OLD | NEW |
(Empty) | |
| 1 // DO NOT EDIT! This test has been generated by tools/gentest.py. |
| 2 // OffscreenCanvas test in a worker:2d.voidreturn |
| 3 // Description:void methods return undefined |
| 4 // Note: |
| 5 |
| 6 importScripts("/resources/testharness.js"); |
| 7 importScripts("/common/canvas-tests.js"); |
| 8 |
| 9 var t = async_test("void methods return undefined"); |
| 10 t.step(function() { |
| 11 |
| 12 var offscreenCanvas = new OffscreenCanvas(100, 50); |
| 13 var ctx = offscreenCanvas.getContext('2d'); |
| 14 |
| 15 _assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); |
| 16 _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); |
| 17 _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); |
| 18 _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); |
| 19 _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); |
| 20 if (ctx.transform) { // (avoid spurious failures, since the aim here is not to t
est that all features are supported) |
| 21 _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0,
0, 1, 0, 0)", "undefined"); |
| 22 } |
| 23 if (ctx.setTransform) { |
| 24 _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform
(1, 0, 0, 1, 0, 0)", "undefined"); |
| 25 } |
| 26 _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "
undefined"); |
| 27 _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "un
defined"); |
| 28 _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)",
"undefined"); |
| 29 _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); |
| 30 _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); |
| 31 _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); |
| 32 _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); |
| 33 _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0
, 0, 0, 0)", "undefined"); |
| 34 _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0
, 0, 0, 0, 0, 0)", "undefined"); |
| 35 _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "un
defined"); |
| 36 _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"
); |
| 37 _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, tru
e)", "undefined"); |
| 38 _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); |
| 39 _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); |
| 40 _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); |
| 41 if (ctx.putImageData) { |
| 42 _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined,
"ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); |
| 43 } |
| 44 _assertSame(ctx.drawImage(offscreenCanvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "
ctx.drawImage(offscreenCanvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); |
| 45 _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undef
ined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefine
d"); |
| 46 |
| 47 t.done(); |
| 48 |
| 49 }); |
| 50 done(); |
OLD | NEW |