OLD | NEW |
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 Loading... |
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 |
| 752 #if defined(OS_WIN) |
| 753 // TODO(oshima): On Windows, we don't update the origin/size right away. |
| 754 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo
tateZoom |
| 755 #else |
| 756 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom |
| 757 #endif |
| 758 |
| 759 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { |
| 760 // Make sure just rotating will not change native location. |
| 761 UpdateDisplay("300x200,200x150"); |
| 762 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 763 aura::Env* env = aura::Env::GetInstance(); |
| 764 |
| 765 // Test on 1st display. |
| 766 root_windows[0]->MoveCursorTo(gfx::Point(150, 50)); |
| 767 EXPECT_EQ("150,50", env->last_mouse_location().ToString()); |
| 768 UpdateDisplay("300x200/r,200x150"); |
| 769 EXPECT_EQ("50,149", env->last_mouse_location().ToString()); |
| 770 |
| 771 // Test on 2nd display. |
| 772 root_windows[1]->MoveCursorTo(gfx::Point(50, 100)); |
| 773 EXPECT_EQ("250,100", env->last_mouse_location().ToString()); |
| 774 UpdateDisplay("300x200/r,200x150/l"); |
| 775 EXPECT_EQ("249,50", env->last_mouse_location().ToString()); |
| 776 |
| 777 // Make sure just zooming will not change native location. |
| 778 UpdateDisplay("600x400*2,400x300"); |
| 779 |
| 780 // Test on 1st display. |
| 781 root_windows[0]->MoveCursorTo(gfx::Point(100, 150)); |
| 782 EXPECT_EQ("100,150", env->last_mouse_location().ToString()); |
| 783 UpdateDisplay("600x400*2@1.5,400x300"); |
| 784 EXPECT_EQ("150,225", env->last_mouse_location().ToString()); |
| 785 |
| 786 // Test on 2nd display. |
| 787 UpdateDisplay("600x400,400x300*2"); |
| 788 root_windows[1]->MoveCursorTo(gfx::Point(100, 50)); |
| 789 EXPECT_EQ("700,50", env->last_mouse_location().ToString()); |
| 790 UpdateDisplay("600x400,400x300*2@1.5"); |
| 791 EXPECT_EQ("750,75", env->last_mouse_location().ToString()); |
| 792 } |
| 793 |
751 } // namespace internal | 794 } // namespace internal |
752 } // namespace ash | 795 } // namespace ash |
OLD | NEW |