Index: ui/aura/window_unittest.cc |
=================================================================== |
--- ui/aura/window_unittest.cc (revision 103882) |
+++ ui/aura/window_unittest.cc (working copy) |
@@ -585,7 +585,7 @@ |
gfx::Rect(0, 0, 500, 500), NULL)); |
scoped_ptr<Window> w11(CreateTestWindowWithDelegate(NULL, 11, |
gfx::Rect(0, 0, 500, 500), w1.get())); |
- scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 1, |
+ scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 111, |
gfx::Rect(50, 50, 450, 450), w11.get())); |
scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12, |
gfx::Rect(0, 0, 500, 500), w1.get())); |
@@ -594,5 +594,31 @@ |
EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(target_point)); |
} |
+// When set_consume_events() is called with |true| for a Window, that Window |
+// should make sure that none behind it in the z-order see events if it has |
+// children. If it does not have children, event targeting works as usual. |
+TEST_F(WindowTest, ConsumesEvents) { |
+ WindowDelegateImpl d11; |
+ WindowDelegateImpl d121; |
+ scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1, |
+ gfx::Rect(0, 0, 500, 500), NULL)); |
+ scoped_ptr<Window> w11(CreateTestWindowWithDelegate(&d11, 11, |
+ gfx::Rect(0, 0, 500, 500), w1.get())); |
+ scoped_ptr<Window> w111(CreateTestWindowWithDelegate(NULL, 111, |
+ gfx::Rect(50, 50, 450, 450), w11.get())); |
+ scoped_ptr<Window> w12(CreateTestWindowWithDelegate(NULL, 12, |
+ gfx::Rect(0, 0, 500, 500), w1.get())); |
+ scoped_ptr<Window> w121(CreateTestWindowWithDelegate(&d121, 121, |
+ gfx::Rect(150, 150, 50, 50), NULL)); |
+ |
+ w12->set_consumes_events(true); |
+ EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(10, 10))); |
+ |
+ w12->AddChild(w121.get()); |
+ |
+ EXPECT_EQ(NULL, w1->GetEventHandlerForPoint(gfx::Point(10, 10))); |
+ EXPECT_EQ(w121.get(), w1->GetEventHandlerForPoint(gfx::Point(175, 175))); |
+} |
+ |
} // namespace internal |
} // namespace aura |