Adds the Swipe Up settings page under gestures

The illusteration video is not included yet.

Merged-In: I7f2b2f3251a795dfd74dbbb442692e42a5a2966e
Bug: 77549883
Test: Unit tests and Manual test
Change-Id: I04f01f0814f16e4e006291e61ddb07cea8e7c0d6
This commit is contained in:
Mehdi Alizadeh
2018-04-03 18:51:07 -07:00
parent 631ee514ae
commit 528fe0ca14
8 changed files with 271 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.gestures;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.UserManager;
import android.provider.Settings;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
public class SwipeUpPreferenceControllerTest {
private Context mContext;
private SwipeUpPreferenceController mController;
private static final String KEY_SWIPE_UP = "gesture_swipe_up";
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mController = new SwipeUpPreferenceController(mContext, KEY_SWIPE_UP);
}
@Test
public void testIsChecked_configIsSet_shouldReturnTrue() {
// Set the setting to be enabled.
mController.setChecked(true);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void testIsChecked_configIsNotSet_shouldReturnFalse() {
// Set the setting to be disabled.
mController.setChecked(false);
assertThat(mController.isChecked()).isFalse();
}
}