use of androidx.slice.core.SliceAction in project android_packages_apps_Settings by omnirom.
the class ZenModeSliceBuilderTest method getZenModeSlice_correctSliceContent.
@Test
public void getZenModeSlice_correctSliceContent() {
final Slice dndSlice = ZenModeSliceBuilder.getSlice(mContext);
final SliceMetadata metadata = SliceMetadata.from(mContext, dndSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.zen_mode_settings_title));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
assertThat(primaryAction.getIcon()).isNull();
}
use of androidx.slice.core.SliceAction in project android_packages_apps_Settings by omnirom.
the class FlashlightSliceTest method getFlashlightSlice_correctData.
@Test
public void getFlashlightSlice_correctData() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.FLASHLIGHT_AVAILABLE, 1);
final Slice slice = new FlashlightSlice(mContext).getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.power_flashlight));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
}
use of androidx.slice.core.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageSliceTest method getSlice_hasSim_shouldBeCorrectSliceContent.
@Test
public void getSlice_hasSim_shouldBeCorrectSliceContent() {
ShadowDataUsageUtils.HAS_SIM = true;
doReturn(DATA_USAGE_TITLE).when(mDataUsageSlice).getDataUsageText(any());
doReturn(DATA_USAGE_SUMMARY).when(mDataUsageSlice).getCycleTime(any());
final Slice slice = mDataUsageSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.data_usage_summary_title));
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedIcon = IconCompat.createWithResource(mContext, R.drawable.ic_settings_data_usage);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
}
use of androidx.slice.core.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class StorageSliceTest method getSlice_shouldBeCorrectSliceContent.
@Test
public void getSlice_shouldBeCorrectSliceContent() {
final PrivateStorageInfo info = new PrivateStorageInfo(100L, 600L);
doReturn(info).when(mStorageSlice).getPrivateStorageInfo();
doReturn(USED_BYTES_TEXT).when(mStorageSlice).getStorageUsedText(any());
doReturn(SUMMARY_TEXT).when(mStorageSlice).getStorageSummaryText(any());
final Slice slice = mStorageSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.storage_label));
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedIcon = IconCompat.createWithResource(mContext, R.drawable.ic_homepage_storage);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
}
use of androidx.slice.core.SliceAction in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FlashlightSliceTest method getFlashlightSlice_correctData.
@Test
public void getFlashlightSlice_correctData() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.FLASHLIGHT_AVAILABLE, 1);
final Slice slice = new FlashlightSlice(mContext).getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.power_flashlight));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
}
Aggregations