summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2012-05-22 21:58:55 +0300
committerDenis Shienkov <scapig@yandex.ru>2012-05-23 08:35:36 +0200
commit276079b9843ca5f2f894c1b65fc337b40a7b2a5c (patch)
treece61b0464bc9cf7af797c29f65066b5eb6c78e95 /tests
parent6dc84edbf05b347db20f1a24ef33d11488ba3473 (diff)
downloadqtserialport-276079b9843ca5f2f894c1b65fc337b40a7b2a5c.tar.gz
Fix the broken tests with Qt4 due to the QSKIP API change
QSKIP went through a source incompatible change from Qt4 migration to Qt5. Therefore, the customers cannot build the project with tests (default build) without such a fix like this. Change-Id: I376e88db723c61358d00cb737a30cde46e03c3a1 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Debao Zhang <dbzhang800@gmail.com> Reviewed-by: Denis Shienkov <scapig@yandex.ru>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/serialport/tst_serialport.cpp45
1 files changed, 13 insertions, 32 deletions
diff --git a/tests/manual/serialport/tst_serialport.cpp b/tests/manual/serialport/tst_serialport.cpp
index f021708..4009fe6 100644
--- a/tests/manual/serialport/tst_serialport.cpp
+++ b/tests/manual/serialport/tst_serialport.cpp
@@ -52,22 +52,33 @@ class tst_SerialPort : public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void open();
void rate();
void dataBits();
void parity();
void stopBits();
void flowControl();
+
+private:
+ QList<SerialPortInfo> ports;
};
-void tst_SerialPort::open()
+void tst_SerialPort::initTestCase()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
+ ports = SerialPortInfo::availablePorts();
if (ports.isEmpty()) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QSKIP("Test doesn't work because the serial ports are not detected.");
+#else
+ QSKIP("Test doesn't work because the serial ports are not detected.", SkipAll);
+#endif
}
+}
+void tst_SerialPort::open()
+{
foreach (const SerialPortInfo &info, ports) {
if (info.isBusy())
@@ -103,12 +114,6 @@ void tst_SerialPort::open()
void tst_SerialPort::rate()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
-
- if (ports.isEmpty()) {
- QSKIP("Test doesn't work because the serial ports are not detected.");
- }
-
foreach (const SerialPortInfo &info, ports) {
SerialPort object1;
@@ -138,12 +143,6 @@ void tst_SerialPort::rate()
void tst_SerialPort::dataBits()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
-
- if (ports.isEmpty()) {
- QSKIP("Test doesn't work because the serial ports are not detected.");
- }
-
foreach (const SerialPortInfo &info, ports) {
SerialPort object1;
@@ -159,12 +158,6 @@ void tst_SerialPort::dataBits()
void tst_SerialPort::parity()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
-
- if (ports.isEmpty()) {
- QSKIP("Test doesn't work because the serial ports are not detected.");
- }
-
foreach (const SerialPortInfo &info, ports) {
SerialPort object1;
@@ -188,12 +181,6 @@ void tst_SerialPort::parity()
void tst_SerialPort::stopBits()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
-
- if (ports.isEmpty()) {
- QSKIP("Test doesn't work because the serial ports are not detected.");
- }
-
foreach (const SerialPortInfo &info, ports) {
SerialPort object1;
@@ -212,12 +199,6 @@ void tst_SerialPort::stopBits()
void tst_SerialPort::flowControl()
{
- const QList<SerialPortInfo> ports = SerialPortInfo::availablePorts();
-
- if (ports.isEmpty()) {
- QSKIP("Test doesn't work because the serial ports are not detected.");
- }
-
foreach (const SerialPortInfo &info, ports) {
SerialPort object1;