summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html')
-rw-r--r--testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html58
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html b/testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html
new file mode 100644
index 0000000000..72287d6f3c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/sin-cos-tan-serialize.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
+<link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
+<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-serialize">
+<link rel="author" title="Apple Inc">
+<link rel="author" title="Seokho Song" href="seokho@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/serialize-testcommon.js"></script>
+<div id=target></div>
+<script>
+function test_serialization(specified, expected, {prop="transform"}={}) {
+ test_specified_serialization(prop, `scale(${specified})`, `scale(${expected})`)
+}
+//TEST CASE | EXPECTED
+var test_map = {
+ "cos(0)" :"calc(1)",
+ "sin(0)" :"calc(0)",
+ "tan(0)" :"calc(0)",
+ "calc(sin(0) + 0.5)" :"calc(0.5)",
+ "calc(sin(0) + cos(0) + tan(0))" :"calc(1)",
+ "calc(cos(0) + 0.5)" :"calc(1.5)",
+ "calc(tan(0) + 0.5)" :"calc(0.5)",
+ "cos(0deg)" :"calc(1)",
+ "sin(0deg)" :"calc(0)",
+ "tan(0deg)" :"calc(0)",
+ "sin(30deg)" :"calc(0.5)",
+ "sin(0.523599)" :"calc(0.5)",
+ "sin(0.523599rad)" :"calc(0.5)",
+ "sin(33.333333grad)" :"calc(0.5)",
+ "sin(0.08333333turn)" :"calc(0.5)",
+ "cos(60deg)" :"calc(0.5)",
+ "cos(66.66666666grad)" :"calc(0.5)",
+ "cos(1.047197551)" :"calc(0.5)",
+ "cos(1.047197551rad)" :"calc(0.5)",
+ "cos(0.16666666666turn)" :"calc(0.5)",
+ "tan(45deg)" :"calc(1)",
+ "tan(50grad)" :"calc(1)",
+ "tan(0.78539816)" :"calc(1)",
+ "tan(0.78539816rad)" :"calc(1)",
+ "tan(0.125turn)" :"calc(1)",
+ "tan(90deg)" :"calc(infinity)",
+ "tan(-90deg)" :"calc(-infinity)",
+ "calc(sin(30deg) + cos(60deg) + tan(45deg))" :"calc(2)",
+ "calc(sin(infinity))" :"calc(NaN)",
+ "calc(cos(infinity))" :"calc(NaN)",
+ "calc(tan(infinity))" :"calc(NaN)",
+ "calc(sin(-infinity))" :"calc(NaN)",
+ "calc(cos(-infinity))" :"calc(NaN)",
+ "calc(tan(-infinity))" :"calc(NaN)",
+};
+
+for (var exp in test_map) {
+ test_serialization(exp, test_map[exp]);
+ test_serialization(`calc(${exp})`, test_map[exp]);
+}
+
+</script>