OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/ui/ws/window_finder.h" | 5 #include "services/ui/ws/window_finder.h" |
6 | 6 |
7 #include "services/ui/ws/server_window.h" | 7 #include "services/ui/ws/server_window.h" |
8 #include "services/ui/ws/server_window_surface_manager.h" | 8 #include "services/ui/ws/server_window_surface_manager.h" |
9 #include "services/ui/ws/server_window_surface_manager_test_api.h" | 9 #include "services/ui/ws/server_window_surface_manager_test_api.h" |
10 #include "services/ui/ws/test_server_window_delegate.h" | 10 #include "services/ui/ws/test_server_window_delegate.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 child2.SetBounds(gfx::Rect(15, 15, 20, 20)); | 34 child2.SetBounds(gfx::Rect(15, 15, 20, 20)); |
35 | 35 |
36 gfx::Point local_point(16, 16); | 36 gfx::Point local_point(16, 16); |
37 EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point)); | 37 EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point)); |
38 EXPECT_EQ(gfx::Point(1, 1), local_point); | 38 EXPECT_EQ(gfx::Point(1, 1), local_point); |
39 | 39 |
40 local_point.SetPoint(13, 14); | 40 local_point.SetPoint(13, 14); |
41 EXPECT_EQ(&child1, FindDeepestVisibleWindowForEvents(&root, &local_point)); | 41 EXPECT_EQ(&child1, FindDeepestVisibleWindowForEvents(&root, &local_point)); |
42 EXPECT_EQ(gfx::Point(3, 4), local_point); | 42 EXPECT_EQ(gfx::Point(3, 4), local_point); |
43 | 43 |
| 44 local_point.SetPoint(13, 14); |
| 45 child1.set_can_accept_events(false); |
| 46 EXPECT_EQ(&root, FindDeepestVisibleWindowForEvents(&root, &local_point)); |
| 47 EXPECT_EQ(gfx::Point(13, 14), local_point); |
| 48 |
44 child2.set_extended_hit_test_region(gfx::Insets(10, 10, 10, 10)); | 49 child2.set_extended_hit_test_region(gfx::Insets(10, 10, 10, 10)); |
45 local_point.SetPoint(13, 14); | 50 local_point.SetPoint(13, 14); |
46 EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point)); | 51 EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point)); |
47 EXPECT_EQ(gfx::Point(-2, -1), local_point); | 52 EXPECT_EQ(gfx::Point(-2, -1), local_point); |
48 } | 53 } |
49 | 54 |
50 TEST(WindowFinderTest, FindDeepestVisibleWindowHitTestMask) { | 55 TEST(WindowFinderTest, FindDeepestVisibleWindowHitTestMask) { |
51 TestServerWindowDelegate window_delegate; | 56 TestServerWindowDelegate window_delegate; |
52 ServerWindow root(&window_delegate, WindowId(1, 2)); | 57 ServerWindow root(&window_delegate, WindowId(1, 2)); |
53 window_delegate.set_root_window(&root); | 58 window_delegate.set_root_window(&root); |
(...skipping 16 matching lines...) Expand all Loading... |
70 | 75 |
71 // Test a point inside the window and inside the mask. | 76 // Test a point inside the window and inside the mask. |
72 gfx::Point point_inside_mask(15, 15); | 77 gfx::Point point_inside_mask(15, 15); |
73 EXPECT_EQ(&child_with_mask, | 78 EXPECT_EQ(&child_with_mask, |
74 FindDeepestVisibleWindowForEvents(&root, &point_inside_mask)); | 79 FindDeepestVisibleWindowForEvents(&root, &point_inside_mask)); |
75 EXPECT_EQ(gfx::Point(5, 5), point_inside_mask); | 80 EXPECT_EQ(gfx::Point(5, 5), point_inside_mask); |
76 } | 81 } |
77 | 82 |
78 } // namespace ws | 83 } // namespace ws |
79 } // namespace ui | 84 } // namespace ui |
OLD | NEW |