| <!DOCTYPE html> |
| <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> |
| <title>Canvas test: 2d.strokeStyle.colorObject</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/html/canvas/resources/canvas-tests.js"></script> |
| <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> |
| <body class="show_output"> |
| |
| <h1>2d.strokeStyle.colorObject</h1> |
| <p class="desc">ctx.strokeStyle works with color objects</p> |
| |
| |
| <p class="output">Actual output:</p> |
| <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> |
| <p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt=""> |
| <ul id="d"></ul> |
| <script> |
| var t = async_test("ctx.strokeStyle works with color objects"); |
| _addTest(function(canvas, ctx) { |
| |
| ctx.lineWidth = 50; |
| ctx.strokeStyle = {r: 1, g: 0, b: 0}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 255,0,0,255); |
| ctx.strokeStyle = {r: 0, g: 0, b: 1}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 0,0,255,255); |
| ctx.strokeStyle = {r: 0.2, g: 0.4, b: 0.6}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 51,102,153,255); |
| ctx.strokeStyle = {r: 0, g: 1, b: 0}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 0,255,0,255); |
| ctx.strokeStyle = {r: -1, g: 0, b: 0}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 0,0,0,255); |
| ctx.strokeStyle = {r: 0, g: 2, b: 0}; |
| ctx.strokeRect(25, 24, 50, 2); |
| _assertPixel(canvas, 50,25, 0,255,0,255); |
| |
| }); |
| </script> |
| |