diff options
author | vadimt <vadimt@google.com> | 2019-06-10 15:36:30 -0700 |
---|---|---|
committer | vadimt <vadimt@google.com> | 2019-06-10 15:36:30 -0700 |
commit | c026bf2f95a39cb3f6f074b7ea4a110adcadfb39 (patch) | |
tree | 98f262c79fb3c8c25df925c92768c6ac24395165 /tests | |
parent | c25d97534276057341f1d3b761af6013e83fc9dd (diff) | |
download | android_packages_apps_Trebuchet-c026bf2f95a39cb3f6f074b7ea4a110adcadfb39.tar.gz android_packages_apps_Trebuchet-c026bf2f95a39cb3f6f074b7ea4a110adcadfb39.tar.bz2 android_packages_apps_Trebuchet-c026bf2f95a39cb3f6f074b7ea4a110adcadfb39.zip |
Making sure that we drag icon far enough to cross the threshold
Tests dragged icon from all apps to workspace by dragging it to the
center of the screen.
If the icon is close enough to the center, this may not trigger the
dragging condition.
Fixing by dragging far enough.
Bug: 133009122
Change-Id: I68127714ab3694f2639b4acf530e2736ca4dbdf3
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/Launchable.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java index 5190f001a..d4bdafa76 100644 --- a/tests/tapl/com/android/launcher3/tapl/Launchable.java +++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java @@ -20,7 +20,6 @@ import android.graphics.Point; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; -import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject2; import androidx.test.uiautomator.Until; @@ -70,11 +69,16 @@ abstract class Launchable { * Drags an object to the center of homescreen. */ public Workspace dragToWorkspace() { - final UiDevice device = mLauncher.getDevice(); + final Point launchableCenter = getObject().getVisibleCenter(); + final Point displaySize = mLauncher.getRealDisplaySize(); + final int width = displaySize.x / 2; Workspace.dragIconToWorkspace( mLauncher, this, - new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2), + new Point( + launchableCenter.x >= width ? + launchableCenter.x - width / 2 : launchableCenter.x + width / 2, + displaySize.y / 2), getLongPressIndicator()); try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "dragged launchable to workspace")) { |