summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>2016-03-09 14:52:06 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2016-03-09 13:55:14 +0000
commit63e40c9f8ac12e280ae89e938916d5a65bdda8c2 (patch)
tree4e37c9646da6ff7f91f9e74893b6094847536627 /tests
parentd0c415d0ac9d59caf309452d2bfd7d3927fb8bba (diff)
Add API to set and retrieve the Modbus RTU inter frame delay.
Change-Id: Id09913509802c74b1a389d7a83a1136bbeccbaf6 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/qmodbusrtuserialmaster/qmodbusrtuserialmaster.pro8
-rw-r--r--tests/auto/qmodbusrtuserialmaster/tst_qmodbusrtuserialmaster.cpp62
3 files changed, 72 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 838eb53..2542d65 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -11,7 +11,8 @@ SUBDIRS += cmake \
qmodbusserver \
qmodbuscommevent \
qmodbusadu \
- qmodbusdeviceidentification
+ qmodbusdeviceidentification \
+ qmodbusrtuserialmaster
qcanbus.depends += plugins
qcanbusdevice.depends += plugins
diff --git a/tests/auto/qmodbusrtuserialmaster/qmodbusrtuserialmaster.pro b/tests/auto/qmodbusrtuserialmaster/qmodbusrtuserialmaster.pro
new file mode 100644
index 0000000..3125a27
--- /dev/null
+++ b/tests/auto/qmodbusrtuserialmaster/qmodbusrtuserialmaster.pro
@@ -0,0 +1,8 @@
+CONFIG -= app_bundle
+CONFIG += testcase c++11
+
+QT = core testlib serialbus
+
+TARGET = tst_qmodbusrtuserialmaster
+SOURCES += tst_qmodbusrtuserialmaster.cpp
+
diff --git a/tests/auto/qmodbusrtuserialmaster/tst_qmodbusrtuserialmaster.cpp b/tests/auto/qmodbusrtuserialmaster/tst_qmodbusrtuserialmaster.cpp
new file mode 100644
index 0000000..589ec46
--- /dev/null
+++ b/tests/auto/qmodbusrtuserialmaster/tst_qmodbusrtuserialmaster.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtSerialBus module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtSerialBus/qmodbusrtuserialmaster.h>
+#include <QtSerialPort/qserialport.h>
+
+#include <QtTest/QtTest>
+
+class tst_QModbusRtuSerialMaster : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testInterFrameDelay()
+ {
+ QModbusRtuSerialMaster qmrsm;
+ QCOMPARE(qmrsm.interFrameDelay(), 2000);
+ qmrsm.setInterFrameDelay(1000);
+ QCOMPARE(qmrsm.interFrameDelay(), 2000);
+ qmrsm.setInterFrameDelay(3000);
+ QCOMPARE(qmrsm.interFrameDelay(), 3000);
+ qmrsm.setInterFrameDelay(-1);
+ QCOMPARE(qmrsm.interFrameDelay(), 2000);
+ }
+};
+
+QTEST_MAIN(tst_QModbusRtuSerialMaster)
+
+#include "tst_qmodbusrtuserialmaster.moc"