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