From c940b70c65b1550fe65dbad5841adfe906cf0cdf Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 14 Mar 2015 21:31:42 -0500 Subject: use the new DateTime::start_of_day() and DateTime::start_of_minute() functions. --- tests/test-alarm-queue.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'tests/test-alarm-queue.cpp') diff --git a/tests/test-alarm-queue.cpp b/tests/test-alarm-queue.cpp index 12ffe92..0492539 100644 --- a/tests/test-alarm-queue.cpp +++ b/tests/test-alarm-queue.cpp @@ -68,12 +68,8 @@ protected: std::vector build_some_appointments() { const auto now = m_state->clock->localtime(); - 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); + const auto tomorrow_begin = now.add_days(1).start_of_day(); + const auto tomorrow_end = tomorrow_begin.add_full(0, 0, 1, 0, 0, -1); Appointment a1; // an alarm clock appointment a1.color = "red"; @@ -84,8 +80,8 @@ protected: a1.begin = tomorrow_begin; a1.end = tomorrow_end; - auto ubermorgen_begin = g_date_time_add_days (tomorrow, 1); - auto ubermorgen_end = g_date_time_add_full (tomorrow_begin, 0, 0, 1, 0, 0, -1); + const auto ubermorgen_begin = now.add_days(2).start_of_day(); + const auto ubermorgen_end = ubermorgen_begin.add_full(0, 0, 1, 0, 0, -1); Appointment a2; // a non-alarm appointment a2.color = "green"; @@ -96,13 +92,6 @@ protected: a2.begin = ubermorgen_begin; a2.end = ubermorgen_end; - // cleanup - g_date_time_unref(ubermorgen_end); - g_date_time_unref(ubermorgen_begin); - g_date_time_unref(tomorrow_end); - g_date_time_unref(tomorrow_begin); - g_date_time_unref(tomorrow); - return std::vector({a1, a2}); } }; -- cgit v1.2.3