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."); | 9 description("Ensure correct behavior of drawImage with ImageBitmaps."); |
10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
(...skipping 14 matching lines...) Expand all Loading... |
25 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'"); | 25 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'"); |
26 } | 26 } |
27 | 27 |
28 function shouldNotBeCalled() { | 28 function shouldNotBeCalled() { |
29 testFailed("createImageBitmap promise rejected."); | 29 testFailed("createImageBitmap promise rejected."); |
30 finishJSTest(); | 30 finishJSTest(); |
31 } | 31 } |
32 | 32 |
33 function shouldBeRed(x, y) { | 33 function shouldBeRed(x, y) { |
34 d = ctx.getImageData(x, y, 1, 1).data; | 34 d = ctx.getImageData(x, y, 1, 1).data; |
35 shouldBeTrue("d[0] == 255"); | 35 shouldBe("d[0]", "255"); |
36 shouldBeTrue("d[1] == 0"); | 36 shouldBe("d[1]", "0"); |
37 shouldBeTrue("d[2] == 0"); | 37 shouldBe("d[2]", "0"); |
38 shouldBeTrue("d[3] == 255"); | 38 shouldBe("d[3]", "255"); |
39 } | 39 } |
40 | 40 |
41 function shouldBeGreen(x, y) { | 41 function shouldBeGreen(x, y) { |
42 d = ctx.getImageData(x, y, 1, 1).data; | 42 d = ctx.getImageData(x, y, 1, 1).data; |
43 shouldBeTrue("d[0] == 0"); | 43 shouldBe("d[0]", "0"); |
44 shouldBeTrue("d[1] == 255"); | 44 shouldBe("d[1]", "255"); |
45 shouldBeTrue("d[2] == 0"); | 45 shouldBe("d[2]", "0"); |
46 shouldBeTrue("d[3] == 255"); | 46 shouldBe("d[3]", "255"); |
47 } | 47 } |
48 | 48 |
49 function shouldBeBlue(x, y) { | 49 function shouldBeBlue(x, y) { |
50 d = ctx.getImageData(x, y, 1, 1).data; | 50 d = ctx.getImageData(x, y, 1, 1).data; |
51 shouldBeTrue("d[0] == 0"); | 51 shouldBe("d[0]", "0"); |
52 shouldBeTrue("d[1] == 0"); | 52 shouldBe("d[1]", "0"); |
53 shouldBeTrue("d[2] == 255"); | 53 shouldBe("d[2]", "255"); |
54 shouldBeTrue("d[3] == 255"); | 54 shouldBe("d[3]", "255"); |
55 } | 55 } |
56 | 56 |
57 function shouldBeBlack(x, y) { | 57 function shouldBeBlack(x, y) { |
58 d = ctx.getImageData(x, y, 1, 1).data; | 58 d = ctx.getImageData(x, y, 1, 1).data; |
59 shouldBeTrue("d[0] == 0"); | 59 shouldBe("d[0]", "0"); |
60 shouldBeTrue("d[1] == 0"); | 60 shouldBe("d[1]", "0"); |
61 shouldBeTrue("d[2] == 0"); | 61 shouldBe("d[2]", "0"); |
62 shouldBeTrue("d[3] == 255"); | 62 shouldBe("d[3]", "255"); |
63 } | 63 } |
64 | 64 |
65 function shouldBeClear(x, y) { | 65 function shouldBeClear(x, y) { |
66 // should be transparent black pixels | 66 // should be transparent black pixels |
67 d = ctx.getImageData(x, y, 1, 1).data; | 67 d = ctx.getImageData(x, y, 1, 1).data; |
68 shouldBeTrue("d[0] == 0"); | 68 shouldBe("d[0]", "0"); |
69 shouldBeTrue("d[1] == 0"); | 69 shouldBe("d[1]", "0"); |
70 shouldBeTrue("d[2] == 0"); | 70 shouldBe("d[2]", "0"); |
71 shouldBeTrue("d[3] == 0"); | 71 shouldBe("d[3]", "0"); |
72 } | 72 } |
73 | 73 |
74 function drawPattern(ctx) { | 74 function drawPattern(ctx) { |
75 // Draw a four-color pattern | 75 // Draw a four-color pattern |
76 ctx.beginPath(); | 76 ctx.beginPath(); |
77 ctx.fillStyle = "rgb(255, 0, 0)"; | 77 ctx.fillStyle = "rgb(255, 0, 0)"; |
78 ctx.fillRect(0, 0, 10, 10); | 78 ctx.fillRect(0, 0, 10, 10); |
79 ctx.fillStyle = "rgb(0, 255, 0)"; | 79 ctx.fillStyle = "rgb(0, 255, 0)"; |
80 ctx.fillRect(10, 0, 10, 10); | 80 ctx.fillRect(10, 0, 10, 10); |
81 ctx.fillStyle = "rgb(0, 0, 255)"; | 81 ctx.fillStyle = "rgb(0, 0, 255)"; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 clearContext(ctx); | 403 clearContext(ctx); |
404 ctx.drawImage(imageBitmap, 0, 0); | 404 ctx.drawImage(imageBitmap, 0, 0); |
405 shouldBeClear(1, 1); | 405 shouldBeClear(1, 1); |
406 shouldBeClear(9, 9); | 406 shouldBeClear(9, 9); |
407 shouldBeClear(11, 11); | 407 shouldBeClear(11, 11); |
408 shouldBeClear(22, 22); | 408 shouldBeClear(22, 22); |
409 } | 409 } |
410 </script> | 410 </script> |
411 </body> | 411 </body> |
412 </html> | 412 </html> |
OLD | NEW |