-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Implemented "Huge" font size setting feature request (Issue #115).
2. Added Android Testing Framework project to the main project. 3. Wrote unit tests using JUnit to unit test changes for Issue #115.
- Loading branch information
1 parent
b302eaa
commit 82e6620
Showing
13 changed files
with
230 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.andrewshu.android.reddit.test" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
<uses-sdk android:minSdkVersion="4" /> | ||
<instrumentation android:targetPackage="com.andrewshu.android.reddit" android:name="android.test.InstrumentationTestRunner" /> | ||
<application android:icon="@drawable/icon" android:label="@string/app_name"> | ||
|
||
<uses-library android:name="android.test.runner" /> | ||
</application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system use, | ||
# "build.properties", and override values to adapt the script to your | ||
# project structure. | ||
|
||
# Project target. | ||
target=android-7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-optimizationpasses 5 | ||
-dontusemixedcaseclassnames | ||
-dontskipnonpubliclibraryclasses | ||
-dontpreverify | ||
-verbose | ||
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* | ||
|
||
-keep public class * extends android.app.Activity | ||
-keep public class * extends android.app.Application | ||
-keep public class * extends android.app.Service | ||
-keep public class * extends android.content.BroadcastReceiver | ||
-keep public class * extends android.content.ContentProvider | ||
-keep public class * extends android.app.backup.BackupAgentHelper | ||
-keep public class * extends android.preference.Preference | ||
-keep public class com.android.vending.licensing.ILicensingService | ||
|
||
-keepclasseswithmembernames class * { | ||
native <methods>; | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet); | ||
} | ||
|
||
-keepclasseswithmembernames class * { | ||
public <init>(android.content.Context, android.util.AttributeSet, int); | ||
} | ||
|
||
-keepclassmembers enum * { | ||
public static **[] values(); | ||
public static ** valueOf(java.lang.String); | ||
} | ||
|
||
-keep class * implements android.os.Parcelable { | ||
public static final android.os.Parcelable$Creator *; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
> | ||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/hello" | ||
/> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="hello">Hello World!</string> | ||
<string name="app_name">reddit is funTest</string> | ||
</resources> |
90 changes: 90 additions & 0 deletions
90
tests/src/com/andrewshu/android/reddit/test/RedditIsFunUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.andrewshu.android.reddit.test; | ||
|
||
import java.lang.reflect.Array; | ||
import java.util.Arrays; | ||
|
||
import com.andrewshu.android.reddit.Constants; | ||
import com.andrewshu.android.reddit.Util; | ||
import com.andrewshu.android.reddit.R; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class RedditIsFunUtilTest extends TestCase { | ||
|
||
public void testIsLightTheme() | ||
{ | ||
|
||
boolean result = Util.isLightTheme(R.style.Reddit_Light_Medium) && | ||
Util.isLightTheme(R.style.Reddit_Light_Large) && | ||
Util.isLightTheme(R.style.Reddit_Light_Larger) && | ||
Util.isLightTheme(R.style.Reddit_Light_Huge); | ||
|
||
assertTrue(result); | ||
|
||
} | ||
|
||
public void testIsDarkTheme() | ||
{ | ||
|
||
boolean result = Util.isDarkTheme(R.style.Reddit_Dark_Medium) && | ||
Util.isDarkTheme(R.style.Reddit_Dark_Large) && | ||
Util.isDarkTheme(R.style.Reddit_Dark_Larger) && | ||
Util.isDarkTheme(R.style.Reddit_Dark_Huge); | ||
|
||
assertTrue(result); | ||
|
||
} | ||
|
||
public void testGetInvertedTheme() | ||
{ | ||
|
||
assertEquals("GetInvertedTheme From Dark to Light Failed", R.style.Reddit_Dark_Huge, Util.getInvertedTheme(R.style.Reddit_Light_Huge)); | ||
|
||
assertEquals("GetInvertedTheme From Light to Dark Failed", R.style.Reddit_Light_Huge, Util.getInvertedTheme(R.style.Reddit_Dark_Huge)); | ||
|
||
} | ||
|
||
public void testGetThemeResourceFromPrefs() | ||
{ | ||
|
||
assertEquals("GetThemeResourceFromPrefs for Dark Theme Failed", R.style.Reddit_Dark_Huge, Util.getThemeResourceFromPrefs(Constants.PREF_THEME_DARK, Constants.PREF_TEXT_SIZE_HUGE)); | ||
|
||
assertEquals("GetThemeResourceFromPrefs for Light Theme Failed", R.style.Reddit_Light_Huge, Util.getThemeResourceFromPrefs(Constants.PREF_THEME_LIGHT, Constants.PREF_TEXT_SIZE_HUGE)); | ||
|
||
} | ||
|
||
public void testGetPrefsFromThemeResource() | ||
{ | ||
|
||
boolean blnResultForDarkTheme; | ||
boolean blnResultForLightTheme; | ||
|
||
String [] astrDarkHugePrefs = new String[] { Constants.PREF_THEME_DARK, Constants.PREF_TEXT_SIZE_HUGE }; | ||
String [] astrLightHugePrefs = new String[] { Constants.PREF_THEME_LIGHT, Constants.PREF_TEXT_SIZE_HUGE }; | ||
|
||
blnResultForDarkTheme = Arrays.equals(astrDarkHugePrefs, Util.getPrefsFromThemeResource(R.style.Reddit_Dark_Huge)); | ||
blnResultForLightTheme = Arrays.equals(astrLightHugePrefs, Util.getPrefsFromThemeResource(R.style.Reddit_Light_Huge)); | ||
|
||
assertTrue(blnResultForDarkTheme && blnResultForLightTheme); | ||
|
||
} | ||
|
||
public void testGetTextAppearanceResource() | ||
{ | ||
|
||
assertEquals("GetTextAppearanceResource for Dark Theme Small Text Failed", R.style.TextAppearance_Huge_Small, Util.getTextAppearanceResource(R.style.Reddit_Dark_Huge, android.R.style.TextAppearance_Small)); | ||
|
||
assertEquals("GetTextAppearanceResource for Dark Theme Medium Text Failed", R.style.TextAppearance_Huge_Medium, Util.getTextAppearanceResource(R.style.Reddit_Dark_Huge, android.R.style.TextAppearance_Medium)); | ||
|
||
assertEquals("GetTextAppearanceResource for Dark Theme Large Text Failed", R.style.TextAppearance_Huge_Large, Util.getTextAppearanceResource(R.style.Reddit_Dark_Huge, android.R.style.TextAppearance_Large)); | ||
|
||
assertEquals("GetTextAppearanceResource for Light Theme Small Text Failed", R.style.TextAppearance_Huge_Small, Util.getTextAppearanceResource(R.style.Reddit_Light_Huge, android.R.style.TextAppearance_Small)); | ||
|
||
assertEquals("GetTextAppearanceResource for Light Theme Medium Text Failed", R.style.TextAppearance_Huge_Medium, Util.getTextAppearanceResource(R.style.Reddit_Light_Huge, android.R.style.TextAppearance_Medium)); | ||
|
||
assertEquals("GetTextAppearanceResource for Light Theme Large Text Failed", R.style.TextAppearance_Huge_Large, Util.getTextAppearanceResource(R.style.Reddit_Light_Huge, android.R.style.TextAppearance_Large)); | ||
|
||
|
||
} | ||
|
||
} |