junit for android app
authorBartek Przybylski <bart.p.pl@gmail.com>
Sat, 29 Sep 2012 23:14:38 +0000 (01:14 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sat, 29 Sep 2012 23:14:38 +0000 (01:14 +0200)
12 files changed:
.project
tests/.classpath [new file with mode: 0644]
tests/.project [new file with mode: 0644]
tests/AndroidManifest.xml [new file with mode: 0644]
tests/proguard-project.txt [new file with mode: 0644]
tests/project.properties [new file with mode: 0644]
tests/res/drawable-hdpi/ic_launcher.png [new file with mode: 0644]
tests/res/drawable-ldpi/ic_launcher.png [new file with mode: 0644]
tests/res/drawable-mdpi/ic_launcher.png [new file with mode: 0644]
tests/res/drawable-xhdpi/ic_launcher.png [new file with mode: 0644]
tests/res/values/strings.xml [new file with mode: 0644]
tests/src/com/owncloud/android/test/AccountUtilsTest.java [new file with mode: 0644]

index a131114..27eaad6 100644 (file)
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>ownCloud</name>
+       <name>owncloud-android</name>
        <comment></comment>
        <projects>
        </projects>
diff --git a/tests/.classpath b/tests/.classpath
new file mode 100644 (file)
index 0000000..f8cb89d
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/owncloud-android"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/tests/.project b/tests/.project
new file mode 100644 (file)
index 0000000..eea585b
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>owncloud-android-tests</name>
+       <comment></comment>
+       <projects>
+               <project>owncloud-android</project>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..bc65d1c
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.owncloud.android.test"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk android:minSdkVersion="8" />
+
+    <instrumentation
+        android:name="android.test.InstrumentationTestRunner"
+        android:targetPackage="com.owncloud.android" />
+
+    <application
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name" >
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/tests/proguard-project.txt b/tests/proguard-project.txt
new file mode 100644 (file)
index 0000000..f2fe155
--- /dev/null
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/tests/project.properties b/tests/project.properties
new file mode 100644 (file)
index 0000000..8937e94
--- /dev/null
@@ -0,0 +1,14 @@
+# 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 edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-14
diff --git a/tests/res/drawable-hdpi/ic_launcher.png b/tests/res/drawable-hdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..96a442e
Binary files /dev/null and b/tests/res/drawable-hdpi/ic_launcher.png differ
diff --git a/tests/res/drawable-ldpi/ic_launcher.png b/tests/res/drawable-ldpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..9923872
Binary files /dev/null and b/tests/res/drawable-ldpi/ic_launcher.png differ
diff --git a/tests/res/drawable-mdpi/ic_launcher.png b/tests/res/drawable-mdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..359047d
Binary files /dev/null and b/tests/res/drawable-mdpi/ic_launcher.png differ
diff --git a/tests/res/drawable-xhdpi/ic_launcher.png b/tests/res/drawable-xhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..71c6d76
Binary files /dev/null and b/tests/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml
new file mode 100644 (file)
index 0000000..eec0107
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">Owncloud-android-testsTest</string>
+
+</resources>
\ No newline at end of file
diff --git a/tests/src/com/owncloud/android/test/AccountUtilsTest.java b/tests/src/com/owncloud/android/test/AccountUtilsTest.java
new file mode 100644 (file)
index 0000000..582e968
--- /dev/null
@@ -0,0 +1,26 @@
+package com.owncloud.android.test;
+
+import org.junit.Test;
+
+import com.owncloud.android.AccountUtils;
+import com.owncloud.android.utils.OwnCloudVersion;
+
+import junit.framework.TestCase;
+
+public class AccountUtilsTest extends TestCase {
+    
+    @Test
+    public void testGetWebdavPath() {
+        OwnCloudVersion ocv12 = new OwnCloudVersion(0x010200);
+        OwnCloudVersion ocv22 = new OwnCloudVersion(0x020200);
+        OwnCloudVersion ocv30 = new OwnCloudVersion(0x030000);
+        OwnCloudVersion ocv45 = new OwnCloudVersion(0x040500);
+        OwnCloudVersion ocv70 = new OwnCloudVersion(0x070000);
+        assertTrue(AccountUtils.getWebdavPath(ocv12).equals("/webdav/owncloud.php"));
+        assertTrue(AccountUtils.getWebdavPath(ocv22).equals("/files/webdav.php"));
+        assertTrue(AccountUtils.getWebdavPath(ocv30).equals("/files/webdav.php"));
+        assertTrue(AccountUtils.getWebdavPath(ocv45).equals("/remote.php/webdav"));
+        assertTrue(AccountUtils.getWebdavPath(ocv70).equals("/remote.php/webdav"));
+    }
+
+}