Switch integration test to qt6 (#1916)

Keep using Qt5 for Cygwin and CodeQL

* CI: upgrade ubuntu
This commit is contained in:
Alexey Sokolov
2024-09-17 15:24:33 +01:00
committed by GitHub
parent 0506e95a74
commit 9e9d75c4b8
9 changed files with 48 additions and 24 deletions
+9 -1
View File
@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <QRegularExpression>
#include "znctest.h"
#ifndef ZNC_BIN_DIR
@@ -119,6 +120,12 @@ std::unique_ptr<QNetworkReply> ZNCTest::HandleHttp(QNetworkReply* reply) {
std::cout << "Got HTTP reply" << std::endl;
loop.quit();
});
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QObject::connect(reply, &QNetworkReply::errorOccurred,
[&](QNetworkReply::NetworkError e) {
ADD_FAILURE() << reply->errorString().toStdString();
});
#else
QObject::connect(
reply,
static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(
@@ -126,6 +133,7 @@ std::unique_ptr<QNetworkReply> ZNCTest::HandleHttp(QNetworkReply* reply) {
[&](QNetworkReply::NetworkError e) {
ADD_FAILURE() << reply->errorString().toStdString();
});
#endif
QTimer::singleShot(30000 /* msec */, &loop, [&]() {
ADD_FAILURE() << "connection timeout";
loop.quit();
@@ -160,7 +168,7 @@ void ZNCTest::InstallModule(QString name, QString content) {
QStringList lines = content.split("\n");
int maxoffset = -1;
for (const QString& line : lines) {
int nonspace = line.indexOf(QRegExp("\\S"));
int nonspace = line.indexOf(QRegularExpression("\\S"));
if (nonspace == -1) continue;
if (nonspace < maxoffset || maxoffset == -1) maxoffset = nonspace;
}