summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew O'Doherty <andrew.odoherty@qt.io>2018-10-19 14:32:51 +0200
committerAndrew O'Doherty <andrew.odoherty@qt.io>2018-10-25 11:42:13 +0000
commit13e39c059fbf9dd85f52fb0b7c71ad6f419adee0 (patch)
tree965d699991b19e54866471823162bff3f0812e1c
parent269bd4455d5f702f7e5e0962826a4a0ab92485c0 (diff)
Expand autotest QKnxNetIpDeviceConfigurationAcknowledge
Change-Id: I18187a48d3443b4f3af7139bd10070936f8ec9bc Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--tests/auto/qknxnetipdeviceconfigurationacknowledge/tst_qknxnetipdeviceconfigurationacknowledge.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qknxnetipdeviceconfigurationacknowledge/tst_qknxnetipdeviceconfigurationacknowledge.cpp b/tests/auto/qknxnetipdeviceconfigurationacknowledge/tst_qknxnetipdeviceconfigurationacknowledge.cpp
index f348511..34cf0a4 100644
--- a/tests/auto/qknxnetipdeviceconfigurationacknowledge/tst_qknxnetipdeviceconfigurationacknowledge.cpp
+++ b/tests/auto/qknxnetipdeviceconfigurationacknowledge/tst_qknxnetipdeviceconfigurationacknowledge.cpp
@@ -29,6 +29,7 @@
#include <QtCore/qdebug.h>
#include <QtTest/qtest.h>
#include <QtKnx/qknxnetipdeviceconfigurationacknowledge.h>
+#include <QtKnx/QKnxNetIpConnectionHeader>
static QString s_msg;
static void myMessageHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
@@ -44,6 +45,7 @@ private slots:
void testDefaultConstructor();
void testConstructor();
void testDebugStream();
+ void testProxyMethods();
};
void tst_QKnxNetIpDeviceConfigurationAcknowledge::testDefaultConstructor()
@@ -75,6 +77,55 @@ void tst_QKnxNetIpDeviceConfigurationAcknowledge::testConstructor()
QCOMPARE(acknowledge.status(), QKnxNetIp::Error::ConnectionId);
}
+void tst_QKnxNetIpDeviceConfigurationAcknowledge::testProxyMethods()
+{
+ quint8 channelId = 255;
+ quint8 sequenceNumber = 250;
+ auto status = QKnxNetIp::Error::ConnectionId;
+ auto frame = QKnxNetIpDeviceConfigurationAcknowledgeProxy::builder()
+ .setChannelId(channelId)
+ .setSequenceNumber(sequenceNumber)
+ .setStatus(status)
+ .create();
+ {
+ // Check channelId(), status() and isValid() with Wrong service type
+ QKnxNetIpFrame frame = { QKnxNetIp::ServiceType::DisconnectRequest,
+ QKnxNetIpConnectionHeader { channelId,
+ sequenceNumber,
+ quint8(status) }
+ };
+ const QKnxNetIpDeviceConfigurationAcknowledgeProxy view(frame);
+ QCOMPARE(view.channelId(), channelId);
+ QCOMPARE(view.status(), status);
+ QCOMPARE(view.sequenceNumber(), sequenceNumber);
+ QCOMPARE(view.isValid(), false);
+ }
+ {
+ // Check channelId(), status(), sequenceNumber() and isValid() with
+ // valid device configuration acknowledge frame
+ QKnxNetIpFrame frame = { QKnxNetIp::ServiceType::DeviceConfigurationAcknowledge };
+ QCOMPARE(frame.header().size(), 6);
+ QCOMPARE(frame.dataSize(), 0);
+ QCOMPARE(frame.size(), 6);
+ const QKnxNetIpDeviceConfigurationAcknowledgeProxy view(frame);
+ QCOMPARE(view.isValid(), false);
+ }
+ {
+ // Check channelId(), status(), sequenceNumber() and isValid() with
+ // valid device configuration acknowledge frame
+ QKnxNetIpFrame frame = { QKnxNetIp::ServiceType::DeviceConfigurationAcknowledge,
+ QKnxNetIpConnectionHeader { channelId,
+ sequenceNumber,
+ quint8(status) }
+ };
+ const QKnxNetIpDeviceConfigurationAcknowledgeProxy view(frame);
+ QCOMPARE(view.channelId(), channelId);
+ QCOMPARE(view.status(), status);
+ QCOMPARE(view.sequenceNumber(), sequenceNumber);
+ QCOMPARE(view.isValid(), true);
+ }
+}
+
void tst_QKnxNetIpDeviceConfigurationAcknowledge::testDebugStream()
{
struct DebugHandler