diff options
author | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 20:32:04 +0000 |
---|---|---|
committer | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 20:32:04 +0000 |
commit | 62a379a9ecd3d803d43303f9cf8f6c850c21d7de (patch) | |
tree | a80415e8d1fd3225e2c5d6dc69ed488a83007a9a /ash/display | |
parent | 61a875bcef849b0e6e6187932ca85adc6c444f53 (diff) | |
download | chromium_src-62a379a9ecd3d803d43303f9cf8f6c850c21d7de.zip chromium_src-62a379a9ecd3d803d43303f9cf8f6c850c21d7de.tar.gz chromium_src-62a379a9ecd3d803d43303f9cf8f6c850c21d7de.tar.bz2 |
Add more test to DisplayControllerTest.
BUG=None
TEST=the new test passed on try
Review URL: https://chromiumcodereview.appspot.com/10855068
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r-- | ash/display/display_controller_unittest.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 03428a9..c6dee63 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -107,6 +107,8 @@ TEST_F(DisplayControllerTest, MAYBE_BoundsUpdated) { EXPECT_EQ("0,700 1000x1000", GetSecondaryDisplay().bounds().ToString()); } +// Verifies if the mouse pointer correctly moves to another display when there +// are two displays. TEST_F(DisplayControllerTest, WarpMouse) { UpdateDisplay("500x500,500x500"); @@ -163,6 +165,38 @@ TEST_F(DisplayControllerTest, WarpMouse) { EXPECT_FALSE(is_warped); } +// Verifies if the mouse pointer correctly moves to another display even when +// two displays are not the same size. +TEST_F(DisplayControllerTest, WarpMouseDifferentSizeDisplays) { + 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()); +} + +// Verifies if DisplayController::dont_warp_mouse() works as expected. TEST_F(DisplayControllerTest, SetUnsetDontWarpMousedFlag) { UpdateDisplay("500x500,500x500"); |