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

Unified Diff: ui/aura_shell/workspace/workspace_manager_unittest.cc

Issue 8391035: Drag and rotate windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 2 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: ui/aura_shell/workspace/workspace_manager_unittest.cc
diff --git a/ui/aura_shell/workspace/workspace_manager_unittest.cc b/ui/aura_shell/workspace/workspace_manager_unittest.cc
index 2f2214a02b3831024d92c89f16fffc03a9adc24d..9e19658f9991b49be9172127c974949af3217696 100644
--- a/ui/aura_shell/workspace/workspace_manager_unittest.cc
+++ b/ui/aura_shell/workspace/workspace_manager_unittest.cc
@@ -161,6 +161,49 @@ TEST_F(WorkspaceManagerTest, WorkspaceManagerActivate) {
EXPECT_EQ(NULL, manager.GetActiveWorkspace());
}
+TEST_F(WorkspaceManagerTest, FindSwapWindow) {
+ WorkspaceManager manager(viewport());
+ manager.workspace_size_ = gfx::Size(500, 300);
+
+ Workspace* ws1 = manager.CreateWorkspace();
+ scoped_ptr<Window> w11(CreateTestWindow());
+ w11->SetBounds(gfx::Rect(0, 0, 100, 100));
+ ws1->AddWindowAfter(w11.get(), NULL);
+
+ scoped_ptr<Window> w12(CreateTestWindow());
+ w12->SetBounds(gfx::Rect(0, 0, 100, 100));
+ ws1->AddWindowAfter(w12.get(), NULL);
+ manager.LayoutWorkspaces();
+
+ // Workspaces are 0-empt-145-w11-245-margin-265-365-500.
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(0, 0)));
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(100, 0)));
+ EXPECT_EQ(w11.get(), manager.FindSwapWindowForLocation(gfx::Point(150, 0)));
+ EXPECT_EQ(w12.get(), manager.FindSwapWindowForLocation(gfx::Point(300, 0)));
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(400, 0)));
+
+ w11->SetBounds(gfx::Rect(0, 0, 400, 100));
+ w12->SetBounds(gfx::Rect(0, 0, 200, 100));
+ manager.LayoutWorkspaces();
+ EXPECT_EQ(w11.get(), manager.FindSwapWindowForLocation(gfx::Point(10, 0)));
+ EXPECT_EQ(w11.get(), manager.FindSwapWindowForLocation(gfx::Point(240, 0)));
+ EXPECT_EQ(w12.get(), manager.FindSwapWindowForLocation(gfx::Point(260, 0)));
+ EXPECT_EQ(w12.get(), manager.FindSwapWindowForLocation(gfx::Point(490, 0)));
+
+ Workspace* ws2 = manager.CreateWorkspace();
+ scoped_ptr<Window> w21(CreateTestWindow());
+ w21->SetBounds(gfx::Rect(0, 0, 100, 100));
+ ws2->AddWindowAfter(w21.get(), NULL);
+ manager.LayoutWorkspaces();
+
+ // 2nd workspace starts from 500+50 and the window is centered 750-850.
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(600, 0)));
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(740, 0)));
+ EXPECT_EQ(w21.get(), manager.FindSwapWindowForLocation(gfx::Point(760, 0)));
+ EXPECT_EQ(w21.get(), manager.FindSwapWindowForLocation(gfx::Point(840, 0)));
+ EXPECT_EQ(NULL, manager.FindSwapWindowForLocation(gfx::Point(860, 0)));
+}
+
class WorkspaceTest : public WorkspaceManagerTestBase {
};
@@ -209,4 +252,7 @@ TEST_F(WorkspaceTest, WorkspaceBasic) {
EXPECT_EQ(1, ws->GetIndexOf(w1.get()));
}
+TEST_F(WorkspaceManagerTest, SwapWindow) {
+}
+
} // namespace aura_shell
« ui/aura_shell/workspace/workspace.cc ('K') | « ui/aura_shell/workspace/workspace_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698