aboutsummaryrefslogtreecommitdiff
path: root/tests/test-alarm-queue.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-03-14 21:31:42 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-03-14 21:31:42 -0500
commitc940b70c65b1550fe65dbad5841adfe906cf0cdf (patch)
tree141b128f526f719b09069e5b06e2ee0c9678bea7 /tests/test-alarm-queue.cpp
parentdb5b700c7c116c73283019b3fbf823a23639a405 (diff)
downloadayatana-indicator-datetime-c940b70c65b1550fe65dbad5841adfe906cf0cdf.tar.gz
ayatana-indicator-datetime-c940b70c65b1550fe65dbad5841adfe906cf0cdf.tar.bz2
ayatana-indicator-datetime-c940b70c65b1550fe65dbad5841adfe906cf0cdf.zip
use the new DateTime::start_of_day() and DateTime::start_of_minute() functions.
Diffstat (limited to 'tests/test-alarm-queue.cpp')
-rw-r--r--tests/test-alarm-queue.cpp19
1 files changed, 4 insertions, 15 deletions
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<Appointment> 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<Appointment>({a1, a2});
}
};