Tests: Import/create tests related to absolutization of StyleValues

Done in a separate commit to show progress
This commit is contained in:
Callum Law 2025-08-04 23:22:34 +12:00 committed by Sam Atkins
commit 70cb8d23fb
Notes: github-actions[bot] 2025-08-06 16:45:54 +00:00
6 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1 @@
calc(1em - 1px) calc(1em - 1px)

View file

@ -0,0 +1 @@
url("foo.png") calc(1 * sign(1em - 1px)) calc(2 * sign(1em - 1px)), pointer

View file

@ -0,0 +1,20 @@
Harness status: OK
Found 14 tests
12 Pass
2 Fail
Pass Property border-radius value '1px'
Pass Property border-radius value '1px 2% 3px 4%'
Pass Property border-radius value '5em / 1px 2% 3px 4%'
Pass Property border-radius value '1px 2% 3px 4% / 5em'
Pass Property border-radius value '1px 1px 1px 2% / 1px 2% 1px 2%'
Pass Property border-radius value '1px 1px 1px 1px / 1px 1px 2% 1px'
Pass Property border-radius value '1px 1px 2% 2%'
Pass Property border-radius value '1px 2% 1px 1px'
Pass Property border-radius value '1px 2% 2% 2% / 1px 2% 3px 2%'
Fail Property border-top-left-radius value 'calc(-0.5em + 10px)'
Pass Property border-top-right-radius value '20%'
Fail Property border-bottom-right-radius value 'calc(0.5em + 10px) 40%'
Pass Property border-bottom-left-radius value '50% 60px'
Pass Property border-top-left-radius value '40px 0px'

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<style>
#foo {
background-size: calc(1em - 1px) calc(1em - 1px);
}
</style>
<div id="foo"></div>
<script src="../include.js"></script>
<script>
test(() => {
println(getComputedStyle(foo).backgroundSize);
});
</script>

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<style>
#foo {
cursor: url(foo.png) calc(1 * sign(1em - 1px)) calc(2 * sign(1em - 1px)), pointer;
}
</style>
<div id="foo"></div>
<script src="../include.js"></script>
<script>
test(() => {
println(getComputedStyle(foo).cursor);
});
</script>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Backgrounds and Borders Module Level 3: getComputedStyle().borderRadius</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#border-radius">
<meta name="assert" content="Computed value has computed length-percentage values.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
<style>
#target {
font-size: 40px;
}
</style>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("border-radius", "1px");
test_computed_value("border-radius", "1px 2% 3px 4%");
test_computed_value("border-radius", "5em / 1px 2% 3px 4%", "200px / 1px 2% 3px 4%");
test_computed_value("border-radius", "1px 2% 3px 4% / 5em", "1px 2% 3px 4% / 200px");
test_computed_value("border-radius", "1px 1px 1px 2% / 1px 2% 1px 2%", "1px 1px 1px 2% / 1px 2%");
test_computed_value("border-radius", "1px 1px 1px 1px / 1px 1px 2% 1px", "1px / 1px 1px 2%");
test_computed_value("border-radius", "1px 1px 2% 2%");
test_computed_value("border-radius", "1px 2% 1px 1px");
test_computed_value("border-radius", "1px 2% 2% 2% / 1px 2% 3px 2%", "1px 2% 2% / 1px 2% 3px");
test_computed_value("border-top-left-radius", "calc(-0.5em + 10px)", "0px");
test_computed_value("border-top-right-radius", "20%");
test_computed_value("border-bottom-right-radius", "calc(0.5em + 10px) 40%", "30px 40%");
test_computed_value("border-bottom-left-radius", "50% 60px");
test_computed_value("border-top-left-radius", "40px 0px", "40px 0px");
</script>
</body>
</html>