Tests: Reimport font-stretch tests as font-width

Corresponds to 7c0c4806bb
This commit is contained in:
Sam Atkins 2025-04-02 12:45:16 +01:00
parent a5df972055
commit 3401981271
9 changed files with 142 additions and 102 deletions

View file

@ -1,9 +1,24 @@
Harness status: OK
Found 15 tests
Found 30 tests
4 Pass
11 Fail
8 Pass
22 Fail
Fail Property font-width value 'ultra-condensed'
Fail Property font-width value 'extra-condensed'
Fail Property font-width value 'condensed'
Fail Property font-width value 'semi-condensed'
Fail Property font-width value 'normal'
Fail Property font-width value 'semi-expanded'
Fail Property font-width value 'expanded'
Fail Property font-width value 'extra-expanded'
Fail Property font-width value 'ultra-expanded'
Pass Property font-width value '234.5%'
Pass Property font-width value 'calc(100%)'
Pass Property font-width value 'calc(0%)'
Fail Property font-width value 'calc(-100%)'
Pass Property font-width value 'calc(100% + 100%)'
Fail Property font-width value 'calc(100% + (sign(20cqw - 10px) * 5%))'
Fail Property font-stretch value 'ultra-condensed'
Fail Property font-stretch value 'extra-condensed'
Fail Property font-stretch value 'condensed'

View file

@ -1,8 +1,12 @@
Harness status: OK
Found 4 tests
Found 8 tests
4 Pass
8 Pass
Pass e.style['font-width'] = "auto" should not set the property value
Pass e.style['font-width'] = "normal, ultra-condensed" should not set the property value
Pass e.style['font-width'] = "condensed expanded" should not set the property value
Pass e.style['font-width'] = "-50%" should not set the property value
Pass e.style['font-stretch'] = "auto" should not set the property value
Pass e.style['font-stretch'] = "normal, ultra-condensed" should not set the property value
Pass e.style['font-stretch'] = "condensed expanded" should not set the property value

View file

@ -1,9 +1,24 @@
Harness status: OK
Found 15 tests
Found 30 tests
14 Pass
1 Fail
28 Pass
2 Fail
Pass e.style['font-width'] = "normal" should set the property value
Pass e.style['font-width'] = "ultra-condensed" should set the property value
Pass e.style['font-width'] = "extra-condensed" should set the property value
Pass e.style['font-width'] = "condensed" should set the property value
Pass e.style['font-width'] = "semi-condensed" should set the property value
Pass e.style['font-width'] = "semi-expanded" should set the property value
Pass e.style['font-width'] = "expanded" should set the property value
Pass e.style['font-width'] = "extra-expanded" should set the property value
Pass e.style['font-width'] = "ultra-expanded" should set the property value
Pass e.style['font-width'] = "234.5%" should set the property value
Pass e.style['font-width'] = "calc(100%)" should set the property value
Pass e.style['font-width'] = "calc(0%)" should set the property value
Pass e.style['font-width'] = "calc(-100%)" should set the property value
Pass e.style['font-width'] = "calc(100% + 100%)" should set the property value
Fail e.style['font-width'] = "calc(100% + (sign(20cqw - 10px) * 5%))" should set the property value
Pass e.style['font-stretch'] = "normal" should set the property value
Pass e.style['font-stretch'] = "ultra-condensed" should set the property value
Pass e.style['font-stretch'] = "extra-condensed" should set the property value

View file

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: getComputedStyle().fontStretch</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch computed value is a percentage.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
<style>
#container {
container-type: inline-size;
width: 10px;
}
</style>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<script>
test_computed_value('font-stretch', 'ultra-condensed', '50%');
test_computed_value('font-stretch', 'extra-condensed', '62.5%');
test_computed_value('font-stretch', 'condensed', '75%');
test_computed_value('font-stretch', 'semi-condensed', '87.5%');
test_computed_value('font-stretch', 'normal', '100%');
test_computed_value('font-stretch', 'semi-expanded', '112.5%');
test_computed_value('font-stretch', 'expanded', '125%');
test_computed_value('font-stretch', 'extra-expanded', '150%');
test_computed_value('font-stretch', 'ultra-expanded', '200%');
test_computed_value('font-stretch', '234.5%');
test_computed_value('font-stretch', 'calc(100%)', '100%');
test_computed_value('font-stretch', 'calc(0%)', '0%');
test_computed_value('font-stretch', 'calc(-100%)', '0%');
test_computed_value('font-stretch', 'calc(100% + 100%)', '200%');
test_computed_value('font-stretch', 'calc(100% + (sign(20cqw - 10px) * 5%))', '95%');
</script>
</body>
</html>

View file

@ -1,21 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-stretch with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch supports only the grammar 'normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<meta name="assert" content="Values less than 0% are invalid.">
<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('font-stretch', 'auto');
test_invalid_value('font-stretch', 'normal, ultra-condensed');
test_invalid_value('font-stretch', 'condensed expanded');
test_invalid_value('font-stretch', '-50%');
</script>
</body>
</html>

View file

@ -1,32 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-stretch with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop">
<meta name="assert" content="font-stretch supports the full grammar 'normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<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('font-stretch', 'normal');
test_valid_value('font-stretch', 'ultra-condensed');
test_valid_value('font-stretch', 'extra-condensed');
test_valid_value('font-stretch', 'condensed');
test_valid_value('font-stretch', 'semi-condensed');
test_valid_value('font-stretch', 'semi-expanded');
test_valid_value('font-stretch', 'expanded');
test_valid_value('font-stretch', 'extra-expanded');
test_valid_value('font-stretch', 'ultra-expanded');
test_valid_value('font-stretch', '234.5%');
test_valid_value('font-stretch', 'calc(100%)');
test_valid_value('font-stretch', 'calc(0%)');
test_valid_value('font-stretch', 'calc(-100%)');
test_valid_value('font-stretch', 'calc(100% + 100%)', 'calc(200%)');
test_valid_value('font-stretch', 'calc(100% + (sign(20cqw - 10px) * 5%))', 'calc(100% + (5% * sign(20cqw - 10px)))');
</script>
</body>
</html>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: getComputedStyle().fontWidth</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-width-prop">
<meta name="assert" content="font-width computed value is a percentage.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
<style>
#container {
container-type: inline-size;
width: 10px;
}
</style>
</head>
<body>
<div id="container">
<div id="target"></div>
</div>
<script>
for (const property of ['font-width','font-stretch']) {
test_computed_value(property, 'ultra-condensed', '50%');
test_computed_value(property, 'extra-condensed', '62.5%');
test_computed_value(property, 'condensed', '75%');
test_computed_value(property, 'semi-condensed', '87.5%');
test_computed_value(property, 'normal', '100%');
test_computed_value(property, 'semi-expanded', '112.5%');
test_computed_value(property, 'expanded', '125%');
test_computed_value(property, 'extra-expanded', '150%');
test_computed_value(property, 'ultra-expanded', '200%');
test_computed_value(property, '234.5%');
test_computed_value(property, 'calc(100%)', '100%');
test_computed_value(property, 'calc(0%)', '0%');
test_computed_value(property, 'calc(-100%)', '0%');
test_computed_value(property, 'calc(100% + 100%)', '200%');
test_computed_value(property, 'calc(100% + (sign(20cqw - 10px) * 5%))', '95%');
}
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-width with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-width-prop">
<meta name="assert" content="font-width supports only the grammar 'normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<meta name="assert" content="Values less than 0% are invalid.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
for (const property of ['font-width','font-stretch']) {
test_invalid_value(property, 'auto');
test_invalid_value(property, 'normal, ultra-condensed');
test_invalid_value(property, 'condensed expanded');
test_invalid_value(property, '-50%');
}
</script>
</body>
</html>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-width with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-width-prop">
<meta name="assert" content="font-width supports the full grammar 'normal | <percentage [0,∞]> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded'.">
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
for (const property of ['font-width','font-stretch']) {
test_valid_value(property, 'normal');
test_valid_value(property, 'ultra-condensed');
test_valid_value(property, 'extra-condensed');
test_valid_value(property, 'condensed');
test_valid_value(property, 'semi-condensed');
test_valid_value(property, 'semi-expanded');
test_valid_value(property, 'expanded');
test_valid_value(property, 'extra-expanded');
test_valid_value(property, 'ultra-expanded');
test_valid_value(property, '234.5%');
test_valid_value(property, 'calc(100%)');
test_valid_value(property, 'calc(0%)');
test_valid_value(property, 'calc(-100%)');
test_valid_value(property, 'calc(100% + 100%)', 'calc(200%)');
test_valid_value(property, 'calc(100% + (sign(20cqw - 10px) * 5%))', 'calc(100% + (5% * sign(20cqw - 10px)))');
}
</script>
</body>
</html>