use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothSliceBuilderTest method getBluetoothSlice_correctSliceContent.
@Test
public void getBluetoothSlice_correctSliceContent() {
final Slice BluetoothSlice = BluetoothSliceBuilder.getSlice(mContext);
final SliceMetadata metadata = SliceMetadata.from(mContext, BluetoothSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_settings_title));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).hasSize(1);
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, com.android.internal.R.drawable.ic_settings_bluetooth);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualCardFeatureProviderImplTest method logNotificationPackage_isNotContextualNotificationChannel_shouldNotLogPackage.
@Test
public void logNotificationPackage_isNotContextualNotificationChannel_shouldNotLogPackage() {
final String packageName = "com.android.test.app";
final Slice slice = buildSlice(FLASHLIGHT_SLICE_URI, packageName);
mImpl.logNotificationPackage(slice);
final Set<String> interactedPackages = mSharedPreferences.getStringSet(PREF_KEY_INTERACTED_PACKAGES, new ArraySet<>());
assertThat(interactedPackages.contains(packageName)).isFalse();
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EligibleCardCheckerTest method isCardEligibleToDisplay_errorSlice_returnFalse.
@Test
public void isCardEligibleToDisplay_errorSlice_returnFalse() {
final Slice slice = new Slice.Builder(TEST_SLICE_URI).addHints(HINT_ERROR).build();
doReturn(slice).when(mEligibleCardChecker).bindSlice(any(Uri.class));
assertThat(mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(TEST_SLICE_URI))).isFalse();
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EligibleCardCheckerTest method isSliceToggleable_cardWithToggle_returnTrue.
@Test
public void isSliceToggleable_cardWithToggle_returnTrue() {
final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
final Slice slice = wifiSlice.getSlice();
assertThat(mEligibleCardChecker.isSliceToggleable(slice)).isTrue();
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EligibleCardCheckerTest method isCardEligibleToDisplay_toggleSlice_hasInlineActionShouldBeTrue.
@Test
public void isCardEligibleToDisplay_toggleSlice_hasInlineActionShouldBeTrue() {
final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
final Slice slice = wifiSlice.getSlice();
doReturn(slice).when(mEligibleCardChecker).bindSlice(any(Uri.class));
mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(TEST_SLICE_URI));
assertThat(mEligibleCardChecker.mCard.hasInlineAction()).isTrue();
}
Aggregations