2 * Copyright (C) 2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "URLDispatcher.h"
19#include <QDBusInterface>
23class URLDispatcherTest : public QObject
30 dispatchServer = new QDBusInterface("com.canonical.URLDispatcher",
31 "/com/canonical/URLDispatcher",
32 "com.canonical.URLDispatcher",
33 QDBusConnection::sessionBus(), this);
38 dispatcher = new URLDispatcher(this);
39 dispatchSpy = new QSignalSpy(dispatcher,
40 SIGNAL(urlRequested(const QString &)));
48 void testInactiveByDefault() {
49 QVERIFY(!dispatcher->active());
52 void testActiveRequest() {
53 dispatcher->setActive(true);
54 dispatchServer->call("DispatchURL", "test:", "package");
55 QCOMPARE(dispatchSpy->count(), 1);
56 QCOMPARE((*dispatchSpy)[0][0], QVariant("test:"));
59 void testInactiveRequest() {
60 dispatchServer->call("DispatchURL", "test:", "package");
61 QCOMPARE(dispatchSpy->count(), 0);
64 void testInactiveAfterActiveRequest() {
65 dispatcher->setActive(true);
66 dispatcher->setActive(false);
67 dispatchServer->call("DispatchURL", "test:", "package");
68 QCOMPARE(dispatchSpy->count(), 0);
72 QDBusInterface *dispatchServer;
73 URLDispatcher *dispatcher;
74 QSignalSpy *dispatchSpy;
77QTEST_GUILESS_MAIN(URLDispatcherTest)
78#include "URLDispatcherTest.moc"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list