aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-09-16 14:55:30 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-09-16 14:55:30 -0500
commitdc501b4b28452b097da0703cc77867377340ed13 (patch)
tree3ae5a01cd394c030465b42c5d71efdda500f83cf /tests
parentf337a0fd3b8040d83b2433a8076f70fea345edad (diff)
downloadayatana-indicator-datetime-dc501b4b28452b097da0703cc77867377340ed13.tar.gz
ayatana-indicator-datetime-dc501b4b28452b097da0703cc77867377340ed13.tar.bz2
ayatana-indicator-datetime-dc501b4b28452b097da0703cc77867377340ed13.zip
LiveClock only needs one Timezone, so give it that instead of a Timezones object
Diffstat (limited to 'tests')
-rw-r--r--tests/test-clock.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/test-clock.cpp b/tests/test-clock.cpp
index a4924b3..cbe13f3 100644
--- a/tests/test-clock.cpp
+++ b/tests/test-clock.cpp
@@ -18,9 +18,10 @@
*/
#include <datetime/clock.h>
-#include <datetime/timezones.h>
+#include <datetime/timezone.h>
#include "test-dbus-fixture.h"
+#include "timezone-mock.h"
/***
****
@@ -49,9 +50,9 @@ class ClockFixture: public TestDBusFixture
TEST_F(ClockFixture, MinuteChangedSignalShouldTriggerOncePerMinute)
{
// start up a live clock
- std::shared_ptr<Timezones> zones(new Timezones);
- zones->timezone.set("America/New_York");
- LiveClock clock(zones);
+ auto timezone_ = std::make_shared<MockTimezone>();
+ timezone_->timezone.set("America/New_York");
+ LiveClock clock(timezone_);
wait_msec(500); // wait for the bus to set up
// count how many times clock.minute_changed() is emitted over the next minute
@@ -74,17 +75,17 @@ TEST_F(ClockFixture, MinuteChangedSignalShouldTriggerOncePerMinute)
TEST_F(ClockFixture, HelloFixture)
{
- std::shared_ptr<Timezones> zones(new Timezones);
- zones->timezone.set("America/New_York");
- LiveClock clock(zones);
+ auto timezone_ = std::make_shared<MockTimezone>();
+ timezone_->timezone.set("America/New_York");
+ LiveClock clock(timezone_);
}
TEST_F(ClockFixture, TimezoneChangeTriggersSkew)
{
- std::shared_ptr<Timezones> zones(new Timezones);
- zones->timezone.set("America/New_York");
- LiveClock clock(zones);
+ auto timezone_ = std::make_shared<MockTimezone>();
+ timezone_->timezone.set("America/New_York");
+ LiveClock clock(timezone_);
auto tz_nyc = g_time_zone_new("America/New_York");
auto now_nyc = g_date_time_new_now(tz_nyc);
@@ -99,9 +100,9 @@ TEST_F(ClockFixture, TimezoneChangeTriggersSkew)
g_main_loop_quit(loop);
});
g_idle_add([](gpointer gs){
- static_cast<Timezones*>(gs)->timezone.set("America/Los_Angeles");
+ static_cast<Timezone*>(gs)->timezone.set("America/Los_Angeles");
return G_SOURCE_REMOVE;
- }, zones.get());
+ }, timezone_.get());
g_main_loop_run(loop);
auto tz_la = g_time_zone_new("America/Los_Angeles");
@@ -118,9 +119,9 @@ TEST_F(ClockFixture, TimezoneChangeTriggersSkew)
*/
TEST_F(ClockFixture, SleepTriggersSkew)
{
- std::shared_ptr<Timezones> zones(new Timezones);
- zones->timezone.set("America/New_York");
- LiveClock clock(zones);
+ auto timezone_ = std::make_shared<MockTimezone>();
+ timezone_->timezone.set("America/New_York");
+ LiveClock clock(timezone_);
wait_msec(500); // wait for the bus to set up
bool skewed = false;