diff options
author | Michael W <baddaemon87@gmail.com> | 2019-01-06 19:36:00 +0100 |
---|---|---|
committer | Michael W <baddaemon87@gmail.com> | 2019-01-06 19:36:06 +0100 |
commit | 034c3c79dc788173929492f98ae36d1c78269c9c (patch) | |
tree | c0d8728b28efce880a2193da0bffdb1bcf286fdd /packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java | |
parent | 915e52eda2602558843fa5355861e79e993c65d9 (diff) | |
download | lineage-sdk-034c3c79dc788173929492f98ae36d1c78269c9c.tar.gz lineage-sdk-034c3c79dc788173929492f98ae36d1c78269c9c.tar.bz2 lineage-sdk-034c3c79dc788173929492f98ae36d1c78269c9c.zip |
Revert "Automatic translation import"
This reverts commit 5f06011a755307465238b04a6ce933472a7d9321.
Change-Id: I1b951cb63fd0b6628d87243a068ab4c083075f5a
Diffstat (limited to 'packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java')
-rw-r--r-- | packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java new file mode 100644 index 00000000..101a60f4 --- /dev/null +++ b/packages/LineageSettingsProvider/tests/src/org/lineageos/lineagesettings/tests/LineageSettingsSystemTests.java @@ -0,0 +1,126 @@ +/** + * 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.lineageos.lineagesettings.tests; + +import android.content.ContentResolver; +import android.net.Uri; +import android.test.AndroidTestCase; +import android.test.suitebuilder.annotation.SmallTest; +import lineageos.providers.LineageSettings; + +public class LineageSettingsSystemTests extends AndroidTestCase { + private ContentResolver mContentResolver; + + private static final String UNREALISTIC_SETTING = "_______UNREAL_______"; + + @Override + protected void setUp() throws Exception { + super.setUp(); + mContentResolver = mContext.getContentResolver(); + } + + @SmallTest + public void testFloat() { + final float expectedFloatValue = 1.0f; + LineageSettings.System.putFloat(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER, expectedFloatValue); + + try { + float actualValue = LineageSettings.System.getFloat(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + assertEquals(expectedFloatValue, actualValue); + } catch (LineageSettings.LineageSettingNotFoundException e) { + throw new AssertionError(e); + } + } + + @SmallTest + public void testFloatWithDefault() { + final float expectedDefaultFloatValue = 1.5f; + float actualValue = LineageSettings.System.getFloat(mContentResolver, + UNREALISTIC_SETTING, expectedDefaultFloatValue); + assertEquals(expectedDefaultFloatValue, actualValue); + } + + @SmallTest + public void testInt() { + final int expectedIntValue = 2; + LineageSettings.System.putInt(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER, expectedIntValue); + + try { + int actualValue = LineageSettings.System.getInt(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + assertEquals(expectedIntValue, actualValue); + } catch (LineageSettings.LineageSettingNotFoundException e) { + throw new AssertionError(e); + } + } + + @SmallTest + public void testIntWithDefault() { + final int expectedDefaultIntValue = 11; + int actualValue = LineageSettings.System.getInt(mContentResolver, + UNREALISTIC_SETTING, expectedDefaultIntValue); + assertEquals(expectedDefaultIntValue, actualValue); + } + + @SmallTest + public void testLong() { + final long expectedLongValue = 3l; + LineageSettings.System.putLong(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER, expectedLongValue); + + try { + long actualValue = LineageSettings.System.getLong(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + assertEquals(expectedLongValue, actualValue); + } catch (LineageSettings.LineageSettingNotFoundException e) { + throw new AssertionError(e); + } + } + + @SmallTest + public void testLongWithDefault() { + final long expectedDefaultLongValue = 17l; + long actualValue = LineageSettings.System.getLong(mContentResolver, + UNREALISTIC_SETTING, expectedDefaultLongValue); + assertEquals(expectedDefaultLongValue, actualValue); + } + + @SmallTest + public void testString() { + final String expectedStringValue = "4"; + LineageSettings.System.putString(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER, expectedStringValue); + + String actualValue = LineageSettings.System.getString(mContentResolver, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + assertEquals(expectedStringValue, actualValue); + } + + @SmallTest + public void testGetUri() { + final Uri expectedUri = Uri.withAppendedPath(LineageSettings.System.CONTENT_URI, + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + + final Uri actualUri = LineageSettings.System.getUriFor( + LineageSettings.System.__MAGICAL_TEST_PASSING_ENABLER); + + assertEquals(expectedUri, actualUri); + } +} |