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

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: Goddamn Reitveld. Created 7 years, 1 month 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 f002f48507ac34c8beb042ab2629e9946fb1736d..64fc157882eb511a22dda006e6ba3a7181f700c6 100644
--- a/chrome/browser/ui/app_list/app_list_positioner_unittest.cc
+++ b/chrome/browser/ui/app_list/app_list_positioner_unittest.cc
@@ -88,6 +88,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_);
@@ -170,6 +175,33 @@ 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(83, 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 - 83, 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, 133),
+ 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 - 133),
+ 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