diff options
author | Lei Zhang <thestig@chromium.org> | 2018-02-09 21:48:15 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-09 21:48:15 +0000 |
commit | 107fa7b06773a2b3e83fc360125d54105574f9bf (patch) | |
tree | 760d8dafa3368cae3be175cb4c55173a7b6f5a85 /fpdfsdk/fpdfppo_embeddertest.cpp | |
parent | 0acd92b3b72a3111e566c1321afacfc78d27848e (diff) | |
download | pdfium-107fa7b06773a2b3e83fc360125d54105574f9bf.tar.xz |
Get rid of EmbedderTest::RenderPageDeprecated().
Change-Id: I8c6d813e488b2612a85fb1973382f979728df563
Reviewed-on: https://pdfium-review.googlesource.com/25571
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfppo_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdfppo_embeddertest.cpp | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/fpdfsdk/fpdfppo_embeddertest.cpp b/fpdfsdk/fpdfppo_embeddertest.cpp index 4e7b2ae82e..f62ca52048 100644 --- a/fpdfsdk/fpdfppo_embeddertest.cpp +++ b/fpdfsdk/fpdfppo_embeddertest.cpp @@ -215,17 +215,15 @@ TEST_F(FPDFPPOEmbeddertest, BUG_750568) { for (size_t i = 0; i < 4; ++i) { FPDF_PAGE page = LoadPage(i); - ASSERT_NE(nullptr, page); + ASSERT_TRUE(page); - FPDF_BITMAP bitmap = RenderPageDeprecated(page); - ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap)); - ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap)); - ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap)); + std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap.get())); + ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap.get())); + ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap.get())); - std::string digest = HashBitmap(bitmap); - FPDFBitmap_Destroy(bitmap); + EXPECT_EQ(kHashes[i], HashBitmap(bitmap.get())); UnloadPage(page); - EXPECT_EQ(kHashes[i], digest); } FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument(); @@ -234,17 +232,16 @@ TEST_F(FPDFPPOEmbeddertest, BUG_750568) { ASSERT_EQ(4, FPDF_GetPageCount(output_doc)); for (size_t i = 0; i < 4; ++i) { FPDF_PAGE page = FPDF_LoadPage(output_doc, i); - ASSERT_NE(nullptr, page); + ASSERT_TRUE(page); - FPDF_BITMAP bitmap = RenderPageDeprecated(page); - ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap)); - ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap)); - ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap)); + std::unique_ptr<void, FPDFBitmapDeleter> bitmap = + RenderPageWithFlags(page, nullptr, 0); + ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap.get())); + ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap.get())); + ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap.get())); - std::string digest = HashBitmap(bitmap); - FPDFBitmap_Destroy(bitmap); + EXPECT_EQ(kHashes[i], HashBitmap(bitmap.get())); FPDF_ClosePage(page); - EXPECT_EQ(kHashes[i], digest); } FPDF_CloseDocument(output_doc); } @@ -252,15 +249,14 @@ TEST_F(FPDFPPOEmbeddertest, BUG_750568) { TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) { EXPECT_TRUE(OpenDocument("zero_length_stream.pdf")); FPDF_PAGE page = LoadPage(0); - ASSERT_NE(nullptr, page); + ASSERT_TRUE(page); - FPDF_BITMAP bitmap = RenderPageDeprecated(page); - ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap)); - ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap)); - ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap)); + std::unique_ptr<void, FPDFBitmapDeleter> bitmap = RenderLoadedPage(page); + ASSERT_EQ(200, FPDFBitmap_GetWidth(bitmap.get())); + ASSERT_EQ(200, FPDFBitmap_GetHeight(bitmap.get())); + ASSERT_EQ(800, FPDFBitmap_GetStride(bitmap.get())); - std::string digest = HashBitmap(bitmap); - FPDFBitmap_Destroy(bitmap); + std::string digest = HashBitmap(bitmap.get()); UnloadPage(page); FPDF_DOCUMENT new_doc = FPDF_CreateNewDocument(); @@ -270,15 +266,13 @@ TEST_F(FPDFPPOEmbeddertest, ImportWithZeroLengthStream) { EXPECT_EQ(1, FPDF_GetPageCount(new_doc)); FPDF_PAGE new_page = FPDF_LoadPage(new_doc, 0); ASSERT_NE(nullptr, new_page); - FPDF_BITMAP new_bitmap = RenderPageDeprecated(new_page); - ASSERT_EQ(200, FPDFBitmap_GetWidth(new_bitmap)); - ASSERT_EQ(200, FPDFBitmap_GetHeight(new_bitmap)); - ASSERT_EQ(800, FPDFBitmap_GetStride(new_bitmap)); + std::unique_ptr<void, FPDFBitmapDeleter> new_bitmap = + RenderPageWithFlags(new_page, nullptr, 0); + ASSERT_EQ(200, FPDFBitmap_GetWidth(new_bitmap.get())); + ASSERT_EQ(200, FPDFBitmap_GetHeight(new_bitmap.get())); + ASSERT_EQ(800, FPDFBitmap_GetStride(new_bitmap.get())); - std::string new_digest = HashBitmap(new_bitmap); - FPDFBitmap_Destroy(new_bitmap); + EXPECT_EQ(digest, HashBitmap(new_bitmap.get())); FPDF_ClosePage(new_page); FPDF_CloseDocument(new_doc); - - EXPECT_EQ(digest, new_digest); } |