| OLD | NEW |
| (Empty) | |
| 1 <script src="../../resources/testharness.js"></script> |
| 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <script> |
| 4 function make_canvas(type) |
| 5 { |
| 6 if (type == "html") |
| 7 return document.createElement("canvas"); |
| 8 return new OffscreenCanvas(10, 10); |
| 9 } |
| 10 |
| 11 function test_back_ref(contextType, canvasType) |
| 12 { |
| 13 var canvas = make_canvas(canvasType); |
| 14 var ctx = canvas.getContext(contextType); |
| 15 assert_equals(ctx.canvas, canvas, "Back reference to canvas should work."); |
| 16 var anotherCanvas = make_canvas(canvasType); |
| 17 ctx.canvas = anotherCanvas; |
| 18 assert_not_equals(ctx.canvas, anotherCanvas, "Canvas attribute is read only.
"); |
| 19 } |
| 20 |
| 21 generate_tests(test_back_ref, [ |
| 22 ["2d context on html canvas", "2d", "html"], |
| 23 ["webgl context on html canvas", "webgl", "html"], |
| 24 ["bitmaprenderer context on html canvas", "bitmaprenderer", "html"], |
| 25 ["2d context on offscreen canvas", "2d", "offscreen"], |
| 26 ["webgl context on offscreen canvas", "webgl", "offscreen"], |
| 27 ]); |
| 28 </script> |
| OLD | NEW |