fune/testing/web-platform/tests/css/css-values/round-mod-rem-serialize.html
Blink WPT Bot a52e7bd11b Bug 1838625 [wpt PR 40567] - Fix wpt tests for css math functions to handle NaN and infinity, a=testonly
Automatic update from web-platform-tests
Fix wpt tests for css math functions to handle NaN and infinity (#40567)

Change tests results to see that NaN goes to 0 on top-level as per:
https://drafts.csswg.org/css-values-4/#top-level-calculation

And correctly handle the infinity expectations. Remove -infinity for
matrix as it can't round-trip.

Reviewed: https://github.com/web-platform-tests/wpt/pull/40567
Discussed: https://github.com/web-platform-tests/interop/issues/337

Change-Id: I4a0a7273c9e82a7f6e21b3bf8ed877b62076e3d3

Co-authored-by: Daniil Sakhapov <sakhapov@chromium.org>
--

wpt-commits: 4e1fc86b7e59919575c9832142e8d81217b3ff02
wpt-pr: 40567
2023-07-12 07:53:26 +00:00

44 lines
1.2 KiB
HTML

<!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="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org">
<link rel="author" title="Apple Inc">
<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(t,s,c) {
test_specified_serialization('opacity', t, s);
test_specified_serialization('transform', `scale(${t})`, `scale(${s})`);
test_computed_serialization('opacity', t, c);
test_computed_serialization('transform', `scale(${t})`, `matrix(${c}, 0, 0, ${c}, 0, 0)`);
}
test_serialization(
'round(1.1,1)',
'calc(1)',
'1');
test_serialization(
'mod(1,1)',
'calc(0)',
'0');
test_serialization(
'rem(1,1)',
'calc(0)',
'0');
test_serialization(
'calc(round(1,0))',
'calc(NaN)',
'0');
test_serialization(
'calc(mod(1,0))',
'calc(NaN)',
'0');
test_serialization(
'calc(rem(1,0))',
'calc(NaN)',
'0');
</script>