Use closeTo in overlay tests

Depending on the platform/monitor/mode the css width/height
might be off by 0.5px.

Bug: none
Change-Id: I2e9038ba22a0dd63cd674bfd68571194e47f1759
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4016406
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
This commit is contained in:
Alex Rudenko
2022-11-09 12:50:15 +00:00
committed by Devtools-frontend LUCI CQ
parent 7a4d800cdb
commit 633bba159e
@@ -196,13 +196,13 @@ export function drawGridLineNamesAndAssertLabels(
}
if (expected.type === 'column' && typeof expected.x !== 'undefined') {
assert.strictEqual(
foundLabel.x, expected.x,
assert.closeTo(
foundLabel.x, expected.x, 0.5,
`Expected column line name label ${expected.textContent} to be positioned at ${expected.x}px`);
}
if (expected.type === 'row' && typeof expected.y !== 'undefined') {
assert.strictEqual(
foundLabel.y, expected.y,
assert.closeTo(
foundLabel.y, expected.y, 0.5,
`Expected row line name label ${expected.textContent} to be positioned at ${expected.y}px`);
}
}