mirror of
https://github.com/servo/servo.git
synced 2025-08-27 08:08:19 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.3arg</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.drawImage.3arg</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.drawImage(document.getElementById('green.png'), 0, 0);
|
||||
ctx.drawImage(document.getElementById('red.png'), -100, 0);
|
||||
ctx.drawImage(document.getElementById('red.png'), 100, 0);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, -50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 50);
|
||||
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
<img src="/images/green.png" id="green.png" class="resource">
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.5arg</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.drawImage.5arg</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('green.png'), 50, 0, 50, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 50, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
<img src="/images/green.png" id="green.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.drawImage.9arg.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.drawImage.9arg.basic</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('green.png'), 0, 0, 100, 50, 0, 0, 100, 50);
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/green.png" id="green.png" class="resource">
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.9arg.destpos</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.drawImage.9arg.destpos</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('green.png'), 0, 0, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -100, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -50, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 50);
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
<img src="/images/green.png" id="green.png" class="resource">
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.9arg.destsize</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.drawImage.9arg.destsize</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('green.png'), 1, 1, 1, 1, 0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, -50, 0, 50, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 100, 0, 50, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, -25, 100, 25);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0, 100, 50, 0, 50, 100, 25);
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
<img src="/images/green.png" id="green.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.drawImage.9arg.sourcepos</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.drawImage.9arg.sourcepos</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('rgrg-256x256.png'), 140, 20, 100, 50, 0, 0, 100, 50);
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/rgrg-256x256.png" id="rgrg-256x256.png" class="resource">
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.9arg.sourcesize</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.drawImage.9arg.sourcesize</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('rgrg-256x256.png'), 0, 0, 256, 256, 0, 0, 100, 50);
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 51, 26);
|
||||
ctx.fillRect(49, 24, 51, 26);
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 20,20, 0,255,0,255, "20,20", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 80,20, 0,255,0,255, "80,20", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 20,30, 0,255,0,255, "20,30", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 80,30, 0,255,0,255, "80,30", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/rgrg-256x256.png" id="rgrg-256x256.png" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.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.drawImage.alpha</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalAlpha = 0;
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.animated.apng</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.drawImage.animated.apng</h1>
|
||||
<p class="desc">drawImage() of an APNG with no poster frame draws the first frame</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("drawImage() of an APNG with no poster frame draws the first frame");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
}), 500);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/anim-gr.png" id="anim-gr.png" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.animated.gif</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.drawImage.animated.gif</h1>
|
||||
<p class="desc">drawImage() of an animated GIF draws the first frame</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("drawImage() of an animated GIF draws the first frame");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
deferTest();
|
||||
setTimeout(t.step_func_done(function () {
|
||||
ctx.drawImage(document.getElementById('anim-gr.gif'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
}), 500);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/anim-gr.gif" id="anim-gr.gif" class="resource">
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.animated.poster</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.drawImage.animated.poster</h1>
|
||||
<p class="desc">drawImage() of an APNG draws the poster frame</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("drawImage() of an APNG draws the poster frame");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.drawImage(document.getElementById('anim-poster-gr.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/anim-poster-gr.png" id="anim-poster-gr.png" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.broken</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.drawImage.broken</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = document.getElementById('broken.png');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/broken.png" id="broken.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.drawImage.canvas</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.drawImage.canvas</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
canvas2.height = 50;
|
||||
var ctx2 = canvas2.getContext('2d');
|
||||
ctx2.fillStyle = '#0f0';
|
||||
ctx2.fillRect(0, 0, 100, 50);
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.drawImage(canvas2, 0, 0);
|
||||
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.clip</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.drawImage.clip</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.rect(-10, -10, 1, 1);
|
||||
ctx.clip();
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.composite</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.drawImage.composite</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.globalCompositeOperation = 'destination-over';
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.floatsource</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.drawImage.floatsource</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.drawImage(document.getElementById('green.png'), 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/green.png" id="green.png" class="resource">
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.incomplete.emptysrc</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.drawImage.incomplete.emptysrc</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = document.getElementById('red.png');
|
||||
img.src = "";
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.incomplete.immediate</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.drawImage.incomplete.immediate</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = new Image();
|
||||
img.src = '../images/red.png';
|
||||
// This triggers the "update the image data" algorithm.
|
||||
// The image will not go to the "completely available" state
|
||||
// until a fetch task in the networking task source is processed,
|
||||
// so the image must not be fully decodable yet:
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.incomplete.nosrc</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.drawImage.incomplete.nosrc</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = new Image();
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.incomplete.reload</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.drawImage.incomplete.reload</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = document.getElementById('yellow.png');
|
||||
img.src = '../images/red.png';
|
||||
// This triggers the "update the image data" algorithm,
|
||||
// and resets the image to the "unavailable" state.
|
||||
// The image will not go to the "completely available" state
|
||||
// until a fetch task in the networking task source is processed,
|
||||
// so the image must not be fully decodable yet:
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/yellow.png" id="yellow.png" class="resource">
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.incomplete.removedsrc</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.drawImage.incomplete.removedsrc</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var img = document.getElementById('red.png');
|
||||
img.removeAttribute('src');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.negativedest</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.drawImage.negativedest</h1>
|
||||
<p class="desc">Negative destination width/height represents the correct rectangle</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("Negative destination width/height represents the correct rectangle");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 100, 78, 50, 50, 0, 50, 50, -50);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 100, 128, 50, -50, 100, 50, -50, -50);
|
||||
_assertPixelApprox(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,1, 0,255,0,255, "48,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,1, 0,255,0,255, "51,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,48, 0,255,0,255, "51,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,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/ggrr-256x256.png" id="ggrr-256x256.png" class="resource">
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.negativedir</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.drawImage.negativedir</h1>
|
||||
<p class="desc">Negative dimensions do not affect the direction of the image</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("Negative dimensions do not affect the direction of the image");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 0, 178, 50, -100, 0, 0, 50, 100);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 0, 78, 50, 100, 50, 100, 50, -100);
|
||||
_assertPixelApprox(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,1, 0,255,0,255, "48,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,1, 0,255,0,255, "51,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,48, 0,255,0,255, "51,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,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/ggrr-256x256.png" id="ggrr-256x256.png" class="resource">
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.negativesource</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.drawImage.negativesource</h1>
|
||||
<p class="desc">Negative source width/height represents the correct rectangle</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("Negative source width/height represents the correct rectangle");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 100, 78, -100, 50, 0, 0, 50, 50);
|
||||
ctx.drawImage(document.getElementById('ggrr-256x256.png'), 100, 128, -100, -50, 50, 0, 50, 50);
|
||||
_assertPixelApprox(canvas, 1,1, 0,255,0,255, "1,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 1,48, 0,255,0,255, "1,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,1, 0,255,0,255, "98,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 98,48, 0,255,0,255, "98,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,1, 0,255,0,255, "48,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 48,48, 0,255,0,255, "48,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,1, 0,255,0,255, "51,1", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 51,48, 0,255,0,255, "51,48", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 25,25, 0,255,0,255, "25,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/ggrr-256x256.png" id="ggrr-256x256.png" class="resource">
|
||||
|
|
@ -0,0 +1,332 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.nonfinite</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
<link rel="stylesheet" href="/common/canvas-tests.css">
|
||||
<body class="show_output">
|
||||
|
||||
<h1>2d.drawImage.nonfinite</h1>
|
||||
<p class="desc">drawImage() with Infinity/NaN is ignored</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("drawImage() with Infinity/NaN is ignored");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
var red = document.getElementById('red.png');
|
||||
ctx.drawImage(red, Infinity, 0);
|
||||
ctx.drawImage(red, -Infinity, 0);
|
||||
ctx.drawImage(red, NaN, 0);
|
||||
ctx.drawImage(red, 0, Infinity);
|
||||
ctx.drawImage(red, 0, -Infinity);
|
||||
ctx.drawImage(red, 0, NaN);
|
||||
ctx.drawImage(red, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, -Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, NaN, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, -Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, NaN, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, -Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, NaN, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, -Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, NaN);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, -Infinity, 0, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, NaN, 0, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, -Infinity, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, NaN, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, -Infinity, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, NaN, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, -Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, NaN, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, -Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, NaN, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, -Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, NaN, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, -Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, NaN, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, -Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, NaN);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, 50);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, Infinity);
|
||||
ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, Infinity);
|
||||
_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,33 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.nowrap</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.drawImage.nowrap</h1>
|
||||
<p class="desc">Stretched images do not get pixels wrapping around the edges</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("Stretched images do not get pixels wrapping around the edges");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('redtransparent.png'), -1950, 0, 2000, 50);
|
||||
_assertPixelApprox(canvas, 45,25, 0,255,0,255, "45,25", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 55,25, 0,255,0,255, "55,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/redtransparent.png" id="redtransparent.png" class="resource">
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.null</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.drawImage.null</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) {
|
||||
|
||||
assert_throws(new TypeError(), function() { ctx.drawImage(null, 0, 0); });
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.path</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.drawImage.path</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.rect(0, 0, 100, 50);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
ctx.fill();
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</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.drawImage.self.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.drawImage.self.1</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 50, 50);
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(50, 0, 50, 50);
|
||||
ctx.drawImage(canvas, 50, 0);
|
||||
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.self.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.drawImage.self.2</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 1, 100, 49);
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.fillRect(0, 0, 100, 1);
|
||||
ctx.drawImage(canvas, 0, 1);
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 2);
|
||||
|
||||
_assertPixelApprox(canvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255", 2);
|
||||
_assertPixelApprox(canvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.svg</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.drawImage.svg</h1>
|
||||
<p class="desc">drawImage() of an SVG image</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("drawImage() of an SVG image");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.drawImage(document.getElementById('green.svg'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/green.svg" id="green.svg" class="resource">
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.transform</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.drawImage.transform</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.translate(100, 0);
|
||||
ctx.drawImage(document.getElementById('red.png'), 0, 0);
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.wrongtype</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.drawImage.wrongtype</h1>
|
||||
<p class="desc">Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError</p>
|
||||
|
||||
<p class="notes">Defined in "Web IDL" (draft)
|
||||
<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("Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
assert_throws(new TypeError(), function() { ctx.drawImage(undefined, 0, 0); });
|
||||
assert_throws(new TypeError(), function() { ctx.drawImage(0, 0, 0); });
|
||||
assert_throws(new TypeError(), function() { ctx.drawImage("", 0, 0); });
|
||||
assert_throws(new TypeError(), function() { ctx.drawImage(document.createElement('p'), 0, 0); });
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.zerocanvas</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.drawImage.zerocanvas</h1>
|
||||
<p class="desc"></p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
|
||||
<ul id="d"></ul>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 0;
|
||||
canvas2.height = 10;
|
||||
assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); });
|
||||
|
||||
canvas2.width = 10;
|
||||
canvas2.height = 0;
|
||||
assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); });
|
||||
|
||||
canvas2.width = 0;
|
||||
canvas2.height = 0;
|
||||
assert_throws("INVALID_STATE_ERR", function() { ctx.drawImage(canvas2, 0, 0); });
|
||||
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.zerosource</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.drawImage.zerosource</h1>
|
||||
<p class="desc">drawImage with zero-sized source rectangle throws INDEX_SIZE_ERR</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<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("drawImage with zero-sized source rectangle throws INDEX_SIZE_ERR");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red.png'), 10, 10, 0, 1, 0, 0, 100, 50); });
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red.png'), 10, 10, 1, 0, 0, 0, 100, 50); });
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red.png'), 10, 10, 0, 0, 0, 0, 100, 50); });
|
||||
_assertPixelApprox(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255", 2);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red.png" id="red.png" class="resource">
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.drawImage.zerosource.image</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.drawImage.zerosource.image</h1>
|
||||
<p class="desc">drawImage with zero-sized source rectangle from image throws INDEX_SIZE_ERR</p>
|
||||
|
||||
|
||||
<p class="output">Actual output:</p>
|
||||
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<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("drawImage with zero-sized source rectangle from image throws INDEX_SIZE_ERR");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red-zerowidth.svg'), 0, 0, 100, 50); });
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red-zeroheight.svg'), 0, 0, 100, 50); });
|
||||
assert_throws("INDEX_SIZE_ERR", function() { ctx.drawImage(document.getElementById('red-zerosize.svg'), 0, 0, 100, 50); });
|
||||
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<img src="/images/red-zerowidth.svg" id="red-zerowidth.svg" class="resource">
|
||||
<img src="/images/red-zeroheight.svg" id="red-zeroheight.svg" class="resource">
|
||||
<img src="/images/red-zerosize.svg" id="red-zerosize.svg" class="resource">
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue