summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Tryshev <vadimt@google.com>2019-06-10 17:51:03 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-06-10 17:51:03 -0700
commita9e45099c413bf800c4aec1b7d466b3ceffd811b (patch)
treec1d064510866d27f8ce963044ef4505688b6f47d /tests
parent153f511ec58e0c5299a8d02b7b0d2a37e79d9fe3 (diff)
parent5d8283a87d842b6d5ae8e5fd27f2b839d5d6a35a (diff)
downloadandroid_packages_apps_Trebuchet-a9e45099c413bf800c4aec1b7d466b3ceffd811b.tar.gz
android_packages_apps_Trebuchet-a9e45099c413bf800c4aec1b7d466b3ceffd811b.tar.bz2
android_packages_apps_Trebuchet-a9e45099c413bf800c4aec1b7d466b3ceffd811b.zip
Merge "Making sure that we drag icon far enough to cross the threshold" into ub-launcher3-qt-dev
am: 5d8283a87d Change-Id: Ie54994f1f1851d277cb79a25223b844f20a8082e
Diffstat (limited to 'tests')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/Launchable.java10
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")) {