summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2018-02-27 14:14:08 +0100
committerAlex Blasche <alexander.blasche@qt.io>2018-03-06 08:31:46 +0000
commit21538dece0e38e0d4ab9bc6b4580687b40a411fa (patch)
treec9e29ee02423b0c4f6e38d40e14a7a7128a44c86 /tests
parent860c798835ae8846e4100ea6557bed28317713bb (diff)
Ensure QModbusDevice::close() handles being unconnected alreadyv5.11.0-beta2
Prior to this change, an unconnected device would transition into the Closing state if disconnectDevice() was called. Since the transition to Unconnected is bound to sockets being closed the already unconnected ModbusDevice would forever hang in CLosing. Task-number: QTBUG-66648 Change-Id: Ia439f6b63b7d4ab7f377a45fb09cb5f5b99627f7 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp b/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
index 836d881..748c4bf 100644
--- a/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
+++ b/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
@@ -64,6 +64,7 @@ private slots:
void cleanupTestCase();
void connectDevice();
+ void disconnectDevice();
void state();
void error();
@@ -98,6 +99,15 @@ void tst_QModbusDevice::connectDevice()
QVERIFY(!device->connectDevice());
}
+void tst_QModbusDevice::disconnectDevice()
+{
+ //see QTBUG-66648
+ DummyDevice dev;
+ QCOMPARE(dev.state(), QModbusDevice::UnconnectedState);
+ dev.disconnectDevice();
+ QCOMPARE(dev.state(), QModbusDevice::UnconnectedState);
+}
+
void tst_QModbusDevice::state()
{
device->setState(QModbusDevice::ConnectedState);