| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 description("Ensure correct behavior of drawImage with ImageBitmaps from video e
lements."); | 9 description("Ensure correct behavior of drawImage with ImageBitmaps from video e
lements."); |
| 10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
| 11 | 11 |
| 12 function jsWrapperClass(node) | 12 function jsWrapperClass(node) |
| 13 { | 13 { |
| 14 // returns the ClassName of node | 14 // returns the ClassName of node |
| 15 if (!node) | 15 if (!node) |
| 16 return "[null]"; | 16 return "[null]"; |
| 17 var string = Object.prototype.toString.apply(node); | 17 var string = Object.prototype.toString.apply(node); |
| 18 | 18 |
| 19 // string will be of the form [object ClassName] | 19 // string will be of the form [object ClassName] |
| 20 return string.substr(8, string.length - 9); | 20 return string.substr(8, string.length - 9); |
| 21 } | 21 } |
| 22 | 22 |
| 23 function shouldBeType(expression, className) | 23 function shouldBeType(expression, className) |
| 24 { | 24 { |
| 25 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'"); | 25 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function shouldBeOpaque(x, y) { | 28 function shouldBeOpaque(x, y) { |
| 29 d = ctx.getImageData(x, y, 1, 1).data; | 29 d = ctx.getImageData(x, y, 1, 1).data; |
| 30 shouldBeTrue("d[3] == 255"); | 30 shouldBe("d[3]", "255"); |
| 31 } | 31 } |
| 32 | 32 |
| 33 function shouldBeClear(x, y) { | 33 function shouldBeClear(x, y) { |
| 34 // should be transparent black pixels | 34 // should be transparent black pixels |
| 35 d = ctx.getImageData(x, y, 1, 1).data; | 35 d = ctx.getImageData(x, y, 1, 1).data; |
| 36 shouldBeTrue("d[0] == 0"); | 36 shouldBe("d[0]", "0"); |
| 37 shouldBeTrue("d[1] == 0"); | 37 shouldBe("d[1]", "0"); |
| 38 shouldBeTrue("d[2] == 0"); | 38 shouldBe("d[2]", "0"); |
| 39 shouldBeTrue("d[3] == 0"); | 39 shouldBe("d[3]", "0"); |
| 40 } | 40 } |
| 41 | 41 |
| 42 function clearContext() { | 42 function clearContext() { |
| 43 ctx.clearRect(0, 0, 500, 500); | 43 ctx.clearRect(0, 0, 500, 500); |
| 44 } | 44 } |
| 45 | 45 |
| 46 var bitmap; | 46 var bitmap; |
| 47 var video; | 47 var video; |
| 48 | 48 |
| 49 var canvas = document.createElement("canvas"); | 49 var canvas = document.createElement("canvas"); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 ctx.drawImage(imageBitmap, 0, 0); | 203 ctx.drawImage(imageBitmap, 0, 0); |
| 204 shouldBeClear(10, 10); | 204 shouldBeClear(10, 10); |
| 205 shouldBeClear(90, 90); | 205 shouldBeClear(90, 90); |
| 206 shouldBeClear(110, 110); | 206 shouldBeClear(110, 110); |
| 207 shouldBeClear(210, 210); | 207 shouldBeClear(210, 210); |
| 208 } | 208 } |
| 209 | 209 |
| 210 </script> | 210 </script> |
| 211 </body> | 211 </body> |
| 212 </html> | 212 </html> |
| OLD | NEW |