Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-clip-test.html

Issue 1628413002: asdfsdf Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698