summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-26 12:56:00 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-26 12:56:00 +0100
commit4e667fa7f88144e198692d9794baacc86bb4eb98 (patch)
tree14e41749bfdbdc6936a2c996514e8eb4f47368ab /tests/auto
parente2a658a2472d9fa710c251a065f488bae981c0ae (diff)
parent12575ecc41a54609aaa1ecac0c918fa444d869ec (diff)
downloadqtserialport-4e667fa7f88144e198692d9794baacc86bb4eb98.tar.gz
Merge remote-tracking branch 'origin/5.7' into 5.8
Change-Id: Ia83609bd366762621857a6c63bf935a6cd230742
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qserialport/tst_qserialport.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp
index 33a48fe..94eaaa5 100644
--- a/tests/auto/qserialport/tst_qserialport.cpp
+++ b/tests/auto/qserialport/tst_qserialport.cpp
@@ -98,6 +98,7 @@ private slots:
void rts();
void dtr();
+ void independenceRtsAndDtr();
void flush();
void doubleFlush();
@@ -549,6 +550,58 @@ void tst_QSerialPort::dtr()
QCOMPARE(qvariant_cast<bool>(dtrSpy.at(2).at(0)), toggle3);
}
+void tst_QSerialPort::independenceRtsAndDtr()
+{
+ QSerialPort serialPort(m_senderPortName);
+ QVERIFY(serialPort.open(QIODevice::ReadWrite)); // No flow control by default!
+
+ QVERIFY(serialPort.setDataTerminalReady(true));
+ QVERIFY(serialPort.setRequestToSend(true));
+ QVERIFY(serialPort.isDataTerminalReady());
+ QVERIFY(serialPort.isRequestToSend());
+
+ // check that DTR changing does not change RTS
+ QVERIFY(serialPort.setDataTerminalReady(false));
+ QVERIFY(!serialPort.isDataTerminalReady());
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.setDataTerminalReady(true));
+ QVERIFY(serialPort.isDataTerminalReady());
+ QVERIFY(serialPort.isRequestToSend());
+
+ // check that RTS changing does not change DTR
+ QVERIFY(serialPort.setRequestToSend(false));
+ QVERIFY(!serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+ QVERIFY(serialPort.setRequestToSend(true));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+
+ // check that baud rate changing does not change DTR or RTS
+ QVERIFY(serialPort.setBaudRate(115200));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+
+ // check that data bits changing does not change DTR or RTS
+ QVERIFY(serialPort.setDataBits(QSerialPort::Data7));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+
+ // check that parity changing does not change DTR or RTS
+ QVERIFY(serialPort.setParity(QSerialPort::EvenParity));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+
+ // check that stop bits changing does not change DTR or RTS
+ QVERIFY(serialPort.setStopBits(QSerialPort::TwoStop));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+
+ // check that software flow control changing does not change DTR or RTS
+ QVERIFY(serialPort.setFlowControl(QSerialPort::SoftwareControl));
+ QVERIFY(serialPort.isRequestToSend());
+ QVERIFY(serialPort.isDataTerminalReady());
+}
+
void tst_QSerialPort::handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten)
{
QCOMPARE(bytesWritten, qint64(alphabetArray.size() + newlineArray.size()));