diff options
Diffstat (limited to 'tests')
30 files changed, 842 insertions, 231 deletions
diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp index 2345bb39c1..b70dcd4a3b 100644 --- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp +++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp @@ -30,11 +30,17 @@ #include <QtTest/QtTest> #include <QtCore/qendian.h> #include <QtCore/private/qendian_p.h> - +#include <QtCore/qsysinfo.h> class tst_QtEndian: public QObject { Q_OBJECT +public: + enum Signedness { + Unsigned, + Signed + }; + Q_ENUM(Signedness); private slots: void fromBigEndian(); @@ -55,6 +61,9 @@ private slots: void endianIntegers(); void endianBitfields(); + + void endianBitfieldUnions_data(); + void endianBitfieldUnions(); }; struct TestData @@ -383,5 +392,103 @@ void tst_QtEndian::endianBitfields() QCOMPARE(u.bottom, -8); } +template<template<typename... Accessors> class Union, template<int, int, typename> class Member> +void testBitfieldUnion() +{ + using upper = Member<21, 11, uint>; + using lower = Member<10, 11, uint>; + using bottom = Member<0, 10, int>; + + using UnionType = Union<upper, lower, bottom>; + UnionType u; + + u.template set<upper>(200); + QCOMPARE(u.template get<upper>(), 200U); + u.template set<lower>(1000); + u.template set<bottom>(-8); + QCOMPARE(u.template get<lower>(), 1000U); + QCOMPARE(u.template get<upper>(), 200U); + + u.template set<lower>(u.template get<lower>() + u.template get<upper>()); + QCOMPARE(u.template get<upper>(), 200U); + QCOMPARE(u.template get<lower>(), 1200U); + + u.template set<upper>(65536 + 7); + u.template set<lower>(65535); + QCOMPARE(u.template get<lower>(), 65535U & ((1<<11) - 1)); + QCOMPARE(u.template get<upper>(), 7U); + + QCOMPARE(u.template get<bottom>(), -8); + + UnionType u2(QSpecialIntegerBitfieldZero); + QCOMPARE(u2.data(), 0U); + + UnionType u3(42U); + QCOMPARE(u3.data(), 42U); + +// We'd need if constexpr to test this: +// +// using BEUintAccessor = QSpecialIntegerAccessor<QBigEndianStorageType<uint>, 21, 11>; +// using LEUintAccessor = QSpecialIntegerAccessor<QLittleEndianStorageType<uint>, 21, 11>; +// using BEIntAccessor = QSpecialIntegerAccessor<QBigEndianStorageType<int>, 0, 10>; +// using LEIntAccessor = QSpecialIntegerAccessor<QLittleEndianStorageType<int>, 0, 10>; + +// if constexpr (std::is_same<BEUintAccessor, upper>::value) { +// QCOMPARE(u.template get<BEUintAccessor>(), 7U); +// } else if constexpr (std::is_same<LEUintAccessor, upper>::value) { +// QCOMPARE(u.template get<LEUintAccessor>(), 7U); +// } else if constexpr (std::is_same<BEIntAccessor, bottom>::value) { +// QCOMPARE(u.template get<BEIntAccessor>(), -8); +// } else if constexpr (std::is_same<LEIntAccessor, bottom>::value) { +// QCOMPARE(u.template get<LEIntAccessor>(), -8); +// } else { +// QFAIL("none of the manually defined accessors match"); +// } +} + +Q_DECLARE_METATYPE(QSysInfo::Endian) +void tst_QtEndian::endianBitfieldUnions_data() +{ + QTest::addColumn<QSysInfo::Endian>("byteOrder"); + QTest::addColumn<Signedness>("signedness"); + + QTest::addRow("little endian unsigned") << QSysInfo::LittleEndian << Unsigned; + QTest::addRow("little endian signed") << QSysInfo::LittleEndian << Signed; + QTest::addRow("big endian unsigned") << QSysInfo::BigEndian << Unsigned; + QTest::addRow("big endian signed") << QSysInfo::BigEndian << Signed; +} + +void tst_QtEndian::endianBitfieldUnions() +{ + QFETCH(QSysInfo::Endian, byteOrder); + QFETCH(Signedness, signedness); + + switch (byteOrder) { + case QSysInfo::LittleEndian: + switch (signedness) { + case Unsigned: + testBitfieldUnion<quint32_le_bitfield_union, quint32_le_bitfield_member>(); + return; + case Signed: + testBitfieldUnion<qint32_le_bitfield_union, qint32_le_bitfield_member>(); + return; + } + Q_UNREACHABLE(); + return; + case QSysInfo::BigEndian: + switch (signedness) { + case Unsigned: + testBitfieldUnion<quint32_be_bitfield_union, quint32_be_bitfield_member>(); + return; + case Signed: + testBitfieldUnion<qint32_be_bitfield_union, qint32_be_bitfield_member>(); + return; + } + Q_UNREACHABLE(); + return; + } +} + + QTEST_MAIN(tst_QtEndian) #include "tst_qtendian.moc" diff --git a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp index 4968742110..6f37f85230 100644 --- a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp @@ -42,6 +42,7 @@ private slots: void writeBlock_data(); void writeBlock(); void seek(); + void invalidSeeks(); void seekTest_data(); void seekTest(); void read_rawdata(); @@ -286,6 +287,29 @@ void tst_QBuffer::seek() QCOMPARE(buffer.size(), pos); } +void tst_QBuffer::invalidSeeks() +{ + if (sizeof(qsizetype) == sizeof(qint64)) { + // sizeof(qsizetype) == sizeof(qint64), so +1 would overflow + QSKIP("This is a 32-bit-only test."); + } else { + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + QCOMPARE(buffer.buffer().size(), qsizetype(0)); + QCOMPARE(buffer.pos(), qint64(0)); + constexpr qint64 MaxQByteArrayCapacity = (std::numeric_limits<qsizetype>::max)(); + // this should fail fast, not after trying to allocate nearly 2 GiB of data, + // potentially crashing in the process: + QVERIFY(!buffer.seek(2 * MaxQByteArrayCapacity - 1)); + QCOMPARE(buffer.buffer().size(), qsizetype(0)); + QCOMPARE(buffer.pos(), qint64(0)); + // ditto: + QVERIFY(!buffer.seek(MaxQByteArrayCapacity + 1)); + QCOMPARE(buffer.buffer().size(), qsizetype(0)); + QCOMPARE(buffer.pos(), qint64(0)); + } +} + void tst_QBuffer::seekTest_data() { writeBlock_data(); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 19b3289390..2e2209ac5d 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -369,7 +369,7 @@ protected: const char *nm = name.constData(); int tp = qRegisterMetaType<Bar>(nm); #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) - pthread_yield(); + sched_yield(); #endif QMetaType info(tp); if (!info.isValid()) { diff --git a/tests/auto/corelib/serialization/qxmlstream/data/019.ref b/tests/auto/corelib/serialization/qxmlstream/data/019.ref index 314efb2b04..9ae28f42e5 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/019.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/019.ref @@ -3,5 +3,5 @@ Comment( text=" Simple legal case: prefixed element " ) StartElement( name="foo" namespaceUri="http://example.org/namespace" qualifiedName="a:foo" prefix="a" NamespaceDeclaration( prefix="a" namespaceUri="http://example.org/namespace" ) ) -EndElement( name="foo" namespaceUri="http://example.org/namespace" qualifiedName="a:foo" ) +EndElement( name="foo" namespaceUri="http://example.org/namespace" qualifiedName="a:foo" prefix="a" ) EndDocument( ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/024.ref b/tests/auto/corelib/serialization/qxmlstream/data/024.ref index 83c3ac5315..43cf2b1faf 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/024.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/024.ref @@ -8,8 +8,8 @@ Characters( whitespace text=" StartElement( name="foo" namespaceUri="http://example.org/other-namespace" qualifiedName="a:foo" prefix="a" NamespaceDeclaration( prefix="a" namespaceUri="http://example.org/other-namespace" ) ) -EndElement( name="foo" namespaceUri="http://example.org/other-namespace" qualifiedName="a:foo" ) +EndElement( name="foo" namespaceUri="http://example.org/other-namespace" qualifiedName="a:foo" prefix="a" ) Characters( whitespace text=" " ) -EndElement( name="foo" namespaceUri="http://example.org/namespace" qualifiedName="a:foo" ) +EndElement( name="foo" namespaceUri="http://example.org/namespace" qualifiedName="a:foo" prefix="a" ) EndDocument( ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/039.ref b/tests/auto/corelib/serialization/qxmlstream/data/039.ref index 63ee6b4def..f7413e5436 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/039.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/039.ref @@ -16,7 +16,7 @@ StartElement( name="bar" namespaceUri="http://example.org/~kipper" qualifiedName Attribute( name="attr" qualifiedName="attr" value="2" ) ) -EndElement( name="bar" namespaceUri="http://example.org/~kipper" qualifiedName="b:bar" ) +EndElement( name="bar" namespaceUri="http://example.org/~kipper" qualifiedName="b:bar" prefix="b" ) Characters( whitespace text=" " ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/041.ref b/tests/auto/corelib/serialization/qxmlstream/data/041.ref index 3e7ca64208..50328feb4a 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/041.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/041.ref @@ -12,7 +12,7 @@ StartElement( name="bar" namespaceUri="http://example.org/~wilbur" qualifiedName Attribute( name="attr" qualifiedName="attr" value="2" ) ) -EndElement( name="bar" namespaceUri="http://example.org/~wilbur" qualifiedName="a:bar" ) +EndElement( name="bar" namespaceUri="http://example.org/~wilbur" qualifiedName="a:bar" prefix="a" ) Characters( whitespace text=" " ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/1.ref b/tests/auto/corelib/serialization/qxmlstream/data/1.ref index 0288cf0e11..41a9febd8e 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/1.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/1.ref @@ -4,5 +4,5 @@ StartElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" pref NamespaceDeclaration( prefix="ns" namespaceUri="namespaceUri" ) ) -EndElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" ) +EndElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" prefix="ns" ) EndDocument( ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/2.ref b/tests/auto/corelib/serialization/qxmlstream/data/2.ref index 95d68efbd6..2fad9844ce 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/2.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/2.ref @@ -5,5 +5,5 @@ StartElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" pref NamespaceDeclaration( prefix="ns" namespaceUri="namespaceUri" ) ) Characters( text="The world goes round and round" ) -EndElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" ) +EndElement( name="doc" namespaceUri="namespaceUri" qualifiedName="ns:doc" prefix="ns" ) EndDocument( ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/21.ref b/tests/auto/corelib/serialization/qxmlstream/data/21.ref index 1098c6800f..d0e4982eec 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/21.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/21.ref @@ -33,10 +33,10 @@ Characters( whitespace text=" " ) StartElement( name="title" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:title" prefix="html" ) Characters( text="test file" ) -EndElement( name="title" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:title" ) +EndElement( name="title" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:title" prefix="html" ) Characters( whitespace text=" " ) -EndElement( name="head" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:head" ) +EndElement( name="head" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:head" prefix="html" ) Characters( whitespace text=" " ) StartElement( name="body" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:body" prefix="html" ) @@ -46,11 +46,11 @@ StartElement( name="p" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName Attribute( name="class" qualifiedName="class" value="visible:false" ) ) Characters( text="bar" ) -EndElement( name="p" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:p" ) +EndElement( name="p" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:p" prefix="html" ) Characters( whitespace text=" " ) -EndElement( name="body" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:body" ) +EndElement( name="body" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:body" prefix="html" ) Characters( whitespace text=" " ) -EndElement( name="html" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:html" ) +EndElement( name="html" namespaceUri="http://www.w3.org/1999/xhtml" qualifiedName="html:html" prefix="html" ) EndDocument( ) diff --git a/tests/auto/corelib/serialization/qxmlstream/data/namespaceCDATA.ref b/tests/auto/corelib/serialization/qxmlstream/data/namespaceCDATA.ref index 132875f4bb..84538b0230 100644 --- a/tests/auto/corelib/serialization/qxmlstream/data/namespaceCDATA.ref +++ b/tests/auto/corelib/serialization/qxmlstream/data/namespaceCDATA.ref @@ -15,7 +15,7 @@ Characters( whitespace text=" StartElement( name="bar" namespaceUri="http://qt-project.org" qualifiedName="pre:bar" prefix="pre" NamespaceDeclaration( prefix="pre" namespaceUri="http://qt-project.org" ) ) -EndElement( name="bar" namespaceUri="http://qt-project.org" qualifiedName="pre:bar" ) +EndElement( name="bar" namespaceUri="http://qt-project.org" qualifiedName="pre:bar" prefix="pre" ) Characters( whitespace text=" " ) EndElement( name="body" qualifiedName="body" ) diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 33fcb156b6..84901f8f75 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -1778,7 +1778,8 @@ void tst_QLocale::toDateTime_data() QTest::addColumn<QDateTime>("result"); QTest::addColumn<QString>("format"); QTest::addColumn<QString>("string"); - QTest::addColumn<bool>("clean"); // No non-format letters in format string + // No non-format letters in format string, no time-zone (t format): + QTest::addColumn<bool>("clean"); QTest::newRow("1C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(5, 14, 0)) << "d/M/yyyy hh:h:mm" << "1/12/1974 05:5:14" << true; @@ -1832,6 +1833,21 @@ void tst_QLocale::toDateTime_data() QTest::newRow("12no_NO") << "no_NO" << QDateTime(QDate(1974, 12, 1), QTime(15, 0, 0)) << "d'd'dd/M/yyh" << "1d01/12/7415" << false; + QTest::newRow("short-ss") // QTBUG-102199: trips over an assert in CET + << "C" << QDateTime() // Single-digit seconds does not match ss format. + << QStringLiteral("ddd, d MMM yyyy HH:mm:ss") + << QStringLiteral("Sun, 29 Mar 2020 02:26:3") << true; + + QTest::newRow("short-ss-Z") // Same, but with a valid date-time: + << "C" << QDateTime() + << QStringLiteral("ddd, d MMM yyyy HH:mm:ss t") + << QStringLiteral("Sun, 29 Mar 2020 02:26:3 Z") << false; + + QTest::newRow("s-Z") // Same, but with a format that accepts the single digit: + << "C" << QDateTime(QDate(2020, 3, 29), QTime(2, 26, 3), Qt::UTC) + << QStringLiteral("ddd, d MMM yyyy HH:mm:s t") + << QStringLiteral("Sun, 29 Mar 2020 02:26:3 Z") << false; + QTest::newRow("RFC-1123") << "C" << QDateTime(QDate(2007, 11, 1), QTime(18, 8, 30)) << "ddd, dd MMM yyyy hh:mm:ss 'GMT'" << "Thu, 01 Nov 2007 18:08:30 GMT" << false; diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index a59b58d57f..412f092377 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -31,6 +31,8 @@ #include <private/qtimezoneprivate_p.h> #include <qlocale.h> +Q_DECLARE_METATYPE(QTimeZone::TimeType) + #if defined(Q_OS_WIN) && !QT_CONFIG(icu) # define USING_WIN_TZ #endif @@ -70,6 +72,8 @@ private slots: void macTest(); void darwinTypes(); void winTest(); + void localeSpecificDisplayName_data(); + void localeSpecificDisplayName(); private: void printTimeZone(const QTimeZone &tz); @@ -1366,6 +1370,55 @@ void tst_QTimeZone::winTest() #endif // QT_BUILD_INTERNAL && USING_WIN_TZ } +void tst_QTimeZone::localeSpecificDisplayName_data() +{ +#ifdef USING_WIN_TZ + QSKIP("MS backend does not use locale parameter"); +#endif + QTest::addColumn<QByteArray>("zoneName"); + QTest::addColumn<QLocale>("locale"); + QTest::addColumn<QTimeZone::TimeType>("timeType"); + QTest::addColumn<QString>("expectedName"); + + QStringList names; + QLocale locale; + // Pick a non-system locale; German or French + if (QLocale::system().language() != QLocale::German) { + locale = QLocale(QLocale::German); + names << QString("Mitteleurop\u00e4ische Normalzeit") + << QString("Mitteleurop\u00e4ische Sommerzeit"); + } else { + locale = QLocale(QLocale::French); + names << QString("heure normale d\u2019Europe centrale") + << QString("heure d\u2019\u00E9t\u00E9 d\u2019Europe centrale"); + } + + qsizetype index = 0; + QTest::newRow("Berlin, standard time") + << QByteArray("Europe/Berlin") << locale << QTimeZone::StandardTime + << names.at(index++); + + QTest::newRow("Berlin, summer time") + << QByteArray("Europe/Berlin") << locale << QTimeZone::DaylightTime + << names.at(index++); +} + +void tst_QTimeZone::localeSpecificDisplayName() +{ + // This test checks that QTimeZone::displayName() correctly uses the + // specified locale, NOT the system locale (see QTBUG-101460). + QFETCH(QByteArray, zoneName); + QFETCH(QLocale, locale); + QFETCH(QTimeZone::TimeType, timeType); + QFETCH(QString, expectedName); + + QTimeZone zone(zoneName); + QVERIFY(zone.isValid()); + + const QString localeName = zone.displayName(timeType, QTimeZone::LongName, locale); + QCOMPARE(localeName, expectedName); +} + #ifdef QT_BUILD_INTERNAL // Test each private produces the same basic results for CET void tst_QTimeZone::testCetPrivate(const QTimeZonePrivate &tzp) diff --git a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp index ba09b863ec..2737feba31 100644 --- a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp +++ b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp @@ -208,6 +208,9 @@ void tst_QTextMarkdownImporter::lists_data() QTest::newRow("numeric lists nested in empty lists") << "- \n 1. a\n 2. b\n- c\n 1.\n + d\n" << 4 << false << "- \n 1. a\n 2. b\n- c 1. + d\n"; + QTest::newRow("styled spans in list items") + << "1. normal text\n2. **bold** text\n3. `code` in the item\n4. *italic* text\n5. _underlined_ text\n" << 5 << false + << "1. normal text\n2. **bold** text\n3. `code` in the item\n4. *italic* text\n5. *underlined* text\n"; } void tst_QTextMarkdownImporter::lists() @@ -219,11 +222,22 @@ void tst_QTextMarkdownImporter::lists() QTextDocument doc; doc.setMarkdown(input); // QTBUG-78870 : don't crash + +#ifdef DEBUG_WRITE_HTML + { + QFile out("/tmp/" + QLatin1String(QTest::currentDataTag()) + ".html"); + out.open(QFile::WriteOnly); + out.write(doc.toHtml().toLatin1()); + out.close(); + } +#endif + QTextFrame::iterator iterator = doc.rootFrame()->begin(); QTextFrame *currentFrame = iterator.currentFrame(); int i = 0; int itemCount = 0; bool emptyItems = true; + QString firstItemFontFamily; while (!iterator.atEnd()) { // There are no child frames QCOMPARE(iterator.currentFrame(), currentFrame); @@ -236,6 +250,21 @@ void tst_QTextMarkdownImporter::lists() } qCDebug(lcTests, "%d %s%s", i, (block.textList() ? "<li>" : "<p>"), qPrintable(block.text())); + QTextCharFormat listItemFmt = block.charFormat(); + QFont listItemFont = listItemFmt.font(); + // QTextDocumentLayoutPrivate::drawListItem() uses listItemFont to render numbers in an ordered list. + // We want that to be consistent, regardless whether the list item's text begins with a styled span. + if (firstItemFontFamily.isEmpty()) + firstItemFontFamily = listItemFont.family(); + else + QCOMPARE(listItemFont.family(), firstItemFontFamily); + QCOMPARE(listItemFont.bold(), false); + QCOMPARE(listItemFont.italic(), false); + QCOMPARE(listItemFont.underline(), false); + QCOMPARE(listItemFont.fixedPitch(), false); + QCOMPARE(listItemFmt.fontItalic(), false); + QCOMPARE(listItemFmt.fontUnderline(), false); + QCOMPARE(listItemFmt.fontFixedPitch(), false); ++iterator; ++i; } diff --git a/tests/auto/network/access/http2/certs/fluke.cert b/tests/auto/network/access/http2/certs/fluke.cert index ace4e4f0eb..4cc4d9a5ea 100644 --- a/tests/auto/network/access/http2/certs/fluke.cert +++ b/tests/auto/network/access/http2/certs/fluke.cert @@ -1,75 +1,34 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 0 (0x0) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, ST=Oslo, L=Nydalen, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com - Validity - Not Before: Dec 4 01:10:32 2007 GMT - Not After : Apr 21 01:10:32 2035 GMT - Subject: C=NO, ST=Oslo, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:a7:c8:a0:4a:c4:19:05:1b:66:ba:32:e2:d2:f1: - 1c:6f:17:82:e4:39:2e:01:51:90:db:04:34:32:11: - 21:c2:0d:6f:59:d8:53:90:54:3f:83:8f:a9:d3:b3: - d5:ee:1a:9b:80:ae:c3:25:c9:5e:a5:af:4b:60:05: - aa:a0:d1:91:01:1f:ca:04:83:e3:58:1c:99:32:45: - 84:70:72:58:03:98:4a:63:8b:41:f5:08:49:d2:91: - 02:60:6b:e4:64:fe:dd:a0:aa:74:08:e9:34:4c:91: - 5f:12:3d:37:4d:54:2c:ad:7f:5b:98:60:36:02:8c: - 3b:f6:45:f3:27:6a:9b:94:9d - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 21:85:04:3D:23:01:66:E5:F7:9F:1A:84:24:8A:AF:0A:79:F4:E5:AC - X509v3 Authority Key Identifier: - DirName:/C=NO/ST=Oslo/L=Nydalen/O=Nokia Corporation and/or its subsidiary(-ies)/OU=Development/CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com - serial:8E:A8:B4:E8:91:B7:54:2E - - Signature Algorithm: sha1WithRSAEncryption - 6d:57:5f:d1:05:43:f0:62:05:ec:2a:71:a5:dc:19:08:f2:c4: - a6:bd:bb:25:d9:ca:89:01:0e:e4:cf:1f:c1:8c:c8:24:18:35: - 53:59:7b:c0:43:b4:32:e6:98:b2:a6:ef:15:05:0b:48:5f:e1: - a0:0c:97:a9:a1:77:d8:35:18:30:bc:a9:8f:d3:b7:54:c7:f1: - a9:9e:5d:e6:19:bf:f6:3c:5b:2b:d8:e4:3e:62:18:88:8b:d3: - 24:e1:40:9b:0c:e6:29:16:62:ab:ea:05:24:70:36:aa:55:93: - ef:02:81:1b:23:10:a2:04:eb:56:95:75:fc:f8:94:b1:5d:42: - c5:3f:36:44:85:5d:3a:2e:90:46:8a:a2:b9:6f:87:ae:0c:15: - 40:19:31:90:fc:3b:25:bb:ae:f1:66:13:0d:85:90:d9:49:34: - 8f:f2:5d:f9:7a:db:4d:5d:27:f6:76:9d:35:8c:06:a6:4c:a3: - b1:b2:b6:6f:1d:d7:a3:00:fd:72:eb:9e:ea:44:a1:af:21:34: - 7d:c7:42:e2:49:91:19:8b:c0:ad:ba:82:80:a8:71:70:f4:35: - 31:91:63:84:20:95:e9:60:af:64:8b:cc:ff:3d:8a:76:74:3d: - c8:55:6d:e4:8e:c3:2b:1c:e8:42:18:ae:9f:e6:6b:9c:34:06: - ec:6a:f2:c3 -----BEGIN CERTIFICATE----- -MIIEEzCCAvugAwIBAgIBADANBgkqhkiG9w0BAQUFADCBnDELMAkGA1UEBhMCTk8x -DTALBgNVBAgTBE9zbG8xEDAOBgNVBAcTB055ZGFsZW4xFjAUBgNVBAoTDVRyb2xs -dGVjaCBBU0ExFDASBgNVBAsTC0RldmVsb3BtZW50MRcwFQYDVQQDEw5mbHVrZS50 -cm9sbC5ubzElMCMGCSqGSIb3DQEJ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a2I+wb3IiE3uwpZbAdaLDyQ5n6F/qpsiIkZXn +gtcF7oqpG5oYrwCcZ53y/ezUgUg7PlSz2XwAGvQtgg== -----END CERTIFICATE----- diff --git a/tests/auto/network/access/http2/certs/fluke.key b/tests/auto/network/access/http2/certs/fluke.key index 9d1664d609..337ce541a6 100644 --- a/tests/auto/network/access/http2/certs/fluke.key +++ b/tests/auto/network/access/http2/certs/fluke.key @@ -1,15 +1,52 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCnyKBKxBkFG2a6MuLS8RxvF4LkOS4BUZDbBDQyESHCDW9Z2FOQ -VD+Dj6nTs9XuGpuArsMlyV6lr0tgBaqg0ZEBH8oEg+NYHJkyRYRwclgDmEpji0H1 -CEnSkQJga+Rk/t2gqnQI6TRMkV8SPTdNVCytf1uYYDYCjDv2RfMnapuUnQIDAQAB -AoGANFzLkanTeSGNFM0uttBipFT9F4a00dqHz6JnO7zXAT26I5r8sU1pqQBb6uLz -/+Qz5Zwk8RUAQcsMRgJetuPQUb0JZjF6Duv24hNazqXBCu7AZzUenjafwmKC/8ri -KpX3fTwqzfzi//FKGgbXQ80yykSSliDL3kn/drATxsLCgQECQQDXhEFWLJ0vVZ1s -1Ekf+3NITE+DR16X+LQ4W6vyEHAjTbaNWtcTKdAWLA2l6N4WAAPYSi6awm+zMxx4 -VomVTsjdAkEAx0z+e7natLeFcrrq8pbU+wa6SAP1VfhQWKitxL1e7u/QO90NCpxE -oQYKzMkmmpOOFjQwEMAy1dvFMbm4LHlewQJAC/ksDBaUcQHHqjktCtrUb8rVjAyW -A8lscckeB2fEYyG5J6dJVaY4ClNOOs5yMDS2Afk1F6H/xKvtQ/5CzInA/QJATDub -K+BPU8jO9q+gpuIi3VIZdupssVGmCgObVCHLakG4uO04y9IyPhV9lA9tALtoIf4c -VIvv5fWGXBrZ48kZAQJBAJmVCdzQxd9LZI5vxijUCj5EI4e+x5DRqVUvyP8KCZrC -AiNyoDP85T+hBZaSXK3aYGpVw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30Q45t/c54X3IuhYvAuiCuTmyfE4ruyzyOwKzhUkeeLq1APX +g0veFbyfzlJ0q8qzD/iffqqIa2ZSmQ== +-----END PRIVATE KEY----- diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 3d4a094c43..278139f2bd 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -9279,9 +9279,16 @@ void tst_QNetworkReply::autoDeleteRepliesAttribute_data() { QTest::addColumn<QUrl>("destination"); - QTest::newRow("http") << QUrl("http://QInvalidDomain.qt/test"); - QTest::newRow("https") << QUrl("https://QInvalidDomain.qt/test"); - QTest::newRow("ftp") << QUrl("ftp://QInvalidDomain.qt/test"); + QUrl webServerUrl = QtNetworkSettings::httpServerIp().toString(); + webServerUrl.setPath("/notfound"); + webServerUrl.setScheme("http"); + QTest::newRow("http") << webServerUrl; + webServerUrl.setScheme("https"); + QTest::newRow("https") << webServerUrl; + QUrl ftpServerUrl = QtNetworkSettings::ftpServerName(); + ftpServerUrl.setScheme("ftp"); + ftpServerUrl.setPath("/test/notfound"); + QTest::newRow("ftp") << ftpServerUrl; QTest::newRow("file") << QUrl("file:///thisfolderdoesn'texist/probably.txt"); #ifdef Q_OS_WIN // Only supported on windows. diff --git a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST index 930d4b1a3b..74a73fcb4b 100644 --- a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST +++ b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST @@ -2,6 +2,7 @@ * [passwordAuth] ubuntu-18.04 +ubuntu-20.04 # QTBUG-74162 [passwordAuth2] ubuntu diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index e397e80fe0..0a58a5cf3b 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -2093,31 +2093,50 @@ void tst_QTcpSocket::nestedEventLoopInErrorSlot() void tst_QTcpSocket::connectToHostError_data() { QTest::addColumn<QString>("host"); - QTest::addColumn<int>("port"); + QTest::addColumn<quint16>("port"); QTest::addColumn<QAbstractSocket::SocketError>("expectedError"); - QTest::newRow("localhost no service") << QStringLiteral("localhost") << 31415 << QAbstractSocket::ConnectionRefusedError; - QTest::newRow("unreachable") << QStringLiteral("0.0.0.1") << 65000 << QAbstractSocket::NetworkError; + QTest::newRow("localhost no service") << QStringLiteral("localhost") << quint16(31415) << QAbstractSocket::ConnectionRefusedError; + QTest::newRow("unreachable") << QStringLiteral("0.0.0.1") << quint16(65000) << QAbstractSocket::NetworkError; } void tst_QTcpSocket::connectToHostError() { + // We are aware of at least one OS in our CI, that would fail + // the test due to timeout - it's Ubuntu 20.04 and 'connect' + // to 0.0.0.1 there return EINPROGRESS, with no other error + // ever received, so only our own internal 30 s. timer can + // detect a connection timeout. + std::unique_ptr<QTcpSocket> socket(newSocket()); QAbstractSocket::SocketError error = QAbstractSocket::UnknownSocketError; - QFETCH(QString, host); - QFETCH(int, port); + QFETCH(const QString, host); + QFETCH(const quint16, port); QFETCH(QAbstractSocket::SocketError, expectedError); - connect(socket.get(), &QAbstractSocket::errorOccurred, [&](QAbstractSocket::SocketError socketError){ + QTestEventLoop eventLoop; + connect(socket.get(), &QAbstractSocket::errorOccurred, socket.get(), + [&](QAbstractSocket::SocketError socketError) { error = socketError; + QTimer::singleShot(0, &eventLoop, [&]{eventLoop.exitLoop();}); }); - socket->connectToHost(host, port); // no service running here, one suspects - QTRY_COMPARE_WITH_TIMEOUT(socket->state(), QTcpSocket::UnconnectedState, 7000); + + socket->connectToHost(host, port); + eventLoop.enterLoopMSecs(7000); + if (eventLoop.timeout() && port == 65000) { + // Let's at least verify it's not in connected state: + QVERIFY(socket->state() != QAbstractSocket::ConnectedState); + QSKIP("Connection to unreachable host timed out, skipping the rest of the test"); + } + + QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); + if (error != expectedError && error == QAbstractSocket::ConnectionRefusedError) QEXPECT_FAIL("unreachable", "CI firewall interfers with this test", Continue); + QCOMPARE(error, expectedError); } @@ -2201,7 +2220,7 @@ public slots: #if defined(Q_OS_MAC) pthread_yield_np(); #elif defined Q_OS_LINUX && !defined Q_OS_ANDROID - pthread_yield(); + sched_yield(); #endif if (!sock->waitForConnected()) { networkTimeout = true; diff --git a/tests/auto/network/ssl/qsslsocket/certs/fluke.cert b/tests/auto/network/ssl/qsslsocket/certs/fluke.cert index 069fa6b341..4cc4d9a5ea 100644 --- a/tests/auto/network/ssl/qsslsocket/certs/fluke.cert +++ b/tests/auto/network/ssl/qsslsocket/certs/fluke.cert @@ -1,75 +1,34 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: 0 (0x0) - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=NO, ST=Oslo, L=Nydalen, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com - Validity - Not Before: Dec 4 01:10:32 2007 GMT - Not After : Apr 21 01:10:32 2035 GMT - Subject: C=NO, ST=Oslo, O=Nokia Corporation and/or its subsidiary(-ies), OU=Development, CN=fluke.troll.no - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:a7:c8:a0:4a:c4:19:05:1b:66:ba:32:e2:d2:f1: - 1c:6f:17:82:e4:39:2e:01:51:90:db:04:34:32:11: - 21:c2:0d:6f:59:d8:53:90:54:3f:83:8f:a9:d3:b3: - d5:ee:1a:9b:80:ae:c3:25:c9:5e:a5:af:4b:60:05: - aa:a0:d1:91:01:1f:ca:04:83:e3:58:1c:99:32:45: - 84:70:72:58:03:98:4a:63:8b:41:f5:08:49:d2:91: - 02:60:6b:e4:64:fe:dd:a0:aa:74:08:e9:34:4c:91: - 5f:12:3d:37:4d:54:2c:ad:7f:5b:98:60:36:02:8c: - 3b:f6:45:f3:27:6a:9b:94:9d - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 21:85:04:3D:23:01:66:E5:F7:9F:1A:84:24:8A:AF:0A:79:F4:E5:AC - X509v3 Authority Key Identifier: - DirName:/C=NO/ST=Oslo/L=Nydalen/O=Nokia Corporation and/or its subsidiary(-ies)/OU=Development/CN=fluke.troll.no/emailAddress=ahanssen@trolltech.com - serial:8E:A8:B4:E8:91:B7:54:2E - - Signature Algorithm: sha1WithRSAEncryption - 6d:57:5f:d1:05:43:f0:62:05:ec:2a:71:a5:dc:19:08:f2:c4: - a6:bd:bb:25:d9:ca:89:01:0e:e4:cf:1f:c1:8c:c8:24:18:35: - 53:59:7b:c0:43:b4:32:e6:98:b2:a6:ef:15:05:0b:48:5f:e1: - a0:0c:97:a9:a1:77:d8:35:18:30:bc:a9:8f:d3:b7:54:c7:f1: - a9:9e:5d:e6:19:bf:f6:3c:5b:2b:d8:e4:3e:62:18:88:8b:d3: - 24:e1:40:9b:0c:e6:29:16:62:ab:ea:05:24:70:36:aa:55:93: - ef:02:81:1b:23:10:a2:04:eb:56:95:75:fc:f8:94:b1:5d:42: - c5:3f:36:44:85:5d:3a:2e:90:46:8a:a2:b9:6f:87:ae:0c:15: - 40:19:31:90:fc:3b:25:bb:ae:f1:66:13:0d:85:90:d9:49:34: - 8f:f2:5d:f9:7a:db:4d:5d:27:f6:76:9d:35:8c:06:a6:4c:a3: - b1:b2:b6:6f:1d:d7:a3:00:fd:72:eb:9e:ea:44:a1:af:21:34: - 7d:c7:42:e2:49:91:19:8b:c0:ad:ba:82:80:a8:71:70:f4:35: - 31:91:63:84:20:95:e9:60:af:64:8b:cc:ff:3d:8a:76:74:3d: - c8:55:6d:e4:8e:c3:2b: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bMukN2 +/Ef96Tsw8nWOEOPMySHOTIPgwyZRp26b0kA9EmhLwOP401SxXVQCmSRmtwNagmtg +jJKmZoYBN+//D45ibK8z6Q0oOm9P+Whf/uUXehcRxBxyV3xz7k0wKGQbHj/ddwcy +IUoIN4lrAlib+lK170kTKN352PDmrpo2gmIzPEsfurKAIMSelDl6H+kih16BtZ8y +Nz6fh9Soqrg3OSAware8pxV7k51crBMoPLN78KoRV8MFCK4K7Fddq4rRISq6hiXq +r1nsjoEPuKM9huprmZVZe9t5YcDa2I+wb3IiE3uwpZbAdaLDyQ5n6F/qpsiIkZXn +gtcF7oqpG5oYrwCcZ53y/ezUgUg7PlSz2XwAGvQtgg== -----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslsocket/certs/fluke.key b/tests/auto/network/ssl/qsslsocket/certs/fluke.key index 9d1664d609..337ce541a6 100644 --- a/tests/auto/network/ssl/qsslsocket/certs/fluke.key +++ b/tests/auto/network/ssl/qsslsocket/certs/fluke.key @@ -1,15 +1,52 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCnyKBKxBkFG2a6MuLS8RxvF4LkOS4BUZDbBDQyESHCDW9Z2FOQ -VD+Dj6nTs9XuGpuArsMlyV6lr0tgBaqg0ZEBH8oEg+NYHJkyRYRwclgDmEpji0H1 -CEnSkQJga+Rk/t2gqnQI6TRMkV8SPTdNVCytf1uYYDYCjDv2RfMnapuUnQIDAQAB -AoGANFzLkanTeSGNFM0uttBipFT9F4a00dqHz6JnO7zXAT26I5r8sU1pqQBb6uLz -/+Qz5Zwk8RUAQcsMRgJetuPQUb0JZjF6Duv24hNazqXBCu7AZzUenjafwmKC/8ri -KpX3fTwqzfzi//FKGgbXQ80yykSSliDL3kn/drATxsLCgQECQQDXhEFWLJ0vVZ1s -1Ekf+3NITE+DR16X+LQ4W6vyEHAjTbaNWtcTKdAWLA2l6N4WAAPYSi6awm+zMxx4 -VomVTsjdAkEAx0z+e7natLeFcrrq8pbU+wa6SA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unFC4LM+NEY2p2zuUQoCw7NjnY3QYrfCnx +rRMCggEAXeXsMSLFjjyuoL7iKbAxo52HD/P0fBoy58LyRcwfNVr0lvYan4pYEx+o +KijIh9K16PqXZXKMA9v003B+ulmF8bJ7SddCZ5NGvnFhUTDe4DdTKgp2RuwQ3Bsc +3skPIDbhVETyOLCtys34USHrq8U/0DlGY3eLRfxw9GnbKxSBGa/KEu/qQLPNUo50 +7xHZDg7GKeC3kqNJeqKM9rkp0VzIGkEnaD9127LeNDmERDfftxJzFoC/THvUBLfU +6Sus2ZYwRE8VFvKC30Q45t/c54X3IuhYvAuiCuTmyfE4ruyzyOwKzhUkeeLq1APX +g0veFbyfzlJ0q8qzD/iffqqIa2ZSmQ== +-----END PRIVATE KEY----- diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 2a2ccfbf8d..97ffafc9a5 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -38,6 +38,7 @@ # include <winuser.h> #endif #include <QtTest/QtTest> +#include <QSignalSpy> #include <QtGui> #include <QtWidgets> #include <math.h> @@ -4079,6 +4080,124 @@ void tst_QAccessibility::focusChild() delete tabBar; QTestAccessibility::clearEvents(); } + + { + QMainWindow mainWindow; + QTableWidget *tableView = new QTableWidget(3, 3); + + QSignalSpy spy(tableView, SIGNAL(currentCellChanged(int,int,int,int))); + + tableView->setColumnCount(3); + QStringList hHeader; + hHeader << "h1" << "h2" << "h3"; + tableView->setHorizontalHeaderLabels(hHeader); + + QStringList vHeader; + vHeader << "v1" << "v2" << "v3"; + tableView->setVerticalHeaderLabels(vHeader); + + for (int i = 0; i < 9; ++i) { + QTableWidgetItem *item = new QTableWidgetItem; + item->setText(QString::number(i/3) + QString(".") + QString::number(i%3)); + tableView->setItem(i/3, i%3, item); + } + + mainWindow.setCentralWidget(tableView); + mainWindow.resize(600, 600); + mainWindow.show(); + + QVERIFY(QTest::qWaitForWindowExposed(tableView)); + + tableView->setFocus(); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView); + QVERIFY(iface); + + spy.clear(); + tableView->setCurrentCell(2, 1); + QTRY_COMPARE(spy.count(), 1); + + QAccessibleInterface *child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("2.1")); + + spy.clear(); + tableView->setCurrentCell(1, 2); + QTRY_COMPARE(spy.count(), 1); + + child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("1.2")); + + delete tableView; + QTestAccessibility::clearEvents(); + } + + { + QMainWindow mainWindow; + QTreeWidget *treeView = new QTreeWidget(); + + QSignalSpy spy(treeView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*))); + + treeView->setColumnCount(2); + QTreeWidgetItem *header = new QTreeWidgetItem; + header->setText(0, "Artist"); + header->setText(1, "Work"); + treeView->setHeaderItem(header); + + QTreeWidgetItem *root1 = new QTreeWidgetItem; + root1->setText(0, "Spain"); + treeView->addTopLevelItem(root1); + + QTreeWidgetItem *item1 = new QTreeWidgetItem; + item1->setText(0, "Picasso"); + item1->setText(1, "Guernica"); + root1->addChild(item1); + + QTreeWidgetItem *item2 = new QTreeWidgetItem; + item2->setText(0, "Tapies"); + item2->setText(1, "Ambrosia"); + root1->addChild(item2); + + QTreeWidgetItem *root2 = new QTreeWidgetItem; + root2->setText(0, "Austria"); + treeView->addTopLevelItem(root2); + + QTreeWidgetItem *item3 = new QTreeWidgetItem; + item3->setText(0, "Klimt"); + item3->setText(1, "The Kiss"); + root2->addChild(item3); + + mainWindow.setCentralWidget(treeView); + mainWindow.resize(600, 600); + mainWindow.show(); + + QVERIFY(QTest::qWaitForWindowExposed(treeView)); + + treeView->setFocus(); + + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView); + QVERIFY(iface); + + spy.clear(); + treeView->setCurrentItem(item2); + QTRY_COMPARE(spy.count(), 1); + + QAccessibleInterface *child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Tapies")); + + spy.clear(); + treeView->setCurrentItem(item3); + QTRY_COMPARE(spy.count(), 1); + + child = iface->focusChild(); + QVERIFY(child); + QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Klimt")); + + delete treeView; + QTestAccessibility::clearEvents(); + } } diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json index 12a4a22a19..18282505e4 100644 --- a/tests/auto/tools/moc/allmocs_baseline_in.json +++ b/tests/auto/tools/moc/allmocs_baseline_in.json @@ -689,16 +689,6 @@ "access": "public", "name": "c", "returnType": "void" - }, - { - "access": "public", - "name": "d", - "returnType": "void" - }, - { - "access": "public", - "name": "e", - "returnType": "void" } ], "superClasses": [ diff --git a/tests/auto/tools/moc/task189996.h b/tests/auto/tools/moc/task189996.h index f94a051b3a..ba9450c271 100644 --- a/tests/auto/tools/moc/task189996.h +++ b/tests/auto/tools/moc/task189996.h @@ -37,11 +37,9 @@ class InlineSlotsWithThrowDeclaration : public QObject Q_OBJECT public slots: - void a() throw() { } - void b() const throw() { } - void c() throw(); - void d() throw(int) { } - void e() const throw(int,double) { } + void a() noexcept { } + void b() const noexcept { } + void c() noexcept; }; #endif diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index c716aead21..cc465a213a 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -41,7 +41,6 @@ #include "single_function_keyword.h" #include "backslash-newlines.h" #include "slots-with-void-template.h" -#include "pure-virtual-signals.h" #include "qinvokable.h" // msvc and friends crap out on it #if !defined(Q_CC_GNU) || defined(Q_OS_WIN) @@ -631,7 +630,6 @@ public: private slots: void initTestCase(); - void slotWithException() throw(MyStruct); void dontStripNamespaces(); void oldStyleCasts(); void warnOnExtraSignalSlotQualifiaction(); @@ -784,12 +782,6 @@ void tst_Moc::initTestCase() #endif } -void tst_Moc::slotWithException() throw(MyStruct) -{ - // be happy - QVERIFY(true); -} - void tst_Moc::dontStripNamespaces() { Sender sender; @@ -1595,7 +1587,7 @@ void tst_Moc::qprivateproperties() #include "task189996.h" -void InlineSlotsWithThrowDeclaration::c() throw() {} +void InlineSlotsWithThrowDeclaration::c() noexcept {} void tst_Moc::inlineSlotsWithThrowDeclaration() { @@ -1604,8 +1596,6 @@ void tst_Moc::inlineSlotsWithThrowDeclaration() QVERIFY(mobj->indexOfSlot("a()") != -1); QVERIFY(mobj->indexOfSlot("b()") != -1); QVERIFY(mobj->indexOfSlot("c()") != -1); - QVERIFY(mobj->indexOfSlot("d()") != -1); - QVERIFY(mobj->indexOfSlot("e()") != -1); } void tst_Moc::warnOnPropertyWithoutREAD() diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index afb24bc528..455159299d 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -137,6 +137,7 @@ private slots: void clearLineEdit(); void enableChooseButton(); void selectedFilesWithoutWidgets(); + void selectedFileWithDefaultSuffix(); void trailingDotsAndSpaces(); #ifdef Q_OS_UNIX #ifdef QT_BUILD_INTERNAL @@ -1475,6 +1476,21 @@ void tst_QFiledialog::selectedFilesWithoutWidgets() QVERIFY(fd.selectedFiles().size() >= 0); } +void tst_QFiledialog::selectedFileWithDefaultSuffix() +{ + // QTBUG-59401: dot in file path should not prevent default suffix from being added + QTemporaryDir tempDir(QDir::tempPath() + "/abcXXXXXX.def"); + QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); + + QFileDialog fd; + fd.setDirectory(tempDir.path()); + fd.setDefaultSuffix(".txt"); + fd.selectFile("xxx"); + const auto selectedFiles = fd.selectedFiles(); + QCOMPARE(selectedFiles.size(), 1); + QVERIFY(selectedFiles.first().endsWith(".txt")); +} + void tst_QFiledialog::trailingDotsAndSpaces() { #ifndef Q_OS_WIN diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST new file mode 100644 index 0000000000..754014501b --- /dev/null +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST @@ -0,0 +1,4 @@ +[scrollUpdate] +android +[forwardTouchEvent] +android diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 875b2c08e5..b038245610 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -166,6 +166,7 @@ private slots: void taskQTBUG_7232_AllowUserToControlSingleStep(); void taskQTBUG_51086_skippingIndexesInSelectedIndexes(); void taskQTBUG_47694_indexOutOfBoundBatchLayout(); + void moveLastRow(); void itemAlignment(); void internalDragDropMove_data(); void internalDragDropMove(); @@ -2514,6 +2515,222 @@ void tst_QListView::taskQTBUG_47694_indexOutOfBoundBatchLayout() view.scrollTo(model.index(batchSize - 1, 0)); } +class TstMoveItem +{ + friend class TstMoveModel; +public: + TstMoveItem(TstMoveItem *parent = nullptr) + : parentItem(parent) + { + if (parentItem) + parentItem->childItems.append(this); + } + + ~TstMoveItem() + { + QList<TstMoveItem *> delItms; + delItms.swap(childItems); + qDeleteAll(delItms); + + if (parentItem) + parentItem->childItems.removeAll(this); + } + + int row() + { + if (parentItem) + return parentItem->childItems.indexOf(this); + return -1; + } + +public: + TstMoveItem *parentItem = nullptr; + QList<TstMoveItem *> childItems; + QHash<int, QVariant> data; +}; + +/*! + Test that removing the last row in an IconView mode QListView + doesn't crash. The model is specifically crafted to provoke a + stale QBspTree by returning a 0 column count for indexes without + children, which changes the column count after moving the last row. + + See QTBUG_95463. +*/ +class TstMoveModel : public QAbstractItemModel +{ + Q_OBJECT +public: + TstMoveModel(QObject *parent = nullptr) + : QAbstractItemModel(parent) + { + rootItem = new TstMoveItem; + rootItem->data.insert(Qt::DisplayRole, "root"); + + TstMoveItem *itm = new TstMoveItem(rootItem); + itm->data.insert(Qt::DisplayRole, "parentItem1"); + + TstMoveItem *itmCh = new TstMoveItem(itm); + itmCh->data.insert(Qt::DisplayRole, "childItem"); + + itm = new TstMoveItem(rootItem); + itm->data.insert(Qt::DisplayRole, "parentItem2"); + } + + ~TstMoveModel() + { + delete rootItem; + } + + QModelIndex index(int row, int column, const QModelIndex &idxPar = QModelIndex()) const override + { + QModelIndex idx; + if (hasIndex(row, column, idxPar)) { + TstMoveItem *parentItem = nullptr; + if (idxPar.isValid()) + parentItem = static_cast<TstMoveItem *>(idxPar.internalPointer()); + else + parentItem = rootItem; + + Q_ASSERT(parentItem); + TstMoveItem *childItem = parentItem->childItems.at(row); + if (childItem) + idx = createIndex(row, column, childItem); + } + return idx; + } + + QModelIndex parent(const QModelIndex &index) const override + { + QModelIndex idxPar; + if (index.isValid()) { + TstMoveItem *childItem = static_cast<TstMoveItem *>(index.internalPointer()); + TstMoveItem *parentItem = childItem->parentItem; + if (parentItem != rootItem) + idxPar = createIndex(parentItem->row(), 0, parentItem); + } + return idxPar; + } + + int columnCount(const QModelIndex &idxPar = QModelIndex()) const override + { + int cnt = 0; + if (idxPar.isValid()) { + TstMoveItem *parentItem = static_cast<TstMoveItem *>(idxPar.internalPointer()); + Q_ASSERT(parentItem); + cnt = parentItem->childItems.isEmpty() ? 0 : 1; + } else { + cnt = rootItem->childItems.isEmpty() ? 0 : 1; + } + return cnt; + } + + int rowCount(const QModelIndex &idxPar = QModelIndex()) const override + { + int cnt = 0; + if (idxPar.isValid()) { + TstMoveItem *parentItem = static_cast<TstMoveItem *>(idxPar.internalPointer()); + Q_ASSERT(parentItem); + cnt = parentItem->childItems.count(); + } else { + cnt = rootItem->childItems.count(); + } + return cnt; + } + + Qt::ItemFlags flags(const QModelIndex &index) const override + { + Q_UNUSED(index) + return Qt::ItemIsEnabled | Qt::ItemIsSelectable; + } + + bool hasChildren(const QModelIndex &parent = QModelIndex()) const override + { + bool ret = false; + if (parent.isValid()) { + TstMoveItem *parentItem = static_cast<TstMoveItem *>(parent.internalPointer()); + Q_ASSERT(parentItem); + ret = parentItem->childItems.count() > 0; + } else { + ret = rootItem->childItems.count() > 0; + } + return ret; + } + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override + { + QVariant dt; + if (index.isValid()) { + TstMoveItem *item = static_cast<TstMoveItem *>(index.internalPointer()); + if (item) + dt = item->data.value(role); + } + return dt; + } + + bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override + { + TstMoveItem *itmSrcParent = itemAt(sourceParent); + TstMoveItem *itmDestParent = itemAt(destinationParent); + + if (itmSrcParent && sourceRow >= 0 + && sourceRow + count <= itmSrcParent->childItems.count() + && itmDestParent && destinationChild <= itmDestParent->childItems.count()) { + beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, + destinationParent, destinationChild); + QList<TstMoveItem *> itemsToMove; + for (int i = 0; i < count; ++i) { + TstMoveItem *itm = itmSrcParent->childItems.at(sourceRow+i); + itemsToMove.append(itm); + } + for (int i = itemsToMove.count() -1; i >= 0; --i) { + TstMoveItem *itm = itemsToMove.at(i); + itm->parentItem->childItems.removeAll(itm); + itm->parentItem = itmDestParent; + itmDestParent->childItems.insert(destinationChild, itm); + } + endMoveRows(); + return true; + } + return false; + } + +private: + TstMoveItem *itemAt(const QModelIndex &index) const + { + TstMoveItem *item = nullptr; + if (index.isValid()) { + Q_ASSERT(index.model() == this); + item = static_cast<TstMoveItem *>(index.internalPointer()); + } else { + item = rootItem; + } + return item; + } + +private: + TstMoveItem *rootItem = nullptr; +}; + +void tst_QListView::moveLastRow() +{ + TstMoveModel model; + QListView view; + view.setModel(&model); + view.setRootIndex(model.index(0, 0, QModelIndex())); + view.setViewMode(QListView::IconMode); + view.show(); + + QApplication::setActiveWindow(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QModelIndex sourceParent = model.index(0, 0); + QModelIndex destinationParent = model.index(1, 0); + // must not crash when paint event is processed + model.moveRow(sourceParent, 0, destinationParent, 0); + QTest::qWait(100); +} + void tst_QListView::itemAlignment() { auto item1 = new QStandardItem("111"); diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index c9a9378905..45b3b879b7 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -94,6 +94,7 @@ private slots: void layoutSpacing(); #endif void qproperty(); + void qproperty_styleSheet(); void palettePropagation_data(); void palettePropagation(); void fontPropagation_data(); @@ -680,6 +681,23 @@ void tst_QStyleSheetStyle::qproperty() QCOMPARE(pb.isChecked(), false); } +void tst_QStyleSheetStyle::qproperty_styleSheet() +{ + QWidget w; + auto checkBox = new QCheckBox("check", &w); + QString sheet = R"(QCheckBox { qproperty-styleSheet: "QCheckBox { qproperty-text: foobar; }"; })"; + + QVERIFY(w.property("styleSheet").toString().isEmpty()); + + w.setStyleSheet(sheet); + QCOMPARE(checkBox->text(), "check"); + + //recursion crash + w.ensurePolished(); + QCOMPARE(w.property("styleSheet").toString(), sheet); + QCOMPARE(checkBox->text(), "foobar"); +} + namespace ns { class PushButton1 : public QPushButton { Q_OBJECT diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 56b34fff2a..b9bbda766b 100644 --- a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -57,6 +57,7 @@ private slots: void scale(); void shear(); void translate(); + void createTextItem(); }; tst_QGraphicsItem::tst_QGraphicsItem() @@ -230,5 +231,15 @@ void tst_QGraphicsItem::translate() } } +void tst_QGraphicsItem::createTextItem() +{ + // Ensure QFontDatabase loaded the font beforehand + QFontInfo(qApp->font()).family(); + const QString text = "This is some text"; + QBENCHMARK { + QGraphicsTextItem item(text); + } +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |