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 464568 22da78af2c327e3296ca94ce093bedff27ca865e
parent 464567 ad337b335d8d92df29535f4ff7b30896937a4e0b
child 464569 d1afd891ac348c1df050feb96de8b67419b34a72
push id80669
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:47:54 +0000
treeherderautoland@e0861be8d6c0 [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>