Merge lp:~mandel/ubuntu-download-manager/remove-tests-qdebug into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 130
Merged at revision: 140
Proposed branch: lp:~mandel/ubuntu-download-manager/remove-tests-qdebug
Merge into: lp:ubuntu-download-manager
Prerequisite: lp:~mandel/ubuntu-download-manager/valid-hash-method
Diff against target: 489 lines (+123/-28)
21 files modified
ubuntu-download-manager-tests/base_testcase.cpp (+39/-0)
ubuntu-download-manager-tests/base_testcase.h (+36/-0)
ubuntu-download-manager-tests/test_download.cpp (+2/-1)
ubuntu-download-manager-tests/test_download.h (+3/-2)
ubuntu-download-manager-tests/test_download_daemon.cpp (+2/-1)
ubuntu-download-manager-tests/test_download_daemon.h (+3/-2)
ubuntu-download-manager-tests/test_download_factory.cpp (+2/-1)
ubuntu-download-manager-tests/test_download_factory.h (+3/-2)
ubuntu-download-manager-tests/test_download_manager.cpp (+2/-1)
ubuntu-download-manager-tests/test_download_manager.h (+3/-2)
ubuntu-download-manager-tests/test_download_queue.cpp (+2/-1)
ubuntu-download-manager-tests/test_download_queue.h (+3/-2)
ubuntu-download-manager-tests/test_downloads_db.cpp (+2/-1)
ubuntu-download-manager-tests/test_downloads_db.h (+3/-2)
ubuntu-download-manager-tests/test_group_download.cpp (+2/-1)
ubuntu-download-manager-tests/test_group_download.h (+3/-2)
ubuntu-download-manager-tests/test_network_reply.cpp (+2/-1)
ubuntu-download-manager-tests/test_network_reply.h (+3/-2)
ubuntu-download-manager-tests/test_xdg_basedir.cpp (+2/-1)
ubuntu-download-manager-tests/test_xdg_basedir.h (+2/-1)
ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro (+4/-2)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/remove-tests-qdebug
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
dobey (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+187491@code.launchpad.net

Commit message

Add BaseTestCase that removes the qDebug output so that we have a cleaner tests results output.

Description of the change

Add BaseTestCase that removes the qDebug output so that we have a cleaner tests results output. To test the branch just run the tests and enjoy the nicer output.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
129. By Manuel de la Peña

Merged valid-hash-method into remove-tests-qdebug.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
130. By Manuel de la Peña

Merged valid-hash-method into remove-tests-qdebug.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Mike McCracken (mikemc) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'ubuntu-download-manager-tests/base_testcase.cpp'
2--- ubuntu-download-manager-tests/base_testcase.cpp 1970-01-01 00:00:00 +0000
3+++ ubuntu-download-manager-tests/base_testcase.cpp 2013-09-25 16:08:34 +0000
4@@ -0,0 +1,39 @@
5+/*
6+ * Copyright 2013 Canonical Ltd.
7+ *
8+ * This library is free software; you can redistribute it and/or
9+ * modify it under the terms of version 3 of the GNU Lesser General Public
10+ * License as published by the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+ * General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU Lesser General Public
18+ * License along with this library; if not, write to the
19+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20+ * Boston, MA 02110-1301, USA.
21+ */
22+
23+#include <QtGlobal>
24+#include "./base_testcase.h"
25+
26+void
27+noMessageOutput(QtMsgType type,
28+ const QMessageLogContext& context,
29+ const QString &message) {
30+ Q_UNUSED(type);
31+ Q_UNUSED(context);
32+ Q_UNUSED(message);
33+ // do nothing
34+}
35+
36+BaseTestCase::BaseTestCase(QObject *parent)
37+ : QObject(parent) {
38+}
39+
40+void
41+BaseTestCase::init() {
42+ qInstallMessageHandler(noMessageOutput);
43+}
44
45=== added file 'ubuntu-download-manager-tests/base_testcase.h'
46--- ubuntu-download-manager-tests/base_testcase.h 1970-01-01 00:00:00 +0000
47+++ ubuntu-download-manager-tests/base_testcase.h 2013-09-25 16:08:34 +0000
48@@ -0,0 +1,36 @@
49+/*
50+ * Copyright 2013 Canonical Ltd.
51+ *
52+ * This library is free software; you can redistribute it and/or
53+ * modify it under the terms of version 3 of the GNU Lesser General Public
54+ * License as published by the Free Software Foundation.
55+ *
56+ * This program is distributed in the hope that it will be useful,
57+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
58+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59+ * General Public License for more details.
60+ *
61+ * You should have received a copy of the GNU Lesser General Public
62+ * License along with this library; if not, write to the
63+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
64+ * Boston, MA 02110-1301, USA.
65+ */
66+
67+#ifndef BASE_TESTCASE_H
68+#define BASE_TESTCASE_H
69+
70+#include <QObject>
71+
72+class BaseTestCase : public QObject
73+{
74+ Q_OBJECT
75+ public:
76+ explicit BaseTestCase(QObject *parent = 0);
77+
78+ protected slots: // NOLINT(whitespace/indent)
79+
80+ virtual void init();
81+
82+};
83+
84+#endif // BASE_TESTCASE_H
85
86=== modified file 'ubuntu-download-manager-tests/test_download.cpp'
87--- ubuntu-download-manager-tests/test_download.cpp 2013-09-25 16:08:34 +0000
88+++ ubuntu-download-manager-tests/test_download.cpp 2013-09-25 16:08:34 +0000
89@@ -27,7 +27,7 @@
90 #include "./test_download.h"
91
92 TestDownload::TestDownload(QObject* parent)
93- : QObject(parent) {
94+ : BaseTestCase(parent) {
95 }
96
97 bool
98@@ -57,6 +57,7 @@
99
100 void
101 TestDownload::init() {
102+ BaseTestCase::init();
103 // set the xdg path so that we have control over it
104 _testDir = QDir("./tests");
105 _testDir.makeAbsolute();
106
107=== modified file 'ubuntu-download-manager-tests/test_download.h'
108--- ubuntu-download-manager-tests/test_download.h 2013-09-25 16:08:34 +0000
109+++ ubuntu-download-manager-tests/test_download.h 2013-09-25 16:08:34 +0000
110@@ -26,9 +26,10 @@
111 #include "./fake_system_network_info.h"
112 #include "./fake_request_factory.h"
113 #include "./fake_process_factory.h"
114+#include "./base_testcase.h"
115 #include "./test_runner.h"
116
117-class TestDownload: public QObject {
118+class TestDownload: public BaseTestCase {
119 Q_OBJECT
120
121 public:
122@@ -36,7 +37,7 @@
123
124 private slots: // NOLINT(whitespace/indent)
125
126- void init();
127+ void init() override;
128 void cleanup();
129
130 // constructors tests
131
132=== modified file 'ubuntu-download-manager-tests/test_download_daemon.cpp'
133--- ubuntu-download-manager-tests/test_download_daemon.cpp 2013-09-20 15:54:50 +0000
134+++ ubuntu-download-manager-tests/test_download_daemon.cpp 2013-09-25 16:08:34 +0000
135@@ -19,11 +19,12 @@
136 #include "./test_download_daemon.h"
137
138 TestDownloadDaemon::TestDownloadDaemon(QObject *parent)
139- : QObject(parent) {
140+ : BaseTestCase(parent) {
141 }
142
143 void
144 TestDownloadDaemon::init() {
145+ BaseTestCase::init();
146 _timer = new FakeTimer();
147 _app = new FakeApplication();
148 _appPointer = QSharedPointer<Application>(_app);
149
150=== modified file 'ubuntu-download-manager-tests/test_download_daemon.h'
151--- ubuntu-download-manager-tests/test_download_daemon.h 2013-09-20 15:54:50 +0000
152+++ ubuntu-download-manager-tests/test_download_daemon.h 2013-09-25 16:08:34 +0000
153@@ -25,9 +25,10 @@
154 #include "./fake_dbus_connection.h"
155 #include "./fake_download_manager.h"
156 #include "./fake_timer.h"
157+#include "./base_testcase.h"
158 #include "./test_runner.h"
159
160-class TestDownloadDaemon : public QObject {
161+class TestDownloadDaemon : public BaseTestCase {
162 Q_OBJECT
163
164 public:
165@@ -35,7 +36,7 @@
166
167 private slots: // NOLINT(whitespace/indent)
168
169- void init();
170+ void init() override;
171 void cleanup();
172 void testStart();
173 void testStartFailServiceRegister();
174
175=== modified file 'ubuntu-download-manager-tests/test_download_factory.cpp'
176--- ubuntu-download-manager-tests/test_download_factory.cpp 2013-09-25 16:08:34 +0000
177+++ ubuntu-download-manager-tests/test_download_factory.cpp 2013-09-25 16:08:34 +0000
178@@ -21,11 +21,12 @@
179 #include "./test_download_factory.h"
180
181 TestDownloadFactory::TestDownloadFactory(QObject *parent)
182- : QObject(parent) {
183+ : BaseTestCase(parent) {
184 }
185
186 void
187 TestDownloadFactory::init() {
188+ BaseTestCase::init();
189 _uuidFactory = QSharedPointer<UuidFactory>(new FakeUuidFactory());
190 _apparmor = new FakeAppArmor(_uuidFactory);
191 _networkInfo = QSharedPointer<SystemNetworkInfo>(
192
193=== modified file 'ubuntu-download-manager-tests/test_download_factory.h'
194--- ubuntu-download-manager-tests/test_download_factory.h 2013-09-16 15:57:06 +0000
195+++ ubuntu-download-manager-tests/test_download_factory.h 2013-09-25 16:08:34 +0000
196@@ -26,9 +26,10 @@
197 #include "./fake_request_factory.h"
198 #include "./fake_process_factory.h"
199 #include "./fake_uuid_factory.h"
200+#include "./base_testcase.h"
201 #include "./test_runner.h"
202
203-class TestDownloadFactory : public QObject {
204+class TestDownloadFactory : public BaseTestCase {
205 Q_OBJECT
206
207 public:
208@@ -36,7 +37,7 @@
209
210 private slots: // NOLINT(whitespace/indent)
211
212- void init();
213+ void init() override;
214 void cleanup();
215
216 void testCreateDownload();
217
218=== modified file 'ubuntu-download-manager-tests/test_download_manager.cpp'
219--- ubuntu-download-manager-tests/test_download_manager.cpp 2013-09-20 15:54:50 +0000
220+++ ubuntu-download-manager-tests/test_download_manager.cpp 2013-09-25 16:08:34 +0000
221@@ -24,11 +24,12 @@
222 #include "./test_download_manager.h"
223
224 TestDownloadManager::TestDownloadManager(QObject *parent)
225- : QObject(parent) {
226+ : BaseTestCase(parent) {
227 }
228
229 void
230 TestDownloadManager::init() {
231+ BaseTestCase::init();
232 _app = new FakeApplication();
233 _appPointer = QSharedPointer<Application>(_app);
234 _conn = QSharedPointer<FakeDBusConnection>(new FakeDBusConnection());
235
236=== modified file 'ubuntu-download-manager-tests/test_download_manager.h'
237--- ubuntu-download-manager-tests/test_download_manager.h 2013-09-20 15:54:50 +0000
238+++ ubuntu-download-manager-tests/test_download_manager.h 2013-09-25 16:08:34 +0000
239@@ -32,8 +32,9 @@
240 #include "./fake_request_factory.h"
241 #include "./fake_uuid_factory.h"
242 #include "./fake_system_network_info.h"
243+#include "./base_testcase.h"
244
245-class TestDownloadManager : public QObject {
246+class TestDownloadManager : public BaseTestCase {
247 Q_OBJECT
248
249 public:
250@@ -41,7 +42,7 @@
251
252 private slots: // NOLINT(whitespace/indent)
253
254- void init();
255+ void init() override;
256 void cleanup();
257
258 // data functions
259
260=== modified file 'ubuntu-download-manager-tests/test_download_queue.cpp'
261--- ubuntu-download-manager-tests/test_download_queue.cpp 2013-09-16 15:57:06 +0000
262+++ ubuntu-download-manager-tests/test_download_queue.cpp 2013-09-25 16:08:34 +0000
263@@ -21,11 +21,12 @@
264 #include "./test_download_queue.h"
265
266 TestDownloadQueue::TestDownloadQueue(QObject *parent)
267- : QObject(parent) {
268+ : BaseTestCase(parent) {
269 }
270
271 void
272 TestDownloadQueue::init() {
273+ BaseTestCase::init();
274 _isConfined = true;
275 _rootPath = "/random/root/path";
276 _networkInfo = new FakeSystemNetworkInfo();
277
278=== modified file 'ubuntu-download-manager-tests/test_download_queue.h'
279--- ubuntu-download-manager-tests/test_download_queue.h 2013-09-16 15:57:06 +0000
280+++ ubuntu-download-manager-tests/test_download_queue.h 2013-09-25 16:08:34 +0000
281@@ -27,8 +27,9 @@
282 #include "./fake_request_factory.h"
283 #include "./fake_process_factory.h"
284 #include "./fake_system_network_info.h"
285+#include "./base_testcase.h"
286
287-class TestDownloadQueue : public QObject {
288+class TestDownloadQueue : public BaseTestCase {
289 Q_OBJECT
290
291 public:
292@@ -36,7 +37,7 @@
293
294 private slots: // NOLINT(whitespace/indent)
295
296- void init();
297+ void init() override;
298 void cleanup();
299
300 void testAddDownload();
301
302=== modified file 'ubuntu-download-manager-tests/test_downloads_db.cpp'
303--- ubuntu-download-manager-tests/test_downloads_db.cpp 2013-09-25 16:08:34 +0000
304+++ ubuntu-download-manager-tests/test_downloads_db.cpp 2013-09-25 16:08:34 +0000
305@@ -38,7 +38,7 @@
306 "FROM SingleDownload WHERE uuid=:uuid;"
307
308 TestDownloadsDb::TestDownloadsDb(QObject *parent)
309- : QObject(parent) {
310+ : BaseTestCase(parent) {
311 }
312
313 bool
314@@ -69,6 +69,7 @@
315
316 void
317 TestDownloadsDb::init() {
318+ BaseTestCase::init();
319 _testDir = QDir("./tests");
320 _testDir.makeAbsolute();
321
322
323=== modified file 'ubuntu-download-manager-tests/test_downloads_db.h'
324--- ubuntu-download-manager-tests/test_downloads_db.h 2013-09-04 10:32:18 +0000
325+++ ubuntu-download-manager-tests/test_downloads_db.h 2013-09-25 16:08:34 +0000
326@@ -22,16 +22,17 @@
327 #include <QObject>
328 #include <QSqlDatabase>
329 #include <downloads_db.h>
330+#include "./base_testcase.h"
331 #include "./test_runner.h"
332
333-class TestDownloadsDb : public QObject {
334+class TestDownloadsDb : public BaseTestCase {
335 Q_OBJECT
336 public:
337 explicit TestDownloadsDb(QObject *parent = 0);
338
339 private slots: // NOLINT(whitespace/indent)
340
341- void init();
342+ void init() override;
343 void cleanup();
344
345 void testTableCreations_data();
346
347=== modified file 'ubuntu-download-manager-tests/test_group_download.cpp'
348--- ubuntu-download-manager-tests/test_group_download.cpp 2013-09-25 16:08:34 +0000
349+++ ubuntu-download-manager-tests/test_group_download.cpp 2013-09-25 16:08:34 +0000
350@@ -22,11 +22,12 @@
351 #include "./test_group_download.h"
352
353 TestGroupDownload::TestGroupDownload(QObject *parent)
354- : QObject(parent) {
355+ : BaseTestCase(parent) {
356 }
357
358 void
359 TestGroupDownload::init() {
360+ BaseTestCase::init();
361 _id = QUuid::createUuid();
362 _path = "/group/dbus/path";
363 _isConfined = true;
364
365=== modified file 'ubuntu-download-manager-tests/test_group_download.h'
366--- ubuntu-download-manager-tests/test_group_download.h 2013-09-25 16:08:34 +0000
367+++ ubuntu-download-manager-tests/test_group_download.h 2013-09-25 16:08:34 +0000
368@@ -28,9 +28,10 @@
369 #include "./fake_request_factory.h"
370 #include "./fake_process_factory.h"
371 #include "./fake_download_factory.h"
372+#include "./base_testcase.h"
373 #include "./test_runner.h"
374
375-class TestGroupDownload : public QObject {
376+class TestGroupDownload : public BaseTestCase {
377 Q_OBJECT
378
379 public:
380@@ -38,7 +39,7 @@
381
382 private slots: // NOLINT(whitespace/indent)
383
384- void init();
385+ void init() override;
386 void cleanup();
387
388 void testCancelNoDownloads();
389
390=== modified file 'ubuntu-download-manager-tests/test_network_reply.cpp'
391--- ubuntu-download-manager-tests/test_network_reply.cpp 2013-07-24 14:36:49 +0000
392+++ ubuntu-download-manager-tests/test_network_reply.cpp 2013-09-25 16:08:34 +0000
393@@ -22,11 +22,12 @@
394 #include "./fake_qnetwork_reply.h"
395
396 TestNetworkReply::TestNetworkReply(QObject *parent)
397- : QObject(parent) {
398+ : BaseTestCase(parent) {
399 }
400
401 void
402 TestNetworkReply::init() {
403+ BaseTestCase::init();
404 _qReply = new FakeQNetworkReply();
405 _reply = new NetworkReply(_qReply);
406 }
407
408=== modified file 'ubuntu-download-manager-tests/test_network_reply.h'
409--- ubuntu-download-manager-tests/test_network_reply.h 2013-07-24 14:37:36 +0000
410+++ ubuntu-download-manager-tests/test_network_reply.h 2013-09-25 16:08:34 +0000
411@@ -21,9 +21,10 @@
412
413 #include <QObject>
414 #include <network_reply.h>
415+#include "./base_testcase.h"
416 #include "./test_runner.h"
417
418-class TestNetworkReply : public QObject {
419+class TestNetworkReply : public BaseTestCase {
420 Q_OBJECT
421
422 public:
423@@ -31,7 +32,7 @@
424
425 private slots: // NOLINT(whitespace/indent)
426
427- void init();
428+ void init() override;
429 void cleanup();
430
431 // data functions used in the tests
432
433=== modified file 'ubuntu-download-manager-tests/test_xdg_basedir.cpp'
434--- ubuntu-download-manager-tests/test_xdg_basedir.cpp 2013-07-24 15:30:54 +0000
435+++ ubuntu-download-manager-tests/test_xdg_basedir.cpp 2013-09-25 16:08:34 +0000
436@@ -24,11 +24,12 @@
437
438
439 TestXDGBasedir::TestXDGBasedir(QObject *parent)
440- : QObject(parent) {
441+ : BaseTestCase(parent) {
442 }
443
444 void
445 TestXDGBasedir::init() {
446+ BaseTestCase::init();
447 QList<QString> envVars;
448 envVars << "XDG_CACHE_HOME" << "XDG_CONFIG_HOME" << "XDG_DATA_HOME"
449 << "XDG_CONFIG_DIRS" << "XDG_DATA_DIRS";
450
451=== modified file 'ubuntu-download-manager-tests/test_xdg_basedir.h'
452--- ubuntu-download-manager-tests/test_xdg_basedir.h 2013-07-24 15:48:37 +0000
453+++ ubuntu-download-manager-tests/test_xdg_basedir.h 2013-09-25 16:08:34 +0000
454@@ -22,10 +22,11 @@
455 #include <functional>
456 #include <QHash>
457 #include <QObject>
458+#include "./base_testcase.h"
459 #include "./xdg_basedir.h"
460 #include "./test_runner.h"
461
462-class TestXDGBasedir : public QObject {
463+class TestXDGBasedir : public BaseTestCase {
464 Q_OBJECT
465
466 public:
467
468=== modified file 'ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro'
469--- ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro 2013-09-10 12:18:34 +0000
470+++ ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro 2013-09-25 16:08:34 +0000
471@@ -40,7 +40,8 @@
472 fake_file_manager.cpp \
473 test_downloads_db.cpp \
474 test_download_factory.cpp \
475- fake_apparmor.cpp
476+ fake_apparmor.cpp \
477+ base_testcase.cpp
478
479 HEADERS += \
480 fake.h \
481@@ -69,7 +70,8 @@
482 fake_file_manager.h \
483 test_downloads_db.h \
484 test_download_factory.h \
485- fake_apparmor.h
486+ fake_apparmor.h \
487+ base_testcase.h
488
489 LIBS += -L$$OUT_PWD/../libubuntudownloadmanager/ -lubuntudownloadmanager
490

Subscribers

People subscribed via source and target branches