Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/js-test.js"></script> | |
| 3 <script> | |
| 4 description("Tests basic functionalities of offscreenCanvas.getContext on the ma in thread"); | |
| 5 | |
| 6 // Tests onstructor of OffscreenCanvas and length/width change | |
| 7 var aCanvas = new OffscreenCanvas(50, 50); | |
|
Justin Novosad
2016/03/07 15:30:26
Not new to this CL, but you should also test the e
| |
| 8 shouldBe("aCanvas.width", "50"); | |
| 9 shouldBe("aCanvas.height", "50"); | |
| 10 | |
| 11 aCanvas.width = 100; | |
| 12 aCanvas.height = 100; | |
| 13 shouldBe("aCanvas.width", "100"); | |
| 14 shouldBe("aCanvas.height", "100"); | |
| 15 | |
| 16 // Tests object type of getContext('2d') | |
| 17 var ctx; | |
| 18 shouldNotThrow("ctx = aCanvas.getContext('2d')"); | |
| 19 shouldBeType("ctx", "OffscreenCanvasRenderingContext2D"); | |
| 20 | |
| 21 // Calling getContext on a different context type will return null | |
| 22 var ctx2 = aCanvas.getContext("webgl"); | |
| 23 shouldBeNull("ctx2"); | |
|
Justin Novosad
2016/03/07 15:30:26
This is good, because this test will still be corr
| |
| 24 | |
| 25 // Calling getContext on the same context type will return the original context type | |
| 26 var ctx3 = aCanvas.getContext("2d"); | |
| 27 shouldBeNonNull("ctx3"); | |
| 28 shouldBeTrue("ctx3 == ctx"); | |
| 29 | |
| 30 // Calling getContext on an unimplemented context type will return null | |
| 31 var bCanvas = new OffscreenCanvas(20, 20); | |
| 32 var ctx4 = bCanvas.getContext("webgl"); | |
|
Justin Novosad
2016/03/07 15:30:26
This test will break the day we support WebGL, mig
| |
| 33 shouldBeNull("ctx4"); | |
| 34 </script> | |
| OLD | NEW |