summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-06-26 11:45:06 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-26 16:23:13 +0000
commitc4479c5d68e91a1b0a8d610ba1063aff7c27f5de (patch)
treee1b1f4a5f1bdd0ece71b544f70d13d00690c5cf3
parentb9776c71718bba353225e6a2010cf0ab1e926658 (diff)
downloadpdfium-c4479c5d68e91a1b0a8d610ba1063aff7c27f5de.tar.xz
Add presubmit check for png files
This CL adds a presubmit check for png files so that they are in the form _expected{,_mac,_win}.pdf.BLA.png and updates the corpus test repository hash. Change-Id: I5397a091b77a339eba7d370b291b7a6e61754744 Reviewed-on: https://pdfium-review.googlesource.com/6951 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
-rw-r--r--DEPS2
-rw-r--r--PRESUBMIT.py18
-rw-r--r--testing/SUPPRESSIONS6
3 files changed, 23 insertions, 3 deletions
diff --git a/DEPS b/DEPS
index a418c66247..e8d020975a 100644
--- a/DEPS
+++ b/DEPS
@@ -19,7 +19,7 @@ vars = {
'jinja2_revision': 'd34383206fa42d52faa10bb9931d6d538f3a57e0',
'jpeg_turbo_revision': '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
'markupsafe_revision': '8f45f5cfa0009d2a70589bcda0349b8cb2b72783',
- 'pdfium_tests_revision': 'f1ccbbfbc586e0ead482d286946d2f085503782f',
+ 'pdfium_tests_revision': 'b56d3ca8b0af647ef73814543ee69b6161e7af08',
'skia_revision': 'bb581ce30f55360fd3a12e7f5aa1fe324b16d085',
'tools_memory_revision': '427f10475e1a8d72424c29d00bf689122b738e5d',
'trace_event_revision': '06294c8a4a6f744ef284cd63cfe54dbf61eea290',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 26d559a33f..e8d8458ec0 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -267,7 +267,7 @@ def _CheckTestDuplicates(input_api, output_api):
end_len = 4
else:
continue
- path = f.LocalPath()[:-end_len];
+ path = f.LocalPath()[:-end_len]
if path in tests_added:
results.append(output_api.PresubmitError(
'Remove %s to prevent shadowing %s' % (path + '.pdf',
@@ -276,6 +276,21 @@ def _CheckTestDuplicates(input_api, output_api):
tests_added.append(path)
return results
+def _CheckPNGFormat(input_api, output_api):
+ """Checks that .png files have a format that will be considered valid by our
+ test runners. If a file ends with .png, then it must be of the form
+ NAME_expected{,mac,win}.pdf.#.png"""
+ expected_pattern = input_api.re.compile(
+ r'.*_expected(_(mac|win))?\.pdf\..*\.png')
+ results = []
+ for f in input_api.AffectedFiles():
+ if not f.LocalPath().endswith('.png'):
+ continue
+ if expected_pattern.match(f.LocalPath()):
+ continue
+ results.append(output_api.PresubmitError(
+ 'PNG file %s does not have the correct format' % f.LocalPath()))
+ return results
def CheckChangeOnUpload(input_api, output_api):
results = []
@@ -285,5 +300,6 @@ def CheckChangeOnUpload(input_api, output_api):
input_api, output_api, None, LINT_FILTERS)
results += _CheckIncludeOrder(input_api, output_api)
results += _CheckTestDuplicates(input_api, output_api)
+ results += _CheckPNGFormat(input_api, output_api)
return results
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 1ae961384f..309ab21f2c 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -296,8 +296,12 @@ bug_679642.in * * noxfa
Choose.pdf * * *
data_binding.pdf * * *
Date_FormCale.pdf * * *
+# TODO(npm): Add proper evt for MouseEvents.
+MouseEvents_enter.pdf * * *
+MouseEvents_exit.pdf * * *
+Oneof3.pdf * * *
Sum.pdf * * *
TimeField.pdf win,linux * *
Test_CheckBox.pdf * * *
Test_DateField_locale_zh_HK.pdf mac,win * *
-Oneof3.pdf * * *
+