2d.fillStyle.parse.current.removed.html (1689B)
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>Canvas test: 2d.fillStyle.parse.current.removed</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 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 9 <body class="show_output"> 10 11 <h1>2d.fillStyle.parse.current.removed</h1> 12 <p class="desc">currentColor is solid black when the canvas element is not in a document</p> 13 14 15 <p class="output">Actual output:</p> 16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> 17 <p class="output expectedtext">Expected output:<p><img src="2d.fillStyle.parse.current.removed.png" class="output expected" id="expected" alt=""> 18 <ul id="d"></ul> 19 <script> 20 var t = async_test("currentColor is solid black when the canvas element is not in a document"); 21 _addTest(function(canvas, ctx) { 22 23 // Try not to let it undetectably incorrectly pick up opaque-black 24 // from other parts of the document: 25 document.body.parentNode.setAttribute('style', 'color: #f00'); 26 document.body.setAttribute('style', 'color: #f00'); 27 canvas.setAttribute('style', 'color: #f00'); 28 29 var canvas2 = document.createElement('canvas'); 30 var ctx2 = canvas2.getContext('2d'); 31 ctx2.fillStyle = '#f00'; 32 ctx2.fillStyle = 'currentColor'; 33 ctx2.fillRect(0, 0, 100, 50); 34 ctx.drawImage(canvas2, 0, 0); 35 36 document.body.parentNode.removeAttribute('style'); 37 document.body.removeAttribute('style'); 38 39 _assertPixel(canvas, 50,25, 0,0,0,255); 40 41 }); 42 </script>