Index: ash/display/display_controller_unittest.cc |
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc |
index 03428a922892e5cc9a2cedcdd53c6d339f0e81d5..8395abe77c05177373fcaf37b3fc19f103be154c 100644 |
--- a/ash/display/display_controller_unittest.cc |
+++ b/ash/display/display_controller_unittest.cc |
@@ -163,6 +163,35 @@ TEST_F(DisplayControllerTest, WarpMouse) { |
EXPECT_FALSE(is_warped); |
} |
+TEST_F(DisplayControllerTest, WarpMouseDifferentSizeDisplays) { |
sky
2012/08/09 16:24:05
Add a brief description to all of these as to what
Yusuke Sato
2012/08/09 18:13:31
Done.
|
+ UpdateDisplay("500x500,600x600"); // the second one is larger. |
+ |
+ ash::internal::DisplayController* controller = |
+ Shell::GetInstance()->display_controller(); |
+ EXPECT_EQ(internal::DisplayController::RIGHT, |
+ controller->secondary_display_layout()); |
+ |
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
+ aura::Env::GetInstance()->SetLastMouseLocation(*root_windows[1], |
+ gfx::Point(123, 123)); |
+ |
+ // Touch the left edge of the secondary root window. Pointer should NOT warp |
+ // because 1px left of (0, 500) is outside the primary root window. |
+ bool is_warped = controller->WarpMouseCursorIfNecessary(root_windows[1], |
+ gfx::Point(0, 500)); |
+ EXPECT_FALSE(is_warped); |
+ EXPECT_EQ("623,123", // by 2px. |
+ aura::Env::GetInstance()->last_mouse_location().ToString()); |
+ |
+ // Touch the left edge of the secondary root window. Pointer should warp |
+ // because 1px left of (0, 499) is inside the primary root window. |
+ is_warped = controller->WarpMouseCursorIfNecessary(root_windows[1], |
+ gfx::Point(0, 499)); |
+ EXPECT_TRUE(is_warped); |
+ EXPECT_EQ("498,499", // by 2px. |
+ aura::Env::GetInstance()->last_mouse_location().ToString()); |
+} |
+ |
TEST_F(DisplayControllerTest, SetUnsetDontWarpMousedFlag) { |
UpdateDisplay("500x500,500x500"); |