Make test not crash
This commit is contained in:
parent
4d059af839
commit
a8e9c0d002
3 changed files with 10 additions and 2 deletions
|
@ -89,7 +89,7 @@ private Q_SLOTS:
|
||||||
void onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl);
|
void onNewDeviceLink(const NetworkPacket& identityPacket, DeviceLink* dl);
|
||||||
void onDeviceStatusChanged();
|
void onDeviceStatusChanged();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void addDevice(Device* device);
|
void addDevice(Device* device);
|
||||||
bool isDiscoveringDevices() const;
|
bool isDiscoveringDevices() const;
|
||||||
void removeDevice(Device* d);
|
void removeDevice(Device* d);
|
||||||
|
|
|
@ -103,6 +103,10 @@ class TestSendFile : public QObject
|
||||||
kcc->addTrustedDevice(deviceId, deviceName, deviceType);
|
kcc->addTrustedDevice(deviceId, deviceName, deviceType);
|
||||||
kcc->setDeviceProperty(deviceId, QStringLiteral("certificate"), QString::fromLatin1(kcc->certificate().toPem())); // Using same certificate from kcc, instead of generating
|
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));
|
QSharedPointer<QFile> f(new QFile(aFile));
|
||||||
NetworkPacket np(PACKET_TYPE_SHARE_REQUEST);
|
NetworkPacket np(PACKET_TYPE_SHARE_REQUEST);
|
||||||
np.setPayload(f, aFile.size());
|
np.setPayload(f, aFile.size());
|
||||||
|
|
|
@ -33,6 +33,10 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addDevice(Device* device) {
|
||||||
|
Daemon::addDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
void reportError(const QString & title, const QString & description) override
|
void reportError(const QString & title, const QString & description) override
|
||||||
{
|
{
|
||||||
qWarning() << "error:" << title << description;
|
qWarning() << "error:" << title << description;
|
||||||
|
|
Loading…
Reference in a new issue