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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
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/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 display_manager()->SetDisplayUIScale(display_id, 1.125f); 741 display_manager()->SetDisplayUIScale(display_id, 1.125f);
742 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).ui_scale()); 742 EXPECT_EQ(1.125f, GetDisplayInfoAt(0).ui_scale());
743 display_manager()->SetDisplayUIScale(display_id, 0.8f); 743 display_manager()->SetDisplayUIScale(display_id, 0.8f);
744 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).ui_scale()); 744 EXPECT_EQ(0.8f, GetDisplayInfoAt(0).ui_scale());
745 display_manager()->SetDisplayUIScale(display_id, 0.625f); 745 display_manager()->SetDisplayUIScale(display_id, 0.625f);
746 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale()); 746 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale());
747 display_manager()->SetDisplayUIScale(display_id, 0.5f); 747 display_manager()->SetDisplayUIScale(display_id, 0.5f);
748 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).ui_scale()); 748 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).ui_scale());
749 } 749 }
750 750
751 TEST_F(DisplayManagerTest, UpdateMouseCursorAfterRotateZoom) {
752 // Make sure just rotating will not change native location.
753 UpdateDisplay("300x200,200x150");
754 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
755 aura::Env* env = aura::Env::GetInstance();
756
757 // Test on 1st display.
758 root_windows[0]->MoveCursorTo(gfx::Point(150, 50));
759 EXPECT_EQ("150,50", env->last_mouse_location().ToString());
760 UpdateDisplay("300x200/r,200x150");
761 EXPECT_EQ("50,149", env->last_mouse_location().ToString());
762
763 // Test on 2nd display.
764 root_windows[1]->MoveCursorTo(gfx::Point(50, 100));
765 EXPECT_EQ("250,100", env->last_mouse_location().ToString());
766 UpdateDisplay("300x200/r,200x150/l");
767 EXPECT_EQ("249,50", env->last_mouse_location().ToString());
768
769 // Make sure just zooming will not change native location.
770 UpdateDisplay("600x400*2,400x300");
771
772 // Test on 1st display.
773 root_windows[0]->MoveCursorTo(gfx::Point(100, 150));
774 EXPECT_EQ("100,150", env->last_mouse_location().ToString());
775 UpdateDisplay("600x400*2@1.5,400x300");
776 EXPECT_EQ("150,225", env->last_mouse_location().ToString());
777
778 // Test on 2nd display.
779 UpdateDisplay("600x400,400x300*2");
780 root_windows[1]->MoveCursorTo(gfx::Point(100, 50));
781 EXPECT_EQ("700,50", env->last_mouse_location().ToString());
782 UpdateDisplay("600x400,400x300*2@1.5");
783 EXPECT_EQ("750,75", env->last_mouse_location().ToString());
784 }
785
751 } // namespace internal 786 } // namespace internal
752 } // namespace ash 787 } // namespace ash
OLDNEW
« ash/display/display_manager.cc ('K') | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698