aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/datetime/actions-live.h24
-rw-r--r--include/datetime/actions.h2
-rw-r--r--include/datetime/clock-mock.h2
-rw-r--r--include/datetime/dbus-shared.h6
-rw-r--r--include/datetime/engine-eds.h6
-rw-r--r--include/datetime/engine-mock.h6
-rw-r--r--include/datetime/engine.h6
-rw-r--r--include/datetime/exporter.h2
-rw-r--r--include/datetime/formatter.h4
-rw-r--r--include/datetime/planner-range.h2
-rw-r--r--include/datetime/wakeup-timer-mainloop.h2
-rw-r--r--include/datetime/wakeup-timer-powerd.h2
-rw-r--r--include/notifications/awake.h2
-rw-r--r--include/notifications/haptic.h2
-rw-r--r--include/notifications/notifications.h2
-rw-r--r--src/engine-eds.cpp2
-rw-r--r--src/planner-snooze.cpp2
-rw-r--r--src/sound.cpp10
-rw-r--r--src/wakeup-timer-powerd.cpp2
-rw-r--r--tests/actions-mock.h2
-rw-r--r--tests/geoclue-fixture.h8
-rw-r--r--tests/glib-fixture.h13
-rw-r--r--tests/manual-test-snap.cpp2
-rw-r--r--tests/state-fixture.h24
-rw-r--r--tests/state-mock.h20
-rw-r--r--tests/test-actions.cpp4
-rw-r--r--tests/test-dbus-fixture.h14
-rw-r--r--tests/test-exporter.cpp10
-rw-r--r--tests/test-formatter.cpp12
-rw-r--r--tests/test-live-actions.cpp10
-rw-r--r--tests/test-locations.cpp4
-rw-r--r--tests/test-menus.cpp4
-rw-r--r--tests/test-settings.cpp4
-rw-r--r--tests/test-snap.cpp8
-rw-r--r--tests/test-timezone-file.cpp4
-rw-r--r--tests/test-timezones.cpp2
36 files changed, 146 insertions, 85 deletions
diff --git a/include/datetime/actions-live.h b/include/datetime/actions-live.h
index 0bf48a8..0214d65 100644
--- a/include/datetime/actions-live.h
+++ b/include/datetime/actions-live.h
@@ -36,21 +36,21 @@ namespace datetime {
class LiveActions: public Actions
{
public:
- LiveActions(const std::shared_ptr<State>& state_in);
- ~LiveActions() =default;
+ explicit LiveActions(const std::shared_ptr<State>& state_in);
+ virtual ~LiveActions() =default;
- bool desktop_has_calendar_app() const;
- void desktop_open_alarm_app();
- void desktop_open_appointment(const Appointment&);
- void desktop_open_calendar_app(const DateTime&);
- void desktop_open_settings_app();
+ bool desktop_has_calendar_app() const override;
+ void desktop_open_alarm_app() override;
+ void desktop_open_appointment(const Appointment&) override;
+ void desktop_open_calendar_app(const DateTime&) override;
+ void desktop_open_settings_app() override;
- void phone_open_alarm_app();
- void phone_open_appointment(const Appointment&);
- void phone_open_calendar_app(const DateTime&);
- void phone_open_settings_app();
+ void phone_open_alarm_app() override;
+ void phone_open_appointment(const Appointment&) override;
+ void phone_open_calendar_app(const DateTime&) override;
+ void phone_open_settings_app() override;
- void set_location(const std::string& zone, const std::string& name);
+ void set_location(const std::string& zone, const std::string& name) override;
protected:
virtual void execute_command(const std::string& command);
diff --git a/include/datetime/actions.h b/include/datetime/actions.h
index f59ef67..87cb676 100644
--- a/include/datetime/actions.h
+++ b/include/datetime/actions.h
@@ -61,7 +61,7 @@ public:
const std::shared_ptr<State> state() const;
protected:
- Actions(const std::shared_ptr<State>& state);
+ explicit Actions(const std::shared_ptr<State>& state);
virtual ~Actions();
private:
diff --git a/include/datetime/clock-mock.h b/include/datetime/clock-mock.h
index 0e24377..84fd860 100644
--- a/include/datetime/clock-mock.h
+++ b/include/datetime/clock-mock.h
@@ -36,7 +36,7 @@ namespace datetime {
class MockClock: public Clock
{
public:
- MockClock(const DateTime& dt): m_localtime(dt) {}
+ explicit MockClock(const DateTime& dt): m_localtime(dt) {}
~MockClock() =default;
DateTime localtime() const { return m_localtime; }
diff --git a/include/datetime/dbus-shared.h b/include/datetime/dbus-shared.h
index c09caa2..0c6b4be 100644
--- a/include/datetime/dbus-shared.h
+++ b/include/datetime/dbus-shared.h
@@ -18,8 +18,8 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#ifndef _INDICATOR_DATETIME_DBUS_SHARED_H_
-#define _INDICATOR_DATETIME_DBUS_SHARED_H_
+#ifndef INDICATOR_DATETIME_DBUS_SHARED_H
+#define INDICATOR_DATETIME_DBUS_SHARED_H
#define BUS_DATETIME_NAME "com.canonical.indicator.datetime"
#define BUS_DATETIME_PATH "/com/canonical/indicator/datetime"
@@ -29,4 +29,4 @@
#define BUS_POWERD_INTERFACE "com.canonical.powerd"
-#endif /* _INDICATOR_DATETIME_DBUS_SHARED_H_ */
+#endif /* INDICATOR_DATETIME_DBUS_SHARED_H */
diff --git a/include/datetime/engine-eds.h b/include/datetime/engine-eds.h
index 4b260a8..ebee838 100644
--- a/include/datetime/engine-eds.h
+++ b/include/datetime/engine-eds.h
@@ -17,8 +17,8 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#ifndef INDICATOR_DATETIME_ENGINE_EDS__H
-#define INDICATOR_DATETIME_ENGINE_EDS__H
+#ifndef INDICATOR_DATETIME_ENGINE_EDS_H
+#define INDICATOR_DATETIME_ENGINE_EDS_H
#include <datetime/engine.h>
@@ -72,4 +72,4 @@ private:
} // namespace indicator
} // namespace unity
-#endif // INDICATOR_DATETIME_ENGINE_EDS__H
+#endif // INDICATOR_DATETIME_ENGINE_EDS_H
diff --git a/include/datetime/engine-mock.h b/include/datetime/engine-mock.h
index ecbf102..4b25120 100644
--- a/include/datetime/engine-mock.h
+++ b/include/datetime/engine-mock.h
@@ -17,8 +17,8 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#ifndef INDICATOR_DATETIME_ENGINE_MOCK__H
-#define INDICATOR_DATETIME_ENGINE_MOCK__H
+#ifndef INDICATOR_DATETIME_ENGINE_MOCK_H
+#define INDICATOR_DATETIME_ENGINE_MOCK_H
#include <datetime/engine.h>
@@ -65,4 +65,4 @@ private:
} // namespace indicator
} // namespace unity
-#endif // INDICATOR_DATETIME_ENGINE_NOOP__H
+#endif // INDICATOR_DATETIME_ENGINE_MOCK_H
diff --git a/include/datetime/engine.h b/include/datetime/engine.h
index 2e8237e..56e9343 100644
--- a/include/datetime/engine.h
+++ b/include/datetime/engine.h
@@ -17,8 +17,8 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
-#ifndef INDICATOR_DATETIME_ENGINE__H
-#define INDICATOR_DATETIME_ENGINE__H
+#ifndef INDICATOR_DATETIME_ENGINE_H
+#define INDICATOR_DATETIME_ENGINE_H
#include <datetime/appointment.h>
#include <datetime/date-time.h>
@@ -65,4 +65,4 @@ protected:
} // namespace indicator
} // namespace unity
-#endif // INDICATOR_DATETIME_ENGINE__H
+#endif // INDICATOR_DATETIME_ENGINE_H
diff --git a/include/datetime/exporter.h b/include/datetime/exporter.h
index dd57263..211e7bb 100644
--- a/include/datetime/exporter.h
+++ b/include/datetime/exporter.h
@@ -39,7 +39,7 @@ namespace datetime {
class Exporter
{
public:
- Exporter(const std::shared_ptr<Settings>&);
+ explicit Exporter(const std::shared_ptr<Settings>&);
~Exporter();
core::Signal<>& name_lost();
diff --git a/include/datetime/formatter.h b/include/datetime/formatter.h
index 0d695e2..9b3699d 100644
--- a/include/datetime/formatter.h
+++ b/include/datetime/formatter.h
@@ -86,7 +86,7 @@ public:
std::string relative_format(GDateTime* then, GDateTime* then_end=nullptr) const;
protected:
- Formatter(const std::shared_ptr<const Clock>&);
+ explicit Formatter(const std::shared_ptr<const Clock>&);
virtual ~Formatter();
static const char* default_header_time_format(bool twelvehour, bool show_seconds);
@@ -126,7 +126,7 @@ private:
class PhoneFormatter: public Formatter
{
public:
- PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) {
+ explicit PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) {
header_format.set(default_header_time_format(is_locale_12h(), false));
}
};
diff --git a/include/datetime/planner-range.h b/include/datetime/planner-range.h
index 2ee2fa0..d638182 100644
--- a/include/datetime/planner-range.h
+++ b/include/datetime/planner-range.h
@@ -72,7 +72,7 @@ private:
core::Property<std::vector<Appointment>> m_appointments;
// we've got a GSignal tag here, so disable copying
- SimpleRangePlanner(const RangePlanner&) =delete;
+ explicit SimpleRangePlanner(const RangePlanner&) =delete;
SimpleRangePlanner& operator=(const RangePlanner&) =delete;
};
diff --git a/include/datetime/wakeup-timer-mainloop.h b/include/datetime/wakeup-timer-mainloop.h
index 480d728..86da8cf 100644
--- a/include/datetime/wakeup-timer-mainloop.h
+++ b/include/datetime/wakeup-timer-mainloop.h
@@ -39,7 +39,7 @@ namespace datetime {
class MainloopWakeupTimer: public WakeupTimer
{
public:
- MainloopWakeupTimer(const std::shared_ptr<Clock>&);
+ explicit MainloopWakeupTimer(const std::shared_ptr<Clock>&);
~MainloopWakeupTimer();
void set_wakeup_time (const DateTime&);
core::Signal<>& timeout();
diff --git a/include/datetime/wakeup-timer-powerd.h b/include/datetime/wakeup-timer-powerd.h
index 6adbbb8..f11febe 100644
--- a/include/datetime/wakeup-timer-powerd.h
+++ b/include/datetime/wakeup-timer-powerd.h
@@ -39,7 +39,7 @@ namespace datetime {
class PowerdWakeupTimer: public WakeupTimer
{
public:
- PowerdWakeupTimer(const std::shared_ptr<Clock>&);
+ explicit PowerdWakeupTimer(const std::shared_ptr<Clock>&);
~PowerdWakeupTimer();
void set_wakeup_time(const DateTime&);
core::Signal<>& timeout();
diff --git a/include/notifications/awake.h b/include/notifications/awake.h
index fd812c1..bc38817 100644
--- a/include/notifications/awake.h
+++ b/include/notifications/awake.h
@@ -36,7 +36,7 @@ namespace notifications {
class Awake
{
public:
- Awake(const std::string& app_name);
+ explicit Awake(const std::string& app_name);
~Awake();
private:
diff --git a/include/notifications/haptic.h b/include/notifications/haptic.h
index bfb5679..f4f1b4d 100644
--- a/include/notifications/haptic.h
+++ b/include/notifications/haptic.h
@@ -41,7 +41,7 @@ public:
MODE_PULSE
};
- Haptic(const Mode& mode = MODE_PULSE);
+ explicit Haptic(const Mode& mode = MODE_PULSE);
~Haptic();
private:
diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h
index 260b466..eb14c07 100644
--- a/include/notifications/notifications.h
+++ b/include/notifications/notifications.h
@@ -85,7 +85,7 @@ private:
class Engine
{
public:
- Engine(const std::string& app_name);
+ explicit Engine(const std::string& app_name);
~Engine();
/** @see Builder::set_action() */
diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp
index 58be0c4..c282a5c 100644
--- a/src/engine-eds.cpp
+++ b/src/engine-eds.cpp
@@ -285,7 +285,7 @@ private:
if (e_cal_client_get_view_finish (E_CAL_CLIENT(client), res, &view, &error))
{
// add the view to our collection
- e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, NULL);
+ e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, nullptr);
e_cal_client_view_start(view, &error);
g_debug("got a view for %s", e_cal_client_get_local_attachment_store(E_CAL_CLIENT(client)));
auto self = static_cast<Impl*>(gself);
diff --git a/src/planner-snooze.cpp b/src/planner-snooze.cpp
index 51ad0d2..29d5f06 100644
--- a/src/planner-snooze.cpp
+++ b/src/planner-snooze.cpp
@@ -46,7 +46,7 @@ public:
{
}
- virtual core::Property<std::vector<Appointment>>& appointments()
+ core::Property<std::vector<Appointment>>& appointments()
{
return m_appointments;
}
diff --git a/src/sound.cpp b/src/sound.cpp
index c6a7b0a..3a4b26f 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -113,17 +113,17 @@ private:
else if ((GST_MESSAGE_TYPE(msg) == GST_MESSAGE_STREAM_START) && (self->m_loop))
{
/* Set the media role if audio sink is pulsesink */
- GstElement *audio_sink = NULL;
- g_object_get(self->m_play, "audio-sink", &audio_sink, NULL);
+ GstElement *audio_sink = nullptr;
+ g_object_get(self->m_play, "audio-sink", &audio_sink, nullptr);
if (audio_sink)
{
- GstPluginFeature *feature = NULL;
+ GstPluginFeature *feature = nullptr;
feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory);
if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0)
{
std::string role_str("props,media.role=alarm");
- GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL);
- g_object_set(audio_sink, "stream-properties", props, NULL);
+ GstStructure *props = gst_structure_from_string(role_str.c_str(), nullptr);
+ g_object_set(audio_sink, "stream-properties", props, nullptr);
gst_structure_free(props);
}
gst_object_unref(audio_sink);
diff --git a/src/wakeup-timer-powerd.cpp b/src/wakeup-timer-powerd.cpp
index 42d93e7..3c4b322 100644
--- a/src/wakeup-timer-powerd.cpp
+++ b/src/wakeup-timer-powerd.cpp
@@ -195,7 +195,7 @@ private:
}
else
{
- const char* s = NULL;
+ const char* s = nullptr;
g_variant_get(ret, "(&s)", &s);
g_debug("%s %s::requestWakeup() sent cookie %s",
G_STRLOC, BUS_POWERD_NAME, s);
diff --git a/tests/actions-mock.h b/tests/actions-mock.h
index 77315c0..9421708 100644
--- a/tests/actions-mock.h
+++ b/tests/actions-mock.h
@@ -31,7 +31,7 @@ namespace datetime {
class MockActions: public Actions
{
public:
- MockActions(std::shared_ptr<State>& state_in): Actions(state_in) {}
+ explicit MockActions(const std::shared_ptr<State>& state_in): Actions(state_in) {}
~MockActions() =default;
enum Action { DesktopOpenAlarmApp,
diff --git a/tests/geoclue-fixture.h b/tests/geoclue-fixture.h
index 0c597d3..d028ec9 100644
--- a/tests/geoclue-fixture.h
+++ b/tests/geoclue-fixture.h
@@ -17,6 +17,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H
+#define INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H
+
#include "glib-fixture.h"
#include <libdbustest/dbus-test.h>
@@ -39,7 +42,7 @@ class GeoclueFixture : public GlibFixture
DbusTestDbusMockObject * obj_geo_addr = nullptr;
const std::string timezone_1 = "America/Denver";
- void SetUp ()
+ void SetUp () override
{
super::SetUp();
@@ -80,7 +83,7 @@ class GeoclueFixture : public GlibFixture
g_string_free (gstr, TRUE);
}
- virtual void TearDown ()
+ void TearDown () override
{
g_clear_object (&mock);
g_clear_object (&service);
@@ -148,3 +151,4 @@ public:
};
+#endif /* INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H */
diff --git a/tests/glib-fixture.h b/tests/glib-fixture.h
index 1914b8c..f888c59 100644
--- a/tests/glib-fixture.h
+++ b/tests/glib-fixture.h
@@ -17,6 +17,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
+#define INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
+
#include <map>
#include <glib.h>
@@ -29,6 +32,10 @@
class GlibFixture : public ::testing::Test
{
+ public:
+
+ virtual ~GlibFixture() =default;
+
private:
//GLogFunc realLogHandler;
@@ -59,7 +66,7 @@ class GlibFixture : public ::testing::Test
protected:
- virtual void SetUp()
+ virtual void SetUp() override
{
setlocale(LC_ALL, "C.UTF-8");
@@ -76,7 +83,7 @@ class GlibFixture : public ::testing::Test
}
- virtual void TearDown()
+ virtual void TearDown() override
{
#if 0
// confirm there aren't any unexpected log messages
@@ -136,3 +143,5 @@ class GlibFixture : public ::testing::Test
GMainLoop * loop;
};
+
+#endif /* INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H */
diff --git a/tests/manual-test-snap.cpp b/tests/manual-test-snap.cpp
index 369e6cd..d4d9ec9 100644
--- a/tests/manual-test-snap.cpp
+++ b/tests/manual-test-snap.cpp
@@ -47,7 +47,7 @@ namespace
GOptionEntry entries[] =
{
{ "volume", 'v', 0, G_OPTION_ARG_INT, &volume, "Volume level [1..100]", "volume" },
- { NULL }
+ { nullptr }
};
}
diff --git a/tests/state-fixture.h b/tests/state-fixture.h
index 7d8358e..e466a79 100644
--- a/tests/state-fixture.h
+++ b/tests/state-fixture.h
@@ -17,18 +17,30 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
+#ifndef INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H
+#define INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H
+
#include "glib-fixture.h"
#include "actions-mock.h"
#include "state-mock.h"
-using namespace unity::indicator::datetime;
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/***
+****
+***/
class StateFixture: public GlibFixture
{
private:
typedef GlibFixture super;
+public:
+ virtual ~StateFixture() =default;
+
protected:
std::shared_ptr<MockState> m_mock_state;
std::shared_ptr<State> m_state;
@@ -56,5 +68,15 @@ protected:
super::TearDown();
}
+
};
+/***
+****
+***/
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif /* INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H */
diff --git a/tests/state-mock.h b/tests/state-mock.h
index 792c60d..caa6393 100644
--- a/tests/state-mock.h
+++ b/tests/state-mock.h
@@ -17,12 +17,21 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
+#ifndef INDICATOR_DATETIME_STATE_MOCK_H
+#define INDICATOR_DATETIME_STATE_MOCK_H
+
#include "planner-mock.h"
#include <datetime/clock-mock.h>
#include <datetime/state.h>
-using namespace unity::indicator::datetime;
+namespace unity {
+namespace indicator {
+namespace datetime {
+
+/***
+****
+***/
class MockState: public State
{
@@ -47,3 +56,12 @@ public:
}
};
+/***
+****
+***/
+
+} // namespace datetime
+} // namespace indicator
+} // namespace unity
+
+#endif /* INDICATOR_DATETIME_STATE_MOCK_H */
diff --git a/tests/test-actions.cpp b/tests/test-actions.cpp
index 9f7856c..aefeac0 100644
--- a/tests/test-actions.cpp
+++ b/tests/test-actions.cpp
@@ -55,12 +55,12 @@ class ActionsFixture: public StateFixture
protected:
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
}
- virtual void TearDown()
+ void TearDown() override
{
super::TearDown();
}
diff --git a/tests/test-dbus-fixture.h b/tests/test-dbus-fixture.h
index db06be2..a894f11 100644
--- a/tests/test-dbus-fixture.h
+++ b/tests/test-dbus-fixture.h
@@ -17,6 +17,9 @@
* Charles Kerr <charles.kerr@canonical.com>
*/
+#ifndef INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H
+#define INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H
+
#include "glib-fixture.h"
/***
@@ -27,9 +30,10 @@ class TestDBusFixture: public GlibFixture
{
public:
- TestDBusFixture() {}
+ TestDBusFixture() =default;
+ virtual ~TestDBusFixture() =default;
- TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {}
+ explicit TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {}
private:
@@ -65,7 +69,7 @@ class TestDBusFixture: public GlibFixture
GDBusConnection * system_bus;
const std::vector<std::string> service_dirs;
- virtual void SetUp ()
+ virtual void SetUp() override
{
super::SetUp ();
@@ -84,7 +88,7 @@ class TestDBusFixture: public GlibFixture
g_main_loop_run (loop);
}
- virtual void TearDown ()
+ virtual void TearDown() override
{
wait_msec();
@@ -100,3 +104,5 @@ class TestDBusFixture: public GlibFixture
super::TearDown();
}
};
+
+#endif /* INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H */
diff --git a/tests/test-exporter.cpp b/tests/test-exporter.cpp
index ec19ef4..be8fcc3 100644
--- a/tests/test-exporter.cpp
+++ b/tests/test-exporter.cpp
@@ -42,7 +42,7 @@ protected:
GTestDBus* bus = nullptr;
- void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -54,7 +54,7 @@ protected:
g_setenv("DBUS_SESSION_BUS_ADDRESS", address, true);
}
- void TearDown()
+ void TearDown() override
{
GError * error = nullptr;
GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
@@ -76,9 +76,9 @@ TEST_F(ExporterFixture, HelloWorld)
TEST_F(ExporterFixture, Publish)
{
- std::shared_ptr<State> state(new MockState);
- std::shared_ptr<Actions> actions(new MockActions(state));
- std::shared_ptr<Settings> settings(new Settings);
+ auto state = std::make_shared<MockState>();
+ auto actions = std::make_shared<MockActions>(state);
+ auto settings = std::make_shared<Settings>();
std::vector<std::shared_ptr<Menu>> menus;
MenuFactory menu_factory (actions, state);
diff --git a/tests/test-formatter.cpp b/tests/test-formatter.cpp
index 01df4f2..d011fea 100644
--- a/tests/test-formatter.cpp
+++ b/tests/test-formatter.cpp
@@ -46,7 +46,7 @@ class FormatterFixture: public GlibFixture
std::shared_ptr<Settings> m_settings;
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -54,7 +54,7 @@ class FormatterFixture: public GlibFixture
m_original_locale = g_strdup(setlocale(LC_TIME, nullptr));
}
- virtual void TearDown()
+ void TearDown() override
{
m_settings.reset();
@@ -90,7 +90,7 @@ class FormatterFixture: public GlibFixture
TEST_F(FormatterFixture, TestPhoneHeader)
{
auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);
- std::shared_ptr<Clock> clock(new MockClock(DateTime(now)));
+ auto clock = std::make_shared<MockClock>(DateTime(now));
g_date_time_unref(now);
// test the default value in a 24h locale
@@ -143,7 +143,7 @@ TEST_F(FormatterFixture, TestDesktopHeader)
};
auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);
- std::shared_ptr<Clock> clock(new MockClock(DateTime(now)));
+ auto clock = std::make_shared<MockClock>(DateTime(now));
g_date_time_unref(now);
for(const auto& test_case : test_cases)
@@ -193,7 +193,7 @@ TEST_F(FormatterFixture, TestUpcomingTimes)
{
if (test_case.is_12h ? Set12hLocale() : Set24hLocale())
{
- std::shared_ptr<Clock> clock (new MockClock(DateTime(test_case.now)));
+ auto clock = std::make_shared<MockClock>(DateTime(test_case.now));
DesktopFormatter f(clock, m_settings);
const auto fmt = f.relative_format(test_case.then);
@@ -236,7 +236,7 @@ TEST_F(FormatterFixture, TestEventTimes)
{
if (test_case.is_12h ? Set12hLocale() : Set24hLocale())
{
- std::shared_ptr<Clock> clock(new MockClock(DateTime(test_case.now)));
+ auto clock = std::make_shared<MockClock>(DateTime(test_case.now));
DesktopFormatter f(clock, m_settings);
const auto fmt = f.relative_format(test_case.then, test_case.then_end);
diff --git a/tests/test-live-actions.cpp b/tests/test-live-actions.cpp
index c67b380..2cd6eef 100644
--- a/tests/test-live-actions.cpp
+++ b/tests/test-live-actions.cpp
@@ -26,17 +26,19 @@
****
***/
+using namespace unity::indicator::datetime;
+
class MockLiveActions: public LiveActions
{
public:
std::string last_cmd;
std::string last_url;
- MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {}
- virtual ~MockLiveActions() {}
+ explicit MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {}
+ ~MockLiveActions() {}
protected:
- void dispatch_url(const std::string& url) { last_url = url; }
- void execute_command(const std::string& cmd) { last_cmd = cmd; }
+ void dispatch_url(const std::string& url) override { last_url = url; }
+ void execute_command(const std::string& cmd) override { last_cmd = cmd; }
};
/***
diff --git a/tests/test-locations.cpp b/tests/test-locations.cpp
index 48e845a..61a6ffd 100644
--- a/tests/test-locations.cpp
+++ b/tests/test-locations.cpp
@@ -47,7 +47,7 @@ class LocationsFixture: public GlibFixture
const std::string nyc = "America/New_York";
const std::string chicago = "America/Chicago";
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -65,7 +65,7 @@ class LocationsFixture: public GlibFixture
m_timezones->timezones.set(std::set<std::string>({ nyc, chicago }));
}
- virtual void TearDown()
+ void TearDown() override
{
m_timezones.reset();
m_settings.reset();
diff --git a/tests/test-menus.cpp b/tests/test-menus.cpp
index f5f8df2..363a132 100644
--- a/tests/test-menus.cpp
+++ b/tests/test-menus.cpp
@@ -39,7 +39,7 @@ protected:
std::shared_ptr<MenuFactory> m_menu_factory;
std::vector<std::shared_ptr<Menu>> m_menus;
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -49,7 +49,7 @@ protected:
m_menus.push_back(m_menu_factory->buildMenu(Menu::Profile(i)));
}
- virtual void TearDown()
+ void TearDown() override
{
m_menus.clear();
m_menu_factory.reset();
diff --git a/tests/test-settings.cpp b/tests/test-settings.cpp
index 5dfb5ae..44037f7 100644
--- a/tests/test-settings.cpp
+++ b/tests/test-settings.cpp
@@ -39,7 +39,7 @@ protected:
std::shared_ptr<Settings> m_settings;
GSettings * m_gsettings;
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -48,7 +48,7 @@ protected:
m_settings = std::dynamic_pointer_cast<Settings>(m_live);
}
- virtual void TearDown()
+ void TearDown() override
{
g_clear_object(&m_gsettings);
m_settings.reset();
diff --git a/tests/test-snap.cpp b/tests/test-snap.cpp
index 5afaab1..21202f4 100644
--- a/tests/test-snap.cpp
+++ b/tests/test-snap.cpp
@@ -96,7 +96,7 @@ protected:
DbusTestDbusMockObject * screen_obj = nullptr;
DbusTestDbusMockObject * haptic_obj = nullptr;
- void SetUp()
+ void SetUp() override
{
GError * error = nullptr;
char * str = nullptr;
@@ -269,18 +269,18 @@ protected:
dbus_test_service_start_tasks(service);
g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE);
- session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
+ session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
ASSERT_NE(nullptr, session_bus);
g_dbus_connection_set_exit_on_close(session_bus, false);
g_object_add_weak_pointer(G_OBJECT(session_bus), (gpointer *)&session_bus);
- system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
+ system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr);
ASSERT_NE(nullptr, system_bus);
g_dbus_connection_set_exit_on_close(system_bus, FALSE);
g_object_add_weak_pointer(G_OBJECT(system_bus), (gpointer *)&system_bus);
}
- virtual void TearDown()
+ void TearDown() override
{
g_clear_object(&haptic_mock);
g_clear_object(&screen_mock);
diff --git a/tests/test-timezone-file.cpp b/tests/test-timezone-file.cpp
index aec597c..8968429 100644
--- a/tests/test-timezone-file.cpp
+++ b/tests/test-timezone-file.cpp
@@ -52,12 +52,12 @@ class TimezoneFixture: public GlibFixture
protected:
- virtual void SetUp()
+ void SetUp() override
{
super::SetUp();
}
- virtual void TearDown()
+ void TearDown() override
{
super::TearDown();
}
diff --git a/tests/test-timezones.cpp b/tests/test-timezones.cpp
index 3f02761..9e5c9cf 100644
--- a/tests/test-timezones.cpp
+++ b/tests/test-timezones.cpp
@@ -52,7 +52,7 @@ TEST_F(TimezonesFixture, ManagerTest)
std::string timezone_geo = "America/Denver";
set_file(timezone_file);
- std::shared_ptr<Settings> settings(new Settings);
+ auto settings = std::make_shared<Settings>();
LiveTimezones z(settings, TIMEZONE_FILE);
wait_msec(500); // wait for the bus to get set up
EXPECT_EQ(timezone_file, z.timezone.get());