Skip to content

Commit 985340a

Browse files
committed
Add test project
1 parent 1432035 commit 985340a

File tree

8 files changed

+107
-0
lines changed

8 files changed

+107
-0
lines changed

test/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/AndroidUtils"/>
6+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
7+
<classpathentry kind="output" path="bin"/>
8+
</classpath>

test/.project

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>AndroidUtilsTest</name>
4+
<comment></comment>
5+
<projects>
6+
<project>AndroidUtils</project>
7+
</projects>
8+
<buildSpec>
9+
<buildCommand>
10+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
16+
<arguments>
17+
</arguments>
18+
</buildCommand>
19+
<buildCommand>
20+
<name>org.eclipse.jdt.core.javabuilder</name>
21+
<arguments>
22+
</arguments>
23+
</buildCommand>
24+
<buildCommand>
25+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
26+
<arguments>
27+
</arguments>
28+
</buildCommand>
29+
</buildSpec>
30+
<natures>
31+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
32+
<nature>org.eclipse.jdt.core.javanature</nature>
33+
</natures>
34+
</projectDescription>

test/AndroidManifest.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.gramercysoftware.utils.test"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
<application android:icon="@drawable/icon" android:label="@string/app_name">
7+
8+
<uses-library android:name="android.test.runner" />
9+
</application>
10+
11+
<instrumentation android:targetPackage="com.gramercysoftware.utils" android:name="android.test.InstrumentationTestRunner" />
12+
</manifest>

test/default.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "build.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-3

test/res/drawable/icon.png

2.51 KB
Loading

test/res/layout/main.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:orientation="vertical"
4+
android:layout_width="fill_parent"
5+
android:layout_height="fill_parent"
6+
>
7+
<TextView
8+
android:layout_width="fill_parent"
9+
android:layout_height="wrap_content"
10+
android:text="@string/hello"
11+
/>
12+
</LinearLayout>

test/res/values/strings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="hello">Hello World!</string>
4+
<string name="app_name">AndroidUtilsTest</string>
5+
</resources>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.gramercysoftware.utils;
2+
3+
import junit.framework.TestCase;
4+
5+
public class StringUtilsTest extends TestCase {
6+
7+
public void testCenter() {
8+
assertEquals(" 1 ", StringUtils.center("1", 5));
9+
assertEquals("XX1XX", StringUtils.center("1", 5, "X"));
10+
}
11+
12+
public void testLeftPad() {
13+
assertEquals(" 1", StringUtils.leftPad("1", 2));
14+
assertEquals("XX1", StringUtils.leftPad("1", 2, "X"));
15+
}
16+
17+
public void testRightPad() {
18+
assertEquals("1 ", StringUtils.rightPad("1", 2));
19+
assertEquals("1XX", StringUtils.rightPad("1", 2, "X"));
20+
}
21+
22+
public void testRepeat() {
23+
assertEquals("XXX", StringUtils.repeat(3, "X"));
24+
}
25+
}

0 commit comments

Comments
 (0)