diff --git a/AndroidManifest.xml b/AndroidManifest.xml index cf337eb4..1b001d4f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,7 +2,7 @@ + android:versionName="0.2" > + + + + + + + + + + + \ No newline at end of file diff --git a/test/assets/vcard3-sample1.vcf b/test/assets/vcard3-sample1.vcf new file mode 100644 index 00000000..f5c9f977 --- /dev/null +++ b/test/assets/vcard3-sample1.vcf @@ -0,0 +1,16 @@ +BEGIN:VCARD +VERSION:3.0 +N:Gump;Forrest +FN:Forrest Gump +ORG:Bubba Gump Shrimp Co. +TITLE:Shrimp Man +PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif +TEL;TYPE=WORK,VOICE:(111) 555-1212 +TEL;TYPE=HOME,VOICE:(404) 555-1212 +ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America +LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America +ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America +LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America +EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com +REV:2008-04-24T19:52:43Z +END:VCARD \ No newline at end of file diff --git a/test/proguard-project.txt b/test/proguard-project.txt new file mode 100644 index 00000000..f2fe1559 --- /dev/null +++ b/test/proguard-project.txt @@ -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/test/project.properties b/test/project.properties new file mode 100644 index 00000000..a3ee5ab6 --- /dev/null +++ b/test/project.properties @@ -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-17 diff --git a/test/res/drawable-hdpi/ic_launcher.png b/test/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 00000000..96a442e5 Binary files /dev/null and b/test/res/drawable-hdpi/ic_launcher.png differ diff --git a/test/res/drawable-ldpi/ic_launcher.png b/test/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 00000000..99238729 Binary files /dev/null and b/test/res/drawable-ldpi/ic_launcher.png differ diff --git a/test/res/drawable-mdpi/ic_launcher.png b/test/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 00000000..359047df Binary files /dev/null and b/test/res/drawable-mdpi/ic_launcher.png differ diff --git a/test/res/drawable-xhdpi/ic_launcher.png b/test/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 00000000..71c6d760 Binary files /dev/null and b/test/res/drawable-xhdpi/ic_launcher.png differ diff --git a/test/res/values/strings.xml b/test/res/values/strings.xml new file mode 100644 index 00000000..eb6df3d5 --- /dev/null +++ b/test/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + DavdroidTestTest + + diff --git a/test/src/at/bitfire/davdroid/resource/ContactTest.java b/test/src/at/bitfire/davdroid/resource/ContactTest.java new file mode 100644 index 00000000..13c148f5 --- /dev/null +++ b/test/src/at/bitfire/davdroid/resource/ContactTest.java @@ -0,0 +1,36 @@ +package at.bitfire.davdroid.resource; + +import java.io.IOException; +import java.io.InputStream; + +import junit.framework.Assert; +import android.content.res.AssetManager; +import android.test.InstrumentationTestCase; + +public class ContactTest extends InstrumentationTestCase { + AssetManager assetMgr; + + public void setUp() { + assetMgr = getInstrumentation().getContext().getResources().getAssets(); + } + + + public void testParseVcard3() throws IOException { + String fname = "vcard3-sample1.vcf"; + InputStream in = assetMgr.open(fname, AssetManager.ACCESS_STREAMING); + + Contact c = new Contact(fname, null); + c.parseEntity(in); + + Assert.assertEquals("Forrest Gump", c.getDisplayName()); + Assert.assertEquals("Forrest", c.getGivenName()); + Assert.assertEquals("Gump", c.getFamilyName()); + + Assert.assertEquals(2, c.getPhoneNumbers().size()); + Assert.assertEquals("(111) 555-1212", c.getPhoneNumbers().get(0).getText()); + + Assert.assertEquals(1, c.getEmails().size()); + Assert.assertEquals("forrestgump@example.com", c.getEmails().get(0).getValue()); + } + +}