use of androidx.slice.SliceMetadata 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.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputIndicatorSliceTest method getSlice_noActiveDevice_verifyDefaultName.
@Test
public void getSlice_noActiveDevice_verifyDefaultName() {
mDevicesList.add(mA2dpDevice);
when(mA2dpProfile.getConnectedDevices()).thenReturn(mDevicesList);
when(mA2dpProfile.getActiveDevice()).thenReturn(null);
// Verify slice title and subtitle
final Slice mediaSlice = mMediaOutputIndicatorSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, mediaSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getText(R.string.media_output_title));
assertThat(metadata.getSubtitle()).isEqualTo(mContext.getText(R.string.media_output_default_summary));
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputIndicatorSliceTest method getSlice_A2dpDeviceActive_verifyName.
@Test
public void getSlice_A2dpDeviceActive_verifyName() {
mDevicesList.add(mA2dpDevice);
when(mA2dpProfile.getConnectedDevices()).thenReturn(mDevicesList);
when(mA2dpProfile.getActiveDevice()).thenReturn(mA2dpDevice);
final Slice mediaSlice = mMediaOutputIndicatorSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, mediaSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getText(R.string.media_output_title));
assertThat(metadata.getSubtitle()).isEqualTo(TEST_A2DP_DEVICE_NAME);
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputSliceTest method getSlice_shouldHaveActiveDeviceName.
@Test
public void getSlice_shouldHaveActiveDeviceName() {
mDevices.clear();
final MediaDevice device = mock(MediaDevice.class);
when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
when(device.getIcon()).thenReturn(mTestDrawable);
when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(device);
final Slice mediaSlice = mMediaOutputSlice.getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, mediaSlice);
final SliceAction primaryAction = metadata.getPrimaryAction();
assertThat(primaryAction.getTitle().toString()).isEqualTo(TEST_DEVICE_1_NAME);
}
use of androidx.slice.SliceMetadata in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocationSliceTest method getLocationSlice_correctSliceContent.
@Test
public void getLocationSlice_correctSliceContent() {
final Slice LocationSlice = new LocationSlice(mContext).getSlice();
final SliceMetadata metadata = SliceMetadata.from(mContext, LocationSlice);
assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.location_settings_title));
final List<SliceAction> toggles = metadata.getToggles();
assertThat(toggles).isEmpty();
final SliceAction primaryAction = metadata.getPrimaryAction();
final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext, com.android.internal.R.drawable.ic_signal_location);
assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
}
Aggregations