Merge lp:~charlesk/indicator-datetime/fix-flint++-warnings into lp:indicator-datetime/13.10
- fix-flint++-warnings
- Merge into trunk.14.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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ted Gould (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email:
|
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
1 | === modified file 'include/datetime/actions-live.h' |
2 | --- include/datetime/actions-live.h 2014-03-22 07:25:50 +0000 |
3 | +++ include/datetime/actions-live.h 2014-09-17 16:59:23 +0000 |
4 | @@ -36,21 +36,21 @@ |
5 | class LiveActions: public Actions |
6 | { |
7 | public: |
8 | - LiveActions(const std::shared_ptr<State>& state_in); |
9 | - ~LiveActions() =default; |
10 | - |
11 | - bool desktop_has_calendar_app() const; |
12 | - void desktop_open_alarm_app(); |
13 | - void desktop_open_appointment(const Appointment&); |
14 | - void desktop_open_calendar_app(const DateTime&); |
15 | - void desktop_open_settings_app(); |
16 | - |
17 | - void phone_open_alarm_app(); |
18 | - void phone_open_appointment(const Appointment&); |
19 | - void phone_open_calendar_app(const DateTime&); |
20 | - void phone_open_settings_app(); |
21 | - |
22 | - void set_location(const std::string& zone, const std::string& name); |
23 | + explicit LiveActions(const std::shared_ptr<State>& state_in); |
24 | + virtual ~LiveActions() =default; |
25 | + |
26 | + bool desktop_has_calendar_app() const override; |
27 | + void desktop_open_alarm_app() override; |
28 | + void desktop_open_appointment(const Appointment&) override; |
29 | + void desktop_open_calendar_app(const DateTime&) override; |
30 | + void desktop_open_settings_app() override; |
31 | + |
32 | + void phone_open_alarm_app() override; |
33 | + void phone_open_appointment(const Appointment&) override; |
34 | + void phone_open_calendar_app(const DateTime&) override; |
35 | + void phone_open_settings_app() override; |
36 | + |
37 | + void set_location(const std::string& zone, const std::string& name) override; |
38 | |
39 | protected: |
40 | virtual void execute_command(const std::string& command); |
41 | |
42 | === modified file 'include/datetime/actions.h' |
43 | --- include/datetime/actions.h 2014-03-22 07:25:50 +0000 |
44 | +++ include/datetime/actions.h 2014-09-17 16:59:23 +0000 |
45 | @@ -61,7 +61,7 @@ |
46 | const std::shared_ptr<State> state() const; |
47 | |
48 | protected: |
49 | - Actions(const std::shared_ptr<State>& state); |
50 | + explicit Actions(const std::shared_ptr<State>& state); |
51 | virtual ~Actions(); |
52 | |
53 | private: |
54 | |
55 | === modified file 'include/datetime/clock-mock.h' |
56 | --- include/datetime/clock-mock.h 2014-09-15 19:49:20 +0000 |
57 | +++ include/datetime/clock-mock.h 2014-09-17 16:59:23 +0000 |
58 | @@ -36,7 +36,7 @@ |
59 | class MockClock: public Clock |
60 | { |
61 | public: |
62 | - MockClock(const DateTime& dt): m_localtime(dt) {} |
63 | + explicit MockClock(const DateTime& dt): m_localtime(dt) {} |
64 | ~MockClock() =default; |
65 | |
66 | DateTime localtime() const { return m_localtime; } |
67 | |
68 | === modified file 'include/datetime/dbus-shared.h' |
69 | --- include/datetime/dbus-shared.h 2014-09-13 18:39:19 +0000 |
70 | +++ include/datetime/dbus-shared.h 2014-09-17 16:59:23 +0000 |
71 | @@ -18,8 +18,8 @@ |
72 | * Charles Kerr <charles.kerr@canonical.com> |
73 | */ |
74 | |
75 | -#ifndef _INDICATOR_DATETIME_DBUS_SHARED_H_ |
76 | -#define _INDICATOR_DATETIME_DBUS_SHARED_H_ |
77 | +#ifndef INDICATOR_DATETIME_DBUS_SHARED_H |
78 | +#define INDICATOR_DATETIME_DBUS_SHARED_H |
79 | |
80 | #define BUS_DATETIME_NAME "com.canonical.indicator.datetime" |
81 | #define BUS_DATETIME_PATH "/com/canonical/indicator/datetime" |
82 | @@ -29,4 +29,4 @@ |
83 | #define BUS_POWERD_INTERFACE "com.canonical.powerd" |
84 | |
85 | |
86 | -#endif /* _INDICATOR_DATETIME_DBUS_SHARED_H_ */ |
87 | +#endif /* INDICATOR_DATETIME_DBUS_SHARED_H */ |
88 | |
89 | === modified file 'include/datetime/engine-eds.h' |
90 | --- include/datetime/engine-eds.h 2014-03-10 03:26:26 +0000 |
91 | +++ include/datetime/engine-eds.h 2014-09-17 16:59:23 +0000 |
92 | @@ -17,8 +17,8 @@ |
93 | * Charles Kerr <charles.kerr@canonical.com> |
94 | */ |
95 | |
96 | -#ifndef INDICATOR_DATETIME_ENGINE_EDS__H |
97 | -#define INDICATOR_DATETIME_ENGINE_EDS__H |
98 | +#ifndef INDICATOR_DATETIME_ENGINE_EDS_H |
99 | +#define INDICATOR_DATETIME_ENGINE_EDS_H |
100 | |
101 | #include <datetime/engine.h> |
102 | |
103 | @@ -72,4 +72,4 @@ |
104 | } // namespace indicator |
105 | } // namespace unity |
106 | |
107 | -#endif // INDICATOR_DATETIME_ENGINE_EDS__H |
108 | +#endif // INDICATOR_DATETIME_ENGINE_EDS_H |
109 | |
110 | === modified file 'include/datetime/engine-mock.h' |
111 | --- include/datetime/engine-mock.h 2014-03-10 03:26:26 +0000 |
112 | +++ include/datetime/engine-mock.h 2014-09-17 16:59:23 +0000 |
113 | @@ -17,8 +17,8 @@ |
114 | * Charles Kerr <charles.kerr@canonical.com> |
115 | */ |
116 | |
117 | -#ifndef INDICATOR_DATETIME_ENGINE_MOCK__H |
118 | -#define INDICATOR_DATETIME_ENGINE_MOCK__H |
119 | +#ifndef INDICATOR_DATETIME_ENGINE_MOCK_H |
120 | +#define INDICATOR_DATETIME_ENGINE_MOCK_H |
121 | |
122 | #include <datetime/engine.h> |
123 | |
124 | @@ -65,4 +65,4 @@ |
125 | } // namespace indicator |
126 | } // namespace unity |
127 | |
128 | -#endif // INDICATOR_DATETIME_ENGINE_NOOP__H |
129 | +#endif // INDICATOR_DATETIME_ENGINE_MOCK_H |
130 | |
131 | === modified file 'include/datetime/engine.h' |
132 | --- include/datetime/engine.h 2014-03-10 03:26:26 +0000 |
133 | +++ include/datetime/engine.h 2014-09-17 16:59:23 +0000 |
134 | @@ -17,8 +17,8 @@ |
135 | * Charles Kerr <charles.kerr@canonical.com> |
136 | */ |
137 | |
138 | -#ifndef INDICATOR_DATETIME_ENGINE__H |
139 | -#define INDICATOR_DATETIME_ENGINE__H |
140 | +#ifndef INDICATOR_DATETIME_ENGINE_H |
141 | +#define INDICATOR_DATETIME_ENGINE_H |
142 | |
143 | #include <datetime/appointment.h> |
144 | #include <datetime/date-time.h> |
145 | @@ -65,4 +65,4 @@ |
146 | } // namespace indicator |
147 | } // namespace unity |
148 | |
149 | -#endif // INDICATOR_DATETIME_ENGINE__H |
150 | +#endif // INDICATOR_DATETIME_ENGINE_H |
151 | |
152 | === modified file 'include/datetime/exporter.h' |
153 | --- include/datetime/exporter.h 2014-06-27 02:36:42 +0000 |
154 | +++ include/datetime/exporter.h 2014-09-17 16:59:23 +0000 |
155 | @@ -39,7 +39,7 @@ |
156 | class Exporter |
157 | { |
158 | public: |
159 | - Exporter(const std::shared_ptr<Settings>&); |
160 | + explicit Exporter(const std::shared_ptr<Settings>&); |
161 | ~Exporter(); |
162 | |
163 | core::Signal<>& name_lost(); |
164 | |
165 | === modified file 'include/datetime/formatter.h' |
166 | --- include/datetime/formatter.h 2014-01-31 00:33:14 +0000 |
167 | +++ include/datetime/formatter.h 2014-09-17 16:59:23 +0000 |
168 | @@ -86,7 +86,7 @@ |
169 | std::string relative_format(GDateTime* then, GDateTime* then_end=nullptr) const; |
170 | |
171 | protected: |
172 | - Formatter(const std::shared_ptr<const Clock>&); |
173 | + explicit Formatter(const std::shared_ptr<const Clock>&); |
174 | virtual ~Formatter(); |
175 | |
176 | static const char* default_header_time_format(bool twelvehour, bool show_seconds); |
177 | @@ -126,7 +126,7 @@ |
178 | class PhoneFormatter: public Formatter |
179 | { |
180 | public: |
181 | - PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) { |
182 | + explicit PhoneFormatter(const std::shared_ptr<const Clock>& clock): Formatter(clock) { |
183 | header_format.set(default_header_time_format(is_locale_12h(), false)); |
184 | } |
185 | }; |
186 | |
187 | === modified file 'include/datetime/planner-range.h' |
188 | --- include/datetime/planner-range.h 2014-04-25 03:34:42 +0000 |
189 | +++ include/datetime/planner-range.h 2014-09-17 16:59:23 +0000 |
190 | @@ -72,7 +72,7 @@ |
191 | core::Property<std::vector<Appointment>> m_appointments; |
192 | |
193 | // we've got a GSignal tag here, so disable copying |
194 | - SimpleRangePlanner(const RangePlanner&) =delete; |
195 | + explicit SimpleRangePlanner(const RangePlanner&) =delete; |
196 | SimpleRangePlanner& operator=(const RangePlanner&) =delete; |
197 | }; |
198 | |
199 | |
200 | === modified file 'include/datetime/wakeup-timer-mainloop.h' |
201 | --- include/datetime/wakeup-timer-mainloop.h 2014-04-25 03:34:42 +0000 |
202 | +++ include/datetime/wakeup-timer-mainloop.h 2014-09-17 16:59:23 +0000 |
203 | @@ -39,7 +39,7 @@ |
204 | class MainloopWakeupTimer: public WakeupTimer |
205 | { |
206 | public: |
207 | - MainloopWakeupTimer(const std::shared_ptr<Clock>&); |
208 | + explicit MainloopWakeupTimer(const std::shared_ptr<Clock>&); |
209 | ~MainloopWakeupTimer(); |
210 | void set_wakeup_time (const DateTime&); |
211 | core::Signal<>& timeout(); |
212 | |
213 | === modified file 'include/datetime/wakeup-timer-powerd.h' |
214 | --- include/datetime/wakeup-timer-powerd.h 2014-08-19 04:03:38 +0000 |
215 | +++ include/datetime/wakeup-timer-powerd.h 2014-09-17 16:59:23 +0000 |
216 | @@ -39,7 +39,7 @@ |
217 | class PowerdWakeupTimer: public WakeupTimer |
218 | { |
219 | public: |
220 | - PowerdWakeupTimer(const std::shared_ptr<Clock>&); |
221 | + explicit PowerdWakeupTimer(const std::shared_ptr<Clock>&); |
222 | ~PowerdWakeupTimer(); |
223 | void set_wakeup_time(const DateTime&); |
224 | core::Signal<>& timeout(); |
225 | |
226 | === modified file 'include/notifications/awake.h' |
227 | --- include/notifications/awake.h 2014-07-27 04:35:38 +0000 |
228 | +++ include/notifications/awake.h 2014-09-17 16:59:23 +0000 |
229 | @@ -36,7 +36,7 @@ |
230 | class Awake |
231 | { |
232 | public: |
233 | - Awake(const std::string& app_name); |
234 | + explicit Awake(const std::string& app_name); |
235 | ~Awake(); |
236 | |
237 | private: |
238 | |
239 | === modified file 'include/notifications/haptic.h' |
240 | --- include/notifications/haptic.h 2014-08-01 00:52:42 +0000 |
241 | +++ include/notifications/haptic.h 2014-09-17 16:59:23 +0000 |
242 | @@ -41,7 +41,7 @@ |
243 | MODE_PULSE |
244 | }; |
245 | |
246 | - Haptic(const Mode& mode = MODE_PULSE); |
247 | + explicit Haptic(const Mode& mode = MODE_PULSE); |
248 | ~Haptic(); |
249 | |
250 | private: |
251 | |
252 | === modified file 'include/notifications/notifications.h' |
253 | --- include/notifications/notifications.h 2014-07-30 22:59:52 +0000 |
254 | +++ include/notifications/notifications.h 2014-09-17 16:59:23 +0000 |
255 | @@ -85,7 +85,7 @@ |
256 | class Engine |
257 | { |
258 | public: |
259 | - Engine(const std::string& app_name); |
260 | + explicit Engine(const std::string& app_name); |
261 | ~Engine(); |
262 | |
263 | /** @see Builder::set_action() */ |
264 | |
265 | === modified file 'src/engine-eds.cpp' |
266 | --- src/engine-eds.cpp 2014-06-27 01:46:06 +0000 |
267 | +++ src/engine-eds.cpp 2014-09-17 16:59:23 +0000 |
268 | @@ -285,7 +285,7 @@ |
269 | if (e_cal_client_get_view_finish (E_CAL_CLIENT(client), res, &view, &error)) |
270 | { |
271 | // add the view to our collection |
272 | - e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, NULL); |
273 | + e_cal_client_view_set_flags(view, E_CAL_CLIENT_VIEW_FLAGS_NONE, nullptr); |
274 | e_cal_client_view_start(view, &error); |
275 | g_debug("got a view for %s", e_cal_client_get_local_attachment_store(E_CAL_CLIENT(client))); |
276 | auto self = static_cast<Impl*>(gself); |
277 | |
278 | === modified file 'src/planner-snooze.cpp' |
279 | --- src/planner-snooze.cpp 2014-09-03 04:44:00 +0000 |
280 | +++ src/planner-snooze.cpp 2014-09-17 16:59:23 +0000 |
281 | @@ -46,7 +46,7 @@ |
282 | { |
283 | } |
284 | |
285 | - virtual core::Property<std::vector<Appointment>>& appointments() |
286 | + core::Property<std::vector<Appointment>>& appointments() |
287 | { |
288 | return m_appointments; |
289 | } |
290 | |
291 | === modified file 'src/sound.cpp' |
292 | --- src/sound.cpp 2014-09-04 21:57:14 +0000 |
293 | +++ src/sound.cpp 2014-09-17 16:59:23 +0000 |
294 | @@ -113,17 +113,17 @@ |
295 | else if ((GST_MESSAGE_TYPE(msg) == GST_MESSAGE_STREAM_START) && (self->m_loop)) |
296 | { |
297 | /* Set the media role if audio sink is pulsesink */ |
298 | - GstElement *audio_sink = NULL; |
299 | - g_object_get(self->m_play, "audio-sink", &audio_sink, NULL); |
300 | + GstElement *audio_sink = nullptr; |
301 | + g_object_get(self->m_play, "audio-sink", &audio_sink, nullptr); |
302 | if (audio_sink) |
303 | { |
304 | - GstPluginFeature *feature = NULL; |
305 | + GstPluginFeature *feature = nullptr; |
306 | feature = GST_PLUGIN_FEATURE_CAST(GST_ELEMENT_GET_CLASS(audio_sink)->elementfactory); |
307 | if (feature && g_strcmp0(gst_plugin_feature_get_name(feature), "pulsesink") == 0) |
308 | { |
309 | std::string role_str("props,media.role=alarm"); |
310 | - GstStructure *props = gst_structure_from_string(role_str.c_str(), NULL); |
311 | - g_object_set(audio_sink, "stream-properties", props, NULL); |
312 | + GstStructure *props = gst_structure_from_string(role_str.c_str(), nullptr); |
313 | + g_object_set(audio_sink, "stream-properties", props, nullptr); |
314 | gst_structure_free(props); |
315 | } |
316 | gst_object_unref(audio_sink); |
317 | |
318 | === modified file 'src/wakeup-timer-powerd.cpp' |
319 | --- src/wakeup-timer-powerd.cpp 2014-08-19 04:08:38 +0000 |
320 | +++ src/wakeup-timer-powerd.cpp 2014-09-17 16:59:23 +0000 |
321 | @@ -195,7 +195,7 @@ |
322 | } |
323 | else |
324 | { |
325 | - const char* s = NULL; |
326 | + const char* s = nullptr; |
327 | g_variant_get(ret, "(&s)", &s); |
328 | g_debug("%s %s::requestWakeup() sent cookie %s", |
329 | G_STRLOC, BUS_POWERD_NAME, s); |
330 | |
331 | === modified file 'tests/actions-mock.h' |
332 | --- tests/actions-mock.h 2014-03-22 07:25:50 +0000 |
333 | +++ tests/actions-mock.h 2014-09-17 16:59:23 +0000 |
334 | @@ -31,7 +31,7 @@ |
335 | class MockActions: public Actions |
336 | { |
337 | public: |
338 | - MockActions(std::shared_ptr<State>& state_in): Actions(state_in) {} |
339 | + explicit MockActions(const std::shared_ptr<State>& state_in): Actions(state_in) {} |
340 | ~MockActions() =default; |
341 | |
342 | enum Action { DesktopOpenAlarmApp, |
343 | |
344 | === modified file 'tests/geoclue-fixture.h' |
345 | --- tests/geoclue-fixture.h 2014-02-02 21:29:29 +0000 |
346 | +++ tests/geoclue-fixture.h 2014-09-17 16:59:23 +0000 |
347 | @@ -17,6 +17,9 @@ |
348 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
349 | */ |
350 | |
351 | +#ifndef INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H |
352 | +#define INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H |
353 | + |
354 | #include "glib-fixture.h" |
355 | |
356 | #include <libdbustest/dbus-test.h> |
357 | @@ -39,7 +42,7 @@ |
358 | DbusTestDbusMockObject * obj_geo_addr = nullptr; |
359 | const std::string timezone_1 = "America/Denver"; |
360 | |
361 | - void SetUp () |
362 | + void SetUp () override |
363 | { |
364 | super::SetUp(); |
365 | |
366 | @@ -80,7 +83,7 @@ |
367 | g_string_free (gstr, TRUE); |
368 | } |
369 | |
370 | - virtual void TearDown () |
371 | + void TearDown () override |
372 | { |
373 | g_clear_object (&mock); |
374 | g_clear_object (&service); |
375 | @@ -148,3 +151,4 @@ |
376 | |
377 | }; |
378 | |
379 | +#endif /* INDICATOR_DATETIME_TESTS_GEOCLUE_FIXTURE_H */ |
380 | |
381 | === modified file 'tests/glib-fixture.h' |
382 | --- tests/glib-fixture.h 2014-01-29 03:15:39 +0000 |
383 | +++ tests/glib-fixture.h 2014-09-17 16:59:23 +0000 |
384 | @@ -17,6 +17,9 @@ |
385 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
386 | */ |
387 | |
388 | +#ifndef INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H |
389 | +#define INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H |
390 | + |
391 | #include <map> |
392 | |
393 | #include <glib.h> |
394 | @@ -29,6 +32,10 @@ |
395 | |
396 | class GlibFixture : public ::testing::Test |
397 | { |
398 | + public: |
399 | + |
400 | + virtual ~GlibFixture() =default; |
401 | + |
402 | private: |
403 | |
404 | //GLogFunc realLogHandler; |
405 | @@ -59,7 +66,7 @@ |
406 | |
407 | protected: |
408 | |
409 | - virtual void SetUp() |
410 | + virtual void SetUp() override |
411 | { |
412 | setlocale(LC_ALL, "C.UTF-8"); |
413 | |
414 | @@ -76,7 +83,7 @@ |
415 | |
416 | } |
417 | |
418 | - virtual void TearDown() |
419 | + virtual void TearDown() override |
420 | { |
421 | #if 0 |
422 | // confirm there aren't any unexpected log messages |
423 | @@ -136,3 +143,5 @@ |
424 | |
425 | GMainLoop * loop; |
426 | }; |
427 | + |
428 | +#endif /* INDICATOR_DATETIME_TESTS_GLIB_FIXTURE_H */ |
429 | |
430 | === modified file 'tests/manual-test-snap.cpp' |
431 | --- tests/manual-test-snap.cpp 2014-09-03 04:22:04 +0000 |
432 | +++ tests/manual-test-snap.cpp 2014-09-17 16:59:23 +0000 |
433 | @@ -47,7 +47,7 @@ |
434 | GOptionEntry entries[] = |
435 | { |
436 | { "volume", 'v', 0, G_OPTION_ARG_INT, &volume, "Volume level [1..100]", "volume" }, |
437 | - { NULL } |
438 | + { nullptr } |
439 | }; |
440 | } |
441 | |
442 | |
443 | === modified file 'tests/state-fixture.h' |
444 | --- tests/state-fixture.h 2014-01-22 05:27:45 +0000 |
445 | +++ tests/state-fixture.h 2014-09-17 16:59:23 +0000 |
446 | @@ -17,18 +17,30 @@ |
447 | * Charles Kerr <charles.kerr@canonical.com> |
448 | */ |
449 | |
450 | +#ifndef INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H |
451 | +#define INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H |
452 | + |
453 | #include "glib-fixture.h" |
454 | |
455 | #include "actions-mock.h" |
456 | #include "state-mock.h" |
457 | |
458 | -using namespace unity::indicator::datetime; |
459 | +namespace unity { |
460 | +namespace indicator { |
461 | +namespace datetime { |
462 | + |
463 | +/*** |
464 | +**** |
465 | +***/ |
466 | |
467 | class StateFixture: public GlibFixture |
468 | { |
469 | private: |
470 | typedef GlibFixture super; |
471 | |
472 | +public: |
473 | + virtual ~StateFixture() =default; |
474 | + |
475 | protected: |
476 | std::shared_ptr<MockState> m_mock_state; |
477 | std::shared_ptr<State> m_state; |
478 | @@ -56,5 +68,15 @@ |
479 | |
480 | super::TearDown(); |
481 | } |
482 | + |
483 | }; |
484 | |
485 | +/*** |
486 | +**** |
487 | +***/ |
488 | + |
489 | +} // namespace datetime |
490 | +} // namespace indicator |
491 | +} // namespace unity |
492 | + |
493 | +#endif /* INDICATOR_DATETIME_TESTS_STATE_FIXTURE_H */ |
494 | |
495 | === modified file 'tests/state-mock.h' |
496 | --- tests/state-mock.h 2014-03-10 02:08:47 +0000 |
497 | +++ tests/state-mock.h 2014-09-17 16:59:23 +0000 |
498 | @@ -17,12 +17,21 @@ |
499 | * Charles Kerr <charles.kerr@canonical.com> |
500 | */ |
501 | |
502 | +#ifndef INDICATOR_DATETIME_STATE_MOCK_H |
503 | +#define INDICATOR_DATETIME_STATE_MOCK_H |
504 | + |
505 | #include "planner-mock.h" |
506 | |
507 | #include <datetime/clock-mock.h> |
508 | #include <datetime/state.h> |
509 | |
510 | -using namespace unity::indicator::datetime; |
511 | +namespace unity { |
512 | +namespace indicator { |
513 | +namespace datetime { |
514 | + |
515 | +/*** |
516 | +**** |
517 | +***/ |
518 | |
519 | class MockState: public State |
520 | { |
521 | @@ -47,3 +56,12 @@ |
522 | } |
523 | }; |
524 | |
525 | +/*** |
526 | +**** |
527 | +***/ |
528 | + |
529 | +} // namespace datetime |
530 | +} // namespace indicator |
531 | +} // namespace unity |
532 | + |
533 | +#endif /* INDICATOR_DATETIME_STATE_MOCK_H */ |
534 | |
535 | === modified file 'tests/test-actions.cpp' |
536 | --- tests/test-actions.cpp 2014-03-24 16:18:12 +0000 |
537 | +++ tests/test-actions.cpp 2014-09-17 16:59:23 +0000 |
538 | @@ -55,12 +55,12 @@ |
539 | |
540 | protected: |
541 | |
542 | - virtual void SetUp() |
543 | + void SetUp() override |
544 | { |
545 | super::SetUp(); |
546 | } |
547 | |
548 | - virtual void TearDown() |
549 | + void TearDown() override |
550 | { |
551 | super::TearDown(); |
552 | } |
553 | |
554 | === modified file 'tests/test-dbus-fixture.h' |
555 | --- tests/test-dbus-fixture.h 2014-01-17 03:23:57 +0000 |
556 | +++ tests/test-dbus-fixture.h 2014-09-17 16:59:23 +0000 |
557 | @@ -17,6 +17,9 @@ |
558 | * Charles Kerr <charles.kerr@canonical.com> |
559 | */ |
560 | |
561 | +#ifndef INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H |
562 | +#define INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H |
563 | + |
564 | #include "glib-fixture.h" |
565 | |
566 | /*** |
567 | @@ -27,9 +30,10 @@ |
568 | { |
569 | public: |
570 | |
571 | - TestDBusFixture() {} |
572 | + TestDBusFixture() =default; |
573 | + virtual ~TestDBusFixture() =default; |
574 | |
575 | - TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {} |
576 | + explicit TestDBusFixture(const std::vector<std::string>& service_dirs_in): service_dirs(service_dirs_in) {} |
577 | |
578 | private: |
579 | |
580 | @@ -65,7 +69,7 @@ |
581 | GDBusConnection * system_bus; |
582 | const std::vector<std::string> service_dirs; |
583 | |
584 | - virtual void SetUp () |
585 | + virtual void SetUp() override |
586 | { |
587 | super::SetUp (); |
588 | |
589 | @@ -84,7 +88,7 @@ |
590 | g_main_loop_run (loop); |
591 | } |
592 | |
593 | - virtual void TearDown () |
594 | + virtual void TearDown() override |
595 | { |
596 | wait_msec(); |
597 | |
598 | @@ -100,3 +104,5 @@ |
599 | super::TearDown(); |
600 | } |
601 | }; |
602 | + |
603 | +#endif /* INDICATOR_DATETIME_TESTS_DBUS_FIXTURE_H */ |
604 | |
605 | === modified file 'tests/test-exporter.cpp' |
606 | --- tests/test-exporter.cpp 2014-09-02 15:37:03 +0000 |
607 | +++ tests/test-exporter.cpp 2014-09-17 16:59:23 +0000 |
608 | @@ -42,7 +42,7 @@ |
609 | |
610 | GTestDBus* bus = nullptr; |
611 | |
612 | - void SetUp() |
613 | + void SetUp() override |
614 | { |
615 | super::SetUp(); |
616 | |
617 | @@ -54,7 +54,7 @@ |
618 | g_setenv("DBUS_SESSION_BUS_ADDRESS", address, true); |
619 | } |
620 | |
621 | - void TearDown() |
622 | + void TearDown() override |
623 | { |
624 | GError * error = nullptr; |
625 | GDBusConnection* connection = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error); |
626 | @@ -76,9 +76,9 @@ |
627 | |
628 | TEST_F(ExporterFixture, Publish) |
629 | { |
630 | - std::shared_ptr<State> state(new MockState); |
631 | - std::shared_ptr<Actions> actions(new MockActions(state)); |
632 | - std::shared_ptr<Settings> settings(new Settings); |
633 | + auto state = std::make_shared<MockState>(); |
634 | + auto actions = std::make_shared<MockActions>(state); |
635 | + auto settings = std::make_shared<Settings>(); |
636 | std::vector<std::shared_ptr<Menu>> menus; |
637 | |
638 | MenuFactory menu_factory (actions, state); |
639 | |
640 | === modified file 'tests/test-formatter.cpp' |
641 | --- tests/test-formatter.cpp 2014-01-31 00:33:14 +0000 |
642 | +++ tests/test-formatter.cpp 2014-09-17 16:59:23 +0000 |
643 | @@ -46,7 +46,7 @@ |
644 | |
645 | std::shared_ptr<Settings> m_settings; |
646 | |
647 | - virtual void SetUp() |
648 | + void SetUp() override |
649 | { |
650 | super::SetUp(); |
651 | |
652 | @@ -54,7 +54,7 @@ |
653 | m_original_locale = g_strdup(setlocale(LC_TIME, nullptr)); |
654 | } |
655 | |
656 | - virtual void TearDown() |
657 | + void TearDown() override |
658 | { |
659 | m_settings.reset(); |
660 | |
661 | @@ -90,7 +90,7 @@ |
662 | TEST_F(FormatterFixture, TestPhoneHeader) |
663 | { |
664 | auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59); |
665 | - std::shared_ptr<Clock> clock(new MockClock(DateTime(now))); |
666 | + auto clock = std::make_shared<MockClock>(DateTime(now)); |
667 | g_date_time_unref(now); |
668 | |
669 | // test the default value in a 24h locale |
670 | @@ -143,7 +143,7 @@ |
671 | }; |
672 | |
673 | auto now = g_date_time_new_local(2020, 10, 31, 18, 30, 59); |
674 | - std::shared_ptr<Clock> clock(new MockClock(DateTime(now))); |
675 | + auto clock = std::make_shared<MockClock>(DateTime(now)); |
676 | g_date_time_unref(now); |
677 | |
678 | for(const auto& test_case : test_cases) |
679 | @@ -193,7 +193,7 @@ |
680 | { |
681 | if (test_case.is_12h ? Set12hLocale() : Set24hLocale()) |
682 | { |
683 | - std::shared_ptr<Clock> clock (new MockClock(DateTime(test_case.now))); |
684 | + auto clock = std::make_shared<MockClock>(DateTime(test_case.now)); |
685 | DesktopFormatter f(clock, m_settings); |
686 | |
687 | const auto fmt = f.relative_format(test_case.then); |
688 | @@ -236,7 +236,7 @@ |
689 | { |
690 | if (test_case.is_12h ? Set12hLocale() : Set24hLocale()) |
691 | { |
692 | - std::shared_ptr<Clock> clock(new MockClock(DateTime(test_case.now))); |
693 | + auto clock = std::make_shared<MockClock>(DateTime(test_case.now)); |
694 | DesktopFormatter f(clock, m_settings); |
695 | |
696 | const auto fmt = f.relative_format(test_case.then, test_case.then_end); |
697 | |
698 | === modified file 'tests/test-live-actions.cpp' |
699 | --- tests/test-live-actions.cpp 2014-03-22 07:25:50 +0000 |
700 | +++ tests/test-live-actions.cpp 2014-09-17 16:59:23 +0000 |
701 | @@ -26,17 +26,19 @@ |
702 | **** |
703 | ***/ |
704 | |
705 | +using namespace unity::indicator::datetime; |
706 | + |
707 | class MockLiveActions: public LiveActions |
708 | { |
709 | public: |
710 | std::string last_cmd; |
711 | std::string last_url; |
712 | - MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {} |
713 | - virtual ~MockLiveActions() {} |
714 | + explicit MockLiveActions(const std::shared_ptr<State>& state_in): LiveActions(state_in) {} |
715 | + ~MockLiveActions() {} |
716 | |
717 | protected: |
718 | - void dispatch_url(const std::string& url) { last_url = url; } |
719 | - void execute_command(const std::string& cmd) { last_cmd = cmd; } |
720 | + void dispatch_url(const std::string& url) override { last_url = url; } |
721 | + void execute_command(const std::string& cmd) override { last_cmd = cmd; } |
722 | }; |
723 | |
724 | /*** |
725 | |
726 | === modified file 'tests/test-locations.cpp' |
727 | --- tests/test-locations.cpp 2014-07-13 22:22:57 +0000 |
728 | +++ tests/test-locations.cpp 2014-09-17 16:59:23 +0000 |
729 | @@ -47,7 +47,7 @@ |
730 | const std::string nyc = "America/New_York"; |
731 | const std::string chicago = "America/Chicago"; |
732 | |
733 | - virtual void SetUp() |
734 | + void SetUp() override |
735 | { |
736 | super::SetUp(); |
737 | |
738 | @@ -65,7 +65,7 @@ |
739 | m_timezones->timezones.set(std::set<std::string>({ nyc, chicago })); |
740 | } |
741 | |
742 | - virtual void TearDown() |
743 | + void TearDown() override |
744 | { |
745 | m_timezones.reset(); |
746 | m_settings.reset(); |
747 | |
748 | === modified file 'tests/test-menus.cpp' |
749 | --- tests/test-menus.cpp 2014-06-27 01:52:36 +0000 |
750 | +++ tests/test-menus.cpp 2014-09-17 16:59:23 +0000 |
751 | @@ -39,7 +39,7 @@ |
752 | std::shared_ptr<MenuFactory> m_menu_factory; |
753 | std::vector<std::shared_ptr<Menu>> m_menus; |
754 | |
755 | - virtual void SetUp() |
756 | + void SetUp() override |
757 | { |
758 | super::SetUp(); |
759 | |
760 | @@ -49,7 +49,7 @@ |
761 | m_menus.push_back(m_menu_factory->buildMenu(Menu::Profile(i))); |
762 | } |
763 | |
764 | - virtual void TearDown() |
765 | + void TearDown() override |
766 | { |
767 | m_menus.clear(); |
768 | m_menu_factory.reset(); |
769 | |
770 | === modified file 'tests/test-settings.cpp' |
771 | --- tests/test-settings.cpp 2014-09-02 15:37:03 +0000 |
772 | +++ tests/test-settings.cpp 2014-09-17 16:59:23 +0000 |
773 | @@ -39,7 +39,7 @@ |
774 | std::shared_ptr<Settings> m_settings; |
775 | GSettings * m_gsettings; |
776 | |
777 | - virtual void SetUp() |
778 | + void SetUp() override |
779 | { |
780 | super::SetUp(); |
781 | |
782 | @@ -48,7 +48,7 @@ |
783 | m_settings = std::dynamic_pointer_cast<Settings>(m_live); |
784 | } |
785 | |
786 | - virtual void TearDown() |
787 | + void TearDown() override |
788 | { |
789 | g_clear_object(&m_gsettings); |
790 | m_settings.reset(); |
791 | |
792 | === modified file 'tests/test-snap.cpp' |
793 | --- tests/test-snap.cpp 2014-07-31 22:06:50 +0000 |
794 | +++ tests/test-snap.cpp 2014-09-17 16:59:23 +0000 |
795 | @@ -96,7 +96,7 @@ |
796 | DbusTestDbusMockObject * screen_obj = nullptr; |
797 | DbusTestDbusMockObject * haptic_obj = nullptr; |
798 | |
799 | - void SetUp() |
800 | + void SetUp() override |
801 | { |
802 | GError * error = nullptr; |
803 | char * str = nullptr; |
804 | @@ -269,18 +269,18 @@ |
805 | dbus_test_service_start_tasks(service); |
806 | g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE); |
807 | |
808 | - session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL); |
809 | + session_bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr); |
810 | ASSERT_NE(nullptr, session_bus); |
811 | g_dbus_connection_set_exit_on_close(session_bus, false); |
812 | g_object_add_weak_pointer(G_OBJECT(session_bus), (gpointer *)&session_bus); |
813 | |
814 | - system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL); |
815 | + system_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, nullptr); |
816 | ASSERT_NE(nullptr, system_bus); |
817 | g_dbus_connection_set_exit_on_close(system_bus, FALSE); |
818 | g_object_add_weak_pointer(G_OBJECT(system_bus), (gpointer *)&system_bus); |
819 | } |
820 | |
821 | - virtual void TearDown() |
822 | + void TearDown() override |
823 | { |
824 | g_clear_object(&haptic_mock); |
825 | g_clear_object(&screen_mock); |
826 | |
827 | === modified file 'tests/test-timezone-file.cpp' |
828 | --- tests/test-timezone-file.cpp 2014-05-05 15:06:34 +0000 |
829 | +++ tests/test-timezone-file.cpp 2014-09-17 16:59:23 +0000 |
830 | @@ -52,12 +52,12 @@ |
831 | |
832 | protected: |
833 | |
834 | - virtual void SetUp() |
835 | + void SetUp() override |
836 | { |
837 | super::SetUp(); |
838 | } |
839 | |
840 | - virtual void TearDown() |
841 | + void TearDown() override |
842 | { |
843 | super::TearDown(); |
844 | } |
845 | |
846 | === modified file 'tests/test-timezones.cpp' |
847 | --- tests/test-timezones.cpp 2014-01-22 15:06:01 +0000 |
848 | +++ tests/test-timezones.cpp 2014-09-17 16:59:23 +0000 |
849 | @@ -52,7 +52,7 @@ |
850 | std::string timezone_geo = "America/Denver"; |
851 | |
852 | set_file(timezone_file); |
853 | - std::shared_ptr<Settings> settings(new Settings); |
854 | + auto settings = std::make_shared<Settings>(); |
855 | LiveTimezones z(settings, TIMEZONE_FILE); |
856 | wait_msec(500); // wait for the bus to get set up |
857 | EXPECT_EQ(timezone_file, z.timezone.get()); |
PASSED: Continuous integration, rev:378 jenkins. qa.ubuntu. com/job/ indicator- datetime- ci/279/ jenkins. qa.ubuntu. com/job/ indicator- datetime- utopic- amd64-ci/ 53 jenkins. qa.ubuntu. com/job/ indicator- datetime- utopic- armhf-ci/ 53 jenkins. qa.ubuntu. com/job/ indicator- datetime- utopic- armhf-ci/ 53/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/indicator- datetime- ci/279/ rebuild
http://