Bug 1367283 - Part 9: Add tests to confirm valid 'inherit' value of -moz prefixed properties during animation. r=hiro draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Tue, 30 May 2017 10:42:59 +0900
changeset 586244 f2e220ccc0c6864ad15416a2cda470f64eeb62be
parent 586049 34ac1a5d6576d6775491c8a882710a1520551da6
child 630933 56a854adc6d8839ad3b065e8d8267896a34d847b
push id61343
push userbmo:dakatsuka@mozilla.com
push dateTue, 30 May 2017 01:43:40 +0000
reviewershiro
bugs1367283
milestone55.0a1
Bug 1367283 - Part 9: Add tests to confirm valid 'inherit' value of -moz prefixed properties during animation. r=hiro Test to confirm valid 'inherit' value of -moz prefixed properties during animation. This also means to confirm the algorithm of clone_XX methods of stylo. NOTE: This file should have only animatable properties that have '-moz' prefix. In this patch, appends following properties. * -moz-box-align * -moz-box-direction * -moz-box-orient * -moz-box-pack * -moz-float-edge * -moz-orient * -moz-osx-font-smoothing * -moz-user-focus * -moz-user-input * -moz-user-modify * -moz-window-dragging MozReview-Commit-ID: GfBfMkvfgGm
dom/animation/test/mochitest.ini
dom/animation/test/mozilla/test_moz-prefixed-properties.html
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -54,16 +54,17 @@ support-files =
   mozilla/file_set-easing.html
   style/file_animation-seeking-with-current-time.html
   style/file_animation-seeking-with-start-time.html
   style/file_animation-setting-effect.html
   style/file_animation-setting-spacing.html
   style/file_composite.html
   style/file_missing-keyframe.html
   style/file_missing-keyframe-on-compositor.html
+  ../../../layout/style/test/property_database.js
   testcommon.js
 
 [css-animations/test_animations-dynamic-changes.html]
 [css-animations/test_animation-cancel.html]
 [css-animations/test_animation-computed-timing.html]
 [css-animations/test_animation-currenttime.html]
 [css-animations/test_animation-finish.html]
 [css-animations/test_animation-finished.html]
@@ -101,16 +102,17 @@ support-files =
 [document-timeline/test_request_animation_frame.html]
 [mozilla/test_cubic_bezier_limits.html]
 [mozilla/test_deferred_start.html]
 [mozilla/test_disable_animations_api_core.html]
 [mozilla/test_disabled_properties.html]
 [mozilla/test_discrete-animations.html]
 [mozilla/test_document-timeline-origin-time-range.html]
 [mozilla/test_hide_and_show.html]
+[mozilla/test_moz-prefixed-properties.html]
 [mozilla/test_set-easing.html]
 [mozilla/test_spacing_property_order.html]
 [mozilla/test_transform_limits.html]
 [mozilla/test_transition_finish_on_compositor.html]
 skip-if = toolkit == 'android'
 [mozilla/test_underlying-discrete-value.html]
 [style/test_animation-seeking-with-current-time.html]
 [style/test_animation-seeking-with-start-time.html]
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/test_moz-prefixed-properties.html
@@ -0,0 +1,87 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test animations of all properties that have -moz prefix</title>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+  <script src="../testcommon.js"></script>
+  <script src="../property_database.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+"use strict";
+
+const testcases = [
+  {
+    property: "-moz-box-align"
+  },
+  {
+    property: "-moz-box-direction"
+  },
+  {
+    property: "-moz-box-orient",
+    expectedValueMap: {
+      "block-axis": "vertical",
+      "inline-axis": "horizontal",
+    }
+  },
+  {
+    property: "-moz-box-pack"
+  },
+  {
+    property: "-moz-float-edge"
+  },
+  {
+    property: "-moz-orient"
+  },
+  {
+    property: "-moz-osx-font-smoothing",
+    pref: "layout.css.osx-font-smoothing.enabled"
+  },
+  {
+    property: "-moz-user-focus"
+  },
+  {
+    property: "-moz-user-input"
+  },
+  {
+    property: "-moz-user-modify"
+  },
+  {
+    property: "-moz-window-dragging"
+  },
+];
+
+testcases.forEach(testcase => {
+  if (testcase.pref && !IsCSSPropertyPrefEnabled(testcase.pref)) {
+    return;
+  }
+
+  const property = gCSSProperties[testcase.property];
+  const values = property.initial_values.concat(property.other_values);
+  values.forEach(value => {
+    test(function(t) {
+      const container = addDiv(t);
+      const target = document.createElement("div");
+      container.appendChild(target);
+
+      container.style[property.domProp] = value;
+
+      const animation =
+        target.animate({ [property.domProp]: [value, "inherit"] },
+                       { duration: 1000, delay: -500 } );
+
+      const expectedValue =
+        testcase.expectedValueMap && testcase.expectedValueMap[value]
+        ? testcase.expectedValueMap[value] : value;
+      assert_equals(getComputedStyle(target)[property.domProp], expectedValue,
+                    `Computed style shoud be "${ expectedValue }"`);
+    }, `Test inherit value for "${ testcase.property }" `
+       + `(Parent element style is "${ value }")`);
+  });
+});
+</script>
+</pre>
+</body>
+</html>