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());
}
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);
}
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();
}
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);
}
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);
}
Aggregations