Search in sources :

Example 91 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_404Launcher by P-404.

the class LauncherAppWidgetProviderInfoTest method initSpans_minWidthLargerThanGridColumns_shouldInitializeSpansToAtMostTheGridColumns.

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

Example 92 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_404Launcher by P-404.

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)

Example 93 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_404Launcher by P-404.

the class LauncherAppWidgetProviderInfoTest method initSpans_minResizeWidthHeightLargerThanMinWidth_shouldUseMinWidthHeightAsMinSpans.

@Test
public void initSpans_minResizeWidthHeightLargerThanMinWidth_shouldUseMinWidthHeightAsMinSpans() {
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = 20;
    info.minHeight = 20;
    info.minResizeWidth = 80;
    info.minResizeHeight = 80;
    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 94 with LauncherAppWidgetProviderInfo

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_404Launcher by P-404.

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

use of com.android.launcher3.widget.LauncherAppWidgetProviderInfo in project android_packages_apps_404Launcher by P-404.

the class LauncherAppWidgetProviderInfoTest method initSpans_minResizeWidthWithCellSpacingAndWidgetInset_shouldInitializeMinSpans.

@Test
public void initSpans_minResizeWidthWithCellSpacingAndWidgetInset_shouldInitializeMinSpans() {
    InvariantDeviceProfile idp = createIDP();
    DeviceProfile dp = idp.supportedProfiles.get(0);
    Rect padding = new Rect();
    AppWidgetHostView.getDefaultPaddingForWidget(mContext, null, padding);
    int maxPadding = Math.max(Math.max(padding.left, padding.right), Math.max(padding.top, padding.bottom));
    dp.cellLayoutBorderSpacePx.x = dp.cellLayoutBorderSpacePx.y = maxPadding + 1;
    Mockito.when(dp.shouldInsetWidgets()).thenReturn(true);
    LauncherAppWidgetProviderInfo info = new LauncherAppWidgetProviderInfo();
    info.minWidth = CELL_SIZE * 3;
    info.minHeight = CELL_SIZE * 3;
    info.minResizeWidth = CELL_SIZE * 2 + maxPadding;
    info.minResizeHeight = CELL_SIZE * 2 + maxPadding;
    info.initSpans(mContext, idp);
    assertThat(info.minSpanX).isEqualTo(2);
    assertThat(info.minSpanY).isEqualTo(2);
}
Also used : DeviceProfile(com.android.launcher3.DeviceProfile) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Rect(android.graphics.Rect) InvariantDeviceProfile(com.android.launcher3.InvariantDeviceProfile) Point(android.graphics.Point) 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