Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: LayoutTests/fast/canvas/script-tests/canvas-overloads-drawImage.js

Issue 36843003: Improve remaining TypeErrors in bindings code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: vibration. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("Test the behavior of CanvasRenderingContext2D.drawImage() when call ed with different numbers of arguments."); 1 description("Test the behavior of CanvasRenderingContext2D.drawImage() when call ed with different numbers of arguments.");
2 2
3 var ctx = document.createElement('canvas').getContext('2d'); 3 var ctx = document.createElement('canvas').getContext('2d');
4 4
5 function ExpectedNotEnoughArgumentsMessage(num) { 5 function ExpectedNotEnoughArgumentsMessage(num) {
6 return "\"TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContex t2D': 3 arguments required, but only " + num + " present.\""; 6 return "\"TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContex t2D': 3 arguments required, but only " + num + " present.\"";
7 } 7 }
8 8
9 var TypeError = "TypeError: Type error"; 9 var TypeError = '"TypeError: Failed to execute \'drawImage\' on \'CanvasRenderin gContext2D\': No function was found that matched the signature provided."';
10 10
11 var imageElement = document.createElement("img"); 11 var imageElement = document.createElement("img");
12 shouldThrow("ctx.drawImage()", ExpectedNotEnoughArgumentsMessage(0)); 12 shouldThrow("ctx.drawImage()", ExpectedNotEnoughArgumentsMessage(0));
13 shouldThrow("ctx.drawImage(imageElement)", ExpectedNotEnoughArgumentsMessage(1)) ; 13 shouldThrow("ctx.drawImage(imageElement)", ExpectedNotEnoughArgumentsMessage(1)) ;
14 shouldThrow("ctx.drawImage(imageElement, 0)", ExpectedNotEnoughArgumentsMessage( 2)); 14 shouldThrow("ctx.drawImage(imageElement, 0)", ExpectedNotEnoughArgumentsMessage( 2));
15 shouldBe("ctx.drawImage(imageElement, 0, 0)", "undefined"); 15 shouldBe("ctx.drawImage(imageElement, 0, 0)", "undefined");
16 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0)", "TypeError"); 16 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0)", "TypeError");
17 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0)", "undefined"); 17 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0)", "undefined");
18 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0)", "TypeError"); 18 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0)", "TypeError");
19 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0)", "TypeError"); 19 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0)", "TypeError");
20 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 20 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError");
21 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 21 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined");
22 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError "); 22 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeError ");
23 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeEr ror"); 23 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeEr ror");
24 24
25 var canvasElement = document.createElement("canvas"); 25 var canvasElement = document.createElement("canvas");
26 shouldThrow("ctx.drawImage(canvasElement)", ExpectedNotEnoughArgumentsMessage(1) ); 26 shouldThrow("ctx.drawImage(canvasElement)", ExpectedNotEnoughArgumentsMessage(1) );
27 shouldThrow("ctx.drawImage(canvasElement, 0)", ExpectedNotEnoughArgumentsMessage (2)); 27 shouldThrow("ctx.drawImage(canvasElement, 0)", ExpectedNotEnoughArgumentsMessage (2));
28 shouldBe("ctx.drawImage(canvasElement, 0, 0)", "undefined"); 28 shouldBe("ctx.drawImage(canvasElement, 0, 0)", "undefined");
29 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0)", "TypeError"); 29 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0)", "TypeError");
30 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0)", "undefined"); 30 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0)", "undefined");
31 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0)", "TypeError"); 31 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0)", "TypeError");
32 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0)", "TypeError"); 32 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0)", "TypeError");
33 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 33 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError");
34 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "'IndexSizeE rror: Index or size was negative, or greater than the allowed value.'"); 34 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "'IndexSizeE rror: Index or size was negative, or greater than the allowed value.'");
35 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeErro r"); 35 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeErro r");
36 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeE rror"); 36 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "TypeE rror");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698