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/workspace/workspace_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager2.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 EXPECT_TRUE(w2->IsVisible()); | 846 EXPECT_TRUE(w2->IsVisible()); |
847 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); | 847 EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity()); |
848 EXPECT_FALSE(w1->IsVisible()); | 848 EXPECT_FALSE(w1->IsVisible()); |
849 | 849 |
850 // Close |w2|. | 850 // Close |w2|. |
851 w2.reset(); | 851 w2.reset(); |
852 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); | 852 EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity()); |
853 EXPECT_TRUE(w1->IsVisible()); | 853 EXPECT_TRUE(w1->IsVisible()); |
854 } | 854 } |
855 | 855 |
| 856 // Verifies windows that are offscreen don't move when switching workspaces. |
| 857 TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) { |
| 858 aura::test::EventGenerator generator( |
| 859 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 860 generator.MoveMouseTo(0, 0); |
| 861 |
| 862 scoped_ptr<Window> w1(CreateTestWindow()); |
| 863 const gfx::Rect w1_bounds(0, 1, 101, 102); |
| 864 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
| 865 const gfx::Rect touches_shelf_bounds( |
| 866 0, shelf->GetIdealBounds().y() - 10, 101, 102); |
| 867 // Move |w1| to overlap the shelf. |
| 868 w1->SetBounds(touches_shelf_bounds); |
| 869 w1->Show(); |
| 870 wm::ActivateWindow(w1.get()); |
| 871 |
| 872 // Create another window and maximize it. |
| 873 scoped_ptr<Window> w2(CreateTestWindow()); |
| 874 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 875 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 876 w2->Show(); |
| 877 wm::ActivateWindow(w2.get()); |
| 878 |
| 879 // Switch to w1. |
| 880 wm::ActivateWindow(w1.get()); |
| 881 EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); |
| 882 } |
856 } // namespace internal | 883 } // namespace internal |
857 } // namespace ash | 884 } // namespace ash |
OLD | NEW |