-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip line caps for closed ellipse paths
As discussed in the github issue, whatwg/html#1079, it's generally agreed to skip drawing line caps for closed paths. Add test cases for full ellipse path. Bug: 644067 Change-Id: I3fde274f4b15a96d4ecaa593b0317c585eeb4a25
- Loading branch information
1 parent
2e73f41
commit 720c857
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
html/canvas/element/path-objects/2d.path.stroke.prune.ellipse.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>Canvas test: 2d.path.stroke.prune.ellipse</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"> | ||
|
||
<h1>2d.path.stroke.prune.ellipse</h1> | ||
<p class="desc">Zero-length full ellipse are removed before stroking with miters</p> | ||
|
||
|
||
<p class="output">Actual output:</p> | ||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> | ||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> | ||
<ul id="d"></ul> | ||
<script> | ||
var t = async_test("Zero-length full ellipse are removed before stroking with miters"); | ||
_addTest(function(canvas, ctx) { | ||
|
||
ctx.fillStyle = '#0f0'; | ||
ctx.fillRect(0, 0, 100, 50); | ||
|
||
ctx.strokeStyle = '#f00'; | ||
ctx.lineWidth = 100; | ||
ctx.lineCap = 'round'; | ||
ctx.lineJoin = 'round'; | ||
|
||
ctx.beginPath(); | ||
ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI); | ||
ctx.stroke(); | ||
|
||
_assertPixel(canvas, 50,25, 0,255,0,255); | ||
|
||
}); | ||
</script> | ||
|
39 changes: 39 additions & 0 deletions
39
html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.path.stroke.prune.ellipse</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.path.stroke.prune.ellipse</h1> | ||
<p class="desc">Zero-length full ellipse are removed before stroking with miters</p> | ||
|
||
|
||
<script> | ||
var t = async_test("Zero-length full ellipse are removed before stroking with miters"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var canvas = new OffscreenCanvas(100, 50); | ||
var ctx = canvas.getContext('2d'); | ||
|
||
ctx.fillStyle = '#0f0'; | ||
ctx.fillRect(0, 0, 100, 50); | ||
|
||
ctx.strokeStyle = '#f00'; | ||
ctx.lineWidth = 100; | ||
ctx.lineCap = 'round'; | ||
ctx.lineJoin = 'round'; | ||
|
||
ctx.beginPath(); | ||
ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI); | ||
ctx.stroke(); | ||
|
||
_assertPixel(canvas, 50,25, 0,255,0,255); | ||
t.done(); | ||
|
||
}); | ||
</script> |
34 changes: 34 additions & 0 deletions
34
html/canvas/offscreen/path-objects/2d.path.stroke.prune.ellipse.worker.js
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.path.stroke.prune.ellipse | ||
// Description:Zero-length full ellipse are removed before stroking with miters | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("Zero-length full ellipse are removed before stroking with miters"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var canvas = new OffscreenCanvas(100, 50); | ||
var ctx = canvas.getContext('2d'); | ||
|
||
ctx.fillStyle = '#0f0'; | ||
ctx.fillRect(0, 0, 100, 50); | ||
|
||
ctx.strokeStyle = '#f00'; | ||
ctx.lineWidth = 100; | ||
ctx.lineCap = 'round'; | ||
ctx.lineJoin = 'round'; | ||
|
||
ctx.beginPath(); | ||
ctx.ellipse(25, 25, 0, 0, 0, 0, 2 * Math.PI); | ||
ctx.stroke(); | ||
|
||
_assertPixel(canvas, 50,25, 0,255,0,255); | ||
t.done(); | ||
}); | ||
done(); |
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