OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ash/wm/panels/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
6 | 6 |
7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/public/cpp/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.h" |
9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/public/cpp/window_properties.h" | 10 #include "ash/public/cpp/window_properties.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
13 #include "ash/shelf/shelf_layout_manager.h" | 13 #include "ash/shelf/shelf_layout_manager.h" |
14 #include "ash/shelf/shelf_model.h" | 14 #include "ash/shelf/shelf_model.h" |
15 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
17 #include "ash/shell_port.h" | 17 #include "ash/shell_port.h" |
18 #include "ash/test/ash_test_base.h" | 18 #include "ash/test/ash_test_base.h" |
19 #include "ash/test/cursor_manager_test_api.h" | 19 #include "ash/test/cursor_manager_test_api.h" |
20 #include "ash/test/shelf_view_test_api.h" | 20 #include "ash/test/shelf_view_test_api.h" |
21 #include "ash/wm/drag_window_resizer.h" | 21 #include "ash/wm/drag_window_resizer.h" |
22 #include "ash/wm/window_properties.h" | 22 #include "ash/wm/window_properties.h" |
23 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
24 #include "ash/wm/wm_event.h" | 24 #include "ash/wm/wm_event.h" |
25 #include "ash/wm_window.h" | |
26 #include "base/i18n/rtl.h" | 25 #include "base/i18n/rtl.h" |
27 #include "base/strings/string_number_conversions.h" | 26 #include "base/strings/string_number_conversions.h" |
28 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
29 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
30 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
31 #include "ui/base/ui_base_types.h" | 30 #include "ui/base/ui_base_types.h" |
32 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
33 #include "ui/wm/core/window_util.h" | 32 #include "ui/wm/core/window_util.h" |
34 | 33 |
35 namespace ash { | 34 namespace ash { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 123 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
125 } | 124 } |
126 | 125 |
127 // Ensure |first| and its shelf item come before those of |second|: | 126 // Ensure |first| and its shelf item come before those of |second|: |
128 // - |first| should be left of |second| in an LTR bottom-aligned shelf. | 127 // - |first| should be left of |second| in an LTR bottom-aligned shelf. |
129 // - |first| should be right of |second| in an RTL bottom-aligned shelf. | 128 // - |first| should be right of |second| in an RTL bottom-aligned shelf. |
130 // - |first| should be above |second| in a left- or right-aligned shelf. | 129 // - |first| should be above |second| in a left- or right-aligned shelf. |
131 void CheckWindowAndItemPlacement(aura::Window* first, aura::Window* second) { | 130 void CheckWindowAndItemPlacement(aura::Window* first, aura::Window* second) { |
132 Shelf* shelf = GetPrimaryShelf(); | 131 Shelf* shelf = GetPrimaryShelf(); |
133 const gfx::Rect first_item_bounds = | 132 const gfx::Rect first_item_bounds = |
134 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(first)); | 133 shelf->GetScreenBoundsOfItemIconForWindow(first); |
135 const gfx::Rect second_item_bounds = | 134 const gfx::Rect second_item_bounds = |
136 shelf->GetScreenBoundsOfItemIconForWindow(WmWindow::Get(second)); | 135 shelf->GetScreenBoundsOfItemIconForWindow(second); |
137 if (!base::i18n::IsRTL()) { | 136 if (!base::i18n::IsRTL()) { |
138 EXPECT_TRUE((first->bounds().x() < second->bounds().x()) || | 137 EXPECT_TRUE((first->bounds().x() < second->bounds().x()) || |
139 (first->bounds().y() < second->bounds().y())); | 138 (first->bounds().y() < second->bounds().y())); |
140 EXPECT_TRUE((first_item_bounds.x() < second_item_bounds.x()) || | 139 EXPECT_TRUE((first_item_bounds.x() < second_item_bounds.x()) || |
141 (first_item_bounds.y() < second_item_bounds.y())); | 140 (first_item_bounds.y() < second_item_bounds.y())); |
142 } else { | 141 } else { |
143 EXPECT_TRUE((first->bounds().x() > second->bounds().x()) || | 142 EXPECT_TRUE((first->bounds().x() > second->bounds().x()) || |
144 (first->bounds().y() < second->bounds().y())); | 143 (first->bounds().y() < second->bounds().y())); |
145 EXPECT_TRUE((first_item_bounds.x() > second_item_bounds.x()) || | 144 EXPECT_TRUE((first_item_bounds.x() > second_item_bounds.x()) || |
146 (first_item_bounds.y() < second_item_bounds.y())); | 145 (first_item_bounds.y() < second_item_bounds.y())); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 557 |
559 INSTANTIATE_TEST_CASE_P(LtrRtl, | 558 INSTANTIATE_TEST_CASE_P(LtrRtl, |
560 PanelWindowResizerTextDirectionTest, | 559 PanelWindowResizerTextDirectionTest, |
561 testing::Bool()); | 560 testing::Bool()); |
562 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 561 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
563 PanelWindowResizerTransientTest, | 562 PanelWindowResizerTransientTest, |
564 testing::Values(aura::client::WINDOW_TYPE_NORMAL, | 563 testing::Values(aura::client::WINDOW_TYPE_NORMAL, |
565 aura::client::WINDOW_TYPE_POPUP)); | 564 aura::client::WINDOW_TYPE_POPUP)); |
566 | 565 |
567 } // namespace ash | 566 } // namespace ash |
OLD | NEW |