blob: bf00fbf30a9a8db624d904dc5b018beedcc7e56e [file] [log] [blame]
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<canvas id="canvas" width="100" height="100"></canvas>
<script>
function shouldBeBlackPixel(ctx, x, y)
{
var data = ctx.getImageData(x, y, 1, 1).data;
assert_equals(data[0], 0);
assert_equals(data[1], 0);
assert_equals(data[2], 0);
assert_equals(data[3], 255);
}
test(function(t) {
var ctx = document.getElementById('canvas').getContext('2d');
ctx.lineWidth = 4;
// 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(ctx, 50, 20);
// moveTo + empty arc (radius == 0)
ctx.beginPath();
ctx.moveTo(20, 40);
ctx.arc(80, 40, 0, 0, 6, false);
ctx.stroke();
shouldBeBlackPixel(ctx, 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(ctx, 50, 60);
// empty arc (radius == 0) + lineTo
ctx.beginPath();
ctx.arc(20, 80, 0, 0, 6, false);
ctx.lineTo(80, 80);
ctx.stroke();
shouldBeBlackPixel(ctx, 50, 80);
}, 'Series of tests to ensure zero-length arc extends current subpath (bug 55696)');
</script>