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

Side by Side Diff: LayoutTests/fast/canvas/canvas-pattern-behaviour.js

Issue 289283002: Add some layout tests about behavior on undefined and null. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 6 years, 7 months 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
OLDNEW
1 description("This test covers the behaviour of pattern use and construction"); 1 description("This test covers the behaviour of pattern use and construction");
2 2
3 function dataToArray(data) { 3 function dataToArray(data) {
4 var result = new Array(data.length) 4 var result = new Array(data.length)
5 for (var i = 0; i < data.length; i++) 5 for (var i = 0; i < data.length; i++)
6 result[i] = data[i]; 6 result[i] = data[i];
7 return result; 7 return result;
8 } 8 }
9 9
10 function getPixel(x, y) { 10 function getPixel(x, y) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 function () { 61 function () {
62 shouldThrow("context.createPattern(green1x1, undefined)"); 62 shouldThrow("context.createPattern(green1x1, undefined)");
63 }, 63 },
64 function () { 64 function () {
65 shouldThrow("context.createPattern(green1x1, 'undefined')"); 65 shouldThrow("context.createPattern(green1x1, 'undefined')");
66 }, 66 },
67 function () { 67 function () {
68 shouldThrow("context.createPattern(green1x1, {toString:function(){ retur n null;}})"); 68 shouldThrow("context.createPattern(green1x1, {toString:function(){ retur n null;}})");
69 }, 69 },
70 function () { 70 function () {
71 shouldThrow("context.createPattern(null, '')");
72 },
73 function () {
74 shouldThrow("context.createPattern(undefined, '')");
75 },
76 function () {
77 shouldThrow("context.createPattern({}, '')");
78 },
79 function () {
80 shouldThrow("context.createPattern([], '')");
81 },
82 function () {
71 var didThrow = false; 83 var didThrow = false;
72 try { 84 try {
73 var pattern = context.createPattern(green1x1, ''); 85 var pattern = context.createPattern(green1x1, '');
74 } catch (e) { 86 } catch (e) {
75 didThrow = true; 87 didThrow = true;
76 testFailed("context.createPattern(green1x1, '') threw exception "+e) 88 testFailed("context.createPattern(green1x1, '') threw exception "+e)
77 } 89 }
78 if (!didThrow) 90 if (!didThrow)
79 testPassed("context.createPattern(green1x1, '') did not throw an exc eption"); 91 testPassed("context.createPattern(green1x1, '') did not throw an exc eption");
80 92
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 pixelShouldBe(98, 1, [0,128,0,255]); 126 pixelShouldBe(98, 1, [0,128,0,255]);
115 pixelShouldBe(1, 48, [0,128,0,255]); 127 pixelShouldBe(1, 48, [0,128,0,255]);
116 pixelShouldBe(98, 48, [0,128,0,255]); 128 pixelShouldBe(98, 48, [0,128,0,255]);
117 }, 129 },
118 ]; 130 ];
119 for (var i = 0; i < tests.length; i++) { 131 for (var i = 0; i < tests.length; i++) {
120 context.fillStyle="red"; 132 context.fillStyle="red";
121 context.fillRect(0,0,100,50); 133 context.fillRect(0,0,100,50);
122 tests[i](); 134 tests[i]();
123 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698