Tests: Import CSS clip-path: path(...) tests

This commit is contained in:
Sam Atkins 2025-07-17 15:23:49 +01:00 committed by Alexander Kalenik
commit 07b5b7ffb6
Notes: github-actions[bot] 2025-07-17 18:00:52 +00:00
6 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,8 @@
Harness status: OK
Found 3 tests
3 Fail
Fail Property clip-path value 'path(nonzero, 'M10,10h80v80h-80zM25,25h50v50h-50z')'
Fail Property clip-path value 'path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z')'
Fail Property clip-path value 'path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50')'

View file

@ -0,0 +1,7 @@
Harness status: OK
Found 2 tests
2 Pass
Pass e.style['clip-path'] = "path(evenodd, 'not-a-path')" should not set the property value
Pass e.style['clip-path'] = "path(badfillrule, 'M10,10')" should not set the property value

View file

@ -0,0 +1,7 @@
Harness status: OK
Found 2 tests
2 Fail
Fail e.style['clip-path'] = "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z')" should set the property value
Fail e.style['clip-path'] = "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50')" should set the property value

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Shapes Module Level 1: the computed value of the path() function</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-path">
<meta name="assert" content="Tests parsing of the path() function">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("clip-path", "path(nonzero, 'M10,10h80v80h-80zM25,25h50v50h-50z')", "path(\"M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50 Z\")");
test_computed_value("clip-path", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z')", "path(evenodd, \"M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50 Z\")");
test_computed_value("clip-path", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50')", "path(evenodd, \"M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50\")");
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Shapes Module Level 1: parsing the path() function</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-path">
<meta name="assert" content="Tests parsing of the path() function">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("clip-path", "path(evenodd, 'not-a-path')");
test_invalid_value("clip-path", "path(badfillrule, 'M10,10')");
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Shapes Module Level 1: parsing the path() function</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#funcdef-basic-shape-path">
<meta name="assert" content="Tests parsing of the path() function">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("clip-path", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50z')", "path(evenodd, \"M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50 Z\")");
test_valid_value("clip-path", "path(evenodd, 'M10,10h80v80h-80zM25,25h50v50h-50')", "path(evenodd, \"M 10 10 h 80 v 80 h -80 Z M 25 25 h 50 v 50 h -50\")");
</script>
</body>
</html>