Bug 1029969 - Make compositor animation (OMTA) tests ignore floating-point differences; r=dzbarsky

This commit is contained in:
Brian Birtles 2014-06-27 11:28:51 +09:00
parent 33bc59c54c
commit 82f5870f8c
3 changed files with 10 additions and 5 deletions

View File

@ -392,7 +392,7 @@ const ExpectComparisonTo = {
}
};
function matricesRoughlyEqual(a, b, tolerance) {
window.matricesRoughlyEqual = function(a, b, tolerance) {
tolerance = tolerance || 0.00011;
for (var i = 0; i < 4; i++) {
for (var j = 0; j < 4; j++) {
@ -402,7 +402,7 @@ const ExpectComparisonTo = {
}
}
return true;
}
};
// Converts something representing an transform into a 3d matrix in
// column-major order.

View File

@ -1764,7 +1764,10 @@ addAsyncAnimTest(function *() {
// "dynamic rule change test, keyframe style set");
todo_is(csTransform, "matrix(1, 0, 0, 1, -50, 0)",
"dynamic rule change test, keyframe style set");
is(SpecialPowers.DOMWindowUtils.getOMTAStyle(gDiv, "transform"), csTransform,
var brokenOMTATransform = convertTo3dMatrix(
SpecialPowers.DOMWindowUtils.getOMTAStyle(gDiv, "transform"));
var brokenComputedTransform = convertTo3dMatrix(csTransform);
ok(matricesRoughlyEqual(brokenOMTATransform, brokenComputedTransform),
"dynamic rule change test, keyframe style set" +
" - OMTA style is equally as broken as computed style");
dyn2.name = "dyn2";

View File

@ -91,7 +91,8 @@ function testTransform() {
gUtils.advanceTimeAndRefresh(10100);
waitForAllPaints(function() {
var transform = gUtils.getOMTAStyle(target, "transform");
is(transform, "matrix(1, 0, 0, 1, 50, 0)",
ok(matricesRoughlyEqual(convertTo3dMatrix(transform),
convertTo3dMatrix("matrix(1, 0, 0, 1, 50, 0)")),
"transform is set on compositor thread after delayed start");
target.removeAttribute("style");
gUtils.restoreNormalRefresh();
@ -115,7 +116,8 @@ function testBackwardsFill() {
gUtils.advanceTimeAndRefresh(100);
waitForAllPaints(function() {
var transform = gUtils.getOMTAStyle(target, "transform");
is(transform, "matrix(1, 0, 0, 1, 1, 0)",
ok(matricesRoughlyEqual(convertTo3dMatrix(transform),
convertTo3dMatrix("matrix(1, 0, 0, 1, 1, 0)")),
"transform is set on compositor thread after delayed start " +
"with backwards fill");
target.removeAttribute("style");