testing/web-platform/tests/css/css-values/hypot-pow-sqrt-serialize.html
author Emilio Cobos Álvarez <emilio@crisal.io>
Thu, 10 Jul 2025 09:08:54 +0000 (4 hours ago)
changeset 795952 1d422913e1cb1658224a2d269f8e4c9e80032d29
parent 751334 68860ff2836483ec8751c2a0c232737b8e91d810
permissions -rw-r--r--
Bug 1976623 - Create drag popups eagerly for now. r=tnikkel,layout-reviewers Trivially restores pre-regression behavior, for now. Differential Revision: https://phabricator.services.mozilla.com/D256769
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-values-4/#exponent-funcs">
<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">
<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(calc(${c}))`);
    test_computed_serialization('opacity', t, c);
    test_computed_serialization('transform', `scale(${t})`, `matrix(${c}, 0, 0, ${c}, 0, 0)`);
}

test_serialization(
    'pow(1,1)',
    'calc(1)',
    '1');
test_serialization(
    'hypot(1)',
    'calc(1)',
    '1');
test_serialization(
    'sqrt(1)',
    'calc(1)',
    '1');

test_serialization(
    'calc(pow(1,1) - 0.5)',
    'calc(0.5)',
    '0.5');
test_serialization(
    'calc(hypot(1) * 0.5)',
    'calc(0.5)',
    '0.5');
test_serialization(
    'calc(sqrt(1) - 1)',
    'calc(0)',
    '0');

test_specified_serialization('letter-spacing', 'hypot(2px, 40%)', 'hypot(2px, 40%)');
</script>