Search in sources :

Example 86 with Slice

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));
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) ShadowPrivateStorageInfo(com.android.settings.testutils.shadow.ShadowPrivateStorageInfo) Slice(androidx.slice.Slice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 87 with Slice

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));
}
Also used : Slice(androidx.slice.Slice) SliceMetadata(androidx.slice.SliceMetadata) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) SliceItem(androidx.slice.SliceItem) Test(org.junit.Test)

Example 88 with Slice

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();
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Example 89 with Slice

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();
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Example 90 with Slice

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));
}
Also used : PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) ShadowPrivateStorageInfo(com.android.settings.testutils.shadow.ShadowPrivateStorageInfo) Slice(androidx.slice.Slice) SliceMetadata(androidx.slice.SliceMetadata) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

Slice (androidx.slice.Slice)216 Test (org.junit.Test)204 SliceMetadata (androidx.slice.SliceMetadata)73 SliceAction (androidx.slice.core.SliceAction)28 SliceItem (androidx.slice.SliceItem)22 Config (org.robolectric.annotation.Config)20 Uri (android.net.Uri)17 ParceledListSlice (android.content.pm.ParceledListSlice)14 IconCompat (androidx.core.graphics.drawable.IconCompat)14 ContextualWifiSlice (com.android.settings.wifi.slice.ContextualWifiSlice)9 PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)9 UiThreadTest (androidx.test.annotation.UiThreadTest)8 VisibleForTesting (androidx.annotation.VisibleForTesting)5 EmergencyInfoSlice (com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice)5 ArrayList (java.util.ArrayList)5 PendingIntent (android.app.PendingIntent)4 Intent (android.content.Intent)4 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)4 EarlyWarningTip (com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip)4 LowBatteryTip (com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)4