2d.line.invalid.strokestyle.html (1212B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>OffscreenCanvas test: 2d.line.invalid.strokestyle</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 9 <h1>2d.line.invalid.strokestyle</h1> 10 <p class="desc">Verify correct behavior of canvas on an invalid strokeStyle()</p> 11 12 13 <script> 14 var t = async_test("Verify correct behavior of canvas on an invalid strokeStyle()"); 15 var t_pass = t.done.bind(t); 16 var t_fail = t.step_func(function(reason) { 17 throw reason; 18 }); 19 t.step(function() { 20 21 var canvas = new OffscreenCanvas(100, 50); 22 var ctx = canvas.getContext('2d'); 23 24 ctx.strokeStyle = 'rgb(0, 255, 0)'; 25 ctx.strokeStyle = 'nonsense'; 26 ctx.lineWidth = 200; 27 ctx.moveTo(0,100); 28 ctx.lineTo(200,100); 29 ctx.stroke(); 30 var imageData = ctx.getImageData(0, 0, 200, 200); 31 var imgdata = imageData.data; 32 _assert(imgdata[4] == 0, "imgdata[\""+(4)+"\"] == 0"); 33 _assert(imgdata[5] == 255, "imgdata[\""+(5)+"\"] == 255"); 34 _assert(imgdata[6] == 0, "imgdata[\""+(6)+"\"] == 0"); 35 t.done(); 36 37 }); 38 </script>