| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/shelf/shelf_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/launcher/launcher_button.h" | 8 #include "ash/launcher/launcher_button.h" |
| 9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
| 10 #include "ash/launcher/launcher_view.h" | 10 #include "ash/launcher/launcher_view.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 TEST_F(ShelfWidgetTest, TestAlignment) { | 67 TEST_F(ShelfWidgetTest, TestAlignment) { |
| 68 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 68 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
| 69 UpdateDisplay("400x400"); | 69 UpdateDisplay("400x400"); |
| 70 ASSERT_TRUE(launcher); | 70 ASSERT_TRUE(launcher); |
| 71 { | 71 { |
| 72 SCOPED_TRACE("Single Bottom"); | 72 SCOPED_TRACE("Single Bottom"); |
| 73 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 73 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
| 74 SHELF_ALIGNMENT_BOTTOM, | 74 SHELF_ALIGNMENT_BOTTOM, |
| 75 "0,0 400x352"); | 75 "0,0 400x353"); |
| 76 } | 76 } |
| 77 { | 77 { |
| 78 SCOPED_TRACE("Single Right"); | 78 SCOPED_TRACE("Single Right"); |
| 79 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 79 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
| 80 SHELF_ALIGNMENT_RIGHT, | 80 SHELF_ALIGNMENT_RIGHT, |
| 81 "0,0 352x400"); | 81 "0,0 353x400"); |
| 82 } | 82 } |
| 83 { | 83 { |
| 84 SCOPED_TRACE("Single Left"); | 84 SCOPED_TRACE("Single Left"); |
| 85 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 85 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
| 86 SHELF_ALIGNMENT_LEFT, | 86 SHELF_ALIGNMENT_LEFT, |
| 87 "48,0 352x400"); | 87 "47,0 353x400"); |
| 88 } | 88 } |
| 89 if (!SupportsMultipleDisplays()) | 89 if (!SupportsMultipleDisplays()) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 UpdateDisplay("300x300,500x500"); | 92 UpdateDisplay("300x300,500x500"); |
| 93 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 93 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 94 { | 94 { |
| 95 SCOPED_TRACE("Primary Bottom"); | 95 SCOPED_TRACE("Primary Bottom"); |
| 96 TestLauncherAlignment(root_windows[0], | 96 TestLauncherAlignment(root_windows[0], |
| 97 SHELF_ALIGNMENT_BOTTOM, | 97 SHELF_ALIGNMENT_BOTTOM, |
| 98 "0,0 300x252"); | 98 "0,0 300x253"); |
| 99 } | 99 } |
| 100 { | 100 { |
| 101 SCOPED_TRACE("Primary Right"); | 101 SCOPED_TRACE("Primary Right"); |
| 102 TestLauncherAlignment(root_windows[0], | 102 TestLauncherAlignment(root_windows[0], |
| 103 SHELF_ALIGNMENT_RIGHT, | 103 SHELF_ALIGNMENT_RIGHT, |
| 104 "0,0 252x300"); | 104 "0,0 253x300"); |
| 105 } | 105 } |
| 106 { | 106 { |
| 107 SCOPED_TRACE("Primary Left"); | 107 SCOPED_TRACE("Primary Left"); |
| 108 TestLauncherAlignment(root_windows[0], | 108 TestLauncherAlignment(root_windows[0], |
| 109 SHELF_ALIGNMENT_LEFT, | 109 SHELF_ALIGNMENT_LEFT, |
| 110 "48,0 252x300"); | 110 "47,0 253x300"); |
| 111 } | 111 } |
| 112 { | 112 { |
| 113 SCOPED_TRACE("Secondary Bottom"); | 113 SCOPED_TRACE("Secondary Bottom"); |
| 114 TestLauncherAlignment(root_windows[1], | 114 TestLauncherAlignment(root_windows[1], |
| 115 SHELF_ALIGNMENT_BOTTOM, | 115 SHELF_ALIGNMENT_BOTTOM, |
| 116 "300,0 500x452"); | 116 "300,0 500x453"); |
| 117 } | 117 } |
| 118 { | 118 { |
| 119 SCOPED_TRACE("Secondary Right"); | 119 SCOPED_TRACE("Secondary Right"); |
| 120 TestLauncherAlignment(root_windows[1], | 120 TestLauncherAlignment(root_windows[1], |
| 121 SHELF_ALIGNMENT_RIGHT, | 121 SHELF_ALIGNMENT_RIGHT, |
| 122 "300,0 452x500"); | 122 "300,0 453x500"); |
| 123 } | 123 } |
| 124 { | 124 { |
| 125 SCOPED_TRACE("Secondary Left"); | 125 SCOPED_TRACE("Secondary Left"); |
| 126 TestLauncherAlignment(root_windows[1], | 126 TestLauncherAlignment(root_windows[1], |
| 127 SHELF_ALIGNMENT_LEFT, | 127 SHELF_ALIGNMENT_LEFT, |
| 128 "348,0 452x500"); | 128 "347,0 453x500"); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Makes sure the launcher is initially sized correctly. | 132 // Makes sure the launcher is initially sized correctly. |
| 133 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { | 133 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { |
| 134 ShelfWidget* shelf_widget = GetShelfWidget(); | 134 ShelfWidget* shelf_widget = GetShelfWidget(); |
| 135 Launcher* launcher = shelf_widget->launcher(); | 135 Launcher* launcher = shelf_widget->launcher(); |
| 136 ASSERT_TRUE(launcher); | 136 ASSERT_TRUE(launcher); |
| 137 internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 137 internal::ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 138 ASSERT_TRUE(shelf_layout_manager); | 138 ASSERT_TRUE(shelf_layout_manager); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const int status_width = | 186 const int status_width = |
| 187 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); | 187 shelf->status_area_widget()->GetWindowBoundsInScreen().width(); |
| 188 EXPECT_GT(status_width, 0); | 188 EXPECT_GT(status_width, 0); |
| 189 EXPECT_EQ(status_width, | 189 EXPECT_EQ(status_width, |
| 190 shelf->GetContentsView()->width() - | 190 shelf->GetContentsView()->width() - |
| 191 launcher->GetLauncherViewForTest()->width()); | 191 launcher->GetLauncherViewForTest()->width()); |
| 192 } | 192 } |
| 193 #endif | 193 #endif |
| 194 | 194 |
| 195 } // namespace ash | 195 } // namespace ash |
| OLD | NEW |