summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-22 11:04:35 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-22 15:35:34 +0000
commit5bcd9a32232e8cd5df918104eb131be76f833701 (patch)
tree08db8fc6fbe874ac106d72457279cea2cc3aed0d
parent742fa8c3b39f0e3713c3450b1f9979174fbb4c8f (diff)
downloadpdfium-5bcd9a32232e8cd5df918104eb131be76f833701.tar.xz
Fix Mac tests on 10.12
md5's with text are changed, so need to allow both the previous and the new one. Pixel tests with text also fail on 10.12, so suppressing those. Found many unexpected successes, so will unsuppress those once all bots are 10.12 BUG=chromium:703912 Change-Id: I6b34aa2f581eb8ea705f3876960b49c89e249347 Reviewed-on: https://pdfium-review.googlesource.com/3144 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
-rw-r--r--fpdfsdk/fpdfedit_embeddertest.cpp16
-rw-r--r--testing/SUPPRESSIONS11
-rw-r--r--testing/embedder_test.cpp22
-rw-r--r--testing/embedder_test.h12
4 files changed, 55 insertions, 6 deletions
diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp
index 6d928597ff..19bdaf57ee 100644
--- a/fpdfsdk/fpdfedit_embeddertest.cpp
+++ b/fpdfsdk/fpdfedit_embeddertest.cpp
@@ -365,10 +365,12 @@ TEST_F(FPDFEditEmbeddertest, PathOnTopOfText) {
FPDF_BITMAP bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5[] = "2f7c0deee10a9490538e195af64beb67";
+ const char new_md5[] = "f9e6fa74230f234286bfcada9f7606d8";
+ CompareBitmap2Options(bitmap, 200, 200, md5, new_md5);
#else
const char md5[] = "17c942c76ff229200f2c98073bb60d85";
-#endif
CompareBitmap(bitmap, 200, 200, md5);
+#endif
FPDFBitmap_Destroy(bitmap);
UnloadPage(page);
}
@@ -436,10 +438,12 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
FPDF_BITMAP page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5[] = "e19c90395d73cb9f37a6c3b0e8b18a9e";
+ const char new_md5[] = "a4dddc1a3930fa694bbff9789dab4161";
+ CompareBitmap2Options(page_bitmap, 612, 792, md5, new_md5);
#else
const char md5[] = "7c3a36ba7cec01688a16a14bfed9ecfc";
-#endif
CompareBitmap(page_bitmap, 612, 792, md5);
+#endif
FPDFBitmap_Destroy(page_bitmap);
// Try another font
@@ -453,10 +457,12 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5_2[] = "8e1c43dca6be68d364dbc283f5521041";
+ const char new_md5_2[] = "a5c4ace4c6f27644094813fe1441a21c";
+ CompareBitmap2Options(page_bitmap, 612, 792, md5_2, new_md5_2);
#else
const char md5_2[] = "e0e0873e3a2634a6394a431a51ce90ff";
-#endif
CompareBitmap(page_bitmap, 612, 792, md5_2);
+#endif
FPDFBitmap_Destroy(page_bitmap);
// And some randomly transformed text
@@ -470,10 +476,12 @@ TEST_F(FPDFEditEmbeddertest, AddStandardFontText) {
page_bitmap = RenderPage(page);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
const char md5_3[] = "c6e5df448428793c7e4b0c820bd8c85e";
+ const char new_md5_3[] = "40b3ef04f915ff4c4208948001763544";
+ CompareBitmap2Options(page_bitmap, 612, 792, md5_3, new_md5_3);
#else
const char md5_3[] = "903ee10b6a9f0be51ecad0a1a0eeb171";
-#endif
CompareBitmap(page_bitmap, 612, 792, md5_3);
+#endif
FPDFBitmap_Destroy(page_bitmap);
// TODO(npm): Why are there issues with text rotated by 90 degrees?
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index fd228f1b17..82b4af28aa 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -21,11 +21,22 @@
#
# Pixel tests
#
+# TODO(npm): Unsupress mac pixel tests
+bug_524043_1.in mac * *
+bug_524043_2.in mac * *
+bug_524043_3.in mac * *
+bug_524043_4.in mac * *
+bug_524043_5.in mac * *
+bug_524043_7.in mac * *
+bug_543018_1.in mac * *
+bug_543018_2.in mac * *
+bug_551258_1.in mac * *
font_size.in mac * *
#
# Corpus tests
#
+# TODO(npm): remove mac unexpected successes from suppressions
050_extra_m.pdf mac,win * *
12.pdf mac * *
1_10_watermark.pdf * * *
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 79074153fb..5d906fe503 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -355,6 +355,28 @@ void EmbedderTest::CompareBitmap(FPDF_BITMAP bitmap,
EXPECT_EQ(expected_md5sum, CRYPT_ToBase16(digest));
}
+// static
+void EmbedderTest::CompareBitmap2Options(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height,
+ const char* option1_md5sum,
+ const char* option2_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));
+
+ if (!option1_md5sum || !option2_md5sum)
+ return;
+
+ uint8_t digest[16];
+ CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
+ expected_stride * expected_height, digest);
+ std::string digest_string = CRYPT_ToBase16(digest);
+ EXPECT_TRUE(digest_string == option1_md5sum ||
+ digest_string == option2_md5sum);
+}
+
// 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) {
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index cc0caec8f6..f341acf688 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -105,14 +105,22 @@ class EmbedderTest : public ::testing::Test,
// is prohibited after this call is made.
virtual void UnloadPage(FPDF_PAGE page);
+ protected:
+ void SetupFormFillEnvironment();
+
// Check |bitmap| to make sure it has the right dimensions and content.
static void CompareBitmap(FPDF_BITMAP bitmap,
int expected_width,
int expected_height,
const char* expected_md5sum);
- protected:
- void SetupFormFillEnvironment();
+ // Check |bitmap| to make sure it has the right dimensions and content.
+ // Have two options for the expected md5 sum.
+ static void CompareBitmap2Options(FPDF_BITMAP bitmap,
+ int expected_width,
+ int expected_height,
+ const char* option1_md5sum,
+ const char* option2_md5sum);
Delegate* delegate_;
std::unique_ptr<Delegate> default_delegate_;