use of com.android.launcher3.widget.CachingWidgetPreviewLoader in project android_packages_apps_Launcher3 by crdroidandroid.
the class CachingWidgetPreviewLoaderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mLoader = new CachingWidgetPreviewLoader(mDelegate);
mTestActivity = Robolectric.buildActivity(TestActivity.class).setup().get();
mTestActivity.setDeviceProfile(mDeviceProfile);
when(mDelegate.loadPreview(any(), any(), any(), any())).thenReturn(mCancellationSignal);
mProviderInfo.provider = TEST_PROVIDER;
when(mProviderInfo.getProfile()).thenReturn(new UserHandle(0));
mProviderInfo2.provider = TEST_PROVIDER2;
when(mProviderInfo2.getProfile()).thenReturn(new UserHandle(0));
InvariantDeviceProfile testProfile = new InvariantDeviceProfile();
testProfile.numRows = 5;
testProfile.numColumns = 5;
mWidgetItem = new WidgetItem(mProviderInfo, testProfile, mIconCache);
mWidgetItem2 = new WidgetItem(mProviderInfo2, testProfile, mIconCache);
}
use of com.android.launcher3.widget.CachingWidgetPreviewLoader in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsListTableViewHolderBinderTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mTestProfile = new InvariantDeviceProfile();
mTestProfile.numRows = 5;
mTestProfile.numColumns = 5;
mActivityController = Robolectric.buildActivity(TestActivity.class);
mTestActivity = mActivityController.setup().get();
mTestActivity.setDeviceProfile(mDeviceProfile);
doAnswer(invocation -> {
ComponentWithLabel componentWithLabel = (ComponentWithLabel) invocation.getArgument(0);
return componentWithLabel.getComponent().getShortClassName();
}).when(mIconCache).getTitleNoCache(any());
WidgetsListAdapter widgetsListAdapter = new WidgetsListAdapter(mContext, LayoutInflater.from(mTestActivity), mWidgetPreviewLoader, mIconCache, /* iconClickListener= */
view -> {
}, /* iconLongClickListener= */
view -> false);
mViewHolderBinder = new WidgetsListTableViewHolderBinder(LayoutInflater.from(mTestActivity), mOnIconClickListener, mOnLongClickListener, new CachingWidgetPreviewLoader(mWidgetPreviewLoader), new WidgetsListDrawableFactory(mTestActivity), widgetsListAdapter);
}
Aggregations