summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js
blob: e8c0596c640c485aa77a58559d12f94b09b7b00f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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");