use of com.android.launcher3.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);
}
use of com.android.launcher3.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);
}
use of com.android.launcher3.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);
}
use of com.android.launcher3.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);
}
use of com.android.launcher3.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);
}
Aggregations