Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4176)

Unified Diff: chrome/browser/ui/app_list/app_list_positioner_unittest.cc

Issue 93863002: Mac App Launcher is positioned on center of dock in certain cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Require the mouse to be within window range of the dock, not 50 pixels. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/app_list_positioner_unittest.cc
diff --git a/chrome/browser/ui/app_list/app_list_positioner_unittest.cc b/chrome/browser/ui/app_list/app_list_positioner_unittest.cc
index 86b9cd0144118c786f94b12f937256aa81711f8d..48e129d5f01a95100c4a2a620718e75cbd106399 100644
--- a/chrome/browser/ui/app_list/app_list_positioner_unittest.cc
+++ b/chrome/browser/ui/app_list/app_list_positioner_unittest.cc
@@ -93,6 +93,11 @@ class AppListPositionerUnitTest : public testing::Test {
return positioner_->GetAnchorPointForShelfCorner(shelf_edge);
}
+ gfx::Point DoGetAnchorPointForShelfCenter(
+ AppListPositioner::ScreenEdge shelf_edge) const {
+ return positioner_->GetAnchorPointForShelfCenter(shelf_edge);
+ }
+
gfx::Point DoGetAnchorPointForShelfCursor(
AppListPositioner::ScreenEdge shelf_edge) const {
return positioner_->GetAnchorPointForShelfCursor(shelf_edge, cursor_);
@@ -176,6 +181,39 @@ TEST_F(AppListPositionerUnitTest, ShelfCorner) {
DoGetAnchorPointForShelfCorner(AppListPositioner::SCREEN_EDGE_BOTTOM));
}
+TEST_F(AppListPositionerUnitTest, ShelfCenter) {
+ // Position the app list on the shelf, aligned with the shelf center.
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_LEFT);
+ // Shelf on left. Expect app list to be center-left.
+ EXPECT_EQ(
+ gfx::Point(kShelfSize + kWindowWidth / 2 + kMinDistanceFromEdge,
+ (kMenuBarSize + kScreenHeight) / 2),
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_LEFT));
+
+ // Shelf on right. Expect app list to be center-right.
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_RIGHT);
+ EXPECT_EQ(
+ gfx::Point(
+ kScreenWidth - kShelfSize - kWindowWidth / 2 - kMinDistanceFromEdge,
+ (kMenuBarSize + kScreenHeight) / 2),
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_RIGHT));
+
+ // Shelf on top. Expect app list to be top-center.
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_TOP);
+ EXPECT_EQ(gfx::Point(kScreenWidth / 2,
+ kMenuBarSize + kShelfSize + kWindowHeight / 2 +
+ kMinDistanceFromEdge),
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_TOP));
+
+ // Shelf on bottom. Expect app list to be bottom-center.
+ PlaceShelf(AppListPositioner::SCREEN_EDGE_BOTTOM);
+ EXPECT_EQ(
+ gfx::Point(kScreenWidth / 2,
+ kScreenHeight - kShelfSize - kWindowHeight / 2 -
+ kMinDistanceFromEdge),
+ DoGetAnchorPointForShelfCenter(AppListPositioner::SCREEN_EDGE_BOTTOM));
+}
+
TEST_F(AppListPositionerUnitTest, ShelfCursor) {
// Position the app list on the shelf, aligned with the mouse cursor.

Powered by Google App Engine
This is Rietveld 408576698