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

Unified Diff: ash/extended_desktop_unittest.cc

Issue 10696002: ASH: Use virtual screen coordinates in Display::bounds() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 6 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/display/multi_display_manager_unittest.cc ('k') | ash/screen_ash.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/extended_desktop_unittest.cc
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 9a70accf8f04f2405aecf76fdf47c3fde6a58ba5..d4cce054474101e1f742ef6210ff3e9203d75a74 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -189,9 +189,6 @@ TEST_F(ExtendedDesktopTest, CycleWindows) {
internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
UpdateDisplay("0+0-700x500,0+0-500x500");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- // Emulate virtual screen coordinate system.
- root_windows[0]->SetBounds(gfx::Rect(0, 0, 700, 500));
- root_windows[1]->SetBounds(gfx::Rect(700, 0, 500, 500));
WindowCycleController* controller =
Shell::GetInstance()->window_cycle_controller();
@@ -241,62 +238,61 @@ TEST_F(ExtendedDesktopTest, CycleWindows) {
TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
UpdateDisplay("0+0-700x500,0+0-500x500");
+ Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
+ internal::DisplayController::LEFT);
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- // Emulate virtual screen coordinate system.
- root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500));
- root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500));
- EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(100, 100)));
- EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(499, 100)));
- EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(500, 300)));
- EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1200,300)));
+ EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(-400, 100)));
+ EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(-1, 100)));
+ EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(0, 300)));
+ EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(700,300)));
// Zero origin.
- EXPECT_EQ(root_windows[1], Shell::GetRootWindowAt(gfx::Point(0, 0)));
+ EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(0, 0)));
// Out of range point should return the primary root window
- EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(-100, 0)));
- EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(1201, 100)));
+ EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(-600, 0)));
+ EXPECT_EQ(root_windows[0], Shell::GetRootWindowAt(gfx::Point(701, 100)));
internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
internal::DisplayController::SetVirtualScreenCoordinatesEnabled(true);
UpdateDisplay("0+0-700x500,0+0-500x500");
+ Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
+ internal::DisplayController::LEFT);
+
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- // Emulate virtual screen coordinate system.
- root_windows[0]->SetBounds(gfx::Rect(500, 0, 700, 500));
- root_windows[1]->SetBounds(gfx::Rect(0, 0, 500, 500));
// Containing rect.
EXPECT_EQ(root_windows[1],
- Shell::GetRootWindowMatching(gfx::Rect(200, 10, 50, 50)));
+ Shell::GetRootWindowMatching(gfx::Rect(-300, 10, 50, 50)));
EXPECT_EQ(root_windows[0],
- Shell::GetRootWindowMatching(gfx::Rect(600, 10, 50, 50)));
+ Shell::GetRootWindowMatching(gfx::Rect(100, 10, 50, 50)));
// Intersecting rect.
EXPECT_EQ(root_windows[1],
- Shell::GetRootWindowMatching(gfx::Rect(300, 0, 300, 300)));
+ Shell::GetRootWindowMatching(gfx::Rect(-200, 0, 300, 300)));
EXPECT_EQ(root_windows[0],
- Shell::GetRootWindowMatching(gfx::Rect(400, 0, 300, 300)));
+ Shell::GetRootWindowMatching(gfx::Rect(-100, 0, 300, 300)));
// Zero origin.
- EXPECT_EQ(root_windows[1],
+ EXPECT_EQ(root_windows[0],
Shell::GetRootWindowMatching(gfx::Rect(0, 0, 0, 0)));
- EXPECT_EQ(root_windows[1],
+ EXPECT_EQ(root_windows[0],
Shell::GetRootWindowMatching(gfx::Rect(0, 0, 1, 1)));
// Empty rect.
EXPECT_EQ(root_windows[1],
- Shell::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0)));
+ Shell::GetRootWindowMatching(gfx::Rect(-400, 100, 0, 0)));
EXPECT_EQ(root_windows[0],
- Shell::GetRootWindowMatching(gfx::Rect(600, 100, 0, 0)));
+ Shell::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0)));
// Out of range rect should return the primary root window.
EXPECT_EQ(root_windows[0],
- Shell::GetRootWindowMatching(gfx::Rect(-100, -300, 50, 50)));
+ Shell::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50)));
EXPECT_EQ(root_windows[0],
- Shell::GetRootWindowMatching(gfx::Rect(0, 2000, 50, 50)));
+ Shell::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50)));
internal::DisplayController::SetVirtualScreenCoordinatesEnabled(false);
}
« no previous file with comments | « ash/display/multi_display_manager_unittest.cc ('k') | ash/screen_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698