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/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 typedef test::AshTestBase WindowUtilTest; | 13 typedef test::AshTestBase WindowUtilTest; |
14 | 14 |
15 TEST_F(WindowUtilTest, CenterWindow) { | 15 TEST_F(WindowUtilTest, CenterWindow) { |
| 16 if (!SupportsMultipleDisplays()) |
| 17 return; |
| 18 |
16 UpdateDisplay("500x400, 600x400"); | 19 UpdateDisplay("500x400, 600x400"); |
17 scoped_ptr<aura::Window> window( | 20 scoped_ptr<aura::Window> window( |
18 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); | 21 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); |
19 wm::CenterWindow(window.get()); | 22 wm::CenterWindow(window.get()); |
20 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); | 23 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); |
21 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); | 24 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); |
22 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), | 25 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), |
23 ScreenAsh::GetSecondaryDisplay()); | 26 ScreenAsh::GetSecondaryDisplay()); |
24 wm::CenterWindow(window.get()); | 27 wm::CenterWindow(window.get()); |
25 EXPECT_EQ("250,126 100x100", window->bounds().ToString()); | 28 EXPECT_EQ("250,126 100x100", window->bounds().ToString()); |
26 EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); | 29 EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); |
27 } | 30 } |
28 | 31 |
29 } // namespace ash | 32 } // namespace ash |
OLD | NEW |