Skip to content

Commit

Permalink
Bug 1722788 [wpt PR 29822] - Rename Canvas2D.textLetterSpacing to Can…
Browse files Browse the repository at this point in the history
…vas2D.letterSpacing, a=testonly

Automatic update from web-platform-tests
Rename Canvas2D.textLetterSpacing to Canvas2D.letterSpacing

Per discussion in w3ctag/design-reviews#627,
we have agreed to remove text prefix for attribute textLetterSpacing. So
that thee attribute name letterSpacing follows the same naming
conversion of other text attributes.

Bug: 1233706

Change-Id: I8b37f046f5cdbfb28848ba3930e047203b061982
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3056509
Commit-Queue: Yi Xu <[email protected]>
Reviewed-by: Bo <[email protected]>
Reviewed-by: Aaron Krajeski <[email protected]>
Cr-Commit-Position: refs/heads/master@{#906594}

--

wpt-commits: 34cb7e900e12fb6b9dc71b6c78d0aa9915dd18d4
wpt-pr: 29822
  • Loading branch information
yiyix authored and moz-wptsync-bot committed Jul 31, 2021
1 parent 0eaffca commit 6b4c2fe
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ <h1>2d.text.drawing.style.nonfinite.spacing</h1>
var t = async_test("Testing letter spacing and word spacing with nonfinite inputs");
_addTest(function(canvas, ctx) {

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

function test_word_spacing(value) {
ctx.wordSpacing = value;
ctx.textLetterSpacing = value;
ctx.letterSpacing = value;
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
}
test_word_spacing(NaN);
test_word_spacing(Infinity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ <h1>2d.text.drawing.style.spacing</h1>
var t = async_test("Testing letter spacing and word spacing");
_addTest(function(canvas, ctx) {

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.wordSpacing = 5;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");

ctx.textLetterSpacing = -1;
ctx.letterSpacing = -1;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -1, "ctx.textLetterSpacing", "-1");
_assertSame(ctx.letterSpacing, -1, "ctx.letterSpacing", "-1");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ <h1>2d.text.drawing.style.spacing.measure</h1>
var t = async_test("Testing letter spacing and word spacing");
_addTest(function(canvas, ctx) {

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_normal = ctx.measureText('Hello World').width;

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_with_spacing = ctx.measureText('Hello World').width;
// Add letter spacing after each letter, so 11 * 3 = 33px longer.
_assertSame(width_with_spacing, width_normal + 33, "width_with_spacing", "width_normal + 33");

ctx.wordSpacing = 5;
ctx.textLetterSpacing = 0;
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
ctx.letterSpacing = 0;
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");
// Add Word Spacing between "Hello" and "World", so it's 5px longer.
width_with_spacing = ctx.measureText('Hello World').width;
_assertSame(width_with_spacing, width_normal + 5, "width_with_spacing", "width_normal + 5");

ctx.textLetterSpacing = -2;
ctx.letterSpacing = -2;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -2, "ctx.textLetterSpacing", "-2");
_assertSame(ctx.letterSpacing, -2, "ctx.letterSpacing", "-2");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");
// Add Word Spacing and letter spacing, so it's -11*2 = -22px from
// letter spacing and -1px from word spacing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ <h1>2d.text.drawing.style.nonfinite.spacing</h1>
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

function test_word_spacing(value) {
ctx.wordSpacing = value;
ctx.textLetterSpacing = value;
ctx.letterSpacing = value;
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
}
test_word_spacing(NaN);
test_word_spacing(Infinity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

function test_word_spacing(value) {
ctx.wordSpacing = value;
ctx.textLetterSpacing = value;
ctx.letterSpacing = value;
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
}
test_word_spacing(NaN);
test_word_spacing(Infinity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ <h1>2d.text.drawing.style.spacing</h1>
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.wordSpacing = 5;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");

ctx.textLetterSpacing = -1;
ctx.letterSpacing = -1;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -1, "ctx.textLetterSpacing", "-1");
_assertSame(ctx.letterSpacing, -1, "ctx.letterSpacing", "-1");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");
t.done();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ <h1>2d.text.drawing.style.spacing.measure</h1>
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_normal = ctx.measureText('Hello World').width;

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_with_spacing = ctx.measureText('Hello World').width;
// Add letter spacing after each letter, so 11 * 3 = 33px longer.
_assertSame(width_with_spacing, width_normal + 33, "width_with_spacing", "width_normal + 33");

ctx.wordSpacing = 5;
ctx.textLetterSpacing = 0;
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
ctx.letterSpacing = 0;
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");
// Add Word Spacing between "Hello" and "World", so it's 5px longer.
width_with_spacing = ctx.measureText('Hello World').width;
_assertSame(width_with_spacing, width_normal + 5, "width_with_spacing", "width_normal + 5");

ctx.textLetterSpacing = -2;
ctx.letterSpacing = -2;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -2, "ctx.textLetterSpacing", "-2");
_assertSame(ctx.letterSpacing, -2, "ctx.letterSpacing", "-2");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");
// Add Word Spacing and letter spacing, so it's -11*2 = -22px from
// letter spacing and -1px from word spacing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_normal = ctx.measureText('Hello World').width;

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");
var width_with_spacing = ctx.measureText('Hello World').width;
// Add letter spacing after each letter, so 11 * 3 = 33px longer.
_assertSame(width_with_spacing, width_normal + 33, "width_with_spacing", "width_normal + 33");

ctx.wordSpacing = 5;
ctx.textLetterSpacing = 0;
_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
ctx.letterSpacing = 0;
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");
// Add Word Spacing between "Hello" and "World", so it's 5px longer.
width_with_spacing = ctx.measureText('Hello World').width;
_assertSame(width_with_spacing, width_normal + 5, "width_with_spacing", "width_normal + 5");

ctx.textLetterSpacing = -2;
ctx.letterSpacing = -2;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -2, "ctx.textLetterSpacing", "-2");
_assertSame(ctx.letterSpacing, -2, "ctx.letterSpacing", "-2");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");
// Add Word Spacing and letter spacing, so it's -11*2 = -22px from
// letter spacing and -1px from word spacing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

_assertSame(ctx.textLetterSpacing, 0, "ctx.textLetterSpacing", "0");
_assertSame(ctx.letterSpacing, 0, "ctx.letterSpacing", "0");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.textLetterSpacing = 3;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
ctx.letterSpacing = 3;
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 0, "ctx.wordSpacing", "0");

ctx.wordSpacing = 5;
_assertSame(ctx.textLetterSpacing, 3, "ctx.textLetterSpacing", "3");
_assertSame(ctx.letterSpacing, 3, "ctx.letterSpacing", "3");
_assertSame(ctx.wordSpacing, 5, "ctx.wordSpacing", "5");

ctx.textLetterSpacing = -1;
ctx.letterSpacing = -1;
ctx.wordSpacing = -1;
_assertSame(ctx.textLetterSpacing, -1, "ctx.textLetterSpacing", "-1");
_assertSame(ctx.letterSpacing, -1, "ctx.letterSpacing", "-1");
_assertSame(ctx.wordSpacing, -1, "ctx.wordSpacing", "-1");
t.done();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,35 +743,35 @@
testing:
- 2d.text.drawing.style.spacing
code: |
@assert ctx.textLetterSpacing === 0;
@assert ctx.letterSpacing === 0;
@assert ctx.wordSpacing === 0;
ctx.textLetterSpacing = 3;
@assert ctx.textLetterSpacing === 3;
ctx.letterSpacing = 3;
@assert ctx.letterSpacing === 3;
@assert ctx.wordSpacing === 0;
ctx.wordSpacing = 5;
@assert ctx.textLetterSpacing === 3;
@assert ctx.letterSpacing === 3;
@assert ctx.wordSpacing === 5;
ctx.textLetterSpacing = -1;
ctx.letterSpacing = -1;
ctx.wordSpacing = -1;
@assert ctx.textLetterSpacing === -1;
@assert ctx.letterSpacing === -1;
@assert ctx.wordSpacing === -1;
- name: 2d.text.drawing.style.nonfinite.spacing
desc: Testing letter spacing and word spacing with nonfinite inputs
testing:
- 2d.text.drawing.style.spacing
code: |
@assert ctx.textLetterSpacing === 0;
@assert ctx.letterSpacing === 0;
@assert ctx.wordSpacing === 0;
function test_word_spacing(value) {
ctx.wordSpacing = value;
ctx.textLetterSpacing = value;
ctx.letterSpacing = value;
@assert ctx.wordSpacing === 0;
@assert ctx.textLetterSpacing === 0;
@assert ctx.letterSpacing === 0;
}
@nonfinite test_word_spacing(<0 NaN Infinity -Infinity>);
Expand All @@ -780,28 +780,28 @@
testing:
- 2d.text.drawing.style.spacing
code: |
@assert ctx.textLetterSpacing === 0;
@assert ctx.letterSpacing === 0;
@assert ctx.wordSpacing === 0;
var width_normal = ctx.measureText('Hello World').width;
ctx.textLetterSpacing = 3;
@assert ctx.textLetterSpacing === 3;
ctx.letterSpacing = 3;
@assert ctx.letterSpacing === 3;
@assert ctx.wordSpacing === 0;
var width_with_spacing = ctx.measureText('Hello World').width;
// Add letter spacing after each letter, so 11 * 3 = 33px longer.
@assert width_with_spacing === width_normal + 33;
ctx.wordSpacing = 5;
ctx.textLetterSpacing = 0;
@assert ctx.textLetterSpacing === 0;
ctx.letterSpacing = 0;
@assert ctx.letterSpacing === 0;
@assert ctx.wordSpacing === 5;
// Add Word Spacing between "Hello" and "World", so it's 5px longer.
width_with_spacing = ctx.measureText('Hello World').width;
@assert width_with_spacing === width_normal + 5;
ctx.textLetterSpacing = -2;
ctx.letterSpacing = -2;
ctx.wordSpacing = -1;
@assert ctx.textLetterSpacing === -2;
@assert ctx.letterSpacing === -2;
@assert ctx.wordSpacing === -1;
// Add Word Spacing and letter spacing, so it's -11*2 = -22px from
// letter spacing and -1px from word spacing.
Expand Down
Loading

0 comments on commit 6b4c2fe

Please sign in to comment.