Search in sources :

Example 6 with WidgetResizeFrame

use of com.android.launcher3.tapl.WidgetResizeFrame in project android_packages_apps_404Launcher by P-404.

the class AddConfigWidgetTest method runTest.

/**
 * @param acceptConfig accept the config activity
 */
private void runTest(boolean acceptConfig) throws Throwable {
    clearHomescreen();
    mDevice.pressHome();
    final Widgets widgets = mLauncher.getWorkspace().openAllWidgets();
    // Drag widget to homescreen
    WidgetConfigStartupMonitor monitor = new WidgetConfigStartupMonitor();
    WidgetResizeFrame resizeFrame = widgets.getWidget(mWidgetInfo.getLabel(mTargetContext.getPackageManager())).dragConfigWidgetToWorkspace(acceptConfig);
    // Widget id for which the config activity was opened
    mWidgetId = monitor.getWidgetId();
    // Verify that the widget id is valid and bound
    assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
    if (acceptConfig) {
        assertNotNull("Widget resize frame not shown after widget added", resizeFrame);
        resizeFrame.dismiss();
        final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
        assertNotNull("Widget not found on the workspace", widget);
    } else {
        final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
        assertNull("Widget unexpectedly found on the workspace", widget);
    }
}
Also used : Widgets(com.android.launcher3.tapl.Widgets) WidgetResizeFrame(com.android.launcher3.tapl.WidgetResizeFrame) Widget(com.android.launcher3.tapl.Widget)

Example 7 with WidgetResizeFrame

use of com.android.launcher3.tapl.WidgetResizeFrame in project android_packages_apps_404Launcher by P-404.

the class AddWidgetTest method testDragIcon.

@Test
@PortraitLandscape
public void testDragIcon() throws Throwable {
    clearHomescreen();
    mDevice.pressHome();
    final LauncherAppWidgetProviderInfo widgetInfo = TestViewHelpers.findWidgetProvider(this, false);
    WidgetResizeFrame resizeFrame = mLauncher.getWorkspace().openAllWidgets().getWidget(widgetInfo.getLabel(mTargetContext.getPackageManager())).dragWidgetToWorkspace();
    assertTrue(mActivityMonitor.itemExists((info, view) -> info instanceof LauncherAppWidgetInfo && ((LauncherAppWidgetInfo) info).providerName.getClassName().equals(widgetInfo.provider.getClassName())).call());
    assertNotNull("Widget resize frame not shown after widget add", resizeFrame);
    resizeFrame.dismiss();
    final Widget widget = mLauncher.getWorkspace().tryGetWidget(widgetInfo.label, DEFAULT_UI_TIMEOUT);
    assertNotNull("Widget not found on the workspace", widget);
    widget.launch(getAppPackageName());
}
Also used : LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) WidgetResizeFrame(com.android.launcher3.tapl.WidgetResizeFrame) Widget(com.android.launcher3.tapl.Widget) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) Test(org.junit.Test) AbstractLauncherUiTest(com.android.launcher3.ui.AbstractLauncherUiTest) LargeTest(androidx.test.filters.LargeTest)

Example 8 with WidgetResizeFrame

use of com.android.launcher3.tapl.WidgetResizeFrame in project android_packages_apps_Launcher3 by ArrowOS.

the class AddConfigWidgetTest method runTest.

/**
 * @param acceptConfig accept the config activity
 */
private void runTest(boolean acceptConfig) throws Throwable {
    clearHomescreen();
    mDevice.pressHome();
    final Widgets widgets = mLauncher.getWorkspace().openAllWidgets();
    // Drag widget to homescreen
    WidgetConfigStartupMonitor monitor = new WidgetConfigStartupMonitor();
    WidgetResizeFrame resizeFrame = widgets.getWidget(mWidgetInfo.getLabel(mTargetContext.getPackageManager())).dragConfigWidgetToWorkspace(acceptConfig);
    // Widget id for which the config activity was opened
    mWidgetId = monitor.getWidgetId();
    // Verify that the widget id is valid and bound
    assertNotNull(mAppWidgetManager.getAppWidgetInfo(mWidgetId));
    if (acceptConfig) {
        assertNotNull("Widget resize frame not shown after widget added", resizeFrame);
        resizeFrame.dismiss();
        final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
        assertNotNull("Widget not found on the workspace", widget);
    } else {
        final Widget widget = mLauncher.getWorkspace().tryGetWidget(mWidgetInfo.label, DEFAULT_UI_TIMEOUT);
        assertNull("Widget unexpectedly found on the workspace", widget);
    }
}
Also used : Widgets(com.android.launcher3.tapl.Widgets) WidgetResizeFrame(com.android.launcher3.tapl.WidgetResizeFrame) Widget(com.android.launcher3.tapl.Widget)

Aggregations

Widget (com.android.launcher3.tapl.Widget)8 WidgetResizeFrame (com.android.launcher3.tapl.WidgetResizeFrame)8 LargeTest (androidx.test.filters.LargeTest)4 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)4 Widgets (com.android.launcher3.tapl.Widgets)4 AbstractLauncherUiTest (com.android.launcher3.ui.AbstractLauncherUiTest)4 LauncherAppWidgetProviderInfo (com.android.launcher3.widget.LauncherAppWidgetProviderInfo)4 Test (org.junit.Test)4