diff options
Diffstat (limited to 'testing/web-platform/tests/2dcontext/path-objects')
136 files changed, 5287 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/path-objects/.gitkeep b/testing/web-platform/tests/2dcontext/path-objects/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/.gitkeep diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.1.html new file mode 100644 index 000000000..06ac1665d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.1</h1> +<p class="desc">arc() draws pi/2 .. -pi anticlockwise correctly</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("arc() draws pi/2 .. -pi anticlockwise correctly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.2.html new file mode 100644 index 000000000..328756cce --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.2.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.2</h1> +<p class="desc">arc() draws -3pi/2 .. -pi anticlockwise correctly</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("arc() draws -3pi/2 .. -pi anticlockwise correctly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.3.html new file mode 100644 index 000000000..a0696d625 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.3.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.3</h1> +<p class="desc">arc() wraps angles mod 2pi when anticlockwise and end > start+2pi</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("arc() wraps angles mod 2pi when anticlockwise and end > start+2pi"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.4.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.4.html new file mode 100644 index 000000000..bad839d80 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.4.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.4</h1> +<p class="desc">arc() draws a full circle when clockwise and end > start+2pi</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("arc() draws a full circle when clockwise and end > start+2pi"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.5.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.5.html new file mode 100644 index 000000000..5a0534452 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.5.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.5</h1> +<p class="desc">arc() wraps angles mod 2pi when clockwise and start > end+2pi</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("arc() wraps angles mod 2pi when clockwise and start > end+2pi"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.6.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.6.html new file mode 100644 index 000000000..3b645cb27 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.angle.6.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.angle.6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.angle.6</h1> +<p class="desc">arc() draws a full circle when anticlockwise and start > end+2pi</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("arc() draws a full circle when anticlockwise and start > end+2pi"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); +ctx.fill(); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.default.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.default.html new file mode 100644 index 000000000..3ccfd9914 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.default.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.default</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.default</h1> +<p class="desc">arc() with missing last argument defaults to clockwise</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("arc() with missing last argument defaults to clockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 0); +ctx.arc(100, 0, 150, -Math.PI, Math.PI/2); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.empty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.empty.html new file mode 100644 index 000000000..fa59b66f5 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.empty.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.empty</h1> +<p class="desc">arc() with an empty path does not draw a straight line to the start point</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("arc() with an empty path does not draw a straight line to the start point"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.end.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.end.html new file mode 100644 index 000000000..13b1188d1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.end.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.end</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.end</h1> +<p class="desc">arc() adds the end point of the arc to the subpath</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("arc() adds the end point of the arc to the subpath"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(-100, 0); +ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.negative.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.negative.html new file mode 100644 index 000000000..c82769046 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.negative.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.negative</h1> +<p class="desc">arc() with negative radius throws INDEX_SIZE_ERR</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> +var t = async_test("arc() with negative radius throws INDEX_SIZE_ERR"); +_addTest(function(canvas, ctx) { + +assert_throws("INDEX_SIZE_ERR", function() { ctx.arc(0, 0, -1, 0, 0, true); }); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonempty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonempty.html new file mode 100644 index 000000000..ffc0b8c0c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonempty.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.nonempty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.nonempty</h1> +<p class="desc">arc() with a non-empty path does draw a straight line to the start point</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("arc() with a non-empty path does draw a straight line to the start point"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 5, 0, 2*Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonfinite.html new file mode 100644 index 000000000..d8cffe446 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.nonfinite.html @@ -0,0 +1,77 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.nonfinite</h1> +<p class="desc">arc() with Infinity/NaN is ignored</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("arc() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); +ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); +ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); +ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); +ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); +ctx.arc(0, 0, 50, 0, Infinity, true); +ctx.arc(0, 0, 50, 0, -Infinity, true); +ctx.arc(0, 0, 50, 0, NaN, true); +ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); +ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); +ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); +ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); +ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); +ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); +ctx.arc(Infinity, 0, 50, 0, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); +ctx.arc(0, Infinity, Infinity, 0, Infinity, true); +ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); +ctx.arc(0, Infinity, 50, Infinity, Infinity, true); +ctx.arc(0, Infinity, 50, 0, Infinity, true); +ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); +ctx.arc(0, 0, Infinity, Infinity, Infinity, true); +ctx.arc(0, 0, Infinity, 0, Infinity, true); +ctx.arc(0, 0, 50, Infinity, Infinity, true); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.1.html new file mode 100644 index 000000000..fcb2b52ae --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.1.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.scale.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.scale.1</h1> +<p class="desc">Non-uniformly scaled arcs are the right shape</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("Non-uniformly scaled arcs are the right shape"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(2, 0.5); +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(25, 50, 56, 0, 2*Math.PI, false); +ctx.fill(); +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-25, 50); +ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(75, 50); +ctx.arc(75, 50, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, -25); +ctx.arc(25, -25, 24, 0, 2*Math.PI, false); +ctx.moveTo(25, 125); +ctx.arc(25, 125, 24, 0, 2*Math.PI, false); +ctx.fill(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.2.html new file mode 100644 index 000000000..59d182c92 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.scale.2.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.scale.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.scale.2</h1> +<p class="desc">Highly scaled arcs are the right shape</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("Highly scaled arcs are the right shape"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(100, 100); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 1.2; +ctx.beginPath(); +ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 50,1, 0,255,0,255, "50,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,25, 0,255,0,255, "1,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 98,25, 0,255,0,255, "98,25", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 50,48, 0,255,0,255, "50,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.1.html new file mode 100644 index 000000000..e212b49b4 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.selfintersect.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.selfintersect.1</h1> +<p class="desc">arc() with lineWidth > 2*radius is drawn sensibly</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("arc() with lineWidth > 2*radius is drawn sensibly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 200; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(100, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(0, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.2.html new file mode 100644 index 000000000..8bc9fea70 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.selfintersect.2.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.selfintersect.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.selfintersect.2</h1> +<p class="desc">arc() with lineWidth > 2*radius is drawn sensibly</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("arc() with lineWidth > 2*radius is drawn sensibly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 180; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); +ctx.stroke(); +ctx.beginPath(); +ctx.arc(100, 0, 25, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,10, 0,255,0,255, "90,10", "0,255,0,255"); +_assertPixel(canvas, 97,1, 0,255,0,255, "97,1", "0,255,0,255"); +_assertPixel(canvas, 97,2, 0,255,0,255, "97,2", "0,255,0,255"); +_assertPixel(canvas, 97,3, 0,255,0,255, "97,3", "0,255,0,255"); +_assertPixel(canvas, 2,48, 0,255,0,255, "2,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.1.html new file mode 100644 index 000000000..dcaac9bb1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.1.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.shape.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.shape.1</h1> +<p class="desc">arc() from 0 to pi does not draw anything in the wrong half</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("arc() from 0 to pi does not draw anything in the wrong half"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 20,48, 0,255,0,255, "20,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.2.html new file mode 100644 index 000000000..dee4b3841 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.shape.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.shape.2</h1> +<p class="desc">arc() from 0 to pi draws stuff in the right half</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("arc() from 0 to pi draws stuff in the right half"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 100; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(50, 50, 50, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 20,48, 0,255,0,255, "20,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.3.html new file mode 100644 index 000000000..0090411fa --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.3.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.shape.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.shape.3</h1> +<p class="desc">arc() from 0 to -pi/2 does not draw anything in the wrong quadrant</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("arc() from 0 to -pi/2 does not draw anything in the wrong quadrant"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 100; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(0, 50, 50, 0, -Math.PI/2, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.4.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.4.html new file mode 100644 index 000000000..dc12ef6c1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.4.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.shape.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.shape.4</h1> +<p class="desc">arc() from 0 to -pi/2 draws stuff in the right quadrant</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("arc() from 0 to -pi/2 draws stuff in the right quadrant"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 150; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.5.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.5.html new file mode 100644 index 000000000..2a84dde74 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.shape.5.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.shape.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.shape.5</h1> +<p class="desc">arc() from 0 to 5pi does not draw crazy things</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("arc() from 0 to 5pi does not draw crazy things"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 200; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arc(300, 0, 100, 0, 5*Math.PI, false); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.1.html new file mode 100644 index 000000000..25fc393aa --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.twopie.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.twopie.1</h1> +<p class="desc">arc() draws nothing when end = start + 2pi-e and anticlockwise</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("arc() draws nothing when end = start + 2pi-e and anticlockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.2.html new file mode 100644 index 000000000..775a87c22 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.2.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.twopie.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.twopie.2</h1> +<p class="desc">arc() draws a full circle when end = start + 2pi-e and clockwise</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("arc() draws a full circle when end = start + 2pi-e and clockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.3.html new file mode 100644 index 000000000..19680022f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.3.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.twopie.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.twopie.3</h1> +<p class="desc">arc() draws a full circle when end = start + 2pi+e and anticlockwise</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("arc() draws a full circle when end = start + 2pi+e and anticlockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.4.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.4.html new file mode 100644 index 000000000..bddf7fb49 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.twopie.4.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.twopie.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.twopie.4</h1> +<p class="desc">arc() draws nothing when end = start + 2pi+e and clockwise</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("arc() draws nothing when end = start + 2pi+e and clockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.1.html new file mode 100644 index 000000000..e18a84919 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.zero.1</h1> +<p class="desc">arc() draws nothing when startAngle = endAngle and anticlockwise</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("arc() draws nothing when startAngle = endAngle and anticlockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, true); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.2.html new file mode 100644 index 000000000..398a74d2a --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zero.2.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.zero.2</h1> +<p class="desc">arc() draws nothing when startAngle = endAngle and clockwise</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("arc() draws nothing when startAngle = endAngle and clockwise"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.arc(50, 25, 50, 0, 0, false); +ctx.stroke(); +_assertPixel(canvas, 50,20, 0,255,0,255, "50,20", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zeroradius.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zeroradius.html new file mode 100644 index 000000000..af1ccf741 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arc.zeroradius.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arc.zeroradius</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arc.zeroradius</h1> +<p class="desc">arc() with zero radius draws a line to the start point</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("arc() with zero radius draws a line to the start point"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00' +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arc(200, 25, 0, 0, Math.PI, true); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.1.html new file mode 100644 index 000000000..936034e38 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.1.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.coincide.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.coincide.1</h1> +<p class="desc">arcTo() has no effect if P0 = P1</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("arcTo() has no effect if P0 = P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(0, 25, 50, 1000, 1); +ctx.lineTo(100, 25); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.arcTo(50, 25, 100, 25, 1); +ctx.stroke(); + +_assertPixel(canvas, 50,1, 0,255,0,255, "50,1", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 50,48, 0,255,0,255, "50,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.2.html new file mode 100644 index 000000000..c64fa4c81 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.coincide.2.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.coincide.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.coincide.2</h1> +<p class="desc">arcTo() draws a straight line to P1 if P1 = P2</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("arcTo() draws a straight line to P1 if P1 = P2"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 25, 1); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.1.html new file mode 100644 index 000000000..196dbc445 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.1.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.collinear.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.collinear.1</h1> +<p class="desc">arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1</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("arcTo() with all points on a line, and P1 between P0/P2, draws a straight line to P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 200, 25, 1); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, 100, 25, 1); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.2.html new file mode 100644 index 000000000..75998b308 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.2.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.collinear.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.collinear.2</h1> +<p class="desc">arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1</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("arcTo() with all points on a line, and P2 between P0/P1, draws a straight line to P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 10, 25, 1); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 110, 25, 1); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.3.html new file mode 100644 index 000000000..8a0e9a888 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.collinear.3.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.collinear.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.collinear.3</h1> +<p class="desc">arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1</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("arcTo() with all points on a line, and P0 between P1/P2, draws a straight line to P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 1); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 0, 25, 1); +ctx.stroke(); + +ctx.beginPath(); +ctx.moveTo(-100, 25); +ctx.arcTo(0, 25, -200, 25, 1); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.1.html new file mode 100644 index 000000000..cae097116 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</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("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.arcTo(100, 50, 200, 50, 0.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.2.html new file mode 100644 index 000000000..4d25a84f4 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</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("If there is no subpath, the first control point is added"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.arcTo(0, 25, 50, 250, 0.1); // adds (x1,y1), draws nothing +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.negative.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.negative.html new file mode 100644 index 000000000..5aa7baa4c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.negative.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.negative</h1> +<p class="desc">arcTo() with negative radius throws an exception</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> +var t = async_test("arcTo() with negative radius throws an exception"); +_addTest(function(canvas, ctx) { + +assert_throws("INDEX_SIZE_ERR", function() { ctx.arcTo(0, 0, 0, 0, -1); }); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.nonfinite.html new file mode 100644 index 000000000..354d62186 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.nonfinite.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.nonfinite</h1> +<p class="desc">arcTo() with Infinity/NaN is ignored</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("arcTo() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.arcTo(Infinity, 50, 0, 50, 0); +ctx.arcTo(-Infinity, 50, 0, 50, 0); +ctx.arcTo(NaN, 50, 0, 50, 0); +ctx.arcTo(0, Infinity, 0, 50, 0); +ctx.arcTo(0, -Infinity, 0, 50, 0); +ctx.arcTo(0, NaN, 0, 50, 0); +ctx.arcTo(0, 50, Infinity, 50, 0); +ctx.arcTo(0, 50, -Infinity, 50, 0); +ctx.arcTo(0, 50, NaN, 50, 0); +ctx.arcTo(0, 50, 0, Infinity, 0); +ctx.arcTo(0, 50, 0, -Infinity, 0); +ctx.arcTo(0, 50, 0, NaN, 0); +ctx.arcTo(0, 50, 0, 50, Infinity); +ctx.arcTo(0, 50, 0, 50, -Infinity); +ctx.arcTo(0, 50, 0, 50, NaN); +ctx.arcTo(Infinity, Infinity, 0, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, 50, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, 0); +ctx.arcTo(Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, Infinity, 50, Infinity); +ctx.arcTo(Infinity, Infinity, 0, Infinity, 0); +ctx.arcTo(Infinity, Infinity, 0, Infinity, Infinity); +ctx.arcTo(Infinity, Infinity, 0, 50, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, 0); +ctx.arcTo(Infinity, 50, Infinity, Infinity, Infinity); +ctx.arcTo(Infinity, 50, Infinity, 50, Infinity); +ctx.arcTo(Infinity, 50, 0, Infinity, 0); +ctx.arcTo(Infinity, 50, 0, Infinity, Infinity); +ctx.arcTo(Infinity, 50, 0, 50, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, 0); +ctx.arcTo(0, Infinity, Infinity, Infinity, Infinity); +ctx.arcTo(0, Infinity, Infinity, 50, Infinity); +ctx.arcTo(0, Infinity, 0, Infinity, 0); +ctx.arcTo(0, Infinity, 0, Infinity, Infinity); +ctx.arcTo(0, Infinity, 0, 50, Infinity); +ctx.arcTo(0, 50, Infinity, Infinity, 0); +ctx.arcTo(0, 50, Infinity, Infinity, Infinity); +ctx.arcTo(0, 50, Infinity, 50, Infinity); +ctx.arcTo(0, 50, 0, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.scale.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.scale.html new file mode 100644 index 000000000..0de2336d7 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.scale.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.scale</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.scale</h1> +<p class="desc">arcTo scales the curve, not just the control points</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("arcTo scales the curve, not just the control points"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.scale(0.1, 1); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-1000, 0); +ctx.fill(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve1.html new file mode 100644 index 000000000..fa06b5bd1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve1.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.shape.curve1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.shape.curve1</h1> +<p class="desc">arcTo() curves in the right kind of shape</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("arcTo() curves in the right kind of shape"); +_addTest(function(canvas, ctx) { + +var tol = 1.5; // tolerance to avoid antialiasing artifacts + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); + +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25+tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15-tol, -Math.PI/2, 0, false); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 55,19, 0,255,0,255, "55,19", "0,255,0,255"); +_assertPixel(canvas, 55,20, 0,255,0,255, "55,20", "0,255,0,255"); +_assertPixel(canvas, 55,21, 0,255,0,255, "55,21", "0,255,0,255"); +_assertPixel(canvas, 64,22, 0,255,0,255, "64,22", "0,255,0,255"); +_assertPixel(canvas, 65,21, 0,255,0,255, "65,21", "0,255,0,255"); +_assertPixel(canvas, 72,28, 0,255,0,255, "72,28", "0,255,0,255"); +_assertPixel(canvas, 73,27, 0,255,0,255, "73,27", "0,255,0,255"); +_assertPixel(canvas, 78,36, 0,255,0,255, "78,36", "0,255,0,255"); +_assertPixel(canvas, 79,35, 0,255,0,255, "79,35", "0,255,0,255"); +_assertPixel(canvas, 80,44, 0,255,0,255, "80,44", "0,255,0,255"); +_assertPixel(canvas, 80,45, 0,255,0,255, "80,45", "0,255,0,255"); +_assertPixel(canvas, 80,46, 0,255,0,255, "80,46", "0,255,0,255"); +_assertPixel(canvas, 65,45, 0,255,0,255, "65,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve2.html new file mode 100644 index 000000000..ae0722c54 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.curve2.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.shape.curve2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.shape.curve2</h1> +<p class="desc">arcTo() curves in the right kind of shape</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("arcTo() curves in the right kind of shape"); +_addTest(function(canvas, ctx) { + +var tol = 1.5; // tolerance to avoid antialiasing artifacts + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.beginPath(); +ctx.rect(10, 20, 45, 10); +ctx.moveTo(80, 45); +ctx.arc(55, 45, 25-tol, 0, -Math.PI/2, true); +ctx.arc(55, 45, 15+tol, -Math.PI/2, 0, false); +ctx.fill(); + +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 10; +ctx.beginPath(); +ctx.moveTo(10, 25); +ctx.arcTo(75, 25, 75, 60, 20); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 55,19, 0,255,0,255, "55,19", "0,255,0,255"); +_assertPixel(canvas, 55,20, 0,255,0,255, "55,20", "0,255,0,255"); +_assertPixel(canvas, 55,21, 0,255,0,255, "55,21", "0,255,0,255"); +_assertPixel(canvas, 64,22, 0,255,0,255, "64,22", "0,255,0,255"); +_assertPixel(canvas, 65,21, 0,255,0,255, "65,21", "0,255,0,255"); +_assertPixel(canvas, 72,28, 0,255,0,255, "72,28", "0,255,0,255"); +_assertPixel(canvas, 73,27, 0,255,0,255, "73,27", "0,255,0,255"); +_assertPixel(canvas, 78,36, 0,255,0,255, "78,36", "0,255,0,255"); +_assertPixel(canvas, 79,35, 0,255,0,255, "79,35", "0,255,0,255"); +_assertPixel(canvas, 80,44, 0,255,0,255, "80,44", "0,255,0,255"); +_assertPixel(canvas, 80,45, 0,255,0,255, "80,45", "0,255,0,255"); +_assertPixel(canvas, 80,46, 0,255,0,255, "80,46", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.end.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.end.html new file mode 100644 index 000000000..44137138b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.end.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.shape.end</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.shape.end</h1> +<p class="desc">arcTo() does not draw anything from P1 to P2</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("arcTo() does not draw anything from P1 to P2"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.arcTo(-100, 25, 200, 25, 10); +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.start.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.start.html new file mode 100644 index 000000000..c7677af8d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.shape.start.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.shape.start</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.shape.start</h1> +<p class="desc">arcTo() draws a straight line from P0 to P1</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("arcTo() draws a straight line from P0 to P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(200, 25, 200, 50, 10); +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.transformation.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.transformation.html new file mode 100644 index 000000000..351495c38 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.transformation.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.transformation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.transformation</h1> +<p class="desc">arcTo joins up to the last subpath point correctly</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("arcTo joins up to the last subpath point correctly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 50); +ctx.translate(100, 0); +ctx.arcTo(50, 50, 50, 0, 50); +ctx.lineTo(-100, 0); +ctx.fill(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.1.html new file mode 100644 index 000000000..fa172b5a9 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.1.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.zero.1</h1> +<p class="desc">arcTo() with zero radius draws a straight line from P0 to P1</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("arcTo() with zero radius draws a straight line from P0 to P1"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, 100, 100, 0); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(0, -25); +ctx.arcTo(50, -25, 50, 50, 0); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.2.html new file mode 100644 index 000000000..ede4480fd --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.arcTo.zero.2.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.arcTo.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.arcTo.zero.2</h1> +<p class="desc">arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear</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("arcTo() with zero radius draws a straight line from P0 to P1, even when all points are collinear"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.lineWidth = 50; + +ctx.strokeStyle = '#0f0'; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.arcTo(100, 25, -100, 25, 0); +ctx.stroke(); + +ctx.strokeStyle = '#f00'; +ctx.beginPath(); +ctx.moveTo(100, 25); +ctx.arcTo(200, 25, 50, 25, 0); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.beginPath.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.beginPath.html new file mode 100644 index 000000000..86c7b0721 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.beginPath.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.beginPath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.beginPath</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.rect(0, 0, 100, 50); +ctx.beginPath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.basic.html new file mode 100644 index 000000000..2628fee45 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.bezierCurveTo(100, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html new file mode 100644 index 000000000..37f3c6a9a --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.1.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</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("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.bezierCurveTo(100, 50, 200, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html new file mode 100644 index 000000000..4fd2a0e3c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</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("If there is no subpath, the first control point is added"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.bezierCurveTo(0, 25, 100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.nonfinite.html new file mode 100644 index 000000000..28639c657 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.nonfinite.html @@ -0,0 +1,109 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.nonfinite</h1> +<p class="desc">bezierCurveTo() with Infinity/NaN is ignored</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("bezierCurveTo() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(-Infinity, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(NaN, 50, 0, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, -Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(0, NaN, 0, 50, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, -Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, 50, NaN, 50, 0, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, -Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, 0, NaN, 0, 50); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, -Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, 50, NaN, 50); +ctx.bezierCurveTo(0, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, -Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, 0, NaN); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, 50); +ctx.bezierCurveTo(Infinity, 50, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(Infinity, 50, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, 50); +ctx.bezierCurveTo(0, Infinity, 0, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, Infinity, 0, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, 50); +ctx.bezierCurveTo(0, 50, Infinity, 50, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, Infinity, 50, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, 50); +ctx.bezierCurveTo(0, 50, 0, Infinity, Infinity, Infinity); +ctx.bezierCurveTo(0, 50, 0, Infinity, 0, Infinity); +ctx.bezierCurveTo(0, 50, 0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.scaled.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.scaled.html new file mode 100644 index 000000000..6546d5d64 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.scaled.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.scaled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.scaled</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-2, 3.1); +ctx.bezierCurveTo(-2, -1, 2.1, -1, 2.1, 3.1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.shape.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.shape.html new file mode 100644 index 000000000..26b502a98 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.bezierCurveTo.shape.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.bezierCurveTo.shape</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.bezierCurveTo.shape</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-2000, 3100); +ctx.bezierCurveTo(-2000, -1000, 2100, -1000, 2100, 3100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.1.html new file mode 100644 index 000000000..e15a0e3bb --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.1.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.basic.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.basic.1</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.rect(0, 0, 100, 50); +ctx.clip(); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.2.html new file mode 100644 index 000000000..65f9eff73 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.basic.2.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.basic.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.basic.2</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.rect(-100, 0, 100, 50); +ctx.clip(); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.empty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.empty.html new file mode 100644 index 000000000..9a437b16e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.empty.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.empty</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.clip(); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.intersect.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.intersect.html new file mode 100644 index 000000000..3ef64feb3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.intersect.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.intersect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.intersect</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50) +ctx.clip(); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.unaffected.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.unaffected.html new file mode 100644 index 000000000..606c34174 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.unaffected.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.unaffected</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; + +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); + +ctx.lineTo(0, 0); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.1.html new file mode 100644 index 000000000..9fe007b40 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.1.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.winding.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.winding.1</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.clip(); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.2.html new file mode 100644 index 000000000..dd9b6ad6c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.clip.winding.2.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.clip.winding.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.clip.winding.2</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.clip(); + +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.lineTo(0, 0); +ctx.clip(); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.empty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.empty.html new file mode 100644 index 000000000..8ee68dc83 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.empty.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.closePath.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.closePath.empty</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.newline.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.newline.html new file mode 100644 index 000000000..391451e6f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.newline.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.closePath.newline</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.closePath.newline</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.closePath(); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.nextpoint.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.nextpoint.html new file mode 100644 index 000000000..e98458b18 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.closePath.nextpoint.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.closePath.nextpoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.closePath.nextpoint</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -1000); +ctx.closePath(); +ctx.lineTo(1000, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.basic.html new file mode 100644 index 000000000..b0fbee754 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.basic.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.closed.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.closed.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.unaffected.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.unaffected.html new file mode 100644 index 000000000..a1d11287c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.closed.unaffected.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.closed.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.closed.unaffected</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#00f'; +ctx.fillRect(0, 0, 100, 50); + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 90,10, 0,255,0,255, "90,10", "0,255,0,255"); +_assertPixel(canvas, 10,40, 0,255,0,255, "10,40", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.html new file mode 100644 index 000000000..d69999c24 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.overlap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.overlap</h1> +<p class="desc"></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="2d.path.fill.overlap.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.rect(0, 0, 100, 50); +ctx.closePath(); +ctx.rect(10, 10, 80, 30); +ctx.fill(); + +_assertPixelApprox(canvas, 50,25, 0,127,0,255, "50,25", "0,127,0,255", 1); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.png b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.png Binary files differnew file mode 100644 index 000000000..e2a35d48d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.overlap.png diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.add.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.add.html new file mode 100644 index 000000000..3eaa0f1bf --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.add.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.winding.add</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.winding.add</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.1.html new file mode 100644 index 000000000..50a2a1dbb --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.1.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.winding.subtract.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.winding.subtract.1</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.2.html new file mode 100644 index 000000000..b9423507c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.2.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.winding.subtract.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.winding.subtract.2</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.moveTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.3.html new file mode 100644 index 000000000..131672d10 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.fill.winding.subtract.3.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.fill.winding.subtract.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.fill.winding.subtract.3</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#0f0'; +ctx.moveTo(-10, -10); +ctx.lineTo(110, -10); +ctx.lineTo(110, 60); +ctx.lineTo(-10, 60); +ctx.lineTo(-10, -10); +ctx.lineTo(-20, -20); +ctx.lineTo(120, -20); +ctx.lineTo(120, 70); +ctx.lineTo(-20, 70); +ctx.lineTo(-20, -20); +ctx.lineTo(0, 0); +ctx.lineTo(0, 50); +ctx.lineTo(100, 50); +ctx.lineTo(100, 0); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.initial.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.initial.html new file mode 100644 index 000000000..9dadad800 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.initial.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.initial</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.initial</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.closePath(); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.arc.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.arc.html new file mode 100644 index 000000000..2d6cfcce5 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.arc.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.arc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.arc</h1> +<p class="desc">isPointInPath() works on arcs</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> +var t = async_test("isPointInPath() works on arcs"); +_addTest(function(canvas, ctx) { + +ctx.arc(50, 25, 10, 0, Math.PI, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), false, "ctx.isPointInPath(50, 20)", "false"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.1.html new file mode 100644 index 000000000..31818b0ad --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.1.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.basic.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.basic.1</h1> +<p class="desc">isPointInPath() detects whether the point is inside the path</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> +var t = async_test("isPointInPath() detects whether the point is inside the path"); +_addTest(function(canvas, ctx) { + +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.2.html new file mode 100644 index 000000000..138368ec1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.basic.2.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.basic.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.basic.2</h1> +<p class="desc">isPointInPath() detects whether the point is inside the path</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> +var t = async_test("isPointInPath() detects whether the point is inside the path"); +_addTest(function(canvas, ctx) { + +ctx.rect(20, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bezier.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bezier.html new file mode 100644 index 000000000..aa246f63c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bezier.html @@ -0,0 +1,48 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.bezier</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.bezier</h1> +<p class="desc">isPointInPath() works on Bezier curves</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> +var t = async_test("isPointInPath() works on Bezier curves"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(25, 25); +ctx.bezierCurveTo(50, -50, 50, 100, 75, 25); +_assertSame(ctx.isPointInPath(25, 20), false, "ctx.isPointInPath(25, 20)", "false"); +_assertSame(ctx.isPointInPath(25, 30), false, "ctx.isPointInPath(25, 30)", "false"); +_assertSame(ctx.isPointInPath(30, 20), true, "ctx.isPointInPath(30, 20)", "true"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 2), false, "ctx.isPointInPath(40, 2)", "false"); +_assertSame(ctx.isPointInPath(40, 20), true, "ctx.isPointInPath(40, 20)", "true"); +_assertSame(ctx.isPointInPath(40, 30), false, "ctx.isPointInPath(40, 30)", "false"); +_assertSame(ctx.isPointInPath(40, 47), false, "ctx.isPointInPath(40, 47)", "false"); +_assertSame(ctx.isPointInPath(45, 20), true, "ctx.isPointInPath(45, 20)", "true"); +_assertSame(ctx.isPointInPath(45, 30), false, "ctx.isPointInPath(45, 30)", "false"); +_assertSame(ctx.isPointInPath(55, 20), false, "ctx.isPointInPath(55, 20)", "false"); +_assertSame(ctx.isPointInPath(55, 30), true, "ctx.isPointInPath(55, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 2), false, "ctx.isPointInPath(60, 2)", "false"); +_assertSame(ctx.isPointInPath(60, 20), false, "ctx.isPointInPath(60, 20)", "false"); +_assertSame(ctx.isPointInPath(60, 30), true, "ctx.isPointInPath(60, 30)", "true"); +_assertSame(ctx.isPointInPath(60, 47), false, "ctx.isPointInPath(60, 47)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 30), true, "ctx.isPointInPath(70, 30)", "true"); +_assertSame(ctx.isPointInPath(75, 20), false, "ctx.isPointInPath(75, 20)", "false"); +_assertSame(ctx.isPointInPath(75, 30), false, "ctx.isPointInPath(75, 30)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bigarc.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bigarc.html new file mode 100644 index 000000000..1565aeeba --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.bigarc.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.bigarc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.bigarc</h1> +<p class="desc">isPointInPath() works on unclosed arcs larger than 2pi</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> +var t = async_test("isPointInPath() works on unclosed arcs larger than 2pi"); +_addTest(function(canvas, ctx) { + +ctx.arc(50, 25, 10, 0, 7, false); +_assertSame(ctx.isPointInPath(50, 10), false, "ctx.isPointInPath(50, 10)", "false"); +_assertSame(ctx.isPointInPath(50, 20), true, "ctx.isPointInPath(50, 20)", "true"); +_assertSame(ctx.isPointInPath(50, 30), true, "ctx.isPointInPath(50, 30)", "true"); +_assertSame(ctx.isPointInPath(50, 40), false, "ctx.isPointInPath(50, 40)", "false"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); +_assertSame(ctx.isPointInPath(70, 20), false, "ctx.isPointInPath(70, 20)", "false"); +_assertSame(ctx.isPointInPath(30, 30), false, "ctx.isPointInPath(30, 30)", "false"); +_assertSame(ctx.isPointInPath(70, 30), false, "ctx.isPointInPath(70, 30)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.edge.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.edge.html new file mode 100644 index 000000000..70faf8054 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.edge.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.edge</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.edge</h1> +<p class="desc">isPointInPath() counts points on the path as being inside</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> +var t = async_test("isPointInPath() counts points on the path as being inside"); +_addTest(function(canvas, ctx) { + +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(0, 0), true, "ctx.isPointInPath(0, 0)", "true"); +_assertSame(ctx.isPointInPath(10, 0), true, "ctx.isPointInPath(10, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 0), true, "ctx.isPointInPath(20, 0)", "true"); +_assertSame(ctx.isPointInPath(20, 10), true, "ctx.isPointInPath(20, 10)", "true"); +_assertSame(ctx.isPointInPath(20, 20), true, "ctx.isPointInPath(20, 20)", "true"); +_assertSame(ctx.isPointInPath(10, 20), true, "ctx.isPointInPath(10, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 20), true, "ctx.isPointInPath(0, 20)", "true"); +_assertSame(ctx.isPointInPath(0, 10), true, "ctx.isPointInPath(0, 10)", "true"); +_assertSame(ctx.isPointInPath(10, -0.01), false, "ctx.isPointInPath(10, -0.01)", "false"); +_assertSame(ctx.isPointInPath(10, 20.01), false, "ctx.isPointInPath(10, 20.01)", "false"); +_assertSame(ctx.isPointInPath(-0.01, 10), false, "ctx.isPointInPath(-0.01, 10)", "false"); +_assertSame(ctx.isPointInPath(20.01, 10), false, "ctx.isPointInPath(20.01, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.empty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.empty.html new file mode 100644 index 000000000..b1e4b2dbd --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.empty.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.empty</h1> +<p class="desc">isPointInPath() works when there is no path</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> +var t = async_test("isPointInPath() works when there is no path"); +_addTest(function(canvas, ctx) { + +_assertSame(ctx.isPointInPath(0, 0), false, "ctx.isPointInPath(0, 0)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.nonfinite.html new file mode 100644 index 000000000..f70e66288 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.nonfinite.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.nonfinite</h1> +<p class="desc">isPointInPath() returns false for non-finite arguments</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> +var t = async_test("isPointInPath() returns false for non-finite arguments"); +_addTest(function(canvas, ctx) { + +ctx.rect(-100, -50, 200, 100); +_assertSame(ctx.isPointInPath(Infinity, 0), false, "ctx.isPointInPath(Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(-Infinity, 0), false, "ctx.isPointInPath(-Infinity, 0)", "false"); +_assertSame(ctx.isPointInPath(NaN, 0), false, "ctx.isPointInPath(NaN, 0)", "false"); +_assertSame(ctx.isPointInPath(0, Infinity), false, "ctx.isPointInPath(0, Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, -Infinity), false, "ctx.isPointInPath(0, -Infinity)", "false"); +_assertSame(ctx.isPointInPath(0, NaN), false, "ctx.isPointInPath(0, NaN)", "false"); +_assertSame(ctx.isPointInPath(NaN, NaN), false, "ctx.isPointInPath(NaN, NaN)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.outside.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.outside.html new file mode 100644 index 000000000..1abe32483 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.outside.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.outside</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.outside</h1> +<p class="desc">isPointInPath() works on paths outside the canvas</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> +var t = async_test("isPointInPath() works on paths outside the canvas"); +_addTest(function(canvas, ctx) { + +ctx.rect(0, -100, 20, 20); +ctx.rect(20, -10, 20, 20); +_assertSame(ctx.isPointInPath(10, -110), false, "ctx.isPointInPath(10, -110)", "false"); +_assertSame(ctx.isPointInPath(10, -90), true, "ctx.isPointInPath(10, -90)", "true"); +_assertSame(ctx.isPointInPath(10, -70), false, "ctx.isPointInPath(10, -70)", "false"); +_assertSame(ctx.isPointInPath(30, -20), false, "ctx.isPointInPath(30, -20)", "false"); +_assertSame(ctx.isPointInPath(30, 0), true, "ctx.isPointInPath(30, 0)", "true"); +_assertSame(ctx.isPointInPath(30, 20), false, "ctx.isPointInPath(30, 20)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.subpath.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.subpath.html new file mode 100644 index 000000000..34bd0c776 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.subpath.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.subpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.subpath</h1> +<p class="desc">isPointInPath() uses the current path, not just the subpath</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> +var t = async_test("isPointInPath() uses the current path, not just the subpath"); +_addTest(function(canvas, ctx) { + +ctx.rect(0, 0, 20, 20); +ctx.beginPath(); +ctx.rect(20, 0, 20, 20); +ctx.closePath(); +ctx.rect(40, 0, 20, 20); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(30, 10), true, "ctx.isPointInPath(30, 10)", "true"); +_assertSame(ctx.isPointInPath(50, 10), true, "ctx.isPointInPath(50, 10)", "true"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.1.html new file mode 100644 index 000000000..20777390c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.transform.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.transform.1</h1> +<p class="desc">isPointInPath() handles transformations correctly</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> +var t = async_test("isPointInPath() handles transformations correctly"); +_addTest(function(canvas, ctx) { + +ctx.translate(50, 0); +ctx.rect(0, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.2.html new file mode 100644 index 000000000..bde026e4f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.2.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.transform.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.transform.2</h1> +<p class="desc">isPointInPath() handles transformations correctly</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> +var t = async_test("isPointInPath() handles transformations correctly"); +_addTest(function(canvas, ctx) { + +ctx.rect(50, 0, 20, 20); +ctx.translate(50, 0); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.3.html new file mode 100644 index 000000000..c612aae60 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.3.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.transform.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.transform.3</h1> +<p class="desc">isPointInPath() handles transformations correctly</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> +var t = async_test("isPointInPath() handles transformations correctly"); +_addTest(function(canvas, ctx) { + +ctx.scale(-1, 1); +ctx.rect(-70, 0, 20, 20); +_assertSame(ctx.isPointInPath(-40, 10), false, "ctx.isPointInPath(-40, 10)", "false"); +_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false"); +_assertSame(ctx.isPointInPath(49, 10), false, "ctx.isPointInPath(49, 10)", "false"); +_assertSame(ctx.isPointInPath(51, 10), true, "ctx.isPointInPath(51, 10)", "true"); +_assertSame(ctx.isPointInPath(69, 10), true, "ctx.isPointInPath(69, 10)", "true"); +_assertSame(ctx.isPointInPath(71, 10), false, "ctx.isPointInPath(71, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.4.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.4.html new file mode 100644 index 000000000..50fc45d2f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.transform.4.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.transform.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.transform.4</h1> +<p class="desc">isPointInPath() handles transformations correctly</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> +var t = async_test("isPointInPath() handles transformations correctly"); +_addTest(function(canvas, ctx) { + +ctx.translate(50, 0); +ctx.rect(50, 0, 20, 20); +ctx.translate(0, 50); +_assertSame(ctx.isPointInPath(60, 10), false, "ctx.isPointInPath(60, 10)", "false"); +_assertSame(ctx.isPointInPath(110, 10), true, "ctx.isPointInPath(110, 10)", "true"); +_assertSame(ctx.isPointInPath(110, 60), false, "ctx.isPointInPath(110, 60)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.unclosed.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.unclosed.html new file mode 100644 index 000000000..a13759253 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.unclosed.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.unclosed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.unclosed</h1> +<p class="desc">isPointInPath() works on unclosed subpaths</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> +var t = async_test("isPointInPath() works on unclosed subpaths"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(20, 0); +ctx.lineTo(20, 20); +ctx.lineTo(0, 20); +_assertSame(ctx.isPointInPath(10, 10), true, "ctx.isPointInPath(10, 10)", "true"); +_assertSame(ctx.isPointInPath(30, 10), false, "ctx.isPointInPath(30, 10)", "false"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.winding.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.winding.html new file mode 100644 index 000000000..afa83810b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.isPointInPath.winding.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.isPointInPath.winding</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.isPointInPath.winding</h1> +<p class="desc">isPointInPath() uses the non-zero winding number rule</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> +var t = async_test("isPointInPath() uses the non-zero winding number rule"); +_addTest(function(canvas, ctx) { + +// Create a square ring, using opposite windings to make a hole in the centre +ctx.moveTo(0, 0); +ctx.lineTo(50, 0); +ctx.lineTo(50, 50); +ctx.lineTo(0, 50); +ctx.lineTo(0, 0); +ctx.lineTo(10, 10); +ctx.lineTo(10, 40); +ctx.lineTo(40, 40); +ctx.lineTo(40, 10); +ctx.lineTo(10, 10); + +_assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); +_assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); +_assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); +_assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); +_assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "false"); +_assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"); +_assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); +_assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"); +_assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.basic.html new file mode 100644 index 000000000..8606f8900 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.1.html new file mode 100644 index 000000000..a4c0efb7e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the point is added and nothing is drawn</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("If there is no subpath, the point is added and nothing is drawn"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.lineTo(100, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.2.html new file mode 100644 index 000000000..94e6eddda --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the point is added and used for subsequent drawing</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("If there is no subpath, the point is added and used for subsequent drawing"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nextpoint.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nextpoint.html new file mode 100644 index 000000000..c2032f7c5 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nextpoint.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.nextpoint</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.nextpoint</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(-100, -100); +ctx.lineTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.details.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.details.html new file mode 100644 index 000000000..88886ebe2 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.details.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.nonfinite.details</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.nonfinite.details</h1> +<p class="desc">lineTo() with Infinity/NaN for first arg still converts the second arg</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/clear-100x50.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("lineTo() with Infinity/NaN for first arg still converts the second arg"); +_addTest(function(canvas, ctx) { + +for (var arg1 of [Infinity, -Infinity, NaN]) { + var converted = false; + ctx.lineTo(arg1, { valueOf: function() { converted = true; return 0; } }); + _assert(converted, "converted"); +} + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.html new file mode 100644 index 000000000..52982d2f6 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.lineTo.nonfinite.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.lineTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.lineTo.nonfinite</h1> +<p class="desc">lineTo() with Infinity/NaN is ignored</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("lineTo() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.lineTo(Infinity, 50); +ctx.lineTo(-Infinity, 50); +ctx.lineTo(NaN, 50); +ctx.lineTo(0, Infinity); +ctx.lineTo(0, -Infinity); +ctx.lineTo(0, NaN); +ctx.lineTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.basic.html new file mode 100644 index 000000000..999518fce --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.moveTo.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.moveTo.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.rect(0, 0, 10, 50); +ctx.moveTo(100, 0); +ctx.lineTo(10, 0); +ctx.lineTo(10, 50); +ctx.lineTo(100, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 90,25, 0,255,0,255, "90,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.multiple.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.multiple.html new file mode 100644 index 000000000..123d39314 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.multiple.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.moveTo.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.moveTo.multiple</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.moveTo(0, 25); +ctx.moveTo(100, 25); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.newsubpath.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.newsubpath.html new file mode 100644 index 000000000..caff9f81d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.newsubpath.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.moveTo.newsubpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.moveTo.newsubpath</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.moveTo(0, 0); +ctx.moveTo(100, 0); +ctx.moveTo(100, 50); +ctx.moveTo(0, 50); +ctx.fillStyle = '#f00'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.nonfinite.html new file mode 100644 index 000000000..c531f4d05 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.moveTo.nonfinite.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.moveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.moveTo.nonfinite</h1> +<p class="desc">moveTo() with Infinity/NaN is ignored</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("moveTo() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.moveTo(Infinity, 50); +ctx.moveTo(-Infinity, 50); +ctx.moveTo(NaN, 50); +ctx.moveTo(0, Infinity); +ctx.moveTo(0, -Infinity); +ctx.moveTo(0, NaN); +ctx.moveTo(Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.basic.html new file mode 100644 index 000000000..247b68005 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.basic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.moveTo(0, 25); +ctx.quadraticCurveTo(100, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html new file mode 100644 index 000000000..ac7bab212 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.1.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.ensuresubpath.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.ensuresubpath.1</h1> +<p class="desc">If there is no subpath, the first control point is added (and nothing is drawn up to it)</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("If there is no subpath, the first control point is added (and nothing is drawn up to it)"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(100, 50, 200, 50); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html new file mode 100644 index 000000000..95951a2ad --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.ensuresubpath.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.ensuresubpath.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.ensuresubpath.2</h1> +<p class="desc">If there is no subpath, the first control point is added</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("If there is no subpath, the first control point is added"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.beginPath(); +ctx.quadraticCurveTo(0, 25, 100, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.nonfinite.html new file mode 100644 index 000000000..637d10954 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.nonfinite.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.nonfinite</h1> +<p class="desc">quadraticCurveTo() with Infinity/NaN is ignored</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("quadraticCurveTo() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.quadraticCurveTo(Infinity, 50, 0, 50); +ctx.quadraticCurveTo(-Infinity, 50, 0, 50); +ctx.quadraticCurveTo(NaN, 50, 0, 50); +ctx.quadraticCurveTo(0, Infinity, 0, 50); +ctx.quadraticCurveTo(0, -Infinity, 0, 50); +ctx.quadraticCurveTo(0, NaN, 0, 50); +ctx.quadraticCurveTo(0, 50, Infinity, 50); +ctx.quadraticCurveTo(0, 50, -Infinity, 50); +ctx.quadraticCurveTo(0, 50, NaN, 50); +ctx.quadraticCurveTo(0, 50, 0, Infinity); +ctx.quadraticCurveTo(0, 50, 0, -Infinity); +ctx.quadraticCurveTo(0, 50, 0, NaN); +ctx.quadraticCurveTo(Infinity, Infinity, 0, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, 50); +ctx.quadraticCurveTo(Infinity, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, Infinity, 0, Infinity); +ctx.quadraticCurveTo(Infinity, 50, Infinity, 50); +ctx.quadraticCurveTo(Infinity, 50, Infinity, Infinity); +ctx.quadraticCurveTo(Infinity, 50, 0, Infinity); +ctx.quadraticCurveTo(0, Infinity, Infinity, 50); +ctx.quadraticCurveTo(0, Infinity, Infinity, Infinity); +ctx.quadraticCurveTo(0, Infinity, 0, Infinity); +ctx.quadraticCurveTo(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.scaled.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.scaled.html new file mode 100644 index 000000000..36801da94 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.scaled.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.scaled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.scaled</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.scale(1000, 1000); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 0.055; +ctx.beginPath(); +ctx.moveTo(-1, 1.05); +ctx.quadraticCurveTo(0, -1, 1.2, 1.05); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.shape.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.shape.html new file mode 100644 index 000000000..9311fc2a3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.quadraticCurveTo.shape.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.quadraticCurveTo.shape</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.quadraticCurveTo.shape</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 55; +ctx.beginPath(); +ctx.moveTo(-1000, 1050); +ctx.quadraticCurveTo(0, -1000, 1200, 1050); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.basic.html new file mode 100644 index 000000000..a5a6a733e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.basic.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.rect(0, 0, 100, 50); +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.closed.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.closed.html new file mode 100644 index 000000000..98f06480d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.closed.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.closed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.closed</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.rect(100, 50, 100, 100); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.1.html new file mode 100644 index 000000000..4cfe05817 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.end.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.end.1</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.rect(200, 100, 400, 1000); +ctx.lineTo(-2000, -1000); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.2.html new file mode 100644 index 000000000..f961b9c52 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.end.2.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.end.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.end.2</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 450; +ctx.lineCap = 'round'; +ctx.lineJoin = 'bevel'; +ctx.rect(150, 150, 2000, 2000); +ctx.lineTo(160, 160); +ctx.stroke(); +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255"); +_assertPixel(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255"); +_assertPixel(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.negative.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.negative.html new file mode 100644 index 000000000..382623a5e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.negative.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.negative</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.negative</h1> +<p class="desc"></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> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.fillStyle = '#0f0'; +ctx.rect(0, 0, 50, 25); +ctx.rect(100, 0, -50, 25); +ctx.rect(0, 50, 50, -25); +ctx.rect(100, 50, -50, -25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255, "25,12", "0,255,0,255"); +_assertPixel(canvas, 75,12, 0,255,0,255, "75,12", "0,255,0,255"); +_assertPixel(canvas, 25,37, 0,255,0,255, "25,37", "0,255,0,255"); +_assertPixel(canvas, 75,37, 0,255,0,255, "75,37", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.newsubpath.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.newsubpath.html new file mode 100644 index 000000000..e0e841b8c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.newsubpath.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.newsubpath</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.newsubpath</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-50, 25); +ctx.rect(200, 25, 1, 1); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.nonfinite.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.nonfinite.html new file mode 100644 index 000000000..173fd383f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.nonfinite.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.nonfinite</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.nonfinite</h1> +<p class="desc">rect() with Infinity/NaN is ignored</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("rect() with Infinity/NaN is ignored"); +_addTest(function(canvas, ctx) { + +ctx.moveTo(0, 0); +ctx.lineTo(100, 0); +ctx.rect(Infinity, 50, 1, 1); +ctx.rect(-Infinity, 50, 1, 1); +ctx.rect(NaN, 50, 1, 1); +ctx.rect(0, Infinity, 1, 1); +ctx.rect(0, -Infinity, 1, 1); +ctx.rect(0, NaN, 1, 1); +ctx.rect(0, 50, Infinity, 1); +ctx.rect(0, 50, -Infinity, 1); +ctx.rect(0, 50, NaN, 1); +ctx.rect(0, 50, 1, Infinity); +ctx.rect(0, 50, 1, -Infinity); +ctx.rect(0, 50, 1, NaN); +ctx.rect(Infinity, Infinity, 1, 1); +ctx.rect(Infinity, Infinity, Infinity, 1); +ctx.rect(Infinity, Infinity, Infinity, Infinity); +ctx.rect(Infinity, Infinity, 1, Infinity); +ctx.rect(Infinity, 50, Infinity, 1); +ctx.rect(Infinity, 50, Infinity, Infinity); +ctx.rect(Infinity, 50, 1, Infinity); +ctx.rect(0, Infinity, Infinity, 1); +ctx.rect(0, Infinity, Infinity, Infinity); +ctx.rect(0, Infinity, 1, Infinity); +ctx.rect(0, 50, Infinity, Infinity); +ctx.lineTo(100, 50); +ctx.lineTo(0, 50); +ctx.fillStyle = '#0f0'; +ctx.fill(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 90,45, 0,255,0,255, "90,45", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.selfintersect.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.selfintersect.html new file mode 100644 index 000000000..16be6232b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.selfintersect.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.selfintersect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.selfintersect</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 90; +ctx.beginPath(); +ctx.rect(45, 20, 10, 10); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.winding.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.winding.html new file mode 100644 index 000000000..194e5733b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.winding.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.winding</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.winding</h1> +<p class="desc"></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> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.beginPath(); +ctx.fillStyle = '#f00'; +ctx.rect(0, 0, 50, 50); +ctx.rect(100, 50, -50, -50); +ctx.rect(0, 25, 100, -25); +ctx.rect(100, 25, -100, 25); +ctx.fill(); +_assertPixel(canvas, 25,12, 0,255,0,255, "25,12", "0,255,0,255"); +_assertPixel(canvas, 75,12, 0,255,0,255, "75,12", "0,255,0,255"); +_assertPixel(canvas, 25,37, 0,255,0,255, "25,37", "0,255,0,255"); +_assertPixel(canvas, 75,37, 0,255,0,255, "75,37", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.1.html new file mode 100644 index 000000000..dd4b1a456 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.1</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(0, 50, 100, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.2.html new file mode 100644 index 000000000..0bdfe380e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.2.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.2</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, -100, 0, 250); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.3.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.3.html new file mode 100644 index 000000000..67dd2410b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.3.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.3</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.3</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 100; +ctx.beginPath(); +ctx.rect(50, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.4.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.4.html new file mode 100644 index 000000000..a74399567 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.4.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.4</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.4</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 50; +ctx.rect(100, 25, 0, 0); +ctx.lineTo(0, 25); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.5.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.5.html new file mode 100644 index 000000000..81566fb7f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.5.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.5</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.5</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.moveTo(0, 0); +ctx.rect(100, 25, 0, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.6.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.6.html new file mode 100644 index 000000000..37b1c524c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.rect.zero.6.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.rect.zero.6</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.rect.zero.6</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.5; +ctx.lineWidth = 200; +ctx.beginPath(); +ctx.rect(100, 25, 1000, 0); +ctx.stroke(); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.empty.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.empty.html new file mode 100644 index 000000000..671c4552b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.empty.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.empty</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.empty</h1> +<p class="desc">Empty subpaths are not stroked</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("Empty subpaths are not stroked"); +_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.moveTo(40, 25); +ctx.moveTo(60, 25); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.html new file mode 100644 index 000000000..8a4d6989e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.overlap</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.overlap</h1> +<p class="desc">Stroked subpaths are combined before being drawn</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="2d.path.stroke.overlap.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Stroked subpaths are combined before being drawn"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#000'; +ctx.fillRect(0, 0, 100, 50); + +ctx.strokeStyle = 'rgba(0, 255, 0, 0.5)'; +ctx.lineWidth = 50; +ctx.moveTo(0, 20); +ctx.lineTo(100, 20); +ctx.moveTo(0, 30); +ctx.lineTo(100, 30); +ctx.stroke(); + +_assertPixelApprox(canvas, 50,25, 0,127,0,255, "50,25", "0,127,0,255", 1); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.png b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.png Binary files differnew file mode 100644 index 000000000..e2a35d48d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.overlap.png diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.arc.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.arc.html new file mode 100644 index 000000000..fc4c23ffc --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.arc.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.arc</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.arc</h1> +<p class="desc">Zero-length line segments from arcTo and arc are removed before stroking</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 line segments from arcTo and arc are removed before stroking"); +_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.moveTo(50, 25); +ctx.arcTo(50, 25, 150, 25, 10); +ctx.stroke(); + +ctx.beginPath(); +ctx.moveTo(60, 25); +ctx.arc(50, 25, 10, 0, 0, false); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.closed.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.closed.html new file mode 100644 index 000000000..d356c91fa --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.closed.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.closed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.closed</h1> +<p class="desc">Zero-length line segments from closed paths are removed before stroking</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 line segments from closed paths are removed before stroking"); +_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.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.closePath(); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.corner.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.corner.html new file mode 100644 index 000000000..687777426 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.corner.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.corner</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.corner</h1> +<p class="desc">Zero-length line segments 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 line segments are removed before stroking with miters"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 400; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 1.4; + +ctx.beginPath(); +ctx.moveTo(-1000, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 200); +ctx.lineTo(-100, 1000); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.curve.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.curve.html new file mode 100644 index 000000000..721cb6eb0 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.curve.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.curve</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.curve</h1> +<p class="desc">Zero-length line segments from quadraticCurveTo and bezierCurveTo are removed before stroking</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 line segments from quadraticCurveTo and bezierCurveTo are removed before stroking"); +_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.moveTo(50, 25); +ctx.quadraticCurveTo(50, 25, 50, 25); +ctx.stroke(); + +ctx.beginPath(); +ctx.moveTo(50, 25); +ctx.bezierCurveTo(50, 25, 50, 25, 50, 25); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.line.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.line.html new file mode 100644 index 000000000..aa04d457e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.line.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.line</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.line</h1> +<p class="desc">Zero-length line segments from lineTo are removed before stroking</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 line segments from lineTo are removed before stroking"); +_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.moveTo(50, 25); +ctx.lineTo(50, 25); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.rect.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.rect.html new file mode 100644 index 000000000..45ead6db4 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.prune.rect.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.prune.rect</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.prune.rect</h1> +<p class="desc">Zero-length line segments from rect and strokeRect are removed before stroking</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 line segments from rect and strokeRect are removed before stroking"); +_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.rect(50, 25, 0, 0); +ctx.stroke(); + +ctx.strokeRect(50, 25, 0, 0); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale1.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale1.html new file mode 100644 index 000000000..ae63be207 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale1.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.scale1</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.scale1</h1> +<p class="desc">Stroke line widths are scaled by the current transformation matrix</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("Stroke line widths are scaled by the current transformation matrix"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); + +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.scale(50, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale2.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale2.html new file mode 100644 index 000000000..de8dd5e34 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.scale2.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.scale2</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.scale2</h1> +<p class="desc">Stroke line widths are scaled by the current transformation matrix</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("Stroke line widths are scaled by the current transformation matrix"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.beginPath(); +ctx.rect(25, 12.5, 50, 25); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); + +ctx.beginPath(); +ctx.rect(-25, -12.5, 150, 75); +ctx.save(); +ctx.rotate(Math.PI/2); +ctx.scale(25, 50); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.skew.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.skew.html new file mode 100644 index 000000000..6c6e0a4d7 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.skew.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.skew</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.skew</h1> +<p class="desc">Strokes lines are skewed by the current transformation matrix</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("Strokes lines are skewed by the current transformation matrix"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.save(); +ctx.beginPath(); +ctx.moveTo(49, -50); +ctx.lineTo(201, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 283); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); +ctx.restore(); + +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); + +ctx.save(); +ctx.beginPath(); +ctx.translate(-150, 0); +ctx.moveTo(49, -50); +ctx.lineTo(199, -50); +ctx.rotate(Math.PI/4); +ctx.scale(1, 142); +ctx.strokeStyle = '#f00'; +ctx.stroke(); +ctx.restore(); + +_assertPixel(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); +_assertPixel(canvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); +_assertPixel(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); +_assertPixel(canvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); +_assertPixel(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); +_assertPixel(canvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); +_assertPixel(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.unaffected.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.unaffected.html new file mode 100644 index 000000000..6980a0cfd --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.unaffected.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.unaffected</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.unaffected</h1> +<p class="desc">Stroking does not start a new path or subpath</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("Stroking does not start a new path or subpath"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.lineWidth = 50; +ctx.moveTo(-100, 25); +ctx.lineTo(-100, -100); +ctx.lineTo(200, -100); +ctx.lineTo(200, 25); +ctx.strokeStyle = '#f00'; +ctx.stroke(); + +ctx.closePath(); +ctx.strokeStyle = '#0f0'; +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.union.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.union.html new file mode 100644 index 000000000..bf1f28a5b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.stroke.union.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.stroke.union</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.stroke.union</h1> +<p class="desc">Strokes in opposite directions are unioned, not subtracted</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("Strokes in opposite directions are unioned, not subtracted"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.strokeStyle = '#0f0'; +ctx.lineWidth = 40; +ctx.moveTo(0, 10); +ctx.lineTo(100, 10); +ctx.moveTo(100, 40); +ctx.lineTo(0, 40); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.basic.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.basic.html new file mode 100644 index 000000000..528032153 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.transformation.basic</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.transformation.basic</h1> +<p class="desc"></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(""); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); + +ctx.translate(-100, 0); +ctx.rect(100, 0, 100, 50); +ctx.translate(0, -100); +ctx.fillStyle = '#0f0'; +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.changing.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.changing.html new file mode 100644 index 000000000..24c32062d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.changing.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.transformation.changing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.transformation.changing</h1> +<p class="desc">Transformations are applied while building paths, not when drawing</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("Transformations are applied while building paths, not when drawing"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.moveTo(0, 0); +ctx.translate(100, 0); +ctx.lineTo(0, 0); +ctx.translate(0, 50); +ctx.lineTo(0, 0); +ctx.translate(-100, 0); +ctx.lineTo(0, 0); +ctx.translate(1000, 1000); +ctx.rotate(Math.PI/2); +ctx.scale(0.1, 0.1); +ctx.fill(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.multiple.html b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.multiple.html new file mode 100644 index 000000000..5d78d28c9 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/path-objects/2d.path.transformation.multiple.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.path.transformation.multiple</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/canvas-tests.js"></script> +<link rel="stylesheet" href="/common/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.path.transformation.multiple</h1> +<p class="desc">Transformations are applied while building paths, not when drawing</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("Transformations are applied while building paths, not when drawing"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.translate(-100, 0); +ctx.rect(0, 0, 100, 50); +ctx.fill(); +ctx.translate(100, 0); +ctx.fill(); + +ctx.beginPath(); +ctx.strokeStyle = '#f00'; +ctx.lineWidth = 50; +ctx.translate(0, -50); +ctx.moveTo(0, 25); +ctx.lineTo(100, 25); +ctx.stroke(); +ctx.translate(0, 50); +ctx.stroke(); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + |