cmsdk: Provide test coverage to Profile's *Settings classes.
Change-Id: I775cdd00e7e5cfbead681d548075f44d5799bccf TICKET: CYNGNOS-3027
This commit is contained in:
parent
2add3de267
commit
0e0cb73c61
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue