OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
6 #include "ash/common/accessibility_delegate.h" | 6 #include "ash/common/accessibility_delegate.h" |
7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
8 #include "ash/common/wm/wm_event.h" | 8 #include "ash/common/wm/wm_event.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 EXPECT_EQ(before, shadow->layer()->bounds()); | 543 EXPECT_EQ(before, shadow->layer()->bounds()); |
544 | 544 |
545 // 4) Updating the widget's window bounds should not change the shadow bounds. | 545 // 4) Updating the widget's window bounds should not change the shadow bounds. |
546 window->SetBounds(gfx::Rect(10, 10, 100, 100)); | 546 window->SetBounds(gfx::Rect(10, 10, 100, 100)); |
547 EXPECT_EQ(before, shadow->layer()->bounds()); | 547 EXPECT_EQ(before, shadow->layer()->bounds()); |
548 | 548 |
549 // 5) This should disable shadow. | 549 // 5) This should disable shadow. |
550 shell_surface->SetRectangularShadow(false); | 550 shell_surface->SetRectangularShadow(false); |
551 surface->Commit(); | 551 surface->Commit(); |
552 | 552 |
553 EXPECT_EQ(wm::SHADOW_TYPE_NONE, wm::GetShadowType(window)); | 553 EXPECT_EQ(wm::ShadowElevation::NONE, wm::GetShadowElevation(window)); |
554 EXPECT_FALSE(shadow->layer()->visible()); | 554 EXPECT_FALSE(shadow->layer()->visible()); |
555 | 555 |
556 // 6) This should enable shadow. | 556 // 6) This should enable shadow. |
557 shell_surface->SetRectangularShadow(true); | 557 shell_surface->SetRectangularShadow(true); |
558 surface->Commit(); | 558 surface->Commit(); |
559 | 559 |
560 EXPECT_EQ(wm::SHADOW_TYPE_RECTANGULAR, wm::GetShadowType(window)); | 560 EXPECT_EQ(wm::ShadowElevation::MEDIUM, wm::GetShadowElevation(window)); |
561 EXPECT_TRUE(shadow->layer()->visible()); | 561 EXPECT_TRUE(shadow->layer()->visible()); |
562 } | 562 } |
563 | 563 |
564 TEST_F(ShellSurfaceTest, ShadowWithStateChange) { | 564 TEST_F(ShellSurfaceTest, ShadowWithStateChange) { |
565 std::unique_ptr<Surface> surface(new Surface); | 565 std::unique_ptr<Surface> surface(new Surface); |
566 // Set the bounds to disable auto managed mode. | 566 // Set the bounds to disable auto managed mode. |
567 std::unique_ptr<ShellSurface> shell_surface( | 567 std::unique_ptr<ShellSurface> shell_surface( |
568 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, | 568 new ShellSurface(surface.get(), nullptr, gfx::Rect(640, 480), true, false, |
569 ash::kShellWindowId_DefaultContainer)); | 569 ash::kShellWindowId_DefaultContainer)); |
570 | 570 |
(...skipping 10 matching lines...) Expand all Loading... |
581 const gfx::Point expected_shadow_origin(-10, -10); | 581 const gfx::Point expected_shadow_origin(-10, -10); |
582 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size); | 582 const gfx::Rect expected_shadow_bounds(expected_shadow_origin, content_size); |
583 | 583 |
584 views::Widget* widget = shell_surface->GetWidget(); | 584 views::Widget* widget = shell_surface->GetWidget(); |
585 aura::Window* window = widget->GetNativeWindow(); | 585 aura::Window* window = widget->GetNativeWindow(); |
586 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 586 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
587 | 587 |
588 shell_surface->SetRectangularShadow(true); | 588 shell_surface->SetRectangularShadow(true); |
589 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); | 589 shell_surface->SetRectangularShadowContentBounds(shadow_bounds); |
590 surface->Commit(); | 590 surface->Commit(); |
591 EXPECT_EQ(wm::SHADOW_TYPE_RECTANGULAR, wm::GetShadowType(window)); | 591 EXPECT_EQ(wm::ShadowElevation::MEDIUM, wm::GetShadowElevation(window)); |
592 | 592 |
593 // Shadow overlay bounds. | 593 // Shadow overlay bounds. |
594 EXPECT_TRUE(shadow->layer()->visible()); | 594 EXPECT_TRUE(shadow->layer()->visible()); |
595 // Origin must be in sync. | 595 // Origin must be in sync. |
596 EXPECT_EQ(expected_shadow_origin, | 596 EXPECT_EQ(expected_shadow_origin, |
597 shadow->layer()->parent()->bounds().origin()); | 597 shadow->layer()->parent()->bounds().origin()); |
598 | 598 |
599 const gfx::Rect work_area = | 599 const gfx::Rect work_area = |
600 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 600 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
601 // Maximizing window hides the shadow. | 601 // Maximizing window hides the shadow. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 shell_surface.OnAccessibilityModeChanged(); | 824 shell_surface.OnAccessibilityModeChanged(); |
825 shell_surface2.OnAccessibilityModeChanged(); | 825 shell_surface2.OnAccessibilityModeChanged(); |
826 | 826 |
827 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); | 827 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); |
828 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 828 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
829 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); | 829 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); |
830 } | 830 } |
831 | 831 |
832 } // namespace | 832 } // namespace |
833 } // namespace exo | 833 } // namespace exo |
OLD | NEW |