blob: 191a118099ed85dc219e017e186798d53801063a [file] [log] [blame]
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>
test(function(t) {
var canvas = document.createElement('canvas')
var ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 1, 1);
var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
g.addColorStop(0, '#f00');
g.addColorStop(1, '#f00');
ctx.fillStyle = g;
ctx.fillRect(0, 0, 1 ,1);
var imageData = ctx.getImageData(0, 0, 1, 1);
var imgdata = imageData.data;
assert_equals(imgdata[0], 0);
assert_approx_equals(imgdata[1], 255, 50);
assert_equals(imgdata[2], 0);
}, "Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient.");
</script>
</body>