2d.line.invalid.strokestyle.worker.js (1052B)
1 // DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. 2 // OffscreenCanvas test in a worker:2d.line.invalid.strokestyle 3 // Description:Verify correct behavior of canvas on an invalid strokeStyle() 4 // Note: 5 6 importScripts("/resources/testharness.js"); 7 importScripts("/html/canvas/resources/canvas-tests.js"); 8 9 var t = async_test("Verify correct behavior of canvas on an invalid strokeStyle()"); 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 ctx.strokeStyle = 'rgb(0, 255, 0)'; 20 ctx.strokeStyle = 'nonsense'; 21 ctx.lineWidth = 200; 22 ctx.moveTo(0,100); 23 ctx.lineTo(200,100); 24 ctx.stroke(); 25 var imageData = ctx.getImageData(0, 0, 200, 200); 26 var imgdata = imageData.data; 27 _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); 28 _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); 29 _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); 30 t.done(); 31 }); 32 done();