use of androidx.slice.SliceMetadata in project android_packages_apps_Settings by omnirom.
the class LowStorageSliceTest method getSlice_storageFree_shouldHaveStorageSettingsTitle.
@Test
@Config(shadows = ShadowPrivateStorageInfo.class)
public void getSlice_storageFree_shouldHaveStorageSettingsTitle() {
ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(100L, 100L));
final Slice slice = mLowStorageSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.storage_settings));
}
use of androidx.slice.SliceMetadata in project android_packages_apps_Settings by omnirom.
the class BluetoothDevicesSliceTest method getSlice_bluetoothTurningOn_shouldHaveBluetoothDevicesTitleAndPairNewDevice.
@Test
public void getSlice_bluetoothTurningOn_shouldHaveBluetoothDevicesTitleAndPairNewDevice() {
mShadowBluetoothAdapter.setEnabled(false);
mShadowBluetoothAdapter.setState(BluetoothAdapter.STATE_OFF);
final Intent intent = new Intent().putExtra(EXTRA_ENABLE_BLUETOOTH, true);
mBluetoothDevicesSlice.onNotifyChange(intent);
final Slice slice = mBluetoothDevicesSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_devices));
final List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, mContext.getString(R.string.bluetooth_pairing_pref_title));
}
use of androidx.slice.SliceMetadata in project android_packages_apps_Settings by omnirom.
the class LowStorageSliceTest method getSlice_lowStorage_shouldHaveStorageFreeTitle.
@Test
@Config(shadows = ShadowPrivateStorageInfo.class)
public void getSlice_lowStorage_shouldHaveStorageFreeTitle() {
ShadowPrivateStorageInfo.setPrivateStorageInfo(new PrivateStorageInfo(10L, 100L));
final Slice slice = mLowStorageSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.storage_menu_free));
}
use of androidx.slice.SliceMetadata in project android_packages_apps_Settings by omnirom.
the class MediaOutputIndicatorSliceTest method getSlice_audioModeIsInCall_returnErrorSlice.
@Test
public void getSlice_audioModeIsInCall_returnErrorSlice() {
mDevices.add(mDevice1);
mDevices.add(mDevice2);
when(sMediaOutputIndicatorWorker.getMediaDevices()).thenReturn(mDevices);
doReturn(mDevice1).when(sMediaOutputIndicatorWorker).getCurrentConnectedMediaDevice();
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
final Slice mediaSlice = mMediaOutputIndicatorSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, mediaSlice);
assertThat(metadata.isErrorSlice()).isTrue();
}
use of androidx.slice.SliceMetadata in project android_packages_apps_Settings by omnirom.
the class ContextualWifiSliceTest method assertWifiHeader.
private void assertWifiHeader(Slice slice) {
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.wifi_settings));
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_wireless);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
}
Aggregations