summaryrefslogtreecommitdiff
path: root/tests/manual
diff options
context:
space:
mode:
authorKurt Pattyn <pattyn.kurt@gmail.com>2014-01-18 22:02:11 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-20 18:26:48 +0100
commit76cd00f8fdb249d866723ced0514041099f95a4b (patch)
tree11f9467e82926a6f62ae61c76b4e2888ab8b46bd /tests/manual
parent196617e5fb4f93655bbecea221b2dd350411fcae (diff)
downloadqtwebsockets-76cd00f8fdb249d866723ced0514041099f95a4b.tar.gz
Use QStringLiteral where appropriate
Change-Id: I608b555428aceafd7761a882cd4bd1fdb50d19b3 Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/compliance/tst_compliance.cpp12
-rw-r--r--tests/manual/websockets/tst_websockets.cpp22
2 files changed, 13 insertions, 21 deletions
diff --git a/tests/manual/compliance/tst_compliance.cpp b/tests/manual/compliance/tst_compliance.cpp
index a5216b2..5c2115c 100644
--- a/tests/manual/compliance/tst_compliance.cpp
+++ b/tests/manual/compliance/tst_compliance.cpp
@@ -113,10 +113,10 @@ void tst_ComplianceTest::runTestCase(int nbr, int total)
qDebug() << "Executing test" << (nbr + 1) << "/" << total;
QUrl url = m_url;
- url.setPath("/runCase?");
+ url.setPath(QStringLiteral("/runCase?"));
QUrlQuery query;
- query.addQueryItem("case", QString::number(nbr + 1));
- query.addQueryItem("agent", "QtWebSockets/1.0");
+ query.addQueryItem(QStringLiteral("case"), QString::number(nbr + 1));
+ query.addQueryItem(QStringLiteral("agent"), QStringLiteral("QtWebSockets/1.0"));
url.setQuery(query);
pWebSocket->open(url);
spy.wait(60000);
@@ -142,7 +142,7 @@ void tst_ComplianceTest::autobahnTest()
numberOfTestCases = message.toInt();
});
- url.setPath("/getCaseCount");
+ url.setPath(QStringLiteral("/getCaseCount"));
pWebSocket->open(url);
spy.wait(60000);
QVERIFY(numberOfTestCases > 0);
@@ -150,9 +150,9 @@ void tst_ComplianceTest::autobahnTest()
QObject::disconnect(pWebSocket, &QWebSocket::textMessageReceived, 0, 0);
runTestCases(0, numberOfTestCases);
- url.setPath("/updateReports?");
+ url.setPath(QStringLiteral("/updateReports?"));
QUrlQuery query;
- query.addQueryItem("agent", "QtWebSockets");
+ query.addQueryItem(QStringLiteral("agent"), QStringLiteral("QtWebSockets"));
url.setQuery(query);
pWebSocket->open(url);
spy.wait(60000);
diff --git a/tests/manual/websockets/tst_websockets.cpp b/tests/manual/websockets/tst_websockets.cpp
index 57cb940..e0fbc09 100644
--- a/tests/manual/websockets/tst_websockets.cpp
+++ b/tests/manual/websockets/tst_websockets.cpp
@@ -97,7 +97,7 @@ private:
tst_WebSocketsTest::tst_WebSocketsTest() :
m_pWebSocket(0),
- m_url("ws://localhost:9000")
+ m_url(QStringLiteral("ws://localhost:9000"))
{
}
@@ -130,24 +130,16 @@ void tst_WebSocketsTest::cleanup()
void tst_WebSocketsTest::testTextMessage()
{
- const char *message = "Hello world!";
+ const QString message = QStringLiteral("Hello world!");
QSignalSpy spy(m_pWebSocket, SIGNAL(textMessageReceived(QString)));
- QCOMPARE(m_pWebSocket->write(message), (qint64)strlen(message));
+ QCOMPARE(m_pWebSocket->write(message), qint64(message.size()));
QTRY_VERIFY_WITH_TIMEOUT(spy.count() != 0, 1000);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).count(), 1);
- QCOMPARE(spy.takeFirst().at(0).toString(), QString(message));
-
- spy.clear();
- QString qMessage(message);
- QCOMPARE(m_pWebSocket->write(qMessage), (qint64)qMessage.length());
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() != 0, 1000);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).count(), 1);
- QCOMPARE(spy.takeFirst().at(0).toString(), qMessage);
+ QCOMPARE(spy.takeFirst().at(0).toString(), message);
}
void tst_WebSocketsTest::testBinaryMessage()
@@ -156,7 +148,7 @@ void tst_WebSocketsTest::testBinaryMessage()
QByteArray data("Hello world!");
- QCOMPARE(m_pWebSocket->write(data), (qint64)data.size());
+ QCOMPARE(m_pWebSocket->write(data), qint64(data.size()));
QTRY_VERIFY_WITH_TIMEOUT(spy.count() != 0, 1000);
QCOMPARE(spy.count(), 1);
@@ -166,7 +158,7 @@ void tst_WebSocketsTest::testBinaryMessage()
void tst_WebSocketsTest::testLocalAddress()
{
- QCOMPARE(m_pWebSocket->localAddress().toString(), QString("127.0.0.1"));
+ QCOMPARE(m_pWebSocket->localAddress().toString(), QStringLiteral("127.0.0.1"));
quint16 localPort = m_pWebSocket->localPort();
QVERIFY2(localPort > 0, "Local port is invalid.");
}
@@ -198,7 +190,7 @@ void tst_WebSocketsTest::testPeerAddress()
void tst_WebSocketsTest::testProxy()
{
QNetworkProxy oldProxy = m_pWebSocket->proxy();
- QNetworkProxy proxy(QNetworkProxy::HttpProxy, QString("proxy.network.com"), 80);
+ QNetworkProxy proxy(QNetworkProxy::HttpProxy, QStringLiteral("proxy.network.com"), 80);
m_pWebSocket->setProxy(proxy);
QCOMPARE(proxy, m_pWebSocket->proxy());
m_pWebSocket->setProxy(oldProxy);