Bug 1478643 - Add test cases checking finished opacity animation on the compositor. r=birtles

All test cases here pass without any changes on the current trunk, but all
counter part test cases for transform introducing in a subsequent patch will
fail without the proper fix.

MozReview-Commit-ID: 3hgsVfFJPrZ

--HG--
extra : rebase_source : 535b74c6ddb070af1b1803d966a94bf7ae7bd37d
This commit is contained in:
Hiroyuki Ikezoe 2018-07-30 10:44:47 +09:00
Родитель ec94f36a20
Коммит 0637266108
2 изменённых файлов: 82 добавлений и 0 удалений

Просмотреть файл

@ -60,6 +60,8 @@ skip-if = (toolkit == 'android' && debug) || (os == 'win' && bits == 64) # Bug 1
[mozilla/test_restyles.html]
[mozilla/test_restyling_xhr_doc.html]
[mozilla/test_set_easing.html]
[mozilla/test_style_after_finished_on_compositor.html]
skip-if = webrender # bug 1479133
[mozilla/test_transform_limits.html]
[mozilla/test_transition_finish_on_compositor.html]
skip-if = toolkit == 'android'

Просмотреть файл

@ -0,0 +1,80 @@
<!doctype html>
<head>
<meta charset=utf-8>
<title>Test for styles after finished on the compositor</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
<style>
.compositor {
/* Element needs geometry to be eligible for layerization */
width: 100px;
height: 100px;
background-color: green;
}
</style>
</head>
<body>
<div id="log"></div>
<script>
"use strict";
promise_test(async t => {
const div = addDiv(t, { 'class': 'compositor' });
const anim = div.animate([ { offset: 0, opacity: 1 },
{ offset: 1, opacity: 0 } ],
{ delay: 10,
duration: 100 });
await anim.finished;
await waitForNextFrame();
const opacity = SpecialPowers.DOMWindowUtils.getOMTAStyle(div, 'opacity');
assert_equals(opacity, '', 'No opacity animation runs on the compositor');
}, 'Opacity animation with positive delay is removed from compositor when ' +
'finished');
promise_test(async t => {
const div = addDiv(t, { 'class': 'compositor' });
const anim = div.animate([ { offset: 0, opacity: 1 },
{ offset: 0.9, opacity: 1 },
{ offset: 1, opacity: 0 } ],
{ duration: 100 });
await anim.finished;
await waitForNextFrame();
const opacity = SpecialPowers.DOMWindowUtils.getOMTAStyle(div, 'opacity');
assert_equals(opacity, '', 'No opacity animation runs on the compositor');
}, 'Opacity animation initially opacity: 1 is removed from compositor when ' +
'finished');
promise_test(async t => {
const div = addDiv(t, { 'class': 'compositor' });
const anim = div.animate([ { offset: 0, opacity: 0 },
{ offset: 0.5, opacity: 1 },
{ offset: 0.51, opacity: 1 },
{ offset: 1, opacity: 0 } ],
{ delay: 10, duration: 100 });
await waitForAnimationFrames(2);
// Setting the current time at the offset generating opacity: 1.
anim.currentTime = 60;
await anim.finished;
await waitForNextFrame();
const opacity = SpecialPowers.DOMWindowUtils.getOMTAStyle(div, 'opacity');
assert_equals(opacity, '', 'No opacity animation runs on the compositor');
}, 'Opacity animation is removed from compositor even when it only visits ' +
'exactly the point where the opacity: 1 value was set');
</script>
</body>