use of androidx.slice.Slice 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.Slice 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.Slice in project android_packages_apps_Settings by omnirom.
the class ContextualAdaptiveSleepSliceTest method getSlice_ShowIfNotTurnedOn.
@Test
public void getSlice_ShowIfNotTurnedOn() {
final Slice slice = mContextualAdaptiveSleepSlice.getSlice();
assertThat(slice).isNotNull();
}
use of androidx.slice.Slice in project android_packages_apps_Settings by omnirom.
the class ContextualAdaptiveSleepSliceTest method getSlice_DoNotShowIfRecentlySetup.
@Test
public void getSlice_DoNotShowIfRecentlySetup() {
doReturn(System.currentTimeMillis()).when(mSharedPreferences).getLong(eq(PREF_KEY_SETUP_TIME), anyLong());
final Slice slice = mContextualAdaptiveSleepSlice.getSlice();
assertThat(slice).isNull();
}
use of androidx.slice.Slice 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));
}
Aggregations