<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<title>Canvas test: 2d.fillStyle.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.fillStyle.colorObject</h1>
<p class="desc">ctx.fillStyle 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.fillStyle works with color objects");
_addTest(function(canvas, ctx) {

ctx.fillStyle = {r: 1, g: 0, b: 0};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 255,0,0,255, "50,25", "255,0,0,255");
ctx.fillStyle = {r: 0, g: 0, b: 1};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,0,255,255, "50,25", "0,0,255,255");
ctx.fillStyle = {r: 0.2, g: 0.4, b: 0.6};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 51,102,153,255, "50,25", "51,102,153,255");
ctx.fillStyle = {r: 0, g: 1, b: 0};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
ctx.fillStyle = {r: -1, g: 0, b: 0};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,0,0,255, "50,25", "0,0,0,255");
ctx.fillStyle = {r: 0, g: 2, b: 0};
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");


});
</script>

