| OLD | NEW |
| 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" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); | 509 scoped_ptr<aura::Window> w2(CreatePanelWindow(bounds)); |
| 510 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds)); | 510 scoped_ptr<aura::Window> w3(CreatePanelWindow(bounds)); |
| 511 | 511 |
| 512 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); | 512 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 513 int window_x1 = w1->GetBoundsInRootWindow().CenterPoint().x(); | 513 int window_x1 = w1->GetBoundsInRootWindow().CenterPoint().x(); |
| 514 int window_x2 = w2->GetBoundsInRootWindow().CenterPoint().x(); | 514 int window_x2 = w2->GetBoundsInRootWindow().CenterPoint().x(); |
| 515 int window_x3 = w3->GetBoundsInRootWindow().CenterPoint().x(); | 515 int window_x3 = w3->GetBoundsInRootWindow().CenterPoint().x(); |
| 516 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 516 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 517 int icon_x1 = launcher->GetScreenBoundsOfItemIconForWindow(w1.get()).x(); | 517 int icon_x1 = launcher->GetScreenBoundsOfItemIconForWindow(w1.get()).x(); |
| 518 int icon_x2 = launcher->GetScreenBoundsOfItemIconForWindow(w2.get()).x(); | 518 int icon_x2 = launcher->GetScreenBoundsOfItemIconForWindow(w2.get()).x(); |
| 519 EXPECT_EQ(window_x2 - window_x1, window_x3 - window_x2); | 519 EXPECT_EQ(window_x1 - window_x2, window_x2 - window_x3); |
| 520 int spacing = window_x2 - window_x1; | 520 int spacing = window_x1 - window_x2; |
| 521 EXPECT_GT(spacing, icon_x2 - icon_x1); | 521 EXPECT_GT(spacing, icon_x1 - icon_x2); |
| 522 } | 522 } |
| 523 | 523 |
| 524 TEST_F(PanelLayoutManagerTest, FanLargeWindow) { | 524 TEST_F(PanelLayoutManagerTest, FanLargeWindow) { |
| 525 gfx::Rect small_bounds(0, 0, 201, 201); | 525 gfx::Rect small_bounds(0, 0, 201, 201); |
| 526 gfx::Rect large_bounds(0, 0, 501, 201); | 526 gfx::Rect large_bounds(0, 0, 501, 201); |
| 527 scoped_ptr<aura::Window> w1(CreatePanelWindow(small_bounds)); | 527 scoped_ptr<aura::Window> w1(CreatePanelWindow(small_bounds)); |
| 528 scoped_ptr<aura::Window> w2(CreatePanelWindow(large_bounds)); | 528 scoped_ptr<aura::Window> w2(CreatePanelWindow(large_bounds)); |
| 529 scoped_ptr<aura::Window> w3(CreatePanelWindow(small_bounds)); | 529 scoped_ptr<aura::Window> w3(CreatePanelWindow(small_bounds)); |
| 530 | 530 |
| 531 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); | 531 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); |
| 532 int window_x1 = w1->GetBoundsInRootWindow().CenterPoint().x(); | 532 int window_x1 = w1->GetBoundsInRootWindow().CenterPoint().x(); |
| 533 int window_x2 = w2->GetBoundsInRootWindow().CenterPoint().x(); | 533 int window_x2 = w2->GetBoundsInRootWindow().CenterPoint().x(); |
| 534 int window_x3 = w3->GetBoundsInRootWindow().CenterPoint().x(); | 534 int window_x3 = w3->GetBoundsInRootWindow().CenterPoint().x(); |
| 535 // The distances may not be equidistant with a large panel but the panels | 535 // The distances may not be equidistant with a large panel but the panels |
| 536 // should be in the correct order with respect to their midpoints. | 536 // should be in the correct order with respect to their midpoints. |
| 537 EXPECT_GT(window_x2, window_x1); | 537 EXPECT_GT(window_x1, window_x2); |
| 538 EXPECT_GT(window_x3, window_x2); | 538 EXPECT_GT(window_x2, window_x3); |
| 539 } | 539 } |
| 540 | 540 |
| 541 TEST_F(PanelLayoutManagerTest, MinimizeRestorePanel) { | 541 TEST_F(PanelLayoutManagerTest, MinimizeRestorePanel) { |
| 542 gfx::Rect bounds(0, 0, 201, 201); | 542 gfx::Rect bounds(0, 0, 201, 201); |
| 543 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds)); | 543 scoped_ptr<aura::Window> window(CreatePanelWindow(bounds)); |
| 544 // Activate the window, ensure callout is visible. | 544 // Activate the window, ensure callout is visible. |
| 545 wm::ActivateWindow(window.get()); | 545 wm::ActivateWindow(window.get()); |
| 546 RunAllPendingInMessageLoop(); | 546 RunAllPendingInMessageLoop(); |
| 547 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); | 547 EXPECT_TRUE(IsPanelCalloutVisible(window.get())); |
| 548 // Minimize the panel, callout should be hidden. | 548 // Minimize the panel, callout should be hidden. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 EXPECT_TRUE(w1->IsVisible()); | 733 EXPECT_TRUE(w1->IsVisible()); |
| 734 EXPECT_FALSE(w2->IsVisible()); | 734 EXPECT_FALSE(w2->IsVisible()); |
| 735 EXPECT_TRUE(w3->IsVisible()); | 735 EXPECT_TRUE(w3->IsVisible()); |
| 736 } | 736 } |
| 737 | 737 |
| 738 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 738 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
| 739 testing::Bool()); | 739 testing::Bool()); |
| 740 | 740 |
| 741 } // namespace internal | 741 } // namespace internal |
| 742 } // namespace ash | 742 } // namespace ash |
| OLD | NEW |