blob: 02ecfb12f1fca127188bcf47141c0b75c437bd58 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Series of tests to ensure that fill() paints nothing on canvas when the fillStyle is set to a zero-size gradient.");
var ctx = document.createElement('canvas').getContext('2d');
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.rect(0, 0, 1 ,1);
ctx.fill();
var imageData = ctx.getImageData(0, 0, 1, 1);
var imgdata = imageData.data;
shouldBe("imgdata[0]", "0");
shouldBe("imgdata[1]", "255");
shouldBe("imgdata[2]", "0");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>