OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/gfx/chrome_canvas.h" | 5 #include "chrome/common/gfx/chrome_canvas.h" |
6 #include "chrome/common/gfx/path.h" | 6 #include "chrome/common/gfx/path.h" |
7 #include "chrome/views/background.h" | 7 #include "chrome/views/background.h" |
8 #include "chrome/views/event.h" | 8 #include "chrome/views/event.h" |
9 #include "chrome/views/root_view.h" | 9 #include "chrome/views/root_view.h" |
10 #include "chrome/views/view.h" | 10 #include "chrome/views/view.h" |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 mask->close(); | 532 mask->close(); |
533 } | 533 } |
534 | 534 |
535 private: | 535 private: |
536 bool has_hittest_mask_; | 536 bool has_hittest_mask_; |
537 | 537 |
538 DISALLOW_COPY_AND_ASSIGN(HitTestView); | 538 DISALLOW_COPY_AND_ASSIGN(HitTestView); |
539 }; | 539 }; |
540 | 540 |
541 POINT ConvertPointToView(ChromeViews::View* view, const POINT& p) { | 541 POINT ConvertPointToView(ChromeViews::View* view, const POINT& p) { |
542 CPoint tmp = p; | 542 gfx::Point tmp(p); |
543 ChromeViews::View::ConvertPointToView(view->GetRootView(), view, &tmp); | 543 ChromeViews::View::ConvertPointToView(view->GetRootView(), view, &tmp); |
544 return tmp; | 544 return tmp.ToPOINT(); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
548 TEST_F(ViewTest, HitTestMasks) { | 548 TEST_F(ViewTest, HitTestMasks) { |
549 ChromeViews::HWNDViewContainer window; | 549 ChromeViews::HWNDViewContainer window; |
550 ChromeViews::RootView* root_view = window.GetRootView(); | 550 ChromeViews::RootView* root_view = window.GetRootView(); |
551 root_view->SetBounds(0, 0, 500, 500); | 551 root_view->SetBounds(0, 0, 500, 500); |
552 | 552 |
553 gfx::Rect v1_bounds = gfx::Rect(0, 0, 100, 100); | 553 gfx::Rect v1_bounds = gfx::Rect(0, 0, 100, 100); |
554 HitTestView* v1 = new HitTestView(false); | 554 HitTestView* v1 = new HitTestView(false); |
(...skipping 16 matching lines...) Expand all Loading... |
571 | 571 |
572 EXPECT_EQ(true, v1->HitTest(ConvertPointToView(v1, v1_origin))); | 572 EXPECT_EQ(true, v1->HitTest(ConvertPointToView(v1, v1_origin))); |
573 EXPECT_EQ(false, v2->HitTest(ConvertPointToView(v2, v2_origin))); | 573 EXPECT_EQ(false, v2->HitTest(ConvertPointToView(v2, v2_origin))); |
574 | 574 |
575 // Test GetViewForPoint | 575 // Test GetViewForPoint |
576 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_centerpoint)); | 576 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_centerpoint)); |
577 EXPECT_EQ(v2, root_view->GetViewForPoint(v2_centerpoint)); | 577 EXPECT_EQ(v2, root_view->GetViewForPoint(v2_centerpoint)); |
578 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_origin)); | 578 EXPECT_EQ(v1, root_view->GetViewForPoint(v1_origin)); |
579 EXPECT_EQ(root_view, root_view->GetViewForPoint(v2_origin)); | 579 EXPECT_EQ(root_view, root_view->GetViewForPoint(v2_origin)); |
580 } | 580 } |
OLD | NEW |