forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Canvas] Move some manual tests in text to generated tests
In the auto generated canvas text folders, some tests there were written manually. It's hard for future maintenance. This cl adds them to the generation template. Bug: 1275750 Change-Id: I0874195ace06f44af9752d19f73934cc0a02bdc5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4727016 Reviewed-by: Jean-Philippe Gravel <jpgravel@chromium.org> Commit-Queue: Yi Xu <yiyix@google.com> Cr-Commit-Position: refs/heads/main@{#1186679}
- Loading branch information
Showing
30 changed files
with
575 additions
and
472 deletions.
There are no files selected for viewing
21 changes: 12 additions & 9 deletions
21
html/canvas/element/text/2d.text.fontVariantCaps1-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps1</title> | ||
<h1>2d.text.fontVariantCaps1</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<link rel="match" href="2d.text.fontVariantCaps1-expected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<title>Canvas test: 2d.text.fontVariantCaps1</title> | ||
<h1>2d.text.fontVariantCaps1</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "32px serif"; | ||
ctx.fontVariantCaps = "small-caps"; | ||
// This should render the same as font = "small-caps 32px serif". | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "32px serif"; | ||
ctx.fontVariantCaps = "small-caps"; | ||
// This should render the same as font = "small-caps 32px serif". | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
12 changes: 0 additions & 12 deletions
12
html/canvas/element/text/2d.text.fontVariantCaps2-unexpected.html
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<link rel="mismatch" href="2d.text.fontVariantCaps2-unexpected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps2</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> | ||
<body class="show_output"> | ||
|
||
<canvas id="c"></canvas> | ||
<h1>2d.text.fontVariantCaps2</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
|
||
|
||
<p class="output">Actual output:</p> | ||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> | ||
|
||
<ul id="d"></ul> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
// "mismatch" test, to verify that small-caps does change the rendering. | ||
ctx.fillText("Hello World", 20, 100); | ||
var t = async_test("Testing small caps setting in fontVariant"); | ||
_addTest(function(canvas, ctx) { | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
// "mismatch" test, to verify that small-caps does change the rendering. | ||
smallCaps_len = ctx.measureText("Hello World").width; | ||
|
||
ctx.font = "32px serif"; | ||
normalCaps_len = ctx.measureText("Hello World").width; | ||
_assert(smallCaps_len != normalCaps_len, "smallCaps_len != normalCaps_len"); | ||
|
||
}); | ||
</script> | ||
|
21 changes: 12 additions & 9 deletions
21
html/canvas/element/text/2d.text.fontVariantCaps3-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps3</title> | ||
<h1>2d.text.fontVariantCaps3</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("hello world", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("hello world", 20, 100); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<link rel="match" href="2d.text.fontVariantCaps3-expected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<title>Canvas test: 2d.text.fontVariantCaps3</title> | ||
<h1>2d.text.fontVariantCaps3</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "32px serif"; | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
// This should render the same as using font = "small-caps 32px serif" | ||
// with all the underlying text in lowercase. | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "32px serif"; | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
// This should render the same as using font = "small-caps 32px serif" | ||
// with all the underlying text in lowercase. | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
21 changes: 12 additions & 9 deletions
21
html/canvas/element/text/2d.text.fontVariantCaps4-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps4</title> | ||
<h1>2d.text.fontVariantCaps4</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("hello world", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("hello world", 20, 100); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<link rel="match" href="2d.text.fontVariantCaps4-expected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<title>Canvas test: 2d.text.fontVariantCaps4</title> | ||
<h1>2d.text.fontVariantCaps4</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
// fontVariantCaps overrides the small-caps setting from the font attribute | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
// fontVariantCaps overrides the small-caps setting from the font attribute | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
21 changes: 12 additions & 9 deletions
21
html/canvas/element/text/2d.text.fontVariantCaps5-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps5</title> | ||
<h1>2d.text.fontVariantCaps5</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<link rel="match" href="2d.text.fontVariantCaps5-expected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<title>Canvas test: 2d.text.fontVariantCaps5</title> | ||
<h1>2d.text.fontVariantCaps5</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "small-caps 32px serif"; | ||
// fontVariantCaps 'normal' does not override the setting from the font attribute. | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "normal"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
// fontVariantCaps 'normal' does not override the setting from the font attribute. | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "normal"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
21 changes: 12 additions & 9 deletions
21
html/canvas/element/text/2d.text.fontVariantCaps6-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps6</title> | ||
<h1>2d.text.fontVariantCaps6</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
ctx.font = "32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML Canvas Test: the 'fontVariantCaps' property</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-fontvariantcaps"> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<link rel="match" href="2d.text.fontVariantCaps6-expected.html"> | ||
<meta name="assert" content="text rendering respects the fontVariantCaps property"> | ||
|
||
<canvas id="c"></canvas> | ||
|
||
<title>Canvas test: 2d.text.fontVariantCaps6</title> | ||
<h1>2d.text.fontVariantCaps6</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
let ctx = c.getContext("2d"); | ||
// fontVariantCaps is reset when the font attribute is set. | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
ctx.font = "32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
// fontVariantCaps is reset when the font attribute is set. | ||
// (spec unclear, cf. https://github.com/whatwg/html/issues/8103) | ||
ctx.fontVariantCaps = "all-small-caps"; | ||
ctx.font = "32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
</script> |
21 changes: 10 additions & 11 deletions
21
html/canvas/offscreen/text/2d.text.fontVariantCaps1-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>HTML OffscreenCanvas reference</title> | ||
<link rel="author" title="Jonathan Kew" href="mailto:jkew@mozilla.com"> | ||
|
||
<canvas id="c1"></canvas> | ||
<br> | ||
<canvas id="c2"></canvas> | ||
|
||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.text.fontVariantCaps1</title> | ||
<h1>2d.text.fontVariantCaps1</h1> | ||
<p class="desc">Testing small caps setting in fontVariant</p> | ||
<canvas id="canvas" width="100" height="50"> | ||
<p class="fallback">FAIL (fallback content)</p> | ||
</canvas> | ||
<script> | ||
for (let c = 1; c <= 2; ++c) { | ||
let ctx = document.getElementById("c" + c).getContext("2d"); | ||
const canvas = document.getElementById("canvas"); | ||
const ctx = canvas.getContext('2d'); | ||
|
||
ctx.font = "small-caps 32px serif"; | ||
ctx.fillText("Hello World", 20, 100); | ||
} | ||
</script> |
Oops, something went wrong.