forked from len0rd/rockbox
rbutil: Make test compile with Qt6.
Change-Id: I2e6520588c7a82482b2c605d0b295f8fc7e0a03b
This commit is contained in:
parent
35bc4590ae
commit
80c0268c7a
1 changed files with 8 additions and 6 deletions
|
|
@ -18,8 +18,8 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest>
|
||||||
#include <QtCore/QObject>
|
#include <QObject>
|
||||||
#include "httpget.h"
|
#include "httpget.h"
|
||||||
|
|
||||||
#define TEST_USER_AGENT "TestAgent/2.3"
|
#define TEST_USER_AGENT "TestAgent/2.3"
|
||||||
|
|
@ -354,10 +354,11 @@ void TestHttpGet::testUserAgent(void)
|
||||||
QCOMPARE(requests.at(0).startsWith("GET"), true);
|
QCOMPARE(requests.at(0).startsWith("GET"), true);
|
||||||
|
|
||||||
for(int i = 0; i < requests.size(); ++i) {
|
for(int i = 0; i < requests.size(); ++i) {
|
||||||
QRegExp rx("User-Agent:[\t ]+([a-zA-Z0-9\\./]+)");
|
QRegularExpression rx("User-Agent:[\t ]+([a-zA-Z0-9\\./]+)");
|
||||||
bool userAgentFound = rx.indexIn(requests.at(i)) > 0 ? true : false;
|
auto match = rx.match(requests.at(i));
|
||||||
|
bool userAgentFound = match.hasMatch();
|
||||||
QCOMPARE(userAgentFound, true);
|
QCOMPARE(userAgentFound, true);
|
||||||
QString userAgentString = rx.cap(1);
|
QString userAgentString = match.captured(1);
|
||||||
QCOMPARE(userAgentString, QString(TEST_USER_AGENT));
|
QCOMPARE(userAgentString, QString(TEST_USER_AGENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -539,7 +540,8 @@ void TestHttpGet::testMovedQuery(void)
|
||||||
QCOMPARE(m_daemon->lastRequestData().at(0).startsWith("GET"), true);
|
QCOMPARE(m_daemon->lastRequestData().at(0).startsWith("GET"), true);
|
||||||
QCOMPARE(m_daemon->lastRequestData().at(1).startsWith("GET"), true);
|
QCOMPARE(m_daemon->lastRequestData().at(1).startsWith("GET"), true);
|
||||||
// current implementation keeps order of query items.
|
// current implementation keeps order of query items.
|
||||||
QCOMPARE((bool)m_daemon->lastRequestData().at(1).contains("/test2.php?var=1&b=foo"), true);
|
qDebug() << m_daemon->lastRequestData().at(1);
|
||||||
|
QCOMPARE(m_daemon->lastRequestData().at(1).contains("/test2.php?var=1&b=foo"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestHttpGet)
|
QTEST_MAIN(TestHttpGet)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue