Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ash/wm/panels/panel_layout_manager.h" 5 #include "ash/wm/panels/panel_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf.h" 10 #include "ash/shelf/shelf.h"
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 797
798 // Note that the constants used in the touch locations below are 798 // Note that the constants used in the touch locations below are
799 // arbitrarily-selected small numbers which will ensure the point is 799 // arbitrarily-selected small numbers which will ensure the point is
800 // within the default extended region surrounding the panel. This value 800 // within the default extended region surrounding the panel. This value
801 // is calculated as 801 // is calculated as
802 // kResizeOutsideBoundsSize * kResizeOutsideBoundsScaleForTouch 802 // kResizeOutsideBoundsSize * kResizeOutsideBoundsScaleForTouch
803 // in src/ash/root_window_controller.cc. 803 // in src/ash/root_window_controller.cc.
804 804
805 // Hit test outside the right edge with a bottom-aligned shelf. 805 // Hit test outside the right edge with a bottom-aligned shelf.
806 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_BOTTOM); 806 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_BOTTOM);
807 gfx::Rect bounds(w->bounds()); 807 gfx::RectF bounds(w->bounds());
808 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, 808 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED,
809 gfx::Point(bounds.right() + 3, bounds.y() + 2), 809 bounds.top_right() + gfx::Vector2dF(3.f, 2.f), 0,
810 0, ui::EventTimeForNow()); 810 ui::EventTimeForNow());
811 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); 811 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch);
812 EXPECT_EQ(w.get(), target); 812 EXPECT_EQ(w.get(), target);
813 813
814 // Hit test outside the bottom edge with a bottom-aligned shelf. 814 // Hit test outside the bottom edge with a bottom-aligned shelf.
815 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5)); 815 touch.set_location(bounds.bottom_left() + gfx::Vector2dF(6.f, 5.f));
816 target = targeter->FindTargetForEvent(root, &touch); 816 target = targeter->FindTargetForEvent(root, &touch);
817 EXPECT_NE(w.get(), target); 817 EXPECT_NE(w.get(), target);
818 818
819 // Hit test outside the bottom edge with a right-aligned shelf. 819 // Hit test outside the bottom edge with a right-aligned shelf.
820 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT); 820 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT);
821 bounds = w->bounds(); 821 bounds = gfx::RectF(w->bounds());
822 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5)); 822 touch.set_location(bounds.bottom_left() + gfx::Vector2dF(6.f, 5.f));
823 target = targeter->FindTargetForEvent(root, &touch); 823 target = targeter->FindTargetForEvent(root, &touch);
824 EXPECT_EQ(w.get(), target); 824 EXPECT_EQ(w.get(), target);
825 825
826 // Hit test outside the right edge with a right-aligned shelf. 826 // Hit test outside the right edge with a right-aligned shelf.
827 touch.set_location(gfx::Point(bounds.right() + 3, bounds.y() + 2)); 827 touch.set_location(bounds.top_right() + gfx::Vector2dF(3.f, 2.f));
828 target = targeter->FindTargetForEvent(root, &touch); 828 target = targeter->FindTargetForEvent(root, &touch);
829 EXPECT_NE(w.get(), target); 829 EXPECT_NE(w.get(), target);
830 830
831 // Hit test outside the top edge with a left-aligned shelf. 831 // Hit test outside the top edge with a left-aligned shelf.
832 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_LEFT); 832 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_LEFT);
833 bounds = w->bounds(); 833 bounds = gfx::RectF(w->bounds());
834 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); 834 touch.set_location(bounds.origin() + gfx::Vector2dF(4.f, -6.f));
835 target = targeter->FindTargetForEvent(root, &touch); 835 target = targeter->FindTargetForEvent(root, &touch);
836 EXPECT_EQ(w.get(), target); 836 EXPECT_EQ(w.get(), target);
837 837
838 // Hit test outside the left edge with a left-aligned shelf. 838 // Hit test outside the left edge with a left-aligned shelf.
839 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 839 touch.set_location(bounds.origin() + gfx::Vector2dF(-1.f, 5.f));
840 target = targeter->FindTargetForEvent(root, &touch); 840 target = targeter->FindTargetForEvent(root, &touch);
841 EXPECT_NE(w.get(), target); 841 EXPECT_NE(w.get(), target);
842 842
843 // Hit test outside the left edge with a top-aligned shelf. 843 // Hit test outside the left edge with a top-aligned shelf.
844 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_TOP); 844 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_TOP);
845 bounds = w->bounds(); 845 bounds = gfx::RectF(w->bounds());
846 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 846 touch.set_location(bounds.origin() + gfx::Vector2dF(-1.f, 5.f));
847 target = targeter->FindTargetForEvent(root, &touch); 847 target = targeter->FindTargetForEvent(root, &touch);
848 EXPECT_EQ(w.get(), target); 848 EXPECT_EQ(w.get(), target);
849 849
850 // Hit test outside the top edge with a top-aligned shelf. 850 // Hit test outside the top edge with a top-aligned shelf.
851 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); 851 touch.set_location(bounds.origin() + gfx::Vector2dF(4.f, -6.f));
852 target = targeter->FindTargetForEvent(root, &touch); 852 target = targeter->FindTargetForEvent(root, &touch);
853 EXPECT_NE(w.get(), target); 853 EXPECT_NE(w.get(), target);
854 } 854 }
855 855
856 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, 856 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest,
857 testing::Bool()); 857 testing::Bool());
858 858
859 } // namespace ash 859 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698