OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 // bounds. | 1626 // bounds. |
1627 gfx::Rect label_bounds = label->GetWidget()->GetWindowBoundsInScreen(); | 1627 gfx::Rect label_bounds = label->GetWidget()->GetWindowBoundsInScreen(); |
1628 if (ash::MaterialDesignController::IsOverviewMaterial()) | 1628 if (ash::MaterialDesignController::IsOverviewMaterial()) |
1629 label_bounds.Inset(kWindowMarginMD, kWindowMarginMD); | 1629 label_bounds.Inset(kWindowMarginMD, kWindowMarginMD); |
1630 EXPECT_EQ(window_item->target_bounds(), label_bounds); | 1630 EXPECT_EQ(window_item->target_bounds(), label_bounds); |
1631 } | 1631 } |
1632 | 1632 |
1633 // Tests that overview updates the window positions if the display orientation | 1633 // Tests that overview updates the window positions if the display orientation |
1634 // changes. | 1634 // changes. |
1635 TEST_P(WindowSelectorTest, DisplayOrientationChanged) { | 1635 TEST_P(WindowSelectorTest, DisplayOrientationChanged) { |
1636 if (!SupportsHostWindowResize()) | |
1637 return; | |
1638 | |
1639 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); | 1636 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
1640 UpdateDisplay("600x200"); | 1637 UpdateDisplay("600x200"); |
1641 EXPECT_EQ("0,0 600x200", root_window->bounds().ToString()); | 1638 EXPECT_EQ("0,0 600x200", root_window->bounds().ToString()); |
1642 gfx::Rect window_bounds(0, 0, 150, 150); | 1639 gfx::Rect window_bounds(0, 0, 150, 150); |
1643 ScopedVector<aura::Window> windows; | 1640 ScopedVector<aura::Window> windows; |
1644 for (int i = 0; i < 3; i++) { | 1641 for (int i = 0; i < 3; i++) { |
1645 windows.push_back(CreateWindow(window_bounds)); | 1642 windows.push_back(CreateWindow(window_bounds)); |
1646 } | 1643 } |
1647 | 1644 |
1648 ToggleOverview(); | 1645 ToggleOverview(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 | 1691 |
1695 SendKey(ui::VKEY_RIGHT); | 1692 SendKey(ui::VKEY_RIGHT); |
1696 EXPECT_EQ(window1, GetSelectedWindow()); | 1693 EXPECT_EQ(window1, GetSelectedWindow()); |
1697 SendCtrlKey(ui::VKEY_W); | 1694 SendCtrlKey(ui::VKEY_W); |
1698 EXPECT_TRUE(widget->IsClosed()); | 1695 EXPECT_TRUE(widget->IsClosed()); |
1699 } | 1696 } |
1700 | 1697 |
1701 // Tests traversing some windows in overview mode with the arrow keys in every | 1698 // Tests traversing some windows in overview mode with the arrow keys in every |
1702 // possible direction. | 1699 // possible direction. |
1703 TEST_P(WindowSelectorTest, BasicArrowKeyNavigation) { | 1700 TEST_P(WindowSelectorTest, BasicArrowKeyNavigation) { |
1704 if (!SupportsHostWindowResize()) | |
1705 return; | |
1706 const size_t test_windows = 9; | 1701 const size_t test_windows = 9; |
1707 UpdateDisplay("800x600"); | 1702 UpdateDisplay("800x600"); |
1708 ScopedVector<aura::Window> windows; | 1703 ScopedVector<aura::Window> windows; |
1709 for (size_t i = test_windows; i > 0; i--) | 1704 for (size_t i = test_windows; i > 0; i--) |
1710 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); | 1705 windows.push_back(CreateWindowWithId(gfx::Rect(0, 0, 100, 100), i)); |
1711 | 1706 |
1712 ui::KeyboardCode arrow_keys[] = {ui::VKEY_RIGHT, ui::VKEY_DOWN, ui::VKEY_LEFT, | 1707 ui::KeyboardCode arrow_keys[] = {ui::VKEY_RIGHT, ui::VKEY_DOWN, ui::VKEY_LEFT, |
1713 ui::VKEY_UP}; | 1708 ui::VKEY_UP}; |
1714 // Expected window layout, assuming that the text filtering feature is | 1709 // Expected window layout, assuming that the text filtering feature is |
1715 // enabled by default (i.e., --ash-disable-text-filtering-in-overview-mode | 1710 // enabled by default (i.e., --ash-disable-text-filtering-in-overview-mode |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2186 bounds.y()); | 2181 bounds.y()); |
2187 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 2182 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
2188 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 2183 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
2189 bounds.right() - transformed_rect.right(), 1); | 2184 bounds.right() - transformed_rect.right(), 1); |
2190 EXPECT_NEAR( | 2185 EXPECT_NEAR( |
2191 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 2186 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
2192 bounds.bottom() - transformed_rect.bottom(), 1); | 2187 bounds.bottom() - transformed_rect.bottom(), 1); |
2193 } | 2188 } |
2194 | 2189 |
2195 } // namespace ash | 2190 } // namespace ash |
OLD | NEW |