blob: 133514606fd404bded9d7391a8058239b9b21382 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<canvas id="canvas" width="100" height="100"></canvas>
<script>
description("Bug 55696: Series of tests to ensure zero-length arc extends current subpath");
var ctx = document.getElementById('canvas').getContext('2d');
ctx.lineWidth = 4;
function shouldBeBlackPixel(x,y)
{
var data = ctx.getImageData(x, y, 1, 1).data;
if (data[0] != 0 || data[1] != 0 || data[2] != 0 || data[3] != 255) {
testFailed("Pixel (" + x + "," + y + ") should be black; " +
"was [" + data[0] + "," + data[1] + "," + data[2] + "," + data[3] + "]");
} else {
testPassed("Pixel (" + x + "," + y + ") is black.");
}
}
// moveTo + empty arc (swing == 0)
ctx.beginPath();
ctx.moveTo(20, 20);
ctx.arc(80, 30, 10, -Math.PI/2, -Math.PI/2, true);
ctx.stroke();
shouldBeBlackPixel(50, 20);
// moveTo + empty arc (radius == 0)
ctx.beginPath();
ctx.moveTo(20, 40);
ctx.arc(80, 40, 0, 0, 6, false);
ctx.stroke();
shouldBeBlackPixel(50, 40)
// empty arc (swing == 0) + lineTo
ctx.beginPath();
ctx.arc(20, 50, 10, Math.PI/2, Math.PI/2, false);
ctx.lineTo(80, 60);
ctx.stroke();
shouldBeBlackPixel(50, 60);
// empty arc (radius == 0) + lineTo
ctx.beginPath();
ctx.arc(20, 80, 0, 0, 6, false);
ctx.lineTo(80, 80);
ctx.stroke();
shouldBeBlackPixel(50, 80);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>