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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
9 #include "ash/public/cpp/window_properties.h" | 9 #include "ash/public/cpp/window_properties.h" |
10 #include "ash/public/interfaces/window_pin_type.mojom.h" | 10 #include "ash/public/interfaces/window_pin_type.mojom.h" |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 // Sending a shadow bounds in maximized state won't create a shaodw. | 826 // Sending a shadow bounds in maximized state won't create a shaodw. |
827 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); | 827 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); |
828 surface->Commit(); | 828 surface->Commit(); |
829 | 829 |
830 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); | 830 EXPECT_FALSE(wm::ShadowController::GetShadowForWindow(window)); |
831 // Underlay should be created even without shadow. | 831 // Underlay should be created even without shadow. |
832 ASSERT_TRUE(shell_surface->shadow_underlay()); | 832 ASSERT_TRUE(shell_surface->shadow_underlay()); |
833 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | 833 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); |
834 | 834 |
835 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(0, 0, 0, 0)); | |
836 // Underlay should be created even without shadow. | |
837 ASSERT_TRUE(shell_surface->shadow_underlay()); | |
838 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | |
839 shell_surface->SetRectangularShadowEnabled(false); | |
840 surface->Commit(); | |
841 // Underlay should be created even without shadow. | |
842 ASSERT_TRUE(shell_surface->shadow_underlay()); | |
843 EXPECT_TRUE(shell_surface->shadow_underlay()->IsVisible()); | |
844 | |
845 shell_surface->SetRectangularShadowEnabled(true); | |
846 shell_surface->SetRectangularSurfaceShadow(gfx::Rect(10, 10, 100, 100)); | |
847 surface->Commit(); | |
848 | |
849 // Restore the window and make sure the shadow is created, visible and | 835 // Restore the window and make sure the shadow is created, visible and |
850 // has the latest bounds. | 836 // has the latest bounds. |
851 widget->Restore(); | 837 widget->Restore(); |
852 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); | 838 wm::Shadow* shadow = wm::ShadowController::GetShadowForWindow(window); |
853 ASSERT_TRUE(shadow); | 839 ASSERT_TRUE(shadow); |
854 EXPECT_TRUE(shadow->layer()->visible()); | 840 EXPECT_TRUE(shadow->layer()->visible()); |
855 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), shadow->layer()->parent()->bounds()); | 841 EXPECT_EQ(gfx::Rect(10, 10, 100, 100), shadow->layer()->parent()->bounds()); |
856 } | 842 } |
857 | 843 |
858 TEST_F(ShellSurfaceTest, ToggleFullscreen) { | 844 TEST_F(ShellSurfaceTest, ToggleFullscreen) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 shell_surface.OnAccessibilityModeChanged(); | 1009 shell_surface.OnAccessibilityModeChanged(); |
1024 shell_surface2.OnAccessibilityModeChanged(); | 1010 shell_surface2.OnAccessibilityModeChanged(); |
1025 | 1011 |
1026 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); | 1012 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); |
1027 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); | 1013 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); |
1028 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); | 1014 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); |
1029 } | 1015 } |
1030 | 1016 |
1031 } // namespace | 1017 } // namespace |
1032 } // namespace exo | 1018 } // namespace exo |
OLD | NEW |