Index: ash/wm/dock/docked_window_layout_manager_unittest.cc |
diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc |
index b2f6ffd9cf4ef48cb3db3e8eb4a89a65555c3d14..22be593eb4aaa90e5451ba37bad31dd7a8911a52 100644 |
--- a/ash/wm/dock/docked_window_layout_manager_unittest.cc |
+++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc |
@@ -97,11 +97,7 @@ class DockedWindowLayoutManagerTest |
} |
void DragStart(aura::Window* window) { |
- initial_location_in_parent_ = window->bounds().origin(); |
- resizer_.reset(CreateSomeWindowResizer(window, |
- initial_location_in_parent_, |
- HTCAPTION)); |
- ASSERT_TRUE(resizer_.get()); |
+ DragStartAtOffsetFromwindowOrigin(window, 0, 0); |
} |
void DragStartAtOffsetFromwindowOrigin(aura::Window* window, |
@@ -175,7 +171,7 @@ class DockedWindowLayoutManagerTest |
gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) { |
- ASSERT_NO_FATAL_FAILURE(DragStart(window)); |
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
// Drag enough to detach since our tests assume panels to be initially |
@@ -197,11 +193,13 @@ class DockedWindowLayoutManagerTest |
// avoid snap by clicking away from the border |
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
+ gfx::Rect work_area = |
+ Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
// Drag the window left or right to the edge (or almost to it). |
if (edge == DOCKED_EDGE_LEFT) |
- dx += window->GetRootWindow()->bounds().x() - initial_bounds.x(); |
+ dx += work_area.x() - initial_location_in_parent_.x(); |
else if (edge == DOCKED_EDGE_RIGHT) |
- dx += window->GetRootWindow()->bounds().right() - initial_bounds.right(); |
+ dx += work_area.right() - 1 - initial_location_in_parent_.x(); |
DragMove(dx, window_type_ == aura::client::WINDOW_TYPE_PANEL ? 0 : dy); |
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); |
// Release the mouse and the panel should be attached to the dock. |
@@ -209,8 +207,10 @@ class DockedWindowLayoutManagerTest |
// x-coordinate can get adjusted by snapping or sticking. |
// y-coordinate could be changed by possible automatic layout if docked. |
- if (window->parent()->id() != internal::kShellWindowId_DockedContainer) |
+ if (window->parent()->id() != internal::kShellWindowId_DockedContainer && |
+ GetRestoreBoundsInScreen(window) == NULL) { |
EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y()); |
+ } |
} |
private: |
@@ -286,10 +286,14 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsDragging) { |
w2->GetBoundsInScreen().right()); |
EXPECT_EQ(internal::kShellWindowId_DockedContainer, w2->parent()->id()); |
+ LOG(INFO) << "w1 at " << w1->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w2 at " << w2->GetBoundsInScreen().ToString(); |
// Drag w2 above w1. |
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w2.get(), 0, 20)); |
- DragMove(0, w1->bounds().y() - w2->bounds().y() - 20); |
+ DragMove(0, w1->bounds().y() - w2->bounds().y() + 20); |
DragEnd(); |
+ LOG(INFO) << "w1 at " << w1->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w2 at " << w2->GetBoundsInScreen().ToString(); |
// Test the new windows order and that the gaps differ at most by a pixel. |
int gap1 = w2->GetBoundsInScreen().y(); |
@@ -312,6 +316,9 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDragging) { |
DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 200); |
scoped_ptr<aura::Window> w3(CreateTestWindow(gfx::Rect(0, 0, 220, 204))); |
DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w3.get(), 300); |
+ LOG(INFO) << "w1 at " << w1->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w2 at " << w2->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w3 at " << w3->GetBoundsInScreen().ToString(); |
// All windows should be attached and snapped to the right side of the screen. |
EXPECT_EQ(w1->GetRootWindow()->bounds().right(), |
@@ -381,6 +388,9 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) { |
DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 600 + 200); |
scoped_ptr<aura::Window> w3(CreateTestWindow(gfx::Rect(0, 600, 220, 204))); |
DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w3.get(), 600 + 300); |
+ LOG(INFO) << "w1 at " << w1->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w2 at " << w2->GetBoundsInScreen().ToString(); |
+ LOG(INFO) << "w3 at " << w3->GetBoundsInScreen().ToString(); |
// All windows should be attached and snapped to the right side of the screen. |
EXPECT_EQ(w1->GetRootWindow()->bounds().right(), |