Merge lp:~charlesk/indicator-datetime/fix-flint++-warnings into lp:indicator-datetime/13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 378
Merged at revision: 380
Proposed branch: lp:~charlesk/indicator-datetime/fix-flint++-warnings
Merge into: lp:indicator-datetime/13.10
Diff against target: 857 lines (+149/-88)
36 files modified
include/datetime/actions-live.h (+15/-15)
include/datetime/actions.h (+1/-1)
include/datetime/clock-mock.h (+1/-1)
include/datetime/dbus-shared.h (+3/-3)
include/datetime/engine-eds.h (+3/-3)
include/datetime/engine-mock.h (+3/-3)
include/datetime/engine.h (+3/-3)
include/datetime/exporter.h (+1/-1)
include/datetime/formatter.h (+2/-2)
include/datetime/planner-range.h (+1/-1)
include/datetime/wakeup-timer-mainloop.h (+1/-1)
include/datetime/wakeup-timer-powerd.h (+1/-1)
include/notifications/awake.h (+1/-1)
include/notifications/haptic.h (+1/-1)
include/notifications/notifications.h (+1/-1)
src/engine-eds.cpp (+1/-1)
src/planner-snooze.cpp (+1/-1)
src/sound.cpp (+5/-5)
src/wakeup-timer-powerd.cpp (+1/-1)
tests/actions-mock.h (+1/-1)
tests/geoclue-fixture.h (+6/-2)
tests/glib-fixture.h (+11/-2)
tests/manual-test-snap.cpp (+1/-1)
tests/state-fixture.h (+23/-1)
tests/state-mock.h (+19/-1)
tests/test-actions.cpp (+2/-2)
tests/test-dbus-fixture.h (+10/-4)
tests/test-exporter.cpp (+5/-5)
tests/test-formatter.cpp (+6/-6)
tests/test-live-actions.cpp (+6/-4)
tests/test-locations.cpp (+2/-2)
tests/test-menus.cpp (+2/-2)
tests/test-settings.cpp (+2/-2)
tests/test-snap.cpp (+4/-4)
tests/test-timezone-file.cpp (+2/-2)
tests/test-timezones.cpp (+1/-1)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/fix-flint++-warnings
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+235014@code.launchpad.net

Commit message

Fix flint++ warnings

Description of the change

Keeping a promise to Satoris from when he reviewed/approved another datetime MP -- this MP fixes a batch of flint++ warnings reported against indicator-datetime:

 * classes with virtual functions but non-virtual dtors
 * single-argument constructors that should use the explicit keyword
 * missing #include guards
 * use of NULL instead of nullptr in c++11 code
 * prefer std::make_shared<> when possible

There are still a handful of warnings left, either invalid (e.g., suggesting make_shared for a shared_ptr that's got a custom deleter) and a couple of others that are resolved as side-effects of the other indicator-datetime MPs already floating around today.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

Have a hard time getting excited about these, but they look fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'include/datetime/actions-live.h'
--- include/datetime/actions-live.h 2014-03-22 07:25:50 +0000
+++ include/datetime/actions-live.h 2014-09-17 16:59:23 +0000
@@ -36,21 +36,21 @@
36class LiveActions: public Actions36class LiveActions: public Actions
37{37{
38public:38public:
39 LiveActions(const std::shared_ptr<State>& state_in);39 explicit LiveActions(const std::shared_ptr<State>& state_in);
40 ~LiveActions() =default;40 virtual ~LiveActions() =default;
4141
42 bool desktop_has_calendar_app() const;42 bool desktop_has_calendar_app() const override;
43 void desktop_open_alarm_app();43 void desktop_open_alarm_app() override;
44 void desktop_open_appointment(const Appointment&);44 void desktop_open_appointment(const Appointment&) override;
45 void desktop_open_calendar_app(const DateTime&);45 void desktop_open_calendar_app(const DateTime&) override;
46 void desktop_open_settings_app();46 void desktop_open_settings_app() override;
4747
48 void phone_open_alarm_app();48 void phone_open_alarm_app() override;
49 void phone_open_appointment(const Appointment&);49 void phone_open_appointment(const Appointment&) override;
50 void phone_open_calendar_app(const DateTime&);50 void phone_open_calendar_app(const DateTime&) override;
51 void phone_open_settings_app();51 void phone_open_settings_app() override;
5252
53 void set_location(const std::string& zone, const std::string& name);53 void set_location(const std::string& zone, const std::string& name) override;
5454
55protected:55protected:
56 virtual void execute_command(const std::string& command);56 virtual void execute_command(const std::string& command);
5757
=== modified file 'include/datetime/actions.h'
--- include/datetime/actions.h 2014-03-22 07:25:50 +0000
+++ include/datetime/actions.h 2014-09-17 16:59:23 +0000
@@ -61,7 +61,7 @@
61 const std::shared_ptr<State> state() const;61 const std::shared_ptr<State> state() const;
6262
63protected:63protected:
64 Actions(const std::shared_ptr<State>& state);64 explicit Actions(const std::shared_ptr<State>& state);
65 virtual ~Actions();65 virtual ~Actions();
6666
67private:67private:
6868
=== modified file 'include/datetime/clock-mock.h'
--- include/datetime/clock-mock.h 2014-09-15 19:49:20 +0000
+++ include/datetime/clock-mock.h 2014-09-17 16:59:23 +0000
@@ -36,7 +36,7 @@
36class MockClock: public Clock36class MockClock: public Clock
37{37{
38public:38public:
39 MockClock(const DateTime& dt): m_localtime(dt) {}39 explicit MockClock(const DateTime& dt): m_localtime(dt) {}
40 ~MockClock() =default;40 ~MockClock() =default;
4141
42 DateTime localtime() const { return m_localtime; }42 DateTime localtime() const { return m_localtime; }
4343
=== modified file 'include/datetime/dbus-shared.h'
--- include/datetime/dbus-shared.h 2014-09-13 18:39:19 +0000
+++ include/datetime/dbus-shared.h 2014-09-17 16:59:23 +0000
@@ -18,8 +18,8 @@
18 * Charles Kerr <charles.kerr@canonical.com>18 * Charles Kerr <charles.kerr@canonical.com>
19 */19 */
2020
21#ifndef _INDICATOR_DATETIME_DBUS_SHARED_H_21#ifndef INDICATOR_DATETIME_DBUS_SHARED_H
22#define _INDICATOR_DATETIME_DBUS_SHARED_H_22#define INDICATOR_DATETIME_DBUS_SHARED_H
2323
24#define BUS_DATETIME_NAME "com.canonical.indicator.datetime"24#define BUS_DATETIME_NAME "com.canonical.indicator.datetime"
25#define BUS_DATETIME_PATH "/com/canonical/indicator/datetime"25#define BUS_DATETIME_PATH "/com/canonical/indicator/datetime"
@@ -29,4 +29,4 @@
29#define BUS_POWERD_INTERFACE "com.canonical.powerd"29#define BUS_POWERD_INTERFACE "com.canonical.powerd"
3030
3131
32#endif /* _INDICATOR_DATETIME_DBUS_SHARED_H_ */32#endif /* INDICATOR_DATETIME_DBUS_SHARED_H */
3333
=== modified file 'include/datetime/engine-eds.h'
--- include/datetime/engine-eds.h 2014-03-10 03:26:26 +0000
+++ include/datetime/engine-eds.h 2014-09-17 16:59:23 +0000
@@ -17,8 +17,8 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_ENGINE_EDS__H20#ifndef INDICATOR_DATETIME_ENGINE_EDS_H
21#define INDICATOR_DATETIME_ENGINE_EDS__H21#define INDICATOR_DATETIME_ENGINE_EDS_H
2222
23#include <datetime/engine.h>23#include <datetime/engine.h>
2424
@@ -72,4 +72,4 @@
72} // namespace indicator72} // namespace indicator
73} // namespace unity73} // namespace unity
7474
75#endif // INDICATOR_DATETIME_ENGINE_EDS__H75#endif // INDICATOR_DATETIME_ENGINE_EDS_H
7676
=== modified file 'include/datetime/engine-mock.h'
--- include/datetime/engine-mock.h 2014-03-10 03:26:26 +0000
+++ include/datetime/engine-mock.h 2014-09-17 16:59:23 +0000
@@ -17,8 +17,8 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_ENGINE_MOCK__H20#ifndef INDICATOR_DATETIME_ENGINE_MOCK_H
21#define INDICATOR_DATETIME_ENGINE_MOCK__H21#define INDICATOR_DATETIME_ENGINE_MOCK_H
2222
23#include <datetime/engine.h>23#include <datetime/engine.h>
2424
@@ -65,4 +65,4 @@
65} // namespace indicator65} // namespace indicator
66} // namespace unity66} // namespace unity
6767
68#endif // INDICATOR_DATETIME_ENGINE_NOOP__H68#endif // INDICATOR_DATETIME_ENGINE_MOCK_H
6969
=== modified file 'include/datetime/engine.h'
--- include/datetime/engine.h 2014-03-10 03:26:26 +0000
+++ include/datetime/engine.h 2014-09-17 16:59:23 +0000
@@ -17,8 +17,8 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_ENGINE__H20#ifndef INDICATOR_DATETIME_ENGINE_H
21#define INDICATOR_DATETIME_ENGINE__H21#define INDICATOR_DATETIME_ENGINE_H
2222
23#include <datetime/appointment.h>23#include <datetime/appointment.h>
24#include <datetime/date-time.h>24#include <datetime/date-time.h>
@@ -65,4 +65,4 @@
65} // namespace indicator65} // namespace indicator
66} // namespace unity66} // namespace unity
6767
68#endif // INDICATOR_DATETIME_ENGINE__H68#endif // INDICATOR_DATETIME_ENGINE_H
6969
=== modified file 'include/datetime/exporter.h'
--- include/datetime/exporter.h 2014-06-27 02:36:42 +0000
+++ include/datetime/exporter.h 2014-09-17 16:59:23 +0000
@@ -39,7 +39,7 @@
39class Exporter39class Exporter
40{40{
41public:41public:
42 Exporter(const std::shared_ptr<Settings>&);42 explicit Exporter(const std::shared_ptr<Settings>&);
43 ~Exporter();43 ~Exporter();
4444
45 core::Signal<>& name_lost();45 core::Signal<>& name_lost();
4646
=== modified file 'include/datetime/formatter.h'
--- include/datetime/formatter.h 2014-01-31 00:33:14 +0000
+++ include/datetime/formatter.h 2014-09-17 16:59:23 +0000
@@ -86,7 +86,7 @@
86 std::string relative_format(GDateTime* then, GDateTime* then_end=nullptr) const;86 std::string relative_format(GDateTime* then, GDateTime* then_end=nullptr) const;
8787
88protected:88protected:
89 Formatter(const std::shared_ptr<const Clock>&);89 explicit Formatter(const std::shared_ptr<const Clock>&);
90 virtual ~Formatter();90 virtual ~Formatter();
9191
92 static const char* default_header_time_format(bool twelvehour, bool show_seconds);92 static const char* default_header_time_format(bool twelvehour, bool show_seconds);
@@ -126,7 +126,7 @@
126class PhoneFormatter: public Formatter126class PhoneFormatter: public Formatter
127{127{
128public:128public:
129 PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) {129 explicit PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) {
130 header_format.set(default_header_time_format(is_locale_12h(), false));130 header_format.set(default_header_time_format(is_locale_12h(), false));
131 }131 }
132};132};
133133
=== modified file 'include/datetime/planner-range.h'
--- include/datetime/planner-range.h 2014-04-25 03:34:42 +0000
+++ include/datetime/planner-range.h 2014-09-17 16:59:23 +0000
@@ -72,7 +72,7 @@
72 core::Property<std::vector<Appointment>> m_appointments;72 core::Property<std::vector<Appointment>> m_appointments;
7373
74 // we've got a GSignal tag here, so disable copying74 // we've got a GSignal tag here, so disable copying
75 SimpleRangePlanner(const RangePlanner&) =delete;75 explicit SimpleRangePlanner(const RangePlanner&) =delete;
76 SimpleRangePlanner& operator=(const RangePlanner&) =delete;76 SimpleRangePlanner& operator=(const RangePlanner&) =delete;
77};77};
7878
7979
=== modified file 'include/datetime/wakeup-timer-mainloop.h'
--- include/datetime/wakeup-timer-mainloop.h 2014-04-25 03:34:42 +0000
+++ include/datetime/wakeup-timer-mainloop.h 2014-09-17 16:59:23 +0000
@@ -39,7 +39,7 @@
39class MainloopWakeupTimer: public WakeupTimer39class MainloopWakeupTimer: public WakeupTimer
40{40{
41public:41public:
42 MainloopWakeupTimer(const std::shared_ptr<Clock>&);42 explicit MainloopWakeupTimer(const std::shared_ptr<Clock>&);
43 ~MainloopWakeupTimer();43 ~MainloopWakeupTimer();
44 void set_wakeup_time (const DateTime&);44 void set_wakeup_time (const DateTime&);
45 core::Signal<>& timeout();45 core::Signal<>& timeout();
4646
=== modified file 'include/datetime/wakeup-timer-powerd.h'
--- include/datetime/wakeup-timer-powerd.h 2014-08-19 04:03:38 +0000
+++ include/datetime/wakeup-timer-powerd.h 2014-09-17 16:59:23 +0000
@@ -39,7 +39,7 @@
39class PowerdWakeupTimer: public WakeupTimer39class PowerdWakeupTimer: public WakeupTimer
40{40{
41public:41public:
42 PowerdWakeupTimer(const std::shared_ptr<Clock>&);42 explicit PowerdWakeupTimer(const std::shared_ptr<Clock>&);
43 ~PowerdWakeupTimer();43 ~PowerdWakeupTimer();
44 void set_wakeup_time(const DateTime&);44 void set_wakeup_time(const DateTime&);
45 core::Signal<>& timeout();45 core::Signal<>& timeout();
4646
=== modified file 'include/notifications/awake.h'
--- include/notifications/awake.h 2014-07-27 04:35:38 +0000
+++ include/notifications/awake.h 2014-09-17 16:59:23 +0000
@@ -36,7 +36,7 @@
36class Awake36class Awake
37{37{
38public:38public:
39 Awake(const std::string& app_name);39 explicit Awake(const std::string& app_name);
40 ~Awake();40 ~Awake();
4141
42private:42private:
4343
=== modified file 'include/notifications/haptic.h'
--- include/notifications/haptic.h 2014-08-01 00:52:42 +0000
+++ include/notifications/haptic.h 2014-09-17 16:59:23 +0000
@@ -41,7 +41,7 @@
41 MODE_PULSE41 MODE_PULSE
42 };42 };
4343
44 Haptic(const Mode& mode = MODE_PULSE);44 explicit Haptic(const Mode& mode = MODE_PULSE);
45 ~Haptic();45 ~Haptic();
4646
47private:47private:
4848
=== modified file 'include/notifications/notifications.h'
--- include/notifications/notifications.h 2014-07-30 22:59:52 +0000
+++ include/notifications/notifications.h 2014-09-17 16:59:23 +0000
@@ -85,7 +85,7 @@
85class Engine85class Engine
86{86{
87public:87public:
88 Engine(const std::string& app_name);88 explicit Engine(const std::string& app_name);
89 ~Engine();89 ~Engine();
9090
91 /** @see Builder::set_action() */91 /** @see Builder::set_action() */
9292
=== modified file 'src/engine-eds.cpp'
--- src/engine-eds.cpp 2014-06-27 01:46:06 +0000
+++ src/engine-eds.cpp 2014-09-17 16:59:23 +0000
@@ -285,7 +285,7 @@
285 if (e_cal_client_get_view_finish (E_CAL_CLIENT(client), res, &view, &error))285 if (e_cal_client_get_view_finish (E_CAL_CLIENT(client), res, &view, &error))
286 {286 {
287 // add the view to our collection287 // add the view to our collection
288 e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, NULL);288 e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, nullptr);
289 e_cal_client_view_start(view, &error);289 e_cal_client_view_start(view, &error);
290 g_debug("got a view for %s", e_cal_client_get_local_attachment_store(E_CAL_CLIENT(client)));290 g_debug("got a view for %s", e_cal_client_get_local_attachment_store(E_CAL_CLIENT(client)));
291 auto self = static_cast<Impl*>(gself);291 auto self = static_cast<Impl*>(gself);
292292
=== modified file 'src/planner-snooze.cpp'
--- src/planner-snooze.cpp 2014-09-03 04:44:00 +0000
+++ src/planner-snooze.cpp 2014-09-17 16:59:23 +0000
@@ -46,7 +46,7 @@
46 {46 {
47 }47 }
4848
49 virtual core::Property<std::vector<Appointment>>& appointments()49 core::Property<std::vector<Appointment>>& appointments()
50 {50 {
51 return m_appointments;51 return m_appointments;
52 }52 }
5353
=== modified file 'src/sound.cpp'
--- src/sound.cpp 2014-09-04 21:57:14 +0000
+++ src/sound.cpp 2014-09-17 16:59:23 +0000
@@ -113,17 +113,17 @@
113 else if ((GST_MESSAGE_TYPE(msg) == GST_MESSAGE_STREAM_START) && (self->m_loop))113 else if ((GST_MESSAGE_TYPE(msg) == GST_MESSAGE_STREAM_START) && (self->m_loop))
114 {114 {
115 /* Set the media role if audio sink is pulsesink */115 /* Set the media role if audio sink is pulsesink */
116 GstElement *audio_sink = NULL;116 GstElement *audio_sink = nullptr;
117 g_object_get(self->m_play, "audio-sink", &audio_sink, NULL);117 g_object_get(self->m_play, "audio-sink", &audio_sink, nullptr);
118 if (audio_sink)118 if (audio_sink)
119 {119 {
120 GstPluginFeature *feature = NULL;120 GstPluginFeature *feature = nullptr;
121 feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory);121 feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory);
122 if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0)122 if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0)
123 {123 {
124 std::string role_str("props,media.role=alarm");124 std::string role_str("props,media.role=alarm");
125 GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL);125 GstStructure *props = gst_structure_from_string(role_str.c_str(), nullptr);
126 g_object_set(audio_sink, "stream-properties", props, NULL);126 g_object_set(audio_sink, "stream-properties", props, nullptr);
127 gst_structure_free(props);127 gst_structure_free(props);
128 }128 }
129 gst_object_unref(audio_sink);129 gst_object_unref(audio_sink);
130130
=== modified file 'src/wakeup-timer-powerd.cpp'
--- src/wakeup-timer-powerd.cpp 2014-08-19 04:08:38 +0000
+++ src/wakeup-timer-powerd.cpp 2014-09-17 16:59:23 +0000
@@ -195,7 +195,7 @@
195 }195 }
196 else196 else
197 {197 {
198 const char* s = NULL;198 const char* s = nullptr;
199 g_variant_get(ret, "(&s)", &s);199 g_variant_get(ret, "(&s)", &s);
200 g_debug("%s %s::requestWakeup() sent cookie %s",200 g_debug("%s %s::requestWakeup() sent cookie %s",
201 G_STRLOC, BUS_POWERD_NAME, s);201 G_STRLOC, BUS_POWERD_NAME, s);
202202
=== modified file 'tests/actions-mock.h'
--- tests/actions-mock.h 2014-03-22 07:25:50 +0000
+++ tests/actions-mock.h 2014-09-17 16:59:23 +0000
@@ -31,7 +31,7 @@
31class MockActions: public Actions31class MockActions: public Actions
32{32{
33public:33public:
34 MockActions(std::shared_ptr<State>& state_in): Actions(state_in) {}34 explicit MockActions(const std::shared_ptr<State>& state_in): Actions(state_in) {}
35 ~MockActions() =default;35 ~MockActions() =default;
3636
37 enum Action { DesktopOpenAlarmApp,37 enum Action { DesktopOpenAlarmApp,
3838
=== modified file 'tests/geoclue-fixture.h'
--- tests/geoclue-fixture.h 2014-02-02 21:29:29 +0000
+++ tests/geoclue-fixture.h 2014-09-17 16:59:23 +0000
@@ -17,6 +17,9 @@
17 * with this program. If not, see <http://www.gnu.org/licenses/>.17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H
21#define INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H
22
20#include "glib-fixture.h"23#include "glib-fixture.h"
2124
22#include <libdbustest/dbus-test.h>25#include <libdbustest/dbus-test.h>
@@ -39,7 +42,7 @@
39 DbusTestDbusMockObject * obj_geo_addr = nullptr;42 DbusTestDbusMockObject * obj_geo_addr = nullptr;
40 const std::string timezone_1 = "America/Denver";43 const std::string timezone_1 = "America/Denver";
4144
42 void SetUp ()45 void SetUp () override
43 {46 {
44 super::SetUp();47 super::SetUp();
4548
@@ -80,7 +83,7 @@
80 g_string_free (gstr, TRUE);83 g_string_free (gstr, TRUE);
81 }84 }
8285
83 virtual void TearDown ()86 void TearDown () override
84 {87 {
85 g_clear_object (&mock);88 g_clear_object (&mock);
86 g_clear_object (&service);89 g_clear_object (&service);
@@ -148,3 +151,4 @@
148151
149};152};
150153
154#endif /* INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H */
151155
=== modified file 'tests/glib-fixture.h'
--- tests/glib-fixture.h 2014-01-29 03:15:39 +0000
+++ tests/glib-fixture.h 2014-09-17 16:59:23 +0000
@@ -17,6 +17,9 @@
17 * with this program. If not, see <http://www.gnu.org/licenses/>.17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
21#define INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H
22
20#include <map>23#include <map>
2124
22#include <glib.h>25#include <glib.h>
@@ -29,6 +32,10 @@
2932
30class GlibFixture : public ::testing::Test33class GlibFixture : public ::testing::Test
31{34{
35 public:
36
37 virtual ~GlibFixture() =default;
38
32 private:39 private:
3340
34 //GLogFunc realLogHandler;41 //GLogFunc realLogHandler;
@@ -59,7 +66,7 @@
5966
60 protected:67 protected:
6168
62 virtual void SetUp()69 virtual void SetUp() override
63 {70 {
64 setlocale(LC_ALL, "C.UTF-8");71 setlocale(LC_ALL, "C.UTF-8");
6572
@@ -76,7 +83,7 @@
7683
77 }84 }
7885
79 virtual void TearDown()86 virtual void TearDown() override
80 {87 {
81#if 088#if 0
82 // confirm there aren't any unexpected log messages89 // confirm there aren't any unexpected log messages
@@ -136,3 +143,5 @@
136143
137 GMainLoop * loop;144 GMainLoop * loop;
138};145};
146
147#endif /* INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H */
139148
=== modified file 'tests/manual-test-snap.cpp'
--- tests/manual-test-snap.cpp 2014-09-03 04:22:04 +0000
+++ tests/manual-test-snap.cpp 2014-09-17 16:59:23 +0000
@@ -47,7 +47,7 @@
47 GOptionEntry entries[] =47 GOptionEntry entries[] =
48 {48 {
49 { "volume", 'v', 0, G_OPTION_ARG_INT, &volume, "Volume level [1..100]", "volume" },49 { "volume", 'v', 0, G_OPTION_ARG_INT, &volume, "Volume level [1..100]", "volume" },
50 { NULL }50 { nullptr }
51 };51 };
52}52}
5353
5454
=== modified file 'tests/state-fixture.h'
--- tests/state-fixture.h 2014-01-22 05:27:45 +0000
+++ tests/state-fixture.h 2014-09-17 16:59:23 +0000
@@ -17,18 +17,30 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H
21#define INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H
22
20#include "glib-fixture.h"23#include "glib-fixture.h"
2124
22#include "actions-mock.h"25#include "actions-mock.h"
23#include "state-mock.h"26#include "state-mock.h"
2427
25using namespace unity::indicator::datetime;28namespace unity {
29namespace indicator {
30namespace datetime {
31
32/***
33****
34***/
2635
27class StateFixture: public GlibFixture36class StateFixture: public GlibFixture
28{37{
29private:38private:
30 typedef GlibFixture super;39 typedef GlibFixture super;
3140
41public:
42 virtual ~StateFixture() =default;
43
32protected:44protected:
33 std::shared_ptr<MockState> m_mock_state;45 std::shared_ptr<MockState> m_mock_state;
34 std::shared_ptr<State> m_state;46 std::shared_ptr<State> m_state;
@@ -56,5 +68,15 @@
5668
57 super::TearDown();69 super::TearDown();
58 }70 }
71
59};72};
6073
74/***
75****
76***/
77
78} // namespace datetime
79} // namespace indicator
80} // namespace unity
81
82#endif /* INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H */
6183
=== modified file 'tests/state-mock.h'
--- tests/state-mock.h 2014-03-10 02:08:47 +0000
+++ tests/state-mock.h 2014-09-17 16:59:23 +0000
@@ -17,12 +17,21 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_STATE_MOCK_H
21#define INDICATOR_DATETIME_STATE_MOCK_H
22
20#include "planner-mock.h"23#include "planner-mock.h"
2124
22#include <datetime/clock-mock.h>25#include <datetime/clock-mock.h>
23#include <datetime/state.h>26#include <datetime/state.h>
2427
25using namespace unity::indicator::datetime;28namespace unity {
29namespace indicator {
30namespace datetime {
31
32/***
33****
34***/
2635
27class MockState: public State36class MockState: public State
28{37{
@@ -47,3 +56,12 @@
47 }56 }
48};57};
4958
59/***
60****
61***/
62
63} // namespace datetime
64} // namespace indicator
65} // namespace unity
66
67#endif /* INDICATOR_DATETIME_STATE_MOCK_H */
5068
=== modified file 'tests/test-actions.cpp'
--- tests/test-actions.cpp 2014-03-24 16:18:12 +0000
+++ tests/test-actions.cpp 2014-09-17 16:59:23 +0000
@@ -55,12 +55,12 @@
5555
56protected:56protected:
5757
58 virtual void SetUp()58 void SetUp() override
59 {59 {
60 super::SetUp();60 super::SetUp();
61 }61 }
6262
63 virtual void TearDown()63 void TearDown() override
64 {64 {
65 super::TearDown();65 super::TearDown();
66 }66 }
6767
=== modified file 'tests/test-dbus-fixture.h'
--- tests/test-dbus-fixture.h 2014-01-17 03:23:57 +0000
+++ tests/test-dbus-fixture.h 2014-09-17 16:59:23 +0000
@@ -17,6 +17,9 @@
17 * Charles Kerr <charles.kerr@canonical.com>17 * Charles Kerr <charles.kerr@canonical.com>
18 */18 */
1919
20#ifndef INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H
21#define INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H
22
20#include "glib-fixture.h"23#include "glib-fixture.h"
2124
22/***25/***
@@ -27,9 +30,10 @@
27{30{
28 public:31 public:
2932
30 TestDBusFixture() {}33 TestDBusFixture() =default;
34 virtual ~TestDBusFixture() =default;
3135
32 TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {}36 explicit TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {}
3337
34 private:38 private:
3539
@@ -65,7 +69,7 @@
65 GDBusConnection * system_bus;69 GDBusConnection * system_bus;
66 const std::vector<std::string> service_dirs;70 const std::vector<std::string> service_dirs;
6771
68 virtual void SetUp ()72 virtual void SetUp() override
69 {73 {
70 super::SetUp ();74 super::SetUp ();
7175
@@ -84,7 +88,7 @@
84 g_main_loop_run (loop);88 g_main_loop_run (loop);
85 }89 }
8690
87 virtual void TearDown ()91 virtual void TearDown() override
88 {92 {
89 wait_msec();93 wait_msec();
9094
@@ -100,3 +104,5 @@
100 super::TearDown();104 super::TearDown();
101 }105 }
102};106};
107
108#endif /* INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H */
103109
=== modified file 'tests/test-exporter.cpp'
--- tests/test-exporter.cpp 2014-09-02 15:37:03 +0000
+++ tests/test-exporter.cpp 2014-09-17 16:59:23 +0000
@@ -42,7 +42,7 @@
4242
43 GTestDBus* bus = nullptr;43 GTestDBus* bus = nullptr;
4444
45 void SetUp()45 void SetUp() override
46 {46 {
47 super::SetUp();47 super::SetUp();
4848
@@ -54,7 +54,7 @@
54 g_setenv("DBUS_SESSION_BUS_ADDRESS", address, true);54 g_setenv("DBUS_SESSION_BUS_ADDRESS", address, true);
55 }55 }
5656
57 void TearDown()57 void TearDown() override
58 {58 {
59 GError * error = nullptr;59 GError * error = nullptr;
60 GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);60 GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
@@ -76,9 +76,9 @@
7676
77TEST_F(ExporterFixture, Publish)77TEST_F(ExporterFixture, Publish)
78{78{
79 std::shared_ptr<State> state(new MockState);79 auto state = std::make_shared<MockState>();
80 std::shared_ptr<Actions> actions(new MockActions(state));80 auto actions = std::make_shared<MockActions>(state);
81 std::shared_ptr<Settings> settings(new Settings);81 auto settings = std::make_shared<Settings>();
82 std::vector<std::shared_ptr<Menu>> menus;82 std::vector<std::shared_ptr<Menu>> menus;
8383
84 MenuFactory menu_factory (actions, state);84 MenuFactory menu_factory (actions, state);
8585
=== modified file 'tests/test-formatter.cpp'
--- tests/test-formatter.cpp 2014-01-31 00:33:14 +0000
+++ tests/test-formatter.cpp 2014-09-17 16:59:23 +0000
@@ -46,7 +46,7 @@
4646
47 std::shared_ptr<Settings> m_settings;47 std::shared_ptr<Settings> m_settings;
4848
49 virtual void SetUp()49 void SetUp() override
50 {50 {
51 super::SetUp();51 super::SetUp();
5252
@@ -54,7 +54,7 @@
54 m_original_locale = g_strdup(setlocale(LC_TIME, nullptr));54 m_original_locale = g_strdup(setlocale(LC_TIME, nullptr));
55 }55 }
5656
57 virtual void TearDown()57 void TearDown() override
58 {58 {
59 m_settings.reset();59 m_settings.reset();
6060
@@ -90,7 +90,7 @@
90TEST_F(FormatterFixture, TestPhoneHeader)90TEST_F(FormatterFixture, TestPhoneHeader)
91{91{
92 auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);92 auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);
93 std::shared_ptr<Clock> clock(new MockClock(DateTime(now)));93 auto clock = std::make_shared<MockClock>(DateTime(now));
94 g_date_time_unref(now);94 g_date_time_unref(now);
9595
96 // test the default value in a 24h locale96 // test the default value in a 24h locale
@@ -143,7 +143,7 @@
143 };143 };
144144
145 auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);145 auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59);
146 std::shared_ptr<Clock> clock(new MockClock(DateTime(now)));146 auto clock = std::make_shared<MockClock>(DateTime(now));
147 g_date_time_unref(now);147 g_date_time_unref(now);
148148
149 for(const auto& test_case : test_cases)149 for(const auto& test_case : test_cases)
@@ -193,7 +193,7 @@
193 {193 {
194 if (test_case.is_12h ? Set12hLocale() : Set24hLocale())194 if (test_case.is_12h ? Set12hLocale() : Set24hLocale())
195 {195 {
196 std::shared_ptr<Clock> clock (new MockClock(DateTime(test_case.now)));196 auto clock = std::make_shared<MockClock>(DateTime(test_case.now));
197 DesktopFormatter f(clock, m_settings);197 DesktopFormatter f(clock, m_settings);
198 198
199 const auto fmt = f.relative_format(test_case.then);199 const auto fmt = f.relative_format(test_case.then);
@@ -236,7 +236,7 @@
236 {236 {
237 if (test_case.is_12h ? Set12hLocale() : Set24hLocale())237 if (test_case.is_12h ? Set12hLocale() : Set24hLocale())
238 {238 {
239 std::shared_ptr<Clock> clock(new MockClock(DateTime(test_case.now)));239 auto clock = std::make_shared<MockClock>(DateTime(test_case.now));
240 DesktopFormatter f(clock, m_settings);240 DesktopFormatter f(clock, m_settings);
241 241
242 const auto fmt = f.relative_format(test_case.then, test_case.then_end);242 const auto fmt = f.relative_format(test_case.then, test_case.then_end);
243243
=== modified file 'tests/test-live-actions.cpp'
--- tests/test-live-actions.cpp 2014-03-22 07:25:50 +0000
+++ tests/test-live-actions.cpp 2014-09-17 16:59:23 +0000
@@ -26,17 +26,19 @@
26****26****
27***/27***/
2828
29using namespace unity::indicator::datetime;
30
29class MockLiveActions: public LiveActions31class MockLiveActions: public LiveActions
30{32{
31public:33public:
32 std::string last_cmd;34 std::string last_cmd;
33 std::string last_url;35 std::string last_url;
34 MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {}36 explicit MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {}
35 virtual ~MockLiveActions() {}37 ~MockLiveActions() {}
3638
37protected:39protected:
38 void dispatch_url(const std::string& url) { last_url = url; }40 void dispatch_url(const std::string& url) override { last_url = url; }
39 void execute_command(const std::string& cmd) { last_cmd = cmd; }41 void execute_command(const std::string& cmd) override { last_cmd = cmd; }
40};42};
4143
42/***44/***
4345
=== modified file 'tests/test-locations.cpp'
--- tests/test-locations.cpp 2014-07-13 22:22:57 +0000
+++ tests/test-locations.cpp 2014-09-17 16:59:23 +0000
@@ -47,7 +47,7 @@
47 const std::string nyc = "America/New_York";47 const std::string nyc = "America/New_York";
48 const std::string chicago = "America/Chicago";48 const std::string chicago = "America/Chicago";
4949
50 virtual void SetUp()50 void SetUp() override
51 {51 {
52 super::SetUp();52 super::SetUp();
5353
@@ -65,7 +65,7 @@
65 m_timezones->timezones.set(std::set<std::string>({ nyc, chicago }));65 m_timezones->timezones.set(std::set<std::string>({ nyc, chicago }));
66 }66 }
6767
68 virtual void TearDown()68 void TearDown() override
69 {69 {
70 m_timezones.reset();70 m_timezones.reset();
71 m_settings.reset();71 m_settings.reset();
7272
=== modified file 'tests/test-menus.cpp'
--- tests/test-menus.cpp 2014-06-27 01:52:36 +0000
+++ tests/test-menus.cpp 2014-09-17 16:59:23 +0000
@@ -39,7 +39,7 @@
39 std::shared_ptr<MenuFactory> m_menu_factory;39 std::shared_ptr<MenuFactory> m_menu_factory;
40 std::vector<std::shared_ptr<Menu>> m_menus;40 std::vector<std::shared_ptr<Menu>> m_menus;
4141
42 virtual void SetUp()42 void SetUp() override
43 {43 {
44 super::SetUp();44 super::SetUp();
4545
@@ -49,7 +49,7 @@
49 m_menus.push_back(m_menu_factory->buildMenu(Menu::Profile(i)));49 m_menus.push_back(m_menu_factory->buildMenu(Menu::Profile(i)));
50 }50 }
5151
52 virtual void TearDown()52 void TearDown() override
53 {53 {
54 m_menus.clear();54 m_menus.clear();
55 m_menu_factory.reset();55 m_menu_factory.reset();
5656
=== modified file 'tests/test-settings.cpp'
--- tests/test-settings.cpp 2014-09-02 15:37:03 +0000
+++ tests/test-settings.cpp 2014-09-17 16:59:23 +0000
@@ -39,7 +39,7 @@
39 std::shared_ptr<Settings> m_settings;39 std::shared_ptr<Settings> m_settings;
40 GSettings * m_gsettings;40 GSettings * m_gsettings;
4141
42 virtual void SetUp()42 void SetUp() override
43 {43 {
44 super::SetUp();44 super::SetUp();
4545
@@ -48,7 +48,7 @@
48 m_settings = std::dynamic_pointer_cast<Settings>(m_live);48 m_settings = std::dynamic_pointer_cast<Settings>(m_live);
49 }49 }
5050
51 virtual void TearDown()51 void TearDown() override
52 {52 {
53 g_clear_object(&m_gsettings);53 g_clear_object(&m_gsettings);
54 m_settings.reset();54 m_settings.reset();
5555
=== modified file 'tests/test-snap.cpp'
--- tests/test-snap.cpp 2014-07-31 22:06:50 +0000
+++ tests/test-snap.cpp 2014-09-17 16:59:23 +0000
@@ -96,7 +96,7 @@
96 DbusTestDbusMockObject * screen_obj = nullptr;96 DbusTestDbusMockObject * screen_obj = nullptr;
97 DbusTestDbusMockObject * haptic_obj = nullptr;97 DbusTestDbusMockObject * haptic_obj = nullptr;
9898
99 void SetUp()99 void SetUp() override
100 {100 {
101 GError * error = nullptr;101 GError * error = nullptr;
102 char * str = nullptr;102 char * str = nullptr;
@@ -269,18 +269,18 @@
269 dbus_test_service_start_tasks(service);269 dbus_test_service_start_tasks(service);
270 g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE);270 g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE);
271271
272 session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);272 session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
273 ASSERT_NE(nullptr, session_bus);273 ASSERT_NE(nullptr, session_bus);
274 g_dbus_connection_set_exit_on_close(session_bus, false);274 g_dbus_connection_set_exit_on_close(session_bus, false);
275 g_object_add_weak_pointer(G_OBJECT(session_bus), (gpointer *)&session_bus);275 g_object_add_weak_pointer(G_OBJECT(session_bus), (gpointer *)&session_bus);
276276
277 system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);277 system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr);
278 ASSERT_NE(nullptr, system_bus);278 ASSERT_NE(nullptr, system_bus);
279 g_dbus_connection_set_exit_on_close(system_bus, FALSE);279 g_dbus_connection_set_exit_on_close(system_bus, FALSE);
280 g_object_add_weak_pointer(G_OBJECT(system_bus), (gpointer *)&system_bus);280 g_object_add_weak_pointer(G_OBJECT(system_bus), (gpointer *)&system_bus);
281 }281 }
282282
283 virtual void TearDown()283 void TearDown() override
284 {284 {
285 g_clear_object(&haptic_mock);285 g_clear_object(&haptic_mock);
286 g_clear_object(&screen_mock);286 g_clear_object(&screen_mock);
287287
=== modified file 'tests/test-timezone-file.cpp'
--- tests/test-timezone-file.cpp 2014-05-05 15:06:34 +0000
+++ tests/test-timezone-file.cpp 2014-09-17 16:59:23 +0000
@@ -52,12 +52,12 @@
5252
53 protected:53 protected:
5454
55 virtual void SetUp()55 void SetUp() override
56 {56 {
57 super::SetUp();57 super::SetUp();
58 }58 }
5959
60 virtual void TearDown()60 void TearDown() override
61 {61 {
62 super::TearDown();62 super::TearDown();
63 }63 }
6464
=== modified file 'tests/test-timezones.cpp'
--- tests/test-timezones.cpp 2014-01-22 15:06:01 +0000
+++ tests/test-timezones.cpp 2014-09-17 16:59:23 +0000
@@ -52,7 +52,7 @@
52 std::string timezone_geo = "America/Denver";52 std::string timezone_geo = "America/Denver";
5353
54 set_file(timezone_file);54 set_file(timezone_file);
55 std::shared_ptr<Settings> settings(new Settings);55 auto settings = std::make_shared<Settings>();
56 LiveTimezones z(settings, TIMEZONE_FILE);56 LiveTimezones z(settings, TIMEZONE_FILE);
57 wait_msec(500); // wait for the bus to get set up57 wait_msec(500); // wait for the bus to get set up
58 EXPECT_EQ(timezone_file, z.timezone.get());58 EXPECT_EQ(timezone_file, z.timezone.get());

Subscribers

People subscribed via source and target branches