| 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/screen_position_controller.h" | 5 #include "ash/display/screen_position_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_util.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" |
| 11 #include "ash/test/shell_test_api.h" | 11 #include "ash/test/shell_test_api.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/test/test_window_delegate.h" | 14 #include "ui/aura/test/test_window_delegate.h" |
| 15 #include "ui/base/layout.h" | 15 #include "ui/base/layout.h" |
| 16 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // The point is on the 1st host. | 223 // The point is on the 1st host. |
| 224 EXPECT_EQ("70,149", ConvertHostPointToScreen(50, 70)); | 224 EXPECT_EQ("70,149", ConvertHostPointToScreen(50, 70)); |
| 225 // The point is out of the host windows. | 225 // The point is out of the host windows. |
| 226 EXPECT_EQ("250,-51", ConvertHostPointToScreen(250, 250)); | 226 EXPECT_EQ("250,-51", ConvertHostPointToScreen(250, 250)); |
| 227 // The point is on the 2nd host. Point on 2nd host (30,150) - | 227 // The point is on the 2nd host. Point on 2nd host (30,150) - |
| 228 // rotate 270 clockwise -> (149, 30) - layout [+(200,0)] -> (349,30). | 228 // rotate 270 clockwise -> (149, 30) - layout [+(200,0)] -> (349,30). |
| 229 EXPECT_EQ("349,30", ConvertHostPointToScreen(30, 450)); | 229 EXPECT_EQ("349,30", ConvertHostPointToScreen(30, 450)); |
| 230 | 230 |
| 231 // Move |window_| to the 2nd. | 231 // Move |window_| to the 2nd. |
| 232 window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), | 232 window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), |
| 233 ScreenAsh::GetSecondaryDisplay()); | 233 ScreenUtil::GetSecondaryDisplay()); |
| 234 aura::Window::Windows root_windows = | 234 aura::Window::Windows root_windows = |
| 235 Shell::GetInstance()->GetAllRootWindows(); | 235 Shell::GetInstance()->GetAllRootWindows(); |
| 236 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 236 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
| 237 | 237 |
| 238 // The point is on the 2nd host. (50,70) on 2n host - | 238 // The point is on the 2nd host. (50,70) on 2n host - |
| 239 // roatate 270 clockwise -> (129,50) -layout [+(200,0)] -> (329,50) | 239 // roatate 270 clockwise -> (129,50) -layout [+(200,0)] -> (329,50) |
| 240 EXPECT_EQ("329,50", ConvertHostPointToScreen(50, 70)); | 240 EXPECT_EQ("329,50", ConvertHostPointToScreen(50, 70)); |
| 241 // The point is out of the host windows. | 241 // The point is out of the host windows. |
| 242 EXPECT_EQ("449,50", ConvertHostPointToScreen(50, -50)); | 242 EXPECT_EQ("449,50", ConvertHostPointToScreen(50, -50)); |
| 243 // The point is on the 2nd host. Point on 2nd host (50,50) - | 243 // The point is on the 2nd host. Point on 2nd host (50,50) - |
| (...skipping 11 matching lines...) Expand all Loading... |
| 255 // The point is on the 1st host. | 255 // The point is on the 1st host. |
| 256 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, 60)); | 256 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, 60)); |
| 257 // The point is out of the host windows. | 257 // The point is out of the host windows. |
| 258 EXPECT_EQ("45,225", ConvertHostPointToScreen(60, 300)); | 258 EXPECT_EQ("45,225", ConvertHostPointToScreen(60, 300)); |
| 259 // The point is on the 2nd host. Point on 2nd host (60,150) - | 259 // The point is on the 2nd host. Point on 2nd host (60,150) - |
| 260 // - screen [+(150,0)] | 260 // - screen [+(150,0)] |
| 261 EXPECT_EQ("210,49", ConvertHostPointToScreen(60, 450)); | 261 EXPECT_EQ("210,49", ConvertHostPointToScreen(60, 450)); |
| 262 | 262 |
| 263 // Move |window_| to the 2nd. | 263 // Move |window_| to the 2nd. |
| 264 window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), | 264 window_->SetBoundsInScreen(gfx::Rect(300, 20, 50, 50), |
| 265 ScreenAsh::GetSecondaryDisplay()); | 265 ScreenUtil::GetSecondaryDisplay()); |
| 266 aura::Window::Windows root_windows = | 266 aura::Window::Windows root_windows = |
| 267 Shell::GetInstance()->GetAllRootWindows(); | 267 Shell::GetInstance()->GetAllRootWindows(); |
| 268 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); | 268 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); |
| 269 | 269 |
| 270 // The point is on the 2nd host. (50,70) - ro | 270 // The point is on the 2nd host. (50,70) - ro |
| 271 EXPECT_EQ("210,70", ConvertHostPointToScreen(60, 70)); | 271 EXPECT_EQ("210,70", ConvertHostPointToScreen(60, 70)); |
| 272 // The point is out of the host windows. | 272 // The point is out of the host windows. |
| 273 EXPECT_EQ("210,-50", ConvertHostPointToScreen(60, -50)); | 273 EXPECT_EQ("210,-50", ConvertHostPointToScreen(60, -50)); |
| 274 // The point is on the 2nd host. Point on 1nd host (60, 60) | 274 // The point is on the 2nd host. Point on 1nd host (60, 60) |
| 275 // 1/2 * 1.5 = (45,45) | 275 // 1/2 * 1.5 = (45,45) |
| 276 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, -340)); | 276 EXPECT_EQ("45,45", ConvertHostPointToScreen(60, -340)); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace test | 279 } // namespace test |
| 280 } // namespace ash | 280 } // namespace ash |
| OLD | NEW |