diff options
Diffstat (limited to 'tests/auto')
12 files changed, 409 insertions, 10 deletions
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 9be046c75be..b05a055252b 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -397,6 +397,7 @@ private slots: void iterateAssociativeContainerElements_data(); void iterateAssociativeContainerElements() { runTestFunction(); } void iterateContainerElements(); + void emptyContainerInterface(); void pairElements_data(); void pairElements() { runTestFunction(); } @@ -5324,6 +5325,26 @@ void tst_QVariant::iterateContainerElements() } } +void tst_QVariant::emptyContainerInterface() +{ + // An empty container interface should implicitly be of invalid size + // and its begin and end iterators should be equal. + + const QtMetaContainerPrivate::QMetaContainerInterface emptyContainerInterface {}; + QIterable emptyIterable(QMetaContainer(&emptyContainerInterface), nullptr); + + QCOMPARE(emptyIterable.size(), -1); + auto constBegin = emptyIterable.constBegin(); + auto constEnd = emptyIterable.constEnd(); + QVERIFY(constBegin == constEnd); + QCOMPARE(constEnd - constBegin, 0); + + auto mutableBegin = emptyIterable.mutableBegin(); + auto mutableEnd = emptyIterable.mutableEnd(); + QVERIFY(mutableBegin == mutableEnd); + QCOMPARE(mutableEnd - mutableBegin, 0); +} + template <typename Pair> static void testVariantPairElements() { QFETCH(std::function<void(void *)>, makeValue); diff --git a/tests/auto/corelib/platform/android/tst_android.cpp b/tests/auto/corelib/platform/android/tst_android.cpp index 3665f100a61..b4bb0323f8a 100644 --- a/tests/auto/corelib/platform/android/tst_android.cpp +++ b/tests/auto/corelib/platform/android/tst_android.cpp @@ -430,6 +430,8 @@ void tst_Android::testFullScreenDimensions() widget.showNormal(); } + // TODO needs fix to work in local and CI on same fashion + const bool runsOnCI = qgetenv("QTEST_ENVIRONMENT").split(' ').contains("ci"); { // Translucent // available geometry == full display size (system bars visible but drawable under) @@ -437,14 +439,11 @@ void tst_Android::testFullScreenDimensions() widget.show(); QCoreApplication::processEvents(); QTRY_COMPARE(screen->availableGeometry().width(), realSize.getField<jint>("x")); - QTRY_COMPARE(screen->availableGeometry().height(), realSize.getField<jint>("y")); - - QTRY_COMPARE(screen->geometry().width(), realSize.getField<jint>("x")); - // TODO needs fix to work in local and CI on same fashion - const bool runsOnCI = qgetenv("QTEST_ENVIRONMENT").split(' ').contains("ci"); if ((sdkVersion > __ANDROID_API_V__) && runsOnCI) QEXPECT_FAIL("", "Fails on Android 16 (QTBUG-141712).", Continue); + QTRY_COMPARE(screen->availableGeometry().height(), realSize.getField<jint>("y")); + QTRY_COMPARE(screen->geometry().width(), realSize.getField<jint>("x")); QTRY_COMPARE(screen->geometry().height(), realSize.getField<jint>("y")); widget.showNormal(); } @@ -455,6 +454,8 @@ void tst_Android::testFullScreenDimensions() widget.showMaximized(); QCoreApplication::processEvents(); QTRY_COMPARE(screen->availableGeometry().width(), realSize.getField<jint>("x")); + if ((sdkVersion > __ANDROID_API_V__) && runsOnCI) + QEXPECT_FAIL("", "Fails on Android 16 (QTBUG-141712).", Continue); QTRY_COMPARE(screen->availableGeometry().height(), realSize.getField<jint>("y")); QTRY_COMPARE(screen->geometry().width(), realSize.getField<jint>("x")); diff --git a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp index a63dea4c679..93024bb4a6c 100644 --- a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp +++ b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp @@ -260,7 +260,7 @@ void tst_QLocaleData::numericData_data() << u"\u00D7\u06F1\u06F0^"_s << GS(1, 3, 3) << U'\u06F0' << false; // Grouping separator variants: - QTest::newRow("gsw-Latn-CH/exp") // Right single quote for grouping: + QTest::newRow("gsw-Latn-CH/exp") // Uses apostrophe for grouping (matching C++): << LOCALE_DATA_PTR(SwissGerman, LatinScript, Switzerland) << QLocaleData::DoubleScientificMode << u"."_s << u"'"_s << u"\u2212"_s << u"+"_s << u"E"_s diff --git a/tests/auto/gui/image/qimagereader/images/image16.pgm b/tests/auto/gui/image/qimagereader/images/image16.pgm new file mode 100644 index 00000000000..4e0b55131b0 --- /dev/null +++ b/tests/auto/gui/image/qimagereader/images/image16.pgm @@ -0,0 +1,260 @@ +P2 +16 +16 +65535 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +65535 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 +32767 diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index de9fea78ea6..8ccaf435f0b 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -610,6 +610,7 @@ void tst_QImageReader::imageFormat_data() QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm") << QImage::Format_Mono; QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm") << QImage::Format_Grayscale8; + QTest::newRow("pgm") << QString("image16.pgm") << QByteArray("pgm") << QImage::Format_Grayscale16; QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm") << QImage::Format_RGB32; QTest::newRow("ppm-2") << QString("teapot.ppm") << QByteArray("ppm") << QImage::Format_RGB32; QTest::newRow("ppm-3") << QString("runners.ppm") << QByteArray("ppm") << QImage::Format_RGB32; diff --git a/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST new file mode 100644 index 00000000000..a8f73d73f4d --- /dev/null +++ b/tests/auto/gui/kernel/qguieventdispatcher/BLACKLIST @@ -0,0 +1,2 @@ +[postEventFromThread] +macos-26 developer-build # QTBUG-142185 diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index 1ef54f0bfbf..55003c7ec18 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -25,5 +25,6 @@ android windows-10 windows-11 android +macos-26 # QTBUG-142157 [stateChangeSignal] macos # QTBUG-140388 diff --git a/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp b/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp index 8e8c90e14de..417655c31d9 100644 --- a/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp +++ b/tests/auto/network/access/qhttp2connection/tst_qhttp2connection.cpp @@ -8,6 +8,8 @@ #include <QtNetwork/private/hpack_p.h> #include <QtNetwork/private/bitstreams_p.h> +#include <QtCore/qregularexpression.h> + #include <limits> using namespace Qt::StringLiterals; @@ -35,6 +37,8 @@ private slots: void connectToServer(); void WINDOW_UPDATE(); void testCONTINUATIONFrame(); + void goaway_data(); + void goaway(); private: enum PeerType { Client, Server }; @@ -1051,6 +1055,112 @@ void tst_QHttp2Connection::testCONTINUATIONFrame() } } +void tst_QHttp2Connection::goaway_data() +{ + QTest::addColumn<bool>("endStreamOnHEADERS"); + QTest::addColumn<bool>("createNewStreamAfterDelay"); + QTest::addRow("end-on-headers") << true << false; + QTest::addRow("end-after-data") << false << false; + QTest::addRow("end-after-new-late-stream") << false << true; +} + +void tst_QHttp2Connection::goaway() +{ + QFETCH(const bool, endStreamOnHEADERS); + QFETCH(const bool, createNewStreamAfterDelay); + auto [client, server] = makeFakeConnectedSockets(); + auto connection = makeHttp2Connection(client.get(), {}, Client); + auto serverConnection = makeHttp2Connection(server.get(), {}, Server); + + QHttp2Stream *clientStream = connection->createStream().unwrap(); + QVERIFY(clientStream); + QVERIFY(waitForSettingsExchange(connection, serverConnection)); + + QSignalSpy newIncomingStreamSpy{ serverConnection, &QHttp2Connection::newIncomingStream }; + + QSignalSpy clientIncomingStreamSpy{ connection, &QHttp2Connection::newIncomingStream }; + QSignalSpy clientHeaderReceivedSpy{ clientStream, &QHttp2Stream::headersReceived }; + QSignalSpy clientGoawaySpy{ connection, &QHttp2Connection::receivedGOAWAY }; + + const HPack::HttpHeader headers = getRequiredHeaders(); + clientStream->sendHEADERS(headers, false); + + QVERIFY(newIncomingStreamSpy.wait()); + auto *serverStream = newIncomingStreamSpy.front().front().value<QHttp2Stream *>(); + QVERIFY(serverStream); + QVERIFY(serverConnection->sendGOAWAY(Http2::CANCEL)); + auto createStreamResult = serverConnection->createLocalStreamInternal(); + QVERIFY(createStreamResult.has_error()); + QCOMPARE(createStreamResult.error(), QHttp2Connection::CreateStreamError::ReceivedGOAWAY); + + QVERIFY(clientGoawaySpy.wait()); + QCOMPARE(clientGoawaySpy.size(), 1); + // The error code used: + QCOMPARE(clientGoawaySpy.first().first().value<Http2::Http2Error>(), Http2::CANCEL); + // Last ID that will be processed + QCOMPARE(clientGoawaySpy.first().last().value<quint32>(), clientStream->streamID()); + clientGoawaySpy.clear(); + + // Test that creating a stream the normal way results in an error: + QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError> + invalidStream = connection->createStream(); + QVERIFY(!invalidStream.ok()); + QVERIFY(invalidStream.has_error()); + QCOMPARE(invalidStream.error(), QHttp2Connection::CreateStreamError::ReceivedGOAWAY); + + // Directly create a stream to avoid the GOAWAY check: + quint32 nextStreamId = clientStream->streamID() + 2; + QHttp2Stream *secondClientStream = connection->createStreamInternal_impl(nextStreamId); + QSignalSpy streamResetSpy{ secondClientStream, &QHttp2Stream::rstFrameReceived }; + secondClientStream->sendHEADERS(headers, endStreamOnHEADERS); + // The stream should be ignored: + using namespace std::chrono_literals; + QVERIFY(!streamResetSpy.wait(100ms)); // We don't get reset because we are ignored + if (endStreamOnHEADERS) + return; + + secondClientStream->sendDATA("my data", createNewStreamAfterDelay); + // We cheat and try to send data after the END_STREAM flag has been sent + if (!createNewStreamAfterDelay) { + // Manually send a frame with END_STREAM so the QHttp2Stream thinks it's fine to send more + // DATA + connection->frameWriter.start(Http2::FrameType::DATA, Http2::FrameFlag::END_STREAM, + secondClientStream->streamID()); + connection->frameWriter.write(*connection->getSocket()); + QVERIFY(!streamResetSpy.wait(100ms)); // We don't get reset because we are ignored + + // Even without the GOAWAY this should fail (more activity after END_STREAM) + secondClientStream->sendDATA("my data", true); + QTest::ignoreMessage(QtCriticalMsg, + QRegularExpression(u".*Connection error: DATA on invalid stream.*"_s)); + QVERIFY(clientGoawaySpy.wait()); + QCOMPARE(clientGoawaySpy.size(), 1); + QCOMPARE(clientGoawaySpy.first().first().value<Http2::Http2Error>(), + Http2::ENHANCE_YOUR_CALM); + QCOMPARE(clientGoawaySpy.first().last().value<quint32>(), clientStream->streamID()); + return; // connection is dead by now + } + + // Override the deadline timer so we don't have to wait too long + serverConnection->m_goawayGraceTimer.setRemainingTime(50ms); + + // We can create the stream whenever, it is not noticed by the server until we send something. + nextStreamId += 2; + QHttp2Stream *rejectedStream = connection->createStreamInternal_impl(nextStreamId); + // Sleep until the grace period is over: + QTRY_VERIFY(serverConnection->m_goawayGraceTimer.hasExpired()); + + QVERIFY(rejectedStream->sendHEADERS(headers, true)); + + QTest::ignoreMessage(QtCriticalMsg, + QRegularExpression(u".*Connection error: Peer refused to GOAWAY\\..*"_s)); + QVERIFY(clientGoawaySpy.wait()); + QCOMPARE(clientGoawaySpy.size(), 1); + QCOMPARE(clientGoawaySpy.first().first().value<Http2::Http2Error>(), Http2::PROTOCOL_ERROR); + // The first stream is still the last processed one: + QCOMPARE(clientGoawaySpy.first().last().value<quint32>(), clientStream->streamID()); +} + QTEST_MAIN(tst_QHttp2Connection) #include "tst_qhttp2connection.moc" diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json index 363ade3d53c..d8e6c4df538 100644 --- a/tests/auto/tools/moc/allmocs_baseline_in.json +++ b/tests/auto/tools/moc/allmocs_baseline_in.json @@ -2501,7 +2501,7 @@ { "isClass": false, "isFlag": false, - "lineNumber": 14, + "lineNumber": 13, "name": "SomeEnum", "values": [ "SomeEnumValue" diff --git a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h index efd82107673..2513094ed0c 100644 --- a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h +++ b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h @@ -9,9 +9,9 @@ namespace QTBUG_2151 { class A : public QObject { Q_OBJECT - Q_ENUMS(SomeEnum) public: enum SomeEnum { SomeEnumValue = 0 }; + Q_ENUM(SomeEnum) }; class B : public QObject diff --git a/tests/auto/tools/moc/related-metaobjects-name-conflict.h b/tests/auto/tools/moc/related-metaobjects-name-conflict.h index cccd97e4e74..d88826f696a 100644 --- a/tests/auto/tools/moc/related-metaobjects-name-conflict.h +++ b/tests/auto/tools/moc/related-metaobjects-name-conflict.h @@ -9,15 +9,15 @@ #define DECLARE_GADGET_AND_OBJECT_CLASSES \ class Gadget { \ Q_GADGET \ - Q_ENUMS(SomeEnum) \ public: \ enum SomeEnum { SomeEnumValue = 0 }; \ + Q_ENUM(SomeEnum) \ }; \ class Object : public QObject{ \ Q_OBJECT \ - Q_ENUMS(SomeEnum) \ public: \ enum SomeEnum { SomeEnumValue = 0 }; \ + Q_ENUM(SomeEnum) \ }; #define DECLARE_DEPENDING_CLASSES \ diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index dd2cb1dcee9..9651c1480c8 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -41,6 +41,9 @@ android android [hoverPosition] macos-14 x86 +macos-26 # QTBUG-142157 # QTBUG-124291 [setParentChangesFocus:make dialog parentless, after] android +[enterLeaveOnWindowShowHide] +macos-26 # QTBUG-142157 |
