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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 10836065: Improve WorkspaceWindowResizer::CompleteDrag() so that the function moves the window to a root windo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/display/screen_position_controller.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/multi_display_manager.h" 6 #include "ash/display/multi_display_manager.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/coordinate_conversion.h" 9 #include "ash/wm/coordinate_conversion.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); 394 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow());
395 EXPECT_EQ("1560,30 100x100", 395 EXPECT_EQ("1560,30 100x100",
396 d1->GetWindowBoundsInScreen().ToString()); 396 d1->GetWindowBoundsInScreen().ToString());
397 397
398 // Setting outside of root windows will be moved to primary root window. 398 // Setting outside of root windows will be moved to primary root window.
399 // TODO(oshima): This one probably should pick the closest root window. 399 // TODO(oshima): This one probably should pick the closest root window.
400 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); 400 d1->SetBounds(gfx::Rect(200, 10, 100, 100));
401 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); 401 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
402 } 402 }
403 403
404 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) {
405 UpdateDisplay("1000x1000,1000x1000");
406 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
407
408 gfx::Display display0 =
409 gfx::Screen::GetDisplayMatching(root_windows[0]->GetBoundsInScreen());
410 gfx::Display display1 =
411 gfx::Screen::GetDisplayMatching(root_windows[1]->GetBoundsInScreen());
412 EXPECT_NE(display0.id(), display1.id());
413
414 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100));
415 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
416
417 // Move the window where the window spans both root windows. Since the second
418 // parameter is |display1|, the window should be shown on the secondary root.
419 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100),
420 display1);
421 EXPECT_EQ("500,10 1000x100",
422 d1->GetWindowBoundsInScreen().ToString());
423 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow());
424
425 // Move to the primary root.
426 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100),
427 display0);
428 EXPECT_EQ("500,10 1000x100",
429 d1->GetWindowBoundsInScreen().ToString());
430 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow());
431 }
432
404 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { 433 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) {
405 UpdateDisplay("1000x600,600x400"); 434 UpdateDisplay("1000x600,600x400");
406 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 435 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
407 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 436 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
408 views::Widget* w1_t1 = CreateTestWidgetWithParent( 437 views::Widget* w1_t1 = CreateTestWidgetWithParent(
409 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); 438 w1, gfx::Rect(50, 50, 50, 50), false /* transient */);
410 // Transient child of the transient child. 439 // Transient child of the transient child.
411 views::Widget* w1_t11 = CreateTestWidgetWithParent( 440 views::Widget* w1_t11 = CreateTestWidgetWithParent(
412 w1_t1, gfx::Rect(1200, 70, 30, 30), false /* transient */); 441 w1_t1, gfx::Rect(1200, 70, 30, 30), false /* transient */);
413 442
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 p.SetPoint(0, 0); 540 p.SetPoint(0, 0);
512 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p); 541 aura::Window::ConvertPointToTarget(root_windows[0], root_windows[1], &p);
513 EXPECT_EQ("0,-600", p.ToString()); 542 EXPECT_EQ("0,-600", p.ToString());
514 p.SetPoint(0, 0); 543 p.SetPoint(0, 0);
515 aura::Window::ConvertPointToTarget(d1, d2, &p); 544 aura::Window::ConvertPointToTarget(d1, d2, &p);
516 EXPECT_EQ("-10,-610", p.ToString()); 545 EXPECT_EQ("-10,-610", p.ToString());
517 } 546 }
518 547
519 } // namespace internal 548 } // namespace internal
520 } // namespace ash 549 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_position_controller.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698