| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 promise_test( |
| 6 t => { return zeroSizeReadback("width", "none", t); }, |
| 7 "Verify convertToBlob on a 0 width OffscreenCanvas with no context." |
| 8 ); |
| 9 |
| 10 promise_test( |
| 11 t => { return zeroSizeReadback("width", "2d", t); }, |
| 12 "Verify convertToBlob and getImageData on a 0 width OffscreenCanvas with a 2d
context." |
| 13 ); |
| 14 |
| 15 promise_test( |
| 16 t => { return zeroSizeReadback("width", "webgl", t); }, |
| 17 "Verify convertToBlob on a 0 width OffscreenCanvas with a webgl context." |
| 18 ); |
| 19 |
| 20 promise_test( |
| 21 t => { return zeroSizeReadback("width", "webgl2", t); }, |
| 22 "Verify convertToBlob on a 0 width OffscreenCanvas with a webgl2 context." |
| 23 ); |
| 24 |
| 25 promise_test( |
| 26 t => { return zeroSizeReadback("height", "none", t); }, |
| 27 "Verify convertToBlob on a 0 height OffscreenCanvas with no context." |
| 28 ); |
| 29 |
| 30 promise_test( |
| 31 t => { return zeroSizeReadback("height", "2d", t); }, |
| 32 "Verify convertToBlob and getImageData on a 0 height OffscreenCanvas with a 2d
context." |
| 33 ); |
| 34 |
| 35 promise_test( |
| 36 t => { return zeroSizeReadback("height", "webgl", t); }, |
| 37 "Verify convertToBlob on a 0 height OffscreenCanvas with a webgl context." |
| 38 ); |
| 39 |
| 40 promise_test( |
| 41 t => { return zeroSizeReadback("height", "webgl2", t); }, |
| 42 "Verify convertToBlob on a 0 height OffscreenCanvas with a webgl2 context." |
| 43 ); |
| 44 |
| 45 function zeroSizeReadback(zeroDimension, contextType, t) { |
| 46 var offscreen = new OffscreenCanvas(10, 10); |
| 47 eval("offscreen." + zeroDimension + " = 0"); |
| 48 // Verify that one of the dimensions was indeed zeroed. |
| 49 assert_equals(offscreen.width * offscreen.height, 0); |
| 50 |
| 51 var ctx; |
| 52 if (contextType != "none") { |
| 53 ctx = offscreen.getContext(contextType); |
| 54 } |
| 55 |
| 56 if (contextType == '2d') { |
| 57 var imgdata = ctx.getImageData(0, 0, 1, 1); |
| 58 assert_equals(imgdata.width, 1); |
| 59 assert_equals(imgdata.height, 1); |
| 60 } |
| 61 |
| 62 return promise_rejects(t, new DOMException('', 'IndexSizeError'), offscreen.co
nvertToBlob()); |
| 63 } |
| 64 </script> |
| OLD | NEW |