blob: de0e1efb907e4fac114cbe90676acef982bdd655 [file] [log] [blame]
<!DOCTYPE HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.rect(0, 0, 20, 20);
assert_true(ctx.isPointInPath(10, 10));
assert_false(ctx.isPointInPath(30, 10));
var path = new Path2D();
path.rect(20, 20, 100, 100);
assert_true(ctx.isPointInPath(path, 20, 20));
assert_false(ctx.isPointInPath(path, 130, 20));
}, 'Test the behavior of isPointInPath APIs for OffscreenCanvas');
test(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.strokeStyle = '#0f0';
ctx.beginPath();
ctx.rect(0, 0, 20, 20);
assert_true(ctx.isPointInStroke(0, 0));
assert_false(ctx.isPointInStroke(30, 10));
var path = new Path2D();
path.rect(20, 20, 100, 100);
assert_true(ctx.isPointInStroke(path, 20, 20));
assert_true(ctx.isPointInStroke(path, 120, 20));
}, 'Test the behavior of isPointInStroke APIs for OffscreenCanvas');
</script>