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.
This commit is contained in:
parent
60efae96fd
commit
188752e5f0
@ -37,6 +37,8 @@ const WORKER_SRC = "../build/generic/build/pdf.worker.js";
|
|||||||
const RENDER_TASK_ON_CONTINUE_DELAY = 5; // ms
|
const RENDER_TASK_ON_CONTINUE_DELAY = 5; // ms
|
||||||
const SVG_NS = "http://www.w3.org/2000/svg";
|
const SVG_NS = "http://www.w3.org/2000/svg";
|
||||||
|
|
||||||
|
const md5FileMap = new Map();
|
||||||
|
|
||||||
function loadStyles(styles) {
|
function loadStyles(styles) {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
@ -431,6 +433,19 @@ class Driver {
|
|||||||
task.stats = { times: [] };
|
task.stats = { times: [] };
|
||||||
task.enableXfa = task.enableXfa === true;
|
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
|
// Support *linked* test-cases for the other suites, e.g. unit- and
|
||||||
// integration-tests, without needing to run them as reference-tests.
|
// integration-tests, without needing to run them as reference-tests.
|
||||||
if (task.type === "other") {
|
if (task.type === "other") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user