Bug 1207734 - Part 9.f. (testing) Add specified value serialization test cases for individual transform. r=emilio draft
authorcku <cku@mozilla.com>
Wed, 10 Jan 2018 15:04:00 +0800
changeset 749202 4b19a5c39c37863ad0682bf2efe7aaa80dc6f484
parent 749201 2a0fbd39ee548e2023aade2da993a9c65bf784b6
child 749203 6e8b1c53fe95e0ea21c2e93fee54288356f7945b
push id97349
push userbbirtles@mozilla.com
push dateWed, 31 Jan 2018 02:59:16 +0000
reviewersemilio
bugs1207734
milestone60.0a1
Bug 1207734 - Part 9.f. (testing) Add specified value serialization test cases for individual transform. r=emilio MozReview-Commit-ID: 56DTIuTXs95
layout/style/test/mochitest.ini
layout/style/test/test_specified_value_serialization.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -29,16 +29,17 @@ support-files =
   unstyled.xml
   viewport_units_iframe.html
   visited_image_loading_frame_empty.html
   visited_image_loading_frame.html
   visited_image_loading.sjs
   visited-lying-inner.html
   visited-pref-iframe.html
   xbl_bindings.xml
+prefs = layout.css.individual-transform.enabled=true
 
 [test_acid3_test46.html]
 [test_addSheet.html]
 support-files = additional_sheets_helper.html
 [test_additional_sheets.html]
 support-files = additional_sheets_helper.html
 [test_align_justify_computed_values.html]
 [test_align_shorthand_serialization.html]
--- a/layout/style/test/test_specified_value_serialization.html
+++ b/layout/style/test/test_specified_value_serialization.html
@@ -272,12 +272,61 @@
 
   p.style.paintOrder = "markers";
   is(p.style.paintOrder, "markers",
      "specified value serialization for paint-order doesn't contain repetitive values");
 
   p.remove();
 })();
 
+(function test_bug_1207734 () {
+  // The individual transform functions are not implemented on the Gecko style
+  // system.
+  if (!SpecialPowers.DOMWindowUtils.isStyledByServo) {
+    return;
+  }
+  // Test for rotate property serialization.
+  [
+    [" 90deg ", "90deg"],
+    [" 100grad ", "100grad"],
+    [" 100gRaD ", "100grad"],
+    [" 0.25turn  ", "0.25turn"],
+    [" 0.25tUrN  ", "0.25turn"],
+    [" 1.57RaD  ", "1.57rad"],
+  ].forEach(function(arr) {
+    document.documentElement.style.rotate = arr[0];
+    is(document.documentElement.style.rotate, arr[1],
+      "bug-1207734: incorrect rotate serialization");
+  });
+  document.documentElement.style.rotate = "";
+
+  // Test for translate property serialization.
+  [
+    [" 50% 5px 6px ", "50% 5px 6px"],
+    [" 50% 10px 100px ", "50% 10px 100px"],
+    [" 4px 5px ", "4px 5px"],
+    [" 10% 10% 99px  ", "10% 10% 99px"],
+    ["   50px    ", "50px"],
+  ].forEach(function(arr) {
+    document.documentElement.style.translate = arr[0];
+    is(document.documentElement.style.translate, arr[1],
+      "bug-1207734: incorrect translate serialization");
+  });
+  document.documentElement.style.translate = "";
+
+  // Test for scale property serialization.
+  [
+    [" 10  ", "10"],
+    [" 10 20.5 ", "10 20.5"],
+    [" 10 20  30 ", "10 20 30"],
+  ].forEach(function(arr) {
+    document.documentElement.style.scale = arr[0];
+    is(document.documentElement.style.scale, arr[1],
+      "bug-1207734: incorrect scale serialization");
+  });
+  document.documentElement.style.scale = "";
+
+})();
+
 </script>
 </pre>
 </body>
 </html>