Bug 1528719 [wpt PR 15397] - adding a new test on rgba() function, a=testonly
authorGérard Talbot <github@gtalbot.org>
Tue, 05 Mar 2019 12:15:11 +0000
changeset 522169 77210973824185662b92f7c93c16ba920b69eb58
parent 522168 a73350397302b7531c88c0ab2ae8e81aa197fab5
child 522170 165c390054b242715a5d81c3a47089ec4f6a53e7
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1528719, 15397
milestone67.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 1528719 [wpt PR 15397] - adding a new test on rgba() function, a=testonly Automatic update from web-platform-tests adding a new test on rgba() function -- wpt-commits: ad219567030d1f99f7310f52a17546b57b70d29e wpt-pr: 15397
testing/web-platform/tests/css/css-values/rgba-011.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/rgba-011.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+
+  <meta charset="UTF-8">
+
+  <title>CSS Values and Units Test: rgba() function syntax (complex)</title>
+
+  <link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+  <link rel="help" href="https://www.w3.org/TR/css-color-3/#rgba-color">
+  <link rel="help" href="https://www.w3.org/TR/css-color-4/#rgb-functions">
+  <link rel="help" href="https://www.w3.org/TR/css-values-4/#combine-integers">
+
+  <meta name="flags" content="">
+  <meta name="assert" content="This test checks the syntax allowed by rgba() function. White space characters, instead of commas, are allowed between numerical values. <alpha-value> can be omitted for rgba() function, in which case it must defaults to 100%. Finally, rgba() function can take real numbers but their computed values will be rounded to the nearest integer, with values halfway between adjacent integers rounded towards positive infinity.">
+
+  <script src="/resources/testharness.js"></script>
+
+  <script src="/resources/testharnessreport.js"></script>
+
+  <div id="log"></div>
+
+  <div id="target"></div>
+
+  <script>
+  function startTesting()
+  {
+
+    var targetElement = document.getElementById("target");
+
+    function compareValue(property_name, calcValue, expectedValue, description)
+    {
+
+    test(function()
+      {
+
+      targetElement.style.setProperty(property_name, calcValue);
+
+      var computedCalcValue = getComputedStyle(targetElement)[property_name];
+
+      targetElement.style.setProperty(property_name, expectedValue);
+
+      var computedExpectedValue = getComputedStyle(targetElement)[property_name];
+
+      assert_equals(computedCalcValue, computedExpectedValue);
+
+      }, description);
+    }
+
+    compareValue("background-color", "rgba(0.4 127.5 0.3)", "rgb(0, 128, 0)", "testing background-color: rgba(0.4 127.5 0.3)");
+
+  }
+
+  startTesting();
+
+  </script>