OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "gfx/canvas_skia.h" | 9 #include "gfx/canvas_skia.h" |
10 #include "gfx/path.h" | 10 #include "gfx/path.h" |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 HitTestView* v2 = new HitTestView(true); | 769 HitTestView* v2 = new HitTestView(true); |
770 v2->SetBounds(v2_bounds); | 770 v2->SetBounds(v2_bounds); |
771 root_view->AddChildView(v2); | 771 root_view->AddChildView(v2); |
772 | 772 |
773 gfx::Point v1_centerpoint = v1_bounds.CenterPoint(); | 773 gfx::Point v1_centerpoint = v1_bounds.CenterPoint(); |
774 gfx::Point v2_centerpoint = v2_bounds.CenterPoint(); | 774 gfx::Point v2_centerpoint = v2_bounds.CenterPoint(); |
775 gfx::Point v1_origin = v1_bounds.origin(); | 775 gfx::Point v1_origin = v1_bounds.origin(); |
776 gfx::Point v2_origin = v2_bounds.origin(); | 776 gfx::Point v2_origin = v2_bounds.origin(); |
777 | 777 |
778 // Test HitTest | 778 // Test HitTest |
779 EXPECT_EQ(true, v1->HitTest(ConvertPointToView(v1, v1_centerpoint))); | 779 EXPECT_TRUE(v1->HitTest(ConvertPointToView(v1, v1_centerpoint))); |
780 EXPECT_EQ(true, v2->HitTest(ConvertPointToView(v2, v2_centerpoint))); | 780 EXPECT_TRUE(v2->HitTest(ConvertPointToView(v2, v2_centerpoint))); |
781 | 781 |
782 EXPECT_EQ(true, v1->HitTest(ConvertPointToView(v1, v1_origin))); | 782 EXPECT_TRUE(v1->HitTest(ConvertPointToView(v1, v1_origin))); |
783 EXPECT_EQ(false, v2->HitTest(ConvertPointToView(v2, v2_origin))); | 783 EXPECT_FALSE(v2->HitTest(ConvertPointToView(v2, v2_origin))); |
784 | 784 |
785 // Test GetViewForPoint | 785 // Test GetViewForPoint |
786 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_centerpoint)); | 786 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_centerpoint)); |
787 EXPECT_EQ(v2, root_view->GetViewForPoint(v2_centerpoint)); | 787 EXPECT_EQ(v2, root_view->GetViewForPoint(v2_centerpoint)); |
788 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_origin)); | 788 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_origin)); |
789 EXPECT_EQ(root_view, root_view->GetViewForPoint(v2_origin)); | 789 EXPECT_EQ(root_view, root_view->GetViewForPoint(v2_origin)); |
790 } | 790 } |
791 | 791 |
792 TEST_F(ViewTest, Textfield) { | 792 TEST_F(ViewTest, Textfield) { |
793 const string16 kText = ASCIIToUTF16("Reality is that which, when you stop " | 793 const string16 kText = ASCIIToUTF16("Reality is that which, when you stop " |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 #endif | 1467 #endif |
1468 } | 1468 } |
1469 | 1469 |
1470 TEST_F(ViewTest, ChangeNativeViewHierarchyChangeHierarchy) { | 1470 TEST_F(ViewTest, ChangeNativeViewHierarchyChangeHierarchy) { |
1471 // TODO(georgey): Fix the test for Linux | 1471 // TODO(georgey): Fix the test for Linux |
1472 #if defined(OS_WIN) | 1472 #if defined(OS_WIN) |
1473 TestChangeNativeViewHierarchy test(this); | 1473 TestChangeNativeViewHierarchy test(this); |
1474 test.CheckChangingHierarhy(); | 1474 test.CheckChangingHierarhy(); |
1475 #endif | 1475 #endif |
1476 } | 1476 } |
OLD | NEW |