From 1118a66bfe024e137324075ac4d9433b9425e373 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 31 May 2018 19:26:52 +0000 Subject: Make XFA pixel tests more stable When generating PDFs using the fixup script and a .in, specify them to to use Ahem.ttf as the text font. Ahem is a font designed to reduce flakiness in pixel tests due to font rendering differences between platforms. Specifically the glyphs in the font are standard size black boxes, so though the specific text content cannot be easily compared, things like layout and high level changes to the content can still be tested. Testing things like specific text changes should be done via an embedder test, where the strings in the elements can be extracted and inspected. The font itself is is CID type 2 font, which is relatively complex to correctly embed in a PDF due to subsetting and other features. Instead of embedding it in the generated PDFs, which was originally attempted, it is being supplied to pdfium_test via the --font-dir flag. This flag overrides where the binary looks for system fonts. This works correctly on Mac and Linux, but not on Windows, which is why that platform remains suppressed. BUG=pdfium:1008,pdfium:1020 Change-Id: I00811536de98f736fc599d96b397194ccf8db0cd Reviewed-on: https://pdfium-review.googlesource.com/27790 Commit-Queue: Ryan Harrison Reviewed-by: Lei Zhang --- testing/resources/fonts/Ahem.ttf | Bin 0 -> 21768 bytes .../pixel/xfa_specific/use_ahem/xfa_example.in | 70 ++++++++++++++++ .../use_ahem/xfa_example_expected.pdf.0.png | Bin 0 -> 3700 bytes .../pixel/xfa_specific/use_ahem/xfa_textfield.evt | 8 ++ .../pixel/xfa_specific/use_ahem/xfa_textfield.in | 91 +++++++++++++++++++++ .../use_ahem/xfa_textfield_expected.pdf.0.png | Bin 0 -> 3919 bytes .../resources/pixel/xfa_specific/xfa_example.in | 71 ---------------- .../xfa_specific/xfa_example_expected.pdf.0.png | Bin 5073 -> 0 bytes .../xfa_example_expected_mac.pdf.0.png | Bin 4806 -> 0 bytes .../xfa_example_expected_win.pdf.0.png | Bin 4806 -> 0 bytes .../resources/pixel/xfa_specific/xfa_textfield.evt | 8 -- .../resources/pixel/xfa_specific/xfa_textfield.in | 73 ----------------- .../xfa_specific/xfa_textfield_expected.pdf.0.png | Bin 4510 -> 0 bytes .../xfa_textfield_expected_mac.pdf.0.png | Bin 4496 -> 0 bytes .../xfa_textfield_expected_win.pdf.0.png | Bin 4496 -> 0 bytes 15 files changed, 169 insertions(+), 152 deletions(-) create mode 100644 testing/resources/fonts/Ahem.ttf create mode 100644 testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in create mode 100644 testing/resources/pixel/xfa_specific/use_ahem/xfa_example_expected.pdf.0.png create mode 100644 testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.evt create mode 100644 testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in create mode 100644 testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield_expected.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_example.in delete mode 100644 testing/resources/pixel/xfa_specific/xfa_example_expected.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_example_expected_mac.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_example_expected_win.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_textfield.evt delete mode 100644 testing/resources/pixel/xfa_specific/xfa_textfield.in delete mode 100644 testing/resources/pixel/xfa_specific/xfa_textfield_expected.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_textfield_expected_mac.pdf.0.png delete mode 100644 testing/resources/pixel/xfa_specific/xfa_textfield_expected_win.pdf.0.png (limited to 'testing/resources') diff --git a/testing/resources/fonts/Ahem.ttf b/testing/resources/fonts/Ahem.ttf new file mode 100644 index 0000000000..4d4785a412 Binary files /dev/null and b/testing/resources/fonts/Ahem.ttf differ diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in new file mode 100644 index 0000000000..0e9ac151d5 --- /dev/null +++ b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example.in @@ -0,0 +1,70 @@ +{{header}} + +{{object 1 0}} +<< + /AcroForm 2 0 R + /Extensions << + /ADBE << + /BaseVersion /1.7 + /ExtensionLevel 8 + >> + >> + /NeedsRendering true + /Type /Catalog +>> +endobj + +{{object 2 0}} +<< + /XFA [ + (preamble) + 3 0 R + (config) + 4 0 R + (template) + 5 0 R + (localeSet) + 6 0 R + (postamble) + 7 0 R + ] +>> +endobj + +{{xfapreamble 3 0}} +{{xfaconfig 4 0}} + +{{object 5 0}} +<< + {{streamlen}} +>> +stream + +endstream +endobj + +{{xfalocale 6 0}} + +{{xfapostamble 7 0}} + +{{xref}} +{{trailer}} +{{startxref}} +%%EOF \ No newline at end of file diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_example_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example_expected.pdf.0.png new file mode 100644 index 0000000000..e1e62cce18 Binary files /dev/null and b/testing/resources/pixel/xfa_specific/use_ahem/xfa_example_expected.pdf.0.png differ diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.evt b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.evt new file mode 100644 index 0000000000..1279468006 --- /dev/null +++ b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.evt @@ -0,0 +1,8 @@ +mousedown,left,20,20 +charcode,72 +charcode,101 +charcode,108 +charcode,108 +charcode,111 +charcode,33 +mousedown,left,20,60 diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in new file mode 100644 index 0000000000..218dbcec96 --- /dev/null +++ b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield.in @@ -0,0 +1,91 @@ +{{header}} + +%% Original object ID: 24 0 +{{object 1 0}} +<< + /AcroForm 2 0 R + /Extensions << + /ADBE << + /BaseVersion /1.7 + /ExtensionLevel 8 + >> + >> + /NeedsRendering true + /Type /Catalog +>> +endobj + +%% Original object ID: 32 0 +{{object 2 0}} +<< + /XFA [ + (preamble) + 3 0 R + (config) + 4 0 R + (template) + 5 0 R + (localeSet) + 6 0 R + (postamble) + 7 0 R + ] +>> +endobj + +{{xfapreamble 3 0}} +{{xfaconfig 4 0}} + +{{object 5 0}} +<< + {{streamlen}} +>> +stream + +endstream +endobj + +{{xfalocale 6 0}} + +{{xfapostamble 7 0}} + +{{xref}} +{{trailer}} +{{startxref}} +%%EOF \ No newline at end of file diff --git a/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield_expected.pdf.0.png new file mode 100644 index 0000000000..4d9a934c11 Binary files /dev/null and b/testing/resources/pixel/xfa_specific/use_ahem/xfa_textfield_expected.pdf.0.png differ diff --git a/testing/resources/pixel/xfa_specific/xfa_example.in b/testing/resources/pixel/xfa_specific/xfa_example.in deleted file mode 100644 index d8be96f305..0000000000 --- a/testing/resources/pixel/xfa_specific/xfa_example.in +++ /dev/null @@ -1,71 +0,0 @@ -{{header}} - -%% Original object ID: 24 0 -{{object 1 0}} -<< - /AcroForm 2 0 R - /Extensions << - /ADBE << - /BaseVersion /1.7 - /ExtensionLevel 8 - >> - >> - /NeedsRendering true - /Type /Catalog ->> -endobj - -%% Original object ID: 32 0 -{{object 2 0}} -<< - /XFA [ - (preamble) - 3 0 R - (config) - 4 0 R - (template) - 5 0 R - (localeSet) - 6 0 R - (postamble) - 7 0 R - ] ->> -endobj - -{{xfapreamble 3 0}} -{{xfaconfig 4 0}} - -{{object 5 0}} -<< - {{streamlen}} ->> -stream - -endstream -endobj - -{{xfalocale 6 0}} - -{{xfapostamble 7 0}} - -{{xref}} -{{trailer}} -{{startxref}} -%%EOF \ No newline at end of file diff --git a/testing/resources/pixel/xfa_specific/xfa_example_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_example_expected.pdf.0.png deleted file mode 100644 index 81c317a1e7..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_example_expected.pdf.0.png and /dev/null differ diff --git a/testing/resources/pixel/xfa_specific/xfa_example_expected_mac.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_example_expected_mac.pdf.0.png deleted file mode 100644 index 9a682f7186..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_example_expected_mac.pdf.0.png and /dev/null differ diff --git a/testing/resources/pixel/xfa_specific/xfa_example_expected_win.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_example_expected_win.pdf.0.png deleted file mode 100644 index 9a682f7186..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_example_expected_win.pdf.0.png and /dev/null differ diff --git a/testing/resources/pixel/xfa_specific/xfa_textfield.evt b/testing/resources/pixel/xfa_specific/xfa_textfield.evt deleted file mode 100644 index 3d110568ec..0000000000 --- a/testing/resources/pixel/xfa_specific/xfa_textfield.evt +++ /dev/null @@ -1,8 +0,0 @@ -mousemove,20,20 -mousedown,left,20,20 -charcode,72 -charcode,101 -charcode,108 -charcode,108 -charcode,111 -charcode,33 diff --git a/testing/resources/pixel/xfa_specific/xfa_textfield.in b/testing/resources/pixel/xfa_specific/xfa_textfield.in deleted file mode 100644 index bdd685009f..0000000000 --- a/testing/resources/pixel/xfa_specific/xfa_textfield.in +++ /dev/null @@ -1,73 +0,0 @@ -{{header}} - -%% Original object ID: 24 0 -{{object 1 0}} -<< - /AcroForm 2 0 R - /Extensions << - /ADBE << - /BaseVersion /1.7 - /ExtensionLevel 8 - >> - >> - /NeedsRendering true - /Type /Catalog ->> -endobj - -%% Original object ID: 32 0 -{{object 2 0}} -<< - /XFA [ - (preamble) - 3 0 R - (config) - 4 0 R - (template) - 5 0 R - (localeSet) - 6 0 R - (postamble) - 7 0 R - ] ->> -endobj - -{{xfapreamble 3 0}} -{{xfaconfig 4 0}} - -{{object 5 0}} -<< - {{streamlen}} ->> -stream - -endstream -endobj - -{{xfalocale 6 0}} - -{{xfapostamble 7 0}} - -{{xref}} -{{trailer}} -{{startxref}} -%%EOF \ No newline at end of file diff --git a/testing/resources/pixel/xfa_specific/xfa_textfield_expected.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_textfield_expected.pdf.0.png deleted file mode 100644 index e5ad5012cd..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_textfield_expected.pdf.0.png and /dev/null differ diff --git a/testing/resources/pixel/xfa_specific/xfa_textfield_expected_mac.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_textfield_expected_mac.pdf.0.png deleted file mode 100644 index c4d4ce5a22..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_textfield_expected_mac.pdf.0.png and /dev/null differ diff --git a/testing/resources/pixel/xfa_specific/xfa_textfield_expected_win.pdf.0.png b/testing/resources/pixel/xfa_specific/xfa_textfield_expected_win.pdf.0.png deleted file mode 100644 index c4d4ce5a22..0000000000 Binary files a/testing/resources/pixel/xfa_specific/xfa_textfield_expected_win.pdf.0.png and /dev/null differ -- cgit v1.2.3