Commit 55d429a7 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS: WPT for font-variation-settings parsing

font-variation-settings is 'normal' or a comma-delimited
list of string - number pairs.

Each string is 4 characters.

https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def


Change-Id: I9ecd80be68a1575647f4dc64864640bc36ee2b64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1728583
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682685}
parent a5d34d76
...@@ -26,6 +26,8 @@ PASS Property font-variant-numeric has initial value normal ...@@ -26,6 +26,8 @@ PASS Property font-variant-numeric has initial value normal
PASS Property font-variant-numeric inherits PASS Property font-variant-numeric inherits
FAIL Property font-variant-position has initial value normal assert_true: font-variant-position doesn't seem to be supported in the computed style expected true got false FAIL Property font-variant-position has initial value normal assert_true: font-variant-position doesn't seem to be supported in the computed style expected true got false
FAIL Property font-variant-position inherits assert_true: font-variant-position doesn't seem to be supported in the computed style expected true got false FAIL Property font-variant-position inherits assert_true: font-variant-position doesn't seem to be supported in the computed style expected true got false
PASS Property font-variation-settings has initial value normal
PASS Property font-variation-settings inherits
PASS Property font-weight has initial value 400 PASS Property font-weight has initial value 400
PASS Property font-weight inherits PASS Property font-weight inherits
Harness: the test ran to completion. Harness: the test ran to completion.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Inheritance of CSS Fonts Level 3 properties</title> <title>Inheritance of CSS Fonts Level 3 properties</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#property-index"> <link rel="help" href="https://www.w3.org/TR/css-fonts-3/#property-index">
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-stretch-prop"> <link rel="help" href="https://www.w3.org/TR/css-fonts-4/#property-index">
<meta name="assert" content="Properties inherit according to the spec."> <meta name="assert" content="Properties inherit according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec."> <meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
...@@ -40,6 +40,7 @@ assert_inherited('font-variant-east-asian', 'normal', 'ruby'); ...@@ -40,6 +40,7 @@ assert_inherited('font-variant-east-asian', 'normal', 'ruby');
assert_inherited('font-variant-ligatures', 'normal', 'none'); assert_inherited('font-variant-ligatures', 'normal', 'none');
assert_inherited('font-variant-numeric', 'normal', 'ordinal'); assert_inherited('font-variant-numeric', 'normal', 'ordinal');
assert_inherited('font-variant-position', 'normal', 'super'); assert_inherited('font-variant-position', 'normal', 'super');
assert_inherited('font-variation-settings', 'normal', '"wght" 700');
assert_inherited('font-weight', '400' /* normal */, '900'); assert_inherited('font-weight', '400' /* normal */, '900');
</script> </script>
</body> </body>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 3: getComputedStyle().fontVariationSettings</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings computed value is as specified.">
<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('font-variation-settings', 'normal');
test_computed_value('font-variation-settings', '"wght" 700');
test_computed_value('font-variation-settings', '"wght" 700, "XHGT" 0.7');
test_computed_value('font-variation-settings', '"XHGT" calc(0.4 + 0.3)', '"XHGT" 0.7');
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-variation-settings with invalid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings supports only the grammar 'normal | [ <string> <number>] #'.">
<meta name="assert" content="font-variation-settings strings must have 4 characters.">
<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-variation-settings', '700');
test_invalid_value('font-variation-settings', '"XHGT"');
test_invalid_value('font-variation-settings', 'wght 700');
test_invalid_value('font-variation-settings', 'normal, "wght" 700');
test_invalid_value('font-variation-settings', '"wgt" 700');
test_invalid_value('font-variation-settings', '"XHGTX" 0.7');
test_invalid_value('font-variation-settings', '"abc\1F" 0.5');
test_invalid_value('font-variation-settings', '"abc\7F" 0.5');
test_invalid_value('font-variation-settings', '"abc\A9" 0.5');
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Fonts Module Level 4: parsing font-variation-settings with valid values</title>
<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-variation-settings">
<meta name="assert" content="font-variation-settings supports the full grammar 'normal | [ <string> <number>] #'.">
<meta name="assert" content="font-variation-settings strings are case sensitive.">
<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-variation-settings', 'normal');
test_valid_value('font-variation-settings', '"wght" 700');
test_valid_value('font-variation-settings', '"wght" 700, "XHGT" 0.7');
test_valid_value('font-variation-settings', '"a cd" 0.5');
test_valid_value('font-variation-settings', '"ab@d" 0.5');
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment