Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: testing/embedder_test.cpp

Issue 2514173002: Check dimensions and content of bitmaps in EmbedderTests. (Closed)
Patch Set: Fix Mac bots, but will other Macs be happy? Probably. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/embedder_test.cpp
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index c23b5c8018d78c4bdf1a88b0d0726c4b0ca62b3c..5fd540893c3501658999491e30c5d640543e5be0 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -17,6 +17,7 @@
#include "public/fpdfview.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/test_support.h"
+#include "testing/utils/md5.h"
#include "testing/utils/path_service.h"
#ifdef PDF_ENABLE_V8
@@ -323,6 +324,20 @@ FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info,
page_index);
}
+// static
+void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height,
+ const char* expected_md5sum) {
+ ASSERT_EQ(expected_width, FPDFBitmap_GetWidth(bitmap));
+ ASSERT_EQ(expected_height, FPDFBitmap_GetHeight(bitmap));
+ const int expected_stride = expected_width * 4;
+ ASSERT_EQ(expected_stride, FPDFBitmap_GetStride(bitmap));
+ EXPECT_EQ(expected_md5sum,
+ pdfium::MD5String(FPDFBitmap_GetBuffer(bitmap),
+ expected_stride * expected_height));
+}
+
// Can't use gtest-provided main since we need to stash the path to the
// executable in order to find the external V8 binary data files.
int main(int argc, char** argv) {

Powered by Google App Engine
This is Rietveld 408576698