diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qserialport/qserialport.pro | 6 | ||||
-rw-r--r-- | tests/auto/qserialport/tst_qserialport.cpp | 71 | ||||
-rw-r--r-- | tests/auto/qserialportinfo/tst_qserialportinfo.cpp | 34 | ||||
-rw-r--r-- | tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp | 34 | ||||
-rw-r--r-- | tests/manual/qserialport/qserialport.pro | 6 | ||||
-rw-r--r-- | tests/manual/qserialport/tst_qserialport.cpp | 12 | ||||
-rw-r--r-- | tests/manual/qserialportinfo/qserialportinfo.pro | 6 | ||||
-rw-r--r-- | tests/manual/qserialportinfo/tst_qserialportinfo.cpp | 12 |
8 files changed, 106 insertions, 75 deletions
diff --git a/tests/auto/qserialport/qserialport.pro b/tests/auto/qserialport/qserialport.pro index c16cd5ee..5435fa39 100644 --- a/tests/auto/qserialport/qserialport.pro +++ b/tests/auto/qserialport/qserialport.pro @@ -2,10 +2,6 @@ QT = core testlib TARGET = tst_qserialport #CONFIG += testcase -greaterThan(QT_MAJOR_VERSION, 4) { - QT += serialport -} else { - include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf) -} +QT += serialport SOURCES = tst_qserialport.cpp diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp index e0643339..627de6c5 100644 --- a/tests/auto/qserialport/tst_qserialport.cpp +++ b/tests/auto/qserialport/tst_qserialport.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtSerialPort module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -112,6 +112,8 @@ private slots: void readAfterInputClear(); #endif + void controlBreak(); + protected slots: void handleBytesWrittenAndExitLoopSlot(qint64 bytesWritten); void handleBytesWrittenAndExitLoopSlot2(qint64 bytesWritten); @@ -760,5 +762,62 @@ void tst_QSerialPort::readAfterInputClear() } #endif +class BreakReader : public QObject +{ + Q_OBJECT +public: + explicit BreakReader(QSerialPort &port) + : serialPort(port) + { + connect(&serialPort, SIGNAL(readyRead()), this, SLOT(receive())); + } + +private slots: + void receive() + { + tst_QSerialPort::exitLoop(); + } + +private: + QSerialPort &serialPort; +}; + +void tst_QSerialPort::controlBreak() +{ +#ifdef Q_OS_WIN + clearReceiver(); +#endif + + QSerialPort senderPort(m_senderPortName); + QVERIFY(senderPort.open(QSerialPort::WriteOnly)); + QCOMPARE(senderPort.isBreakEnabled(), false); + + QSignalSpy breakSpy(&senderPort, SIGNAL(breakEnabledChanged(bool))); + QVERIFY(breakSpy.isValid()); + + QSerialPort receiverPort(m_receiverPortName); + QVERIFY(receiverPort.open(QSerialPort::ReadOnly)); + + BreakReader reader(receiverPort); + + QVERIFY(senderPort.setBreakEnabled(true)); + QCOMPARE(senderPort.isBreakEnabled(), true); + + enterLoop(1); + QVERIFY2(!timeout(), "Timed out when waiting for the read of break state."); + QVERIFY(receiverPort.bytesAvailable() > 0); + + foreach (const char c, receiverPort.readAll()) { + QCOMPARE(c, char(0)); + } + + QVERIFY(senderPort.setBreakEnabled(false)); + QCOMPARE(senderPort.isBreakEnabled(), false); + + QCOMPARE(breakSpy.count(), 2); + QCOMPARE(qvariant_cast<bool>(breakSpy.at(0).at(0)), true); + QCOMPARE(qvariant_cast<bool>(breakSpy.at(1).at(0)), false); +} + QTEST_MAIN(tst_QSerialPort) #include "tst_qserialport.moc" diff --git a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp index e421aa41..54f18253 100644 --- a/tests/auto/qserialportinfo/tst_qserialportinfo.cpp +++ b/tests/auto/qserialportinfo/tst_qserialportinfo.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtSerialPort module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 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 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp b/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp index cfd2d856..486699f4 100644 --- a/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp +++ b/tests/auto/qserialportinfoprivate/tst_qserialportinfoprivate.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** ** Copyright (C) 2014 Denis Shienkov <denis.shienkov@gmail.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtSerialPort module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 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 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/manual/qserialport/qserialport.pro b/tests/manual/qserialport/qserialport.pro index 504e766f..3858b6b3 100644 --- a/tests/manual/qserialport/qserialport.pro +++ b/tests/manual/qserialport/qserialport.pro @@ -2,10 +2,6 @@ TEMPLATE = app TARGET = tst_qserialport QT = core testlib -greaterThan(QT_MAJOR_VERSION, 4) { - QT += serialport -} else { - include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf) -} +QT += serialport SOURCES += tst_qserialport.cpp diff --git a/tests/manual/qserialport/tst_qserialport.cpp b/tests/manual/qserialport/tst_qserialport.cpp index 961e8550..380af390 100644 --- a/tests/manual/qserialport/tst_qserialport.cpp +++ b/tests/manual/qserialport/tst_qserialport.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtSerialPort module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/tests/manual/qserialportinfo/qserialportinfo.pro b/tests/manual/qserialportinfo/qserialportinfo.pro index 8e08264c..57f6ea60 100644 --- a/tests/manual/qserialportinfo/qserialportinfo.pro +++ b/tests/manual/qserialportinfo/qserialportinfo.pro @@ -2,10 +2,6 @@ TEMPLATE = app TARGET = tst_qserialportinfo QT = core testlib -greaterThan(QT_MAJOR_VERSION, 4) { - QT += serialport -} else { - include($$QTSERIALPORT_PROJECT_ROOT/src/serialport/qt4support/serialport.prf) -} +QT += serialport SOURCES += tst_qserialportinfo.cpp diff --git a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp b/tests/manual/qserialportinfo/tst_qserialportinfo.cpp index 9f2d2450..3bcc0b34 100644 --- a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp +++ b/tests/manual/qserialportinfo/tst_qserialportinfo.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Denis Shienkov <denis.shienkov@gmail.com> ** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtSerialPort module of the Qt Toolkit. ** @@ -11,9 +11,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** 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 @@ -24,8 +24,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ |