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

Unified Diff: ash/wm/dock/docked_window_resizer_unittest.cc

Issue 141053002: Avoids updating dock alignment when drag is cancelled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoids updating dock alignment when drag is cancelled (test) Created 6 years, 11 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
Index: ash/wm/dock/docked_window_resizer_unittest.cc
diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc
index 529efad2bb1c5893cdeb4325f89035bfbdf86ff3..2a847a18e909bc211d3e82c8db1bc7706ed2b54e 100644
--- a/ash/wm/dock/docked_window_resizer_unittest.cc
+++ b/ash/wm/dock/docked_window_resizer_unittest.cc
@@ -624,6 +624,11 @@ TEST_P(DockedWindowResizerTest, RevertDockedDragRevertsAttachment) {
if (!SupportsHostWindowResize())
return;
scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
+ aura::Window* dock_container = Shell::GetContainer(
+ window->GetRootWindow(),
+ kShellWindowId_DockedContainer);
+ DockedWindowLayoutManager* manager =
+ static_cast<DockedWindowLayoutManager*>(dock_container->layout_manager());
int previous_container_id = window->parent()->id();
// Drag the window out but revert the drag
ASSERT_NO_FATAL_FAILURE(DragStart(window.get()));
@@ -631,6 +636,30 @@ TEST_P(DockedWindowResizerTest, RevertDockedDragRevertsAttachment) {
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
DragRevert();
EXPECT_EQ(previous_container_id, window->parent()->id());
+ EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager));
+
+ // Drag a window to the left so that it overlaps the screen edge.
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromWindowOrigin(
+ window.get(),
+ window->bounds().width()/2 + 10,
+ 0));
+ DragMove(-50 - window->bounds().x(), 50 - window->bounds().y());
+ DragEnd();
+ // The window now overlaps the left screen edge but is not docked.
+ EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
+ EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager));
pkotwicz 2014/01/16 21:43:27 Nit: It may be useful to test that the window is a
varkha 2014/01/16 23:34:14 Done.
+
+ // Drag the window further left and revert the drag.
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromWindowOrigin(
+ window.get(),
+ window->bounds().width()/2 + 10,
+ 0));
+ DragMove(-10, 10);
+ DragRevert();
+ // The window should be in default container and not docked.
+ EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
+ // Docked area alignment should be cleared.
+ EXPECT_EQ(DOCKED_ALIGNMENT_NONE, docked_alignment(manager));
}
// Move a docked window to the second display
« ash/wm/dock/docked_window_layout_manager.cc ('K') | « ash/wm/dock/docked_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698