summaryrefslogtreecommitdiff
path: root/testing/embedder_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'testing/embedder_test.cpp')
-rw-r--r--testing/embedder_test.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index bf00c11607..6cea598400 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -326,6 +326,15 @@ FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info,
page_index);
}
+std::string EmbedderTest::HashBitmap(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height) {
+ uint8_t digest[16];
+ CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
+ expected_width * 4 * expected_height, digest);
+ return CryptToBase16(digest);
+}
+
// static
void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
int expected_width,
@@ -339,10 +348,8 @@ void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
if (!expected_md5sum)
return;
- uint8_t digest[16];
- CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
- expected_stride * expected_height, digest);
- EXPECT_EQ(expected_md5sum, CryptToBase16(digest));
+ EXPECT_EQ(expected_md5sum,
+ HashBitmap(bitmap, expected_width, expected_height));
}
// Can't use gtest-provided main since we need to stash the path to the