Bug 1367028 part 3 - Add tests for the new serialization code. r=dholbert
authorXidorn Quan <me@upsuper.org>
Tue, 30 May 2017 13:44:44 +1000
changeset 409503 a5a48d0240308bf82ff8e6290a69d709256bdbaf
parent 409502 2b57daca7dcb350482c31d1e99be71004cefae8b
child 409504 5b2c84104a7f4774fd120ab38d21b6483bcb63c7
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1367028
milestone55.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 1367028 part 3 - Add tests for the new serialization code. r=dholbert MozReview-Commit-ID: GuoOCAKTUuB
layout/style/test/test_computed_style.html
layout/style/test/test_specified_value_serialization.html
--- a/layout/style/test/test_computed_style.html
+++ b/layout/style/test/test_computed_style.html
@@ -559,12 +559,67 @@ var noframe_container = document.getElem
     p.style.backgroundImage = test[0];
     is(cs.backgroundImage, test[1],
        "computed value of prefixed gradient expression (" + test[2] + ")");
   }
 
   p.remove();
 })();
 
+(function test_bug_1367028() {
+  const borderImageSubprops = [
+    "border-image-slice",
+    "border-image-outset",
+    "border-image-width"
+  ];
+  const rectValues = [
+    {
+      values: ["5 5 5 5", "5 5 5", "5 5", "5"],
+      expected: "5",
+      desc: "identical four sides",
+    },
+    {
+      values: ["5 6 5 6", "5 6 5", "5 6"],
+      expected: "5 6",
+      desc: "identical values on each axis",
+    },
+    {
+      values: ["5 6 7 6", "5 6 7"],
+      expected: "5 6 7",
+      desc: "identical values on left and right",
+    },
+    {
+      values: ["5 6 5 7"],
+      desc: "identical values on top and bottom",
+    },
+    {
+      values: ["5 5 6 6", "5 6 6 5"],
+      desc: "identical values on unrelated sides",
+    },
+    {
+      values: ["5 6 7 8"],
+      desc: "different values on all sides",
+    },
+  ];
+
+  let frameContainer = document.getElementById("display");
+  let p = document.createElement("p");
+  frameContainer.appendChild(p);
+  let cs = getComputedStyle(p);
+
+  for (let prop of borderImageSubprops) {
+    for (let {values, expected, desc} of rectValues) {
+      for (let value of values) {
+        p.style.setProperty(prop, value);
+        is(cs.getPropertyValue(prop),
+           expected ? expected : value, `${desc} for ${prop}`);
+        p.style.removeProperty(prop);
+      }
+    }
+  }
+
+  p.remove();
+})();
+
 </script>
 </pre>
 </body>
 </html>
--- a/layout/style/test/test_specified_value_serialization.html
+++ b/layout/style/test/test_specified_value_serialization.html
@@ -168,12 +168,66 @@
     p.style.backgroundImage = test[0];
     is(p.style.backgroundImage, test[1],
        "serialization value of gradient expression (" + test[2] + ")");
   }
 
   p.remove();
 })();
 
+(function test_bug_1367028() {
+  const borderImageSubprops = [
+    "border-image-slice",
+    "border-image-outset",
+    "border-image-width"
+  ];
+  const rectValues = [
+    {
+      values: ["5 5 5 5", "5 5 5", "5 5", "5"],
+      expected: "5",
+      desc: "identical four sides",
+    },
+    {
+      values: ["5 6 5 6", "5 6 5", "5 6"],
+      expected: "5 6",
+      desc: "identical values on each axis",
+    },
+    {
+      values: ["5 6 7 6", "5 6 7"],
+      expected: "5 6 7",
+      desc: "identical values on left and right",
+    },
+    {
+      values: ["5 6 5 7"],
+      desc: "identical values on top and bottom",
+    },
+    {
+      values: ["5 5 6 6", "5 6 6 5"],
+      desc: "identical values on unrelated sides",
+    },
+    {
+      values: ["5 6 7 8"],
+      desc: "different values on all sides",
+    },
+  ];
+
+  let frameContainer = document.getElementById("display");
+  let p = document.createElement("p");
+  frameContainer.appendChild(p);
+
+  for (let prop of borderImageSubprops) {
+    for (let {values, expected, desc} of rectValues) {
+      for (let value of values) {
+        p.style.setProperty(prop, value);
+        is(p.style.getPropertyValue(prop),
+           expected ? expected : value, `${desc} for ${prop}`);
+        p.style.removeProperty(prop);
+      }
+    }
+  }
+
+  p.remove();
+})();
+
 </script>
 </pre>
 </body>
 </html>