Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
0
tests/wpt/web-platform-tests/2dcontext/shadows/.gitkeep
Normal file
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
After Width: | Height: | Size: 246 B |
|
@ -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>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -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">
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
After Width: | Height: | Size: 206 B |
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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">
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Canvas Test: Shadows for linear gradients</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 linear gradients." />
|
||||
<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 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);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="runTest()">
|
||||
<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>
|
|
@ -0,0 +1,28 @@
|
|||
<!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 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>
|
|
@ -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>
|