OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 HitTestView* v2 = new HitTestView(true); | 974 HitTestView* v2 = new HitTestView(true); |
975 v2->SetBoundsRect(v2_bounds); | 975 v2->SetBoundsRect(v2_bounds); |
976 root_view->AddChildView(v2); | 976 root_view->AddChildView(v2); |
977 | 977 |
978 gfx::Point v1_centerpoint = v1_bounds.CenterPoint(); | 978 gfx::Point v1_centerpoint = v1_bounds.CenterPoint(); |
979 gfx::Point v2_centerpoint = v2_bounds.CenterPoint(); | 979 gfx::Point v2_centerpoint = v2_bounds.CenterPoint(); |
980 gfx::Point v1_origin = v1_bounds.origin(); | 980 gfx::Point v1_origin = v1_bounds.origin(); |
981 gfx::Point v2_origin = v2_bounds.origin(); | 981 gfx::Point v2_origin = v2_bounds.origin(); |
982 | 982 |
983 // Test HitTest | 983 // Test HitTest |
984 EXPECT_TRUE(v1->HitTest(ConvertPointToView(v1, v1_centerpoint))); | 984 EXPECT_TRUE(v1->HitTest(gfx::Rect(ConvertPointToView(v1, v1_centerpoint), |
985 EXPECT_TRUE(v2->HitTest(ConvertPointToView(v2, v2_centerpoint))); | 985 gfx::Size(0, 0)))); |
| 986 EXPECT_TRUE(v2->HitTest(gfx::Rect(ConvertPointToView(v2, v2_centerpoint), |
| 987 gfx::Size(0, 0)))); |
986 | 988 |
987 EXPECT_TRUE(v1->HitTest(ConvertPointToView(v1, v1_origin))); | 989 EXPECT_TRUE(v1->HitTest(gfx::Rect(ConvertPointToView(v1, v1_origin), |
988 EXPECT_FALSE(v2->HitTest(ConvertPointToView(v2, v2_origin))); | 990 gfx::Size(0, 0)))); |
| 991 EXPECT_FALSE(v2->HitTest(gfx::Rect(ConvertPointToView(v2, v2_origin), |
| 992 gfx::Size(0, 0)))); |
989 | 993 |
990 // Test GetEventHandlerForPoint | 994 // Test GetEventHandlerForPoint |
991 EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_centerpoint)); | 995 EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_centerpoint)); |
992 EXPECT_EQ(v2, root_view->GetEventHandlerForPoint(v2_centerpoint)); | 996 EXPECT_EQ(v2, root_view->GetEventHandlerForPoint(v2_centerpoint)); |
| 997 |
993 EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_origin)); | 998 EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_origin)); |
994 EXPECT_EQ(root_view, root_view->GetEventHandlerForPoint(v2_origin)); | 999 EXPECT_EQ(root_view, root_view->GetEventHandlerForPoint(v2_origin)); |
995 | 1000 |
996 widget->CloseNow(); | 1001 widget->CloseNow(); |
997 } | 1002 } |
998 | 1003 |
999 TEST_F(ViewTest, NotifyEnterExitOnChild) { | 1004 TEST_F(ViewTest, NotifyEnterExitOnChild) { |
1000 Widget* widget = new Widget; | 1005 Widget* widget = new Widget; |
1001 widget->Init(Widget::InitParams(Widget::InitParams::TYPE_POPUP)); | 1006 widget->Init(Widget::InitParams(Widget::InitParams::TYPE_POPUP)); |
1002 View* root_view = widget->GetRootView(); | 1007 View* root_view = widget->GetRootView(); |
(...skipping 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3337 // Set to non default value. | 3342 // Set to non default value. |
3338 v->layer()->set_scale_content(false); | 3343 v->layer()->set_scale_content(false); |
3339 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); | 3344 scoped_ptr<ui::Layer> old_layer(v->RecreateLayer()); |
3340 ui::Layer* new_layer = v->layer(); | 3345 ui::Layer* new_layer = v->layer(); |
3341 EXPECT_FALSE(new_layer->scale_content()); | 3346 EXPECT_FALSE(new_layer->scale_content()); |
3342 } | 3347 } |
3343 | 3348 |
3344 #endif // USE_AURA | 3349 #endif // USE_AURA |
3345 | 3350 |
3346 } // namespace views | 3351 } // namespace views |
OLD | NEW |