Search in sources :

Example 56 with LauncherAppWidgetProviderInfo

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

the class LauncherAppWidgetProviderInfoTest method initSpans_minResizeWidthLargerThanCellWidth_shouldInitializeMinSpans.

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

Example 57 with LauncherAppWidgetProviderInfo

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

the class LauncherAppWidgetProviderInfoTest method initSpans_minWidthLargerThanCellWidth_shouldInitializeSpans.

@Test
public void initSpans_minWidthLargerThanCellWidth_shouldInitializeSpans() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = 80;
    info.minHeight = 80;
    InvariantDeviceProfile idp = createIDP();
    info.initSpans(mContext, idp);
    assertThat(info.spanX).isEqualTo(2);
    assertThat(info.spanY).isEqualTo(2);
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 58 with LauncherAppWidgetProviderInfo

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

the class LauncherAppWidgetProviderInfoTest method initSpans_minHeightLargerThanGridRows_shouldInitializeSpansToAtMostTheGridRows.

@Test
public void initSpans_minHeightLargerThanGridRows_shouldInitializeSpansToAtMostTheGridRows() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = 20;
    info.minHeight = 50 * (NUM_OF_ROWS + 1);
    InvariantDeviceProfile idp = createIDP();
    info.initSpans(mContext, idp);
    assertThat(info.spanX).isEqualTo(1);
    assertThat(info.spanY).isEqualTo(NUM_OF_ROWS);
}
Also used : InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 59 with LauncherAppWidgetProviderInfo

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

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

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

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)

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