Skip to content

Commit cd0e4e4

Browse files
mhochkchromium-wpt-export-bot
authored andcommitted
Agnosticize seg-break-transformation tests
This does *not* fix these tests, it reduces the test expectations noise. Update the seg-break-transformation tests to all specify a provided font rather than relying on the OS default, so their failure values are identical across platforms. This aligns with the latest of these tests (which were already specifying a font), reduces the number of expectations files currently needed, and protects against needing to make additional platform-specific expectations files for these tests going forward (which has historically happend for different Mac versions). It does not use the Ahem font (used by the latest of these tests) because that does not include all the relevant characters being tested. This also required updating these tests (that are using script) to explicitly wait for font loading to complete. Otherwise, they would potentially be falling back to the defaults, re-introducing the problem this is trying to fix. While touching these files, also updating their spec links to point at css-text-4 (where this functionality is currently an open issue). Bug: 40771963 Change-Id: I30a936bae5c0a20c856ce3464fee31babd01ef73 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8133969 Reviewed-by: Kurt Catti-Schmidt <kschmi@microsoft.com> Reviewed-by: Alison Maher <almaher@microsoft.com> Commit-Queue: Hoch Hochkeppel <mhochk@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1669643}
1 parent 012495e commit cd0e4e4

19 files changed

Lines changed: 532 additions & 447 deletions

css/css-text/white-space/seg-break-transformation-000.tentative.html

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
<meta charset="utf-8">
55
<title>Whitespace and line break transformation</title>
66
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
7-
<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
7+
<link rel='help' href='https://drafts.csswg.org/css-text-4/#line-break-transform'>
88
<meta name="assert" content="All spaces and tabs immediately preceding or following a segment break are removed. If no F, H, W or ZWSP characters involved, the segment break is converted to a space.">
99
<style type='text/css'>
10+
@font-face { font-family: CSSFW; src: url('/fonts/adobe-fonts/CSSFWOrientationTest.otf'); }
1011
/* the CSS below is not part of the test */
11-
.test span { font-size: 24px; font-family: sans-serif; background-color:#2AA5F7; color: white; }
12-
.ref span { font-size: 24px; font-family: sans-serif; background-color:#270CEF; color: white; }
12+
.test span { font-size: 24px; font-family: CSSFW; background-color:#2AA5F7; color: white; }
13+
.ref span { font-size: 24px; font-family: CSSFW; background-color:#270CEF; color: white; }
1314
</style>
1415
<script src="/resources/testharness.js"></script>
1516
<script src="/resources/testharnessreport.js"></script>
@@ -34,24 +35,28 @@
3435
&#x20;&#x20;&#x20;there</span></div>
3536
<div id="ref" class="ref"><span>hello there</span></div>
3637
<script>
37-
test(function() {
38-
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
39-
}, "linebreak only");
40-
test(function() {
41-
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42-
}, "spaces linebreak");
43-
test(function() {
44-
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45-
}, "linebreak spaces");
46-
test(function() {
47-
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48-
}, "spaces linebreak spaces");
49-
test(function() {
50-
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51-
}, "multiple linebreaks");
52-
test(function() {
53-
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54-
}, "multiple linebreaks + spaces");
38+
setup({explicit_done: true});
39+
document.fonts.ready.then(() => {
40+
test(function() {
41+
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42+
}, "linebreak only");
43+
test(function() {
44+
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45+
}, "spaces linebreak");
46+
test(function() {
47+
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48+
}, "linebreak spaces");
49+
test(function() {
50+
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51+
}, "spaces linebreak spaces");
52+
test(function() {
53+
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54+
}, "multiple linebreaks");
55+
test(function() {
56+
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
57+
}, "multiple linebreaks + spaces");
58+
done();
59+
});
5560
</script>
5661
<!-- Notes:
5762
The assertion will fail if more than one space is produced for any line in the test paragraph.

css/css-text/white-space/seg-break-transformation-001.tentative.html

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
<meta charset="utf-8">
55
<title>Wide characters around line break</title>
66
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
7-
<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
7+
<link rel='help' href='https://drafts.csswg.org/css-text-4/#line-break-transform'>
88
<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is W and neither side is Hangul, then the segment break is removed.">
99
<style type='text/css'>
10+
@font-face { font-family: CSSFW; src: url('/fonts/adobe-fonts/CSSFWOrientationTest.otf'); }
1011
/* the CSS below is not part of the test */
11-
.test span { font-size: 24px; font-family: sans-serif; background-color:#2AA5F7; color: white; }
12-
.ref span { font-size: 24px; font-family: sans-serif; background-color:#270CEF; color: white; }
12+
.test span { font-size: 24px; font-family: CSSFW; background-color:#2AA5F7; color: white; }
13+
.ref span { font-size: 24px; font-family: CSSFW; background-color:#270CEF; color: white; }
1314
</style>
1415
<script src="/resources/testharness.js"></script>
1516
<script src="/resources/testharnessreport.js"></script>
@@ -34,24 +35,28 @@
3435
&#x20;&#x20;&#x20;中国话</span></div>
3536
<div id="ref" class="ref"><span>日本語中国话</span></div>
3637
<script>
37-
test(function() {
38-
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
39-
}, "linebreak only");
40-
test(function() {
41-
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42-
}, "spaces linebreak");
43-
test(function() {
44-
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45-
}, "linebreak spaces");
46-
test(function() {
47-
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48-
}, "spaces linebreak spaces");
49-
test(function() {
50-
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51-
}, "multiple linebreaks");
52-
test(function() {
53-
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54-
}, "multiple linebreaks + spaces");
38+
setup({explicit_done: true});
39+
document.fonts.ready.then(() => {
40+
test(function() {
41+
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42+
}, "linebreak only");
43+
test(function() {
44+
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45+
}, "spaces linebreak");
46+
test(function() {
47+
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48+
}, "linebreak spaces");
49+
test(function() {
50+
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51+
}, "spaces linebreak spaces");
52+
test(function() {
53+
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54+
}, "multiple linebreaks");
55+
test(function() {
56+
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
57+
}, "multiple linebreaks + spaces");
58+
done();
59+
});
5560
</script>
5661
<!-- Notes:
5762
The assertion will fail if space is produced for any line in the test paragraph.

css/css-text/white-space/seg-break-transformation-002.tentative.html

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
<meta charset="utf-8">
55
<title>Fullwidth characters around line break</title>
66
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
7-
<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
7+
<link rel='help' href='https://drafts.csswg.org/css-text-4/#line-break-transform'>
88
<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is F and neither side is Hangul, then the segment break is removed.">
99
<style type='text/css'>
10+
@font-face { font-family: CSSFW; src: url('/fonts/adobe-fonts/CSSFWOrientationTest.otf'); }
1011
/* the CSS below is not part of the test */
11-
.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
12-
.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
12+
.test span { font-size: 24px; font-family: CSSFW; background-color: #2AA5F7; color: white; }
13+
.ref span { font-size: 24px; font-family: CSSFW; background-color: #270CEF; color: white; }
1314
</style>
1415
<script src="/resources/testharness.js"></script>
1516
<script src="/resources/testharnessreport.js"></script>
@@ -34,24 +35,28 @@
3435
&#x20;&#x20;&#x20;WIDTH</span></div>
3536
<div id="ref" class="ref"><span>FULLWIDTH</span></div>
3637
<script>
37-
test(function() {
38-
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
39-
}, "linebreak only");
40-
test(function() {
41-
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42-
}, "spaces linebreak");
43-
test(function() {
44-
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45-
}, "linebreak spaces");
46-
test(function() {
47-
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48-
}, "spaces linebreak spaces");
49-
test(function() {
50-
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51-
}, "multiple linebreaks");
52-
test(function() {
53-
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54-
}, "multiple linebreaks + spaces");
38+
setup({explicit_done: true});
39+
document.fonts.ready.then(() => {
40+
test(function() {
41+
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42+
}, "linebreak only");
43+
test(function() {
44+
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45+
}, "spaces linebreak");
46+
test(function() {
47+
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48+
}, "linebreak spaces");
49+
test(function() {
50+
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51+
}, "spaces linebreak spaces");
52+
test(function() {
53+
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54+
}, "multiple linebreaks");
55+
test(function() {
56+
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
57+
}, "multiple linebreaks + spaces");
58+
done();
59+
});
5560
</script>
5661
<!-- Notes:
5762
The assertion will fail if space is produced for any line in the test paragraph.

css/css-text/white-space/seg-break-transformation-003.tentative.html

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
<meta charset="utf-8">
55
<title>Halfwidth characters around line break</title>
66
<link rel='author' title='Richard Ishida' href='mailto:ishida@w3.org'>
7-
<link rel='help' href='https://drafts.csswg.org/css-text-3/#line-break-transform'>
7+
<link rel='help' href='https://drafts.csswg.org/css-text-4/#line-break-transform'>
88
<meta name="assert" content="If the East Asian Width property of both the character before and after the line feed is H and neither side is Hangul, then the segment break is removed.">
99
<style type='text/css'>
10+
@font-face { font-family: CSSFW; src: url('/fonts/adobe-fonts/CSSFWOrientationTest.otf'); }
1011
/* the CSS below is not part of the test */
11-
.test span { font-size: 24px; font-family: sans-serif; background-color: #2AA5F7; color: white; }
12-
.ref span { font-size: 24px; font-family: sans-serif; background-color: #270CEF; color: white; }
12+
.test span { font-size: 24px; font-family: CSSFW; background-color: #2AA5F7; color: white; }
13+
.ref span { font-size: 24px; font-family: CSSFW; background-color: #270CEF; color: white; }
1314
</style>
1415
<script src="/resources/testharness.js"></script>
1516
<script src="/resources/testharnessreport.js"></script>
@@ -34,24 +35,28 @@
3435
&#x20;&#x20;&#x20;カク</span></div>
3536
<div id="ref" class="ref"><span>ハンカク</span></div>
3637
<script>
37-
test(function() {
38-
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
39-
}, "linebreak only");
40-
test(function() {
41-
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42-
}, "spaces linebreak");
43-
test(function() {
44-
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45-
}, "linebreak spaces");
46-
test(function() {
47-
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48-
}, "spaces linebreak spaces");
49-
test(function() {
50-
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51-
}, "multiple linebreaks");
52-
test(function() {
53-
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54-
}, "multiple linebreaks + spaces");
38+
setup({explicit_done: true});
39+
document.fonts.ready.then(() => {
40+
test(function() {
41+
assert_equals(document.getElementById('test1').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
42+
}, "linebreak only");
43+
test(function() {
44+
assert_equals(document.getElementById('test2').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
45+
}, "spaces linebreak");
46+
test(function() {
47+
assert_equals(document.getElementById('test3').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
48+
}, "linebreak spaces");
49+
test(function() {
50+
assert_equals(document.getElementById('test4').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
51+
}, "spaces linebreak spaces");
52+
test(function() {
53+
assert_equals(document.getElementById('test5').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
54+
}, "multiple linebreaks");
55+
test(function() {
56+
assert_equals(document.getElementById('test6').firstChild.offsetWidth, document.getElementById('ref').firstChild.offsetWidth);
57+
}, "multiple linebreaks + spaces");
58+
done();
59+
});
5560
</script>
5661
<!-- Notes:
5762
The assertion will fail if space is produced for any line in the test paragraph.

0 commit comments

Comments
 (0)