aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-06-08 14:18:37 -0700
committerAdnan Begovic <adnan@cyngn.com>2016-06-13 11:35:38 -0700
commit0e0cb73c61508cf61f59da90b63baf45b6309202 (patch)
tree04fb2ef4d91205e1e6947084f9200cec122aa646 /tests
parent2add3de26702b4568dd7af1c460a49b754d0ff74 (diff)
downloadvendor_cmsdk-0e0cb73c61508cf61f59da90b63baf45b6309202.zip
vendor_cmsdk-0e0cb73c61508cf61f59da90b63baf45b6309202.tar.gz
vendor_cmsdk-0e0cb73c61508cf61f59da90b63baf45b6309202.tar.bz2
cmsdk: Provide test coverage to Profile's *Settings classes.
Change-Id: I775cdd00e7e5cfbead681d548075f44d5799bccf TICKET: CYNGNOS-3027
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/AirplaneModeSettingsTest.java52
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/BrightnessSettingsTest.java49
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/ConnectionSettingsTest.java71
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/LockSettingsTest.java39
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/RingModeSettingsTest.java49
-rw-r--r--tests/src/org/cyanogenmod/tests/profiles/unit/StreamSettingsTest.java58
6 files changed, 318 insertions, 0 deletions
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/AirplaneModeSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/AirplaneModeSettingsTest.java
new file mode 100644
index 0000000..d77639b
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/AirplaneModeSettingsTest.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.profiles.AirplaneModeSettings;
+
+public class AirplaneModeSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructWholly() {
+ AirplaneModeSettings airplaneModeSettings =
+ new AirplaneModeSettings(
+ AirplaneModeSettings.BooleanState.STATE_ENABLED, true);
+ assertEquals(AirplaneModeSettings.BooleanState.STATE_ENABLED, airplaneModeSettings.getValue());
+ assertEquals(true, airplaneModeSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyOverride() {
+ AirplaneModeSettings airplaneModeSettings =
+ new AirplaneModeSettings(
+ AirplaneModeSettings.BooleanState.STATE_ENABLED, true);
+ airplaneModeSettings.setOverride(false);
+ assertEquals(false, airplaneModeSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ int expectedValue = AirplaneModeSettings.BooleanState.STATE_DISALED;
+ AirplaneModeSettings airplaneModeSettings =
+ new AirplaneModeSettings(
+ AirplaneModeSettings.BooleanState.STATE_ENABLED, true);
+ airplaneModeSettings.setValue(expectedValue);
+ assertEquals(expectedValue, airplaneModeSettings.getValue());
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/BrightnessSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/BrightnessSettingsTest.java
new file mode 100644
index 0000000..bb725e8
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/BrightnessSettingsTest.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.profiles.BrightnessSettings;
+
+public class BrightnessSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructWholly() {
+ BrightnessSettings brightnessSettings =
+ new BrightnessSettings(0, true);
+ assertEquals(0, brightnessSettings.getValue());
+ assertEquals(true, brightnessSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyOverride() {
+ BrightnessSettings brightnessSettings =
+ new BrightnessSettings(0, true);
+ brightnessSettings.setOverride(false);
+ assertEquals(false, brightnessSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ int expectedValue = 30;
+ BrightnessSettings brightnessSettings =
+ new BrightnessSettings(0, true);
+ brightnessSettings.setValue(expectedValue);
+ assertEquals(expectedValue, brightnessSettings.getValue());
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/ConnectionSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/ConnectionSettingsTest.java
new file mode 100644
index 0000000..780c0df
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/ConnectionSettingsTest.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.profiles.ConnectionSettings;
+
+public class ConnectionSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructManually() {
+ ConnectionSettings connectionSettings = new ConnectionSettings(
+ ConnectionSettings.PROFILE_CONNECTION_GPS);
+ assertEquals(ConnectionSettings.PROFILE_CONNECTION_GPS,
+ connectionSettings.getConnectionId());
+ assertNotNull(connectionSettings);
+ }
+
+ @SmallTest
+ public void testConstructWholly() {
+ ConnectionSettings connectionSettings =
+ new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_GPS,
+ ConnectionSettings.BooleanState.STATE_DISALED, true);
+ assertEquals(true, connectionSettings.isOverride());
+ assertEquals(ConnectionSettings.BooleanState.STATE_DISALED,
+ connectionSettings.getValue());
+ assertEquals(ConnectionSettings.PROFILE_CONNECTION_GPS,
+ connectionSettings.getConnectionId());
+ assertNotNull(connectionSettings);
+ }
+
+ @SmallTest
+ public void testVerifyOverride() {
+ ConnectionSettings connectionSettings = new ConnectionSettings(
+ ConnectionSettings.PROFILE_CONNECTION_GPS);
+ connectionSettings.setOverride(true);
+ assertEquals(true, connectionSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifySubId() {
+ int expectedSubId = 2;
+ ConnectionSettings connectionSettings = new ConnectionSettings(
+ ConnectionSettings.PROFILE_CONNECTION_2G3G4G);
+ connectionSettings.setSubId(expectedSubId);
+ assertEquals(expectedSubId, connectionSettings.getSubId());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ int expectedValue = ConnectionSettings.BooleanState.STATE_DISALED;
+ ConnectionSettings connectionSettings = new ConnectionSettings(
+ ConnectionSettings.PROFILE_CONNECTION_2G3G4G);
+ connectionSettings.setValue(expectedValue);
+ assertEquals(expectedValue, connectionSettings.getValue());
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/LockSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/LockSettingsTest.java
new file mode 100644
index 0000000..9da3c0f
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/LockSettingsTest.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.app.Profile;
+import cyanogenmod.profiles.LockSettings;
+
+public class LockSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructWholly() {
+ LockSettings lockSettings = new LockSettings(Profile.LockMode.INSECURE);
+ assertEquals(Profile.LockMode.INSECURE, lockSettings.getValue());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ int expectedValue = Profile.LockMode.DEFAULT;
+ LockSettings lockSettings = new LockSettings(Profile.LockMode.INSECURE);
+ lockSettings.setValue(expectedValue);
+ assertEquals(expectedValue, lockSettings.getValue());
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/RingModeSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/RingModeSettingsTest.java
new file mode 100644
index 0000000..de2ae93
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/RingModeSettingsTest.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.profiles.RingModeSettings;
+
+public class RingModeSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructWholly() {
+ RingModeSettings ringSettings = new RingModeSettings(
+ RingModeSettings.RING_MODE_MUTE, true);
+ assertEquals(RingModeSettings.RING_MODE_MUTE, ringSettings.getValue());
+ assertEquals(true, ringSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyOverride() {
+ RingModeSettings ringSettings = new RingModeSettings(
+ RingModeSettings.RING_MODE_MUTE, true);
+ ringSettings.setOverride(false);
+ assertEquals(false, ringSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ String expectedValue = RingModeSettings.RING_MODE_NORMAL;
+ RingModeSettings ringSettings = new RingModeSettings(
+ RingModeSettings.RING_MODE_MUTE, true);
+ ringSettings.setValue(expectedValue);
+ assertEquals(expectedValue, ringSettings.getValue());
+ }
+}
diff --git a/tests/src/org/cyanogenmod/tests/profiles/unit/StreamSettingsTest.java b/tests/src/org/cyanogenmod/tests/profiles/unit/StreamSettingsTest.java
new file mode 100644
index 0000000..8bf806b
--- /dev/null
+++ b/tests/src/org/cyanogenmod/tests/profiles/unit/StreamSettingsTest.java
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2016, The CyanogenMod 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 org.cyanogenmod.tests.profiles.unit;
+
+import android.media.AudioManager;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import cyanogenmod.profiles.StreamSettings;
+
+public class StreamSettingsTest extends AndroidTestCase {
+
+ @SmallTest
+ public void testConstructManually() {
+ StreamSettings streamSettings =
+ new StreamSettings(AudioManager.STREAM_RING);
+ assertEquals(AudioManager.STREAM_RING, streamSettings.getStreamId());
+ }
+
+ @SmallTest
+ public void testConstructWholly() {
+ StreamSettings streamSettings =
+ new StreamSettings(AudioManager.STREAM_RING, 0, true);
+ assertEquals(AudioManager.STREAM_RING, streamSettings.getStreamId());
+ assertEquals(0, streamSettings.getValue());
+ assertEquals(true, streamSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyOverride() {
+ StreamSettings streamSettings =
+ new StreamSettings(AudioManager.STREAM_RING);
+ streamSettings.setOverride(true);
+ assertEquals(true, streamSettings.isOverride());
+ }
+
+ @SmallTest
+ public void testVerifyValue() {
+ int expectedValue = AudioManager.STREAM_ALARM;
+ StreamSettings streamSettings =
+ new StreamSettings(AudioManager.STREAM_RING);
+ streamSettings.setValue(expectedValue);
+ assertEquals(expectedValue, streamSettings.getValue());
+ }
+}