Commit abcefa3e authored by mgiuca@chromium.org's avatar mgiuca@chromium.org

Mac App Launcher is positioned on center of dock in certain cases.

The app launcher will be positioned on the center of the dock if the
cursor is not visible (previously would be in the lower-left corner) or
too far away from the dock (previously would be aligned with the cursor).

BUG=312851

Review URL: https://codereview.chromium.org/93863002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238528 0039d316-1c4b-4281-b951-d872f2087c98
parent 1a546a50
...@@ -81,6 +81,33 @@ gfx::Point AppListPositioner::GetAnchorPointForShelfCorner( ...@@ -81,6 +81,33 @@ gfx::Point AppListPositioner::GetAnchorPointForShelfCorner(
return ClampAnchorPoint(anchor); return ClampAnchorPoint(anchor);
} }
gfx::Point AppListPositioner::GetAnchorPointForShelfCenter(
ScreenEdge shelf_edge) const {
const gfx::Rect& work_area = display_.work_area();
gfx::Point anchor;
switch (shelf_edge) {
case SCREEN_EDGE_LEFT:
anchor =
gfx::Point(work_area.x(), work_area.y() + work_area.height() / 2);
break;
case SCREEN_EDGE_RIGHT:
anchor =
gfx::Point(work_area.right(), work_area.y() + work_area.height() / 2);
break;
case SCREEN_EDGE_TOP:
anchor = gfx::Point(work_area.x() + work_area.width() / 2, work_area.y());
break;
case SCREEN_EDGE_BOTTOM:
anchor =
gfx::Point(work_area.x() + work_area.width() / 2, work_area.bottom());
break;
default:
NOTREACHED();
anchor = gfx::Point();
}
return ClampAnchorPoint(anchor);
}
gfx::Point AppListPositioner::GetAnchorPointForShelfCursor( gfx::Point AppListPositioner::GetAnchorPointForShelfCursor(
ScreenEdge shelf_edge, ScreenEdge shelf_edge,
const gfx::Point& cursor) const { const gfx::Point& cursor) const {
......
...@@ -68,6 +68,12 @@ class AppListPositioner { ...@@ -68,6 +68,12 @@ class AppListPositioner {
// Returns the intended coordinates for the center of the window. // Returns the intended coordinates for the center of the window.
gfx::Point GetAnchorPointForShelfCorner(ScreenEdge shelf_edge) const; gfx::Point GetAnchorPointForShelfCorner(ScreenEdge shelf_edge) const;
// Finds the position for a window to anchor it to the center of the shelf.
// |shelf_edge| specifies the location of the shelf. It must not be
// SCREEN_EDGE_UNKNOWN. Returns the intended coordinates for the center of the
// window.
gfx::Point GetAnchorPointForShelfCenter(ScreenEdge shelf_edge) const;
// Finds the position for a window to anchor it to the shelf at a point // Finds the position for a window to anchor it to the shelf at a point
// closest to the user's mouse cursor. |shelf_edge| specifies the location of // closest to the user's mouse cursor. |shelf_edge| specifies the location of
// the shelf; |cursor| specifies the location of the user's mouse cursor. // the shelf; |cursor| specifies the location of the user's mouse cursor.
......
...@@ -93,6 +93,11 @@ class AppListPositionerUnitTest : public testing::Test { ...@@ -93,6 +93,11 @@ class AppListPositionerUnitTest : public testing::Test {
return positioner_->GetAnchorPointForShelfCorner(shelf_edge); return positioner_->GetAnchorPointForShelfCorner(shelf_edge);
} }
gfx::Point DoGetAnchorPointForShelfCenter(
AppListPositioner::ScreenEdge shelf_edge) const {
return positioner_->GetAnchorPointForShelfCenter(shelf_edge);
}
gfx::Point DoGetAnchorPointForShelfCursor( gfx::Point DoGetAnchorPointForShelfCursor(
AppListPositioner::ScreenEdge shelf_edge) const { AppListPositioner::ScreenEdge shelf_edge) const {
return positioner_->GetAnchorPointForShelfCursor(shelf_edge, cursor_); return positioner_->GetAnchorPointForShelfCursor(shelf_edge, cursor_);
...@@ -176,6 +181,39 @@ TEST_F(AppListPositionerUnitTest, ShelfCorner) { ...@@ -176,6 +181,39 @@ TEST_F(AppListPositionerUnitTest, ShelfCorner) {
DoGetAnchorPointForShelfCorner(AppListPositioner::SCREEN_EDGE_BOTTOM)); 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) { TEST_F(AppListPositionerUnitTest, ShelfCursor) {
// Position the app list on the shelf, aligned with the mouse cursor. // Position the app list on the shelf, aligned with the mouse cursor.
......
...@@ -280,24 +280,29 @@ void AppListServiceMac::FindAnchorPoint(const gfx::Size& window_size, ...@@ -280,24 +280,29 @@ void AppListServiceMac::FindAnchorPoint(const gfx::Size& window_size,
NSPoint* target_origin, NSPoint* target_origin,
NSPoint* start_origin) { NSPoint* start_origin) {
AppListPositioner positioner(display, window_size, 0); AppListPositioner positioner(display, window_size, 0);
AppListPositioner::ScreenEdge dock_location = AppListPositioner::ScreenEdge dock_location = DockLocationInDisplay(display);
AppListPositioner::SCREEN_EDGE_UNKNOWN;
gfx::Point anchor; gfx::Point anchor;
if (!cursor_is_visible) { // Snap to the dock edge. If the cursor is greater than the window
// width/height away or not visible, anchor to the center of the dock.
// Otherwise, anchor to the cursor position.
if (dock_location == AppListPositioner::SCREEN_EDGE_UNKNOWN) {
anchor = positioner.GetAnchorPointForScreenCorner( anchor = positioner.GetAnchorPointForScreenCorner(
AppListPositioner::SCREEN_CORNER_BOTTOM_LEFT); AppListPositioner::SCREEN_CORNER_BOTTOM_LEFT);
} else { } else {
dock_location = DockLocationInDisplay(display); int snap_distance =
dock_location == AppListPositioner::SCREEN_EDGE_BOTTOM ||
// Snap to the dock edge, anchored to the cursor position. dock_location == AppListPositioner::SCREEN_EDGE_TOP ?
if (dock_location == AppListPositioner::SCREEN_EDGE_UNKNOWN) { window_size.height() :
anchor = positioner.GetAnchorPointForScreenCorner( window_size.width();
AppListPositioner::SCREEN_CORNER_BOTTOM_LEFT); // Subtract the dock area since the display's default work_area will not
// subtract it if the dock is set to auto-hide, and the app list should
// never overlap the dock.
AdjustWorkAreaForDock(display, &positioner, dock_location);
if (!cursor_is_visible || positioner.GetCursorDistanceFromShelf(
dock_location, cursor) > snap_distance) {
anchor = positioner.GetAnchorPointForShelfCenter(dock_location);
} else { } else {
// Subtract the dock area since the display's default work_area will not
// subtract it if the dock is set to auto-hide, and the app list should
// never overlap the dock.
AdjustWorkAreaForDock(display, &positioner, dock_location);
anchor = positioner.GetAnchorPointForShelfCursor(dock_location, cursor); anchor = positioner.GetAnchorPointForShelfCursor(dock_location, cursor);
} }
} }
...@@ -307,6 +312,8 @@ void AppListServiceMac::FindAnchorPoint(const gfx::Size& window_size, ...@@ -307,6 +312,8 @@ void AppListServiceMac::FindAnchorPoint(const gfx::Size& window_size,
primary_display_height - anchor.y() - window_size.height() / 2); primary_display_height - anchor.y() - window_size.height() / 2);
*start_origin = *target_origin; *start_origin = *target_origin;
// If the launcher is anchored to the dock (regardless of whether the cursor
// is visible), animate in inwards from the edge of screen
switch (dock_location) { switch (dock_location) {
case AppListPositioner::SCREEN_EDGE_UNKNOWN: case AppListPositioner::SCREEN_EDGE_UNKNOWN:
break; break;
......
...@@ -33,10 +33,14 @@ const int kExtraDistance = 50; ...@@ -33,10 +33,14 @@ const int kExtraDistance = 50;
// A cursor position that is within the dock. This must be < kDockSize. // A cursor position that is within the dock. This must be < kDockSize.
const int kCursorOnDock = kDockSize / 2; const int kCursorOnDock = kDockSize / 2;
// A cursor position that is within 50 pixels of the dock. // A cursor position that is within kWindowWidth pixels of the dock.
const int kCursorNearDock = kDockSize + 50; const int kCursorNearDockX = kDockSize + kWindowWidth;
// A cursor position that is more than 50 pixels away from the dock. // A cursor position that is more than kWindowWidth pixels away from the dock.
const int kCursorAwayFromDock = kCursorNearDock + 1; const int kCursorAwayFromDockX = kCursorNearDockX + 1;
// A cursor position that is within kWindowHeight pixels of the dock.
const int kCursorNearDockY = kDockSize + kWindowHeight;
// A cursor position that is more than kWindowHeight pixels away from the dock.
const int kCursorAwayFromDockY = kCursorNearDockY + 1;
// A position for the center of the window that causes the window to overlap the // A position for the center of the window that causes the window to overlap the
// edge of the screen. This must be < kWindowWidth / 2 and < kWindowHeight / 2. // edge of the screen. This must be < kWindowWidth / 2 and < kWindowHeight / 2.
...@@ -131,25 +135,34 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoCursor) { ...@@ -131,25 +135,34 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoCursor) {
NSPoint target_origin; NSPoint target_origin;
NSPoint start_origin; NSPoint start_origin;
// Bottom dock. Expect the app list to be in the bottom-left corner, above the // Bottom dock. Expect the app list to be centered on the dock.
// dock.
PlaceDock(DOCK_LOCATION_BOTTOM, false); PlaceDock(DOCK_LOCATION_BOTTOM, false);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, kDockSize), target_origin)); EXPECT_TRUE(
EXPECT_TRUE(NSEqualPoints(target_origin, start_origin)); NSEqualPoints(NSMakePoint(kScreenWidth / 2 - kWindowWidth / 2, kDockSize),
target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset),
start_origin));
// Left dock. Expect the app list to be in the bottom-left corner, beside the // Left dock. Expect the app list to be centered on the dock.
// dock.
PlaceDock(DOCK_LOCATION_LEFT, false); PlaceDock(DOCK_LOCATION_LEFT, false);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(kDockSize, 0), target_origin)); EXPECT_TRUE(NSEqualPoints(
EXPECT_TRUE(NSEqualPoints(target_origin, start_origin)); NSMakePoint(kDockSize,
(kScreenHeight - kMenuBarSize) / 2 - kWindowHeight / 2),
target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, -kAnimationOffset, 0),
start_origin));
// Right dock. Expect the app list to be in the bottom-left corner. // Right dock. Expect the app list to be centered on the dock.
PlaceDock(DOCK_LOCATION_RIGHT, false); PlaceDock(DOCK_LOCATION_RIGHT, false);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, 0), target_origin)); EXPECT_TRUE(NSEqualPoints(
EXPECT_TRUE(NSEqualPoints(target_origin, start_origin)); NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
(kScreenHeight - kMenuBarSize) / 2 - kWindowHeight / 2),
target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, kAnimationOffset, 0),
start_origin));
} }
// Tests positioning the app list when there is no dock on the display. // Tests positioning the app list when there is no dock on the display.
...@@ -163,46 +176,48 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoDock) { ...@@ -163,46 +176,48 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointNoDock) {
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, 0), target_origin)); EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, 0), target_origin));
EXPECT_TRUE(NSEqualPoints(target_origin, start_origin)); EXPECT_TRUE(NSEqualPoints(target_origin, start_origin));
// No mouse cursor. This should have no effect.
SetCursorVisible(false);
DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(0, 0), target_origin));
EXPECT_TRUE(NSEqualPoints(target_origin, start_origin));
} }
// Tests positioning the app list when the mouse is away from the dock. // Tests positioning the app list when the mouse is away from the dock.
TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOffDock) { TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOffDock) {
// On Mac, this is currently no different from having the mouse on the dock.
SetCursorVisible(true); SetCursorVisible(true);
NSPoint target_origin; NSPoint target_origin;
NSPoint start_origin; NSPoint start_origin;
// Bottom dock. Expect the app list to be at the bottom centered on the mouse // Bottom dock. Expect the app list to be centered on the dock.
// X coordinate.
PlaceDock(DOCK_LOCATION_BOTTOM, false); PlaceDock(DOCK_LOCATION_BOTTOM, false);
PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorAwayFromDock); PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorAwayFromDockY);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(
NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2, kDockSize), NSEqualPoints(NSMakePoint(kScreenWidth / 2 - kWindowWidth / 2, kDockSize),
target_origin)); target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset), EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, 0, -kAnimationOffset),
start_origin)); start_origin));
// Left dock. Expect the app list to be at the left centered on the mouse Y // Left dock. Expect the app list to be centered on the dock.
// coordinate.
PlaceDock(DOCK_LOCATION_LEFT, false); PlaceDock(DOCK_LOCATION_LEFT, false);
PlaceCursor(kCursorAwayFromDock, kWindowAwayFromEdge); PlaceCursor(kCursorAwayFromDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kDockSize, NSMakePoint(kDockSize,
kScreenHeight - kWindowAwayFromEdge - kWindowHeight / 2), (kScreenHeight - kMenuBarSize) / 2 - kWindowHeight / 2),
target_origin)); target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, -kAnimationOffset, 0), EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, -kAnimationOffset, 0),
start_origin)); start_origin));
// Right dock. Expect the app list to be at the right centered on the mouse Y // Right dock. Expect the app list to be centered on the dock.
// coordinate.
PlaceDock(DOCK_LOCATION_RIGHT, false); PlaceDock(DOCK_LOCATION_RIGHT, false);
PlaceCursor(kScreenWidth - kCursorAwayFromDock, kWindowAwayFromEdge); PlaceCursor(kScreenWidth - kCursorAwayFromDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kScreenWidth - kDockSize - kWindowWidth, NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
kScreenHeight - kWindowAwayFromEdge - kWindowHeight / 2), (kScreenHeight - kMenuBarSize) / 2 - kWindowHeight / 2),
target_origin)); target_origin));
EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, kAnimationOffset, 0), EXPECT_TRUE(NSEqualPoints(OffsetPoint(target_origin, kAnimationOffset, 0),
start_origin)); start_origin));
...@@ -217,7 +232,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) { ...@@ -217,7 +232,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) {
// Bottom dock. Expect the app list to be kExtraDistance pixels from the dock // Bottom dock. Expect the app list to be kExtraDistance pixels from the dock
// centered on the mouse X coordinate. // centered on the mouse X coordinate.
PlaceDock(DOCK_LOCATION_BOTTOM, true); PlaceDock(DOCK_LOCATION_BOTTOM, true);
PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorAwayFromDock); PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorAwayFromDockY);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints(NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2, EXPECT_TRUE(NSEqualPoints(NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2,
kHiddenDockSize + kExtraDistance), kHiddenDockSize + kExtraDistance),
...@@ -228,7 +243,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) { ...@@ -228,7 +243,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) {
// Left dock. Expect the app list to be kExtraDistance pixels from the dock // Left dock. Expect the app list to be kExtraDistance pixels from the dock
// centered on the mouse Y coordinate. // centered on the mouse Y coordinate.
PlaceDock(DOCK_LOCATION_LEFT, true); PlaceDock(DOCK_LOCATION_LEFT, true);
PlaceCursor(kCursorAwayFromDock, kWindowAwayFromEdge); PlaceCursor(kCursorAwayFromDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kHiddenDockSize + kExtraDistance, NSMakePoint(kHiddenDockSize + kExtraDistance,
...@@ -240,7 +255,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) { ...@@ -240,7 +255,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointHiddenDock) {
// Right dock. Expect the app list to be kExtraDistance pixels from the dock // Right dock. Expect the app list to be kExtraDistance pixels from the dock
// centered on the mouse Y coordinate. // centered on the mouse Y coordinate.
PlaceDock(DOCK_LOCATION_RIGHT, true); PlaceDock(DOCK_LOCATION_RIGHT, true);
PlaceCursor(kScreenWidth - kCursorAwayFromDock, kWindowAwayFromEdge); PlaceCursor(kScreenWidth - kCursorAwayFromDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint( NSMakePoint(
...@@ -271,7 +286,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) { ...@@ -271,7 +286,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) {
// Bottom dock (outside the dock but still close enough). Expect the app list // Bottom dock (outside the dock but still close enough). Expect the app list
// to be at the bottom centered on the mouse X coordinate. // to be at the bottom centered on the mouse X coordinate.
PlaceDock(DOCK_LOCATION_BOTTOM, false); PlaceDock(DOCK_LOCATION_BOTTOM, false);
PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorNearDock); PlaceCursor(kWindowAwayFromEdge, kScreenHeight - kCursorNearDockY);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2, kDockSize), NSMakePoint(kWindowAwayFromEdge - kWindowWidth / 2, kDockSize),
...@@ -282,7 +297,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) { ...@@ -282,7 +297,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) {
// Left dock. Expect the app list to be at the left centered on the mouse Y // Left dock. Expect the app list to be at the left centered on the mouse Y
// coordinate. // coordinate.
PlaceDock(DOCK_LOCATION_LEFT, false); PlaceDock(DOCK_LOCATION_LEFT, false);
PlaceCursor(kCursorNearDock, kWindowAwayFromEdge); PlaceCursor(kCursorNearDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kDockSize, NSMakePoint(kDockSize,
...@@ -294,7 +309,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) { ...@@ -294,7 +309,7 @@ TEST_F(AppListServiceMacUnitTest, FindAnchorPointMouseOnDock) {
// Right dock. Expect the app list to be at the right centered on the mouse Y // Right dock. Expect the app list to be at the right centered on the mouse Y
// coordinate. // coordinate.
PlaceDock(DOCK_LOCATION_RIGHT, false); PlaceDock(DOCK_LOCATION_RIGHT, false);
PlaceCursor(kScreenWidth - kCursorNearDock, kWindowAwayFromEdge); PlaceCursor(kScreenWidth - kCursorNearDockX, kWindowAwayFromEdge);
DoFindAnchorPoint(&target_origin, &start_origin); DoFindAnchorPoint(&target_origin, &start_origin);
EXPECT_TRUE(NSEqualPoints( EXPECT_TRUE(NSEqualPoints(
NSMakePoint(kScreenWidth - kDockSize - kWindowWidth, NSMakePoint(kScreenWidth - kDockSize - kWindowWidth,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment