Index: ash/wm/workspace/workspace_window_resizer_unittest.cc |
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc |
index c831d12e11bbb38e4e9a8d5f75a4d2f5cf4098e0..91c7584e8b3f5f5527a9b6b06ca2ed762ecf5b54 100644 |
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc |
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc |
@@ -471,8 +471,7 @@ TEST_F(WorkspaceWindowResizerTest, Edge) { |
EXPECT_EQ("20,30 50x60", |
GetRestoreBoundsInScreen(window_.get())->ToString()); |
} |
- |
- // Try the same with the right side. |
+ // Being left maximized tTry the same with the right side. |
SetGridSize(0); |
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
@@ -904,5 +903,39 @@ TEST_F(WorkspaceWindowResizerTest, CtrlCompleteDragMoveToExactPosition) { |
EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); |
} |
+// Verifies that a dragged window will restore to its pre-maximized size. |
+TEST_F(WorkspaceWindowResizerTest, RestoreToPreMaximizeCoordinates) { |
+ window_->SetBounds(gfx::Rect(0, 0, 1000, 1000)); |
+ SetRestoreBoundsInScreen(window_.get(), gfx::Rect(96, 112, 320, 160)); |
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
+ window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
+ SetGridSize(1); |
sky
2012/09/10 17:10:48
I'm removing the grid @ http://codereview.chromium
|
+ ASSERT_TRUE(resizer.get()); |
+ // Drag the window to new poistion by adding (180, 16) to original point, |
+ // the window should get restored. |
+ resizer->Drag(CalculateDragPoint(*resizer, 180, 16), 0); |
+ resizer->CompleteDrag(0); |
+ EXPECT_EQ("180,16 320x160", window_->bounds().ToString()); |
+ // The restore rectangle should get cleared as well. |
+ EXPECT_EQ(NULL, GetRestoreBoundsInScreen(window_.get())); |
+} |
+ |
+// Verifies that a dragged window will restore to its pre-maximized size. |
+TEST_F(WorkspaceWindowResizerTest, RevertResizeOperation) { |
+ window_->SetBounds(gfx::Rect(0, 0, 1000, 1000)); |
+ SetRestoreBoundsInScreen(window_.get(), gfx::Rect(96, 112, 320, 160)); |
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( |
+ window_.get(), gfx::Point(), HTCAPTION, empty_windows())); |
+ SetGridSize(1); |
+ ASSERT_TRUE(resizer.get()); |
+ // Drag the window to new poistion by adding (180, 16) to original point, |
+ // the window should get restored. |
+ resizer->Drag(CalculateDragPoint(*resizer, 180, 16), 0); |
+ resizer->RevertDrag(); |
+ EXPECT_EQ("0,0 1000x1000", window_->bounds().ToString()); |
+ EXPECT_EQ("96,112 320x160", |
+ GetRestoreBoundsInScreen(window_.get())->ToString()); |
+} |
+ |
} // namespace internal |
} // namespace ash |