Merge "Send ACTION_UP if there is an exception" into main

This commit is contained in:
Sebastián Franco
2024-01-23 18:40:53 +00:00
committed by Android (Google) Code Review
2 changed files with 26 additions and 16 deletions

View File

@@ -2055,11 +2055,14 @@ public final class LauncherInstrumentation {
final long downTime = SystemClock.uptimeMillis();
sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, targetCenter,
GestureScope.DONT_EXPECT_PILFER);
expectEvent(TestProtocol.SEQUENCE_MAIN, longClickEvent);
final UiObject2 result = waitForLauncherObject(resName);
sendPointer(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, targetCenter,
GestureScope.DONT_EXPECT_PILFER);
return result;
try {
expectEvent(TestProtocol.SEQUENCE_MAIN, longClickEvent);
final UiObject2 result = waitForLauncherObject(resName);
return result;
} finally {
sendPointer(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, targetCenter,
GestureScope.DONT_EXPECT_PILFER);
}
}
@NonNull
@@ -2070,12 +2073,15 @@ public final class LauncherInstrumentation {
sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, targetCenter,
GestureScope.DONT_EXPECT_PILFER, InputDevice.SOURCE_MOUSE,
/* isRightClick= */ true);
expectEvent(TestProtocol.SEQUENCE_MAIN, rightClickEvent);
final UiObject2 result = waitForLauncherObject(resName);
sendPointer(downTime, SystemClock.uptimeMillis(), ACTION_UP, targetCenter,
GestureScope.DONT_EXPECT_PILFER, InputDevice.SOURCE_MOUSE,
/* isRightClick= */ true);
return result;
try {
expectEvent(TestProtocol.SEQUENCE_MAIN, rightClickEvent);
final UiObject2 result = waitForLauncherObject(resName);
return result;
} finally {
sendPointer(downTime, SystemClock.uptimeMillis(), ACTION_UP, targetCenter,
GestureScope.DONT_EXPECT_PILFER, InputDevice.SOURCE_MOUSE,
/* isRightClick= */ true);
}
}
private static int getSystemIntegerRes(Context context, String resName) {

View File

@@ -16,6 +16,7 @@
package com.android.launcher3.tapl;
import static com.android.launcher3.tapl.Launchable.DEFAULT_DRAG_STEPS;
import static org.junit.Assert.assertTrue;
import android.graphics.Point;
@@ -61,11 +62,14 @@ public class WidgetResizeFrame {
final long downTime = SystemClock.uptimeMillis();
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, targetStart,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
mLauncher.movePointer(targetStart, targetDest, DEFAULT_DRAG_STEPS,
true, downTime, downTime, true,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, targetDest,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
try {
mLauncher.movePointer(targetStart, targetDest, DEFAULT_DRAG_STEPS,
true, downTime, downTime, true,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
} finally {
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, targetDest,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer(
"want to return resized widget resize frame")) {