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

Unified Diff: components/mus/ws/window_finder_unittest.cc

Issue 1991973003: mash: Preliminary support for widget hit test masks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 | « components/mus/ws/window_finder.cc ('k') | components/mus/ws/window_manager_access_policy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/window_finder_unittest.cc
diff --git a/components/mus/ws/window_finder_unittest.cc b/components/mus/ws/window_finder_unittest.cc
index c0021d61263b861bbf973021d6742f4fbf41393b..f910624ce433ca3a8072eb72633100589a9cbc79 100644
--- a/components/mus/ws/window_finder_unittest.cc
+++ b/components/mus/ws/window_finder_unittest.cc
@@ -47,5 +47,33 @@ TEST(WindowFinderTest, FindDeepestVisibleWindow) {
EXPECT_EQ(gfx::Point(-2, -1), local_point);
}
+TEST(WindowFinderTest, FindDeepestVisibleWindowHitTestMask) {
+ TestServerWindowDelegate window_delegate;
+ ServerWindow root(&window_delegate, WindowId(1, 2));
+ window_delegate.set_root_window(&root);
+ EnableHitTest(&root);
+ root.SetVisible(true);
+ root.SetBounds(gfx::Rect(0, 0, 100, 100));
+
+ ServerWindow child_with_mask(&window_delegate, WindowId(1, 4));
+ root.Add(&child_with_mask);
+ EnableHitTest(&child_with_mask);
+ child_with_mask.SetVisible(true);
+ child_with_mask.SetBounds(gfx::Rect(10, 10, 20, 20));
+ child_with_mask.SetHitTestMask(gfx::Rect(2, 2, 16, 16));
+
+ // Test a point inside the window but outside the mask.
+ gfx::Point point_outside_mask(11, 11);
+ EXPECT_EQ(&root,
+ FindDeepestVisibleWindowForEvents(&root, &point_outside_mask));
+ EXPECT_EQ(gfx::Point(11, 11), point_outside_mask);
+
+ // Test a point inside the window and inside the mask.
+ gfx::Point point_inside_mask(15, 15);
+ EXPECT_EQ(&child_with_mask,
+ FindDeepestVisibleWindowForEvents(&root, &point_inside_mask));
+ EXPECT_EQ(gfx::Point(5, 5), point_inside_mask);
+}
+
} // namespace ws
} // namespace mus
« no previous file with comments | « components/mus/ws/window_finder.cc ('k') | components/mus/ws/window_manager_access_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698