From bec0b027f802d20dee00a33e9bc83d1d07b2dd42 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Thu, 27 Aug 2015 12:16:15 +0300 Subject: Avoid to start of communication notifier if it already is active This happens in the QSP::clear() method, where the WaitCommEvent() function returns with an error "The parameter is incorrect", because it calls when the waiting already is active. Tested with the virtual com0com and on-board serial ports. Change-Id: I351a336f2d3c05852a654e7bccc3ff84d7aba025 Reviewed-by: Sergey Belyashov Reviewed-by: Denis Shienkov --- tests/auto/qserialport/tst_qserialport.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/qserialport') diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp index c5c9113..e49b1ff 100644 --- a/tests/auto/qserialport/tst_qserialport.cpp +++ b/tests/auto/qserialport/tst_qserialport.cpp @@ -112,6 +112,8 @@ private slots: void controlBreak(); + void clearAfterOpen(); + protected slots: void handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten); void handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten); @@ -910,5 +912,14 @@ void tst_QSerialPort::controlBreak() QCOMPARE(qvariant_cast(breakSpy.at(1).at(0)), false); } +void tst_QSerialPort::clearAfterOpen() +{ + QSerialPort senderPort(m_senderPortName); + QVERIFY(senderPort.open(QSerialPort::ReadWrite)); + QCOMPARE(senderPort.error(), QSerialPort::NoError); + QVERIFY(senderPort.clear()); + QCOMPARE(senderPort.error(), QSerialPort::NoError); +} + QTEST_MAIN(tst_QSerialPort) #include "tst_qserialport.moc" -- cgit v1.2.1