--- /dev/null
+QT.websockets.name = QtWebSockets
+QT.websockets.bins = $$QT_MODULE_BIN_BASE
+QT.websockets.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtWebSockets
+QT.websockets.private_includes = $$QT_MODULE_INCLUDE_BASE/QtWebSockets/$$QT.websockets.VERSION/QtWebSockets/private
+QT.websockets.sources = $$QT_MODULE_BASE/src/websockets
+QT.websockets.libs = $$QT_MODULE_LIB_BASE
+QT.websockets.plugins = $$QT_MODULE_PLUGIN_BASE
+
%moduleheaders = (
);
+%modulepris = (
+ "QtWebSockets" => "$basedir/modules/qt_websockets.pri",
+);
+
%classnames = (
"qtwebsockets.h" => "QtWebSockets",
);
--- /dev/null
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ #dataprocessor
+
+
--- /dev/null
+CONFIG += console
+CONFIG += c++11
+CONFIG += testcase
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+TARGET = tst_dataprocessor
+
+QT = core testlib websockets websockets-private
+
+SOURCES += tst_dataprocessor.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
#include <QBuffer>
#include <QByteArray>
#include <QDebug>
-#include "dataprocessor_p.h"
-#include "unittests.h"
+
+#include "private/dataprocessor_p.h"
Q_DECLARE_METATYPE(QWebSocketProtocol::CloseCode)
Q_DECLARE_METATYPE(QWebSocketProtocol::OpCode)
<< QWebSocketProtocol::CC_TOO_MUCH_DATA;
}
-DECLARE_TEST(tst_DataProcessor)
+QTEST_MAIN(tst_DataProcessor)
#include "tst_dataprocessor.moc"
--- /dev/null
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ compliance \
+ websockets
+
+
+
--- /dev/null
+CONFIG += console
+CONFIG += c++11
+CONFIG += testcase
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+TARGET = tst_compliance
+
+QT = core network websockets testlib
+
+SOURCES += tst_compliance.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
#include <QHostInfo>
#include <QDebug>
#include "qwebsocket.h"
-#include "unittests.h"
-class ComplianceTest : public QObject
+class tst_ComplianceTest : public QObject
{
Q_OBJECT
public:
- ComplianceTest();
+ tst_ComplianceTest();
private Q_SLOTS:
void initTestCase();
void runTestCase(int nbr, int total);
};
-ComplianceTest::ComplianceTest() :
+tst_ComplianceTest::tst_ComplianceTest() :
m_url("ws://localhost:9001")
{
}
-void ComplianceTest::initTestCase()
+void tst_ComplianceTest::initTestCase()
{
}
-void ComplianceTest::cleanupTestCase()
+void tst_ComplianceTest::cleanupTestCase()
{
}
-void ComplianceTest::init()
+void tst_ComplianceTest::init()
{
}
-void ComplianceTest::cleanup()
+void tst_ComplianceTest::cleanup()
{
}
-void ComplianceTest::runTestCase(int nbr, int total)
+void tst_ComplianceTest::runTestCase(int nbr, int total)
{
if (nbr == total)
{
runTestCase(nbr + 1, total);
}
-void ComplianceTest::runTestCases(int startNbr, int stopNbr)
+void tst_ComplianceTest::runTestCases(int startNbr, int stopNbr)
{
runTestCase(startNbr, stopNbr);
}
-void ComplianceTest::autobahnTest()
+void tst_ComplianceTest::autobahnTest()
{
//connect to autobahn server at url ws://ipaddress:port/getCaseCount
QWebSocket *pWebSocket = new QWebSocket;
pWebSocket = 0;
}
-//DECLARE_TEST(ComplianceTest)
+QTEST_MAIN(tst_ComplianceTest)
#include "tst_compliance.moc"
#include <QHostInfo>
#include <QDebug>
#include "qwebsocket.h"
-#include "unittests.h"
-class WebSocketsTest : public QObject
+class tst_WebSocketsTest : public QObject
{
Q_OBJECT
public:
- WebSocketsTest();
+ tst_WebSocketsTest();
private Q_SLOTS:
void initTestCase();
QUrl m_url;
};
-WebSocketsTest::WebSocketsTest() :
+tst_WebSocketsTest::tst_WebSocketsTest() :
m_pWebSocket(0),
m_url("ws://localhost:9000")
{
}
-void WebSocketsTest::initTestCase()
+void tst_WebSocketsTest::initTestCase()
{
m_pWebSocket = new QWebSocket();
/*m_pWebSocket->open(m_url, true);
QVERIFY(m_pWebSocket->isValid());*/
}
-void WebSocketsTest::cleanupTestCase()
+void tst_WebSocketsTest::cleanupTestCase()
{
if (m_pWebSocket)
{
}
}
-void WebSocketsTest::init()
+void tst_WebSocketsTest::init()
{
}
-void WebSocketsTest::cleanup()
+void tst_WebSocketsTest::cleanup()
{
}
-void WebSocketsTest::testTextMessage()
+void tst_WebSocketsTest::testTextMessage()
{
const char *message = "Hello world!";
QCOMPARE(spy.takeFirst().at(0).toString(), qMessage);
}
-void WebSocketsTest::testBinaryMessage()
+void tst_WebSocketsTest::testBinaryMessage()
{
QSignalSpy spy(m_pWebSocket, SIGNAL(binaryMessageReceived(QByteArray)));
QCOMPARE(spy.takeFirst().at(0).toByteArray(), data);
}
-void WebSocketsTest::testLocalAddress()
+void tst_WebSocketsTest::testLocalAddress()
{
QCOMPARE(m_pWebSocket->localAddress().toString(), QString("127.0.0.1"));
quint16 localPort = m_pWebSocket->localPort();
QVERIFY2(localPort > 0, "Local port is invalid.");
}
-void WebSocketsTest::testPeerAddress()
+void tst_WebSocketsTest::testPeerAddress()
{
QHostInfo hostInfo = QHostInfo::fromName(m_url.host());
QList<QHostAddress> addresses = hostInfo.addresses();
QCOMPARE(m_pWebSocket->peerPort(), (quint16)m_url.port(80));
}
-void WebSocketsTest::testProxy()
+void tst_WebSocketsTest::testProxy()
{
QNetworkProxy oldProxy = m_pWebSocket->proxy();
QNetworkProxy proxy(QNetworkProxy::HttpProxy, QString("proxy.network.com"), 80);
QCOMPARE(oldProxy, m_pWebSocket->proxy());
}
-void WebSocketsTest::testInvalidWithUnopenedSocket()
+void tst_WebSocketsTest::testInvalidWithUnopenedSocket()
{
QWebSocket qws;
QCOMPARE(qws.isValid(), false);
}
-//DECLARE_TEST(WebSocketsTest)
+QTEST_MAIN(tst_WebSocketsTest)
#include "tst_websockets.moc"
--- /dev/null
+CONFIG += console
+CONFIG += c++11
+CONFIG += testcase
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+TARGET = tst_websockets
+
+QT = core network websockets testlib
+
+SOURCES += tst_websockets.cpp
+
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+++ /dev/null
-#include "unittests.h"
-
-TEST_MAIN
-cache()
-
-QT += core network websockets testlib
-
-TARGET = unittests
-CONFIG += testcase
-CONFIG += console
-CONFIG += c++11
-CONFIG -= app_bundle
-
-TEMPLATE = app
-
-SOURCES += \
- main.cpp \
- tst_websockets.cpp \
- tst_compliance.cpp \
- tst_dataprocessor.cpp
-
-HEADERS += \
- unittests.h
-
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+TEMPLATE = subdirs
+SUBDIRS += auto autobahn
+++ /dev/null
-#ifndef UNITTESTT_H
-#define UNITTESTT_H
-
-#include <QTest>
-#include <QObject>
-#include <QList>
-#include <QString>
-#include <QSharedPointer>
-#include <QCoreApplication>
-
-namespace AutoTest
-{
-
-typedef QList<QObject*> TestList;
-
-inline TestList& testList()
-{
- static TestList list;
- return list;
-}
-
-inline bool findObject(QObject* object)
-{
- TestList& list = testList();
- if (list.contains(object))
- {
- return true;
- }
- Q_FOREACH (QObject* test, list)
- {
- if (test->objectName() == object->objectName())
- {
- return true;
- }
- }
- return false;
-}
-
-inline void addTest(QObject* object)
-{
- TestList& list = testList();
- if (!findObject(object))
- {
- list.append(object);
- }
-}
-
-inline int run(int argc, char *argv[])
-{
- int ret = 0;
-
- Q_FOREACH (QObject* test, testList())
- {
- ret += QTest::qExec(test, argc, argv);
- }
- testList().clear();
- return ret;
-}
-
-} // end namespace
-
-template <class T>
-class Test
-{
-public:
- QSharedPointer<T> child;
-
- Test(const QString& name) : child(new T)
- {
- child->setObjectName(name);
- AutoTest::addTest(child.data());
- }
-};
-
-#define DECLARE_TEST(className) static Test<className> t(#className);
-
-#define TEST_MAIN \
- int main(int argc, char *argv[]) \
-{ \
- QCoreApplication app(argc, argv); \
- int ret = AutoTest::run(argc, argv); \
- return ret; \
- }
-//return app.exec();
-
-#endif