Commit b623022b authored by Yi Xu's avatar Yi Xu Committed by Commit Bot

[WPT test] Update text.measurement expectation

After verifying the spec, I learned that
measureText('A  B').width != measureText('A B').width. The spaces do not
suppose to collapse:
-> Replace all ASCII whitespace in text with U+0020 SPACE characters.
-> Then the 'white-space' property set to 'pre'.
-> Then Let result be an array constructed by iterating over each glyph
in the inline box from left to right (if any), adding to the array, for
each glyph, the shape of the glyph as it is in the inline box,
positioned on a coordinate space using CSS pixels with its origin is at
the anchor point.

Update the test expectation accordingly.

Bug: 1066953

Change-Id: Ifb9885815f3cbf3d46432107abf16af6ed5b4cf2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2306575Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarAaron Krajeski <aaronhk@chromium.org>
Commit-Queue: Yi Xu <yiyix@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791412}
parent 633b7a63
This is a testharness.js-based test. This is a testharness.js-based test.
FAIL Space characters are converted to U+0020 and collapsed (per CSS) assert_equals: ctx.measureText('A B').width === 150 (got 200[number], expected 150[number]) expected 150 but got 200 FAIL Space characters are converted to U+0020 and collapsed (per CSS) assert_equals: ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150 (got 650[number], expected 150[number]) expected 150 but got 650
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -33,7 +33,7 @@ document.fonts.ready.then(() => { ...@@ -33,7 +33,7 @@ document.fonts.ready.then(() => {
step_timeout(t.step_func_done(function () { step_timeout(t.step_func_done(function () {
ctx.font = '50px CanvasTest'; ctx.font = '50px CanvasTest';
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 200, "ctx.measureText('A B').width", "200");
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150"); _assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200"); _assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
......
This is a testharness.js-based test. This is a testharness.js-based test.
FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas assert_equals: ctx.measureText('A B').width === 150 (got 200[number], expected 150[number]) expected 150 but got 200 FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas assert_equals: ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150 (got 650[number], expected 150[number]) expected 150 but got 650
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -27,7 +27,7 @@ fonts.add(f); ...@@ -27,7 +27,7 @@ fonts.add(f);
fonts.ready.then(function() { fonts.ready.then(function() {
ctx.font = '50px CanvasTest'; ctx.font = '50px CanvasTest';
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 200, "ctx.measureText('A B').width", "200");
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150"); _assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200"); _assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
......
This is a testharness.js-based test. This is a testharness.js-based test.
FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas assert_equals: ctx.measureText('A B').width === 150 (got 200[number], expected 150[number]) expected 150 but got 200 FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas assert_equals: ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150 (got 650[number], expected 150[number]) expected 150 but got 650
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -23,7 +23,7 @@ fonts.add(f); ...@@ -23,7 +23,7 @@ fonts.add(f);
fonts.ready.then(function() { fonts.ready.then(function() {
ctx.font = '50px CanvasTest'; ctx.font = '50px CanvasTest';
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150"); _assertSame(ctx.measureText('A B').width, 200, "ctx.measureText('A B').width", "200");
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150"); _assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200"); _assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
......
...@@ -455,7 +455,7 @@ ...@@ -455,7 +455,7 @@
step_timeout(t.step_func_done(function () { step_timeout(t.step_func_done(function () {
ctx.font = '50px CanvasTest'; ctx.font = '50px CanvasTest';
@assert ctx.measureText('A B').width === 150; @assert ctx.measureText('A B').width === 150;
@assert ctx.measureText('A B').width === 150; @moz-todo @assert ctx.measureText('A B').width === 200;
@assert ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150; @moz-todo @assert ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150; @moz-todo
@assert ctx.measureText('A \x0b B').width >= 200; @assert ctx.measureText('A \x0b B').width >= 200;
......
...@@ -1089,7 +1089,7 @@ ...@@ -1089,7 +1089,7 @@
fonts.ready.then(function() { fonts.ready.then(function() {
ctx.font = '50px CanvasTest'; ctx.font = '50px CanvasTest';
@assert ctx.measureText('A B').width === 150; @assert ctx.measureText('A B').width === 150;
@assert ctx.measureText('A B').width === 150; @moz-todo @assert ctx.measureText('A B').width === 200;
@assert ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150; @moz-todo @assert ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150; @moz-todo
@assert ctx.measureText('A \x0b B').width >= 200; @assert ctx.measureText('A \x0b B').width >= 200;
......
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