summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/element/pixel-manipulation/2d.imageData.put.wrongtype.html
blob: 9e43b1fbe9070b8db86f9a741fba044b1a49f0e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>Canvas test: 2d.imageData.put.wrongtype</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
<body class="show_output">

<h1>2d.imageData.put.wrongtype</h1>
<p class="desc">putImageData() does not accept non-ImageData objects</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("putImageData() does not accept non-ImageData objects");
_addTest(function(canvas, ctx) {

  var imgdata = { width: 1, height: 1, data: [255, 0, 0, 255] };
  assert_throws_js(TypeError, function() { ctx.putImageData(imgdata, 0, 0); });
  assert_throws_js(TypeError, function() { ctx.putImageData("cheese", 0, 0); });
  assert_throws_js(TypeError, function() { ctx.putImageData(42, 0, 0); });

});
</script>