From 81ab847386857926542dd9ee9cd899bc469f2ac0 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 31 Mar 2015 15:05:54 -0700 Subject: [PATCH] Bug 847287 patch 1 - Add additional tests. r=birtles All of the todos will be fixed by later patches in this bug (as will some already-existing todos in the same file). --- layout/style/test/test_animations_omta.html | 105 ++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/layout/style/test/test_animations_omta.html b/layout/style/test/test_animations_omta.html index 686c93769f8b..50615a0ebf48 100644 --- a/layout/style/test/test_animations_omta.html +++ b/layout/style/test/test_animations_omta.html @@ -2163,5 +2163,110 @@ addAsyncAnimTest(function *() { done_div(); }); +// Bug 847287 - Test that changes of when an animation is dynamically +// overridden work correctly. +addAsyncAnimTest(function *() { + // anim2 and anim3 are both animations from opacity 0 to 1 + + new_div("animation: anim2 1s linear forwards; opacity: 0.5 ! important"); + yield waitForPaintsFlushed(); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation at start (0s)"); + advance_clock(750); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation while running (750ms)"); + advance_clock(1000); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation while filling (1750ms)"); + done_div(); + + new_div("animation: anim2 1s linear; opacity: 0.5 ! important"); + yield waitForPaintsFlushed(); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation at start (0s)"); + advance_clock(750); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation while running (750ms)"); + advance_clock(1000); + omta_todo_is("opacity", 0.5, RunningOn.TodoMainThread, + "opacity overriding animation after complete (1750ms)"); + done_div(); + + // One animation overriding another, and then not. + new_div("animation: anim2 1s linear, anim3 500ms linear reverse"); + yield waitForPaintsFlushed(); + omta_todo_is("opacity", 1, RunningOn.Compositor, + "anim3 overriding anim2 at start (0s)"); + advance_clock(400); + omta_todo_is("opacity", 0.2, RunningOn.Compositor, + "anim3 overriding anim2 at 400ms"); + advance_clock(200); + // Wait for paints because we're resending animations to the + // compositor via an UpdateOpacityLayer hint, which does the resending + // via painting. + yield waitForPaints(); + omta_is("opacity", 0.6, RunningOn.Compositor, + "anim2 at 600ms"); + done_div(); + + // One animation overriding another, and then not, but without a + // restyle when the overriding one ends. + new_div("animation: anim2 1s steps(8, end)"); + yield waitForPaintsFlushed(); + omta_is("opacity", 0, RunningOn.Compositor, + "anim2 at start (0s)"); + advance_clock(300); + omta_is("opacity", 0.25, RunningOn.Compositor, + "anim2 at 300ms"); + gDiv.style.animation = "anim2 1s steps(8, end), anim3 500ms steps(4, end)"; + yield waitForPaintsFlushed(); + omta_todo_is("opacity", 0, RunningOn.Compositor, + "anim3 overriding anim2 at 300ms"); + advance_clock(475); + omta_is("opacity", 0.75, RunningOn.Compositor, + "anim3 the same as anim2 at 775ms"); + advance_clock(50); + // Wait for paints because we're resending animations to the + // compositor via an UpdateOpacityLayer hint, which does the resending + // via painting. + yield waitForPaints(); + omta_is("opacity", 0.75, RunningOn.Compositor, + "anim2 at 825ms"); + advance_clock(75); + omta_is("opacity", 0.875, RunningOn.Compositor, + "anim2 at 900ms"); + done_div(); + + // Exactly the same as the previous test, except with an extra + // waitForPaintsFlushed(), since that extra one exposes other bugs. + new_div("animation: anim2 1s steps(8, end)"); + yield waitForPaintsFlushed(); + omta_is("opacity", 0, RunningOn.Compositor, + "anim2 at start (0s)"); + advance_clock(300); + omta_is("opacity", 0.25, RunningOn.Compositor, + "anim2 at 300ms"); + gDiv.style.animation = "anim2 1s steps(8, end), anim3 500ms steps(4, end)"; + yield waitForPaintsFlushed(); + omta_todo_is("opacity", 0, RunningOn.Compositor, + "anim3 overriding anim2 at 300ms"); + advance_clock(475); + omta_is("opacity", 0.75, RunningOn.Compositor, + "anim3 the same as anim2 at 775ms"); + // Extra waitForPaintsFlushed to expose bugs. + yield waitForPaintsFlushed(); + advance_clock(50); + // Wait for paints because we're resending animations to the + // compositor via an UpdateOpacityLayer hint, which does the resending + // via painting. + yield waitForPaints(); + omta_is("opacity", 0.75, RunningOn.Compositor, + "anim2 at 825ms"); + advance_clock(75); + omta_is("opacity", 0.875, RunningOn.Compositor, + "anim2 at 900ms"); + done_div(); +}); +