use of androidx.slice.Slice 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.Slice 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.Slice 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.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputSliceTest method getSlice_callStateRinging_shouldReturnZeroRow.
@Test
public void getSlice_callStateRinging_shouldReturnZeroRow() {
mShadowTelephonyManager.setCallState(TelephonyManager.CALL_STATE_RINGING);
final Slice slice = mMediaOutputSlice.getSlice();
final int rows = SliceQuery.findAll(slice, FORMAT_SLICE, HINT_LIST_ITEM, null).size();
assertThat(rows).isEqualTo(0);
}
use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MediaOutputSliceTest method getSlice_workerIsNull_shouldReturnZeroRow.
@Test
public void getSlice_workerIsNull_shouldReturnZeroRow() {
mMediaOutputSlice.init(TEST_PACKAGE_NAME, null);
final Slice slice = mMediaOutputSlice.getSlice();
final int rows = SliceQuery.findAll(slice, FORMAT_SLICE, HINT_LIST_ITEM, null).size();
assertThat(rows).isEqualTo(0);
}
Aggregations