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" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 float touch_radius_x_; | 101 float touch_radius_x_; |
102 float touch_radius_y_; | 102 float touch_radius_y_; |
103 float scroll_x_offset_; | 103 float scroll_x_offset_; |
104 float scroll_y_offset_; | 104 float scroll_y_offset_; |
105 float scroll_x_offset_ordinal_; | 105 float scroll_x_offset_ordinal_; |
106 float scroll_y_offset_ordinal_; | 106 float scroll_y_offset_ordinal_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); | 108 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); |
109 }; | 109 }; |
110 | 110 |
111 float GetStoredUIScale(int64 id) { | 111 float GetStoredUIScale(int64_t id) { |
112 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id). | 112 return Shell::GetInstance()->display_manager()->GetDisplayInfo(id). |
113 GetEffectiveUIScale(); | 113 GetEffectiveUIScale(); |
114 } | 114 } |
115 | 115 |
116 scoped_ptr<RootWindowTransformer> | 116 scoped_ptr<RootWindowTransformer> |
117 CreateCurrentRootWindowTransformerForMirroring() { | 117 CreateCurrentRootWindowTransformerForMirroring() { |
118 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 118 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
119 DCHECK(display_manager->IsInMirrorMode()); | 119 DCHECK(display_manager->IsInMirrorMode()); |
120 const DisplayInfo& mirror_display_info = | 120 const DisplayInfo& mirror_display_info = |
121 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); | 121 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); |
(...skipping 23 matching lines...) Expand all Loading... |
145 TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { | 145 TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { |
146 MagnificationController* magnifier = | 146 MagnificationController* magnifier = |
147 Shell::GetInstance()->magnification_controller(); | 147 Shell::GetInstance()->magnification_controller(); |
148 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 148 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
149 | 149 |
150 TestEventHandler event_handler; | 150 TestEventHandler event_handler; |
151 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 151 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
152 | 152 |
153 UpdateDisplay("120x200,300x400*2"); | 153 UpdateDisplay("120x200,300x400*2"); |
154 gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); | 154 gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); |
155 int64 display2_id = ScreenUtil::GetSecondaryDisplay().id(); | 155 int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id(); |
156 | 156 |
157 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 157 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
158 ui::test::EventGenerator generator1(root_windows[0]); | 158 ui::test::EventGenerator generator1(root_windows[0]); |
159 ui::test::EventGenerator generator2(root_windows[1]); | 159 ui::test::EventGenerator generator2(root_windows[1]); |
160 | 160 |
161 magnifier->SetEnabled(true); | 161 magnifier->SetEnabled(true); |
162 EXPECT_EQ(2.0f, magnifier->GetScale()); | 162 EXPECT_EQ(2.0f, magnifier->GetScale()); |
163 EXPECT_EQ("120x200", root_windows[0]->bounds().size().ToString()); | 163 EXPECT_EQ("120x200", root_windows[0]->bounds().size().ToString()); |
164 EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString()); | 164 EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString()); |
165 EXPECT_EQ("120,0 150x200", | 165 EXPECT_EQ("120,0 150x200", |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. | 412 // Y margin must be margin is (500 - 500/400 * 200) / 2 = 125. |
413 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); | 413 EXPECT_EQ("0,125,0,125", transformer->GetHostInsets().ToString()); |
414 | 414 |
415 UpdateDisplay("200x400,500x500"); | 415 UpdateDisplay("200x400,500x500"); |
416 // The aspect ratio is flipped, so X margin is now 125. | 416 // The aspect ratio is flipped, so X margin is now 125. |
417 transformer = CreateCurrentRootWindowTransformerForMirroring(); | 417 transformer = CreateCurrentRootWindowTransformerForMirroring(); |
418 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); | 418 EXPECT_EQ("125,0,125,0", transformer->GetHostInsets().ToString()); |
419 } | 419 } |
420 | 420 |
421 } // namespace ash | 421 } // namespace ash |
OLD | NEW |