Renaming gesture
Bug: 111414690 Test: manual Test: ReachGesturePreferenceControllerTest, ReachGestureSettingsTest Change-Id: I34cd4aacabc912122c553bf9c955a8ca4494230b
This commit is contained in:
@@ -37,41 +37,41 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class ReachGesturePreferenceControllerTest {
|
||||
public class WakeLockScreenGesturePreferenceControllerTest {
|
||||
|
||||
private static final String KEY_REACH = "gesture_reach";
|
||||
private static final String KEY_WAKE_LOCK_SCREEN = "gesture_wake_lock_screen";
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
|
||||
|
||||
private ReachGesturePreferenceController mController;
|
||||
private WakeLockScreenGesturePreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mController = new ReachGesturePreferenceController(mContext, KEY_REACH);
|
||||
mController = new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
|
||||
mController.setConfig(mAmbientDisplayConfiguration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_configIsSet_shouldReturnTrue() {
|
||||
// Set the setting to be enabled.
|
||||
when(mAmbientDisplayConfiguration.reachGestureEnabled(anyInt())).thenReturn(true);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(true);
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
|
||||
// Set the setting to be disabled.
|
||||
when(mAmbientDisplayConfiguration.reachGestureEnabled(anyInt())).thenReturn(false);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureEnabled(anyInt())).thenReturn(false);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gestureNotSupported_UNSUPPORTED_ON_DEVICE() {
|
||||
when(mAmbientDisplayConfiguration.reachGestureAvailable()).thenReturn(false);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(false);
|
||||
final int availabilityStatus = mController.getAvailabilityStatus();
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||
@@ -79,7 +79,7 @@ public class ReachGesturePreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gestureSupported_AVAILABLE() {
|
||||
when(mAmbientDisplayConfiguration.reachGestureAvailable()).thenReturn(true);
|
||||
when(mAmbientDisplayConfiguration.wakeLockScreenGestureAvailable()).thenReturn(true);
|
||||
final int availabilityStatus = mController.getAvailabilityStatus();
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(AVAILABLE);
|
||||
@@ -87,15 +87,15 @@ public class ReachGesturePreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final ReachGesturePreferenceController controller =
|
||||
new ReachGesturePreferenceController(mContext, "gesture_reach");
|
||||
final WakeLockScreenGesturePreferenceController controller =
|
||||
new WakeLockScreenGesturePreferenceController(mContext, KEY_WAKE_LOCK_SCREEN);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final ReachGesturePreferenceController controller =
|
||||
new ReachGesturePreferenceController(mContext, "bad_key");
|
||||
final WakeLockScreenGesturePreferenceController controller =
|
||||
new WakeLockScreenGesturePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
@@ -30,19 +30,19 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class ReachGestureSettingsTest {
|
||||
public class WakeLockScreenGestureSettingsTest {
|
||||
|
||||
private ReachGestureSettings mSettings;
|
||||
private WakeLockScreenGestureSettings mSettings;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mSettings = new ReachGestureSettings();
|
||||
mSettings = new WakeLockScreenGestureSettings();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_shouldIndexResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
ReachGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
WakeLockScreenGestureSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
RuntimeEnvironment.application, true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
Reference in New Issue
Block a user