From 1d753e0b3a6aca6e506760962e500a0a701d378d Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 5 Aug 2015 13:02:52 +0300 Subject: Get rid of incomplete and never used manual tests Change-Id: I8057ab7b7a641c8f6abde8e9063fd2ee56fc1165 Reviewed-by: Sergey Belyashov Reviewed-by: Denis Shienkov --- tests/manual/manual.pro | 3 - tests/manual/qserialport/qserialport.pro | 7 - tests/manual/qserialport/tst_qserialport.cpp | 208 --------------------- tests/manual/qserialportinfo/qserialportinfo.pro | 7 - .../manual/qserialportinfo/tst_qserialportinfo.cpp | 100 ---------- tests/tests.pro | 2 +- 6 files changed, 1 insertion(+), 326 deletions(-) delete mode 100644 tests/manual/manual.pro delete mode 100644 tests/manual/qserialport/qserialport.pro delete mode 100644 tests/manual/qserialport/tst_qserialport.cpp delete mode 100644 tests/manual/qserialportinfo/qserialportinfo.pro delete mode 100644 tests/manual/qserialportinfo/tst_qserialportinfo.cpp (limited to 'tests') diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro deleted file mode 100644 index 5be8160..0000000 --- a/tests/manual/manual.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += qserialportinfo \ - qserialport diff --git a/tests/manual/qserialport/qserialport.pro b/tests/manual/qserialport/qserialport.pro deleted file mode 100644 index 3858b6b..0000000 --- a/tests/manual/qserialport/qserialport.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = tst_qserialport - -QT = core testlib -QT += serialport - -SOURCES += tst_qserialport.cpp diff --git a/tests/manual/qserialport/tst_qserialport.cpp b/tests/manual/qserialport/tst_qserialport.cpp deleted file mode 100644 index f6f3252..0000000 --- a/tests/manual/qserialport/tst_qserialport.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Denis Shienkov -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtSerialPort module of the Qt Toolkit. -** -** $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 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 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. -** -** 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$ -** -****************************************************************************/ - -#include -#include - -#include -#include - -QT_USE_NAMESPACE - -class tst_QSerialPort : public QObject -{ - Q_OBJECT - -private slots: - void initTestCase(); - void open(); - void baudRate(); - void dataBits(); - void parity(); - void stopBits(); - void flowControl(); - -private: - QList serialPortInfoList; -}; - -void tst_QSerialPort::initTestCase() -{ - serialPortInfoList = QSerialPortInfo::availablePorts(); - - if (serialPortInfoList.isEmpty()) { - QSKIP("Test doesn't work because the serial ports are not detected."); - } -} - -void tst_QSerialPort::open() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - if (serialPortInfo.isBusy()) - continue; - - QSerialPort object1; - - // Try open and check access to port by Info - object1.setPort(serialPortInfo); - QCOMPARE(object1.portName(), serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - QCOMPARE(object1.isOpen(), true); - object1.close(); - QCOMPARE(object1.isOpen(), false); - - // Try open and check access to port by Name - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.portName(), serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - QCOMPARE(object1.isOpen(), true); - object1.close(); - QCOMPARE(object1.isOpen(), false); - - // Try open and check access to port by Location - object1.setPortName(serialPortInfo.systemLocation()); - QCOMPARE(object1.portName(), serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - QCOMPARE(object1.isOpen(), true); - object1.close(); - QCOMPARE(object1.isOpen(), false); - } -} - -void tst_QSerialPort::baudRate() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - QSerialPort object1; - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - - QCOMPARE(object1.setBaudRate(QSerialPort::Baud1200), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud1200)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud2400), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud2400)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud4800), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud4800)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud9600), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud9600)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud19200), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud19200)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud38400), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud38400)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud57600), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud57600)); - QCOMPARE(object1.setBaudRate(QSerialPort::Baud115200), true); - QCOMPARE(object1.baudRate(), static_cast(QSerialPort::Baud115200)); - - object1.close(); - } -} - -void tst_QSerialPort::dataBits() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - QSerialPort object1; - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - - QCOMPARE(object1.setDataBits(QSerialPort::Data8), true); - QCOMPARE(object1.dataBits(), QSerialPort::Data8); - - object1.close(); - } -} - -void tst_QSerialPort::parity() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - QSerialPort object1; - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - - QCOMPARE(object1.setParity(QSerialPort::NoParity), true); - QCOMPARE(object1.parity(), QSerialPort::NoParity); - QCOMPARE(object1.setParity(QSerialPort::EvenParity), true); - QCOMPARE(object1.parity(), QSerialPort::EvenParity); - QCOMPARE(object1.setParity(QSerialPort::OddParity), true); - QCOMPARE(object1.parity(), QSerialPort::OddParity); - QCOMPARE(object1.setParity(QSerialPort::MarkParity), true); - QCOMPARE(object1.parity(), QSerialPort::MarkParity); - QCOMPARE(object1.setParity(QSerialPort::SpaceParity), true); - QCOMPARE(object1.parity(), QSerialPort::SpaceParity); - - object1.close(); - } -} - -void tst_QSerialPort::stopBits() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - QSerialPort object1; - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - - QCOMPARE(object1.setStopBits(QSerialPort::OneStop), true); - QCOMPARE(object1.stopBits(), QSerialPort::OneStop); - // skip 1.5 stop bits - QCOMPARE(object1.setStopBits(QSerialPort::TwoStop), true); - QCOMPARE(object1.stopBits(), QSerialPort::TwoStop); - - object1.close(); - } -} - -void tst_QSerialPort::flowControl() -{ - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - - QSerialPort object1; - object1.setPortName(serialPortInfo.portName()); - QCOMPARE(object1.open(QIODevice::ReadWrite), true); - - QCOMPARE(object1.setFlowControl(QSerialPort::NoFlowControl), true); - QCOMPARE(object1.flowControl(), QSerialPort::NoFlowControl); - QCOMPARE(object1.setFlowControl(QSerialPort::HardwareControl), true); - QCOMPARE(object1.flowControl(), QSerialPort::HardwareControl); - QCOMPARE(object1.setFlowControl(QSerialPort::SoftwareControl), true); - QCOMPARE(object1.flowControl(), QSerialPort::SoftwareControl); - - object1.close(); - } -} - -QTEST_MAIN(tst_QSerialPort) -#include "tst_qserialport.moc" diff --git a/tests/manual/qserialportinfo/qserialportinfo.pro b/tests/manual/qserialportinfo/qserialportinfo.pro deleted file mode 100644 index 57f6ea6..0000000 --- a/tests/manual/qserialportinfo/qserialportinfo.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -TARGET = tst_qserialportinfo - -QT = core testlib -QT += serialport - -SOURCES += tst_qserialportinfo.cpp diff --git a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp b/tests/manual/qserialportinfo/tst_qserialportinfo.cpp deleted file mode 100644 index 3bcc0b3..0000000 --- a/tests/manual/qserialportinfo/tst_qserialportinfo.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Denis Shienkov -** Copyright (C) 2013 Laszlo Papp -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the QtSerialPort module of the Qt Toolkit. -** -** $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 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 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. -** -** 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$ -** -****************************************************************************/ - -#include -#include - -#include -#include - -QT_USE_NAMESPACE - -class tst_QSerialPortInfo : public QObject -{ - Q_OBJECT - -private slots: - void serialPortInfoList(); - void standardBaudRateList(); - void constructors(); - void assignment(); -}; - -void tst_QSerialPortInfo::serialPortInfoList() -{ - QList list(QSerialPortInfo::availablePorts()); - QCOMPARE(list.isEmpty(), false); -} - -void tst_QSerialPortInfo::standardBaudRateList() -{ - QList list(QSerialPortInfo::standardBaudRates()); - QCOMPARE(list.isEmpty(), false); -} - -void tst_QSerialPortInfo::constructors() -{ - QSerialPortInfo serialPortInfo; - QCOMPARE(serialPortInfo.portName().isEmpty(), true); - QCOMPARE(serialPortInfo.systemLocation().isEmpty(), true); - QCOMPARE(serialPortInfo.description().isEmpty(), true); - QCOMPARE(serialPortInfo.manufacturer().isEmpty(), true); - QCOMPARE(serialPortInfo.serialNumber().isEmpty(), true); - QCOMPARE(serialPortInfo.vendorIdentifier(), quint16(0)); - QCOMPARE(serialPortInfo.productIdentifier(), quint16(0)); - QCOMPARE(serialPortInfo.hasVendorIdentifier(), false); - QCOMPARE(serialPortInfo.hasProductIdentifier(), false); - QCOMPARE(serialPortInfo.isNull(), false); - QCOMPARE(serialPortInfo.isBusy(), false); - QCOMPARE(serialPortInfo.isValid(), false); -} - -void tst_QSerialPortInfo::assignment() -{ - QList serialPortInfoList(QSerialPortInfo::availablePorts()); - - foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { - QSerialPortInfo otherSerialPortInfo = serialPortInfo; - QCOMPARE(otherSerialPortInfo.portName(), serialPortInfo.portName()); - QCOMPARE(otherSerialPortInfo.systemLocation(), serialPortInfo.systemLocation()); - QCOMPARE(otherSerialPortInfo.description(), serialPortInfo.description()); - QCOMPARE(otherSerialPortInfo.manufacturer(), serialPortInfo.manufacturer()); - QCOMPARE(otherSerialPortInfo.serialNumber(), serialPortInfo.serialNumber()); - QCOMPARE(otherSerialPortInfo.vendorIdentifier(), serialPortInfo.vendorIdentifier()); - QCOMPARE(otherSerialPortInfo.productIdentifier(), serialPortInfo.productIdentifier()); - } -} - -QTEST_MAIN(tst_QSerialPortInfo) -#include "tst_qserialportinfo.moc" diff --git a/tests/tests.pro b/tests/tests.pro index dcc8531..157ef34 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,2 +1,2 @@ TEMPLATE = subdirs -SUBDIRS += auto manual +SUBDIRS += auto -- cgit v1.2.1