summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorMichael Chan <mchan@android.com>2010-03-11 17:52:48 -0800
committerErik <roboerik@android.com>2010-03-16 16:05:31 -0700
commitff6be831fc682374be6b78c13ecf5daca81f86d9 (patch)
treefce33f1b3554a45099c2d5bfd0b88cba9cb847d9 /tests/src
parent16d119af4234cba88a54990fdef9a125f6d377db (diff)
downloadandroid_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.tar.gz
android_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.tar.bz2
android_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.zip
b/2494603 Improve UI to disambiguate calendars with the same name
Added checks for calendars with duplicated names and if found will now include the owner e-mail with the display name. Also did some minor layout changes for German ( b/2516982 ). And started a tests class for Utils. Change-Id: I567c6552a8c17b2c7e73d23312ac60f5dc85a1ec
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/calendar/UtilsTests.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/src/com/android/calendar/UtilsTests.java b/tests/src/com/android/calendar/UtilsTests.java
new file mode 100644
index 00000000..e8159ba6
--- /dev/null
+++ b/tests/src/com/android/calendar/UtilsTests.java
@@ -0,0 +1,63 @@
+package com.android.calendar;
+
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import junit.framework.TestCase;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test class for verifying helper functions in Calendar's Utils
+ *
+ * You can run these tests with the following command:
+ * "adb shell am instrument -w -e class com.android.calendar.UtilsTests
+ * com.android.calendar.tests/android.test.InstrumentationTestRunner"
+ */
+public class UtilsTests extends TestCase {
+ HashMap<String, Boolean> mIsDuplicateName;
+ HashMap<String, Boolean> mIsDuplicateNameExpected;
+ MatrixCursor mDuplicateNameCursor;
+
+ private static final int NAME_COLUMN = 0;
+ private static final String[] DUPLICATE_NAME_COLUMNS = new String[] { "name" };
+ private static final String[][] DUPLICATE_NAMES = new String[][] {
+ {"Pepper Pots"},
+ {"Green Goblin"},
+ {"Pepper Pots"},
+ {"Peter Parker"},
+ {"Silver Surfer"},
+ {"John Jameson"},
+ {"John Jameson"},
+ {"Pepper Pots"}
+ };
+
+ @Override
+ public void setUp() {
+ mIsDuplicateName = new HashMap<String, Boolean> ();
+ mDuplicateNameCursor = new MatrixCursor(DUPLICATE_NAME_COLUMNS);
+ for (int i = 0; i < DUPLICATE_NAMES.length; i++) {
+ mDuplicateNameCursor.addRow(DUPLICATE_NAMES[i]);
+ }
+
+ mIsDuplicateNameExpected = new HashMap<String, Boolean> ();
+ mIsDuplicateNameExpected.put("Pepper Pots", true);
+ mIsDuplicateNameExpected.put("Green Goblin", false);
+ mIsDuplicateNameExpected.put("Peter Parker", false);
+ mIsDuplicateNameExpected.put("Silver Surfer", false);
+ mIsDuplicateNameExpected.put("John Jameson", true);
+ }
+
+ @Override
+ public void tearDown() {
+ mDuplicateNameCursor.close();
+ }
+
+ @SmallTest
+ public void testCheckForDuplicateNames() {
+ Utils.checkForDuplicateNames(mIsDuplicateName, mDuplicateNameCursor, NAME_COLUMN);
+ assertEquals(mIsDuplicateName, mIsDuplicateNameExpected);
+ }
+}