aboutsummaryrefslogtreecommitdiff
path: root/tests/test-timezones.cpp
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-30 02:38:51 +0200
committerRobert Tari <robert@tari.in>2021-08-30 02:40:00 +0200
commit0e8d75b5ba5eac277e3fbf964effd6c118a9da6b (patch)
tree0738d4519fb21633af326bfe7e452c3fcaa1f56a /tests/test-timezones.cpp
parent22e66866c7b17fc655479ca911269b86cb80a744 (diff)
parent2d853c12ad91cb0ac066a60397cabc61631be5c1 (diff)
downloadayatana-indicator-datetime-0e8d75b5ba5eac277e3fbf964effd6c118a9da6b.tar.gz
ayatana-indicator-datetime-0e8d75b5ba5eac277e3fbf964effd6c118a9da6b.tar.bz2
ayatana-indicator-datetime-0e8d75b5ba5eac277e3fbf964effd6c118a9da6b.zip
Merge branch 'tari01-pr/fix-failing-tests'
Attributes GH PR #47: https://github.com/AyatanaIndicators/ayatana-indicator-datetime/pull/47
Diffstat (limited to 'tests/test-timezones.cpp')
-rw-r--r--tests/test-timezones.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/tests/test-timezones.cpp b/tests/test-timezones.cpp
index 362fcf7..7144aaf 100644
--- a/tests/test-timezones.cpp
+++ b/tests/test-timezones.cpp
@@ -18,10 +18,10 @@
*/
#include "geoclue-fixture.h"
-
+#include "timezone-mock.h"
#include <datetime/settings.h>
#include <datetime/timezones-live.h>
-
+#include <datetime/timezone-timedated.h>
#include <memory> // std::shared_ptr
#include <cstdio> // fopen()
@@ -53,7 +53,8 @@ TEST_F(TimezonesFixture, ManagerTest)
set_file(timezone_file);
auto settings = std::make_shared<Settings>();
- LiveTimezones z(settings, TIMEZONE_FILE);
+ auto timezone = std::make_shared<MockTimezone>(timezone_file);
+ LiveTimezones z(settings, timezone);
wait_msec(500); // wait for the bus to get set up
EXPECT_EQ(timezone_file, z.timezone.get());
auto zones = z.timezones.get();
@@ -105,20 +106,6 @@ TEST_F(TimezonesFixture, ManagerTest)
EXPECT_EQ(2, zones.size());
EXPECT_EQ(1, zones.count(timezone_file));
EXPECT_EQ(1, zones.count(timezone_geo));
-
- // now set the file value... this should change both the primary property and set property
- zone_changed = false;
- zones_changed = false;
- timezone_file = "America/Los_Angeles";
- EXPECT_EQ(0, zones.count(timezone_file));
- g_idle_add([](gpointer str) {set_file(static_cast<const char*>(str)); return G_SOURCE_REMOVE;}, const_cast<char*>(timezone_file.c_str()));
- g_main_loop_run(loop);
- EXPECT_TRUE(zone_changed);
- EXPECT_TRUE(zones_changed);
- EXPECT_EQ(timezone_file, z.timezone.get());
- EXPECT_EQ(2, zones.size());
- EXPECT_EQ(1, zones.count(timezone_file));
- EXPECT_EQ(1, zones.count(timezone_geo));
}