Bug 964646 part 18 - Add omta_todo_is for marking OMTA animations that are known to fail; r=dbaron

The implementation here current expects BOTH the following to fail:

- The comparison between the OMTA value and the expected value
- The comparison between the OMTA value and the computed value

This generally tends to be the case since the computed value and expected value
normally match unless we have a bug that affects all CSS animations. If we need
to mark tests where the computed value is also wrong we'll need to modify the
behavior here at that time.

This patch also applies this new function to the author !important test that was
previously commented-out because it currently fails.
This commit is contained in:
Brian Birtles 2014-05-19 14:42:49 +09:00
parent 003951e81b
commit bdc9dbb50b

View File

@ -1533,11 +1533,8 @@ addAsyncTest(function *() {
"transform: translate(200px) ! important;");
yield waitForPaints();
// Bug 847287 - off main thread animations don't cascade correctly
// (todo_is added in subsequent patch)
/*
omta_is("transform", { tx: 200 }, RunningOn.TodoMainThread,
"important author rules override animations");
*/
omta_todo_is("transform", { tx: 200 }, RunningOn.TodoMainThread,
"important author rules override animations");
done_div();
});
@ -1644,11 +1641,24 @@ const RunningOn = {
TodoMainThread: 3
};
const ExpectComparisonTo = {
Pass: 1,
Fail: 2
};
function omta_todo_is(property, expected, runningOn, desc) {
return omta_is_approx(property, expected, runningOn, 0, desc,
ExpectComparisonTo.Fail);
}
function omta_is(property, expected, runningOn, desc) {
return omta_is_approx(property, expected, runningOn, 0, desc);
}
function omta_is_approx(property, expected, runningOn, tolerance, desc) {
// Many callers of this method will pass 'undefined' for
// expectedComparisonResult.
function omta_is_approx(property, expected, runningOn, tolerance, desc,
expectedComparisonResult) {
// Check input
const omtaProperties = [ "transform", "opacity" ];
if (omtaProperties.indexOf(property) === -1) {
@ -1709,15 +1719,19 @@ function omta_is_approx(property, expected, runningOn, tolerance, desc) {
break;
}
var okOrTodo = expectedComparisonResult == ExpectComparisonTo.Fail ?
todo :
ok;
// Compare animated value with expected
var actualValue = normalize(actualStr);
if (actualValue === null) {
ok(false, desc + ": should return a valid result - got " + actualStr);
return;
}
ok(compare(expectedValue, actualValue, tolerance),
desc + " - got " + actualStr + ", expected " +
normalizedToString(expectedValue));
okOrTodo(compare(expectedValue, actualValue, tolerance),
desc + " - got " + actualStr + ", expected " +
normalizedToString(expectedValue));
// For compositor animations do an additional check that they match
// the value calculated on the main thread
@ -1728,9 +1742,9 @@ function omta_is_approx(property, expected, runningOn, tolerance, desc) {
" - got " + computedStr);
return;
}
ok(compare(computedValue, actualValue, 0),
desc + ": OMTA style and computed style should be equal" +
" - OMTA " + actualStr + ", computed " + computedStr);
okOrTodo(compare(computedValue, actualValue, 0),
desc + ": OMTA style and computed style should be equal" +
" - OMTA " + actualStr + ", computed " + computedStr);
}
}