From 4bedb184665dee67bec58cd5c0875e208c973e71 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Sun, 25 Aug 2024 20:41:00 -0700 Subject: [PATCH] Correctly map the drag view position to the Workspace The drag view needs to be mapped to the drop target which in this case is the Workspace instead of the CellLayout Fix: 352569050 Test: IntegrationReorderWidgetsTest Flag: TEST_ONLY Change-Id: I233c2b3bf0b8637f80d74d201189b2290ef59c94 --- .../launcher3/celllayout/integrationtest/TestUtils.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/src/com/android/launcher3/celllayout/integrationtest/TestUtils.kt b/tests/src/com/android/launcher3/celllayout/integrationtest/TestUtils.kt index 4cecb5a2c7..bcb919162e 100644 --- a/tests/src/com/android/launcher3/celllayout/integrationtest/TestUtils.kt +++ b/tests/src/com/android/launcher3/celllayout/integrationtest/TestUtils.kt @@ -21,6 +21,7 @@ import android.graphics.Rect import android.view.View import android.view.ViewGroup import com.android.launcher3.CellLayout +import com.android.launcher3.Utilities import com.android.launcher3.Workspace import com.android.launcher3.util.CellAndSpan import com.android.launcher3.widget.LauncherAppWidgetHostView @@ -54,7 +55,7 @@ object TestUtils { return view as LauncherAppWidgetHostView } - fun getCellTopLeftRelativeToCellLayout( + fun getCellTopLeftRelativeToWorkspace( workspace: Workspace<*>, cellAndSpan: CellAndSpan ): Point { @@ -67,6 +68,8 @@ object TestUtils { cellAndSpan.spanY, target ) - return Point(target.left, target.top) + val point = floatArrayOf(target.left.toFloat(), target.top.toFloat()) + Utilities.getDescendantCoordRelativeToAncestor(cellLayout, workspace, point, false) + return Point(point[0].toInt(), point[1].toInt()) } }