use of androidx.slice.SliceItem in project android_packages_apps_Settings by omnirom.
the class WifiSliceTest method getWifiSlice_noAp_shouldReturnLoadingRow.
@Test
public void getWifiSlice_noAp_shouldReturnLoadingRow() {
final Slice wifiSlice = mWifiSlice.getSlice();
final int rows = SliceQuery.findAll(wifiSlice, FORMAT_SLICE, HINT_LIST_ITEM, null).size();
final List<SliceItem> sliceItems = wifiSlice.getItems();
// All AP rows + title row
assertThat(rows).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT + 1);
// Has scanning text
SliceTester.assertAnySliceItemContainsSubtitle(sliceItems, mContext.getString(R.string.wifi_empty_list_wifi_on));
}
use of androidx.slice.SliceItem in project android_packages_apps_Settings by omnirom.
the class WifiSliceTest method getWifiSlice_oneConnectedApAndOneDisconnectedAp_shouldReturnLoadingRow.
@Test
public void getWifiSlice_oneConnectedApAndOneDisconnectedAp_shouldReturnLoadingRow() {
setWorkerResults(createWifiSliceItem(AP1_NAME, WifiEntry.CONNECTED_STATE_CONNECTED), createWifiSliceItem(AP2_NAME, WifiEntry.CONNECTED_STATE_DISCONNECTED));
final Slice wifiSlice = mWifiSlice.getSlice();
final List<SliceItem> sliceItems = wifiSlice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, AP1_NAME);
SliceTester.assertAnySliceItemContainsTitle(sliceItems, AP2_NAME);
// Has scanning text
SliceTester.assertAnySliceItemContainsSubtitle(sliceItems, mContext.getString(R.string.wifi_empty_list_wifi_on));
}
use of androidx.slice.SliceItem in project android_packages_apps_Settings by omnirom.
the class WifiCallingSliceHelperTest method assertTitle.
private void assertTitle(List<SliceItem> sliceItems, String title) {
boolean hasTitle = false;
for (SliceItem item : sliceItems) {
final List<SliceItem> titleItems = SliceQuery.findAll(item, FORMAT_TEXT, HINT_TITLE, null);
if (titleItems == null) {
continue;
}
hasTitle = true;
for (SliceItem subTitleItem : titleItems) {
assertThat(subTitleItem.getText()).isEqualTo(title);
}
}
assertThat(hasTitle).isTrue();
}
use of androidx.slice.SliceItem in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageSliceTest method getSlice_hasNoSim_shouldShowNoSimCard.
@Test
public void getSlice_hasNoSim_shouldShowNoSimCard() {
ShadowDataUsageUtils.HAS_SIM = false;
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 List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, mContext.getString(R.string.no_sim_card));
}
use of androidx.slice.SliceItem in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDevicesSliceTest method getSlice_hasBluetoothDevices_shouldMatchBluetoothMockTitle.
@Test
public void getSlice_hasBluetoothDevices_shouldMatchBluetoothMockTitle() {
mockBluetoothDeviceList(1);
doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
final Slice slice = mBluetoothDevicesSlice.getSlice();
final List<SliceItem> sliceItems = slice.getItems();
SliceTester.assertAnySliceItemContainsTitle(sliceItems, BLUETOOTH_MOCK_TITLE);
}
Aggregations