diff options
author | Sara Ting <sarating@google.com> | 2012-04-19 10:41:56 -0700 |
---|---|---|
committer | Sara Ting <sarating@google.com> | 2012-04-19 13:25:31 -0700 |
commit | 4e92627c5eb10de50c49c57e116b080d48360c70 (patch) | |
tree | d1b68f99a7a7fd383e16c12bd01d31495ac9a602 /tests | |
parent | 1f2534fa594749d41f50171477c049c96cc14101 (diff) | |
download | android_packages_apps_Calendar-4e92627c5eb10de50c49c57e116b080d48360c70.tar.gz android_packages_apps_Calendar-4e92627c5eb10de50c49c57e116b080d48360c70.tar.bz2 android_packages_apps_Calendar-4e92627c5eb10de50c49c57e116b080d48360c70.zip |
Fixed missing event name from the event info details, and changed datetime description to display "Today at <time>" or "Tomorrow at <time>".
Change-Id: I5d529214f65eba38b661d074704ed3ef5e6b5428
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/calendar/UtilsTests.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/src/com/android/calendar/UtilsTests.java b/tests/src/com/android/calendar/UtilsTests.java index 11181b60..60e63c8a 100644 --- a/tests/src/com/android/calendar/UtilsTests.java +++ b/tests/src/com/android/calendar/UtilsTests.java @@ -19,6 +19,7 @@ package com.android.calendar; import com.android.calendar.CalendarUtils.TimeZoneUtils; import android.content.res.Configuration; +import android.content.res.Resources.NotFoundException; import android.database.MatrixCursor; import android.provider.CalendarContract.CalendarCache; import android.test.mock.MockResources; @@ -92,6 +93,20 @@ public class UtilsTests extends TestCase { } @Override + public String getString(int id, Object... formatArgs) { + if (id == R.string.today_at_time_fmt) { + return String.format("Today at %s", formatArgs); + } + if (id == R.string.tomorrow_at_time_fmt) { + return String.format("Tomorrow at %s", formatArgs); + } + if (id == R.string.date_time_fmt) { + return String.format("%s, %s", formatArgs); + } + throw new IllegalArgumentException("unexpected resource ID: " + id); + } + + @Override public Configuration getConfiguration() { Configuration config = new Configuration(); config.locale = Locale.getDefault(); @@ -397,7 +412,7 @@ public class UtilsTests extends TestCase { long end = createTimeInMillis(0, 0, 18, NOW_DAY, NOW_MONTH, NOW_YEAR); String result = Utils.getDisplayedDatetime(start, end, NOW_TIME, DEFAULT_TIMEZONE, DEFAULT_TIMEZONE, false, dbUtils.getContext()); - assertEquals("Today, 5:00pm \u2013 6:00pm", result); + assertEquals("Today at 5:00pm \u2013 6:00pm", result); } @SmallTest @@ -407,7 +422,7 @@ public class UtilsTests extends TestCase { long end = createTimeInMillis(0, 0, 0, NOW_DAY + 1, NOW_MONTH, NOW_YEAR); String result = Utils.getDisplayedDatetime(start, end, NOW_TIME, DEFAULT_TIMEZONE, DEFAULT_TIMEZONE, false, dbUtils.getContext()); - assertEquals("Today, 5:00pm \u2013 midnight", result); + assertEquals("Today at 5:00pm \u2013 midnight", result); } @SmallTest @@ -417,7 +432,7 @@ public class UtilsTests extends TestCase { long end = createTimeInMillis(0, 59, 23, NOW_DAY + 1, NOW_MONTH, NOW_YEAR); String result = Utils.getDisplayedDatetime(start, end, NOW_TIME, DEFAULT_TIMEZONE, DEFAULT_TIMEZONE, false, dbUtils.getContext()); - assertEquals("Tomorrow, 12:01am \u2013 11:59pm", result); + assertEquals("Tomorrow at 12:01am \u2013 11:59pm", result); } @SmallTest @@ -501,4 +516,6 @@ public class UtilsTests extends TestCase { Time.TIMEZONE_UTC, true, dbUtils.getContext()); assertEquals("Tomorrow", result); } + + // TODO: add tests for army time. } |