Bug 1048838 - Add mochitest for transitions and restyles. No review.
authorL. David Baron <dbaron@dbaron.org>
Wed, 20 Aug 2014 14:57:21 -0700
changeset 200710 ac59c5f851dc2dab526d28e59384e450b42ae2aa
parent 200709 3d8dd1441e53ac2fa34d01c393d1e387508f93a5
child 200711 b2326bbb0c28b91a38e40775d23761c47fd8ee5a
push id27353
push useremorley@mozilla.com
push dateThu, 21 Aug 2014 12:33:28 +0000
treeherdermozilla-central@479ec85d9e6f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1048838
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1048838 - Add mochitest for transitions and restyles. No review. The third test fails without the patch, and passes with the patch.
layout/style/test/mochitest.ini
layout/style/test/test_transitions_and_restyles.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -186,16 +186,17 @@ skip-if = (toolkit == 'gonk' && debug) |
 [test_shorthand_property_getters.html]
 [test_specified_value_serialization.html]
 [test_style_attribute_quirks.html]
 [test_style_attribute_standards.html]
 [test_style_struct_copy_constructors.html]
 [test_supports_rules.html]
 [test_system_font_serialization.html]
 [test_transitions_and_reframes.html]
+[test_transitions_and_restyles.html]
 [test_transitions_and_zoom.html]
 [test_transitions_cancel_near_end.html]
 [test_transitions_computed_values.html]
 [test_transitions_computed_value_combinations.html]
 [test_transitions_events.html]
 [test_transitions.html]
 [test_transitions_per_property.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 775227 # b2g(times out, needs more time + various failures) b2g-debug(times out, needs more time + various failures) b2g-desktop(times out, needs more time + various failures)
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_transitions_and_restyles.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1030993
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1030993</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+  #display {
+    background: blue; height: 10px; width: 0; color: black;
+    transition: width linear 1s, color linear 1s;
+  }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1030993">Mozilla Bug 1030993</a>
+<p id="display"></p>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 1030993 **/
+
+function advance_clock(milliseconds) {
+  SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(milliseconds);
+}
+
+var p = document.getElementById("display");
+var cs = getComputedStyle(p, "");
+advance_clock(0);
+cs.width; // flush
+p.style.width = "1000px"; // start transition
+is(cs.width, "0px", "transition at 0ms"); // flush (and test)
+advance_clock(100);
+is(cs.width, "100px", "transition at 100ms"); // flush
+// restyle *and* trigger new transitions
+p.style.color = "blue";
+// flush again, at the same timestamp
+is(cs.width, "100px", "transition at 100ms, after restyle");
+
+SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
+
+</script>
+</body>
+</html>