diff options
author | Nancy Chen <nancychen@google.com> | 2015-10-28 18:04:42 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2015-11-03 14:42:50 -0800 |
commit | 0e1bfc32db89820e86262a0587dd90263c78caeb (patch) | |
tree | 56ba74b8787dfefd97e97cdde663953e096e95e0 /InCallUI/tests/src/com/android/incallui | |
parent | 4cda82096ee60dbb7e65be3ef0c5b2604c249bde (diff) |
Fix Open Now in Contact Context to account for after midnight times.
Originally the close time was set to the same date as the open time, but
sometimes a place is open past midnight, which means that it's open
until the next day. Update this so that Open Now correctly represents
the state even when the place is open past midnight.
Bug: 25345785
Change-Id: I417ecb046bb2d5f708279f2b3808af0afd7662c7
Diffstat (limited to 'InCallUI/tests/src/com/android/incallui')
-rw-r--r-- | InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java b/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java index b97be01ee..50d0aaf6c 100644 --- a/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java +++ b/InCallUI/tests/src/com/android/incallui/InCallContactInteractionsTest.java @@ -44,6 +44,26 @@ public class InCallContactInteractionsTest extends AndroidTestCase { assertEquals(mContext.getString(R.string.open_now), info.heading); } + public void testIsOpenNow_ClosingAfterMidnight() { + Calendar currentTimeForTest = Calendar.getInstance(); + currentTimeForTest.set(Calendar.HOUR_OF_DAY, 10); + BusinessContextInfo info = + mInCallContactInteractions.constructHoursInfo( + currentTimeForTest, + Pair.create("0800", "0100")); + assertEquals(mContext.getString(R.string.open_now), info.heading); + } + + public void testIsOpenNow_Open24Hours() { + Calendar currentTimeForTest = Calendar.getInstance(); + currentTimeForTest.set(Calendar.HOUR_OF_DAY, 10); + BusinessContextInfo info = + mInCallContactInteractions.constructHoursInfo( + currentTimeForTest, + Pair.create("0800", "0800")); + assertEquals(mContext.getString(R.string.open_now), info.heading); + } + public void testIsClosedNow_BeforeOpen() { Calendar currentTimeForTest = Calendar.getInstance(); currentTimeForTest.set(Calendar.HOUR_OF_DAY, 6); |