1 description("Test the behavior of CanvasRenderingContext2D.drawImage() when called with different numbers of arguments.");
3 var ctx = document.createElement('canvas').getContext('2d');
5 var imageElement = document.createElement("img");
6 shouldThrow("ctx.drawImage()");
7 shouldThrow("ctx.drawImage(imageElement)");
8 shouldThrow("ctx.drawImage(imageElement, 0)");
9 shouldBe("ctx.drawImage(imageElement, 0, 0)", "undefined");
10 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0)");
11 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0)", "undefined");
12 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0)");
13 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0)");
14 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0)");
15 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
16 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
17 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
19 var canvasElement = document.createElement("canvas");
20 shouldThrow("ctx.drawImage(canvasElement)");
21 shouldThrow("ctx.drawImage(canvasElement, 0)");
22 shouldBe("ctx.drawImage(canvasElement, 0, 0)", "undefined");
23 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0)");
24 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0)", "undefined");
25 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0)");
26 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0)");
27 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0)");
28 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
29 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
30 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");