| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_types.h" | 7 #include "ash/common/accessibility_types.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // contained in the view port and the caret is at the center of the view port. | 666 // contained in the view port and the caret is at the center of the view port. |
| 667 gfx::Rect new_view_port = GetViewport(); | 667 gfx::Rect new_view_port = GetViewport(); |
| 668 EXPECT_NE(view_port, new_view_port); | 668 EXPECT_NE(view_port, new_view_port); |
| 669 EXPECT_TRUE(new_view_port.Contains(text_input_bounds)); | 669 EXPECT_TRUE(new_view_port.Contains(text_input_bounds)); |
| 670 gfx::Rect caret_bounds = GetCaretBounds(); | 670 gfx::Rect caret_bounds = GetCaretBounds(); |
| 671 EXPECT_EQ(caret_bounds.CenterPoint(), new_view_port.CenterPoint()); | 671 EXPECT_EQ(caret_bounds.CenterPoint(), new_view_port.CenterPoint()); |
| 672 } | 672 } |
| 673 | 673 |
| 674 // Make sure that unified desktop can enter magnified mode. | 674 // Make sure that unified desktop can enter magnified mode. |
| 675 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { | 675 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { |
| 676 if (!SupportsMultipleDisplays()) | |
| 677 return; | |
| 678 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); | 676 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); |
| 679 | 677 |
| 680 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 678 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 681 | 679 |
| 682 GetMagnificationController()->SetEnabled(true); | 680 GetMagnificationController()->SetEnabled(true); |
| 683 | 681 |
| 684 display::Screen* screen = display::Screen::GetScreen(); | 682 display::Screen* screen = display::Screen::GetScreen(); |
| 685 | 683 |
| 686 UpdateDisplay("500x500, 500x500"); | 684 UpdateDisplay("500x500, 500x500"); |
| 687 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); | 685 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 688 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 686 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 689 | 687 |
| 690 GetMagnificationController()->SetEnabled(false); | 688 GetMagnificationController()->SetEnabled(false); |
| 691 | 689 |
| 692 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 690 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 693 | 691 |
| 694 GetMagnificationController()->SetEnabled(true); | 692 GetMagnificationController()->SetEnabled(true); |
| 695 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 693 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 696 | 694 |
| 697 UpdateDisplay("500x500"); | 695 UpdateDisplay("500x500"); |
| 698 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 696 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 699 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 697 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 700 | 698 |
| 701 GetMagnificationController()->SetEnabled(false); | 699 GetMagnificationController()->SetEnabled(false); |
| 702 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 700 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 703 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 701 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 704 } | 702 } |
| 705 | 703 |
| 706 } // namespace ash | 704 } // namespace ash |
| OLD | NEW |