From 39550ff6ea66e13f552932976ba92788ad189619 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 3 Sep 2013 02:14:55 +0200 Subject: [PATCH] Type was missing for identity packages Added a test for it --- kded/networkpackage.cpp | 1 + tests/networkpackagetests.cpp | 10 ++++++++++ tests/networkpackagetests.h | 1 + 3 files changed, 12 insertions(+) diff --git a/kded/networkpackage.cpp b/kded/networkpackage.cpp index 74bbdf4b4..c636c5e8d 100644 --- a/kded/networkpackage.cpp +++ b/kded/networkpackage.cpp @@ -136,6 +136,7 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np) KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc"); QString id = config->group("myself").readEntry("id",""); np->mId = QString::number(QDateTime::currentMSecsSinceEpoch()); + np->mType = PACKAGE_TYPE_IDENTITY; np->set("deviceId", id); np->set("deviceName", QHostInfo::localHostName()); np->set("protocolVersion", NetworkPackage::ProtocolVersion); diff --git a/tests/networkpackagetests.cpp b/tests/networkpackagetests.cpp index b2f3096f8..806ab93a6 100644 --- a/tests/networkpackagetests.cpp +++ b/tests/networkpackagetests.cpp @@ -79,6 +79,16 @@ void NetworkPackageTests::networkPackageTest() } +void NetworkPackageTests::networkPackageIdentityTest() +{ + NetworkPackage np(""); + NetworkPackage::createIdentityPackage(&np); + + QCOMPARE( np.get("protocolVersion") , NetworkPackage::ProtocolVersion ); + QCOMPARE( np.type() , PACKAGE_TYPE_IDENTITY ); + +} + void NetworkPackageTests::networkPackageEncryptionTest() { diff --git a/tests/networkpackagetests.h b/tests/networkpackagetests.h index b91eab9cf..bb2b74379 100644 --- a/tests/networkpackagetests.h +++ b/tests/networkpackagetests.h @@ -32,6 +32,7 @@ private Q_SLOTS: void dummyTest(); void networkPackageTest(); + void networkPackageIdentityTest(); void networkPackageEncryptionTest(); void cleanupTestCase();