diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2017-11-10 22:40:44 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-10 22:40:44 +0000 |
commit | 9fa5036245c34ce8c420531c5b02e699a861bc18 (patch) | |
tree | 41030e8cd39e5c06e75b2c6fd17513e0a5ae92fe /testing/embedder_test.cpp | |
parent | 6e4656f88fba94f706e0e42d1b548e28f6645594 (diff) | |
download | pdfium-9fa5036245c34ce8c420531c5b02e699a861bc18.tar.xz |
Add FPDFSaveEmbedderTest.SaveLinearizedDocchromium/3267chromium/3266
Bug: pdfium:614
Change-Id: I3c6cd16dfe0ac5db66cc9e996d3f4e74a5d9d716
Reviewed-on: https://pdfium-review.googlesource.com/18251
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'testing/embedder_test.cpp')
-rw-r--r-- | testing/embedder_test.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp index 36ee08f85d..bb202bff1c 100644 --- a/testing/embedder_test.cpp +++ b/testing/embedder_test.cpp @@ -106,6 +106,8 @@ void EmbedderTest::SetUp() { info->version = 1; info->FSDK_UnSupport_Handler = UnsupportedHandlerTrampoline; FSDK_SetUnSpObjProcessHandler(info); + + m_SavedDocument = nullptr; } void EmbedderTest::TearDown() { @@ -347,6 +349,10 @@ FPDF_PAGE EmbedderTest::LoadSavedPage(int page_number) { return page; } +FPDF_BITMAP EmbedderTest::RenderSavedPage(FPDF_PAGE page) { + return RenderPageWithFlags(page, m_SavedForm, 0); +} + void EmbedderTest::CloseSavedPage(FPDF_PAGE page) { ASSERT(page); FPDF_ClosePage(page); @@ -424,14 +430,14 @@ FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info, page_index); } -std::string EmbedderTest::HashBitmap(FPDF_BITMAP bitmap, - int expected_width, - int expected_height) { +// static +std::string EmbedderTest::HashBitmap(FPDF_BITMAP bitmap) { uint8_t digest[16]; - CRYPT_MD5Generate( - static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)), - expected_width * GetBitmapBytesPerPixel(bitmap) * expected_height, - digest); + CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)), + FPDFBitmap_GetWidth(bitmap) * + GetBitmapBytesPerPixel(bitmap) * + FPDFBitmap_GetHeight(bitmap), + digest); return CryptToBase16(digest); } @@ -452,8 +458,7 @@ void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap, if (!expected_md5sum) return; - EXPECT_EQ(expected_md5sum, - HashBitmap(bitmap, expected_width, expected_height)); + EXPECT_EQ(expected_md5sum, HashBitmap(bitmap)); } // static |