Search in sources :

Example 16 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_Launcher3 by AOSPA.

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 17 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_Launcher3 by AOSPA.

the class WidgetsListContentEntryTest method createWidgetItem.

private WidgetItem createWidgetItem(ComponentName componentName, int spanX, int spanY) {
    String label = mWidgetsToLabels.get(componentName);
    AppWidgetProviderInfo widgetInfo = createAppWidgetProviderInfo(componentName);
    LauncherAppWidgetProviderInfo launcherAppWidgetProviderInfo = LauncherAppWidgetProviderInfo.fromProviderInfo(getApplicationContext(), widgetInfo);
    launcherAppWidgetProviderInfo.spanX = spanX;
    launcherAppWidgetProviderInfo.spanY = spanY;
    launcherAppWidgetProviderInfo.label = label;
    return new WidgetItem(launcherAppWidgetProviderInfo, mTestProfile, mIconCache);
}
Also used : LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) WidgetUtils.createAppWidgetProviderInfo(com.android.launcher3.util.WidgetUtils.createAppWidgetProviderInfo) LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) WidgetItem(com.android.launcher3.model.WidgetItem)

Example 18 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_Launcher3 by AOSPA.

the class LauncherAppWidgetProviderInfoTest method isMinSizeFulfilled_minHeightAndMinResizeHeightExceededGridRows_shouldReturnFalse.

@Test
public void isMinSizeFulfilled_minHeightAndMinResizeHeightExceededGridRows_shouldReturnFalse() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = 80;
    info.minHeight = CELL_SIZE * (NUM_OF_ROWS + 2);
    info.minResizeWidth = 50;
    info.minResizeHeight = CELL_SIZE * (NUM_OF_ROWS + 1);
    InvariantDeviceProfile idp = createIDP();
    info.initSpans(mContext, idp);
    assertThat(info.isMinSizeFulfilled()).isFalse();
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 19 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_Launcher3 by AOSPA.

the class LauncherAppWidgetProviderInfoTest method initSpans_minResizeWidthUnspecified_shouldInitializeMinSpansToOne.

@Test
public void initSpans_minResizeWidthUnspecified_shouldInitializeMinSpansToOne() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    InvariantDeviceProfile idp = createIDP();
    info.initSpans(mContext, idp);
    assertThat(info.minSpanX).isEqualTo(1);
    assertThat(info.minSpanY).isEqualTo(1);
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 20 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_Launcher3 by AOSPA.

the class LauncherAppWidgetProviderInfoTest method initSpans_minResizeWidthSmallerThanCellWidth_shouldInitializeMinSpansToOne.

@Test
public void initSpans_minResizeWidthSmallerThanCellWidth_shouldInitializeMinSpansToOne() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = 100;
    info.minHeight = 100;
    info.minResizeWidth = 20;
    info.minResizeHeight = 20;
    InvariantDeviceProfile idp = createIDP();
    info.initSpans(mContext, idp);
    assertThat(info.minSpanX).isEqualTo(1);
    assertThat(info.minSpanY).isEqualTo(1);
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)108 LauncherAppWidgetProviderInfo (com.android.launcher3.widget.LauncherAppWidgetProviderInfo)81 InvariantDeviceProfile (com.android.launcher3.InvariantDeviceProfile)77 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)65 SmallTest (androidx.test.filters.SmallTest)52 LargeTest (androidx.test.filters.LargeTest)42 AbstractLauncherUiTest (com.android.launcher3.ui.AbstractLauncherUiTest)42 PendingAddWidgetInfo (com.android.launcher3.widget.PendingAddWidgetInfo)33 Bundle (android.os.Bundle)32 WidgetManagerHelper (com.android.launcher3.widget.WidgetManagerHelper)31 Point (android.graphics.Point)29 LauncherAppWidgetProviderInfo (com.android.launcher3.LauncherAppWidgetProviderInfo)28 AppWidgetProviderInfo (android.appwidget.AppWidgetProviderInfo)23 Context (android.content.Context)23 DeviceProfile (com.android.launcher3.DeviceProfile)23 ArrayList (java.util.ArrayList)21 AppWidgetHostView (android.appwidget.AppWidgetHostView)20 WidgetItem (com.android.launcher3.model.WidgetItem)17 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)14 WidgetAddFlowHandler (com.android.launcher3.widget.WidgetAddFlowHandler)14