Bug 1387894 - Fix animation WPTs r=birtles,jgraham
I believe these intermittents are caused by double imprecision. When unconditional clamping is enabled it gets multiplied out and causes animation.currentTime to occasionally go to 50000.02 which causes the test to fail. We can reduce the precision back down to ignore that. We do so using some WPT overrides. Differential Revision: https://phabricator.services.mozilla.com/D38810
This commit is contained in:
18
testing/web-platform/tests/web-animations/resources/timing-override.js
Executable file
18
testing/web-platform/tests/web-animations/resources/timing-override.js
Executable file
@@ -0,0 +1,18 @@
|
||||
// Firefox implements unconditional clamping of 20 usec; and for certain web-animation tests,
|
||||
// we hit some test failures because the Time Precision is too small. We override these functions
|
||||
// on a per-test basis for Firefox only.
|
||||
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
|
||||
window.assert_times_equal = (actual, expected, description) => {
|
||||
let TIME_PRECISION = 0.02;
|
||||
assert_approx_equals(actual, expected, TIME_PRECISION * 2, description);
|
||||
};
|
||||
|
||||
window.assert_time_equals_literal = (actual, expected, description) => {
|
||||
let TIME_PRECISION = 0.02;
|
||||
if (Math.abs(expected) === Infinity) {
|
||||
assert_equals(actual, expected, description);
|
||||
} else {
|
||||
assert_approx_equals(actual, expected, TIME_PRECISION, description);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<script src="../../resources/timing-override.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
@@ -262,7 +263,7 @@ promise_test(async t => {
|
||||
// calculated using the new playback rate
|
||||
assert_times_equal(anim.startTime,
|
||||
anim.timeline.currentTime - 25 * MS_PER_SEC);
|
||||
assert_time_equals_literal(anim.currentTime, 50 * MS_PER_SEC);
|
||||
assert_time_equals_literal(parseInt(anim.currentTime.toPrecision(5), 10), 50 * MS_PER_SEC);
|
||||
}, 'Setting the start time of a playing animation applies a pending playback rate');
|
||||
|
||||
</script>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../../testcommon.js"></script>
|
||||
<script src="../../resources/timing-override.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user