diff options
Diffstat (limited to 'tests/test-live-actions.cpp')
-rw-r--r-- | tests/test-live-actions.cpp | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp index 1197e3e..1a34511 100644 --- a/tests/test-live-actions.cpp +++ b/tests/test-live-actions.cpp @@ -346,9 +346,7 @@ TEST_F(LiveActionsFixture, PhoneOpenSettingsApp) TEST_F(LiveActionsFixture, CalendarState) { // init the clock - auto tmp = g_date_time_new_local (2014, 1, 1, 0, 0, 0); - const DateTime now (tmp); - g_date_time_unref (tmp); + auto now = DateTime::Local(2014, 1, 1, 0, 0, 0); m_mock_state->mock_clock->set_localtime (now); m_state->calendar_month->month().set(now); //m_state->planner->time.set(now); @@ -388,12 +386,9 @@ TEST_F(LiveActionsFixture, CalendarState) /// Now add appointments to the planner and confirm that the state keeps in sync /// - auto tomorrow = g_date_time_add_days (now.get(), 1); - auto tomorrow_begin = g_date_time_add_full (tomorrow, 0, 0, 0, - -g_date_time_get_hour(tomorrow), - -g_date_time_get_minute(tomorrow), - -g_date_time_get_seconds(tomorrow)); - auto tomorrow_end = g_date_time_add_full (tomorrow_begin, 0, 0, 1, 0, 0, -1); + auto tomorrow = now.add_days(1); + auto tomorrow_begin = tomorrow.start_of_day(); + auto tomorrow_end = tomorrow.end_of_day(); Appointment a1; a1.color = "green"; a1.summary = "write unit tests"; @@ -402,15 +397,16 @@ TEST_F(LiveActionsFixture, CalendarState) a1.begin = tomorrow_begin; a1.end = tomorrow_end; - auto next_begin = g_date_time_add_days (tomorrow_begin, 1); - auto next_end = g_date_time_add_full (next_begin, 0, 0, 1, 0, 0, -1); + auto ubermorgen = now.add_days(2); + auto ubermorgen_begin = ubermorgen.start_of_day(); + auto ubermorgen_end = ubermorgen.end_of_day(); Appointment a2; a2.color = "orange"; a2.summary = "code review"; a2.url = "http://www.ubuntu.com/"; a2.uid = "2756ff7de3745bbffd65d2e4779c37c7ca60d843"; - a2.begin = next_begin; - a2.end = next_end; + a2.begin = ubermorgen_begin; + a2.end = ubermorgen_end; m_state->calendar_month->appointments().set(std::vector<Appointment>({a1, a2})); @@ -424,19 +420,12 @@ TEST_F(LiveActionsFixture, CalendarState) EXPECT_TRUE (v != nullptr); int i; g_variant_get_child (v, 0, "i", &i); - EXPECT_EQ (g_date_time_get_day_of_month(a1.begin.get()), i); + EXPECT_EQ (a1.begin.day_of_month(), i); g_variant_get_child (v, 1, "i", &i); - EXPECT_EQ (g_date_time_get_day_of_month(a2.begin.get()), i); + EXPECT_EQ (a2.begin.day_of_month(), i); g_clear_pointer(&v, g_variant_unref); g_clear_pointer(&calendar_state, g_variant_unref); - // cleanup this step - g_date_time_unref (next_end); - g_date_time_unref (next_begin); - g_date_time_unref (tomorrow_end); - g_date_time_unref (tomorrow_begin); - g_date_time_unref (tomorrow); - /// /// Confirm that the action state's dictionary /// keeps in sync with settings.show_week_numbers |