Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283446 => 283447)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-02 21:24:31 UTC (rev 283446)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-02 22:18:38 UTC (rev 283447)
@@ -1,3 +1,17 @@
+2021-10-02 Nikos Mouchtaris <[email protected]>
+
+ WPTs for hypot,sqrt,pow calc functions
+ https://bugs.webkit.org/show_bug.cgi?id=231053
+
+ Reviewed by Simon Fraser.
+
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-computed-expected.txt: Added.
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-computed.html: Added.
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt: Added.
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html: Added.
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt: Added.
+ * web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html: Added.
+
2021-10-02 Ziran Sun <[email protected]>
[css-grid] Accommodate spanning items crossing flexible tracks
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed-expected.txt (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed-expected.txt 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,40 @@
+
+PASS pow(1,1) should be used-value-equivalent to 1
+PASS sqrt(1) should be used-value-equivalent to 1
+PASS hypot(1) should be used-value-equivalent to 1
+PASS sqrt(pow(1,1)) should be used-value-equivalent to 1
+PASS hypot(pow(1, sqrt(1))) should be used-value-equivalent to 1
+PASS calc(hypot(pow((1 + sqrt(1)) / 2, sqrt(1)))) should be used-value-equivalent to 1
+PASS calc(100px * pow(2, pow(2, 2))) should be used-value-equivalent to 1600px
+PASS calc(1px * pow(2, 3)) should be used-value-equivalent to 8px
+PASS calc(100px * sqrt(100)) should be used-value-equivalent to 1000px
+PASS calc(1px * pow(2, sqrt(100)) should be used-value-equivalent to 1024px
+PASS hypot(3px, 4px) should be used-value-equivalent to 5px
+PASS calc(100px * hypot(3, 4)) should be used-value-equivalent to 500px
+PASS hypot(-5px) should be used-value-equivalent to 5px
+PASS calc(1px * hypot(-5)) should be used-value-equivalent to 5px
+PASS calc(1px * hypot(10000)) should be used-value-equivalent to 10000px
+PASS calc(2px * sqrt(100000000)) should be used-value-equivalent to 20000px
+PASS calc(3px * pow(200, 4)) should be used-value-equivalent to 33554428px
+PASS hypot(1px) should be used-value-equivalent to 1px
+PASS hypot(1cm) should be used-value-equivalent to 1cm
+PASS hypot(1mm) should be used-value-equivalent to 1mm
+PASS hypot(1Q) should be used-value-equivalent to 1Q
+PASS hypot(1in) should be used-value-equivalent to 1in
+PASS hypot(1pc) should be used-value-equivalent to 1pc
+PASS hypot(1pt) should be used-value-equivalent to 1pt
+PASS hypot(1em) should be used-value-equivalent to 1em
+PASS hypot(1ex) should be used-value-equivalent to 1ex
+PASS hypot(1ch) should be used-value-equivalent to 1ch
+PASS hypot(1rem) should be used-value-equivalent to 1rem
+PASS hypot(1vh) should be used-value-equivalent to 1vh
+PASS hypot(1vw) should be used-value-equivalent to 1vw
+PASS hypot(1vmin) should be used-value-equivalent to 1vmin
+PASS hypot(1vmax) should be used-value-equivalent to 1vmax
+PASS hypot(1s) should be used-value-equivalent to 1s
+PASS hypot(1ms) should be used-value-equivalent to 1ms
+PASS hypot(1deg) should be used-value-equivalent to 1deg
+PASS hypot(1grad) should be used-value-equivalent to 1grad
+PASS hypot(1rad) should be used-value-equivalent to 1rad
+PASS hypot(1turn) should be used-value-equivalent to 1turn
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed.html (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-computed.html 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Apple Inc">
+<script src=""
+<script src=""
+<script src=""
+<div id="target"></div>
+<script>
+
+// Identity tests
+test_math_used('pow(1,1)', '1', {type:'number'});
+test_math_used('sqrt(1)', '1', {type:'number'});
+test_math_used('hypot(1)', '1', {type:'number'});
+
+// Nestings
+test_math_used('sqrt(pow(1,1))', '1');
+test_math_used('hypot(pow(1, sqrt(1)))', '1');
+test_math_used('calc(hypot(pow((1 + sqrt(1)) / 2, sqrt(1))))', '1');
+
+// General calculations
+test_math_used('calc(100px * pow(2, pow(2, 2)))','1600px');
+test_math_used('calc(1px * pow(2, 3))', '8px')
+test_math_used('calc(100px * sqrt(100))', '1000px');
+test_math_used('calc(1px * pow(2, sqrt(100))', '1024px');
+test_math_used('hypot(3px, 4px)', '5px');
+test_math_used('calc(100px * hypot(3, 4))', '500px');
+test_math_used('hypot(-5px)', '5px');
+test_math_used('calc(1px * hypot(-5))', '5px');
+test_math_used('calc(1px * hypot(10000))','10000px');
+test_math_used('calc(2px * sqrt(100000000))','20000px');
+test_math_used('calc(3px * pow(200, 4))', '33554428px');
+
+//Type checking hypot
+test_math_used('hypot(1px)', '1px');
+test_math_used('hypot(1cm)', '1cm');
+test_math_used('hypot(1mm)', '1mm');
+test_math_used('hypot(1Q)', '1Q');
+test_math_used('hypot(1in)', '1in');
+test_math_used('hypot(1pc)', '1pc');
+test_math_used('hypot(1pt)', '1pt');
+test_math_used('hypot(1em)', '1em');
+test_math_used('hypot(1ex)', '1ex');
+test_math_used('hypot(1ch)', '1ch');
+test_math_used('hypot(1rem)', '1rem');
+test_math_used('hypot(1vh)', '1vh');
+test_math_used('hypot(1vw)', '1vw');
+test_math_used('hypot(1vmin)', '1vmin');
+test_math_used('hypot(1vmax)', '1vmax');
+test_math_used('hypot(1s)', '1s', {type:'time'});
+test_math_used('hypot(1ms)', '1ms', {type:'time'});
+test_math_used('hypot(1deg)', '1deg', {type:'angle', approx:0.001});
+test_math_used('hypot(1grad)', '1grad', {type:'angle', approx:0.001});
+test_math_used('hypot(1rad)', '1rad', {type:'angle', approx:0.001});
+test_math_used('hypot(1turn)', '1turn', {type:'angle', approx:0.001});
+</script>
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid-expected.txt 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,49 @@
+
+PASS e.style['opacity'] = "hypot()" should not set the property value
+PASS e.style['opacity'] = "hypot( )" should not set the property value
+PASS e.style['opacity'] = "hypot(,)" should not set the property value
+PASS e.style['opacity'] = "hypot(1, )" should not set the property value
+PASS e.style['opacity'] = "hypot(, 1)" should not set the property value
+PASS e.style['opacity'] = "hypot(1 + )" should not set the property value
+PASS e.style['opacity'] = "hypot(1 - )" should not set the property value
+PASS e.style['opacity'] = "hypot(1 * )" should not set the property value
+PASS e.style['opacity'] = "hypot(1 / )" should not set the property value
+PASS e.style['opacity'] = "hypot(1 2)" should not set the property value
+PASS e.style['opacity'] = "hypot(1, , 2)" should not set the property value
+FAIL e.style['opacity'] = "hypot(1, 2)" should not set the property value assert_equals: expected "" but got "hypot(2.23606797749979)"
+PASS e.style['opacity'] = "sqrt()" should not set the property value
+PASS e.style['opacity'] = "sqrt( )" should not set the property value
+PASS e.style['opacity'] = "sqrt(,)" should not set the property value
+PASS e.style['opacity'] = "sqrt(1, )" should not set the property value
+PASS e.style['opacity'] = "sqrt(, 1)" should not set the property value
+PASS e.style['opacity'] = "sqrt(1 + )" should not set the property value
+PASS e.style['opacity'] = "sqrt(1 - )" should not set the property value
+PASS e.style['opacity'] = "sqrt(1 * )" should not set the property value
+PASS e.style['opacity'] = "sqrt(1 / )" should not set the property value
+PASS e.style['opacity'] = "sqrt(1 2)" should not set the property value
+PASS e.style['opacity'] = "sqrt(1, , 2)" should not set the property value
+PASS e.style['opacity'] = "sqrt(1, 2)" should not set the property value
+PASS e.style['opacity'] = "pow( )" should not set the property value
+PASS e.style['opacity'] = "pow(,)" should not set the property value
+PASS e.style['opacity'] = "pow(1, )" should not set the property value
+PASS e.style['opacity'] = "pow(, 1)" should not set the property value
+PASS e.style['opacity'] = "pow(1 + )" should not set the property value
+PASS e.style['opacity'] = "pow(1 - )" should not set the property value
+PASS e.style['opacity'] = "pow(1 * )" should not set the property value
+PASS e.style['opacity'] = "pow(1 / )" should not set the property value
+PASS e.style['opacity'] = "pow(1 2)" should not set the property value
+PASS e.style['opacity'] = "pow(1, , 2)" should not set the property value
+FAIL e.style['opacity'] = "pow(1, 2)" should not set the property value assert_equals: expected "" but got "pow(1, 2)"
+PASS e.style['letter-spacing'] = "calc(1px * pow(1))" should not set the property value
+PASS e.style['letter-spacing'] = "calc(1px * pow(2px, 3px))" should not set the property value
+PASS e.style['letter-spacing'] = "calc(sqrt(100px)" should not set the property value
+PASS e.style['letter-spacing'] = "hypot(2px, 40%)" should not set the property value
+PASS e.style['letter-spacing'] = "hypot(2px, 3)" should not set the property value
+PASS e.style['letter-spacing'] = "hypot(3, ,4)" should not set the property value
+PASS e.style['letter-spacing'] = "calc(1px * pow(2 3))" should not set the property value
+PASS e.style['letter-spacing'] = "hypot()" should not set the property value
+PASS e.style['letter-spacing'] = "calc(pow(2))" should not set the property value
+PASS e.style['letter-spacing'] = "pow())" should not set the property value
+PASS e.style['letter-spacing'] = "calc(sqrt())" should not set the property value
+PASS e.style['letter-spacing'] = "calc(sqrt(100, 200))" should not set the property value
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-invalid.html 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Apple Inc">
+<script src=""
+<script src=""
+<script src=""
+<script>
+function test_invalid_number(value) {
+ test_invalid_value('opacity', value);
+}
+function test_invalid_length(value) {
+ // 'letter-spacing' accepts <length> only, not <percentage> or any mixes.
+ test_invalid_value('letter-spacing', value);
+}
+
+// Syntax checking
+test_invalid_number('hypot()');
+test_invalid_number('hypot( )');
+test_invalid_number('hypot(,)');
+test_invalid_number('hypot(1, )');
+test_invalid_number('hypot(, 1)');
+test_invalid_number('hypot(1 + )');
+test_invalid_number('hypot(1 - )');
+test_invalid_number('hypot(1 * )');
+test_invalid_number('hypot(1 / )');
+test_invalid_number('hypot(1 2)');
+test_invalid_number('hypot(1, , 2)');
+test_invalid_number('hypot(1, 2)');
+test_invalid_number('sqrt()');
+test_invalid_number('sqrt( )');
+test_invalid_number('sqrt(,)');
+test_invalid_number('sqrt(1, )');
+test_invalid_number('sqrt(, 1)');
+test_invalid_number('sqrt(1 + )');
+test_invalid_number('sqrt(1 - )');
+test_invalid_number('sqrt(1 * )');
+test_invalid_number('sqrt(1 / )');
+test_invalid_number('sqrt(1 2)');
+test_invalid_number('sqrt(1, , 2)');
+test_invalid_number('sqrt(1, 2)');
+test_invalid_number('pow( )');
+test_invalid_number('pow(,)');
+test_invalid_number('pow(1, )');
+test_invalid_number('pow(, 1)');
+test_invalid_number('pow(1 + )');
+test_invalid_number('pow(1 - )');
+test_invalid_number('pow(1 * )');
+test_invalid_number('pow(1 / )');
+test_invalid_number('pow(1 2)');
+test_invalid_number('pow(1, , 2)');
+test_invalid_number('pow(1, 2)');
+
+// General tests
+test_invalid_length('calc(1px * pow(1))');
+test_invalid_length('calc(1px * pow(2px, 3px))');
+test_invalid_length('calc(sqrt(100px)');
+test_invalid_length('hypot(2px, 40%)');
+test_invalid_length('hypot(2px, 3)');
+test_invalid_length('hypot(3, ,4)');
+test_invalid_length('calc(1px * pow(2 3))');
+test_invalid_length('hypot()');
+test_invalid_length('calc(pow(2))');
+test_invalid_length('pow())');
+test_invalid_length('calc(sqrt())');
+test_invalid_length('calc(sqrt(100, 200))');
+</script>
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize-expected.txt 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,26 @@
+
+FAIL 'pow(1,1)' as a specified value should serialize as 'calc(1)'. assert_equals: 'pow(1,1)' and 'calc(1)' should serialize the same in specified values. expected "calc(1)" but got "pow(1, 1)"
+FAIL 'scale(pow(1,1))' as a specified value should serialize as 'scale(calc(1))'. assert_equals: 'scale(pow(1,1))' and 'scale(calc(1))' should serialize the same in specified values. expected "scale(calc(1))" but got "scale(pow(1, 1))"
+PASS 'pow(1,1)' as a computed value should serialize as '1'.
+PASS 'scale(pow(1,1))' as a computed value should serialize as 'matrix(1, 0, 0, 1, 0, 0)'.
+FAIL 'hypot(1)' as a specified value should serialize as 'calc(1)'. assert_equals: 'hypot(1)' and 'calc(1)' should serialize the same in specified values. expected "calc(1)" but got "hypot(1)"
+FAIL 'scale(hypot(1))' as a specified value should serialize as 'scale(calc(1))'. assert_equals: 'scale(hypot(1))' and 'scale(calc(1))' should serialize the same in specified values. expected "scale(calc(1))" but got "scale(hypot(1))"
+PASS 'hypot(1)' as a computed value should serialize as '1'.
+PASS 'scale(hypot(1))' as a computed value should serialize as 'matrix(1, 0, 0, 1, 0, 0)'.
+FAIL 'sqrt(1)' as a specified value should serialize as 'calc(1)'. assert_equals: 'sqrt(1)' and 'calc(1)' should serialize the same in specified values. expected "calc(1)" but got "sqrt(1)"
+FAIL 'scale(sqrt(1))' as a specified value should serialize as 'scale(calc(1))'. assert_equals: 'scale(sqrt(1))' and 'scale(calc(1))' should serialize the same in specified values. expected "scale(calc(1))" but got "scale(sqrt(1))"
+PASS 'sqrt(1)' as a computed value should serialize as '1'.
+PASS 'scale(sqrt(1))' as a computed value should serialize as 'matrix(1, 0, 0, 1, 0, 0)'.
+PASS 'calc(pow(1,1) + 1)' as a specified value should serialize as 'calc(2)'.
+PASS 'scale(calc(pow(1,1) + 1))' as a specified value should serialize as 'scale(calc(2))'.
+FAIL 'calc(pow(1,1) + 1)' as a computed value should serialize as '2'. assert_equals: '2' should round-trip exactly in computed values. expected "2" but got "1"
+PASS 'scale(calc(pow(1,1) + 1))' as a computed value should serialize as 'matrix(2, 0, 0, 2, 0, 0)'.
+PASS 'calc(hypot(1) * 2)' as a specified value should serialize as 'calc(2)'.
+PASS 'scale(calc(hypot(1) * 2))' as a specified value should serialize as 'scale(calc(2))'.
+FAIL 'calc(hypot(1) * 2)' as a computed value should serialize as '2'. assert_equals: '2' should round-trip exactly in computed values. expected "2" but got "1"
+PASS 'scale(calc(hypot(1) * 2))' as a computed value should serialize as 'matrix(2, 0, 0, 2, 0, 0)'.
+PASS 'calc(sqrt(1) - 1)' as a specified value should serialize as 'calc(0)'.
+PASS 'scale(calc(sqrt(1) - 1))' as a specified value should serialize as 'scale(calc(0))'.
+PASS 'calc(sqrt(1) - 1)' as a computed value should serialize as '0'.
+PASS 'scale(calc(sqrt(1) - 1))' as a computed value should serialize as 'matrix(0, 0, 0, 0, 0, 0)'.
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html (0 => 283447)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/hypot-pow-sqrt-serialize.html 2021-10-02 22:18:38 UTC (rev 283447)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<link rel="author" title="Apple Inc">
+<script src=""
+<script src=""
+<script src=""
+<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) + 1)',
+ 'calc(2)',
+ '2');
+test_serialization(
+ 'calc(hypot(1) * 2)',
+ 'calc(2)',
+ '2');
+test_serialization(
+ 'calc(sqrt(1) - 1)',
+ 'calc(0)',
+ '0');
+</script>
\ No newline at end of file