From 60efae96fd126a3668674d952203da2c3eee1785 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 8 Feb 2022 14:05:53 +0100 Subject: [PATCH 1/2] Update the file used with the `xfa_bug1720182` test-case The file used in this test-case is *identical* to, i.e. the md5 entry perfectly matches, the file used with the `xfa_bug1716380` test-case. While it's obviously fine to use the same PDF document in different reference-tests, note how we e.g. have both `eq` and `text` tests for one document, we should always avoid adding *duplicate* files in the `test/pdfs/` folder. --- test/pdfs/xfa_bug1720182.pdf.link | 1 - test/test_manifest.json | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 test/pdfs/xfa_bug1720182.pdf.link diff --git a/test/pdfs/xfa_bug1720182.pdf.link b/test/pdfs/xfa_bug1720182.pdf.link deleted file mode 100644 index c5854fa7f..000000000 --- a/test/pdfs/xfa_bug1720182.pdf.link +++ /dev/null @@ -1 +0,0 @@ -https://bugzilla.mozilla.org/attachment.cgi?id=9230780 diff --git a/test/test_manifest.json b/test/test_manifest.json index 38c3eee19..3a9da2743 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1157,7 +1157,7 @@ "type": "eq" }, { "id": "xfa_bug1720182", - "file": "pdfs/xfa_bug1720182.pdf", + "file": "pdfs/xfa_bug1716380.pdf", "md5": "1351f816f0509fe750ca61ef2bd40872", "link": true, "rounds": 1, @@ -1174,7 +1174,8 @@ "ComplainantLastname2711": { "value": "Bar" } - } + }, + "about": "This *intentionally* uses the same file as test-case xfa_bug1716380." }, { "id": "bug1720411", "file": "pdfs/bug1720411.pdf", From 188752e5f03f259d4781b0b4da2fbd5b32bdde1c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 8 Feb 2022 16:59:18 +0100 Subject: [PATCH 2/2] Update the test `Driver` to fail on duplicate files While it's obviously fine to use the same PDF document in different reference-tests, note how we e.g. have both `eq` and `text` tests for one document, we should always avoid adding *duplicate* files in the `test/pdfs/` folder. --- test/driver.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/driver.js b/test/driver.js index e92bf829d..6805017d8 100644 --- a/test/driver.js +++ b/test/driver.js @@ -37,6 +37,8 @@ const WORKER_SRC = "../build/generic/build/pdf.worker.js"; const RENDER_TASK_ON_CONTINUE_DELAY = 5; // ms const SVG_NS = "http://www.w3.org/2000/svg"; +const md5FileMap = new Map(); + function loadStyles(styles) { const promises = []; @@ -431,6 +433,19 @@ class Driver { task.stats = { times: [] }; task.enableXfa = task.enableXfa === true; + const prevFile = md5FileMap.get(task.md5); + if (prevFile) { + if (task.file !== prevFile) { + this._nextPage( + task, + `The "${task.file}" file is identical to the previously used "${prevFile}" file.` + ); + return; + } + } else { + md5FileMap.set(task.md5, task.file); + } + // Support *linked* test-cases for the other suites, e.g. unit- and // integration-tests, without needing to run them as reference-tests. if (task.type === "other") {