diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
commit | 9bd032355163d92cda5e7e59ecd21214b131f187 (patch) | |
tree | 002fa12558505683143c7eb08949a3d225bf0712 /tests/auto | |
parent | d037d25c3d5236623371cf051aaf6a9e59792ba7 (diff) | |
parent | 41673c45dde2eb95ee21dd918235218399f2be2c (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
configure
src/corelib/io/qurl.cpp
src/gui/kernel/qwindow.cpp
src/tools/moc/generator.cpp
src/widgets/kernel/qwidget_qpa.cpp
src/widgets/styles/qstyle.h
src/widgets/widgets/qtabbar.cpp
tests/auto/corelib/codecs/utf8/tst_utf8.cpp
Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
Diffstat (limited to 'tests/auto')
34 files changed, 559 insertions, 92 deletions
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp index 07ea4c4545..e513b2cea2 100644 --- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp +++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp @@ -233,6 +233,38 @@ void tst_Utf8::nonCharacters_data() QTest::addColumn<QByteArray>("utf8"); QTest::addColumn<QString>("utf16"); + // Unicode has a couple of "non-characters" that one can use internally, + // but are not allowed to be used for text interchange. + // + // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF, + // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and + // U+FDEF (inclusive) + + // U+FDD0 through U+FDEF + for (int i = 0; i < 32; ++i) { + char utf8[] = { char(0357), char(0267), char(0220 + i), 0 }; + QString utf16 = QChar(0xfdd0 + i); + QTest::newRow(qPrintable(QString::number(0xfdd0 + i, 16))) << QByteArray(utf8) << utf16; + } + + // the last two in Planes 1 through 16 + for (uint plane = 1; plane <= 16; ++plane) { + for (uint lower = 0xfffe; lower < 0x10000; ++lower) { + uint ucs4 = (plane << 16) | lower; + char utf8[] = { char(0xf0 | uchar(ucs4 >> 18)), + char(0x80 | (uchar(ucs4 >> 12) & 0x3f)), + char(0x80 | (uchar(ucs4 >> 6) & 0x3f)), + char(0x80 | (uchar(ucs4) & 0x3f)), + 0 }; + ushort utf16[] = { QChar::highSurrogate(ucs4), QChar::lowSurrogate(ucs4), 0 }; + + QTest::newRow(qPrintable(QString::number(ucs4, 16))) << QByteArray(utf8) << QString::fromUtf16(utf16); + } + } + + QTest::newRow("fffe") << QByteArray("\xEF\xBF\xBE") << QString(QChar(0xfffe)); + QTest::newRow("ffff") << QByteArray("\xEF\xBF\xBF") << QString(QChar(0xffff)); + extern void loadNonCharactersRows(); loadNonCharactersRows(); } diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index dab5e4a3a5..676762da81 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -10,5 +10,3 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \ ../resources/file1.ext1 win32: LIBS+=-lole32 -luuid - -mac*:CONFIG+=insignificant_test diff --git a/tests/auto/corelib/io/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro index a8295ec79b..c98e3fb8c3 100644 --- a/tests/auto/corelib/io/qiodevice/qiodevice.pro +++ b/tests/auto/corelib/io/qiodevice/qiodevice.pro @@ -5,5 +5,3 @@ SOURCES = tst_qiodevice.cpp TESTDATA += tst_qiodevice.cpp MOC_DIR=tmp - -mac: CONFIG += insignificant_test # QTBUG-22766 diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 9b1d5c0b68..29f6fe9da4 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -49,7 +49,7 @@ #include <sys/types.h> #endif -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) #define Q_XDG_PLATFORM #endif @@ -239,12 +239,16 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. + // Blackberry OS is an exception to this case, owing to the fact that + // applications are sandboxed. +#ifndef Q_OS_BLACKBERRY const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/tst_qstandardpaths"); QCoreApplication::instance()->setApplicationName("QtTest"); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/QtTest"); +#endif #ifdef Q_XDG_PLATFORM setDefaultLocations(); diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro index 577f52972d..93fb6d232f 100644 --- a/tests/auto/corelib/io/qtextstream/test/test.pro +++ b/tests/auto/corelib/io/qtextstream/test/test.pro @@ -19,5 +19,3 @@ TESTDATA += \ ../qtextstream.qrc \ ../tst_qtextstream.cpp \ ../resources - -mac: CONFIG += insignificant_test # QTBUG-22767 diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 4ab4b78da1..bf6a58a24b 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -123,6 +123,8 @@ private Q_SLOTS: void testTrailingComma(); void testDetachBug(); + + void valueEquals(); private: QString testDataDir; }; @@ -1845,5 +1847,51 @@ void TestQtJson::testDetachBug() QCOMPARE(local.keys().size(), 1); } +void TestQtJson::valueEquals() +{ + QVERIFY(QJsonValue() == QJsonValue()); + QVERIFY(QJsonValue() != QJsonValue(QJsonValue::Undefined)); + QVERIFY(QJsonValue() != QJsonValue(true)); + QVERIFY(QJsonValue() != QJsonValue(1.)); + QVERIFY(QJsonValue() != QJsonValue(QJsonArray())); + QVERIFY(QJsonValue() != QJsonValue(QJsonObject())); + + QVERIFY(QJsonValue(true) == QJsonValue(true)); + QVERIFY(QJsonValue(true) != QJsonValue(false)); + QVERIFY(QJsonValue(true) != QJsonValue(QJsonValue::Undefined)); + QVERIFY(QJsonValue(true) != QJsonValue()); + QVERIFY(QJsonValue(true) != QJsonValue(1.)); + QVERIFY(QJsonValue(true) != QJsonValue(QJsonArray())); + QVERIFY(QJsonValue(true) != QJsonValue(QJsonObject())); + + QVERIFY(QJsonValue(1.) == QJsonValue(1.)); + QVERIFY(QJsonValue(1.) != QJsonValue(2.)); + QVERIFY(QJsonValue(1.) != QJsonValue(QJsonValue::Undefined)); + QVERIFY(QJsonValue(1.) != QJsonValue()); + QVERIFY(QJsonValue(1.) != QJsonValue(true)); + QVERIFY(QJsonValue(1.) != QJsonValue(QJsonArray())); + QVERIFY(QJsonValue(1.) != QJsonValue(QJsonObject())); + + QVERIFY(QJsonValue(QJsonArray()) == QJsonValue(QJsonArray())); + QJsonArray nonEmptyArray; + nonEmptyArray.append(true); + QVERIFY(QJsonValue(QJsonArray()) != nonEmptyArray); + QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(QJsonValue::Undefined)); + QVERIFY(QJsonValue(QJsonArray()) != QJsonValue()); + QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(true)); + QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(1.)); + QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(QJsonObject())); + + QVERIFY(QJsonValue(QJsonObject()) == QJsonValue(QJsonObject())); + QJsonObject nonEmptyObject; + nonEmptyObject.insert("Key", true); + QVERIFY(QJsonValue(QJsonObject()) != nonEmptyObject); + QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(QJsonValue::Undefined)); + QVERIFY(QJsonValue(QJsonObject()) != QJsonValue()); + QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(true)); + QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(1.)); + QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(QJsonArray())); +} + QTEST_MAIN(TestQtJson) #include "tst_qtjson.moc" diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 90d20843e3..f429af7ce2 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -4850,6 +4850,8 @@ signals: int returnInt(int); void returnVoid(int); CustomType returnCustomType(int); + + QObject *returnPointer(); public slots: QVariant returnVariantSlot(int i) { return i; } QString returnStringSlot(int i) { return QString::number(i); } @@ -4858,6 +4860,8 @@ public slots: void returnVoidSlot() {} int return23() { return 23; } QString returnHello() { return QStringLiteral("hello"); } + QObject *returnThisSlot1() { return this; } + ReturnValue *returnThisSlot2() { return this; } public: struct VariantFunctor { QVariant operator()(int i) { return i; } @@ -4910,6 +4914,7 @@ void tst_QObject::returnValue() QCOMPARE(emit r.returnInt(45), int()); emit r.returnVoid(45); QCOMPARE((emit r.returnCustomType(45)).value(), CustomType().value()); + QCOMPARE((emit r.returnPointer()), static_cast<QObject *>(0)); } { // connected to a slot returning the same type CheckInstanceCount checker; @@ -4922,6 +4927,8 @@ void tst_QObject::returnValue() QCOMPARE(emit r.returnInt(45), int(45)); QVERIFY(connect(&r, &ReturnValue::returnCustomType, &receiver, &ReturnValue::returnCustomTypeSlot, type)); QCOMPARE((emit r.returnCustomType(45)).value(), CustomType(45).value()); + QVERIFY(connect(&r, &ReturnValue::returnPointer, &receiver, &ReturnValue::returnThisSlot1, type)); + QCOMPARE((emit r.returnPointer()), static_cast<QObject *>(&receiver)); } if (!isBlockingQueued) { // connected to simple functions or functor CheckInstanceCount checker; @@ -4950,6 +4957,8 @@ void tst_QObject::returnValue() QCOMPARE((emit r.returnCustomType(48)).value(), CustomType(48).value()); QVERIFY(connect(&r, &ReturnValue::returnVoid, &receiver, &ReturnValue::returnCustomTypeSlot, type)); emit r.returnVoid(48); + QVERIFY(connect(&r, &ReturnValue::returnPointer, &receiver, &ReturnValue::returnThisSlot2, type)); + QCOMPARE((emit r.returnPointer()), static_cast<QObject *>(&receiver)); } if (!isBlockingQueued) { // connected to functor with different type CheckInstanceCount checker; @@ -4974,6 +4983,8 @@ void tst_QObject::returnValue() QCOMPARE(emit r.returnInt(45), int()); QVERIFY(connect(&r, &ReturnValue::returnCustomType, &receiver, &ReturnValue::returnVoidSlot, type)); QCOMPARE((emit r.returnCustomType(45)).value(), CustomType().value()); + QVERIFY(connect(&r, &ReturnValue::returnPointer, &receiver, &ReturnValue::returnVoidSlot, type)); + QCOMPARE((emit r.returnPointer()), static_cast<QObject *>(0)); } if (!isBlockingQueued) { // queued connection should not forward the return value @@ -4987,6 +4998,9 @@ void tst_QObject::returnValue() QCOMPARE(emit r.returnInt(45), int()); QVERIFY(connect(&r, &ReturnValue::returnCustomType, &receiver, &ReturnValue::returnCustomTypeSlot, Qt::QueuedConnection)); QCOMPARE((emit r.returnCustomType(45)).value(), CustomType().value()); + QVERIFY(connect(&r, &ReturnValue::returnPointer, &receiver, &ReturnValue::returnThisSlot1, Qt::QueuedConnection)); + QCOMPARE((emit r.returnPointer()), static_cast<QObject *>(0)); + QCoreApplication::processEvents(); QVERIFY(connect(&r, &ReturnValue::returnVariant, &receiver, &ReturnValue::returnStringSlot, Qt::QueuedConnection)); diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index e72af11fbb..14c43d0088 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -77,6 +77,7 @@ private slots: void joining(); void combiningClass(); void digitValue(); + void mirroredChar(); void decomposition(); void lineBreakClass(); void normalization_data(); @@ -523,6 +524,29 @@ void tst_QChar::digitValue() QVERIFY(QChar::digitValue((ushort)0x1040) == 0); QVERIFY(QChar::digitValue((uint)0x1049) == 9); QVERIFY(QChar::digitValue((uint)0x1040) == 0); + + QVERIFY(QChar::digitValue((ushort)0xd800) == -1); + QVERIFY(QChar::digitValue((uint)UNICODE_LAST_CODEPOINT + 1) == -1); +} + +void tst_QChar::mirroredChar() +{ + QVERIFY(QChar(0x169B).hasMirrored()); + QVERIFY(QChar(0x169B).mirroredChar() == QChar(0x169C)); + QVERIFY(QChar(0x169C).hasMirrored()); + QVERIFY(QChar(0x169C).mirroredChar() == QChar(0x169B)); + + QVERIFY(QChar(0x301A).hasMirrored()); + QVERIFY(QChar(0x301A).mirroredChar() == QChar(0x301B)); + QVERIFY(QChar(0x301B).hasMirrored()); + QVERIFY(QChar(0x301B).mirroredChar() == QChar(0x301A)); + + if (QChar::currentUnicodeVersion() <= QChar::Unicode_5_0) { + QVERIFY(!QChar(0x201C).hasMirrored()); + QVERIFY(QChar(0x201C).mirroredChar() != QChar(0x201D)); + QVERIFY(!QChar(0x201D).hasMirrored()); + QVERIFY(QChar(0x201D).mirroredChar() != QChar(0x201C)); + } } void tst_QChar::decomposition() @@ -540,10 +564,10 @@ void tst_QChar::decomposition() { QString str; - str += QChar( (0x1D157 - 0x10000) / 0x400 + 0xd800 ); - str += QChar( ((0x1D157 - 0x10000) % 0x400) + 0xdc00 ); - str += QChar( (0x1D165 - 0x10000) / 0x400 + 0xd800 ); - str += QChar( ((0x1D165 - 0x10000) % 0x400) + 0xdc00 ); + str += QChar(QChar::highSurrogate(0x1D157)); + str += QChar(QChar::lowSurrogate(0x1D157)); + str += QChar(QChar::highSurrogate(0x1D165)); + str += QChar(QChar::lowSurrogate(0x1D165)); QVERIFY(QChar::decomposition(0x1D15e) == str); } @@ -626,14 +650,12 @@ void tst_QChar::normalization_data() for (int j = 0; j < c.size(); ++j) { bool ok; uint uc = c.at(j).toInt(&ok, 16); - if (uc < 0x10000) + if (!QChar::requiresSurrogates(uc)) { columns[i].append(QChar(uc)); - else { + } else { // convert to utf16 - ushort high = QChar::highSurrogate(uc); - ushort low = QChar::lowSurrogate(uc); - columns[i].append(QChar(high)); - columns[i].append(QChar(low)); + columns[i].append(QChar(QChar::highSurrogate(uc))); + columns[i].append(QChar(QChar::lowSurrogate(uc))); } } } diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro index 24dcc0638a..28e127e307 100644 --- a/tests/auto/corelib/tools/qlocale/test/test.pro +++ b/tests/auto/corelib/tools/qlocale/test/test.pro @@ -17,3 +17,4 @@ load(testcase) # for target.path and installTestHelperApp() installTestHelperApp("../syslocaleapp/syslocaleapp",syslocaleapp,syslocaleapp) mac: CONFIG += insignificant_test # QTBUG-22769 +win32:CONFIG+= insignificant_test # QTBUG-25284 diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index a4c04d6207..f1de1722e2 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -637,6 +637,52 @@ void tst_QRegularExpression::normalMatch_data() << 0 << QRegularExpression::MatchOptions(QRegularExpression::AnchoredMatchOption) << m; + + // *** + + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured << "678"; + QTest::newRow("negativeoffset01") << QRegularExpression("\\d+") + << "abc123def678ghi" + << -6 + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << m; + + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured << "678"; + QTest::newRow("negativeoffset02") << QRegularExpression("\\d+") + << "abc123def678ghi" + << -8 + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << m; + + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured << "678ghi" << "678" << "ghi"; + QTest::newRow("negativeoffset03") << QRegularExpression("(\\d+)(\\w+)") + << "abc123def678ghi" + << -8 + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << m; + + m.clear(); + m.isValid = true; + QTest::newRow("negativeoffset04") << QRegularExpression("\\d+") + << "abc123def678ghi" + << -3 + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << m; + + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured << "678"; + QTest::newRow("negativeoffset05") << QRegularExpression("^\\d+", QRegularExpression::MultilineOption) + << "a\nbc123\ndef\n678gh\ni" + << -10 + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << m; } @@ -959,6 +1005,31 @@ void tst_QRegularExpression::globalMatch_data() matchList.clear(); m.clear(); m.isValid = true; m.hasMatch = true; + m.captured = QStringList() << "ACA""GTG""CGA""AAA"; + matchList << m; + m.captured = QStringList() << "AAA"; + matchList << m; + m.captured = QStringList() << "AAG""GAA""AAG""AAA"; + matchList << m; + m.captured = QStringList() << "AAA"; + matchList << m; + QTest::newRow("globalmatch03") << QRegularExpression("\\G(?:\\w\\w\\w)*?AAA") + << "ACA""GTG""CGA""AAA""AAA""AAG""GAA""AAG""AAA""AAA" + << 0 + << QRegularExpression::NormalMatch + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << matchList; + + QTest::newRow("globalmatch04") << QRegularExpression("(?:\\w\\w\\w)*?AAA") + << "ACA""GTG""CGA""AAA""AAA""AAG""GAA""AAG""AAA""AAA" + << 0 + << QRegularExpression::NormalMatch + << QRegularExpression::MatchOptions(QRegularExpression::AnchoredMatchOption) + << matchList; + + matchList.clear(); + m.clear(); + m.isValid = true; m.hasMatch = true; m.captured = QStringList() << ""; matchList << m; m.captured = QStringList() << "c"; @@ -1103,6 +1174,46 @@ void tst_QRegularExpression::globalMatch_data() << QRegularExpression::NormalMatch << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) << matchList; + + matchList.clear(); + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured = QStringList() << "ABC"; + matchList << m; + m.captured = QStringList() << ""; + matchList << m; + m.captured = QStringList() << "DEF"; + matchList << m; + m.captured = QStringList() << ""; + matchList << m; + m.captured = QStringList() << "GHI"; + matchList << m; + m.captured = QStringList() << ""; + matchList << m; + QTest::newRow("globalmatch_emptycaptures07") << QRegularExpression("[\\x{0000}-\\x{FFFF}]*") + << QString::fromUtf8("ABC""\xf0\x9d\x85\x9d""DEF""\xf0\x9d\x85\x9e""GHI") + << 0 + << QRegularExpression::NormalMatch + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << matchList; + + matchList.clear(); + m.clear(); + m.isValid = true; m.hasMatch = true; + m.captured = QStringList() << QString::fromUtf8("ABC""\xc3\x80"); + matchList << m; + m.captured = QStringList() << ""; + matchList << m; + m.captured = QStringList() << QString::fromUtf8("\xc3\x80""DEF""\xc3\x80"); + matchList << m; + m.captured = QStringList() << ""; + matchList << m; + QTest::newRow("globalmatch_emptycaptures08") << QRegularExpression("[\\x{0000}-\\x{FFFF}]*") + << QString::fromUtf8("ABC""\xc3\x80""\xf0\x9d\x85\x9d""\xc3\x80""DEF""\xc3\x80") + << 0 + << QRegularExpression::NormalMatch + << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption) + << matchList; } void tst_QRegularExpression::globalMatch() diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 1dc2e551b4..c0242d95c5 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -56,6 +56,7 @@ private slots: void abortQuitOnShow(); void changeFocusWindow(); void keyboardModifiers(); + void modalWindow(); }; class DummyWindow : public QWindow @@ -315,5 +316,183 @@ void tst_QGuiApplication::keyboardModifiers() delete window; } +class BlockableWindow : public QWindow +{ + Q_OBJECT +public: + int blocked; + + inline BlockableWindow() + : QWindow() + { + blocked = false; + } + + bool event(QEvent *e) + { + switch (e->type()) { + case QEvent::WindowBlocked: + ++blocked; + break; + case QEvent::WindowUnblocked: + --blocked; + break; + default: + break; + } + return QWindow::event(e); + } +}; + +void tst_QGuiApplication::modalWindow() +{ + int argc = 0; + QGuiApplication app(argc, 0); + + BlockableWindow *window1 = new BlockableWindow; + + BlockableWindow *window2 = new BlockableWindow; + + BlockableWindow *windowModalWindow1 = new BlockableWindow; + windowModalWindow1->setTransientParent(window1); + windowModalWindow1->setWindowModality(Qt::WindowModal); + + BlockableWindow *windowModalWindow2 = new BlockableWindow; + windowModalWindow2->setTransientParent(windowModalWindow1); + windowModalWindow2->setWindowModality(Qt::WindowModal); + + BlockableWindow *applicationModalWindow1 = new BlockableWindow; + applicationModalWindow1->setWindowModality(Qt::ApplicationModal); + + // show the 2 windows, nothing is blocked + window1->show(); + window2->show(); + QTest::qWaitForWindowShown(window1); + QTest::qWaitForWindowShown(window2); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(window1->blocked, 0); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show applicationModalWindow1, everything is blocked + applicationModalWindow1->show(); + QCOMPARE(app.modalWindow(), applicationModalWindow1); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 1); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 1); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // everything is unblocked when applicationModalWindow1 is hidden + applicationModalWindow1->hide(); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(window1->blocked, 0); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show the windowModalWindow1, only window1 is blocked + windowModalWindow1->show(); + QCOMPARE(app.modalWindow(), windowModalWindow1); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show the windowModalWindow2, windowModalWindow1 is blocked as well + windowModalWindow2->show(); + QCOMPARE(app.modalWindow(), windowModalWindow2); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // hide windowModalWindow1, nothing is unblocked + windowModalWindow1->hide(); + QCOMPARE(app.modalWindow(), windowModalWindow2); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // hide windowModalWindow2, windowModalWindow1 and window1 are unblocked + windowModalWindow2->hide(); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(window1->blocked, 0); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show windowModalWindow1 again, window1 is blocked + windowModalWindow1->show(); + QCOMPARE(app.modalWindow(), windowModalWindow1); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show windowModalWindow2 again, windowModalWindow1 is also blocked + windowModalWindow2->show(); + QCOMPARE(app.modalWindow(), windowModalWindow2); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // show applicationModalWindow1, everything is blocked + applicationModalWindow1->show(); + QCOMPARE(app.modalWindow(), applicationModalWindow1); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 1); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 1); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // hide applicationModalWindow1, windowModalWindow1 and window1 are blocked + applicationModalWindow1->hide(); + QCOMPARE(app.modalWindow(), windowModalWindow2); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 1); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // hide windowModalWindow2, window1 is blocked + windowModalWindow2->hide(); + QCOMPARE(app.modalWindow(), windowModalWindow1); + QCOMPARE(window1->blocked, 1); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + // hide windowModalWindow1, everything is unblocked + windowModalWindow1->hide(); + QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0)); + QCOMPARE(window1->blocked, 0); + QCOMPARE(window2->blocked, 0); + QCOMPARE(windowModalWindow1->blocked, 0); + QCOMPARE(windowModalWindow2->blocked, 0); + QCOMPARE(applicationModalWindow1->blocked, 0); + + window2->hide(); + window1->hide(); + + delete applicationModalWindow1; + delete windowModalWindow2; + delete windowModalWindow1; + delete window2; + delete window1; +} + QTEST_APPLESS_MAIN(tst_QGuiApplication) #include "tst_qguiapplication.moc" diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 1cedfa5c01..ea26b9262b 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -75,10 +75,8 @@ private slots: void serializeSpacing(); void lastResortFont(); void styleName(); -#ifdef QT_BUILD_INTERNAL void defaultFamily_data(); void defaultFamily(); -#endif }; // Testing get/set functions @@ -623,36 +621,62 @@ void tst_QFont::styleName() #endif } -#ifdef QT_BUILD_INTERNAL +QString getPlatformGenericFont(const char* genericName) +{ +#if defined(Q_OS_UNIX) && !defined(QT_NO_FONTCONFIG) + QProcess p; + p.start(QLatin1String("fc-match"), (QStringList() << "-f%{family}" << genericName)); + if (!p.waitForStarted()) + qWarning("fc-match cannot be started: %s", qPrintable(p.errorString())); + if (p.waitForFinished()) + return QString::fromLatin1(p.readAllStandardOutput()); +#endif + return QLatin1String(genericName); +} + +static inline QByteArray msgNotAcceptableFont(const QString &defaultFamily, const QStringList &acceptableFamilies) +{ + QString res = QString::fromLatin1("Font family '%1' is not one of the following accaptable results: ").arg(defaultFamily); + Q_FOREACH (const QString &family, acceptableFamilies) + res += QString::fromLatin1("\n %1").arg(family); + return res.toLocal8Bit(); +} + Q_DECLARE_METATYPE(QFont::StyleHint) void tst_QFont::defaultFamily_data() { QTest::addColumn<QFont::StyleHint>("styleHint"); - QTest::addColumn<QString>("defaultFamily"); - - QTest::newRow("serif") << QFont::Times << "serif"; - QTest::newRow("monospace") << QFont::Monospace << "monospace"; - QTest::newRow("sans-serif") << QFont::SansSerif << "sans-serif"; - QTest::newRow("cursive") << QFont::Cursive << "cursive"; - QTest::newRow("fantasy") << QFont::Fantasy << "fantasy"; - QTest::newRow("old english") << QFont::OldEnglish << "Old English"; + QTest::addColumn<QStringList>("acceptableFamilies"); + + QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << getPlatformGenericFont("serif")); + QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << getPlatformGenericFont("monospace")); + QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << getPlatformGenericFont("cursive")); + QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << getPlatformGenericFont("fantasy")); + QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << getPlatformGenericFont("sans-serif")); } void tst_QFont::defaultFamily() { QFETCH(QFont::StyleHint, styleHint); - QFETCH(QString, defaultFamily); - - QFontDatabase db; - if (!db.hasFamily(defaultFamily)) - QSKIP("Font family is not available on the system"); + QFETCH(QStringList, acceptableFamilies); QFont f; + QFontDatabase db; f.setStyleHint(styleHint); - QCOMPARE(QFontDatabase::resolveFontFamilyAlias(f.defaultFamily()), QFontDatabase::resolveFontFamilyAlias(defaultFamily)); + const QString familyForHint(f.defaultFamily()); + // it should at least return a family that is available. + QVERIFY(db.hasFamily(familyForHint)); + + bool isAcceptable = false; + Q_FOREACH (const QString& family, acceptableFamilies) { + if (!familyForHint.compare(family, Qt::CaseInsensitive)) { + isAcceptable = true; + break; + } + } + QVERIFY2(isAcceptable, msgNotAcceptableFont(familyForHint, acceptableFamilies)); } -#endif // QT_BUILD_INTERNAL QTEST_MAIN(tst_QFont) #include "tst_qfont.moc" diff --git a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro index ef47a4b458..69062bc0c9 100644 --- a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro @@ -6,4 +6,3 @@ SOURCES += tst_qabstractnetworkcache.cpp TESTDATA += tests/* -CONFIG += insignificant_test # QTBUG-20686; note, assumed unstable on all platforms diff --git a/tests/auto/network/access/qftp/qftp.pro b/tests/auto/network/access/qftp/qftp.pro index 0f5bd5fe17..7fdf3a46f0 100644 --- a/tests/auto/network/access/qftp/qftp.pro +++ b/tests/auto/network/access/qftp/qftp.pro @@ -14,4 +14,4 @@ wince*: { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -CONFIG+=insignificant_test # uses live qt-test-server, inherently unstable +CONFIG+=insignificant_test # QTBUG-15111: uses live qt-test-server, inherently unstable diff --git a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro index 389c8ca4dc..9e37aec5ce 100644 --- a/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/network/socket/qsocks5socketengine/qsocks5socketengine.pro @@ -10,7 +10,6 @@ MOC_DIR=tmp QT = core-private network-private testlib -# QTBUG-23380 - udpTest failing on Ubuntu 11.10 x64 -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-23380 requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index ee49d679f0..977013ab8c 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1589,6 +1589,22 @@ void tst_QAccessibility::textEditTest() iface->editableTextInterface()->cutText(12, 16); QCOMPARE(QApplication::clipboard()->text(), QLatin1String("how ")); QCOMPARE(iface->textInterface()->text(12, 15), QLatin1String("are")); + + QTestAccessibility::clearEvents(); + + // select text + QTextCursor c = edit.textCursor(); + c.setPosition(2); + c.setPosition(4, QTextCursor::KeepAnchor); + edit.setTextCursor(c); + QAccessibleTextSelectionEvent sel(&edit, 2, 4); + QVERIFY_EVENT(&sel); + + edit.selectAll(); + int end = edit.textCursor().position(); + sel.setCursorPosition(end); + sel.setSelection(0, end); + QVERIFY_EVENT(&sel); } QTestAccessibility::clearEvents(); } @@ -1922,7 +1938,6 @@ void tst_QAccessibility::lineEditTest() QVERIFY_EVENT(&cursor); lineEdit->setText("foo"); - qDebug() << QTestAccessibility::events(); cursorEvent.setCursorPosition(3); QVERIFY_EVENT(&cursorEvent); diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 68a347ebdb..7d34981a73 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -129,6 +129,10 @@ void tst_QSqlDriver::record() QSqlRecord rec = db.driver()->record(tablename); QCOMPARE(rec.count(), 4); + // QTBUG-1363: QSqlField::length() always return -1 when using QODBC3 driver and QSqlDatabase::record() + if (db.driverName().startsWith("QODBC") && tst_Databases::isSqlServer(db)) + QCOMPARE(rec.field(1).length(), 20); + if (db.driverName().startsWith("QIBASE")|| db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) for(int i = 0; i < fields.count(); ++i) fields[i] = fields[i].toUpper(); diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index f7ce54959e..78e18f9229 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -368,6 +368,13 @@ signals: void signalInIf3(); #endif +# //QTBUG-22717 + # /* */ +# + + # \ + +// public slots: void const slotWithSillyConst() {} diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/qgraphicsgridlayout.pro b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/qgraphicsgridlayout.pro index b32c638948..5796cbfd73 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -4,5 +4,3 @@ TARGET = tst_qgraphicsgridlayout QT += widgets testlib SOURCES += tst_qgraphicsgridlayout.cpp CONFIG += parallel_test -# ### fixme: QTBUG-20756 crashes on xcb -contains(QT_CONFIG,xcb):CONFIG+=insignificant_test diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro index 2f479151dc..59ad89ed1f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro @@ -7,6 +7,6 @@ QT += core-private gui-private SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp DEFINES += QT_NO_CAST_TO_ASCII -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test # QTBUG-16063 win32|mac:CONFIG += insignificant_test # QTBUG-24296 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro index ca796647c1..2fc45b48de 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -6,5 +6,4 @@ QT += core-private gui-private SOURCES += tst_qgraphicswidget.cpp -# QTBUG-23616 - unstable test -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-23616 diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 1158a9f06b..1518403a64 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -1947,8 +1947,8 @@ void tst_QHeaderView::noSectionsWithNegativeSize() void tst_QHeaderView::emptySectionSpan() { - QHeaderViewPrivate::SectionSpan span; - QCOMPARE(span.sectionSize(), 0); + QHeaderViewPrivate::SectionItem section; + QCOMPARE(section.sectionSize(), 0); } void tst_QHeaderView::task236450_hidden_data() diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro index d47b3bfa31..d1a7686637 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro +++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro @@ -5,5 +5,4 @@ SOURCES += tst_qitemdelegate.cpp win32:!wince*: LIBS += -lUser32 -# QTBUG-23637 -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test # QTBUG-23637 diff --git a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro index 95d1ba1c2f..8102b6b95d 100644 --- a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro +++ b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro @@ -4,5 +4,4 @@ QT += widgets testlib QT += widgets-private gui-private core-private SOURCES += tst_qtreeview.cpp -# QTBUG-23638 -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG+=insignificant_test # QTBUG-23638 diff --git a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro index 03bb91f4c0..e0545630c5 100644 --- a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro +++ b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro @@ -3,5 +3,4 @@ TARGET = tst_qcombobox QT += widgets widgets-private gui-private core-private testlib SOURCES += tst_qcombobox.cpp -# QTBUG-23639 - unstable test (related QTBUG-1071) -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-23639, (related QTBUG-1071) diff --git a/tests/auto/widgets/widgets/qdoublespinbox/qdoublespinbox.pro b/tests/auto/widgets/widgets/qdoublespinbox/qdoublespinbox.pro index 4dd0890fc0..183210b597 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/qdoublespinbox.pro +++ b/tests/auto/widgets/widgets/qdoublespinbox/qdoublespinbox.pro @@ -3,5 +3,4 @@ TARGET = tst_qdoublespinbox QT += widgets testlib SOURCES += tst_qdoublespinbox.cpp -# QTBUG-23641 - unstable test -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-23641 diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 06bf929e4b..22e05a8871 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -271,6 +271,7 @@ private slots: void taskQTBUG_7395_readOnlyShortcut(); void QTBUG697_paletteCurrentColorGroup(); void QTBUG13520_textNotVisible(); + void QTBUG7174_inputMaskCursorBlink(); void bidiVisualMovement_data(); void bidiVisualMovement(); @@ -3693,6 +3694,30 @@ void tst_QLineEdit::QTBUG13520_textNotVisible() } +class UpdateRegionLineEdit : public QLineEdit +{ +public: + QRegion updateRegion; +protected: + void paintEvent(QPaintEvent *event) + { + updateRegion = event->region(); + } +}; + +void tst_QLineEdit::QTBUG7174_inputMaskCursorBlink() +{ + UpdateRegionLineEdit edit; + edit.setInputMask(QLatin1String("AAAA")); + edit.setFocus(); + edit.setText(QLatin1String("AAAA")); + edit.show(); + QRect cursorRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect(); + QTest::qWaitForWindowShown(&edit); + edit.updateRegion = QRegion(); + QTest::qWait(QApplication::cursorFlashTime()); + QVERIFY(edit.updateRegion.contains(cursorRect)); +} void tst_QLineEdit::bidiVisualMovement_data() { diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 70823d92f0..bc5100f118 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -98,10 +98,9 @@ static inline void triggerSignal(QMdiSubWindow *window, QMdiArea *workspace, window->showMaximized(); qApp->processEvents(); window->showNormal(); - qApp->processEvents(); - QVERIFY(!window->isMinimized()); - QVERIFY(!window->isMaximized()); - QVERIFY(!window->isShaded()); + QTRY_VERIFY(!window->isMinimized()); + QTRY_VERIFY(!window->isMaximized()); + QTRY_VERIFY(!window->isShaded()); } else if (signal == SIGNAL(aboutToActivate())) { if (window->parent()) { workspace->setActiveSubWindow(window); diff --git a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro index 6bacaa0d37..c74c9e84c1 100644 --- a/tests/auto/widgets/widgets/qmenubar/qmenubar.pro +++ b/tests/auto/widgets/widgets/qmenubar/qmenubar.pro @@ -3,5 +3,4 @@ TARGET = tst_qmenubar QT += widgets testlib SOURCES += tst_qmenubar.cpp -# QTBUG-4965, QTBUG-11823 - unstable tests -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-4965, QTBUG-11823 diff --git a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro index e9436eccdc..2863dd2034 100644 --- a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro +++ b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qscrollbar QT += widgets testlib SOURCES += tst_qscrollbar.cpp - -mac*:CONFIG+=insignificant_test diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 688daf1f8a..f568322ab7 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -99,6 +99,9 @@ void tst_QScrollBar::scrollSingleStep() QTest::mouseClick(testWidget, Qt::LeftButton, Qt::NoModifier, QPoint(sr.x(), sr.y())); QTest::qWait(510); // initial delay is 500 for setRepeatAction disconnect(testWidget, SIGNAL(actionTriggered(int)), 0, 0); +#ifdef Q_OS_MAC + QEXPECT_FAIL("", "This test fails on Mac OS X, see QTBUG-25272", Abort); +#endif QCOMPARE(testWidget->value(), testWidget->singleStep()); } @@ -136,9 +139,6 @@ void tst_QScrollBar::task_209492() QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent); // Check that the action was triggered once. -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "Fix does does not work on Mac due to paint architechure differences.", Abort); -#endif QCOMPARE(scrollArea.scrollCount, 1); QCOMPARE(spy.count(), 1); } diff --git a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro index 1c2821b289..6e0fff17d5 100644 --- a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro +++ b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro @@ -2,18 +2,5 @@ CONFIG += testcase TARGET = tst_qtextedit QT += widgets widgets-private gui-private core-private testlib -INCLUDEPATH += ../ -HEADERS += -SOURCES += tst_qtextedit.cpp - -wince* { - addImages.files = fullWidthSelection/* - addImages.path = fullWidthSelection - DEPLOYMENT += addImages - DEFINES += SRCDIR=\\\"./\\\" -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} - -contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-20756 crashes on xcb +SOURCES += tst_qtextedit.cpp diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 9c5a3dbed7..a3f58c4c0d 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -58,6 +58,7 @@ #include <qimagewriter.h> #include <qcommonstyle.h> #include <qlayout.h> +#include <qdir.h> #include <qabstracttextdocumentlayout.h> #include <qtextdocumentfragment.h> @@ -218,6 +219,7 @@ private: QTextEdit *ed; qreal rootFrameMargin; PlatformInputContext m_platformInputContext; + const QString m_fullWidthSelectionImagesFolder; }; bool tst_QTextEdit::nativeClipboardWorking() @@ -376,13 +378,17 @@ public: int &iterationCounter; }; -tst_QTextEdit::tst_QTextEdit() -{} +tst_QTextEdit::tst_QTextEdit() : + m_fullWidthSelectionImagesFolder(QFINDTESTDATA("fullWidthSelection")) +{ + +} void tst_QTextEdit::initTestCase() { QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); inputMethodPrivate->testContext = &m_platformInputContext; + QVERIFY2(!m_fullWidthSelectionImagesFolder.isEmpty(), qPrintable(QString::fromLatin1("Cannot locate 'fullWidthSelection' starting from %1").arg(QDir::currentPath()))); } void tst_QTextEdit::cleanupTestCase() @@ -1934,12 +1940,18 @@ void tst_QTextEdit::fullWidthSelection_data() QTest::addColumn<int>("cursorTo"); QTest::addColumn<QString>("imageFileName"); - QTest::newRow("centered fully selected") << 0 << 15 << QString("fullWidthSelection/centered-fully-selected.png"); - QTest::newRow("centered partly selected") << 2 << 15 << QString("fullWidthSelection/centered-partly-selected.png"); - QTest::newRow("last char on line") << 42 << 44 << QString("fullWidthSelection/last-char-on-line.png"); - QTest::newRow("last char on parag") << 545 << 548 << QString("fullWidthSelection/last-char-on-parag.png"); - QTest::newRow("multiple full width lines") << 20 << 60 << QString("fullWidthSelection/multiple-full-width-lines.png"); - QTest::newRow("single full width line") << 20 << 30 << QString("fullWidthSelection/single-full-width-line.png"); + QTest::newRow("centered fully selected") + << 0 << 15 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/centered-fully-selected.png")); + QTest::newRow("centered partly selected") + << 2 << 15 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/centered-partly-selected.png")); + QTest::newRow("last char on line") + << 42 << 44 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/last-char-on-line.png")); + QTest::newRow("last char on parag") + << 545 << 548 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/last-char-on-parag.png")); + QTest::newRow("multiple full width lines") + << 20 << 60 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/multiple-full-width-lines.png")); + QTest::newRow("single full width line") + << 20 << 30 << (m_fullWidthSelectionImagesFolder + QStringLiteral("/single-full-width-line.png")); } void tst_QTextEdit::fullWidthSelection() @@ -2053,11 +2065,12 @@ void tst_QTextEdit::compareWidgetAndImage(QTextEdit &widget, const QString &imag QPainter painter(&image); widget.viewport()->render(&painter); painter.end(); - // qDebug() << "file: " << QString(SRCDIR) + imageFileName; - QImageReader reader(QString(SRCDIR) + imageFileName, "PNG"); + QImageReader reader(imageFileName, "PNG"); + QImage original = reader.read(); - QCOMPARE(original.isNull(), false); + QVERIFY2(!original.isNull(), + qPrintable(QString::fromLatin1("Unable to read image %1: %2").arg(imageFileName, reader.errorString()))); QCOMPARE(original.size(), image.size()); QCOMPARE(image.depth(), 32); QCOMPARE(original.depth(), image.depth()); diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index 1155cd0547..bfd6ff0810 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -1405,7 +1405,7 @@ void tst_QDom::normalizeEndOfLine() const const QString expected(QLatin1String("<a>\nc\nc\na\na</a>")); - // ### Qt 5: fix this, if we keep QDom at all + // ### Qt 6: fix this, if we keep QDom at all QEXPECT_FAIL("", "The parser doesn't perform newline normalization. Fixing that would change behavior.", Continue); QCOMPARE(doc.documentElement().text(), expected); } |