Index: ash/wm/overview/window_selector_unittest.cc |
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc |
index ce93b6976dd66daa284dfbd72fca57a57164039a..028bacd816856a72a8bc493ee611552cef90ea8f 100644 |
--- a/ash/wm/overview/window_selector_unittest.cc |
+++ b/ash/wm/overview/window_selector_unittest.cc |
@@ -1144,4 +1144,37 @@ TEST_F(WindowSelectorTest, CreateLabelUnderPanel) { |
EXPECT_EQ(label->text(), panel1_title); |
} |
+// Tests that overview updates the window postions if the display orientation |
+// changes. |
+TEST_F(WindowSelectorTest, DisplayOrientationChanged) { |
+ if (!SupportsHostWindowResize()) |
+ return; |
+ |
+ aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
+ UpdateDisplay("600x200"); |
+ EXPECT_EQ("0,0 600x200", root_window->bounds().ToString()); |
+ gfx::Rect window_bounds(0, 0, 150, 150); |
+ ScopedVector<aura::Window> windows; |
+ for (int i = 0; i < 3; i++) { |
+ windows.push_back(CreateWindow(window_bounds)); |
+ } |
+ |
+ ToggleOverview(); |
+ for (ScopedVector<aura::Window>::iterator iter = windows.begin(); |
+ iter != windows.end(); ++iter) { |
+ EXPECT_TRUE(root_window->bounds().Contains( |
+ ToEnclosingRect(GetTransformedTargetBounds(*iter)))); |
+ } |
+ |
+ // Rotate the display, windows should be repositioned to be within the screen |
+ // bounds. |
+ UpdateDisplay("600x200/r"); |
+ EXPECT_EQ("0,0 200x600", root_window->bounds().ToString()); |
+ for (ScopedVector<aura::Window>::iterator iter = windows.begin(); |
+ iter != windows.end(); ++iter) { |
+ EXPECT_TRUE(root_window->bounds().Contains( |
+ ToEnclosingRect(GetTransformedTargetBounds(*iter)))); |
+ } |
+} |
+ |
} // namespace ash |