diff options
Diffstat (limited to 'tests/auto')
38 files changed, 622 insertions, 203 deletions
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp index b00fd0dfd4..d1aadab7d8 100644 --- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp +++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp @@ -53,11 +53,7 @@ public: // test data: QTextCodec *codec; QString (*from8BitPtr)(const char *, int); -#ifdef Q_COMPILER_REF_QUALIFIERS - QByteArray (QString:: *to8Bit)() const &; -#else - QByteArray (QString:: *to8Bit)() const; -#endif + static QByteArray to8Bit(const QString &); inline QString from8Bit(const QByteArray &ba) { return from8BitPtr(ba.constData(), ba.length()); } @@ -97,14 +93,21 @@ void tst_Utf8::init() if (useLocale) { codec = QTextCodec::codecForLocale(); from8BitPtr = &QString::fromLocal8Bit; - to8Bit = &QString::toLocal8Bit; } else { codec = QTextCodec::codecForMib(106); from8BitPtr = &QString::fromUtf8; - to8Bit = &QString::toUtf8; } } +QByteArray tst_Utf8::to8Bit(const QString &s) +{ + QFETCH_GLOBAL(bool, useLocale); + if (useLocale) + return s.toLocal8Bit(); + else + return s.toUtf8(); +} + void tst_Utf8::roundTrip_data() { QTest::addColumn<QByteArray>("utf8"); @@ -114,10 +117,10 @@ void tst_Utf8::roundTrip_data() QTest::newRow("nul") << QByteArray("", 1) << QString(QChar(QChar::Null)); static const char ascii[] = "This is a standard US-ASCII message"; - QTest::newRow("ascii") << QByteArray(ascii) << ascii; + QTest::newRow("ascii") << QByteArray(ascii) << QString::fromLatin1(ascii); static const char ascii2[] = "\1This\2is\3an\4US-ASCII\020 message interspersed with control chars"; - QTest::newRow("ascii2") << QByteArray(ascii2) << ascii2; + QTest::newRow("ascii2") << QByteArray(ascii2) << QString::fromLatin1(ascii2); static const char utf8_1[] = "\302\240"; // NBSP QTest::newRow("utf8_1") << QByteArray(utf8_1) << QString(QChar(QChar::Nbsp)); @@ -161,11 +164,20 @@ void tst_Utf8::roundTrip() QFETCH(QByteArray, utf8); QFETCH(QString, utf16); - QCOMPARE((utf16.*to8Bit)(), utf8); + QCOMPARE(to8Bit(utf16), utf8); + QCOMPARE(from8Bit(utf8), utf16); + + QCOMPARE(to8Bit(from8Bit(utf8)), utf8); + QCOMPARE(from8Bit(to8Bit(utf16)), utf16); + + // repeat with a longer message + utf8.prepend("12345678901234"); + utf16.prepend(QLatin1String("12345678901234")); + QCOMPARE(to8Bit(utf16), utf8); QCOMPARE(from8Bit(utf8), utf16); - QCOMPARE((from8Bit(utf8).*to8Bit)(), utf8); - QCOMPARE(from8Bit((utf16.*to8Bit)()), utf16); + QCOMPARE(to8Bit(from8Bit(utf8)), utf8); + QCOMPARE(from8Bit(to8Bit(utf16)), utf16); } void tst_Utf8::charByChar_data() diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a58c7dfb4b..4f7ddce9c3 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -405,6 +405,13 @@ void tst_QFileSystemWatcher::removePaths() watcher.removePaths(paths); } +static QByteArray msgFileOperationFailed(const char *what, const QFile &f) +{ + return what + QByteArrayLiteral(" failed on \"") + + QDir::toNativeSeparators(f.fileName()).toLocal8Bit() + + QByteArrayLiteral("\": ") + f.errorString().toLocal8Bit(); +} + void tst_QFileSystemWatcher::watchFileAndItsDirectory() { QFETCH(QString, backend); @@ -420,14 +427,10 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QString testFileName = testDir.filePath("testFile.txt"); QString secondFileName = testDir.filePath("testFile2.txt"); - QFile::remove(secondFileName); QFile testFile(testFileName); - testFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner); - testFile.remove(); - - QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); - testFile.write(QByteArray("hello")); + QVERIFY2(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", testFile)); + QVERIFY2(testFile.write(QByteArrayLiteral("hello")) > 0, msgFileOperationFailed("write", testFile)); testFile.close(); QFileSystemWatcher watcher; @@ -449,8 +452,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() // wait before modifying the directory... QTest::qWait(2000); - QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate)); - testFile.write(QByteArray("hello again")); + QVERIFY2(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", testFile)); + QVERIFY2(testFile.write(QByteArrayLiteral("hello again")), msgFileOperationFailed("write", testFile)); testFile.close(); #ifdef Q_OS_MAC @@ -472,8 +475,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() fileChangedSpy.clear(); dirChangedSpy.clear(); QFile secondFile(secondFileName); - secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate); - secondFile.write("Foo"); + QVERIFY2(secondFile.open(QIODevice::WriteOnly | QIODevice::Truncate), msgFileOperationFailed("open", secondFile)); + QVERIFY2(secondFile.write(QByteArrayLiteral("Foo")) > 0, msgFileOperationFailed("write", secondFile)); secondFile.close(); timer.start(3000); @@ -491,17 +494,17 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() dirChangedSpy.clear(); - QFile::remove(testFileName); + QVERIFY(QFile::remove(testFileName)); QTRY_VERIFY(fileChangedSpy.count() > 0); - QCOMPARE(dirChangedSpy.count(), 1); + QTRY_COMPARE(dirChangedSpy.count(), 1); fileChangedSpy.clear(); dirChangedSpy.clear(); // removing a deleted file should fail QVERIFY(!watcher.removePath(testFileName)); - QFile::remove(secondFileName); + QVERIFY(QFile::remove(secondFileName)); timer.start(3000); eventLoop.exec(); diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h index 40917c0172..af0ced130c 100644 --- a/tests/auto/corelib/tools/qarraydata/simplevector.h +++ b/tests/auto/corelib/tools/qarraydata/simplevector.h @@ -101,9 +101,10 @@ public: bool isStatic() const { return d->ref.isStatic(); } bool isShared() const { return d->ref.isShared(); } bool isSharedWith(const SimpleVector &other) const { return d == other.d; } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) bool isSharable() const { return d->ref.isSharable(); } - void setSharable(bool sharable) { d.setSharable(sharable); } +#endif size_t size() const { return d->size; } size_t capacity() const { return d->alloc; } diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 60b807a7bc..35ec0ef019 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -52,7 +52,9 @@ struct SharedNullVerifier { Q_ASSERT(QArrayData::shared_null[0].ref.isStatic()); Q_ASSERT(QArrayData::shared_null[0].ref.isShared()); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) Q_ASSERT(QArrayData::shared_null[0].ref.isSharable()); +#endif } }; @@ -107,7 +109,9 @@ void tst_QArrayData::referenceCounting() QCOMPARE(array.ref.atomic.load(), 1); QVERIFY(!array.ref.isStatic()); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QVERIFY(array.ref.isSharable()); +#endif QVERIFY(array.ref.ref()); QCOMPARE(array.ref.atomic.load(), 2); @@ -127,6 +131,7 @@ void tst_QArrayData::referenceCounting() // Now would be a good time to free/release allocated data } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) { // Reference counting initialized to 0 (non-sharable) QArrayData array = { { Q_BASIC_ATOMIC_INITIALIZER(0) }, 0, 0, 0, 0 }; @@ -145,6 +150,7 @@ void tst_QArrayData::referenceCounting() // Free/release data } +#endif { // Reference counting initialized to -1 (static read-only data) @@ -153,13 +159,16 @@ void tst_QArrayData::referenceCounting() QCOMPARE(array.ref.atomic.load(), -1); QVERIFY(array.ref.isStatic()); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QVERIFY(array.ref.isSharable()); +#endif QVERIFY(array.ref.ref()); QCOMPARE(array.ref.atomic.load(), -1); QVERIFY(array.ref.deref()); QCOMPARE(array.ref.atomic.load(), -1); + } } @@ -169,16 +178,19 @@ void tst_QArrayData::sharedNullEmpty() QArrayData *empty = QArrayData::allocate(1, Q_ALIGNOF(QArrayData), 0); QVERIFY(null->ref.isStatic()); - QVERIFY(null->ref.isSharable()); QVERIFY(null->ref.isShared()); QVERIFY(empty->ref.isStatic()); - QVERIFY(empty->ref.isSharable()); QVERIFY(empty->ref.isShared()); QCOMPARE(null->ref.atomic.load(), -1); QCOMPARE(empty->ref.atomic.load(), -1); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + QVERIFY(null->ref.isSharable()); + QVERIFY(empty->ref.isSharable()); +#endif + QVERIFY(null->ref.ref()); QVERIFY(empty->ref.ref()); @@ -305,6 +317,7 @@ void tst_QArrayData::simpleVector() QVERIFY(!v7.isShared()); QVERIFY(!v8.isShared()); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QVERIFY(v1.isSharable()); QVERIFY(v2.isSharable()); QVERIFY(v3.isSharable()); @@ -313,6 +326,7 @@ void tst_QArrayData::simpleVector() QVERIFY(v6.isSharable()); QVERIFY(v7.isSharable()); QVERIFY(v8.isSharable()); +#endif QVERIFY(v1.isSharedWith(v2)); QVERIFY(v1.isSharedWith(v3)); @@ -496,6 +510,7 @@ void tst_QArrayData::simpleVector() for (int i = 0; i < 120; ++i) QCOMPARE(v1[i], v8[i % 10]); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) { v7.setSharable(true); QVERIFY(v7.isSharable()); @@ -558,6 +573,7 @@ void tst_QArrayData::simpleVector() QVERIFY(null.isEmpty()); QVERIFY(empty.isEmpty()); } +#endif } Q_DECLARE_METATYPE(SimpleVector<int>) @@ -648,7 +664,7 @@ void tst_QArrayData::allocate_data() QTest::addColumn<size_t>("alignment"); QTest::addColumn<QArrayData::AllocationOptions>("allocateOptions"); QTest::addColumn<bool>("isCapacityReserved"); - QTest::addColumn<bool>("isSharable"); + QTest::addColumn<bool>("isSharable"); // ### Qt6: remove QTest::addColumn<const QArrayData *>("commonEmpty"); struct { @@ -662,10 +678,12 @@ void tst_QArrayData::allocate_data() }; QArrayData *shared_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0); - QArrayData *unsharable_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0, QArrayData::Unsharable); - QVERIFY(shared_empty); + +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + QArrayData *unsharable_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0, QArrayData::Unsharable); QVERIFY(unsharable_empty); +#endif struct { char const *description; @@ -676,10 +694,12 @@ void tst_QArrayData::allocate_data() } options[] = { { "Default", QArrayData::Default, false, true, shared_empty }, { "Reserved", QArrayData::CapacityReserved, true, true, shared_empty }, +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) { "Reserved | Unsharable", QArrayData::CapacityReserved | QArrayData::Unsharable, true, false, unsharable_empty }, { "Unsharable", QArrayData::Unsharable, false, false, unsharable_empty }, +#endif { "Grow", QArrayData::Grow, false, true, shared_empty } }; @@ -700,7 +720,6 @@ void tst_QArrayData::allocate() QFETCH(size_t, alignment); QFETCH(QArrayData::AllocationOptions, allocateOptions); QFETCH(bool, isCapacityReserved); - QFETCH(bool, isSharable); QFETCH(const QArrayData *, commonEmpty); // Minimum alignment that can be requested is that of QArrayData. @@ -725,7 +744,10 @@ void tst_QArrayData::allocate() else QCOMPARE(data->alloc, uint(capacity)); QCOMPARE(data->capacityReserved, uint(isCapacityReserved)); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + QFETCH(bool, isSharable); QCOMPARE(data->ref.isSharable(), isSharable); +#endif // Check that the allocated array can be used. Best tested with a // memory checker, such as valgrind, running. @@ -1302,6 +1324,7 @@ static inline bool arrayIsFilledWith(const QArrayDataPointer<int> &array, void tst_QArrayData::setSharable_data() { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QTest::addColumn<QArrayDataPointer<int> >("array"); QTest::addColumn<size_t>("size"); QTest::addColumn<size_t>("capacity"); @@ -1342,10 +1365,12 @@ void tst_QArrayData::setSharable_data() QTest::newRow("non-empty-reserved") << nonEmptyReserved << size_t(7) << size_t(15) << true << 2; QTest::newRow("static-array") << staticArray << size_t(10) << size_t(0) << false << 3; QTest::newRow("raw-data") << rawData << size_t(10) << size_t(0) << false << 3; +#endif } void tst_QArrayData::setSharable() { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QFETCH(QArrayDataPointer<int>, array); QFETCH(size_t, size); QFETCH(size_t, capacity); @@ -1424,6 +1449,7 @@ void tst_QArrayData::setSharable() QCOMPARE(array->ref.isShared(), !(size || isCapacityReserved)); QVERIFY(array->ref.isSharable()); +#endif } struct ResetOnDtor @@ -1474,6 +1500,7 @@ void fromRawData_impl() QVERIFY((const T *)raw.constBegin() != array); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) { // Immutable, unsharable SimpleVector<T> raw = SimpleVector<T>::fromRawData(array, @@ -1502,6 +1529,7 @@ void fromRawData_impl() QCOMPARE(raw.back(), T(11)); QVERIFY((const T *)raw.constBegin() != array); } +#endif } void tst_QArrayData::fromRawData_data() @@ -1558,7 +1586,9 @@ void tst_QArrayData::literals() QVERIFY(v.isStatic()); #endif +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QVERIFY(v.isSharable()); +#endif QCOMPARE((void*)(const char*)(v.constBegin() + v.size()), (void*)(const char*)v.constEnd()); for (int i = 0; i < 10; ++i) @@ -1607,7 +1637,9 @@ void tst_QArrayData::variadicLiterals() QVERIFY(v.isStatic()); +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QVERIFY(v.isSharable()); +#endif QCOMPARE((const int *)(v.constBegin() + v.size()), (const int *)v.constEnd()); for (int i = 0; i < 7; ++i) diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index 6e183f3212..cdcbd19ae8 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -1863,7 +1863,7 @@ void tst_QByteArray::reserve() QCOMPARE(qba.capacity(), capacity); QCOMPARE(copy.capacity(), capacity); - copy = qba; + qba = copy; qba.reserve(capacity * 2); QCOMPARE(qba.size(), capacity); QCOMPARE(qba.capacity(), capacity * 2); diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 73f8973245..9c96aaf78d 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -1217,12 +1217,14 @@ void tst_QHash::noNeedlessRehashes() void tst_QHash::const_shared_null() { + QHash<int, QString> hash2; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QHash<int, QString> hash1; hash1.setSharable(false); QVERIFY(hash1.isDetached()); - QHash<int, QString> hash2; hash2.setSharable(true); +#endif QVERIFY(!hash2.isDetached()); } diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp index 49b32d5534..9e47e9c6d6 100644 --- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp +++ b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp @@ -1018,12 +1018,14 @@ void tst_QLinkedList::initializeList() const template<typename T> void tst_QLinkedList::constSharedNull() const { + QLinkedList<T> list2; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QLinkedList<T> list1; list1.setSharable(false); QVERIFY(list1.isDetached()); - QLinkedList<T> list2; list2.setSharable(true); +#endif QVERIFY(!list2.isDetached()); } @@ -1049,6 +1051,7 @@ void tst_QLinkedList::constSharedNullComplex() const void tst_QLinkedList::setSharableInt() const { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QLinkedList<int> orglist; orglist << 0 << 1 << 2 << 3 << 4 << 5; int size = 6; @@ -1094,6 +1097,7 @@ void tst_QLinkedList::setSharableInt() const } QCOMPARE(list.size(), size); +#endif } QTEST_APPLESS_MAIN(tst_QLinkedList) diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index d77cc4a37c..b368359c62 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -1522,12 +1522,14 @@ void tst_QList::initializeList() const template<typename T> void tst_QList::constSharedNull() const { + QList<T> list2; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QList<T> list1; list1.setSharable(false); QVERIFY(list1.isDetached()); - QList<T> list2; list2.setSharable(true); +#endif QVERIFY(!list2.isDetached()); } @@ -1553,16 +1555,19 @@ void tst_QList::constSharedNullComplex() const template <class T> void generateSetSharableData() { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QTest::addColumn<QList<T> >("list"); QTest::addColumn<int>("size"); QTest::newRow("null") << QList<T>() << 0; QTest::newRow("non-empty") << (QList<T>() << T(0) << T(1) << T(2) << T(3) << T(4)) << 5; +#endif } template <class T> void runSetSharableTest() { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QFETCH(QList<T>, list); QFETCH(int, size); @@ -1602,6 +1607,7 @@ void runSetSharableTest() QCOMPARE(int(list[i]), i); QCOMPARE(list.size(), size); +#endif } void tst_QList::setSharableInt_data() const diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index e812e5a337..00e669c1d8 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp @@ -984,12 +984,14 @@ void tst_QMap::qmultimap_specific() void tst_QMap::const_shared_null() { + QMap<int, QString> map2; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QMap<int, QString> map1; map1.setSharable(false); QVERIFY(map1.isDetached()); - QMap<int, QString> map2; map2.setSharable(true); +#endif QVERIFY(!map2.isDetached()); } @@ -1046,6 +1048,7 @@ const T &const_(const T &t) void tst_QMap::setSharable() { +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) QMap<int, QString> map; map.insert(1, "um"); @@ -1095,6 +1098,7 @@ void tst_QMap::setSharable() QVERIFY(!map.isDetached()); QVERIFY(copy.isSharedWith(map)); } +#endif } void tst_QMap::insert() @@ -1204,7 +1208,6 @@ void tst_QMap::initializerList() void tst_QMap::testInsertWithHint() { QMap<int, int> map; - map.setSharable(false); // Check with end hint(); map.insert(map.constEnd(), 3, 1); // size == 1 @@ -1268,7 +1271,6 @@ void tst_QMap::testInsertWithHint() void tst_QMap::testInsertMultiWithHint() { QMap<int, int> map; - map.setSharable(false); typedef QMap<int, int>::const_iterator cite; // Hack since we define QT_STRICT_ITERATORS map.insertMulti(cite(map.end()), 64, 65); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index d9d6b985b7..95d377b176 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -3619,6 +3619,14 @@ void tst_QString::fromUtf8_data() str += " some "; QTest::newRow("str3-len") << QByteArray("\342\202\254 some text") << str << 9; + // test that QString::fromUtf8 suppresses an initial BOM, but not a ZWNBSP + str = "hello"; + QByteArray bom("\357\273\277"); + QTest::newRow("bom0") << bom << QString() << 3; + QTest::newRow("bom1") << bom + "hello" << str << -1; + QTest::newRow("bom+zwnbsp0") << bom + bom << QString(QChar(0xfeff)) << -1; + QTest::newRow("bom+zwnbsp1") << bom + "hello" + bom << str + QChar(0xfeff) << -1; + str = "hello"; str += QChar::ReplacementCharacter; str += QChar(0x68); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index f85d2dee0c..776251fa52 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -267,12 +267,15 @@ private slots: void initializeListCustom(); void const_shared_null(); +#if 1 + // ### Qt6 remove this section void setSharableInt_data(); void setSharableInt(); void setSharableMovable_data(); void setSharableMovable(); void setSharableCustom_data(); void setSharableCustom(); +#endif void detachInt() const; void detachMovable() const; @@ -398,15 +401,17 @@ void tst_QVector::copyConstructor() const } { QVector<T> v1; - v1.setSharable(false); + v1 << value1 << value2 << value3 << value4; QVector<T> v2(v1); - QVERIFY(!v1.isSharedWith(v2)); QCOMPARE(v1, v2); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v1; - v1 << value1 << value2 << value3 << value4; + v1.setSharable(false); QVector<T> v2(v1); + QVERIFY(!v1.isSharedWith(v2)); QCOMPARE(v1, v2); } { @@ -417,6 +422,7 @@ void tst_QVector::copyConstructor() const QVERIFY(!v1.isSharedWith(v2)); QCOMPARE(v1, v2); } +#endif } void tst_QVector::copyConstructorInt() const @@ -517,6 +523,8 @@ void tst_QVector::append() const QVERIFY(v.size() == 3); QCOMPARE(v.at(v.size() - 1), SimpleValue<T>::at(0)); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v(2); v.reserve(12); @@ -525,6 +533,7 @@ void tst_QVector::append() const QVERIFY(v.size() == 3); QCOMPARE(v.last(), SimpleValue<T>::at(0)); } +#endif } void tst_QVector::appendInt() const @@ -822,12 +831,15 @@ void tst_QVector::eraseEmpty() const v.erase(v.begin(), v.end()); QCOMPARE(v.size(), 0); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v; v.setSharable(false); v.erase(v.begin(), v.end()); QCOMPARE(v.size(), 0); } +#endif } void tst_QVector::eraseEmptyInt() const @@ -858,6 +870,8 @@ void tst_QVector::eraseEmptyReserved() const v.erase(v.begin(), v.end()); QCOMPARE(v.size(), 0); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v; v.reserve(10); @@ -865,6 +879,7 @@ void tst_QVector::eraseEmptyReserved() const v.erase(v.begin(), v.end()); QCOMPARE(v.size(), 0); } +#endif } void tst_QVector::eraseEmptyReservedInt() const @@ -971,6 +986,8 @@ void tst_QVector::erase(bool shared) const if (shared) QCOMPARE(SimpleValue<T>::vector(12), *svc.copy); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v = SimpleValue<T>::vector(10); SharedVectorChecker<T> svc(v, shared); @@ -983,6 +1000,7 @@ void tst_QVector::erase(bool shared) const if (shared) QCOMPARE(SimpleValue<T>::vector(10), *svc.copy); } +#endif } void tst_QVector::eraseInt() const @@ -1055,6 +1073,8 @@ template<typename T> void tst_QVector::eraseReserved() const v.erase(v.begin() + 1, v.end() - 1); QCOMPARE(v.size(), 2); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section { QVector<T> v(10); v.reserve(16); @@ -1064,6 +1084,7 @@ template<typename T> void tst_QVector::eraseReserved() const v.erase(v.begin(), v.end() - 1); QCOMPARE(v.size(), 1); } +#endif } void tst_QVector::eraseReservedInt() const @@ -1585,6 +1606,14 @@ void tst_QVector::resizePOD_data() const QVERIFY(emptyReserved.capacity() >= 10); QVERIFY(nonEmptyReserved.capacity() >= 15); + QTest::newRow("null") << null << 10; + QTest::newRow("empty") << empty << 10; + QTest::newRow("emptyReserved") << emptyReserved << 10; + QTest::newRow("nonEmpty") << nonEmpty << 10; + QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; + +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section QVector<int> nullNotShared; QVector<int> emptyNotShared(0, 5); QVector<int> emptyReservedNotShared; @@ -1603,16 +1632,12 @@ void tst_QVector::resizePOD_data() const nonEmptyNotShared.setSharable(false); nonEmptyReservedNotShared.setSharable(false); - QTest::newRow("null") << null << 10; - QTest::newRow("empty") << empty << 10; - QTest::newRow("emptyReserved") << emptyReserved << 10; - QTest::newRow("nonEmpty") << nonEmpty << 10; - QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; QTest::newRow("nullNotShared") << nullNotShared << 10; QTest::newRow("emptyNotShared") << emptyNotShared << 10; QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10; QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10; QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10; +#endif } void tst_QVector::resizePOD() const @@ -1656,6 +1681,14 @@ void tst_QVector::resizeComplexMovable_data() const QVERIFY(emptyReserved.capacity() >= 10); QVERIFY(nonEmptyReserved.capacity() >= 15); + QTest::newRow("null") << null << 10; + QTest::newRow("empty") << empty << 10; + QTest::newRow("emptyReserved") << emptyReserved << 10; + QTest::newRow("nonEmpty") << nonEmpty << 10; + QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; + +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section QVector<Movable> nullNotShared; QVector<Movable> emptyNotShared(0, 'Q'); QVector<Movable> emptyReservedNotShared; @@ -1674,16 +1707,12 @@ void tst_QVector::resizeComplexMovable_data() const nonEmptyNotShared.setSharable(false); nonEmptyReservedNotShared.setSharable(false); - QTest::newRow("null") << null << 10; - QTest::newRow("empty") << empty << 10; - QTest::newRow("emptyReserved") << emptyReserved << 10; - QTest::newRow("nonEmpty") << nonEmpty << 10; - QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; QTest::newRow("nullNotShared") << nullNotShared << 10; QTest::newRow("emptyNotShared") << emptyNotShared << 10; QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10; QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10; QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10; +#endif } void tst_QVector::resizeComplexMovable() const @@ -1731,6 +1760,14 @@ void tst_QVector::resizeComplex_data() const QVERIFY(emptyReserved.capacity() >= 10); QVERIFY(nonEmptyReserved.capacity() >= 15); + QTest::newRow("null") << null << 10; + QTest::newRow("empty") << empty << 10; + QTest::newRow("emptyReserved") << emptyReserved << 10; + QTest::newRow("nonEmpty") << nonEmpty << 10; + QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; + +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section QVector<Custom> nullNotShared; QVector<Custom> emptyNotShared(0, '0'); QVector<Custom> emptyReservedNotShared; @@ -1749,16 +1786,12 @@ void tst_QVector::resizeComplex_data() const nonEmptyNotShared.setSharable(false); nonEmptyReservedNotShared.setSharable(false); - QTest::newRow("null") << null << 10; - QTest::newRow("empty") << empty << 10; - QTest::newRow("emptyReserved") << emptyReserved << 10; - QTest::newRow("nonEmpty") << nonEmpty << 10; - QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10; QTest::newRow("nullNotShared") << nullNotShared << 10; QTest::newRow("emptyNotShared") << emptyNotShared << 10; QTest::newRow("emptyReservedNotShared") << emptyReservedNotShared << 10; QTest::newRow("nonEmptyNotShared") << nonEmptyNotShared << 10; QTest::newRow("nonEmptyReservedNotShared") << nonEmptyReservedNotShared << 10; +#endif } void tst_QVector::resizeComplex() const @@ -2143,15 +2176,20 @@ void tst_QVector::initializeListCustom() void tst_QVector::const_shared_null() { + QVector<int> v2; +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) + // ### Qt6 remove this section QVector<int> v1; v1.setSharable(false); QVERIFY(v1.isDetached()); - QVector<int> v2; v2.setSharable(true); +#endif QVERIFY(!v2.isDetached()); } +#if QT_SUPPORTS(UNSHARABLE_CONTAINERS) +// ### Qt6 remove this section template<typename T> void tst_QVector::setSharable_data() const { @@ -2182,21 +2220,6 @@ void tst_QVector::setSharable_data() const QTest::newRow("non-empty, Reserved") << nonEmptyReserved << 7 << 15 << true; } -void tst_QVector::setSharableInt_data() -{ - setSharable_data<int>(); -} - -void tst_QVector::setSharableMovable_data() -{ - setSharable_data<Movable>(); -} - -void tst_QVector::setSharableCustom_data() -{ - setSharable_data<Custom>(); -} - template<typename T> void tst_QVector::setSharable() const { @@ -2258,6 +2281,30 @@ void tst_QVector::setSharable() const .arg(vector.capacity()) .arg(capacity))); } +#else +template<typename T> void tst_QVector::setSharable_data() const +{ +} + +template<typename T> void tst_QVector::setSharable() const +{ +} +#endif + +void tst_QVector::setSharableInt_data() +{ + setSharable_data<int>(); +} + +void tst_QVector::setSharableMovable_data() +{ + setSharable_data<Movable>(); +} + +void tst_QVector::setSharableCustom_data() +{ + setSharable_data<Custom>(); +} void tst_QVector::setSharableInt() { diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index eea72cd246..e1cdb8db45 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -48,6 +48,10 @@ #include <qpa/qwindowsysteminterface.h> #include <qgenericplugin.h> +#if defined(Q_OS_QNX) +#include <QOpenGLContext> +#endif + #include <QDebug> #include "tst_qcoreapplication.h" @@ -143,6 +147,9 @@ void tst_QGuiApplication::focusObject() const QRect screenGeometry = QGuiApplication::primaryScreen()->availableVirtualGeometry(); DummyWindow window1; +#if defined(Q_OS_QNX) + window1.setSurfaceType(QSurface::OpenGLSurface); +#endif window1.resize(windowSize, windowSize); window1.setTitle(QStringLiteral("focusObject:window1")); window1.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing)); @@ -153,6 +160,15 @@ void tst_QGuiApplication::focusObject() window1.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + QOpenGLContext context; + context.create(); + context.makeCurrent(&window1); + QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window1); +#endif + QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject*))); @@ -298,15 +314,35 @@ void tst_QGuiApplication::changeFocusWindow() // focus is changed between FocusAboutToChange and FocusChanged FocusChangeWindow window1; +#if defined(Q_OS_QNX) + window1.setSurfaceType(QSurface::OpenGLSurface); +#endif window1.resize(windowSize, windowSize); window1.setFramePosition(QPoint(screenGeometry.left() + spacing, screenGeometry.top() + spacing)); window1.setTitle(QStringLiteral("changeFocusWindow:window1")); window1.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + QOpenGLContext context; + context.create(); + context.makeCurrent(&window1); + QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window1); +#endif FocusChangeWindow window2; +#if defined(Q_OS_QNX) + window2.setSurfaceType(QSurface::OpenGLSurface); +#endif window2.resize(windowSize, windowSize); window2.setFramePosition(QPoint(screenGeometry.left() + 2 * spacing + windowSize, screenGeometry.top() + spacing)); window2.setTitle(QStringLiteral("changeFocusWindow:window2")); window2.show(); +#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store + // and then post the window in order for screen to show the window + context.makeCurrent(&window2); + QTest::qWaitForWindowExposed(&window2); // Buffer swap only succeeds with exposed window + context.swapBuffers(&window2); +#endif QVERIFY(QTest::qWaitForWindowExposed(&window1)); QVERIFY(QTest::qWaitForWindowExposed(&window2)); window1.requestActivate(); diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index eefa85a745..589f3e66e1 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -88,6 +88,10 @@ private slots: void visibility(); void mask(); void initialSize(); + void modalDialog(); + void modalDialogClosingOneOfTwoModal(); + void modalWithChildWindow(); + void modalWindowModallity(); void initTestCase() { @@ -1316,6 +1320,115 @@ void tst_QWindow::initialSize() } } +void tst_QWindow::modalDialog() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow dialog; + dialog.resize(200,200); + dialog.setModality(Qt::ApplicationModal); + dialog.setFlags(Qt::Dialog); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + + normalWindow.requestActivate(); + + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog); +} + +void tst_QWindow::modalDialogClosingOneOfTwoModal() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow first_dialog; + first_dialog.resize(200,200); + first_dialog.setModality(Qt::ApplicationModal); + first_dialog.setFlags(Qt::Dialog); + first_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&first_dialog)); + + { + QWindow second_dialog; + second_dialog.resize(200,200); + second_dialog.setModality(Qt::ApplicationModal); + second_dialog.setFlags(Qt::Dialog); + second_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&second_dialog)); + + QTRY_COMPARE(QGuiApplication::focusWindow(), &second_dialog); + + second_dialog.close(); + } + + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &first_dialog); +} + +void tst_QWindow::modalWithChildWindow() +{ + QWindow normalWindow; + normalWindow.resize(400, 400); + normalWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normalWindow)); + + QWindow tlw_dialog; + tlw_dialog.resize(400,200); + tlw_dialog.setModality(Qt::ApplicationModal); + tlw_dialog.setFlags(Qt::Dialog); + tlw_dialog.create(); + + QWindow sub_window(&tlw_dialog); + sub_window.resize(200,300); + sub_window.show(); + + tlw_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&tlw_dialog)); + QVERIFY(QTest::qWaitForWindowExposed(&sub_window)); + + QTRY_COMPARE(QGuiApplication::focusWindow(), &tlw_dialog); + + sub_window.requestActivate(); + QGuiApplication::sync(); + QGuiApplication::processEvents(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &sub_window); +} + +void tst_QWindow::modalWindowModallity() +{ + QWindow normal_window; + normal_window.resize(400, 400); + normal_window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&normal_window)); + + QWindow parent_to_modal; + parent_to_modal.resize(400, 400); + parent_to_modal.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parent_to_modal)); + QTRY_COMPARE(QGuiApplication::focusWindow(), &parent_to_modal); + + QWindow modal_dialog; + modal_dialog.resize(400,200); + modal_dialog.setModality(Qt::WindowModal); + modal_dialog.setFlags(Qt::Dialog); + modal_dialog.setTransientParent(&parent_to_modal); + modal_dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&modal_dialog)); + QTRY_COMPARE(QGuiApplication::focusWindow(), &modal_dialog); + + normal_window.requestActivate(); + QTRY_COMPARE(QGuiApplication::focusWindow(), &normal_window); + +} + #include <tst_qwindow.moc> QTEST_MAIN(tst_QWindow) diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 56d6711dc6..d0482d77e2 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -309,9 +309,6 @@ void tst_QTextLayout::simpleBoundingRect() void tst_QTextLayout::threeLineBoundingRect() { -#if defined(Q_OS_MAC) - QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); -#endif /* stricter check. break text into three lines */ QString firstWord("hello"); @@ -430,9 +427,6 @@ void tst_QTextLayout::forcedBreaks() void tst_QTextLayout::breakAny() { -#if defined(Q_OS_MAC) - QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); -#endif QString text = "ABCD"; QTextLayout layout(text, testFont); @@ -473,9 +467,6 @@ void tst_QTextLayout::breakAny() void tst_QTextLayout::noWrap() { -#if defined(Q_OS_MAC) - QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); -#endif QString text = "AB CD"; QTextLayout layout(text, testFont); @@ -1048,9 +1039,6 @@ void tst_QTextLayout::charWordStopOnLineSeparator() void tst_QTextLayout::xToCursorAtEndOfLine() { -#if defined(Q_OS_MAC) - QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); -#endif QString text = "FirstLine SecondLine"; text.replace('\n', QChar::LineSeparator); @@ -1112,9 +1100,6 @@ void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() void tst_QTextLayout::tabStops() { -#if defined(Q_OS_MAC) - QSKIP("QTestFontEngine on the mac does not support logclusters at the moment"); -#endif QString txt("Hello there\tworld"); QTextLayout layout(txt, testFont); layout.beginLayout(); @@ -1931,13 +1916,16 @@ void tst_QTextLayout::textWithSurrogates_qtbug15679() void tst_QTextLayout::textWidthWithStackedTextEngine() { QString text = QString::fromUtf8("คลิก ถัดไป เพื่อดำเนินการต่อ"); + QTextLayout layout(text); layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); layout.endLayout(); - QFontMetricsF fm(layout.font()); - QCOMPARE(line.naturalTextWidth(), fm.width(text)); + + QStackTextEngine layout2(text, layout.font()); + + QVERIFY(layout2.width(0, text.size()).toReal() >= line.naturalTextWidth()); } void tst_QTextLayout::textWidthWithLineSeparator() @@ -1958,27 +1946,24 @@ void tst_QTextLayout::textWidthWithLineSeparator() void tst_QTextLayout::cursorInLigatureWithMultipleLines() { -#if !defined(Q_OS_MAC) - QSKIP("This test can only be run on Mac"); -#endif QTextLayout layout("first line finish", QFont("Times", 20)); layout.setCacheEnabled(true); layout.beginLayout(); QTextLine line = layout.createLine(); - line.setLineWidth(70); - line = layout.createLine(); + line.setNumColumns(10); + QTextLine line2 = layout.createLine(); layout.endLayout(); - // The second line will be "finish", with "fi" as a ligature - QEXPECT_FAIL("", "QTBUG-26403", Abort); - QVERIFY(line.cursorToX(0) != line.cursorToX(1)); + // The second line will be "finish" + QCOMPARE(layout.text().mid(line2.textStart(), line2.textLength()), QString::fromLatin1("finish")); + + QVERIFY(line.cursorToX(1) != line.cursorToX(0)); + QCOMPARE(line2.cursorToX(line2.textStart()), line.cursorToX(0)); + QCOMPARE(line2.cursorToX(line2.textStart() + 1), line.cursorToX(1)); } void tst_QTextLayout::xToCursorForLigatures() { -#if !defined(Q_OS_MAC) - QSKIP("This test can only be run on Mac"); -#endif QTextLayout layout("fi", QFont("Times", 20)); layout.setCacheEnabled(true); layout.beginLayout(); @@ -2001,9 +1986,6 @@ void tst_QTextLayout::xToCursorForLigatures() void tst_QTextLayout::cursorInNonStopChars() { -#if defined(Q_OS_MAC) - QSKIP("This test can not be run on Mac"); -#endif QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8")); layout.setCacheEnabled(true); layout.beginLayout(); diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index c4db669695..74eb58670b 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1105,6 +1105,9 @@ void tst_QTextScriptEngine::mirroredChars() void tst_QTextScriptEngine::controlInSyllable_qtbug14204() { +#ifdef Q_OS_MAC + QSKIP("Result differs for HarfBuzz-NG, skip test."); +#endif QFontDatabase db; if (!db.families().contains(QStringLiteral("Aparajita"))) QSKIP("couldn't find 'Aparajita' font"); @@ -1143,6 +1146,10 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675_data() QTest::addColumn<QFont>("font"); QTest::addColumn<QString>("string"); +#ifdef Q_OS_MAC + QSKIP("Result differs for HarfBuzz-NG, skip test."); +#endif + bool hasTests = false; QStringList families; @@ -1251,36 +1258,37 @@ void tst_QTextScriptEngine::thaiWithZWJ() QTextLayout layout(s, font); QTextEngine *e = layout.engine(); e->itemize(); - QCOMPARE(e->layoutData->items.size(), 11); + QCOMPARE(e->layoutData->items.size(), 3); for (int item = 0; item < e->layoutData->items.size(); ++item) e->shape(item); - QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(7)); // Thai: The ZWJ and ZWNJ characters are inherited, so should be part of the thai script - QCOMPARE(e->layoutData->items[1].num_glyphs, ushort(1)); // Common: The smart quotes cannot be handled by thai, so should be a separate item - QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(1)); // Thai: Thai character - QCOMPARE(e->layoutData->items[3].num_glyphs, ushort(1)); // Common: Ellipsis - QCOMPARE(e->layoutData->items[4].num_glyphs, ushort(1)); // Thai: Thai character - QCOMPARE(e->layoutData->items[5].num_glyphs, ushort(1)); // Common: Smart quote - QCOMPARE(e->layoutData->items[6].num_glyphs, ushort(1)); // Thai: Thai character - QCOMPARE(e->layoutData->items[7].num_glyphs, ushort(1)); // Common: \xA0 = non-breaking space. Could be useful to have in thai, but not currently implemented - QCOMPARE(e->layoutData->items[8].num_glyphs, ushort(1)); // Thai: Thai character - QCOMPARE(e->layoutData->items[9].num_glyphs, ushort(1)); // Japanese: Kanji for tree - QCOMPARE(e->layoutData->items[10].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(15)); // Thai: The ZWJ and ZWNJ characters are inherited, so should be part of the thai script + QCOMPARE(e->layoutData->items[1].num_glyphs, ushort(1)); // Han: Kanji for tree + QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type //A quick sanity check - check all the characters are individual clusters unsigned short *logClusters = e->layoutData->logClustersPtr; - for (int i = 0; i < 7; i++) + for (int i = 0; i <= 14; i++) QCOMPARE(logClusters[i], ushort(i)); - for (int i = 0; i < 10; i++) - QCOMPARE(logClusters[i+7], ushort(0)); + QCOMPARE(logClusters[15], ushort(0)); + QCOMPARE(logClusters[16], ushort(0)); +#ifndef Q_OS_MAC + // ### Result differs for HarfBuzz-NG QCOMPARE(logClusters[17], ushort(1)); +#endif // A thai implementation could either remove the ZWJ and ZWNJ characters, or hide them. // The current implementation hides them, so we test for that. // The only characters that we should be hiding are the ZWJ and ZWNJ characters in position 1 and 3. const QGlyphLayout glyphLayout = e->layoutData->glyphLayout; for (int i = 0; i < 18; i++) { +#ifdef Q_OS_MAC + // ### Result differs for HarfBuzz-NG + if (i == 17) + QCOMPARE(glyphLayout.advances[i].toInt(), 0); + else +#endif if (i == 1 || i == 3) QCOMPARE(glyphLayout.advances[i].toInt(), 0); else diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index e589d520cb..122ac63034 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -331,8 +331,8 @@ void tst_QTcpSocket::initTestCase_data() qDebug() << QtNetworkSettings::serverName(); QTest::newRow("WithoutProxy") << false << 0 << false; - QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; - QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; + //QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false; ### temporarily disabled, QTBUG-38385 + //QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false; ### temporarily disabled, QTBUG-38385 QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false; QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false; @@ -340,8 +340,8 @@ void tst_QTcpSocket::initTestCase_data() #ifndef QT_NO_SSL QTest::newRow("WithoutProxy SSL") << false << 0 << true; - QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; - QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; + //QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true; ### temporarily disabled, QTBUG-38385 + //QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true; ### temporarily disabled, QTBUG-38385 QTest::newRow("WithHttpProxy SSL") << true << int(HttpProxy) << true; QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true; diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index baaf21e6bb..30a9e19138 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -273,10 +273,12 @@ void tst_QSslSocket::initTestCase_data() void tst_QSslSocket::initTestCase() { +#ifndef QT_NO_SSL qDebug("Using SSL library %s (%ld)", qPrintable(QSslSocket::sslLibraryVersionString()), QSslSocket::sslLibraryVersionNumber()); QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); +#endif } void tst_QSslSocket::init() diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 02f32adf57..71243339aa 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -754,7 +754,7 @@ void tst_QGL::openGLVersionCheck() #elif defined(QT_OPENGL_ES_2) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); #else - if (QOpenGLContext::currentContext()->isES()) + if (QOpenGLContext::currentContext()->isOpenGLES()) QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0); else QVERIFY(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_1); @@ -1553,7 +1553,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA; #else - QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8; + QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8; #endif QCOMPARE(int(format1.internalTextureFormat()), expectedFormat); @@ -1630,7 +1630,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format3c)); @@ -1643,7 +1643,7 @@ void tst_QGL::fboFormat() #ifdef QT_OPENGL_ES_2 GL_RGBA #else - QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL ? GL_RGBA : GL_RGBA8 + QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL ? GL_RGBA : GL_RGBA8 #endif ); QVERIFY(!(format1c == format4c)); @@ -2420,10 +2420,10 @@ void tst_QGL::extensions() QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Shaders)); QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Buffers)); QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Multisample)); - QVERIFY(!ctx->isES() || allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); + QVERIFY(!ctx->isOpenGLES() || allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); QVERIFY(allFeatures.testFlag(QOpenGLFunctions::NPOTTextures) && allFeatures.testFlag(QOpenGLFunctions::NPOTTextureRepeat)); - if (ctx->isES()) { + if (ctx->isOpenGLES()) { QVERIFY(!allFeatures.testFlag(QOpenGLFunctions::FixedFunctionPipeline)); QVERIFY(allFeatures.testFlag(QOpenGLFunctions::Framebuffers)); } diff --git a/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp b/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp index 915f503b3f..a8a9deb25f 100644 --- a/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp +++ b/tests/auto/opengl/qglbuffer/tst_qglbuffer.cpp @@ -207,6 +207,10 @@ void tst_QGLBuffer::bufferSharing() QSKIP("Unreproducible timeout on Windows (MSVC/MinGW) CI bots"); #endif +#if defined(Q_OS_QNX) + QSKIP("Crashes on QNX when destroying the second QGLWidget (see QTBUG-38275)"); +#endif + QGLWidget *w1 = new QGLWidget(); w1->makeCurrent(); diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp index 4e0375171a..a465afef21 100644 --- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp +++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp @@ -96,7 +96,7 @@ void tst_QGLFunctions::features() funcs.initializeGLFunctions(); // Validate the features against what we expect for this platform. - if (QOpenGLContext::currentContext()->isES()) { + if (QOpenGLContext::currentContext()->isOpenGLES()) { #if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) QGLFunctions::OpenGLFeatures allFeatures = (QGLFunctions::Multitexture | diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index e190af31e4..25057ba2a0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -345,7 +345,7 @@ void renderAScene(int w, int h) { QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); - if (QOpenGLContext::currentContext()->isES()) { + if (QOpenGLContext::currentContext()->isOpenGLES()) { Q_UNUSED(w); Q_UNUSED(h); QGLShaderProgram program; diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index fcc5581bea..1cc79f643a 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3283,7 +3283,7 @@ void tst_QAccessibility::comboBoxTest() QVERIFY(!combo.view()->isVisible()); QVERIFY(iface->actionInterface()); - QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction()); + QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction() << QAccessibleActionInterface::pressAction()); iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction()); QTRY_VERIFY(combo.view()->isVisible()); diff --git a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp index 9763e3e7e6..847453b3ed 100644 --- a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp +++ b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp @@ -102,6 +102,7 @@ void tst_QSqlError::construction() QCOMPARE(obj1.databaseText(), QString("databasetext")); QCOMPARE(obj1.type(), QSqlError::UnknownError); QCOMPARE(obj1.number(), 123); + QCOMPARE(obj1.nativeErrorCode(), QStringLiteral("123")); QVERIFY(obj1.isValid()); QSqlError obj2(obj1); @@ -109,6 +110,7 @@ void tst_QSqlError::construction() QCOMPARE(obj2.databaseText(), obj1.databaseText()); QCOMPARE(obj2.type(), obj1.type()); QCOMPARE(obj2.number(), obj1.number()); + QCOMPARE(obj2.nativeErrorCode(), obj1.nativeErrorCode()); QVERIFY(obj2.isValid()); QSqlError obj3 = obj2; @@ -116,10 +118,16 @@ void tst_QSqlError::construction() QCOMPARE(obj3.databaseText(), obj2.databaseText()); QCOMPARE(obj3.type(), obj2.type()); QCOMPARE(obj3.number(), obj2.number()); + QCOMPARE(obj3.nativeErrorCode(), obj2.nativeErrorCode()); QVERIFY(obj3.isValid()); QSqlError obj4; QVERIFY(!obj4.isValid()); + QCOMPARE(obj4.driverText(), QString()); + QCOMPARE(obj4.databaseText(), QString()); + QCOMPARE(obj4.type(), QSqlError::NoError); + QCOMPARE(obj4.number(), -1); + QCOMPARE(obj4.nativeErrorCode(), QString()); QSqlError obj5(QStringLiteral("drivertext"), QStringLiteral("databasetext"), QSqlError::UnknownError, QStringLiteral("123")); @@ -138,6 +146,16 @@ void tst_QSqlError::construction() QCOMPARE(obj6.number(), 0); QCOMPARE(obj6.nativeErrorCode(), QStringLiteral("Err123")); QVERIFY(obj6.isValid()); + + // Default constructed object as constructed before Qt 5.3 + QSqlError obj7(QString(), QString(), QSqlError::NoError, -1); + QVERIFY(!obj7.isValid()); + QCOMPARE(obj7.driverText(), QString()); + QCOMPARE(obj7.databaseText(), QString()); + QCOMPARE(obj7.type(), QSqlError::NoError); + QCOMPARE(obj7.number(), -1); + QCOMPARE(obj7.nativeErrorCode(), QString()); + } void tst_QSqlError::operators() diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 55cb67eed9..824f042ffc 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -195,6 +195,9 @@ private slots: void task_233829_data() { generic_data("QPSQL"); } void task_233829(); + void QTBUG_12477_data() { generic_data("QPSQL"); } + void QTBUG_12477(); + void sqlServerReturn0_data() { generic_data(); } void sqlServerReturn0(); @@ -1247,6 +1250,26 @@ void tst_QSqlQuery::seek() QVERIFY( q.seek( 0 ) ); QCOMPARE( q.at(), 0 ); QCOMPARE( q.value( 0 ).toInt(), 1 ); + + QVERIFY(!q.seek(QSql::BeforeFirstRow)); + QCOMPARE(q.at(), int(QSql::BeforeFirstRow)); + QVERIFY(q.seek(1, true)); + QCOMPARE(q.at(), 0); + QCOMPARE(q.value(0).toInt(), 1); + + qint32 count = 1; + while (q.next()) ++count; + + QCOMPARE(q.at(), int(QSql::AfterLastRow)); + + if (!q.isForwardOnly()) { + QVERIFY(q.seek(-1, true)); + QCOMPARE(q.at(), count - 1); + QCOMPARE(q.value(0).toInt(), count); + } else { + QVERIFY(!q.seek(-1, true)); + QCOMPARE(q.at(), int(QSql::AfterLastRow)); + } } void tst_QSqlQuery::seekForwardOnlyQuery() @@ -2992,6 +3015,47 @@ void tst_QSqlQuery::task_233829() QVERIFY_SQL(q,exec()); } +void tst_QSqlQuery::QTBUG_12477() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + if (!db.driverName().startsWith("QPSQL")) + QSKIP("PostgreSQL specific test"); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("SELECT 1::bit, '10101010000111101101'::varbit, " + "'10101111011'::varbit(15), '22222.20'::numeric(16,2), " + "'333333'::numeric(18), '444444'::numeric")); + QVERIFY_SQL(q, next()); + QSqlRecord r = q.record(); + QSqlField f; + + f = r.field(0); + QCOMPARE(f.length(), 1); + QCOMPARE(f.precision(), -1); + + f = r.field(1); + QCOMPARE(f.length(), -1); + QCOMPARE(f.precision(), -1); + + f = r.field(2); + QCOMPARE(f.length(), 15); + QCOMPARE(f.precision(), -1); + + f = r.field(3); + QCOMPARE(f.length(), 16); + QCOMPARE(f.precision(), 2); + + f = r.field(4); + QCOMPARE(f.length(), 18); + QCOMPARE(f.precision(), 0); + + f = r.field(5); + QCOMPARE(f.length(), -1); + QCOMPARE(f.precision(), -1); +} + void tst_QSqlQuery::sqlServerReturn0() { QFETCH( QString, dbName ); diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index d360a646f1..047df0d3f2 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -43,6 +43,7 @@ #include <QtTest/QtTest> #include <qcoreapplication.h> +#include <qfile.h> #include <qdebug.h> #include <qsharedpointer.h> #include <qfiledialog.h> @@ -72,6 +73,7 @@ #include <QFileSystemModel> #if defined(Q_OS_UNIX) +#include <unistd.h> // for pathconf() on OS X #ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); @@ -79,6 +81,19 @@ QT_END_NAMESPACE #endif #endif +static inline bool isCaseSensitiveFileSystem(const QString &path) +{ + Q_UNUSED(path) +#if defined(Q_OS_MAC) + return pathconf(QFile::encodeName(path).constData(), _PC_CASE_SENSITIVE); +#elif defined(Q_OS_WIN) + return false; +#else + return true; +#endif +} + + class QNonNativeFileDialog : public QFileDialog { Q_OBJECT @@ -130,6 +145,7 @@ private slots: void selectFile_data(); void selectFile(); void selectFiles(); + void selectFileWrongCaseSaveAs(); void selectFilter(); void viewMode(); void proxymodel(); @@ -147,6 +163,7 @@ private slots: void clearLineEdit(); void enableChooseButton(); void widgetlessNativeDialog(); + void selectedFilesWithoutWidgets(); void trailingDotsAndSpaces(); #ifdef Q_OS_UNIX #ifdef QT_BUILD_INTERNAL @@ -857,36 +874,59 @@ void tst_QFiledialog::selectFile() { QFETCH(QString, file); QFETCH(int, count); - QNonNativeFileDialog fd; - QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); + QScopedPointer<QNonNativeFileDialog> fd(new QNonNativeFileDialog); + QFileSystemModel *model = fd->findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); - fd.setDirectory(QDir::currentPath()); + fd->setDirectory(QDir::currentPath()); // default value - QCOMPARE(fd.selectedFiles().count(), 1); + QCOMPARE(fd->selectedFiles().count(), 1); - QTemporaryFile tempFile(QDir::tempPath() + "/aXXXXXX"); - bool inTemp = (file == "temp"); - if (inTemp) { - tempFile.open(); - file = tempFile.fileName(); + QScopedPointer<QTemporaryFile> tempFile; + if (file == QLatin1String("temp")) { + tempFile.reset(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/aXXXXXX"))); + QVERIFY(tempFile->open()); + file = tempFile->fileName(); } - fd.selectFile(file); - QCOMPARE(fd.selectedFiles().count(), count); - if (inTemp) { - QCOMPARE(model->index(fd.directory().path()), model->index(QDir::tempPath())); + fd->selectFile(file); + QCOMPARE(fd->selectedFiles().count(), count); + if (tempFile.isNull()) { + QCOMPARE(model->index(fd->directory().path()), model->index(QDir::currentPath())); } else { - QCOMPARE(model->index(fd.directory().path()), model->index(QDir::currentPath())); + QCOMPARE(model->index(fd->directory().path()), model->index(QDir::tempPath())); } + fd.reset(); // Ensure the file dialog let's go of the temporary file for "temp". +} + +void tst_QFiledialog::selectFileWrongCaseSaveAs() +{ + const QString home = QDir::homePath(); + if (isCaseSensitiveFileSystem(home)) + QSKIP("This test is intended for case-insensitive file systems only."); + // QTBUG-38162: when passing a wrongly capitalized path to selectFile() + // on a case-insensitive file system, the line edit should only + // contain the file name ("c:\PRogram files\foo.txt" -> "foo.txt"). + const QString fileName = QStringLiteral("foo.txt"); + const QString path = home + QLatin1Char('/') + fileName; + QString wrongCasePath = path; + for (int c = 0; c < wrongCasePath.size(); c += 2) + wrongCasePath[c] = wrongCasePath.at(c).isLower() ? wrongCasePath.at(c).toUpper() : wrongCasePath.at(c).toLower(); + QNonNativeFileDialog fd(0, "QTBUG-38162", wrongCasePath); + fd.setAcceptMode(QFileDialog::AcceptSave); + fd.selectFile(wrongCasePath); + const QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text().compare(fileName, Qt::CaseInsensitive), 0); } void tst_QFiledialog::selectFiles() { - QNonNativeFileDialog fd; - fd.setViewMode(QFileDialog::List); QTemporaryDir tempDir; QVERIFY(tempDir.isValid()); const QString tempPath = tempDir.path(); + { + QNonNativeFileDialog fd; + fd.setViewMode(QFileDialog::List); fd.setDirectory(tempPath); QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); @@ -931,17 +971,20 @@ void tst_QFiledialog::selectFiles() QCOMPARE(spyFilesSelected.count(), 0); QCOMPARE(spyFilterSelected.count(), 0); - //If the selection is invalid then we fill the line edit but without the / - QNonNativeFileDialog * dialog = new QNonNativeFileDialog( 0, "Save" ); - dialog->setFileMode( QFileDialog::AnyFile ); - dialog->setAcceptMode( QFileDialog::AcceptSave ); - dialog->selectFile(tempPath + QStringLiteral("/blah")); - dialog->show(); - QVERIFY(QTest::qWaitForWindowExposed(dialog)); - QLineEdit *lineEdit = dialog->findChild<QLineEdit*>("fileNameEdit"); - QVERIFY(lineEdit); - QCOMPARE(lineEdit->text(),QLatin1String("blah")); - delete dialog; + } + + { + //If the selection is invalid then we fill the line edit but without the / + QNonNativeFileDialog dialog( 0, "Save" ); + dialog.setFileMode( QFileDialog::AnyFile ); + dialog.setAcceptMode( QFileDialog::AcceptSave ); + dialog.selectFile(tempPath + QStringLiteral("/blah")); + dialog.show(); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QLineEdit *lineEdit = dialog.findChild<QLineEdit*>("fileNameEdit"); + QVERIFY(lineEdit); + QCOMPARE(lineEdit->text(),QLatin1String("blah")); + } } void tst_QFiledialog::viewMode() @@ -1321,6 +1364,14 @@ void tst_QFiledialog::widgetlessNativeDialog() QVERIFY(!button); } +void tst_QFiledialog::selectedFilesWithoutWidgets() +{ + // Test for a crash when widgets are not instantiated yet. + QFileDialog fd; + fd.setAcceptMode(QFileDialog::AcceptOpen); + QVERIFY(fd.selectedFiles().size() >= 0); +} + void tst_QFiledialog::trailingDotsAndSpaces() { #ifndef Q_OS_WIN diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 9e0446388e..3925090465 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -476,13 +476,19 @@ void tst_QFileSystemModel::rowCount() void tst_QFileSystemModel::rowsInserted_data() { QTest::addColumn<int>("count"); - QTest::addColumn<int>("assending"); + QTest::addColumn<int>("ascending"); for (int i = 0; i < 4; ++i) { QTest::newRow(QString("Qt::AscendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::AscendingOrder; QTest::newRow(QString("Qt::DescendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::DescendingOrder; } } +static inline QString lastEntry(const QModelIndex &root) +{ + const QAbstractItemModel *model = root.model(); + return model->index(model->rowCount(root) - 1, 0, root).data().toString(); +} + void tst_QFileSystemModel::rowsInserted() { #if defined(Q_OS_WINCE) @@ -492,9 +498,9 @@ void tst_QFileSystemModel::rowsInserted() rowCount(); QModelIndex root = model->index(model->rootPath()); - QFETCH(int, assending); + QFETCH(int, ascending); QFETCH(int, count); - model->sort(0, (Qt::SortOrder)assending); + model->sort(0, (Qt::SortOrder)ascending); QSignalSpy spy0(model, SIGNAL(rowsInserted(QModelIndex,int,int))); QSignalSpy spy1(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); @@ -505,7 +511,6 @@ void tst_QFileSystemModel::rowsInserted() QVERIFY(createFiles(tmp, files, 5)); TRY_WAIT(model->rowCount(root) == oldCount + count); QTRY_COMPARE(model->rowCount(root), oldCount + count); - QTest::qWait(100); // Let the sort settle. int totalRowsInserted = 0; for (int i = 0; i < spy0.count(); ++i) { int start = spy0[i].value(1).toInt(); @@ -513,12 +518,9 @@ void tst_QFileSystemModel::rowsInserted() totalRowsInserted += end - start + 1; } QCOMPARE(totalRowsInserted, count); - if (assending == (Qt::SortOrder)Qt::AscendingOrder) { - QString letter = model->index(model->rowCount(root) - 1, 0, root).data().toString(); - QCOMPARE(letter, QString("j")); - } else { - QCOMPARE(model->index(model->rowCount(root) - 1, 0, root).data().toString(), QString("b")); - } + const QString expected = ascending == Qt::AscendingOrder ? QStringLiteral("j") : QStringLiteral("b"); + QTRY_COMPARE(lastEntry(root), expected); + if (spy0.count() > 0) { if (count == 0) QCOMPARE(spy0.count(), 0); @@ -548,8 +550,8 @@ void tst_QFileSystemModel::rowsRemoved() QModelIndex root = model->index(model->rootPath()); QFETCH(int, count); - QFETCH(int, assending); - model->sort(0, (Qt::SortOrder)assending); + QFETCH(int, ascending); + model->sort(0, (Qt::SortOrder)ascending); QTest::qWait(WAITTIME); QSignalSpy spy0(model, SIGNAL(rowsRemoved(QModelIndex,int,int))); diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 4c07b48c00..a932a2e859 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -2605,6 +2605,9 @@ void tst_QWizard::task161658_alignments() void tst_QWizard::task177022_setFixedSize() { +#ifdef Q_OS_BLACKBERRY + QSKIP("Window is forced fullscreen"); +#endif int width = 300; int height = 200; QWizard wiz; @@ -2622,7 +2625,7 @@ void tst_QWizard::task177022_setFixedSize() QCOMPARE(wiz.maximumWidth(), width); QCOMPARE(wiz.maximumHeight(), height); - wiz.show(); + wiz.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&wiz)); QCOMPARE(wiz.size(), QSize(width, height)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 5b178903cf..8f57eca0a7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -2502,9 +2502,6 @@ void tst_QGraphicsProxyWidget::popup_basic() void tst_QGraphicsProxyWidget::popup_subwidget() { -#ifdef Q_OS_WIN - QSKIP("This test crashes on Windows, QTBUG-33213"); -#endif QGroupBox *groupBox = new QGroupBox; groupBox->setTitle("GroupBox"); groupBox->setCheckable(true); @@ -3183,10 +3180,6 @@ void tst_QGraphicsProxyWidget::actionsContextMenu() void tst_QGraphicsProxyWidget::deleteProxyForChildWidget() { -#if defined(Q_OS_WIN) - QSKIP("This test is crashing on windows, it needs to be fixed. QTBUG-29684"); -#endif - QDialog dialog; dialog.resize(320, 120); dialog.move(80, 40); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 83c4582645..daca1d1516 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1257,7 +1257,7 @@ void tst_QAbstractItemView::task250754_fontChange() tree.setModel(m); tree.setHeaderHidden(true); // The header is (in certain styles) dpi dependent - w.resize(160, 300); // Minimum width for windows with frame on Windows 8 + w.resize(160, 350); // Minimum width for windows with frame on Windows 8 centerOnScreen(&w); moveCursorAway(&w); w.showNormal(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 0579914940..77690cc27a 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2488,7 +2488,7 @@ void tst_QTreeView::extendedSelection_data() QTest::addColumn<int>("selectedCount"); QTest::newRow("select") << QPoint(10, 10) << 2; - QTest::newRow("unselect") << QPoint(10, 150) << 0; + QTest::newRow("unselect") << QPoint(10, 300) << 0; } void tst_QTreeView::extendedSelection() @@ -2499,7 +2499,7 @@ void tst_QTreeView::extendedSelection() QStandardItemModel model(5, 2); QWidget topLevel; QTreeView view(&topLevel); - view.resize(qMax(mousePressPos.x() * 2, 200), qMax(mousePressPos.y() * 2, 200)); + view.resize(qMax(mousePressPos.x() * 2, 300), qMax(mousePressPos.y() * 2, 350)); view.setModel(&model); view.setSelectionMode(QAbstractItemView::ExtendedSelection); topLevel.show(); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 509ccc37b6..abc0129f8b 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2064,7 +2064,7 @@ void tst_QComboBox::itemListPosition() topLevel.move(screen.width() - topLevel.sizeHint().width() - 10, 0); //puts the combo to the top-right corner - topLevel.show(); + topLevel.showNormal(); //wait because the window manager can move the window if there is a right panel QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -2232,7 +2232,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() box.move(100, 100); box.setSizeAdjustPolicy(QComboBox::AdjustToContents); box.addItems(initialContent); - box.show(); + box.showNormal(); //wait needed in order to get the combo initial size QTRY_VERIFY(box.isVisible()); @@ -2244,7 +2244,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() correctBox.move(400, 100); correctBox.addItems(finalContent); - correctBox.show(); + correctBox.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&box)); QVERIFY(QTest::qWaitForWindowExposed(&correctBox)); @@ -2266,7 +2266,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4)); - comboBox.show(); + comboBox.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&comboBox)); QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); @@ -2274,7 +2274,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QTest::qWaitForWindowExposed(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); -#ifdef QT_BUILD_INTERNAL +#if defined QT_BUILD_INTERNAL && !defined Q_OS_BLACKBERRY QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); @@ -2609,7 +2609,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() for (int i = 0; i < 80; i++) combo.addItem( QString::number(i)); - combo.show(); + combo.showNormal(); centerCursor(&combo); // QTBUG-33973, cursor needs to be within view from start on Mac. QApplication::setActiveWindow(&combo); QVERIFY(QTest::qWaitForWindowActive(&combo)); @@ -2629,7 +2629,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#ifndef Q_OS_WINCE +#if !defined Q_OS_WINCE && !defined Q_OS_QNX // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: centerCursor(combo.view()); QTest::qWait(200); diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 6551a88232..095fa3347d 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -801,13 +801,16 @@ void tst_QDockWidget::task237438_setFloatingCrash() void tst_QDockWidget::task248604_infiniteResize() { +#if defined Q_OS_BLACKBERRY + QSKIP("Top level window is stretched to fullscreen"); +#endif QDockWidget d; QTabWidget *t = new QTabWidget; t->addTab(new QWidget, "Foo"); d.setWidget(t); d.setContentsMargins(2, 2, 2, 2); d.setMinimumSize(320, 240); - d.show(); + d.showNormal(); QTest::qWait(400); QCOMPARE(d.size(), QSize(320, 240)); } diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 6784ee477b..6b763f5a4c 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -825,6 +825,8 @@ void tst_QDoubleSpinBox::editingFinished() QCOMPARE(editingFinishedSpy1.count(), 4); QCOMPARE(editingFinishedSpy2.count(), 4); + testFocusWidget->show(); // On BlackBerry this is our root window we need to show it again + // otherwise subsequent tests will fail } void tst_QDoubleSpinBox::removeAll() diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 077e1aa1df..36f14cb1ba 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -1322,7 +1322,7 @@ void tst_QLineEdit::undo_keypressevents_data() // unselect any current selection keys.addKeyClick(Qt::Key_Right); -#ifdef Q_OS_WIN //Mac has a specialcase to handle jumping to the end of a selection +#if defined Q_OS_WIN || defined Q_OS_QNX //Windows and QNX do not jump to the beginning of the selection keys.addKeyClick(Qt::Key_Left); #endif @@ -3206,7 +3206,7 @@ void tst_QLineEdit::leftKeyOnSelectedText() QCOMPARE(testWidget->cursorPosition(), 2); QCOMPARE(testWidget->selectedText(), QString("23")); QTest::keyClick(testWidget, Qt::Key_Left); -#ifdef Q_OS_WIN +#if defined Q_OS_WIN || defined Q_OS_QNX QCOMPARE(testWidget->cursorPosition(), 1); #else // Selection is cleared ands cursor remains at position 2. diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index ba9652a170..59021108a2 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1007,7 +1007,7 @@ void tst_QMdiArea::activeSubWindow() qApp->setActiveWindow(&mainWindow); QCOMPARE(mdiArea->activeSubWindow(), subWindow); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) +#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) && !defined(Q_OS_QNX) qApp->setActiveWindow(0); QVERIFY(!mdiArea->activeSubWindow()); #endif @@ -1088,7 +1088,7 @@ void tst_QMdiArea::currentSubWindow() QVERIFY(mdiArea.activeSubWindow()); QVERIFY(mdiArea.currentSubWindow()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) +#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) && !defined(Q_OS_QNX) qApp->setActiveWindow(0); QVERIFY(!mdiArea.activeSubWindow()); QVERIFY(mdiArea.currentSubWindow()); @@ -1701,7 +1701,7 @@ void tst_QMdiArea::tileSubWindows() qApp->processEvents(); QTRY_COMPARE(workspace.size(), QSize(350, 150)); - const QSize minSize(300, 100); + const QSize minSize(600, 130); foreach (QMdiSubWindow *subWindow, workspace.subWindowList()) subWindow->setMinimumSize(minSize); @@ -1908,6 +1908,9 @@ void tst_QMdiArea::dontMaximizeSubWindowOnActivation() for (int i = 0; i < 5; ++i) { QMdiSubWindow *window = mdiArea.addSubWindow(new QWidget); window->show(); +#if defined Q_OS_QNX + QEXPECT_FAIL("", "QTBUG-38231", Abort); +#endif QVERIFY(window->isMaximized()); qApp->processEvents(); } @@ -2598,7 +2601,7 @@ void tst_QMdiArea::nativeSubWindows() if (platformName != QLatin1String("xcb") && platformName != QLatin1String("windows")) QSKIP(qPrintable(QString::fromLatin1("nativeSubWindows() does not work on this platform (%1).").arg(platformName))); #if defined(Q_OS_WIN) && !defined(QT_NO_OPENGL) - if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::LibGL) QSKIP("nativeSubWindows() does not work with ANGLE on Windows, QTBUG-28545."); #endif { // Add native widgets after show. diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 268638a504..ffc3e3b67d 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -206,6 +206,7 @@ private slots: void task_233197(); void task_226929(); void styleChange(); + void testFullScreenState(); }; void tst_QMdiSubWindow::initTestCase() @@ -2007,6 +2008,19 @@ void tst_QMdiSubWindow::styleChange() QCOMPARE(spy.count(), 0); } +void tst_QMdiSubWindow::testFullScreenState() +{ + QMdiArea mdiArea; + mdiArea.showMaximized(); + + QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); + subWindow->setGeometry(0, 0, 300, 300); + subWindow->showFullScreen(); // QMdiSubWindow does not support the fullscreen state. This call + // should be equivalent to setVisible(true) (and not showNormal()) + QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); + QCOMPARE(subWindow->size(), QSize(300, 300)); +} + QTEST_MAIN(tst_QMdiSubWindow) #include "tst_qmdisubwindow.moc" diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp index 345b8d82ad..06dd623368 100644 --- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp @@ -679,7 +679,8 @@ void tst_QTabBar::tabBarClicked() QCOMPARE(doubleClickSpy.count(), 0); QTest::mouseDClick(&tabBar, button, 0, tabPos); - QCOMPARE(clickSpy.count(), 0); + QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); QCOMPARE(doubleClickSpy.count(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), 0); @@ -691,7 +692,8 @@ void tst_QTabBar::tabBarClicked() QCOMPARE(doubleClickSpy.count(), 0); QTest::mouseDClick(&tabBar, button, 0, barPos); - QCOMPARE(clickSpy.count(), 0); + QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); QCOMPARE(doubleClickSpy.count(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), -1); diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index df11ea9b14..90af617e87 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -690,7 +690,8 @@ void tst_QTabWidget::tabBarClicked() QCOMPARE(doubleClickSpy.count(), 0); QTest::mouseDClick(&tabBar, button, 0, tabPos); - QCOMPARE(clickSpy.count(), 0); + QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0); QCOMPARE(doubleClickSpy.count(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), 0); @@ -702,7 +703,8 @@ void tst_QTabWidget::tabBarClicked() QCOMPARE(doubleClickSpy.count(), 0); QTest::mouseDClick(&tabBar, button, 0, barPos); - QCOMPARE(clickSpy.count(), 0); + QCOMPARE(clickSpy.count(), 1); + QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1); QCOMPARE(doubleClickSpy.count(), 1); QCOMPARE(doubleClickSpy.takeFirst().takeFirst().toInt(), -1); |