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

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

Issue 12213111: Fix right edge bounds for panel position. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/panel_layout_manager.h" 5 #include "ash/wm/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/screen_ash.h"
12 #include "ash/shell.h" 13 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
14 #include "ash/test/ash_test_base.h" 15 #include "ash/test/ash_test_base.h"
15 #include "ash/test/launcher_view_test_api.h" 16 #include "ash/test/launcher_view_test_api.h"
16 #include "ash/test/shell_test_api.h" 17 #include "ash/test/shell_test_api.h"
17 #include "ash/test/test_launcher_delegate.h" 18 #include "ash/test/test_launcher_delegate.h"
18 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
19 #include "base/basictypes.h" 20 #include "base/basictypes.h"
20 #include "base/command_line.h" 21 #include "base/command_line.h"
21 #include "base/compiler_specific.h" 22 #include "base/compiler_specific.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 73 }
73 74
74 void GetCalloutWidget(views::Widget** widget) { 75 void GetCalloutWidget(views::Widget** widget) {
75 PanelLayoutManager* manager = 76 PanelLayoutManager* manager =
76 static_cast<PanelLayoutManager*>(GetPanelContainer()->layout_manager()); 77 static_cast<PanelLayoutManager*>(GetPanelContainer()->layout_manager());
77 ASSERT_TRUE(manager); 78 ASSERT_TRUE(manager);
78 ASSERT_TRUE(manager->callout_widget()); 79 ASSERT_TRUE(manager->callout_widget());
79 *widget = manager->callout_widget(); 80 *widget = manager->callout_widget();
80 } 81 }
81 82
83 void PanelInScreen(aura::Window* panel) {
84 gfx::Rect panel_bounds = panel->GetBoundsInRootWindow();
85 gfx::Point root_point = gfx::Point(panel_bounds.x(), panel_bounds.y());
86 gfx::Display display = ScreenAsh::FindDisplayContainingPoint(root_point);
87
88 gfx::Rect panel_bounds_in_screen = panel->GetBoundsInScreen();
89 gfx::Point screen_bottom_right = gfx::Point(
90 panel_bounds_in_screen.right(),
91 panel_bounds_in_screen.bottom());
92 gfx::Rect display_bounds = display.bounds();
93 EXPECT_TRUE(screen_bottom_right.x() < display_bounds.width() &&
94 screen_bottom_right.y() < display_bounds.height());
95 }
96
82 void PanelsNotOverlapping(aura::Window* panel1, aura::Window* panel2) { 97 void PanelsNotOverlapping(aura::Window* panel1, aura::Window* panel2) {
83 // Waits until all launcher view animations are done. 98 // Waits until all launcher view animations are done.
84 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); 99 launcher_view_test()->RunMessageLoopUntilAnimationsDone();
85 gfx::Rect window1_bounds = panel1->GetBoundsInRootWindow(); 100 gfx::Rect window1_bounds = panel1->GetBoundsInRootWindow();
86 gfx::Rect window2_bounds = panel2->GetBoundsInRootWindow(); 101 gfx::Rect window2_bounds = panel2->GetBoundsInRootWindow();
87 102
88 EXPECT_FALSE(window1_bounds.Intersects(window2_bounds)); 103 EXPECT_FALSE(window1_bounds.Intersects(window2_bounds));
89 } 104 }
90 105
91 // TODO(dcheng): This should be const, but GetScreenBoundsOfItemIconForWindow 106 // TODO(dcheng): This should be const, but GetScreenBoundsOfItemIconForWindow
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 319 }
305 320
306 TEST_F(PanelLayoutManagerTest, SplitView) { 321 TEST_F(PanelLayoutManagerTest, SplitView) {
307 gfx::Rect bounds(0, 0, 90, 201); 322 gfx::Rect bounds(0, 0, 90, 201);
308 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds)); 323 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds));
309 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); 324 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds));
310 325
311 EXPECT_NO_FATAL_FAILURE(PanelsNotOverlapping(w1.get(), w2.get())); 326 EXPECT_NO_FATAL_FAILURE(PanelsNotOverlapping(w1.get(), w2.get()));
312 } 327 }
313 328
329 TEST_F(PanelLayoutManagerTest, SplitViewOverlapWhenLarge) {
330 gfx::Rect bounds(0, 0, 600, 201);
331 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds));
332 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds));
333
334 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w1.get()));
335 EXPECT_NO_FATAL_FAILURE(PanelInScreen(w2.get()));
336 }
337
314 TEST_F(PanelLayoutManagerTest, FanWindows) { 338 TEST_F(PanelLayoutManagerTest, FanWindows) {
315 gfx::Rect bounds(0, 0, 201, 201); 339 gfx::Rect bounds(0, 0, 201, 201);
316 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds)); 340 scoped_ptr<aura::Window> w1(CreatePanelWindow(bounds));
317 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); 341 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds));
318 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds)); 342 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds));
319 343
320 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); 344 launcher_view_test()->RunMessageLoopUntilAnimationsDone();
321 int window_x1 = w1->GetBoundsInRootWindow().x(); 345 int window_x1 = w1->GetBoundsInRootWindow().x();
322 int window_x2 = w2->GetBoundsInRootWindow().x(); 346 int window_x2 = w2->GetBoundsInRootWindow().x();
323 int window_x3 = w3->GetBoundsInRootWindow().x(); 347 int window_x3 = w3->GetBoundsInRootWindow().x();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow()); 437 EXPECT_EQ(root_windows[1], p1_d1->GetRootWindow());
414 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow()); 438 EXPECT_EQ(root_windows[0], p2_d1->GetRootWindow());
415 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow()); 439 EXPECT_EQ(root_windows[0], p1_d2->GetRootWindow());
416 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow()); 440 EXPECT_EQ(root_windows[1], p2_d2->GetRootWindow());
417 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains( 441 EXPECT_TRUE(root_windows[0]->GetBoundsInScreen().Contains(
418 p1_d2->GetBoundsInScreen())); 442 p1_d2->GetBoundsInScreen()));
419 } 443 }
420 444
421 } // namespace internal 445 } // namespace internal
422 } // namespace ash 446 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698