| 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_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 } | 22 } |
| 23 | 23 |
| 24 typedef test::AshTestBase WindowUtilTest; | 24 typedef test::AshTestBase WindowUtilTest; |
| 25 | 25 |
| 26 TEST_F(WindowUtilTest, CenterWindow) { | 26 TEST_F(WindowUtilTest, CenterWindow) { |
| 27 if (!SupportsMultipleDisplays()) | 27 if (!SupportsMultipleDisplays()) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 UpdateDisplay("500x400, 600x400"); | 30 UpdateDisplay("500x400, 600x400"); |
| 31 scoped_ptr<aura::Window> window( | 31 std::unique_ptr<aura::Window> window( |
| 32 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); | 32 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); |
| 33 | 33 |
| 34 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 34 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 35 EXPECT_FALSE(window_state->bounds_changed_by_user()); | 35 EXPECT_FALSE(window_state->bounds_changed_by_user()); |
| 36 | 36 |
| 37 wm::CenterWindow(window.get()); | 37 wm::CenterWindow(window.get()); |
| 38 // Centring window is considered as a user's action. | 38 // Centring window is considered as a user's action. |
| 39 EXPECT_TRUE(window_state->bounds_changed_by_user()); | 39 EXPECT_TRUE(window_state->bounds_changed_by_user()); |
| 40 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); | 40 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); |
| 41 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); | 41 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 "-250,-40 100x100", | 87 "-250,-40 100x100", |
| 88 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150))); | 88 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150))); |
| 89 EXPECT_EQ( | 89 EXPECT_EQ( |
| 90 "-275,-50 100x100", | 90 "-275,-50 100x100", |
| 91 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150))); | 91 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150))); |
| 92 EXPECT_EQ("-125,0 100x100", | 92 EXPECT_EQ("-125,0 100x100", |
| 93 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150))); | 93 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150))); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace ash | 96 } // namespace ash |
| OLD | NEW |