From c0055ef9118a7a284b26d164617985236a2d432a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 15 Sep 2014 14:49:20 -0500 Subject: add unit tests for the powerd monitor --- include/datetime/clock-mock.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/datetime') diff --git a/include/datetime/clock-mock.h b/include/datetime/clock-mock.h index fb9b52f..0e24377 100644 --- a/include/datetime/clock-mock.h +++ b/include/datetime/clock-mock.h @@ -41,15 +41,23 @@ public: DateTime localtime() const { return m_localtime; } - void set_localtime(const DateTime& dt) { + void set_localtime(const DateTime& dt) + { const auto old = m_localtime; - m_localtime = dt; + + set_localtime_quietly(dt); + if (!DateTime::is_same_minute(old, m_localtime)) minute_changed(); if (!DateTime::is_same_day(old, m_localtime)) date_changed(); } + void set_localtime_quietly(const DateTime& dt) + { + m_localtime = dt; + } + private: DateTime m_localtime; }; -- cgit v1.2.3