| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/display/root_window_transformers.h" | 5 #include "ash/display/root_window_transformers.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 EXPECT_EQ(display::Display::ROTATE_180, | 248 EXPECT_EQ(display::Display::ROTATE_180, |
| 249 GetActiveDisplayRotation(display1.id())); | 249 GetActiveDisplayRotation(display1.id())); |
| 250 EXPECT_EQ(display::Display::ROTATE_270, | 250 EXPECT_EQ(display::Display::ROTATE_270, |
| 251 GetActiveDisplayRotation(display2_id)); | 251 GetActiveDisplayRotation(display2_id)); |
| 252 magnifier->SetEnabled(false); | 252 magnifier->SetEnabled(false); |
| 253 | 253 |
| 254 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 254 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(RootWindowTransformersTest, ScaleAndMagnify) { | 257 TEST_F(RootWindowTransformersTest, ScaleAndMagnify) { |
| 258 if (!SupportsMultipleDisplays()) | |
| 259 return; | |
| 260 | |
| 261 TestEventHandler event_handler; | 258 TestEventHandler event_handler; |
| 262 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 259 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
| 263 | 260 |
| 264 UpdateDisplay("600x400*2@1.5,500x300"); | 261 UpdateDisplay("600x400*2@1.5,500x300"); |
| 265 | 262 |
| 266 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 263 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 267 display::test::ScopedSetInternalDisplayId set_internal(display_manager(), | 264 display::test::ScopedSetInternalDisplayId set_internal(display_manager(), |
| 268 display1.id()); | 265 display1.id()); |
| 269 display::Display display2 = display_manager()->GetSecondaryDisplay(); | 266 display::Display display2 = display_manager()->GetSecondaryDisplay(); |
| 270 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 267 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 generator.MoveMouseToInHost(0, 0); | 413 generator.MoveMouseToInHost(0, 0); |
| 417 EXPECT_EQ("159,99", event_handler.GetLocationAndReset()); | 414 EXPECT_EQ("159,99", event_handler.GetLocationAndReset()); |
| 418 | 415 |
| 419 magnifier->SetEnabled(false); | 416 magnifier->SetEnabled(false); |
| 420 EXPECT_FLOAT_EQ(1.0f, magnifier->GetScale()); | 417 EXPECT_FLOAT_EQ(1.0f, magnifier->GetScale()); |
| 421 | 418 |
| 422 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 419 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 423 } | 420 } |
| 424 | 421 |
| 425 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) { | 422 TEST_F(RootWindowTransformersTest, LetterBoxPillarBox) { |
| 426 if (!SupportsMultipleDisplays()) | |
| 427 return; | |
| 428 test::MirrorWindowTestApi test_api; | 423 test::MirrorWindowTestApi test_api; |
| 429 display_manager()->SetMultiDisplayMode(display::DisplayManager::MIRRORING); | 424 display_manager()->SetMultiDisplayMode(display::DisplayManager::MIRRORING); |
| 430 UpdateDisplay("400x200,500x500"); | 425 UpdateDisplay("400x200,500x500"); |
| 431 std::unique_ptr<RootWindowTransformer> transformer( | 426 std::unique_ptr<RootWindowTransformer> transformer( |
| 432 CreateCurrentRootWindowTransformerForMirroring()); | 427 CreateCurrentRootWindowTransformerForMirroring()); |
| 433 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 428 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
| 434 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 429 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
| 435 | 430 |
| 436 UpdateDisplay("200x400,500x500"); | 431 UpdateDisplay("200x400,500x500"); |
| 437 // The aspect ratio is flipped, so X margin is now 125. | 432 // The aspect ratio is flipped, so X margin is now 125. |
| 438 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 433 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
| 439 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 434 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
| 440 } | 435 } |
| 441 | 436 |
| 442 } // namespace ash | 437 } // namespace ash |
| OLD | NEW |