Tests: Import some CSS cursor tests

This commit is contained in:
Sam Atkins 2025-02-20 15:50:36 +00:00 committed by Andreas Kling
commit 3216da062a
Notes: github-actions[bot] 2025-02-28 12:52:32 +00:00
6 changed files with 288 additions and 0 deletions

View file

@ -0,0 +1,41 @@
Harness status: OK
Found 36 tests
36 Pass
Pass Property cursor value 'auto'
Pass Property cursor value 'default'
Pass Property cursor value 'none'
Pass Property cursor value 'context-menu'
Pass Property cursor value 'help'
Pass Property cursor value 'pointer'
Pass Property cursor value 'progress'
Pass Property cursor value 'wait'
Pass Property cursor value 'cell'
Pass Property cursor value 'crosshair'
Pass Property cursor value 'text'
Pass Property cursor value 'vertical-text'
Pass Property cursor value 'alias'
Pass Property cursor value 'copy'
Pass Property cursor value 'move'
Pass Property cursor value 'no-drop'
Pass Property cursor value 'not-allowed'
Pass Property cursor value 'grab'
Pass Property cursor value 'grabbing'
Pass Property cursor value 'e-resize'
Pass Property cursor value 'n-resize'
Pass Property cursor value 'ne-resize'
Pass Property cursor value 'nw-resize'
Pass Property cursor value 's-resize'
Pass Property cursor value 'se-resize'
Pass Property cursor value 'sw-resize'
Pass Property cursor value 'w-resize'
Pass Property cursor value 'ew-resize'
Pass Property cursor value 'ns-resize'
Pass Property cursor value 'nesw-resize'
Pass Property cursor value 'nwse-resize'
Pass Property cursor value 'col-resize'
Pass Property cursor value 'row-resize'
Pass Property cursor value 'all-scroll'
Pass Property cursor value 'zoom-in'
Pass Property cursor value 'zoom-out'

View file

@ -0,0 +1,11 @@
Harness status: OK
Found 6 tests
6 Pass
Pass e.style['cursor'] = "en-resize" should not set the property value
Pass e.style['cursor'] = "url(\"https://example.com/\") alias" should not set the property value
Pass e.style['cursor'] = "1 2 url(\"https://example.com/\"), copy" should not set the property value
Pass e.style['cursor'] = "url(\"https://example.com/\"), url(\"https://example.com/\") 3, move" should not set the property value
Pass e.style['cursor'] = "url(\"https://example.com/\") 1px 2px, copy" should not set the property value
Pass e.style['cursor'] = "url(\"https://example.com/\"), url(\"https://example.com/\") 3% 4%, move" should not set the property value

View file

@ -0,0 +1,48 @@
Harness status: OK
Found 42 tests
36 Pass
6 Fail
Pass e.style['cursor'] = "auto" should set the property value
Pass e.style['cursor'] = "default" should set the property value
Pass e.style['cursor'] = "none" should set the property value
Pass e.style['cursor'] = "context-menu" should set the property value
Pass e.style['cursor'] = "help" should set the property value
Pass e.style['cursor'] = "pointer" should set the property value
Pass e.style['cursor'] = "progress" should set the property value
Pass e.style['cursor'] = "wait" should set the property value
Pass e.style['cursor'] = "cell" should set the property value
Pass e.style['cursor'] = "crosshair" should set the property value
Pass e.style['cursor'] = "text" should set the property value
Pass e.style['cursor'] = "vertical-text" should set the property value
Pass e.style['cursor'] = "alias" should set the property value
Pass e.style['cursor'] = "copy" should set the property value
Pass e.style['cursor'] = "move" should set the property value
Pass e.style['cursor'] = "no-drop" should set the property value
Pass e.style['cursor'] = "not-allowed" should set the property value
Pass e.style['cursor'] = "grab" should set the property value
Pass e.style['cursor'] = "grabbing" should set the property value
Pass e.style['cursor'] = "e-resize" should set the property value
Pass e.style['cursor'] = "n-resize" should set the property value
Pass e.style['cursor'] = "ne-resize" should set the property value
Pass e.style['cursor'] = "nw-resize" should set the property value
Pass e.style['cursor'] = "s-resize" should set the property value
Pass e.style['cursor'] = "se-resize" should set the property value
Pass e.style['cursor'] = "sw-resize" should set the property value
Pass e.style['cursor'] = "w-resize" should set the property value
Pass e.style['cursor'] = "ew-resize" should set the property value
Pass e.style['cursor'] = "ns-resize" should set the property value
Pass e.style['cursor'] = "nesw-resize" should set the property value
Pass e.style['cursor'] = "nwse-resize" should set the property value
Pass e.style['cursor'] = "col-resize" should set the property value
Pass e.style['cursor'] = "row-resize" should set the property value
Pass e.style['cursor'] = "all-scroll" should set the property value
Pass e.style['cursor'] = "zoom-in" should set the property value
Pass e.style['cursor'] = "zoom-out" should set the property value
Fail e.style['cursor'] = "url(\"https://example.com/\"), alias" should set the property value
Fail e.style['cursor'] = "url(\"https://example.com/\") 1 calc(2 + 0), copy" should set the property value
Fail e.style['cursor'] = "url(\"https://example.com/\"), url(\"https://example.com/\") 3 -4, move" should set the property value
Fail e.style['cursor'] = "url(\"https://example.com/\") 5 6, grab" should set the property value
Fail e.style['cursor'] = "image-set(\"https://example.com/\" 1x) 5 6, grab" should set the property value
Fail e.style['cursor'] = "image-set(\"https://example.com/\" 1x, \"https://example.com/highres\" 2x) 5 6, grab" should set the property value

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS UI Level 3: getComputedStyle().cursor</title>
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#cursor">
<meta name="assert" content="cursor computed value is as specified for keywords.">
<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("cursor", "auto");
test_computed_value("cursor", "default");
test_computed_value("cursor", "none");
test_computed_value("cursor", "context-menu");
test_computed_value("cursor", "help");
test_computed_value("cursor", "pointer");
test_computed_value("cursor", "progress");
test_computed_value("cursor", "wait");
test_computed_value("cursor", "cell");
test_computed_value("cursor", "crosshair");
test_computed_value("cursor", "text");
test_computed_value("cursor", "vertical-text");
test_computed_value("cursor", "alias");
test_computed_value("cursor", "copy");
test_computed_value("cursor", "move");
test_computed_value("cursor", "no-drop");
test_computed_value("cursor", "not-allowed");
test_computed_value("cursor", "grab");
test_computed_value("cursor", "grabbing");
test_computed_value("cursor", "e-resize");
test_computed_value("cursor", "n-resize");
test_computed_value("cursor", "ne-resize");
test_computed_value("cursor", "nw-resize");
test_computed_value("cursor", "s-resize");
test_computed_value("cursor", "se-resize");
test_computed_value("cursor", "sw-resize");
test_computed_value("cursor", "w-resize");
test_computed_value("cursor", "ew-resize");
test_computed_value("cursor", "ns-resize");
test_computed_value("cursor", "nesw-resize");
test_computed_value("cursor", "nwse-resize");
test_computed_value("cursor", "col-resize");
test_computed_value("cursor", "row-resize");
test_computed_value("cursor", "all-scroll");
test_computed_value("cursor", "zoom-in");
test_computed_value("cursor", "zoom-out");
// Not yet tested: // [ [<url> [<x> <y>]?,]*
// "relative URLs converted to absolute"
</script>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS UI Level 3: parsing cursor with invalid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-ui-3/#cursor">
<meta name="assert" content="cursor supports only the grammar.">
<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("cursor", "en-resize");
test_invalid_value("cursor", 'url("https://example.com/") alias');
test_invalid_value("cursor", '1 2 url("https://example.com/"), copy');
test_invalid_value("cursor", 'url("https://example.com/"), url("https://example.com/") 3, move');
test_invalid_value("cursor", 'url("https://example.com/") 1px 2px, copy');
test_invalid_value("cursor", 'url("https://example.com/"), url("https://example.com/") 3% 4%, move');
</script>
</body>
</html>

View file

@ -0,0 +1,108 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS UI Level 4: parsing cursor with valid values</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#cursor">
<meta name="assert" content="cursor supports the full required grammar.">
<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("cursor", "auto");
test_valid_value("cursor", "default");
test_valid_value("cursor", "none");
test_valid_value("cursor", "context-menu");
test_valid_value("cursor", "help");
test_valid_value("cursor", "pointer");
test_valid_value("cursor", "progress");
test_valid_value("cursor", "wait");
test_valid_value("cursor", "cell");
test_valid_value("cursor", "crosshair");
test_valid_value("cursor", "text");
test_valid_value("cursor", "vertical-text");
test_valid_value("cursor", "alias");
test_valid_value("cursor", "copy");
test_valid_value("cursor", "move");
test_valid_value("cursor", "no-drop");
test_valid_value("cursor", "not-allowed");
test_valid_value("cursor", "grab");
test_valid_value("cursor", "grabbing");
test_valid_value("cursor", "e-resize");
test_valid_value("cursor", "n-resize");
test_valid_value("cursor", "ne-resize");
test_valid_value("cursor", "nw-resize");
test_valid_value("cursor", "s-resize");
test_valid_value("cursor", "se-resize");
test_valid_value("cursor", "sw-resize");
test_valid_value("cursor", "w-resize");
test_valid_value("cursor", "ew-resize");
test_valid_value("cursor", "ns-resize");
test_valid_value("cursor", "nesw-resize");
test_valid_value("cursor", "nwse-resize");
test_valid_value("cursor", "col-resize");
test_valid_value("cursor", "row-resize");
test_valid_value("cursor", "all-scroll");
test_valid_value("cursor", "zoom-in");
test_valid_value("cursor", "zoom-out");
test_valid_value(
"cursor",
'url("https://example.com/"), alias',
[
'url("https://example.com/"), alias',
'url(https://example.com/), alias'
]
);
test_valid_value(
"cursor",
'url("https://example.com/") 1 calc(2 + 0), copy',
[
'url("https://example.com/") 1 calc(2), copy',
'url("https://example.com/") 1 2, copy',
'url(https://example.com/) 1 2, copy'
]
);
test_valid_value(
"cursor",
'url("https://example.com/"), url("https://example.com/") 3 -4, move',
[
'url("https://example.com/"), url("https://example.com/") 3 -4, move',
'url(https://example.com/), url(https://example.com/) 3 -4, move'
]
);
test_valid_value(
"cursor",
'url("https://example.com/") 5 6, grab',
[
'url("https://example.com/") 5 6, grab',
'url(https://example.com/) 5 6, grab'
]
);
test_valid_value(
"cursor",
'image-set("https://example.com/" 1x) 5 6, grab',
[
'image-set(url("https://example.com/") 1x) 5 6, grab',
'image-set(url(https://example.com/) 1x) 5 6, grab'
]
);
test_valid_value(
"cursor",
'image-set("https://example.com/" 1x, "https://example.com/highres" 2x) 5 6, grab',
[
'image-set(url("https://example.com/") 1x, url("https://example.com/highres") 2x) 5 6, grab',
'image-set(url(https://example.com/) 1x, url(https://example.com/highres) 2x) 5 6, grab'
]
);
</script>
</body>
</html>