diff --git a/core/daemon.h b/core/daemon.h index 41995701e..d230a407a 100644 --- a/core/daemon.h +++ b/core/daemon.h @@ -89,7 +89,7 @@ private Q_SLOTS: void onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl); void onDeviceStatusChanged(); -private: +protected: void addDevice(Device* device); bool isDiscoveringDevices() const; void removeDevice(Device* d); diff --git a/tests/sendfiletest.cpp b/tests/sendfiletest.cpp index 6eedbb9e0..914e1d309 100644 --- a/tests/sendfiletest.cpp +++ b/tests/sendfiletest.cpp @@ -103,6 +103,10 @@ class TestSendFile : public QObject kcc->addTrustedDevice(deviceId, deviceName, deviceType); kcc->setDeviceProperty(deviceId, QStringLiteral("certificate"), QString::fromLatin1(kcc->certificate().toPem())); // Using same certificate from kcc, instead of generating + //We need the device to be loaded on the daemon, otherwise CompositeUploadJob will get a null device + Device* device = new Device(this, deviceId); + m_daemon->addDevice(device); + QSharedPointer f(new QFile(aFile)); NetworkPacket np(PACKET_TYPE_SHARE_REQUEST); np.setPayload(f, aFile.size()); diff --git a/tests/testdaemon.h b/tests/testdaemon.h index 501f4f549..63fa57c21 100644 --- a/tests/testdaemon.h +++ b/tests/testdaemon.h @@ -33,6 +33,10 @@ public: { } + void addDevice(Device* device) { + Daemon::addDevice(device); + } + void reportError(const QString & title, const QString & description) override { qWarning() << "error:" << title << description; @@ -50,7 +54,7 @@ public: return m_nam; } - Q_SCRIPTABLE virtual void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) override + Q_SCRIPTABLE virtual void sendSimpleNotification(const QString &eventId, const QString &title, const QString &text, const QString &iconName) override { qDebug() << eventId << title << text << iconName; }