Add 2% tolerance to vector rendering tests
This commit is contained in:
@@ -23,4 +23,7 @@ new Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
render({message: 'Vector tile layer renders'});
|
render({
|
||||||
|
message: 'Vector tile layer renders',
|
||||||
|
tolerance: 0.02
|
||||||
|
});
|
||||||
|
|||||||
@@ -67,4 +67,4 @@ new Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
render();
|
render({tolerance: 0.02});
|
||||||
|
|||||||
+11
-5
@@ -182,24 +182,30 @@ async function copyActualToExpected(entry) {
|
|||||||
async function renderEach(page, entries, options) {
|
async function renderEach(page, entries, options) {
|
||||||
let fail = false;
|
let fail = false;
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
const config = await renderPage(page, entry, options);
|
const {tolerance = 0, message = ''} = await renderPage(page, entry, options);
|
||||||
const message = config.message !== undefined ? config.message : entry;
|
|
||||||
const tolerance = config.tolerance !== undefined ? config.tolerance : 0;
|
|
||||||
if (options.fix) {
|
if (options.fix) {
|
||||||
await copyActualToExpected(entry);
|
await copyActualToExpected(entry);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {error, mismatch} = await getScreenshotsMismatch(entry);
|
const {error, mismatch} = await getScreenshotsMismatch(entry);
|
||||||
if (error) {
|
if (error) {
|
||||||
options.log.error(error);
|
options.log.error(error);
|
||||||
fail = true;
|
fail = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let detail = `case ${entry}`;
|
||||||
|
if (message) {
|
||||||
|
detail = `${detail} (${message})`;
|
||||||
|
}
|
||||||
|
|
||||||
if (mismatch > tolerance) {
|
if (mismatch > tolerance) {
|
||||||
options.log.error(`checking '${message}': mismatch ${mismatch.toFixed(3)}`);
|
options.log.error(`${detail}': mismatch ${mismatch.toFixed(3)}`);
|
||||||
fail = true;
|
fail = true;
|
||||||
} else {
|
} else {
|
||||||
options.log.info(`checking '${message}': ok`);
|
options.log.info(`${detail}': ok`);
|
||||||
await touch(getPassFilePath(entry));
|
await touch(getPassFilePath(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user