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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 13466022: Don't move cursor location when rotation /ui scaling has changed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add explicit bootstrap flag as display_controller is no longer NULL during bootstrap Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 237a89ba790dd985f6bb655d377da41b5cf7078f..7ddb8a5a75185dbd2f8485947954fbe1674d70fe 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -748,5 +748,48 @@ TEST_F(DisplayManagerTest, UIScale) {
EXPECT_EQ(0.5f, GetDisplayInfoAt(0).ui_scale());
}
+
+#if defined(OS_WIN)
+// TODO(oshima): On Windows, we don't update the origin/size right away.
+#define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRotateZoom
+#else
+#define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom
+#endif
+
+TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) {
+ // Make sure just rotating will not change native location.
+ UpdateDisplay("300x200,200x150");
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ aura::Env* env = aura::Env::GetInstance();
+
+ // Test on 1st display.
+ root_windows[0]->MoveCursorTo(gfx::Point(150, 50));
+ EXPECT_EQ("150,50", env->last_mouse_location().ToString());
+ UpdateDisplay("300x200/r,200x150");
+ EXPECT_EQ("50,149", env->last_mouse_location().ToString());
+
+ // Test on 2nd display.
+ root_windows[1]->MoveCursorTo(gfx::Point(50, 100));
+ EXPECT_EQ("250,100", env->last_mouse_location().ToString());
+ UpdateDisplay("300x200/r,200x150/l");
+ EXPECT_EQ("249,50", env->last_mouse_location().ToString());
+
+ // Make sure just zooming will not change native location.
+ UpdateDisplay("600x400*2,400x300");
+
+ // Test on 1st display.
+ root_windows[0]->MoveCursorTo(gfx::Point(100, 150));
+ EXPECT_EQ("100,150", env->last_mouse_location().ToString());
+ UpdateDisplay("600x400*2@1.5,400x300");
+ EXPECT_EQ("150,225", env->last_mouse_location().ToString());
+
+ // Test on 2nd display.
+ UpdateDisplay("600x400,400x300*2");
+ root_windows[1]->MoveCursorTo(gfx::Point(100, 50));
+ EXPECT_EQ("700,50", env->last_mouse_location().ToString());
+ UpdateDisplay("600x400,400x300*2@1.5");
+ EXPECT_EQ("750,75", env->last_mouse_location().ToString());
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698