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

Side by Side Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 14574009: Use correctly mirrored points for ideal bounds of launcher item icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add RTL icon reordering test. Created 7 years, 7 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
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/wm/panels/panel_layout_manager.h" 5 #include "ash/wm/panels/panel_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/launcher/launcher_button.h" 9 #include "ash/launcher/launcher_button.h"
10 #include "ash/launcher/launcher_model.h" 10 #include "ash/launcher/launcher_model.h"
11 #include "ash/launcher/launcher_view.h" 11 #include "ash/launcher/launcher_view.h"
12 #include "ash/root_window_controller.h" 12 #include "ash/root_window_controller.h"
13 #include "ash/screen_ash.h" 13 #include "ash/screen_ash.h"
14 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
15 #include "ash/shelf/shelf_types.h" 15 #include "ash/shelf/shelf_types.h"
16 #include "ash/shelf/shelf_widget.h" 16 #include "ash/shelf/shelf_widget.h"
17 #include "ash/shell.h" 17 #include "ash/shell.h"
18 #include "ash/shell_window_ids.h" 18 #include "ash/shell_window_ids.h"
19 #include "ash/test/ash_test_base.h" 19 #include "ash/test/ash_test_base.h"
20 #include "ash/test/launcher_view_test_api.h" 20 #include "ash/test/launcher_view_test_api.h"
21 #include "ash/test/shell_test_api.h" 21 #include "ash/test/shell_test_api.h"
22 #include "ash/test/test_launcher_delegate.h" 22 #include "ash/test/test_launcher_delegate.h"
23 #include "ash/wm/window_util.h" 23 #include "ash/wm/window_util.h"
24 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "base/command_line.h" 25 #include "base/command_line.h"
26 #include "base/compiler_specific.h" 26 #include "base/compiler_specific.h"
27 #include "base/i18n/rtl.h"
27 #include "base/run_loop.h" 28 #include "base/run_loop.h"
28 #include "ui/aura/client/aura_constants.h" 29 #include "ui/aura/client/aura_constants.h"
29 #include "ui/aura/root_window.h" 30 #include "ui/aura/root_window.h"
30 #include "ui/aura/test/event_generator.h" 31 #include "ui/aura/test/event_generator.h"
31 #include "ui/aura/test/test_windows.h" 32 #include "ui/aura/test/test_windows.h"
32 #include "ui/aura/window.h" 33 #include "ui/aura/window.h"
33 #include "ui/views/corewm/corewm_switches.h" 34 #include "ui/views/corewm/corewm_switches.h"
34 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
35 36
36 namespace ash { 37 namespace ash {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 scoped_ptr<test::LauncherViewTestAPI> launcher_view_test_; 262 scoped_ptr<test::LauncherViewTestAPI> launcher_view_test_;
262 263
263 bool IsHorizontal(ShelfAlignment alignment) { 264 bool IsHorizontal(ShelfAlignment alignment) {
264 return alignment == SHELF_ALIGNMENT_BOTTOM || 265 return alignment == SHELF_ALIGNMENT_BOTTOM ||
265 alignment == SHELF_ALIGNMENT_TOP; 266 alignment == SHELF_ALIGNMENT_TOP;
266 } 267 }
267 268
268 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest); 269 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest);
269 }; 270 };
270 271
272 class PanelLayoutManagerRTLTest : public PanelLayoutManagerTest {
273 public:
274 PanelLayoutManagerRTLTest() {}
275 virtual ~PanelLayoutManagerRTLTest() {}
276
277 virtual void SetUp() OVERRIDE {
278 base::i18n::SetICUDefaultLocale("ar");
279 PanelLayoutManagerTest::SetUp();
280 ASSERT_TRUE(base::i18n::IsRTL());
281 }
282
283 private:
284 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerRTLTest);
285 };
286
varkha 2013/05/03 17:48:14 RTL could be a test parameter set up with INSTANTI
flackr 2013/05/17 20:31:14 This would be nice, however as far as I can tell i
271 // Tests that a created panel window is successfully added to the panel 287 // Tests that a created panel window is successfully added to the panel
272 // layout manager. 288 // layout manager.
273 TEST_F(PanelLayoutManagerTest, AddOnePanel) { 289 TEST_F(PanelLayoutManagerTest, AddOnePanel) {
274 gfx::Rect bounds(0, 0, 201, 201); 290 gfx::Rect bounds(0, 0, 201, 201);
275 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds)); 291 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds));
276 EXPECT_EQ(GetPanelContainer(window.get()), window->parent()); 292 EXPECT_EQ(GetPanelContainer(window.get()), window->parent());
277 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); 293 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
278 } 294 }
279 295
296 // Tests that a created panel window is above the launcher icon in RTL.
297 TEST_F(PanelLayoutManagerRTLTest, AddOnePanel) {
298 gfx::Rect bounds(0, 0, 201, 201);
299 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds));
300 EXPECT_EQ(GetPanelContainer(window.get()), window->parent());
301 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
302 EXPECT_NO_FATAL_FAILURE(IsCalloutAboveLauncherIcon(window.get()));
303 }
304
280 // Tests that a created panel window is successfully aligned over a hidden 305 // Tests that a created panel window is successfully aligned over a hidden
281 // launcher icon. 306 // launcher icon.
282 TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIcon) { 307 TEST_F(PanelLayoutManagerTest, PanelAlignsToHiddenLauncherIcon) {
283 gfx::Rect bounds(0, 0, 201, 201); 308 gfx::Rect bounds(0, 0, 201, 201);
284 SetShelfAutoHideBehavior(Shell::GetPrimaryRootWindow(), 309 SetShelfAutoHideBehavior(Shell::GetPrimaryRootWindow(),
285 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 310 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
286 RunAllPendingInMessageLoop(); 311 RunAllPendingInMessageLoop();
287 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds)); 312 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds));
288 EXPECT_EQ(GetPanelContainer(window.get()), window->parent()); 313 EXPECT_EQ(GetPanelContainer(window.get()), window->parent());
289 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); 314 EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get()));
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 RunAllPendingInMessageLoop(); 702 RunAllPendingInMessageLoop();
678 703
679 // Windows should be restored to their prior state. 704 // Windows should be restored to their prior state.
680 EXPECT_TRUE(w1->IsVisible()); 705 EXPECT_TRUE(w1->IsVisible());
681 EXPECT_FALSE(w2->IsVisible()); 706 EXPECT_FALSE(w2->IsVisible());
682 EXPECT_TRUE(w3->IsVisible()); 707 EXPECT_TRUE(w3->IsVisible());
683 } 708 }
684 709
685 } // namespace internal 710 } // namespace internal
686 } // namespace ash 711 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698