summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/.prev_CMakeLists.txt18
-rw-r--r--tests/auto/corelib/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/animation/CMakeLists.txt6
-rw-r--r--tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/codecs/CMakeLists.txt3
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/echo/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/codecs/utf8/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/global/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/global/q_func_info/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qflags/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/global/qfloat16/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qgetputenv/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qglobal/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp101
-rw-r--r--tests/auto/corelib/global/qglobalstatic/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/global/qhooks/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/global/qlogging/CMakeLists.txt25
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro1
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp15
-rw-r--r--tests/auto/corelib/global/qnumeric/CMakeLists.txt26
-rw-r--r--tests/auto/corelib/global/qrand/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp1
-rw-r--r--tests/auto/corelib/global/qtendian/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/.prev_CMakeLists.txt56
-rw-r--r--tests/auto/corelib/io/CMakeLists.txt56
-rw-r--r--tests/auto/corelib/io/largefile/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt25
-rw-r--r--tests/auto/corelib/io/qbuffer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qdataurl/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qdebug/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp23
-rw-r--r--tests/auto/corelib/io/qdir/CMakeLists.txt99
-rw-r--r--tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/io/qdiriterator/CMakeLists.txt38
-rw-r--r--tests/auto/corelib/io/qfile/.prev_CMakeLists.txt89
-rw-r--r--tests/auto/corelib/io/qfile/CMakeLists.txt89
-rw-r--r--tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qfileinfo/CMakeLists.txt47
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+mac/test50
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+osx/test40
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+mac/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test0
-rw-r--r--tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test (renamed from tests/auto/corelib/io/qfileselector/platforms/+osx/test)0
-rw-r--r--tests/auto/corelib/io/qfileselector/qfileselector.qrc114
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp8
-rw-r--r--tests/auto/corelib/io/qfilesystementry/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qiodevice/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/io/qipaddress/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qlockfile/CMakeLists.txt23
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt11
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qloggingcategory/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/io/qloggingregistry/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/io/qnodebug/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp108
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/io/qsavefile/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/io/qsettings/CMakeLists.txt50
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp6
-rw-r--r--tests/auto/corelib/io/qstandardpaths/CMakeLists.txt26
-rw-r--r--tests/auto/corelib/io/qstorageinfo/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/io/qtemporarydir/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt47
-rw-r--r--tests/auto/corelib/io/qurl/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp57
-rw-r--r--tests/auto/corelib/io/qurlinternal/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp1
-rw-r--r--tests/auto/corelib/io/qurlquery/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/itemmodels/CMakeLists.txt19
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/CMakeLists.txt17
-rw-r--r--tests/auto/corelib/itemmodels/qabstractproxymodel/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/itemmodels/qstringlistmodel/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/itemmodels/qtransposeproxymodel/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/kernel/.prev_CMakeLists.txt40
-rw-r--r--tests/auto/corelib/kernel/CMakeLists.txt40
-rw-r--r--tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qeventloop/CMakeLists.txt26
-rw-r--r--tests/auto/corelib/kernel/qmath/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp80
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp7
-rw-r--r--tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt42
-rw-r--r--tests/auto/corelib/kernel/qmetatype/CMakeLists.txt42
-rw-r--r--tests/auto/corelib/kernel/qmetatype/qmetatype.pro1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp213
-rw-r--r--tests/auto/corelib/kernel/qmimedata/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/kernel/qobject/CMakeLists.txt29
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp66
-rw-r--r--tests/auto/corelib/kernel/qpointer/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt30
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.txt38
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/kernel/qtimer/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/kernel/qtranslator/CMakeLists.txt47
-rw-r--r--tests/auto/corelib/kernel/qvariant/.prev_CMakeLists.txt34
-rw-r--r--tests/auto/corelib/kernel/qvariant/CMakeLists.txt34
-rw-r--r--tests/auto/corelib/kernel/qvariant/qvariant.pro1
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp473
-rw-r--r--tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/mimetypes/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt107
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt103
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt107
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt103
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp8
-rw-r--r--tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/plugin/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt42
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt68
-rw-r--r--tests/auto/corelib/plugin/qlibrary/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt34
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt43
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt104
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt37
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt50
-rw-r--r--tests/auto/corelib/plugin/qplugin/.prev_CMakeLists.txt3
-rw-r--r--tests/auto/corelib/plugin/qplugin/CMakeLists.txt27
-rw-r--r--tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt19
-rw-r--r--tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt19
-rw-r--r--tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt19
-rw-r--r--tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp6
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt30
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt32
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt34
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt41
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/machtest/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt23
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt25
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt31
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt45
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt43
-rw-r--r--tests/auto/corelib/plugin/quuid/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt29
-rw-r--r--tests/auto/corelib/plugin/quuid/test/CMakeLists.txt30
-rw-r--r--tests/auto/corelib/plugin/quuid/testProcessUniqueness/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/CMakeLists.txt17
-rw-r--r--tests/auto/corelib/serialization/json/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/serialization/json/tst_qtjson.cpp78
-rw-r--r--tests/auto/corelib/serialization/qcborstreamreader/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/serialization/qcborvalue_json/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp15
-rw-r--r--tests/auto/corelib/serialization/qdatastream/.prev_CMakeLists.txt35
-rw-r--r--tests/auto/corelib/serialization/qdatastream/CMakeLists.txt35
-rw-r--r--tests/auto/corelib/serialization/qdatastream/qdatastream.pro2
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp160
-rw-r--r--tests/auto/corelib/serialization/qdatastream_core_pixmap/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/qtextstream/CMakeLists.txt6
-rw-r--r--tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/qtextstream/stdinProcess/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt56
-rw-r--r--tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp6
-rw-r--r--tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/statemachine/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/statemachine/qstate/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/CMakeLists.txt22
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp76
-rw-r--r--tests/auto/corelib/text/qbytearraylist/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qbytedatabuffer/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp72
-rw-r--r--tests/auto/corelib/text/qregexp/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qregularexpression/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp52
-rw-r--r--tests/auto/corelib/text/qstring_no_cast_from_bytearray/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder1/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder2/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder3/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder4/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringiterator/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/text/qstringlist/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringmatcher/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/text/qstringref/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/text/qstringref/tst_qstringref.cpp13
-rw-r--r--tests/auto/corelib/thread/CMakeLists.txt24
-rw-r--r--tests/auto/corelib/thread/qatomicint/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp17
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char16_t/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/char32_t/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/int/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/long/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qlonglong/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qptrdiff/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/quintptr/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/qulonglong/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/schar/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/short/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/uchar/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/uint/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/ulong/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/ushort/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/wchar_t/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qatomicpointer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp6
-rw-r--r--tests/auto/corelib/thread/qfuture/.prev_CMakeLists.txt14
-rw-r--r--tests/auto/corelib/thread/qfuture/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/thread/qfuture/qfuture.pro1
-rw-r--r--tests/auto/corelib/thread/qfuturesynchronizer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/thread/qmutex/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/thread/qmutexlocker/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qreadlocker/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qreadwritelock/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qresultstore/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/thread/qresultstore/qresultstore.pro1
-rw-r--r--tests/auto/corelib/thread/qsemaphore/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qthread/.prev_CMakeLists.txt16
-rw-r--r--tests/auto/corelib/thread/qthread/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/thread/qthreadonce/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/thread/qthreadpool/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt21
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashonexit/.prev_CMakeLists.txt15
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/thread/qwaitcondition/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/thread/qwritelocker/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/time/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/time/qcalendar/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/time/qdate/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/time/qdatetime/CMakeLists.txt26
-rw-r--r--tests/auto/corelib/time/qtime/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/time/qtimezone/CMakeLists.txt27
-rw-r--r--tests/auto/corelib/tools/CMakeLists.txt49
-rw-r--r--tests/auto/corelib/tools/collections/collections.pro2
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp385
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro4
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp15
-rw-r--r--tests/auto/corelib/tools/qalgorithms/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qarraydata/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/tools/qarraydata/simplevector.h53
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp634
-rw-r--r--tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qbitarray/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp93
-rw-r--r--tests/auto/corelib/tools/qcache/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/tools/qcontiguouscache/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qexplicitlyshareddatapointer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qflatmap/qflatmap.pro4
-rw-r--r--tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp453
-rw-r--r--tests/auto/corelib/tools/qhash/.prev_CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qhash/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp243
-rw-r--r--tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro7
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp1133
-rw-r--r--tests/auto/corelib/tools/qlist/.gitignore1
-rw-r--r--tests/auto/corelib/tools/qlist/qlist.pro6
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp2115
-rw-r--r--tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qmakearray/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qmap/.prev_CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qmap/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp82
-rw-r--r--tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qmargins/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qmessageauthenticationcode/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro1
-rw-r--r--tests/auto/corelib/tools/qpair/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/tools/qpoint/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qpointf/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qqueue/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qrect/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qringbuffer/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qscopedvaluerollback/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qscopeguard/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp2
-rw-r--r--tests/auto/corelib/tools/qset/.prev_CMakeLists.txt15
-rw-r--r--tests/auto/corelib/tools/qset/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp149
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp30
-rw-r--r--tests/auto/corelib/tools/qsize/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qsizef/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qstl/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qtimeline/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/CMakeLists.txt13
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp2
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp606
-rw-r--r--tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro3
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp151
-rw-r--r--tests/auto/corelib/tools/tools.pro8
326 files changed, 6828 insertions, 6186 deletions
diff --git a/tests/auto/corelib/.prev_CMakeLists.txt b/tests/auto/corelib/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1029b14654
--- /dev/null
+++ b/tests/auto/corelib/.prev_CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from corelib.pro.
+
+add_subdirectory(kernel)
+if(NOT APPLE_UIKIT)
+ add_subdirectory(animation)
+ add_subdirectory(codecs)
+ add_subdirectory(global)
+ add_subdirectory(io)
+ add_subdirectory(itemmodels)
+ add_subdirectory(mimetypes)
+ add_subdirectory(plugin)
+ add_subdirectory(serialization)
+ add_subdirectory(statemachine)
+ add_subdirectory(text)
+ add_subdirectory(thread)
+ add_subdirectory(time)
+ add_subdirectory(tools)
+endif()
diff --git a/tests/auto/corelib/CMakeLists.txt b/tests/auto/corelib/CMakeLists.txt
new file mode 100644
index 0000000000..1029b14654
--- /dev/null
+++ b/tests/auto/corelib/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from corelib.pro.
+
+add_subdirectory(kernel)
+if(NOT APPLE_UIKIT)
+ add_subdirectory(animation)
+ add_subdirectory(codecs)
+ add_subdirectory(global)
+ add_subdirectory(io)
+ add_subdirectory(itemmodels)
+ add_subdirectory(mimetypes)
+ add_subdirectory(plugin)
+ add_subdirectory(serialization)
+ add_subdirectory(statemachine)
+ add_subdirectory(text)
+ add_subdirectory(thread)
+ add_subdirectory(time)
+ add_subdirectory(tools)
+endif()
diff --git a/tests/auto/corelib/animation/CMakeLists.txt b/tests/auto/corelib/animation/CMakeLists.txt
new file mode 100644
index 0000000000..ed238bb4f7
--- /dev/null
+++ b/tests/auto/corelib/animation/CMakeLists.txt
@@ -0,0 +1,6 @@
+add_subdirectory(qabstractanimation)
+add_subdirectory(qanimationgroup)
+add_subdirectory(qparallelanimationgroup)
+add_subdirectory(qpauseanimation)
+add_subdirectory(qsequentialanimationgroup)
+add_subdirectory(qvariantanimation)
diff --git a/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt b/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt
new file mode 100644
index 0000000000..d5f4a9a016
--- /dev/null
+++ b/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qabstractanimation.pro.
+
+#####################################################################
+## tst_qabstractanimation Test:
+#####################################################################
+
+add_qt_test(tst_qabstractanimation
+ SOURCES
+ tst_qabstractanimation.cpp
+)
diff --git a/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt
new file mode 100644
index 0000000000..9b165f7983
--- /dev/null
+++ b/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qanimationgroup.pro.
+
+#####################################################################
+## tst_qanimationgroup Test:
+#####################################################################
+
+add_qt_test(tst_qanimationgroup
+ SOURCES
+ tst_qanimationgroup.cpp
+)
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt
new file mode 100644
index 0000000000..376c9351bd
--- /dev/null
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qparallelanimationgroup.pro.
+
+#####################################################################
+## tst_qparallelanimationgroup Test:
+#####################################################################
+
+add_qt_test(tst_qparallelanimationgroup
+ SOURCES
+ tst_qparallelanimationgroup.cpp
+)
diff --git a/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt b/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt
new file mode 100644
index 0000000000..183127519f
--- /dev/null
+++ b/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qpauseanimation.pro.
+
+#####################################################################
+## tst_qpauseanimation Test:
+#####################################################################
+
+add_qt_test(tst_qpauseanimation
+ SOURCES
+ tst_qpauseanimation.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt
new file mode 100644
index 0000000000..a3381b06b0
--- /dev/null
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsequentialanimationgroup.pro.
+
+#####################################################################
+## tst_qsequentialanimationgroup Test:
+#####################################################################
+
+add_qt_test(tst_qsequentialanimationgroup
+ SOURCES
+ tst_qsequentialanimationgroup.cpp
+)
diff --git a/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt b/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt
new file mode 100644
index 0000000000..1c5f9bd03b
--- /dev/null
+++ b/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qvariantanimation.pro.
+
+#####################################################################
+## tst_qvariantanimation Test:
+#####################################################################
+
+add_qt_test(tst_qvariantanimation
+ SOURCES
+ tst_qvariantanimation.cpp
+)
diff --git a/tests/auto/corelib/codecs/CMakeLists.txt b/tests/auto/corelib/codecs/CMakeLists.txt
new file mode 100644
index 0000000000..272b19f5f8
--- /dev/null
+++ b/tests/auto/corelib/codecs/CMakeLists.txt
@@ -0,0 +1,3 @@
+add_subdirectory(qtextcodec)
+add_subdirectory(utf8)
+
diff --git a/tests/auto/corelib/codecs/qtextcodec/CMakeLists.txt b/tests/auto/corelib/codecs/qtextcodec/CMakeLists.txt
new file mode 100644
index 0000000000..09b46eaa1d
--- /dev/null
+++ b/tests/auto/corelib/codecs/qtextcodec/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_qt_test(tst_qtextcodec SOURCES tst_qtextcodec.cpp)
+
+if(UNIX)
+ add_subdirectory(echo)
+endif()
diff --git a/tests/auto/corelib/codecs/qtextcodec/echo/CMakeLists.txt b/tests/auto/corelib/codecs/qtextcodec/echo/CMakeLists.txt
new file mode 100644
index 0000000000..fc63473cbc
--- /dev/null
+++ b/tests/auto/corelib/codecs/qtextcodec/echo/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from echo.pro.
+
+#####################################################################
+## echo_helper Binary:
+#####################################################################
+
+add_qt_test_helper(echo_helper
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/codecs/utf8/CMakeLists.txt b/tests/auto/corelib/codecs/utf8/CMakeLists.txt
new file mode 100644
index 0000000000..1f794d63d0
--- /dev/null
+++ b/tests/auto/corelib/codecs/utf8/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from utf8.pro.
+
+#####################################################################
+## tst_utf8 Test:
+#####################################################################
+
+add_qt_test(tst_utf8
+ SOURCES
+ tst_utf8.cpp
+ utf8data.cpp
+)
diff --git a/tests/auto/corelib/global/CMakeLists.txt b/tests/auto/corelib/global/CMakeLists.txt
new file mode 100644
index 0000000000..58e083d665
--- /dev/null
+++ b/tests/auto/corelib/global/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_subdirectory(q_func_info)
+add_subdirectory(qflags)
+add_subdirectory(qfloat16)
+add_subdirectory(qgetputenv)
+add_subdirectory(qglobalstatic)
+add_subdirectory(qhooks)
+add_subdirectory(qlogging)
+add_subdirectory(qnumeric)
+add_subdirectory(qrand)
+add_subdirectory(qrandomgenerator)
+add_subdirectory(qtendian)
+
diff --git a/tests/auto/corelib/global/q_func_info/CMakeLists.txt b/tests/auto/corelib/global/q_func_info/CMakeLists.txt
new file mode 100644
index 0000000000..5435c97cf8
--- /dev/null
+++ b/tests/auto/corelib/global/q_func_info/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from q_func_info.pro.
+
+#####################################################################
+## tst_q_func_info Test:
+#####################################################################
+
+add_qt_test(tst_q_func_info
+ SOURCES
+ tst_q_func_info.cpp
+)
diff --git a/tests/auto/corelib/global/qflags/CMakeLists.txt b/tests/auto/corelib/global/qflags/CMakeLists.txt
new file mode 100644
index 0000000000..f1fdb7a5f8
--- /dev/null
+++ b/tests/auto/corelib/global/qflags/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qflags.pro.
+
+#####################################################################
+## tst_qflags Test:
+#####################################################################
+
+add_qt_test(tst_qflags
+ SOURCES
+ tst_qflags.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/global/qfloat16/CMakeLists.txt b/tests/auto/corelib/global/qfloat16/CMakeLists.txt
new file mode 100644
index 0000000000..36e15d8225
--- /dev/null
+++ b/tests/auto/corelib/global/qfloat16/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qfloat16.pro.
+
+#####################################################################
+## tst_qfloat16 Test:
+#####################################################################
+
+add_qt_test(tst_qfloat16
+ SOURCES
+ tst_qfloat16.cpp
+)
diff --git a/tests/auto/corelib/global/qgetputenv/CMakeLists.txt b/tests/auto/corelib/global/qgetputenv/CMakeLists.txt
new file mode 100644
index 0000000000..c5f3a53810
--- /dev/null
+++ b/tests/auto/corelib/global/qgetputenv/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qgetputenv.pro.
+
+#####################################################################
+## tst_qgetputenv Test:
+#####################################################################
+
+add_qt_test(tst_qgetputenv
+ SOURCES
+ tst_qgetputenv.cpp
+)
diff --git a/tests/auto/corelib/global/qglobal/CMakeLists.txt b/tests/auto/corelib/global/qglobal/CMakeLists.txt
new file mode 100644
index 0000000000..1efaaa71d0
--- /dev/null
+++ b/tests/auto/corelib/global/qglobal/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qglobal.pro.
+
+#####################################################################
+## tst_qglobal Test:
+#####################################################################
+
+add_qt_test(tst_qglobal
+ SOURCES
+ qglobal.c
+ tst_qglobal.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index b33dec8a61..047130d5ea 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -49,7 +49,6 @@ private slots:
void qConstructorFunction();
void qCoreAppStartupFunction();
void qCoreAppStartupFunctionRestart();
- void qAlignOf();
void integerForSize();
void qprintable();
void qprintable_data();
@@ -434,106 +433,6 @@ template <class T> struct AlignmentInStruct { T dummy; };
typedef int (*fun) ();
typedef int (Empty::*memFun) ();
-#define TEST_AlignOf(type, alignment) \
- do { \
- TEST_AlignOf_impl(type, alignment); \
- \
- TEST_AlignOf_impl(type &, alignment); \
- TEST_AlignOf_RValueRef(type &&, alignment); \
- \
- TEST_AlignOf_impl(type [5], alignment); \
- TEST_AlignOf_impl(type (&) [5], alignment); \
- \
- TEST_AlignOf_impl(AlignmentInStruct<type>, alignment); \
- \
- /* Some internal sanity validation, just for fun */ \
- TEST_AlignOf_impl(AlignmentInStruct<type [5]>, alignment); \
- TEST_AlignOf_impl(AlignmentInStruct<type &>, Q_ALIGNOF(void *)); \
- TEST_AlignOf_impl(AlignmentInStruct<type (&) [5]>, \
- Q_ALIGNOF(void *)); \
- TEST_AlignOf_RValueRef(AlignmentInStruct<type &&>, \
- Q_ALIGNOF(void *)); \
- } while (false) \
- /**/
-
-#define TEST_AlignOf_RValueRef(type, alignment) \
- TEST_AlignOf_impl(type, alignment)
-
-#define TEST_AlignOf_impl(type, alignment) \
- do { \
- QCOMPARE(Q_ALIGNOF(type), size_t(alignment)); \
- /* Compare to native operator for compilers that support it,
- otherwise... erm... check consistency! :-) */ \
- QCOMPARE(alignof(type), Q_ALIGNOF(type)); \
- } while (false)
- /**/
-
-void tst_QGlobal::qAlignOf()
-{
- // Built-in types, except 64-bit integers and double
- TEST_AlignOf(char, 1);
- TEST_AlignOf(signed char, 1);
- TEST_AlignOf(unsigned char, 1);
- TEST_AlignOf(qint8, 1);
- TEST_AlignOf(quint8, 1);
- TEST_AlignOf(qint16, 2);
- TEST_AlignOf(quint16, 2);
- TEST_AlignOf(qint32, 4);
- TEST_AlignOf(quint32, 4);
- TEST_AlignOf(void *, sizeof(void *));
-
- // Depends on platform and compiler, disabling test for now
- // TEST_AlignOf(long double, 16);
-
- // Empty struct
- TEST_AlignOf(Empty, 1);
-
- // Function pointers
- TEST_AlignOf(fun, Q_ALIGNOF(void *));
- TEST_AlignOf(memFun, Q_ALIGNOF(void *));
-
-
- // 64-bit integers and double
- TEST_AlignOf_impl(qint64, 8);
- TEST_AlignOf_impl(quint64, 8);
- TEST_AlignOf_impl(double, 8);
-
- TEST_AlignOf_impl(qint64 &, 8);
- TEST_AlignOf_impl(quint64 &, 8);
- TEST_AlignOf_impl(double &, 8);
-
- TEST_AlignOf_RValueRef(qint64 &&, 8);
- TEST_AlignOf_RValueRef(quint64 &&, 8);
- TEST_AlignOf_RValueRef(double &&, 8);
-
- // 32-bit x86 ABI idiosyncrasies
-#if defined(Q_PROCESSOR_X86_32) && !defined(Q_OS_WIN)
- TEST_AlignOf_impl(AlignmentInStruct<qint64>, 4);
-#else
- TEST_AlignOf_impl(AlignmentInStruct<qint64>, 8);
-#endif
-
- TEST_AlignOf_impl(AlignmentInStruct<quint64>, Q_ALIGNOF(AlignmentInStruct<qint64>));
- TEST_AlignOf_impl(AlignmentInStruct<double>, Q_ALIGNOF(AlignmentInStruct<qint64>));
-
- // 32-bit x86 ABI, Clang disagrees with gcc
-#if !defined(Q_PROCESSOR_X86_32) || !defined(Q_CC_CLANG) || defined(Q_OS_ANDROID)
- TEST_AlignOf_impl(qint64 [5], Q_ALIGNOF(qint64));
-#else
- TEST_AlignOf_impl(qint64 [5], Q_ALIGNOF(AlignmentInStruct<qint64>));
-#endif
-
- TEST_AlignOf_impl(qint64 (&) [5], Q_ALIGNOF(qint64 [5]));
- TEST_AlignOf_impl(quint64 [5], Q_ALIGNOF(quint64 [5]));
- TEST_AlignOf_impl(quint64 (&) [5], Q_ALIGNOF(quint64 [5]));
- TEST_AlignOf_impl(double [5], Q_ALIGNOF(double [5]));
- TEST_AlignOf_impl(double (&) [5], Q_ALIGNOF(double [5]));
-}
-
-#undef TEST_AlignOf
-#undef TEST_AlignOf_RValueRef
-#undef TEST_AlignOf_impl
-
void tst_QGlobal::integerForSize()
{
// compile-only test:
diff --git a/tests/auto/corelib/global/qglobalstatic/CMakeLists.txt b/tests/auto/corelib/global/qglobalstatic/CMakeLists.txt
new file mode 100644
index 0000000000..7e8eee14d3
--- /dev/null
+++ b/tests/auto/corelib/global/qglobalstatic/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qglobalstatic.pro.
+
+#####################################################################
+## tst_qglobalstatic Test:
+#####################################################################
+
+add_qt_test(tst_qglobalstatic
+ EXCEPTIONS
+ SOURCES
+ tst_qglobalstatic.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/global/qhooks/CMakeLists.txt b/tests/auto/corelib/global/qhooks/CMakeLists.txt
new file mode 100644
index 0000000000..c86faba75f
--- /dev/null
+++ b/tests/auto/corelib/global/qhooks/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qhooks.pro.
+
+#####################################################################
+## tst_qhooks Test:
+#####################################################################
+
+add_qt_test(tst_qhooks
+ SOURCES
+ tst_qhooks.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/global/qlogging/CMakeLists.txt b/tests/auto/corelib/global/qlogging/CMakeLists.txt
new file mode 100644
index 0000000000..bd0ab6aeca
--- /dev/null
+++ b/tests/auto/corelib/global/qlogging/CMakeLists.txt
@@ -0,0 +1,25 @@
+if(NOT WINRT)
+ add_qt_executable(qlogging_helper
+ NO_INSTALL # special case
+ OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # special case
+ SOURCES app/main.cpp
+ DEFINES QT_MESSAGELOGCONTEXT
+ LIBRARIES Qt::Core)
+
+ #special case begin
+ # Fixes required for the backtrace stack to be correct
+ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ target_link_options(qlogging_helper PRIVATE -rdynamic)
+ endif()
+ set_target_properties(qlogging_helper PROPERTIES CXX_VISIBILITY_PRESET default)
+ # special case end
+endif()
+
+add_qt_test(tst_qlogging SOURCES tst_qlogging.cpp
+ DEFINES
+ QT_MESSAGELOGCONTEXT
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ HELPER_BINARY="${CMAKE_CURRENT_BINARY_DIR}/qlogging_helper" # special case
+)
+
+target_compile_definitions(tst_qlogging PRIVATE QT_CMAKE_BUILD) # special case # to fix the binary name
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro
index 91896d4494..81445247e0 100644
--- a/tests/auto/corelib/global/qlogging/test/test.pro
+++ b/tests/auto/corelib/global/qlogging/test/test.pro
@@ -19,3 +19,4 @@ SOURCES = ../tst_qlogging.cpp
DEFINES += QT_MESSAGELOGCONTEXT
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+DEFINES += HELPER_BINARY=\\\"helper\\\"
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 3af637d13a..6c6f3a2168 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -792,10 +792,17 @@ void tst_qmessagehandler::qMessagePattern_data()
#define QT_NAMESPACE_STR ""
#endif
+
+#ifdef QT_CMAKE_BUILD
+#define BACKTRACE_HELPER_NAME "qlogging_helper"
+#else
+#define BACKTRACE_HELPER_NAME "helper"
+#endif
+
#ifndef QT_NO_DEBUG
QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << (QList<QByteArray>()
// MyClass::qt_static_metacall is explicitly marked as hidden in the Q_OBJECT macro
- << "[MyClass::myFunction|MyClass::mySlot1|?helper?|" QT_NAMESPACE_STR "QMetaMethod::invoke|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34");
+ << "[MyClass::myFunction|MyClass::mySlot1|?" BACKTRACE_HELPER_NAME "?|" QT_NAMESPACE_STR "QMetaMethod::invoke|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34");
#endif
QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>()
@@ -820,9 +827,9 @@ void tst_qmessagehandler::qMessagePattern()
QProcess process;
#ifndef Q_OS_ANDROID
- const QString appExe(QLatin1String("helper"));
+ const QString appExe(QLatin1String(HELPER_BINARY));
#else
- const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/libhelper.so"));
+ const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so"));
#endif
//
@@ -870,7 +877,7 @@ void tst_qmessagehandler::setMessagePattern()
QProcess process;
#ifndef Q_OS_ANDROID
- const QString appExe(QLatin1String("helper"));
+ const QString appExe(QLatin1String(HELPER_BINARY));
#else
const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/libhelper.so"));
#endif
diff --git a/tests/auto/corelib/global/qnumeric/CMakeLists.txt b/tests/auto/corelib/global/qnumeric/CMakeLists.txt
new file mode 100644
index 0000000000..8a857c5622
--- /dev/null
+++ b/tests/auto/corelib/global/qnumeric/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Generated from qnumeric.pro.
+
+#####################################################################
+## tst_qnumeric Test:
+#####################################################################
+
+add_qt_test(tst_qnumeric
+ SOURCES
+ tst_qnumeric.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qnumeric CONDITION ICC
+ COMPILE_OPTIONS
+ -fp-model
+ strict
+)
+
+extend_target(tst_qnumeric CONDITION intel_icl
+ COMPILE_OPTIONS
+ /fp:strict
+)
diff --git a/tests/auto/corelib/global/qrand/CMakeLists.txt b/tests/auto/corelib/global/qrand/CMakeLists.txt
new file mode 100644
index 0000000000..80e8132809
--- /dev/null
+++ b/tests/auto/corelib/global/qrand/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qrand.pro.
+
+#####################################################################
+## tst_qrand Test:
+#####################################################################
+
+add_qt_test(tst_qrand
+ SOURCES
+ tst_qrand.cpp
+)
diff --git a/tests/auto/corelib/global/qrandomgenerator/CMakeLists.txt b/tests/auto/corelib/global/qrandomgenerator/CMakeLists.txt
new file mode 100644
index 0000000000..edd2efe760
--- /dev/null
+++ b/tests/auto/corelib/global/qrandomgenerator/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qrandomgenerator.pro.
+
+#####################################################################
+## tst_qrandomgenerator Test:
+#####################################################################
+
+add_qt_test(tst_qrandomgenerator
+ SOURCES
+ tst_qrandomgenerator.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
index 6f9dcc08f9..f997a40119 100644
--- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -27,7 +27,6 @@
****************************************************************************/
#include <QtTest>
-#include <qlinkedlist.h>
#include <qobject.h>
#include <qrandom.h>
#include <qvector.h>
diff --git a/tests/auto/corelib/global/qtendian/CMakeLists.txt b/tests/auto/corelib/global/qtendian/CMakeLists.txt
new file mode 100644
index 0000000000..9efb17712e
--- /dev/null
+++ b/tests/auto/corelib/global/qtendian/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qtendian.pro.
+
+#####################################################################
+## tst_qtendian Test:
+#####################################################################
+
+add_qt_test(tst_qtendian
+ SOURCES
+ tst_qtendian.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/.prev_CMakeLists.txt b/tests/auto/corelib/io/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..5baf4c35de
--- /dev/null
+++ b/tests/auto/corelib/io/.prev_CMakeLists.txt
@@ -0,0 +1,56 @@
+# Generated from io.pro.
+
+if(QT_FEATURE_private_tests)
+ add_subdirectory(qabstractfileengine)
+ add_subdirectory(qfileinfo)
+ add_subdirectory(qipaddress)
+ add_subdirectory(qloggingregistry)
+ add_subdirectory(qurlinternal)
+endif()
+add_subdirectory(qbuffer)
+add_subdirectory(qdataurl)
+add_subdirectory(qdiriterator)
+add_subdirectory(qfile)
+add_subdirectory(largefile)
+add_subdirectory(qfileselector)
+add_subdirectory(qfilesystemmetadata)
+add_subdirectory(qloggingcategory)
+add_subdirectory(qnodebug)
+add_subdirectory(qsavefile)
+add_subdirectory(qstandardpaths)
+add_subdirectory(qtemporarydir)
+add_subdirectory(qtemporaryfile)
+add_subdirectory(qurlquery)
+if(TARGET Qt::Concurrent)
+ add_subdirectory(qdebug)
+ add_subdirectory(qlockfile)
+ add_subdirectory(qurl)
+endif()
+if(NOT ANDROID)
+ add_subdirectory(qdir)
+ add_subdirectory(qresourceengine)
+endif()
+if(QT_FEATURE_private_tests OR UNIX)
+ add_subdirectory(qfilesystementry)
+endif()
+if(QT_FEATURE_filesystemwatcher)
+ add_subdirectory(qfilesystemwatcher)
+endif()
+if(TARGET Qt::Network)
+ add_subdirectory(qiodevice)
+endif()
+if(QT_FEATURE_process AND TARGET Qt::Network AND NOT ANDROID)
+ add_subdirectory(qprocess)
+endif()
+if(QT_FEATURE_process)
+ add_subdirectory(qprocess-noapplication)
+endif()
+if(QT_FEATURE_processenvironment)
+ add_subdirectory(qprocessenvironment)
+endif()
+if(QT_FEATURE_settings AND TARGET Qt::Gui)
+ add_subdirectory(qsettings)
+endif()
+if(NOT WINRT)
+ add_subdirectory(qstorageinfo)
+endif()
diff --git a/tests/auto/corelib/io/CMakeLists.txt b/tests/auto/corelib/io/CMakeLists.txt
new file mode 100644
index 0000000000..cb1246c3a2
--- /dev/null
+++ b/tests/auto/corelib/io/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Generated from io.pro.
+
+if(QT_FEATURE_private_tests)
+ add_subdirectory(qabstractfileengine)
+ add_subdirectory(qfileinfo)
+ add_subdirectory(qipaddress)
+ add_subdirectory(qloggingregistry)
+ add_subdirectory(qurlinternal)
+endif()
+add_subdirectory(qbuffer)
+add_subdirectory(qdataurl)
+add_subdirectory(qdiriterator)
+add_subdirectory(qfile)
+add_subdirectory(largefile)
+# add_subdirectory(qfileselector) # special case needs fixes
+add_subdirectory(qfilesystemmetadata)
+add_subdirectory(qloggingcategory)
+add_subdirectory(qnodebug)
+add_subdirectory(qsavefile)
+add_subdirectory(qstandardpaths)
+add_subdirectory(qtemporarydir)
+add_subdirectory(qtemporaryfile)
+add_subdirectory(qurlquery)
+if(TARGET Qt::Concurrent)
+ add_subdirectory(qdebug)
+ add_subdirectory(qlockfile)
+ add_subdirectory(qurl)
+endif()
+if(NOT ANDROID)
+ add_subdirectory(qdir)
+ # add_subdirectory(qresourceengine) # special case needs fixes
+endif()
+if(QT_FEATURE_private_tests OR UNIX)
+ add_subdirectory(qfilesystementry)
+endif()
+if(QT_FEATURE_filesystemwatcher)
+ add_subdirectory(qfilesystemwatcher)
+endif()
+if(TARGET Qt::Network)
+ add_subdirectory(qiodevice)
+endif()
+if(QT_FEATURE_process AND TARGET Qt::Network AND NOT ANDROID)
+ # add_subdirectory(qprocess) # special case needs fixes
+endif()
+if(QT_FEATURE_process)
+ add_subdirectory(qprocess-noapplication)
+endif()
+if(QT_FEATURE_processenvironment)
+ add_subdirectory(qprocessenvironment)
+endif()
+if(QT_FEATURE_settings AND TARGET Qt::Gui)
+ add_subdirectory(qsettings)
+endif()
+if(NOT WINRT)
+ add_subdirectory(qstorageinfo)
+endif()
diff --git a/tests/auto/corelib/io/largefile/CMakeLists.txt b/tests/auto/corelib/io/largefile/CMakeLists.txt
new file mode 100644
index 0000000000..cb1eba8526
--- /dev/null
+++ b/tests/auto/corelib/io/largefile/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from largefile.pro.
+
+#####################################################################
+## tst_largefile Test:
+#####################################################################
+
+add_qt_test(tst_largefile
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_largefile.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+)
diff --git a/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt b/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt
new file mode 100644
index 0000000000..1b7a11d657
--- /dev/null
+++ b/tests/auto/corelib/io/qabstractfileengine/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Generated from qabstractfileengine.pro.
+
+#####################################################################
+## tst_qabstractfileengine Test:
+#####################################################################
+
+add_qt_test(tst_qabstractfileengine
+ SOURCES
+ tst_qabstractfileengine.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+# Resources:
+set(qabstractfileengine_resource_files
+ "resources/"
+)
+
+add_qt_resource(tst_qabstractfileengine "qabstractfileengine"
+ PREFIX
+ "/tst_qabstractfileengine/"
+ FILES
+ ${qabstractfileengine_resource_files}
+)
+
diff --git a/tests/auto/corelib/io/qbuffer/CMakeLists.txt b/tests/auto/corelib/io/qbuffer/CMakeLists.txt
new file mode 100644
index 0000000000..40502dd004
--- /dev/null
+++ b/tests/auto/corelib/io/qbuffer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qbuffer.pro.
+
+#####################################################################
+## tst_qbuffer Test:
+#####################################################################
+
+add_qt_test(tst_qbuffer
+ SOURCES
+ tst_qbuffer.cpp
+)
diff --git a/tests/auto/corelib/io/qdataurl/CMakeLists.txt b/tests/auto/corelib/io/qdataurl/CMakeLists.txt
new file mode 100644
index 0000000000..507852a11e
--- /dev/null
+++ b/tests/auto/corelib/io/qdataurl/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qdataurl.pro.
+
+#####################################################################
+## tst_qdataurl Test:
+#####################################################################
+
+add_qt_test(tst_qdataurl
+ SOURCES
+ tst_qdataurl.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/qdebug/CMakeLists.txt b/tests/auto/corelib/io/qdebug/CMakeLists.txt
new file mode 100644
index 0000000000..d7fa4fb7cd
--- /dev/null
+++ b/tests/auto/corelib/io/qdebug/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qdebug.pro.
+
+#####################################################################
+## tst_qdebug Test:
+#####################################################################
+
+add_qt_test(tst_qdebug
+ SOURCES
+ tst_qdebug.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 584e66a7db..7b9e614cf7 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -66,6 +66,7 @@ private slots:
void resetFormat() const;
void defaultMessagehandler() const;
void threadSafety() const;
+ void toString() const;
};
void tst_QDebug::assignment() const
@@ -740,6 +741,28 @@ void tst_QDebug::threadSafety() const
}
}
+void tst_QDebug::toString() const
+{
+ // By reference.
+ {
+ MyPoint point(3, 4);
+ QString expectedString;
+ QDebug stream(&expectedString);
+ stream << point;
+ QCOMPARE(QDebug::toString(point), expectedString);
+ }
+
+ // By pointer.
+ {
+ QObject qobject;
+ qobject.setObjectName("test");
+ QString expectedString;
+ QDebug stream(&expectedString);
+ stream << &qobject;
+ QCOMPARE(QDebug::toString(&qobject), expectedString);
+ }
+}
+
// Should compile: instentiation of unrelated operator<< should not cause cause compilation
// error in QDebug operators (QTBUG-47375)
class TestClassA {};
diff --git a/tests/auto/corelib/io/qdir/CMakeLists.txt b/tests/auto/corelib/io/qdir/CMakeLists.txt
new file mode 100644
index 0000000000..84136283c1
--- /dev/null
+++ b/tests/auto/corelib/io/qdir/CMakeLists.txt
@@ -0,0 +1,99 @@
+# Generated from qdir.pro.
+
+#####################################################################
+## tst_qdir Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "testdir")
+list(APPEND test_data "testData")
+list(APPEND test_data "searchdir")
+list(APPEND test_data "resources")
+list(APPEND test_data "entrylist")
+list(APPEND test_data "types")
+list(APPEND test_data "tst_qdir.cpp")
+
+add_qt_test(tst_qdir
+ SOURCES
+ tst_qdir.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set(qdir_resource_files
+ "resources/entryList/"
+)
+
+add_qt_resource(tst_qdir "qdir"
+ PREFIX
+ "/tst_qdir/"
+ FILES
+ ${qdir_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:qdir.pro:APPLE_IOS:
+# QMAKE_INFO_PLIST = "Info.plist"
+
+extend_target(tst_qdir CONDITION CONFIG___contains___builtin_testdata
+ DEFINES
+ BUILTIN_TESTDATA
+)
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(android_testdata_resource_files
+ "entrylist/directory/dummy"
+ "entrylist/file"
+ "resources/entryList/file1.data"
+ "resources/entryList/file2.data"
+ "resources/entryList/file3.data"
+ "resources/entryList/file4.nothing"
+ "searchdir/subdir1/picker.png"
+ "searchdir/subdir2/picker.png"
+ "testData/empty"
+ "testdir/dir/qdir.pro"
+ "testdir/dir/qrc_qdir.cpp"
+ "testdir/dir/tmp/empty"
+ "testdir/dir/tst_qdir.cpp"
+ "testdir/spaces/foo. bar"
+ "testdir/spaces/foo.bar"
+ "tst_qdir.cpp"
+ "types/a"
+ "types/a.a"
+ "types/a.b"
+ "types/a.c"
+ "types/b"
+ "types/b.a"
+ "types/b.b"
+ "types/b.c"
+ "types/c"
+ "types/c.a"
+ "types/c.b"
+ "types/c.c"
+ "types/d.a/dummy"
+ "types/d.b/dummy"
+ "types/d.c/dummy"
+ "types/d/dummy"
+ "types/e.a/dummy"
+ "types/e.b/dummy"
+ "types/e.c/dummy"
+ "types/e/dummy"
+ "types/f.a/dummy"
+ "types/f.b/dummy"
+ "types/f.c/dummy"
+ "types/f/dummy"
+ )
+
+ add_qt_resource(tst_qdir "android_testdata"
+ PREFIX
+ "/android_testdata"
+ FILES
+ ${android_testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt b/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt
new file mode 100644
index 0000000000..e50fcb60ca
--- /dev/null
+++ b/tests/auto/corelib/io/qdir/testdir/dir/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qdir.pro.
+
+#####################################################################
+## qdir Binary:
+#####################################################################
+
+add_qt_executable(qdir
+ GUI
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/io/qdiriterator/CMakeLists.txt b/tests/auto/corelib/io/qdiriterator/CMakeLists.txt
new file mode 100644
index 0000000000..2e120b4621
--- /dev/null
+++ b/tests/auto/corelib/io/qdiriterator/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Generated from qdiriterator.pro.
+
+#####################################################################
+## tst_qdiriterator Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "entrylist")
+
+add_qt_test(tst_qdiriterator
+ SOURCES
+ tst_qdiriterator.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set(qdiriterator_resource_files
+ "entrylist/directory/dummy"
+ "entrylist/file"
+)
+
+add_qt_resource(tst_qdiriterator "qdiriterator"
+ PREFIX
+ "/testdata/"
+ FILES
+ ${qdiriterator_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qdiriterator CONDITION CONFIG___contains___builtin_testdata
+ DEFINES
+ BUILTIN_TESTDATA
+)
diff --git a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..b976754629
--- /dev/null
+++ b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt
@@ -0,0 +1,89 @@
+# Generated from qfile.pro.
+
+#####################################################################
+## tst_qfile Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "BLACKLIST")
+list(APPEND test_data "dosfile.txt")
+list(APPEND test_data "noendofline.txt")
+list(APPEND test_data "testfile.txt")
+list(APPEND test_data "testlog.txt")
+list(APPEND test_data "two.dots.file")
+list(APPEND test_data "tst_qfile.cpp")
+list(APPEND test_data "Makefile")
+list(APPEND test_data "forCopying.txt")
+list(APPEND test_data "forRenaming.txt")
+list(APPEND test_data "resources/file1.ext1")
+
+add_qt_test(tst_qfile
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qfile.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+ LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set(qfile_resource_files
+ "resources/"
+)
+
+add_qt_resource(tst_qfile "qfile"
+ PREFIX
+ "/tst_qfileinfo/"
+ FILES
+ ${qfile_resource_files}
+)
+set(rename-fallback_resource_files
+ "rename-fallback.qrc"
+)
+
+add_qt_resource(tst_qfile "rename-fallback"
+ PREFIX
+ "/"
+ FILES
+ ${rename-fallback_resource_files}
+)
+set(copy-fallback_resource_files
+ "copy-fallback.qrc"
+)
+
+add_qt_resource(tst_qfile "copy-fallback"
+ PREFIX
+ "/"
+ FILES
+ ${copy-fallback_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qfile CONDITION TARGET Qt::Network
+ PUBLIC_LIBRARIES
+ Qt::Network
+)
+
+extend_target(tst_qfile CONDITION NOT TARGET Qt::Network
+ DEFINES
+ QT_NO_NETWORK
+)
+
+extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata
+ DEFINES
+ BUILTIN_TESTDATA
+)
+
+extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ ole32
+ uuid
+)
+if(NOT WINRT)
+ add_subdirectory(stdinprocess)
+endif()
diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt
new file mode 100644
index 0000000000..03b648d76f
--- /dev/null
+++ b/tests/auto/corelib/io/qfile/CMakeLists.txt
@@ -0,0 +1,89 @@
+# Generated from qfile.pro.
+
+#####################################################################
+## tst_qfile Test:
+#####################################################################
+
+# Collect test data
+# list(APPEND test_data "BLACKLIST") # special case remove
+list(APPEND test_data "dosfile.txt")
+list(APPEND test_data "noendofline.txt")
+list(APPEND test_data "testfile.txt")
+list(APPEND test_data "testlog.txt")
+list(APPEND test_data "two.dots.file")
+list(APPEND test_data "tst_qfile.cpp")
+# list(APPEND test_data "Makefile") # special case remove
+list(APPEND test_data "forCopying.txt")
+list(APPEND test_data "forRenaming.txt")
+list(APPEND test_data "resources/file1.ext1")
+
+add_qt_test(tst_qfile
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qfile.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+ LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set(qfile_resource_files
+ "resources/"
+)
+
+add_qt_resource(tst_qfile "qfile"
+ PREFIX
+ "/tst_qfileinfo/"
+ FILES
+ ${qfile_resource_files}
+)
+set(rename-fallback_resource_files
+ "rename-fallback.qrc"
+)
+
+add_qt_resource(tst_qfile "rename-fallback"
+ PREFIX
+ "/"
+ FILES
+ ${rename-fallback_resource_files}
+)
+set(copy-fallback_resource_files
+ "copy-fallback.qrc"
+)
+
+add_qt_resource(tst_qfile "copy-fallback"
+ PREFIX
+ "/"
+ FILES
+ ${copy-fallback_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qfile CONDITION TARGET Qt::Network
+ PUBLIC_LIBRARIES
+ Qt::Network
+)
+
+extend_target(tst_qfile CONDITION NOT TARGET Qt::Network
+ DEFINES
+ QT_NO_NETWORK
+)
+
+extend_target(tst_qfile CONDITION CONFIG___contains___builtin_testdata
+ DEFINES
+ BUILTIN_TESTDATA
+)
+
+extend_target(tst_qfile CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ ole32
+ uuid
+)
+if(NOT WINRT)
+ add_subdirectory(stdinprocess)
+endif()
diff --git a/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt b/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt
new file mode 100644
index 0000000000..994c2fc268
--- /dev/null
+++ b/tests/auto/corelib/io/qfile/stdinprocess/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from stdinprocess.pro.
+
+#####################################################################
+## stdinprocess_helper Binary:
+#####################################################################
+
+add_qt_test_helper(stdinprocess_helper
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt
new file mode 100644
index 0000000000..a6cf3a38f1
--- /dev/null
+++ b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from qfileinfo.pro.
+
+#####################################################################
+## tst_qfileinfo Test:
+#####################################################################
+
+add_qt_test(tst_qfileinfo
+ SOURCES
+ tst_qfileinfo.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+# Resources:
+set(qfileinfo_resource_files
+ "resources/"
+)
+
+add_qt_resource(tst_qfileinfo "qfileinfo"
+ PREFIX
+ "/tst_qfileinfo/"
+ FILES
+ ${qfileinfo_resource_files}
+)
+set(testdata_resource_files
+ "resources/file1"
+ "resources/file1.ext1"
+ "resources/file1.ext1.ext2"
+ "tst_qfileinfo.cpp"
+)
+
+add_qt_resource(tst_qfileinfo "testdata"
+ PREFIX
+ "/testdata"
+ FILES
+ ${testdata_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qfileinfo CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ advapi32
+ netapi32
+)
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 09ef0ea44f..ebb9a0a44c 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -116,7 +116,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe
reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) {
result = GetLastError();
QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", "
- << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result
+ << nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result
<< ": " << qt_error_string(int(result));
}
return result;
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test
+++ /dev/null
diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
index e69de29bb2..e69de29bb2 100644
--- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test
+++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test
diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
index 54b2e0a0e2..f3b3ede575 100644
--- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc
+++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc
@@ -1,65 +1,51 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>extras/test</file>
- <file>extras/test2</file>
- <file>extras/+custom1/test</file>
- <file>extras/+custom1/test3</file>
- <file>extras/+custom2/test</file>
- <file>extras/+custom3/test</file>
- <file>extras/+custom3/+custom2/test</file>
- <file>extras/+custom3/+custom4/test</file>
- <file>extras/+custom3/+custom5/test</file>
- <file>extras/+custom5/+custom3/test</file>
-
- <!-- platforms/test: deepest possible selection -->
- <file>platforms/test</file>
- <file>platforms/+unix/+android/test</file>
- <file>platforms/+unix/+darwin/+mac/+ios/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file>
- <file>platforms/+unix/+darwin/+mac/+osx/test</file>
- <file>platforms/+unix/+darwin/+mac/test</file>
- <file>platforms/+unix/+darwin/test</file>
- <file>platforms/+unix/+haiku/test</file>
- <file>platforms/+unix/+linux/test</file>
- <file>platforms/+unix/+qnx/test</file>
- <file>platforms/+unix/test</file>
- <file>platforms/+windows/+wince/test</file>
- <file>platforms/+windows/+winnt/test</file>
- <file>platforms/+windows/+winrt/test</file>
- <file>platforms/+windows/test</file>
- <file>platforms/+android/test</file>
- <file>platforms/+ios/test</file>
- <file>platforms/+macos/test</file>
- <file>platforms/+osx/test</file>
- <file>platforms/+darwin/test</file>
- <file>platforms/+mac/test</file>
- <file>platforms/+haiku/test</file>
- <file>platforms/+linux/test</file>
- <file>platforms/+qnx/test</file>
- <file>platforms/+wince/test</file>
- <file>platforms/+winrt/test</file>
-
- <!-- platforms/test2: shallow selection for the deepest selector -->
- <file>platforms/test2</file>
- <file>platforms/+android/test2</file>
- <file>platforms/+ios/test2</file>
- <file>platforms/+macos/test2</file>
- <file>platforms/+haiku/test2</file>
- <file>platforms/+linux/test2</file>
- <file>platforms/+qnx/test2</file>
- <file>platforms/+wince/test2</file>
- <file>platforms/+winnt/test2</file>
- <file>platforms/+winrt/test2</file>
-
- <!-- platforms/test3: selection for the family only -->
- <file>platforms/test3</file>
- <file>platforms/+windows/test3</file>
- <file>platforms/+unix/test3</file>
-
- <!-- platforms/test4 and 5: special cases for macOS -->
- <file>platforms/test4</file>
- <file>platforms/+osx/test4</file>
- <file>platforms/test5</file>
- <file>platforms/+mac/test5</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>extras/test</file>
+ <file>extras/test2</file>
+ <file>extras/+custom1/test</file>
+ <file>extras/+custom1/test3</file>
+ <file>extras/+custom2/test</file>
+ <file>extras/+custom3/test</file>
+ <file>extras/+custom3/+custom2/test</file>
+ <file>extras/+custom3/+custom4/test</file>
+ <file>extras/+custom3/+custom5/test</file>
+ <file>extras/+custom5/+custom3/test</file>
+ <file>platforms/test</file>
+ <file>platforms/+unix/+android/test</file>
+ <file>platforms/+unix/+darwin/test</file>
+ <file>platforms/+unix/+haiku/test</file>
+ <file>platforms/+unix/+linux/test</file>
+ <file>platforms/+unix/+qnx/test</file>
+ <file>platforms/+unix/test</file>
+ <file>platforms/+windows/+wince/test</file>
+ <file>platforms/+windows/+winnt/test</file>
+ <file>platforms/+windows/+winrt/test</file>
+ <file>platforms/+windows/test</file>
+ <file>platforms/+android/test</file>
+ <file>platforms/+ios/test</file>
+ <file>platforms/+macos/test</file>
+ <file>platforms/+darwin/test</file>
+ <file>platforms/+haiku/test</file>
+ <file>platforms/+linux/test</file>
+ <file>platforms/+qnx/test</file>
+ <file>platforms/+wince/test</file>
+ <file>platforms/+winrt/test</file>
+ <file>platforms/test2</file>
+ <file>platforms/+android/test2</file>
+ <file>platforms/+ios/test2</file>
+ <file>platforms/+macos/test2</file>
+ <file>platforms/+haiku/test2</file>
+ <file>platforms/+linux/test2</file>
+ <file>platforms/+qnx/test2</file>
+ <file>platforms/+wince/test2</file>
+ <file>platforms/+winnt/test2</file>
+ <file>platforms/+winrt/test2</file>
+ <file>platforms/test3</file>
+ <file>platforms/+windows/test3</file>
+ <file>platforms/+unix/test3</file>
+ <file>platforms/test4</file>
+ <file>platforms/test5</file>
+ <file>platforms/+unix/+darwin/+macos/test</file>
+ <file>platforms/+unix/+darwin/+ios/test</file>
+ </qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 11b1fdaeeb..bac7a69e0f 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data()
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
<< expectedPlatform3File;
-#ifdef Q_OS_MACOS
- // special case for compatibility code
- QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList()
- << ":/platforms/+osx/test4";
- QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList()
- << ":/platforms/+mac/test5";
-#endif
-
QString resourceTestPath(":/extras/test");
QString custom1("custom1");
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
diff --git a/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt b/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt
new file mode 100644
index 0000000000..e989315bdd
--- /dev/null
+++ b/tests/auto/corelib/io/qfilesystementry/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qfilesystementry.pro.
+
+#####################################################################
+## tst_qfilesystementry Test:
+#####################################################################
+
+add_qt_test(tst_qfilesystementry
+ SOURCES
+ ${QT_SOURCE_TREE}/src/corelib/io/qfilesystementry.cpp ${QT_SOURCE_TREE}/src/corelib/io/qfilesystementry_p.h
+ tst_qfilesystementry.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt b/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt
new file mode 100644
index 0000000000..a237090a48
--- /dev/null
+++ b/tests/auto/corelib/io/qfilesystemmetadata/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qfilesystemmetadata.pro.
+
+#####################################################################
+## tst_qfilesystemmetadata Test:
+#####################################################################
+
+add_qt_test(tst_qfilesystemmetadata
+ SOURCES
+ tst_qfilesystemmetadata.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt b/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt
new file mode 100644
index 0000000000..1dfef5acab
--- /dev/null
+++ b/tests/auto/corelib/io/qfilesystemwatcher/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qfilesystemwatcher.pro.
+
+#####################################################################
+## tst_qfilesystemwatcher Test:
+#####################################################################
+
+add_qt_test(tst_qfilesystemwatcher
+ SOURCES
+ tst_qfilesystemwatcher.cpp
+)
diff --git a/tests/auto/corelib/io/qiodevice/CMakeLists.txt b/tests/auto/corelib/io/qiodevice/CMakeLists.txt
new file mode 100644
index 0000000000..6b7833ac22
--- /dev/null
+++ b/tests/auto/corelib/io/qiodevice/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated from qiodevice.pro.
+
+#####################################################################
+## tst_qiodevice Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "tst_qiodevice.cpp")
+
+add_qt_test(tst_qiodevice
+ SOURCES
+ tst_qiodevice.cpp
+ PUBLIC_LIBRARIES
+ Qt::Network
+ TESTDATA ${test_data}
+)
+
+#### Keys ignored in scope 1:.:.:qiodevice.pro:<TRUE>:
+# MOC_DIR = "tmp"
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(android_testdata_resource_files
+ "tst_qiodevice.cpp"
+ )
+
+ add_qt_resource(tst_qiodevice "android_testdata"
+ PREFIX
+ "/"
+ FILES
+ ${android_testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/io/qipaddress/CMakeLists.txt b/tests/auto/corelib/io/qipaddress/CMakeLists.txt
new file mode 100644
index 0000000000..821cd58bdb
--- /dev/null
+++ b/tests/auto/corelib/io/qipaddress/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qipaddress.pro.
+
+#####################################################################
+## tst_qipaddress Test:
+#####################################################################
+
+add_qt_test(tst_qipaddress
+ SOURCES
+ tst_qipaddress.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/qlockfile/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/CMakeLists.txt
new file mode 100644
index 0000000000..52bd7bfd8f
--- /dev/null
+++ b/tests/auto/corelib/io/qlockfile/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Generated from qlockfile.pro.
+
+#####################################################################
+## tst_qlockfile Test:
+#####################################################################
+
+add_qt_test(tst_qlockfile
+ SOURCES
+ tst_qlockfile.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qlockfile CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ advapi32
+)
+add_subdirectory(qlockfiletesthelper)
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..755dc7cf39
--- /dev/null
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/.prev_CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qlockfile_test_helper.pro.
+
+#####################################################################
+## qlockfile_test_helper Binary:
+#####################################################################
+
+add_qt_executable(qlockfile_test_helper
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ qlockfile_test_helper.cpp
+)
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt
new file mode 100644
index 0000000000..b515037d56
--- /dev/null
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qlockfile_test_helper.pro.
+
+#####################################################################
+## qlockfile_test_helper Binary:
+#####################################################################
+
+add_qt_test_helper(qlockfile_test_helper # special case
+ OVERRIDE_OUTPUT_DIRECTORY # special case
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ qlockfile_test_helper.cpp
+)
diff --git a/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt b/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt
new file mode 100644
index 0000000000..9e1eaf3e4a
--- /dev/null
+++ b/tests/auto/corelib/io/qloggingcategory/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qloggingcategory.pro.
+
+#####################################################################
+## tst_qloggingcategory Test:
+#####################################################################
+
+add_qt_test(tst_qloggingcategory
+ SOURCES
+ tst_qloggingcategory.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+#### Keys ignored in scope 1:.:.:qloggingcategory.pro:<TRUE>:
+# TEMPLATE = "app"
diff --git a/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt
new file mode 100644
index 0000000000..3c42af9d01
--- /dev/null
+++ b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated from qloggingregistry.pro.
+
+#####################################################################
+## tst_qloggingregistry Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "qtlogging.ini")
+
+add_qt_test(tst_qloggingregistry
+ SOURCES
+ tst_qloggingregistry.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+#### Keys ignored in scope 1:.:.:qloggingregistry.pro:<TRUE>:
+# TEMPLATE = "app"
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(android_testdata_resource_files
+ "qtlogging.ini"
+ )
+
+ add_qt_resource(tst_qloggingregistry "android_testdata"
+ PREFIX
+ "/"
+ FILES
+ ${android_testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/io/qnodebug/CMakeLists.txt b/tests/auto/corelib/io/qnodebug/CMakeLists.txt
new file mode 100644
index 0000000000..4d1b57e222
--- /dev/null
+++ b/tests/auto/corelib/io/qnodebug/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qnodebug.pro.
+
+#####################################################################
+## tst_qnodebug Test:
+#####################################################################
+
+add_qt_test(tst_qnodebug
+ SOURCES
+ tst_qnodebug.cpp
+)
diff --git a/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt b/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt
new file mode 100644
index 0000000000..ce6195fc37
--- /dev/null
+++ b/tests/auto/corelib/io/qprocess-noapplication/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qprocess-noapplication.pro.
+
+#####################################################################
+## qprocess-noapplication Test:
+#####################################################################
+
+add_qt_test(qprocess-noapplication
+ SOURCES
+ tst_qprocessnoapplication.cpp
+)
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index e799369c8a..269a59ae41 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -42,8 +42,6 @@
#include <QtNetwork/QHostInfo>
#include <stdlib.h>
-typedef void (QProcess::*QProcessFinishedSignal1)(int);
-typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus);
typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError);
class tst_QProcess : public QObject
@@ -152,7 +150,6 @@ private slots:
void failToStartEmptyArgs();
#if QT_DEPRECATED_SINCE(5, 13)
- void crashTest2_deprecated();
void restartProcessDeadlock_deprecated();
void waitForReadyReadInAReadyReadSlot_deprecated();
void finishProcessBeforeReadingDone_deprecated();
@@ -350,7 +347,7 @@ void tst_QProcess::crashTest()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QSignalSpy spy(process.data(), &QProcess::errorOccurred);
- QSignalSpy spy2(process.data(), static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy spy2(process.data(), &QProcess::finished);
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@@ -393,13 +390,12 @@ void tst_QProcess::crashTest2()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QSignalSpy spy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred));
- QSignalSpy spy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy spy2(&process, &QProcess::finished);
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
- QObject::connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- this, &tst_QProcess::exitLoopSlot);
+ QObject::connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot);
QTestEventLoop::instance().enterLoop(30);
if (QTestEventLoop::instance().timeout())
@@ -724,15 +720,14 @@ void tst_QProcess::restartProcessDeadlock()
// process in the finished() connected slot causes a deadlock
// because of the way QProcessManager uses its locks.
QProcess process;
- connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- this, &tst_QProcess::restartProcess);
+ connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess);
process.start("testProcessEcho/testProcessEcho");
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
- QObject::disconnect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished), nullptr, nullptr);
+ QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr);
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
@@ -931,8 +926,7 @@ public:
SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false)
{
- connect(this, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- this, &SoftExitProcess::finishedSlot);
+ connect(this, &QProcess::finished, this, &SoftExitProcess::finishedSlot);
switch (n) {
case 0:
@@ -1177,8 +1171,7 @@ protected:
exitCode = 90210;
QProcess process;
- connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- this, &TestThread::catchExitCode, Qt::DirectConnection);
+ connect(&process, &QProcess::finished, this, &TestThread::catchExitCode, Qt::DirectConnection);
process.start("testProcessEcho/testProcessEcho");
@@ -1251,8 +1244,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
{
QProcess process;
connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot);
- connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- this, &tst_QProcess::exitLoopSlot);
+ connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot);
bytesAvailable = 0;
process.start("testProcessEcho/testProcessEcho");
@@ -1490,7 +1482,7 @@ void tst_QProcess::failToStart()
QProcess process;
QSignalSpy stateSpy(&process, &QProcess::stateChanged);
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy finishedSpy(&process, &QProcess::finished);
QVERIFY(stateSpy.isValid());
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1499,10 +1491,6 @@ void tst_QProcess::failToStart()
QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(errorSpy2.isValid());
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
- QVERIFY(finishedSpy2.isValid());
-#endif
// OS X and HP-UX have a really low default process limit (~100), so spawning
// to many processes here will cause test failures later on.
@@ -1548,9 +1536,6 @@ void tst_QProcess::failToStart()
#if QT_DEPRECATED_SINCE(5, 6)
QCOMPARE(errorSpy2.count(), j * attempts + i + 1);
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QCOMPARE(finishedSpy2.count(), 0);
-#endif
int it = j * attempts + i + 1;
@@ -1569,7 +1554,7 @@ void tst_QProcess::failToStartWithWait()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy finishedSpy(&process, &QProcess::finished);
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1577,10 +1562,6 @@ void tst_QProcess::failToStartWithWait()
QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(errorSpy2.isValid());
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
- QVERIFY(finishedSpy2.isValid());
-#endif
for (int i = 0; i < 50; ++i) {
process.start("/blurp", QStringList() << "-v" << "-debug");
@@ -1592,10 +1573,6 @@ void tst_QProcess::failToStartWithWait()
#if QT_DEPRECATED_SINCE(5, 6)
QCOMPARE(errorSpy2.count(), i + 1);
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QCOMPARE(finishedSpy2.count(), 0);
-#endif
-
}
}
@@ -1607,7 +1584,7 @@ void tst_QProcess::failToStartWithEventLoop()
QProcess process;
QEventLoop loop;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy finishedSpy(&process, &QProcess::finished);
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1615,10 +1592,6 @@ void tst_QProcess::failToStartWithEventLoop()
QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(errorSpy2.isValid());
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QSignalSpy finishedSpy2(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
- QVERIFY(finishedSpy2.isValid());
-#endif
// The error signal may be emitted before start() returns
connect(&process, &QProcess::errorOccurred, &loop, &QEventLoop::quit, Qt::QueuedConnection);
@@ -1635,9 +1608,6 @@ void tst_QProcess::failToStartWithEventLoop()
#if QT_DEPRECATED_SINCE(5, 6)
QCOMPARE(errorSpy2.count(), i + 1);
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QCOMPARE(finishedSpy2.count(), 0);
-#endif
}
}
@@ -1912,7 +1882,7 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QProcess process;
QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
- QSignalSpy finishedSpy(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy finishedSpy(&process, &QProcess::finished);
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1920,10 +1890,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
QVERIFY(errorSpy2.isValid());
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QSignalSpy finishedSpy1(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished));
- QVERIFY(finishedSpy1.isValid());
-#endif
QVERIFY(!process.waitForReadyRead()); // used to crash
process.start("doesntexist");
@@ -1935,9 +1901,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QCOMPARE(errorSpy2.count(), 1);
QCOMPARE(errorSpy2.at(0).at(0).toInt(), 0);
#endif
-#if QT_DEPRECATED_SINCE(5, 13)
- QCOMPARE(finishedSpy1.count(), 0);
-#endif
}
void tst_QProcess::setStandardInputFile()
@@ -2390,7 +2353,7 @@ void tst_QProcess::onlyOneStartedSignal()
QProcess process;
QSignalSpy spyStarted(&process, &QProcess::started);
- QSignalSpy spyFinished(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
+ QSignalSpy spyFinished(&process, &QProcess::finished);
QVERIFY(spyStarted.isValid());
QVERIFY(spyFinished.isValid());
@@ -2433,8 +2396,7 @@ void tst_QProcess::finishProcessBeforeReadingDone()
QProcess process;
BlockOnReadStdOut blocker(&process);
QEventLoop loop;
- connect(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished),
- &loop, &QEventLoop::quit);
+ connect(&process, &QProcess::finished, &loop, &QEventLoop::quit);
process.start("testProcessOutput/testProcessOutput");
QVERIFY(process.waitForStarted());
loop.exec();
@@ -2581,52 +2543,20 @@ void tst_QProcess::processEventsInAReadyReadSlot()
#if QT_DEPRECATED_SINCE(5, 13)
-void tst_QProcess::crashTest2_deprecated()
-{
- QProcess process;
- process.start("testProcessCrash/testProcessCrash");
- QVERIFY(process.waitForStarted(5000));
-
- qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
- qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
-
- QSignalSpy spy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred));
- QSignalSpy spy2(&process, static_cast<QProcessFinishedSignal2>(&QProcess::finished));
-
- QVERIFY(spy.isValid());
- QVERIFY(spy2.isValid());
-
- QObject::connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
- this, &tst_QProcess::exitLoopSlot);
-
- QTestEventLoop::instance().enterLoop(30);
- if (QTestEventLoop::instance().timeout())
- QFAIL("Failed to detect crash : operation timed out");
-
- QCOMPARE(spy.count(), 1);
- QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed);
-
- QCOMPARE(spy2.count(), 1);
- QCOMPARE(*static_cast<const QProcess::ExitStatus *>(spy2.at(0).at(1).constData()), QProcess::CrashExit);
-
- QCOMPARE(process.exitStatus(), QProcess::CrashExit);
-}
-
void tst_QProcess::restartProcessDeadlock_deprecated()
{
// The purpose of this test is to detect whether restarting a
// process in the finished() connected slot causes a deadlock
// because of the way QProcessManager uses its locks.
QProcess process;
- connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
- this, &tst_QProcess::restartProcess);
+ connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess);
process.start("testProcessEcho/testProcessEcho");
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
- QObject::disconnect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished), nullptr, nullptr);
+ QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr);
QCOMPARE(process.write("", 1), qlonglong(1));
QVERIFY(process.waitForFinished(5000));
@@ -2638,8 +2568,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot_deprecated()
{
QProcess process;
connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot);
- connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
- this, &tst_QProcess::exitLoopSlot);
+ connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot);
bytesAvailable = 0;
process.start("testProcessEcho/testProcessEcho");
@@ -2665,8 +2594,7 @@ void tst_QProcess::finishProcessBeforeReadingDone_deprecated()
QProcess process;
BlockOnReadStdOut blocker(&process);
QEventLoop loop;
- connect(&process, static_cast<QProcessFinishedSignal1>(&QProcess::finished),
- &loop, &QEventLoop::quit);
+ connect(&process, &QProcess::finished, &loop, &QEventLoop::quit);
process.start("testProcessOutput/testProcessOutput");
QVERIFY(process.waitForStarted());
loop.exec();
diff --git a/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt b/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt
new file mode 100644
index 0000000000..dbcd8c8172
--- /dev/null
+++ b/tests/auto/corelib/io/qprocessenvironment/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qprocessenvironment.pro.
+
+#####################################################################
+## tst_qprocessenvironment Test:
+#####################################################################
+
+add_qt_test(tst_qprocessenvironment
+ SOURCES
+ tst_qprocessenvironment.cpp
+)
diff --git a/tests/auto/corelib/io/qsavefile/CMakeLists.txt b/tests/auto/corelib/io/qsavefile/CMakeLists.txt
new file mode 100644
index 0000000000..aec5da1f99
--- /dev/null
+++ b/tests/auto/corelib/io/qsavefile/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qsavefile.pro.
+
+#####################################################################
+## tst_qsavefile Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "tst_qsavefile.cpp")
+
+add_qt_test(tst_qsavefile
+ SOURCES
+ tst_qsavefile.cpp
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/corelib/io/qsettings/CMakeLists.txt b/tests/auto/corelib/io/qsettings/CMakeLists.txt
new file mode 100644
index 0000000000..161b03b041
--- /dev/null
+++ b/tests/auto/corelib/io/qsettings/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Generated from qsettings.pro.
+
+#####################################################################
+## tst_qsettings Test:
+#####################################################################
+
+add_qt_test(tst_qsettings
+ SOURCES
+ tst_qsettings.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../kernel/qmetatype
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+)
+
+# Resources:
+set(qsettings_resource_files
+ "bom.ini"
+ "resourcefile.ini"
+ "resourcefile2.ini"
+ "resourcefile3.ini"
+ "resourcefile4.ini"
+ "resourcefile5.ini"
+ "resourcefile6.plist"
+ "withcomments.ini"
+)
+
+add_qt_resource(tst_qsettings "qsettings"
+ PREFIX
+ "/"
+ FILES
+ ${qsettings_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qsettings CONDITION MSVC
+ PUBLIC_LIBRARIES
+ advapi32
+)
+
+extend_target(tst_qsettings CONDITION APPLE
+ PUBLIC_LIBRARIES
+ ${FWCoreFoundation}
+)
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 0f07ba4bb2..c969e72c18 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -39,7 +39,9 @@
#include <QtCore/QDir>
#include <QtCore/QThread>
#include <QtCore/QSysInfo>
-#include <QtGui/QKeySequence>
+#if QT_CONFIG(shortcut)
+# include <QtGui/QKeySequence>
+#endif
#include <QtCore>
#include <QtGui>
@@ -1364,6 +1366,7 @@ void tst_QSettings::testVariantTypes()
dt.setOffsetFromUtc(3600);
testVal("key14", dt, QDateTime, DateTime);
+#if QT_CONFIG(shortcut)
// We store key sequences as strings instead of binary variant blob, for improved
// readability in the resulting format.
if (format >= QSettings::InvalidFormat) {
@@ -1373,6 +1376,7 @@ void tst_QSettings::testVariantTypes()
QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
QString, String);
}
+#endif // QT_CONFIG(shortcut)
#undef testVal
}
diff --git a/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt b/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt
new file mode 100644
index 0000000000..5bceaf1d77
--- /dev/null
+++ b/tests/auto/corelib/io/qstandardpaths/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Generated from qstandardpaths.pro.
+
+#####################################################################
+## tst_qstandardpaths Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "tst_qstandardpaths.cpp")
+list(APPEND test_data "qstandardpaths.pro")
+
+add_qt_test(tst_qstandardpaths
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qstandardpaths.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qstandardpaths CONDITION boot2qt
+ DEFINES
+ SKIP_FINDEXECUTABLE
+)
diff --git a/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt
new file mode 100644
index 0000000000..08af02dc6c
--- /dev/null
+++ b/tests/auto/corelib/io/qstorageinfo/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qstorageinfo.pro.
+
+#####################################################################
+## tst_qstorageinfo Test:
+#####################################################################
+
+add_qt_test(tst_qstorageinfo
+ SOURCES
+ tst_qstorageinfo.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt b/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt
new file mode 100644
index 0000000000..855495bbbb
--- /dev/null
+++ b/tests/auto/corelib/io/qtemporarydir/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qtemporarydir.pro.
+
+#####################################################################
+## tst_qtemporarydir Test:
+#####################################################################
+
+add_qt_test(tst_qtemporarydir
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qtemporarydir.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+ PUBLIC_LIBRARIES
+ Qt::TestPrivate
+)
diff --git a/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt b/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt
new file mode 100644
index 0000000000..af614552cc
--- /dev/null
+++ b/tests/auto/corelib/io/qtemporaryfile/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from qtemporaryfile.pro.
+
+#####################################################################
+## tst_qtemporaryfile Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "tst_qtemporaryfile.cpp")
+
+add_qt_test(tst_qtemporaryfile
+ SOURCES
+ tst_qtemporaryfile.cpp
+ PUBLIC_LIBRARIES
+ Qt::TestPrivate
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set(qtemporaryfile_resource_files
+ "resources/test.txt"
+)
+
+add_qt_resource(tst_qtemporaryfile "qtemporaryfile"
+ PREFIX
+ "/"
+ FILES
+ ${qtemporaryfile_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(android_testdata_resource_files
+ "resources/test.txt"
+ "tst_qtemporaryfile.cpp"
+ )
+
+ add_qt_resource(tst_qtemporaryfile "android_testdata"
+ PREFIX
+ "/android_testdata"
+ FILES
+ ${android_testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/io/qurl/CMakeLists.txt b/tests/auto/corelib/io/qurl/CMakeLists.txt
new file mode 100644
index 0000000000..c23ad27cfc
--- /dev/null
+++ b/tests/auto/corelib/io/qurl/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Generated from qurl.pro.
+
+#####################################################################
+## tst_qurl Test:
+#####################################################################
+
+add_qt_test(tst_qurl
+ SOURCES
+ tst_qurl.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qurl CONDITION APPLE
+ SOURCES
+ tst_qurl_mac.mm
+)
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index ef4325d2ea..8d046d5499 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -48,8 +48,6 @@ class tst_QUrl : public QObject
private slots:
void initTestCase();
void cleanupTestCase();
- void effectiveTLDs_data();
- void effectiveTLDs();
void getSetCheck();
void constructing();
void hashInPath();
@@ -3387,61 +3385,6 @@ void tst_QUrl::acceptEmptyAuthoritySegments()
QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar);
}
-void tst_QUrl::effectiveTLDs_data()
-{
- // See also: tst_QNetworkCookieJar::setCookiesFromUrl().
- // in tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
- QTest::addColumn<QUrl>("domain");
- QTest::addColumn<QString>("TLD");
- // TODO: autogenerate test-cases from:
- // https://raw.githubusercontent.com/publicsuffix/list/master/tests/test_psl.txt
- // checkPublicSuffix(domain, tail) appears in the list if
- // either tail is null and domain is public or
- // tail is the "registrable" part of domain; i.e. its minimal non-public tail.
-
- QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk";
- QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com";
- QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de";
- QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum";
- QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no";
- QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg";
- QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn";
- QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws";
- QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum";
- QTest::newRow("yes10") << QUrl::fromEncoded("http://www.com.evje-og-hornnes.no") << ".evje-og-hornnes.no";
- QTest::newRow("yes11") << QUrl::fromEncoded("http://www.bla.kamijima.ehime.jp") << ".kamijima.ehime.jp";
- QTest::newRow("yes12") << QUrl::fromEncoded("http://www.bla.kakuda.miyagi.jp") << ".kakuda.miyagi.jp";
- QTest::newRow("yes13") << QUrl::fromEncoded("http://mypage.betainabox.com") << ".betainabox.com";
- QTest::newRow("yes14") << QUrl::fromEncoded("http://mypage.rhcloud.com") << ".rhcloud.com";
- QTest::newRow("yes15") << QUrl::fromEncoded("http://mypage.int.az") << ".int.az";
- QTest::newRow("yes16") << QUrl::fromEncoded("http://anything.pagespeedmobilizer.com") << ".pagespeedmobilizer.com";
- QTest::newRow("yes17") << QUrl::fromEncoded("http://anything.eu-central-1.compute.amazonaws.com") << ".eu-central-1.compute.amazonaws.com";
- QTest::newRow("yes18") << QUrl::fromEncoded("http://anything.ltd.hk") << ".ltd.hk";
- QTest::newRow("trentino.it")
- << QUrl::fromEncoded("http://any.thing.trentino.it") << ".trentino.it";
- QTest::newRow("net.ni") << QUrl::fromEncoded("http://test.net.ni") << ".net.ni";
- QTest::newRow("dyn.cosidns.de")
- << QUrl::fromEncoded("http://test.dyn.cosidns.de") << ".dyn.cosidns.de";
- QTest::newRow("freeddns.org")
- << QUrl::fromEncoded("http://test.freeddns.org") << ".freeddns.org";
- QTest::newRow("app.os.stg.fedoraproject.org")
- << QUrl::fromEncoded("http://test.app.os.stg.fedoraproject.org")
- << ".app.os.stg.fedoraproject.org";
- QTest::newRow("development.run") << QUrl::fromEncoded("http://test.development.run") << ".development.run";
- QTest::newRow("crafting.xyz") << QUrl::fromEncoded("http://test.crafting.xyz") << ".crafting.xyz";
- QTest::newRow("nym.ie") << QUrl::fromEncoded("http://shamus.nym.ie") << ".nym.ie";
- QTest::newRow("vapor.cloud") << QUrl::fromEncoded("http://test.vapor.cloud") << ".vapor.cloud";
- QTest::newRow("official.academy") << QUrl::fromEncoded("http://acredited.official.academy") << ".official.academy";
-}
-
-void tst_QUrl::effectiveTLDs()
-{
- QFETCH(QUrl, domain);
- QFETCH(QString, TLD);
- QCOMPARE(domain.topLevelDomain(QUrl::PrettyDecoded), TLD);
- QCOMPARE(domain.topLevelDomain(QUrl::FullyDecoded), TLD);
-}
-
void tst_QUrl::lowercasesScheme()
{
QUrl url;
diff --git a/tests/auto/corelib/io/qurlinternal/CMakeLists.txt b/tests/auto/corelib/io/qurlinternal/CMakeLists.txt
new file mode 100644
index 0000000000..5ad3bc1919
--- /dev/null
+++ b/tests/auto/corelib/io/qurlinternal/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Generated from qurlinternal.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qurlinternal Test:
+#####################################################################
+
+add_qt_test(tst_qurlinternal
+ SOURCES
+ ../../codecs/utf8/utf8data.cpp
+ tst_qurlinternal.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+#### Keys ignored in scope 1:.:.:qurlinternal.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 5c6e633749..f644979c06 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -30,7 +30,6 @@
#include <QtCore/QUrl>
#include <QtTest/QtTest>
-#include "private/qtldurl_p.h"
#include "private/qurl_p.h"
// For testsuites
diff --git a/tests/auto/corelib/io/qurlquery/CMakeLists.txt b/tests/auto/corelib/io/qurlquery/CMakeLists.txt
new file mode 100644
index 0000000000..8a0cc54aeb
--- /dev/null
+++ b/tests/auto/corelib/io/qurlquery/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qurlquery.pro.
+
+#####################################################################
+## tst_qurlquery Test:
+#####################################################################
+
+add_qt_test(tst_qurlquery
+ SOURCES
+ tst_qurlquery.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/itemmodels/CMakeLists.txt b/tests/auto/corelib/itemmodels/CMakeLists.txt
new file mode 100644
index 0000000000..6f52ed2600
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Generated from itemmodels.pro.
+
+add_subdirectory(qstringlistmodel)
+if(TARGET Qt::Gui)
+ add_subdirectory(qabstractitemmodel)
+ add_subdirectory(qabstractproxymodel)
+ add_subdirectory(qconcatenatetablesproxymodel)
+ add_subdirectory(qidentityproxymodel)
+ add_subdirectory(qitemselectionmodel)
+ add_subdirectory(qsortfilterproxymodel_recursive)
+ add_subdirectory(qtransposeproxymodel)
+endif()
+if(TARGET Qt::Widgets)
+ add_subdirectory(qsortfilterproxymodel_regexp)
+ add_subdirectory(qsortfilterproxymodel_regularexpression)
+endif()
+if(TARGET Qt::Sql AND TARGET Qt::Widgets)
+ add_subdirectory(qitemmodel)
+endif()
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qabstractitemmodel/CMakeLists.txt
new file mode 100644
index 0000000000..edc7f4321a
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Generated from qabstractitemmodel.pro.
+
+#####################################################################
+## tst_qabstractitemmodel Test:
+#####################################################################
+
+add_qt_test(tst_qabstractitemmodel
+ SOURCES
+ ../../../other/qabstractitemmodelutils/dynamictreemodel.cpp ../../../other/qabstractitemmodelutils/dynamictreemodel.h
+ tst_qabstractitemmodel.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../../other/qabstractitemmodelutils
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qabstractproxymodel/CMakeLists.txt
new file mode 100644
index 0000000000..f6a443213c
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qabstractproxymodel.pro.
+
+#####################################################################
+## tst_qabstractproxymodel Test:
+#####################################################################
+
+add_qt_test(tst_qabstractproxymodel
+ SOURCES
+ tst_qabstractproxymodel.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/CMakeLists.txt
new file mode 100644
index 0000000000..90b371cb1b
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qconcatenatetablesproxymodel.pro.
+
+#####################################################################
+## tst_qconcatenatetablesproxymodel Test:
+#####################################################################
+
+add_qt_test(tst_qconcatenatetablesproxymodel
+ SOURCES
+ tst_qconcatenatetablesproxymodel.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qidentityproxymodel/CMakeLists.txt
new file mode 100644
index 0000000000..c02e7b5ad4
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qidentityproxymodel.pro.
+
+#####################################################################
+## tst_qidentityproxymodel Test:
+#####################################################################
+
+add_qt_test(tst_qidentityproxymodel
+ SOURCES
+ ../../../other/qabstractitemmodelutils/dynamictreemodel.cpp ../../../other/qabstractitemmodelutils/dynamictreemodel.h
+ tst_qidentityproxymodel.cpp
+ INCLUDE_DIRECTORIES
+ ../../../other/qabstractitemmodelutils
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt
new file mode 100644
index 0000000000..3baf727cf9
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qitemmodel/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qitemmodel.pro.
+
+#####################################################################
+## tst_qitemmodel Test:
+#####################################################################
+
+add_qt_test(tst_qitemmodel
+ SOURCES
+ tst_qitemmodel.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Sql
+ Qt::Widgets
+)
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qitemselectionmodel/CMakeLists.txt
new file mode 100644
index 0000000000..bd79cba5e2
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qitemselectionmodel.pro.
+
+#####################################################################
+## tst_qitemselectionmodel Test:
+#####################################################################
+
+add_qt_test(tst_qitemselectionmodel
+ SOURCES
+ tst_qitemselectionmodel.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/CMakeLists.txt b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/CMakeLists.txt
new file mode 100644
index 0000000000..59f5d8ae76
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qsortfilterproxymodel_recursive.pro.
+
+#####################################################################
+## tst_qsortfilterproxymodel_recursive Test:
+#####################################################################
+
+add_qt_test(tst_qsortfilterproxymodel_recursive
+ SOURCES
+ tst_qsortfilterproxymodel_recursive.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/CMakeLists.txt b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/CMakeLists.txt
new file mode 100644
index 0000000000..8df14a96b1
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regexp/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qsortfilterproxymodel_regexp.pro.
+
+#####################################################################
+## tst_qsortfilterproxymodel_regexp Test:
+#####################################################################
+
+add_qt_test(tst_qsortfilterproxymodel_regexp
+ SOURCES
+ ../../../other/qabstractitemmodelutils/dynamictreemodel.cpp ../../../other/qabstractitemmodelutils/dynamictreemodel.h
+ ../qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp ../qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h
+ tst_qsortfilterproxymodel_regexp.cpp
+ INCLUDE_DIRECTORIES
+ ../../../other/qabstractitemmodelutils
+ ../qsortfilterproxymodel_common
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/CMakeLists.txt b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/CMakeLists.txt
new file mode 100644
index 0000000000..8bc7f55f7c
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qsortfilterproxymodel_regularexpression.pro.
+
+#####################################################################
+## tst_qsortfilterproxymodel_regularexpression Test:
+#####################################################################
+
+add_qt_test(tst_qsortfilterproxymodel_regularexpression
+ SOURCES
+ ../../../other/qabstractitemmodelutils/dynamictreemodel.cpp ../../../other/qabstractitemmodelutils/dynamictreemodel.h
+ ../qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp ../qsortfilterproxymodel_common/tst_qsortfilterproxymodel.h
+ tst_qsortfilterproxymodel_regularexpression.cpp
+ INCLUDE_DIRECTORIES
+ ../../../other/qabstractitemmodelutils
+ ../qsortfilterproxymodel_common
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qstringlistmodel/CMakeLists.txt
new file mode 100644
index 0000000000..53bfdbe419
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qstringlistmodel/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qstringlistmodel.pro.
+
+#####################################################################
+## tst_qstringlistmodel Test:
+#####################################################################
+
+add_qt_test(tst_qstringlistmodel
+ SOURCES
+ qmodellistener.h
+ tst_qstringlistmodel.cpp
+)
diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/CMakeLists.txt b/tests/auto/corelib/itemmodels/qtransposeproxymodel/CMakeLists.txt
new file mode 100644
index 0000000000..ad1b65d348
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qtransposeproxymodel.pro.
+
+#####################################################################
+## tst_qtransposeproxymodel Test:
+#####################################################################
+
+add_qt_test(tst_qtransposeproxymodel
+ SOURCES
+ tst_qtransposeproxymodel.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/kernel/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..5415a23a98
--- /dev/null
+++ b/tests/auto/corelib/kernel/.prev_CMakeLists.txt
@@ -0,0 +1,40 @@
+# Generated from kernel.pro.
+
+add_subdirectory(qcoreapplication)
+add_subdirectory(qdeadlinetimer)
+add_subdirectory(qelapsedtimer)
+add_subdirectory(qeventdispatcher)
+if(TARGET Qt::Network)
+ add_subdirectory(qeventloop)
+endif()
+add_subdirectory(qmath)
+add_subdirectory(qmetaobject)
+add_subdirectory(qmetaobjectbuilder)
+add_subdirectory(qmetamethod)
+add_subdirectory(qmetaproperty)
+add_subdirectory(qmetatype)
+add_subdirectory(qmetaenum)
+if(TARGET Qt::Gui)
+ add_subdirectory(qmimedata)
+endif()
+if(TARGET Qt::Network AND NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qobject)
+endif()
+add_subdirectory(qpointer)
+if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qsharedmemory)
+endif()
+add_subdirectory(qsignalblocker)
+add_subdirectory(qsignalmapper)
+if(QT_FEATURE_private_tests AND TARGET Qt::Network)
+ add_subdirectory(qsocketnotifier)
+endif()
+if(QT_FEATURE_systemsemaphore AND NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qsystemsemaphore)
+endif()
+add_subdirectory(qtimer)
+add_subdirectory(qtranslator)
+add_subdirectory(qvariant)
+if(win32_x_ AND NOT WINRT)
+ add_subdirectory(qwineventnotifier)
+endif()
diff --git a/tests/auto/corelib/kernel/CMakeLists.txt b/tests/auto/corelib/kernel/CMakeLists.txt
new file mode 100644
index 0000000000..9fbe2b8b7a
--- /dev/null
+++ b/tests/auto/corelib/kernel/CMakeLists.txt
@@ -0,0 +1,40 @@
+# Generated from kernel.pro.
+
+# add_subdirectory(qcoreapplication) # special case
+add_subdirectory(qdeadlinetimer)
+add_subdirectory(qelapsedtimer)
+add_subdirectory(qeventdispatcher)
+if(TARGET Qt::Network)
+ add_subdirectory(qeventloop)
+endif()
+add_subdirectory(qmath)
+add_subdirectory(qmetaobject)
+add_subdirectory(qmetaobjectbuilder)
+add_subdirectory(qmetamethod)
+add_subdirectory(qmetaproperty)
+# add_subdirectory(qmetatype) # special case
+add_subdirectory(qmetaenum)
+if(TARGET Qt::Gui)
+ add_subdirectory(qmimedata)
+endif()
+if(TARGET Qt::Network AND NOT ANDROID AND NOT APPLE_UIKIT)
+ # add_subdirectory(qobject) # special case
+endif()
+add_subdirectory(qpointer)
+if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qsharedmemory)
+endif()
+add_subdirectory(qsignalblocker)
+add_subdirectory(qsignalmapper)
+if(QT_FEATURE_private_tests AND TARGET Qt::Network)
+ add_subdirectory(qsocketnotifier)
+endif()
+if(QT_FEATURE_systemsemaphore AND NOT ANDROID AND NOT APPLE_UIKIT)
+ add_subdirectory(qsystemsemaphore)
+endif()
+# add_subdirectory(qtimer) # special case
+add_subdirectory(qtranslator)
+add_subdirectory(qvariant)
+if(win32_x_ AND NOT WINRT)
+ add_subdirectory(qwineventnotifier)
+endif()
diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt b/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt
new file mode 100644
index 0000000000..5feb9ff535
--- /dev/null
+++ b/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qdeadlinetimer.pro.
+
+#####################################################################
+## tst_qdeadlinetimer Test:
+#####################################################################
+
+add_qt_test(tst_qdeadlinetimer
+ SOURCES
+ tst_qdeadlinetimer.cpp
+)
diff --git a/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt b/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt
new file mode 100644
index 0000000000..e188c94933
--- /dev/null
+++ b/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qelapsedtimer.pro.
+
+#####################################################################
+## tst_qelapsedtimer Test:
+#####################################################################
+
+add_qt_test(tst_qelapsedtimer
+ SOURCES
+ tst_qelapsedtimer.cpp
+)
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
new file mode 100644
index 0000000000..4dbabc2d69
--- /dev/null
+++ b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qeventdispatcher.pro.
+
+#####################################################################
+## tst_qeventdispatcher Test:
+#####################################################################
+
+add_qt_test(tst_qeventdispatcher
+ SOURCES
+ tst_qeventdispatcher.cpp
+)
diff --git a/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt
new file mode 100644
index 0000000000..ac952f64f7
--- /dev/null
+++ b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Generated from qeventloop.pro.
+
+#####################################################################
+## tst_qeventloop Test:
+#####################################################################
+
+add_qt_test(tst_qeventloop
+ SOURCES
+ tst_qeventloop.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Network
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qeventloop CONDITION WIN32 AND NOT WINRT
+ PUBLIC_LIBRARIES
+ user32
+)
+
+extend_target(tst_qeventloop CONDITION QT_FEATURE_glib
+ DEFINES
+ HAVE_GLIB
+)
diff --git a/tests/auto/corelib/kernel/qmath/CMakeLists.txt b/tests/auto/corelib/kernel/qmath/CMakeLists.txt
new file mode 100644
index 0000000000..5e73597c67
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmath/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmath.pro.
+
+#####################################################################
+## tst_qmath Test:
+#####################################################################
+
+add_qt_test(tst_qmath
+ SOURCES
+ tst_qmath.cpp
+)
diff --git a/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt
new file mode 100644
index 0000000000..12c9d9a8a7
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmetaenum.pro.
+
+#####################################################################
+## tst_qmetaenum Test:
+#####################################################################
+
+add_qt_test(tst_qmetaenum
+ SOURCES
+ tst_qmetaenum.cpp
+)
diff --git a/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt b/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt
new file mode 100644
index 0000000000..b16101a1a1
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmetamethod.pro.
+
+#####################################################################
+## tst_qmetamethod Test:
+#####################################################################
+
+add_qt_test(tst_qmetamethod
+ SOURCES
+ tst_qmetamethod.cpp
+)
diff --git a/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt
new file mode 100644
index 0000000000..888bfeaa78
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qmetaobject.pro.
+
+#####################################################################
+## tst_qmetaobject Test:
+#####################################################################
+
+add_qt_test(tst_qmetaobject
+ SOURCES
+ tst_qmetaobject.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 60000316cc..9db2bb241a 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -1320,32 +1320,38 @@ void tst_QMetaObject::normalizedSignature_data()
QTest::newRow("function ptr spaces") << "void foo( void ( * ) ( void ))" << "void foo(void(*)())";
QTest::newRow("function ptr void*") << "void foo(void(*)(void*))" << "void foo(void(*)(void*))";
QTest::newRow("function ptr void* spaces") << "void foo( void ( * ) ( void * ))" << "void foo(void(*)(void*))";
- QTest::newRow("template args") << " void foo( QMap<a, a>, QList<b>) "
- << "void foo(QMap<a,a>,QList<b>)";
+ QTest::newRow("template args") << " void foo( QMap<a, a>, QVector<b>) "
+ << "void foo(QMap<a,a>,QVector<b>)";
QTest::newRow("void template args") << " void foo( Foo<void>, Bar<void> ) "
<< "void foo(Foo<void>,Bar<void>)";
QTest::newRow("void* template args") << " void foo( Foo<void*>, Bar<void *> ) "
<< "void foo(Foo<void*>,Bar<void*>)";
- QTest::newRow("rettype") << "QList<int, int> foo()" << "QList<int,int>foo()";
+ QTest::newRow("rettype") << "QVector<int, int> foo()" << "QVector<int,int>foo()";
QTest::newRow("rettype void template") << "Foo<void> foo()" << "Foo<void>foo()";
QTest::newRow("const rettype") << "const QString *foo()" << "const QString*foo()";
QTest::newRow("const ref") << "const QString &foo()" << "const QString&foo()";
QTest::newRow("reference") << "QString &foo()" << "QString&foo()";
QTest::newRow("const1") << "void foo(QString const *)" << "void foo(const QString*)";
- QTest::newRow("const2") << "void foo(QString * const)" << "void foo(QString*const)";
+ QTest::newRow("const2") << "void foo(QString * const)" << "void foo(QString*)";
QTest::newRow("const3") << "void foo(QString const &)" << "void foo(QString)";
QTest::newRow("const4") << "void foo(const int)" << "void foo(int)";
QTest::newRow("const5") << "void foo(const int, int const, const int &, int const &)"
<< "void foo(int,int,int,int)";
- QTest::newRow("const6") << "void foo(QList<const int>)" << "void foo(QList<const int>)";
- QTest::newRow("const7") << "void foo(QList<const int*>)" << "void foo(QList<const int*>)";
- QTest::newRow("const8") << "void foo(QList<int const*>)" << "void foo(QList<const int*>)";
+ QTest::newRow("const6") << "void foo(QVector<const int>)" << "void foo(QVector<const int>)";
+ QTest::newRow("const7") << "void foo(QVector<const int*>)" << "void foo(QVector<const int*>)";
+ QTest::newRow("const8") << "void foo(QVector<int const*>)" << "void foo(QVector<const int*>)";
QTest::newRow("const9") << "void foo(const Foo<Bar>)" << "void foo(Foo<Bar>)";
QTest::newRow("const10") << "void foo(Foo<Bar>const)" << "void foo(Foo<Bar>)";
- QTest::newRow("const11") << "void foo(Foo<Bar> *const)" << "void foo(Foo<Bar>*const)";
- QTest::newRow("const12") << "void foo(Foo<Bar>const*const *const)" << "void foo(Foo<Bar>*const*const)";
+ QTest::newRow("const11") << "void foo(Foo<Bar> *const)" << "void foo(Foo<Bar>*)";
+ QTest::newRow("const12") << "void foo(Foo<Bar>const*const *const)" << "void foo(const Foo<Bar>*const*)";
QTest::newRow("const13") << "void foo(const Foo<Bar>&)" << "void foo(Foo<Bar>)";
QTest::newRow("const14") << "void foo(Foo<Bar>const&)" << "void foo(Foo<Bar>)";
+ QTest::newRow("QList") << "void foo(QList<int>)" << "void foo(QVector<int>)";
+ QTest::newRow("QList1") << "void foo(const Template<QList, MyQList const>)"
+ << "void foo(Template<QVector,const MyQList>)";
+
+ QTest::newRow("refref") << "const char* foo(const X &&,X const &&, const X* &&) && "
+ << "const char*foo(const X&&,const X&&,const X*&&)&&";
QTest::newRow("invalid1") << "a( b" << "a(b";
}
@@ -1367,26 +1373,63 @@ void tst_QMetaObject::normalizedType_data()
QTest::newRow("white") << " int " << "int";
QTest::newRow("const1") << "int const *" << "const int*";
QTest::newRow("const2") << "const int *" << "const int*";
- QTest::newRow("template1") << "QList<int const *>" << "QList<const int*>";
- QTest::newRow("template2") << "QList<const int *>" << "QList<const int*>";
+ QTest::newRow("template1") << "QVector<int const *>" << "QVector<const int*>";
+ QTest::newRow("template2") << "QVector<const int *>" << "QVector<const int*>";
QTest::newRow("template3") << "QMap<QString, int>" << "QMap<QString,int>";
QTest::newRow("template4") << "const QMap<QString, int> &" << "QMap<QString,int>";
- QTest::newRow("template5") << "QList< ::Foo::Bar>" << "QList< ::Foo::Bar>";
- QTest::newRow("template6") << "QList<::Foo::Bar>" << "QList<::Foo::Bar>";
- QTest::newRow("template7") << "QList<QList<int> >" << "QList<QList<int> >";
+ QTest::newRow("template5") << "QVector< ::Foo::Bar>" << "QVector<::Foo::Bar>";
+ QTest::newRow("template6") << "QVector<::Foo::Bar>" << "QVector<::Foo::Bar>";
+ QTest::newRow("template7") << "QVector<QVector<int> >" << "QVector<QVector<int>>";
QTest::newRow("template8") << "QMap<const int, const short*>" << "QMap<const int,const short*>";
- QTest::newRow("template9") << "QPair<const QPair<int, int const *> , QPair<QHash<int, const char*> > >" << "QPair<const QPair<int,const int*>,QPair<QHash<int,const char*> > >";
+ QTest::newRow("template9") << "QPair<const QPair<int, int const *> , QPair<QHash<int, const char*> > >" << "QPair<const QPair<int,const int*>,QPair<QHash<int,const char*>>>";
+ QTest::newRow("template10") << "QList<int const * const> const" << "QVector<const int*const>";
+ QTest::newRow("template11") << " QSharedPointer<QVarLengthArray< QString const, ( 16>> 2 )> > const & "
+ << "QSharedPointer<QVarLengthArray<const QString,(16>>2)>>";
+ QTest::newRow("template_sub") << "X<( Y < 8), (Y >6)> const & " << "X<(Y<8),(Y>6)>";
QTest::newRow("value1") << "const QString &" << "QString";
QTest::newRow("value2") << "QString const &" << "QString";
QTest::newRow("constInName1") << "constconst" << "constconst";
QTest::newRow("constInName2") << "constconst*" << "constconst*";
QTest::newRow("constInName3") << "const constconst&" << "constconst";
- QTest::newRow("constInName4") << "constconst const*const" << "constconst*const";
+ QTest::newRow("constInName4") << "constconst const*const" << "const constconst*";
QTest::newRow("class") << "const class foo&" << "foo";
QTest::newRow("struct") << "const struct foo*" << "const foo*";
QTest::newRow("struct2") << "struct foo const*" << "const foo*";
QTest::newRow("enum") << "enum foo" << "foo";
QTest::newRow("void") << "void" << "void";
+ QTest::newRow("QList") << "QList<int>" << "QVector<int>";
+ QTest::newRow("refref") << "X const*const&&" << "const X*const&&";
+ QTest::newRow("refref2") << "const X<T const&&>&&" << "const X<const T&&>&&";
+ QTest::newRow("long1") << "long unsigned int long" << "unsigned long long";
+ QTest::newRow("long2") << "int signed long" << "long";
+ QTest::newRow("long3") << "long unsigned" << "ulong";
+ QTest::newRow("long double") << " long double" << "long double";
+ QTest::newRow("signed char") << "char signed" << "signed char";
+ QTest::newRow("unsigned char") << "char unsigned" << "unsigned char";
+ QTest::newRow("signed short") << "short signed" << "short";
+ QTest::newRow("unsigned shot") << "short unsigned" << "unsigned short";
+ QTest::newRow("unsigned shot") << "short unsigned" << "unsigned short";
+ QTest::newRow("array1") << "unsigned int [4]" << "uint[4]";
+ QTest::newRow("array2") << "unsigned int const [4][5]" << "const uint[4][5]";
+ QTest::newRow("array3") << "unsigned[] const" << "uint[]";
+ QTest::newRow("nttp1") << "S<'>', int const> const"
+ << "S<'>',const int>";
+ QTest::newRow("nttp2") << "S< \"> \\\">const * \\\\\" , int const> const"
+ << "S<\"> \\\">const * \\\\\",const int>";
+ QTest::newRow("nttp3") << "S<\"Q <\" , int const> const*"
+ << "const S<\"Q <\",const int>*";
+ QTest::newRow("nttp4") << "S< 1'2 , int const> const"
+ << "S<1'2,const int>";
+ QTest::newRow("invalid") << "'const"
+ << "'const";
+ QTest::newRow("anonym1") << "XX::<unnamed struct>"
+ << "XX::<unnamed struct>";
+ QTest::newRow("anonym2") << "XX::{unnamed type#1}"
+ << "XX::{unnamed type#1}";
+ QTest::newRow("anonym3") << "struct XX::<unnamed-type-s>"
+ << "XX::<unnamed-type-s>";
+ QTest::newRow("anonym4") << "XX::(anonymous struct at ./example.cpp:10:13)"
+ << "XX::(anonymous struct at./example.cpp:10:13)";
}
void tst_QMetaObject::normalizedType()
@@ -1395,6 +1438,7 @@ void tst_QMetaObject::normalizedType()
QFETCH(QString, result);
QCOMPARE(QMetaObject::normalizedType(type.toLatin1()), result.toLatin1());
+ QCOMPARE(QMetaObject::normalizedType(result.toLatin1()), result.toLatin1());
}
void tst_QMetaObject::customPropertyType()
@@ -1402,13 +1446,15 @@ void tst_QMetaObject::customPropertyType()
QMetaProperty prop = metaObject()->property(metaObject()->indexOfProperty("value3"));
QCOMPARE(prop.type(), QVariant::UserType);
- QCOMPARE(prop.userType(), 0);
+ QCOMPARE(prop.userType(), QMetaType::fromType<MyStruct>().id());
+ QCOMPARE(prop.metaType(), QMetaType::fromType<MyStruct>());
qRegisterMetaType<MyStruct>("MyStruct");
QCOMPARE(prop.userType(), QMetaType::type("MyStruct"));
prop = metaObject()->property(metaObject()->indexOfProperty("value4"));
QCOMPARE(prop.type(), QVariant::List);
+ QCOMPARE(prop.metaType(), QMetaType::fromType<QList<QVariant>>());
prop = metaObject()->property(metaObject()->indexOfProperty("value5"));
QCOMPARE(prop.type(), QVariant::List);
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt
new file mode 100644
index 0000000000..e7586d580b
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmetaobjectbuilder.pro.
+
+#####################################################################
+## tst_qmetaobjectbuilder Test:
+#####################################################################
+
+add_qt_test(tst_qmetaobjectbuilder
+ SOURCES
+ tst_qmetaobjectbuilder.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 9fe7d63727..14719f36f8 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -1702,9 +1702,10 @@ void tst_QMetaObjectBuilder::classNameFirstInStringData()
builder.setClassName(QByteArrayLiteral("TestClass"));
QMetaObject *mo = builder.toMetaObject();
- QByteArrayDataPtr header;
- header.ptr = const_cast<QByteArrayData*>(mo->d.stringdata);
- QCOMPARE(QByteArray(header), QByteArrayLiteral("TestClass"));
+ uint offset = mo->d.stringdata[0];
+ uint len = mo->d.stringdata[1];
+ QByteArray className(reinterpret_cast<const char *>(mo->d.stringdata) + offset, len);
+ QCOMPARE(className, QByteArrayLiteral("TestClass"));
free(mo);
}
diff --git a/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt
new file mode 100644
index 0000000000..2d657d5217
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmetaproperty.pro.
+
+#####################################################################
+## tst_qmetaproperty Test:
+#####################################################################
+
+add_qt_test(tst_qmetaproperty
+ SOURCES
+ tst_qmetaproperty.cpp
+)
diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
index cc67fc7884..43ed535019 100644
--- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
+++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
@@ -138,6 +138,7 @@ void tst_QMetaProperty::gadget()
const QMetaObject *mo = &MyGadget::staticMetaObject;
QMetaProperty valueProp = mo->property(mo->indexOfProperty("value"));
QVERIFY(valueProp.isValid());
+ QCOMPARE(valueProp.metaType(), QMetaType::fromType<QString>());
{
MyGadget g;
QString hello = QLatin1String("hello");
diff --git a/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..62d517c27d
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetatype/.prev_CMakeLists.txt
@@ -0,0 +1,42 @@
+# Generated from qmetatype.pro.
+
+#####################################################################
+## tst_qmetatype Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "./typeFlags.bin")
+
+add_qt_test(tst_qmetatype
+ SOURCES
+ tst_qmetatype.cpp
+ DEFINES
+ -QT_NO_LINKED_LIST
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../../other/qvariant_common
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmetatype CONDITION MSVC OR WINRT
+ COMPILE_OPTIONS
+ /bigobj
+)
+
+#### Keys ignored in scope 3:.:.:qmetatype.pro:WINRT:
+# QMAKE_CFLAGS_RELEASE = "--O2"
+# QMAKE_CXXFLAGS_RELEASE = "--O2"
+
+#### Keys ignored in scope 4:.:.:qmetatype.pro:CLANG:
+# QMAKE_CFLAGS_RELEASE = "--O2" "--g"
+# QMAKE_CXXFLAGS_RELEASE = "--O2" "--g"
+
+extend_target(tst_qmetatype CONDITION CLANG AND (TEST_architecture_arch STREQUAL "arm")
+ DEFINES
+ TST_QMETATYPE_BROKEN_COMPILER
+)
diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
new file mode 100644
index 0000000000..3c9bb97825
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
@@ -0,0 +1,42 @@
+# Generated from qmetatype.pro.
+
+#####################################################################
+## tst_qmetatype Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "./typeFlags.bin")
+
+add_qt_test(tst_qmetatype
+ SOURCES
+ tst_qmetatype.cpp
+ DEFINES
+ # -QT_NO_LINKED_LIST # special case remove until we fix this
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../../other/qvariant_common
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmetatype CONDITION MSVC OR WINRT
+ COMPILE_OPTIONS
+ /bigobj
+)
+
+#### Keys ignored in scope 3:.:.:qmetatype.pro:WINRT:
+# QMAKE_CFLAGS_RELEASE = "--O2"
+# QMAKE_CXXFLAGS_RELEASE = "--O2"
+
+#### Keys ignored in scope 4:.:.:qmetatype.pro:CLANG:
+# QMAKE_CFLAGS_RELEASE = "--O2" "--g"
+# QMAKE_CXXFLAGS_RELEASE = "--O2" "--g"
+
+extend_target(tst_qmetatype CONDITION CLANG AND (TEST_architecture_arch STREQUAL "arm")
+ DEFINES
+ TST_QMETATYPE_BROKEN_COMPILER
+)
diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
index 4856b138c3..56b8c071c3 100644
--- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
+++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
@@ -5,7 +5,6 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qmetatype.cpp
TESTDATA=./typeFlags.bin
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-DEFINES -= QT_NO_LINKED_LIST
msvc|winrt {
# Prevents "fatal error C1128: number of sections exceeded object file format limit".
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 19b3289390..0d9dfc1c4c 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -120,17 +120,18 @@ private slots:
void constRefs();
void convertCustomType_data();
void convertCustomType();
- void compareCustomType_data();
- void compareCustomType();
void compareCustomEqualOnlyType();
void customDebugStream();
void unknownType();
void fromType();
+ void operatorEq_data();
+ void operatorEq();
};
struct BaseGenericType
{
int m_typeId = -1;
+ QMetaType m_metatype;
virtual void *constructor(int typeId, void *where, const void *copy) = 0;
virtual void staticMetacallFunction(QMetaObject::Call _c, int _id, void **_a) = 0;
virtual void saveOperator(QDataStream & out) const = 0;
@@ -302,11 +303,19 @@ void tst_QMetaType::registerGadget(const char *name, const QVector<GadgetPropert
meta->d.static_metacall = &GadgetsStaticMetacallFunction;
meta->d.superdata = nullptr;
const auto flags = QMetaType::WasDeclaredAsMetaType | QMetaType::IsGadget | QMetaType::NeedsConstruction | QMetaType::NeedsDestruction;
- int gadgetTypeId = QMetaType::registerType(name,
- &GadgetTypedDestructor,
- &GadgetTypedConstructor,
- sizeof(GenericGadgetType),
- flags, meta);
+ using TypeInfo = QtPrivate::QMetaTypeInterface;
+ auto typeInfo = new TypeInfo {
+ 0, sizeof(GenericGadgetType), alignof(GenericGadgetType), uint(flags), meta, name, 0,
+ QtPrivate::RefCount{ 0 },
+ [](TypeInfo *self) { delete self; },
+ [](const TypeInfo *self, void *where) { GadgetTypedConstructor(self->typeId, where, nullptr); },
+ [](const TypeInfo *self, void *where, const void *copy) { GadgetTypedConstructor(self->typeId, where, copy); },
+ [](const TypeInfo *self, void *where, void *copy) { GadgetTypedConstructor(self->typeId, where, copy); },
+ [](const TypeInfo *self, void *ptr) { GadgetTypedDestructor(self->typeId, ptr); },
+ nullptr };
+ QMetaType gadgetMetaType(typeInfo);
+ dynamicGadgetProperties->m_metatype = gadgetMetaType;
+ int gadgetTypeId = QMetaType(typeInfo).id();
QVERIFY(gadgetTypeId > 0);
QMetaType::registerStreamOperators(gadgetTypeId, &GadgetSaveOperator, &GadgetLoadOperator);
s_managedTypes[gadgetTypeId] = qMakePair(dynamicGadgetProperties, std::shared_ptr<QMetaObject>{meta, [](QMetaObject *ptr){ ::free(ptr); }});
@@ -392,10 +401,6 @@ protected:
++failureCount;
qWarning() << "Wrong metatype returned for" << name;
}
- if (QMetaType::typeName(tp) != name) {
- ++failureCount;
- qWarning() << "Wrong typeName returned for" << tp;
- }
void *buf1 = QMetaType::create(tp, 0);
void *buf2 = QMetaType::create(tp, buf1);
void *buf3 = info.create(tp, 0);
@@ -574,11 +579,13 @@ void tst_QMetaType::typeName_data()
QTest::newRow("124125534") << 124125534 << QString();
// automatic registration
- QTest::newRow("QList<int>") << ::qMetaTypeId<QList<int> >() << QString::fromLatin1("QList<int>");
QTest::newRow("QHash<int,int>") << ::qMetaTypeId<QHash<int, int> >() << QString::fromLatin1("QHash<int,int>");
QTest::newRow("QMap<int,int>") << ::qMetaTypeId<QMap<int, int> >() << QString::fromLatin1("QMap<int,int>");
- QTest::newRow("QVector<QList<int>>") << ::qMetaTypeId<QVector<QList<int> > >() << QString::fromLatin1("QVector<QList<int> >");
- QTest::newRow("QVector<QMap<int,int>>") << ::qMetaTypeId<QVector<QMap<int, int> > >() << QString::fromLatin1("QVector<QMap<int,int> >");
+ QTest::newRow("QVector<QMap<int,int>>") << ::qMetaTypeId<QVector<QMap<int, int> > >() << QString::fromLatin1("QVector<QMap<int,int>>");
+
+ // automatic registration with automatic QList to QVector aliasing
+ QTest::newRow("QList<int>") << ::qMetaTypeId<QList<int> >() << QString::fromLatin1("QVector<int>");
+ QTest::newRow("QVector<QList<int>>") << ::qMetaTypeId<QVector<QList<int> > >() << QString::fromLatin1("QVector<QVector<int>>");
QTest::newRow("CustomQObject*") << ::qMetaTypeId<CustomQObject*>() << QString::fromLatin1("CustomQObject*");
QTest::newRow("CustomGadget") << ::qMetaTypeId<CustomGadget>() << QString::fromLatin1("CustomGadget");
@@ -1006,6 +1013,10 @@ void tst_QMetaType::flagsBinaryCompatibility5_0_data()
for (int i = 0; i < buffer.size(); i+=2) {
const quint32 id = buffer.at(i);
const quint32 flags = buffer.at(i + 1);
+ if (id > QMetaType::LastCoreType)
+ continue; // We do not link against QtGui, so we do longer consider such type as registered
+ if (id == QMetaType::Void)
+ continue; // The meaning of QMetaType::Void has changed in Qt6
QVERIFY2(QMetaType::isRegistered(id), "A type could not be removed in BC way");
QTest::newRow(QMetaType::typeName(id)) << id << flags;
}
@@ -1032,9 +1043,9 @@ static void testConstructHelper()
typedef typename MetaEnumToType<ID>::Type Type;
QMetaType info(ID);
int size = info.sizeOf();
- void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage1 = qMallocAligned(size, alignof(Type));
void *actual1 = QMetaType::construct(ID, storage1, /*copy=*/0);
- void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage2 = qMallocAligned(size, alignof(Type));
void *actual2 = info.construct(storage2, /*copy=*/0);
QCOMPARE(actual1, storage1);
QCOMPARE(actual2, storage2);
@@ -1158,11 +1169,19 @@ void tst_QMetaType::typedConstruct()
auto dynamicGadgetProperties = std::make_shared<GenericPODType>();
dynamicGadgetProperties->podData = myPodTesData;
const auto flags = QMetaType::NeedsConstruction | QMetaType::NeedsDestruction;
- int podTypeId = QMetaType::registerType(podTypeName,
- &GadgetTypedDestructor,
- &GadgetTypedConstructor,
- sizeof(GenericGadgetType),
- flags, nullptr);
+ using TypeInfo = QtPrivate::QMetaTypeInterface;
+ auto typeInfo = new TypeInfo {
+ 0, sizeof(GenericGadgetType), alignof(GenericGadgetType), uint(flags), nullptr, podTypeName,
+ 0, QtPrivate::RefCount{0},
+ [](TypeInfo *self) { delete self; },
+ [](const TypeInfo *self, void *where) { GadgetTypedConstructor(self->typeId, where, nullptr); },
+ [](const TypeInfo *self, void *where, const void *copy) { GadgetTypedConstructor(self->typeId, where, copy); },
+ [](const TypeInfo *self, void *where, void *copy) { GadgetTypedConstructor(self->typeId, where, copy); },
+ [](const TypeInfo *self, void *ptr) { GadgetTypedDestructor(self->typeId, ptr); },
+ nullptr };
+ QMetaType metatype(typeInfo);
+ dynamicGadgetProperties->m_metatype = metatype;
+ int podTypeId = metatype.id();
QVERIFY(podTypeId > 0);
QMetaType::registerStreamOperators(podTypeId, &GadgetSaveOperator, &GadgetLoadOperator);
s_managedTypes[podTypeId] = qMakePair(dynamicGadgetProperties, std::shared_ptr<QMetaObject>{});
@@ -1186,9 +1205,9 @@ static void testConstructCopyHelper()
QMetaType info(ID);
int size = QMetaType::sizeOf(ID);
QCOMPARE(info.sizeOf(), size);
- void *storage1 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage1 = qMallocAligned(size, alignof(Type));
void *actual1 = QMetaType::construct(ID, storage1, expected);
- void *storage2 = qMallocAligned(size, Q_ALIGNOF(Type));
+ void *storage2 = qMallocAligned(size, alignof(Type));
void *actual2 = info.construct(storage2, expected);
QCOMPARE(actual1, storage1);
QCOMPARE(actual2, storage2);
@@ -1309,54 +1328,6 @@ void tst_QMetaType::registerType()
QCOMPARE(qRegisterMetaType<MyFoo>("MyFoo"), fooId);
QCOMPARE(QMetaType::type("MyFoo"), fooId);
-
- // cannot unregister built-in types
- QVERIFY(!QMetaType::unregisterType(QMetaType::QString));
- QCOMPARE(QMetaType::type("QString"), int(QMetaType::QString));
- QCOMPARE(QMetaType::type("MyString"), int(QMetaType::QString));
-
- // cannot unregister declared types
- QVERIFY(!QMetaType::unregisterType(fooId));
- QCOMPARE(QMetaType::type("TestSpace::Foo"), fooId);
- QCOMPARE(QMetaType::type("MyFoo"), fooId);
-
- // test unregistration of dynamic types (used by Qml)
- int unregId = QMetaType::registerType("UnregisterMe",
- 0,
- 0,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct,
- 0, QMetaType::TypeFlags(), 0);
- QCOMPARE(QMetaType::registerTypedef("UnregisterMeTypedef", unregId), unregId);
- int unregId2 = QMetaType::registerType("UnregisterMe2",
- 0,
- 0,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct,
- 0, QMetaType::TypeFlags(), 0);
- QVERIFY(unregId >= int(QMetaType::User));
- QCOMPARE(unregId2, unregId + 2);
-
- QVERIFY(QMetaType::unregisterType(unregId));
- QCOMPARE(QMetaType::type("UnregisterMe"), 0);
- QCOMPARE(QMetaType::type("UnregisterMeTypedef"), 0);
- QCOMPARE(QMetaType::type("UnregisterMe2"), unregId2);
- QVERIFY(QMetaType::unregisterType(unregId2));
- QCOMPARE(QMetaType::type("UnregisterMe2"), 0);
-
- // re-registering should always return the lowest free index
- QCOMPARE(QMetaType::registerType("UnregisterMe2",
- 0,
- 0,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct,
- 0, QMetaType::TypeFlags(), 0), unregId);
- QCOMPARE(QMetaType::registerType("UnregisterMe",
- 0,
- 0,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<void>::Construct,
- 0, QMetaType::TypeFlags(), 0), unregId + 1);
}
class IsRegisteredDummyType { };
@@ -1367,7 +1338,7 @@ void tst_QMetaType::isRegistered_data()
QTest::addColumn<bool>("registered");
// predefined/custom types
- QTest::newRow("QMetaType::Void") << int(QMetaType::Void) << true;
+ QTest::newRow("QMetaType::Void") << int(QMetaType::Void) << false;
QTest::newRow("QMetaType::Int") << int(QMetaType::Int) << true;
int dummyTypeId = qRegisterMetaType<IsRegisteredDummyType>("IsRegisteredDummyType");
@@ -1733,8 +1704,8 @@ void tst_QMetaType::automaticTemplateRegistration()
CONTAINER< __VA_ARGS__ > t; \
const QVariant v = QVariant::fromValue(t); \
QByteArray tn = createTypeName(#CONTAINER "<", #__VA_ARGS__); \
- const int type = QMetaType::type(tn); \
const int expectedType = ::qMetaTypeId<CONTAINER< __VA_ARGS__ > >(); \
+ const int type = QMetaType::type(tn); \
QCOMPARE(type, expectedType); \
QCOMPARE((QMetaType::fromType<CONTAINER< __VA_ARGS__ >>().id()), expectedType); \
}
@@ -1742,7 +1713,6 @@ void tst_QMetaType::automaticTemplateRegistration()
#define FOR_EACH_1ARG_TEMPLATE_TYPE(F, TYPE) \
F(QList, TYPE) \
F(QVector, TYPE) \
- F(QLinkedList, TYPE) \
F(QVector, TYPE) \
F(QVector, TYPE) \
F(QQueue, TYPE) \
@@ -1777,7 +1747,7 @@ void tst_QMetaType::automaticTemplateRegistration()
PRINT_2ARG_TEMPLATE
)
- CREATE_AND_VERIFY_CONTAINER(QList, QList<QMap<int, QHash<char, QVariantList> > >)
+ CREATE_AND_VERIFY_CONTAINER(QList, QList<QMap<int, QHash<char, QList<QVariant> > > >)
CREATE_AND_VERIFY_CONTAINER(QVector, void*)
CREATE_AND_VERIFY_CONTAINER(QVector, const void*)
CREATE_AND_VERIFY_CONTAINER(QList, void*)
@@ -2017,7 +1987,7 @@ void tst_QMetaType::metaObject_data()
QTest::newRow("MyGadget") << ::qMetaTypeId<MyGadget>() << &MyGadget::staticMetaObject << true << false << false;
QTest::newRow("MyGadget*") << ::qMetaTypeId<MyGadget*>() << &MyGadget::staticMetaObject << false << true << false;
QTest::newRow("MyEnum") << ::qMetaTypeId<MyGadget::MyEnum>() << &MyGadget::staticMetaObject << false << false << false;
- QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &QObject::staticQtMetaObject << false << false << false;
+ QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &Qt::staticMetaObject << false << false << false;
QTest::newRow("MyQObjectFromGadget*") << ::qMetaTypeId<MyQObjectFromGadget*>() << &MyQObjectFromGadget::staticMetaObject << false << false << true;
QTest::newRow("GadgetDerivedAndTyped<int>") << ::qMetaTypeId<GadgetDerivedAndTyped<int>>() << &GadgetDerivedAndTyped<int>::staticMetaObject << true << false << false;
@@ -2139,7 +2109,7 @@ struct CustomConvertibleType
};
bool operator<(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
-{ return lhs.m_foo < rhs.m_foo; }
+{ return lhs.m_foo.toString() < rhs.m_foo.toString(); }
bool operator==(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
{ return lhs.m_foo == rhs.m_foo; }
bool operator!=(const CustomConvertibleType &lhs, const CustomConvertibleType &rhs)
@@ -2429,43 +2399,6 @@ void tst_QMetaType::convertCustomType()
QCOMPARE(v.value<CustomConvertibleType2>().m_foo, testCustom.m_foo);
}
-void tst_QMetaType::compareCustomType_data()
-{
- QMetaType::registerComparators<CustomConvertibleType>();
-
- QTest::addColumn<QVariantList>("unsorted");
- QTest::addColumn<QVariantList>("sorted");
-
- QTest::newRow("int") << (QVariantList() << 37 << 458 << 1 << 243 << -4 << 383)
- << (QVariantList() << -4 << 1 << 37 << 243 << 383 << 458);
-
- QTest::newRow("dobule") << (QVariantList() << 4934.93 << 0.0 << 302.39 << -39.0)
- << (QVariantList() << -39.0 << 0.0 << 302.39 << 4934.93);
-
- QTest::newRow("QString") << (QVariantList() << "Hello" << "World" << "this" << "is" << "a" << "test")
- << (QVariantList() << "a" << "Hello" << "is" << "test" << "this" << "World");
-
- QTest::newRow("QTime") << (QVariantList() << QTime(14, 39) << QTime(0, 0) << QTime(18, 18) << QTime(9, 27))
- << (QVariantList() << QTime(0, 0) << QTime(9, 27) << QTime(14, 39) << QTime(18, 18));
-
- QTest::newRow("QDate") << (QVariantList() << QDate(2013, 3, 23) << QDate(1900, 12, 1) << QDate(2001, 2, 2) << QDate(1982, 12, 16))
- << (QVariantList() << QDate(1900, 12, 1) << QDate(1982, 12, 16) << QDate(2001, 2, 2) << QDate(2013, 3, 23));
-
- QTest::newRow("mixed") << (QVariantList() << "Hello" << "World" << QChar('a') << 38 << QChar('z') << -39 << 4.6)
- << (QVariantList() << -39 << 4.6 << 38 << QChar('a') << "Hello" << "World" << QChar('z'));
-
- QTest::newRow("custom") << (QVariantList() << QVariant::fromValue(CustomConvertibleType(1)) << QVariant::fromValue(CustomConvertibleType(100)) << QVariant::fromValue(CustomConvertibleType(50)))
- << (QVariantList() << QVariant::fromValue(CustomConvertibleType(1)) << QVariant::fromValue(CustomConvertibleType(50)) << QVariant::fromValue(CustomConvertibleType(100)));
-}
-
-void tst_QMetaType::compareCustomType()
-{
- QFETCH(QVariantList, unsorted);
- QFETCH(QVariantList, sorted);
- std::sort(unsorted.begin(), unsorted.end());
- QCOMPARE(unsorted, sorted);
-}
-
void tst_QMetaType::compareCustomEqualOnlyType()
{
int metaTypeId = qRegisterMetaType<CustomEqualsOnlyType>();
@@ -2487,11 +2420,6 @@ void tst_QMetaType::compareCustomEqualOnlyType()
QCOMPARE(variant100, variant100x);
QCOMPARE(variant100, variant100);
- // compare always fails
- QVERIFY(!(variant50 < variant50));
- QVERIFY(!(variant50 < variant100));
- QVERIFY(!(variant100 < variant50));
-
// check QMetaType::compare works/doesn't crash for equals only comparators
bool wasSuccess = QMetaType::compare(variant50.constData(), variant50.constData(),
metaTypeId, &result);
@@ -2588,7 +2516,8 @@ void tst_QMetaType::fromType()
QCOMPARE(QMetaType::fromType<RealType>(), QMetaType(MetaTypeId)); \
QVERIFY(QMetaType::fromType<RealType>() == QMetaType(MetaTypeId)); \
QVERIFY(!(QMetaType::fromType<RealType>() != QMetaType(MetaTypeId))); \
- QCOMPARE(QMetaType::fromType<RealType>().id(), MetaTypeId);
+ if (MetaTypeId != QMetaType::Void) \
+ QCOMPARE(QMetaType::fromType<RealType>().id(), MetaTypeId);
FOR_EACH_CORE_METATYPE(FROMTYPE_CHECK)
@@ -2600,6 +2529,50 @@ void tst_QMetaType::fromType()
#undef FROMTYPE_CHECK
}
+template<char X, typename T = void>
+struct CharTemplate
+{
+ struct
+ {
+ int a;
+ } x;
+};
+
+void tst_QMetaType::operatorEq_data()
+{
+ QTest::addColumn<QMetaType>("typeA");
+ QTest::addColumn<QMetaType>("typeB");
+ QTest::addColumn<bool>("eq");
+
+ QTest::newRow("String") << QMetaType(QMetaType::QString)
+ << QMetaType::fromType<const QString &>() << true;
+ QTest::newRow("void1") << QMetaType(QMetaType::UnknownType) << QMetaType::fromType<void>()
+ << true;
+ QTest::newRow("void2") << QMetaType::fromType<const void>() << QMetaType::fromType<void>()
+ << true;
+ QTest::newRow("vec1") << QMetaType::fromType<QVector<const int *>>()
+ << QMetaType::fromType<QVector<const int *>>() << true;
+ QTest::newRow("vec2") << QMetaType::fromType<QVector<const int *>>()
+ << QMetaType::fromType<QVector<int *>>() << false;
+ QTest::newRow("char1") << QMetaType::fromType<CharTemplate<'>'>>()
+ << QMetaType::fromType<CharTemplate<'>', void>>() << true;
+ QTest::newRow("annon1") << QMetaType::fromType<decltype(CharTemplate<'>'>::x)>()
+ << QMetaType::fromType<decltype(CharTemplate<'>'>::x)>() << true;
+ QTest::newRow("annon2") << QMetaType::fromType<decltype(CharTemplate<'>'>::x)>()
+ << QMetaType::fromType<decltype(CharTemplate<'<'>::x)>() << false;
+}
+
+void tst_QMetaType::operatorEq()
+{
+ QFETCH(QMetaType, typeA);
+ QFETCH(QMetaType, typeB);
+ QFETCH(bool, eq);
+
+ QCOMPARE(typeA == typeB, eq);
+ QCOMPARE(typeB == typeA, eq);
+ QCOMPARE(typeA != typeB, !eq);
+ QCOMPARE(typeB != typeA, !eq);
+}
// Compile-time test, it should be possible to register function pointer types
class Undefined;
diff --git a/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt b/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt
new file mode 100644
index 0000000000..b4965302dd
--- /dev/null
+++ b/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmimedata.pro.
+
+#####################################################################
+## tst_qmimedata Test:
+#####################################################################
+
+add_qt_test(tst_qmimedata
+ SOURCES
+ tst_qmimedata.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/kernel/qobject/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/CMakeLists.txt
new file mode 100644
index 0000000000..3be3287532
--- /dev/null
+++ b/tests/auto/corelib/kernel/qobject/CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from qobject.pro.
+
+#####################################################################
+## tst_qobject Test:
+#####################################################################
+
+add_qt_test(tst_qobject
+ SOURCES
+ tst_qobject.cpp
+ DEFINES
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Network
+)
+
+#### Keys ignored in scope 3:.:.:test.pro:<TRUE>:
+# CONFIG = "testcase" "console"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 4:.:.:test.pro:QT_CONFIG___contains___c++1z:
+# CONFIG = "c++1z"
+
+if(NOT WINRT)
+ add_subdirectory(signalbug)
+endif()
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt
new file mode 100644
index 0000000000..e798028b1b
--- /dev/null
+++ b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from signalbug.pro.
+
+#####################################################################
+## signalbug_helper Binary:
+#####################################################################
+
+add_qt_test_helper(signalbug_helper
+ SOURCES
+ signalbug.cpp signalbug.h
+)
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 21615d6ec4..b1d3ea19d6 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -81,9 +81,6 @@ private slots:
void senderTest();
void declareInterface();
void qpointerResetBeforeDestroyedSignal();
-#ifndef QT_NO_USERDATA
- void testUserData();
-#endif
void childDeletesItsSibling();
void dynamicProperties();
void floatProperty();
@@ -463,7 +460,7 @@ void tst_QObject::connectSlotsByName()
sender.setObjectName("Sender");
QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()");
- QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: QVector(\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")");
QMetaObject::connectSlotsByName(&receiver);
receiver.called_slots.clear();
@@ -1917,7 +1914,7 @@ void tst_QObject::property()
property = mo->property(mo->indexOfProperty("alpha"));
QVERIFY(property.isEnumType());
QCOMPARE(property.typeName(), "Alpha");
- QCOMPARE(property.type(), QVariant::Int);
+ QCOMPARE(property.userType(), QMetaType::fromType<PropertyObject::Alpha>().id());
QVariant var = object.property("alpha");
QVERIFY(!var.isNull());
@@ -1928,7 +1925,8 @@ void tst_QObject::property()
QCOMPARE(object.property("alpha").toInt(), int(PropertyObject::Alpha2));
QVERIFY(object.setProperty("alpha", "Alpha1"));
QCOMPARE(object.property("alpha").toInt(), int(PropertyObject::Alpha1));
- QVERIFY(!object.setProperty("alpha", QVariant()));
+ QVERIFY(object.setProperty("alpha", QVariant()));
+ QCOMPARE(object.property("alpha").toInt(), 0);
QVERIFY(mo->indexOfProperty("number") != -1);
QCOMPARE(object.property("number").toInt(), 0);
@@ -1998,7 +1996,7 @@ void tst_QObject::property()
property = mo->property(mo->indexOfProperty("priority"));
QVERIFY(property.isEnumType());
QCOMPARE(property.typeName(), "Priority");
- QCOMPARE(property.type(), QVariant::Int);
+ QCOMPARE(property.userType(), QMetaType::fromType<PropertyObject::Priority>().id());
var = object.property("priority");
QVERIFY(!var.isNull());
@@ -2009,7 +2007,8 @@ void tst_QObject::property()
QCOMPARE(object.property("priority").toInt(), int(PropertyObject::VeryHigh));
QVERIFY(object.setProperty("priority", "High"));
QCOMPARE(object.property("priority").toInt(), int(PropertyObject::High));
- QVERIFY(!object.setProperty("priority", QVariant()));
+ QVERIFY(object.setProperty("priority", QVariant()));
+ QCOMPARE(object.property("priority").toInt(), 0);
// now it's registered, so it works as expected
int priorityMetaTypeId = qRegisterMetaType<PropertyObject::Priority>("PropertyObject::Priority");
@@ -2031,7 +2030,8 @@ void tst_QObject::property()
QCOMPARE(qvariant_cast<PropertyObject::Priority>(object.property("priority")), PropertyObject::VeryHigh);
QVERIFY(object.setProperty("priority", "High"));
QCOMPARE(qvariant_cast<PropertyObject::Priority>(object.property("priority")), PropertyObject::High);
- QVERIFY(!object.setProperty("priority", QVariant()));
+ QVERIFY(object.setProperty("priority", QVariant()));
+ QCOMPARE(object.property("priority").toInt(), 0);
var = object.property("priority");
QCOMPARE(qvariant_cast<PropertyObject::Priority>(var), PropertyObject::High);
@@ -2341,51 +2341,6 @@ void tst_QObject::declareInterface()
}
-#ifndef QT_NO_USERDATA
-class CustomData : public QObjectUserData
-{
-public:
- int id;
-};
-
-void tst_QObject::testUserData()
-{
- const int USER_DATA_COUNT = 100;
- int user_data_ids[USER_DATA_COUNT];
-
- // Register a few
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- user_data_ids[i] = QObject::registerUserData();
- }
-
- // Randomize the table a bit
- for (int i=0; i<100; ++i) {
- int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
- int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
-
- int tmp = user_data_ids[p1];
- user_data_ids[p1] = user_data_ids[p2];
- user_data_ids[p2] = tmp;
- }
-
- // insert the user data into an object
- QObject my_test_object;
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- CustomData *data = new CustomData;
- data->id = user_data_ids[i];
- my_test_object.setUserData(data->id, data);
- }
-
- // verify that all ids and positions are matching
- for (int i=0; i<USER_DATA_COUNT; ++i) {
- int id = user_data_ids[i];
- CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
- QVERIFY(data != nullptr);
- QCOMPARE(data->id, id);
- }
-}
-#endif // QT_NO_USERDATA
-
class DestroyedListener : public QObject
{
Q_OBJECT
@@ -6974,8 +6929,7 @@ void tst_QObject::noDeclarativeParentChangedOnDestruction()
QObject *parent = new QObject;
QObject *child = new QObject;
- QAbstractDeclarativeDataImpl dummy;
- dummy.ownedByQml1 = false;
+ QAbstractDeclarativeData dummy;
QObjectPrivate::get(child)->declarativeData = &dummy;
parentChangeCalled = false;
diff --git a/tests/auto/corelib/kernel/qpointer/CMakeLists.txt b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt
new file mode 100644
index 0000000000..804a3a9def
--- /dev/null
+++ b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qpointer.pro.
+
+#####################################################################
+## tst_qpointer Test:
+#####################################################################
+
+add_qt_test(tst_qpointer
+ SOURCES
+ tst_qpointer.cpp
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qpointer CONDITION TARGET Qt::Widgets
+ PUBLIC_LIBRARIES
+ Qt::Widgets
+)
diff --git a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt
new file mode 100644
index 0000000000..366e76d034
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Generated from qsharedmemory.pro.
+
+
+if(QT_FEATURE_sharedmemory)
+ #####################################################################
+ ## tst_qsharedmemory Test:
+ #####################################################################
+
+ add_qt_test(tst_qsharedmemory
+ SOURCES
+ tst_qsharedmemory.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ )
+
+#### Keys ignored in scope 4:.:.:test.pro:<TRUE>:
+ # CONFIG = "testcase"
+
+ ## Scopes:
+ #####################################################################
+
+ extend_target(tst_qsharedmemory CONDITION LINUX
+ PUBLIC_LIBRARIES
+ rt
+ )
+
+ if(NOT WINRT)
+ add_subdirectory(producerconsumer)
+ endif()
+endif()
diff --git a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt
new file mode 100644
index 0000000000..2e16a673b1
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from producerconsumer.pro.
+
+#####################################################################
+## producerconsumer_helper Binary:
+#####################################################################
+
+add_qt_test_helper(producerconsumer_helper
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Test
+)
diff --git a/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt b/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt
new file mode 100644
index 0000000000..ae86137c94
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsignalblocker.pro.
+
+#####################################################################
+## tst_qsignalblocker Test:
+#####################################################################
+
+add_qt_test(tst_qsignalblocker
+ SOURCES
+ tst_qsignalblocker.cpp
+)
diff --git a/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt b/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt
new file mode 100644
index 0000000000..1360e76ea1
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsignalmapper.pro.
+
+#####################################################################
+## tst_qsignalmapper Test:
+#####################################################################
+
+add_qt_test(tst_qsignalmapper
+ SOURCES
+ tst_qsignalmapper.cpp
+)
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.txt b/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.txt
new file mode 100644
index 0000000000..cb847dc503
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Generated from qsocketnotifier.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qsocketnotifier Test:
+#####################################################################
+
+add_qt_test(tst_qsocketnotifier
+ SOURCES
+ tst_qsocketnotifier.cpp
+ INCLUDE_DIRECTORIES
+ ${QT_SOURCE_TREE}/src/network
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Network
+ Qt::NetworkPrivate
+)
+
+#### Keys ignored in scope 1:.:.:qsocketnotifier.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qsocketnotifier CONDITION WIN32
+ PUBLIC_LIBRARIES
+ ws2_32
+)
+
+extend_target(tst_qsocketnotifier CONDITION QT_FEATURE_reduce_exports AND UNIX
+ SOURCES
+ ${QT_SOURCE_TREE}/src/network/socket/qabstractsocketengine.cpp ${QT_SOURCE_TREE}/src/network/socket/qabstractsocketengine_p.h
+ ${QT_SOURCE_TREE}/src/network/socket/qnativesocketengine.cpp ${QT_SOURCE_TREE}/src/network/socket/qnativesocketengine_p.h
+ ${QT_SOURCE_TREE}/src/network/socket/qnativesocketengine_unix.cpp
+)
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt
new file mode 100644
index 0000000000..1e6889eec0
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Generated from qsystemsemaphore.pro.
+
+add_subdirectory(acquirerelease)
+#####################################################################
+## tst_qsystemsemaphore Test:
+#####################################################################
+
+add_qt_test(tst_qsystemsemaphore
+ SOURCES
+ tst_qsystemsemaphore.cpp
+)
+
+#### Keys ignored in scope 2:.:.:test.pro:<TRUE>:
+# CONFIG = "testcase"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 3:.:.:test.pro:WIN32:
+# CONFIG = "console"
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt
new file mode 100644
index 0000000000..ddce7297d2
--- /dev/null
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from acquirerelease.pro.
+
+#####################################################################
+## acquirerelease_helper Binary:
+#####################################################################
+
+add_qt_test_helper(acquirerelease_helper
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Test
+)
diff --git a/tests/auto/corelib/kernel/qtimer/CMakeLists.txt b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt
new file mode 100644
index 0000000000..84585751ac
--- /dev/null
+++ b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qtimer.pro.
+
+#####################################################################
+## tst_qtimer Test:
+#####################################################################
+
+add_qt_test(tst_qtimer
+ SOURCES
+ tst_qtimer.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt
new file mode 100644
index 0000000000..79e44bc928
--- /dev/null
+++ b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt
@@ -0,0 +1,47 @@
+# Generated from qtranslator.pro.
+
+#####################################################################
+## tst_qtranslator Test:
+#####################################################################
+
+add_qt_test(tst_qtranslator
+ SOURCES
+ tst_qtranslator.cpp
+)
+
+# Resources:
+set(qtranslator_resource_files
+ "hellotr_empty.qm"
+ "hellotr_la.qm"
+)
+
+add_qt_resource(tst_qtranslator "qtranslator"
+ PREFIX
+ "/tst_qtranslator"
+ FILES
+ ${qtranslator_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(android_testdata_resource_files
+ "dependencies_la.qm"
+ "hellotr_empty.qm"
+ "hellotr_la.qm"
+ "msgfmt_from_po.qm"
+ )
+
+ add_qt_resource(tst_qtranslator "android_testdata"
+ PREFIX
+ "/android_testdata"
+ FILES
+ ${android_testdata_resource_files}
+ )
+endif()
+
+#### Keys ignored in scope 3:.:.:qtranslator.pro:else:
+# TESTDATA = "dependencies_la.qm" "hellotr_empty.qm" "hellotr_la.qm" "msgfmt_from_po.qm"
diff --git a/tests/auto/corelib/kernel/qvariant/.prev_CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..dc676d11fe
--- /dev/null
+++ b/tests/auto/corelib/kernel/qvariant/.prev_CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from qvariant.pro.
+
+#####################################################################
+## tst_qvariant Test:
+#####################################################################
+
+add_qt_test(tst_qvariant
+ SOURCES
+ tst_qvariant.cpp
+ DEFINES
+ -QT_NO_LINKED_LIST
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../../other/qvariant_common
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+# Resources:
+set(qvariant_resource_files
+ "stream/qt4.9/"
+ "stream/qt5.0/"
+)
+
+add_qt_resource(tst_qvariant "qvariant"
+ PREFIX
+ "/"
+ FILES
+ ${qvariant_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt
new file mode 100644
index 0000000000..dff731cfc2
--- /dev/null
+++ b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from qvariant.pro.
+
+#####################################################################
+## tst_qvariant Test:
+#####################################################################
+
+add_qt_test(tst_qvariant
+ SOURCES
+ tst_qvariant.cpp
+ DEFINES
+ # -QT_NO_LINKED_LIST # special case remove until we fix this
+ QT_DISABLE_DEPRECATED_BEFORE=0
+ INCLUDE_DIRECTORIES
+ ../../../other/qvariant_common
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+# Resources:
+set(qvariant_resource_files
+ "stream/qt4.9/"
+ "stream/qt5.0/"
+)
+
+add_qt_resource(tst_qvariant "qvariant"
+ PREFIX
+ "/"
+ FILES
+ ${qvariant_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro
index 0b5280df86..a620be0091 100644
--- a/tests/auto/corelib/kernel/qvariant/qvariant.pro
+++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro
@@ -5,7 +5,6 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qvariant.cpp
RESOURCES += qvariant.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-DEFINES -= QT_NO_LINKED_LIST
qtConfig(c++14): CONFIG += c++14
qtConfig(c++1z): CONFIG += c++1z
!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 5af1353a0f..22464daf67 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -49,7 +49,6 @@
#if __has_include(<variant>) && __cplusplus >= 201703L
#include <variant>
#endif
-#include <QLinkedList>
#include <QRegularExpression>
#include <QDir>
#include <QBuffer>
@@ -190,8 +189,6 @@ private slots:
void operator_eq_eq_data();
void operator_eq_eq();
void operator_eq_eq_rhs();
- void compareNumbers_data() const;
- void compareNumbers() const;
void typeName_data();
void typeName();
@@ -270,9 +267,6 @@ private slots:
void enums();
void metaEnums();
- void compareSanity_data();
- void compareSanity();
- void compareRich();
void nullConvert();
@@ -355,13 +349,13 @@ void tst_QVariant::constructor_invalid()
QFETCH(uint, typeId);
{
- QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type"));
QVariant variant(static_cast<QVariant::Type>(typeId));
QVERIFY(!variant.isValid());
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
}
{
- QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type"));
QVariant variant(typeId, /* copy */ 0);
QVERIFY(!variant.isValid());
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
@@ -1439,10 +1433,7 @@ void tst_QVariant::checkDataStream()
const int typeId = QMetaType::LastCoreType + 1;
QVERIFY(!QMetaType::isRegistered(typeId));
- QByteArray errorMessage("Trying to construct an instance of an invalid type, type id: ");
- errorMessage.append(QString::number(typeId, 10));
-
- QTest::ignoreMessage(QtWarningMsg, errorMessage.constData());
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type"));
QByteArray settingsHex("000000");
settingsHex.append(QString::number(typeId, 16));
settingsHex.append("ffffffffff");
@@ -1732,344 +1723,6 @@ void tst_QVariant::operator_eq_eq_rhs()
#endif
}
-void tst_QVariant::compareNumbers_data() const
-{
- typedef signed char schar;
- QTest::addColumn<QVariant>("v1");
- QTest::addColumn<QVariant>("v2");
- QTest::addColumn<int>("expected");
-
- // sanity checking: same types
- QTest::newRow("bool1") << QVariant(false) << QVariant(false) << 0;
- QTest::newRow("bool2") << QVariant(true) << QVariant(true) << 0;
- QTest::newRow("bool3") << QVariant(false) << QVariant(true) << -1;
- QTest::newRow("bool4") << QVariant(true) << QVariant(false) << +1;
-
- QTest::newRow("char1") << QVariant::fromValue(char(0)) << QVariant::fromValue(char(0)) << 0;
- QTest::newRow("char2") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(CHAR_MAX) << 0;
- QTest::newRow("char3") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(CHAR_MIN) << 0;
- QTest::newRow("char4") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(CHAR_MAX) << -1;
- QTest::newRow("char5") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(CHAR_MIN) << +1;
-
- QTest::newRow("schar1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(schar(0)) << 0;
- QTest::newRow("schar2") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(SCHAR_MAX) << 0;
- QTest::newRow("schar3") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(SCHAR_MIN) << 0;
- QTest::newRow("schar4") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(SCHAR_MAX) << -1;
- QTest::newRow("schar5") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(SCHAR_MIN) << +1;
-
- QTest::newRow("uchar1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(uchar(0)) << 0;
- QTest::newRow("uchar2") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(UCHAR_MAX) << 0;
- QTest::newRow("uchar3") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(UCHAR_MAX) << -1;
- QTest::newRow("uchar4") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(uchar(0)) << +1;
-
- QTest::newRow("short1") << QVariant::fromValue(short(0)) << QVariant::fromValue(short(0)) << 0;
- QTest::newRow("short2") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(SHRT_MAX) << 0;
- QTest::newRow("short3") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(SHRT_MIN) << 0;
- QTest::newRow("short4") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(SHRT_MAX) << -1;
- QTest::newRow("short5") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(SHRT_MIN) << +1;
-
- QTest::newRow("ushort1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(ushort(0)) << 0;
- QTest::newRow("ushort2") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(USHRT_MAX) << 0;
- QTest::newRow("ushort3") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(USHRT_MAX) << -1;
- QTest::newRow("ushort4") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(ushort(0)) << +1;
-
- QTest::newRow("int1") << QVariant::fromValue(int(0)) << QVariant::fromValue(int(0)) << 0;
- QTest::newRow("int2") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(INT_MAX) << 0;
- QTest::newRow("int3") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(INT_MIN) << 0;
- QTest::newRow("int4") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("int5") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(INT_MIN) << +1;
-
- QTest::newRow("uint1") << QVariant::fromValue(uint(0)) << QVariant::fromValue(uint(0)) << 0;
- QTest::newRow("uint2") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("uint3") << QVariant::fromValue(uint(0)) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("uint4") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(uint(0)) << +1;
-
- QTest::newRow("long1") << QVariant::fromValue(long(0)) << QVariant::fromValue(long(0)) << 0;
- QTest::newRow("long2") << QVariant::fromValue(LONG_MAX) << QVariant::fromValue(LONG_MAX) << 0;
- QTest::newRow("long3") << QVariant::fromValue(LONG_MIN) << QVariant::fromValue(LONG_MIN) << 0;
- QTest::newRow("long4") << QVariant::fromValue(LONG_MIN) << QVariant::fromValue(LONG_MAX) << -1;
- QTest::newRow("long5") << QVariant::fromValue(LONG_MAX) << QVariant::fromValue(LONG_MIN) << +1;
-
- QTest::newRow("ulong1") << QVariant::fromValue(ulong(0)) << QVariant::fromValue(ulong(0)) << 0;
- QTest::newRow("ulong2") << QVariant::fromValue(ULONG_MAX) << QVariant::fromValue(ULONG_MAX) << 0;
- QTest::newRow("ulong3") << QVariant::fromValue(ulong(0)) << QVariant::fromValue(ULONG_MAX) << -1;
- QTest::newRow("ulong4") << QVariant::fromValue(ULONG_MAX) << QVariant::fromValue(ulong(0)) << +1;
-
- QTest::newRow("llong1") << QVariant::fromValue(qlonglong(0)) << QVariant::fromValue(qlonglong(0)) << 0;
- QTest::newRow("llong2") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(LLONG_MAX) << 0;
- QTest::newRow("llong3") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(LLONG_MIN) << 0;
- QTest::newRow("llong4") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("llong5") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(LLONG_MIN) << +1;
-
- QTest::newRow("ullong1") << QVariant::fromValue(qulonglong(0)) << QVariant::fromValue(qulonglong(0)) << 0;
- QTest::newRow("ullong2") << QVariant::fromValue(ULLONG_MAX) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("ullong3") << QVariant::fromValue(qulonglong(0)) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("ullong4") << QVariant::fromValue(ULLONG_MAX) << QVariant::fromValue(qulonglong(0)) << +1;
-
- QTest::newRow("float1") << QVariant::fromValue(0.f) << QVariant::fromValue(0.f) << 0;
- QTest::newRow("float2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0.f) << -1;
- QTest::newRow("float3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1.f) << +1;
- QTest::newRow("float4") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(0.f) << -1;
- QTest::newRow("float5") << QVariant::fromValue(0.f) << QVariant::fromValue(-float(qInf())) << +1;
- QTest::newRow("float6") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(-float(qInf())) << 0;
- QTest::newRow("float7") << QVariant::fromValue(float(qInf())) << QVariant::fromValue(float(qInf())) << 0;
-
- QTest::newRow("double1") << QVariant::fromValue(0.) << QVariant::fromValue(0.) << 0;
- QTest::newRow("double2") << QVariant::fromValue(-1.) << QVariant::fromValue(0.) << -1;
- QTest::newRow("double3") << QVariant::fromValue(0.) << QVariant::fromValue(-1.) << +1;
- QTest::newRow("double4") << QVariant::fromValue(-qInf()) << QVariant::fromValue(0.) << -1;
- QTest::newRow("double5") << QVariant::fromValue(0.) << QVariant::fromValue(-qInf()) << +1;
- QTest::newRow("double6") << QVariant::fromValue(-double(qInf())) << QVariant::fromValue(-qInf()) << 0;
- QTest::newRow("double7") << QVariant::fromValue(qInf()) << QVariant::fromValue(qInf()) << 0;
- QTest::newRow("double8") << QVariant::fromValue(-qInf()) << QVariant::fromValue(qInf()) << -1;
- QTest::newRow("double9") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(0.) << INT_MAX;
- QTest::newRow("double10") << QVariant::fromValue(0.) << QVariant::fromValue(qQNaN()) << INT_MAX;
- QTest::newRow("double11") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(qQNaN()) << INT_MAX;
-
- // mixed comparisons
- // fp + fp
- QTest::newRow("float+double1") << QVariant::fromValue(0.f) << QVariant::fromValue(0.) << 0;
- QTest::newRow("float+double2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0.) << -1;
- QTest::newRow("float+double3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1.) << +1;
- QTest::newRow("float+double4") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(0.) << -1;
- QTest::newRow("float+double5") << QVariant::fromValue(0.f) << QVariant::fromValue(-qInf()) << +1;
- QTest::newRow("float+double6") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(-qInf()) << 0;
- QTest::newRow("float+double7") << QVariant::fromValue(float(qInf())) << QVariant::fromValue(qInf()) << 0;
- QTest::newRow("float+double8") << QVariant::fromValue(-float(qInf())) << QVariant::fromValue(qInf()) << -1;
- QTest::newRow("float+double9") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(0.) << INT_MAX;
- QTest::newRow("float+double10") << QVariant::fromValue(0.) << QVariant::fromValue(qQNaN()) << INT_MAX;
- QTest::newRow("float+double11") << QVariant::fromValue(qQNaN()) << QVariant::fromValue(qQNaN()) << INT_MAX;
-
- // fp + int
- QTest::newRow("float+int1") << QVariant::fromValue(0.f) << QVariant::fromValue(0) << 0;
- QTest::newRow("double+int1") << QVariant::fromValue(0.) << QVariant::fromValue(0) << 0;
- QTest::newRow("float+int2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0) << -1;
- QTest::newRow("double+int2") << QVariant::fromValue(-1.) << QVariant::fromValue(0) << -1;
- QTest::newRow("float+int3") << QVariant::fromValue(0.f) << QVariant::fromValue(-1) << +1;
- QTest::newRow("double+int3") << QVariant::fromValue(0.) << QVariant::fromValue(-1) << +1;
- QTest::newRow("float+int4") << QVariant::fromValue(1.5f) << QVariant::fromValue(1) << +1;
- QTest::newRow("double+int4") << QVariant::fromValue(1.5) << QVariant::fromValue(1) << +1;
- QTest::newRow("double+int5") << QVariant::fromValue(qInf()) << QVariant::fromValue(1) << +1;
-
- // fp + uint
- QTest::newRow("float+uint1") << QVariant::fromValue(0.f) << QVariant::fromValue(0U) << 0;
- QTest::newRow("double+uint1") << QVariant::fromValue(0.) << QVariant::fromValue(0U) << 0;
- QTest::newRow("float+uint2") << QVariant::fromValue(-1.f) << QVariant::fromValue(0U) << -1;
- QTest::newRow("double+uint2") << QVariant::fromValue(-1.) << QVariant::fromValue(0U) << -1;
- QTest::newRow("float+uint3") << QVariant::fromValue(0.f) << QVariant::fromValue(1U) << -1;
- QTest::newRow("double+uint3") << QVariant::fromValue(0.) << QVariant::fromValue(1U) << -1;
- QTest::newRow("float+uint4") << QVariant::fromValue(1.5f) << QVariant::fromValue(1U) << +1;
- QTest::newRow("double+uint4") << QVariant::fromValue(1.5) << QVariant::fromValue(1U) << +1;
-
- // lower ranked + int
- QTest::newRow("bool+int1") << QVariant::fromValue(false) << QVariant::fromValue(0) << 0;
- QTest::newRow("bool+int2") << QVariant::fromValue(false) << QVariant::fromValue(1) << -1;
- QTest::newRow("bool+int3") << QVariant::fromValue(true) << QVariant::fromValue(0) << +1;
- QTest::newRow("bool+int4") << QVariant::fromValue(true) << QVariant::fromValue(1) << 0;
- QTest::newRow("bool+int5") << QVariant::fromValue(true) << QVariant::fromValue(2) << -1;
-
- QTest::newRow("char+int1") << QVariant::fromValue(char(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("char+int2") << QVariant::fromValue(char(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("char+int3") << QVariant::fromValue(char(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("char+int4") << QVariant::fromValue(char(1)) << QVariant::fromValue(1) << 0;
- if (std::numeric_limits<char>::is_signed) {
- QTest::newRow("char+int5") << QVariant::fromValue(char(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("char+int6") << QVariant::fromValue(char(-1)) << QVariant::fromValue(-1) << 0;
- }
-
- QTest::newRow("schar+int1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("schar+int2") << QVariant::fromValue(schar(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("schar+int3") << QVariant::fromValue(schar(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("schar+int4") << QVariant::fromValue(schar(1)) << QVariant::fromValue(1) << 0;
- QTest::newRow("schar+int5") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("schar+int6") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(-1) << 0;
-
- QTest::newRow("uchar+int1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("uchar+int2") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("uchar+int3") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("uchar+int4") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(1) << 0;
-
- QTest::newRow("short+int1") << QVariant::fromValue(short(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("short+int2") << QVariant::fromValue(short(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("short+int3") << QVariant::fromValue(short(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("short+int4") << QVariant::fromValue(short(1)) << QVariant::fromValue(1) << 0;
- QTest::newRow("short+int5") << QVariant::fromValue(short(-1)) << QVariant::fromValue(0) << -1;
- QTest::newRow("short+int6") << QVariant::fromValue(short(-1)) << QVariant::fromValue(-1) << 0;
-
- QTest::newRow("ushort+int1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(0) << 0;
- QTest::newRow("ushort+int2") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(1) << -1;
- QTest::newRow("ushort+int3") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(0) << +1;
- QTest::newRow("ushort+int4") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(1) << 0;
-
- // lower ranked + uint (without sign change)
- QTest::newRow("bool+uint1") << QVariant::fromValue(false) << QVariant::fromValue(0U) << 0;
- QTest::newRow("bool+uint2") << QVariant::fromValue(false) << QVariant::fromValue(1U) << -1;
- QTest::newRow("bool+uint3") << QVariant::fromValue(true) << QVariant::fromValue(0U) << +1;
- QTest::newRow("bool+uint4") << QVariant::fromValue(true) << QVariant::fromValue(1U) << 0;
- QTest::newRow("bool+uint5") << QVariant::fromValue(true) << QVariant::fromValue(2U) << -1;
-
- QTest::newRow("char+uint1") << QVariant::fromValue(char(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("char+uint2") << QVariant::fromValue(char(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("char+uint3") << QVariant::fromValue(char(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("char+uint4") << QVariant::fromValue(char(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("schar+uint1") << QVariant::fromValue(schar(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("schar+uint2") << QVariant::fromValue(schar(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("schar+uint3") << QVariant::fromValue(schar(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("schar+uint4") << QVariant::fromValue(schar(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("uchar+uint1") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("uchar+uint2") << QVariant::fromValue(uchar(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("uchar+uint3") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("uchar+uint4") << QVariant::fromValue(uchar(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("short+uint1") << QVariant::fromValue(short(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("short+uint2") << QVariant::fromValue(short(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("short+uint3") << QVariant::fromValue(short(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("short+uint4") << QVariant::fromValue(short(1)) << QVariant::fromValue(1U) << 0;
-
- QTest::newRow("ushort+uint1") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(0U) << 0;
- QTest::newRow("ushort+uint2") << QVariant::fromValue(ushort(0)) << QVariant::fromValue(1U) << -1;
- QTest::newRow("ushort+uint3") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("ushort+uint4") << QVariant::fromValue(ushort(1)) << QVariant::fromValue(1U) << 0;
-
- // int + qlonglong
- QTest::newRow("int+qlonglong1") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(0)) << 0;
- QTest::newRow("int+qlonglong2") << QVariant::fromValue(1) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("int+qlonglong3") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(1)) << -1;
- QTest::newRow("int+qlonglong4") << QVariant::fromValue(1) << QVariant::fromValue(Q_INT64_C(1)) << 0;
- QTest::newRow("int+qlonglong5") << QVariant::fromValue(0) << QVariant::fromValue(Q_INT64_C(-1)) << +1;
- QTest::newRow("int+qlonglong6") << QVariant::fromValue(-1) << QVariant::fromValue(Q_INT64_C(0)) << -1;
- QTest::newRow("int+qlonglong7") << QVariant::fromValue(-1) << QVariant::fromValue(Q_INT64_C(-1)) << 0;
-
- // uint + qulonglong
- QTest::newRow("uint+qulonglong1") << QVariant::fromValue(0U) << QVariant::fromValue(Q_UINT64_C(0)) << 0;
- QTest::newRow("uint+qulonglong2") << QVariant::fromValue(1U) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("uint+qulonglong3") << QVariant::fromValue(0U) << QVariant::fromValue(Q_UINT64_C(1)) << -1;
- QTest::newRow("uint+qulonglong4") << QVariant::fromValue(1U) << QVariant::fromValue(Q_UINT64_C(1)) << 0;
-
- // int + uint (without sign change)
- QTest::newRow("int+uint1") << QVariant::fromValue(0) << QVariant::fromValue(0U) << 0;
- QTest::newRow("int+uint2") << QVariant::fromValue(1) << QVariant::fromValue(0U) << +1;
- QTest::newRow("int+uint3") << QVariant::fromValue(0) << QVariant::fromValue(1U) << -1;
- QTest::newRow("int+uint4") << QVariant::fromValue(1) << QVariant::fromValue(1U) << 0;
-
- // uint + qlonglong
- QTest::newRow("uint+qlonglong1") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(0)) << 0;
- QTest::newRow("uint+qlonglong2") << QVariant::fromValue(1U) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("uint+qlonglong3") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(1)) << -1;
- QTest::newRow("uint+qlonglong4") << QVariant::fromValue(1U) << QVariant::fromValue(Q_INT64_C(1)) << 0;
- QTest::newRow("uint+qlonglong5") << QVariant::fromValue(0U) << QVariant::fromValue(Q_INT64_C(-1)) << +1;
-
- // boundary conditions
- QTest::newRow("charmax+intmax") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("charmax+uintmax") << QVariant::fromValue(CHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("scharmax+intmax") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("scharmax+uintmax") << QVariant::fromValue(SCHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("ucharmax+intmax") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("ucharmax+uintmax") << QVariant::fromValue(UCHAR_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("shortmax+intmax") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("shortmax+uintmax") << QVariant::fromValue(SHRT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("ushortmax+intmax") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(INT_MAX) << -1;
- QTest::newRow("ushortmax+uintmax") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
-
- QTest::newRow("intmin+qlonglongmin") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(LLONG_MIN) << +1;
- QTest::newRow("intmax+uintmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(UINT_MAX) << -1;
- QTest::newRow("intmax+qlonglongmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("uintmax+qlonglongmax") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(LLONG_MAX) << -1;
- QTest::newRow("intmax+qulonglongmax") << QVariant::fromValue(INT_MAX) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("qlonglongmax+qulonglongmax") << QVariant::fromValue(LLONG_MAX) << QVariant::fromValue(ULLONG_MAX) << -1;
- QTest::newRow("uintmax+qlonglongmin") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(LLONG_MIN) << +1;
-
- // check for no sign-extension issues
- QTest::newRow("ushortmax+intzero") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(0) << +1;
- QTest::newRow("ushortmax+qlonglongzero") << QVariant::fromValue(USHRT_MAX) << QVariant::fromValue(Q_INT64_C(0)) << +1;
- QTest::newRow("uintmax+qlonglongzero") << QVariant::fromValue(UINT_MAX) << QVariant::fromValue(Q_INT64_C(0)) << +1;
-
- // sign changes
- // the tests below check that a signed negative number sign-changes to a non-zero unsigned number and that
- // signed -1 sign-changes to unsigned maximum (all bits set, ~0). This works on two's complement machines
- // (all that Qt supports), and would also work on one's complement.
- if (std::numeric_limits<char>::is_signed) {
- QTest::newRow("signchange-char+uint") << QVariant::fromValue(char(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-char+uintmax") << QVariant::fromValue(char(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-charmin+uint") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-char+qulonglong") << QVariant::fromValue(char(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-char+qulonglongmax") << QVariant::fromValue(char(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-charmin+qulonglong") << QVariant::fromValue(CHAR_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- }
- QTest::newRow("signchange-schar+uint") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-schar+uintmax") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-scharmin+uint") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-schar+qulonglong") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-schar+qulonglongmax") << QVariant::fromValue(schar(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-scharmin+qulonglong") << QVariant::fromValue(SCHAR_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-short+uint") << QVariant::fromValue(short(-1)) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-short+uintmax") << QVariant::fromValue(short(-1)) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-shortmin+uint") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-short+qulonglong") << QVariant::fromValue(short(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-short+qulonglongmax") << QVariant::fromValue(short(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-shortmin+qulonglong") << QVariant::fromValue(SHRT_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-int+uint") << QVariant::fromValue(-1) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-int+uintmax") << QVariant::fromValue(-1) << QVariant::fromValue(UINT_MAX) << 0;
- QTest::newRow("signchange-intmin+uint") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(0U) << +1;
- QTest::newRow("signchange-int+qulonglong") << QVariant::fromValue(-1) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-int+qulonglongmax") << QVariant::fromValue(-1) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-intmin+qulonglong") << QVariant::fromValue(INT_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- // no qlonglong+uint, since that should promote to qlonglong and then the comparison is signed (tested above)
- QTest::newRow("signchange-qlonglong+qulonglong") << QVariant::fromValue(Q_INT64_C(-1)) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
- QTest::newRow("signchange-qlonglong+qulonglongmax") << QVariant::fromValue(Q_INT64_C(-1)) << QVariant::fromValue(ULLONG_MAX) << 0;
- QTest::newRow("signchange-qlonglongmin+qulonglong") << QVariant::fromValue(LLONG_MIN) << QVariant::fromValue(Q_UINT64_C(0)) << +1;
-}
-
-void tst_QVariant::compareNumbers() const
-{
- QFETCH(QVariant, v1);
- QFETCH(QVariant, v2);
- QFETCH(int, expected);
-
- if (expected == -1) {
- QVERIFY(v1 < v2);
- QVERIFY(v1 <= v2);
- QVERIFY(!(v1 == v2));
- QVERIFY(!(v1 > v2));
- QVERIFY(!(v1 >= v2));
-
- QVERIFY(!(v2 < v1));
- QVERIFY(!(v2 <= v1));
- QVERIFY(!(v2 == v1));
- QVERIFY(v2 >= v1);
- QVERIFY(v2 > v1);
- } else if (expected == 0) {
- QVERIFY(!(v1 < v2));
- QVERIFY(v1 <= v2);
- QCOMPARE(v1, v2);
- QVERIFY(!(v1 > v2));
- QVERIFY(v1 >= v2);
-
- QVERIFY(!(v2 < v1));
- QVERIFY(v2 <= v1);
- QCOMPARE(v2, v1);
- QVERIFY(v2 >= v1);
- QVERIFY(!(v2 > v1));
- } else if (expected == +1) {
- QVERIFY(!(v1 < v2));
- QVERIFY(!(v1 <= v2));
- QVERIFY(!(v1 == v2));
- QVERIFY(v1 > v2);
- QVERIFY(v1 >= v2);
-
- QVERIFY(v2 < v1);
- QVERIFY(v2 <= v1);
- QVERIFY(!(v2 == v1));
- QVERIFY(!(v2 >= v1));
- QVERIFY(!(v2 > v1));
- } else {
- // unorderable (NaN)
- QVERIFY(!(v1 == v2));
- }
-}
-
void tst_QVariant::typeName_data()
{
QTest::addColumn<int>("type");
@@ -2624,16 +2277,6 @@ void tst_QVariant::variantMap()
QCOMPARE(qvariant_cast<QVariantMap>(v3).value("test").toInt(), 42);
QCOMPARE(v, QVariant(v.toHash()));
-
- // multi-keys
- map.insertMulti("test", 47);
- v = map;
- map2 = qvariant_cast<QVariantMap>(v);
- QCOMPARE(map2, map);
- map2 = v.toMap();
- QCOMPARE(map2, map);
-
- QCOMPARE(v, QVariant(v.toHash()));
}
void tst_QVariant::variantHash()
@@ -2657,16 +2300,6 @@ void tst_QVariant::variantHash()
QCOMPARE(qvariant_cast<QVariantHash>(v3).value("test").toInt(), 42);
QCOMPARE(v, QVariant(v.toMap()));
-
- // multi-keys
- hash.insertMulti("test", 47);
- v = hash;
- hash2 = qvariant_cast<QVariantHash>(v);
- QCOMPARE(hash2, hash);
- hash2 = v.toHash();
- QCOMPARE(hash2, hash);
-
- QCOMPARE(v, QVariant(v.toMap()));
}
class CustomQObject : public QObject {
@@ -3203,7 +2836,7 @@ void tst_QVariant::loadUnknownUserType()
void tst_QVariant::loadBrokenUserType()
{
- QTest::ignoreMessage(QtWarningMsg, "Trying to construct an instance of an invalid type, type id: 127");
+ QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type"));
char data[] = {0, 0, 0, 127, 0 };
QByteArray ba(data, sizeof(data));
@@ -3408,7 +3041,7 @@ void tst_QVariant::convertIterables() const
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
- map.insertMulti("3", 5);
+ map.insert("4", 5);
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
}
@@ -3418,7 +3051,7 @@ void tst_QVariant::convertIterables() const
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
- map.insertMulti("3", 5);
+ map.insert("4", 5);
QCOMPARE(QVariant::fromValue(map).value<QVariantHash>().count(), map.count());
QCOMPARE(QVariant::fromValue(map).value<QVariantMap>().count(), map.count());
}
@@ -3428,7 +3061,7 @@ void tst_QVariant::convertIterables() const
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
- hash.insertMulti("3", 5);
+ hash.insert("4", 5);
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
}
@@ -3438,7 +3071,7 @@ void tst_QVariant::convertIterables() const
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
- hash.insertMulti("3", 5);
+ hash.insert("4", 5);
QCOMPARE(QVariant::fromValue(hash).value<QVariantHash>().count(), hash.count());
QCOMPARE(QVariant::fromValue(hash).value<QVariantMap>().count(), hash.count());
}
@@ -3884,13 +3517,6 @@ void tst_QVariant::moreCustomTypes()
data << (QSet<int>() << 42);
PLAY_WITH_VARIANT(data, false, QString(), 0, false);
}
-
- {
- QList<QLinkedList<int> > data;
- PLAY_WITH_VARIANT(data, false, QString(), 0, false);
- data << (QLinkedList<int>() << 42);
- PLAY_WITH_VARIANT(data, false, QString(), 0, false);
- }
}
void tst_QVariant::movabilityTest()
@@ -3963,8 +3589,7 @@ Q_DECLARE_METATYPE(Convertible);
struct BigConvertible {
double d;
- double dummy;
- double dummy2;
+ double dummy[sizeof(QVariant) / sizeof(double)];
operator int() const { return (int)d; }
operator double() const { return d; }
operator QString() const { return QString::number(d); }
@@ -4865,86 +4490,6 @@ void tst_QVariant::metaEnums()
METAENUMS_TEST(MetaEnumTest_Enum8_value);
}
-void tst_QVariant::compareSanity_data()
-{
- QTest::addColumn<QVariant>("value1");
- QTest::addColumn<QVariant>("value2");
-
- QTest::newRow( "int <>/== QUrl" ) << QVariant( 97 ) << QVariant(QUrl("a"));
- QTest::newRow( "int <>/== QChar" ) << QVariant( 97 ) << QVariant(QChar('a'));
- QTest::newRow( "int <>/== QString" ) << QVariant( 97 ) << QVariant(QString("a"));
- QTest::newRow( "QUrl <>/== QChar" ) << QVariant(QUrl("a")) << QVariant(QChar('a'));
- QTest::newRow( "QUrl <>/== QString" ) << QVariant(QUrl("a")) << QVariant(QString("a"));
- QTest::newRow( "QChar <>/== QString" ) << QVariant(QChar('a')) << QVariant(QString("a"));
-}
-
-void tst_QVariant::compareSanity()
-{
- QFETCH(QVariant, value1);
- QFETCH(QVariant, value2);
-
- if (value1 == value2) {
- QVERIFY(!(value1 < value2) && !(value1 > value2));
- } else {
- QVERIFY(value1 != value2);
- QVERIFY((value1 < value2) || (value1 > value2));
- }
-}
-
-static void richComparison(const QVariant& less, const QVariant& more)
-{
- QVERIFY(less.type() == more.type());
-
- QVERIFY(less < more);
- QVERIFY(!(more < less));
-
- QVERIFY(more > less);
- QVERIFY(!(less > more));
-
- QVERIFY(less <= more);
- QVERIFY(!(more <= less));
- QVERIFY(less <= less);
-
- QVERIFY(more >= less);
- QVERIFY(!(less >= more));
- QVERIFY(more >= more);
-}
-
-void tst_QVariant::compareRich()
-{
- richComparison(QUuid("{49d8ad2a-2ee8-4c3d-949f-1b5a3765ddf0}"),
- QUuid("{f6d56824-16e9-4543-a375-add2877c2d05}"));
- richComparison(QByteArray::fromRawData("a", 1),
- QByteArray::fromRawData("b", 1));
- richComparison(QStringLiteral("a"), QStringLiteral("b"));
- richComparison(QLatin1String("a"), QLatin1String("b"));
- richComparison(QChar('a'), QChar('b'));
- richComparison(QDate(2016, 7, 23), QDate(2016, 7, 24));
- richComparison(QTime(0, 0), QTime(0, 1));
- richComparison(QDateTime(QDate(2016, 7, 23), QTime(0, 0)),
- QDateTime(QDate(2016, 7, 23), QTime(0, 1)));
-
- richComparison(QStringList(), QStringList() << QStringLiteral("a"));
- richComparison(QStringList(), QStringList() << QStringLiteral("a")
- << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a"),
- QStringList() << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a"),
- QStringList() << QStringLiteral("b")
- << QStringLiteral("c"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("b"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("b")
- << QStringLiteral("d"));
- richComparison(QStringList() << QStringLiteral("a")
- << QStringLiteral("c"),
- QStringList() << QStringLiteral("a")
- << QStringLiteral("d"));
-}
-
void tst_QVariant::nullConvert()
{
// Test quirks with QVariants different types of null states.
diff --git a/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt b/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt
new file mode 100644
index 0000000000..0f287a1652
--- /dev/null
+++ b/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qwineventnotifier.pro.
+
+#####################################################################
+## tst_qwineventnotifier Test:
+#####################################################################
+
+add_qt_test(tst_qwineventnotifier
+ SOURCES
+ tst_qwineventnotifier.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/mimetypes/CMakeLists.txt b/tests/auto/corelib/mimetypes/CMakeLists.txt
new file mode 100644
index 0000000000..ea0463de36
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from mimetypes.pro.
+
+# special case begin
+if(FEATURE_private_tests)
+# special case end
+ add_subdirectory(qmimetype)
+ add_subdirectory(qmimedatabase)
+# special case begin
+endif()
+# special case end
+
+if(NOT QT_FEATURE_private_tests)
+ ### remove_subdirectory("qmimetype")
+endif()
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt
new file mode 100644
index 0000000000..6661952a68
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmimedatabase.pro.
+
+
+if(TARGET Qt::Concurrent)
+ add_subdirectory(qmimedatabase-xml)
+
+ if(UNIX AND NOT APPLE AND NOT QNX)
+ add_subdirectory(qmimedatabase-cache)
+ endif()
+endif()
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..9dc2ea18bf
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt
@@ -0,0 +1,107 @@
+# Generated from qmimedatabase-cache.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qmimedatabase-cache Test:
+#####################################################################
+
+add_qt_test(tst_qmimedatabase-cache
+ SOURCES
+ ../tst_qmimedatabase.h
+ tst_qmimedatabase-cache.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+# Resources:
+set_source_files_properties("/devel/work/qt-cmake/qtbase/src/corelib/mimetypes/mime/packages/freedesktop.org.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "freedesktop.org.xml"
+)
+set(mimetypes_resource_files
+ "mime/packages/freedesktop.org.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-cache "mimetypes"
+ PREFIX
+ "/qt-project.org/qmime/packages"
+ BASE
+ "/devel/work/qt-cmake/qtbase/src/corelib/mimetypes"
+ FILES
+ ${mimetypes_resource_files}
+)
+set_source_files_properties("../invalid-magic1.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic1.xml"
+)
+set_source_files_properties("../invalid-magic2.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic2.xml"
+)
+set_source_files_properties("../invalid-magic3.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic3.xml"
+)
+set_source_files_properties("../magic-and-hierarchy.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.foo"
+)
+set_source_files_properties("../magic-and-hierarchy.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.xml"
+)
+set_source_files_properties("../magic-and-hierarchy2.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy2.foo"
+)
+set_source_files_properties("../qml-again.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "qml-again.xml"
+)
+set_source_files_properties("../test.qml"
+ PROPERTIES QT_RESOURCE_ALIAS "test.qml"
+)
+set_source_files_properties("../text-x-objcsrc.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "text-x-objcsrc.xml"
+)
+set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "yast2-metapackage-handler-mimetypes.xml"
+)
+set(testdata_resource_files
+ "invalid-magic1.xml"
+ "invalid-magic2.xml"
+ "invalid-magic3.xml"
+ "magic-and-hierarchy.foo"
+ "magic-and-hierarchy.xml"
+ "magic-and-hierarchy2.foo"
+ "qml-again.xml"
+ "test.qml"
+ "text-x-objcsrc.xml"
+ "yast2-metapackage-handler-mimetypes.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-cache "testdata"
+ PREFIX
+ "/qt-project.org/qmime"
+ BASE
+ ".."
+ FILES
+ ${testdata_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmimedatabase-cache CONDITION GCC
+ COMPILE_OPTIONS
+ -W
+ -Wall
+ -Wextra
+ -Wno-long-long
+ -Wnon-virtual-dtor
+ -Wshadow
+)
+
+extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE AND NOT QNX
+ DEFINES
+ USE_XDG_DATA_DIRS
+)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt
new file mode 100644
index 0000000000..7720e4d18e
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt
@@ -0,0 +1,103 @@
+# Generated from qmimedatabase-cache.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qmimedatabase-cache Test:
+#####################################################################
+
+add_qt_test(tst_qmimedatabase-cache
+ SOURCES
+ ../tst_qmimedatabase.h
+ tst_qmimedatabase-cache.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+# Resources:
+# special case begin
+# the freedesktop resources are handled manually below via mimetypes_resources.cmake
+#set(mimetypes_resource_files
+ #"mime/packages/freedesktop.org.xml"
+#)
+# special case end
+set_source_files_properties("../invalid-magic1.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic1.xml"
+)
+set_source_files_properties("../invalid-magic2.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic2.xml"
+)
+set_source_files_properties("../invalid-magic3.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic3.xml"
+)
+set_source_files_properties("../magic-and-hierarchy.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.foo"
+)
+set_source_files_properties("../magic-and-hierarchy.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.xml"
+)
+set_source_files_properties("../magic-and-hierarchy2.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy2.foo"
+)
+set_source_files_properties("../qml-again.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "qml-again.xml"
+)
+set_source_files_properties("../test.qml"
+ PROPERTIES QT_RESOURCE_ALIAS "test.qml"
+)
+set_source_files_properties("../text-x-objcsrc.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "text-x-objcsrc.xml"
+)
+set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "yast2-metapackage-handler-mimetypes.xml"
+)
+set(testdata_resource_files
+ "invalid-magic1.xml"
+ "invalid-magic2.xml"
+ "invalid-magic3.xml"
+ "magic-and-hierarchy.foo"
+ "magic-and-hierarchy.xml"
+ "magic-and-hierarchy2.foo"
+ "qml-again.xml"
+ "test.qml"
+ "text-x-objcsrc.xml"
+ "yast2-metapackage-handler-mimetypes.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-cache "testdata"
+ PREFIX
+ "/qt-project.org/qmime"
+ BASE
+ ".."
+ FILES
+ ${testdata_resource_files}
+)
+
+# special case begin
+set(corelib_source_dir ../../../../../../src/corelib)
+include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake)
+corelib_add_mimetypes_resources(tst_qmimedatabase-cache)
+# special case end
+
+#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmimedatabase-cache CONDITION GCC
+ COMPILE_OPTIONS
+ -W
+ -Wall
+ -Wextra
+ -Wno-long-long
+ -Wnon-virtual-dtor
+ -Wshadow
+)
+
+extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE AND NOT QNX
+ DEFINES
+ USE_XDG_DATA_DIRS
+)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1672255d29
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/.prev_CMakeLists.txt
@@ -0,0 +1,107 @@
+# Generated from qmimedatabase-xml.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qmimedatabase-xml Test:
+#####################################################################
+
+add_qt_test(tst_qmimedatabase-xml
+ SOURCES
+ ../tst_qmimedatabase.h
+ tst_qmimedatabase-xml.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+# Resources:
+set_source_files_properties("/devel/work/qt-cmake/qtbase/src/corelib/mimetypes/mime/packages/freedesktop.org.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "freedesktop.org.xml"
+)
+set(mimetypes_resource_files
+ "mime/packages/freedesktop.org.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-xml "mimetypes"
+ PREFIX
+ "/qt-project.org/qmime/packages"
+ BASE
+ "/devel/work/qt-cmake/qtbase/src/corelib/mimetypes"
+ FILES
+ ${mimetypes_resource_files}
+)
+set_source_files_properties("../invalid-magic1.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic1.xml"
+)
+set_source_files_properties("../invalid-magic2.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic2.xml"
+)
+set_source_files_properties("../invalid-magic3.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic3.xml"
+)
+set_source_files_properties("../magic-and-hierarchy.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.foo"
+)
+set_source_files_properties("../magic-and-hierarchy.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.xml"
+)
+set_source_files_properties("../magic-and-hierarchy2.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy2.foo"
+)
+set_source_files_properties("../qml-again.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "qml-again.xml"
+)
+set_source_files_properties("../test.qml"
+ PROPERTIES QT_RESOURCE_ALIAS "test.qml"
+)
+set_source_files_properties("../text-x-objcsrc.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "text-x-objcsrc.xml"
+)
+set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "yast2-metapackage-handler-mimetypes.xml"
+)
+set(testdata_resource_files
+ "invalid-magic1.xml"
+ "invalid-magic2.xml"
+ "invalid-magic3.xml"
+ "magic-and-hierarchy.foo"
+ "magic-and-hierarchy.xml"
+ "magic-and-hierarchy2.foo"
+ "qml-again.xml"
+ "test.qml"
+ "text-x-objcsrc.xml"
+ "yast2-metapackage-handler-mimetypes.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-xml "testdata"
+ PREFIX
+ "/qt-project.org/qmime"
+ BASE
+ ".."
+ FILES
+ ${testdata_resource_files}
+)
+
+
+#### Keys ignored in scope 1:.:.:qmimedatabase-xml.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmimedatabase-xml CONDITION GCC
+ COMPILE_OPTIONS
+ -W
+ -Wall
+ -Wextra
+ -Wno-long-long
+ -Wnon-virtual-dtor
+ -Wshadow
+)
+
+extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE AND NOT QNX
+ DEFINES
+ USE_XDG_DATA_DIRS
+)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt
new file mode 100644
index 0000000000..cf8e349226
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt
@@ -0,0 +1,103 @@
+# Generated from qmimedatabase-xml.pro.
+
+if(NOT QT_FEATURE_private_tests)
+ return()
+endif()
+
+#####################################################################
+## tst_qmimedatabase-xml Test:
+#####################################################################
+
+add_qt_test(tst_qmimedatabase-xml
+ SOURCES
+ ../tst_qmimedatabase.h
+ tst_qmimedatabase-xml.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+)
+
+# Resources:
+# special case begin
+# the freedesktop resources are handled manually below via mimetypes_resources.cmake
+#set(mimetypes_resource_files
+ #"mime/packages/freedesktop.org.xml"
+#)
+# special case end
+set_source_files_properties("../invalid-magic1.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic1.xml"
+)
+set_source_files_properties("../invalid-magic2.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic2.xml"
+)
+set_source_files_properties("../invalid-magic3.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "invalid-magic3.xml"
+)
+set_source_files_properties("../magic-and-hierarchy.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.foo"
+)
+set_source_files_properties("../magic-and-hierarchy.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy.xml"
+)
+set_source_files_properties("../magic-and-hierarchy2.foo"
+ PROPERTIES QT_RESOURCE_ALIAS "magic-and-hierarchy2.foo"
+)
+set_source_files_properties("../qml-again.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "qml-again.xml"
+)
+set_source_files_properties("../test.qml"
+ PROPERTIES QT_RESOURCE_ALIAS "test.qml"
+)
+set_source_files_properties("../text-x-objcsrc.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "text-x-objcsrc.xml"
+)
+set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml"
+ PROPERTIES QT_RESOURCE_ALIAS "yast2-metapackage-handler-mimetypes.xml"
+)
+set(testdata_resource_files
+ "invalid-magic1.xml"
+ "invalid-magic2.xml"
+ "invalid-magic3.xml"
+ "magic-and-hierarchy.foo"
+ "magic-and-hierarchy.xml"
+ "magic-and-hierarchy2.foo"
+ "qml-again.xml"
+ "test.qml"
+ "text-x-objcsrc.xml"
+ "yast2-metapackage-handler-mimetypes.xml"
+)
+
+add_qt_resource(tst_qmimedatabase-xml "testdata"
+ PREFIX
+ "/qt-project.org/qmime"
+ BASE
+ ".."
+ FILES
+ ${testdata_resource_files}
+)
+
+# special case begin
+set(corelib_source_dir ../../../../../../src/corelib)
+include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake)
+corelib_add_mimetypes_resources(tst_qmimedatabase-xml)
+# special case end
+
+#### Keys ignored in scope 1:.:.:qmimedatabase-xml.pro:<TRUE>:
+# _REQUIREMENTS = "qtConfig(private_tests)"
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmimedatabase-xml CONDITION GCC
+ COMPILE_OPTIONS
+ -W
+ -Wall
+ -Wextra
+ -Wno-long-long
+ -Wnon-virtual-dtor
+ -Wshadow
+)
+
+extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE AND NOT QNX
+ DEFINES
+ USE_XDG_DATA_DIRS
+)
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index fd3cc18af5..60017d53fa 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -73,12 +73,12 @@ static inline QString testSuiteWarning()
str << "\nCannot find the shared-mime-info test suite\nstarting from: "
<< QDir::toNativeSeparators(QDir::currentPath()) << "\n"
"cd " << QDir::toNativeSeparators(QStringLiteral("tests/auto/corelib/mimetypes/qmimedatabase")) << "\n"
- "wget http://cgit.freedesktop.org/xdg/shared-mime-info/snapshot/Release-1-10.zip\n"
- "unzip Release-1-10.zip\n";
+ "wget https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/Release-1-10/shared-mime-info-Release-1-10.zip\n"
+ "unzip shared-mime-info-Release-1-10.zip\n";
#ifdef Q_OS_WIN
- str << "mkdir testfiles\nxcopy /s Release-1-10 s-m-i\n";
+ str << "mkdir testfiles\nxcopy /s shared-mime-info-Release-1-10 s-m-i\n";
#else
- str << "ln -s Release-1-10 s-m-i\n";
+ str << "ln -s shared-mime-info-Release-1-10 s-m-i\n";
#endif
return result;
}
diff --git a/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt
new file mode 100644
index 0000000000..990835c86a
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmimetype.pro.
+
+#####################################################################
+## tst_qmimetype Test:
+#####################################################################
+
+add_qt_test(tst_qmimetype
+ SOURCES
+ tst_qmimetype.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/plugin/CMakeLists.txt b/tests/auto/corelib/plugin/CMakeLists.txt
new file mode 100644
index 0000000000..710d471e8a
--- /dev/null
+++ b/tests/auto/corelib/plugin/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from plugin.pro.
+
+if(QT_BUILD_SHARED_LIBS)
+ add_subdirectory(qfactoryloader)
+endif()
+add_subdirectory(quuid)
+if(QT_FEATURE_library)
+ add_subdirectory(qpluginloader)
+ add_subdirectory(qlibrary)
+endif()
+if(QT_BUILD_SHARED_LIBS AND QT_FEATURE_library)
+ add_subdirectory(qplugin)
+endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/CMakeLists.txt
new file mode 100644
index 0000000000..6263be15a2
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Generated from qfactoryloader.pro.
+
+add_subdirectory(plugin1)
+add_subdirectory(plugin2)
+add_subdirectory(test)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
new file mode 100644
index 0000000000..940dcc2b09
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated from plugin1.pro.
+
+#####################################################################
+## plugin1 Generic Library:
+#####################################################################
+
+add_cmake_library(plugin1
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ plugin1.cpp plugin1.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:plugin1.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 7:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+extend_target(plugin1 CONDITION NOT QT_FEATURE_library
+ DEFINES
+ QT_STATICPLUGIN
+)
+
+qt_autogen_tools_initial_setup(plugin1)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
new file mode 100644
index 0000000000..2df999c292
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated from plugin2.pro.
+
+#####################################################################
+## plugin2 Generic Library:
+#####################################################################
+
+add_cmake_library(plugin2
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ plugin2.cpp plugin2.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:plugin2.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 7:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+extend_target(plugin2 CONDITION NOT QT_FEATURE_library
+ DEFINES
+ QT_STATICPLUGIN
+)
+
+qt_autogen_tools_initial_setup(plugin2)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..454b6c061a
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/.prev_CMakeLists.txt
@@ -0,0 +1,42 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qfactoryloader Test:
+#####################################################################
+
+add_qt_test(tst_qfactoryloader
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../plugin1/plugininterface1.h
+ ../plugin2/plugininterface2.h
+ ../tst_qfactoryloader.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qfactoryloader CONDITION NOT QT_FEATURE_library
+ PUBLIC_LIBRARIES
+ # Remove: L
+ ../bin/
+ plugin1
+ plugin2
+)
+
+if(ANDROID)
+ # Resources:
+ set(qmake_libs_resource_files
+ ${CMAKE_CURRENT_BINARY_DIR}/../bin
+ )
+
+ add_qt_resource(tst_qfactoryloader "qmake_libs"
+ PREFIX
+ "android_test_data"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/.."
+ FILES
+ ${qmake_libs_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
new file mode 100644
index 0000000000..d532eeeb4b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
@@ -0,0 +1,68 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qfactoryloader Test:
+#####################################################################
+
+add_qt_test(tst_qfactoryloader
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../plugin1/plugininterface1.h
+ ../plugin2/plugininterface2.h
+ ../tst_qfactoryloader.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+# special case begin
+if (NOT QT_FEATURE_library)
+ target_link_directories(tst_qfactoryloader PRIVATE "${CMAKE_CURRENT_BINARY_DIR}../bin")
+endif()
+# special case end
+
+extend_target(tst_qfactoryloader CONDITION NOT QT_FEATURE_library
+ PUBLIC_LIBRARIES
+ # Remove: L
+ # special case begin
+ # this part is handled as a special case above
+ # ../bin/
+ # special case end
+)
+
+if(ANDROID)
+ # special case begin
+ set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/../bin/libplugin1.so
+ PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY plugin1
+ )
+
+ set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/../bin/libplugin2.so
+ PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY plugin2
+ )
+ # Resources:
+ if (ANDROID)
+ set(qmake_libs_resource_files
+ bin/libplugin1_${CMAKE_ANDROID_ARCH_ABI}.so
+ bin/libplugin2_${CMAKE_ANDROID_ARCH_ABI}.so
+ )
+ else()
+ set(qmake_libs_resource_files
+ bin/libplugin1.so
+ bin/libplugin2.so
+ )
+ endif()
+ # special case end
+
+ add_qt_resource(tst_qfactoryloader "qmake_libs"
+ PREFIX
+ "android_test_data"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/.."
+ FILES
+ ${qmake_libs_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt
new file mode 100644
index 0000000000..c0faebc91d
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Generated from qlibrary.pro.
+
+add_subdirectory(lib)
+add_subdirectory(lib2)
+add_subdirectory(tst)
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..6dbbd7a060
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/lib/.prev_CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from lib.pro.
+
+#####################################################################
+## mylib Generic Library:
+#####################################################################
+
+add_cmake_library(mylib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qlibrary"
+
+## Scopes:
+#####################################################################
+
+extend_target(mylib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
+
+#### Keys ignored in scope 4:.:.:lib.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/"
+
+#### Keys ignored in scope 5:.:.:lib.pro:else:
+# DESTDIR = "../release/"
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt
new file mode 100644
index 0000000000..f2de91635a
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Generated from lib.pro.
+
+#####################################################################
+## mylib Generic Library:
+#####################################################################
+
+add_cmake_library(mylib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qlibrary"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+# special case begin
+set_target_properties(mylib PROPERTIES
+ VERSION 1.0.0
+ SOVERSION 1
+ C_VISIBILITY_PRESET "default"
+ CXX_VISIBILITY_PRESET "default"
+)
+# special case end
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qlibrary"
+
+## Scopes:
+#####################################################################
+
+extend_target(mylib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
+
+#### Keys ignored in scope 4:.:.:lib.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/"
+
+#### Keys ignored in scope 5:.:.:lib.pro:else:
+# DESTDIR = "../release/"
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt
new file mode 100644
index 0000000000..716ad488d0
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt
@@ -0,0 +1,104 @@
+# Generated from lib2.pro.
+
+#####################################################################
+## mylib Generic Library:
+#####################################################################
+
+add_cmake_library(mylib2 # special case
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}tst_qlibrary"
+ #OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+# special case begin
+# This test is very "annoying" to get working with CMake as it involves having
+# two targets with the same name on the parent scope, which is not possible with
+# CMake. Furthermore, on UNIX, this version of the library should override the
+# root symlink (libmylib.so) to point to version 2.
+# Since we can't build two targets with the same name and in the same directory,
+# we build mylib2 in it's own directory and manually copy and create the
+# symlinks in the parent directory.
+# Finally we also need to create a libmylib.so2 file in the parent directory.
+#
+set_target_properties(mylib2 PROPERTIES
+ OUTPUT_NAME mylib
+)
+set_target_properties(mylib2 PROPERTIES
+ VERSION 2.0.0
+ SOVERSION 2
+ C_VISIBILITY_PRESET "default"
+ CXX_VISIBILITY_PRESET "default"
+)
+if (UNIX)
+ add_dependencies(mylib2 mylib)
+ add_custom_command(TARGET mylib2 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<TARGET_FILE:mylib2>
+ "${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<TARGET_FILE:mylib2>
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0"
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2"
+ COMMAND ${CMAKE_COMMAND} -E remove
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0"
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.2.0.0"
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2"
+ )
+else() #Win32
+ add_custom_command(TARGET mylib2 POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<TARGET_FILE:mylib2>
+ "${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.dll"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<TARGET_FILE:mylib2>
+ "${CMAKE_CURRENT_BINARY_DIR}/../mylib.dl2"
+ )
+endif()
+# special case end
+
+#### Keys ignored in scope 1:.:.:lib2.pro:<TRUE>:
+# INSTALLS = "target" "renamed_target"
+# QMAKE_POST_LINK = "$$member(QMAKE_POST_LINK, 0, -2)"
+# TEMPLATE = "lib"
+# VERSION = "2"
+# renamed_target.extra = "$$member(renamed_target.extra, 0, -2)"
+# renamed_target.path = "$$target.path"
+# target.path = "$$[QT_INSTALL_TESTS]$${QMAKE_DIR_SEP}tst_qlibrary"
+
+## Scopes:
+#####################################################################
+
+extend_target(mylib2 CONDITION MSVC # special case
+ DEFINES
+ WIN32_MSVC
+)
+
+#### Keys ignored in scope 3:.:.:lib2.pro:WIN32:
+# DESTDIR = "../$$BUILD_FOLDER/"
+# files = "$$BUILD_FOLDER$${QMAKE_DIR_SEP}mylib.dl2" "$$BUILD_FOLDER$${QMAKE_DIR_SEP}system.qt.test.mylib.dll"
+
+#### Keys ignored in scope 4:.:.:lib2.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# BUILD_FOLDER = "debug"
+
+#### Keys ignored in scope 5:.:.:lib2.pro:else:
+# BUILD_FOLDER = "release"
+
+#### Keys ignored in scope 6:.:.:lib2.pro:TEMPLATE___contains___vc._x_:
+# src = "$(TargetPath)"
+
+#### Keys ignored in scope 7:.:.:lib2.pro:else:
+# src = "$(DESTDIR_TARGET)"
+
+#### Keys ignored in scope 8:.:.:lib2.pro:else:
+# files = "libmylib.so2" "system.qt.test.mylib.so"
+# src = "$(DESTDIR)$(TARGET)"
diff --git a/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..ac6515ba63
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/tst/.prev_CMakeLists.txt
@@ -0,0 +1,37 @@
+# Generated from tst.pro.
+
+#####################################################################
+## tst_qlibrary Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../library_path/invalid.so")
+
+add_qt_test(tst_qlibrary
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../tst_qlibrary.cpp
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+if(ANDROID)
+ # Resources:
+ set(qmake_libs_resource_files
+ ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.prl
+ ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so
+ ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2
+ ${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so
+ )
+
+ add_qt_resource(tst_qlibrary "qmake_libs"
+ PREFIX
+ "android_test_data"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/.."
+ FILES
+ ${qmake_libs_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt
new file mode 100644
index 0000000000..e6086a982f
--- /dev/null
+++ b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt
@@ -0,0 +1,50 @@
+# Generated from tst.pro.
+
+#####################################################################
+## tst_qlibrary Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../library_path/invalid.so")
+
+add_qt_test(tst_qlibrary
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../tst_qlibrary.cpp
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+if(ANDROID)
+ # special case begin
+ set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so
+ PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY mylib
+ )
+ set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2
+ ${CMAKE_CURRENT_BINARY_DIR}/../system.qt.test.mylib.so
+ PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY mylib2
+ )
+ # special case end
+ # Resources:
+ set(qmake_libs_resource_files
+ # special case begin
+ #libmylib.prl
+ libmylib.so
+ libmylib.so2
+ system.qt.test.mylib.so
+ # special case end
+ )
+
+ add_qt_resource(tst_qlibrary "qmake_libs"
+ PREFIX
+ "android_test_data"
+ BASE
+ "${CMAKE_CURRENT_BINARY_DIR}/.."
+ FILES
+ ${qmake_libs_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/plugin/qplugin/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..7e6ccc966d
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/.prev_CMakeLists.txt
@@ -0,0 +1,3 @@
+# Generated from qplugin.pro.
+
+add_subdirectory(invalidplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/CMakeLists.txt
new file mode 100644
index 0000000000..b2829099aa
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from qplugin.pro.
+
+add_subdirectory(invalidplugin)
+
+# special case begin
+add_subdirectory(debugplugin)
+add_subdirectory(releaseplugin)
+
+# The contents below are generated from ./tst_qplugin.pro
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ plugins/*)
+list(APPEND test_data ${test_data_glob})
+
+add_qt_test(tst_qplugin
+ SOURCES
+ tst_qplugin.cpp
+ LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${test_data}
+)
+
+target_compile_definitions(tst_qplugin PRIVATE CMAKE_BUILD=1)
+
+add_dependencies(tst_qplugin invalidplugin debugplugin releaseplugin)
+# special case end
diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt
new file mode 100644
index 0000000000..ab32e5e364
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/debugplugin/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Generated from debugplugin.pro.
+
+#####################################################################
+## debugplugin Generic Library:
+#####################################################################
+
+add_cmake_library(debugplugin
+ MODULE
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:debugplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(debugplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt
new file mode 100644
index 0000000000..c3eb37d930
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/invalidplugin/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Generated from invalidplugin.pro.
+
+#####################################################################
+## invalidplugin Generic Library:
+#####################################################################
+
+add_cmake_library(invalidplugin
+ MODULE
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:invalidplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(invalidplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt
new file mode 100644
index 0000000000..893386bc6b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/CMakeLists.txt
@@ -0,0 +1,19 @@
+# Generated from releaseplugin.pro.
+
+#####################################################################
+## releaseplugin Generic Library:
+#####################################################################
+
+add_cmake_library(releaseplugin
+ MODULE
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../plugins"
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:releaseplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(releaseplugin)
diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
index aa85a7c35b..644b8b700d 100644
--- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
+++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
@@ -81,6 +81,9 @@ void tst_QPlugin::loadDebugPlugin()
QObject *object = loader.instance();
QVERIFY(object != 0);
#else
+# if defined(CMAKE_BUILD) && defined(QT_NO_DEBUG)
+ QSKIP("Skipping test as it is not possible to disable build targets based on configuration with CMake");
+# endif
// loading a plugin is dependent on which lib we are running against
# if defined(QT_NO_DEBUG)
// release build, we cannot load debug plugins
@@ -111,6 +114,9 @@ void tst_QPlugin::loadReleasePlugin()
QObject *object = loader.instance();
QVERIFY(object != 0);
#else
+# if defined(CMAKE_BUILD) && !defined(QT_NO_DEBUG)
+ QSKIP("Skipping test as it is not possible to disable build targets based on configuration with CMake");
+# endif
// loading a plugin is dependent on which lib we are running against
# if defined(QT_NO_DEBUG)
// release build, we can load debug plugins
diff --git a/tests/auto/corelib/plugin/qpluginloader/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/CMakeLists.txt
new file mode 100644
index 0000000000..ba7d375e3b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qpluginloader.pro.
+
+add_subdirectory(lib)
+add_subdirectory(staticplugin)
+add_subdirectory(theplugin)
+add_subdirectory(tst)
+if(UNIX AND NOT ANDROID AND NOT APPLE)
+ add_subdirectory(almostplugin)
+endif()
+if(APPLE_OSX AND QT_FEATURE_private_tests AND TARGET Qt::Gui)
+ add_subdirectory(machtest)
+endif()
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..5e42a1aef0
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/.prev_CMakeLists.txt
@@ -0,0 +1,30 @@
+# Generated from almostplugin.pro.
+
+#####################################################################
+## almostplugin Generic Library:
+#####################################################################
+
+add_cmake_library(almostplugin
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ almostplugin.cpp almostplugin.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:almostplugin.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+extend_target(almostplugin CONDITION GCC
+ LINK_OPTIONS
+ "--Wl,--no-undefined"
+)
+
+qt_autogen_tools_initial_setup(almostplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt
new file mode 100644
index 0000000000..5208a70c9d
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Generated from almostplugin.pro.
+
+#####################################################################
+## almostplugin Generic Library:
+#####################################################################
+
+add_cmake_library(almostplugin
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ almostplugin.cpp almostplugin.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:almostplugin.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+qt_autogen_tools_initial_setup(almostplugin)
+# special case begin
+# We want the opposite of this
+#extend_target(almostplugin CONDITION GCC
+# LINK_OPTIONS
+# "--Wl,--no-undefined"
+#)
+# special case end
diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..74945fc6d8
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/lib/.prev_CMakeLists.txt
@@ -0,0 +1,34 @@
+# Generated from lib.pro.
+
+#####################################################################
+## tst_qpluginloaderlib Generic Library:
+#####################################################################
+
+add_cmake_library(tst_qpluginloaderlib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 7:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+extend_target(tst_qpluginloaderlib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt
new file mode 100644
index 0000000000..8d723cf3ce
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/lib/CMakeLists.txt
@@ -0,0 +1,41 @@
+# Generated from lib.pro.
+
+#####################################################################
+## tst_qpluginloaderlib Generic Library:
+#####################################################################
+
+add_cmake_library(tst_qpluginloaderlib
+ SHARED
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ mylib.c
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:lib.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 7:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+extend_target(tst_qpluginloaderlib CONDITION MSVC
+ DEFINES
+ WIN32_MSVC
+)
+
+# special case begin
+set_target_properties(tst_qpluginloaderlib PROPERTIES
+ C_VISIBILITY_PRESET "default"
+ CXX_VISIBILITY_PRESET "default"
+)
+# special case end
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/machtest/CMakeLists.txt
new file mode 100644
index 0000000000..05cd044aa3
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/CMakeLists.txt
@@ -0,0 +1,2 @@
+# Generated from machtest.pro.
+
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..bfc30d7c1d
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/.prev_CMakeLists.txt
@@ -0,0 +1,23 @@
+# Generated from staticplugin.pro.
+
+#####################################################################
+## staticplugin Generic Library:
+#####################################################################
+
+add_cmake_library(staticplugin
+ STATIC
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ MOC_OPTIONS
+ "-M"
+ "ExtraMetaData=StaticPlugin"
+ "-M"
+ "ExtraMetaData=foo"
+)
+
+#### Keys ignored in scope 1:.:.:staticplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(staticplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
new file mode 100644
index 0000000000..fb9d365d74
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
@@ -0,0 +1,25 @@
+# Generated from staticplugin.pro.
+
+#####################################################################
+## staticplugin Generic Library:
+#####################################################################
+
+add_cmake_library(staticplugin
+ STATIC
+ SOURCES
+ main.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ MOC_OPTIONS
+ "-M"
+ "ExtraMetaData=StaticPlugin"
+ "-M"
+ "ExtraMetaData=foo"
+)
+
+#### Keys ignored in scope 1:.:.:staticplugin.pro:<TRUE>:
+# TEMPLATE = "lib"
+
+qt_autogen_tools_initial_setup(staticplugin)
+
+target_compile_definitions(staticplugin PRIVATE QT_STATICPLUGIN)
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
new file mode 100644
index 0000000000..5389790fba
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Generated from theplugin.pro.
+
+#####################################################################
+## theplugin Generic Library:
+#####################################################################
+
+add_cmake_library(theplugin
+ MODULE
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qpluginloader/bin"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
+ SOURCES
+ theplugin.cpp theplugin.h
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+#### Keys ignored in scope 1:.:.:theplugin.pro:<TRUE>:
+# INSTALLS = "target"
+# TEMPLATE = "lib"
+# target.path = "$$[QT_INSTALL_TESTS]/tst_qpluginloader/bin"
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 5:.:..:../winrt.pri:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug/bin"
+
+#### Keys ignored in scope 6:.:..:../winrt.pri:else:
+# DESTDIR = "../release/bin"
+
+qt_autogen_tools_initial_setup(theplugin)
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..8bef975168
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/.prev_CMakeLists.txt
@@ -0,0 +1,45 @@
+# Generated from tst.pro.
+
+#####################################################################
+## tst_qpluginloader Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../elftest")
+list(APPEND test_data "../machtest")
+
+add_qt_test(tst_qpluginloader
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../fakeplugin.cpp
+ ../theplugin/plugininterface.h
+ ../tst_qpluginloader.cpp
+ PUBLIC_LIBRARIES
+ staticplugin
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
+ LIBRARIES
+ Qt::CorePrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
+
+extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32 AND debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/debug
+)
+
+extend_target(tst_qpluginloader CONDITION WIN32 AND debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/release
+)
+
+extend_target(tst_qpluginloader CONDITION UNIX OR NOT debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin
+)
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
new file mode 100644
index 0000000000..c1c0d4b02b
--- /dev/null
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
@@ -0,0 +1,43 @@
+# Generated from tst.pro.
+
+#####################################################################
+## tst_qpluginloader Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../elftest")
+list(APPEND test_data "../machtest")
+
+add_qt_test(tst_qpluginloader
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../fakeplugin.cpp
+ ../theplugin/plugininterface.h
+ ../tst_qpluginloader.cpp
+ PUBLIC_LIBRARIES
+ staticplugin
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32 AND debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/debug
+)
+
+extend_target(tst_qpluginloader CONDITION WIN32 AND debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin/release
+)
+
+extend_target(tst_qpluginloader CONDITION UNIX OR NOT debug_and_release
+ PUBLIC_LIBRARIES
+ # Remove: L../staticplugin
+)
diff --git a/tests/auto/corelib/plugin/quuid/CMakeLists.txt b/tests/auto/corelib/plugin/quuid/CMakeLists.txt
new file mode 100644
index 0000000000..91e75fe0ae
--- /dev/null
+++ b/tests/auto/corelib/plugin/quuid/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Generated from quuid.pro.
+
+add_subdirectory(testProcessUniqueness)
+add_subdirectory(test)
diff --git a/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt b/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..c635f6479c
--- /dev/null
+++ b/tests/auto/corelib/plugin/quuid/test/.prev_CMakeLists.txt
@@ -0,0 +1,29 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_quuid Test:
+#####################################################################
+
+add_qt_test(tst_quuid
+ SOURCES
+ ../tst_quuid.cpp
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_quuid CONDITION APPLE
+ SOURCES
+ ../tst_quuid_darwin.mm
+ PUBLIC_LIBRARIES
+ ${FWFoundation}
+)
+
+#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug"
+
+#### Keys ignored in scope 5:.:.:test.pro:else:
+# DESTDIR = "../release"
+
+#### Keys ignored in scope 6:.:.:test.pro:else:
+# DESTDIR = ".."
diff --git a/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt b/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt
new file mode 100644
index 0000000000..5707dfa5a1
--- /dev/null
+++ b/tests/auto/corelib/plugin/quuid/test/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_quuid Test:
+#####################################################################
+
+add_qt_test(tst_quuid
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../" # special case
+ SOURCES
+ ../tst_quuid.cpp
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_quuid CONDITION APPLE
+ SOURCES
+ ../tst_quuid_darwin.mm
+ PUBLIC_LIBRARIES
+ ${FWFoundation}
+)
+
+#### Keys ignored in scope 4:.:.:test.pro:(CMAKE_BUILD_TYPE STREQUAL Debug):
+# DESTDIR = "../debug"
+
+#### Keys ignored in scope 5:.:.:test.pro:else:
+# DESTDIR = "../release"
+
+#### Keys ignored in scope 6:.:.:test.pro:else:
+# DESTDIR = ".."
diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/CMakeLists.txt b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/CMakeLists.txt
new file mode 100644
index 0000000000..39ff85c466
--- /dev/null
+++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from testProcessUniqueness.pro.
+
+#####################################################################
+## testProcessUniqueness Binary:
+#####################################################################
+
+add_qt_executable(testProcessUniqueness
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_quuid/testProcessUniqueness"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/serialization/CMakeLists.txt b/tests/auto/corelib/serialization/CMakeLists.txt
new file mode 100644
index 0000000000..f6af7fa256
--- /dev/null
+++ b/tests/auto/corelib/serialization/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Generated from serialization.pro.
+
+add_subdirectory(json)
+add_subdirectory(qcborstreamreader)
+add_subdirectory(qcborstreamwriter)
+add_subdirectory(qcborvalue)
+add_subdirectory(qcborvalue_json)
+add_subdirectory(qdatastream_core_pixmap)
+if(TARGET Qt::Gui)
+ add_subdirectory(qdatastream)
+endif()
+if(TARGET Qt::Network)
+ add_subdirectory(qtextstream)
+endif()
+if(TARGET Qt::Network AND TARGET Qt::Xml)
+ add_subdirectory(qxmlstream)
+endif()
diff --git a/tests/auto/corelib/serialization/json/CMakeLists.txt b/tests/auto/corelib/serialization/json/CMakeLists.txt
new file mode 100644
index 0000000000..b38b6223ed
--- /dev/null
+++ b/tests/auto/corelib/serialization/json/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Generated from json.pro.
+
+#####################################################################
+## tst_json Test:
+#####################################################################
+
+add_qt_test(tst_json
+ SOURCES
+ tst_qtjson.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:json.pro:NOT ANDROID:
+# TESTDATA = "bom.json" "test.json" "test.bjson" "test3.json" "test2.json"
+
+if(ANDROID)
+ # Resources:
+ set(json_resource_files
+ "bom.json"
+ "test.bjson"
+ "test.json"
+ "test2.json"
+ "test3.json"
+ )
+
+ add_qt_resource(tst_json "json"
+ PREFIX
+ "/"
+ FILES
+ ${json_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
index 45f815f810..4c85482c6a 100644
--- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
@@ -52,6 +52,8 @@ private Q_SLOTS:
void testNumbers_3();
void testNumbers_4();
+ void testNumberComparisons();
+
void testObjectSimple();
void testObjectSmallKeys();
void testArraySimple();
@@ -218,26 +220,32 @@ void tst_QtJson::testNumbers()
{
int numbers[] = {
0,
- -1,
1,
+ 2,
+ -1,
+ -2,
+ (1<<25),
(1<<26),
(1<<27),
(1<<28),
+ -(1<<25),
-(1<<26),
-(1<<27),
-(1<<28),
(1<<26) - 1,
(1<<27) - 1,
(1<<28) - 1,
+ (1<<29) - 1,
-((1<<26) - 1),
-((1<<27) - 1),
- -((1<<28) - 1)
+ -((1<<28) - 1),
+ -((1<<29) - 1)
};
int n = sizeof(numbers)/sizeof(int);
QJsonArray array;
for (int i = 0; i < n; ++i)
- array.append((double)numbers[i]);
+ array.append(numbers[i]);
QByteArray serialized = QJsonDocument(array).toJson();
QJsonDocument json = QJsonDocument::fromJson(serialized);
@@ -246,8 +254,10 @@ void tst_QtJson::testNumbers()
QCOMPARE(array.size(), array2.size());
for (int i = 0; i < array.size(); ++i) {
QCOMPARE(array.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array.at(i).toInt(), numbers[i]);
QCOMPARE(array.at(i).toDouble(), (double)numbers[i]);
QCOMPARE(array2.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array2.at(i).toInt(), numbers[i]);
QCOMPARE(array2.at(i).toDouble(), (double)numbers[i]);
}
}
@@ -255,8 +265,10 @@ void tst_QtJson::testNumbers()
{
qint64 numbers[] = {
0,
- -1,
1,
+ 2,
+ -1,
+ -2,
(1ll<<54),
(1ll<<55),
(1ll<<56),
@@ -266,15 +278,21 @@ void tst_QtJson::testNumbers()
(1ll<<54) - 1,
(1ll<<55) - 1,
(1ll<<56) - 1,
+ (1ll<<57) - 1,
+ (1ll<<58) - 1,
+ (1ll<<59) + 1001,
-((1ll<<54) - 1),
-((1ll<<55) - 1),
- -((1ll<<56) - 1)
+ -((1ll<<56) - 1),
+ -((1ll<<57) - 1),
+ -((1ll<<58) - 1),
+ -((1ll<<59) + 1001),
};
int n = sizeof(numbers)/sizeof(qint64);
QJsonArray array;
for (int i = 0; i < n; ++i)
- array.append((double)numbers[i]);
+ array.append(QJsonValue(numbers[i]));
QByteArray serialized = QJsonDocument(array).toJson();
QJsonDocument json = QJsonDocument::fromJson(serialized);
@@ -283,8 +301,10 @@ void tst_QtJson::testNumbers()
QCOMPARE(array.size(), array2.size());
for (int i = 0; i < array.size(); ++i) {
QCOMPARE(array.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array.at(i).toInteger(), numbers[i]);
QCOMPARE(array.at(i).toDouble(), (double)numbers[i]);
QCOMPARE(array2.at(i).type(), QJsonValue::Double);
+ QCOMPARE(array2.at(i).toInteger(), numbers[i]);
QCOMPARE(array2.at(i).toDouble(), (double)numbers[i]);
}
}
@@ -422,6 +442,46 @@ void tst_QtJson::testNumbers_4()
" -18446744073709552000\n"
"]\n";
QCOMPARE(json, expected);
+
+ QJsonArray array2;
+ array2 << QJsonValue(Q_INT64_C(+1000000000000000));
+ array2 << QJsonValue(Q_INT64_C(-1000000000000000));
+ array2 << QJsonValue(Q_INT64_C(+9007199254740992));
+ array2 << QJsonValue(Q_INT64_C(-9007199254740992));
+ array2 << QJsonValue(Q_INT64_C(+9223372036854775807));
+ array2 << QJsonValue(Q_INT64_C(-9223372036854775807));
+ const QByteArray json2(QJsonDocument(array2).toJson());
+ const QByteArray expected2 =
+ "[\n"
+ " 1000000000000000,\n"
+ " -1000000000000000,\n"
+ " 9007199254740992,\n"
+ " -9007199254740992,\n"
+ " 9223372036854775807,\n"
+ " -9223372036854775807\n"
+ "]\n";
+ QCOMPARE(json2, expected2);
+}
+
+void tst_QtJson::testNumberComparisons()
+{
+ // QJsonValues created using doubles only have double precision
+ QJsonValue llMinDbl(-9223372036854775807.0);
+ QJsonValue llMinPlus1Dbl(-9223372036854775806.0);
+ QCOMPARE(llMinDbl == llMinPlus1Dbl, -9223372036854775807.0 == -9223372036854775806.0); // true
+
+ // QJsonValues created using qint64 have full qint64 precision
+ QJsonValue llMin(Q_INT64_C(-9223372036854775807));
+ QJsonValue llMinPlus1(Q_INT64_C(-9223372036854775806));
+ QCOMPARE(llMin == llMinPlus1, Q_INT64_C(-9223372036854775807) == Q_INT64_C(-9223372036854775806)); // false
+
+ // The different storage formats should be able to compare as their C++ versions (all true)
+ QCOMPARE(llMin == llMinDbl, Q_INT64_C(-9223372036854775807) == -9223372036854775807.0);
+ QCOMPARE(llMinDbl == llMin, -9223372036854775807.0 == Q_INT64_C(-9223372036854775807));
+ QCOMPARE(llMinPlus1 == llMinPlus1Dbl, Q_INT64_C(-9223372036854775806) == -9223372036854775806.0);
+ QCOMPARE(llMinPlus1Dbl == llMinPlus1, -9223372036854775806.0 == Q_INT64_C(-9223372036854775806));
+ QCOMPARE(llMinPlus1 == llMinDbl, Q_INT64_C(-9223372036854775806) == -9223372036854775807.0);
+ QCOMPARE(llMinPlus1Dbl == llMin, -9223372036854775806.0 == Q_INT64_C(-9223372036854775807));
}
void tst_QtJson::testObjectSimple()
@@ -1162,8 +1222,8 @@ void tst_QtJson::fromVariant_data()
bool boolValue = true;
int intValue = -1;
uint uintValue = 1;
- long long longlongValue = -2;
- unsigned long long ulonglongValue = 2;
+ qlonglong longlongValue = -2;
+ qulonglong ulonglongValue = 2;
float floatValue = 3.3f;
double doubleValue = 4.4;
QString stringValue("str");
@@ -1209,7 +1269,7 @@ void tst_QtJson::fromVariant_data()
QTest::newRow("nullptr") << QVariant::fromValue(nullptr) << QJsonValue(QJsonValue::Null);
QTest::newRow("bool") << QVariant(boolValue) << QJsonValue(boolValue);
QTest::newRow("int") << QVariant(intValue) << QJsonValue(intValue);
- QTest::newRow("uint") << QVariant(uintValue) << QJsonValue(static_cast<double>(uintValue));
+ QTest::newRow("uint") << QVariant(uintValue) << QJsonValue(static_cast<qint64>(uintValue));
QTest::newRow("longlong") << QVariant(longlongValue) << QJsonValue(longlongValue);
QTest::newRow("ulonglong") << QVariant(ulonglongValue) << QJsonValue(static_cast<double>(ulonglongValue));
QTest::newRow("float") << QVariant(floatValue) << QJsonValue(floatValue);
diff --git a/tests/auto/corelib/serialization/qcborstreamreader/CMakeLists.txt b/tests/auto/corelib/serialization/qcborstreamreader/CMakeLists.txt
new file mode 100644
index 0000000000..198cca8435
--- /dev/null
+++ b/tests/auto/corelib/serialization/qcborstreamreader/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qcborstreamreader.pro.
+
+#####################################################################
+## tst_qcborstreamreader Test:
+#####################################################################
+
+add_qt_test(tst_qcborstreamreader
+ SOURCES
+ tst_qcborstreamreader.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+ INCLUDE_DIRECTORIES
+ ../../../../../src/3rdparty/tinycbor/src
+ ../../../../../src/3rdparty/tinycbor/tests/parser
+)
diff --git a/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt b/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt
new file mode 100644
index 0000000000..9265df415e
--- /dev/null
+++ b/tests/auto/corelib/serialization/qcborstreamwriter/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qcborstreamwriter.pro.
+
+#####################################################################
+## tst_qcborstreamwriter Test:
+#####################################################################
+
+add_qt_test(tst_qcborstreamwriter
+ SOURCES
+ tst_qcborstreamwriter.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+ INCLUDE_DIRECTORIES
+ ../../../../../src/3rdparty/tinycbor/tests/encoder
+)
diff --git a/tests/auto/corelib/serialization/qcborvalue/CMakeLists.txt b/tests/auto/corelib/serialization/qcborvalue/CMakeLists.txt
new file mode 100644
index 0000000000..66cb80c56a
--- /dev/null
+++ b/tests/auto/corelib/serialization/qcborvalue/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qcborvalue.pro.
+
+#####################################################################
+## tst_qcborvalue Test:
+#####################################################################
+
+add_qt_test(tst_qcborvalue
+ SOURCES
+ tst_qcborvalue.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+ INCLUDE_DIRECTORIES
+ ../../../../../src/3rdparty/tinycbor/src
+ ../../../../../src/3rdparty/tinycbor/tests/parser
+)
diff --git a/tests/auto/corelib/serialization/qcborvalue_json/CMakeLists.txt b/tests/auto/corelib/serialization/qcborvalue_json/CMakeLists.txt
new file mode 100644
index 0000000000..0346d2d0e0
--- /dev/null
+++ b/tests/auto/corelib/serialization/qcborvalue_json/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qcborvalue_json.pro.
+
+#####################################################################
+## tst_qcborvalue_json Test:
+#####################################################################
+
+add_qt_test(tst_qcborvalue_json
+ SOURCES
+ tst_qcborvalue_json.cpp
+ DEFINES
+ SRCDIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"
+)
diff --git a/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp b/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
index 56245a7173..76f2bb924a 100644
--- a/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
+++ b/tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp
@@ -97,9 +97,12 @@ void tst_QCborValue_Json::toVariant_data()
add(1, 1, 1);
add(-1, -1, -1);
add(0., 0., 0.);
+ add(2., 2., 2.);
add(1.25, 1.25, 1.25);
add(-1.25, -1.25, -1.25);
add("Hello", "Hello", "Hello");
+ add(std::numeric_limits<qint64>::max(), std::numeric_limits<qint64>::max(), std::numeric_limits<qint64>::max());
+ add(std::numeric_limits<qint64>::min(), std::numeric_limits<qint64>::min(), std::numeric_limits<qint64>::min());
// converts to string in JSON:
add(QByteArray("Hello"), QByteArray("Hello"), "SGVsbG8");
@@ -123,14 +126,6 @@ void tst_QCborValue_Json::toVariant_data()
<< QVariant(qQNaN())
<< QJsonValue();
- // large integral values lose precision in JSON
- QTest::newRow("Integer:max") << QCborValue(std::numeric_limits<qint64>::max())
- << QVariant(std::numeric_limits<qint64>::max())
- << QJsonValue(std::numeric_limits<qint64>::max());
- QTest::newRow("Integer:min") << QCborValue(std::numeric_limits<qint64>::min())
- << QVariant(std::numeric_limits<qint64>::min())
- << QJsonValue(std::numeric_limits<qint64>::min());
-
// empty arrays and maps
add(QCborArray(), QVariantList(), QJsonArray());
add(QCborMap(), QVariantMap(), QJsonObject());
@@ -257,6 +252,10 @@ void tst_QCborValue_Json::fromJson_data()
QTest::newRow("0") << QCborValue(0) << QJsonValue(0.);
QTest::newRow("1") << QCborValue(1) << QJsonValue(1);
QTest::newRow("1.5") << QCborValue(1.5) << QJsonValue(1.5);
+ QTest::newRow("Integer:max") << QCborValue(std::numeric_limits<qint64>::max())
+ << QJsonValue(std::numeric_limits<qint64>::max());
+ QTest::newRow("Integer:min") << QCborValue(std::numeric_limits<qint64>::min())
+ << QJsonValue(std::numeric_limits<qint64>::min());
QTest::newRow("string") << QCborValue("Hello") << QJsonValue("Hello");
QTest::newRow("array") << QCborValue(QCborValue::Array) << QJsonValue(QJsonValue::Array);
QTest::newRow("map") << QCborValue(QCborValue::Map) << QJsonValue(QJsonValue::Object);
diff --git a/tests/auto/corelib/serialization/qdatastream/.prev_CMakeLists.txt b/tests/auto/corelib/serialization/qdatastream/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..1402aed9ab
--- /dev/null
+++ b/tests/auto/corelib/serialization/qdatastream/.prev_CMakeLists.txt
@@ -0,0 +1,35 @@
+# Generated from qdatastream.pro.
+
+#####################################################################
+## tst_qdatastream Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "datastream.q42")
+
+add_qt_test(tst_qdatastream
+ SOURCES
+ tst_qdatastream.cpp
+ DEFINES
+ -QT_NO_LINKED_LIST
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(testdata_resource_files
+ "datastream.q42"
+ )
+
+ add_qt_resource(tst_qdatastream "testdata"
+ PREFIX
+ "/"
+ FILES
+ ${testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/serialization/qdatastream/CMakeLists.txt b/tests/auto/corelib/serialization/qdatastream/CMakeLists.txt
new file mode 100644
index 0000000000..2bb2e842e8
--- /dev/null
+++ b/tests/auto/corelib/serialization/qdatastream/CMakeLists.txt
@@ -0,0 +1,35 @@
+# Generated from qdatastream.pro.
+
+#####################################################################
+## tst_qdatastream Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "datastream.q42")
+
+add_qt_test(tst_qdatastream
+ SOURCES
+ tst_qdatastream.cpp
+ DEFINES
+ # -QT_NO_LINKED_LIST # special case remove
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+if(ANDROID AND NOT ANDROID_EMBEDDED)
+ # Resources:
+ set(testdata_resource_files
+ "datastream.q42"
+ )
+
+ add_qt_resource(tst_qdatastream "testdata"
+ PREFIX
+ "/"
+ FILES
+ ${testdata_resource_files}
+ )
+endif()
diff --git a/tests/auto/corelib/serialization/qdatastream/qdatastream.pro b/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
index 469d689f3f..25f8b889a0 100644
--- a/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
+++ b/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
@@ -3,8 +3,6 @@ TARGET = tst_qdatastream
QT += testlib
SOURCES = tst_qdatastream.cpp
-DEFINES -= QT_NO_LINKED_LIST
-
TESTDATA += datastream.q42
android:!android-embedded {
diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
index aed84cb14e..d777d69d3c 100644
--- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
@@ -121,9 +121,15 @@ private slots:
void stream_Map_data();
void stream_Map();
+ void stream_MultiMap_data();
+ void stream_MultiMap();
+
void stream_Hash_data();
void stream_Hash();
+ void stream_MultiHash_data();
+ void stream_MultiHash();
+
void stream_qint64_data();
void stream_qint64();
@@ -180,7 +186,7 @@ private slots:
void status_QHash_QMap();
- void status_QLinkedList_QList_QVector();
+ void status_QList_QVector();
void streamToAndFromQByteArray();
@@ -230,7 +236,9 @@ private:
void writeQRegularExpression(QDataStream *dev);
#endif
void writeMap(QDataStream* dev);
+ void writeMultiMap(QDataStream* dev);
void writeHash(QDataStream* dev);
+ void writeMultiHash(QDataStream* dev);
void writeqint64(QDataStream *s);
void writeQIcon(QDataStream *s);
void writeQEasingCurve(QDataStream *s);
@@ -262,7 +270,9 @@ private:
void readQRegularExpression(QDataStream *s);
#endif
void readMap(QDataStream *s);
+ void readMultiMap(QDataStream *s);
void readHash(QDataStream *s);
+ void readMultiHash(QDataStream *s);
void readqint64(QDataStream *s);
void readQIcon(QDataStream *s);
void readQEasingCurve(QDataStream *s);
@@ -650,16 +660,10 @@ static Map MapData(int index)
map.insert(2, "bbb");
map.insert(3, "cccccc");
break;
- case 2:
- map.insert(1, "a");
- map.insert(2, "one");
- map.insertMulti(2, "two");
- map.insertMulti(2, "three");
- map.insert(3, "cccccc");
}
return map;
}
-#define MAX_MAP_DATA 3
+#define MAX_MAP_DATA 2
void tst_QDataStream::stream_Map_data()
{
@@ -689,6 +693,60 @@ void tst_QDataStream::readMap(QDataStream *s)
QCOMPARE(S, test);
}
+typedef QMultiMap<int, QString> MultiMap;
+
+static MultiMap MultiMapData(int index)
+{
+ MultiMap map;
+
+ switch (index) {
+ case 0:
+ default:
+ break;
+ case 1:
+ map.insert(1, "a");
+ map.insert(2, "bbb");
+ map.insert(3, "cccccc");
+ break;
+ case 2:
+ map.insert(1, "a");
+ map.insert(2, "one");
+ map.insert(2, "two");
+ map.insert(2, "three");
+ map.insert(3, "cccccc");
+ }
+ return map;
+}
+#define MAX_MULTIMAP_DATA 3
+
+void tst_QDataStream::stream_MultiMap_data()
+{
+ stream_data(MAX_MULTIMAP_DATA);
+}
+
+void tst_QDataStream::stream_MultiMap()
+{
+ STREAM_IMPL(MultiMap);
+}
+
+void tst_QDataStream::writeMultiMap(QDataStream* s)
+{
+ MultiMap test(MultiMapData(dataIndex(QTest::currentDataTag())));
+ *s << test;
+ *s << test;
+}
+
+void tst_QDataStream::readMultiMap(QDataStream *s)
+{
+ MultiMap S;
+ MultiMap test(MultiMapData(dataIndex(QTest::currentDataTag())));
+
+ *s >> S;
+ QCOMPARE(S, test);
+ *s >> S;
+ QCOMPARE(S, test);
+}
+
// ************************************
typedef QHash<int, QString> Hash;
@@ -706,16 +764,10 @@ static Hash HashData(int index)
map.insert(2, "bbb");
map.insert(3, "cccccc");
break;
- case 2:
- map.insert(1, "a");
- map.insert(2, "one");
- map.insertMulti(2, "two");
- map.insertMulti(2, "three");
- map.insert(3, "cccccc");
}
return map;
}
-#define MAX_HASH_DATA 3
+#define MAX_HASH_DATA 2
void tst_QDataStream::stream_Hash_data()
{
@@ -745,6 +797,60 @@ void tst_QDataStream::readHash(QDataStream *s)
QCOMPARE(S, test);
}
+typedef QMultiHash<int, QString> MultiHash;
+
+static MultiHash MultiHashData(int index)
+{
+ MultiHash map;
+
+ switch (index) {
+ case 0:
+ default:
+ break;
+ case 1:
+ map.insert(1, "a");
+ map.insert(2, "bbb");
+ map.insert(3, "cccccc");
+ break;
+ case 2:
+ map.insert(1, "a");
+ map.insert(2, "one");
+ map.insert(2, "two");
+ map.insert(2, "three");
+ map.insert(3, "cccccc");
+ }
+ return map;
+}
+#define MAX_MULTIHASH_DATA 3
+
+void tst_QDataStream::stream_MultiHash_data()
+{
+ stream_data(MAX_HASH_DATA);
+}
+
+void tst_QDataStream::stream_MultiHash()
+{
+ STREAM_IMPL(MultiHash);
+}
+
+void tst_QDataStream::writeMultiHash(QDataStream* s)
+{
+ MultiHash test(MultiHashData(dataIndex(QTest::currentDataTag())));
+ *s << test;
+ *s << test;
+}
+
+void tst_QDataStream::readMultiHash(QDataStream *s)
+{
+ MultiHash S;
+ MultiHash test(MultiHashData(dataIndex(QTest::currentDataTag())));
+
+ *s >> S;
+ QCOMPARE(S, test);
+ *s >> S;
+ QCOMPARE(S, test);
+}
+
// ************************************
static QEasingCurve QEasingCurveData(int index)
@@ -2327,6 +2433,7 @@ void tst_QDataStream::setVersion()
QDataStream latest;
QFETCH(int, vers);
+#if QT_CONFIG(shortcut)
/*
Test QKeySequence.
*/
@@ -2351,6 +2458,7 @@ void tst_QDataStream::setVersion()
}
QCOMPARE(deadbeef, 0xDEADBEEF);
}
+#endif // QT_CONFIG(shortcut)
/*
Test QPalette.
@@ -3064,24 +3172,6 @@ void tst_QDataStream::status_QHash_QMap()
} \
} \
{ \
- LinkedList expectedLinkedList; \
- for (int i = 0; i < expectedList.count(); ++i) \
- expectedLinkedList << expectedList.at(i); \
- QByteArray ba = byteArray; \
- QDataStream stream(&ba, QIODevice::ReadOnly); \
- if (inTransaction) \
- stream.startTransaction(); \
- stream.setStatus(initialStatus); \
- stream >> linkedList; \
- QCOMPARE((int)stream.status(), (int)expectedStatus); \
- if (!inTransaction || stream.commitTransaction()) { \
- QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
- QCOMPARE(linkedList, expectedLinkedList); \
- } else { \
- QVERIFY(linkedList.isEmpty()); \
- } \
- } \
- { \
Vector expectedVector; \
for (int i = 0; i < expectedList.count(); ++i) \
expectedVector << expectedList.at(i); \
@@ -3103,12 +3193,10 @@ void tst_QDataStream::status_QHash_QMap()
break; \
}
-void tst_QDataStream::status_QLinkedList_QList_QVector()
+void tst_QDataStream::status_QList_QVector()
{
- typedef QLinkedList<QString> LinkedList;
typedef QList<QString> List;
typedef QVector<QString> Vector;
- LinkedList linkedList;
List list;
Vector vector;
diff --git a/tests/auto/corelib/serialization/qdatastream_core_pixmap/CMakeLists.txt b/tests/auto/corelib/serialization/qdatastream_core_pixmap/CMakeLists.txt
new file mode 100644
index 0000000000..55e8c164e5
--- /dev/null
+++ b/tests/auto/corelib/serialization/qdatastream_core_pixmap/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qdatastream_core_pixmap.pro.
+
+#####################################################################
+## tst_qdatastream_core_pixmap Test:
+#####################################################################
+
+add_qt_test(tst_qdatastream_core_pixmap
+ SOURCES
+ tst_qdatastream_core_pixmap.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+)
diff --git a/tests/auto/corelib/serialization/qtextstream/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/CMakeLists.txt
new file mode 100644
index 0000000000..15798c963f
--- /dev/null
+++ b/tests/auto/corelib/serialization/qtextstream/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Generated from qtextstream.pro.
+
+add_subdirectory(test)
+add_subdirectory(stdinProcess)
+add_subdirectory(readAllStdinProcess)
+add_subdirectory(readLineStdinProcess)
diff --git a/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/CMakeLists.txt
new file mode 100644
index 0000000000..f377c97c2d
--- /dev/null
+++ b/tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from readAllStdinProcess.pro.
+
+#####################################################################
+## readAllStdinProcess Binary:
+#####################################################################
+
+add_qt_executable(readAllStdinProcess
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qtextstream/readAllStdinProcess"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/CMakeLists.txt
new file mode 100644
index 0000000000..ae899e55df
--- /dev/null
+++ b/tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from readLineStdinProcess.pro.
+
+#####################################################################
+## readLineStdinProcess Binary:
+#####################################################################
+
+add_qt_executable(readLineStdinProcess
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qtextstream/readLineStdinProcess"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/serialization/qtextstream/stdinProcess/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/stdinProcess/CMakeLists.txt
new file mode 100644
index 0000000000..fed74b64c2
--- /dev/null
+++ b/tests/auto/corelib/serialization/qtextstream/stdinProcess/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from stdinProcess.pro.
+
+#####################################################################
+## stdinProcess Binary:
+#####################################################################
+
+add_qt_executable(stdinProcess
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qtextstream/stdinProcess"
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ main.cpp
+)
diff --git a/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt
new file mode 100644
index 0000000000..21ba0d47fb
--- /dev/null
+++ b/tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Generated from test.pro.
+
+#####################################################################
+## tst_qtextstream Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "../rfc3261.txt")
+list(APPEND test_data "../shift-jis.txt")
+list(APPEND test_data "../task113817.txt")
+list(APPEND test_data "../qtextstream.qrc")
+list(APPEND test_data "../tst_qtextstream.cpp")
+list(APPEND test_data "../resources")
+list(APPEND test_data "../BLACKLIST")
+
+add_qt_test(tst_qtextstream
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
+ SOURCES
+ ../../../../../shared/emulationdetector.h
+ ../tst_qtextstream.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../../shared
+ PUBLIC_LIBRARIES
+ Qt::Network
+ TESTDATA ${test_data}
+)
+
+# Resources:
+set_source_files_properties("../resources/big_endian/"
+ PROPERTIES QT_RESOURCE_ALIAS "resources/big_endian/"
+)
+set_source_files_properties("../resources/little_endian/"
+ PROPERTIES QT_RESOURCE_ALIAS "resources/little_endian/"
+)
+set(qtextstream_resource_files
+ "resources/big_endian/"
+ "resources/little_endian/"
+)
+
+add_qt_resource(tst_qtextstream "qtextstream"
+ PREFIX
+ "/tst_textstream/"
+ BASE
+ ".."
+ FILES
+ ${qtextstream_resource_files}
+)
+
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qtextstream CONDITION builtin_testdata
+ DEFINES
+ BUILTIN_TESTDATA
+)
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
index 6381ce5ed0..6565924f58 100644
--- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -2449,8 +2449,8 @@ void tst_QTextStream::generateRealNumbersDataWrite()
QTest::newRow("0") << 0.0 << QByteArray("0") << QByteArray("0");
QTest::newRow("3.14") << 3.14 << QByteArray("3.14") << QByteArray("3.14");
QTest::newRow("-3.14") << -3.14 << QByteArray("-3.14") << QByteArray("-3.14");
- QTest::newRow("1.2e+10") << 1.2e+10 << QByteArray("1.2e+10") << QByteArray("1.2e+10");
- QTest::newRow("-1.2e+10") << -1.2e+10 << QByteArray("-1.2e+10") << QByteArray("-1.2e+10");
+ QTest::newRow("1.2e+10") << 1.2e+10 << QByteArray("1.2e+10") << QByteArray("1.2E+10");
+ QTest::newRow("-1.2e+10") << -1.2e+10 << QByteArray("-1.2e+10") << QByteArray("-1.2E+10");
QTest::newRow("12345") << 12345. << QByteArray("12345") << QByteArray("12,345");
}
diff --git a/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt b/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt
new file mode 100644
index 0000000000..0339b57c71
--- /dev/null
+++ b/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qxmlstream.pro.
+
+#####################################################################
+## tst_qxmlstream Test:
+#####################################################################
+
+# Collect test data
+list(APPEND test_data "data")
+list(APPEND test_data "XML-Test-Suite")
+
+add_qt_test(tst_qxmlstream
+ SOURCES
+ tst_qxmlstream.cpp
+ PUBLIC_LIBRARIES
+ Qt::Network
+ Qt::Xml
+ TESTDATA ${test_data}
+)
diff --git a/tests/auto/corelib/statemachine/CMakeLists.txt b/tests/auto/corelib/statemachine/CMakeLists.txt
new file mode 100644
index 0000000000..52c956cd03
--- /dev/null
+++ b/tests/auto/corelib/statemachine/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_subdirectory(qstate)
+
diff --git a/tests/auto/corelib/statemachine/qstate/CMakeLists.txt b/tests/auto/corelib/statemachine/qstate/CMakeLists.txt
new file mode 100644
index 0000000000..e269f7191a
--- /dev/null
+++ b/tests/auto/corelib/statemachine/qstate/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstate.pro.
+
+#####################################################################
+## tst_qstate Test:
+#####################################################################
+
+add_qt_test(tst_qstate
+ SOURCES
+ tst_qstate.cpp
+)
diff --git a/tests/auto/corelib/text/CMakeLists.txt b/tests/auto/corelib/text/CMakeLists.txt
new file mode 100644
index 0000000000..dd51385aa6
--- /dev/null
+++ b/tests/auto/corelib/text/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Generated from text.pro.
+
+# add_subdirectory(qbytearray) # special case not ported
+add_subdirectory(qbytearraylist)
+# add_subdirectory(qbytearraymatcher) # special case not ported
+add_subdirectory(qbytedatabuffer)
+# add_subdirectory(qchar) # special case not ported
+# add_subdirectory(qcollator) # special case not ported
+# add_subdirectory(qlatin1string) # special case not ported
+# add_subdirectory(qlocale) # special case not ported
+add_subdirectory(qregexp)
+add_subdirectory(qregularexpression)
+# add_subdirectory(qstring) # special case not ported
+add_subdirectory(qstring_no_cast_from_bytearray)
+# add_subdirectory(qstringapisymmetry) # special case not ported
+# add_subdirectory(qstringbuilder) # special case not ported
+add_subdirectory(qstringiterator)
+add_subdirectory(qstringlist)
+add_subdirectory(qstringmatcher)
+add_subdirectory(qstringref)
+# add_subdirectory(qstringview) # special case not ported
+# add_subdirectory(qtextboundaryfinder) # special case not ported
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
index 48dd7a241e..e3009a78fb 100644
--- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp
@@ -149,36 +149,17 @@ private slots:
void stdString();
};
-static const struct StaticByteArrays {
- struct Standard {
- QByteArrayData data;
- const char string[8];
- } standard;
- struct NotNullTerminated {
- QByteArrayData data;
- const char string[8];
- } notNullTerminated;
- struct Shifted {
- QByteArrayData data;
- const char dummy; // added to change offset of string
- const char string[8];
- } shifted;
- struct ShiftedNotNullTerminated {
- QByteArrayData data;
- const char dummy; // added to change offset of string
- const char string[8];
- } shiftedNotNullTerminated;
-
-} statics = {{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "data"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "dataBAD"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "data"}
- ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "dataBAD"}
- };
-
-static const QByteArrayDataPtr staticStandard = { const_cast<QByteArrayData *>(&statics.standard.data) };
-static const QByteArrayDataPtr staticNotNullTerminated = { const_cast<QByteArrayData *>(&statics.notNullTerminated.data) };
-static const QByteArrayDataPtr staticShifted = { const_cast<QByteArrayData *>(&statics.shifted.data) };
-static const QByteArrayDataPtr staticShiftedNotNullTerminated = { const_cast<QByteArrayData *>(&statics.shiftedNotNullTerminated.data) };
+static const QArrayData staticDataFlags = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
+static const QByteArray::DataPointer staticStandard = {
+ static_cast<QTypedArrayData<char> *>(const_cast<QArrayData *>(&staticDataFlags)),
+ const_cast<char *>("data"),
+ 4
+};
+static const QByteArray::DataPointer staticNotNullTerminated = {
+ static_cast<QTypedArrayData<char> *>(const_cast<QArrayData *>(&staticDataFlags)),
+ const_cast<char *>("dataBAD"),
+ 4
+};
template <class T> const T &verifyZeroTermination(const T &t) { return t; }
@@ -186,11 +167,10 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
{
// This test does some evil stuff, it's all supposed to work.
- QByteArray::DataPtr baDataPtr = const_cast<QByteArray &>(ba).data_ptr();
+ QByteArray::DataPointer baDataPtr = const_cast<QByteArray &>(ba).data_ptr();
// Skip if isStatic() or fromRawData(), as those offer no guarantees
- if (baDataPtr->ref.isStatic()
- || baDataPtr->offset != QByteArray().data_ptr()->offset)
+ if (baDataPtr->isStatic() || baDataPtr->flags() & QArrayData::RawDataType)
return ba;
int baSize = ba.size();
@@ -201,7 +181,7 @@ QByteArray verifyZeroTermination(const QByteArray &ba)
.arg(baTerminator, 2, 16, QChar('0')).toLatin1();
// Skip mutating checks on shared strings
- if (baDataPtr->ref.isShared())
+ if (baDataPtr->isShared())
return ba;
const char *baData = ba.constData();
@@ -253,11 +233,11 @@ void tst_QByteArray::qChecksum_data()
QTest::addColumn<uint>("checksum");
// Examples from ISO 14443-3
- QTest::newRow("1") << QByteArray("\x00\x00") << 2U << Qt::ChecksumItuV41 << 0x1EA0U;
- QTest::newRow("2") << QByteArray("\x12\x34") << 2U << Qt::ChecksumItuV41 << 0xCF26U;
- QTest::newRow("3") << QByteArray("\x00\x00\x00") << 3U << Qt::ChecksumIso3309 << 0xC6CCU;
- QTest::newRow("4") << QByteArray("\x0F\xAA\xFF") << 3U << Qt::ChecksumIso3309 << 0xD1FCU;
- QTest::newRow("5") << QByteArray("\x0A\x12\x34\x56") << 4U << Qt::ChecksumIso3309 << 0xF62CU;
+ QTest::newRow("1") << QByteArray("\x00\x00", 2) << 2U << Qt::ChecksumItuV41 << 0x1EA0U;
+ QTest::newRow("2") << QByteArray("\x12\x34", 2) << 2U << Qt::ChecksumItuV41 << 0xCF26U;
+ QTest::newRow("3") << QByteArray("\x00\x00\x00", 3) << 3U << Qt::ChecksumIso3309 << 0xC6CCU;
+ QTest::newRow("4") << QByteArray("\x0F\xAA\xFF", 3) << 3U << Qt::ChecksumIso3309 << 0xD1FCU;
+ QTest::newRow("5") << QByteArray("\x0A\x12\x34\x56", 4) << 4U << Qt::ChecksumIso3309 << 0xF62CU;
}
void tst_QByteArray::qChecksum()
@@ -267,6 +247,7 @@ void tst_QByteArray::qChecksum()
QFETCH(Qt::ChecksumType, standard);
QFETCH(uint, checksum);
+ QCOMPARE(data.length(), int(len));
if (standard == Qt::ChecksumIso3309) {
QCOMPARE(::qChecksum(data.constData(), len), static_cast<quint16>(checksum));
}
@@ -1054,9 +1035,7 @@ void tst_QByteArray::prependExtended_data()
QTest::addColumn<QByteArray>("array");
QTest::newRow("literal") << QByteArray(QByteArrayLiteral("data"));
QTest::newRow("standard") << QByteArray(staticStandard);
- QTest::newRow("shifted") << QByteArray(staticShifted);
QTest::newRow("notNullTerminated") << QByteArray(staticNotNullTerminated);
- QTest::newRow("shiftedNotNullTerminated") << QByteArray(staticShiftedNotNullTerminated);
QTest::newRow("non static data") << QByteArray("data");
QTest::newRow("from raw data") << QByteArray::fromRawData("data", 4);
QTest::newRow("from raw data not terminated") << QByteArray::fromRawData("dataBAD", 4);
@@ -2122,21 +2101,13 @@ void tst_QByteArray::repeated_data() const
<< QByteArray(staticStandard)
<< QByteArray("datadatadatadata")
<< 4;
- QTest::newRow("static shifted not null terminated")
- << QByteArray(staticShiftedNotNullTerminated)
- << QByteArray("datadatadatadata")
- << 4;
- QTest::newRow("static shifted")
- << QByteArray(staticShifted)
- << QByteArray("datadatadatadata")
- << 4;
}
void tst_QByteArray::byteRefDetaching() const
{
{
QByteArray str = "str";
- QByteArray copy;
+ QByteArray copy = str;
copy[0] = 'S';
QCOMPARE(str, QByteArray("str"));
@@ -2266,7 +2237,7 @@ void tst_QByteArray::movablity()
const int newSize = size + 2;
const bool newIsEmpty = false;
const bool newIsNull = false;
- const int newCapacity = 16;
+ const int newCapacity = memSpace.capacity();
// move back memSpace -> array
array.~QByteArray();
@@ -2301,8 +2272,7 @@ void tst_QByteArray::literals()
QVERIFY(str.length() == 4);
QVERIFY(str == "abcd");
- QVERIFY(str.data_ptr()->ref.isStatic());
- QVERIFY(str.data_ptr()->offset == sizeof(QByteArrayData));
+ QVERIFY(str.data_ptr()->isStatic());
const char *s = str.constData();
QByteArray str2 = str;
diff --git a/tests/auto/corelib/text/qbytearraylist/CMakeLists.txt b/tests/auto/corelib/text/qbytearraylist/CMakeLists.txt
new file mode 100644
index 0000000000..780216a38c
--- /dev/null
+++ b/tests/auto/corelib/text/qbytearraylist/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qbytearraylist.pro.
+
+#####################################################################
+## tst_qbytearraylist Test:
+#####################################################################
+
+add_qt_test(tst_qbytearraylist
+ SOURCES
+ tst_qbytearraylist.cpp
+)
diff --git a/tests/auto/corelib/text/qbytedatabuffer/CMakeLists.txt b/tests/auto/corelib/text/qbytedatabuffer/CMakeLists.txt
new file mode 100644
index 0000000000..c9cd01231b
--- /dev/null
+++ b/tests/auto/corelib/text/qbytedatabuffer/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qbytedatabuffer.pro.
+
+#####################################################################
+## tst_qbytedatabuffer Test:
+#####################################################################
+
+add_qt_test(tst_qbytedatabuffer
+ SOURCES
+ tst_qbytedatabuffer.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index ec85a6c5c6..a70b07e389 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -59,6 +59,7 @@
#endif
Q_DECLARE_METATYPE(QLocale::FormatType)
+Q_DECLARE_METATYPE(QStringView)
class tst_QLocale : public QObject
{
@@ -95,6 +96,7 @@ private slots:
void long_long_conversion_extra();
void testInfAndNan();
void fpExceptions();
+ void negativeZero_data();
void negativeZero();
void dayOfWeek();
void dayOfWeek_data();
@@ -1060,8 +1062,8 @@ void tst_QLocale::doubleToString_data()
QTest::newRow("de_DE 3,4 f 1") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << 1;
QTest::newRow("de_DE 3,4 f -") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << shortest;
- QTest::newRow("de_DE 3,4 e 1") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << 1;
- QTest::newRow("de_DE 3,4 e -") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << shortest;
+ QTest::newRow("de_DE 3,4 e 1") << QString("de_DE") << QString("3,4E+00") << 3.4 << 'e' << 1;
+ QTest::newRow("de_DE 3,4 e -") << QString("de_DE") << QString("3,4E+00") << 3.4 << 'e' << shortest;
QTest::newRow("de_DE 3,4 g 2") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << 2;
QTest::newRow("de_DE 3,4 g -") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << shortest;
@@ -1081,8 +1083,8 @@ void tst_QLocale::doubleToString_data()
QTest::newRow("de_DE 0,035003945 f 9") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << 9;
QTest::newRow("de_DE 0,035003945 f -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << shortest;
- QTest::newRow("de_DE 0,035003945 e 7") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << 7;
- QTest::newRow("de_DE 0,035003945 e -") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << shortest;
+ QTest::newRow("de_DE 0,035003945 e 7") << QString("de_DE") << QString("3,5003945E-02") << 0.035003945 << 'e' << 7;
+ QTest::newRow("de_DE 0,035003945 e -") << QString("de_DE") << QString("3,5003945E-02") << 0.035003945 << 'e' << shortest;
QTest::newRow("de_DE 0,035003945 g 8") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << 8;
QTest::newRow("de_DE 0,035003945 g -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << shortest;
@@ -1102,10 +1104,10 @@ void tst_QLocale::doubleToString_data()
QTest::newRow("de_DE 0,000003945 f 9") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << 9;
QTest::newRow("de_DE 0,000003945 f -") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << shortest;
- QTest::newRow("de_DE 0,000003945 e 3") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << 3;
- QTest::newRow("de_DE 0,000003945 e -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << shortest;
- QTest::newRow("de_DE 0,000003945 g 4") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << 4;
- QTest::newRow("de_DE 0,000003945 g -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << shortest;
+ QTest::newRow("de_DE 0,000003945 e 3") << QString("de_DE") << QString("3,945E-06") << 0.000003945 << 'e' << 3;
+ QTest::newRow("de_DE 0,000003945 e -") << QString("de_DE") << QString("3,945E-06") << 0.000003945 << 'e' << shortest;
+ QTest::newRow("de_DE 0,000003945 g 4") << QString("de_DE") << QString("3,945E-06") << 0.000003945 << 'g' << 4;
+ QTest::newRow("de_DE 0,000003945 g -") << QString("de_DE") << QString("3,945E-06") << 0.000003945 << 'g' << shortest;
QTest::newRow("C 12456789012 f 3") << QString("C") << QString("12456789012.000") << 12456789012.0 << 'f' << 3;
QTest::newRow("C 12456789012 e 13") << QString("C") << QString("1.2456789012000e+10") << 12456789012.0 << 'e' << 13;
@@ -1122,8 +1124,8 @@ void tst_QLocale::doubleToString_data()
QTest::newRow("de_DE 12456789012 f 0") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << 0;
QTest::newRow("de_DE 12456789012 f -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << shortest;
- QTest::newRow("de_DE 12456789012 e 10") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << 10;
- QTest::newRow("de_DE 12456789012 e -") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << shortest;
+ QTest::newRow("de_DE 12456789012 e 10") << QString("de_DE") << QString("1,2456789012E+10") << 12456789012.0 << 'e' << 10;
+ QTest::newRow("de_DE 12456789012 e -") << QString("de_DE") << QString("1,2456789012E+10") << 12456789012.0 << 'e' << shortest;
QTest::newRow("de_DE 12456789012 g 11") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << 11;
QTest::newRow("de_DE 12456789012 g -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << shortest;
}
@@ -1422,13 +1424,32 @@ void tst_QLocale::fpExceptions()
#endif
}
+void tst_QLocale::negativeZero_data()
+{
+ QTest::addColumn<QLocale::Language>("language");
+ QTest::addColumn<QLocale::Script>("script");
+ QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QStringView>("expect");
+
+ QTest::newRow("C")
+ << QLocale::C << QLocale::AnyScript << QLocale::AnyCountry
+ << QStringView(u"0");
+ QTest::newRow("Arabic")
+ << QLocale::Arabic << QLocale::ArabicScript << QLocale::AnyCountry
+ << QStringView(u"\u0660");
+ QTest::newRow("Chakma")
+ << QLocale::Chakma << QLocale::ChakmaScript << QLocale::AnyCountry
+ << QStringView(u"\xD804\xDD36"); // A surrogate pair.
+}
+
void tst_QLocale::negativeZero()
{
- double negativeZero( 0.0 ); // Initialise to zero.
- uchar *ptr = (uchar *)&negativeZero;
- ptr[QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 7] = 0x80;
- QString s = QString::number(negativeZero);
- QCOMPARE(s, QString("0"));
+ QFETCH(QLocale::Language, language);
+ QFETCH(QLocale::Script, script);
+ QFETCH(QLocale::Country, territory);
+ QFETCH(QStringView, expect);
+ QLocale locale(language, script, territory);
+ QCOMPARE(locale.toString(std::copysign(0.0, -1.0)), expect);
}
void tst_QLocale::dayOfWeek_data()
@@ -1900,15 +1921,14 @@ void tst_QLocale::macDefaultLocale()
// On OS X the decimal point and group separator are configurable
// independently of the locale. Verify that they have one of the
// allowed values and are not the same.
- QVERIFY(locale.decimalPoint() == QChar('.') || locale.decimalPoint() == QChar(','));
- if (!(locale.numberOptions() & QLocale::OmitGroupSeparator)) {
- QVERIFY(locale.groupSeparator() == QChar(',')
- || locale.groupSeparator() == QChar('.')
- || locale.groupSeparator() == QChar('\xA0') // no-breaking space
- || locale.groupSeparator() == QChar('\'')
- || locale.groupSeparator() == QChar());
- QVERIFY(locale.decimalPoint() != locale.groupSeparator());
- }
+ QVERIFY(locale.decimalPoint() == QStringView(u".")
+ || locale.decimalPoint() == QStringView(u","));
+ QVERIFY(locale.groupSeparator() == QStringView(u",")
+ || locale.groupSeparator() == QStringView(u".")
+ || locale.groupSeparator() == QStringView(u"\xA0") // no-breaking space
+ || locale.groupSeparator() == QStringView(u"'")
+ || locale.groupSeparator().isEmpty());
+ QVERIFY(locale.decimalPoint() != locale.groupSeparator());
// make sure we are using the system to parse them
QCOMPARE(locale.toString(1234.56), systemLocaleFormatNumber(QString("1,234.56")));
@@ -2049,8 +2069,8 @@ void tst_QLocale::windowsDefaultLocale()
QLocale locale = QLocale::system();
// make sure we are seeing the system's format strings
- QCOMPARE(locale.decimalPoint(), QChar('@'));
- QCOMPARE(locale.groupSeparator(), QChar('?'));
+ QCOMPARE(locale.decimalPoint(), QStringView(u"@"));
+ QCOMPARE(locale.groupSeparator(), QStringView(u"?"));
QCOMPARE(locale.dateFormat(QLocale::ShortFormat), shortDateFormat);
QCOMPARE(locale.dateFormat(QLocale::LongFormat), longDateFormat);
QCOMPARE(locale.timeFormat(QLocale::ShortFormat), shortTimeFormat);
diff --git a/tests/auto/corelib/text/qregexp/CMakeLists.txt b/tests/auto/corelib/text/qregexp/CMakeLists.txt
new file mode 100644
index 0000000000..e14979d7fe
--- /dev/null
+++ b/tests/auto/corelib/text/qregexp/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qregexp.pro.
+
+#####################################################################
+## tst_qregexp Test:
+#####################################################################
+
+add_qt_test(tst_qregexp
+ SOURCES
+ tst_qregexp.cpp
+)
diff --git a/tests/auto/corelib/text/qregularexpression/CMakeLists.txt b/tests/auto/corelib/text/qregularexpression/CMakeLists.txt
new file mode 100644
index 0000000000..b1ee1ff7de
--- /dev/null
+++ b/tests/auto/corelib/text/qregularexpression/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qregularexpression.pro.
+
+#####################################################################
+## tst_qregularexpression Test:
+#####################################################################
+
+add_qt_test(tst_qregularexpression
+ SOURCES
+ tst_qregularexpression.cpp
+)
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 7072cb9516..2c02fb2264 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -607,11 +607,10 @@ QString verifyZeroTermination(const QString &str)
{
// This test does some evil stuff, it's all supposed to work.
- QString::DataPtr strDataPtr = const_cast<QString &>(str).data_ptr();
+ QString::DataPointer strDataPtr = const_cast<QString &>(str).data_ptr();
// Skip if isStatic() or fromRawData(), as those offer no guarantees
- if (strDataPtr->ref.isStatic()
- || strDataPtr->offset != QString().data_ptr()->offset)
+ if (strDataPtr->isStatic() || !strDataPtr->isMutable())
return str;
int strSize = str.size();
@@ -622,7 +621,7 @@ QString verifyZeroTermination(const QString &str)
.arg(strTerminator.unicode(), 4, 16, QChar('0'));
// Skip mutating checks on shared strings
- if (strDataPtr->ref.isShared())
+ if (strDataPtr->isShared())
return str;
const QChar *strData = str.constData();
@@ -986,28 +985,6 @@ void tst_QString::acc_01()
f[7]='F';
QCOMPARE(text[7],'!');
- a="";
- a[0]='A';
- QCOMPARE(a, QLatin1String("A"));
- QCOMPARE(a.length(),1);
- a[1]='B';
- QCOMPARE(a, QLatin1String("AB"));
- QCOMPARE(a.length(),2);
- a[2]='C';
- QCOMPARE(a, QLatin1String("ABC"));
- QCOMPARE(a.length(),3);
- a = QString();
- QVERIFY(a.isNull());
- a[0]='A';
- QCOMPARE(a, QLatin1String("A"));
- QCOMPARE(a.length(),1);
- a[1]='B';
- QCOMPARE(a, QLatin1String("AB"));
- QCOMPARE(a.length(),2);
- a[2]='C';
- QCOMPARE(a, QLatin1String("ABC"));
- QCOMPARE(a.length(),3);
-
a="123";
b="456";
a[0]=a[1];
@@ -4110,8 +4087,9 @@ void tst_QString::setRawData()
QVERIFY(cstr.constData() == ptr);
QVERIFY(cstr == QString(ptr, 1));
+ QSKIP("This is currently not working.");
// This actually tests the recycling of the shared data object
- QString::DataPtr csd = cstr.data_ptr();
+ QString::DataPointer csd = cstr.data_ptr();
cstr.setRawData(ptr2, 1);
QVERIFY(cstr.isDetached());
QVERIFY(cstr.constData() == ptr2);
@@ -4955,13 +4933,14 @@ void tst_QString::arg()
void tst_QString::number()
{
- QCOMPARE( QString::number(int(0)), QLatin1String("0") );
- QCOMPARE( QString::number((unsigned int)(11)), QLatin1String("11") );
- QCOMPARE( QString::number(-22L), QLatin1String("-22") );
- QCOMPARE( QString::number(333UL), QLatin1String("333") );
- QCOMPARE( QString::number(4.4), QLatin1String("4.4") );
- QCOMPARE( QString::number(Q_INT64_C(-555)), QLatin1String("-555") );
- QCOMPARE( QString::number(Q_UINT64_C(6666)), QLatin1String("6666") );
+ QCOMPARE(QString::number(int(0)), QLatin1String("0"));
+ QCOMPARE(QString::number(std::copysign(0.0, -1.0)), QLatin1String("0"));
+ QCOMPARE(QString::number((unsigned int)(11)), QLatin1String("11"));
+ QCOMPARE(QString::number(-22L), QLatin1String("-22"));
+ QCOMPARE(QString::number(333UL), QLatin1String("333"));
+ QCOMPARE(QString::number(4.4), QLatin1String("4.4"));
+ QCOMPARE(QString::number(Q_INT64_C(-555)), QLatin1String("-555"));
+ QCOMPARE(QString::number(Q_UINT64_C(6666)), QLatin1String("6666"));
#ifndef QT_NO_DOUBLECONVERSION // snprintf_l is too stupid for this
QCOMPARE( QString::number(12.05, 'f', 1), QString("12.1") );
@@ -6463,7 +6442,7 @@ void tst_QString::QCharRefDetaching() const
{
{
QString str = QString::fromLatin1("str");
- QString copy;
+ QString copy = str;
copy[0] = QLatin1Char('S');
QCOMPARE(str, QString::fromLatin1("str"));
@@ -6684,8 +6663,7 @@ void tst_QString::literals()
QVERIFY(str.length() == 4);
QVERIFY(str == QLatin1String("abcd"));
- QVERIFY(str.data_ptr()->ref.isStatic());
- QVERIFY(str.data_ptr()->offset == sizeof(QStringData));
+ QVERIFY(str.data_ptr()->isStatic());
const QChar *s = str.constData();
QString str2 = str;
diff --git a/tests/auto/corelib/text/qstring_no_cast_from_bytearray/CMakeLists.txt b/tests/auto/corelib/text/qstring_no_cast_from_bytearray/CMakeLists.txt
new file mode 100644
index 0000000000..d0285cce3c
--- /dev/null
+++ b/tests/auto/corelib/text/qstring_no_cast_from_bytearray/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qstring_no_cast_from_bytearray.pro.
+
+#####################################################################
+## tst_qstring_no_cast_from_bytearray Test:
+#####################################################################
+
+add_qt_test(tst_qstring_no_cast_from_bytearray
+ SOURCES
+ tst_qstring_no_cast_from_bytearray.cpp
+ DEFINES
+ QT_NO_CAST_FROM_BYTEARRAY
+)
diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/CMakeLists.txt b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/CMakeLists.txt
new file mode 100644
index 0000000000..959f04f07e
--- /dev/null
+++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringbuilder1.pro.
+
+#####################################################################
+## tst_qstringbuilder1 Test:
+#####################################################################
+
+add_qt_test(tst_qstringbuilder1
+ SOURCES
+ tst_qstringbuilder1.cpp
+)
diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder2/CMakeLists.txt b/tests/auto/corelib/text/qstringbuilder/qstringbuilder2/CMakeLists.txt
new file mode 100644
index 0000000000..ff9dfd4ce1
--- /dev/null
+++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder2/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringbuilder2.pro.
+
+#####################################################################
+## tst_qstringbuilder2 Test:
+#####################################################################
+
+add_qt_test(tst_qstringbuilder2
+ SOURCES
+ tst_qstringbuilder2.cpp
+)
diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder3/CMakeLists.txt b/tests/auto/corelib/text/qstringbuilder/qstringbuilder3/CMakeLists.txt
new file mode 100644
index 0000000000..810004cc7d
--- /dev/null
+++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder3/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringbuilder3.pro.
+
+#####################################################################
+## tst_qstringbuilder3 Test:
+#####################################################################
+
+add_qt_test(tst_qstringbuilder3
+ SOURCES
+ tst_qstringbuilder3.cpp
+)
diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder4/CMakeLists.txt b/tests/auto/corelib/text/qstringbuilder/qstringbuilder4/CMakeLists.txt
new file mode 100644
index 0000000000..1ad6d02418
--- /dev/null
+++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder4/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringbuilder4.pro.
+
+#####################################################################
+## tst_qstringbuilder4 Test:
+#####################################################################
+
+add_qt_test(tst_qstringbuilder4
+ SOURCES
+ tst_qstringbuilder4.cpp
+)
diff --git a/tests/auto/corelib/text/qstringiterator/CMakeLists.txt b/tests/auto/corelib/text/qstringiterator/CMakeLists.txt
new file mode 100644
index 0000000000..e3388ee1b9
--- /dev/null
+++ b/tests/auto/corelib/text/qstringiterator/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qstringiterator.pro.
+
+#####################################################################
+## tst_qstringiterator Test:
+#####################################################################
+
+add_qt_test(tst_qstringiterator
+ SOURCES
+ tst_qstringiterator.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/text/qstringlist/CMakeLists.txt b/tests/auto/corelib/text/qstringlist/CMakeLists.txt
new file mode 100644
index 0000000000..aff8b59c15
--- /dev/null
+++ b/tests/auto/corelib/text/qstringlist/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringlist.pro.
+
+#####################################################################
+## tst_qstringlist Test:
+#####################################################################
+
+add_qt_test(tst_qstringlist
+ SOURCES
+ tst_qstringlist.cpp
+)
diff --git a/tests/auto/corelib/text/qstringmatcher/CMakeLists.txt b/tests/auto/corelib/text/qstringmatcher/CMakeLists.txt
new file mode 100644
index 0000000000..15616a0b13
--- /dev/null
+++ b/tests/auto/corelib/text/qstringmatcher/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qstringmatcher.pro.
+
+#####################################################################
+## tst_qstringmatcher Test:
+#####################################################################
+
+add_qt_test(tst_qstringmatcher
+ SOURCES
+ tst_qstringmatcher.cpp
+ DEFINES
+ QT_NO_CAST_TO_ASCII
+)
diff --git a/tests/auto/corelib/text/qstringref/CMakeLists.txt b/tests/auto/corelib/text/qstringref/CMakeLists.txt
new file mode 100644
index 0000000000..961f37c93d
--- /dev/null
+++ b/tests/auto/corelib/text/qstringref/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstringref.pro.
+
+#####################################################################
+## tst_qstringref Test:
+#####################################################################
+
+add_qt_test(tst_qstringref
+ SOURCES
+ tst_qstringref.cpp
+)
diff --git a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
index 6f01947131..20d5426bf7 100644
--- a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp
@@ -87,6 +87,7 @@ private slots:
void mid();
void split_data();
void split();
+ void nullToString();
};
static QStringRef emptyRef()
@@ -2177,6 +2178,18 @@ void tst_QStringRef::split()
}
}
+void tst_QStringRef::nullToString()
+{
+ QStringRef nullRef;
+ QVERIFY(nullRef.isNull());
+ QVERIFY(nullRef.toString().isNull());
+
+ QString str;
+ nullRef = &str;
+ QVERIFY(nullRef.isNull());
+ QVERIFY(nullRef.toString().isNull());
+}
+
QTEST_APPLESS_MAIN(tst_QStringRef)
#include "tst_qstringref.moc"
diff --git a/tests/auto/corelib/thread/CMakeLists.txt b/tests/auto/corelib/thread/CMakeLists.txt
new file mode 100644
index 0000000000..d07c583a77
--- /dev/null
+++ b/tests/auto/corelib/thread/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Generated from thread.pro.
+
+if(QT_FEATURE_thread)
+ add_subdirectory(qatomicint)
+ add_subdirectory(qatomicinteger)
+ add_subdirectory(qatomicpointer)
+ add_subdirectory(qresultstore)
+ add_subdirectory(qfuture)
+ add_subdirectory(qfuturesynchronizer)
+ add_subdirectory(qmutex)
+ add_subdirectory(qmutexlocker)
+ add_subdirectory(qreadlocker)
+ add_subdirectory(qreadwritelock)
+ add_subdirectory(qsemaphore)
+ add_subdirectory(qthread)
+ add_subdirectory(qthreadonce)
+ add_subdirectory(qthreadpool)
+ add_subdirectory(qthreadstorage)
+ add_subdirectory(qwaitcondition)
+ add_subdirectory(qwritelocker)
+endif()
+if(TARGET Qt::Concurrent)
+ add_subdirectory(qfuturewatcher)
+endif()
diff --git a/tests/auto/corelib/thread/qatomicint/CMakeLists.txt b/tests/auto/corelib/thread/qatomicint/CMakeLists.txt
new file mode 100644
index 0000000000..1a084fb28c
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicint/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qatomicint.pro.
+
+#####################################################################
+## tst_qatomicint Test:
+#####################################################################
+
+add_qt_test(tst_qatomicint
+ SOURCES
+ tst_qatomicint.cpp
+)
diff --git a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
index bef491d5f0..22ee7d17b7 100644
--- a/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
+++ b/tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp
@@ -237,28 +237,23 @@ template <typename T> struct TypeInStruct { T type; };
void tst_QAtomicInt::alignment()
{
-#ifdef Q_ALIGNOF
- // this will cause a build error if the alignment isn't the same
- char dummy1[Q_ALIGNOF(QBasicAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1];
- char dummy2[Q_ALIGNOF(QAtomicInt) == Q_ALIGNOF(TypeInStruct<int>) ? 1 : -1];
- (void)dummy1; (void)dummy2;
+ Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
+ Q_STATIC_ASSERT(alignof(QBasicAtomicInt) == alignof(TypeInStruct<int>));
#ifdef Q_ATOMIC_INT32_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<int>), Q_ALIGNOF(TypeInStruct<int>));
+ QCOMPARE(alignof(QBasicAtomicInteger<int>), alignof(TypeInStruct<int>));
#endif
#ifdef Q_ATOMIC_INT16_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<short>), Q_ALIGNOF(TypeInStruct<short>));
+ QCOMPARE(alignof(QBasicAtomicInteger<short>), alignof(TypeInStruct<short>));
#endif
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<char>), Q_ALIGNOF(TypeInStruct<char>));
+ QCOMPARE(alignof(QBasicAtomicInteger<char>), alignof(TypeInStruct<char>));
#endif
#ifdef Q_ATOMIC_INT64_IS_SUPPORTED
- QCOMPARE(Q_ALIGNOF(QBasicAtomicInteger<qlonglong>), Q_ALIGNOF(TypeInStruct<qlonglong>));
-#endif
-
+ QCOMPARE(alignof(QBasicAtomicInteger<qlonglong>), alignof(TypeInStruct<qlonglong>));
#endif
}
diff --git a/tests/auto/corelib/thread/qatomicinteger/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/CMakeLists.txt
new file mode 100644
index 0000000000..8f0637a4d2
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qatomicinteger.pro.
+
+add_subdirectory(char)
+add_subdirectory(char16_t)
+add_subdirectory(char32_t)
+add_subdirectory(int)
+add_subdirectory(long)
+add_subdirectory(qlonglong)
+add_subdirectory(qptrdiff)
+add_subdirectory(quintptr)
+add_subdirectory(qulonglong)
+add_subdirectory(schar)
+add_subdirectory(short)
+add_subdirectory(uchar)
+add_subdirectory(uint)
+add_subdirectory(ulong)
+add_subdirectory(ushort)
+add_subdirectory(wchar_t)
diff --git a/tests/auto/corelib/thread/qatomicinteger/char/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/char/CMakeLists.txt
new file mode 100644
index 0000000000..6ccaf3291d
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/char/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from char.pro.
+
+#####################################################################
+## tst_qatomicinteger_char Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_char
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=char
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_char
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/char16_t/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/char16_t/CMakeLists.txt
new file mode 100644
index 0000000000..d57d4b89dc
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/char16_t/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from char16_t.pro.
+
+#####################################################################
+## tst_qatomicinteger_char16_t Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_char16_t
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=char16_t
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_char16_t
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/char32_t/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/char32_t/CMakeLists.txt
new file mode 100644
index 0000000000..7e04c7864b
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/char32_t/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from char32_t.pro.
+
+#####################################################################
+## tst_qatomicinteger_char32_t Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_char32_t
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=char32_t
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_char32_t
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/int/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/int/CMakeLists.txt
new file mode 100644
index 0000000000..16332fcf3b
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/int/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from int.pro.
+
+#####################################################################
+## tst_qatomicinteger_int Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_int
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=int
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_int
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/long/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/long/CMakeLists.txt
new file mode 100644
index 0000000000..17c2510ac2
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/long/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from long.pro.
+
+#####################################################################
+## tst_qatomicinteger_long Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_long
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=long
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_long
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qlonglong/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/qlonglong/CMakeLists.txt
new file mode 100644
index 0000000000..021b865e67
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/qlonglong/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qlonglong.pro.
+
+#####################################################################
+## tst_qatomicinteger_qlonglong Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_qlonglong
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=qlonglong
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_qlonglong
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qptrdiff/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/CMakeLists.txt
new file mode 100644
index 0000000000..4beff29882
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qptrdiff.pro.
+
+#####################################################################
+## tst_qatomicinteger_qptrdiff Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_qptrdiff
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=qptrdiff
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_qptrdiff
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/quintptr/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/quintptr/CMakeLists.txt
new file mode 100644
index 0000000000..a5f9b7aef3
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/quintptr/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from quintptr.pro.
+
+#####################################################################
+## tst_qatomicinteger_quintptr Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_quintptr
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=quintptr
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_quintptr
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/qulonglong/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/qulonglong/CMakeLists.txt
new file mode 100644
index 0000000000..d2e1c31856
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/qulonglong/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qulonglong.pro.
+
+#####################################################################
+## tst_qatomicinteger_qulonglong Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_qulonglong
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=qulonglong
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_qulonglong
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/schar/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/schar/CMakeLists.txt
new file mode 100644
index 0000000000..9354bbe2e2
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/schar/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from schar.pro.
+
+#####################################################################
+## tst_qatomicinteger_schar Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_schar
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=schar
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_schar
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/short/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/short/CMakeLists.txt
new file mode 100644
index 0000000000..07143ed431
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/short/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from short.pro.
+
+#####################################################################
+## tst_qatomicinteger_short Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_short
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=short
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_short
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/uchar/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/uchar/CMakeLists.txt
new file mode 100644
index 0000000000..ebc64efea5
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/uchar/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from uchar.pro.
+
+#####################################################################
+## tst_qatomicinteger_uchar Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_uchar
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=uchar
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_uchar
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/uint/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/uint/CMakeLists.txt
new file mode 100644
index 0000000000..561274da9d
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/uint/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from uint.pro.
+
+#####################################################################
+## tst_qatomicinteger_uint Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_uint
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=uint
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_uint
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/ulong/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/ulong/CMakeLists.txt
new file mode 100644
index 0000000000..c859818838
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/ulong/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from ulong.pro.
+
+#####################################################################
+## tst_qatomicinteger_ulong Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_ulong
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=ulong
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_ulong
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/ushort/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/ushort/CMakeLists.txt
new file mode 100644
index 0000000000..6608390b8e
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/ushort/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from ushort.pro.
+
+#####################################################################
+## tst_qatomicinteger_ushort Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_ushort
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=ushort
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_ushort
+)
diff --git a/tests/auto/corelib/thread/qatomicinteger/wchar_t/CMakeLists.txt b/tests/auto/corelib/thread/qatomicinteger/wchar_t/CMakeLists.txt
new file mode 100644
index 0000000000..9c7e17f1bd
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicinteger/wchar_t/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from wchar_t.pro.
+
+#####################################################################
+## tst_qatomicinteger_wchar_t Test:
+#####################################################################
+
+add_qt_test(tst_qatomicinteger_wchar_t
+ SOURCES
+ ../tst_qatomicinteger.cpp
+ DEFINES
+ QATOMIC_TEST_TYPE=wchar_t
+ tst_QAtomicIntegerXX=tst_QAtomicInteger_wchar_t
+)
diff --git a/tests/auto/corelib/thread/qatomicpointer/CMakeLists.txt b/tests/auto/corelib/thread/qatomicpointer/CMakeLists.txt
new file mode 100644
index 0000000000..f400ad7b2e
--- /dev/null
+++ b/tests/auto/corelib/thread/qatomicpointer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qatomicpointer.pro.
+
+#####################################################################
+## tst_qatomicpointer Test:
+#####################################################################
+
+add_qt_test(tst_qatomicpointer
+ SOURCES
+ tst_qatomicpointer.cpp
+)
diff --git a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
index a699cf6202..9e12e7ccce 100644
--- a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
+++ b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp
@@ -108,11 +108,7 @@ void tst_QAtomicPointer::warningFree()
void tst_QAtomicPointer::alignment()
{
-#ifdef Q_ALIGNOF
- // this will cause a build error if the alignment isn't the same
- char dummy[Q_ALIGNOF(QBasicAtomicPointer<void>) == Q_ALIGNOF(void*) ? 1 : -1];
- (void)dummy;
-#endif
+ Q_STATIC_ASSERT(alignof(QBasicAtomicPointer<void>) == alignof(void*));
}
void tst_QAtomicPointer::constructor()
diff --git a/tests/auto/corelib/thread/qfuture/.prev_CMakeLists.txt b/tests/auto/corelib/thread/qfuture/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..671eeef665
--- /dev/null
+++ b/tests/auto/corelib/thread/qfuture/.prev_CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from qfuture.pro.
+
+#####################################################################
+## tst_qfuture Test:
+#####################################################################
+
+add_qt_test(tst_qfuture
+ SOURCES
+ tst_qfuture.cpp
+ DEFINES
+ -QT_NO_JAVA_STYLE_ITERATORS
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/thread/qfuture/CMakeLists.txt b/tests/auto/corelib/thread/qfuture/CMakeLists.txt
new file mode 100644
index 0000000000..db1afabc0d
--- /dev/null
+++ b/tests/auto/corelib/thread/qfuture/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qfuture.pro.
+
+#####################################################################
+## tst_qfuture Test:
+#####################################################################
+
+add_qt_test(tst_qfuture
+ SOURCES
+ tst_qfuture.cpp
+ DEFINES
+ # -QT_NO_JAVA_STYLE_ITERATORS # special case
+ QT_STRICT_ITERATORS
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/thread/qfuture/qfuture.pro b/tests/auto/corelib/thread/qfuture/qfuture.pro
index 1f21130af7..fe097edf20 100644
--- a/tests/auto/corelib/thread/qfuture/qfuture.pro
+++ b/tests/auto/corelib/thread/qfuture/qfuture.pro
@@ -2,5 +2,4 @@ CONFIG += testcase
TARGET = tst_qfuture
QT = core core-private testlib
SOURCES = tst_qfuture.cpp
-DEFINES += QT_STRICT_ITERATORS
DEFINES -= QT_NO_JAVA_STYLE_ITERATORS
diff --git a/tests/auto/corelib/thread/qfuturesynchronizer/CMakeLists.txt b/tests/auto/corelib/thread/qfuturesynchronizer/CMakeLists.txt
new file mode 100644
index 0000000000..54e3eb861d
--- /dev/null
+++ b/tests/auto/corelib/thread/qfuturesynchronizer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qfuturesynchronizer.pro.
+
+#####################################################################
+## tst_qfuturesynchronizer Test:
+#####################################################################
+
+add_qt_test(tst_qfuturesynchronizer
+ SOURCES
+ tst_qfuturesynchronizer.cpp
+)
diff --git a/tests/auto/corelib/thread/qfuturewatcher/CMakeLists.txt b/tests/auto/corelib/thread/qfuturewatcher/CMakeLists.txt
new file mode 100644
index 0000000000..c27412daac
--- /dev/null
+++ b/tests/auto/corelib/thread/qfuturewatcher/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qfuturewatcher.pro.
+
+#####################################################################
+## tst_qfuturewatcher Test:
+#####################################################################
+
+add_qt_test(tst_qfuturewatcher
+ SOURCES
+ tst_qfuturewatcher.cpp
+ PUBLIC_LIBRARIES
+ Qt::Concurrent
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/thread/qmutex/CMakeLists.txt b/tests/auto/corelib/thread/qmutex/CMakeLists.txt
new file mode 100644
index 0000000000..536802f127
--- /dev/null
+++ b/tests/auto/corelib/thread/qmutex/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qmutex.pro.
+
+#####################################################################
+## tst_qmutex Test:
+#####################################################################
+
+add_qt_test(tst_qmutex
+ SOURCES
+ tst_qmutex.cpp
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qmutex CONDITION WIN32
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/thread/qmutexlocker/CMakeLists.txt b/tests/auto/corelib/thread/qmutexlocker/CMakeLists.txt
new file mode 100644
index 0000000000..a07548a494
--- /dev/null
+++ b/tests/auto/corelib/thread/qmutexlocker/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmutexlocker.pro.
+
+#####################################################################
+## tst_qmutexlocker Test:
+#####################################################################
+
+add_qt_test(tst_qmutexlocker
+ SOURCES
+ tst_qmutexlocker.cpp
+)
diff --git a/tests/auto/corelib/thread/qreadlocker/CMakeLists.txt b/tests/auto/corelib/thread/qreadlocker/CMakeLists.txt
new file mode 100644
index 0000000000..c52bc24491
--- /dev/null
+++ b/tests/auto/corelib/thread/qreadlocker/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qreadlocker.pro.
+
+#####################################################################
+## tst_qreadlocker Test:
+#####################################################################
+
+add_qt_test(tst_qreadlocker
+ SOURCES
+ tst_qreadlocker.cpp
+)
diff --git a/tests/auto/corelib/thread/qreadwritelock/CMakeLists.txt b/tests/auto/corelib/thread/qreadwritelock/CMakeLists.txt
new file mode 100644
index 0000000000..3de89adb2d
--- /dev/null
+++ b/tests/auto/corelib/thread/qreadwritelock/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qreadwritelock.pro.
+
+#####################################################################
+## tst_qreadwritelock Test:
+#####################################################################
+
+add_qt_test(tst_qreadwritelock
+ SOURCES
+ tst_qreadwritelock.cpp
+)
diff --git a/tests/auto/corelib/thread/qresultstore/CMakeLists.txt b/tests/auto/corelib/thread/qresultstore/CMakeLists.txt
new file mode 100644
index 0000000000..f630bdc43b
--- /dev/null
+++ b/tests/auto/corelib/thread/qresultstore/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qresultstore.pro.
+
+#####################################################################
+## tst_qresultstore Test:
+#####################################################################
+
+add_qt_test(tst_qresultstore
+ SOURCES
+ tst_qresultstore.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/thread/qresultstore/qresultstore.pro b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
index bbebe0976b..80e79b1c1a 100644
--- a/tests/auto/corelib/thread/qresultstore/qresultstore.pro
+++ b/tests/auto/corelib/thread/qresultstore/qresultstore.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qresultstore
QT = core-private testlib
SOURCES = tst_qresultstore.cpp
-DEFINES += QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/thread/qsemaphore/CMakeLists.txt b/tests/auto/corelib/thread/qsemaphore/CMakeLists.txt
new file mode 100644
index 0000000000..3aaa71423e
--- /dev/null
+++ b/tests/auto/corelib/thread/qsemaphore/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsemaphore.pro.
+
+#####################################################################
+## tst_qsemaphore Test:
+#####################################################################
+
+add_qt_test(tst_qsemaphore
+ SOURCES
+ tst_qsemaphore.cpp
+)
diff --git a/tests/auto/corelib/thread/qthread/.prev_CMakeLists.txt b/tests/auto/corelib/thread/qthread/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..749a5e9734
--- /dev/null
+++ b/tests/auto/corelib/thread/qthread/.prev_CMakeLists.txt
@@ -0,0 +1,16 @@
+# Generated from qthread.pro.
+
+#####################################################################
+## tst_qthread Test:
+#####################################################################
+
+add_qt_test(tst_qthread
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qthread.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/thread/qthread/CMakeLists.txt b/tests/auto/corelib/thread/qthread/CMakeLists.txt
new file mode 100644
index 0000000000..a21e239c35
--- /dev/null
+++ b/tests/auto/corelib/thread/qthread/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Generated from qthread.pro.
+
+#####################################################################
+## tst_qthread Test:
+#####################################################################
+
+add_qt_test(tst_qthread
+ SOURCES
+ ../../../../shared/emulationdetector.h
+ tst_qthread.cpp
+ INCLUDE_DIRECTORIES
+ ../../../../shared
+ LIBRARIES # special case
+ Threads::Threads # special case
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/thread/qthreadonce/CMakeLists.txt b/tests/auto/corelib/thread/qthreadonce/CMakeLists.txt
new file mode 100644
index 0000000000..c29b4e640a
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadonce/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qthreadonce.pro.
+
+#####################################################################
+## tst_qthreadonce Test:
+#####################################################################
+
+add_qt_test(tst_qthreadonce
+ SOURCES
+ qthreadonce.cpp
+ tst_qthreadonce.cpp
+)
diff --git a/tests/auto/corelib/thread/qthreadpool/CMakeLists.txt b/tests/auto/corelib/thread/qthreadpool/CMakeLists.txt
new file mode 100644
index 0000000000..bc3fca1b6a
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadpool/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qthreadpool.pro.
+
+#####################################################################
+## tst_qthreadpool Test:
+#####################################################################
+
+add_qt_test(tst_qthreadpool
+ SOURCES
+ tst_qthreadpool.cpp
+)
diff --git a/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt
new file mode 100644
index 0000000000..52a928863c
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadstorage/CMakeLists.txt
@@ -0,0 +1,21 @@
+# special case skip regeneration
+# Generated from qthreadstorage.pro.
+
+#####################################################################
+## tst_qthreadstorage Test:
+#####################################################################
+
+add_qt_test(tst_qthreadstorage
+ SOURCES
+ tst_qthreadstorage.cpp
+ LIBRARIES # special case
+ Threads::Threads # special case
+
+)
+
+## Scopes:
+#####################################################################
+
+if(NOT ANDROID AND NOT WINRT)
+ add_subdirectory(crashonexit)
+endif()
diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/.prev_CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/crashonexit/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..87ae29a04c
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/.prev_CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from crashonexit.pro.
+
+#####################################################################
+## crashonexit Binary:
+#####################################################################
+
+add_qt_executable(crashonexit
+ OUTPUT_DIRECTORY "${INSTALL_TESTSDIR}/tst_qthreadstorage/crashonexit"
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qthreadstorage/crashonexit"
+ SOURCES
+ crashOnExit.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt b/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt
new file mode 100644
index 0000000000..b2bac9713a
--- /dev/null
+++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from crashonexit.pro.
+
+#####################################################################
+## crashonexit Binary:
+#####################################################################
+
+add_qt_executable(crashOnExit_helper
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.." # special case
+ INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qthreadstorage/crashOnExit_helper" # special case
+ SOURCES
+ crashOnExit.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/thread/qwaitcondition/CMakeLists.txt b/tests/auto/corelib/thread/qwaitcondition/CMakeLists.txt
new file mode 100644
index 0000000000..76f8b33aa4
--- /dev/null
+++ b/tests/auto/corelib/thread/qwaitcondition/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qwaitcondition.pro.
+
+#####################################################################
+## tst_qwaitcondition Test:
+#####################################################################
+
+add_qt_test(tst_qwaitcondition
+ SOURCES
+ tst_qwaitcondition.cpp
+)
diff --git a/tests/auto/corelib/thread/qwritelocker/CMakeLists.txt b/tests/auto/corelib/thread/qwritelocker/CMakeLists.txt
new file mode 100644
index 0000000000..00a9809174
--- /dev/null
+++ b/tests/auto/corelib/thread/qwritelocker/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qwritelocker.pro.
+
+#####################################################################
+## tst_qwritelocker Test:
+#####################################################################
+
+add_qt_test(tst_qwritelocker
+ SOURCES
+ tst_qwritelocker.cpp
+)
diff --git a/tests/auto/corelib/time/CMakeLists.txt b/tests/auto/corelib/time/CMakeLists.txt
new file mode 100644
index 0000000000..ed990d1979
--- /dev/null
+++ b/tests/auto/corelib/time/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Generated from time.pro.
+
+add_subdirectory(qcalendar)
+add_subdirectory(qdate)
+add_subdirectory(qdatetime)
+add_subdirectory(qtime)
+add_subdirectory(qtimezone)
diff --git a/tests/auto/corelib/time/qcalendar/CMakeLists.txt b/tests/auto/corelib/time/qcalendar/CMakeLists.txt
new file mode 100644
index 0000000000..1e59a1f0b0
--- /dev/null
+++ b/tests/auto/corelib/time/qcalendar/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qcalendar.pro.
+
+#####################################################################
+## tst_qcalendar Test:
+#####################################################################
+
+add_qt_test(tst_qcalendar
+ SOURCES
+ tst_qcalendar.cpp
+)
diff --git a/tests/auto/corelib/time/qdate/CMakeLists.txt b/tests/auto/corelib/time/qdate/CMakeLists.txt
new file mode 100644
index 0000000000..b39828b5df
--- /dev/null
+++ b/tests/auto/corelib/time/qdate/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qdate.pro.
+
+#####################################################################
+## tst_qdate Test:
+#####################################################################
+
+add_qt_test(tst_qdate
+ SOURCES
+ tst_qdate.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/time/qdatetime/CMakeLists.txt b/tests/auto/corelib/time/qdatetime/CMakeLists.txt
new file mode 100644
index 0000000000..e992936e60
--- /dev/null
+++ b/tests/auto/corelib/time/qdatetime/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Generated from qdatetime.pro.
+
+#####################################################################
+## tst_qdatetime Test:
+#####################################################################
+
+add_qt_test(tst_qdatetime
+ SOURCES
+ tst_qdatetime.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+#### Keys ignored in scope 2:.:.:qdatetime.pro:MSVC:
+# QMAKE_CFLAGS_RELEASE = "--O1"
+# QMAKE_CXXFLAGS_RELEASE = "--O1"
+
+extend_target(tst_qdatetime CONDITION APPLE
+ SOURCES
+ tst_qdatetime_mac.mm
+ PUBLIC_LIBRARIES
+ ${FWFoundation}
+)
diff --git a/tests/auto/corelib/time/qtime/CMakeLists.txt b/tests/auto/corelib/time/qtime/CMakeLists.txt
new file mode 100644
index 0000000000..ef224b45e3
--- /dev/null
+++ b/tests/auto/corelib/time/qtime/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qtime.pro.
+
+#####################################################################
+## tst_qtime Test:
+#####################################################################
+
+add_qt_test(tst_qtime
+ SOURCES
+ tst_qtime.cpp
+)
diff --git a/tests/auto/corelib/time/qtimezone/CMakeLists.txt b/tests/auto/corelib/time/qtimezone/CMakeLists.txt
new file mode 100644
index 0000000000..d95a2ac767
--- /dev/null
+++ b/tests/auto/corelib/time/qtimezone/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Generated from qtimezone.pro.
+
+#####################################################################
+## tst_qtimezone Test:
+#####################################################################
+
+add_qt_test(tst_qtimezone
+ SOURCES
+ tst_qtimezone.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
+
+## Scopes:
+#####################################################################
+
+extend_target(tst_qtimezone CONDITION QT_FEATURE_icu
+ LIBRARIES
+ ICU::i18n ICU::uc ICU::data
+)
+
+extend_target(tst_qtimezone CONDITION APPLE
+ SOURCES
+ tst_qtimezone_darwin.mm
+ PUBLIC_LIBRARIES
+ ${FWFoundation}
+)
diff --git a/tests/auto/corelib/tools/CMakeLists.txt b/tests/auto/corelib/tools/CMakeLists.txt
new file mode 100644
index 0000000000..f1967c3664
--- /dev/null
+++ b/tests/auto/corelib/tools/CMakeLists.txt
@@ -0,0 +1,49 @@
+# Generated from tools.pro.
+
+# add_subdirectory(collections) # special case not ported
+# add_subdirectory(containerapisymmetry) # special case not ported
+add_subdirectory(qalgorithms)
+add_subdirectory(qarraydata)
+# add_subdirectory(qarraydata_strictiterators) # special case not ported
+add_subdirectory(qbitarray)
+add_subdirectory(qcache)
+add_subdirectory(qcommandlineparser)
+add_subdirectory(qcontiguouscache)
+# add_subdirectory(qcryptographichash) # special case not ported
+add_subdirectory(qeasingcurve)
+add_subdirectory(qexplicitlyshareddatapointer)
+# add_subdirectory(qfreelist) # special case not ported
+add_subdirectory(qhash)
+# add_subdirectory(qhash_strictiterators) # special case not ported
+add_subdirectory(qhashfunctions)
+# add_subdirectory(qline) # special case not ported
+# add_subdirectory(qlist) # special case no longer exists
+# add_subdirectory(qlist_strictiterators) # special case not ported
+add_subdirectory(qmakearray)
+add_subdirectory(qmap)
+# add_subdirectory(qmap_strictiterators) # special case not ported
+add_subdirectory(qmargins)
+add_subdirectory(qmessageauthenticationcode)
+# add_subdirectory(qoffsetstringarray) # special case not ported
+add_subdirectory(qpair)
+add_subdirectory(qpoint)
+add_subdirectory(qpointf)
+add_subdirectory(qqueue)
+add_subdirectory(qrect)
+add_subdirectory(qringbuffer)
+add_subdirectory(qscopedpointer)
+add_subdirectory(qscopedvaluerollback)
+add_subdirectory(qscopeguard)
+add_subdirectory(qset)
+# add_subdirectory(qsharedpointer) # special case not ported
+add_subdirectory(qsize)
+add_subdirectory(qsizef)
+add_subdirectory(qstl)
+add_subdirectory(qtimeline)
+add_subdirectory(qvarlengtharray)
+# add_subdirectory(qvector) # special case not ported
+# add_subdirectory(qvector_strictiterators) # special case not ported
+# add_subdirectory(qversionnumber) # special case not ported
+if(APPLE)
+ # add_subdirectory(qmacautoreleasepool) # special case not ported
+endif()
diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro
index e0f9f0a0ea..0182a0c837 100644
--- a/tests/auto/corelib/tools/collections/collections.pro
+++ b/tests/auto/corelib/tools/collections/collections.pro
@@ -4,6 +4,4 @@ SOURCES += tst_collections.cpp
QT = core testlib
# This test does not work with strict iterators
-DEFINES -= QT_NO_LINKED_LIST
-DEFINES -= QT_STRICT_ITERATORS
DEFINES -= QT_NO_JAVA_STYLE_ITERATORS
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index e79a4dba29..6fcf726c21 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -32,7 +32,6 @@
static QCache<int, int> *cacheX;
static QHash<int, int> *hashX;
-static QLinkedList<int> *linkedListX;
static QList<int> *listX;
static QMap<int, int> *mapX;
static QMultiHash<int, int> *multiHashX;
@@ -49,7 +48,6 @@ void foo()
{
cacheX = 0;
hashX = 0;
- linkedListX = 0;
listX = 0;
mapX = 0;
multiHashX = 0;
@@ -71,7 +69,6 @@ void foo()
#include "qbytearray.h"
#include "qcache.h"
#include "qhash.h"
-#include "qlinkedlist.h"
#include "qlist.h"
#include "qmap.h"
#include "qpair.h"
@@ -84,10 +81,6 @@ void foo()
#include "qvector.h"
#include "qqueue.h"
-QT_BEGIN_NAMESPACE
-template class QList<int>;
-QT_END_NAMESPACE
-
class tst_Collections : public QObject
{
Q_OBJECT
@@ -96,7 +89,6 @@ private slots:
void typeinfo();
void qstring();
void list();
- void linkedList();
void vector();
void byteArray();
void stack();
@@ -109,7 +101,6 @@ private slots:
#endif
void pair();
void sharableQList();
- void sharableQLinkedList();
void sharableQVector();
void sharableQMap();
void sharableQHash();
@@ -121,8 +112,6 @@ private slots:
void vector_stl();
void list_stl_data();
void list_stl();
- void linkedlist_stl_data();
- void linkedlist_stl();
void q_init();
void pointersize();
void containerInstantiation();
@@ -551,19 +540,12 @@ void tst_Collections::list()
list << "foo" << "bar";
QVERIFY(!list.isEmpty());
- list.insert(-1, "lessthanzero");
- QCOMPARE(list.at(0), QString("lessthanzero"));
-
list.insert(0, "atzero");
QCOMPARE(list.at(0), QString("atzero"));
int listCount = list.count();
list.insert(listCount, "atcount");
QCOMPARE(list.at(listCount), QString("atcount"));
-
- listCount = list.count();
- list.insert(listCount + 1, "beyondcount");
- QCOMPARE(list.at(listCount), QString("beyondcount"));
}
{
@@ -736,228 +718,6 @@ void tst_Collections::list()
}
}
-void tst_Collections::linkedList()
-{
- {
- QLinkedList<int> list;
- QVERIFY(list.isEmpty());
- list.append(1);
- list.push_back(2);
- list += (3);
- list << 4 << 5 << 6;
- QVERIFY(!list.isEmpty());
- QVERIFY(list.size() == 6);
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- sum += i.next();
- }
- QVERIFY(sum == 21);
- }
- {
- int sum = 0;
- QLinkedList<int>::const_iterator i = list.begin();
- while (i != list.end())
- sum += *i++;
- QVERIFY(sum == 21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext())
- i.setValue(2*i.next());
- }
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- sum += i.previous();
- QVERIFY(sum == 2*21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- i.setValue(2*i.previous());
- }
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- sum += i.previous();
- QVERIFY(sum == 2*2*21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- i.insert(a);
- }
- }
- {
- int sum = 0;
- QLinkedList<int>::iterator i = list.begin();
- while (i != list.end())
- sum += *i++;
- QVERIFY(sum == 2*2*2*21);
- }
- {
- int duplicates = 0;
- QLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- if (i.hasNext() && a == i.peekNext())
- duplicates++;
- }
- QVERIFY(duplicates == 6);
- }
- {
- int duplicates = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious()) {
- int a = i.previous();
- if (i.hasPrevious() && a == i.peekPrevious())
- duplicates++;
- }
- QVERIFY(duplicates == 6);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- if (i.hasNext() &&
- i.peekNext() == a)
- i.remove();
- }
- }
- {
- int duplicates = 0;
- QMutableLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious()) {
- int a = i.previous();
- if (i.hasPrevious() && a == i.peekPrevious())
- duplicates++;
- }
- QVERIFY(duplicates == 0);
- }
- {
- QVERIFY(list.size() == 6);
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.peekNext();
- i.insert(42);
- QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a);
- i.next();
- }
- QVERIFY(list.size() == 12);
- i.toFront();
- while (i.findNext(42))
- i.remove();
- }
- {
- QLinkedList<int> l;
- l << 4 << 8 << 12 << 16 << 20 << 24;
- QVERIFY(l == list);
- QLinkedList<int> copy = list;
- list += list;
- QVERIFY(l != list && l.size() == list.size()/2 && l == copy);
- l += copy;
- QVERIFY(l == list);
- list = copy;
- }
- {
- QLinkedList<int> copy = list;
- list.prepend(999);
- list.append(999);
- QVERIFY(list.contains(999));
- QVERIFY(list.count(999) == 2);
- list.removeAll(999);
- QVERIFY(list == copy);
- }
- {
- QLinkedList<QString> list;
- list << "one" << "two" << "three" << "four" << "five" << "six";
- while (!list.isEmpty())
- list.removeAll(list.first());
- }
- {
- QLinkedList<QString> list;
- list << "one" << "two" << "one" << "two";
- QVERIFY(!list.removeOne("three"));
- QVERIFY(list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one" << "two");;
- QVERIFY(list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one");
- QVERIFY(!list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one");
- QVERIFY(list.removeOne("one"));
- QCOMPARE(list, QLinkedList<QString>() << "one");
- QVERIFY(list.removeOne("one"));
- QVERIFY(list.isEmpty());
- QVERIFY(!list.removeOne("one"));
- QVERIFY(list.isEmpty());
- }
- {
- list.clear();
- QVERIFY(list.isEmpty());
- QVERIFY(list.begin() == list.end());
- QLinkedListIterator<int> i(list);
- QVERIFY(!i.hasNext() && !i.hasPrevious());
- }
- }
-
- {
- QLinkedList<QString> list;
- list.append("Hello");
-
- QLinkedList<QString>::iterator it = list.begin();
- QVERIFY((*it)[0] == QChar('H'));
- QVERIFY(it->constData()[0] == QChar('H'));
- it->replace(QChar('H'), QChar('X'));
- QCOMPARE(list.first(), QLatin1String("Xello"));
-
- QLinkedList<QString>::const_iterator cit = list.constBegin();
- QCOMPARE((*cit).toLower(), QLatin1String("xello"));
- QCOMPARE(cit->toUpper(), QLatin1String("XELLO"));
-
- cit = list.cbegin();
- QCOMPARE((*cit).toLower(), QLatin1String("xello"));
- QCOMPARE(cit->toUpper(), QLatin1String("XELLO"));
- }
-
- {
- QLinkedList<QString> list;
- list << "alpha" << "beta";
- list += list;
- QVERIFY(list.size() == 4);
- QCOMPARE(*list.begin(), QLatin1String("alpha"));
- QCOMPARE(*(list.begin() + 1), QLatin1String("beta"));
- QCOMPARE(*(list.begin() + 2), QLatin1String("alpha"));
- QCOMPARE(*(list.begin() + 3), QLatin1String("beta"));
- }
-
- {
- QLinkedList<int> a;
- QCOMPARE(a.startsWith(1), false);
- QCOMPARE(a.endsWith(1), false);
- a.append(1);
- QCOMPARE(a.startsWith(1), true);
- QCOMPARE(a.startsWith(2), false);
- QCOMPARE(a.endsWith(1), true);
- QCOMPARE(a.endsWith(2), false);
- a.append(2);
- QCOMPARE(a.startsWith(1), true);
- QCOMPARE(a.startsWith(2), false);
- QCOMPARE(a.endsWith(1), false);
- QCOMPARE(a.endsWith(2), true);
- }
-};
-
-
void tst_Collections::vector()
{
QVector<int> v1;
@@ -1562,12 +1322,12 @@ void tst_Collections::hash()
}
{
- QHash<int, QString> hash1, hash2;
- hash1.insertMulti(1, "Alpha");
- hash1.insertMulti(1, "Gamma");
- hash2.insertMulti(1, "Beta");
- hash2.insertMulti(1, "Gamma");
- hash2.insertMulti(1, "Gamma");
+ QMultiHash<int, QString> hash1, hash2;
+ hash1.insert(1, "Alpha");
+ hash1.insert(1, "Gamma");
+ hash2.insert(1, "Beta");
+ hash2.insert(1, "Gamma");
+ hash2.insert(1, "Gamma");
hash1.unite(hash2);
QCOMPARE(hash1.size(), 5);
@@ -1997,15 +1757,6 @@ void tst_Collections::qstring()
QVERIFY(null.isNull());
QVERIFY(!nonNull.isNull());
-#if QT_DEPRECATED_SINCE(5, 9)
- QVERIFY(null == QString::null);
- QVERIFY(QString::null == null);
- QVERIFY(nonNull != QString::null);
- QVERIFY(QString::null != nonNull);
- QVERIFY(null == nonNull);
- QVERIFY(QString::null == QString::null);
-#endif
-
QString fill = "123";
fill.fill('a');
QCOMPARE(fill, QLatin1String("aaa"));
@@ -2331,18 +2082,6 @@ void populate(QList<int> &container)
}
template <>
-void populate(QLinkedList<int> &container)
-{
- container << 1 << 2 << 4 << 8;
-}
-
-template <>
-void populate(QVector<int> &container)
-{
- container << 1 << 2 << 4 << 8;
-}
-
-template <>
void populate(QMap<int, int> &container)
{
container.insert(1, 1);
@@ -2431,11 +2170,6 @@ void tst_Collections::sharableQList()
TEST_SEQUENTIAL_CONTAINER(List);
}
-void tst_Collections::sharableQLinkedList()
-{
- TEST_SEQUENTIAL_CONTAINER(LinkedList);
-}
-
void tst_Collections::sharableQVector()
{
TEST_SEQUENTIAL_CONTAINER(Vector);
@@ -2727,8 +2461,10 @@ void testMapLikeStlIterators()
QString t;
fake.insert(k, t);
- typename Container::iterator i1 = fake.begin(), i2 = i1 + 1;
- typename Container::const_iterator c1 = i1, c2 = c1 + 1;
+ typename Container::iterator i1 = fake.begin(), i2 = i1;
+ ++i2;
+ typename Container::const_iterator c1 = i1, c2 = c1;
+ ++c2;
QVERIFY(i1 == i1);
QVERIFY(i1 == c1);
@@ -2738,8 +2474,6 @@ void testMapLikeStlIterators()
QVERIFY(i2 == c2);
QVERIFY(c2 == i2);
QVERIFY(c2 == c2);
- QVERIFY(1 + i1 == i1 + 1);
- QVERIFY(1 + c1 == c1 + 1);
QVERIFY(i1 != i2);
QVERIFY(i1 != c2);
@@ -2755,7 +2489,6 @@ void tst_Collections::constAndNonConstStlIterators()
{
testListLikeStlIterators<QList<int> >();
testListLikeStlIterators<QStringList >();
- testLinkedListLikeStlIterators<QLinkedList<int> >();
testListLikeStlIterators<QVector<int> >();
testMapLikeStlIterators<QMap<QString, QString> >();
testMapLikeStlIterators<QMultiMap<QString, QString> >();
@@ -2798,31 +2531,6 @@ void tst_Collections::vector_stl()
QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector);
}
-void tst_Collections::linkedlist_stl_data()
-{
- list_stl_data();
-}
-
-void tst_Collections::linkedlist_stl()
-{
- QFETCH(QStringList, elements);
-
- QLinkedList<QString> list;
- for (int i = 0; i < elements.count(); ++i)
- list << elements.at(i);
-
- std::list<QString> stdList = list.toStdList();
-
- QCOMPARE(int(stdList.size()), elements.size());
-
- std::list<QString>::const_iterator it = stdList.begin();
- QLinkedList<QString>::const_iterator it2 = list.cbegin();
- for (uint j = 0; j < stdList.size(); ++j, ++it, ++it2)
- QCOMPARE(*it, *it2);
-
- QCOMPARE(QLinkedList<QString>::fromStdList(stdList), list);
-}
-
void tst_Collections::list_stl_data()
{
QTest::addColumn<QStringList>("elements");
@@ -2950,10 +2658,6 @@ void instantiateMutableIterationContainer()
it = container.begin();
it = container.end();
Q_UNUSED(it)
-
- // QSet lacks count(T).
- const ValueType value = ValueType();
- container.count(value);
}
template <typename ContainerType, typename ValueType>
@@ -2961,10 +2665,9 @@ void instantiateSequence()
{
instantiateMutableIterationContainer<ContainerType, ValueType>();
-// QVector lacks removeAll(T)
-// ValueType value = ValueType();
-// ContainerType container;
-// container.removeAll(value);
+ ValueType value = ValueType();
+ ContainerType container;
+ container.removeAll(value);
}
template <typename ContainerType, typename ValueType>
@@ -3037,11 +2740,10 @@ void instantiatePairAssociative()
constContainer.keys();
container.remove(key);
container.take(key);
- container.unite(constContainer);
+ container.insert(constContainer);
container.value(key);
container.value(key, value);
container.values();
- container.values(key);
container[key];
const int foo = constContainer[key];
Q_UNUSED(foo);
@@ -3070,15 +2772,6 @@ void tst_Collections::containerInstantiation()
typedef QSet<EqualsComparable> Set;
instantiateAssociative<Set, EqualsComparable>();
- //Instantiate QLinkedList member functions.
- typedef QLinkedList<EqualsComparable> LinkedList;
- instantiateSequence<LinkedList, EqualsComparable> ();
- {
- EqualsComparable value;
- LinkedList list;
- list.removeAll(value);
- }
-
//Instantiate QList member functions.
typedef QList<EqualsComparable> List;
instantiateRandomAccess<List, EqualsComparable>();
@@ -3185,7 +2878,6 @@ void tst_Collections::containerTypedefs()
testContainerTypedefs(QVector<int>());
testContainerTypedefs(QStack<int>());
testContainerTypedefs(QList<int>());
- testContainerTypedefs(QLinkedList<int>());
testContainerTypedefs(QQueue<int>());
testPairAssociativeContainerTypedefs(QMap<int, int>());
@@ -3207,16 +2899,13 @@ void tst_Collections::forwardDeclared()
{ typedef QMultiMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QPair<T1, T2> C; C *x = 0; Q_UNUSED(x) }
{ typedef QList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
- { typedef QLinkedList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QVector<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QStack<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QQueue<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QSet<T1> C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) }
}
-#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN)
-
-class Q_DECL_ALIGN(4) Aligned4
+class alignas(4) Aligned4
{
char i;
public:
@@ -3228,7 +2917,7 @@ public:
inline bool operator<(const Aligned4 &other) const { return i < other.i; }
friend inline int qHash(const Aligned4 &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(Q_ALIGNOF(Aligned4) % 4 == 0);
+Q_STATIC_ASSERT(alignof(Aligned4) % 4 == 0);
#if defined(Q_PROCESSOR_ARM)
# if defined(Q_COMPILER_ALIGNAS) && defined(__BIGGEST_ALIGNMENT__)
@@ -3242,7 +2931,7 @@ Q_STATIC_ASSERT(Q_ALIGNOF(Aligned4) % 4 == 0);
# define BIGGEST_ALIGNMENT_TO_TEST 128
#endif
-class Q_DECL_ALIGN(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest
+class alignas(BIGGEST_ALIGNMENT_TO_TEST) AlignedBiggest
{
char i;
public:
@@ -3254,7 +2943,7 @@ public:
inline bool operator<(const AlignedBiggest &other) const { return i < other.i; }
friend inline int qHash(const AlignedBiggest &a) { return qHash(a.i); }
};
-Q_STATIC_ASSERT(Q_ALIGNOF(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
+Q_STATIC_ASSERT(alignof(AlignedBiggest) % BIGGEST_ALIGNMENT_TO_TEST == 0);
template<typename C>
void testVectorAlignment()
@@ -3325,13 +3014,6 @@ void tst_Collections::alignment()
testAssociativeContainerAlignment<QHash<AlignedBiggest, AlignedBiggest> >();
}
-#else
-void tst_Collections::alignment()
-{
- QSKIP("Compiler doesn't support necessary extension keywords");
-}
-#endif
-
#ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS
template<template<class> class C>
@@ -3441,7 +3123,6 @@ void tst_Collections::QTBUG13079_collectionInsideCollection()
QTBUG13079_collectionInsideCollectionImpl<QVector>();
QTBUG13079_collectionInsideCollectionImpl<QStack>();
QTBUG13079_collectionInsideCollectionImpl<QList>();
- QTBUG13079_collectionInsideCollectionImpl<QLinkedList>();
QTBUG13079_collectionInsideCollectionImpl<QQueue>();
{
@@ -3510,9 +3191,6 @@ void tst_Collections::foreach_2()
QCOMPARE(varl1.count(), intlist.count());
QCOMPARE(varl2.count(), intlist.count());
QCOMPARE(varl3.count(), intlist.count());
- foreach_test_arrays(varl1);
- foreach_test_arrays(varl2);
- foreach_test_arrays(varl3);
QVarLengthArray<QString> varl4;
QVarLengthArray<QString, 3> varl5;
@@ -3525,9 +3203,6 @@ void tst_Collections::foreach_2()
QCOMPARE(varl4.count(), strlist.count());
QCOMPARE(varl5.count(), strlist.count());
QCOMPARE(varl6.count(), strlist.count());
- foreach_test_arrays(varl4);
- foreach_test_arrays(varl5);
- foreach_test_arrays(varl6);
}
struct IntOrString
@@ -3615,30 +3290,8 @@ template<class Container> void insert_remove_loop_impl()
}
-//Add insert(int, int, T) so it has the same interface as QVector and QVarLengthArray for the test.
template<typename T>
-struct ExtList : QList<T> {
- using QList<T>::insert;
- void insert(int before, int n, const T&x) {
- while (n--) {
- this->insert(before, x );
- }
- }
- void insert(typename QList<T>::iterator before, int n, const T&x) {
- while (n--) {
- before = this->insert(before, x);
- }
- }
-
- void remove(int i) {
- this->removeAt(i);
- }
- void remove(int i, int n) {
- while (n--) {
- this->removeAt(i);
- }
- }
-};
+using ExtList = QList<T>;
void tst_Collections::insert_remove_loop()
{
diff --git a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
index e46d51761e..c114014bf4 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
+++ b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
@@ -2,7 +2,3 @@ CONFIG += testcase
TARGET = tst_containerapisymmetry
SOURCES += tst_containerapisymmetry.cpp
QT = core testlib
-
-# This test does not work with strict iterators
-DEFINES -= QT_STRICT_ITERATORS
-DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
index 88c0c5055c..fe6e82e19c 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -29,7 +29,6 @@
#include <QtTest/QtTest>
#include "qbytearray.h"
-#include "qlinkedlist.h"
#include "qlist.h"
#include "qstring.h"
#include "qvarlengtharray.h"
@@ -324,11 +323,6 @@ private Q_SLOTS:
#endif
}
- void ranged_ctor_QLinkedList_int() { ranged_ctor_non_associative_impl<QLinkedList<int>>(); }
- void ranged_ctor_QLinkedList_Movable() { ranged_ctor_non_associative_impl<QLinkedList<Movable>>(); }
- void ranged_ctor_QLinkedList_Complex() { ranged_ctor_non_associative_impl<QLinkedList<Complex>>(); }
- void ranged_ctor_QLinkedList_duplicates_strategy() { non_associative_container_duplicates_strategy<QLinkedList>(); }
-
void ranged_ctor_std_set_int() { ranged_ctor_non_associative_impl<std::set<int>>(); }
void ranged_ctor_std_set_Movable() { ranged_ctor_non_associative_impl<std::set<Movable>>(); }
void ranged_ctor_std_set_Complex() { ranged_ctor_non_associative_impl<std::set<Complex>>(); }
@@ -482,7 +476,6 @@ private Q_SLOTS:
void front_back_std_vector() { front_back_impl<std::vector<int>>(); }
void front_back_QVector() { front_back_impl<QVector<int>>(); }
void front_back_QList() { front_back_impl<QList<qintptr>>(); }
- void front_back_QLinkedList() { front_back_impl<QLinkedList<int>>(); }
void front_back_QVarLengthArray() { front_back_impl<QVarLengthArray<int>>(); }
void front_back_QString() { front_back_impl<QString>(); }
void front_back_QStringRef() { front_back_impl<QStringRef>(); }
@@ -580,9 +573,6 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<VarLengthArray<T...>> : ContainerAcceptsDuplicateValues {};
template<typename ... T>
-struct ContainerDuplicatedValuesStrategy<QList<T...>> : ContainerAcceptsDuplicateValues {};
-
-template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::list<T...>> : ContainerAcceptsDuplicateValues {};
#if COMPILER_HAS_STDLIB_INCLUDE(<forward_list>)
@@ -590,9 +580,6 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {};
#endif
-template<typename ... T>
-struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {};
-
// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution
template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::set<T...>> : ContainerRejectsDuplicateValues {};
@@ -798,8 +785,6 @@ template <> QStringView make(int size) { return QStringView(s_string).left(siz
template <> QLatin1String make(int size) { return QLatin1String("\1\2\3\4\5\6\7", size); }
template <typename T> T clean(T &&t) { return std::forward<T>(t); }
-inline QChar clean(QCharRef ch) { return ch; }
-inline char clean(QByteRef ch) { return ch; }
inline char clean(QLatin1Char ch) { return ch.toLatin1(); }
template <typename Container>
diff --git a/tests/auto/corelib/tools/qalgorithms/CMakeLists.txt b/tests/auto/corelib/tools/qalgorithms/CMakeLists.txt
new file mode 100644
index 0000000000..14b7c95f4b
--- /dev/null
+++ b/tests/auto/corelib/tools/qalgorithms/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qalgorithms.pro.
+
+#####################################################################
+## tst_qalgorithms Test:
+#####################################################################
+
+add_qt_test(tst_qalgorithms
+ SOURCES
+ tst_qalgorithms.cpp
+)
diff --git a/tests/auto/corelib/tools/qarraydata/CMakeLists.txt b/tests/auto/corelib/tools/qarraydata/CMakeLists.txt
new file mode 100644
index 0000000000..f68c3714aa
--- /dev/null
+++ b/tests/auto/corelib/tools/qarraydata/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qarraydata.pro.
+
+#####################################################################
+## tst_qarraydata Test:
+#####################################################################
+
+add_qt_test(tst_qarraydata
+ SOURCES
+ simplevector.h
+ tst_qarraydata.cpp
+)
diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h
index 9dd8b05796..94cee5d887 100644
--- a/tests/auto/corelib/tools/qarraydata/simplevector.h
+++ b/tests/auto/corelib/tools/qarraydata/simplevector.h
@@ -76,25 +76,32 @@ public:
{
}
- explicit SimpleVector(Data *ptr)
- : d(ptr)
+ template <size_t N>
+ explicit SimpleVector(QStaticArrayData<T, N> &ptr)
+ : d(static_cast<Data *>(&ptr.header), ptr.data, N)
+ {
+ }
+
+ SimpleVector(Data *header, T *data, size_t len = 0)
+ : d(header, data, len)
+ {
+ }
+
+ explicit SimpleVector(QPair<Data*, T*> ptr, size_t len = 0)
+ : d(ptr, len)
{
}
- bool empty() const { return d->size == 0; }
+ bool empty() const { return d.size == 0; }
bool isNull() const { return d.isNull(); }
bool isEmpty() const { return this->empty(); }
- bool isStatic() const { return d->ref.isStatic(); }
- bool isShared() const { return d->ref.isShared(); }
+ bool isStatic() const { return d->isStatic(); }
+ bool isShared() const { return d->isShared(); }
bool isSharedWith(const SimpleVector &other) const { return d == other.d; }
-#if !defined(QT_NO_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; }
+ size_t size() const { return d.size; }
+ size_t capacity() const { return d->constAllocatedCapacity(); }
iterator begin() { detach(); return d->begin(); }
iterator end() { detach(); return d->end(); }
@@ -143,10 +150,10 @@ public:
return;
if (n <= capacity()) {
- if (d->capacityReserved)
+ if (d->flags() & Data::CapacityReserved)
return;
- if (!d->ref.isShared()) {
- d->capacityReserved = 1;
+ if (!d->isShared()) {
+ d->flags() |= Data::CapacityReserved;
return;
}
}
@@ -163,7 +170,7 @@ public:
if (size() == newSize)
return;
- if (d.needsDetach() || newSize > capacity()) {
+ if (d->needsDetach() || newSize > capacity()) {
SimpleVector detached(Data::allocate(
d->detachCapacity(newSize), d->detachFlags()));
if (newSize) {
@@ -199,11 +206,11 @@ public:
return;
T *const begin = d->begin();
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
detached.d->copyAppend(first, last);
detached.d->copyAppend(begin, begin + d->size);
@@ -220,11 +227,11 @@ public:
if (first == last)
return;
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
if (d->size) {
const T *const begin = constBegin();
@@ -260,11 +267,11 @@ public:
const iterator begin = d->begin();
const iterator where = begin + position;
const iterator end = begin + d->size;
- if (d.needsDetach()
+ if (d->needsDetach()
|| capacity() - size() < size_t(last - first)) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() + (last - first)),
- d->detachFlags() | Data::Grow));
+ d->detachFlags() | Data::GrowsForward));
if (position)
detached.d->copyAppend(begin, where);
@@ -298,7 +305,7 @@ public:
const T *const begin = d->begin();
const T *const end = begin + d->size;
- if (d.needsDetach()) {
+ if (d->needsDetach()) {
SimpleVector detached(Data::allocate(
d->detachCapacity(size() - (last - first)),
d->detachFlags()));
@@ -332,7 +339,7 @@ public:
}
static SimpleVector fromRawData(const T *data, size_t size,
- QArrayData::AllocationOptions options = Data::Default)
+ QArrayData::ArrayOptions options = Data::DefaultRawFlags)
{
return SimpleVector(Data::fromRawData(data, size, options));
}
diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
index 25e2f21d03..1366eebf97 100644
--- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
@@ -37,11 +37,8 @@ struct SharedNullVerifier
{
SharedNullVerifier()
{
- Q_ASSERT(QArrayData::shared_null[0].ref.isStatic());
- Q_ASSERT(QArrayData::shared_null[0].ref.isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- Q_ASSERT(QArrayData::shared_null[0].ref.isSharable());
-#endif
+ Q_ASSERT(QArrayData::shared_null[0].isStatic());
+ Q_ASSERT(QArrayData::shared_null[0].isShared());
}
};
@@ -59,7 +56,6 @@ class tst_QArrayData : public QObject
private slots:
void referenceCounting();
void sharedNullEmpty();
- void staticData();
void simpleVector();
void simpleVectorReserve_data();
void simpleVectorReserve();
@@ -73,8 +69,6 @@ private slots:
void gccBug43247();
void arrayOps();
void arrayOps2();
- void setSharable_data();
- void setSharable();
void fromRawData_data();
void fromRawData();
void literals();
@@ -89,70 +83,42 @@ void tst_QArrayData::referenceCounting()
{
{
// Reference counting initialized to 1 (owned)
- QArrayData array = { { Q_BASIC_ATOMIC_INITIALIZER(1) }, 0, 0, 0, 0 };
+ QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(1), QArrayData::DefaultRawFlags, 0 };
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(!array.ref.isStatic());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(array.ref.isSharable());
-#endif
+ QVERIFY(!array.isStatic());
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 2);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 2);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), 2);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 1);
- QVERIFY(!array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
+ QVERIFY(!array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), 0);
// Now would be a good time to free/release allocated data
}
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- // Reference counting initialized to 0 (non-sharable)
- QArrayData array = { { Q_BASIC_ATOMIC_INITIALIZER(0) }, 0, 0, 0, 0 };
-
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- QVERIFY(!array.ref.isStatic());
- QVERIFY(!array.ref.isSharable());
-
- QVERIFY(!array.ref.ref());
- // Reference counting fails, data should be copied
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- QVERIFY(!array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), 0);
-
- // Free/release data
- }
-#endif
-
{
// Reference counting initialized to -1 (static read-only data)
- QArrayData array = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, 0 };
+ QArrayData array = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
- QVERIFY(array.ref.isStatic());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(array.ref.isSharable());
-#endif
+ QVERIFY(array.isStatic());
- QVERIFY(array.ref.ref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QVERIFY(array.ref());
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
- QVERIFY(array.ref.deref());
- QCOMPARE(array.ref.atomic.loadRelaxed(), -1);
+ QVERIFY(array.deref());
+ QCOMPARE(array.ref_.loadRelaxed(), -1);
}
}
@@ -160,74 +126,39 @@ void tst_QArrayData::referenceCounting()
void tst_QArrayData::sharedNullEmpty()
{
QArrayData *null = const_cast<QArrayData *>(QArrayData::shared_null);
- QArrayData *empty = QArrayData::allocate(1, Q_ALIGNOF(QArrayData), 0);
-
- QVERIFY(null->ref.isStatic());
- QVERIFY(null->ref.isShared());
+ QArrayData *empty;
+ QArrayData::allocate(&empty, 1, alignof(QArrayData), 0);
- QVERIFY(empty->ref.isStatic());
- QVERIFY(empty->ref.isShared());
+ QVERIFY(null->isStatic());
+ QVERIFY(null->isShared());
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QVERIFY(empty->isStatic());
+ QVERIFY(empty->isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(null->ref.isSharable());
- QVERIFY(empty->ref.isSharable());
-#endif
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
- QVERIFY(null->ref.ref());
- QVERIFY(empty->ref.ref());
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QVERIFY(null->deref());
+ QVERIFY(empty->deref());
- QVERIFY(null->ref.deref());
- QVERIFY(empty->ref.deref());
-
- QCOMPARE(null->ref.atomic.loadRelaxed(), -1);
- QCOMPARE(empty->ref.atomic.loadRelaxed(), -1);
+ QCOMPARE(null->ref_.loadRelaxed(), -1);
+ QCOMPARE(empty->ref_.loadRelaxed(), -1);
QVERIFY(null != empty);
- QCOMPARE(null->size, 0);
- QCOMPARE(null->alloc, 0u);
- QCOMPARE(null->capacityReserved, 0u);
+ QCOMPARE(null->allocatedCapacity(), size_t(0));
- QCOMPARE(empty->size, 0);
- QCOMPARE(empty->alloc, 0u);
- QCOMPARE(empty->capacityReserved, 0u);
-}
-
-void tst_QArrayData::staticData()
-{
- QStaticArrayData<char, 10> charArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(char, 10),
- { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
- };
- QStaticArrayData<int, 10> intArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
- };
- QStaticArrayData<double, 10> doubleArray = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(double, 10),
- { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f }
- };
-
- QCOMPARE(charArray.header.size, 10);
- QCOMPARE(intArray.header.size, 10);
- QCOMPARE(doubleArray.header.size, 10);
-
- QCOMPARE(charArray.header.data(), reinterpret_cast<void *>(&charArray.data));
- QCOMPARE(intArray.header.data(), reinterpret_cast<void *>(&intArray.data));
- QCOMPARE(doubleArray.header.data(), reinterpret_cast<void *>(&doubleArray.data));
+ QCOMPARE(empty->allocatedCapacity(), size_t(0));
}
void tst_QArrayData::simpleVector()
{
- QArrayData data0 = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, 0 };
+ QArrayData data0 = { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 };
QStaticArrayData<int, 7> data1 = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 7),
+ { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 },
{ 0, 1, 2, 3, 4, 5, 6 }
};
@@ -235,10 +166,10 @@ void tst_QArrayData::simpleVector()
SimpleVector<int> v1;
SimpleVector<int> v2(v1);
- SimpleVector<int> v3(static_cast<QTypedArrayData<int> *>(&data0));
- SimpleVector<int> v4(static_cast<QTypedArrayData<int> *>(&data1.header));
- SimpleVector<int> v5(static_cast<QTypedArrayData<int> *>(&data0));
- SimpleVector<int> v6(static_cast<QTypedArrayData<int> *>(&data1.header));
+ SimpleVector<int> v3(static_cast<QTypedArrayData<int> *>(&data0), 0, 0);
+ SimpleVector<int> v4(data1);
+ SimpleVector<int> v5(static_cast<QTypedArrayData<int> *>(&data0), 0, 0);
+ SimpleVector<int> v6(data1);
SimpleVector<int> v7(10, 5);
SimpleVector<int> v8(array, array + sizeof(array)/sizeof(*array));
@@ -302,17 +233,6 @@ void tst_QArrayData::simpleVector()
QVERIFY(!v7.isShared());
QVERIFY(!v8.isShared());
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QVERIFY(v1.isSharable());
- QVERIFY(v2.isSharable());
- QVERIFY(v3.isSharable());
- QVERIFY(v4.isSharable());
- QVERIFY(v5.isSharable());
- QVERIFY(v6.isSharable());
- QVERIFY(v7.isSharable());
- QVERIFY(v8.isSharable());
-#endif
-
QVERIFY(v1.isSharedWith(v2));
QVERIFY(v1.isSharedWith(v3));
QVERIFY(v1.isSharedWith(v4));
@@ -494,71 +414,6 @@ void tst_QArrayData::simpleVector()
for (int i = 0; i < 120; ++i)
QCOMPARE(v1[i], v8[i % 10]);
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- v7.setSharable(true);
- QVERIFY(v7.isSharable());
-
- SimpleVector<int> copy1(v7);
- QVERIFY(copy1.isSharedWith(v7));
-
- v7.setSharable(false);
- QVERIFY(!v7.isSharable());
-
- QVERIFY(!copy1.isSharedWith(v7));
- QCOMPARE(v7.size(), copy1.size());
- for (size_t i = 0; i < copy1.size(); ++i)
- QCOMPARE(v7[i], copy1[i]);
-
- SimpleVector<int> clone(v7);
- QVERIFY(!clone.isSharedWith(v7));
- QCOMPARE(clone.size(), copy1.size());
- for (size_t i = 0; i < copy1.size(); ++i)
- QCOMPARE(clone[i], copy1[i]);
-
- v7.setSharable(true);
- QVERIFY(v7.isSharable());
-
- SimpleVector<int> copy2(v7);
- QVERIFY(copy2.isSharedWith(v7));
- }
-
- {
- SimpleVector<int> null;
- SimpleVector<int> empty(0, 5);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- null.setSharable(true);
- empty.setSharable(true);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
-
- null.setSharable(false);
- empty.setSharable(false);
-
- QVERIFY(!null.isSharable());
- QVERIFY(!empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
-
- null.setSharable(true);
- empty.setSharable(true);
-
- QVERIFY(null.isSharable());
- QVERIFY(empty.isSharable());
-
- QVERIFY(null.isEmpty());
- QVERIFY(empty.isEmpty());
- }
-#endif
}
Q_DECLARE_METATYPE(SimpleVector<int>)
@@ -574,11 +429,13 @@ void tst_QArrayData::simpleVectorReserve_data()
QTest::newRow("non-empty") << SimpleVector<int>(5, 42) << size_t(5) << size_t(5);
static const QStaticArrayData<int, 15> array = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 15),
+ { Q_BASIC_ATOMIC_INITIALIZER(-1), QArrayData::StaticDataFlags, 0 },
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } };
- QArrayDataPointerRef<int> p = {
+ const QArrayDataPointerRef<int> p = {
static_cast<QTypedArrayData<int> *>(
- const_cast<QArrayData *>(&array.header)) };
+ const_cast<QArrayData *>(&array.header)),
+ const_cast<int *>(array.data),
+ sizeof(array.data) / sizeof(array.data[0]) };
QTest::newRow("static") << SimpleVector<int>(p) << size_t(0) << size_t(15);
QTest::newRow("raw-data") << SimpleVector<int>::fromRawData(array.data, 15) << size_t(0) << size_t(15);
@@ -641,15 +498,14 @@ struct Deallocator
};
Q_DECLARE_METATYPE(const QArrayData *)
-Q_DECLARE_METATYPE(QArrayData::AllocationOptions)
+Q_DECLARE_METATYPE(QArrayData::ArrayOptions)
void tst_QArrayData::allocate_data()
{
QTest::addColumn<size_t>("objectSize");
QTest::addColumn<size_t>("alignment");
- QTest::addColumn<QArrayData::AllocationOptions>("allocateOptions");
+ QTest::addColumn<QArrayData::ArrayOptions>("allocateOptions");
QTest::addColumn<bool>("isCapacityReserved");
- QTest::addColumn<bool>("isSharable"); // ### Qt6: remove
QTest::addColumn<const QArrayData *>("commonEmpty");
struct {
@@ -657,35 +513,24 @@ void tst_QArrayData::allocate_data()
size_t objectSize;
size_t alignment;
} types[] = {
- { "char", sizeof(char), Q_ALIGNOF(char) },
- { "short", sizeof(short), Q_ALIGNOF(short) },
- { "void *", sizeof(void *), Q_ALIGNOF(void *) }
+ { "char", sizeof(char), alignof(char) },
+ { "short", sizeof(short), alignof(short) },
+ { "void *", sizeof(void *), alignof(void *) }
};
- QArrayData *shared_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0);
+ QArrayData *shared_empty;
+ QArrayData::allocate(&shared_empty, 1, alignof(QArrayData), 0);
QVERIFY(shared_empty);
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QArrayData *unsharable_empty = QArrayData::allocate(0, Q_ALIGNOF(QArrayData), 0, QArrayData::Unsharable);
- QVERIFY(unsharable_empty);
-#endif
-
struct {
char const *description;
- QArrayData::AllocationOptions allocateOptions;
+ QArrayData::ArrayOptions allocateOptions;
bool isCapacityReserved;
- bool isSharable;
const QArrayData *commonEmpty;
} options[] = {
- { "Default", QArrayData::Default, false, true, shared_empty },
- { "Reserved", QArrayData::CapacityReserved, true, true, shared_empty },
-#if !defined(QT_NO_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 }
+ { "Default", QArrayData::DefaultAllocationFlags, false, shared_empty },
+ { "Reserved", QArrayData::CapacityReserved, true, shared_empty },
+ { "Grow", QArrayData::GrowsForward, false, shared_empty }
};
for (size_t i = 0; i < sizeof(types)/sizeof(types[0]); ++i)
@@ -696,47 +541,45 @@ void tst_QArrayData::allocate_data()
+ QLatin1String(options[j].description)))
<< types[i].objectSize << types[i].alignment
<< options[j].allocateOptions << options[j].isCapacityReserved
- << options[j].isSharable << options[j].commonEmpty;
+ << options[j].commonEmpty;
}
void tst_QArrayData::allocate()
{
QFETCH(size_t, objectSize);
QFETCH(size_t, alignment);
- QFETCH(QArrayData::AllocationOptions, allocateOptions);
+ QFETCH(QArrayData::ArrayOptions, allocateOptions);
QFETCH(bool, isCapacityReserved);
QFETCH(const QArrayData *, commonEmpty);
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
// Shared Empty
- QCOMPARE(QArrayData::allocate(objectSize, minAlignment, 0,
- QArrayData::AllocationOptions(allocateOptions)), commonEmpty);
+ QArrayData *empty;
+ QCOMPARE((QArrayData::allocate(&empty, objectSize, minAlignment, 0,
+ QArrayData::ArrayOptions(allocateOptions)), empty), commonEmpty);
Deallocator keeper(objectSize, minAlignment);
keeper.headers.reserve(1024);
for (int capacity = 1; capacity <= 1024; capacity <<= 1) {
- QArrayData *data = QArrayData::allocate(objectSize, minAlignment,
- capacity, QArrayData::AllocationOptions(allocateOptions));
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, objectSize, minAlignment,
+ capacity, QArrayData::ArrayOptions(allocateOptions));
+
keeper.headers.append(data);
- QCOMPARE(data->size, 0);
- if (allocateOptions & QArrayData::Grow)
- QVERIFY(data->alloc > uint(capacity));
+ if (allocateOptions & QArrayData::GrowsForward)
+ QVERIFY(data->allocatedCapacity() > uint(capacity));
else
- QCOMPARE(data->alloc, uint(capacity));
- QCOMPARE(data->capacityReserved, uint(isCapacityReserved));
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(bool, isSharable);
- QCOMPARE(data->ref.isSharable(), isSharable);
-#endif
+ QCOMPARE(data->allocatedCapacity(), size_t(capacity));
+ QCOMPARE(bool(data->flags & QArrayData::CapacityReserved), isCapacityReserved);
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(data->data(), 'A', objectSize * capacity);
+ ::memset(dataPointer, 'A', objectSize * capacity);
}
}
@@ -744,47 +587,40 @@ void tst_QArrayData::reallocate()
{
QFETCH(size_t, objectSize);
QFETCH(size_t, alignment);
- QFETCH(QArrayData::AllocationOptions, allocateOptions);
+ QFETCH(QArrayData::ArrayOptions, allocateOptions);
QFETCH(bool, isCapacityReserved);
- // Maximum alignment that can be requested is that of QArrayData,
- // otherwise, we can't use reallocate().
- Q_ASSERT(alignment <= Q_ALIGNOF(QArrayData));
-
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
int capacity = 10;
Deallocator keeper(objectSize, minAlignment);
- QArrayData *data = QArrayData::allocate(objectSize, minAlignment, capacity,
- QArrayData::AllocationOptions(allocateOptions) & ~QArrayData::Grow);
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, objectSize, minAlignment, capacity,
+ QArrayData::ArrayOptions(allocateOptions) & ~QArrayData::GrowsForward);
keeper.headers.append(data);
- memset(data->data(), 'A', objectSize * capacity);
- data->size = capacity;
+ memset(dataPointer, 'A', objectSize * capacity);
// now try to reallocate
int newCapacity = 40;
- data = QArrayData::reallocateUnaligned(data, objectSize, newCapacity,
- QArrayData::AllocationOptions(allocateOptions));
+ auto pair = QArrayData::reallocateUnaligned(data, dataPointer, objectSize, newCapacity,
+ QArrayData::ArrayOptions(allocateOptions));
+ data = pair.first;
+ dataPointer = pair.second;
QVERIFY(data);
keeper.headers.clear();
keeper.headers.append(data);
- QCOMPARE(data->size, capacity);
- if (allocateOptions & QArrayData::Grow)
- QVERIFY(data->alloc > uint(newCapacity));
+ if (allocateOptions & QArrayData::GrowsForward)
+ QVERIFY(data->allocatedCapacity() > size_t(newCapacity));
else
- QCOMPARE(data->alloc, uint(newCapacity));
- QCOMPARE(data->capacityReserved, uint(isCapacityReserved));
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(bool, isSharable);
- QCOMPARE(data->ref.isSharable(), isSharable);
-#endif
+ QCOMPARE(data->allocatedCapacity(), size_t(newCapacity));
+ QCOMPARE(!(data->flags & QArrayData::CapacityReserved), !isCapacityReserved);
for (int i = 0; i < capacity; ++i)
- QCOMPARE(static_cast<char *>(data->data())[i], 'A');
+ QCOMPARE(static_cast<char *>(dataPointer)[i], 'A');
}
class Unaligned
@@ -808,95 +644,52 @@ void tst_QArrayData::alignment()
// Minimum alignment that can be requested is that of QArrayData.
// Typically, this alignment is sizeof(void *) and ensured by malloc.
- size_t minAlignment = qMax(alignment, Q_ALIGNOF(QArrayData));
+ size_t minAlignment = qMax(alignment, alignof(QArrayData));
Deallocator keeper(sizeof(Unaligned), minAlignment);
keeper.headers.reserve(100);
for (int i = 0; i < 100; ++i) {
- QArrayData *data = QArrayData::allocate(sizeof(Unaligned),
- minAlignment, 8, QArrayData::Default);
+ QArrayData *data;
+ void *dataPointer = QArrayData::allocate(&data, sizeof(Unaligned),
+ minAlignment, 8, QArrayData::DefaultAllocationFlags);
keeper.headers.append(data);
QVERIFY(data);
- QCOMPARE(data->size, 0);
- QVERIFY(data->alloc >= uint(8));
+ QVERIFY(data->allocatedCapacity() >= uint(8));
// These conditions should hold as long as header and array are
// allocated together
- QVERIFY(data->offset >= qptrdiff(sizeof(QArrayData)));
- QVERIFY(data->offset <= qptrdiff(sizeof(QArrayData)
- + minAlignment - Q_ALIGNOF(QArrayData)));
+ qptrdiff offset = reinterpret_cast<char *>(dataPointer) -
+ reinterpret_cast<char *>(data);
+ QVERIFY(offset >= qptrdiff(sizeof(QArrayData)));
+ QVERIFY(offset <= qptrdiff(sizeof(QArrayData)
+ + minAlignment - alignof(QArrayData)));
// Data is aligned
- QCOMPARE(quintptr(quintptr(data->data()) % alignment), quintptr(0u));
+ QCOMPARE(quintptr(quintptr(dataPointer) % alignment), quintptr(0u));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(data->data(), 'A', sizeof(Unaligned) * 8);
+ ::memset(dataPointer, 'A', sizeof(Unaligned) * 8);
}
}
void tst_QArrayData::typedData()
{
- QStaticArrayData<int, 10> data = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
- };
- QCOMPARE(data.header.size, 10);
-
- {
- QTypedArrayData<int> *array =
- static_cast<QTypedArrayData<int> *>(&data.header);
- QCOMPARE(array->data(), data.data);
-
- int j = 0;
- for (QTypedArrayData<int>::iterator iter = array->begin();
- iter != array->end(); ++iter, ++j)
- QCOMPARE((const int *)iter, data.data + j);
- QCOMPARE(j, 10);
- }
-
- {
- const QTypedArrayData<int> *array =
- static_cast<const QTypedArrayData<int> *>(&data.header);
-
- QCOMPARE(array->data(), data.data);
-
- int j = 0;
- for (QTypedArrayData<int>::const_iterator iter = array->begin();
- iter != array->end(); ++iter, ++j)
- QCOMPARE((const int *)iter, data.data + j);
- QCOMPARE(j, 10);
- }
-
- {
- QTypedArrayData<int> *null = QTypedArrayData<int>::sharedNull();
- QTypedArrayData<int> *empty = QTypedArrayData<int>::allocate(0);
-
- QVERIFY(null != empty);
-
- QCOMPARE(null->size, 0);
- QCOMPARE(empty->size, 0);
-
- QCOMPARE(null->begin(), null->end());
- QCOMPARE(empty->begin(), empty->end());
- }
-
-
{
Deallocator keeper(sizeof(char),
- Q_ALIGNOF(QTypedArrayData<char>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<char>::allocate(10);
+ alignof(QTypedArrayData<char>::AlignmentDummy));
+ QPair<QTypedArrayData<char> *, char *> pair = QTypedArrayData<char>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(char));
+ ::memset(pair.second, 0, 10 * sizeof(char));
keeper.headers.clear();
QTypedArrayData<short>::deallocate(array);
@@ -906,17 +699,17 @@ void tst_QArrayData::typedData()
{
Deallocator keeper(sizeof(short),
- Q_ALIGNOF(QTypedArrayData<short>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<short>::allocate(10);
+ alignof(QTypedArrayData<short>::AlignmentDummy));
+ QPair<QTypedArrayData<short> *, short *> pair = QTypedArrayData<short>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(short));
+ ::memset(pair.second, 0, 10 * sizeof(short));
keeper.headers.clear();
QTypedArrayData<short>::deallocate(array);
@@ -926,17 +719,17 @@ void tst_QArrayData::typedData()
{
Deallocator keeper(sizeof(double),
- Q_ALIGNOF(QTypedArrayData<double>::AlignmentDummy));
- QArrayData *array = QTypedArrayData<double>::allocate(10);
+ alignof(QTypedArrayData<double>::AlignmentDummy));
+ QPair<QTypedArrayData<double> *, double *> pair = QTypedArrayData<double>::allocate(10);
+ QArrayData *array = pair.first;
keeper.headers.append(array);
QVERIFY(array);
- QCOMPARE(array->size, 0);
- QCOMPARE(array->alloc, 10u);
+ QCOMPARE(array->allocatedCapacity(), size_t(10));
// Check that the allocated array can be used. Best tested with a
// memory checker, such as valgrind, running.
- ::memset(array->data(), 0, 10 * sizeof(double));
+ ::memset(pair.second, 0, 10 * sizeof(double));
keeper.headers.clear();
QTypedArrayData<double>::deallocate(array);
@@ -1354,136 +1147,6 @@ static inline bool arrayIsFilledWith(const QArrayDataPointer<int> &array,
return true;
}
-void tst_QArrayData::setSharable_data()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QTest::addColumn<QArrayDataPointer<int> >("array");
- QTest::addColumn<size_t>("size");
- QTest::addColumn<size_t>("capacity");
- QTest::addColumn<bool>("isCapacityReserved");
- QTest::addColumn<int>("fillValue");
-
- QArrayDataPointer<int> null;
- QArrayDataPointer<int> empty; empty.clear();
-
- static QStaticArrayData<int, 10> staticArrayData = {
- Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(int, 10),
- { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }
- };
-
- QArrayDataPointer<int> emptyReserved(QTypedArrayData<int>::allocate(5,
- QArrayData::CapacityReserved));
- QArrayDataPointer<int> nonEmpty(QTypedArrayData<int>::allocate(5,
- QArrayData::Default));
- QArrayDataPointer<int> nonEmptyExtraCapacity(
- QTypedArrayData<int>::allocate(10, QArrayData::Default));
- QArrayDataPointer<int> nonEmptyReserved(QTypedArrayData<int>::allocate(15,
- QArrayData::CapacityReserved));
- QArrayDataPointer<int> staticArray(
- static_cast<QTypedArrayData<int> *>(&staticArrayData.header));
- QArrayDataPointer<int> rawData(
- QTypedArrayData<int>::fromRawData(staticArrayData.data, 10));
-
- nonEmpty->copyAppend(5, 1);
- nonEmptyExtraCapacity->copyAppend(5, 1);
- nonEmptyReserved->copyAppend(7, 2);
-
- QTest::newRow("shared-null") << null << size_t(0) << size_t(0) << false << 0;
- QTest::newRow("shared-empty") << empty << size_t(0) << size_t(0) << false << 0;
- // unsharable-empty implicitly tested in shared-empty
- QTest::newRow("empty-reserved") << emptyReserved << size_t(0) << size_t(5) << true << 0;
- QTest::newRow("non-empty") << nonEmpty << size_t(5) << size_t(5) << false << 1;
- QTest::newRow("non-empty-extra-capacity") << nonEmptyExtraCapacity << size_t(5) << size_t(10) << false << 1;
- 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 !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(QArrayDataPointer<int>, array);
- QFETCH(size_t, size);
- QFETCH(size_t, capacity);
- QFETCH(bool, isCapacityReserved);
- QFETCH(int, fillValue);
-
- QVERIFY(array->ref.isShared()); // QTest has a copy
- QVERIFY(array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- // shared-null becomes shared-empty, may otherwise detach
- array.setSharable(true);
-
- QVERIFY(array->ref.isSharable());
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(array->ref.isShared());
- QVERIFY(array->ref.isSharable());
- QCOMPARE(copy.data(), array.data());
- }
-
- // Unshare, must detach
- array.setSharable(false);
-
- // Immutability (alloc == 0) is lost on detach, as is additional capacity
- // if capacityReserved flag is not set.
- if ((capacity == 0 && size != 0)
- || (!isCapacityReserved && capacity > size))
- capacity = size;
-
- QVERIFY(!array->ref.isShared());
- QVERIFY(!array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(!array->ref.isShared());
- QVERIFY(!array->ref.isSharable());
-
- // Null/empty is always shared
- QCOMPARE(copy->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(copy->ref.isSharable());
-
- QCOMPARE(size_t(copy->size), size);
- QCOMPARE(size_t(copy->alloc), capacity);
- QCOMPARE(bool(copy->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(copy, fillValue, size));
- }
-
- // Make sharable, again
- array.setSharable(true);
-
- QCOMPARE(array->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(array->ref.isSharable());
-
- QCOMPARE(size_t(array->size), size);
- QCOMPARE(size_t(array->alloc), capacity);
- QCOMPARE(bool(array->capacityReserved), isCapacityReserved);
- QVERIFY(arrayIsFilledWith(array, fillValue, size));
-
- {
- QArrayDataPointer<int> copy(array);
- QVERIFY(array->ref.isShared());
- QCOMPARE(copy.data(), array.data());
- }
-
- QCOMPARE(array->ref.isShared(), !(size || isCapacityReserved));
- QVERIFY(array->ref.isSharable());
-#endif
-}
-
struct ResetOnDtor
{
ResetOnDtor()
@@ -1517,7 +1180,7 @@ void fromRawData_impl()
{
// Default: Immutable, sharable
SimpleVector<T> raw = SimpleVector<T>::fromRawData(array,
- sizeof(array)/sizeof(array[0]), QArrayData::Default);
+ sizeof(array)/sizeof(array[0]), QArrayData::DefaultRawFlags);
QCOMPARE(raw.size(), size_t(11));
QCOMPARE((const T *)raw.constBegin(), array);
@@ -1531,37 +1194,6 @@ void fromRawData_impl()
QCOMPARE(raw.back(), T(11));
QVERIFY((const T *)raw.constBegin() != array);
}
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- {
- // Immutable, unsharable
- SimpleVector<T> raw = SimpleVector<T>::fromRawData(array,
- sizeof(array)/sizeof(array[0]), QArrayData::Unsharable);
-
- QCOMPARE(raw.size(), size_t(11));
- QCOMPARE((const T *)raw.constBegin(), array);
- QCOMPARE((const T *)raw.constEnd(), (const T *)(array + sizeof(array)/sizeof(array[0])));
-
- SimpleVector<T> copy(raw);
- QVERIFY(!copy.isSharedWith(raw));
- QVERIFY(!raw.isShared());
-
- QCOMPARE(copy.size(), size_t(11));
-
- for (size_t i = 0; i < 11; ++i) {
- QCOMPARE(const_(copy)[i], const_(raw)[i]);
- QCOMPARE(const_(copy)[i], T(i + 1));
- }
-
- QCOMPARE(raw.size(), size_t(11));
- QCOMPARE((const T *)raw.constBegin(), array);
- QCOMPARE((const T *)raw.constEnd(), (const T *)(array + sizeof(array)/sizeof(array[0])));
-
- // Detach
- QCOMPARE(raw.back(), T(11));
- QVERIFY((const T *)raw.constBegin() != array);
- }
-#endif
}
void tst_QArrayData::fromRawData_data()
@@ -1593,17 +1225,17 @@ void tst_QArrayData::literals()
{
{
QArrayDataPointer<char> d = Q_ARRAY_LITERAL(char, "ABCDEFGHIJ");
- QCOMPARE(d->size, 10 + 1);
+ QCOMPARE(d.size, 10u + 1u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], char('A' + i));
+ QCOMPARE(d.data()[i], char('A' + i));
}
{
// wchar_t is not necessarily 2-bytes
QArrayDataPointer<wchar_t> d = Q_ARRAY_LITERAL(wchar_t, L"ABCDEFGHIJ");
- QCOMPARE(d->size, 10 + 1);
+ QCOMPARE(d.size, 10u + 1u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], wchar_t('A' + i));
+ QCOMPARE(d.data()[i], wchar_t('A' + i));
}
{
@@ -1615,10 +1247,6 @@ void tst_QArrayData::literals()
// v.capacity() is unspecified, for now
QVERIFY(v.isStatic());
-
-#if !defined(QT_NO_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)
@@ -1645,26 +1273,26 @@ void tst_QArrayData::variadicLiterals()
{
QArrayDataPointer<int> d =
Q_ARRAY_LITERAL(int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], i);
+ QCOMPARE(d.data()[i], i);
}
{
QArrayDataPointer<char> d = Q_ARRAY_LITERAL(char,
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i)
- QCOMPARE(d->data()[i], char('A' + i));
+ QCOMPARE(d.data()[i], char('A' + i));
}
{
QArrayDataPointer<const char *> d = Q_ARRAY_LITERAL(const char *,
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J");
- QCOMPARE(d->size, 10);
+ QCOMPARE(d.size, 10u);
for (int i = 0; i < 10; ++i) {
- QCOMPARE(d->data()[i][0], char('A' + i));
- QCOMPARE(d->data()[i][1], '\0');
+ QCOMPARE(d.data()[i][0], char('A' + i));
+ QCOMPARE(d.data()[i][1], '\0');
}
}
@@ -1677,10 +1305,6 @@ void tst_QArrayData::variadicLiterals()
// v.capacity() is unspecified, for now
QVERIFY(v.isStatic());
-
-#if !defined(QT_NO_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/qarraydata_strictiterators/qarraydata_strictiterators.pro b/tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro
deleted file mode 100644
index b01fbd84d1..0000000000
--- a/tests/auto/corelib/tools/qarraydata_strictiterators/qarraydata_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qarraydata/qarraydata.pro)
-TARGET = tst_qarraydata_strictiterators
-DEFINES += QT_STRICT_ITERATORS=1 tst_QArrayData=tst_QArrayData_StrictIterators
diff --git a/tests/auto/corelib/tools/qbitarray/CMakeLists.txt b/tests/auto/corelib/tools/qbitarray/CMakeLists.txt
new file mode 100644
index 0000000000..65150c02a2
--- /dev/null
+++ b/tests/auto/corelib/tools/qbitarray/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qbitarray.pro.
+
+#####################################################################
+## tst_qbitarray Test:
+#####################################################################
+
+add_qt_test(tst_qbitarray
+ SOURCES
+ tst_qbitarray.cpp
+)
diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
index 9a7c099228..b2c7915aa0 100644
--- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
+++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp
@@ -86,6 +86,9 @@ private slots:
void resize();
void fromBits_data();
void fromBits();
+
+ void toUInt32_data();
+ void toUInt32();
};
void tst_QBitArray::size_data()
@@ -667,5 +670,95 @@ void tst_QBitArray::fromBits()
QCOMPARE(QBitArray::fromBits(fromBits.bits(), fromBits.size()), expected);
}
+void tst_QBitArray::toUInt32_data()
+{
+ QTest::addColumn<QBitArray>("data");
+ QTest::addColumn<int>("endianness");
+ QTest::addColumn<bool>("check");
+ QTest::addColumn<quint32>("result");
+
+ QTest::newRow("ctor") << QBitArray()
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(0);
+
+ QTest::newRow("empty") << QBitArray(0)
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(0);
+
+ QTest::newRow("LittleEndian4") << QStringToQBitArray(QString("0111"))
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(14);
+
+ QTest::newRow("BigEndian4") << QStringToQBitArray(QString("0111"))
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << true
+ << quint32(7);
+
+ QTest::newRow("LittleEndian8") << QStringToQBitArray(QString("01111111"))
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(254);
+
+ QTest::newRow("BigEndian8") << QStringToQBitArray(QString("01111111"))
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << true
+ << quint32(127);
+
+ QTest::newRow("LittleEndian16") << QStringToQBitArray(QString("0111111111111111"))
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(65534);
+
+ QTest::newRow("BigEndian16") << QStringToQBitArray(QString("0111111111111111"))
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << true
+ << quint32(32767);
+
+ QTest::newRow("LittleEndian31") << QBitArray(31, true)
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(2147483647);
+
+ QTest::newRow("BigEndian31") << QBitArray(31, true)
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << true
+ << quint32(2147483647);
+
+ QTest::newRow("LittleEndian32") << QBitArray(32, true)
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << true
+ << quint32(4294967295);
+
+ QTest::newRow("BigEndian32") << QBitArray(32, true)
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << true
+ << quint32(4294967295);
+
+ QTest::newRow("LittleEndian33") << QBitArray(33, true)
+ << static_cast<int>(QSysInfo::Endian::LittleEndian)
+ << false
+ << quint32(0);
+
+ QTest::newRow("BigEndian33") << QBitArray(33, true)
+ << static_cast<int>(QSysInfo::Endian::BigEndian)
+ << false
+ << quint32(0);
+}
+
+void tst_QBitArray::toUInt32()
+{
+ QFETCH(QBitArray, data);
+ QFETCH(int, endianness);
+ QFETCH(bool, check);
+ QFETCH(quint32, result);
+ bool ok = false;
+
+ QCOMPARE(data.toUInt32(static_cast<QSysInfo::Endian>(endianness), &ok), result);
+ QCOMPARE(ok, check);
+}
+
QTEST_APPLESS_MAIN(tst_QBitArray)
#include "tst_qbitarray.moc"
diff --git a/tests/auto/corelib/tools/qcache/CMakeLists.txt b/tests/auto/corelib/tools/qcache/CMakeLists.txt
new file mode 100644
index 0000000000..50fb2372c3
--- /dev/null
+++ b/tests/auto/corelib/tools/qcache/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qcache.pro.
+
+#####################################################################
+## tst_qcache Test:
+#####################################################################
+
+add_qt_test(tst_qcache
+ SOURCES
+ tst_qcache.cpp
+)
diff --git a/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt b/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt
new file mode 100644
index 0000000000..2fc50a7d89
--- /dev/null
+++ b/tests/auto/corelib/tools/qcommandlineparser/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qcommandlineparser.pro.
+
+#####################################################################
+## tst_qcommandlineparser Test:
+#####################################################################
+
+add_qt_test(tst_qcommandlineparser
+ SOURCES
+ tst_qcommandlineparser.cpp
+)
+add_subdirectory(testhelper)
diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/CMakeLists.txt b/tests/auto/corelib/tools/qcommandlineparser/testhelper/CMakeLists.txt
new file mode 100644
index 0000000000..3d0989d841
--- /dev/null
+++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/CMakeLists.txt
@@ -0,0 +1,11 @@
+# Generated from qcommandlineparser_test_helper.pro.
+
+#####################################################################
+## qcommandlineparser_test_helper Binary:
+#####################################################################
+
+add_qt_executable(qcommandlineparser_test_helper
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
+ SOURCES
+ qcommandlineparser_test_helper.cpp
+)
diff --git a/tests/auto/corelib/tools/qcontiguouscache/CMakeLists.txt b/tests/auto/corelib/tools/qcontiguouscache/CMakeLists.txt
new file mode 100644
index 0000000000..bce8ce11bd
--- /dev/null
+++ b/tests/auto/corelib/tools/qcontiguouscache/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qcontiguouscache.pro.
+
+#####################################################################
+## tst_qcontiguouscache Test:
+#####################################################################
+
+add_qt_test(tst_qcontiguouscache
+ SOURCES
+ tst_qcontiguouscache.cpp
+)
diff --git a/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt b/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt
new file mode 100644
index 0000000000..c2611921ab
--- /dev/null
+++ b/tests/auto/corelib/tools/qeasingcurve/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qeasingcurve.pro.
+
+#####################################################################
+## tst_qeasingcurve Test:
+#####################################################################
+
+add_qt_test(tst_qeasingcurve
+ SOURCES
+ tst_qeasingcurve.cpp
+)
diff --git a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/CMakeLists.txt b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/CMakeLists.txt
new file mode 100644
index 0000000000..cacc36beaa
--- /dev/null
+++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qexplicitlyshareddatapointer.pro.
+
+#####################################################################
+## tst_qexplicitlyshareddatapointer Test:
+#####################################################################
+
+add_qt_test(tst_qexplicitlyshareddatapointer
+ SOURCES
+ tst_qexplicitlyshareddatapointer.cpp
+)
diff --git a/tests/auto/corelib/tools/qflatmap/qflatmap.pro b/tests/auto/corelib/tools/qflatmap/qflatmap.pro
new file mode 100644
index 0000000000..3927cee30c
--- /dev/null
+++ b/tests/auto/corelib/tools/qflatmap/qflatmap.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qflatmap
+QT = core-private testlib
+SOURCES = tst_qflatmap.cpp
diff --git a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp
new file mode 100644
index 0000000000..a5ae6f5f44
--- /dev/null
+++ b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp
@@ -0,0 +1,453 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <private/qflatmap_p.h>
+#include <qbytearray.h>
+#include <qstring.h>
+#include <qstringview.h>
+#include <qvarlengtharray.h>
+#include <qvector.h>
+
+#include <algorithm>
+#include <list>
+#include <tuple>
+
+class tst_QFlatMap : public QObject
+{
+ Q_OBJECT
+private slots:
+ void constructing();
+ void constAccess();
+ void insertion();
+ void removal();
+ void extraction();
+ void iterators();
+ void statefulComparator();
+ void transparency();
+ void viewIterators();
+ void varLengthArray();
+};
+
+void tst_QFlatMap::constructing()
+{
+ using Map = QFlatMap<int, QByteArray>;
+ Map fmDefault;
+ QVERIFY(fmDefault.isEmpty());
+ QCOMPARE(fmDefault.size(), Map::size_type(0));
+ QCOMPARE(fmDefault.size(), fmDefault.count());
+
+ auto key_compare = fmDefault.key_comp();
+ auto selfbuilt_value_compare
+ = [&key_compare](const Map::value_type &a, const Map::value_type &b)
+ {
+ return key_compare(a.first, b.first);
+ };
+ auto value_compare = fmDefault.value_comp();
+
+ Map::key_container_type kv = { 6, 2, 1 };
+ Map::mapped_container_type mv = { "foo", "bar", "baz" };
+ Map fmCopy{kv, mv};
+ QCOMPARE(fmCopy.size(), Map::size_type(3));
+ QVERIFY(std::is_sorted(fmCopy.begin(), fmCopy.end(), selfbuilt_value_compare));
+ QVERIFY(std::is_sorted(fmCopy.begin(), fmCopy.end(), value_compare));
+
+ Map fmMove{
+ Map::key_container_type{ 6, 2, 1 },
+ Map::mapped_container_type{ "foo", "bar", "baz" }
+ };
+ QCOMPARE(fmMove.size(), Map::size_type(3));
+ QVERIFY(std::is_sorted(fmMove.begin(), fmMove.end(), value_compare));
+
+ auto fmInitList = Map{ { 1, 2 }, { "foo", "bar" } };
+ QVERIFY(std::is_sorted(fmInitList.begin(), fmInitList.end(), value_compare));
+
+ auto fmRange = Map(fmCopy.begin(), fmCopy.end());
+ QVERIFY(std::is_sorted(fmRange.begin(), fmRange.end(), value_compare));
+
+ kv.clear();
+ mv.clear();
+ std::vector<Map::value_type> sv;
+ for (auto it = fmRange.begin(); it != fmRange.end(); ++it) {
+ kv.push_back(it->first);
+ mv.push_back(it->second);
+ sv.push_back(*it);
+ }
+ auto fmFromSortedVectorCopy = Map(Qt::OrderedUniqueRange, kv, mv);
+ auto fmFromSortedVectorMove = Map(Qt::OrderedUniqueRange, Map::key_container_type(kv),
+ Map::mapped_container_type(mv));
+ auto fmFromSortedInitList = Map(Qt::OrderedUniqueRange, { { 1, "foo" }, { 2, "bar" } });
+ auto fmFromSortedRange = Map(Qt::OrderedUniqueRange, sv.begin(), sv.end());
+}
+
+void tst_QFlatMap::constAccess()
+{
+ using Map = QFlatMap<QByteArray, QByteArray>;
+ const Map m{ { { "foo", "FOO" }, { "bar", "BAR" } } };
+
+ const std::vector<Map::value_type> v{ { "foo", "FOO" }, { "bar", "BAR" } };
+
+ QCOMPARE(m.value("foo").data(), "FOO");
+ QCOMPARE(m.value("bar").data(), "BAR");
+ QCOMPARE(m.value("nix"), QByteArray());
+ QCOMPARE(m.value("nix", "NIX").data(), "NIX");
+ QCOMPARE(m["foo"].data(), "FOO");
+ QCOMPARE(m["bar"].data(), "BAR");
+ QCOMPARE(m["nix"], QByteArray());
+ QVERIFY(m.contains("foo"));
+ QVERIFY(!m.contains("nix"));
+}
+
+void tst_QFlatMap::insertion()
+{
+ using Map = QFlatMap<QByteArray, QByteArray>;
+ Map m;
+ QByteArray foo = "foo";
+ m[foo] = foo.toUpper();
+ m["bar"] = "BAR";
+ m["baz"] = "BAZ";
+ QVERIFY(m.insert("oof", "eek").second);
+ QVERIFY(!m.insert("oof", "OOF").second);
+ const std::vector<Map::value_type> container = { { "bla", "BLA" }, { "blubb", "BLUBB" } };
+ m.insert(container.begin(), container.end());
+ QCOMPARE(m.value("foo").data(), "FOO");
+ QCOMPARE(m.value("bar").data(), "BAR");
+ QCOMPARE(m.value("baz").data(), "BAZ");
+ QCOMPARE(m.value("oof").data(), "OOF");
+ QCOMPARE(m.value("bla").data(), "BLA");
+ QCOMPARE(m.value("blubb").data(), "BLUBB");
+
+ Map::value_type a1[] = { { "narf", "NARF" },
+ { "zort", "ZORT" },
+ { "troz", "TROZ" } };
+ Map::value_type a2[] = { { "gnampf", "GNAMPF" },
+ { "narf", "NARFFFF" },
+ { "narf", "NARFFFFF" },
+ { "narf", "NARFFFFFF" } };
+ m.insert(std::begin(a1), std::end(a1));
+ m.insert(Qt::OrderedUniqueRange, std::begin(a2), std::end(a2));
+ QCOMPARE(m.size(), 10);
+ QCOMPARE(m.value("narf").data(), "NARFFFFFF");
+ QCOMPARE(m.value("gnampf").data(), "GNAMPF");
+}
+
+void tst_QFlatMap::extraction()
+{
+ using Map = QFlatMap<int, QByteArray>;
+ Map::key_container_type expectedKeys = { 1, 2, 3 };
+ Map::mapped_container_type expectedValues = { "een", "twee", "dree" };
+ Map m(expectedKeys, expectedValues);
+ auto keys = m.keys();
+ auto values = m.values();
+ QCOMPARE(keys, expectedKeys);
+ QCOMPARE(values, expectedValues);
+ Map::containers c = std::move(m).extract();
+ QCOMPARE(c.keys, expectedKeys);
+ QCOMPARE(c.values, expectedValues);
+}
+
+void tst_QFlatMap::iterators()
+{
+ using Map = QFlatMap<int, QByteArray>;
+ auto m = Map{ { 1, "foo" }, { 2, "bar" }, { 3, "baz" } };
+ {
+ // forward / backward
+ Map::iterator a = m.begin();
+ QVERIFY(a != m.end());
+ QCOMPARE(a.key(), 1);
+ QCOMPARE(a.value(), "foo");
+ ++a;
+ QCOMPARE(a.key(), 2);
+ QCOMPARE(a.value(), "bar");
+ Map::iterator b = a++;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ QCOMPARE(std::tie(b.key(), b.value()), std::make_tuple(2, "bar"));
+ QCOMPARE(++a, m.end());
+ --a;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ a.value() = "buzz";
+ b = a--;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+ QCOMPARE(std::tie(b.key(), b.value()), std::make_tuple(3, "buzz"));
+ b.value() = "baz";
+
+ // random access
+ a = m.begin();
+ a += 2;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ a = m.begin() + 1;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+ a = 1 + m.begin();
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+ a = m.end() - 1;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ b = m.end();
+ b -= 1;
+ QCOMPARE(std::tie(b.key(), b.value()), std::make_tuple(3, "baz"));
+ QCOMPARE(m.end() - m.begin(), m.size());
+
+ // comparison
+ a = m.begin() + m.size() - 1;
+ b = m.end() - 1;
+ QVERIFY(a == b);
+ a = m.begin();
+ b = m.end();
+ QVERIFY(a < b);
+ QVERIFY(a <= b);
+ QVERIFY(b > a);
+ QVERIFY(b >= a);
+ a = b;
+ QVERIFY(!(a < b));
+ QVERIFY(a <= b);
+ QVERIFY(!(b > a));
+ QVERIFY(b >= a);
+
+ // de-referencing
+ a = m.begin();
+ auto ref0 = *a;
+ QCOMPARE(ref0.first, 1);
+ QCOMPARE(ref0.second, "foo");
+ auto ref1 = a[1];
+ QCOMPARE(ref1.first, 2);
+ QCOMPARE(ref1.second, "bar");
+ }
+ {
+ // forward / backward
+ Map::const_iterator a = m.cbegin();
+ QVERIFY(a != m.cend());
+ QCOMPARE(a.key(), 1);
+ QCOMPARE(a.value(), "foo");
+ ++a;
+ QCOMPARE(a.key(), 2);
+ QCOMPARE(a.value(), "bar");
+ Map::const_iterator b = a++;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ QCOMPARE(std::tie(b.key(), b.value()), std::make_tuple(2, "bar"));
+ QCOMPARE(++a, m.cend());
+ --a;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ b = a--;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+
+ // random access
+ a = m.cbegin();
+ a += 2;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ a = m.cbegin() + 1;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+ a = 1 + m.cbegin();
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(2, "bar"));
+ a = m.cend() - 1;
+ QCOMPARE(std::tie(a.key(), a.value()), std::make_tuple(3, "baz"));
+ b = m.cend();
+ b -= 1;
+ QCOMPARE(std::tie(b.key(), b.value()), std::make_tuple(3, "baz"));
+ QCOMPARE(m.cend() - m.cbegin(), m.size());
+
+ // comparison
+ a = m.cbegin() + m.size() - 1;
+ b = m.cend() - 1;
+ QVERIFY(a == b);
+ a = m.cbegin();
+ b = m.cend();
+ QVERIFY(a < b);
+ QVERIFY(a <= b);
+ QVERIFY(b > a);
+ QVERIFY(b >= a);
+ a = b;
+ QVERIFY(!(a < b));
+ QVERIFY(a <= b);
+ QVERIFY(!(b > a));
+ QVERIFY(b >= a);
+
+ // de-referencing
+ a = m.cbegin();
+ auto ref0 = *a;
+ QCOMPARE(ref0.first, 1);
+ QCOMPARE(ref0.second, "foo");
+ auto ref1 = a[1];
+ QCOMPARE(ref1.first, 2);
+ QCOMPARE(ref1.second, "bar");
+ }
+ {
+ Map::iterator it = m.begin();
+ Map::const_iterator cit = it;
+ Q_UNUSED(it);
+ Q_UNUSED(cit);
+ }
+ {
+ std::list<Map::value_type> revlst;
+ std::copy(m.begin(), m.end(), std::front_inserter(revlst));
+ std::vector<Map::value_type> v0;
+ std::copy(revlst.begin(), revlst.end(), std::back_inserter(v0));
+ std::vector<Map::value_type> v1;
+ std::copy(m.rbegin(), m.rend(), std::back_inserter(v1));
+ const Map cm = m;
+ std::vector<Map::value_type> v2;
+ std::copy(cm.rbegin(), cm.rend(), std::back_inserter(v2));
+ std::vector<Map::value_type> v3;
+ std::copy(m.crbegin(), m.crend(), std::back_inserter(v3));
+ QCOMPARE(v0, v1);
+ QCOMPARE(v1, v2);
+ QCOMPARE(v2, v3);
+ }
+}
+
+void tst_QFlatMap::removal()
+{
+ using Map = QFlatMap<int, QByteArray>;
+ Map m({ { 2, "bar" }, { 3, "baz" }, { 1, "foo" } });
+ QCOMPARE(m.value(2).data(), "bar");
+ QCOMPARE(m.take(2).data(), "bar");
+ QVERIFY(!m.contains(2));
+ QCOMPARE(m.size(), Map::size_type(2));
+ QVERIFY(m.remove(1));
+ QVERIFY(!m.contains(1));
+ QVERIFY(!m.remove(1));
+ QCOMPARE(m.size(), Map::size_type(1));
+ m.clear();
+ QVERIFY(m.isEmpty());
+ QVERIFY(m.empty());
+
+ m[1] = "een";
+ m[2] = "twee";
+ m[3] = "dree";
+ auto it = m.lower_bound(1);
+ QCOMPARE(it.key(), 1);
+ it = m.erase(it);
+ QCOMPARE(it.key(), 2);
+ QVERIFY(!m.contains(1));
+}
+
+void tst_QFlatMap::statefulComparator()
+{
+ struct CountingCompare {
+ mutable int count = 0;
+
+ bool operator()(const QString &lhs, const QString &rhs) const
+ {
+ ++count;
+ return lhs < rhs;
+ }
+ };
+
+ using Map = QFlatMap<QString, QString, CountingCompare>;
+ auto m1 = Map{ { "en", "een"}, { "to", "twee" }, { "tre", "dree" } };
+ QVERIFY(m1.key_comp().count > 0);
+ auto m2 = Map(m1.key_comp());
+ QCOMPARE(m2.key_comp().count, m1.key_comp().count);
+ m2.insert(m1.begin(), m1.end());
+ QVERIFY(m2.key_comp().count > m1.key_comp().count);
+}
+
+void tst_QFlatMap::transparency()
+{
+ struct StringViewCompare
+ {
+ using is_transparent = void;
+ bool operator()(const QStringView &lhs, const QStringView &rhs) const
+ {
+ return lhs < rhs;
+ }
+ };
+
+ using Map = QFlatMap<QString, QString, StringViewCompare>;
+ auto m = Map{ { "one", "een" }, { "two", "twee" }, { "three", "dree" } };
+
+ const QString numbers = "one two three";
+ const QStringView sv1{numbers.constData(), 3};
+ const QStringView sv2{numbers.constData() + 4, 3};
+ const QStringView sv3{numbers.constData() + 8, 5};
+ QCOMPARE(m.lower_bound(sv1).value(), "een");
+ QCOMPARE(m.lower_bound(sv2).value(), "twee");
+ QCOMPARE(m.lower_bound(sv3).value(), "dree");
+}
+
+void tst_QFlatMap::viewIterators()
+{
+ using Map = QFlatMap<QByteArray, QByteArray>;
+ Map m({ { "yksi", "een"}, { "kaksi", "twee" }, { "kolme", "dree" } });
+ {
+ std::vector<QByteArray> keys;
+ std::transform(m.begin(), m.end(), std::back_inserter(keys),
+ [](const Map::value_type &v)
+ {
+ return v.first;
+ });
+ auto it = keys.begin();
+ QCOMPARE(*it, "kaksi");
+ QCOMPARE(it->length(), 5);
+ ++it;
+ QCOMPARE(*it, "kolme");
+ it++;
+ QCOMPARE(*it, "yksi");
+ ++it;
+ QCOMPARE(it, keys.end());
+ --it;
+ QCOMPARE(*it, "yksi");
+ it--;
+ QCOMPARE(*it, "kolme");
+ }
+ {
+ std::vector<QByteArray> values;
+ std::transform(m.begin(), m.end(), std::back_inserter(values),
+ [](const Map::value_type &v)
+ {
+ return v.second;
+ });
+ auto it = values.begin();
+ QCOMPARE(*it, "twee");
+ QCOMPARE(it->length(), 4);
+ ++it;
+ QCOMPARE(*it, "dree");
+ it++;
+ QCOMPARE(*it, "een");
+ ++it;
+ QCOMPARE(it, values.end());
+ --it;
+ QCOMPARE(*it, "een");
+ it--;
+ QCOMPARE(*it, "dree");
+ }
+}
+
+void tst_QFlatMap::varLengthArray()
+{
+ using Map = QFlatMap<int, QByteArray, std::less<int>,
+ QVarLengthArray<int, 1024>, QVarLengthArray<QByteArray, 1024>>;
+ Map m{ { 2, "twee" } };
+ m.insert(1, "een");
+ m.remove(1);
+ QVERIFY(!m.isEmpty());
+ m.remove(2);
+ QVERIFY(m.isEmpty());
+}
+
+QTEST_APPLESS_MAIN(tst_QFlatMap)
+#include "tst_qflatmap.moc"
diff --git a/tests/auto/corelib/tools/qhash/.prev_CMakeLists.txt b/tests/auto/corelib/tools/qhash/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..5dfeedb322
--- /dev/null
+++ b/tests/auto/corelib/tools/qhash/.prev_CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qhash.pro.
+
+#####################################################################
+## tst_qhash Test:
+#####################################################################
+
+add_qt_test(tst_qhash
+ SOURCES
+ tst_qhash.cpp
+ DEFINES
+ -QT_NO_JAVA_STYLE_ITERATORS
+)
diff --git a/tests/auto/corelib/tools/qhash/CMakeLists.txt b/tests/auto/corelib/tools/qhash/CMakeLists.txt
new file mode 100644
index 0000000000..32edf72073
--- /dev/null
+++ b/tests/auto/corelib/tools/qhash/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qhash.pro.
+
+#####################################################################
+## tst_qhash Test:
+#####################################################################
+
+add_qt_test(tst_qhash
+ SOURCES
+ tst_qhash.cpp
+ DEFINES
+ #-QT_NO_JAVA_STYLE_ITERATORS # special case remove
+)
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index b98ac38288..4052eff0ae 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -451,20 +451,6 @@ void tst_QHash::insert1()
QCOMPARE(hash.find(searchKey).value(), id01.id); // last-inserted value
QCOMPARE(hash.find(searchKey).key().id, id00.id); // but first-inserted key
}
- {
- QMultiHash<IdentityTracker, int> hash;
- QCOMPARE(hash.size(), 0);
- const int dummy = -1;
- IdentityTracker id00 = {0, 0}, id01 = {0, 1}, searchKey = {0, dummy};
- QCOMPARE(hash.insert(id00, id00.id).key().id, id00.id);
- QCOMPARE(hash.size(), 1);
- QCOMPARE(hash.insert(id01, id01.id).key().id, id01.id);
- QCOMPARE(hash.size(), 2);
- QMultiHash<IdentityTracker, int>::const_iterator pos = hash.constFind(searchKey);
- QCOMPARE(pos.value(), pos.key().id); // key fits to value it was inserted with
- ++pos;
- QCOMPARE(pos.value(), pos.key().id); // key fits to value it was inserted with
- }
}
void tst_QHash::erase()
@@ -491,13 +477,15 @@ void tst_QHash::erase()
++n;
}
QVERIFY(n == 3);
- QHash<int, int> h2;
- h2.insertMulti(20, 41);
- h2.insertMulti(20, 42);
+
+ QMultiHash<int, int> h2;
+ h2.insert(20, 41);
+ h2.insert(20, 42);
QVERIFY(h2.size() == 2);
- it1 = h2.erase(h2.begin());
- it1 = h2.erase(h2.begin());
- QVERIFY(it1 == h2.end());
+ auto bit = h2.begin();
+ auto mit = h2.erase(bit);
+ mit = h2.erase(h2.begin());
+ QVERIFY(mit == h2.end());
}
void tst_QHash::key()
@@ -631,14 +619,15 @@ void tst_QHash::find()
QCOMPARE(map1.find(1).value(), QLatin1String("Mayer"));
QCOMPARE(map1.find(2).value(), QLatin1String("Hej"));
- for(i = 3; i < 10; ++i) {
+ QMultiHash<int, QString> multiMap(map1);
+ for (i = 3; i < 10; ++i) {
compareString = testString.arg(i);
- map1.insertMulti(4, compareString);
+ multiMap.insert(4, compareString);
}
- QHash<int, QString>::const_iterator it=map1.constFind(4);
+ auto it = multiMap.constFind(4);
- for(i = 9; i > 2 && it != map1.constEnd() && it.key() == 4; --i) {
+ for (i = 9; i > 2 && it != multiMap.constEnd() && it.key() == 4; --i) {
compareString = testString.arg(i);
QVERIFY(it.value() == compareString);
++it;
@@ -664,14 +653,15 @@ void tst_QHash::constFind()
QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer"));
QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej"));
- for(i = 3; i < 10; ++i) {
+ QMultiHash<int, QString> multiMap(map1);
+ for (i = 3; i < 10; ++i) {
compareString = testString.arg(i);
- map1.insertMulti(4, compareString);
+ multiMap.insert(4, compareString);
}
- QHash<int, QString>::const_iterator it=map1.constFind(4);
+ auto it = multiMap.constFind(4);
- for(i = 9; i > 2 && it != map1.constEnd() && it.key() == 4; --i) {
+ for (i = 9; i > 2 && it != multiMap.constEnd() && it.key() == 4; --i) {
compareString = testString.arg(i);
QVERIFY(it.value() == compareString);
++it;
@@ -689,9 +679,9 @@ void tst_QHash::contains()
map1.insert(1, "one");
QVERIFY(map1.contains(1));
- for(i=2; i < 100; ++i)
+ for (i=2; i < 100; ++i)
map1.insert(i, "teststring");
- for(i=99; i > 1; --i)
+ for (i=99; i > 1; --i)
QVERIFY(map1.contains(i));
map1.remove(43);
@@ -855,33 +845,33 @@ void tst_QHash::operator_eq()
// regardless of insertion or iteration order
{
- QHash<int, int> a;
- QHash<int, int> b;
+ QMultiHash<int, int> a;
+ QMultiHash<int, int> b;
- a.insertMulti(0, 0);
- a.insertMulti(0, 1);
+ a.insert(0, 0);
+ a.insert(0, 1);
- b.insertMulti(0, 1);
- b.insertMulti(0, 0);
+ b.insert(0, 1);
+ b.insert(0, 0);
QVERIFY(a == b);
QVERIFY(!(a != b));
}
{
- QHash<int, int> a;
- QHash<int, int> b;
+ QMultiHash<int, int> a;
+ QMultiHash<int, int> b;
enum { Count = 100 };
for (int key = 0; key < Count; ++key) {
for (int value = 0; value < Count; ++value)
- a.insertMulti(key, value);
+ a.insert(key, value);
}
for (int key = Count - 1; key >= 0; --key) {
for (int value = 0; value < Count; ++value)
- b.insertMulti(key, value);
+ b.insert(key, value);
}
QVERIFY(a == b);
@@ -889,8 +879,8 @@ void tst_QHash::operator_eq()
}
{
- QHash<int, int> a;
- QHash<int, int> b;
+ QMultiHash<int, int> a;
+ QMultiHash<int, int> b;
enum {
Count = 100,
@@ -900,7 +890,7 @@ void tst_QHash::operator_eq()
for (int key = 0; key < Count; ++key) {
for (int value = 0; value < Count; ++value)
- a.insertMulti(key, value);
+ a.insert(key, value);
}
// Generates two permutations of [0, Count) for the keys and values,
@@ -909,7 +899,7 @@ void tst_QHash::operator_eq()
for (int k = 0; k < Count; ++k) {
const int key = (k * KeyStep) % Count;
for (int v = 0; v < Count; ++v)
- b.insertMulti(key, (v * ValueStep) % Count);
+ b.insert(key, (v * ValueStep) % Count);
}
QVERIFY(a == b);
@@ -923,10 +913,10 @@ void tst_QHash::compare()
QString testString = "Teststring %1";
int i;
- for(i = 0; i < 1000; ++i)
+ for (i = 0; i < 1000; ++i)
hash1.insert(i,testString.arg(i));
- for(--i; i >= 0; --i)
+ for (--i; i >= 0; --i)
hash2.insert(i,testString.arg(i));
hash1.squeeze();
@@ -947,39 +937,39 @@ void tst_QHash::compare()
void tst_QHash::compare2()
{
- QHash<int, int> a;
- QHash<int, int> b;
+ QMultiHash<int, int> a;
+ QMultiHash<int, int> b;
- a.insertMulti(17, 1);
- a.insertMulti(17 * 2, 1);
- b.insertMulti(17 * 2, 1);
- b.insertMulti(17, 1);
+ a.insert(17, 1);
+ a.insert(17 * 2, 1);
+ b.insert(17 * 2, 1);
+ b.insert(17, 1);
QVERIFY(a == b);
QVERIFY(b == a);
- a.insertMulti(17, 2);
- a.insertMulti(17 * 2, 3);
- b.insertMulti(17 * 2, 3);
- b.insertMulti(17, 2);
+ a.insert(17, 2);
+ a.insert(17 * 2, 3);
+ b.insert(17 * 2, 3);
+ b.insert(17, 2);
QVERIFY(a == b);
QVERIFY(b == a);
- a.insertMulti(17, 4);
- a.insertMulti(17 * 2, 5);
- b.insertMulti(17 * 2, 4);
- b.insertMulti(17, 5);
+ a.insert(17, 4);
+ a.insert(17 * 2, 5);
+ b.insert(17 * 2, 4);
+ b.insert(17, 5);
QVERIFY(!(a == b));
QVERIFY(!(b == a));
a.clear();
b.clear();
- a.insertMulti(1, 1);
- a.insertMulti(1, 2);
- a.insertMulti(1, 3);
- b.insertMulti(1, 1);
- b.insertMulti(1, 2);
- b.insertMulti(1, 3);
- b.insertMulti(1, 4);
+ a.insert(1, 1);
+ a.insert(1, 2);
+ a.insert(1, 3);
+ b.insert(1, 1);
+ b.insert(1, 2);
+ b.insert(1, 3);
+ b.insert(1, 4);
QVERIFY(!(a == b));
QVERIFY(!(b == a));
}
@@ -993,7 +983,7 @@ void tst_QHash::iterators()
QString testString1;
int i;
- for(i = 1; i < 100; ++i)
+ for (i = 1; i < 100; ++i)
hash.insert(i, testString.arg(i));
//to get some chaos in the hash
@@ -1010,18 +1000,13 @@ void tst_QHash::iterators()
QVERIFY(stlIt.value() == testMap.value(1));
- stlIt+=5;
+ for (int i = 0; i < 5; ++i)
+ ++stlIt;
QVERIFY(stlIt.value() == testMap.value(6));
stlIt++;
QVERIFY(stlIt.value() == testMap.value(7));
- stlIt-=3;
- QVERIFY(stlIt.value() == testMap.value(4));
-
- stlIt--;
- QVERIFY(stlIt.value() == testMap.value(3));
-
testMap.clear();
//STL-Style const-iterators
@@ -1035,18 +1020,13 @@ void tst_QHash::iterators()
QVERIFY(cstlIt.value() == testMap.value(1));
- cstlIt+=5;
+ for (int i = 0; i < 5; ++i)
+ ++cstlIt;
QVERIFY(cstlIt.value() == testMap.value(6));
cstlIt++;
QVERIFY(cstlIt.value() == testMap.value(7));
- cstlIt-=3;
- QVERIFY(cstlIt.value() == testMap.value(4));
-
- cstlIt--;
- QVERIFY(cstlIt.value() == testMap.value(3));
-
testMap.clear();
//Java-Style iterators
@@ -1068,14 +1048,7 @@ void tst_QHash::iterators()
QVERIFY(javaIt.value() == testMap.value(i));
}
- ++i;
- while(javaIt.hasPrevious()) {
- --i;
- javaIt.previous();
- QVERIFY(javaIt.value() == testMap.value(i));
- }
-
- //peekNext() peekPrevious()
+ //peekNext()
javaIt.toFront();
javaIt.next();
while(javaIt.hasNext()) {
@@ -1083,14 +1056,6 @@ void tst_QHash::iterators()
testString1 = javaIt.peekNext().value();
javaIt.next();
QVERIFY(javaIt.value() == testString1);
- QCOMPARE(javaIt.peekPrevious().value(), testString1);
- }
- while(javaIt.hasPrevious()) {
- testString = javaIt.value();
- testString1 = javaIt.peekPrevious().value();
- javaIt.previous();
- QVERIFY(javaIt.value() == testString1);
- QCOMPARE(javaIt.peekNext().value(), testString1);
}
}
@@ -1115,9 +1080,15 @@ void tst_QHash::keyIterator()
QVERIFY(key_it != hash.keyEnd());
QCOMPARE(*key_it, it.key());
QCOMPARE(*(key_it++), (it++).key());
- QCOMPARE(*(key_it--), (it--).key());
- QCOMPARE(*(++key_it), (++it).key());
- QCOMPARE(*(--key_it), (--it).key());
+ if (key_it != hash.keyEnd()) {
+ QVERIFY(it != hash.end());
+ ++key_it;
+ ++it;
+ if (key_it != hash.keyEnd())
+ QCOMPARE(*key_it, it.key());
+ else
+ QVERIFY(it == hash.end());
+ }
QCOMPARE(std::count(hash.keyBegin(), hash.keyEnd(), 99), 1);
@@ -1162,19 +1133,11 @@ void tst_QHash::keyValueIterator()
++it;
++key_value_it;
- QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
-
- --it;
- --key_value_it;
- QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
-
- ++it;
- ++key_value_it;
- QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+ if (it != hash.end())
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+ else
+ QVERIFY(key_value_it == hash.constKeyValueEnd());
- --it;
- --key_value_it;
- QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
key = 99;
value = 99 * 100;
QCOMPARE(std::count(hash.constKeyValueBegin(), hash.constKeyValueEnd(), entry_type(key, value)), 1);
@@ -1184,9 +1147,9 @@ void tst_QHash::rehash_isnt_quadratic()
{
// this test should be incredibly slow if rehash() is quadratic
for (int j = 0; j < 5; ++j) {
- QHash<int, int> testHash;
+ QMultiHash<int, int> testHash;
for (int i = 0; i < 500000; ++i)
- testHash.insertMulti(1, 1);
+ testHash.insert(1, 1);
}
}
@@ -1330,27 +1293,27 @@ QList<T> sorted(const QList<T> &list)
void tst_QHash::keys_values_uniqueKeys()
{
- QHash<QString, int> hash;
+ QMultiHash<QString, int> hash;
QVERIFY(hash.uniqueKeys().isEmpty());
QVERIFY(hash.keys().isEmpty());
QVERIFY(hash.values().isEmpty());
- hash.insertMulti("alpha", 1);
+ hash.insert("alpha", 1);
QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha"));
QVERIFY(hash.keys() == hash.uniqueKeys());
QVERIFY(hash.values() == (QList<int>() << 1));
- hash.insertMulti("beta", -2);
+ hash.insert("beta", -2);
QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "beta"));
QVERIFY(hash.keys() == hash.uniqueKeys());
QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 1 << -2));
- hash.insertMulti("alpha", 2);
+ hash.insert("alpha", 2);
QVERIFY(sorted(hash.uniqueKeys()) == (QList<QString>() << "alpha" << "beta"));
QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "alpha" << "beta"));
QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 2 << 1 << -2));
- hash.insertMulti("beta", 4);
+ hash.insert("beta", 4);
QVERIFY(sorted(hash.uniqueKeys()) == (QList<QString>() << "alpha" << "beta"));
QVERIFY(sorted(hash.keys()) == (QList<QString>() << "alpha" << "alpha" << "beta" << "beta"));
QVERIFY(sorted(hash.values()) == sorted(QList<int>() << 2 << 1 << 4 << -2));
@@ -1373,13 +1336,6 @@ void tst_QHash::noNeedlessRehashes()
void tst_QHash::const_shared_null()
{
QHash<int, QString> hash2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QHash<int, QString> hash1;
- hash1.setSharable(false);
- QVERIFY(hash1.isDetached());
-
- hash2.setSharable(true);
-#endif
QVERIFY(!hash2.isDetached());
}
@@ -1511,14 +1467,14 @@ void tst_QHash::initializerList()
void tst_QHash::eraseValidIteratorOnSharedHash()
{
- QHash<int, int> a, b;
+ QMultiHash<int, int> a, b;
a.insert(10, 10);
- a.insertMulti(10, 25);
- a.insertMulti(10, 30);
+ a.insert(10, 25);
+ a.insert(10, 30);
a.insert(20, 20);
a.insert(40, 40);
- QHash<int, int>::iterator i = a.begin();
+ auto i = a.begin();
while (i.value() != 25)
++i;
@@ -1540,7 +1496,7 @@ void tst_QHash::eraseValidIteratorOnSharedHash()
void tst_QHash::equal_range()
{
- QHash<int, QString> hash;
+ QMultiHash<int, QString> hash;
auto result = hash.equal_range(0);
QCOMPARE(result.first, hash.end());
@@ -1553,7 +1509,7 @@ void tst_QHash::equal_range()
QCOMPARE(result.first, hash.find(1));
QVERIFY(std::distance(result.first, result.second) == 1);
- QHash<int, int> h1;
+ QMultiHash<int, int> h1;
{
auto p = h1.equal_range(0);
QVERIFY(p.first == p.second);
@@ -1604,7 +1560,7 @@ void tst_QHash::equal_range()
QVERIFY(p2.first == m1.begin() || p2.second == m1.end());
}
- const QHash<int, int> ch1 = h1;
+ const QMultiHash<int, int> ch1 = h1;
{
auto p1 = ch1.equal_range(9);
QVERIFY(p1.first == p1.second);
@@ -1630,10 +1586,10 @@ void tst_QHash::equal_range()
QVERIFY(p2.first == cm1.cbegin() || p2.second == cm1.cend());
}
- QHash<int, int> h2;
+ QMultiHash<int, int> h2;
for (int i = 0; i < 8; ++i)
for (int j = 0; j < 8; ++j)
- h2.insertMulti(i, i*j);
+ h2.insert(i, i*j);
for (int i = 0; i < 8; ++i) {
auto pair = h2.equal_range(i);
@@ -1699,21 +1655,6 @@ void tst_QHash::insert_hash()
QCOMPARE(hash[2], 5);
QCOMPARE(hash[7], 55);
}
- {
- // This will use a QMultiHash and then insert that into QHash,
- // the ordering is undefined so we won't test that but make
- // sure this isn't adding multiple entries with the same key
- // to the QHash.
- QHash<int, int> hash;
- QMultiHash<int, int> hash2;
- hash2.insert(0, 5);
- hash2.insert(0, 6);
- hash2.insert(0, 7);
-
- hash.insert(hash2);
-
- QCOMPARE(hash.count(), 1);
- }
}
QTEST_APPLESS_MAIN(tst_QHash)
diff --git a/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro b/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro
deleted file mode 100644
index 715e9bf0c9..0000000000
--- a/tests/auto/corelib/tools/qhash_strictiterators/qhash_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qhash/qhash.pro)
-TARGET = tst_qhash_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QHash=tst_QHash_StrictIterators
diff --git a/tests/auto/corelib/tools/qhashfunctions/CMakeLists.txt b/tests/auto/corelib/tools/qhashfunctions/CMakeLists.txt
new file mode 100644
index 0000000000..87d109f997
--- /dev/null
+++ b/tests/auto/corelib/tools/qhashfunctions/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qhashfunctions.pro.
+
+#####################################################################
+## tst_qhashfunctions Test:
+#####################################################################
+
+add_qt_test(tst_qhashfunctions
+ SOURCES
+ tst_qhashfunctions.cpp
+)
diff --git a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro
deleted file mode 100644
index c53d553d6d..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qlinkedlist
-QT = core testlib
-qtConfig(c++14): CONFIG += c++14
-qtConfig(c++1z): CONFIG += c++1z
-SOURCES = tst_qlinkedlist.cpp
-DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
deleted file mode 100644
index df42b5dea9..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ /dev/null
@@ -1,1133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QLinkedList>
-
-struct Movable
-{
- Movable(char input = 'j') : i(input), state(Constructed)
- {
- ++liveCount;
- }
- Movable(const Movable &other)
- : i(other.i)
- , state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Movable()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- Movable &operator=(const Movable &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- State state;
-
- static void check(const State state1, const State state2)
- {
- QCOMPARE(int(state1), int(state2));
- }
-};
-
-int Movable::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Movable);
-
-Q_DECLARE_METATYPE(QLinkedList<int>);
-
-
-int qHash(const Movable& movable)
-{
- return qHash(movable.i);
-}
-
-struct Complex
-{
- Complex(int val = 0)
- : value(val)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex(Complex const &other)
- : value(other.value)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex &operator=(Complex const &other)
- {
- check(); other.check();
-
- value = other.value;
- return *this;
- }
-
- ~Complex()
- {
- --liveCount;
- check();
- }
-
- operator int() const { return value; }
-
- bool operator==(Complex const &other) const
- {
- check(); other.check();
- return value == other.value;
- }
-
- void check() const
- {
- QVERIFY(this == checkSum);
- }
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- int value;
- void *checkSum;
-};
-
-int Complex::liveCount = 0;
-
-Q_DECLARE_METATYPE(Complex);
-
-// Tests depend on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isComplex);
-
-class tst_QLinkedList : public QObject
-{
- Q_OBJECT
-private slots:
- void eraseValidIteratorsOnSharedList() const;
- void insertWithIteratorsOnSharedList() const;
- void lengthInt() const;
- void lengthMovable() const;
- void lengthComplex() const;
- void lengthSignature() const;
- void firstInt() const;
- void firstMovable() const;
- void firstComplex() const;
- void lastInt() const;
- void lastMovable() const;
- void lastComplex() const;
- void beginInt() const;
- void beginMovable() const;
- void beginComplex() const;
- void endInt() const;
- void endMovable() const;
- void endComplex() const;
- void containsInt() const;
- void containsMovable() const;
- void containsComplex() const;
- void countInt() const;
- void countMovable() const;
- void countComplex() const;
- void cpp17ctad() const;
- void emptyInt() const;
- void emptyMovable() const;
- void emptyComplex() const;
- void endsWithInt() const;
- void endsWithMovable() const;
- void endsWithComplex() const;
- void removeAllInt() const;
- void removeAllMovable() const;
- void removeAllComplex() const;
- void removeOneInt() const;
- void removeOneMovable() const;
- void removeOneComplex() const;
- void reverseIterators() const;
- void startsWithInt() const;
- void startsWithMovable() const;
- void startsWithComplex() const;
- void takeFirstInt() const;
- void takeFirstMovable() const;
- void takeFirstComplex() const;
- void takeLastInt() const;
- void takeLastMovable() const;
- void takeLastComplex() const;
- void toStdListInt() const;
- void toStdListMovable() const;
- void toStdListComplex() const;
- void testOperatorsInt() const;
- void testOperatorsMovable() const;
- void testOperatorsComplex() const;
- void testSTLIteratorsInt() const;
- void testSTLIteratorsMovable() const;
- void testSTLIteratorsComplex() const;
-
- void initializeList() const;
-
- void constSharedNullInt() const;
- void constSharedNullMovable() const;
- void constSharedNullComplex() const;
-
- void setSharableInt() const;
-private:
- template<typename T> void length() const;
- template<typename T> void first() const;
- template<typename T> void last() const;
- template<typename T> void begin() const;
- template<typename T> void end() const;
- template<typename T> void contains() const;
- template<typename T> void count() const;
- template<typename T> void empty() const;
- template<typename T> void endsWith() const;
- template<typename T> void move() const;
- template<typename T> void removeAll() const;
- template<typename T> void removeOne() const;
- template<typename T> void startsWith() const;
- template<typename T> void swap() const;
- template<typename T> void takeFirst() const;
- template<typename T> void takeLast() const;
- template<typename T> void toStdList() const;
- template<typename T> void value() const;
-
- template<typename T> void testOperators() const;
- template<typename T> void testSTLIterators() const;
-
- template<typename T> void constSharedNull() const;
-
- int dummyForGuard;
-};
-
-template<typename T> struct SimpleValue
-{
- static T at(int index)
- {
- return values[index % maxSize];
- }
- static const uint maxSize = 7;
- static const T values[maxSize];
-};
-
-template<>
-const int SimpleValue<int>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Movable SimpleValue<Movable>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Complex SimpleValue<Complex>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-
-// Make some macros for the tests to use in order to be slightly more readable...
-#define T_FOO SimpleValue<T>::at(0)
-#define T_BAR SimpleValue<T>::at(1)
-#define T_BAZ SimpleValue<T>::at(2)
-#define T_CAT SimpleValue<T>::at(3)
-#define T_DOG SimpleValue<T>::at(4)
-#define T_BLAH SimpleValue<T>::at(5)
-#define T_WEEE SimpleValue<T>::at(6)
-
-template<typename T>
-void tst_QLinkedList::length() const
-{
- /* Empty list. */
- {
- const QLinkedList<T> list;
- QCOMPARE(list.size(), 0);
- }
-
- /* One entry. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- QCOMPARE(list.size(), 1);
- }
-
- /* Two entries. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- QCOMPARE(list.size(), 2);
- }
-
- /* Three entries. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- list.append(T_BAZ);
- QCOMPARE(list.size(), 3);
- }
-}
-
-void tst_QLinkedList::eraseValidIteratorsOnSharedList() const
-{
- QLinkedList<int> a, b;
- a.append(5);
- a.append(10);
- a.append(20);
- a.append(20);
- a.append(20);
- a.append(20);
- a.append(30);
-
- QLinkedList<int>::iterator i = a.begin();
- ++i;
- ++i;
- ++i;
- b = a;
- QLinkedList<int>::iterator r = a.erase(i);
- QCOMPARE(b.size(), 7);
- QCOMPARE(a.size(), 6);
- --r;
- --r;
- QCOMPARE(*r, 10); // Ensure that number 2 instance was removed;
-}
-
-void tst_QLinkedList::insertWithIteratorsOnSharedList() const
-{
- QLinkedList<int> a, b;
- a.append(5);
- a.append(10);
- a.append(20);
- QLinkedList<int>::iterator i = a.begin();
- ++i;
- ++i;
- b = a;
-
- QLinkedList<int>::iterator i2 = a.insert(i, 15);
- QCOMPARE(b.size(), 3);
- QCOMPARE(a.size(), 4);
- --i2;
- QCOMPARE(*i2, 10);
-}
-
-void tst_QLinkedList::lengthInt() const
-{
- length<int>();
-}
-
-void tst_QLinkedList::lengthMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- length<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::lengthComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- length<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::lengthSignature() const
-{
- /* Constness. */
- {
- const QLinkedList<int> list;
- /* The function should be const. */
- list.size();
- }
-}
-
-template<typename T>
-void tst_QLinkedList::first() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.first(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.first(), T_BAR);
-}
-
-void tst_QLinkedList::firstInt() const
-{
- first<int>();
-}
-
-void tst_QLinkedList::firstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- first<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::firstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- first<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::last() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.last(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.last(), T_FOO);
-}
-
-void tst_QLinkedList::lastInt() const
-{
- last<int>();
-}
-
-void tst_QLinkedList::lastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- last<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::lastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- last<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::begin() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*list.begin(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(*list.begin(), T_BAR);
-}
-
-void tst_QLinkedList::beginInt() const
-{
- begin<int>();
-}
-
-void tst_QLinkedList::beginMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- begin<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::beginComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- begin<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::end() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*--list.end(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(*--list.end(), T_FOO);
-}
-
-void tst_QLinkedList::endInt() const
-{
- end<int>();
-}
-
-void tst_QLinkedList::endMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- end<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::endComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- end<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::contains() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QVERIFY(list.contains(T_FOO));
- QVERIFY(list.contains(T_BLAH) != true);
-
- // add it and make sure it matches
- list.append(T_BLAH);
- QVERIFY(list.contains(T_BLAH));
-}
-
-void tst_QLinkedList::containsInt() const
-{
- contains<int>();
-}
-
-void tst_QLinkedList::containsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- contains<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::containsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- contains<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::count() const
-{
- QLinkedList<T> list;
-
- // starts empty
- QVERIFY(list.count() == 0);
-
- // goes up
- list.append(T_FOO);
- QVERIFY(list.count() == 1);
-
- // and up
- list.append(T_BAR);
- QVERIFY(list.count() == 2);
-
- // and down
- list.pop_back();
- QVERIFY(list.count() == 1);
-
- // and empty. :)
- list.pop_back();
- QVERIFY(list.count() == 0);
-}
-
-void tst_QLinkedList::countInt() const
-{
- count<int>();
-}
-
-void tst_QLinkedList::countMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- count<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::countComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- count<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::cpp17ctad() const
-{
-#ifdef __cpp_deduction_guides
-#define QVERIFY_IS_LIST_OF(obj, Type) \
- QVERIFY2((std::is_same<decltype(obj), QLinkedList<Type>>::value), \
- QMetaType::typeName(qMetaTypeId<decltype(obj)::value_type>()))
-#define CHECK(Type, One, Two, Three) \
- do { \
- const Type v[] = {One, Two, Three}; \
- QLinkedList v1 = {One, Two, Three}; \
- QVERIFY_IS_LIST_OF(v1, Type); \
- QLinkedList v2(v1.begin(), v1.end()); \
- QVERIFY_IS_LIST_OF(v2, Type); \
- QLinkedList v3(std::begin(v), std::end(v)); \
- QVERIFY_IS_LIST_OF(v3, Type); \
- } while (false) \
- /*end*/
- CHECK(int, 1, 2, 3);
- CHECK(double, 1.0, 2.0, 3.0);
- CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three"));
-#undef QVERIFY_IS_LIST_OF
-#undef CHECK
-#else
- QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler.");
-#endif
-}
-
-template<typename T>
-void tst_QLinkedList::empty() const
-{
- QLinkedList<T> list;
-
- // make sure it starts empty
- QVERIFY(list.empty());
-
- // and doesn't stay empty
- list.append(T_FOO);
- QVERIFY(!list.empty());
-
- // and goes back to being empty
- list.pop_back();
- QVERIFY(list.empty());
-}
-
-void tst_QLinkedList::emptyInt() const
-{
- empty<int>();
-}
-
-void tst_QLinkedList::emptyMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- empty<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::emptyComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- empty<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::endsWith() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test it returns correctly in both cases
- QVERIFY(list.endsWith(T_BAZ));
- QVERIFY(!list.endsWith(T_BAR));
-
- // remove an item and make sure the end item changes
- list.pop_back();
- QVERIFY(list.endsWith(T_BAR));
-}
-
-void tst_QLinkedList::endsWithInt() const
-{
- endsWith<int>();
-}
-
-void tst_QLinkedList::endsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- endsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::endsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- endsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::removeAll() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // remove one instance
- list.removeAll(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ);
-
- // many instances
- list << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ;
- list.removeAll(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-
- // try remove something that doesn't exist
- list.removeAll(T_WEEE);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-}
-
-void tst_QLinkedList::removeAllInt() const
-{
- removeAll<int>();
-}
-
-void tst_QLinkedList::removeAllMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAll<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::removeAllComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAll<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::removeOne() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeOne(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeOne(T_FOO);
- QCOMPARE(list, QLinkedList<T>() << T_BAZ);
-
- // last
- list.removeOne(T_BAZ);
- QCOMPARE(list, QLinkedList<T>());
-
- // make sure it really only removes one :)
- list << T_FOO << T_FOO;
- list.removeOne(T_FOO);
- QCOMPARE(list, QLinkedList<T>() << T_FOO);
-
- // try remove something that doesn't exist
- list.removeOne(T_WEEE);
- QCOMPARE(list, QLinkedList<T>() << T_FOO);
-}
-
-void tst_QLinkedList::removeOneInt() const
-{
- removeOne<int>();
-}
-
-void tst_QLinkedList::removeOneMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeOne<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::removeOneComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeOne<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::reverseIterators() const
-{
- QLinkedList<int> l;
- l << 1 << 2 << 3 << 4;
- QLinkedList<int> lr = l;
- std::reverse(lr.begin(), lr.end());
- const QLinkedList<int> &clr = lr;
- QVERIFY(std::equal(l.begin(), l.end(), lr.rbegin()));
- QVERIFY(std::equal(l.begin(), l.end(), lr.crbegin()));
- QVERIFY(std::equal(l.begin(), l.end(), clr.rbegin()));
- QVERIFY(std::equal(lr.rbegin(), lr.rend(), l.begin()));
- QVERIFY(std::equal(lr.crbegin(), lr.crend(), l.begin()));
- QVERIFY(std::equal(clr.rbegin(), clr.rend(), l.begin()));
-}
-
-template<typename T>
-void tst_QLinkedList::startsWith() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // make sure it starts ok
- QVERIFY(list.startsWith(T_FOO));
-
- // remove an item
- list.removeFirst();
- QVERIFY(list.startsWith(T_BAR));
-}
-
-void tst_QLinkedList::startsWithInt() const
-{
- startsWith<int>();
-}
-
-void tst_QLinkedList::startsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- startsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::startsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- startsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::takeFirst() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeFirst(), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeFirst(), T_BAR);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeFirst(), T_BAZ);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QLinkedList::takeFirstInt() const
-{
- takeFirst<int>();
-}
-
-void tst_QLinkedList::takeFirstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeFirst<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::takeFirstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeFirst<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::takeLast() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeLast(), T_BAZ);
- QCOMPARE(list.takeLast(), T_BAR);
- QCOMPARE(list.takeLast(), T_FOO);
-}
-
-void tst_QLinkedList::takeLastInt() const
-{
- takeLast<int>();
-}
-
-void tst_QLinkedList::takeLastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeLast<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::takeLastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeLast<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::toStdList() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // yuck.
- std::list<T> slist;
- slist.push_back(T_FOO);
- slist.push_back(T_BAR);
- slist.push_back(T_BAZ);
-
- QCOMPARE(list.toStdList(), slist);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QLinkedList::toStdListInt() const
-{
- toStdList<int>();
-}
-
-void tst_QLinkedList::toStdListMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toStdList<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::toStdListComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toStdList<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::testOperators() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QLinkedList<T> listtwo;
- listtwo << T_FOO << T_BAR << T_BAZ;
-
- // test equal
- QVERIFY(list == listtwo);
-
- // not equal
- listtwo.append(T_CAT);
- QVERIFY(list != listtwo);
-
- // +=
- list += listtwo;
- QVERIFY(list.size() == 7);
- QVERIFY(listtwo.size() == 4);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // =
- list = listtwo;
- QCOMPARE(list, listtwo);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ << T_CAT);
-}
-
-void tst_QLinkedList::testOperatorsInt() const
-{
- testOperators<int>();
-}
-
-void tst_QLinkedList::testOperatorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testOperators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::testOperatorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testOperators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::testSTLIterators() const
-{
- QLinkedList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- typename QLinkedList<T>::iterator it = list.begin();
- QCOMPARE(*it, T_FOO); it++;
- QCOMPARE(*it, T_BAR); it++;
- QCOMPARE(*it, T_BAZ); it++;
- QCOMPARE(it, list.end()); it--;
-
- // walk backwards
- QCOMPARE(*it, T_BAZ); it--;
- QCOMPARE(*it, T_BAR); it--;
- QCOMPARE(*it, T_FOO);
-
- // test erase
- it = list.erase(it);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it, T_BAR);
-
- // test multiple erase
- it = list.erase(it, it + 2);
- QVERIFY(list.size() == 0);
- QCOMPARE(it, list.end());
-
- // insert again
- it = list.insert(it, T_FOO);
- QVERIFY(list.size() == 1);
- QCOMPARE(*it, T_FOO);
-
- // insert again
- it = list.insert(it, T_BAR);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it++, T_BAR);
- QCOMPARE(*it, T_FOO);
-}
-
-void tst_QLinkedList::testSTLIteratorsInt() const
-{
- testSTLIterators<int>();
-}
-
-void tst_QLinkedList::testSTLIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testSTLIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::testSTLIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testSTLIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::initializeList() const
-{
- QLinkedList<int> v1 { 2, 3, 4 };
- QCOMPARE(v1, QLinkedList<int>() << 2 << 3 << 4);
- QCOMPARE(v1, (QLinkedList<int> { 2, 3, 4}));
-
- QLinkedList<QLinkedList<int>> v2{ v1, { 1 }, QLinkedList<int>(), { 2, 3, 4 } };
- QLinkedList<QLinkedList<int>> v3;
- v3 << v1 << (QLinkedList<int>() << 1) << QLinkedList<int>() << v1;
- QCOMPARE(v3, v2);
-}
-
-
-template<typename T>
-void tst_QLinkedList::constSharedNull() const
-{
- QLinkedList<T> list2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QLinkedList<T> list1;
- list1.setSharable(false);
- QVERIFY(list1.isDetached());
-
- list2.setSharable(true);
-#endif
- QVERIFY(!list2.isDetached());
-}
-
-void tst_QLinkedList::constSharedNullInt() const
-{
- constSharedNull<int>();
-}
-
-void tst_QLinkedList::constSharedNullMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- constSharedNull<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::constSharedNullComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- constSharedNull<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-
-void tst_QLinkedList::setSharableInt() const
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QLinkedList<int> orglist;
- orglist << 0 << 1 << 2 << 3 << 4 << 5;
- int size = 6;
-
- QLinkedList<int> list;
- list = orglist;
-
- QVERIFY(!list.isDetached());
- list.setSharable(true);
-
- QCOMPARE(list.size(), size);
-
- {
- QLinkedList<int> copy(list);
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- list.setSharable(false);
- QVERIFY(list.isDetached() || list.isSharedWith(QLinkedList<int>()));
-
- {
- QLinkedList<int> copy(list);
-
- QVERIFY(copy.isDetached() || copy.isSharedWith(QLinkedList<int>()));
- QCOMPARE(copy.size(), size);
- QCOMPARE(copy, list);
- }
-
- list.setSharable(true);
-
- {
- QLinkedList<int> copy(list);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- QLinkedList<int>::const_iterator it = list.constBegin();
- for (int i = 0; i < list.size(); ++i) {
- QCOMPARE(int(*it), i);
- ++it;
- }
-
- QCOMPARE(list.size(), size);
-#endif
-}
-
-QTEST_APPLESS_MAIN(tst_QLinkedList)
-#include "tst_qlinkedlist.moc"
diff --git a/tests/auto/corelib/tools/qlist/.gitignore b/tests/auto/corelib/tools/qlist/.gitignore
deleted file mode 100644
index df208b6e78..0000000000
--- a/tests/auto/corelib/tools/qlist/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qlist
diff --git a/tests/auto/corelib/tools/qlist/qlist.pro b/tests/auto/corelib/tools/qlist/qlist.pro
deleted file mode 100644
index 118c607880..0000000000
--- a/tests/auto/corelib/tools/qlist/qlist.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qlist
-QT = core testlib
-qtConfig(c++14): CONFIG += c++14
-qtConfig(c++1z): CONFIG += c++1z
-SOURCES = $$PWD/tst_qlist.cpp
diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp
deleted file mode 100644
index cc9a3a16d1..0000000000
--- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp
+++ /dev/null
@@ -1,2115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QList>
-
-template <typename T, class MemoryLayout>
-class is_qlist_array_memory_layout {
- struct No { char c; };
- struct Yes { No n[2]; };
- Q_STATIC_ASSERT(sizeof(No) != sizeof(Yes));
- static No check(...);
- static Yes check(MemoryLayout);
-public:
- enum { value = sizeof(check(typename QList<T>::MemoryLayout())) == sizeof(Yes) };
-};
-
-struct Movable {
- Movable(char input = 'j')
- : i(input)
- , state(Constructed)
- {
- ++liveCount;
- }
- Movable(const Movable &other)
- : i(other.i)
- , state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Movable()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- bool operator<(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i < other.i;
- }
-
- Movable &operator=(const Movable &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- uchar state;
-
- static void check(const uchar state1, const uchar state2)
- {
- QCOMPARE(state1, state2);
- }
-};
-
-Q_STATIC_ASSERT(sizeof(Movable) < sizeof(void*));
-
-int Movable::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Movable);
-
-int qHash(const Movable& movable)
-{
- return qHash(movable.i);
-}
-
-struct Optimal
-{
- Optimal(char input = 'j')
- : i(input),
- state(Constructed)
- {
- ++liveCount;
- }
- Optimal(const Optimal &other)
- : i(other.i),
- state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Optimal()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Optimal &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- bool operator<(const Optimal &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i < other.i;
- }
-
- Optimal &operator=(const Optimal &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- uchar state;
- char padding[sizeof(void*) - 2];
-
- static void check(const uchar state1, const uchar state2)
- {
- QCOMPARE(state1, state2);
- }
-};
-
-Q_STATIC_ASSERT(sizeof(Optimal) == sizeof(void*));
-
-int Optimal::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Optimal, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Optimal);
-
-int qHash(const Optimal& key)
-{
- return qHash(key.i);
-}
-
-struct Complex
-{
- Complex(int val = 0)
- : value(val)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex(Complex const &other)
- : value(other.value)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex &operator=(Complex const &other)
- {
- check(); other.check();
-
- value = other.value;
- return *this;
- }
-
- ~Complex()
- {
- --liveCount;
- check();
- }
-
- operator int() const { return value; }
-
- bool operator==(Complex const &other) const
- {
- check(); other.check();
- return value == other.value;
- }
-
- bool operator<(Complex const &other) const
- {
- check(); other.check();
- return value < other.value;
- }
-
- void check() const
- {
- QVERIFY(this == checkSum);
- }
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- int value;
- void *checkSum;
-};
-
-int Complex::liveCount = 0;
-
-Q_DECLARE_METATYPE(Complex);
-
-// Tests depend on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Optimal>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Optimal>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isComplex);
-// iow:
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<int, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<int, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Optimal, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Optimal, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Optimal, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Movable, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Movable, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Movable, QListData::IndirectLayout> ::value));
-
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::InlineWithPaddingLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Complex, QListData::NotArrayCompatibleLayout>::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::NotIndirectLayout> ::value));
-Q_STATIC_ASSERT((!is_qlist_array_memory_layout<Complex, QListData::ArrayCompatibleLayout> ::value));
-Q_STATIC_ASSERT(( is_qlist_array_memory_layout<Complex, QListData::IndirectLayout> ::value));
-
-class tst_QList : public QObject
-{
- Q_OBJECT
-
-private slots:
- void lengthOptimal() const;
- void lengthMovable() const;
- void lengthComplex() const;
- void lengthSignature() const;
- void appendOptimal() const;
- void appendMovable() const;
- void appendComplex() const;
- void prepend() const;
- void midOptimal() const;
- void midMovable() const;
- void midComplex() const;
- void atOptimal() const;
- void atMovable() const;
- void atComplex() const;
- void firstOptimal() const;
- void firstMovable() const;
- void firstComplex() const;
- void lastOptimal() const;
- void lastMovable() const;
- void lastComplex() const;
- void constFirst() const;
- void constLast() const;
- void cpp17ctad() const;
- void beginOptimal() const;
- void beginMovable() const;
- void beginComplex() const;
- void endOptimal() const;
- void endMovable() const;
- void endComplex() const;
- void containsOptimal() const;
- void containsMovable() const;
- void containsComplex() const;
- void countOptimal() const;
- void countMovable() const;
- void countComplex() const;
- void emptyOptimal() const;
- void emptyMovable() const;
- void emptyComplex() const;
- void endsWithOptimal() const;
- void endsWithMovable() const;
- void endsWithComplex() const;
- void lastIndexOfOptimal() const;
- void lastIndexOfMovable() const;
- void lastIndexOfComplex() const;
- void moveOptimal() const;
- void moveMovable() const;
- void moveComplex() const;
- void removeAllOptimal() const;
- void removeAllMovable() const;
- void removeAllComplex() const;
- void removeAtOptimal() const;
- void removeAtMovable() const;
- void removeAtComplex() const;
- void removeOneOptimal() const;
- void removeOneMovable() const;
- void removeOneComplex() const;
- void replaceOptimal() const;
- void replaceMovable() const;
- void replaceComplex() const;
- void reverseIteratorsOptimal() const;
- void reverseIteratorsMovable() const;
- void reverseIteratorsComplex() const;
- void startsWithOptimal() const;
- void startsWithMovable() const;
- void startsWithComplex() const;
- void swapOptimal() const;
- void swapMovable() const;
- void swapComplex() const;
- void takeAtOptimal() const;
- void takeAtMovable() const;
- void takeAtComplex() const;
- void takeFirstOptimal() const;
- void takeFirstMovable() const;
- void takeFirstComplex() const;
- void takeLastOptimal() const;
- void takeLastMovable() const;
- void takeLastComplex() const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- void toSetOptimal() const;
- void toSetMovable() const;
- void toSetComplex() const;
- void toStdListOptimal() const;
- void toStdListMovable() const;
- void toStdListComplex() const;
-#endif
- void toVectorOptimal() const;
- void toVectorMovable() const;
- void toVectorComplex() const;
- void valueOptimal() const;
- void valueMovable() const;
- void valueComplex() const;
-
- void testOperatorsOptimal() const;
- void testOperatorsMovable() const;
- void testOperatorsComplex() const;
- void testSTLIteratorsOptimal() const;
- void testSTLIteratorsMovable() const;
- void testSTLIteratorsComplex() const;
-
- void initializeList() const;
-
- void constSharedNullOptimal() const;
- void constSharedNullMovable() const;
- void constSharedNullComplex() const;
- void setSharableInt_data() const;
- void setSharableInt() const;
- void setSharableComplex_data() const;
- void setSharableComplex() const;
- void eraseValidIteratorsOnSharedList() const;
- void insertWithValidIteratorsOnSharedList() const;
-
- void qhashOptimal() const { qhash<Optimal>(); }
- void qhashMovable() const { qhash<Movable>(); }
- void qhashComplex() const { qhash<Complex>(); }
- void reserve() const;
-private:
- template<typename T> void length() const;
- template<typename T> void append() const;
- template<typename T> void mid() const;
- template<typename T> void at() const;
- template<typename T> void first() const;
- template<typename T> void last() const;
- template<typename T> void begin() const;
- template<typename T> void end() const;
- template<typename T> void contains() const;
- template<typename T> void count() const;
- template<typename T> void empty() const;
- template<typename T> void endsWith() const;
- template<typename T> void lastIndexOf() const;
- template<typename T> void move() const;
- template<typename T> void qhash() const;
- template<typename T> void removeAll() const;
- template<typename T> void removeAt() const;
- template<typename T> void removeOne() const;
- template<typename T> void replace() const;
- template<typename T> void reverseIterators() const;
- template<typename T> void startsWith() const;
- template<typename T> void swap() const;
- template<typename T> void takeAt() const;
- template<typename T> void takeFirst() const;
- template<typename T> void takeLast() const;
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- template<typename T> void toSet() const;
- template<typename T> void toStdList() const;
-#endif
- template<typename T> void toVector() const;
- template<typename T> void value() const;
-
- template<typename T> void testOperators() const;
- template<typename T> void testSTLIterators() const;
-
- template<typename T> void constSharedNull() const;
-
- int dummyForGuard;
-};
-
-template<typename T> struct SimpleValue
-{
- static T at(int index)
- {
- return values[index % maxSize];
- }
- static const uint maxSize = 7;
- static const T values[maxSize];
-};
-
-template<>
-const Optimal SimpleValue<Optimal>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Movable SimpleValue<Movable>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Complex SimpleValue<Complex>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-
-// Make some macros for the tests to use in order to be slightly more readable...
-#define T_FOO SimpleValue<T>::at(0)
-#define T_BAR SimpleValue<T>::at(1)
-#define T_BAZ SimpleValue<T>::at(2)
-#define T_CAT SimpleValue<T>::at(3)
-#define T_DOG SimpleValue<T>::at(4)
-#define T_BLAH SimpleValue<T>::at(5)
-#define T_WEEE SimpleValue<T>::at(6)
-
-template<typename T>
-void tst_QList::length() const
-{
- /* Empty list. */
- {
- const QList<T> list;
- QCOMPARE(list.length(), 0);
- }
-
- /* One entry. */
- {
- QList<T> list;
- list.append(T_FOO);
- QCOMPARE(list.length(), 1);
- }
-
- /* Two entries. */
- {
- QList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- QCOMPARE(list.length(), 2);
- }
-
- /* Three entries. */
- {
- QList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- list.append(T_BAZ);
- QCOMPARE(list.length(), 3);
- }
-}
-
-void tst_QList::lengthOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- length<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lengthMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- length<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lengthComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- length<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::lengthSignature() const
-{
- /* Constness. */
- {
- const QList<int> list;
- /* The function should be const. */
- list.length();
- }
-}
-
-template<typename T>
-void tst_QList::append() const
-{
- /* test append(const QList<T> &) function */
- T one(T_FOO);
- T two(T_BAR);
- T three(T_BAZ);
- T four(T_CAT);
- QList<T> list1;
- QList<T> list2;
- QList<T> listTotal;
- list1.append(one);
- list1.append(two);
- list2.append(three);
- list2.append(four);
- list1.append(list2);
- listTotal.append(one);
- listTotal.append(two);
- listTotal.append(three);
- listTotal.append(four);
- QCOMPARE(list1, listTotal);
-}
-
-void tst_QList::appendOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- append<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::appendMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- append<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::appendComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- append<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::prepend() const
-{
- QList<int *> list;
- int *t1 = new int(0);
- list.prepend(t1);
- QVERIFY(list.size() == 1);
- QVERIFY(list.at(0) == t1);
- int *t2 = new int(0);
- list.prepend(t2);
- QVERIFY(list.size() == 2);
- QVERIFY(list.at(0) == t2);
- QVERIFY(list.at(1) == t1);
- int *t3 = new int(0);
- list.prepend(t3);
- QVERIFY(list.size() == 3);
- QVERIFY(list.at(0) == t3);
- QVERIFY(list.at(1) == t2);
- QVERIFY(list.at(2) == t1);
- list.removeAll(t2);
- delete t2;
- QVERIFY(list.size() == 2);
- QVERIFY(list.at(0) == t3);
- QVERIFY(list.at(1) == t1);
- int *t4 = new int(0);
- list.prepend(t4);
- QVERIFY(list.size() == 3);
- QVERIFY(list.at(0) == t4);
- QVERIFY(list.at(1) == t3);
- QVERIFY(list.at(2) == t1);
- qDeleteAll(list);
- list.clear();
-}
-
-template<typename T>
-void tst_QList::mid() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ << T_CAT << T_DOG << T_BLAH << T_WEEE;
-
- QCOMPARE(list.mid(3, 3),
- QList<T>() << T_CAT << T_DOG << T_BLAH);
-
- QList<T> list1;
- QCOMPARE(list1.mid(1, 1).length(), 0);
-}
-
-void tst_QList::midOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- mid<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::midMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- mid<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::midComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- mid<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::at() const
-{
- // test at() and make sure it functions correctly with some simple list manipulation.
- QList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- QVERIFY(list.size() == 3);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAR);
- QCOMPARE(list.at(2), T_BAZ);
-
- // append an item
- list << T_CAT;
- QVERIFY(list.size() == 4);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAR);
- QCOMPARE(list.at(2), T_BAZ);
- QCOMPARE(list.at(3), T_CAT);
-
- // remove an item
- list.removeAt(1);
- QVERIFY(list.size() == 3);
- QCOMPARE(list.at(0), T_FOO);
- QCOMPARE(list.at(1), T_BAZ);
- QCOMPARE(list.at(2), T_CAT);
-}
-
-void tst_QList::atOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- at<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::atMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- at<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::atComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- at<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::first() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.first(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.first(), T_BAR);
-}
-
-void tst_QList::firstOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- first<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::firstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- first<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::firstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- first<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::constFirst() const
-{
- // Based on tst_QVector::constFirst()
- QList<int> list;
- list << 69 << 42 << 3;
-
- // test it starts ok
- QCOMPARE(list.constFirst(), 69);
- QVERIFY(list.isDetached());
-
- QList<int> listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 69);
- QCOMPARE(listCopy.constFirst(), 69);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test removal changes
- list.removeAt(0);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constFirst(), 42);
- QCOMPARE(listCopy.constFirst(), 69);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 42);
- QCOMPARE(listCopy.constFirst(), 42);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test prepend changes
- list.prepend(23);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constFirst(), 23);
- QCOMPARE(listCopy.constFirst(), 42);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constFirst(), 23);
- QCOMPARE(listCopy.constFirst(), 23);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-}
-
-void tst_QList::constLast() const
-{
- // Based on tst_QVector::constLast()
- QList<int> list;
- list << 69 << 42 << 3;
-
- // test it starts ok
- QCOMPARE(list.constLast(), 3);
- QVERIFY(list.isDetached());
-
- QList<int> listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 3);
- QCOMPARE(listCopy.constLast(), 3);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test removal changes
- list.removeLast();
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constLast(), 42);
- QCOMPARE(listCopy.constLast(), 3);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 42);
- QCOMPARE(listCopy.constLast(), 42);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- // test prepend changes
- list.append(23);
- QVERIFY(list.isDetached());
- QVERIFY(!list.isSharedWith(listCopy));
- QCOMPARE(list.constLast(), 23);
- QCOMPARE(listCopy.constLast(), 42);
-
- listCopy = list;
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-
- QCOMPARE(list.constLast(), 23);
- QCOMPARE(listCopy.constLast(), 23);
-
- QVERIFY(!list.isDetached());
- QVERIFY(!listCopy.isDetached());
- QVERIFY(list.isSharedWith(listCopy));
- QVERIFY(listCopy.isSharedWith(list));
-}
-
-void tst_QList::cpp17ctad() const
-{
-#ifdef __cpp_deduction_guides
-#define QVERIFY_IS_LIST_OF(obj, Type) \
- QVERIFY2((std::is_same<decltype(obj), QList<Type>>::value), \
- QMetaType::typeName(qMetaTypeId<decltype(obj)::value_type>()))
-#define CHECK(Type, One, Two, Three) \
- do { \
- const Type v[] = {One, Two, Three}; \
- QList v1 = {One, Two, Three}; \
- QVERIFY_IS_LIST_OF(v1, Type); \
- QList v2(v1.begin(), v1.end()); \
- QVERIFY_IS_LIST_OF(v2, Type); \
- QList v3(std::begin(v), std::end(v)); \
- QVERIFY_IS_LIST_OF(v3, Type); \
- } while (false) \
- /*end*/
- CHECK(int, 1, 2, 3);
- CHECK(double, 1.0, 2.0, 3.0);
- CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three"));
-#undef QVERIFY_IS_LIST_OF
-#undef CHECK
-#else
- QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler.");
-#endif
-}
-
-template<typename T>
-void tst_QList::last() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.last(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.last(), T_FOO);
-}
-
-void tst_QList::lastOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- last<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- last<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- last<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::begin() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*list.begin(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(*list.begin(), T_BAR);
-}
-
-void tst_QList::beginOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- begin<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::beginMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- begin<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::beginComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- begin<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::end() const
-{
- QList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*--list.end(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(*--list.end(), T_FOO);
-}
-
-void tst_QList::endOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- end<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::endMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- end<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::endComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- end<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::contains() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QVERIFY(list.contains(T_FOO));
- QVERIFY(list.contains(T_BLAH) != true);
-
- // add it and make sure it matches
- list.append(T_BLAH);
- QVERIFY(list.contains(T_BLAH));
-}
-
-void tst_QList::containsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- contains<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::containsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- contains<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::containsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- contains<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::count() const
-{
- QList<T> list;
-
- // starts empty
- QVERIFY(list.count() == 0);
-
- // goes up
- list.append(T_FOO);
- QVERIFY(list.count() == 1);
-
- // and up
- list.append(T_BAR);
- QVERIFY(list.count() == 2);
-
- // and down
- list.pop_back();
- QVERIFY(list.count() == 1);
-
- // and empty. :)
- list.pop_back();
- QVERIFY(list.count() == 0);
-}
-
-void tst_QList::countOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- count<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::countMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- count<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::countComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- count<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::empty() const
-{
- QList<T> list;
-
- // make sure it starts empty
- QVERIFY(list.empty());
-
- // and doesn't stay empty
- list.append(T_FOO);
- QVERIFY(!list.empty());
-
- // and goes back to being empty
- list.pop_back();
- QVERIFY(list.empty());
-}
-
-void tst_QList::emptyOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- empty<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::emptyMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- empty<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::emptyComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- empty<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::endsWith() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test it returns correctly in both cases
- QVERIFY(list.endsWith(T_BAZ));
- QVERIFY(!list.endsWith(T_BAR));
-
- // remove an item and make sure the end item changes
- list.pop_back();
- QVERIFY(list.endsWith(T_BAR));
-}
-
-void tst_QList::endsWithOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- endsWith<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::endsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- endsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::endsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- endsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::lastIndexOf() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // one instance of the target item
- QVERIFY(list.lastIndexOf(T_BAZ) == 2);
-
- // shouldn't find this
- QVERIFY(list.lastIndexOf(T_WEEE) == -1);
-
- // multiple instances
- list.append(T_BAZ);
- list.append(T_BAZ);
- QVERIFY(list.lastIndexOf(T_BAZ) == 4);
-
- // search from the middle to find the last one
- QVERIFY(list.lastIndexOf(T_BAZ, 3) == 3);
-
- // try to find none
- QVERIFY(list.lastIndexOf(T_BAZ, 1) == -1);
-}
-
-void tst_QList::lastIndexOfOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- lastIndexOf<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::lastIndexOfMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- lastIndexOf<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::lastIndexOfComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- lastIndexOf<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::move() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // move an item
- list.move(0, list.count() - 1);
- QCOMPARE(list, QList<T>() << T_BAR << T_BAZ << T_FOO);
-
- // move it back
- list.move(list.count() - 1, 0);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-
- // move an item in the middle
- list.move(1, 0);
- QCOMPARE(list, QList<T>() << T_BAR << T_FOO << T_BAZ);
-}
-
-void tst_QList::moveOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- move<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::moveMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- move<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::moveComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- move<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeAll() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // remove one instance
- list.removeAll(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // many instances
- list << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ;
- list.removeAll(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-
- // try remove something that doesn't exist
- list.removeAll(T_WEEE);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-}
-
-void tst_QList::removeAllOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeAll<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeAllMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAll<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeAllComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAll<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeAt() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeAt(1);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeAt(0);
- QCOMPARE(list, QList<T>() << T_BAZ);
-
- // final
- list.removeAt(0);
- QCOMPARE(list, QList<T>());
-}
-
-void tst_QList::removeAtOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeAt<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeAtMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAt<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeAtComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAt<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::removeOne() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeOne(T_BAR);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeOne(T_FOO);
- QCOMPARE(list, QList<T>() << T_BAZ);
-
- // last
- list.removeOne(T_BAZ);
- QCOMPARE(list, QList<T>());
-
- // make sure it really only removes one :)
- list << T_FOO << T_FOO;
- list.removeOne(T_FOO);
- QCOMPARE(list, QList<T>() << T_FOO);
-
- // try remove something that doesn't exist
- list.removeOne(T_WEEE);
- QCOMPARE(list, QList<T>() << T_FOO);
-}
-
-void tst_QList::removeOneOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- removeOne<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::removeOneMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeOne<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::removeOneComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeOne<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::replace() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // start
- list.replace(0, T_CAT);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_BAR << T_BAZ);
-
- // middle
- list.replace(1, T_DOG);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_DOG << T_BAZ);
-
- // end
- list.replace(2, T_BLAH);
- QCOMPARE(list, QList<T>() << T_CAT
- << T_DOG << T_BLAH);
-}
-
-void tst_QList::replaceOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- replace<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::replaceMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- replace<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::replaceComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- replace<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::reverseIterators() const
-{
- QList<T> v;
- v << T_CAT << T_DOG << T_BLAH << T_BAZ;
- QList<T> vr = v;
- std::reverse(vr.begin(), vr.end());
- const QList<T> &cvr = vr;
- QVERIFY(std::equal(v.begin(), v.end(), vr.rbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), vr.crbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), cvr.rbegin()));
- QVERIFY(std::equal(vr.rbegin(), vr.rend(), v.begin()));
- QVERIFY(std::equal(vr.crbegin(), vr.crend(), v.begin()));
- QVERIFY(std::equal(cvr.rbegin(), cvr.rend(), v.begin()));
-}
-
-void tst_QList::reverseIteratorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- reverseIterators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::reverseIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- reverseIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::reverseIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- reverseIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::startsWith() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // make sure it starts ok
- QVERIFY(list.startsWith(T_FOO));
-
- // remove an item
- list.removeFirst();
- QVERIFY(list.startsWith(T_BAR));
-}
-
-void tst_QList::startsWithOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- startsWith<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::startsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- startsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::startsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- startsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::swap() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // swap
- list.swapItemsAt(0, 2);
- QCOMPARE(list, QList<T>() << T_BAZ << T_BAR << T_FOO);
-
- // swap again
- list.swapItemsAt(1, 2);
- QCOMPARE(list, QList<T>() << T_BAZ << T_FOO << T_BAR);
-
- QList<T> list2;
- list2 << T_DOG << T_BLAH;
-
- list.swap(list2);
- QCOMPARE(list, QList<T>() << T_DOG << T_BLAH);
- QCOMPARE(list2, QList<T>() << T_BAZ << T_FOO << T_BAR);
-}
-
-void tst_QList::swapOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- swap<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::swapMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- swap<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::swapComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- swap<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeAt() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeAt(0), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeAt(1), T_BAZ);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeAt(0), T_BAR);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QList::takeAtOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeAt<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeAtMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeAt<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeAtComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeAt<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeFirst() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeFirst(), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeFirst(), T_BAR);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeFirst(), T_BAZ);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QList::takeFirstOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeFirst<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeFirstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeFirst<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeFirstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeFirst<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::takeLast() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeLast(), T_BAZ);
- QCOMPARE(list.takeLast(), T_BAR);
- QCOMPARE(list.takeLast(), T_FOO);
-}
-
-void tst_QList::takeLastOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- takeLast<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::takeLastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeLast<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::takeLastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeLast<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-template<typename T>
-void tst_QList::toSet() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // no duplicates
- QCOMPARE(list.toSet(), QSet<T>() << T_FOO << T_BAR << T_BAZ);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-
- // duplicates (is this more of a QSet test?)
- list << T_FOO << T_BAR << T_BAZ;
- QCOMPARE(list.toSet(), QSet<T>() << T_FOO << T_BAR << T_BAZ);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toSetOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toSet<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toSetMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toSet<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toSetComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toSet<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::toStdList() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // yuck.
- std::list<T> slist;
- slist.push_back(T_FOO);
- slist.push_back(T_BAR);
- slist.push_back(T_BAZ);
-
- QCOMPARE(list.toStdList(), slist);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toStdListOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toStdList<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toStdListMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toStdList<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toStdListComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toStdList<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-#endif
-
-template<typename T>
-void tst_QList::toVector() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.toVector(), QVector<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QList::toVectorOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- toVector<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::toVectorMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toVector<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::toVectorComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toVector<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::value() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test real values
- QCOMPARE(list.value(0), T_FOO);
- QCOMPARE(list.value(2), T_BAZ);
-
- // test empty default
- QCOMPARE(list.value(3), T());
- QCOMPARE(list.value(-1), T());
-
- // test defaults
- T defaultT(T_WEEE);
- QCOMPARE(list.value(-1, defaultT), defaultT);
- QCOMPARE(list.value(3, defaultT), defaultT);
-}
-
-void tst_QList::valueOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- value<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::valueMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- value<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::valueComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- value<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::testOperators() const
-{
- QList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QList<T> listtwo;
- listtwo << T_FOO << T_BAR << T_BAZ;
-
- // test equal
- QVERIFY(list == listtwo);
-
- // not equal
- listtwo.append(T_CAT);
- QVERIFY(list != listtwo);
-
- // +=
- list += listtwo;
- QVERIFY(list.size() == 7);
- QVERIFY(listtwo.size() == 4);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // =
- list = listtwo;
- QCOMPARE(list, listtwo);
- QCOMPARE(list, QList<T>() << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // []
- QCOMPARE(list[0], T_FOO);
- QCOMPARE(list[list.size() - 1], T_CAT);
-
- // <, >, <=, >=
- QVERIFY(!(list < listtwo));
- QVERIFY(!(list > listtwo));
- QVERIFY( list <= listtwo);
- QVERIFY( list >= listtwo);
- listtwo.push_back(T_CAT);
- QVERIFY( list < listtwo);
- QVERIFY(!(list > listtwo));
- QVERIFY( list <= listtwo);
- QVERIFY(!(list >= listtwo));
- QVERIFY(listtwo > list);
- QVERIFY(listtwo >= list);
-}
-
-void tst_QList::testOperatorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- testOperators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::testOperatorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testOperators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::testOperatorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testOperators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QList::testSTLIterators() const
-{
- QList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- typename QList<T>::iterator it = list.begin();
- QCOMPARE(*it, T_FOO); it++;
- QCOMPARE(*it, T_BAR); it++;
- QCOMPARE(*it, T_BAZ); it++;
- QCOMPARE(it, list.end()); it--;
-
- // walk backwards
- QCOMPARE(*it, T_BAZ); it--;
- QCOMPARE(*it, T_BAR); it--;
- QCOMPARE(*it, T_FOO);
-
- // test erase
- it = list.erase(it);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it, T_BAR);
-
- // test multiple erase
- it = list.erase(it, it + 2);
- QVERIFY(list.size() == 0);
- QCOMPARE(it, list.end());
-
- // insert again
- it = list.insert(it, T_FOO);
- QVERIFY(list.size() == 1);
- QCOMPARE(*it, T_FOO);
-
- // insert again
- it = list.insert(it, T_BAR);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it++, T_BAR);
- QCOMPARE(*it, T_FOO);
-}
-
-void tst_QList::testSTLIteratorsOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- testSTLIterators<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::testSTLIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testSTLIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::testSTLIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testSTLIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QList::initializeList() const
-{
- QList<int> v1{2,3,4};
- QCOMPARE(v1, QList<int>() << 2 << 3 << 4);
- QCOMPARE(v1, (QList<int>{2,3,4}));
-
- QList<QList<int>> v2{ v1, {1}, QList<int>(), {2,3,4} };
- QList<QList<int>> v3;
- v3 << v1 << (QList<int>() << 1) << QList<int>() << v1;
- QCOMPARE(v3, v2);
-}
-
-template<typename T>
-void tst_QList::constSharedNull() const
-{
- QList<T> list2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QList<T> list1;
- list1.setSharable(false);
- QVERIFY(list1.isDetached());
-
- list2.setSharable(true);
-#endif
- QVERIFY(!list2.isDetached());
-}
-
-void tst_QList::constSharedNullOptimal() const
-{
- const int liveCount = Optimal::getLiveCount();
- constSharedNull<Optimal>();
- QCOMPARE(liveCount, Optimal::getLiveCount());
-}
-
-void tst_QList::constSharedNullMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- constSharedNull<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QList::constSharedNullComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- constSharedNull<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template <class T>
-void generateSetSharableData()
-{
-#if !defined(QT_NO_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 !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QFETCH(QList<T>, list);
- QFETCH(int, size);
-
- QVERIFY(!list.isDetached()); // Shared with QTest
-
- list.setSharable(true);
-
- QCOMPARE(list.size(), size);
-
- {
- QList<T> copy(list);
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- list.setSharable(false);
- QVERIFY(list.isDetached() || list.isSharedWith(QList<T>()));
-
- {
- QList<T> copy(list);
-
- QVERIFY(copy.isDetached() || copy.isSharedWith(QList<T>()));
- QCOMPARE(copy.size(), size);
- QCOMPARE(copy, list);
- }
-
- list.setSharable(true);
-
- {
- QList<T> copy(list);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(list));
- }
-
- for (int i = 0; i < list.size(); ++i)
- QCOMPARE(int(list[i]), i);
-
- QCOMPARE(list.size(), size);
-#endif
-}
-
-void tst_QList::setSharableInt_data() const
-{
- generateSetSharableData<int>();
-}
-
-void tst_QList::setSharableComplex_data() const
-{
- generateSetSharableData<Complex>();
-}
-
-void tst_QList::setSharableInt() const
-{
- runSetSharableTest<int>();
-}
-
-void tst_QList::setSharableComplex() const
-{
- runSetSharableTest<Complex>();
-}
-
-void tst_QList::eraseValidIteratorsOnSharedList() const
-{
- QList<int> a, b;
- a.push_back(10);
- a.push_back(20);
- a.push_back(30);
- QList<int>::iterator i = a.begin();
- ++i;
- b = a;
- a.erase(i);
- QCOMPARE(b.size(), 3);
- QCOMPARE(a.size(), 2);
- QCOMPARE(a.at(0), 10);
- QCOMPARE(a.at(1), 30);
-
- a.push_back(40);
- a.push_back(50);
- a.push_back(60);
- QCOMPARE(a.size(), 5);
- i = a.begin();
- b = a;
- ++i;
- QList<int>::iterator j = i;
- ++j;
- ++j;
- a.erase(i, j); // remove 3 elements
- QCOMPARE(b.size(), 5);
- QCOMPARE(a.size(), 3);
- QCOMPARE(a.at(0), 10);
- QCOMPARE(a.at(1), 50);
-}
-
-void tst_QList::insertWithValidIteratorsOnSharedList() const
-{
- QList<int> a, b;
- a.push_back(10);
- a.push_back(20);
- a.push_back(30);
- QList<int>::iterator i = a.begin();
- ++i;
- b = a;
- a.insert(i, 15);
- QCOMPARE(a.size(), b.size() + 1);
- QCOMPARE(b.at(1), 20);
- QCOMPARE(a.at(1), 15);
-}
-
-template <typename T>
-void tst_QList::qhash() const
-{
- QList<T> l1, l2;
- QCOMPARE(qHash(l1), qHash(l2));
- l1 << T_BAR;
- l2 << T_BAR;
- QCOMPARE(qHash(l1), qHash(l2));
-}
-
-void tst_QList::reserve() const
-{
- // Note:
- // This test depends on QList's current behavior that ints are stored in the array itself.
- // This test would not work for QList<Complex>.
- int capacity = 100;
- QList<int> list;
- list.reserve(capacity);
- list << 0;
- int *data = &list[0];
-
- for (int i = 1; i < capacity; i++) {
- list << i;
- QCOMPARE(&list.at(0), data);
- }
-
- QList<int> copy = list;
- list.reserve(capacity / 2);
- QCOMPARE(list.size(), capacity); // we didn't shrink the size!
-
- copy = list;
- list.reserve(capacity * 2);
- QCOMPARE(list.size(), capacity);
- QVERIFY(&list.at(0) != data);
-}
-
-QTEST_APPLESS_MAIN(tst_QList)
-#include "tst_qlist.moc"
diff --git a/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro b/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro
deleted file mode 100644
index e39ad38919..0000000000
--- a/tests/auto/corelib/tools/qlist_strictiterators/qlist_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qlist/qlist.pro)
-TARGET = tst_qlist_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QList=tst_QList_StrictIterators
diff --git a/tests/auto/corelib/tools/qmakearray/CMakeLists.txt b/tests/auto/corelib/tools/qmakearray/CMakeLists.txt
new file mode 100644
index 0000000000..36b20c3b4f
--- /dev/null
+++ b/tests/auto/corelib/tools/qmakearray/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmakearray.pro.
+
+#####################################################################
+## tst_qmakearray Test:
+#####################################################################
+
+add_qt_test(tst_qmakearray
+ SOURCES
+ tst_qmakearray.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/tools/qmap/.prev_CMakeLists.txt b/tests/auto/corelib/tools/qmap/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..96378d3278
--- /dev/null
+++ b/tests/auto/corelib/tools/qmap/.prev_CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmap.pro.
+
+#####################################################################
+## tst_qmap Test:
+#####################################################################
+
+add_qt_test(tst_qmap
+ SOURCES
+ tst_qmap.cpp
+ DEFINES
+ -QT_NO_JAVA_STYLE_ITERATORS
+)
diff --git a/tests/auto/corelib/tools/qmap/CMakeLists.txt b/tests/auto/corelib/tools/qmap/CMakeLists.txt
new file mode 100644
index 0000000000..677159ae0d
--- /dev/null
+++ b/tests/auto/corelib/tools/qmap/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qmap.pro.
+
+#####################################################################
+## tst_qmap Test:
+#####################################################################
+
+add_qt_test(tst_qmap
+ SOURCES
+ tst_qmap.cpp
+ DEFINES
+ #-QT_NO_JAVA_STYLE_ITERATORS # special case remove
+)
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index c3a8a88f0c..1638ebc992 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -68,7 +68,6 @@ private slots:
void const_shared_null();
void equal_range();
- void setSharable();
void insert();
void insertMap();
@@ -1066,13 +1065,6 @@ void tst_QMap::qmultimap_specific()
void tst_QMap::const_shared_null()
{
QMap<int, QString> map2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QMap<int, QString> map1;
- map1.setSharable(false);
- QVERIFY(map1.isDetached());
-
- map2.setSharable(true);
-#endif
QVERIFY(!map2.isDetached());
}
@@ -1161,61 +1153,6 @@ const T &const_(const T &t)
return t;
}
-void tst_QMap::setSharable()
-{
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- QMap<int, QString> map;
-
- map.insert(1, "um");
- map.insert(2, "dois");
- map.insert(4, "quatro");
- map.insert(5, "cinco");
-
- map.setSharable(true);
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(!map.isDetached());
- QVERIFY(copy.isSharedWith(map));
- sanityCheckTree(copy, __LINE__);
- }
-
- map.setSharable(false);
- sanityCheckTree(map, __LINE__);
- QVERIFY(map.isDetached());
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(map.isDetached());
- QVERIFY(copy.isDetached());
-
- QCOMPARE(copy.size(), 4);
- QCOMPARE(const_(copy)[4], QString("quatro"));
-
- QCOMPARE(map, copy);
- sanityCheckTree(map, __LINE__);
- sanityCheckTree(copy, __LINE__);
- }
-
- map.setSharable(true);
- QCOMPARE(map.size(), 4);
- QCOMPARE(const_(map)[4], QString("quatro"));
-
- {
- QMap<int, QString> copy(map);
-
- QVERIFY(!map.isDetached());
- QVERIFY(copy.isSharedWith(map));
- }
-#endif
-}
-
void tst_QMap::insert()
{
QMap<QString, float> map;
@@ -1510,17 +1447,16 @@ void tst_QMap::testInsertMultiWithHint()
{
QMap<int, int> map;
- typedef QMap<int, int>::const_iterator cite; // Hack since we define QT_STRICT_ITERATORS
- map.insertMulti(cite(map.end()), 64, 65);
+ map.insertMulti(map.end(), 64, 65);
map[128] = 129;
map[256] = 257;
sanityCheckTree(map, __LINE__);
- map.insertMulti(cite(map.end()), 512, 513);
- map.insertMulti(cite(map.end()), 512, 513 * 2);
+ map.insertMulti(map.end(), 512, 513);
+ map.insertMulti(map.end(), 512, 513 * 2);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 5);
- map.insertMulti(cite(map.end()), 256, 258); // wrong hint
+ map.insertMulti(map.end(), 256, 258); // wrong hint
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 6);
@@ -1532,23 +1468,23 @@ void tst_QMap::testInsertMultiWithHint()
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 8);
- j = map.insertMulti(cite(j), 68, 259);
+ j = map.insertMulti(j, 68, 259);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 9);
- j = map.insertMulti(cite(j), 67, 67);
+ j = map.insertMulti(j, 67, 67);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 10);
- i = map.insertMulti(cite(i), 256, 259);
+ i = map.insertMulti(i, 256, 259);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 11);
- i = map.insertMulti(cite(i), 256, 260);
+ i = map.insertMulti(i, 256, 260);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 12);
- map.insertMulti(cite(i), 64, 67);
+ map.insertMulti(i, 64, 67);
sanityCheckTree(map, __LINE__);
QCOMPARE(map.size(), 13);
diff --git a/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro b/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro
deleted file mode 100644
index 6c1f4727c1..0000000000
--- a/tests/auto/corelib/tools/qmap_strictiterators/qmap_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qmap/qmap.pro)
-TARGET = tst_qmap_strictiterators
-DEFINES += QT_STRICT_ITERATORS tst_QMap=tst_QMap_StrictIterators
diff --git a/tests/auto/corelib/tools/qmargins/CMakeLists.txt b/tests/auto/corelib/tools/qmargins/CMakeLists.txt
new file mode 100644
index 0000000000..632e5dc8d2
--- /dev/null
+++ b/tests/auto/corelib/tools/qmargins/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmargins.pro.
+
+#####################################################################
+## tst_qmargins Test:
+#####################################################################
+
+add_qt_test(tst_qmargins
+ SOURCES
+ tst_qmargins.cpp
+)
diff --git a/tests/auto/corelib/tools/qmessageauthenticationcode/CMakeLists.txt b/tests/auto/corelib/tools/qmessageauthenticationcode/CMakeLists.txt
new file mode 100644
index 0000000000..6e142facfb
--- /dev/null
+++ b/tests/auto/corelib/tools/qmessageauthenticationcode/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qmessageauthenticationcode.pro.
+
+#####################################################################
+## tst_qmessageauthenticationcode Test:
+#####################################################################
+
+add_qt_test(tst_qmessageauthenticationcode
+ SOURCES
+ tst_qmessageauthenticationcode.cpp
+)
diff --git a/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro b/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro
index c8e6a8e05a..6c00f4f081 100644
--- a/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro
+++ b/tests/auto/corelib/tools/qoffsetstringarray/qoffsetstringarray.pro
@@ -1,6 +1,5 @@
CONFIG += testcase
TARGET = tst_qoffsetstringarray
QT = core testlib core-private
-CONFIG += c++11
CONFIG += strict_c++
SOURCES = $$PWD/tst_qoffsetstringarray.cpp
diff --git a/tests/auto/corelib/tools/qpair/CMakeLists.txt b/tests/auto/corelib/tools/qpair/CMakeLists.txt
new file mode 100644
index 0000000000..4c226f5a02
--- /dev/null
+++ b/tests/auto/corelib/tools/qpair/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qpair.pro.
+
+#####################################################################
+## tst_qpair Test:
+#####################################################################
+
+add_qt_test(tst_qpair
+ SOURCES
+ tst_qpair.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/tools/qpoint/CMakeLists.txt b/tests/auto/corelib/tools/qpoint/CMakeLists.txt
new file mode 100644
index 0000000000..6ef68c30cb
--- /dev/null
+++ b/tests/auto/corelib/tools/qpoint/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qpoint.pro.
+
+#####################################################################
+## tst_qpoint Test:
+#####################################################################
+
+add_qt_test(tst_qpoint
+ SOURCES
+ tst_qpoint.cpp
+)
diff --git a/tests/auto/corelib/tools/qpointf/CMakeLists.txt b/tests/auto/corelib/tools/qpointf/CMakeLists.txt
new file mode 100644
index 0000000000..b1784d999f
--- /dev/null
+++ b/tests/auto/corelib/tools/qpointf/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qpointf.pro.
+
+#####################################################################
+## tst_qpointf Test:
+#####################################################################
+
+add_qt_test(tst_qpointf
+ SOURCES
+ tst_qpointf.cpp
+)
diff --git a/tests/auto/corelib/tools/qqueue/CMakeLists.txt b/tests/auto/corelib/tools/qqueue/CMakeLists.txt
new file mode 100644
index 0000000000..6d1aeda5b2
--- /dev/null
+++ b/tests/auto/corelib/tools/qqueue/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qqueue.pro.
+
+#####################################################################
+## tst_qqueue Test:
+#####################################################################
+
+add_qt_test(tst_qqueue
+ SOURCES
+ tst_qqueue.cpp
+)
diff --git a/tests/auto/corelib/tools/qrect/CMakeLists.txt b/tests/auto/corelib/tools/qrect/CMakeLists.txt
new file mode 100644
index 0000000000..47b8aced46
--- /dev/null
+++ b/tests/auto/corelib/tools/qrect/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qrect.pro.
+
+#####################################################################
+## tst_qrect Test:
+#####################################################################
+
+add_qt_test(tst_qrect
+ SOURCES
+ tst_qrect.cpp
+)
diff --git a/tests/auto/corelib/tools/qringbuffer/CMakeLists.txt b/tests/auto/corelib/tools/qringbuffer/CMakeLists.txt
new file mode 100644
index 0000000000..4bab92b0c6
--- /dev/null
+++ b/tests/auto/corelib/tools/qringbuffer/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Generated from qringbuffer.pro.
+
+#####################################################################
+## tst_qringbuffer Test:
+#####################################################################
+
+add_qt_test(tst_qringbuffer
+ SOURCES
+ tst_qringbuffer.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+)
diff --git a/tests/auto/corelib/tools/qscopedpointer/CMakeLists.txt b/tests/auto/corelib/tools/qscopedpointer/CMakeLists.txt
new file mode 100644
index 0000000000..141bab267b
--- /dev/null
+++ b/tests/auto/corelib/tools/qscopedpointer/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qscopedpointer.pro.
+
+#####################################################################
+## tst_qscopedpointer Test:
+#####################################################################
+
+add_qt_test(tst_qscopedpointer
+ SOURCES
+ tst_qscopedpointer.cpp
+)
diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/CMakeLists.txt b/tests/auto/corelib/tools/qscopedvaluerollback/CMakeLists.txt
new file mode 100644
index 0000000000..e23a4d55f9
--- /dev/null
+++ b/tests/auto/corelib/tools/qscopedvaluerollback/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qscopedvaluerollback.pro.
+
+#####################################################################
+## tst_qscopedvaluerollback Test:
+#####################################################################
+
+add_qt_test(tst_qscopedvaluerollback
+ SOURCES
+ tst_qscopedvaluerollback.cpp
+)
diff --git a/tests/auto/corelib/tools/qscopeguard/CMakeLists.txt b/tests/auto/corelib/tools/qscopeguard/CMakeLists.txt
new file mode 100644
index 0000000000..11b425448b
--- /dev/null
+++ b/tests/auto/corelib/tools/qscopeguard/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qscopeguard.pro.
+
+#####################################################################
+## tst_qscopeguard Test:
+#####################################################################
+
+add_qt_test(tst_qscopeguard
+ SOURCES
+ tst_qscopeguard.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
index e5393f694e..4bb4113845 100644
--- a/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
+++ b/tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
@@ -100,9 +100,11 @@ void tst_QScopeGuard::construction()
QScopeGuard fromFunctionPointer(&func);
QScopeGuard fromNonVoidFunction(intFunc);
QScopeGuard fromNoDiscardFunction(noDiscardFunc);
+#ifndef __apple_build_version__
QScopeGuard fromStdFunction{std::function(func)};
std::function stdFunction(func);
QScopeGuard fromNamedStdFunction(stdFunction);
+#endif
#else
QSKIP("This test requires C++17 Class Template Argument Deduction support enabled in the compiler.");
#endif
diff --git a/tests/auto/corelib/tools/qset/.prev_CMakeLists.txt b/tests/auto/corelib/tools/qset/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..68a8f64822
--- /dev/null
+++ b/tests/auto/corelib/tools/qset/.prev_CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qset.pro.
+
+#####################################################################
+## tst_qset Test:
+#####################################################################
+
+add_qt_test(tst_qset
+ SOURCES
+ tst_qset.cpp
+ DEFINES
+ -QT_NO_JAVA_STYLE_ITERATORS
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/tools/qset/CMakeLists.txt b/tests/auto/corelib/tools/qset/CMakeLists.txt
new file mode 100644
index 0000000000..a423e4aa23
--- /dev/null
+++ b/tests/auto/corelib/tools/qset/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Generated from qset.pro.
+
+#####################################################################
+## tst_qset Test:
+#####################################################################
+
+add_qt_test(tst_qset
+ SOURCES
+ tst_qset.cpp
+ #DEFINES # special case remove
+ #-QT_NO_JAVA_STYLE_ITERATORS # special case remove
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp
index 8a545712a2..0ca8be7fa3 100644
--- a/tests/auto/corelib/tools/qset/tst_qset.cpp
+++ b/tests/auto/corelib/tools/qset/tst_qset.cpp
@@ -26,8 +26,6 @@
**
****************************************************************************/
-//#define QT_STRICT_ITERATORS
-
#include <QtTest/QtTest>
#include <qset.h>
#include <qdebug.h>
@@ -61,7 +59,6 @@ private slots:
void begin();
void end();
void insert();
- void reverseIterators();
void setOperations();
void stlIterator();
void stlMutableIterator();
@@ -579,21 +576,6 @@ void tst_QSet::insert()
}
}
-void tst_QSet::reverseIterators()
-{
- QSet<int> s;
- s << 1 << 17 << 61 << 127 << 911;
- std::vector<int> v(s.begin(), s.end());
- std::reverse(v.begin(), v.end());
- const QSet<int> &cs = s;
- QVERIFY(std::equal(v.begin(), v.end(), s.rbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), s.crbegin()));
- QVERIFY(std::equal(v.begin(), v.end(), cs.rbegin()));
- QVERIFY(std::equal(s.rbegin(), s.rend(), v.begin()));
- QVERIFY(std::equal(s.crbegin(), s.crend(), v.begin()));
- QVERIFY(std::equal(cs.rbegin(), cs.rend(), v.begin()));
-}
-
void tst_QSet::setOperations()
{
QSet<QString> set1, set2;
@@ -707,16 +689,6 @@ void tst_QSet::stlIterator()
}
QVERIFY(sum == 24999 * 25000 / 2);
}
-
- {
- int sum = 0;
- QSet<QString>::const_iterator i = set1.end();
- while (i != set1.begin()) {
- --i;
- sum += toNumber(*i);
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
}
void tst_QSet::stlMutableIterator()
@@ -736,21 +708,10 @@ void tst_QSet::stlMutableIterator()
}
{
- int sum = 0;
- QSet<QString>::iterator i = set1.end();
- while (i != set1.begin()) {
- --i;
- sum += toNumber(*i);
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
QSet<QString> set2 = set1;
QSet<QString> set3 = set2;
QSet<QString>::iterator i = set2.begin();
- QSet<QString>::iterator j = set3.begin();
while (i != set2.end()) {
i = set2.erase(i);
@@ -758,24 +719,7 @@ void tst_QSet::stlMutableIterator()
QVERIFY(set2.isEmpty());
QVERIFY(!set3.isEmpty());
- j = set3.end();
- while (j != set3.begin()) {
- j--;
- if (j + 1 != set3.end())
- set3.erase(j + 1);
- }
- if (set3.begin() != set3.end())
- set3.erase(set3.begin());
-
- QVERIFY(set2.isEmpty());
- QVERIFY(set3.isEmpty());
-
-// #if QT_VERSION >= 0x050000
-// i = set2.insert("foo");
-// #else
- QSet<QString>::const_iterator k = set2.insert("foo");
- i = reinterpret_cast<QSet<QString>::iterator &>(k);
-// #endif
+ i = set2.insert("foo");
QCOMPARE(*i, QLatin1String("foo"));
}
}
@@ -804,47 +748,6 @@ void tst_QSet::javaIterator()
QVERIFY(sum == 24999 * 25000 / 2);
}
- {
- int sum = 0;
- QSetIterator<QString> i(set1);
- while (i.hasNext()) {
- i.next();
- sum += toNumber(i.peekPrevious());
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious())
- sum += toNumber(i.previous());
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious()) {
- sum += toNumber(i.peekPrevious());
- i.previous();
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious()) {
- i.previous();
- sum += toNumber(i.peekNext());
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
int sum1 = 0;
int sum2 = 0;
QSetIterator<QString> i(set1);
@@ -899,52 +802,10 @@ void tst_QSet::javaMutableIterator()
}
{
- int sum = 0;
- QMutableSetIterator<QString> i(set1);
- while (i.hasNext()) {
- i.next();
- sum += toNumber(i.peekPrevious());
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QMutableSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious())
- sum += toNumber(i.previous());
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QMutableSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious()) {
- sum += toNumber(i.peekPrevious());
- i.previous();
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
- int sum = 0;
- QMutableSetIterator<QString> i(set1);
- i.toBack();
- while (i.hasPrevious()) {
- i.previous();
- sum += toNumber(i.peekNext());
- }
- QVERIFY(sum == 24999 * 25000 / 2);
- }
-
- {
QSet<QString> set2 = set1;
QSet<QString> set3 = set2;
QMutableSetIterator<QString> i(set2);
- QMutableSetIterator<QString> j(set3);
while (i.hasNext()) {
i.next();
@@ -952,14 +813,6 @@ void tst_QSet::javaMutableIterator()
}
QVERIFY(set2.isEmpty());
QVERIFY(!set3.isEmpty());
-
- j.toBack();
- while (j.hasPrevious()) {
- j.previous();
- j.remove();
- }
- QVERIFY(set2.isEmpty());
- QVERIFY(set3.isEmpty());
}
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index a9fd282ac9..8a621cd5d9 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -2155,7 +2155,7 @@ void tst_QSharedPointer::threadStressTest()
}
}
-template<typename Container, bool Ordered>
+template<typename Container, bool Ordered, bool Multi>
void hashAndMapTest()
{
typedef typename Container::key_type Key;
@@ -2200,26 +2200,30 @@ void hashAndMapTest()
QVERIFY(it == c.end());
}
- c.insertMulti(k1, Value(47));
- it = c.find(k1);
- QVERIFY(it != c.end());
- QCOMPARE(it.key(), k1);
- ++it;
- QVERIFY(it != c.end());
- QCOMPARE(it.key(), k1);
- ++it;
- if (Ordered)
- QVERIFY(it == c.end());
+ if (Multi) {
+ c.insert(k1, Value(47));
+ it = c.find(k1);
+ QVERIFY(it != c.end());
+ QCOMPARE(it.key(), k1);
+ ++it;
+ QVERIFY(it != c.end());
+ QCOMPARE(it.key(), k1);
+ ++it;
+ if (Ordered)
+ QVERIFY(it == c.end());
+ }
}
void tst_QSharedPointer::map()
{
- hashAndMapTest<QMap<QSharedPointer<int>, int>, true>();
+ hashAndMapTest<QMap<QSharedPointer<int>, int>, true, false>();
+ hashAndMapTest<QMultiMap<QSharedPointer<int>, int>, true, true>();
}
void tst_QSharedPointer::hash()
{
- hashAndMapTest<QHash<QSharedPointer<int>, int>, false>();
+ hashAndMapTest<QHash<QSharedPointer<int>, int>, false, false>();
+ hashAndMapTest<QMultiHash<QSharedPointer<int>, int>, false, true>();
}
void tst_QSharedPointer::validConstructs()
diff --git a/tests/auto/corelib/tools/qsize/CMakeLists.txt b/tests/auto/corelib/tools/qsize/CMakeLists.txt
new file mode 100644
index 0000000000..f516941180
--- /dev/null
+++ b/tests/auto/corelib/tools/qsize/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsize.pro.
+
+#####################################################################
+## tst_qsize Test:
+#####################################################################
+
+add_qt_test(tst_qsize
+ SOURCES
+ tst_qsize.cpp
+)
diff --git a/tests/auto/corelib/tools/qsizef/CMakeLists.txt b/tests/auto/corelib/tools/qsizef/CMakeLists.txt
new file mode 100644
index 0000000000..d767ca92d7
--- /dev/null
+++ b/tests/auto/corelib/tools/qsizef/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qsizef.pro.
+
+#####################################################################
+## tst_qsizef Test:
+#####################################################################
+
+add_qt_test(tst_qsizef
+ SOURCES
+ tst_qsizef.cpp
+)
diff --git a/tests/auto/corelib/tools/qstl/CMakeLists.txt b/tests/auto/corelib/tools/qstl/CMakeLists.txt
new file mode 100644
index 0000000000..975ddfe0b5
--- /dev/null
+++ b/tests/auto/corelib/tools/qstl/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qstl.pro.
+
+#####################################################################
+## tst_qstl Test:
+#####################################################################
+
+add_qt_test(tst_qstl
+ SOURCES
+ tst_qstl.cpp
+)
diff --git a/tests/auto/corelib/tools/qtimeline/CMakeLists.txt b/tests/auto/corelib/tools/qtimeline/CMakeLists.txt
new file mode 100644
index 0000000000..802cd56305
--- /dev/null
+++ b/tests/auto/corelib/tools/qtimeline/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Generated from qtimeline.pro.
+
+#####################################################################
+## tst_qtimeline Test:
+#####################################################################
+
+add_qt_test(tst_qtimeline
+ SOURCES
+ tst_qtimeline.cpp
+)
diff --git a/tests/auto/corelib/tools/qvarlengtharray/CMakeLists.txt b/tests/auto/corelib/tools/qvarlengtharray/CMakeLists.txt
new file mode 100644
index 0000000000..17989ae31d
--- /dev/null
+++ b/tests/auto/corelib/tools/qvarlengtharray/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Generated from qvarlengtharray.pro.
+
+#####################################################################
+## tst_qvarlengtharray Test:
+#####################################################################
+
+add_qt_test(tst_qvarlengtharray
+ SOURCES
+ tst_qvarlengtharray.cpp
+)
+
+## Scopes:
+#####################################################################
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index a1d0100f96..6220cc766a 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -827,7 +827,7 @@ void tst_QVarLengthArray::operators()
// +=: not provided, emulate
//myvla += myvlatwo;
- Q_FOREACH (const QString &s, myvlatwo)
+ for (const QString &s : qAsConst(myvlatwo))
myvla.push_back(s);
QCOMPARE(myvla, combined);
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index 08d5a8cd50..6ae312fb8d 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -104,7 +104,7 @@ private:
static void check(const State state1, const State state2)
{
- QCOMPARE(state1, state2);
+ QCOMPARE(int(state1), int(state2));
}
};
@@ -174,7 +174,7 @@ private:
{
// check if c object has been moved
QCOMPARE(c, c->that);
- QCOMPARE(c->state, Constructed);
+ QCOMPARE(int(c->state), int(Constructed));
}
};
QAtomicInt Custom::counter = 0;
@@ -307,22 +307,11 @@ private slots:
void reserve();
void reserveZero();
- void reallocAfterCopy_data();
- void reallocAfterCopy();
void initializeListInt();
void initializeListMovable();
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;
@@ -335,6 +324,18 @@ private slots:
void swapItemsAt() const;
+ void emplaceInt();
+ void emplaceCustom();
+ void emplaceMovable();
+ void emplaceConsistentWithStdVectorInt();
+ void emplaceConsistentWithStdVectorCustom();
+ void emplaceConsistentWithStdVectorMovable();
+ void emplaceReturnsIterator();
+ void emplaceBack();
+ void emplaceBackReturnsRef();
+ void emplaceWithElementFromTheSameContainer();
+ void emplaceWithElementFromTheSameContainer_data();
+
private:
template<typename T> void copyConstructor() const;
template<typename T> void add() const;
@@ -358,10 +359,10 @@ private:
template<typename T> void size() const;
template<typename T> void swap() const;
template<typename T> void initializeList();
- template<typename T> void setSharable_data() const;
- template<typename T> void setSharable() const;
template<typename T> void detach() const;
template<typename T> void detachThreadSafety() const;
+ template<typename T> void emplaceImpl() const;
+ template<typename T> void emplaceConsistentWithStdVectorImpl() const;
};
@@ -467,24 +468,6 @@ void tst_QVector::copyConstructor() const
QVector<T> v2(v1);
QCOMPARE(v1, v2);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v1;
- v1.setSharable(false);
- QVector<T> v2(v1);
- QVERIFY(!v1.isSharedWith(v2));
- QCOMPARE(v1, v2);
- }
- {
- QVector<T> v1;
- v1 << value1 << value2 << value3 << value4;
- v1.setSharable(false);
- QVector<T> v2(v1);
- QVERIFY(!v1.isSharedWith(v2));
- QCOMPARE(v1, v2);
- }
-#endif
}
void tst_QVector::copyConstructorInt() const
@@ -665,17 +648,6 @@ void tst_QVector::append() const
QVERIFY(v.size() == 3);
QCOMPARE(v.at(v.size() - 1), SimpleValue<T>::at(0));
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v(2);
- v.reserve(12);
- v.setSharable(false);
- v.append(SimpleValue<T>::at(0));
- QVERIFY(v.size() == 3);
- QCOMPARE(v.last(), SimpleValue<T>::at(0));
- }
-#endif
{
QVector<int> v;
v << 1 << 2 << 3;
@@ -766,16 +738,12 @@ void tst_QVector::capacity() const
myvec.remove(3);
myvec.remove(3);
myvec.remove(3);
- // TODO: is this a safe assumption? presumably it won't release memory until shrink(), but can we asser that is true?
- QVERIFY(myvec.capacity() >= 6);
myvec.squeeze();
QVERIFY(myvec.capacity() >= 3);
myvec.remove(0);
myvec.remove(0);
myvec.remove(0);
- // TODO: as above note
- QVERIFY(myvec.capacity() >= 3);
myvec.squeeze();
QVERIFY(myvec.capacity() == 0);
}
@@ -1019,20 +987,9 @@ void tst_QVector::endsWith() const
template<typename T>
void tst_QVector::eraseEmpty() const
{
- {
- QVector<T> v;
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v;
- v.setSharable(false);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#endif
+ QVector<T> v;
+ v.erase(v.begin(), v.end());
+ QCOMPARE(v.size(), 0);
}
void tst_QVector::eraseEmptyInt() const
@@ -1057,22 +1014,10 @@ void tst_QVector::eraseEmptyCustom() const
template<typename T>
void tst_QVector::eraseEmptyReserved() const
{
- {
- QVector<T> v;
- v.reserve(10);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v;
- v.reserve(10);
- v.setSharable(false);
- v.erase(v.begin(), v.end());
- QCOMPARE(v.size(), 0);
- }
-#endif
+ QVector<T> v;
+ v.reserve(10);
+ v.erase(v.begin(), v.end());
+ QCOMPARE(v.size(), 0);
}
void tst_QVector::eraseEmptyReservedInt() const
@@ -1179,21 +1124,6 @@ void tst_QVector::erase(bool shared) const
if (shared)
QCOMPARE(SimpleValue<T>::vector(12), *svc.copy);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v = SimpleValue<T>::vector(10);
- SharedVectorChecker<T> svc(v, shared);
- v.setSharable(false);
- SharedVectorChecker<T> svc2(v, shared);
- v.erase(v.begin() + 3);
- QCOMPARE(v.size(), 9);
- v.erase(v.begin(), v.end() - 1);
- QCOMPARE(v.size(), 1);
- if (shared)
- QCOMPARE(SimpleValue<T>::vector(10), *svc.copy);
- }
-#endif
}
void tst_QVector::eraseInt() const
@@ -1266,18 +1196,6 @@ template<typename T> void tst_QVector::eraseReserved() const
v.erase(v.begin() + 1, v.end() - 1);
QCOMPARE(v.size(), 2);
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- {
- QVector<T> v(10);
- v.reserve(16);
- v.setSharable(false);
- v.erase(v.begin() + 3);
- QCOMPARE(v.size(), 9);
- v.erase(v.begin(), v.end() - 1);
- QCOMPARE(v.size(), 1);
- }
-#endif
}
void tst_QVector::eraseReservedInt() const
@@ -2019,33 +1937,6 @@ void tst_QVector::resizePOD_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<int> nullNotShared;
- QVector<int> emptyNotShared(0, 5);
- QVector<int> emptyReservedNotShared;
- QVector<int> nonEmptyNotShared;
- QVector<int> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << 0 << 1 << 2 << 3 << 4;
- nonEmptyReservedNotShared << 0 << 1 << 2 << 3 << 4 << 5 << 6;
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- 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
@@ -2094,33 +1985,6 @@ void tst_QVector::resizeComplexMovable_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<Movable> nullNotShared;
- QVector<Movable> emptyNotShared(0, 'Q');
- QVector<Movable> emptyReservedNotShared;
- QVector<Movable> nonEmptyNotShared;
- QVector<Movable> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << '0' << '1' << '2' << '3' << '4';
- nonEmptyReservedNotShared << '0' << '1' << '2' << '3' << '4' << '5' << '6';
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- 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
@@ -2173,33 +2037,6 @@ void tst_QVector::resizeComplex_data() const
QTest::newRow("emptyReserved") << emptyReserved << 10;
QTest::newRow("nonEmpty") << nonEmpty << 10;
QTest::newRow("nonEmptyReserved") << nonEmptyReserved << 10;
-
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<Custom> nullNotShared;
- QVector<Custom> emptyNotShared(0, '0');
- QVector<Custom> emptyReservedNotShared;
- QVector<Custom> nonEmptyNotShared;
- QVector<Custom> nonEmptyReservedNotShared;
-
- emptyReservedNotShared.reserve(10);
- nonEmptyReservedNotShared.reserve(15);
- nonEmptyNotShared << '0' << '1' << '2' << '3' << '4';
- nonEmptyReservedNotShared << '0' << '1' << '2' << '3' << '4' << '5' << '6';
- QVERIFY(emptyReservedNotShared.capacity() >= 10);
- QVERIFY(nonEmptyReservedNotShared.capacity() >= 15);
-
- emptyNotShared.setSharable(false);
- emptyReservedNotShared.setSharable(false);
- nonEmptyNotShared.setSharable(false);
- nonEmptyReservedNotShared.setSharable(false);
-
- 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
@@ -2512,87 +2349,6 @@ void tst_QVector::reserveZero()
QVERIFY(vec.capacity() >= 1);
}
-// This is a regression test for QTBUG-11763, where memory would be reallocated
-// soon after copying a QVector.
-void tst_QVector::reallocAfterCopy_data()
-{
- QTest::addColumn<int>("capacity");
- QTest::addColumn<int>("fill_size");
- QTest::addColumn<int>("func_id");
- QTest::addColumn<int>("result1");
- QTest::addColumn<int>("result2");
- QTest::addColumn<int>("result3");
- QTest::addColumn<int>("result4");
-
- int result1, result2, result3, result4;
- int fill_size;
- for (int i = 70; i <= 100; i += 10) {
- const QByteArray prefix = "reallocAfterCopy:" + QByteArray::number(i) + ',';
- fill_size = i - 20;
- for (int j = 0; j <= 3; j++) {
- if (j == 0) { // append
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 1) { // insert(0)
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 2) { // insert(20)
- result1 = i;
- result2 = i;
- result3 = i - 19;
- result4 = i - 20;
- } else if (j == 3) { // insert(0, 10)
- result1 = i;
- result2 = i;
- result3 = i - 10;
- result4 = i - 20;
- }
- QTest::newRow((prefix + QByteArray::number(j)).constData())
- << i << fill_size << j << result1 << result2 << result3 << result4;
- }
- }
-}
-
-void tst_QVector::reallocAfterCopy()
-{
- QFETCH(int, capacity);
- QFETCH(int, fill_size);
- QFETCH(int, func_id);
- QFETCH(int, result1);
- QFETCH(int, result2);
- QFETCH(int, result3);
- QFETCH(int, result4);
-
- QVector<qreal> v1;
- QVector<qreal> v2;
-
- v1.reserve(capacity);
- v1.resize(0);
- v1.fill(qreal(1.0), fill_size);
-
- v2 = v1;
-
- // no need to test begin() and end(), there is a detach() in them
- if (func_id == 0) {
- v1.append(qreal(1.0)); //push_back is same as append
- } else if (func_id == 1) {
- v1.insert(0, qreal(1.0)); //push_front is same as prepend, insert(0)
- } else if (func_id == 2) {
- v1.insert(20, qreal(1.0));
- } else if (func_id == 3) {
- v1.insert(0, 10, qreal(1.0));
- }
-
- QCOMPARE(v1.capacity(), result1);
- QCOMPARE(v2.capacity(), result2);
- QCOMPARE(v1.size(), result3);
- QCOMPARE(v2.size(), result4);
-}
-
template<typename T>
void tst_QVector::initializeList()
{
@@ -2636,154 +2392,9 @@ void tst_QVector::initializeListCustom()
void tst_QVector::const_shared_null()
{
QVector<int> v2;
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
- // ### Qt6 remove this section
- QVector<int> v1;
- v1.setSharable(false);
- QVERIFY(v1.isDetached());
-
- v2.setSharable(true);
-#endif
QVERIFY(!v2.isDetached());
}
-#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
-// ### Qt6 remove this section
-template<typename T>
-void tst_QVector::setSharable_data() const
-{
- QTest::addColumn<QVector<T> >("vector");
- QTest::addColumn<int>("size");
- QTest::addColumn<int>("capacity");
- QTest::addColumn<bool>("isCapacityReserved");
-
- QVector<T> null;
- QVector<T> empty(0, SimpleValue<T>::at(1));
- QVector<T> emptyReserved;
- QVector<T> nonEmpty;
- QVector<T> nonEmptyReserved;
-
- emptyReserved.reserve(10);
- nonEmptyReserved.reserve(15);
-
- nonEmpty << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2) << SimpleValue<T>::at(3) << SimpleValue<T>::at(4);
- nonEmptyReserved << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2) << SimpleValue<T>::at(3) << SimpleValue<T>::at(4) << SimpleValue<T>::at(5) << SimpleValue<T>::at(6);
-
- QVERIFY(emptyReserved.capacity() >= 10);
- QVERIFY(nonEmptyReserved.capacity() >= 15);
-
- QTest::newRow("null") << null << 0 << 0 << false;
- QTest::newRow("empty") << empty << 0 << 0 << false;
- QTest::newRow("empty, Reserved") << emptyReserved << 0 << 10 << true;
- QTest::newRow("non-empty") << nonEmpty << 5 << 0 << false;
- QTest::newRow("non-empty, Reserved") << nonEmptyReserved << 7 << 15 << true;
-}
-
-template<typename T>
-void tst_QVector::setSharable() const
-{
- QFETCH(QVector<T>, vector);
- QFETCH(int, size);
- QFETCH(int, capacity);
- QFETCH(bool, isCapacityReserved);
-
- QVERIFY(!vector.isDetached()); // Shared with QTest
-
- vector.setSharable(true);
-
- QCOMPARE(vector.size(), size);
- if (isCapacityReserved)
- QVERIFY2(vector.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .arg(vector.capacity())
- .arg(capacity)));
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(vector));
- }
-
- vector.setSharable(false);
- QVERIFY(vector.isDetached() || vector.isSharedWith(QVector<T>()));
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(copy.isDetached() || copy.isEmpty() || copy.isSharedWith(QVector<T>()));
- QCOMPARE(copy.size(), size);
- if (isCapacityReserved)
- QVERIFY2(copy.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .arg(copy.capacity())
- .arg(capacity)));
- QCOMPARE(copy, vector);
- }
-
- vector.setSharable(true);
-
- {
- QVector<T> copy(vector);
-
- QVERIFY(!copy.isDetached());
- QVERIFY(copy.isSharedWith(vector));
- }
-
- for (int i = 0; i < vector.size(); ++i)
- QCOMPARE(vector[i], SimpleValue<T>::at(i));
-
- QCOMPARE(vector.size(), size);
- if (isCapacityReserved)
- QVERIFY2(vector.capacity() >= capacity,
- qPrintable(QString("Capacity is %1, expected at least %2.")
- .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()
-{
- setSharable<int>();
-}
-
-void tst_QVector::setSharableMovable()
-{
- const int instancesCount = Movable::counter.loadAcquire();
- setSharable<Movable>();
- QCOMPARE(instancesCount, Movable::counter.loadAcquire());
-}
-
-void tst_QVector::setSharableCustom()
-{
- const int instancesCount = Custom::counter.loadAcquire();
- setSharable<Custom>();
- QCOMPARE(instancesCount, Custom::counter.loadAcquire());
-}
-
template<typename T>
void tst_QVector::detach() const
{
@@ -2791,7 +2402,7 @@ void tst_QVector::detach() const
// detach an empty vector
QVector<T> v;
v.detach();
- QVERIFY(v.isDetached());
+ QVERIFY(!v.isDetached());
QCOMPARE(v.size(), 0);
QCOMPARE(v.capacity(), 0);
}
@@ -2801,7 +2412,7 @@ void tst_QVector::detach() const
QVector<T> ref(v);
QVERIFY(!v.isDetached());
v.detach();
- QVERIFY(v.isDetached());
+ QVERIFY(!v.isDetached());
QCOMPARE(v.size(), 0);
QCOMPARE(v.capacity(), 0);
}
@@ -3048,5 +2659,172 @@ void tst_QVector::swapItemsAt() const
QCOMPARE(copy.at(2), 2);
}
+void tst_QVector::emplaceInt()
+{
+ emplaceImpl<int>();
+}
+
+void tst_QVector::emplaceCustom()
+{
+ emplaceImpl<Custom>();
+}
+
+void tst_QVector::emplaceMovable()
+{
+ emplaceImpl<Movable>();
+}
+
+void tst_QVector::emplaceConsistentWithStdVectorInt()
+{
+ emplaceConsistentWithStdVectorImpl<int>();
+}
+
+void tst_QVector::emplaceConsistentWithStdVectorCustom()
+{
+ emplaceConsistentWithStdVectorImpl<Custom>();
+}
+
+void tst_QVector::emplaceConsistentWithStdVectorMovable()
+{
+ emplaceConsistentWithStdVectorImpl<Movable>();
+}
+
+void tst_QVector::emplaceReturnsIterator()
+{
+ QVector<Movable> vec;
+
+ vec.emplace(0, 'k')->i = 'p';
+
+ QCOMPARE(vec[0].i, 'p');
+}
+
+void tst_QVector::emplaceBack()
+{
+ QScopedValueRollback<QAtomicInt> rollback(Movable::counter, 0);
+
+ QVector<Movable> vec;
+
+ vec.emplaceBack('k');
+
+ QCOMPARE(Movable::counter, 1);
+}
+
+void tst_QVector::emplaceBackReturnsRef()
+{
+ QVector<Movable> vec;
+
+ vec.emplaceBack('k').i = 'p';
+
+ QCOMPARE(vec.at(0).i, 'p');
+}
+
+void tst_QVector::emplaceWithElementFromTheSameContainer()
+{
+ QFETCH(int, elementPos);
+ QFETCH(int, insertPos);
+ QFETCH(bool, doCopy);
+
+ QVector<QString> vec {"a", "b", "c", "d", "e"};
+ const QString e = vec[elementPos];
+
+ if (doCopy)
+ vec.emplace(insertPos, vec[elementPos]);
+ else
+ vec.emplace(insertPos, std::move(vec[elementPos]));
+
+ QCOMPARE(vec[insertPos], e);
+}
+
+void tst_QVector::emplaceWithElementFromTheSameContainer_data()
+{
+ QTest::addColumn<int>("elementPos");
+ QTest::addColumn<int>("insertPos");
+ QTest::addColumn<bool>("doCopy");
+
+ for (int i = 0; i < 2; ++i) {
+ const bool doCopy = i == 0;
+ const char *opName = doCopy ? "copy" : "move";
+
+ QTest::addRow("%s: begin -> end" , opName) << 0 << 5 << doCopy;
+ QTest::addRow("%s: begin -> middle", opName) << 0 << 2 << doCopy;
+ QTest::addRow("%s: middle -> begin" , opName) << 2 << 0 << doCopy;
+ QTest::addRow("%s: middle -> end" , opName) << 2 << 5 << doCopy;
+ QTest::addRow("%s: end -> middle", opName) << 4 << 2 << doCopy;
+ QTest::addRow("%s: end -> begin" , opName) << 4 << 0 << doCopy;
+ }
+}
+
+template<typename T>
+void tst_QVector::emplaceImpl() const
+{
+ QVector<T> vec {'a', 'b', 'c', 'd'};
+
+ vec.emplace(2, 'k');
+
+ QCOMPARE(vec[2], T('k'));
+}
+
+template <class T>
+static void vecEq(const QVector<T> &qVec, const std::vector<T> &stdVec)
+{
+ QCOMPARE(std::size_t(qVec.size()), stdVec.size());
+ QVERIFY(std::equal(qVec.begin(), qVec.end(), stdVec.begin(), stdVec.end()));
+}
+
+template <class T>
+static void squeezeVec(QVector<T> &qVec, std::vector<T> &stdVec)
+{
+ qVec.squeeze();
+ stdVec.shrink_to_fit();
+}
+
+template<typename T>
+void tst_QVector::emplaceConsistentWithStdVectorImpl() const
+{
+ QVector<T> qVec {'a', 'b', 'c', 'd', 'e'};
+ std::vector<T> stdVec {'a', 'b', 'c', 'd', 'e'};
+ vecEq(qVec, stdVec);
+
+ qVec.emplaceBack('f');
+ stdVec.emplace_back('f');
+ vecEq(qVec, stdVec);
+
+ qVec.emplace(3, 'g');
+ stdVec.emplace(stdVec.begin() + 3, 'g');
+ vecEq(qVec, stdVec);
+
+ qVec.emplaceBack(std::move(qVec[0]));
+ stdVec.emplace_back(std::move(stdVec[0]));
+ vecEq(qVec, stdVec);
+
+ squeezeVec(qVec, stdVec);
+
+ qVec.emplaceBack(std::move(qVec[1]));
+ stdVec.emplace_back(std::move(stdVec[1]));
+ vecEq(qVec, stdVec);
+
+ squeezeVec(qVec, stdVec);
+
+ qVec.emplace(3, std::move(qVec[5]));
+ stdVec.emplace(stdVec.begin() + 3, std::move(stdVec[5]));
+ vecEq(qVec, stdVec);
+
+ qVec.emplaceBack(qVec[3]);
+ stdVec.emplace_back(stdVec[3]);
+ vecEq(qVec, stdVec);
+
+ squeezeVec(qVec, stdVec);
+
+ qVec.emplaceBack(qVec[4]);
+ stdVec.emplace_back(stdVec[4]);
+ vecEq(qVec, stdVec);
+
+ squeezeVec(qVec, stdVec);
+
+ qVec.emplace(5, qVec[7]);
+ stdVec.emplace(stdVec.begin() + 5, stdVec[7]);
+ vecEq(qVec, stdVec);
+}
+
QTEST_MAIN(tst_QVector)
#include "tst_qvector.moc"
diff --git a/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro b/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro
deleted file mode 100644
index d6cad86aac..0000000000
--- a/tests/auto/corelib/tools/qvector_strictiterators/qvector_strictiterators.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-include(../qvector/qvector.pro)
-TARGET = tst_qvector_strictiterators
-DEFINES += QT_STRICT_ITERATORS=1 tst_QVector=tst_QVector_StrictIterators
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index 7c4d1071ce..928bd365fd 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -81,6 +81,10 @@ private slots:
void serialize();
void moveSemantics();
void qtVersion();
+ void qTypeRevision_data();
+ void qTypeRevision();
+ void qTypeRevisionTypes();
+ void qTypeRevisionComparison();
};
void tst_QVersionNumber::singleInstanceData()
@@ -645,6 +649,153 @@ void tst_QVersionNumber::qtVersion()
QCOMPARE(v.toString(), QString(qVersion()));
}
+template<typename Integer>
+void compileTestRevisionMajorMinor()
+{
+ const Integer major = 8;
+ const Integer minor = 4;
+
+ const QTypeRevision r2 = QTypeRevision::fromVersion(major, minor);
+ QCOMPARE(r2.majorVersion(), 8);
+ QCOMPARE(r2.minorVersion(), 4);
+
+ const QTypeRevision r3 = QTypeRevision::fromMajorVersion(major);
+ QCOMPARE(r3.majorVersion(), 8);
+ QVERIFY(!r3.hasMinorVersion());
+
+ const QTypeRevision r4 = QTypeRevision::fromMinorVersion(minor);
+ QVERIFY(!r4.hasMajorVersion());
+ QCOMPARE(r4.minorVersion(), 4);
+}
+
+
+template<typename Integer>
+void compileTestRevision()
+{
+ if (std::is_signed<Integer>::value)
+ compileTestRevision<typename QIntegerForSize<sizeof(Integer) / 2>::Signed>();
+ else
+ compileTestRevision<typename QIntegerForSize<sizeof(Integer) / 2>::Unsigned>();
+
+ const Integer value = 0x0510;
+ const QTypeRevision r = QTypeRevision::fromEncodedVersion(value);
+
+ QCOMPARE(r.majorVersion(), 5);
+ QCOMPARE(r.minorVersion(), 16);
+ QCOMPARE(r.toEncodedVersion<Integer>(), value);
+
+ compileTestRevisionMajorMinor<Integer>();
+}
+
+template<>
+void compileTestRevision<qint16>()
+{
+ compileTestRevisionMajorMinor<quint8>();
+}
+
+template<>
+void compileTestRevision<quint8>()
+{
+ compileTestRevisionMajorMinor<quint8>();
+}
+
+template<>
+void compileTestRevision<qint8>()
+{
+ compileTestRevisionMajorMinor<qint8>();
+}
+
+void tst_QVersionNumber::qTypeRevision_data()
+{
+ QTest::addColumn<QTypeRevision>("revision");
+ QTest::addColumn<bool>("valid");
+ QTest::addColumn<int>("major");
+ QTest::addColumn<int>("minor");
+
+ QTest::addRow("Qt revision") << QTypeRevision::fromVersion(QT_VERSION_MAJOR, QT_VERSION_MINOR)
+ << true << QT_VERSION_MAJOR << QT_VERSION_MINOR;
+ QTest::addRow("invalid") << QTypeRevision() << false << 0xff << 0xff;
+ QTest::addRow("major") << QTypeRevision::fromMajorVersion(6) << true << 6 << 0xff;
+ QTest::addRow("minor") << QTypeRevision::fromMinorVersion(15) << true << 0xff << 15;
+ QTest::addRow("zero") << QTypeRevision::fromVersion(0, 0) << true << 0 << 0;
+
+ // We're intentionally not testing negative numbers.
+ // There are asserts against negative numbers in QTypeRevision.
+ // You must not pass them as major or minor versions, or values.
+}
+
+void tst_QVersionNumber::qTypeRevision()
+{
+ const QTypeRevision other = QTypeRevision::fromVersion(127, 128);
+
+ QFETCH(QTypeRevision, revision);
+
+ QFETCH(bool, valid);
+ QFETCH(int, major);
+ QFETCH(int, minor);
+
+ QCOMPARE(revision.isValid(), valid);
+ QCOMPARE(revision.majorVersion(), major);
+ QCOMPARE(revision.minorVersion(), minor);
+
+ QCOMPARE(revision.hasMajorVersion(), QTypeRevision::isValidSegment(major));
+ QCOMPARE(revision.hasMinorVersion(), QTypeRevision::isValidSegment(minor));
+
+ const QTypeRevision copy = QTypeRevision::fromEncodedVersion(revision.toEncodedVersion<int>());
+ QCOMPARE(copy, revision);
+
+ QVERIFY(revision != other);
+ QVERIFY(copy != other);
+}
+
+void tst_QVersionNumber::qTypeRevisionTypes()
+{
+ compileTestRevision<quint64>();
+ compileTestRevision<qint64>();
+
+ QVERIFY(!QTypeRevision::isValidSegment(0xff));
+ QVERIFY(!QTypeRevision::isValidSegment(-1));
+
+ const QTypeRevision maxRevision = QTypeRevision::fromVersion(254, 254);
+ QVERIFY(maxRevision.hasMajorVersion());
+ QVERIFY(maxRevision.hasMinorVersion());
+}
+
+void tst_QVersionNumber::qTypeRevisionComparison()
+{
+ const QTypeRevision revisions[] = {
+ QTypeRevision::zero(),
+ QTypeRevision::fromMajorVersion(0),
+ QTypeRevision::fromVersion(0, 1),
+ QTypeRevision::fromVersion(0, 20),
+ QTypeRevision::fromMinorVersion(0),
+ QTypeRevision(),
+ QTypeRevision::fromMinorVersion(1),
+ QTypeRevision::fromMinorVersion(20),
+ QTypeRevision::fromVersion(1, 0),
+ QTypeRevision::fromMajorVersion(1),
+ QTypeRevision::fromVersion(1, 1),
+ QTypeRevision::fromVersion(1, 20),
+ QTypeRevision::fromVersion(20, 0),
+ QTypeRevision::fromMajorVersion(20),
+ QTypeRevision::fromVersion(20, 1),
+ QTypeRevision::fromVersion(20, 20),
+ };
+
+ const int length = sizeof(revisions) / sizeof(QTypeRevision);
+
+ for (int i = 0; i < length; ++i) {
+ for (int j = 0; j < length; ++j) {
+ QCOMPARE(revisions[i] == revisions[j], i == j);
+ QCOMPARE(revisions[i] != revisions[j], i != j);
+ QCOMPARE(revisions[i] < revisions[j], i < j);
+ QCOMPARE(revisions[i] > revisions[j], i > j);
+ QCOMPARE(revisions[i] <= revisions[j], i <= j);
+ QCOMPARE(revisions[i] >= revisions[j], i >= j);
+ }
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QVersionNumber)
#include "tst_qversionnumber.moc"
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index 49b2a1f075..e51be90100 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -4,7 +4,6 @@ SUBDIRS=\
containerapisymmetry \
qalgorithms \
qarraydata \
- qarraydata_strictiterators \
qbitarray \
qcache \
qcommandlineparser \
@@ -12,17 +11,13 @@ SUBDIRS=\
qcryptographichash \
qeasingcurve \
qexplicitlyshareddatapointer \
+ qflatmap \
qfreelist \
qhash \
- qhash_strictiterators \
qhashfunctions \
qline \
- qlinkedlist \
- qlist \
- qlist_strictiterators \
qmakearray \
qmap \
- qmap_strictiterators \
qmargins \
qmessageauthenticationcode \
qoffsetstringarray \
@@ -43,7 +38,6 @@ SUBDIRS=\
qtimeline \
qvarlengtharray \
qvector \
- qvector_strictiterators \
qversionnumber
darwin: SUBDIRS += qmacautoreleasepool