Make test not crash

This commit is contained in:
Albert Vaca Cintora 2019-02-13 00:09:04 +01:00
parent 4d059af839
commit a8e9c0d002
3 changed files with 10 additions and 2 deletions

View file

@ -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);

View file

@ -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<QFile> f(new QFile(aFile));
NetworkPacket np(PACKET_TYPE_SHARE_REQUEST);
np.setPayload(f, aFile.size());

View file

@ -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;
}