зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1379808 - Intermittent browser_test_zoom_text.js failure, wrong height and y, r=eeejay
This commit is contained in:
Родитель
9a42394a1f
Коммит
3f0bbfed64
|
@ -8,4 +8,3 @@ support-files =
|
|||
|
||||
[browser_test_zoom.js]
|
||||
[browser_test_zoom_text.js]
|
||||
skip-if = true # Bug 1372296, Bug 1379808, Bug 1391453
|
||||
|
|
|
@ -191,6 +191,19 @@ function isObject(aObj, aExpectedObj, aMsg) {
|
|||
"', expected '" + prettyName(aExpectedObj) + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
* is() function checking the expected value is within the range.
|
||||
*/
|
||||
function isWithin(aExpected, aGot, aWithin, aMsg)
|
||||
{
|
||||
if (Math.abs(aGot - aExpected) <= aWithin) {
|
||||
ok(true, `${aMsg} - Got ${aGot}`);
|
||||
} else {
|
||||
ok(false,
|
||||
`${aMsg} - Got ${aGot}, expected ${aExpected} with error of ${aWithin}`);
|
||||
}
|
||||
}
|
||||
|
||||
// //////////////////////////////////////////////////////////////////////////////
|
||||
// Helpers for getting DOM node/accessible
|
||||
|
||||
|
|
|
@ -150,13 +150,18 @@ function testTextBounds(aID, aStartOffset, aEndOffset, aRect, aCoordOrigin) {
|
|||
var hyperText = getAccessible(aID, [nsIAccessibleText]);
|
||||
hyperText.getRangeExtents(aStartOffset, aEndOffset,
|
||||
xObj, yObj, widthObj, heightObj, aCoordOrigin);
|
||||
|
||||
// x
|
||||
is(xObj.value, expectedX,
|
||||
"Wrong x coordinate of text between offsets (" + aStartOffset + ", " +
|
||||
aEndOffset + ") for " + prettyName(aID));
|
||||
is(yObj.value, expectedY,
|
||||
"Wrong y coordinate of text between offsets (" + aStartOffset + ", " +
|
||||
aEndOffset + ") for " + prettyName(aID));
|
||||
|
||||
// y
|
||||
isWithin(yObj.value, expectedY, 1,
|
||||
`y coord of text between offsets (${aStartOffset}, ${aEndOffset}) ` +
|
||||
`for ${prettyName(aID)}`);
|
||||
|
||||
// Width
|
||||
var msg = "Wrong width of text between offsets (" + aStartOffset + ", " +
|
||||
aEndOffset + ") for " + prettyName(aID);
|
||||
if (widthObj.value == expectedWidth)
|
||||
|
@ -164,9 +169,10 @@ function testTextBounds(aID, aStartOffset, aEndOffset, aRect, aCoordOrigin) {
|
|||
else
|
||||
todo(false, msg); // fails on some windows machines
|
||||
|
||||
is(heightObj.value, expectedHeight,
|
||||
"Wrong height of text between offsets (" + aStartOffset + ", " +
|
||||
aEndOffset + ") for " + prettyName(aID));
|
||||
// Height
|
||||
isWithin(heightObj.value, expectedHeight, 1,
|
||||
`height of text between offsets (${aStartOffset}, ${aEndOffset}) ` +
|
||||
`for ${prettyName(aID)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче