summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/minmax-time-computed.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-values/minmax-time-computed.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/minmax-time-computed.html')
-rw-r--r--testing/web-platform/tests/css/css-values/minmax-time-computed.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/minmax-time-computed.html b/testing/web-platform/tests/css/css-values/minmax-time-computed.html
new file mode 100644
index 0000000000..c6a708f028
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/minmax-time-computed.html
@@ -0,0 +1,48 @@
+<!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/#time">
+<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
+<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/numeric-testcommon.js"></script>
+<div id="target"></div>
+<script>
+function test_time_equals(t,e) {
+ test_math_used(t, e, {type:"time"});
+}
+
+// Identity tests
+test_time_equals('min(1s)', '1s');
+test_time_equals('min(1ms)', '1ms');
+test_time_equals('max(1s)', '1s');
+test_time_equals('max(1ms)', '1ms');
+
+// Comparisons between same units
+test_time_equals('min(1s, 2s)', '1s');
+test_time_equals('min(1ms, 2ms)', '1ms');
+test_time_equals('max(1s, 2s)', '2s');
+test_time_equals('max(1ms, 2ms)', '2ms');
+
+// Comparisons between different units
+test_time_equals('min(1s, 1100ms)', '1s');
+test_time_equals('max(0.9s, 1000ms)', '1000ms');
+
+// Nestings
+test_time_equals('min(2s, max(1s, 1500ms))', '1500ms');
+test_time_equals('max(1000ms, min(2000ms, 1.5s))', '1.5s');
+
+// General calculations
+test_time_equals('calc(min(0.5s, 600ms) + 500ms)', '1s');
+test_time_equals('calc(min(0.6s, 700ms) - 500ms)', '0.1s');
+test_time_equals('calc(min(0.5s, 600ms) * 2)', '1s');
+test_time_equals('calc(min(0.5s, 600ms) / 2)', '0.25s');
+test_time_equals('calc(max(0.5s, 400ms) + 500ms)', '1s');
+test_time_equals('calc(max(0.5s, 400ms) - 400ms)', '0.1s');
+test_time_equals('calc(max(0.5s, 400ms) * 2)', '1s');
+test_time_equals('calc(max(0.5s, 400ms) / 2)', '0.25s');
+test_time_equals('calc(min(0.5s, 600ms) + max(500ms, 0.4s))', '1s');
+test_time_equals('calc(min(0.6s, 700ms) - max(500ms, 0.4s))', '0.1s');
+test_time_equals('min(1s + 100ms, 500ms * 3)', '1.1s');
+test_time_equals('calc(min(1s, 2s) + max(3s, 4s) + 10s)', '15s');
+</script>