blob: 288d14f0b6bdb332e58ede25aa10c10fa084851c [file] [log] [blame]
darin@apple.coma2a00252008-12-16 00:22:14 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
mark.lam@apple.com104d9932013-09-07 22:20:15 +00004<script src="../../resources/js-test-pre.js"></script>
darin@apple.coma2a00252008-12-16 00:22:14 +00005</head>
6<body>
ap@apple.com92352d02017-05-24 22:53:00 +00007<script>
8description("Series of tests to ensure that no gradient is drawn without path");
9var ctx = document.createElement('canvas').getContext('2d');
10
11ctx.fillStyle = 'green';
12ctx.fillRect(0, 0, 100, 100);
13
14var gradient = ctx.createLinearGradient(0, 0, 0, 100);
15gradient.addColorStop(1, 'red');
16ctx.fillStyle = gradient;
17
18ctx.fill();
19
20var imageData = ctx.getImageData(1, 1, 98, 98);
21var imgdata = imageData.data;
22shouldBe("imgdata[4]", "0");
23shouldBe("imgdata[5]", "128");
24shouldBe("imgdata[6]", "0");
25
26ctx.strokeStyle = 'green';
27ctx.lineWidth = 100;
28ctx.strokeRect(50, 0, 100, 100);
29
30ctx.strokeStyle = gradient;
31
32ctx.stroke();
33
34imageData = ctx.getImageData(1, 1, 98, 98);
35imgdata = imageData.data;
36shouldBe("imgdata[4]", "0");
37shouldBe("imgdata[5]", "128");
38shouldBe("imgdata[6]", "0");
39</script>
mark.lam@apple.com104d9932013-09-07 22:20:15 +000040<script src="../../resources/js-test-post.js"></script>
darin@apple.coma2a00252008-12-16 00:22:14 +000041</body>
42</html>