## Summary
pluginloadtest and sendfiletest are crashing. This patch fixes that by allowing Daemon::init() to be called from TestDaemon ## Test Plan ### Before: Both tests are crashing because it is not able to find any devices. It is not able to find any devices because the LanLinkProvider is not being added because Daemon::init() is not being called. ### After: pluginloadtest and sendfiletest pass
This commit is contained in:
parent
163f10c797
commit
24ab6d15cf
5 changed files with 24 additions and 1 deletions
|
@ -179,6 +179,11 @@ Device*Daemon::getDevice(const QString& deviceId)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const QSet<LinkProvider*>& Daemon::getLinkProviders() const
|
||||
{
|
||||
return d->m_linkProviders;
|
||||
}
|
||||
|
||||
QStringList Daemon::devices(bool onlyReachable, bool onlyTrusted) const
|
||||
{
|
||||
QStringList ret;
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
|
||||
Device* getDevice(const QString& deviceId);
|
||||
|
||||
const QSet<LinkProvider*>& getLinkProviders() const;
|
||||
|
||||
QStringList pairingRequests() const;
|
||||
|
||||
Q_SCRIPTABLE QString selfId() const;
|
||||
|
|
|
@ -46,6 +46,10 @@ class PluginLoadTest : public QObject
|
|||
|
||||
private Q_SLOTS:
|
||||
void testPlugins() {
|
||||
if (!(m_daemon->getLinkProviders().size() > 0)) {
|
||||
QFAIL("No links available, but loopback should have been provided by the test");
|
||||
}
|
||||
|
||||
Device* d = nullptr;
|
||||
m_daemon->acquireDiscoveryMode(QStringLiteral("plugintest"));
|
||||
const QList<Device*> devicesList = m_daemon->devicesList();
|
||||
|
@ -57,6 +61,9 @@ class PluginLoadTest : public QObject
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (d == nullptr) {
|
||||
QFAIL("Unable to determine device");
|
||||
}
|
||||
m_daemon->releaseDiscoveryMode(QStringLiteral("plugintest"));
|
||||
|
||||
if (!d->loadedPlugins().contains(QStringLiteral("kdeconnect_remotecontrol"))) {
|
||||
|
|
|
@ -51,6 +51,10 @@ class TestSendFile : public QObject
|
|||
|
||||
private Q_SLOTS:
|
||||
void testSend() {
|
||||
if (!(m_daemon->getLinkProviders().size() > 0)) {
|
||||
QFAIL("No links available, but loopback should have been provided by the test");
|
||||
}
|
||||
|
||||
m_daemon->acquireDiscoveryMode(QStringLiteral("test"));
|
||||
Device* d = nullptr;
|
||||
const QList<Device*> devicesList = m_daemon->devicesList();
|
||||
|
@ -61,8 +65,10 @@ class TestSendFile : public QObject
|
|||
d = id;
|
||||
}
|
||||
}
|
||||
if (d == nullptr) {
|
||||
QFAIL("Unable to determine device");
|
||||
}
|
||||
m_daemon->releaseDiscoveryMode(QStringLiteral("test"));
|
||||
QVERIFY(d);
|
||||
QCOMPARE(d->isReachable(), true);
|
||||
QCOMPARE(d->isTrusted(), true);
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ public:
|
|||
: Daemon(parent, true)
|
||||
, m_nam(nullptr)
|
||||
{
|
||||
// Necessary to force the event loop to run because the test harness seems to behave differently
|
||||
// and we need the QTimer::SingleShot in Daemon's constructor to fire
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
void addDevice(Device* device) {
|
||||
|
|
Loading…
Reference in a new issue