diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/2dcontext/shadows | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/2dcontext/shadows')
72 files changed, 2263 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/shadows/.gitkeep b/testing/web-platform/tests/2dcontext/shadows/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/.gitkeep diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.1.html new file mode 100644 index 000000000..d541cd4b8 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.1.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.alpha.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.shadow.alpha.1</h1> +<p class="desc">Shadow colour alpha components are used</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("Shadow colour alpha components are used"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = 'rgba(255, 0, 0, 0.01)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 4); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.html new file mode 100644 index 000000000..217618292 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.alpha.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.shadow.alpha.2</h1> +<p class="desc">Shadow colour alpha components are used</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.shadow.alpha.2.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadow colour alpha components are used"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = 'rgba(0, 0, 255, 0.5)'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.2.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.html new file mode 100644 index 000000000..970575478 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.alpha.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.shadow.alpha.3</h1> +<p class="desc">Shadows are affected by globalAlpha</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.shadow.alpha.3.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows are affected by globalAlpha"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.5; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.3.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.html new file mode 100644 index 000000000..0621af631 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.alpha.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.shadow.alpha.4</h1> +<p class="desc">Shadows with alpha components are correctly affected by globalAlpha</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.shadow.alpha.4.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows with alpha components are correctly affected by globalAlpha"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#f00'; // (work around broken Firefox globalAlpha caching) +ctx.shadowColor = 'rgba(0, 0, 255, 0.707)'; +ctx.shadowOffsetY = 50; +ctx.globalAlpha = 0.707; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.4.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.html new file mode 100644 index 000000000..95cb2f399 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.alpha.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.shadow.alpha.5</h1> +<p class="desc">Shadows of shapes with alpha components are drawn 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="2d.shadow.alpha.5.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows of shapes with alpha components are drawn correctly"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = 'rgba(64, 0, 0, 0.5)'; +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 50; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.alpha.5.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.initial.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.initial.html new file mode 100644 index 000000000..7b65cac6f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.initial.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowBlur.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.shadow.attributes.shadowBlur.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> + +<ul id="d"></ul> +<script> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +_assertSame(ctx.shadowBlur, 0, "ctx.shadowBlur", "0"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.invalid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.invalid.html new file mode 100644 index 000000000..c4bf2ba99 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.invalid.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowBlur.invalid</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.shadow.attributes.shadowBlur.invalid</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.shadowBlur = 1; +ctx.shadowBlur = -2; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); + +ctx.shadowBlur = 1; +ctx.shadowBlur = Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); + +ctx.shadowBlur = 1; +ctx.shadowBlur = -Infinity; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); + +ctx.shadowBlur = 1; +ctx.shadowBlur = NaN; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.valid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.valid.html new file mode 100644 index 000000000..6aa9f9b1a --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowBlur.valid.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowBlur.valid</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.shadow.attributes.shadowBlur.valid</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.shadowBlur = 1; +_assertSame(ctx.shadowBlur, 1, "ctx.shadowBlur", "1"); + +ctx.shadowBlur = 0.5; +_assertSame(ctx.shadowBlur, 0.5, "ctx.shadowBlur", "0.5"); + +ctx.shadowBlur = 1e6; +_assertSame(ctx.shadowBlur, 1e6, "ctx.shadowBlur", "1e6"); + +ctx.shadowBlur = 0; +_assertSame(ctx.shadowBlur, 0, "ctx.shadowBlur", "0"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.initial.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.initial.html new file mode 100644 index 000000000..3f7471333 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.initial.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowColor.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.shadow.attributes.shadowColor.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> + +<ul id="d"></ul> +<script> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +_assertSame(ctx.shadowColor, 'rgba(0, 0, 0, 0)', "ctx.shadowColor", "'rgba(0, 0, 0, 0)'"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.invalid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.invalid.html new file mode 100644 index 000000000..5f28ecbae --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.invalid.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowColor.invalid</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.shadow.attributes.shadowColor.invalid</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.shadowColor = '#00ff00'; +ctx.shadowColor = 'bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); + +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = 'red bogus'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); + +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = ctx; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); + +ctx.shadowColor = '#00ff00'; +ctx.shadowColor = undefined; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.valid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.valid.html new file mode 100644 index 000000000..02ce65c90 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowColor.valid.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowColor.valid</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.shadow.attributes.shadowColor.valid</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.shadowColor = 'lime'; +_assertSame(ctx.shadowColor, '#00ff00', "ctx.shadowColor", "'#00ff00'"); + +ctx.shadowColor = 'RGBA(0,255, 0,0)'; +_assertSame(ctx.shadowColor, 'rgba(0, 255, 0, 0)', "ctx.shadowColor", "'rgba(0, 255, 0, 0)'"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.initial.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.initial.html new file mode 100644 index 000000000..35f1317f2 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.initial.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowOffset.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.shadow.attributes.shadowOffset.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> + +<ul id="d"></ul> +<script> +var t = async_test(""); +_addTest(function(canvas, ctx) { + +_assertSame(ctx.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.invalid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.invalid.html new file mode 100644 index 000000000..0b1ef728c --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.invalid.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowOffset.invalid</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.shadow.attributes.shadowOffset.invalid</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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = Infinity; +ctx.shadowOffsetY = Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); + +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = -Infinity; +ctx.shadowOffsetY = -Infinity; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); + +ctx.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +ctx.shadowOffsetX = NaN; +ctx.shadowOffsetY = NaN; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.valid.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.valid.html new file mode 100644 index 000000000..4133ebb94 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.attributes.shadowOffset.valid.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.attributes.shadowOffset.valid</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.shadow.attributes.shadowOffset.valid</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.shadowOffsetX = 1; +ctx.shadowOffsetY = 2; +_assertSame(ctx.shadowOffsetX, 1, "ctx.shadowOffsetX", "1"); +_assertSame(ctx.shadowOffsetY, 2, "ctx.shadowOffsetY", "2"); + +ctx.shadowOffsetX = 0.5; +ctx.shadowOffsetY = 0.25; +_assertSame(ctx.shadowOffsetX, 0.5, "ctx.shadowOffsetX", "0.5"); +_assertSame(ctx.shadowOffsetY, 0.25, "ctx.shadowOffsetY", "0.25"); + +ctx.shadowOffsetX = -0.5; +ctx.shadowOffsetY = -0.25; +_assertSame(ctx.shadowOffsetX, -0.5, "ctx.shadowOffsetX", "-0.5"); +_assertSame(ctx.shadowOffsetY, -0.25, "ctx.shadowOffsetY", "-0.25"); + +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 0; +_assertSame(ctx.shadowOffsetX, 0, "ctx.shadowOffsetX", "0"); +_assertSame(ctx.shadowOffsetY, 0, "ctx.shadowOffsetY", "0"); + +ctx.shadowOffsetX = 1e6; +ctx.shadowOffsetY = 1e6; +_assertSame(ctx.shadowOffsetX, 1e6, "ctx.shadowOffsetX", "1e6"); +_assertSame(ctx.shadowOffsetY, 1e6, "ctx.shadowOffsetY", "1e6"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high-manual.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high-manual.html new file mode 100644 index 000000000..957f5b802 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high-manual.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.blur.high</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.shadow.blur.high</h1> +<p class="desc">Shadows look correct for large blurs</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.shadow.blur.high.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows look correct for large blurs"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#ff0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 0; +ctx.shadowBlur = 100; +ctx.fillRect(-200, -200, 200, 400); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high.png Binary files differnew file mode 100644 index 000000000..743640b79 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.high.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low-manual.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low-manual.html new file mode 100644 index 000000000..548db5c5e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low-manual.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.blur.low</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.shadow.blur.low</h1> +<p class="desc">Shadows look correct for small blurs</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.shadow.blur.low.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows look correct for small blurs"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#ff0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#00f'; +ctx.shadowOffsetY = 25; +for (var x = 0; x < 100; ++x) { + ctx.save(); + ctx.beginPath(); + ctx.rect(x, 0, 1, 50); + ctx.clip(); + ctx.shadowBlur = x; + ctx.fillRect(-200, -200, 500, 200); + ctx.restore(); +} + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low.png Binary files differnew file mode 100644 index 000000000..e1922ae79 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.blur.low.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.html new file mode 100644 index 000000000..584703dff --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.canvas.alpha</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.shadow.canvas.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent canvases</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.shadow.canvas.alpha.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent canvases"); +_addTest(function(canvas, ctx) { + +var canvas2 = document.createElement('canvas'); +canvas2.width = 100; +canvas2.height = 50; +var ctx2 = canvas2.getContext('2d'); +ctx2.fillStyle = 'rgba(255, 0, 0, 0.5)'; +ctx2.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.drawImage(canvas2, 0, -50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> +<img src="/images/transparent50.png" id="transparent50.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.alpha.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.basic.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.basic.html new file mode 100644 index 000000000..824c66894 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.basic.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.canvas.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.shadow.canvas.basic</h1> +<p class="desc">Shadows are drawn for canvases</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("Shadows are drawn for canvases"); +_addTest(function(canvas, ctx) { + +var canvas2 = document.createElement('canvas'); +canvas2.width = 100; +canvas2.height = 50; +var ctx2 = canvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 100, 50); + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.drawImage(canvas2, 0, -50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.1.html new file mode 100644 index 000000000..13ddd33e1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.1.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.canvas.transparent.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.shadow.canvas.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent canvases</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("Shadows are not drawn for transparent canvases"); +_addTest(function(canvas, ctx) { + +var canvas2 = document.createElement('canvas'); +canvas2.width = 100; +canvas2.height = 50; +var ctx2 = canvas2.getContext('2d'); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.drawImage(canvas2, 0, -50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.2.html new file mode 100644 index 000000000..e795fa1e2 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.canvas.transparent.2.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.canvas.transparent.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.shadow.canvas.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of canvases</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("Shadows are not drawn for transparent parts of canvases"); +_addTest(function(canvas, ctx) { + +var canvas2 = document.createElement('canvas'); +canvas2.width = 100; +canvas2.height = 50; +var ctx2 = canvas2.getContext('2d'); +ctx2.fillStyle = '#f00'; +ctx2.fillRect(0, 0, 50, 50); + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.drawImage(canvas2, 50, -50); +ctx.shadowColor = '#f00'; +ctx.drawImage(canvas2, -50, -50); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.1.html new file mode 100644 index 000000000..50fbb8711 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.1.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.clip.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.shadow.clip.1</h1> +<p class="desc">Shadows of clipped shapes are still drawn within the clipping region</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("Shadows of clipped shapes are still drawn within the clipping region"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); + +ctx.save(); +ctx.beginPath(); +ctx.rect(50, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.2.html new file mode 100644 index 000000000..239b43b98 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.2.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.clip.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.shadow.clip.2</h1> +<p class="desc">Shadows are not drawn outside the clipping region</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("Shadows are not drawn outside the clipping region"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); + +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +ctx.restore(); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.3.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.3.html new file mode 100644 index 000000000..6b1bb02fc --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.clip.3.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.clip.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.shadow.clip.3</h1> +<p class="desc">Shadows of clipped shapes are still drawn within the clipping region</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("Shadows of clipped shapes are still drawn within the clipping region"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); + +ctx.save(); +ctx.beginPath(); +ctx.rect(0, 0, 50, 50); +ctx.clip(); +ctx.fillStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(-50, 0, 50, 50); +ctx.restore(); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.1.html new file mode 100644 index 000000000..e27c1e2c0 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.1.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.composite.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.shadow.composite.1</h1> +<p class="desc">Shadows are drawn using globalCompositeOperation</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("Shadows are drawn using globalCompositeOperation"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-100, 0, 200, 50); + +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.2.html new file mode 100644 index 000000000..960b44b54 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.composite.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.shadow.composite.2</h1> +<p class="desc">Shadows are drawn using globalCompositeOperation</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("Shadows are drawn using globalCompositeOperation"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'xor'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 1; +ctx.fillStyle = '#0f0'; +ctx.fillRect(-10, -10, 120, 70); + +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.3.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.3.html new file mode 100644 index 000000000..feee1ce5e --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.composite.3.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.composite.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.shadow.composite.3</h1> +<p class="desc">Areas outside shadows are drawn correctly with destination-out</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("Areas outside shadows are drawn correctly with destination-out"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.globalCompositeOperation = 'destination-out'; +ctx.shadowColor = '#f00'; +ctx.shadowBlur = 10; +ctx.fillStyle = '#f00'; +ctx.fillRect(200, 0, 100, 50); + +_assertPixelApprox(canvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.blur.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.blur.html new file mode 100644 index 000000000..f94f5f69f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.blur.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.enable.blur</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.shadow.enable.blur</h1> +<p class="desc">Shadows are drawn if shadowBlur is set</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("Shadows are drawn if shadowBlur is set"); +_addTest(function(canvas, ctx) { + +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowBlur = 0.1; +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/shadows/2d.shadow.enable.off.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.off.1.html new file mode 100644 index 000000000..161ec52c4 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.off.1.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.enable.off.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.shadow.enable.off.1</h1> +<p class="desc">Shadows are not drawn when only shadowColor is set</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("Shadows are not drawn when only shadowColor is set"); +_addTest(function(canvas, ctx) { + +ctx.shadowColor = '#f00'; +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/shadows/2d.shadow.enable.off.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.off.2.html new file mode 100644 index 000000000..23bfa752a --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.off.2.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.enable.off.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.shadow.enable.off.2</h1> +<p class="desc">Shadows are not drawn when only shadowColor is set</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("Shadows are not drawn when only shadowColor is set"); +_addTest(function(canvas, ctx) { + +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#f00'; +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/shadows/2d.shadow.enable.x.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.x.html new file mode 100644 index 000000000..b90da98df --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.x.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.enable.x</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.shadow.enable.x</h1> +<p class="desc">Shadows are drawn if shadowOffsetX is set</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("Shadows are drawn if shadowOffsetX is set"); +_addTest(function(canvas, ctx) { + +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 0.1; +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/shadows/2d.shadow.enable.y.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.y.html new file mode 100644 index 000000000..32750e6f8 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.enable.y.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.enable.y</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.shadow.enable.y</h1> +<p class="desc">Shadows are drawn if shadowOffsetY is set</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("Shadows are drawn if shadowOffsetY is set"); +_addTest(function(canvas, ctx) { + +ctx.globalCompositeOperation = 'destination-atop'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 0.1; +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/shadows/2d.shadow.gradient.alpha.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.alpha.html new file mode 100644 index 000000000..31c4adc50 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.alpha.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.gradient.alpha</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.shadow.gradient.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent gradient fills</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.shadow.gradient.alpha.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent gradient fills"); +_addTest(function(canvas, ctx) { + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(255,0,0,0.5)'); +gradient.addColorStop(1, 'rgba(255,0,0,0.5)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.alpha.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.alpha.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.alpha.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.basic.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.basic.html new file mode 100644 index 000000000..cdb223232 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.basic.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.gradient.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.shadow.gradient.basic</h1> +<p class="desc">Shadows are drawn for gradient fills</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("Shadows are drawn for gradient fills"); +_addTest(function(canvas, ctx) { + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(1, '#f00'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 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/shadows/2d.shadow.gradient.transparent.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.transparent.1.html new file mode 100644 index 000000000..d4a21c6b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.transparent.1.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.gradient.transparent.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.shadow.gradient.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent gradient fills</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("Shadows are not drawn for transparent gradient fills"); +_addTest(function(canvas, ctx) { + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 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/shadows/2d.shadow.gradient.transparent.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.transparent.2.html new file mode 100644 index 000000000..be5d93a5b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.gradient.transparent.2.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.gradient.transparent.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.shadow.gradient.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of gradient fills</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("Shadows are not drawn for transparent parts of gradient fills"); +_addTest(function(canvas, ctx) { + +var gradient = ctx.createLinearGradient(0, 0, 100, 0); +gradient.addColorStop(0, '#f00'); +gradient.addColorStop(0.499, '#f00'); +gradient.addColorStop(0.5, 'rgba(0,0,0,0)'); +gradient.addColorStop(1, 'rgba(0,0,0,0)'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.fillStyle = gradient; +ctx.fillRect(0, -50, 100, 50); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.html new file mode 100644 index 000000000..9e7a56973 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.alpha</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.shadow.image.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent images</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.shadow.image.alpha.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent images"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.drawImage(document.getElementById('transparent50.png'), 0, -50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> +<img src="/images/transparent50.png" id="transparent50.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.alpha.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.basic.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.basic.html new file mode 100644 index 000000000..570451ae9 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.basic.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.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.shadow.image.basic</h1> +<p class="desc">Shadows are drawn for images</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("Shadows are drawn for images"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.drawImage(document.getElementById('red.png'), 0, -50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/red.png" id="red.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.scale.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.scale.html new file mode 100644 index 000000000..ded6fc0d6 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.scale.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.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.shadow.image.scale</h1> +<p class="desc">Shadows are drawn correctly for scaled images</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("Shadows are drawn correctly for scaled images"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.drawImage(document.getElementById('redtransparent.png'), 0, 0, 100, 50, -10, -50, 240, 50); + +_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2); + + +}); +</script> +<img src="/images/redtransparent.png" id="redtransparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.section.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.section.html new file mode 100644 index 000000000..9dc9bca67 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.section.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.section</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.shadow.image.section</h1> +<p class="desc">Shadows are not drawn for areas outside image source rectangles</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("Shadows are not drawn for areas outside image source rectangles"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#f00'; +ctx.drawImage(document.getElementById('redtransparent.png'), 50, 0, 50, 50, 0, -50, 50, 50); + +_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2); +_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2); +_assertPixelApprox(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2); + + +}); +</script> +<img src="/images/redtransparent.png" id="redtransparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.1.html new file mode 100644 index 000000000..13dff1f2d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.1.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.transparent.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.shadow.image.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent images</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("Shadows are not drawn for transparent images"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.drawImage(document.getElementById('transparent.png'), 0, -50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/transparent.png" id="transparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.2.html new file mode 100644 index 000000000..17a26407d --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.image.transparent.2.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.image.transparent.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.shadow.image.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of images</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("Shadows are not drawn for transparent parts of images"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#f00'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.drawImage(document.getElementById('redtransparent.png'), 50, -50); +ctx.shadowColor = '#f00'; +ctx.drawImage(document.getElementById('redtransparent.png'), -50, -50); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/redtransparent.png" id="redtransparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeX.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeX.html new file mode 100644 index 000000000..da1c39ba0 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeX.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.offset.negativeX</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.shadow.offset.negativeX</h1> +<p class="desc">Shadows can be offset with negative x</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("Shadows can be offset with negative x"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = -50; +ctx.fillRect(50, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeY.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeY.html new file mode 100644 index 000000000..0f7a7f0ad --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.negativeY.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.offset.negativeY</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.shadow.offset.negativeY</h1> +<p class="desc">Shadows can be offset with negative y</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("Shadows can be offset with negative y"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = -25; +ctx.fillRect(0, 25, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255, "50,12", "0,255,0,255"); +_assertPixel(canvas, 50,37, 0,255,0,255, "50,37", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveX.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveX.html new file mode 100644 index 000000000..969d9b43a --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveX.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.offset.positiveX</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.shadow.offset.positiveX</h1> +<p class="desc">Shadows can be offset with positive x</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("Shadows can be offset with positive x"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 50; +ctx.fillRect(0, 0, 50, 50); +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveY.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveY.html new file mode 100644 index 000000000..c797d709f --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.offset.positiveY.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.offset.positiveY</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.shadow.offset.positiveY</h1> +<p class="desc">Shadows can be offset with positive y</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("Shadows can be offset with positive y"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.fillStyle = '#0f0'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 25; +ctx.fillRect(0, 0, 100, 25); +_assertPixel(canvas, 50,12, 0,255,0,255, "50,12", "0,255,0,255"); +_assertPixel(canvas, 50,37, 0,255,0,255, "50,37", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.outside.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.outside.html new file mode 100644 index 000000000..ef3492226 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.outside.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.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.shadow.outside</h1> +<p class="desc">Shadows of shapes outside the visible area can be offset onto the visible area</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("Shadows of shapes outside the visible area can be offset onto the visible area"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.fillRect(-100, 0, 25, 50); +ctx.shadowOffsetX = -100; +ctx.fillRect(175, 0, 25, 50); +ctx.shadowOffsetX = 0; +ctx.shadowOffsetY = 100; +ctx.fillRect(25, -100, 50, 25); +ctx.shadowOffsetY = -100; +ctx.fillRect(25, 125, 50, 25); +_assertPixel(canvas, 12,25, 0,255,0,255, "12,25", "0,255,0,255"); +_assertPixel(canvas, 87,25, 0,255,0,255, "87,25", "0,255,0,255"); +_assertPixel(canvas, 50,12, 0,255,0,255, "50,12", "0,255,0,255"); +_assertPixel(canvas, 50,37, 0,255,0,255, "50,37", "0,255,0,255"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.html new file mode 100644 index 000000000..5fcfcc4b0 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.pattern.alpha</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.shadow.pattern.alpha</h1> +<p class="desc">Shadows are drawn correctly for partially-transparent fill patterns</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.shadow.pattern.alpha.png" class="output expected" id="expected" alt=""> +<ul id="d"></ul> +<script> +var t = async_test("Shadows are drawn correctly for partially-transparent fill patterns"); +_addTest(function(canvas, ctx) { + +var pattern = ctx.createPattern(document.getElementById('transparent50.png'), 'repeat'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#00f'; +ctx.fillStyle = pattern; +ctx.fillRect(0, -50, 100, 50); + +_assertPixelApprox(canvas, 50,25, 127,0,127,255, "50,25", "127,0,127,255", 2); + + +}); +</script> +<img src="/images/transparent50.png" id="transparent50.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.png b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.png Binary files differnew file mode 100644 index 000000000..8764e89b3 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.alpha.png diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.basic.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.basic.html new file mode 100644 index 000000000..38b9a7367 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.basic.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.pattern.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.shadow.pattern.basic</h1> +<p class="desc">Shadows are drawn for fill patterns</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("Shadows are drawn for fill patterns"); +_addTest(function(canvas, ctx) { + +var pattern = ctx.createPattern(document.getElementById('red.png'), 'repeat'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = pattern; +ctx.fillRect(0, -50, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/red.png" id="red.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.1.html new file mode 100644 index 000000000..fcdda5a20 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.1.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.pattern.transparent.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.shadow.pattern.transparent.1</h1> +<p class="desc">Shadows are not drawn for transparent fill patterns</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("Shadows are not drawn for transparent fill patterns"); +_addTest(function(canvas, ctx) { + +var pattern = ctx.createPattern(document.getElementById('transparent.png'), 'repeat'); +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.fillStyle = pattern; +ctx.fillRect(0, -50, 100, 50); + +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/transparent.png" id="transparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.2.html new file mode 100644 index 000000000..3dbb856bf --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.pattern.transparent.2.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.pattern.transparent.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.shadow.pattern.transparent.2</h1> +<p class="desc">Shadows are not drawn for transparent parts of fill patterns</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("Shadows are not drawn for transparent parts of fill patterns"); +_addTest(function(canvas, ctx) { + +var pattern = ctx.createPattern(document.getElementById('redtransparent.png'), 'repeat'); +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.fillStyle = pattern; +ctx.fillRect(0, -50, 100, 50); + +_assertPixel(canvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); +_assertPixel(canvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255"); + + +}); +</script> +<img src="/images/redtransparent.png" id="redtransparent.png" class="resource"> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.basic.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.basic.html new file mode 100644 index 000000000..4e5bd06b2 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.basic.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.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.shadow.stroke.basic</h1> +<p class="desc">Shadows are drawn for strokes</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("Shadows are drawn for strokes"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.moveTo(0, -25); +ctx.lineTo(100, -25); +ctx.stroke(); + +_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"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.1.html new file mode 100644 index 000000000..04450b979 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.1.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.cap.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.shadow.stroke.cap.1</h1> +<p class="desc">Shadows are not drawn for areas outside stroke caps</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("Shadows are not drawn for areas outside stroke caps"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'butt'; +ctx.moveTo(-50, -25); +ctx.lineTo(0, -25); +ctx.moveTo(100, -25); +ctx.lineTo(150, -25); +ctx.stroke(); + +_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"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.2.html new file mode 100644 index 000000000..11a7cf3cf --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.cap.2.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.cap.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.shadow.stroke.cap.2</h1> +<p class="desc">Shadows are drawn for stroke caps</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("Shadows are drawn for stroke caps"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetY = 50; +ctx.beginPath(); +ctx.lineWidth = 50; +ctx.lineCap = 'square'; +ctx.moveTo(25, -25); +ctx.lineTo(75, -25); +ctx.stroke(); + +_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"); + + +}); +</script> + diff --git a/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.1.html new file mode 100644 index 000000000..d204874d7 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.1.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.join.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.shadow.stroke.join.1</h1> +<p class="desc">Shadows are not drawn for areas outside stroke joins</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("Shadows are not drawn for areas outside stroke joins"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'bevel'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "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/shadows/2d.shadow.stroke.join.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.2.html new file mode 100644 index 000000000..ccff894fd --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.2.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.join.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.shadow.stroke.join.2</h1> +<p class="desc">Shadows are drawn for stroke joins</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("Shadows are drawn for stroke joins"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 50, 50); +ctx.fillStyle = '#0f0'; +ctx.fillRect(50, 0, 50, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#0f0'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "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/shadows/2d.shadow.stroke.join.3.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.3.html new file mode 100644 index 000000000..25044ebfc --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.stroke.join.3.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> +<title>Canvas test: 2d.shadow.stroke.join.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.shadow.stroke.join.3</h1> +<p class="desc">Shadows are drawn for stroke joins respecting miter limit</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("Shadows are drawn for stroke joins respecting miter limit"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#0f0'; +ctx.fillRect(0, 0, 100, 50); +ctx.strokeStyle = '#f00'; +ctx.shadowColor = '#f00'; +ctx.shadowOffsetX = 100; +ctx.lineWidth = 200; +ctx.lineJoin = 'miter'; +ctx.miterLimit = 0.1; +ctx.beginPath(); +ctx.moveTo(-200, -50); +ctx.lineTo(-150, -50); +ctx.lineTo(-151, -100); // (not an exact right angle, to avoid some other bug in Firefox 3) +ctx.stroke(); + +_assertPixel(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255"); +_assertPixel(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255"); +_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "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/shadows/2d.shadow.transform.1.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.transform.1.html new file mode 100644 index 000000000..03a4ab2e4 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.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.shadow.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.shadow.transform.1</h1> +<p class="desc">Shadows take account of transformations</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("Shadows take account of transformations"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.translate(100, 100); +ctx.fillRect(-100, -150, 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/shadows/2d.shadow.transform.2.html b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.transform.2.html new file mode 100644 index 000000000..8e1ac095b --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/2d.shadow.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.shadow.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.shadow.transform.2</h1> +<p class="desc">Shadow offsets are not affected by transformations</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("Shadow offsets are not affected by transformations"); +_addTest(function(canvas, ctx) { + +ctx.fillStyle = '#f00'; +ctx.fillRect(0, 0, 100, 50); +ctx.shadowOffsetY = 50; +ctx.shadowColor = '#0f0'; +ctx.rotate(Math.PI) +ctx.fillRect(-100, 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/shadows/canvas_shadows_001.htm b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_001.htm new file mode 100644 index 000000000..1763950d6 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_001.htm @@ -0,0 +1,60 @@ +<!doctype HTML> +<html> + <head> + <title>HTML5 Canvas Test: Shadows for linear gradients</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <link rel="author" title="Microsoft" href="http://www.microsoft.com" /> + <link rel="help" href="http://www.w3.org/TR/2dcontext/#shadows" /> + <meta name="assert" content="Shadows must be drawn for linear gradients." /> + <script type="text/javascript"> + async_test(function(t) { + window.addEventListener("load", t.step_func_done(function runTest() { + var canvas = document.getElementById("canvas1"); + var ctx = canvas.getContext("2d"); + + // Draw a red rectangle. + ctx.fillStyle = "rgba(255, 0, 0, 1.0)"; + ctx.fillRect(150, 0, 100, 50); + + // Set shadow styles to draw a black shadow to overlap the red rectangle. + ctx.shadowOffsetX = 150; + ctx.shadowColor = "rgba(0, 0, 0, 1.0)"; + + // Draw a left to right, green-to-blue linear gradient. + var lingrad = ctx.createLinearGradient(0, 50, 100, 50); + lingrad.addColorStop(0, "rgba(0, 255, 0, 1.0)"); + lingrad.addColorStop(1, "rgba(0, 0, 255, 1.0)"); + ctx.fillStyle = lingrad; + ctx.fillRect(0, 0, 100, 50); + + // Check the red is gone + var data = ctx.getImageData(150, 0, 100, 50); + for (var i = 0; i < data.data.length; i += 4) { + var r = data.data[i]; + var g = data.data[i+1]; + var b = data.data[i+2]; + var a = data.data[i+3]; + assert_equals(r, 0, "r channel"); + assert_equals(g, 0, "g channel"); + assert_equals(b, 0, "b channel"); + assert_equals(a, 0xFF, "a channel"); + } + + for (var j = 0; j < data.data.length; j += 4) { + var r2 = data.data[j]; + var g2 = data.data[j+1]; + var b2 = data.data[j+2]; + var a2 = data.data[j+3]; + assert_false(r2 == 0xFF && g2 == 0 && b2 == 0 && a2 == 0xFF, "no red"); + } + })); + }, "linear gradient fillRect draws shadow (black rectange)"); + </script> + </head> + <body> + <p>Description: Shadows must be drawn for linear gradients.</p> + <p>Test passes if there is one gradient filled rectangle and one black rectangle, and no red seen on the page.</p> + <canvas id="canvas1" width="300" height="150">Browser does not support HTML5 Canvas.</canvas> + </body> +</html> diff --git a/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002-ref.htm b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002-ref.htm new file mode 100644 index 000000000..0658be808 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002-ref.htm @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>HTML5 Canvas Test: Shadows for images</title> + <link rel="author" title="Microsoft" href="http://www.microsoft.com" /> + <link rel="help" href="http://www.w3.org/TR/2dcontext/#shadows" /> + <meta name="assert" content="Shadows must be drawn for images." /> + <script type="text/javascript"> + function runTest() { + var canvas = document.getElementById("canvas1"); + var ctx = canvas.getContext("2d"); + + // Draw a black rectangle image on the canvas. + var img = document.getElementById("imgBlackRect"); + ctx.drawImage(img, 0, 0); + ctx.drawImage(img, 150, 0); + } + </script> + + </head> + <body onload="runTest()"> + <p>Description: Shadows must be drawn for images.</p> + <p>Test passes if two black rectangles are shown and there is no red visible on the page.</p> + <canvas id="canvas1" width="300" height="150">Browser does not support HTML5 Canvas.</canvas> + <img id="imgBlackRect" style="display:none;" width="100" height="50" src="/images/black-rectangle.png"> + </body> +</html> diff --git a/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002.htm b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002.htm new file mode 100644 index 000000000..908fffea1 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/shadows/canvas_shadows_002.htm @@ -0,0 +1,34 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>HTML5 Canvas Test: Shadows for images</title> + <link rel="author" title="Microsoft" href="http://www.microsoft.com" /> + <link rel="help" href="http://www.w3.org/TR/2dcontext/#shadows" /> + <link rel="match" href="canvas_shadows_002-ref.htm" /> + <meta name="assert" content="Shadows must be drawn for images." /> + <script type="text/javascript"> + function runTest() { + var canvas = document.getElementById("canvas1"); + var ctx = canvas.getContext("2d"); + + // Draw a red rectangle. + ctx.fillStyle = "rgba(255, 0, 0, 1.0)"; + ctx.fillRect(150, 0, 100, 50); + + // Set shadow styles to draw a black shadow to overlap the red rectangle. + ctx.shadowOffsetX = 150; + ctx.shadowColor = "rgba(0, 0, 0, 1.0)"; + + // Draw a black rectangle image on the canvas. + var img = document.getElementById("imgBlackRect"); + ctx.drawImage(img, 0, 0); + } + </script> + </head> + <body onload="runTest()"> + <p>Description: Shadows must be drawn for images.</p> + <p>Test passes if two black rectangles are shown and there is no red visible on the page.</p> + <canvas id="canvas1" width="300" height="150">Browser does not support HTML5 Canvas.</canvas> + <img id="imgBlackRect" style="display:none" width="100" height="50" src="/images/black-rectangle.png"> + </body> +</html> |