| 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 "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/display_util.h" | 9 #include "ash/display/display_util.h" |
| 10 #include "ash/host/root_window_transformer.h" | 10 #include "ash/host/root_window_transformer.h" |
| 11 #include "ash/magnifier/magnification_controller.h" | 11 #include "ash/magnifier/magnification_controller.h" |
| 12 #include "ash/screen_util.h" | 12 #include "ash/screen_util.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 17 #include "ash/test/cursor_manager_test_api.h" | 17 #include "ash/test/cursor_manager_test_api.h" |
| 18 #include "ash/test/display_manager_test_api.h" | 18 #include "ash/test/display_manager_test_api.h" |
| 19 #include "ash/test/mirror_window_test_api.h" | 19 #include "ash/test/mirror_window_test_api.h" |
| 20 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
| 21 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 23 #include "ui/aura/window_tracker.h" | 23 #include "ui/aura/window_tracker.h" |
| 24 #include "ui/display/manager/display_layout.h" |
| 24 #include "ui/events/event_handler.h" | 25 #include "ui/events/event_handler.h" |
| 25 #include "ui/events/test/event_generator.h" | 26 #include "ui/events/test/event_generator.h" |
| 26 #include "ui/gfx/display.h" | 27 #include "ui/gfx/display.h" |
| 27 #include "ui/gfx/geometry/rect_conversions.h" | 28 #include "ui/gfx/geometry/rect_conversions.h" |
| 28 #include "ui/gfx/screen.h" | 29 #include "ui/gfx/screen.h" |
| 29 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
| 30 | 31 |
| 31 namespace ash { | 32 namespace ash { |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); | 187 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); |
| 187 generator1.MoveMouseToInHost(39, 120); | 188 generator1.MoveMouseToInHost(39, 120); |
| 188 EXPECT_EQ("110,70", event_handler.GetLocationAndReset()); | 189 EXPECT_EQ("110,70", event_handler.GetLocationAndReset()); |
| 189 EXPECT_EQ("110,70", | 190 EXPECT_EQ("110,70", |
| 190 aura::Env::GetInstance()->last_mouse_location().ToString()); | 191 aura::Env::GetInstance()->last_mouse_location().ToString()); |
| 191 EXPECT_EQ(gfx::Display::ROTATE_90, GetActiveDisplayRotation(display1.id())); | 192 EXPECT_EQ(gfx::Display::ROTATE_90, GetActiveDisplayRotation(display1.id())); |
| 192 EXPECT_EQ(gfx::Display::ROTATE_0, GetActiveDisplayRotation(display2_id)); | 193 EXPECT_EQ(gfx::Display::ROTATE_0, GetActiveDisplayRotation(display2_id)); |
| 193 magnifier->SetEnabled(false); | 194 magnifier->SetEnabled(false); |
| 194 | 195 |
| 195 display_manager->SetLayoutForCurrentDisplays( | 196 display_manager->SetLayoutForCurrentDisplays( |
| 196 test::CreateDisplayLayout(DisplayPlacement::BOTTOM, 50)); | 197 test::CreateDisplayLayout(display::DisplayPlacement::BOTTOM, 50)); |
| 197 EXPECT_EQ("50,120 150x200", | 198 EXPECT_EQ("50,120 150x200", |
| 198 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); | 199 ScreenUtil::GetSecondaryDisplay().bounds().ToString()); |
| 199 | 200 |
| 200 display_manager->SetDisplayRotation(display2_id, gfx::Display::ROTATE_270, | 201 display_manager->SetDisplayRotation(display2_id, gfx::Display::ROTATE_270, |
| 201 gfx::Display::ROTATION_SOURCE_ACTIVE); | 202 gfx::Display::ROTATION_SOURCE_ACTIVE); |
| 202 // Move the cursor to the center of the second root window. | 203 // Move the cursor to the center of the second root window. |
| 203 generator2.MoveMouseToInHost(151, 199); | 204 generator2.MoveMouseToInHost(151, 199); |
| 204 | 205 |
| 205 magnifier->SetEnabled(true); | 206 magnifier->SetEnabled(true); |
| 206 EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); | 207 EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 414 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
| 414 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 415 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
| 415 | 416 |
| 416 UpdateDisplay("200x400,500x500"); | 417 UpdateDisplay("200x400,500x500"); |
| 417 // The aspect ratio is flipped, so X margin is now 125. | 418 // The aspect ratio is flipped, so X margin is now 125. |
| 418 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 419 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
| 419 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 420 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
| 420 } | 421 } |
| 421 | 422 |
| 422 } // namespace ash | 423 } // namespace ash |
| OLD | NEW |