gecko/content/canvas/test/test_2d.path.isPointInPath.bigarc.html

32 lines
1.3 KiB
HTML

<!DOCTYPE HTML>
<title>Canvas test: 2d.path.isPointInPath.bigarc</title>
<!-- Testing: isPointInPath() works on unclosed arcs larger than 2pi -->
<script src="/MochiKit/packed.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<body>
<canvas id="c" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
SimpleTest.waitForExplicitFinish();
MochiKit.DOM.addLoadEvent(function () {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
ctx.arc(50, 25, 10, 0, 7, false);
ok(ctx.isPointInPath(50, 10) === false, "ctx.isPointInPath(50, 10) === false");
ok(ctx.isPointInPath(50, 20) === true, "ctx.isPointInPath(50, 20) === true");
ok(ctx.isPointInPath(50, 30) === true, "ctx.isPointInPath(50, 30) === true");
ok(ctx.isPointInPath(50, 40) === false, "ctx.isPointInPath(50, 40) === false");
ok(ctx.isPointInPath(30, 20) === false, "ctx.isPointInPath(30, 20) === false");
ok(ctx.isPointInPath(70, 20) === false, "ctx.isPointInPath(70, 20) === false");
ok(ctx.isPointInPath(30, 30) === false, "ctx.isPointInPath(30, 30) === false");
ok(ctx.isPointInPath(70, 30) === false, "ctx.isPointInPath(70, 30) === false");
SimpleTest.finish();
});
</script>