diff options
author | Chris Craig <craig@ics.com> | 2012-05-10 18:01:25 -0400 |
---|---|---|
committer | Chris Craig <craig@ics.com> | 2013-03-01 03:33:27 +0100 |
commit | 6b8d228ab8cc2a424f80d5a76f93d598ffac454f (patch) | |
tree | 32ccec5e60ea7b7c87a22d12ffe5ef4b4cceea7a /tests | |
parent | f6c2f5c3a36f148cf1654c0fea576282b3c83b1c (diff) |
Qt5 release fixes
Modifications to build with the final Qt 5 release. Because
the Qt module build process changed a lot, there are a number
of changes. Most significantly, all classes are renamed to begin
with 'Q', since that's the only way to get syncqt to install them
correctly.
Change-Id: I987fd426702a49991e930d1670d9c76be994eab9
Reviewed-by: Chris Craig <craig@ics.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/jsonbuffer/tst_jsonbuffer.cpp | 6 | ||||
-rw-r--r-- | tests/auto/jsonconnection/testClient/main.cpp | 8 | ||||
-rw-r--r-- | tests/auto/jsonconnection/tst_jsonconnection.cpp | 92 | ||||
-rw-r--r-- | tests/auto/jsonschema/tst_jsonschema.cpp | 8 | ||||
-rw-r--r-- | tests/auto/jsonstream/testClient/main.cpp | 6 | ||||
-rw-r--r-- | tests/auto/jsonstream/tst_jsonstream.cpp | 68 | ||||
-rw-r--r-- | tests/auto/testsuite/tst_jsonclient.cpp | 2 | ||||
-rw-r--r-- | tests/auto/testsuite/tst_jsonclient.h | 2 | ||||
-rw-r--r-- | tests/auto/testsuite/tst_jsonserver.cpp | 10 | ||||
-rw-r--r-- | tests/auto/testsuite/tst_jsonserver.h | 2 |
10 files changed, 102 insertions, 102 deletions
diff --git a/tests/auto/jsonbuffer/tst_jsonbuffer.cpp b/tests/auto/jsonbuffer/tst_jsonbuffer.cpp index 13acf64..dd6c966 100644 --- a/tests/auto/jsonbuffer/tst_jsonbuffer.cpp +++ b/tests/auto/jsonbuffer/tst_jsonbuffer.cpp @@ -41,7 +41,7 @@ #include <QtTest> -#include "private/jsonbuffer_p.h" +#include "private/qjsonbuffer_p.h" QT_USE_NAMESPACE_JSONSTREAM @@ -67,7 +67,7 @@ void tst_JsonBuffer::utf8() { int n = sizeof(utf8spaces) / sizeof(utf8spaces[0]); for (int i = 0 ; i < n ; i++ ) { - JsonBuffer buf; + QJsonBuffer buf; buf.append(utf8spaces[i], strlen(utf8spaces[i])); QVERIFY(buf.messageAvailable()); @@ -103,7 +103,7 @@ PartialData utf8packets[] = { { "{\"a\":123.0", 0, 0 }, void tst_JsonBuffer::utf8extend() { - JsonBuffer buf; + QJsonBuffer buf; int n = sizeof(utf8packets) / sizeof(utf8packets[0]); for (int i = 0 ; i < n ; i++ ) { PartialData& d = utf8packets[i]; diff --git a/tests/auto/jsonconnection/testClient/main.cpp b/tests/auto/jsonconnection/testClient/main.cpp index a0afa0b..3cc19eb 100644 --- a/tests/auto/jsonconnection/testClient/main.cpp +++ b/tests/auto/jsonconnection/testClient/main.cpp @@ -50,8 +50,8 @@ #include <QTimer> #include <QFile> -#include "jsonstream.h" -#include "jsonserver.h" +#include "qjsonstream.h" +#include "qjsonserver.h" QT_USE_NAMESPACE_JSONSTREAM @@ -99,7 +99,7 @@ private slots: void handleConnection() { socket = server->nextPendingConnection(); Q_ASSERT(socket); - stream = new JsonStream(socket); + stream = new QJsonStream(socket); stream->setParent(socket); connect(socket, SIGNAL(disconnected()), SLOT(handleDisconnection())); connect(stream, SIGNAL(readyReadMessage()), SLOT(processMessages())); @@ -141,7 +141,7 @@ signals: private: QLocalServer *server; QLocalSocket *socket; - JsonStream *stream; + QJsonStream *stream; }; class Container : public QObject diff --git a/tests/auto/jsonconnection/tst_jsonconnection.cpp b/tests/auto/jsonconnection/tst_jsonconnection.cpp index 458022f..6e6a8eb 100644 --- a/tests/auto/jsonconnection/tst_jsonconnection.cpp +++ b/tests/auto/jsonconnection/tst_jsonconnection.cpp @@ -42,9 +42,9 @@ #include <QtTest> #include <QLocalSocket> #include <QLocalServer> -#include "jsonserver.h" -#include "jsonconnection.h" -#include "jsonendpoint.h" +#include "qjsonserver.h" +#include "qjsonconnection.h" +#include "qjsonendpoint.h" #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> @@ -53,7 +53,7 @@ QT_USE_NAMESPACE_JSONSTREAM Q_DECLARE_METATYPE(QJsonObject); -Q_DECLARE_METATYPE(JsonConnection::State); +Q_DECLARE_METATYPE(QJsonConnection::State); void waitForSpy(QSignalSpy& spy, int count, int timeout=5000) { QTime stopWatch; @@ -138,15 +138,15 @@ class EndpointContainer : public QObject public: EndpointContainer(QObject *parent = 0); - JsonEndpoint *addEndpoint(const QString & name); + QJsonEndpoint *addEndpoint(const QString & name); - void sendMessage(const QString & endpointDestination = QString::null, JsonEndpoint *sender = 0); + void sendMessage(const QString & endpointDestination = QString::null, QJsonEndpoint *sender = 0); void sendMessage(const QStringList & endpointDestinationList, int messagesPerEndpoint, bool grouped); QList<QObject *> endpoints() { return mEndpoints; } - JsonConnection *connection() { return mConnection; } - void setConnection(JsonConnection *connection); + QJsonConnection *connection() { return mConnection; } + void setConnection(QJsonConnection *connection); public slots: void processMessages(); @@ -155,11 +155,11 @@ signals: void messageReceived(const QJsonObject&, QObject *); protected: - void addEndpoint(JsonEndpoint *endpoint); + void addEndpoint(QJsonEndpoint *endpoint); private: - JsonConnection *mConnection; - JsonEndpoint *mStream; + QJsonConnection *mConnection; + QJsonEndpoint *mStream; QList<QObject *> mEndpoints; int mCounter; }; @@ -170,33 +170,33 @@ EndpointContainer::EndpointContainer(QObject *parent) { } -JsonEndpoint *EndpointContainer::addEndpoint(const QString & name) +QJsonEndpoint *EndpointContainer::addEndpoint(const QString & name) { - JsonEndpoint *endpoint = new JsonEndpoint(name, mConnection); + QJsonEndpoint *endpoint = new QJsonEndpoint(name, mConnection); endpoint->setParent(mConnection); addEndpoint(endpoint); return endpoint; } -void EndpointContainer::addEndpoint(JsonEndpoint *endpoint) +void EndpointContainer::addEndpoint(QJsonEndpoint *endpoint) { mStream = endpoint; connect(mStream, SIGNAL(readyReadMessage()), SLOT(processMessages())); mEndpoints.append(mStream); } -void EndpointContainer::setConnection(JsonConnection *connection) +void EndpointContainer::setConnection(QJsonConnection *connection) { mConnection = connection; foreach (QObject *obj, mEndpoints) { - JsonEndpoint *endpoint = qobject_cast<JsonEndpoint *> (obj); + QJsonEndpoint *endpoint = qobject_cast<QJsonEndpoint *> (obj); if (endpoint) endpoint->setConnection(connection); } } -void EndpointContainer::sendMessage(const QString & endpointDestination, JsonEndpoint *sender) +void EndpointContainer::sendMessage(const QString & endpointDestination, QJsonEndpoint *sender) { QJsonObject msg; msg.insert("text", QLatin1String("Standard text")); @@ -236,7 +236,7 @@ void EndpointContainer::processMessages() { QObject *source(sender()); QVERIFY(source && mEndpoints.contains(source)); if (mEndpoints.contains(source)) { - JsonEndpoint *endpoint = qobject_cast< JsonEndpoint *>(source); + QJsonEndpoint *endpoint = qobject_cast< QJsonEndpoint *>(source); // qDebug() << " XXX: came from: " << endpoint->name(); while (endpoint->messageAvailable()) { QJsonObject obj = endpoint->readMessage(); @@ -257,7 +257,7 @@ public: void doConnect(); void closeConnection() { - JsonConnection *oldConnection = connection(); + QJsonConnection *oldConnection = connection(); setConnection(0); delete oldConnection; } @@ -273,7 +273,7 @@ ConnectionContainer::ConnectionContainer(const QString & socketName, bool bSepar : EndpointContainer(), mSocketName(socketName) { qDebug() << "Creating new json client at " << socketName; - JsonConnection *connection = new JsonConnection(); + QJsonConnection *connection = new QJsonConnection(); connection->setUseSeparateThreadForProcessing(bSeparateThread); connection->setFormat(FormatUTF8); @@ -333,12 +333,12 @@ void tst_JsonConnection::connectionTest() ConnectionContainer c(socketname,true); - JsonEndpoint *endpoint = c.addEndpoint("test"); + QJsonEndpoint *endpoint = c.addEndpoint("test"); QVERIFY(endpoint->name() == "test"); - QVERIFY(c.connection()->state() == JsonConnection::Unconnected); + QVERIFY(c.connection()->state() == QJsonConnection::Unconnected); c.doConnect(); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); c.sendMessage(endpoint->name()); QSignalSpy spy(&c, SIGNAL(messageReceived(QJsonObject,QObject *))); @@ -380,7 +380,7 @@ void tst_JsonConnection::connectionSameThreadTest() ConnectionContainer c(socketname, false); - JsonEndpoint *endpoint = c.addEndpoint("test"); + QJsonEndpoint *endpoint = c.addEndpoint("test"); QVERIFY(endpoint->name() == "test"); c.doConnect(); @@ -425,8 +425,8 @@ signals: void tst_JsonConnection::registerQmlTypes() { - qmlRegisterType<JsonConnection>("Qt.json.connection.test", 1,0, "JsonConnection"); - qmlRegisterType<JsonEndpoint>("Qt.json.connection.test", 1,0, "JsonEndpoint"); + qmlRegisterType<QJsonConnection>("Qt.json.connection.test", 1,0, "JsonConnection"); + qmlRegisterType<QJsonEndpoint>("Qt.json.connection.test", 1,0, "JsonEndpoint"); } static const char szData[] = @@ -654,13 +654,13 @@ void tst_JsonConnection::multipleEndpointsTest() QString endpointName("test"); endpointName += QString::number(i); - JsonEndpoint *endpoint = c.addEndpoint(endpointName); + QJsonEndpoint *endpoint = c.addEndpoint(endpointName); QVERIFY(endpoint->name() == endpointName); } - QVERIFY(c.connection()->state() == JsonConnection::Unconnected); + QVERIFY(c.connection()->state() == QJsonConnection::Unconnected); c.doConnect(); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); for (int i = 0; i < knEndpointsNumber; i++) { QString endpointName("test"); @@ -677,7 +677,7 @@ void tst_JsonConnection::multipleEndpointsTest() for (it = spy.constBegin(); it != spy.constEnd(); it++) { QJsonObject msg = qvariant_cast<QJsonObject>(it->at(0)); - JsonEndpoint *endpoint = qobject_cast<JsonEndpoint *>(qvariant_cast<QObject *>(it->at(1))); + QJsonEndpoint *endpoint = qobject_cast<QJsonEndpoint *>(qvariant_cast<QObject *>(it->at(1))); QVERIFY(endpoints.removeOne(endpoint)); QVERIFY(msg.value("endpoint").isString() && msg.value("endpoint").toString() == endpoint->name()); @@ -736,7 +736,7 @@ void tst_JsonConnection::multipleThreadTest() endpointName += QString::number(i); endpointNames.append(endpointName); - JsonEndpoint *endpoint = ec->addEndpoint(endpointName); + QJsonEndpoint *endpoint = ec->addEndpoint(endpointName); QVERIFY(endpoint->name() == endpointName); QSignalSpy *spy = new QSignalSpy(ec, SIGNAL(messageReceived(QJsonObject,QObject*))); @@ -746,9 +746,9 @@ void tst_JsonConnection::multipleThreadTest() newThread->start(); } - QVERIFY(c.connection()->state() == JsonConnection::Unconnected); + QVERIFY(c.connection()->state() == QJsonConnection::Unconnected); c.doConnect(); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); // grouped c.sendMessage(endpointNames, knMessagesPerThread, true); @@ -803,12 +803,12 @@ void tst_JsonConnection::autoreconnectTest() ConnectionContainer c(socketname,true); c.connection()->setAutoReconnectEnabled(true); - JsonEndpoint *endpoint = c.addEndpoint("test"); + QJsonEndpoint *endpoint = c.addEndpoint("test"); QVERIFY(endpoint->name() == "test"); - QVERIFY(c.connection()->state() == JsonConnection::Unconnected); + QVERIFY(c.connection()->state() == QJsonConnection::Unconnected); c.doConnect(); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); QJsonObject msg; msg.insert("endpoint", QLatin1String("test")); @@ -827,17 +827,17 @@ void tst_JsonConnection::autoreconnectTest() QVERIFY(msg.value("timeout").isDouble() && msg.value("timeout").toDouble() == 2000); // wait for disconnect -> connencting state - QSignalSpy spy1(c.connection(), SIGNAL(stateChanged(JsonConnection::State))); + QSignalSpy spy1(c.connection(), SIGNAL(stateChanged(QJsonConnection::State))); waitForSpy(spy1, 1); - JsonConnection::State state = qvariant_cast<JsonConnection::State>(spy1.last().at(0)); - QVERIFY(state == JsonConnection::Connecting); - QVERIFY(c.connection()->state() == JsonConnection::Connecting); + QJsonConnection::State state = qvariant_cast<QJsonConnection::State>(spy1.last().at(0)); + QVERIFY(state == QJsonConnection::Connecting); + QVERIFY(c.connection()->state() == QJsonConnection::Connecting); // wait for reconnection waitForSpy(spy1, 2, 10000); - state = qvariant_cast<JsonConnection::State>(spy1.last().at(0)); - QVERIFY(state == JsonConnection::Connected); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + state = qvariant_cast<QJsonConnection::State>(spy1.last().at(0)); + QVERIFY(state == QJsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); // send a new message after reconnection and wait for a reply msg = QJsonObject(); @@ -872,12 +872,12 @@ void tst_JsonConnection::nameChangeTest() c.connection()->setAutoReconnectEnabled(true); QSignalSpy spyDef(&c, SIGNAL(messageReceived(const QJsonObject&, QObject *)));; - JsonEndpoint *endpoint = c.addEndpoint("wrong"); + QJsonEndpoint *endpoint = c.addEndpoint("wrong"); QVERIFY(endpoint->name() == "wrong"); - QVERIFY(c.connection()->state() == JsonConnection::Unconnected); + QVERIFY(c.connection()->state() == QJsonConnection::Unconnected); c.doConnect(); - QVERIFY(c.connection()->state() == JsonConnection::Connected); + QVERIFY(c.connection()->state() == QJsonConnection::Connected); c.sendMessage("test"); diff --git a/tests/auto/jsonschema/tst_jsonschema.cpp b/tests/auto/jsonschema/tst_jsonschema.cpp index 82d1109..e7508f4 100644 --- a/tests/auto/jsonschema/tst_jsonschema.cpp +++ b/tests/auto/jsonschema/tst_jsonschema.cpp @@ -41,7 +41,7 @@ #include <QtTest/QtTest> -#include "schemavalidator.h" +#include "qjsonschemavalidator.h" QT_USE_NAMESPACE_JSONSTREAM @@ -103,7 +103,7 @@ private: void tst_JsonSchema::schemaTest() { bool result; - SchemaValidator validator; + QJsonSchemaValidator validator; // test SchemaValidator::schemaNames() and SchemaValidator::hasSchema() with empty object QVERIFY(validator.schemaNames().isEmpty()); @@ -135,7 +135,7 @@ void tst_JsonSchema::schemaTest() result = validator.validateSchema("SchemaTestObject", noncompliant); //qDebug() << "INVALID validation result: " << result << " message is:" << validator.getLastError().errorString(); - QVERIFY(!result && validator.getLastError().errorCode() == SchemaError::FailedSchemaValidation); + QVERIFY(!result && validator.getLastError().errorCode() == QJsonSchemaError::FailedSchemaValidation); // test SchemaValidator::removesSchema() validator.removeSchema("SchemaTestObject"); @@ -523,7 +523,7 @@ bool tst_JsonSchema::validate(const QJsonValue & value, const QByteArray & schem object.insert("test", value); //qDebug() << "object " << object; - SchemaValidator validator; + QJsonSchemaValidator validator; // wrap schema body QByteArray schema = QString("{ \"properties\": { \"test\": %1 } }").arg(schemaBody.constData()).toUtf8(); diff --git a/tests/auto/jsonstream/testClient/main.cpp b/tests/auto/jsonstream/testClient/main.cpp index 5ba9b65..2276e95 100644 --- a/tests/auto/jsonstream/testClient/main.cpp +++ b/tests/auto/jsonstream/testClient/main.cpp @@ -44,7 +44,7 @@ #include <QDebug> #include <QJsonArray> -#include "jsonclient.h" +#include "qjsonclient.h" QT_USE_NAMESPACE_JSONSTREAM @@ -65,7 +65,7 @@ public slots: void disconnected(); private: - JsonClient *mClient; + QJsonClient *mClient; int mCounter; }; @@ -73,7 +73,7 @@ Container::Container() : mCounter(0) { qDebug() << "Creating new json client with format" << gFormat; - mClient = new JsonClient; + mClient = new QJsonClient; connect(mClient, SIGNAL(messageReceived(const QJsonObject&)), SLOT(received(const QJsonObject&))); connect(mClient, SIGNAL(disconnected()), SLOT(disconnected())); diff --git a/tests/auto/jsonstream/tst_jsonstream.cpp b/tests/auto/jsonstream/tst_jsonstream.cpp index e54abe8..b23d077 100644 --- a/tests/auto/jsonstream/tst_jsonstream.cpp +++ b/tests/auto/jsonstream/tst_jsonstream.cpp @@ -42,12 +42,12 @@ #include <QtTest> #include <QLocalSocket> #include <QLocalServer> -#include "jsonserver.h" -#include "jsonstream.h" -#include "jsonpipe.h" -#include "jsonuidauthority.h" -#include "jsonuidrangeauthority.h" -#include "schemavalidator.h" +#include "qjsonserver.h" +#include "qjsonstream.h" +#include "qjsonpipe.h" +#include "qjsonuidauthority.h" +#include "qjsonuidrangeauthority.h" +#include "qjsonschemavalidator.h" #include <unistd.h> @@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QJsonObject); class Spy { public: - Spy(JsonServer *server) + Spy(QJsonServer *server) : addedSpy(server, SIGNAL(connectionAdded(const QString&))) , removedSpy(server, SIGNAL(connectionRemoved(const QString&))) , receivedSpy(server, SIGNAL(messageReceived(const QString&, const QJsonObject&))) @@ -172,11 +172,11 @@ private: }; /****************************/ -class TestJsonStream : public JsonStream +class TestJsonStream : public QJsonStream { public: TestJsonStream(QIODevice *device) - : JsonStream(device) {} + : QJsonStream(device) {} bool sendRaw(const QByteArray& byteArray) { return sendInternal(byteArray); } }; @@ -188,7 +188,7 @@ class BasicServer : public QObject { public: BasicServer(const QString& socketname, qint64 _sz = 0, bool _handleReadBufOverflow = false) : socket(0), stream(0), readBufferSize(_sz) - , mHandleReadBufOverflow(_handleReadBufOverflow), mLastError(JsonStream::NoError) + , mHandleReadBufOverflow(_handleReadBufOverflow), mLastError(QJsonStream::NoError) { QLocalServer::removeServer(socketname); server = new QLocalServer(this); @@ -226,7 +226,7 @@ public: return stream->format(); } - JsonStream *jsonStream() const { return stream; } + QJsonStream *jsonStream() const { return stream; } private slots: void handleConnection() { socket = server->nextPendingConnection(); @@ -275,7 +275,7 @@ private: qint64 readBufferSize; bool mHandleReadBufOverflow; public: - JsonStream::JsonStreamError mLastError; + QJsonStream::QJsonStreamError mLastError; }; /****************************/ @@ -305,7 +305,7 @@ private slots: void tst_JsonStream::initTestCase() { qRegisterMetaType<QJsonObject>(); - qRegisterMetaType<JsonPipe::PipeError>("PipeError"); + qRegisterMetaType<QJsonPipe::PipeError>("PipeError"); } #if defined(Q_OS_LINUX_ANDROID) @@ -316,7 +316,7 @@ QString s_socketname = QStringLiteral("/tmp/tst_socket"); void tst_JsonStream::noAuthTest() { - JsonServer server; + QJsonServer server; Spy spy(&server); QVERIFY(server.listen(s_socketname)); @@ -335,9 +335,9 @@ void tst_JsonStream::noAuthTest() void tst_JsonStream::authTest() { - JsonServer server; + QJsonServer server; Spy spy(&server); - JsonUIDAuthority *authority = new JsonUIDAuthority; + QJsonUIDAuthority *authority = new QJsonUIDAuthority; QVERIFY(server.listen(s_socketname, authority)); authority->authorize(geteuid()); @@ -357,9 +357,9 @@ void tst_JsonStream::authTest() void tst_JsonStream::authFail() { - JsonServer server; + QJsonServer server; Spy spy(&server); - JsonUIDAuthority *authority = new JsonUIDAuthority; + QJsonUIDAuthority *authority = new QJsonUIDAuthority; QVERIFY(server.listen(s_socketname, authority)); // authority->authorize(geteuid()); @@ -373,9 +373,9 @@ void tst_JsonStream::authFail() void tst_JsonStream::authRangeTest() { - JsonServer server; + QJsonServer server; Spy spy(&server); - JsonUIDRangeAuthority *authority = new JsonUIDRangeAuthority; + QJsonUIDRangeAuthority *authority = new QJsonUIDRangeAuthority; authority->setMinimum(geteuid()); authority->setMaximum(geteuid()); @@ -397,9 +397,9 @@ void tst_JsonStream::authRangeTest() void tst_JsonStream::authRangeFail() { - JsonServer server; + QJsonServer server; Spy spy(&server); - JsonUIDRangeAuthority *authority = new JsonUIDRangeAuthority; + QJsonUIDRangeAuthority *authority = new QJsonUIDRangeAuthority; QVERIFY(server.listen(s_socketname, authority)); Child child("testClient/testClient", QStringList() << "-socket" << s_socketname); @@ -590,14 +590,14 @@ void tst_JsonStream::bufferSizeTest() server.jsonStream()->setWriteBufferSize(100); QVERIFY(!server.send(msg)); - QVERIFY(server.jsonStream()->lastError() == JsonStream::MaxWriteBufferSizeExceeded); + QVERIFY(server.jsonStream()->lastError() == QJsonStream::MaxWriteBufferSizeExceeded); QString strLarge(500000, '*'); msg.insert("large", strLarge); msg.insert("large_size", strLarge.size()); server.jsonStream()->setWriteBufferSize(0); QVERIFY(server.send(msg)); - QVERIFY(server.jsonStream()->lastError() == JsonStream::NoError); + QVERIFY(server.jsonStream()->lastError() == QJsonStream::NoError); server.waitDisconnect(); child.waitForFinished(); @@ -624,7 +624,7 @@ void tst_JsonStream::bufferMaxReadSizeFailTest() QVERIFY(!server.jsonStream()); //disconnected QVERIFY(spy1.count() == 1); // overflow happend only once - QVERIFY(server.mLastError == JsonStream::MaxReadBufferSizeExceeded); + QVERIFY(server.mLastError == QJsonStream::MaxReadBufferSizeExceeded); } void tst_JsonStream::schemaTest() @@ -632,20 +632,20 @@ void tst_JsonStream::schemaTest() QString strSchemasDir(QDir::currentPath() + "/" + "schemas"); QVERIFY(QFile::exists(strSchemasDir)); - JsonServer server; + QJsonServer server; QVERIFY(server.inboundValidator()); QVERIFY(server.outboundValidator()); - server.setValidatorFlags(JsonServer::ValidatorFlags(JsonServer::WarnIfInvalid | JsonServer::DropIfInvalid)); + server.setValidatorFlags(QJsonServer::ValidatorFlags(QJsonServer::WarnIfInvalid | QJsonServer::DropIfInvalid)); server.inboundValidator()->loadFromFolder(strSchemasDir); server.inboundValidator()->setValidationFilter(QRegExp("Paint\\w+Event|BackgroundEvent")); - server.inboundValidator()->setSchemaNameMatcher(SchemaValidator::SchemaUniqueKeyNameMatcher("event")); + server.inboundValidator()->setSchemaNameMatcher(QJsonSchemaValidator::SchemaUniqueKeyNameMatcher("event")); server.outboundValidator()->loadFromFolder(strSchemasDir); server.outboundValidator()->setValidationFilter(QRegExp("Reply\\w+")); - server.outboundValidator()->setSchemaNameMatcher(SchemaValidator::SchemaUniqueKeyNameMatcher("event")); + server.outboundValidator()->setSchemaNameMatcher(QJsonSchemaValidator::SchemaUniqueKeyNameMatcher("event")); QVERIFY(!server.inboundValidator()->isEmpty()); QVERIFY(!server.outboundValidator()->isEmpty()); @@ -692,7 +692,7 @@ public: ::close(fd2[0]); ::close(fd2[1]); } - void join(JsonPipe& jp1, JsonPipe& jp2) { + void join(QJsonPipe& jp1, QJsonPipe& jp2) { // fd1[0] = Read end of jp1 fd1[1] = Write end of jp2 // fd2[0] = Read end of jp2 fd2[1] = Write end of jp1 jp1.setFds(fd1[0], fd2[1]); @@ -703,7 +703,7 @@ public: class PipeSpy { public: - PipeSpy(JsonPipe& jp) + PipeSpy(QJsonPipe& jp) : msg(&jp, SIGNAL(messageReceived(const QJsonObject&))) , err(&jp, SIGNAL(error(PipeError))) {} QJsonObject at(int i) { return qvariant_cast<QJsonObject>(msg.at(i).at(0)); } @@ -714,7 +714,7 @@ public: void tst_JsonStream::pipeTest() { Pipes pipes; - JsonPipe jpipe1, jpipe2; + QJsonPipe jpipe1, jpipe2; QVERIFY(!jpipe1.writeEnabled()); QVERIFY(!jpipe1.readEnabled()); @@ -744,7 +744,7 @@ void tst_JsonStream::pipeFormatTest() foreach (EncodingFormat format, formats) { Pipes pipes; - JsonPipe jpipe1, jpipe2; + QJsonPipe jpipe1, jpipe2; pipes.join(jpipe1, jpipe2); PipeSpy spy(jpipe2); jpipe1.setFormat(format); @@ -762,7 +762,7 @@ void tst_JsonStream::pipeFormatTest() void tst_JsonStream::pipeWaitTest() { Pipes pipes; - JsonPipe jpipe1, jpipe2; + QJsonPipe jpipe1, jpipe2; pipes.join(jpipe1, jpipe2); QJsonObject msg; diff --git a/tests/auto/testsuite/tst_jsonclient.cpp b/tests/auto/testsuite/tst_jsonclient.cpp index f2a3954..5bbd380 100644 --- a/tests/auto/testsuite/tst_jsonclient.cpp +++ b/tests/auto/testsuite/tst_jsonclient.cpp @@ -48,7 +48,7 @@ tst_JsonClient::tst_JsonClient(const QString& socketname, const QString& strMsg) { qDebug() << Q_FUNC_INFO; - mClient = new JsonClient; + mClient = new QJsonClient; connect(mClient, SIGNAL(messageReceived(const QJsonObject&)), this, SLOT(messageReceived(const QJsonObject&))); mSpyMessageReceived = new QSignalSpy(mClient, SIGNAL(messageReceived(const QJsonObject&))); diff --git a/tests/auto/testsuite/tst_jsonclient.h b/tests/auto/testsuite/tst_jsonclient.h index a0898df..6a0ad25 100644 --- a/tests/auto/testsuite/tst_jsonclient.h +++ b/tests/auto/testsuite/tst_jsonclient.h @@ -60,7 +60,7 @@ private slots: void messageReceived(const QJsonObject& message); private: - JsonClient *mClient; + QJsonClient *mClient; QString mMsg; QSignalSpy *mSpyMessageReceived; }; diff --git a/tests/auto/testsuite/tst_jsonserver.cpp b/tests/auto/testsuite/tst_jsonserver.cpp index aa8c400..af83959 100644 --- a/tests/auto/testsuite/tst_jsonserver.cpp +++ b/tests/auto/testsuite/tst_jsonserver.cpp @@ -102,7 +102,7 @@ void tst_JsonServer::noAuthTest() { qDebug() << "Running" << Q_FUNC_INFO; - mServer = new JsonServer; + mServer = new QJsonServer; connect(mServer, SIGNAL(connectionAdded(const QString&)), this, SLOT(connectionAdded(const QString&))); mSpyServerConnectionAdded = new QSignalSpy(mServer, SIGNAL(connectionAdded(const QString&))); @@ -123,7 +123,7 @@ void tst_JsonServer::pidAuthorityTest() qDebug() << "Running" << Q_FUNC_INFO; #ifdef MMM // not implemented - JsonPIDAuthority *auth = new JsonPIDAuthority(this); + QJsonPIDAuthority *auth = new QJsonPIDAuthority(this); pid_t clientPid = getpid(); QString clientId = "pid_auth_tester"; @@ -140,7 +140,7 @@ void tst_JsonServer::pidAuthorityTest() QVERIFY(auth->deauthorize(clientPid) == false); #endif - mServer = new JsonServer; + mServer = new QJsonServer; connect(mServer, SIGNAL(connectionAdded(const QString&)), this, SLOT(connectionAdded(const QString&))); mSpyServerConnectionAdded = new QSignalSpy(mServer, SIGNAL(connectionAdded(const QString&))); @@ -160,7 +160,7 @@ void tst_JsonServer::tokenAuthorityTest() { qDebug() << "Running" << Q_FUNC_INFO; - JsonTokenAuthority *auth = new JsonTokenAuthority(this); + QJsonTokenAuthority *auth = new QJsonTokenAuthority(this); QString clientId = "token_auth_tester"; QString clientToken = QUuid::createUuid().toString(); @@ -179,7 +179,7 @@ void tst_JsonServer::tokenAuthorityTest() QVERIFY(auth->authorize(clientToken, clientId)); - mServer = new JsonServer; + mServer = new QJsonServer; connect(mServer, SIGNAL(connectionAdded(const QString&)), this, SLOT(connectionAdded(const QString&))); mSpyServerConnectionAdded = new QSignalSpy(mServer, SIGNAL(connectionAdded(const QString&))); diff --git a/tests/auto/testsuite/tst_jsonserver.h b/tests/auto/testsuite/tst_jsonserver.h index 6725caa..cd446d9 100644 --- a/tests/auto/testsuite/tst_jsonserver.h +++ b/tests/auto/testsuite/tst_jsonserver.h @@ -78,7 +78,7 @@ private: QString mId; bool mDone; - JsonServer *mServer; + QJsonServer *mServer; QSignalSpy *mSpyServerConnectionAdded; QSignalSpy *mSpyServerConnectionRemoved; QSignalSpy *mSpyMessageReceived; |