Search in sources :

Example 11 with Slice

use of androidx.slice.Slice 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());
}
Also used : Slice(androidx.slice.Slice) IconCompat(androidx.core.graphics.drawable.IconCompat) SliceMetadata(androidx.slice.SliceMetadata) SliceAction(androidx.slice.core.SliceAction) Test(org.junit.Test)

Example 12 with Slice

use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelperTest method test_CreateWifiCallingPreferenceSlice_wfcOff.

@Test
public void test_CreateWifiCallingPreferenceSlice_wfcOff() {
    when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
    when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
    when(mMockImsManager.isWfcEnabledByUser()).thenReturn(false);
    when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
    mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
    final Slice slice = mWfcSliceHelper.createWifiCallingPreferenceSlice(CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI);
    assertThat(mWfcSliceHelper.getDefaultVoiceSubId()).isEqualTo(1);
    testWifiCallingSettingsUnavailableSlice(slice, null, getActivityIntent(WifiCallingSliceHelper.ACTION_WIFI_CALLING_SETTINGS_ACTIVITY), mContext.getString(R.string.wifi_calling_mode_title));
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Example 13 with Slice

use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelperTest method test_CreateWifiCallingSlice_invalidSubId.

@Test
public void test_CreateWifiCallingSlice_invalidSubId() {
    mWfcSliceHelper.setDefaultVoiceSubId(-1);
    final Slice slice = mWfcSliceHelper.createWifiCallingSlice(CustomSliceRegistry.WIFI_CALLING_URI);
    assertThat(slice).isNull();
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Example 14 with Slice

use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelperTest method test_SettingsSliceProvider_getWfcPreferenceSlice.

@Test
public void test_SettingsSliceProvider_getWfcPreferenceSlice() {
    when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(true);
    when(mMockImsManager.isWfcProvisionedOnDevice()).thenReturn(true);
    when(mMockImsManager.isWfcEnabledByUser()).thenReturn(true);
    when(mMockImsManager.isNonTtyOrTtyOnVolteEnabled()).thenReturn(true);
    when(mMockImsManager.getWfcMode(false)).thenReturn(ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED);
    when(mSlicesFeatureProvider.getNewWifiCallingSliceHelper(mContext)).thenReturn(mWfcSliceHelper);
    mWfcSliceHelper.setIsWifiCallingPrefEditable(true);
    final Slice slice = mProvider.onBindSlice(CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI);
    assertThat(mWfcSliceHelper.getDefaultVoiceSubId()).isEqualTo(1);
    testWifiCallingPreferenceSlice(slice, null, getActivityIntent(WifiCallingSliceHelper.ACTION_WIFI_CALLING_SETTINGS_ACTIVITY));
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Example 15 with Slice

use of androidx.slice.Slice in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiCallingSliceHelperTest method test_CreateWifiCallingSlice_wfcNotSupported.

@Test
public void test_CreateWifiCallingSlice_wfcNotSupported() {
    when(mMockImsManager.isWfcEnabledByPlatform()).thenReturn(false);
    final Slice slice = mWfcSliceHelper.createWifiCallingSlice(CustomSliceRegistry.WIFI_CALLING_URI);
    assertThat(mWfcSliceHelper.getDefaultVoiceSubId()).isEqualTo(1);
    assertThat(slice).isNull();
}
Also used : Slice(androidx.slice.Slice) Test(org.junit.Test)

Aggregations

Slice (androidx.slice.Slice)216 Test (org.junit.Test)204 SliceMetadata (androidx.slice.SliceMetadata)73 SliceAction (androidx.slice.core.SliceAction)28 SliceItem (androidx.slice.SliceItem)22 Config (org.robolectric.annotation.Config)20 Uri (android.net.Uri)17 ParceledListSlice (android.content.pm.ParceledListSlice)14 IconCompat (androidx.core.graphics.drawable.IconCompat)14 ContextualWifiSlice (com.android.settings.wifi.slice.ContextualWifiSlice)9 PrivateStorageInfo (com.android.settingslib.deviceinfo.PrivateStorageInfo)9 UiThreadTest (androidx.test.annotation.UiThreadTest)8 VisibleForTesting (androidx.annotation.VisibleForTesting)5 EmergencyInfoSlice (com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice)5 ArrayList (java.util.ArrayList)5 PendingIntent (android.app.PendingIntent)4 Intent (android.content.Intent)4 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)4 EarlyWarningTip (com.android.settings.fuelgauge.batterytip.tips.EarlyWarningTip)4 LowBatteryTip (com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)4