aboutsummaryrefslogtreecommitdiff
path: root/tests/test-timezone-file.cpp
diff options
context:
space:
mode:
authorIain Lane <iain.lane@canonical.com>2015-09-01 10:52:13 +0100
committerIain Lane <iain.lane@canonical.com>2015-09-01 10:52:13 +0100
commita3937830bf656d5a8e2f368757b947cef0c8b1de (patch)
tree7a965b3f4a2cf3c1ba3fd4c701cfb75e8ed397e8 /tests/test-timezone-file.cpp
parentf016debfbaac39f509f5947b098c141a03a3b65f (diff)
downloadayatana-indicator-datetime-a3937830bf656d5a8e2f368757b947cef0c8b1de.tar.gz
ayatana-indicator-datetime-a3937830bf656d5a8e2f368757b947cef0c8b1de.tar.bz2
ayatana-indicator-datetime-a3937830bf656d5a8e2f368757b947cef0c8b1de.zip
Rename FileTimezone to TimedatedTimezone
Diffstat (limited to 'tests/test-timezone-file.cpp')
-rw-r--r--tests/test-timezone-file.cpp73
1 files changed, 0 insertions, 73 deletions
diff --git a/tests/test-timezone-file.cpp b/tests/test-timezone-file.cpp
deleted file mode 100644
index 0ec496d..0000000
--- a/tests/test-timezone-file.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/*
- * Copyright 2013 Canonical Ltd.
- *
- * Authors:
- * Charles Kerr <charles.kerr@canonical.com>
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 3, as published
- * by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranties of
- * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "timedated-fixture.h"
-
-#include <datetime/timezone-file.h>
-
-#include <cstdio> // fopen()
-//#include <sys/stat.h> // chmod()
-#include <unistd.h> // sync()
-
-using unity::indicator::datetime::FileTimezone;
-
-/**
- * Test that timezone-file picks up the initial value
- */
-TEST_F(TimedateFixture, InitialValue)
-{
- const std::string expected_timezone = "America/Chicago";
- set_timezone(expected_timezone);
- FileTimezone tz;
- ASSERT_EQ(expected_timezone, tz.timezone.get());
-}
-
-/**
- * Test that changing the tz after we are running works.
- */
-TEST_F(TimedateFixture, ChangedValue)
-{
- const std::string initial_timezone = "America/Chicago";
- const std::string changed_timezone = "America/New_York";
- GMainLoop *l = g_main_loop_new(nullptr, FALSE);
-
- set_timezone(initial_timezone);
-
- FileTimezone tz;
- ASSERT_EQ(initial_timezone, tz.timezone.get());
-
- bool changed = false;
- tz.timezone.changed().connect(
- [&changed, this, l](const std::string& s){
- g_message("timezone changed to %s", s.c_str());
- changed = true;
- g_main_loop_quit(l);
- });
-
- g_idle_add([](gpointer gself){
- static_cast<TimedateFixture*>(gself)->set_timezone("America/New_York");
- return G_SOURCE_REMOVE;
- }, this);
-
- g_main_loop_run(l);
-
- ASSERT_TRUE(changed);
- ASSERT_EQ(changed_timezone, tz.timezone.get());
-}