| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..978c768f2e906b20aab8a52d3af0dbfb91530875
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html
|
| @@ -0,0 +1,67 @@
|
| +<!DOCTYPE html>
|
| +<title>HitRegion Clip Test</title>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script src="./resources/test-helpers.js"></script>
|
| +<canvas width="400" height="400"></canvas>
|
| +<style>
|
| +
|
| +body {
|
| + margin : 0px;
|
| + padding : 0px;
|
| +}
|
| +
|
| +</style>
|
| +<script>
|
| +
|
| +var canvas = document.querySelector('canvas');
|
| +var context = canvas.getContext('2d');
|
| +
|
| +function simple_rect_clip_test(test_set)
|
| +{
|
| + context.save();
|
| + context.beginPath();
|
| + context.rect(0, 0, 100, 100);
|
| + context.clip();
|
| + context.beginPath();
|
| + context.rect(50, 50, 100, 100);
|
| + context.fill();
|
| + context.addHitRegion({ id : 'clip' });
|
| + context.restore();
|
| + generate_tests(assert_equals, test_set);
|
| +}
|
| +
|
| +function non_rect_clip_test(test_set)
|
| +{
|
| + context.save();
|
| + context.beginPath();
|
| + context.arc(50, 50, 50, 0, Math.PI * 2);
|
| + context.clip();
|
| + context.beginPath();
|
| + context.rect(0, 0, 100, 100);
|
| + context.fill();
|
| + context.addHitRegion({ id : 'clip' });
|
| + context.restore();
|
| + generate_tests(assert_equals, test_set);
|
| +}
|
| +
|
| +coroutine(function*() {
|
| + setup({ explicit_done : true, explicit_timeout : true });
|
| +
|
| + simple_rect_clip_test([
|
| + [ 'null', yield clickOrTouch(10, 10), null ],
|
| + [ 'clip', yield clickOrTouch(60, 60), 'clip' ]
|
| + ]);
|
| +
|
| + non_rect_clip_test([
|
| + [ 'null', yield clickOrTouch(0, 0), null ],
|
| + [ 'null', yield clickOrTouch(100, 0), null ],
|
| + [ 'null', yield clickOrTouch(100, 100), null ],
|
| + [ 'null', yield clickOrTouch(0, 100), null ],
|
| + [ 'clip', yield clickOrTouch(50, 50), 'clip' ]
|
| + ]);
|
| +
|
| + done();
|
| +});
|
| +
|
| +</script>
|
|
|