use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationChannelSliceTest method getSlice_channelCountIsLessThanDefaultRows_subTitleShouldNotHaveTapToManagerAll.
@Test
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public void getSlice_channelCountIsLessThanDefaultRows_subTitleShouldNotHaveTapToManagerAll() {
addMockPackageToPackageManager(true, /* isRecentlyInstalled */
ApplicationInfo.FLAG_INSTALLED);
mockNotificationBackend(CHANNEL_COUNT - 1, NOTIFICATION_COUNT, false, /* banned */
false);
final Slice slice = mNotificationChannelSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getSubtitle()).isEqualTo(mContext.getResources().getQuantityString(R.plurals.notification_few_channel_count_summary, CHANNEL_COUNT - 1, CHANNEL_COUNT - 1));
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceInfoSliceTest method getSlice_hasSubscriptionInfo_shouldBeCorrectSliceContent.
@Test
public void getSlice_hasSubscriptionInfo_shouldBeCorrectSliceContent() {
final String phoneNumber = "1111111111";
doReturn(mSubscriptionInfo).when(mDeviceInfoSlice).getFirstSubscriptionInfo();
doReturn(phoneNumber).when(mDeviceInfoSlice).getPhoneNumber();
final Slice slice = mDeviceInfoSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.device_info_label));
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedIcon = IconCompat.createWithResource(mContext, R.drawable.ic_info_outline_24dp);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
final List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, phoneNumber);
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DeviceInfoSliceTest method getSlice_hasNoSubscriptionInfo_shouldShowUnknown.
@Test
public void getSlice_hasNoSubscriptionInfo_shouldShowUnknown() {
final Slice slice = mDeviceInfoSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.device_info_label));
final List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, mContext.getString(R.string.device_info_default));
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDevicesSliceTest method getSlice_hasBluetoothDevices_shouldHaveBluetoothDevicesTitle.
@Test
public void getSlice_hasBluetoothDevices_shouldHaveBluetoothDevicesTitle() {
mockBluetoothDeviceList(1);
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
final Slice slice = mBluetoothDevicesSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_devices));
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDevicesSliceTest method getSlice_noBluetoothDevices_shouldHaveNoBluetoothDevicesTitle.
@Test
public void getSlice_noBluetoothDevices_shouldHaveNoBluetoothDevicesTitle() {
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
final Slice slice = mBluetoothDevicesSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.no_bluetooth_devices));
}
Aggregations