Skip to content
Snippets Groups Projects
Commit f7f07ef6 authored by Pierre Paridans's avatar Pierre Paridans
Browse files

[FIX] web: test breaking in newer Chrome due to rounding issue


Since (at least) Chrome 94+, some element's sizing computation returns a
slightly different value (in the order of a fraction of a pixel). Sadly,
due to rounding, this difference has an impact on exact sizing assertion
(specifically in the list view column sizing tests).

As the difference is *really* small, introducing a margin of error (i.e.
<= 1px) looks reasonnable ; as implemented in this commit.

closes odoo/odoo#92203

Forward-port-of: odoo/odoo#92066
X-original-commit: 5f035381
Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
Signed-off-by: default avatarPierre Paridans (app) <app@odoo.com>
parent e5e997ea
Branches
Tags
No related merge requests found
......@@ -2938,8 +2938,8 @@ QUnit.module('Views', {
 
assert.strictEqual(list.$('table').width(), list.$('.o_list_view').width());
const largeCells = list.$('.o_data_cell.large');
assert.strictEqual(largeCells[0].offsetWidth, largeCells[1].offsetWidth);
assert.strictEqual(largeCells[1].offsetWidth, largeCells[2].offsetWidth);
assert.ok(Math.abs(largeCells[0].offsetWidth - largeCells[1].offsetWidth) <= 1);
assert.ok(Math.abs(largeCells[1].offsetWidth - largeCells[2].offsetWidth) <= 1);
assert.ok(list.$('.o_data_cell:not(.large)')[0].offsetWidth < largeCells[0].offsetWidth);
 
list.destroy();
......@@ -3430,7 +3430,7 @@ QUnit.module('Views', {
const text = list.el.querySelector('th[data-name="text"]');
const textWidth = Math.ceil(text.getBoundingClientRect().width);
 
assert.strictEqual(fooWidth, textWidth, "both columns should have been given the same width");
assert.ok(Math.abs(fooWidth - textWidth) <= 1, "both columns should have been given the same width");
 
const firstRowHeight = list.$('.o_data_row:nth(0)')[0].offsetHeight;
const secondRowHeight = list.$('.o_data_row:nth(1)')[0].offsetHeight;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment