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

Unified Diff: components/mus/ws/event_dispatcher_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: add bug link for SkPath conversion 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
Index: components/mus/ws/event_dispatcher_unittest.cc
diff --git a/components/mus/ws/event_dispatcher_unittest.cc b/components/mus/ws/event_dispatcher_unittest.cc
index 07ffa0f39d67161710f735a75baccb7af8fa4f1b..424d07c7b450b81b5a3034173997acdc532c43cb 100644
--- a/components/mus/ws/event_dispatcher_unittest.cc
+++ b/components/mus/ws/event_dispatcher_unittest.cc
@@ -654,6 +654,26 @@ TEST_F(EventDispatcherTest, AdditionalClientArea) {
EXPECT_FALSE(details->in_nonclient_area);
}
+TEST_F(EventDispatcherTest, HitTestMask) {
+ std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
+
+ root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
+ child->SetBounds(gfx::Rect(10, 10, 20, 20));
+ child->set_hit_test_mask(gfx::Rect(2, 2, 16, 16));
+
+ // Press in the masked out area.
+ const ui::PointerEvent press_event(ui::MouseEvent(
+ ui::ET_MOUSE_PRESSED, gfx::Point(11, 11), gfx::Point(11, 11),
+ base::TimeDelta(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
+ event_dispatcher()->ProcessEvent(press_event);
+
+ // Event went through the child window and hit the root.
+ std::unique_ptr<DispatchedEventDetails> details =
+ test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
+ EXPECT_EQ(root_window(), details->window);
+ EXPECT_FALSE(details->in_nonclient_area);
+}
+
TEST_F(EventDispatcherTest, DontFocusOnSecondDown) {
std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));

Powered by Google App Engine
This is Rietveld 408576698