2d.conformance.requirements.basics.worker.js (3390B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.conformance.requirements.basics 3 // Description:void methods return undefined 4 // Note:<p class="notes">Defined in "Web IDL" (draft) 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 var t = async_test("void methods return undefined"); 10 var t_pass = t.done.bind(t); 11 var t_fail = t.step_func(function(reason) { 12 throw reason; 13 }); 14 t.step(function() { 15 16 var canvas = new OffscreenCanvas(100, 50); 17 var ctx = canvas.getContext('2d'); 18 19 _assertSame(ctx.save(), undefined, "ctx.save()", "undefined"); 20 _assertSame(ctx.restore(), undefined, "ctx.restore()", "undefined"); 21 _assertSame(ctx.scale(1, 1), undefined, "ctx.scale(1, 1)", "undefined"); 22 _assertSame(ctx.rotate(0), undefined, "ctx.rotate(0)", "undefined"); 23 _assertSame(ctx.translate(0, 0), undefined, "ctx.translate(0, 0)", "undefined"); 24 if (ctx.transform) { // (avoid spurious failures, since the aim here is not to test that all features are supported) 25 _assertSame(ctx.transform(1, 0, 0, 1, 0, 0), undefined, "ctx.transform(1, 0, 0, 1, 0, 0)", "undefined"); 26 } 27 if (ctx.setTransform) { 28 _assertSame(ctx.setTransform(1, 0, 0, 1, 0, 0), undefined, "ctx.setTransform(1, 0, 0, 1, 0, 0)", "undefined"); 29 _assertSame(ctx.setTransform(), undefined, "ctx.setTransform()", "undefined"); 30 } 31 _assertSame(ctx.clearRect(0, 0, 0, 0), undefined, "ctx.clearRect(0, 0, 0, 0)", "undefined"); 32 _assertSame(ctx.fillRect(0, 0, 0, 0), undefined, "ctx.fillRect(0, 0, 0, 0)", "undefined"); 33 _assertSame(ctx.strokeRect(0, 0, 0, 0), undefined, "ctx.strokeRect(0, 0, 0, 0)", "undefined"); 34 _assertSame(ctx.beginPath(), undefined, "ctx.beginPath()", "undefined"); 35 _assertSame(ctx.closePath(), undefined, "ctx.closePath()", "undefined"); 36 _assertSame(ctx.moveTo(0, 0), undefined, "ctx.moveTo(0, 0)", "undefined"); 37 _assertSame(ctx.lineTo(0, 0), undefined, "ctx.lineTo(0, 0)", "undefined"); 38 _assertSame(ctx.quadraticCurveTo(0, 0, 0, 0), undefined, "ctx.quadraticCurveTo(0, 0, 0, 0)", "undefined"); 39 _assertSame(ctx.bezierCurveTo(0, 0, 0, 0, 0, 0), undefined, "ctx.bezierCurveTo(0, 0, 0, 0, 0, 0)", "undefined"); 40 _assertSame(ctx.arcTo(0, 0, 0, 0, 1), undefined, "ctx.arcTo(0, 0, 0, 0, 1)", "undefined"); 41 _assertSame(ctx.rect(0, 0, 0, 0), undefined, "ctx.rect(0, 0, 0, 0)", "undefined"); 42 _assertSame(ctx.arc(0, 0, 1, 0, 0, true), undefined, "ctx.arc(0, 0, 1, 0, 0, true)", "undefined"); 43 _assertSame(ctx.fill(), undefined, "ctx.fill()", "undefined"); 44 _assertSame(ctx.stroke(), undefined, "ctx.stroke()", "undefined"); 45 _assertSame(ctx.clip(), undefined, "ctx.clip()", "undefined"); 46 if (ctx.fillText) { 47 _assertSame(ctx.fillText('test', 0, 0), undefined, "ctx.fillText('test', 0, 0)", "undefined"); 48 _assertSame(ctx.strokeText('test', 0, 0), undefined, "ctx.strokeText('test', 0, 0)", "undefined"); 49 } 50 if (ctx.putImageData) { 51 _assertSame(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0), undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0)", "undefined"); 52 } 53 _assertSame(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0), undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0)", "undefined"); 54 _assertSame(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white'), undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white')", "undefined"); 55 t.done(); 56 57 }); 58 done();