summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html')
-rw-r--r--testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html b/testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html
new file mode 100644
index 0000000000..8dec53f3f0
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/getComputedStyle-border-radius-002.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+
+ <meta charset="UTF-8">
+
+ <title>CSS Values Test: percentages in calc() and computed border-radius values</title>
+
+ <!--
+
+ Bugzilla bug report 1516454: Computed value of border-radius with calc(percentage) is incorrect
+ https://bugzilla.mozilla.org/show_bug.cgi?id=1516454
+
+ -->
+
+ <link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
+ <link rel="help" href="https://www.w3.org/TR/css-values-3/#calc-computed-value">
+
+ <style>
+ div#target
+ {
+ border: black solid 5px;
+ height: 100px;
+ width: 100px;
+ }
+ </style>
+
+ <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, "initial");
+
+ 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("border-top-left-radius", "calc(50%)", "50%", "simple percentage conversion test 1");
+
+ compareValue("border-top-right-radius", "calc(50%)", "50%", "simple percentage conversion test 2");
+
+ compareValue("border-bottom-left-radius", "calc(50%)", "50%", "simple percentage conversion test 3");
+
+ compareValue("border-bottom-right-radius", "calc(50%)", "50%", "simple percentage conversion test 4");
+
+ compareValue("border-top-left-radius", "calc(50%) calc(25%)", "50% 25%", "percentage conversion test 5");
+
+ compareValue("border-top-right-radius", "calc(50%) calc(25%)", "50% 25%", "percentage conversion test 6");
+
+ compareValue("border-bottom-left-radius", "calc(50%) calc(25%)", "50% 25%", "percentage conversion test 7");
+
+ compareValue("border-bottom-right-radius", "calc(50%) calc(25%)", "50% 25%", "percentage conversion test 8");
+ }
+
+ startTesting();
+
+ </script>