Chromium Code Reviews| 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/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | 897 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
| 898 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); | 898 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
| 899 ASSERT_TRUE(resizer.get()); | 899 ASSERT_TRUE(resizer.get()); |
| 900 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, | 900 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, |
| 901 // the window should move to the exact position. | 901 // the window should move to the exact position. |
| 902 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); | 902 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); |
| 903 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); | 903 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); |
| 904 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); | 904 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); |
| 905 } | 905 } |
| 906 | 906 |
| 907 // Verifies that a dragged window will restore to its pre-maximized size. | |
| 908 TEST_F(WorkspaceWindowResizerTest, RestoreToPreMaximizeCoordinates) { | |
|
sky
2012/09/07 02:43:30
Add coverage of the revert case
Mr4D (OOO till 08-26)
2012/09/08 01:17:41
Done.
| |
| 909 window_->SetBounds(gfx::Rect(0, 0, 1000, 1000)); | |
| 910 SetRestoreBoundsInScreen(window_.get(), gfx::Rect(96, 112, 320, 160)); | |
| 911 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( | |
| 912 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); | |
| 913 SetGridSize(1); | |
| 914 ASSERT_TRUE(resizer.get()); | |
| 915 // Drag the window to new poistion by adding (180, 12) to original point, | |
| 916 // the window should get restored and centered around cursor. | |
| 917 resizer->Drag(CalculateDragPoint(*resizer, 180, 12), 0); | |
| 918 resizer->CompleteDrag(0); | |
| 919 EXPECT_EQ("20,16 320x160", window_->bounds().ToString()); | |
| 920 // The restore rectangle should get cleared as well. | |
| 921 EXPECT_EQ(NULL, GetRestoreBoundsInScreen(window_.get())); | |
| 922 } | |
| 923 | |
| 907 } // namespace internal | 924 } // namespace internal |
| 908 } // namespace ash | 925 } // namespace ash |
| OLD | NEW |