aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcoapclient/tst_qcoapclient.cpp19
-rw-r--r--tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp28
2 files changed, 35 insertions, 12 deletions
diff --git a/tests/auto/qcoapclient/tst_qcoapclient.cpp b/tests/auto/qcoapclient/tst_qcoapclient.cpp
index 3e5eac0..90b44cf 100644
--- a/tests/auto/qcoapclient/tst_qcoapclient.cpp
+++ b/tests/auto/qcoapclient/tst_qcoapclient.cpp
@@ -77,6 +77,8 @@ private Q_SLOTS:
void multicast_blockwise();
};
+#ifdef QT_BUILD_INTERNAL
+
class QCoapQUdpConnectionSocketTestsPrivate : public QCoapQUdpConnectionPrivate
{
bool bind() override
@@ -172,6 +174,7 @@ public:
}
};
+#endif
class Helper : public QObject
{
@@ -347,6 +350,7 @@ void tst_QCoapClient::setBlockSize_data()
void tst_QCoapClient::setBlockSize()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(int, blockSizeSet);
QFETCH(int, blockSizeExpected);
@@ -358,6 +362,9 @@ void tst_QCoapClient::setBlockSize()
eventLoop.exec();
QCOMPARE(client.protocol()->blockSize(), blockSizeExpected);
+#else
+ QSKIP("Not an internal build, skipping this test");
+#endif
}
void tst_QCoapClient::requestWithQIODevice_data()
@@ -479,6 +486,7 @@ void tst_QCoapClient::timeout_data()
void tst_QCoapClient::timeout()
{
+#ifdef QT_BUILD_INTERNAL
QFETCH(int, timeout);
QFETCH(int, maxRetransmit);
@@ -520,6 +528,9 @@ void tst_QCoapClient::timeout()
QCOMPARE(spyReplyFinished.count(), 1);
QCOMPARE(spyReplyAborted.count(), 0);
QCOMPARE(spyClientError.count(), 1);
+#else
+ QSKIP("Not an internal build, skipping this test");
+#endif
}
void tst_QCoapClient::abort()
@@ -786,6 +797,7 @@ void tst_QCoapClient::confirmableMulticast()
void tst_QCoapClient::multicast()
{
+#ifdef QT_BUILD_INTERNAL
QCoapClientForMulticastTests client;
QCoapRequest request = QCoapRequest(QUrl("224.0.1.187"));
request.setToken("abc");
@@ -811,10 +823,14 @@ void tst_QCoapClient::multicast()
QCOMPARE(message1.payload(), "Reply1");
QHostAddress sender1 = qvariant_cast<QHostAddress>(spyMulticastResponse.at(1).at(2));
QCOMPARE(sender1, host1);
+#else
+ QSKIP("Not an internal build, skipping this test");
+#endif
}
void tst_QCoapClient::multicast_blockwise()
{
+#ifdef QT_BUILD_INTERNAL
QCoapClientForMulticastTests client;
QCoapRequest request = QCoapRequest(QUrl("224.0.1.187"));
request.setToken("abc");
@@ -842,6 +858,9 @@ void tst_QCoapClient::multicast_blockwise()
QCOMPARE(message1.payload(), "Reply3Reply4");
QHostAddress sender1 = qvariant_cast<QHostAddress>(spyMulticastResponse.at(1).at(2));
QCOMPARE(sender1, host1);
+#else
+ QSKIP("Not an internal build, skipping this test");
+#endif
}
QTEST_MAIN(tst_QCoapClient)
diff --git a/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp b/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
index 6ce5a87..daed5fb 100644
--- a/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
+++ b/tests/auto/qcoapqudpconnection/tst_qcoapqudpconnection.cpp
@@ -37,12 +37,13 @@
#include <QtNetwork/qudpsocket.h>
#include <QtNetwork/qnetworkdatagram.h>
#include <QtCoap/qcoapglobal.h>
-#include <QtCoap/qcoapqudpconnection.h>
#include <QtCoap/qcoaprequest.h>
#include <private/qcoapqudpconnection_p.h>
#include <private/qcoapinternalrequest_p.h>
#include "../coapnetworksettings.h"
+#ifdef QT_BUILD_INTERNAL
+
using namespace QtCoapNetworkSettings;
struct QCoapRequestForTest : public QCoapRequest
@@ -86,7 +87,6 @@ void tst_QCoapQUdpConnection::ctor()
void tst_QCoapQUdpConnection::connectToHost()
{
-#ifdef QT_BUILD_INTERNAL
QCoapQUdpConnectionForTest connection;
QUdpSocket *socket = qobject_cast<QUdpSocket*>(connection.socket());
@@ -101,14 +101,10 @@ void tst_QCoapQUdpConnection::connectToHost()
QTRY_COMPARE(spySocketStateChanged.count(), 1);
QTRY_COMPARE(spyConnectionBound.count(), 1);
QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Bound);
-#else
- QSKIP("Not an internal build, skipping this test");
-#endif
}
void tst_QCoapQUdpConnection::reconnect()
{
-#ifdef QT_BUILD_INTERNAL
QCoapQUdpConnectionForTest connection;
// This will trigger connection.bind()
@@ -124,9 +120,6 @@ void tst_QCoapQUdpConnection::reconnect()
connection.sendRequest(QByteArray(), QString(), 0);
QTRY_COMPARE(connectionBoundSpy.count(), 2);
QCOMPARE(connection.state(), QCoapQUdpConnection::ConnectionState::Bound);
-#else
- QSKIP("Not an internal build, skipping this test");
-#endif
}
void tst_QCoapQUdpConnection::sendRequest_data()
@@ -180,7 +173,6 @@ void tst_QCoapQUdpConnection::sendRequest_data()
void tst_QCoapQUdpConnection::sendRequest()
{
-#ifdef QT_BUILD_INTERNAL
QFETCH(QString, protocol);
QFETCH(QString, host);
QFETCH(QString, path);
@@ -208,10 +200,22 @@ void tst_QCoapQUdpConnection::sendRequest()
QByteArray data = spyConnectionReadyRead.first().first().value<QByteArray>();
QVERIFY(QString(data.toHex()).startsWith(dataHexaHeader));
QVERIFY(QString(data.toHex()).endsWith(dataHexaPayload));
+}
+
#else
- QSKIP("Not an internal build, skipping this test");
+
+class tst_QCoapQUdpConnection : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase()
+ {
+ QSKIP("Not an internal build, nothing to test");
+ }
+};
+
#endif
-}
QTEST_MAIN(tst_QCoapQUdpConnection)