Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Unified Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 10918077: Adding proper dragging behavior for L/R maximized windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It looks like if git merged wrong here... Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ba15148be98b73b5c7284fb0641c1ed1ea7233b1..b7eb06f8aa8ae27bc9ce4bc6c594f3ef5e476171 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -458,7 +458,6 @@ TEST_F(WorkspaceWindowResizerTest, Edge) {
EXPECT_EQ("20,30 50x60",
GetRestoreBoundsInScreen(window_.get())->ToString());
}
-
// Try the same with the right side.
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
@@ -869,5 +868,37 @@ TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
EXPECT_EQ("0,0 640x552", rect.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()));
+ ASSERT_TRUE(resizer.get());
+ // Drag the window to new position by adding (10, 10) to original point,
+ // the window should get restored.
+ resizer->Drag(CalculateDragPoint(*resizer, 10, 10), 0);
+ resizer->CompleteDrag(0);
+ EXPECT_EQ("10,10 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()));
+ 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
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698