summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp29
-rw-r--r--tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp29
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp29
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp29
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp29
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp29
-rw-r--r--tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp29
-rw-r--r--tests/auto/corelib/global/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp29
-rw-r--r--tests/auto/corelib/global/qcompare/tst_qcompare.cpp40
-rw-r--r--tests/auto/corelib/global/qflags/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp180
-rw-r--r--tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp49
-rw-r--r--tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp31
-rw-r--r--tests/auto/corelib/global/qglobal/qglobal.c41
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp29
-rw-r--r--tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp31
-rw-r--r--tests/auto/corelib/global/qhooks/tst_qhooks.cpp29
-rw-r--r--tests/auto/corelib/global/qkeycombination/tst_qkeycombination.cpp29
-rw-r--r--tests/auto/corelib/global/qlogging/app/main.cpp29
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp115
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qmessagelogger.cpp29
-rw-r--r--tests/auto/corelib/global/qnativeinterface/tst_qnativeinterface.cpp29
-rw-r--r--tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp70
-rw-r--r--tests/auto/corelib/global/qoperatingsystemversion/tst_qoperatingsystemversion.cpp29
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp29
-rw-r--r--tests/auto/corelib/global/qtendian/tst_qtendian.cpp166
-rw-r--r--tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp29
-rw-r--r--tests/auto/corelib/global/qxp/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/global/qxp/function_ref/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/global/qxp/function_ref/tst_qxp_function_ref.cpp279
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp29
-rw-r--r--tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp29
-rw-r--r--tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp106
-rw-r--r--tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp95
-rw-r--r--tests/auto/corelib/io/qdebug/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp104
-rw-r--r--tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp29
-rw-r--r--tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp29
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp73
-rw-r--r--tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp31
-rw-r--r--tests/auto/corelib/io/qfile/stdinprocess/main.cpp29
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp43
-rw-r--r--tests/auto/corelib/io/qfileinfo/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp102
-rw-r--r--tests/auto/corelib/io/qfileselector/CMakeLists.txt19
-rw-r--r--tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp29
-rw-r--r--tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp35
-rw-r--r--tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp29
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST9
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp31
-rw-r--r--tests/auto/corelib/io/qiodevice/CMakeLists.txt21
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp52
-rw-r--r--tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp29
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp29
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp31
-rw-r--r--tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp31
-rw-r--r--tests/auto/corelib/io/qloggingregistry/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp29
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testDetached/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testExitCodes/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testForwarding/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testForwardingHelper/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp31
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessHang/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp29
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp132
-rw-r--r--tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp29
-rw-r--r--tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp42
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp29
-rw-r--r--tests/auto/corelib/io/qsettings/.gitattributes2
-rw-r--r--tests/auto/corelib/io/qsettings/CMakeLists.txt33
-rw-r--r--tests/auto/corelib/io/qsettings/qt5settings.ini11
-rw-r--r--tests/auto/corelib/io/qsettings/resourcefile4.ini2
-rw-r--r--tests/auto/corelib/io/qsettings/resourcefile5.ini2
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp368
-rw-r--r--tests/auto/corelib/io/qsettings/utf8settings.ini11
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp31
-rw-r--r--tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp29
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp96
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp43
-rw-r--r--tests/auto/corelib/io/qurl/idna-test.c29
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp35
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl_mac.mm29
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp37
-rw-r--r--tests/auto/corelib/io/qurlinternal/utf8data.cpp31
-rw-r--r--tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp78
-rw-r--r--tests/auto/corelib/io/qurluts46/tst_qurluts46.cpp31
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp157
-rw-r--r--tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp40
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp32
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.h29
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qstringlistmodel/qmodellistener.h29
-rw-r--r--tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp29
-rw-r--r--tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp40
-rw-r--r--tests/auto/corelib/kernel/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/kernel/qapplicationstatic/tst_qapplicationstatic.cpp29
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp59
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h33
-rw-r--r--tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp29
-rw-r--r--tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp29
-rw-r--r--tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp56
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp29
-rw-r--r--tests/auto/corelib/kernel/qjnienvironment/testdata/src/org/qtproject/qt/android/testdata/QtJniEnvironmentTestClass.java29
-rw-r--r--tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp70
-rw-r--r--tests/auto/corelib/kernel/qjniobject/testdata/src/org/qtproject/qt/android/testdata/QtJniObjectTestClass.java29
-rw-r--r--tests/auto/corelib/kernel/qjniobject/tst_qjniobject.cpp218
-rw-r--r--tests/auto/corelib/kernel/qjnitypes/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/kernel/qjnitypes/tst_qjnitypes.cpp124
-rw-r--r--tests/auto/corelib/kernel/qmath/tst_qmath.cpp42
-rw-r--r--tests/auto/corelib/kernel/qmetacontainer/tst_qmetacontainer.cpp31
-rw-r--r--tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp29
-rw-r--r--tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp31
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp29
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp52
-rw-r--r--tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp33
-rw-r--r--tests/auto/corelib/kernel/qmetatype/CMakeLists.txt17
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp35
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h32
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp29
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp29
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h32
-rw-r--r--tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp29
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp29
-rw-r--r--tests/auto/corelib/kernel/qobject/signalbug/signalbug.h29
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp92
-rw-r--r--tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp29
-rw-r--r--tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp169
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp31
-rw-r--r--tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp29
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp31
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp31
-rw-r--r--tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp29
-rw-r--r--tests/auto/corelib/kernel/qvariant/CMakeLists.txt22
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp35
-rw-r--r--tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp29
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp29
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp29
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/test.qml29
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp39
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h29
-rw-r--r--tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp30
-rw-r--r--tests/auto/corelib/platform/android/tst_android.cpp29
-rw-r--r--tests/auto/corelib/plugin/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.cpp29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin1/plugininterface1.h29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.cpp29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/plugin2/plugininterface2.h29
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt54
-rw-r--r--tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp58
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib/mylib.c29
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt49
-rw-r--r--tests/auto/corelib/plugin/qlibrary/lib2/mylib.c29
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt40
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp59
-rw-r--r--tests/auto/corelib/plugin/qplugin/CMakeLists.txt36
-rw-r--r--tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp29
-rw-r--r--tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp29
-rw-r--r--tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp29
-rw-r--r--tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp45
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/fakeplugin.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/lib/mylib.c29
-rwxr-xr-xtests/auto/corelib/plugin/qpluginloader/machtest/generate-bad.pl29
-rwxr-xr-xtests/auto/corelib/plugin/qpluginloader/machtest/ppcconverter.pl29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h29
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt31
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp78
-rw-r--r--tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp29
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp29
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm29
-rw-r--r--tests/auto/corelib/serialization/CMakeLists.txt3
-rw-r--r--tests/auto/corelib/serialization/cborlargedatavalidation.cpp40
-rw-r--r--tests/auto/corelib/serialization/json/CMakeLists.txt37
-rw-r--r--tests/auto/corelib/serialization/json/tst_qtjson.cpp277
-rw-r--r--tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp47
-rw-r--r--tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp40
-rw-r--r--tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp541
-rw-r--r--tests/auto/corelib/serialization/qcborvalue_json/tst_qcborvalue_json.cpp43
-rw-r--r--tests/auto/corelib/serialization/qdatastream/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/serialization/qdatastream/gen_typedefq5.cpp29
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp33
-rw-r--r--tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp29
-rw-r--r--tests/auto/corelib/serialization/qtextstream/readAllStdinProcess/main.cpp30
-rw-r--r--tests/auto/corelib/serialization/qtextstream/readLineStdinProcess/main.cpp29
-rw-r--r--tests/auto/corelib/serialization/qtextstream/stdinProcess/main.cpp29
-rw-r--r--tests/auto/corelib/serialization/qtextstream/test/CMakeLists.txt29
-rw-r--r--tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp72
-rw-r--r--tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/serialization/qxmlstream/qc14n.h29
-rwxr-xr-xtests/auto/corelib/serialization/qxmlstream/setupSuite.sh29
-rw-r--r--tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp74
-rw-r--r--tests/auto/corelib/text/CMakeLists.txt7
-rw-r--r--tests/auto/corelib/text/qanystringview/tst_qanystringview.cpp86
-rw-r--r--tests/auto/corelib/text/qbytearray/CMakeLists.txt14
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp139
-rw-r--r--tests/auto/corelib/text/qbytearray/tst_qbytearray_mac.mm31
-rw-r--r--tests/auto/corelib/text/qbytearrayapisymmetry/tst_qbytearrayapisymmetry.cpp29
-rw-r--r--tests/auto/corelib/text/qbytearraylist/tst_qbytearraylist.cpp31
-rw-r--r--tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp29
-rw-r--r--tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp35
-rw-r--r--tests/auto/corelib/text/qbytedatabuffer/tst_qbytedatabuffer.cpp29
-rw-r--r--tests/auto/corelib/text/qchar/CMakeLists.txt17
-rw-r--r--tests/auto/corelib/text/qchar/tst_qchar.cpp29
-rw-r--r--tests/auto/corelib/text/qcollator/tst_qcollator.cpp29
-rw-r--r--tests/auto/corelib/text/qlatin1string/.gitignore1
-rw-r--r--tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp298
-rw-r--r--tests/auto/corelib/text/qlatin1stringview/.gitignore1
-rw-r--r--tests/auto/corelib/text/qlatin1stringview/CMakeLists.txt (renamed from tests/auto/corelib/text/qlatin1string/CMakeLists.txt)8
-rw-r--r--tests/auto/corelib/text/qlatin1stringview/tst_qlatin1stringview.cpp415
-rw-r--r--tests/auto/corelib/text/qlocale/syslocaleapp/syslocaleapp.cpp29
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp264
-rw-r--r--tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp40
-rw-r--r--tests/auto/corelib/text/qstring/double_data.h29
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp524
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring_mac.mm29
-rw-r--r--tests/auto/corelib/text/qstring_no_cast_from_bytearray/tst_qstring_no_cast_from_bytearray.cpp29
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp950
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp29
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder1/tst_qstringbuilder1.cpp29
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder2/tst_qstringbuilder2.cpp29
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder3/tst_qstringbuilder3.cpp29
-rw-r--r--tests/auto/corelib/text/qstringbuilder/qstringbuilder4/tst_qstringbuilder4.cpp29
-rw-r--r--tests/auto/corelib/text/qstringconverter/BLACKLIST3
-rw-r--r--tests/auto/corelib/text/qstringconverter/CMakeLists.txt22
-rw-r--r--tests/auto/corelib/text/qstringconverter/euc_kr.txt1
-rw-r--r--tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp872
-rw-r--r--tests/auto/corelib/text/qstringconverter/utf8.txt1
-rw-r--r--tests/auto/corelib/text/qstringiterator/tst_qstringiterator.cpp29
-rw-r--r--tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp29
-rw-r--r--tests/auto/corelib/text/qstringmatcher/tst_qstringmatcher.cpp29
-rw-r--r--tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp42
-rw-r--r--tests/auto/corelib/text/qstringview/tst_qstringview.cpp29
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/CMakeLists.txt25
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/LineBreakTest.txt124
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/LineBreakTest.txt.full7686
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/ReadMe.full.txt4
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt88
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/data/WordBreakTest.txt.full1851
-rw-r--r--tests/auto/corelib/text/qtextboundaryfinder/tst_qtextboundaryfinder.cpp35
-rw-r--r--tests/auto/corelib/text/qunicodetools/tst_qunicodetools.cpp29
-rw-r--r--tests/auto/corelib/text/shared/test_number_shared.h29
-rw-r--r--tests/auto/corelib/thread/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/thread/qatomicint/BLACKLIST3
-rw-r--r--tests/auto/corelib/thread/qatomicint/tst_qatomicint.cpp34
-rw-r--r--tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp29
-rw-r--r--tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp31
-rw-r--r--tests/auto/corelib/thread/qfuture/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp524
-rw-r--r--tests/auto/corelib/thread/qfuturesynchronizer/tst_qfuturesynchronizer.cpp29
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp32
-rw-r--r--tests/auto/corelib/thread/qmutex/tst_qmutex.cpp31
-rw-r--r--tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp109
-rw-r--r--tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp51
-rw-r--r--tests/auto/corelib/thread/qpromise/tst_qpromise.cpp63
-rw-r--r--tests/auto/corelib/thread/qreadlocker/tst_qreadlocker.cpp29
-rw-r--r--tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp29
-rw-r--r--tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp29
-rw-r--r--tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp29
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp129
-rw-r--r--tests/auto/corelib/thread/qthreadonce/qthreadonce.cpp29
-rw-r--r--tests/auto/corelib/thread/qthreadonce/qthreadonce.h29
-rw-r--r--tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp29
-rw-r--r--tests/auto/corelib/thread/qthreadpool/BLACKLIST4
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp31
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/BLACKLIST3
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/crashonexit/crashOnExit.cpp29
-rw-r--r--tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp34
-rw-r--r--tests/auto/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp29
-rw-r--r--tests/auto/corelib/thread/qwritelocker/tst_qwritelocker.cpp29
-rw-r--r--tests/auto/corelib/time/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/time/qcalendar/tst_qcalendar.cpp29
-rw-r--r--tests/auto/corelib/time/qdate/tst_qdate.cpp110
-rw-r--r--tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp355
-rw-r--r--tests/auto/corelib/time/qdatetime/tst_qdatetime_mac.mm31
-rw-r--r--tests/auto/corelib/time/qdatetimeparser/tst_qdatetimeparser.cpp29
-rw-r--r--tests/auto/corelib/time/qtime/tst_qtime.cpp29
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp168
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone_darwin.mm29
-rw-r--r--tests/auto/corelib/tools/CMakeLists.txt6
-rw-r--r--tests/auto/corelib/tools/collections/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp29
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp221
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp29
-rw-r--r--tests/auto/corelib/tools/qarraydata/simplevector.h30
-rw-r--r--tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp29
-rw-r--r--tests/auto/corelib/tools/qatomicscopedvaluerollback/CMakeLists.txt6
-rw-r--r--tests/auto/corelib/tools/qatomicscopedvaluerollback/tst_qatomicscopedvaluerollback.cpp157
-rw-r--r--tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp29
-rw-r--r--tests/auto/corelib/tools/qcache/tst_qcache.cpp29
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp29
-rw-r--r--tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp31
-rw-r--r--tests/auto/corelib/tools/qcontiguouscache/tst_qcontiguouscache.cpp29
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/CMakeLists.txt18
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp29
-rw-r--r--tests/auto/corelib/tools/qduplicatetracker/tst_qduplicatetracker.cpp29
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp29
-rw-r--r--tests/auto/corelib/tools/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp29
-rw-r--r--tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp173
-rw-r--r--tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp29
-rw-r--r--tests/auto/corelib/tools/qhash/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp160
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp30
-rw-r--r--tests/auto/corelib/tools/qhashseed/tst_qhashseed.cpp29
-rw-r--r--tests/auto/corelib/tools/qhashseed/tst_qhashseed_helper.cpp29
-rw-r--r--tests/auto/corelib/tools/qline/tst_qline.cpp71
-rw-r--r--tests/auto/corelib/tools/qlist/CMakeLists.txt2
-rw-r--r--tests/auto/corelib/tools/qlist/tst_qlist.cpp37
-rw-r--r--tests/auto/corelib/tools/qmacautoreleasepool/tst_qmacautoreleasepool.mm29
-rw-r--r--tests/auto/corelib/tools/qmakearray/tst_qmakearray.cpp29
-rw-r--r--tests/auto/corelib/tools/qmap/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp29
-rw-r--r--tests/auto/corelib/tools/qmargins/tst_qmargins.cpp63
-rw-r--r--tests/auto/corelib/tools/qmessageauthenticationcode/tst_qmessageauthenticationcode.cpp29
-rw-r--r--tests/auto/corelib/tools/qoffsetstringarray/tst_qoffsetstringarray.cpp29
-rw-r--r--tests/auto/corelib/tools/qpair/tst_qpair.cpp29
-rw-r--r--tests/auto/corelib/tools/qpoint/tst_qpoint.cpp58
-rw-r--r--tests/auto/corelib/tools/qpointf/tst_qpointf.cpp29
-rw-r--r--tests/auto/corelib/tools/qqueue/tst_qqueue.cpp29
-rw-r--r--tests/auto/corelib/tools/qrect/tst_qrect.cpp66
-rw-r--r--tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp30
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp29
-rw-r--r--tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp29
-rw-r--r--tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp31
-rw-r--r--tests/auto/corelib/tools/qset/CMakeLists.txt5
-rw-r--r--tests/auto/corelib/tools/qset/tst_qset.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/externaltests.h29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.cpp31
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/forwarddeclared.h31
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/nontracked.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/nontracked.h29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp82
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.cpp29
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/wrapper.h29
-rw-r--r--tests/auto/corelib/tools/qsize/tst_qsize.cpp58
-rw-r--r--tests/auto/corelib/tools/qsizef/tst_qsizef.cpp29
-rw-r--r--tests/auto/corelib/tools/qstl/tst_qstl.cpp29
-rw-r--r--tests/auto/corelib/tools/qtaggedpointer/tst_qtaggedpointer.cpp29
-rw-r--r--tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp29
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp29
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp31
385 files changed, 8311 insertions, 20470 deletions
diff --git a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
index 65e57e2d84..0408ad806b 100644
--- a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
+++ b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qabstractanimation.h>
diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
index 8892a0b1ab..162f8ea9fc 100644
--- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QPauseAnimation>
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 6cf7e5cb94..6d73725cff 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QVariantAnimation>
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index 0688eafda8..ba57904620 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index 88bfe0dc9f..a5eff80e49 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtTest/private/qpropertytesthelper_p.h>
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index fbe3ffe4ae..61be0d00f5 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QVariantAnimation>
diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
index cbb73296b4..2d8d674ba5 100644
--- a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
+++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qvariantanimation.h>
diff --git a/tests/auto/corelib/global/CMakeLists.txt b/tests/auto/corelib/global/CMakeLists.txt
index fe63402288..e19eab18eb 100644
--- a/tests/auto/corelib/global/CMakeLists.txt
+++ b/tests/auto/corelib/global/CMakeLists.txt
@@ -21,3 +21,4 @@ add_subdirectory(qoperatingsystemversion)
if(WIN32)
add_subdirectory(qwinregistry)
endif()
+add_subdirectory(qxp)
diff --git a/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp b/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp
index 9d6bc15d73..5320ba90c0 100644
--- a/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp
+++ b/tests/auto/corelib/global/q_func_info/tst_q_func_info.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QString>
diff --git a/tests/auto/corelib/global/qcompare/tst_qcompare.cpp b/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
index 61ea0eddc4..cc21bd9d14 100644
--- a/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
+++ b/tests/auto/corelib/global/qcompare/tst_qcompare.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtCore/QtCompare>
#include <QtTest/QTest>
diff --git a/tests/auto/corelib/global/qflags/CMakeLists.txt b/tests/auto/corelib/global/qflags/CMakeLists.txt
index 998834d619..8ba02d93b4 100644
--- a/tests/auto/corelib/global/qflags/CMakeLists.txt
+++ b/tests/auto/corelib/global/qflags/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from qflags.pro.
-
#####################################################################
## tst_qflags Test:
#####################################################################
@@ -9,5 +7,9 @@ qt_internal_add_test(tst_qflags
tst_qflags.cpp
)
-## Scopes:
-#####################################################################
+qt_internal_add_test(tst_qflags_non_typesafe
+ SOURCES
+ tst_qflags.cpp
+ DEFINES
+ QFLAGS_TEST_NO_TYPESAFE_FLAGS
+)
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index 3179cfc9d2..f267fc4497 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -1,38 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QTest>
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#ifdef QFLAGS_TEST_NO_TYPESAFE_FLAGS
+# ifdef QT_TYPESAFE_FLAGS
+# undef QT_TYPESAFE_FLAGS
+# endif
+#else
+# ifndef QT_TYPESAFE_FLAGS
+# define QT_TYPESAFE_FLAGS
+# endif
+#endif
-QT_WARNING_DISABLE_DEPRECATED
+#include <QTest>
class tst_QFlags: public QObject
{
Q_OBJECT
private slots:
+ void boolCasts() const;
+ void operators() const;
+ void mixingDifferentEnums() const;
void testFlag() const;
void testFlagZeroFlag() const;
void testFlagMultiBits() const;
@@ -46,6 +33,105 @@ private slots:
void adl();
};
+void tst_QFlags::boolCasts() const
+{
+ // This tests that the operator overloading is sufficient so that common
+ // idioms involving flags -> bool casts work as expected:
+
+ const Qt::Alignment nonNull = Qt::AlignCenter;
+ const Qt::Alignment null = {};
+
+ // basic premiss:
+ QVERIFY(bool(nonNull));
+ QVERIFY(!bool(null));
+
+ // The rest is just checking that stuff compiles:
+
+ // QVERIFY should compile:
+ QVERIFY(nonNull);
+ QVERIFY(!null);
+
+ // ifs should compile:
+ if (null) QFAIL("Can't contextually convert QFlags to bool!");
+ if (!nonNull) QFAIL("Missing operator! on QFlags (shouldn't be necessary).");
+
+ // ternary should compile:
+ QVERIFY(nonNull ? true : false);
+ QVERIFY(!null ? true : false);
+
+ // logical operators should compile:
+ QVERIFY(nonNull && true);
+ QVERIFY(nonNull || false);
+ QVERIFY(!null && true);
+ QVERIFY(!null || false);
+
+ // ... in both directions:
+ QVERIFY(true && nonNull);
+ QVERIFY(false || nonNull);
+ QVERIFY(true && !null);
+ QVERIFY(false || !null);
+
+ // ... and mixed:
+ QVERIFY(null || nonNull);
+ QVERIFY(!(null && nonNull));
+}
+
+void tst_QFlags::operators() const
+{
+#define CHECK(op, LHS, RHS, RES) \
+ do { \
+ QCOMPARE((LHS op RHS), (RES)); \
+ QCOMPARE(( /*CTAD*/ QFlags(LHS) op RHS), (RES)); \
+ QCOMPARE((LHS op QFlags(RHS)), (RES)); \
+ QCOMPARE((QFlags(LHS) op QFlags(RHS)), (RES)); \
+ QCOMPARE((QFlags(LHS) op ## = RHS), (RES)); \
+ QCOMPARE((QFlags(LHS) op ## = QFlags(RHS)), (RES)); \
+ } while (false)
+
+ CHECK(|, Qt::AlignHCenter, Qt::AlignVCenter, Qt::AlignCenter);
+ CHECK(|, Qt::AlignHCenter, Qt::AlignHCenter, Qt::AlignHCenter);
+ CHECK(&, Qt::AlignHCenter, Qt::AlignVCenter, Qt::Alignment());
+ CHECK(&, Qt::AlignHCenter, Qt::AlignHCenter, Qt::AlignHCenter);
+ CHECK(^, Qt::AlignHCenter, Qt::AlignVCenter, Qt::AlignCenter);
+ CHECK(^, Qt::AlignHCenter, Qt::AlignHCenter, Qt::Alignment());
+#undef CHECK
+}
+
+void tst_QFlags::mixingDifferentEnums() const
+{
+#define CHECK(op, LHS, RHS, RES) \
+ /* LHS must be QFlags'able */ \
+ do { \
+ QCOMPARE((LHS op RHS), (RES)); \
+ QCOMPARE((RHS op LHS), (RES)); \
+ /*QCOMPARE(( / *CTAD* / QFlags(LHS) op RHS), (RES));*/ \
+ /*QCOMPARE((QFlags(LHS) op ## = RHS), (RES));*/ \
+ } while (false)
+
+ // AlignmentFlags <-> TextFlags
+ {
+ CHECK(|, Qt::AlignCenter, Qt::TextSingleLine, 0x0184);
+ CHECK(&, Qt::AlignCenter, Qt::TextSingleLine, 0x0000);
+ CHECK(^, Qt::AlignCenter, Qt::TextSingleLine, 0x0184);
+ }
+ // QFlags<AlignmentFlags> <-> TextFlags
+ {
+#ifndef QT_TYPESAFE_FLAGS // QTBUG-101344
+ Qt::Alignment MyAlignCenter = Qt::AlignCenter; // convert enum to QFlags
+ CHECK(|, MyAlignCenter, Qt::TextSingleLine, 0x0184U); // yes, unsigned!
+ CHECK(&, MyAlignCenter, Qt::TextSingleLine, 0x0000U); // yes, unsigned!
+ CHECK(^, MyAlignCenter, Qt::TextSingleLine, 0x0184U); // yes, unsigned!
+#endif
+ }
+ // TextElideMode <-> TextFlags
+ {
+ CHECK(|, Qt::ElideNone, Qt::TextSingleLine, 0x0103);
+ CHECK(&, Qt::ElideNone, Qt::TextSingleLine, 0x0000);
+ CHECK(^, Qt::ElideNone, Qt::TextSingleLine, 0x0103);
+ }
+#undef CHECK
+}
+
void tst_QFlags::testFlag() const
{
Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton;
@@ -150,6 +236,7 @@ void tst_QFlags::testAnyFlag()
}
template <unsigned int N, typename T> bool verifyConstExpr(T n) { return n == N; }
+template <unsigned int N, typename T> bool verifyConstExpr(QFlags<T> n) { return n.toInt() == N; }
constexpr Qt::MouseButtons testRelaxedConstExpr()
{
@@ -164,25 +251,32 @@ constexpr Qt::MouseButtons testRelaxedConstExpr()
void tst_QFlags::constExpr()
{
Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton;
- switch (btn) {
+ switch (btn.toInt()) {
case Qt::LeftButton: QVERIFY(false); break;
case Qt::RightButton: QVERIFY(false); break;
- case int(Qt::LeftButton | Qt::RightButton): QVERIFY(true); break;
- default: QFAIL(qPrintable(QStringLiteral("Unexpected button: %1").arg(btn)));
+ case (Qt::LeftButton | Qt::RightButton).toInt(): QVERIFY(true); break;
+ default: QFAIL(qPrintable(QStringLiteral("Unexpected button: %1").arg(btn.toInt())));
}
- QVERIFY(verifyConstExpr<uint((Qt::LeftButton | Qt::RightButton) & Qt::LeftButton)>(Qt::LeftButton));
- QVERIFY(verifyConstExpr<uint((Qt::LeftButton | Qt::RightButton) & Qt::MiddleButton)>(0));
- QVERIFY(verifyConstExpr<uint((Qt::LeftButton | Qt::RightButton) | Qt::MiddleButton)>(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton));
- QVERIFY(verifyConstExpr<uint(~(Qt::LeftButton | Qt::RightButton))>(~(Qt::LeftButton | Qt::RightButton)));
- QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::LeftButton) ^ Qt::RightButton)>(Qt::LeftButton ^ Qt::RightButton));
- QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(0))>(0));
- QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::RightButton) & 0xff)>(Qt::RightButton));
- QVERIFY(verifyConstExpr<uint(Qt::MouseButtons(Qt::RightButton) | 0xff)>(0xff));
+#define VERIFY_CONSTEXPR(expression, expected) \
+ QVERIFY(verifyConstExpr<(expression).toInt()>(expected))
+
+ VERIFY_CONSTEXPR((Qt::LeftButton | Qt::RightButton) & Qt::LeftButton, Qt::LeftButton);
+ VERIFY_CONSTEXPR((Qt::LeftButton | Qt::RightButton) & Qt::MiddleButton, 0);
+ VERIFY_CONSTEXPR((Qt::LeftButton | Qt::RightButton) | Qt::MiddleButton, Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
+ VERIFY_CONSTEXPR(~(Qt::LeftButton | Qt::RightButton), ~(Qt::LeftButton | Qt::RightButton));
+ VERIFY_CONSTEXPR(Qt::MouseButtons(Qt::LeftButton) ^ Qt::RightButton, Qt::LeftButton ^ Qt::RightButton);
+ VERIFY_CONSTEXPR(Qt::MouseButtons(0), 0);
+#ifndef QT_TYPESAFE_FLAGS
+ QVERIFY(verifyConstExpr<(Qt::MouseButtons(Qt::RightButton) & 0xff)>(Qt::RightButton));
+ QVERIFY(verifyConstExpr<(Qt::MouseButtons(Qt::RightButton) | 0xff)>(0xff));
+#endif
QVERIFY(!verifyConstExpr<Qt::RightButton>(~Qt::MouseButtons(Qt::LeftButton)));
- QVERIFY(verifyConstExpr<uint(testRelaxedConstExpr())>(Qt::MiddleButton));
+ VERIFY_CONSTEXPR(testRelaxedConstExpr(), Qt::MiddleButton);
+
+#undef VERIFY_CONSTEXPR
}
void tst_QFlags::signedness()
@@ -233,11 +327,14 @@ void tst_QFlags::classEnum()
QVERIFY(!f0);
+#ifndef QT_TYPESAFE_FLAGS
QCOMPARE(f3 & int(1), 1);
QCOMPARE(f3 & uint(1), 1);
+#endif
QCOMPARE(f3 & MyStrictEnum::StrictOne, 1);
MyStrictFlags aux;
+#ifndef QT_TYPESAFE_FLAGS
aux = f3;
aux &= int(1);
QCOMPARE(aux, 1);
@@ -245,6 +342,7 @@ void tst_QFlags::classEnum()
aux = f3;
aux &= uint(1);
QCOMPARE(aux, 1);
+#endif
aux = f3;
aux &= MyStrictEnum::StrictOne;
diff --git a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
index 90e131a7ef..e61ceff1c0 100644
--- a/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
+++ b/tests/auto/corelib/global/qfloat16/tst_qfloat16.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2016 by Southwest Research Institute (R)
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2016 by Southwest Research Institute (R)
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QFloat16>
@@ -213,13 +188,7 @@ void tst_qfloat16::qNaN()
QVERIFY(qIsNaN(nan));
QVERIFY(qIsNaN(nan + one));
QVERIFY(qIsNaN(-nan));
-#ifdef Q_CC_INTEL
- QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
-#endif
QVERIFY(qIsNaN(nan * zero));
-#ifdef Q_CC_INTEL
- QEXPECT_FAIL("", "ICC optimizes zero * anything to zero", Continue);
-#endif
QVERIFY(qIsNaN(Bounds::infinity() * zero));
QVERIFY(!nan.isNormal());
@@ -550,17 +519,25 @@ void tst_qfloat16::properties()
// and the same supposed to be for qfloat16.
#if !defined(Q_CC_GHS)
QVERIFY(Bounds::is_iec559);
-#else
+#endif //Q_CC_GHS
+#if QT_CONFIG(signaling_nan)
// Technically, presence of NaN and infinities are implied from the above check, but that checkings GHS compiler complies.
QVERIFY(Bounds::has_infinity && Bounds::has_quiet_NaN && Bounds::has_signaling_NaN);
-#endif // Q_CC_GHS
+#endif
QVERIFY(Bounds::is_bounded);
QVERIFY(!Bounds::is_modulo);
QVERIFY(!Bounds::traps);
QVERIFY(Bounds::has_infinity);
QVERIFY(Bounds::has_quiet_NaN);
+#if QT_CONFIG(signaling_nan)
QVERIFY(Bounds::has_signaling_NaN);
+#endif
+#if !defined(Q_CC_GHS)
QCOMPARE(Bounds::has_denorm, std::denorm_present);
+#else
+ // For GHS compiler the "denorm_indeterminite" is the expected return value.
+ QCOMPARE(Bounds::has_denorm, std::denorm_indeterminate);
+#endif // Q_CC_GHS
QCOMPARE(Bounds::round_style, std::round_to_nearest);
QCOMPARE(Bounds::radix, 2);
// Untested: has_denorm_loss
diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
index 519c5fa88d..77a7fa4194 100644
--- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
+++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qdebug.h>
#include <QTest>
diff --git a/tests/auto/corelib/global/qglobal/qglobal.c b/tests/auto/corelib/global/qglobal/qglobal.c
index b577a6f71f..3b898de39f 100644
--- a/tests/auto/corelib/global/qglobal/qglobal.c
+++ b/tests/auto/corelib/global/qglobal/qglobal.c
@@ -1,42 +1,8 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qglobal.h>
-#if __has_include(<stdbool.h>) || __STDC_VERSION__ >= 199901L
-# include <stdbool.h>
-#else
-# undef true
-# define true 1
-# undef false
-# define false 0
-#endif
-
#ifdef Q_COMPILER_THREAD_LOCAL
# include <threads.h>
#endif
@@ -85,7 +51,8 @@ int tst_QtVersion()
return QT_VERSION;
}
-const char *tst_qVersion() Q_DECL_NOEXCEPT
+const char *tst_qVersion() Q_DECL_NOEXCEPT;
+const char *tst_qVersion()
{
#if !defined(QT_NAMESPACE)
return qVersion();
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 7323cfe545..752fb948a5 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp
index ee85a3b77f..4c5d0da638 100644
--- a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp
+++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Thiago Macieira <thiago@kde.org>
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Thiago Macieira <thiago@kde.org>
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QThread>
#include <QTest>
diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp
index 5a24275177..26f628312b 100644
--- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp
+++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Volker Krause <volker.krause@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module 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$
-**
-****************************************************************************/
+// Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Volker Krause <volker.krause@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/global/qkeycombination/tst_qkeycombination.cpp b/tests/auto/corelib/global/qkeycombination/tst_qkeycombination.cpp
index 7e70cdb70f..3091ed4129 100644
--- a/tests/auto/corelib/global/qkeycombination/tst_qkeycombination.cpp
+++ b/tests/auto/corelib/global/qkeycombination/tst_qkeycombination.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QObject>
#include <QTest>
diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp
index 4c26bb85e3..79d2dbcc92 100644
--- a/tests/auto/corelib/global/qlogging/app/main.cpp
+++ b/tests/auto/corelib/global/qlogging/app/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QLoggingCategory>
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index af4a5989d8..5de7830113 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -1,31 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2022 Intel Corporation.
+// Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qdebug.h>
#include <qglobal.h>
@@ -33,6 +9,8 @@
# include <QtCore/QProcess>
#endif
#include <QtTest/QTest>
+#include <QList>
+#include <QMap>
class tst_qmessagehandler : public QObject
{
@@ -62,7 +40,10 @@ private slots:
void formatLogMessage();
private:
- QStringList m_baseEnvironment;
+ QString backtraceHelperPath();
+#if QT_CONFIG(process)
+ QProcessEnvironment m_baseEnvironment;
+#endif
};
static QtMsgType s_type;
@@ -89,13 +70,9 @@ tst_qmessagehandler::tst_qmessagehandler()
void tst_qmessagehandler::initTestCase()
{
#if QT_CONFIG(process)
- m_baseEnvironment = QProcess::systemEnvironment();
- for (int i = 0; i < m_baseEnvironment.count(); ++i) {
- if (m_baseEnvironment.at(i).startsWith("QT_MESSAGE_PATTERN=")) {
- m_baseEnvironment.removeAt(i);
- break;
- }
- }
+ m_baseEnvironment = QProcessEnvironment::systemEnvironment();
+ m_baseEnvironment.remove("QT_MESSAGE_PATTERN");
+ m_baseEnvironment.insert("QT_FORCE_STDERR_LOGGING", "1");
#endif // QT_CONFIG(process)
}
@@ -667,16 +644,16 @@ void tst_qmessagehandler::qMessagePattern_data()
// %{file} is tricky because of shadow builds
QTest::newRow("basic") << "%{type} %{appname} %{line} %{function} %{message}" << true << (QList<QByteArray>()
- << "debug 39 T::T static constructor"
+ << "debug 14 T::T static constructor"
// we can't be sure whether the QT_MESSAGE_PATTERN is already destructed
<< "static destructor"
- << "debug tst_qlogging 60 MyClass::myFunction from_a_function 34"
- << "debug tst_qlogging 70 main qDebug"
- << "info tst_qlogging 71 main qInfo"
- << "warning tst_qlogging 72 main qWarning"
- << "critical tst_qlogging 73 main qCritical"
- << "warning tst_qlogging 76 main qDebug with category"
- << "debug tst_qlogging 80 main qDebug2");
+ << "debug tst_qlogging 35 MyClass::myFunction from_a_function 34"
+ << "debug tst_qlogging 45 main qDebug"
+ << "info tst_qlogging 46 main qInfo"
+ << "warning tst_qlogging 47 main qWarning"
+ << "critical tst_qlogging 48 main qCritical"
+ << "warning tst_qlogging 51 main qDebug with category"
+ << "debug tst_qlogging 55 main qDebug2");
QTest::newRow("invalid") << "PREFIX: %{unknown} %{message}" << false << (QList<QByteArray>()
@@ -777,18 +754,14 @@ void tst_qmessagehandler::qMessagePattern()
QFETCH(QList<QByteArray>, expected);
QProcess process;
-#ifndef Q_OS_ANDROID
- const QString appExe(QLatin1String(HELPER_BINARY));
-#else
- const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so"));
-#endif
+ const QString appExe(backtraceHelperPath());
//
// test QT_MESSAGE_PATTERN
//
- QStringList environment = m_baseEnvironment;
- environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"'));
- process.setEnvironment(environment);
+ QProcessEnvironment environment = m_baseEnvironment;
+ environment.insert("QT_MESSAGE_PATTERN", pattern);
+ process.setProcessEnvironment(environment);
process.start(appExe);
QVERIFY2(process.waitForStarted(), qPrintable(
@@ -803,13 +776,14 @@ void tst_qmessagehandler::qMessagePattern()
for (const QByteArray &e : qAsConst(expected)) {
if (!output.contains(e)) {
- qDebug() << output;
- qDebug() << "expected: " << e;
- QVERIFY(output.contains(e));
+ // use QDebug so we get proper string escaping for the newlines
+ QString buf;
+ QDebug(&buf) << "Got:" << output << "; Expected:" << e;
+ QVERIFY2(output.contains(e), qPrintable(buf));
}
}
if (pattern.startsWith("%{pid}"))
- QVERIFY2(output.startsWith('"' + pid), "PID: " + pid + "\noutput:\n" + output);
+ QVERIFY2(output.startsWith(pid), "PID: " + pid + "\noutput:\n" + output);
#endif
}
@@ -827,22 +801,10 @@ void tst_qmessagehandler::setMessagePattern()
//
QProcess process;
-#ifndef Q_OS_ANDROID
- const QString appExe(QLatin1String(HELPER_BINARY));
-#else
- const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/libhelper.so"));
-#endif
+ const QString appExe(backtraceHelperPath());
// make sure there is no QT_MESSAGE_PATTERN in the environment
- QStringList environment;
- environment.reserve(m_baseEnvironment.size());
- const auto doesNotStartWith = [](QLatin1String s) {
- return [s](const QString &str) { return !str.startsWith(s); };
- };
- std::copy_if(m_baseEnvironment.cbegin(), m_baseEnvironment.cend(),
- std::back_inserter(environment),
- doesNotStartWith(QLatin1String("QT_MESSAGE_PATTERN")));
- process.setEnvironment(environment);
+ process.setProcessEnvironment(m_baseEnvironment);
process.start(appExe);
QVERIFY2(process.waitForStarted(), qPrintable(
@@ -928,6 +890,19 @@ void tst_qmessagehandler::formatLogMessage()
QCOMPARE(r, result);
}
+QString tst_qmessagehandler::backtraceHelperPath()
+{
+#ifdef Q_OS_ANDROID
+ QString appExe(QCoreApplication::applicationDirPath()
+ + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so"));
+#elif defined(Q_OS_WEBOS)
+ QString appExe(QCoreApplication::applicationDirPath()
+ + QLatin1String("/" BACKTRACE_HELPER_NAME));
+#else
+ QString appExe(QLatin1String(HELPER_BINARY));
+#endif
+ return appExe;
+}
QTEST_MAIN(tst_qmessagehandler)
#include "tst_qlogging.moc"
diff --git a/tests/auto/corelib/global/qlogging/tst_qmessagelogger.cpp b/tests/auto/corelib/global/qlogging/tst_qmessagelogger.cpp
index 4ff0469a49..4466c1b36b 100644
--- a/tests/auto/corelib/global/qlogging/tst_qmessagelogger.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qmessagelogger.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qlogging.h>
#include <qloggingcategory.h>
diff --git a/tests/auto/corelib/global/qnativeinterface/tst_qnativeinterface.cpp b/tests/auto/corelib/global/qnativeinterface/tst_qnativeinterface.cpp
index 5291133406..b7ec10df6c 100644
--- a/tests/auto/corelib/global/qnativeinterface/tst_qnativeinterface.cpp
+++ b/tests/auto/corelib/global/qnativeinterface/tst_qnativeinterface.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
index 5dbe6663b9..03acf5c074 100644
--- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
+++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -179,6 +154,15 @@ void tst_QNumeric::fuzzyIsNull()
QCOMPARE(::qFuzzyIsNull(-value), isNull);
}
+static void clearFpExceptions()
+{
+ // Call after any functions that exercise floating-point exceptions, such as
+ // sqrt(-1) or log(0).
+#ifdef Q_OS_WIN
+ _clearfp();
+#endif
+}
+
#if defined __FAST_MATH__ && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)
// turn -ffast-math off
# pragma GCC optimize "no-fast-math"
@@ -187,6 +171,7 @@ void tst_QNumeric::fuzzyIsNull()
template<typename F>
void tst_QNumeric::checkNaN(F nan)
{
+ const auto cleanup = qScopeGuard([]() { clearFpExceptions(); });
#define CHECKNAN(value) \
do { \
const F v = (value); \
@@ -195,21 +180,23 @@ void tst_QNumeric::checkNaN(F nan)
QVERIFY(!qIsFinite(v)); \
QVERIFY(!qIsInf(v)); \
} while (0)
+ const F zero(0), one(1), two(2);
- QVERIFY(!(0 > nan));
- QVERIFY(!(0 < nan));
- QVERIFY(!(0 == nan));
+ QVERIFY(!(zero > nan));
+ QVERIFY(!(zero < nan));
+ QVERIFY(!(zero == nan));
QVERIFY(!(nan == nan));
CHECKNAN(nan);
- CHECKNAN(nan + 1);
- CHECKNAN(nan - 1);
+ CHECKNAN(nan + one);
+ CHECKNAN(nan - one);
CHECKNAN(-nan);
- CHECKNAN(nan * 2.0);
- CHECKNAN(nan / 2.0);
- CHECKNAN(1.0 / nan);
- CHECKNAN(0.0 / nan);
- CHECKNAN(0.0 * nan);
+ CHECKNAN(nan * two);
+ CHECKNAN(nan / two);
+ CHECKNAN(one / nan);
+ CHECKNAN(zero / nan);
+ CHECKNAN(zero * nan);
+ CHECKNAN(sqrt(-one));
// When any NaN is expected, any NaN will do:
QCOMPARE(nan, nan);
@@ -297,6 +284,7 @@ void tst_QNumeric::generalNaN()
template<typename F>
void tst_QNumeric::infinity()
{
+ const auto cleanup = qScopeGuard([]() { clearFpExceptions(); });
const F inf = qInf();
const F zero(0), one(1), two(2);
QVERIFY(inf > zero);
@@ -319,6 +307,7 @@ void tst_QNumeric::infinity()
QCOMPARE(one / -inf, zero);
QVERIFY(qIsNaN(zero * inf));
QVERIFY(qIsNaN(zero * -inf));
+ QCOMPARE(log(zero), -inf);
}
template<typename F>
@@ -402,6 +391,11 @@ void tst_QNumeric::distance()
QFETCH(F, from);
QFETCH(F, stop);
QFETCH(Count, expectedDistance);
+ if constexpr (std::numeric_limits<F>::has_denorm != std::denorm_present) {
+ if (qstrcmp(QTest::currentDataTag(), "denormal") == 0) {
+ QSKIP("Skipping 'denorm' as this type lacks denormals on this system");
+ }
+ }
QCOMPARE(qFloatDistance(from, stop), expectedDistance);
QCOMPARE(qFloatDistance(stop, from), expectedDistance);
}
diff --git a/tests/auto/corelib/global/qoperatingsystemversion/tst_qoperatingsystemversion.cpp b/tests/auto/corelib/global/qoperatingsystemversion/tst_qoperatingsystemversion.cpp
index d1f9279b57..9c602a459c 100644
--- a/tests/auto/corelib/global/qoperatingsystemversion/tst_qoperatingsystemversion.cpp
+++ b/tests/auto/corelib/global/qoperatingsystemversion/tst_qoperatingsystemversion.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qoperatingsystemversion.h>
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
index 30e170b65d..a3b31eda3f 100644
--- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qlist.h>
diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
index 74c2deff52..401367ecaa 100644
--- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
+++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
@@ -1,40 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtCore/qendian.h>
#include <QtCore/private/qendian_p.h>
-
+#include <QtCore/qsysinfo.h>
class tst_QtEndian: public QObject
{
Q_OBJECT
+public:
+ enum Signedness {
+ Unsigned,
+ Signed
+ };
+ Q_ENUM(Signedness);
private slots:
void fromBigEndian();
@@ -54,7 +35,8 @@ private slots:
void endianIntegers_data();
void endianIntegers();
- void endianBitfields();
+ void endianBitfieldUnions_data();
+ void endianBitfieldUnions();
};
struct TestData
@@ -360,32 +342,110 @@ void tst_QtEndian::endianIntegers()
#endif
}
-void tst_QtEndian::endianBitfields()
+template<template<typename... Accessors> typename Union, template<int, int, typename> typename Member>
+void testBitfieldUnion()
+{
+ using upper = Member<21, 11, uint>;
+ using lower = Member<10, 11, uint>;
+ using bottom = Member<0, 10, int>;
+ using all = Member<0, 32, uint>;
+
+ using UnionType = Union<upper, lower, bottom, all>;
+ UnionType u;
+
+ u.template set<upper>(200);
+ QCOMPARE(u.template get<upper>(), 200U);
+ u.template set<lower>(1000);
+ u.template set<bottom>(-8);
+ QCOMPARE(u.template get<lower>(), 1000U);
+ QCOMPARE(u.template get<upper>(), 200U);
+
+ u.template set<lower>(u.template get<lower>() + u.template get<upper>());
+ QCOMPARE(u.template get<upper>(), 200U);
+ QCOMPARE(u.template get<lower>(), 1200U);
+
+ u.template set<upper>(65536 + 7);
+ u.template set<lower>(65535);
+ QCOMPARE(u.template get<lower>(), 65535U & ((1<<11) - 1));
+ QCOMPARE(u.template get<upper>(), 7U);
+
+ QCOMPARE(u.template get<bottom>(), -8);
+
+ UnionType u2(QSpecialIntegerBitfieldZero);
+ QCOMPARE(u2.data(), 0U);
+
+ u2.template set<all>(std::numeric_limits<uint>::max());
+ QCOMPARE(u2.template get<all>(), std::numeric_limits<uint>::max());
+
+ u2.template set<all>(453);
+ QCOMPARE(u2.template get<all>(), 453U);
+
+ u2.template set<all>(0);
+ QCOMPARE(u2.template get<all>(), 0U);
+
+ UnionType u3(42U);
+ QCOMPARE(u3.data(), 42U);
+
+ using BEUintAccessor = QSpecialIntegerAccessor<QBigEndianStorageType<uint>, 21, 11>;
+ using LEUintAccessor = QSpecialIntegerAccessor<QLittleEndianStorageType<uint>, 21, 11>;
+ using BEIntAccessor = QSpecialIntegerAccessor<QBigEndianStorageType<int>, 0, 10>;
+ using LEIntAccessor = QSpecialIntegerAccessor<QLittleEndianStorageType<int>, 0, 10>;
+
+ if constexpr (std::is_same_v<BEUintAccessor, upper>) {
+ QCOMPARE(u.template get<BEUintAccessor>(), 7U);
+ } else if constexpr (std::is_same_v<LEUintAccessor, upper>) {
+ QCOMPARE(u.template get<LEUintAccessor>(), 7U);
+ } else if constexpr (std::is_same_v<BEIntAccessor, bottom>) {
+ QCOMPARE(u.template get<BEIntAccessor>(), -8);
+ } else if constexpr (std::is_same_v<LEIntAccessor, bottom>) {
+ QCOMPARE(u.template get<LEIntAccessor>(), -8);
+ } else {
+ QFAIL("none of the manually defined accessors match");
+ }
+}
+
+void tst_QtEndian::endianBitfieldUnions_data()
{
- union {
- quint32_be_bitfield<21, 11> upper;
- quint32_be_bitfield<10, 11> lower;
- qint32_be_bitfield<0, 10> bottom;
- } u;
-
- u.upper = 200;
- QCOMPARE(u.upper, 200U);
- u.lower = 1000;
- u.bottom = -8;
- QCOMPARE(u.lower, 1000U);
- QCOMPARE(u.upper, 200U);
-
- u.lower += u.upper;
- QCOMPARE(u.upper, 200U);
- QCOMPARE(u.lower, 1200U);
-
- u.upper = 65536 + 7;
- u.lower = 65535;
- QCOMPARE(u.lower, 65535U & ((1<<11) - 1));
- QCOMPARE(u.upper, 7U);
-
- QCOMPARE(u.bottom, -8);
+ QTest::addColumn<QSysInfo::Endian>("byteOrder");
+ QTest::addColumn<Signedness>("signedness");
+
+ QTest::addRow("little endian unsigned") << QSysInfo::LittleEndian << Unsigned;
+ QTest::addRow("little endian signed") << QSysInfo::LittleEndian << Signed;
+ QTest::addRow("big endian unsigned") << QSysInfo::BigEndian << Unsigned;
+ QTest::addRow("big endian signed") << QSysInfo::BigEndian << Signed;
+}
+
+void tst_QtEndian::endianBitfieldUnions()
+{
+ QFETCH(QSysInfo::Endian, byteOrder);
+ QFETCH(Signedness, signedness);
+
+ switch (byteOrder) {
+ case QSysInfo::LittleEndian:
+ switch (signedness) {
+ case Unsigned:
+ testBitfieldUnion<quint32_le_bitfield_union, quint32_le_bitfield_member>();
+ return;
+ case Signed:
+ testBitfieldUnion<qint32_le_bitfield_union, qint32_le_bitfield_member>();
+ return;
+ }
+ Q_UNREACHABLE();
+ return;
+ case QSysInfo::BigEndian:
+ switch (signedness) {
+ case Unsigned:
+ testBitfieldUnion<quint32_be_bitfield_union, quint32_be_bitfield_member>();
+ return;
+ case Signed:
+ testBitfieldUnion<qint32_be_bitfield_union, qint32_be_bitfield_member>();
+ return;
+ }
+ Q_UNREACHABLE();
+ return;
+ }
}
+
QTEST_MAIN(tst_QtEndian)
#include "tst_qtendian.moc"
diff --git a/tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp b/tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp
index c73a0a7575..423c4ebc82 100644
--- a/tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp
+++ b/tests/auto/corelib/global/qwinregistry/tst_qwinregistry.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 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$
-**
-****************************************************************************/
+// Copyright (C) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/global/qxp/CMakeLists.txt b/tests/auto/corelib/global/qxp/CMakeLists.txt
new file mode 100644
index 0000000000..f289a04701
--- /dev/null
+++ b/tests/auto/corelib/global/qxp/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(function_ref)
diff --git a/tests/auto/corelib/global/qxp/function_ref/CMakeLists.txt b/tests/auto/corelib/global/qxp/function_ref/CMakeLists.txt
new file mode 100644
index 0000000000..91c797c32f
--- /dev/null
+++ b/tests/auto/corelib/global/qxp/function_ref/CMakeLists.txt
@@ -0,0 +1,7 @@
+qt_internal_add_test(tst_qxp_function_ref
+ EXCEPTIONS
+ SOURCES
+ tst_qxp_function_ref.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+)
diff --git a/tests/auto/corelib/global/qxp/function_ref/tst_qxp_function_ref.cpp b/tests/auto/corelib/global/qxp/function_ref/tst_qxp_function_ref.cpp
new file mode 100644
index 0000000000..6264e6a5ae
--- /dev/null
+++ b/tests/auto/corelib/global/qxp/function_ref/tst_qxp_function_ref.cpp
@@ -0,0 +1,279 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include <QtCore/qxpfunctional.h>
+
+#include <QTest>
+
+#include <type_traits>
+
+// checking dependency q20::remove_cvref_t:
+#define CHECK(in, out) \
+ static_assert(std::is_same_v<q20::remove_cvref_t< in >, out >)
+CHECK(int, int);
+CHECK(const int, int);
+CHECK(int &, int);
+CHECK(const int &, int);
+CHECK(int &&, int);
+CHECK(const int &&, int);
+CHECK(int *, int *);
+CHECK(const int *, const int *);
+CHECK(int[4], int[4]);
+CHECK(const int (&)[4], int[4]);
+#undef CHECK
+
+template <typename T> constexpr inline bool
+is_noexcept_function_ref_helper_v = false;
+template <typename R, typename...Args> constexpr inline bool
+is_noexcept_function_ref_helper_v<qxp::function_ref<R(Args...) noexcept(true)>> = true;
+template <typename R, typename...Args> constexpr inline bool
+is_noexcept_function_ref_helper_v<qxp::function_ref<R(Args...) const noexcept(true)>> = true;
+
+template <typename T> constexpr inline bool
+is_noexcept_function_ref_v = is_noexcept_function_ref_helper_v<q20::remove_cvref_t<T>>;
+
+class tst_qxp_function_ref : public QObject
+{
+ Q_OBJECT
+public:
+ using QObject::QObject;
+
+private Q_SLOTS:
+ void basics();
+ void constOverloads();
+ void constExpr();
+ void voidReturning();
+ void ctad();
+};
+
+void tst_qxp_function_ref::basics()
+{
+ static_assert(std::is_trivially_copyable_v<qxp::function_ref<int(int)>>);
+ static_assert(std::is_trivially_copyable_v<qxp::function_ref<int()>>);
+ static_assert(std::is_trivially_copyable_v<qxp::function_ref<void()>>);
+
+ {
+ Q_CONSTINIT static int invoked = 0;
+ auto lambda = [](int i) noexcept { ++invoked; return i; };
+ const qxp::function_ref<int(int)> f = lambda;
+ QCOMPARE(invoked, 0);
+ QCOMPARE(f(42), 42);
+ QCOMPARE(invoked, 1);
+
+ const int fourtyTwo = 42;
+
+ const qxp::function_ref<int(int) noexcept> f2 = std::move(lambda);
+ QCOMPARE(invoked, 1);
+ QCOMPARE(f2(fourtyTwo), 42);
+ QCOMPARE(invoked, 2);
+
+ int (*fpr)(int) = lambda;
+
+ const qxp::function_ref f3 = fpr;
+ static_assert(!is_noexcept_function_ref_v<decltype(f3)>);
+ QCOMPARE(invoked, 2);
+ QCOMPARE(f3(42), 42);
+ QCOMPARE(invoked, 3);
+
+ int (*fpr2)(int) noexcept = lambda;
+
+ const qxp::function_ref f4 = fpr2;
+ static_assert(is_noexcept_function_ref_v<decltype(f4)>);
+ QCOMPARE(invoked, 3);
+ QCOMPARE(f4(42), 42);
+ QCOMPARE(invoked, 4);
+ }
+ {
+ Q_CONSTINIT static int invoked = 0;
+ auto lambda = [] { ++invoked; return 42; };
+ const qxp::function_ref<int()> f = lambda;
+ QCOMPARE(invoked, 0);
+ QCOMPARE(f(), 42);
+ QCOMPARE(invoked, 1);
+
+ const qxp::function_ref<int()> f2 = std::move(lambda);
+ QCOMPARE(invoked, 1);
+ QCOMPARE(f2(), 42);
+ QCOMPARE(invoked, 2);
+
+ int (*fpr)() = lambda;
+
+ const qxp::function_ref f3 = fpr;
+ static_assert(!is_noexcept_function_ref_v<decltype(f3)>);
+ QCOMPARE(invoked, 2);
+ QCOMPARE(f3(), 42);
+ QCOMPARE(invoked, 3);
+ }
+ {
+ Q_CONSTINIT static int invoked = 0;
+ auto lambda = [] { ++invoked; };
+ const qxp::function_ref<void()> f = lambda;
+ QCOMPARE(invoked, 0);
+ f();
+ QCOMPARE(invoked, 1);
+
+ const qxp::function_ref<void()> f2 = std::move(lambda);
+ QCOMPARE(invoked, 1);
+ f2();
+ QCOMPARE(invoked, 2);
+
+ void (*fpr)() = lambda;
+
+ const qxp::function_ref f3 = fpr;
+ QCOMPARE(invoked, 2);
+ f3();
+ QCOMPARE(invoked, 3);
+ }
+}
+
+void tst_qxp_function_ref::constOverloads()
+{
+ auto func_c = [](qxp::function_ref<int() const> callable)
+ {
+ return callable();
+ };
+ auto func_m = [](qxp::function_ref<int() /*mutable*/> callable)
+ {
+ return callable();
+ };
+
+ struct S
+ {
+ int operator()() { return 1; }
+ int operator()() const { return 2; }
+ };
+ S s;
+ QCOMPARE(func_c(s), 2);
+ QCOMPARE(func_m(s), 1);
+ const S cs;
+ QCOMPARE(func_c(cs), 2);
+#if 0
+ // this should not compile (and doesn't, but currently fails with an error in the impl,
+ // not by failing a constructor constaint → spec issue?).
+ QCOMPARE(func_m(cs), 2);
+#endif
+}
+
+void tst_qxp_function_ref::constExpr()
+{
+ Q_CONSTINIT static int invoked = 0;
+ {
+ Q_CONSTINIT static auto lambda = [] (int i) { ++invoked; return i; };
+ // the function object constructor is constexpr, so this should be constinit:
+ Q_CONSTINIT static qxp::function_ref<int(int)> f = lambda;
+
+ QCOMPARE(invoked, 0);
+ QCOMPARE(f(15), 15);
+ QCOMPARE(invoked, 1);
+ }
+ {
+ constexpr static auto lambda = [] (int i) { ++invoked; return i; };
+ // the function object constructor is constexpr, so this should be constinit:
+ Q_CONSTINIT static qxp::function_ref<int(int) const> f = lambda;
+
+ QCOMPARE(invoked, 1);
+ QCOMPARE(f(51), 51);
+ QCOMPARE(invoked, 2);
+
+#if 0 // ### should this work?:
+ Q_CONSTINIT static qxp::function_ref<int(int)> f2 = lambda;
+
+ QCOMPARE(invoked, 2);
+ QCOMPARE(f(150), 150);
+ QCOMPARE(invoked, 3);
+#endif
+
+ }
+}
+
+int i_f_i_nx(int i) noexcept { return i; }
+void v_f_i_nx(int) noexcept {}
+int i_f_v_nx() noexcept { return 42; }
+void v_f_v_nx() noexcept {}
+
+int i_f_i_ex(int i) { return i; }
+void v_f_i_ex(int) {}
+int i_f_v_ex() { return 42; }
+void v_f_v_ex() {}
+
+void tst_qxp_function_ref::voidReturning()
+{
+ // check that "casting" int to void returns works:
+
+ using Fi = qxp::function_ref<void(int)>;
+ using Fv = qxp::function_ref<void()>;
+
+ {
+ Fi fi = i_f_i_nx;
+ fi(42);
+ Fv fv = i_f_v_nx;
+ fv();
+ }
+
+ {
+ Fi fi = i_f_i_ex;
+ fi(42);
+ Fv fv = i_f_v_ex;
+ fv();
+ }
+
+ // now with lambdas
+
+ bool ok = false; // prevent lambdas from decaying to function pointers
+ {
+ auto lambda1 = [&](int i) noexcept { return i + int(ok); };
+ Fi fi = lambda1;
+ fi(42);
+ auto lambda2 = [&]() noexcept { return int(ok); };
+ Fv fv = lambda2;
+ fv();
+ }
+
+ {
+ auto lambda1 = [&](int i) { return i + int(ok); };
+ Fi fi = lambda1;
+ fi(42);
+ auto lambda2 = [&]() { return int(ok); };
+ Fv fv = lambda2;
+ fv();
+ }
+}
+
+void tst_qxp_function_ref::ctad()
+{
+#define CHECK(fun, sig) \
+ do { \
+ qxp::function_ref f = fun; \
+ static_assert(std::is_same_v<decltype(f), \
+ qxp::function_ref<sig>>); \
+ qxp::function_ref f2 = &fun; \
+ static_assert(std::is_same_v<decltype(f2), \
+ qxp::function_ref<sig>>); \
+ } while (false)
+
+ CHECK(i_f_i_nx, int (int) noexcept);
+ CHECK(v_f_i_nx, void(int) noexcept);
+ CHECK(i_f_v_nx, int ( ) noexcept);
+ CHECK(v_f_v_nx, void( ) noexcept);
+
+ CHECK(i_f_i_ex, int (int));
+ CHECK(v_f_i_ex, void(int));
+ CHECK(i_f_v_ex, int ( ));
+ CHECK(v_f_v_ex, void( ));
+
+#undef CHECK
+
+#if 0 // no deduction guides for the non-function-pointer case, so no CTAD for lambdas
+ {
+ auto lambda = [](int i) -> int { return i; };
+ qxp::function_ref f = lambda;
+ static_assert(std::is_same_v<decltype(f),
+ qxp::function_ref<int(int)>>);
+ }
+#endif
+}
+
+
+QTEST_APPLESS_MAIN(tst_qxp_function_ref);
+
+#include "tst_qxp_function_ref.moc"
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index 088f3e96f2..a9108c577f 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
index edb5ec05a5..8f91ebe136 100644
--- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
+++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the FOO module 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/private/qabstractfileengine_p.h>
#include <QtCore/private/qfsfileengine_p.h>
diff --git a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
index 7a68da8192..93e0d6fce8 100644
--- a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp
@@ -1,36 +1,14 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QTestEventLoop>
#include <QBuffer>
#include <QByteArray>
+#include <QElapsedTimer>
+
+#include <string>
class tst_QBuffer : public QObject
{
@@ -43,6 +21,7 @@ private slots:
void writeBlock_data();
void writeBlock();
void seek();
+ void invalidSeeks();
void seekTest_data();
void seekTest();
void read_rawdata();
@@ -58,6 +37,7 @@ private slots:
void readLineBoundaries();
void getAndUngetChar();
void writeAfterQByteArrayResize();
+ void writeOfMoreThan2GiB();
void read_null();
protected slots:
@@ -287,6 +267,29 @@ void tst_QBuffer::seek()
QCOMPARE(buffer.size(), pos);
}
+void tst_QBuffer::invalidSeeks()
+{
+ if constexpr (sizeof(qsizetype) == sizeof(qint64)) {
+ // sizeof(qsizetype) == sizeof(qint64), so +1 would overflow
+ QSKIP("This is a 32-bit-only test.");
+ } else {
+ QBuffer buffer;
+ buffer.open(QIODevice::WriteOnly);
+ QCOMPARE(buffer.buffer().size(), qsizetype(0));
+ QCOMPARE(buffer.pos(), qint64(0));
+ constexpr qint64 MaxQByteArrayCapacity = (std::numeric_limits<qsizetype>::max)();
+ // this should fail fast, not after trying to allocate nearly 2 GiB of data,
+ // potentially crashing in the process:
+ QVERIFY(!buffer.seek(2 * MaxQByteArrayCapacity - 1));
+ QCOMPARE(buffer.buffer().size(), qsizetype(0));
+ QCOMPARE(buffer.pos(), qint64(0));
+ // ditto:
+ QVERIFY(!buffer.seek(MaxQByteArrayCapacity + 1));
+ QCOMPARE(buffer.buffer().size(), qsizetype(0));
+ QCOMPARE(buffer.pos(), qint64(0));
+ }
+}
+
void tst_QBuffer::seekTest_data()
{
writeBlock_data();
@@ -599,6 +602,55 @@ void tst_QBuffer::writeAfterQByteArrayResize()
QCOMPARE(buffer.buffer().size(), 1000);
}
+void tst_QBuffer::writeOfMoreThan2GiB()
+{
+ if constexpr (sizeof(void*) == 4)
+ QSKIP("This is a 64-bit-only test");
+
+ [[maybe_unused]] constexpr size_t GiB = 1024 * 1024 * 1024;
+
+#ifndef QT_NO_EXCEPTIONS
+
+ try {
+ //
+ // GIVEN: an empty QBuffer open for writing
+ //
+ QBuffer buffer;
+ QVERIFY(buffer.open(QIODevice::WriteOnly));
+
+ //
+ // WHEN: writing more than 2GiB in a singe chunk:
+ //
+ QElapsedTimer timer;
+ timer.start();
+
+ const std::string input(2 * GiB + 1, 42);
+
+ qDebug("created dataset in %lld ms", timer.restart());
+
+ const auto inputSize = qint64(input.size());
+
+ QCOMPARE(buffer.write(input.data(), inputSize), inputSize);
+
+ qDebug("performed write in %lld ms", timer.restart());
+
+ //
+ // THEN: the buffer contains the written data
+ //
+ QCOMPARE(buffer.buffer().size(), inputSize);
+ QVERIFY(buffer.buffer() == QByteArrayView{input});
+
+ qDebug("verified result in %lld ms", timer.elapsed());
+
+ } catch (const std::bad_alloc &) {
+ QSKIP("Cannot allocate enough memory for this test");
+ }
+
+#else
+ QSKIP("This test requires exceptions enabled.");
+#endif // QT_NO_EXCEPTIONS
+}
+
void tst_QBuffer::read_null()
{
QByteArray buffer;
diff --git a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp
index 9be0463b99..8cc1b0ae54 100644
--- a/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp
+++ b/tests/auto/corelib/io/qdataurl/tst_qdataurl.cpp
@@ -1,77 +1,58 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "private/qdataurl_p.h"
#include <QTest>
#include <QtCore/QDebug>
+using namespace Qt::Literals;
+
class tst_QDataUrl : public QObject
{
Q_OBJECT
private slots:
- void nonData();
- void emptyData();
- void alreadyPercentageEncoded();
+ void decode_data();
+ void decode();
};
-void tst_QDataUrl::nonData()
+void tst_QDataUrl::decode_data()
{
- QLatin1String data("http://test.com");
- QUrl url(data);
- QString mimeType;
- QByteArray payload;
- bool result = qDecodeDataUrl(url, mimeType, payload);
- QVERIFY(!result);
-}
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<bool>("result");
+ QTest::addColumn<QString>("mimeType");
+ QTest::addColumn<QByteArray>("payload");
-void tst_QDataUrl::emptyData()
-{
- QLatin1String data("data:text/plain");
- QUrl url(data);
- QString mimeType;
- QByteArray payload;
- bool result = qDecodeDataUrl(url, mimeType, payload);
- QVERIFY(result);
- QCOMPARE(mimeType, QLatin1String("text/plain;charset=US-ASCII"));
- QVERIFY(payload.isNull());
+ auto row = [](const char *tag, const char *url, bool success, QString mimeType = {}, QByteArray payload = {}) {
+ QTest::newRow(tag) << url << success <<mimeType << payload;
+ };
+
+ row("nonData", "http://test.com", false);
+ row("emptyData", "data:text/plain", true,
+ "text/plain;charset=US-ASCII"_L1);
+ row("alreadyPercentageEncoded", "data:text/plain,%E2%88%9A", true,
+ "text/plain"_L1, QByteArray::fromPercentEncoding("%E2%88%9A"));
+ row("everythingIsCaseInsensitive", "Data:texT/PlaiN;charSet=iSo-8859-1;Base64,SGVsbG8=", true,
+ "texT/PlaiN;charSet=iSo-8859-1"_L1, QByteArrayLiteral("Hello"));
}
-void tst_QDataUrl::alreadyPercentageEncoded()
+void tst_QDataUrl::decode()
{
- QLatin1String data("data:text/plain,%E2%88%9A");
- QUrl url(data);
- QString mimeType;
- QByteArray payload;
- bool result = qDecodeDataUrl(url, mimeType, payload);
- QVERIFY(result);
- QCOMPARE(mimeType, QLatin1String("text/plain"));
- QCOMPARE(payload, QByteArray::fromPercentEncoding("%E2%88%9A"));
+ QFETCH(const QString, input);
+ QFETCH(const bool, result);
+ QFETCH(const QString, mimeType);
+ QFETCH(const QByteArray, payload);
+
+ QString actualMimeType;
+ QByteArray actualPayload;
+
+ QUrl url(input);
+ const bool actualResult = qDecodeDataUrl(url, actualMimeType, actualPayload);
+
+ QCOMPARE(actualResult, result);
+ QCOMPARE(actualMimeType, mimeType);
+ QCOMPARE(actualPayload, payload);
+ QCOMPARE(actualPayload.isNull(), payload.isNull()); // assume nullness is significant
}
QTEST_MAIN(tst_QDataUrl)
diff --git a/tests/auto/corelib/io/qdebug/CMakeLists.txt b/tests/auto/corelib/io/qdebug/CMakeLists.txt
index 39b92b9d2f..067e3be04b 100644
--- a/tests/auto/corelib/io/qdebug/CMakeLists.txt
+++ b/tests/auto/corelib/io/qdebug/CMakeLists.txt
@@ -10,3 +10,7 @@ qt_internal_add_test(tst_qdebug
PUBLIC_LIBRARIES
Qt::Concurrent
)
+
+if (APPLE)
+ target_compile_options(tst_qdebug PRIVATE -x objective-c++)
+endif()
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 9b9696d7c1..400625ba7d 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QCoreApplication>
@@ -52,6 +27,10 @@ struct ConvertsToQVariant {
};
static_assert(!QTypeTraits::has_ostream_operator_v<QDebug, ConvertsToQVariant>);
+#if defined(Q_OS_DARWIN)
+#include <objc/runtime.h>
+#include <Foundation/Foundation.h>
+#endif
class tst_QDebug: public QObject
{
@@ -88,6 +67,12 @@ private slots:
void threadSafety() const;
void toString() const;
void noQVariantEndlessRecursion() const;
+#if defined(Q_OS_DARWIN)
+ void objcInCppMode_data() const;
+ void objcInCppMode() const;
+ void objcInObjcMode_data() const;
+ void objcInObjcMode() const;
+#endif
};
void tst_QDebug::assignment() const
@@ -873,6 +858,69 @@ void tst_QDebug::noQVariantEndlessRecursion() const
qDebug() << var;
}
+#if defined(Q_OS_DARWIN)
+
+@interface MyObjcClass : NSObject
+@end
+
+@implementation MyObjcClass : NSObject
+- (NSString *)description
+{
+ return @"MyObjcClass is the best";
+}
+@end
+
+void tst_QDebug::objcInCppMode_data() const
+{
+ QTest::addColumn<objc_object *>("object");
+ QTest::addColumn<QString>("message");
+
+ QTest::newRow("nil") << static_cast<objc_object*>(nullptr) << QString::fromLatin1("(null)");
+
+ // Not an NSObject subclass
+ auto *nsproxy = reinterpret_cast<objc_object *>(class_createInstance(objc_getClass("NSProxy"), 0));
+ QTest::newRow("NSProxy") << nsproxy << QString::fromLatin1("<NSProxy: 0x%1>").arg(uintptr_t(nsproxy), 1, 16);
+
+ // Plain NSObject
+ auto *nsobject = reinterpret_cast<objc_object *>(class_createInstance(objc_getClass("NSObject"), 0));
+ QTest::newRow("NSObject") << nsobject << QString::fromLatin1("<NSObject: 0x%1>").arg(uintptr_t(nsobject), 1, 16);
+
+ auto str = QString::fromLatin1("foo");
+ QTest::newRow("NSString") << reinterpret_cast<objc_object*>(str.toNSString()) << str;
+
+ // Custom debug description
+ QTest::newRow("MyObjcClass") << reinterpret_cast<objc_object*>([[MyObjcClass alloc] init])
+ << QString::fromLatin1("MyObjcClass is the best");
+}
+
+void tst_QDebug::objcInCppMode() const
+{
+ QFETCH(objc_object *, object);
+ QFETCH(QString, message);
+
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << object; }
+
+ QCOMPARE(s_msg, message);
+}
+
+void tst_QDebug::objcInObjcMode_data() const
+{
+ objcInCppMode_data();
+}
+
+void tst_QDebug::objcInObjcMode() const
+{
+ QFETCH(objc_object *, object);
+ QFETCH(QString, message);
+
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << static_cast<id>(object); }
+
+ QCOMPARE(s_msg, message);
+}
+#endif
+
// 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/testdir/dir/qrc_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
index a1d5c2c9ff..cf4421c7d5 100644
--- a/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/testdir/dir/qrc_qdir.cpp
@@ -1,29 +1,4 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
diff --git a/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
index a1d5c2c9ff..cf4421c7d5 100644
--- a/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/testdir/dir/tst_qdir.cpp
@@ -1,29 +1,4 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index d0d6588446..cfc786b292 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2017 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2017 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QTemporaryFile>
@@ -75,6 +50,8 @@ extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
#include "private/qdir_p.h"
#endif
+using namespace Qt::StringLiterals;
+
static QByteArray msgDoesNotExist(const QString &name)
{
return (QLatin1Char('"') + QDir::toNativeSeparators(name)
@@ -490,7 +467,7 @@ void tst_QDir::mkdirWithPermissions()
QFile::ReadOwner, QFile::WriteOwner, QFile::ExeOwner
};
- const QString path = u"tmpdir"_qs;
+ const QString path = u"tmpdir"_s;
QDir dir;
auto deleteDirectory = qScopeGuard([&dir, &path] { dir.rmdir(path); });
@@ -1332,19 +1309,19 @@ tst_QDir::cleanPath_data()
QTest::newRow("unc-server-up") << "//server/path/.." << "//server";
QTest::newRow("unc-server-above-root") << "//server/.." << "//server/..";
- QTest::newRow("longpath") << uR"(\\?\d:\)"_qs << u"d:/"_qs;
- QTest::newRow("longpath-slash") << u"//?/d:/"_qs << u"d:/"_qs;
- QTest::newRow("longpath-mixed-slashes") << uR"(//?/d:\)"_qs << u"d:/"_qs;
- QTest::newRow("longpath-mixed-slashes-2") << uR"(\\?\d:/)"_qs << u"d:/"_qs;
-
- QTest::newRow("unc-network-share") << uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-slash") << u"//?/UNC/localhost/c$/tmp.txt"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-mixed-slashes") << uR"(//?/UNC/localhost\c$\tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
- QTest::newRow("unc-network-share-mixed-slashes-2") << uR"(\\?\UNC\localhost/c$/tmp.txt)"_qs
- << u"//localhost/c$/tmp.txt"_qs;
+ QTest::newRow("longpath") << uR"(\\?\d:\)"_s << u"d:/"_s;
+ QTest::newRow("longpath-slash") << u"//?/d:/"_s << u"d:/"_s;
+ QTest::newRow("longpath-mixed-slashes") << uR"(//?/d:\)"_s << u"d:/"_s;
+ QTest::newRow("longpath-mixed-slashes-2") << uR"(\\?\d:/)"_s << u"d:/"_s;
+
+ QTest::newRow("unc-network-share") << uR"(\\?\UNC\localhost\c$\tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-slash") << u"//?/UNC/localhost/c$/tmp.txt"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-mixed-slashes") << uR"(//?/UNC/localhost\c$\tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
+ QTest::newRow("unc-network-share-mixed-slashes-2") << uR"(\\?\UNC\localhost/c$/tmp.txt)"_s
+ << u"//localhost/c$/tmp.txt"_s;
#else
QTest::newRow("data15") << "//c:/foo" << "/c:/foo";
#endif // non-windows
@@ -1743,9 +1720,9 @@ void tst_QDir::dotAndDotDot()
{
QDir dir(QString((m_dataPath + "/testdir/")));
QStringList entryList = dir.entryList(QDir::Dirs);
- QCOMPARE(entryList, QStringList({ u"."_qs, u".."_qs, u"dir"_qs, u"dir.lnk"_qs, u"spaces"_qs }));
+ QCOMPARE(entryList, QStringList({ u"."_s, u".."_s, u"dir"_s, u"dir.lnk"_s, u"spaces"_s }));
entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
- QCOMPARE(entryList, QStringList({ u"dir"_qs, u"dir.lnk"_qs, u"spaces"_qs }));
+ QCOMPARE(entryList, QStringList({ u"dir"_s, u"dir.lnk"_s, u"spaces"_s }));
}
void tst_QDir::homePath()
@@ -1820,10 +1797,10 @@ void tst_QDir::nativeSeparators()
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\")), QString("/"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\\\?\\C:\\")), QString("C:/"));
- QCOMPARE(QDir::fromNativeSeparators(uR"(\\?\UNC\localhost\c$\tmp.txt)"_qs),
- u"//localhost/c$/tmp.txt"_qs);
- QCOMPARE(QDir::fromNativeSeparators(uR"(//?/UNC/localhost\c$\tmp.txt)"_qs),
- u"//localhost/c$/tmp.txt"_qs);
+ QCOMPARE(QDir::fromNativeSeparators(uR"(\\?\UNC\localhost\c$\tmp.txt)"_s),
+ u"//localhost/c$/tmp.txt"_s);
+ QCOMPARE(QDir::fromNativeSeparators(uR"(//?/UNC/localhost\c$\tmp.txt)"_s),
+ u"//localhost/c$/tmp.txt"_s);
#else
QCOMPARE(QDir::toNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\"));
diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
index 9761fbcfb3..628f1acad6 100644
--- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -34,6 +9,8 @@
#include <qdiriterator.h>
#include <qfileinfo.h>
#include <qstringlist.h>
+#include <QSet>
+#include <QString>
#include <QtCore/private/qfsfileengine_p.h>
diff --git a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
index 77a1932bd5..1adde71921 100644
--- a/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
+++ b/tests/auto/corelib/io/qfile/stdinprocess/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QCoreApplication>
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 8ea01b4680..fe412641f5 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#define _CRT_SECURE_NO_WARNINGS 1
@@ -119,6 +94,8 @@ QT_END_NAMESPACE
#define QT_OPEN_BINARY 0
#endif
+using namespace Qt::StringLiterals;
+
Q_DECLARE_METATYPE(QFile::FileError)
@@ -1302,7 +1279,7 @@ void tst_QFile::createFilePermissions()
QFile::ReadOwner, QFile::WriteOwner, QFile::ExeOwner
};
- const QString fileName = u"createme.txt"_qs;
+ const QString fileName = u"createme.txt"_s;
QFile::remove(fileName);
QVERIFY(!QFile::exists(fileName));
@@ -2935,7 +2912,7 @@ void tst_QFile::handle()
// test if the QFile and the handle remain in sync
QVERIFY(file.getChar(&c));
- QCOMPARE(c, '*');
+ QCOMPARE(c, '/');
// same, but read from QFile first now
file.close();
@@ -2950,7 +2927,7 @@ void tst_QFile::handle()
QCOMPARE(QT_READ(fd, &c, 1), 1);
#endif
- QCOMPARE(c, '*');
+ QCOMPARE(c, '/');
//test round trip of adopted stdio file handle
QFile file2;
@@ -3820,8 +3797,8 @@ void tst_QFile::moveToTrash_data()
void tst_QFile::moveToTrash()
{
-#ifdef Q_OS_ANDROID
- QSKIP("Android doesn't implement a trash bin");
+#if defined(Q_OS_ANDROID) or defined(Q_OS_WEBOS)
+ QSKIP("This platform doesn't implement a trash bin");
#endif
QFETCH(QString, source);
QFETCH(bool, create);
diff --git a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt
index da955ff6a6..8b015d518c 100644
--- a/tests/auto/corelib/io/qfileinfo/CMakeLists.txt
+++ b/tests/auto/corelib/io/qfileinfo/CMakeLists.txt
@@ -45,3 +45,7 @@ qt_internal_extend_target(tst_qfileinfo CONDITION WIN32
advapi32
netapi32
)
+
+if (APPLE)
+ target_compile_options(tst_qfileinfo PRIVATE -x objective-c++)
+endif()
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 395db040b0..80f204156e 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QStandardPaths>
@@ -62,6 +37,10 @@
#include <private/qfileinfo_p.h>
#include "../../../../shared/filesystem.h"
+#if defined(Q_OS_MACOS)
+#include <Foundation/Foundation.h>
+#endif
+
#if defined(Q_OS_VXWORKS)
#define Q_NO_SYMLINKS
#endif
@@ -73,6 +52,8 @@ QT_END_NAMESPACE
bool IsUserAdmin();
#endif
+using namespace Qt::StringLiterals;
+
inline bool qIsLikelyToBeFat(const QString &path)
{
QByteArray name = QStorageInfo(path).fileSystemType().toLower();
@@ -218,6 +199,9 @@ private slots:
void isShortcut_data();
void isShortcut();
+ void isAlias_data();
+ void isAlias();
+
void link_data();
void link();
@@ -1345,6 +1329,57 @@ void tst_QFileInfo::isShortcut()
QCOMPARE(fi.isShortcut(), isShortcut);
}
+void tst_QFileInfo::isAlias_data()
+{
+ QFile::remove("symlink");
+ QFile::remove("file-alias");
+ QFile::remove("directory-alias");
+
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("isAlias");
+
+ QFile regularFile(m_sourceFile);
+ QTest::newRow("regular-file") << regularFile.fileName() << false;
+ QTest::newRow("directory") << QDir::currentPath() << false;
+
+#if defined(Q_OS_MACOS)
+ auto createAlias = [](const QString &target, const QString &alias) {
+ NSURL *targetUrl = [NSURL fileURLWithPath:target.toNSString()];
+ NSURL *aliasUrl = [NSURL fileURLWithPath:alias.toNSString()];
+ NSData *bookmarkData = [targetUrl bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile
+ includingResourceValuesForKeys:nil relativeToURL:nil error:nullptr];
+ Q_ASSERT(bookmarkData);
+
+ bool success = [NSURL writeBookmarkData:bookmarkData toURL:aliasUrl
+ options:NSURLBookmarkCreationSuitableForBookmarkFile error:nullptr];
+ Q_ASSERT(success);
+ };
+
+ regularFile.link("symlink");
+ QTest::newRow("symlink") << "symlink" << false;
+
+ createAlias(regularFile.fileName(), QDir::current().filePath("file-alias"));
+ QTest::newRow("file-alias") << "file-alias" << true;
+
+ createAlias(QDir::currentPath(), QDir::current().filePath("directory-alias"));
+ QTest::newRow("directory-alias") << "directory-alias" << true;
+
+ regularFile.copy("non-existing-file");
+ createAlias("non-existing-file", QDir::current().filePath("non-existing-file-alias"));
+ QDir::current().remove("non-existing-file");
+ QTest::newRow("non-existing-file-alias") << "non-existing-file-alias" << true;
+#endif
+}
+
+void tst_QFileInfo::isAlias()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, isAlias);
+
+ QFileInfo fi(path);
+ QCOMPARE(fi.isAlias(), isAlias);
+}
+
void tst_QFileInfo::isSymbolicLink_data()
{
QTest::addColumn<QString>("path");
@@ -1795,14 +1830,14 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
creationResult.target = creationResult.target.sliced(4);
// resolve volume to drive letter
- static const QRegularExpression matchVolumeRe(uR"(^Volume\{([a-z]|[0-9]|-)+\}\\)"_qs,
+ static const QRegularExpression matchVolumeRe(uR"(^Volume\{([a-z]|[0-9]|-)+\}\\)"_s,
QRegularExpression::CaseInsensitiveOption);
auto matchVolume = matchVolumeRe.match(creationResult.target);
if (matchVolume.hasMatch()) {
Q_ASSERT(matchVolume.capturedStart() == 0);
DWORD len;
wchar_t buffer[MAX_PATH];
- const QString volumeName = uR"(\\?\)"_qs + matchVolume.captured();
+ const QString volumeName = uR"(\\?\)"_s + matchVolume.captured();
if (GetVolumePathNamesForVolumeName(reinterpret_cast<LPCWSTR>(volumeName.utf16()),
buffer, MAX_PATH, &len) != 0) {
creationResult.target.replace(0, matchVolume.capturedLength(),
@@ -1878,7 +1913,13 @@ void tst_QFileInfo::isExecutable()
{
QString appPath = QCoreApplication::applicationDirPath();
#ifdef Q_OS_ANDROID
- appPath += "/libtst_qfileinfo.so";
+ QDir dir(appPath);
+ QVERIFY(dir.exists());
+ dir.setNameFilters({ "libtst_qfileinfo*.so" });
+ QStringList entries = dir.entryList();
+ QCOMPARE(entries.size(), 1);
+
+ appPath += "/" + entries[0];
#else
appPath += "/tst_qfileinfo";
# if defined(Q_OS_WIN)
@@ -1886,6 +1927,7 @@ void tst_QFileInfo::isExecutable()
# endif
#endif
QFileInfo fi(appPath);
+ QVERIFY(fi.exists());
QCOMPARE(fi.isExecutable(), true);
QCOMPARE(QFileInfo(m_proFile).isExecutable(), false);
diff --git a/tests/auto/corelib/io/qfileselector/CMakeLists.txt b/tests/auto/corelib/io/qfileselector/CMakeLists.txt
index 5f254044df..1ceb91212a 100644
--- a/tests/auto/corelib/io/qfileselector/CMakeLists.txt
+++ b/tests/auto/corelib/io/qfileselector/CMakeLists.txt
@@ -4,13 +4,6 @@
## tst_qfileselectors Test:
#####################################################################
-qt_internal_add_test(tst_qfileselectors
- SOURCES
- tst_qfileselector.cpp
- PUBLIC_LIBRARIES
- Qt::CorePrivate
-)
-
# Resources:
set(qfileselector_resource_files
"extras/+custom1/test"
@@ -62,10 +55,12 @@ set(qfileselector_resource_files
"platforms/test5"
)
-qt_internal_add_resource(tst_qfileselectors "qfileselector"
- PREFIX
- "/"
- FILES
- ${qfileselector_resource_files}
+qt_internal_add_test(tst_qfileselectors
+ SOURCES
+ tst_qfileselector.cpp
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ TESTDATA ${qfileselector_resource_files}
+ BUILTIN_TESTDATA
)
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
index 3d79507050..a3623cdc0b 100644
--- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
+++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qplatformdefs.h>
diff --git a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
index a9ae848251..b6836ddbba 100644
--- a/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
+++ b/tests/auto/corelib/io/qfilesystementry/tst_qfilesystementry.cpp
@@ -1,35 +1,12 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtCore/private/qfilesystementry_p.h>
+using namespace Qt::StringLiterals;
+
class tst_QFileSystemEntry : public QObject
{
Q_OBJECT
@@ -106,12 +83,12 @@ void tst_QFileSystemEntry::getSetCheck_data()
<< "A:dir/without/leading/backslash.bat" << "backslash.bat" << "backslash" << "backslash" << "bat" << "bat" << false << false;
QTest::newRow("longpath")
- << uR"(\\?\D:\)"_qs
+ << uR"(\\?\D:\)"_s
<< absPrefix + QLatin1String(R"(D:\)")
<< "D:/" << "" << "" << "" << "" << "" << true << false;
QTest::newRow("uncprefix")
- << uR"(\\?\UNC\localhost\C$\tmp.txt)"_qs
+ << uR"(\\?\UNC\localhost\C$\tmp.txt)"_s
<< absPrefix + QLatin1String(R"(UNC\localhost\C$\tmp.txt)")
<< "//localhost/C$/tmp.txt" << "tmp.txt" << "tmp" << "tmp" << "txt" << "txt" << true
<< false;
diff --git a/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp b/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
index 880c88c441..53ba1d1311 100644
--- a/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
+++ b/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtCore/private/qfilesystemmetadata_p.h>
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
index 457499591d..3b59c6477a 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
+++ b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
@@ -1,10 +1,15 @@
# QTBUG-33574 QTBUG-30943
[signalsEmittedAfterFileMoved]
-windows-7sp1
-windows-10
+windows
[watchFileAndItsDirectory:native backend-testfile]
osx
windows
[watchFileAndItsDirectory:native backend-specialchars]
osx
windows
+# QTBUG-102095
+[watchDirectory]
+macos arm ci
+# QTBUG-102096
+[signalsEmittedAfterFileMoved]
+macos arm ci
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index eda146dd02..acf26039d1 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QCoreApplication>
@@ -33,6 +8,8 @@
#include <QFileSystemWatcher>
#include <QElapsedTimer>
#include <QTextStream>
+#include <QMap>
+#include <QString>
#include <QDir>
#include <QSignalSpy>
#include <QTimer>
diff --git a/tests/auto/corelib/io/qiodevice/CMakeLists.txt b/tests/auto/corelib/io/qiodevice/CMakeLists.txt
index 2bd6033440..ce15e80be5 100644
--- a/tests/auto/corelib/io/qiodevice/CMakeLists.txt
+++ b/tests/auto/corelib/io/qiodevice/CMakeLists.txt
@@ -13,24 +13,5 @@ qt_internal_add_test(tst_qiodevice
PUBLIC_LIBRARIES
Qt::Network
TESTDATA ${test_data}
+ QT_TEST_SERVER_LIST "apache2" "cyrus"
)
-
-#### Keys ignored in scope 1:.:.:qiodevice.pro:<TRUE>:
-# MOC_DIR = "tmp"
-
-## Scopes:
-#####################################################################
-
-if(ANDROID)
- # Resources:
- set(android_testdata_resource_files
- "tst_qiodevice.cpp"
- )
-
- qt_internal_add_resource(tst_qiodevice "android_testdata"
- PREFIX
- "/"
- FILES
- ${android_testdata_resource_files}
- )
-endif()
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index 87e46bff09..07c2aa27b7 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QCoreApplication>
#include <QtNetwork/QtNetwork>
@@ -104,15 +79,20 @@ void tst_QIODevice::getSetCheck()
//----------------------------------------------------------------------------------
void tst_QIODevice::constructing_QTcpSocket()
{
+#ifdef QT_TEST_SERVER
+ if (!QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143))
+ QSKIP("No network test server available");
+#else
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
+#endif
QTcpSocket socket;
QIODevice *device = &socket;
QVERIFY(!device->isOpen());
- socket.connectToHost(QtNetworkSettings::serverName(), 143);
+ socket.connectToHost(QtNetworkSettings::imapServerName(), 143);
QVERIFY(socket.waitForConnected(30000));
QVERIFY(device->isOpen());
QCOMPARE(device->readChannelCount(), 1);
@@ -130,7 +110,7 @@ void tst_QIODevice::constructing_QTcpSocket()
socket.close();
QCOMPARE(socket.readChannelCount(), 0);
QCOMPARE(socket.writeChannelCount(), 0);
- socket.connectToHost(QtNetworkSettings::serverName(), 143);
+ socket.connectToHost(QtNetworkSettings::imapServerName(), 143);
QVERIFY(socket.waitForConnected(30000));
QVERIFY(device->isOpen());
@@ -270,9 +250,17 @@ void tst_QIODevice::unget()
result = QByteArray("ZXCV");
lineResult = "ZXCV";
} else {
- if (!QtNetworkSettings::verifyTestNetworkSettings())
- QSKIP("No network test server available");
- socket.connectToHost(QtNetworkSettings::serverName(), 80);
+#ifdef QT_TEST_SERVER
+ const bool hasNetworkServer =
+ QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80);
+#else
+ const bool hasNetworkServer = QtNetworkSettings::verifyTestNetworkSettings();
+#endif
+ if (!hasNetworkServer) {
+ qInfo("No network test server: skipping QTcpSocket part of test.");
+ continue;
+ }
+ socket.connectToHost(QtNetworkSettings::httpServerName(), 80);
socket.write("GET / HTTP/1.0\r\n\r\n");
QVERIFY(socket.waitForReadyRead());
dev = &socket;
diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp
index 60b0c697c5..04d7268f06 100644
--- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp
+++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#define _CRT_SECURE_NO_WARNINGS 1
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
index e086bf1904..c8a1f5a447 100644
--- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QDebug>
#include <QCoreApplication>
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index 2766ea51d5..f36334db02 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2013 David Faure <faure+bluesystems@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
index a2a96e32d3..a0a9bb940e 100644
--- a/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
+++ b/tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QMutexLocker>
#include <QLoggingCategory>
+#include <QMap>
+#include <QStringList>
Q_LOGGING_CATEGORY(TST_LOG, "tst.log")
Q_LOGGING_CATEGORY(Digia_Oslo_Office_com, "Digia.Oslo.Office.com")
diff --git a/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt
index a00fb8cb32..80da400032 100644
--- a/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt
+++ b/tests/auto/corelib/io/qloggingregistry/CMakeLists.txt
@@ -14,23 +14,3 @@ qt_internal_add_test(tst_qloggingregistry
Qt::CorePrivate
TESTDATA ${test_data}
)
-
-#### Keys ignored in scope 1:.:.:qloggingregistry.pro:<TRUE>:
-# TEMPLATE = "app"
-
-## Scopes:
-#####################################################################
-
-if(ANDROID)
- # Resources:
- set(android_testdata_resource_files
- "qtlogging.ini"
- )
-
- qt_internal_add_resource(tst_qloggingregistry "android_testdata"
- PREFIX
- "/"
- FILES
- ${android_testdata_resource_files}
- )
-endif()
diff --git a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
index d46dc4b98c..1ee6bf80e7 100644
--- a/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
+++ b/tests/auto/corelib/io/qloggingregistry/tst_qloggingregistry.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QLoggingCategory>
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index 7279aad287..67b74026ce 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// This test is for "release" mode, with -DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT
#ifndef QT_NO_DEBUG
diff --git a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
index c9949b4932..b7b7650e03 100644
--- a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
+++ b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QCoreApplication>
#include <QtCore/QProcess>
diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
index efeadadb93..01e49400af 100644
--- a/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
+++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QFile>
diff --git a/tests/auto/corelib/io/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
index c10e32d584..57d39f4f13 100644
--- a/tests/auto/corelib/io/qprocess/testDetached/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QDebug>
#include <QStringList>
diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
index f681870609..bd416d8fa3 100644
--- a/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testExitCodes/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdlib.h>
diff --git a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
index b5d56a1138..cc1bb8163f 100644
--- a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QCoreApplication>
#include <QtCore/QDeadlineTimer>
diff --git a/tests/auto/corelib/io/qprocess/testForwardingHelper/main.cpp b/tests/auto/corelib/io/qprocess/testForwardingHelper/main.cpp
index c902db9410..3ed5ae7360 100644
--- a/tests/auto/corelib/io/qprocess/testForwardingHelper/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testForwardingHelper/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <fstream>
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
index 98babfacb8..eff79edbdc 100644
--- a/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testGuiProcess/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
index 298a74d2b0..1441c8ed0c 100644
--- a/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessCrash/main.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2020 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2020 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
void crashFallback(volatile int *ptr = nullptr)
{
diff --git a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
index eb780fbc3a..e13927a380 100644
--- a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
index 4fb2e29c2d..c997fbe5c2 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEOF/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
index e18e48e516..b970704b1e 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
index ce4494b048..8420601d6e 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho2/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
index dfd6e009db..7f2c78e20d 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEcho3/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp b/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
index abe957c1ea..eab3275a38 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEchoGui/main_win.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <windows.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
index 9f13f5c00f..d5a289fb49 100644
--- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
#include <stdlib.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessHang/main.cpp b/tests/auto/corelib/io/qprocess/testProcessHang/main.cpp
index cb904134f9..bbfc7af19d 100644
--- a/tests/auto/corelib/io/qprocess/testProcessHang/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessHang/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp b/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
index 4611ed4547..ea78ca4353 100644
--- a/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessNormal/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
int main()
diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
index 4934708153..914d2ed26c 100644
--- a/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessOutput/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
index 0d40a9b83c..c04c7171d5 100644
--- a/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testProcessSpacesArgs/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp
index 488b03ab57..3f7260dd4e 100644
--- a/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testSetNamedPipeHandleState/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <windows.h>
diff --git a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
index 37d7deb1ac..86f5d65a46 100644
--- a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
index ed0f16ac17..fce8206170 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_unix.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <sys/types.h>
diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
index 898029483f..29de8a5129 100644
--- a/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
+++ b/tests/auto/corelib/io/qprocess/testSoftExit/main_win.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <windows.h>
diff --git a/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp b/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
index 0e2374de06..f86f575a3e 100644
--- a/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testSpaceInName/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 63f2a816fc..674e232eca 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2020 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2022 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QTestEventLoop>
@@ -151,6 +126,8 @@ private slots:
void startStopStartStopBuffers();
void processEventsInAReadyReadSlot_data();
void processEventsInAReadyReadSlot();
+ void startFromCurrentWorkingDir_data();
+ void startFromCurrentWorkingDir();
// keep these at the end, since they use lots of processes and sometimes
// caused obscure failures to occur in tests that followed them (esp. on the Mac)
@@ -1080,6 +1057,16 @@ void tst_QProcess::mergedChannels()
QVERIFY(process.waitForStarted(5000));
+ {
+ QCOMPARE(process.write("abc"), qlonglong(3));
+ while (process.bytesAvailable() < 6)
+ QVERIFY(process.waitForReadyRead(5000));
+ QCOMPARE(process.readAllStandardOutput(), QByteArray("aabbcc"));
+ QTest::ignoreMessage(QtWarningMsg,
+ "QProcess::readAllStandardError: Called with MergedChannels");
+ QCOMPARE(process.readAllStandardError(), QByteArray());
+ }
+
for (int i = 0; i < 100; ++i) {
QCOMPARE(process.write("abc"), qlonglong(3));
while (process.bytesAvailable() < 6)
@@ -2524,5 +2511,94 @@ void tst_QProcess::processEventsInAReadyReadSlot()
QVERIFY(process.waitForFinished());
}
+enum class ChdirMode {
+ None = 0,
+ InParent,
+ InChild
+};
+Q_DECLARE_METATYPE(ChdirMode)
+
+void tst_QProcess::startFromCurrentWorkingDir_data()
+{
+ qRegisterMetaType<ChdirMode>();
+ QTest::addColumn<QString>("programPrefix");
+ QTest::addColumn<ChdirMode>("chdirMode");
+ QTest::addColumn<bool>("success");
+
+ constexpr bool IsWindows = true
+#ifdef Q_OS_UNIX
+ && false
+#endif
+ ;
+
+ // baseline: trying to execute the directory, this can't possibly succeed!
+ QTest::newRow("plain-same-cwd") << QString() << ChdirMode::None << false;
+
+ // cross-platform behavior: neither OS searches the setWorkingDirectory()
+ // dir without "./"
+ QTest::newRow("plain-child-chdir") << QString() << ChdirMode::InChild << false;
+
+ // cross-platform behavior: both OSes search the parent's CWD with "./"
+ QTest::newRow("prefixed-parent-chdir") << "./" << ChdirMode::InParent << true;
+
+ // opposite behaviors: Windows searches the parent's CWD and Unix searches
+ // the child's with "./"
+ QTest::newRow("prefixed-child-chdir") << "./" << ChdirMode::InChild << !IsWindows;
+
+ // Windows searches the parent's CWD without "./"
+ QTest::newRow("plain-parent-chdir") << QString() << ChdirMode::InParent << IsWindows;
+}
+
+void tst_QProcess::startFromCurrentWorkingDir()
+{
+ QFETCH(QString, programPrefix);
+ QFETCH(ChdirMode, chdirMode);
+ QFETCH(bool, success);
+
+ QProcess process;
+ qRegisterMetaType<QProcess::ProcessError>();
+ QSignalSpy errorSpy(&process, &QProcess::errorOccurred);
+ QVERIFY(errorSpy.isValid());
+
+ // both the dir name and the executable name
+ const QString target = QStringLiteral("testProcessNormal");
+ process.setProgram(programPrefix + target);
+
+#ifdef Q_OS_UNIX
+ // Reset PATH, to be sure it doesn't contain . or the empty path.
+ // We can't do this on Windows because DLLs are searched in PATH
+ // and Windows always searches "." anyway.
+ auto restoreEnv = qScopeGuard([old = qgetenv("PATH")] {
+ qputenv("PATH", old);
+ });
+ qputenv("PATH", "/");
+#endif
+
+ switch (chdirMode) {
+ case ChdirMode::InParent: {
+ auto restoreCwd = qScopeGuard([old = QDir::currentPath()] {
+ QDir::setCurrent(old);
+ });
+ QVERIFY(QDir::setCurrent(target));
+ process.start();
+ break;
+ }
+ case ChdirMode::InChild:
+ process.setWorkingDirectory(target);
+ Q_FALLTHROUGH();
+ case ChdirMode::None:
+ process.start();
+ break;
+ }
+
+ QCOMPARE(process.waitForStarted(), success);
+ QCOMPARE(errorSpy.count(), int(!success));
+ if (success) {
+ QVERIFY(process.waitForFinished());
+ } else {
+ QCOMPARE(process.error(), QProcess::FailedToStart);
+ }
+}
+
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
index d1035cb8c2..32a12c30bd 100644
--- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QObject>
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
index 1de5749d6e..42018219a9 100644
--- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2019 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2019 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QResource>
@@ -491,7 +466,7 @@ void tst_QResourceEngine::checkStructure()
void tst_QResourceEngine::searchPath_data()
{
- auto searchPath = QFileInfo(QT_TESTCASE_SOURCEDIR "/testqrc").canonicalFilePath();
+ auto searchPath = QFileInfo(QFINDTESTDATA("testqrc/test.qrc")).canonicalPath();
QTest::addColumn<QString>("searchPathPrefix");
QTest::addColumn<QString>("searchPath");
@@ -565,6 +540,15 @@ void tst_QResourceEngine::checkUnregisterResource()
QVERIFY(QFile::exists(file_check));
QVERIFY(QResource::unregisterResource(rcc_file, root));
QVERIFY(!QFile::exists(file_check));
+ {
+ // QTBUG-86088
+ QVERIFY(QResource::registerResource(rcc_file, root));
+ QFile file(file_check);
+ QVERIFY(file.open(QFile::ReadOnly));
+ QVERIFY(!QResource::unregisterResource(rcc_file, root));
+ file.close();
+ QVERIFY(!QFile::exists(file_check));
+ }
QVERIFY(QResource::registerResource(rcc_file, root));
QVERIFY(QFile::exists(file_check));
QFileInfo fileInfo(file_check);
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index 3d09ea291d..6879534144 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 David Faure <faure@kde.org>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module 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$
-**
-****************************************************************************/
+// Copyright (C) 2012 David Faure <faure@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSaveFile>
diff --git a/tests/auto/corelib/io/qsettings/.gitattributes b/tests/auto/corelib/io/qsettings/.gitattributes
index a4ad8d7644..920df33b54 100644
--- a/tests/auto/corelib/io/qsettings/.gitattributes
+++ b/tests/auto/corelib/io/qsettings/.gitattributes
@@ -1,5 +1,3 @@
resourcefile.ini -crlf
resourcefile2.ini -crlf
resourcefile3.ini -crlf
-resourcefile4.ini -crlf
-resourcefile5.ini -crlf
diff --git a/tests/auto/corelib/io/qsettings/CMakeLists.txt b/tests/auto/corelib/io/qsettings/CMakeLists.txt
index 55a360166b..2b60d1efff 100644
--- a/tests/auto/corelib/io/qsettings/CMakeLists.txt
+++ b/tests/auto/corelib/io/qsettings/CMakeLists.txt
@@ -4,36 +4,29 @@
## tst_qsettings Test:
#####################################################################
-qt_internal_add_test(tst_qsettings
- SOURCES
- tst_qsettings.cpp
- DEFINES
- QT_DISABLE_DEPRECATED_BEFORE=0
- INCLUDE_DIRECTORIES
- ../../kernel/qmetatype
- PUBLIC_LIBRARIES
- Qt::CorePrivate
- Qt::Gui
-)
-
-# Resources:
+# Test:
set(qsettings_resource_files
"bom.ini"
"resourcefile.ini"
"resourcefile2.ini"
"resourcefile3.ini"
- "resourcefile4.ini"
- "resourcefile5.ini"
"resourcefile6.plist"
"withcomments.ini"
"float.ini"
+ "qt5settings.ini"
+ "utf8settings.ini"
)
-qt_internal_add_resource(tst_qsettings "qsettings"
- PREFIX
- "/"
- FILES
- ${qsettings_resource_files}
+qt_internal_add_test(tst_qsettings
+ SOURCES
+ tst_qsettings.cpp
+ INCLUDE_DIRECTORIES
+ ../../kernel/qmetatype
+ PUBLIC_LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ TESTDATA ${qsettings_resource_files}
+ BUILTIN_TESTDATA
)
diff --git a/tests/auto/corelib/io/qsettings/qt5settings.ini b/tests/auto/corelib/io/qsettings/qt5settings.ini
new file mode 100644
index 0000000000..59239d29f3
--- /dev/null
+++ b/tests/auto/corelib/io/qsettings/qt5settings.ini
@@ -0,0 +1,11 @@
+[General]
+.%2C%27%25U%U0430%U0431%U0432%U0433%22%09=".,'%!@#$"
+%U265F=\x2658\x265a
+%UD83C%UDF0D=\xd83c\xdf10
+
+[Test]
+BAR=BAR
+B%C4R=B\xc4R
+OST=OST
+%D6SE=\xd6SE
+%U042D%U0442%U043E\%U0442%U0435%U0441%U0442=\x42d\x442\x43e \x442\x435\x441\x442
diff --git a/tests/auto/corelib/io/qsettings/resourcefile4.ini b/tests/auto/corelib/io/qsettings/resourcefile4.ini
deleted file mode 100644
index 09c21b1591..0000000000
--- a/tests/auto/corelib/io/qsettings/resourcefile4.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[Fa%E7ade]
-QU%C9BEC=Façade/QUÉBEC
diff --git a/tests/auto/corelib/io/qsettings/resourcefile5.ini b/tests/auto/corelib/io/qsettings/resourcefile5.ini
deleted file mode 100644
index d2d2103560..0000000000
--- a/tests/auto/corelib/io/qsettings/resourcefile5.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[Fa%E7ade]
-QU%C9BEC=Faade/QUBEC
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 48087b6a65..19ed36589e 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -1,52 +1,22 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtCore/QSettings>
#include <private/qsettings_p.h>
+
+#include "tst_qmetatype_common.h"
+
#include <QtCore/QCoreApplication>
-#include <QtCore/QDateTime>
-#include <QtCore/QtGlobal>
-#include <QtCore/QMetaType>
-#include <QtCore/QString>
#include <QtCore/QDir>
+#include <QtCore/QtGlobal>
#include <QtCore/QThread>
#include <QtCore/QSysInfo>
#if QT_CONFIG(shortcut)
# include <QtGui/QKeySequence>
#endif
-#include <QtCore>
-#include <QtGui>
-#include "tst_qmetatype_common.h"
-
#include <cctype>
#include <stdlib.h>
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
@@ -108,6 +78,16 @@ static inline bool canWriteNativeSystemSettings()
static const char insufficientPermissionSkipMessage[] = "Insufficient permissions for this test.";
+static void populateWithFormats()
+{
+ QTest::addColumn<QSettings::Format>("format");
+
+ QTest::newRow("native") << QSettings::NativeFormat;
+ QTest::newRow("ini") << QSettings::IniFormat;
+ QTest::newRow("custom1") << QSettings::CustomFormat1;
+ QTest::newRow("custom2") << QSettings::CustomFormat2;
+}
+
class tst_QSettings : public QObject
{
Q_OBJECT
@@ -120,7 +100,7 @@ public slots:
void cleanup() { cleanupTestFiles(); }
private slots:
void getSetCheck();
- void ctor_data();
+ void ctor_data() { populateWithFormats(); }
void ctor();
void beginGroup();
void setValue();
@@ -132,16 +112,16 @@ private slots:
void syncAlternateDataStream();
#endif
void setFallbacksEnabled();
- void setFallbacksEnabled_data();
- void fromFile_data();
+ void setFallbacksEnabled_data() { populateWithFormats(); }
+ void fromFile_data() { populateWithFormats(); }
void fromFile();
- void testArrays_data();
+ void testArrays_data() { populateWithFormats(); }
void testArrays();
- void testCaseSensitivity_data();
+ void testCaseSensitivity_data() { populateWithFormats(); }
void testCaseSensitivity();
void testErrorHandling_data();
void testErrorHandling();
- void testChildKeysAndGroups_data();
+ void testChildKeysAndGroups_data() { populateWithFormats(); }
void testChildKeysAndGroups();
void testUpdateRequestEvent();
void testThreadSafety();
@@ -154,7 +134,7 @@ private slots:
#ifdef Q_OS_MAC
void fileName();
#endif
- void isWritable_data();
+ void isWritable_data() { populateWithFormats(); }
void isWritable();
void registerFormat();
void setPath();
@@ -168,23 +148,23 @@ private slots:
#endif
#ifdef QT_BUILD_INTERNAL
- void allKeys_data();
+ void allKeys_data() { populateWithFormats(); }
void allKeys();
- void childGroups_data();
+ void childGroups_data() { populateWithFormats(); }
void childGroups();
- void childKeys_data();
+ void childKeys_data() { populateWithFormats(); }
void childKeys();
void testIniParsing_data();
void testIniParsing();
void testEscapes();
void testNormalizedKey_data();
void testNormalizedKey();
- void testVariantTypes_data();
+ void testVariantTypes_data() { populateWithFormats(); }
void testVariantTypes();
void testMetaTypes_data();
void testMetaTypes();
#endif
- void rainersSyncBugOnMac_data();
+ void rainersSyncBugOnMac_data() { populateWithFormats(); }
void rainersSyncBugOnMac();
void recursionBug();
@@ -198,6 +178,10 @@ private slots:
void floatAsQVariant();
void testXdg();
+
+ void testReadKeys_data();
+ void testReadKeys();
+
private:
void cleanupTestFiles();
@@ -280,16 +264,6 @@ static bool writeCustom3File(QIODevice &device, const QSettings::SettingsMap &ma
return true;
}
-static void populateWithFormats()
-{
- QTest::addColumn<QSettings::Format>("format");
-
- QTest::newRow("native") << QSettings::NativeFormat;
- QTest::newRow("ini") << QSettings::IniFormat;
- QTest::newRow("custom1") << QSettings::CustomFormat1;
- QTest::newRow("custom2") << QSettings::CustomFormat2;
-}
-
tst_QSettings::tst_QSettings()
: m_canWriteNativeSystemSettings(canWriteNativeSystemSettings())
{
@@ -361,11 +335,6 @@ void tst_QSettings::cleanupTestFiles()
Test the constructors and the assignment operator.
*/
-void tst_QSettings::ctor_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::ctor()
{
QFETCH(QSettings::Format, format);
@@ -955,7 +924,7 @@ void tst_QSettings::testIniParsing()
if ( settings.status() == QSettings::NoError ) { // else no point proceeding
QVariant v = settings.value(key);
if (expect.isValid())
- QVERIFY(v.canConvert(expect.type()));
+ QVERIFY(v.canConvert(expect.metaType()));
// check some types so as to give prettier error messages
if ( v.typeId() == QMetaType::QString ) {
QCOMPARE(v.toString(), expect.toString());
@@ -1183,7 +1152,7 @@ template<int MetaTypeId>
static void testMetaTypesHelper(QSettings::Format format)
{
typedef typename MetaEnumToType<MetaTypeId>::Type Type;
- const char *key = QMetaType::typeName(MetaTypeId);
+ const char *key = QMetaType(MetaTypeId).name();
Type *value = TestValueFactory<MetaTypeId>::create();
QVariant inputVariant = QVariant::fromValue(*value);
@@ -1202,8 +1171,8 @@ static void testMetaTypesHelper(QSettings::Format format)
QSettings settings(format, scope, organization, applicationName);
QVariant outputVariant = settings.value(key);
if (MetaTypeId != QMetaType::QVariant)
- QVERIFY(outputVariant.canConvert(MetaTypeId));
- if (outputVariant.type() != inputVariant.type())
+ QVERIFY(outputVariant.canConvert(QMetaType(MetaTypeId)));
+ if (outputVariant.typeId() != inputVariant.typeId())
qWarning() << "type mismatch between" << inputVariant << "and" << outputVariant;
QCOMPARE(qvariant_cast<Type >(outputVariant), *value);
}
@@ -1242,7 +1211,7 @@ void tst_QSettings::testMetaTypes_data()
#define ADD_METATYPE_TEST_ROW(MetaTypeName, MetaTypeId, RealType) \
{ \
const char *formatName = QMetaEnum::fromType<QSettings::Format>().valueToKey(formats[i]); \
- const char *typeName = QMetaType::typeName(QMetaType::MetaTypeName); \
+ const char *typeName = QMetaType(QMetaType::MetaTypeName).name(); \
QTest::newRow(QString("%1:%2").arg(formatName).arg(typeName).toLatin1().constData()) \
<< QSettings::Format(formats[i]) << int(QMetaType::MetaTypeName); \
}
@@ -1277,106 +1246,102 @@ FOR_EACH_CORE_METATYPE(RETURN_CREATE_FUNCTION)
TypeTestFunctionGetter::get(type)(format);
}
-
-void tst_QSettings::testVariantTypes_data()
-{
- populateWithFormats();
-}
#endif
#ifdef QT_BUILD_INTERNAL
void tst_QSettings::testVariantTypes()
{
-#define testVal(key, val, tp, rtype) \
- { \
- QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP"); \
- settings1.setValue(key, QVariant::fromValue(val)); \
- } \
- QConfFile::clearCache(); \
- { \
- QSettings settings2(format, QSettings::UserScope, "software.org", "KillerAPP"); \
- QVariant v = settings2.value(key); \
- QVERIFY(qvariant_cast<tp >(v) == val); \
- QVERIFY(v.type() == QVariant::rtype); \
+ QFETCH(QSettings::Format, format);
+
+ {
+ QSettings settings(format, QSettings::UserScope, "software.org", "KillerAPP");
+ QVERIFY(!settings.contains("empty"));
+ QCOMPARE(settings.value("empty"), QVariant());
+
+ settings.setValue("empty", QVariant());
+ QVERIFY(settings.contains("empty"));
+ QCOMPARE(settings.value("empty"), QVariant());
+
+ settings.setValue("empty", QVariant(1));
+ QVERIFY(settings.contains("empty"));
+ QCOMPARE(settings.value("empty"), QVariant(1));
+
+ settings.setValue("empty", QVariant());
+ QVERIFY(settings.contains("empty"));
+ QCOMPARE(settings.value("empty"), QVariant());
+
+ settings.remove("empty");
+ QVERIFY(!settings.contains("empty"));
+ QCOMPARE(settings.value("empty"), QVariant());
}
- typedef QMap<QString, QVariant> TestVariantMap;
+ auto checker = [format](const char *key, auto value, QMetaType::Type expected) {
+ {
+ QSettings settings(format, QSettings::UserScope, "software.org", "KillerAPP");
+ settings.setValue(key, QVariant::fromValue(value));
+ }
+ QConfFile::clearCache();
+ {
+ QSettings settings(format, QSettings::UserScope, "software.org", "KillerAPP");
+ QVariant actual = settings.value(key);
+ QCOMPARE(actual.metaType().id(), expected);
+ QCOMPARE(qvariant_cast<decltype(value)>(actual), value);
+ }
+ };
+#define testValue(key, supplied, expected) do { \
+ checker(key, supplied, QMetaType::expected); \
+ if (QTest::currentTestFailed()) \
+ return; \
+ } while (0)
- QFETCH(QSettings::Format, format);
+ typedef QMap<QString, QVariant> TestVariantMap;
TestVariantMap m2;
m2.insert("ene", "due");
m2.insert("rike", "fake");
m2.insert("borba", "dorba");
- testVal("key2", m2, TestVariantMap, Map);
-
- QStringList l2;
+ testValue("customMap", m2, QVariantMap);
- l2 << "ene" << "due" << "@Point(1 2)" << "@fake";
- testVal("key3", l2, QStringList, StringList);
+ QStringList l2 { "ene", "due", "@Point(1 2)", "@fake" };
+ testValue("stringsAt", l2, QStringList);
- l2.clear();
- l2 << "ene" << "due" << "rike" << "fake";
- testVal("key3", l2, QStringList, StringList);
+ l2 = { "ene", "due", "rike", "fake" };
+ testValue("strings", l2, QStringList);
- QList<QVariant> l3;
QDate date = QDate::currentDate();
QTime time = QTime::currentTime();
- l3 << QString("ene") << 10 << QVariant::fromValue(QColor(1, 2, 3)) << QVariant(QRect(1, 2, 3, 4))
- << QVariant(QSize(4, 56)) << QVariant(QPoint(4, 2)) << true << false << date << time;
- testVal("key3", l3, QVariantList, List);
-
- testVal("key4", QString("hello"), QString, String);
- testVal("key5", QColor(1, 2, 3), QColor, Color);
- testVal("key6", QRect(1, 2, 3, 4), QRect, Rect);
- testVal("key7", QSize(4, 56), QSize, Size);
- testVal("key8", QPoint(4, 2), QPoint, Point);
- testVal("key10", date, QDate, Date);
- testVal("key11", time, QTime, Time);
- testVal("key12", QByteArray("foo bar"), QByteArray, ByteArray);
-
- {
- QSettings settings(format, QSettings::UserScope, "software.org", "KillerAPP");
- QVERIFY(!settings.contains("key99"));
- QCOMPARE(settings.value("key99"), QVariant());
-
- settings.setValue("key99", QVariant());
- QVERIFY(settings.contains("key99"));
- QCOMPARE(settings.value("key99"), QVariant());
-
- settings.setValue("key99", QVariant(1));
- QVERIFY(settings.contains("key99"));
- QCOMPARE(settings.value("key99"), QVariant(1));
+ QList<QVariant> l3 { QString("ene"), 10, QVariant::fromValue(QColor(1, 2, 3)),
+ QVariant(QRect(1, 2, 3, 4)), QVariant(QSize(4, 56)), QVariant(QPoint(4, 2)),
+ true, false, date, time };
+ testValue("mixedList", l3, QVariantList);
+
+ testValue("string", QString("hello"), QString);
+ testValue("color", QColor(1, 2, 3), QColor);
+ testValue("rect", QRect(1, 2, 3, 4), QRect);
+ testValue("size", QSize(4, 56), QSize);
+ testValue("point", QPoint(4, 2), QPoint);
+ testValue("date", date, QDate);
+ testValue("time", time, QTime);
+ testValue("byteArray", QByteArray("foo bar"), QByteArray);
+
+ QList<QVariant> l4 { QVariant(m2), QVariant(l2), QVariant(l3) };
+ testValue("collectList", l4, QVariantList);
- settings.setValue("key99", QVariant());
- QVERIFY(settings.contains("key99"));
- QCOMPARE(settings.value("key99"), QVariant());
-
- settings.remove("key99");
- QVERIFY(!settings.contains("key99"));
- QCOMPARE(settings.value("key99"), QVariant());
- }
-
- QList<QVariant> l4;
- l4 << QVariant(m2) << QVariant(l2) << QVariant(l3);
- testVal("key13", l4, QVariantList, List);
QDateTime dt = QDateTime::currentDateTime();
dt.setOffsetFromUtc(3600);
- testVal("key14", dt, QDateTime, DateTime);
+ testValue("dateTime", dt, QDateTime);
#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) {
- testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QKeySequence, KeySequence);
- } else {
- testVal("keysequence",
- QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
- QString, String);
- }
+ QKeySequence seq(Qt::ControlModifier | Qt::Key_F1);
+ if (format >= QSettings::InvalidFormat)
+ testValue("keySequence", seq, QKeySequence);
+ else
+ testValue("keySequence", seq.toString(QKeySequence::NativeText), QString);
#endif // QT_CONFIG(shortcut)
-#undef testVal
+#undef testValue
}
#endif
@@ -1864,11 +1829,6 @@ void tst_QSettings::syncAlternateDataStream()
}
#endif
-void tst_QSettings::setFallbacksEnabled_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::setFallbacksEnabled()
{
QFETCH(QSettings::Format, format);
@@ -1953,11 +1913,6 @@ void tst_QSettings::setFallbacksEnabled()
QVERIFY(!settings1.contains("key 5"));
}
-void tst_QSettings::testChildKeysAndGroups_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::testChildKeysAndGroups()
{
QFETCH(QSettings::Format, format);
@@ -2156,20 +2111,17 @@ void tst_QSettings::testNormalizedKey()
inKey.detach();
- QString result = QSettingsPrivate::normalizedKey(inKey);
- QCOMPARE(result, outKey);
-
- /*
- If the key is already normalized, we verify that outKey is
- just a shallow copy of the input string. This is an important
- optimization that shouldn't be removed accidentally.
- */
- if (inKey == outKey) {
- QVERIFY(!result.isDetached());
- } else {
- if (!result.isEmpty()) {
- QVERIFY(result.isDetached());
- }
+ {
+ auto result = QSettingsPrivate::normalizedKey(inKey);
+ QCOMPARE(result, outKey);
+ }
+ {
+ auto result = QSettingsPrivate::normalizedKey(QUtf8StringView{inKey.toUtf8()});
+ QCOMPARE(result, outKey);
+ }
+ {
+ auto result = QSettingsPrivate::normalizedKey(QLatin1String{inKey.toLatin1()});
+ QCOMPARE(result, outKey);
}
}
#endif
@@ -2355,11 +2307,6 @@ void tst_QSettings::trailingWhitespace()
}
}
-void tst_QSettings::fromFile_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::fromFile()
{
QFETCH(QSettings::Format, format);
@@ -2429,11 +2376,6 @@ static bool containsSubList(QStringList mom, QStringList son)
return true;
}
-void tst_QSettings::testArrays_data()
-{
- populateWithFormats();
-}
-
/*
Tests beginReadArray(), beginWriteArray(), endArray(), and
setArrayIndex().
@@ -2714,7 +2656,7 @@ static QByteArray iniEscapedKey(const QString &str)
static QString iniUnescapedKey(const QByteArray &ba)
{
QString result;
- QSettingsPrivate::iniUnescapedKey(ba, 0, ba.size(), result);
+ QSettingsPrivate::iniUnescapedKey(ba, result);
return result;
}
@@ -2729,7 +2671,7 @@ static QStringList iniUnescapedStringList(const QByteArray &ba)
{
QStringList result;
QString str;
- bool isStringList = QSettingsPrivate::iniUnescapedStringList(ba, 0, ba.size(), str, result);
+ bool isStringList = QSettingsPrivate::iniUnescapedStringList(ba, str, result);
if (!isStringList)
result = QStringList(str);
return result;
@@ -2881,11 +2823,6 @@ void tst_QSettings::testEscapes()
}
#endif
-void tst_QSettings::testCaseSensitivity_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::testCaseSensitivity()
{
QFETCH(QSettings::Format, format);
@@ -3035,11 +2972,6 @@ void tst_QSettings::fileName()
}
#endif
-void tst_QSettings::isWritable_data()
-{
- populateWithFormats();
-}
-
void tst_QSettings::isWritable()
{
QFETCH(QSettings::Format, format);
@@ -3092,13 +3024,6 @@ void tst_QSettings::isWritable()
}
#ifdef QT_BUILD_INTERNAL
-void tst_QSettings::childGroups_data()
-{
- populateWithFormats();
-}
-#endif
-
-#ifdef QT_BUILD_INTERNAL
void tst_QSettings::childGroups()
{
QFETCH(QSettings::Format, format);
@@ -3168,13 +3093,6 @@ void tst_QSettings::childGroups()
#endif
#ifdef QT_BUILD_INTERNAL
-void tst_QSettings::childKeys_data()
-{
- populateWithFormats();
-}
-#endif
-
-#ifdef QT_BUILD_INTERNAL
void tst_QSettings::childKeys()
{
QFETCH(QSettings::Format, format);
@@ -3242,13 +3160,6 @@ void tst_QSettings::childKeys()
#endif
#ifdef QT_BUILD_INTERNAL
-void tst_QSettings::allKeys_data()
-{
- populateWithFormats();
-}
-#endif
-
-#ifdef QT_BUILD_INTERNAL
void tst_QSettings::allKeys()
{
QFETCH(QSettings::Format, format);
@@ -3508,11 +3419,6 @@ void tst_QSettings::dontReorderIniKeysNeedlessly()
}
#endif
-void tst_QSettings::rainersSyncBugOnMac_data()
-{
- ctor_data();
-}
-
void tst_QSettings::rainersSyncBugOnMac()
{
QFETCH(QSettings::Format, format);
@@ -3544,7 +3450,7 @@ void tst_QSettings::rainersSyncBugOnMac()
void tst_QSettings::recursionBug()
{
QPixmap pix(10,10);
- pix.fill("blue");
+ pix.fill(Qt::blue);
{
QSettings settings(settingsPath("starrunner.ini"), QSettings::IniFormat);
@@ -3663,5 +3569,39 @@ void tst_QSettings::testXdg()
#endif
}
+void tst_QSettings::testReadKeys_data()
+{
+ QTest::addColumn<QString>("filepath");
+
+ QTest::newRow("escaped") << ":/qt5settings.ini";
+ QTest::newRow("utf-8") << ":/utf8settings.ini";
+}
+
+void tst_QSettings::testReadKeys()
+{
+ QFETCH(QString, filepath);
+
+ QSettings settings(filepath, QSettings::IniFormat);
+ QCOMPARE(settings.status(), QSettings::NoError);
+
+ QVariantMap expectedValues;
+ expectedValues.insert("Test/BAR", "BAR");
+ expectedValues.insert("Test/OST", "OST");
+ expectedValues.insert("Test/B\xC3\x84R", "B\xC3\x84R"); // BÄR
+ expectedValues.insert("Test/\xC3\x96SE", "\xC3\x96SE"); // ÖSE
+ expectedValues.insert(
+ "Test/\xD0\xAD\xD1\x82\xD0\xBE/\xD1\x82\xD0\xB5\xD1\x81\xD1\x82", // Это/тест
+ "\xD0\xAD\xD1\x82\xD0\xBE \xD1\x82\xD0\xB5\xD1\x81\xD1\x82"); // Это тест
+ expectedValues.insert(".,'%U\xD0\xB0\xD0\xB1\xD0\xB2\xD0\xB3\"\t", ".,'%!@#$");
+ expectedValues.insert("\xE2\x99\x9F", "\xE2\x99\x98\xE2\x99\x9A"); // ♟︎ ♘♚
+ expectedValues.insert("\xF0\x9F\x8C\x8D", "\xF0\x9F\x8C\x90"); // 🌍 🌐
+
+ QVariantMap readValues;
+ for (const auto &key : settings.allKeys())
+ readValues.insert(key, settings.value(key));
+
+ QCOMPARE(readValues, expectedValues);
+}
+
QTEST_MAIN(tst_QSettings)
#include "tst_qsettings.moc"
diff --git a/tests/auto/corelib/io/qsettings/utf8settings.ini b/tests/auto/corelib/io/qsettings/utf8settings.ini
new file mode 100644
index 0000000000..bac010254f
--- /dev/null
+++ b/tests/auto/corelib/io/qsettings/utf8settings.ini
@@ -0,0 +1,11 @@
+[General]
+.%2C%27%25Uабвг%22%09=".,'%!@#$"
+♟=♘♚
+🌍=🌐
+
+[Test]
+BAR=BAR
+BÄR=BÄR
+OST=OST
+ÖSE=ÖSE
+Это\тест=Это тест
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index d722b374d9..2c0500eec9 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2020 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2020 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qstandardpaths.h>
#include <QTest>
diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
index f7273d19cf..7e462537b3 100644
--- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
+++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2014 Ivan Komissarov <ABBAPOH@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QStorageInfo>
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index d4760c0afd..7761ac5a6a 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -49,6 +24,10 @@
#include "qplatformdefs.h"
#endif
+#include <optional>
+
+using namespace Qt::StringLiterals;
+
class tst_QTemporaryDir : public QObject
{
Q_OBJECT
@@ -59,6 +38,7 @@ public slots:
private slots:
void construction();
+ void moveSemantics();
void fileTemplate();
void fileTemplate_data();
void getSetCheck();
@@ -105,6 +85,58 @@ void tst_QTemporaryDir::construction()
QCOMPARE(dir.errorString(), QString());
}
+void tst_QTemporaryDir::moveSemantics()
+{
+ {
+ auto original = std::optional<QTemporaryDir>(std::in_place);
+ QVERIFY(original->isValid());
+
+ original->setAutoRemove(true);
+
+ auto OriginalDirectoryInfo = QFileInfo(original->path());
+ OriginalDirectoryInfo.setCaching(false);
+ QVERIFY(OriginalDirectoryInfo.exists());
+
+ QTemporaryDir movedInto = std::move(*original);
+
+ original.reset();
+
+ QVERIFY(OriginalDirectoryInfo.exists());
+ QVERIFY(movedInto.path() == OriginalDirectoryInfo.filePath());
+ }
+
+ {
+ auto movedInto = QTemporaryDir();
+ QVERIFY(movedInto.isValid());
+
+ movedInto.setAutoRemove(true);
+
+ auto movedIntoInitialDirectoryInfo = QFileInfo(movedInto.path());
+ movedIntoInitialDirectoryInfo.setCaching(false);
+ QVERIFY(movedIntoInitialDirectoryInfo.exists());
+
+ auto OriginalDirectoryInfo = QFileInfo();
+ OriginalDirectoryInfo.setCaching(false);
+
+ {
+ auto original = QTemporaryDir();
+ QVERIFY(original.isValid());
+
+ original.setAutoRemove(true);
+
+ OriginalDirectoryInfo.setFile(original.path());
+ QVERIFY(OriginalDirectoryInfo.exists());
+
+ movedInto = std::move(original);
+ }
+
+ QVERIFY(!movedIntoInitialDirectoryInfo.exists());
+ QVERIFY(OriginalDirectoryInfo.exists());
+
+ QVERIFY(movedInto.path() == OriginalDirectoryInfo.filePath());
+ }
+}
+
// Testing get/set functions
void tst_QTemporaryDir::getSetCheck()
{
@@ -169,19 +201,19 @@ void tst_QTemporaryDir::fileTemplate_data()
return; // skip if we have no drive letter
tmp.data()[1] = u'$';
- const auto tmpPath = tmp + uR"(\UNC.XXXXXX.tmpDir)"_qs;
+ const auto tmpPath = tmp + uR"(\UNC.XXXXXX.tmpDir)"_s;
QTest::newRow("UNC-backslash")
- << uR"(\\localhost\)"_qs + tmpPath << "UNC."
+ << uR"(\\localhost\)"_s + tmpPath << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-prefix")
- << uR"(\\?\UNC\localhost\)"_qs + tmpPath << "UNC."
+ << uR"(\\?\UNC\localhost\)"_s + tmpPath << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-slash")
- << u"//localhost/"_qs + QDir::fromNativeSeparators(tmpPath) << "UNC."
+ << u"//localhost/"_s + QDir::fromNativeSeparators(tmpPath) << "UNC."
<< ".tmpDir";
QTest::newRow("UNC-prefix-slash")
- << uR"(//?/UNC/localhost/)"_qs + QDir::fromNativeSeparators(tmpPath) << "UNC."
+ << uR"(//?/UNC/localhost/)"_s + QDir::fromNativeSeparators(tmpPath) << "UNC."
<< ".tmpDir";
#endif
}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 732b2fa4a8..ba37285d5f 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2017 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2017 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qcoreapplication.h>
@@ -60,6 +35,8 @@
#include "qplatformdefs.h"
#endif
+using namespace Qt::StringLiterals;
+
class tst_QTemporaryFile : public QObject
{
Q_OBJECT
@@ -218,22 +195,22 @@ void tst_QTemporaryFile::fileTemplate_data()
return; // skip if we have no drive letter
tmp.data()[1] = u'$';
- const auto tmpPath = tmp + uR"(\QTBUG-74291.XXXXXX.tmpFile)"_qs;
+ const auto tmpPath = tmp + uR"(\QTBUG-74291.XXXXXX.tmpFile)"_s;
QTest::newRow("UNC-backslash")
- << uR"(\\localhost\)"_qs + tmpPath << "QTBUG-74291."
+ << uR"(\\localhost\)"_s + tmpPath << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-prefix")
- << uR"(\\?\UNC\localhost\)"_qs + tmpPath << "QTBUG-74291."
+ << uR"(\\?\UNC\localhost\)"_s + tmpPath << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-slash")
- << u"//localhost/"_qs + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
+ << u"//localhost/"_s + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
<< ".tmpFile"
<< "";
QTest::newRow("UNC-prefix-slash")
- << uR"(//?/UNC/localhost/)"_qs + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
+ << uR"(//?/UNC/localhost/)"_s + QDir::fromNativeSeparators(tmpPath) << "QTBUG-74291."
<< ".tmpFile"
<< "";
#endif
diff --git a/tests/auto/corelib/io/qurl/idna-test.c b/tests/auto/corelib/io/qurl/idna-test.c
index 035d3e1c89..1360ee1072 100644
--- a/tests/auto/corelib/io/qurl/idna-test.c
+++ b/tests/auto/corelib/io/qurl/idna-test.c
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
struct idna
{
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 205a99ef1b..48ffa09906 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qurl.h>
#include <QtCore/QDebug>
@@ -40,6 +15,8 @@
#include <QtTest/private/qemulationdetector_p.h>
+using namespace Qt::StringLiterals;
+
Q_DECLARE_METATYPE(QUrl::FormattingOptions)
class tst_QUrl : public QObject
@@ -2085,7 +2062,7 @@ void tst_QUrl::hasQuery()
void tst_QUrl::nameprep()
{
// U+FB01 LATIN SMALL LIGATURE FI
- QUrl url(u"http://www.\uFB01le.de/"_qs);
+ QUrl url(u"http://www.\uFB01le.de/"_s);
QCOMPARE(url.toString(), QStringLiteral(u"http://www.file.de/"));
}
diff --git a/tests/auto/corelib/io/qurl/tst_qurl_mac.mm b/tests/auto/corelib/io/qurl/tst_qurl_mac.mm
index b6e2a923f3..f23fb4ce06 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl_mac.mm
+++ b/tests/auto/corelib/io/qurl/tst_qurl_mac.mm
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 6c556f1f25..aa7564f300 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QUrl>
#include <QTest>
@@ -41,6 +16,8 @@
#define STRINGPREP_BIDI_BOTH_L_AND_RAL 4
#define STRINGPREP_BIDI_LEADTRAIL_NOT_RAL 5
+using namespace Qt::StringLiterals;
+
struct char16array {
char16array() {}
template <size_t N>
@@ -259,8 +236,8 @@ void tst_QUrlInternal::ace_testsuite_data()
QTest::newRow("ascii-upper") << "FLUKE" << "fluke" << "fluke" << "fluke";
// U+FB01 LATIN SMALL LIGATURE FI
- QTest::newRow("asciifolded") << u"\uFB01le"_qs << "file" << "." << "file";
- QTest::newRow("asciifolded-dotcom") << u"\uFB01le.example.com"_qs << "file.example.com" << "." << "file.example.com";
+ QTest::newRow("asciifolded") << u"\uFB01le"_s << "file" << "." << "file";
+ QTest::newRow("asciifolded-dotcom") << u"\uFB01le.example.com"_s << "file.example.com" << "." << "file.example.com";
QTest::newRow("greek-mu") << QString::fromLatin1("\265V")
<<"xn--v-lmb"
<< "."
diff --git a/tests/auto/corelib/io/qurlinternal/utf8data.cpp b/tests/auto/corelib/io/qurlinternal/utf8data.cpp
index ba2c3e054a..244da29d1c 100644
--- a/tests/auto/corelib/io/qurlinternal/utf8data.cpp
+++ b/tests/auto/corelib/io/qurlinternal/utf8data.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
void loadInvalidUtf8Rows()
diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
index de911b7aa4..43a407da9d 100644
--- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
+++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp
@@ -1,30 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2012 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QUrlQuery>
#include <QTest>
@@ -33,6 +9,8 @@ typedef QList<QPair<QString, QString> > QueryItems;
Q_DECLARE_METATYPE(QueryItems)
Q_DECLARE_METATYPE(QUrl::ComponentFormattingOptions)
+using namespace Qt::StringLiterals;
+
class tst_QUrlQuery : public QObject
{
Q_OBJECT
@@ -67,46 +45,32 @@ private Q_SLOTS:
void old_hasQueryItem();
};
-static QString prettyElement(const QString &key, const QString &value)
-{
- QString result;
- if (key.isNull())
- result += "null -> ";
- else
- result += '"' + key + "\" -> ";
- if (value.isNull())
- result += "null";
- else
- result += '"' + value + '"';
- return result;
-}
-
-static QString prettyPair(QList<QPair<QString, QString> >::const_iterator it)
+static QString prettyPair(const QPair<QString, QString> &pair)
{
- return prettyElement(it->first, it->second);
+ const auto represent = [](const QString &s) {
+ return s.isNull() ? u"null"_s : u'"' + s + u'"';
+ };
+ return represent(pair.first) + " -> "_L1 + represent(pair.second);
}
-template <typename T>
-static QByteArray prettyList(const T &items)
+static QByteArray prettyList(const QueryItems &items)
{
- QString result = "(";
- bool first = true;
- typename T::const_iterator it = items.constBegin();
- for ( ; it != items.constEnd(); ++it) {
- if (!first)
- result += ", ";
- first = false;
- result += prettyPair(it);
- }
- result += QLatin1Char(')');
+ if (items.isEmpty())
+ return "()";
+ auto it = items.constBegin();
+ QString result = u'(' + prettyPair(*it);
+ for (++it; it != items.constEnd(); ++it)
+ result += ", "_L1 + prettyPair(*it);
+ result += u')';
return result.toLocal8Bit();
}
-static bool compare(const QList<QPair<QString, QString> > &actual, const QueryItems &expected,
+static bool compare(const QueryItems &actual, const QueryItems &expected,
const char *actualStr, const char *expectedStr, const char *file, int line)
{
return QTest::compare_helper(actual == expected, "Compared values are not the same",
- qstrdup(prettyList(actual)), qstrdup(prettyList(expected).data()),
+ [&actual] { return qstrdup(prettyList(actual).constData()); },
+ [&expected] { return qstrdup(prettyList(expected).constData()); },
actualStr, expectedStr, file, line);
}
diff --git a/tests/auto/corelib/io/qurluts46/tst_qurluts46.cpp b/tests/auto/corelib/io/qurluts46/tst_qurluts46.cpp
index a550397ee8..e36642974a 100644
--- a/tests/auto/corelib/io/qurluts46/tst_qurluts46.cpp
+++ b/tests/auto/corelib/io/qurluts46/tst_qurluts46.cpp
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QUrl>
#include <QtCore/QFile>
#include <QTest>
+#include <QSet>
+#include <QByteArray>
#include <algorithm>
class tst_QUrlUts46 : public QObject
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
index 5719d9e046..423cc1bdc8 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp
index dced357d61..b8283709e2 100644
--- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtTest/private/qpropertytesthelper_p.h>
@@ -44,6 +19,7 @@ private slots:
void flags();
void headerData_data();
void headerData();
+ void headerDataInBounds();
void itemData_data();
void itemData();
void mapFromSource_data();
@@ -174,6 +150,133 @@ void tst_QAbstractProxyModel::headerData()
QCOMPARE(model.headerData(section, orientation, role), headerData);
}
+class SimpleTableReverseColumnsProxy : public QAbstractProxyModel
+{
+public:
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
+ {
+ if (parent.isValid())
+ return {};
+
+ if (row < 0 || row >= rowCount() || column < 0 || column >= columnCount())
+ qFatal("error"); // cannot QFAIL here
+
+ return createIndex(row, column);
+ }
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override
+ {
+ if (parent.isValid())
+ return 0;
+ return sourceModel()->rowCount();
+ }
+
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override
+ {
+ if (parent.isValid())
+ return 0;
+ return sourceModel()->columnCount();
+ }
+
+ QModelIndex parent(const QModelIndex &) const override
+ {
+ return QModelIndex();
+ }
+
+ QModelIndex mapToSource(const QModelIndex &idx) const override
+ {
+ if (!idx.isValid())
+ return QModelIndex();
+ return sourceModel()->index(idx.row(), columnCount() - 1 - idx.column());
+ }
+
+ QModelIndex mapFromSource(const QModelIndex &idx) const override
+ {
+ if (idx.parent().isValid())
+ return QModelIndex();
+ return createIndex(idx.row(), columnCount() - 1 - idx.column());
+ }
+};
+
+void tst_QAbstractProxyModel::headerDataInBounds()
+{
+ QStandardItemModel qsim(0, 5);
+ qsim.setHorizontalHeaderLabels({"Col1", "Col2", "Col3", "Col4", "Col5"});
+
+ SimpleTableReverseColumnsProxy proxy;
+ QSignalSpy headerDataChangedSpy(&proxy, &QAbstractItemModel::headerDataChanged);
+ QVERIFY(headerDataChangedSpy.isValid());
+ proxy.setSourceModel(&qsim);
+ QCOMPARE(proxy.rowCount(), 0);
+ QCOMPARE(proxy.columnCount(), 5);
+
+ for (int i = 0; i < proxy.columnCount(); ++i) {
+ QString expected = QString("Col%1").arg(i + 1);
+ QCOMPARE(proxy.headerData(i, Qt::Horizontal).toString(), expected);
+ }
+
+ qsim.appendRow({
+ new QStandardItem("A"),
+ new QStandardItem("B"),
+ new QStandardItem("C"),
+ new QStandardItem("D"),
+ new QStandardItem("E")
+ });
+
+ QCOMPARE(proxy.rowCount(), 1);
+ QCOMPARE(proxy.columnCount(), 5);
+ QCOMPARE(headerDataChangedSpy.count(), 1);
+ QCOMPARE(headerDataChangedSpy[0][0].value<Qt::Orientation>(), Qt::Horizontal);
+ QCOMPARE(headerDataChangedSpy[0][1].value<int>(), 0);
+ QCOMPARE(headerDataChangedSpy[0][2].value<int>(), 4);
+
+ for (int i = 0; i < proxy.columnCount(); ++i) {
+ QString expected = QString("Col%1").arg(proxy.columnCount() - i);
+ QCOMPARE(proxy.headerData(i, Qt::Horizontal).toString(), expected);
+ }
+
+ qsim.appendRow({
+ new QStandardItem("A"),
+ new QStandardItem("B"),
+ new QStandardItem("C"),
+ new QStandardItem("D"),
+ new QStandardItem("E")
+ });
+ QCOMPARE(proxy.rowCount(), 2);
+ QCOMPARE(proxy.columnCount(), 5);
+ QCOMPARE(headerDataChangedSpy.count(), 1);
+
+ for (int i = 0; i < proxy.columnCount(); ++i) {
+ QString expected = QString("Col%1").arg(proxy.columnCount() - i);
+ QCOMPARE(proxy.headerData(i, Qt::Horizontal).toString(), expected);
+ }
+
+ QVERIFY(qsim.removeRows(0, 1));
+
+ QCOMPARE(proxy.rowCount(), 1);
+ QCOMPARE(proxy.columnCount(), 5);
+ QCOMPARE(headerDataChangedSpy.count(), 1);
+
+ for (int i = 0; i < proxy.columnCount(); ++i) {
+ QString expected = QString("Col%1").arg(proxy.columnCount() - i);
+ QCOMPARE(proxy.headerData(i, Qt::Horizontal).toString(), expected);
+ }
+
+ QVERIFY(qsim.removeRows(0, 1));
+
+ QCOMPARE(proxy.rowCount(), 0);
+ QCOMPARE(proxy.columnCount(), 5);
+ QCOMPARE(headerDataChangedSpy.count(), 2);
+ QCOMPARE(headerDataChangedSpy[1][0].value<Qt::Orientation>(), Qt::Horizontal);
+ QCOMPARE(headerDataChangedSpy[1][1].value<int>(), 0);
+ QCOMPARE(headerDataChangedSpy[1][2].value<int>(), 4);
+
+ for (int i = 0; i < proxy.columnCount(); ++i) {
+ QString expected = QString("Col%1").arg(i + 1);
+ QCOMPARE(proxy.headerData(i, Qt::Horizontal).toString(), expected);
+ }
+}
+
void tst_QAbstractProxyModel::itemData_data()
{
QTest::addColumn<QModelIndex>("index");
diff --git a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
index 0188768db5..9990aaf2ed 100644
--- a/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qconcatenatetablesproxymodel/tst_qconcatenatetablesproxymodel.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QSignalSpy>
#include <QSortFilterProxyModel>
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index 72f3564746..b1de23d619 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module 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$
-**
-****************************************************************************/
+// Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QAbstractItemModelTester>
#include <QCoreApplication>
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
index cdbeaccac6..b0256470e6 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
index 40495c1d9e..1ce10c46aa 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 7c4dbaedbf..1a9875a1eb 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtTest/private/qpropertytesthelper_p.h>
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index f07d324ce1..99151a2065 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tst_qsortfilterproxymodel.h"
#include "dynamictreemodel.h"
@@ -3197,7 +3172,8 @@ void tst_QSortFilterProxyModel::mapFromToSource()
QCOMPARE(proxy.mapFromSource(QModelIndex()), QModelIndex());
QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex());
-#ifdef QT_NO_DEBUG //if Qt is compiled in debug mode, this will assert
+ // Will assert in debug, so only test in release
+#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource");
QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex());
QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource");
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.h b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.h
index baad28ec06..b63ec98baa 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.h
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TST_QSORTFILTERPROXYMODEL_H
#define TST_QSORTFILTERPROXYMODEL_H
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
index d6a09056ae..a880f8d204 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, authors Filipe Azevedo <filipe.azevedo@kdab.com> and David Faure <david.faure@kdab.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, authors Filipe Azevedo <filipe.azevedo@kdab.com> and David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp
index 39376b3499..bce7b1733d 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_regularexpression/tst_qsortfilterproxymodel_regularexpression.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/qmodellistener.h b/tests/auto/corelib/itemmodels/qstringlistmodel/qmodellistener.h
index e08a0bdb1f..0ea058d0ec 100644
--- a/tests/auto/corelib/itemmodels/qstringlistmodel/qmodellistener.h
+++ b/tests/auto/corelib/itemmodels/qstringlistmodel/qmodellistener.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QObject>
#include <QModelIndex>
diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
index 5fe8784768..ac2eda0ef0 100644
--- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp
index f577c3c41b..353d700e2d 100644
--- a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Luca Beldi <v.ronin@yahoo.it>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 Luca Beldi <v.ronin@yahoo.it>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/kernel/CMakeLists.txt b/tests/auto/corelib/kernel/CMakeLists.txt
index 18f20bfadc..3083652945 100644
--- a/tests/auto/corelib/kernel/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/CMakeLists.txt
@@ -49,4 +49,5 @@ endif()
if(ANDROID)
add_subdirectory(qjnienvironment)
add_subdirectory(qjniobject)
+ add_subdirectory(qjnitypes)
endif()
diff --git a/tests/auto/corelib/kernel/qapplicationstatic/tst_qapplicationstatic.cpp b/tests/auto/corelib/kernel/qapplicationstatic/tst_qapplicationstatic.cpp
index 9972e050db..987a20a589 100644
--- a/tests/auto/corelib/kernel/qapplicationstatic/tst_qapplicationstatic.cpp
+++ b/tests/auto/corelib/kernel/qapplicationstatic/tst_qapplicationstatic.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QPointer>
diff --git a/tests/auto/corelib/kernel/qcoreapplication/CMakeLists.txt b/tests/auto/corelib/kernel/qcoreapplication/CMakeLists.txt
index 24be474f90..92d4b03d26 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qcoreapplication/CMakeLists.txt
@@ -31,6 +31,11 @@ if (APPLE)
endif()
# special case end
+if (ANDROID)
+ set_property(TARGET tst_qcoreapplication PROPERTY QT_ANDROID_VERSION_NAME ${target_version})
+endif()
+
+
#### Keys ignored in scope 1:.:.:qcoreapplication.pro:<TRUE>:
# QMAKE_INFO_PLIST = "$$PWD/Info.plist"
# _REQUIREMENTS = "qtConfig(private_tests)"
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index fcfd3030d5..8ddca93cb7 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -1,37 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tst_qcoreapplication.h"
#include <QtCore/QtCore>
#include <QTest>
+#include <private/qabstracteventdispatcher_p.h> // for qGlobalPostedEventsCount()
#include <private/qcoreapplication_p.h>
#include <private/qeventloop_p.h>
#include <private/qthread_p.h>
@@ -123,7 +99,7 @@ void tst_QCoreApplication::getSetCheck()
void tst_QCoreApplication::qAppName()
{
-#ifdef QT_GUI_LIB
+#ifdef QT_QGUIAPPLICATIONTEST
const char* appName = "tst_qguiapplication";
#else
const char* appName = "tst_qcoreapplication";
@@ -538,16 +514,13 @@ void tst_QCoreApplication::applicationPid()
QVERIFY(QCoreApplication::applicationPid() > 0);
}
-QT_BEGIN_NAMESPACE
-Q_CORE_EXPORT uint qGlobalPostedEventsCount();
-QT_END_NAMESPACE
-
+#ifdef QT_BUILD_INTERNAL
class GlobalPostedEventsCountObject : public QObject
{
Q_OBJECT
public:
- QList<int> globalPostedEventsCount;
+ QList<qsizetype> globalPostedEventsCount;
bool event(QEvent *event) override
{
@@ -564,7 +537,7 @@ void tst_QCoreApplication::globalPostedEventsCount()
TestApplication app(argc, argv);
QCoreApplication::sendPostedEvents();
- QCOMPARE(qGlobalPostedEventsCount(), 0u);
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(0));
GlobalPostedEventsCountObject x;
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
@@ -572,19 +545,15 @@ void tst_QCoreApplication::globalPostedEventsCount()
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
QCoreApplication::postEvent(&x, new QEvent(QEvent::User));
- QCOMPARE(qGlobalPostedEventsCount(), 5u);
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(5));
QCoreApplication::sendPostedEvents();
- QCOMPARE(qGlobalPostedEventsCount(), 0u);
-
- QList<int> expected = QList<int>()
- << 4
- << 3
- << 2
- << 1
- << 0;
+ QCOMPARE(qGlobalPostedEventsCount(), qsizetype(0));
+
+ const QList<qsizetype> expected = {4, 3, 2, 1, 0};
QCOMPARE(x.globalPostedEventsCount, expected);
}
+#endif // QT_BUILD_INTERNAL
class ProcessEventsAlwaysSendsPostedEventsObject : public QObject
{
@@ -1078,7 +1047,7 @@ static void createQObjectOnDestruction()
}
Q_DESTRUCTOR_FUNCTION(createQObjectOnDestruction)
-#ifndef QT_GUI_LIB
+#ifndef QT_QGUIAPPLICATIONTEST
QTEST_APPLESS_MAIN(tst_QCoreApplication)
#endif
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
index 655a879afa..0894b64f33 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TST_QCOREAPPLICATION_H
#define TST_QCOREAPPLICATION_H
@@ -47,7 +22,9 @@ private slots:
void deliverInDefinedOrder();
#endif
void applicationPid();
+#ifdef QT_BUILD_INTERNAL
void globalPostedEventsCount();
+#endif
void processEventsAlwaysSendsPostedEvents();
#ifdef Q_OS_WIN
void sendPostedEventsInNativeLoop();
diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp
index 540856ad6e..b8ed0031cd 100644
--- a/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp
+++ b/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QString>
#include <QtCore/QTime>
diff --git a/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp
index e27ccc336a..652a62f640 100644
--- a/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/corelib/kernel/qelapsedtimer/tst_qelapsedtimer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QString>
#include <QtCore/QTime>
diff --git a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
index 2fff160ceb..df5f5fef1d 100644
--- a/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
+++ b/tests/auto/corelib/kernel/qeventdispatcher/tst_qeventdispatcher.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifdef QT_GUI_LIB
# include <QtGui/QGuiApplication>
@@ -443,24 +418,17 @@ void tst_QEventDispatcher::postEventFromEventHandler()
QAbstractEventDispatcher::instance()->processEvents(QEventLoop::WaitForMoreEvents);
done = true;
- bool coreFails = false;
- bool guiFails = false;
const QByteArrayView eventDispatcherName(QAbstractEventDispatcher::instance()->metaObject()->className());
-#if defined(Q_OS_DARWIN)
- coreFails = true;
-#elif defined(Q_OS_WINDOWS)
- coreFails = true;
- guiFails = true;
-#elif defined(Q_OS_LINUX)
- // QXcbUnixEventDispatcher and QEventDispatcherUNIX do not do this correctly
- // QXcbGlibEventDispatcher and QEventDispatcherGlib do
- coreFails = !eventDispatcherName.contains("Glib");
- guiFails = !eventDispatcherName.contains("Glib");
-#endif
-
- if (coreFails && !isGuiEventDispatcher)
- QEXPECT_FAIL("", eventDispatcherName.constData(), Continue);
- if (guiFails && isGuiEventDispatcher)
+ qDebug() << eventDispatcherName;
+ // QXcbUnixEventDispatcher and QEventDispatcherUNIX do not do this correctly on any platform;
+ // both Windows event dispatchers fail as well.
+ const bool knownToFail = eventDispatcherName.contains("UNIX")
+ || eventDispatcherName.contains("Unix")
+ || eventDispatcherName.contains("Win32")
+ || eventDispatcherName.contains("WindowsGui")
+ || eventDispatcherName.contains("Android");
+
+ if (knownToFail)
QEXPECT_FAIL("", eventDispatcherName.constData(), Continue);
QVERIFY(!hadToQuit);
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 3169cc933b..74b08601b7 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qjnienvironment/testdata/src/org/qtproject/qt/android/testdata/QtJniEnvironmentTestClass.java b/tests/auto/corelib/kernel/qjnienvironment/testdata/src/org/qtproject/qt/android/testdata/QtJniEnvironmentTestClass.java
index 411bd1501d..0fc70f2567 100644
--- a/tests/auto/corelib/kernel/qjnienvironment/testdata/src/org/qtproject/qt/android/testdata/QtJniEnvironmentTestClass.java
+++ b/tests/auto/corelib/kernel/qjnienvironment/testdata/src/org/qtproject/qt/android/testdata/QtJniEnvironmentTestClass.java
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
package org.qtproject.qt.android.testdatapackage;
diff --git a/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp b/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp
index 8cf207fc3a..76cad4ddc0 100644
--- a/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp
+++ b/tests/auto/corelib/kernel/qjnienvironment/tst_qjnienvironment.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <jni.h>
@@ -90,6 +65,7 @@ void tst_QJniEnvironment::jniEnv()
// try to find an existing class with QJniEnvironment
QJniEnvironment env;
QVERIFY(env.findClass("java/lang/Object"));
+ QVERIFY(env.findClass<jstring>());
// try to find a nonexistent class
QVERIFY(!env.findClass("this/doesnt/Exist"));
@@ -123,12 +99,14 @@ static void callbackFromJava(JNIEnv *env, jobject /*thiz*/, jstring value)
Q_UNUSED(env)
registerNativesString = QJniObject(value).toString();
}
+Q_DECLARE_JNI_NATIVE_METHOD(callbackFromJava);
static void callbackFromJavaNoCtor(JNIEnv *env, jobject /*thiz*/, jstring value)
{
Q_UNUSED(env)
registerNativesString = QJniObject(value).toString();
}
+Q_DECLARE_JNI_NATIVE_METHOD(callbackFromJavaNoCtor);
void tst_QJniEnvironment::registerNativeMethods()
{
@@ -136,11 +114,9 @@ void tst_QJniEnvironment::registerNativeMethods()
QJniEnvironment env;
{
- const JNINativeMethod methods[] {
- {"callbackFromJava", "(Ljava/lang/String;)V", reinterpret_cast<void *>(callbackFromJava)}
- };
-
- QVERIFY(env.registerNativeMethods(javaTestClass, methods, 1));
+ QVERIFY(env.registerNativeMethods(javaTestClass, {
+ Q_JNI_NATIVE_METHOD(callbackFromJava)
+ }));
QJniObject::callStaticMethod<void>(javaTestClass,
"appendJavaToString",
@@ -152,10 +128,9 @@ void tst_QJniEnvironment::registerNativeMethods()
// No default constructor in class
{
- const JNINativeMethod methods[] {{"callbackFromJavaNoCtor", "(Ljava/lang/String;)V",
- reinterpret_cast<void *>(callbackFromJavaNoCtor)}};
-
- QVERIFY(env.registerNativeMethods(javaTestClassNoCtor, methods, 1));
+ QVERIFY(env.registerNativeMethods(javaTestClassNoCtor, {
+ Q_JNI_NATIVE_METHOD(callbackFromJavaNoCtor)
+ }));
QJniObject::callStaticMethod<void>(javaTestClassNoCtor,
"appendJavaToString",
@@ -171,17 +146,16 @@ static void intCallbackFromJava(JNIEnv *env, jobject /*thiz*/, jint value)
Q_UNUSED(env)
registerNativeInteger = static_cast<int>(value);
}
+Q_DECLARE_JNI_NATIVE_METHOD(intCallbackFromJava);
void tst_QJniEnvironment::registerNativeMethodsByJclass()
{
- const JNINativeMethod methods[] {
- { "intCallbackFromJava", "(I)V", reinterpret_cast<void *>(intCallbackFromJava) }
- };
-
QJniEnvironment env;
jclass clazz = env.findClass(javaTestClass);
QVERIFY(clazz != 0);
- QVERIFY(env.registerNativeMethods(clazz, methods, 1));
+ QVERIFY(env.registerNativeMethods(clazz, {
+ Q_JNI_NATIVE_METHOD(intCallbackFromJava)
+ }));
QCOMPARE(registerNativeInteger, 0);
@@ -202,6 +176,10 @@ void tst_QJniEnvironment::findMethod()
jmethodID methodId = env.findMethod(clazz, "toString", "()Ljava/lang/String;");
QVERIFY(methodId != nullptr);
+ // existing method
+ methodId = env.findMethod<jstring>(clazz, "toString");
+ QVERIFY(methodId != nullptr);
+
// invalid signature
jmethodID invalid = env.findMethod(clazz, "unknown", "()I");
QVERIFY(invalid == nullptr);
@@ -219,6 +197,10 @@ void tst_QJniEnvironment::findStaticMethod()
jmethodID staticMethodId = env.findStaticMethod(clazz, "parseInt", "(Ljava/lang/String;)I");
QVERIFY(staticMethodId != nullptr);
+ // existing method
+ staticMethodId = env.findStaticMethod<jint, jstring>(clazz, "parseInt");
+ QVERIFY(staticMethodId != nullptr);
+
QJniObject parameter = QJniObject::fromString("123");
jint result = QJniObject::callStaticMethod<jint>(clazz, staticMethodId,
parameter.object<jstring>());
@@ -227,6 +209,8 @@ void tst_QJniEnvironment::findStaticMethod()
// invalid method
jmethodID invalid = env.findStaticMethod(clazz, "unknown", "()I");
QVERIFY(invalid == nullptr);
+ invalid = env.findStaticMethod<jint>(clazz, "unknown");
+ QVERIFY(invalid == nullptr);
// check that all exceptions are already cleared
QVERIFY(!env.checkAndClearExceptions());
}
@@ -240,6 +224,8 @@ void tst_QJniEnvironment::findField()
// valid field
jfieldID validId = env.findField(clazz, "INT_FIELD", "I");
QVERIFY(validId != nullptr);
+ validId = env.findField<jint>(clazz, "INT_FIELD");
+ QVERIFY(validId != nullptr);
jmethodID constructorId = env.findMethod(clazz, "<init>", "()V");
QVERIFY(constructorId != nullptr);
@@ -265,6 +251,8 @@ void tst_QJniEnvironment::findStaticField()
// valid field
jfieldID validId = env.findStaticField(clazz, "S_INT_FIELD", "I");
QVERIFY(validId != nullptr);
+ validId = env.findStaticField<jint>(clazz, "S_INT_FIELD");
+ QVERIFY(validId != nullptr);
int size = env->GetStaticIntField(clazz, validId);
QVERIFY(!env.checkAndClearExceptions());
diff --git a/tests/auto/corelib/kernel/qjniobject/testdata/src/org/qtproject/qt/android/testdata/QtJniObjectTestClass.java b/tests/auto/corelib/kernel/qjniobject/testdata/src/org/qtproject/qt/android/testdata/QtJniObjectTestClass.java
index 5865391ac9..dc55ad0f89 100644
--- a/tests/auto/corelib/kernel/qjniobject/testdata/src/org/qtproject/qt/android/testdata/QtJniObjectTestClass.java
+++ b/tests/auto/corelib/kernel/qjniobject/testdata/src/org/qtproject/qt/android/testdata/QtJniObjectTestClass.java
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
package org.qtproject.qt.android.testdatapackage;
diff --git a/tests/auto/corelib/kernel/qjniobject/tst_qjniobject.cpp b/tests/auto/corelib/kernel/qjniobject/tst_qjniobject.cpp
index 4c0d9e1e6e..e57785c5c5 100644
--- a/tests/auto/corelib/kernel/qjniobject/tst_qjniobject.cpp
+++ b/tests/auto/corelib/kernel/qjniobject/tst_qjniobject.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <jni.h>
@@ -160,6 +135,11 @@ void tst_QJniObject::ctor()
}
{
+ QJniObject object = QJniObject::construct<jstring>();
+ QVERIFY(object.isValid());
+ }
+
+ {
QJniObject string = QJniObject::fromString(QLatin1String("Hello, Java"));
QJniObject object("java/lang/String", "(Ljava/lang/String;)V", string.object<jstring>());
QVERIFY(object.isValid());
@@ -167,6 +147,13 @@ void tst_QJniObject::ctor()
}
{
+ QJniObject string = QJniObject::fromString(QLatin1String("Hello, Java"));
+ QJniObject object = QJniObject::construct<jstring>(string.object<jstring>());
+ QVERIFY(object.isValid());
+ QCOMPARE(string.toString(), object.toString());
+ }
+
+ {
QJniEnvironment env;
jclass javaStringClass = env->FindClass("java/lang/String");
QJniObject string(javaStringClass);
@@ -182,6 +169,16 @@ void tst_QJniObject::ctor()
QVERIFY(stringCpy.isValid());
QCOMPARE(qString, stringCpy.toString());
}
+
+ {
+ QJniEnvironment env;
+ const QString qString = QLatin1String("Hello, Java");
+ jclass javaStringClass = env->FindClass("java/lang/String");
+ QJniObject string = QJniObject::fromString(qString);
+ QJniObject stringCpy(javaStringClass, string.object<jstring>());
+ QVERIFY(stringCpy.isValid());
+ QCOMPARE(qString, stringCpy.toString());
+ }
}
void tst_QJniObject::callMethodTest()
@@ -194,9 +191,12 @@ void tst_QJniObject::callMethodTest()
const jboolean isEmpty = jString1.callMethod<jboolean>("isEmpty");
QVERIFY(!isEmpty);
- const jint ret = jString1.callMethod<jint>("compareToIgnoreCase",
- "(Ljava/lang/String;)I",
- jString2.object<jstring>());
+ jint ret = jString1.callMethod<jint>("compareToIgnoreCase",
+ "(Ljava/lang/String;)I",
+ jString2.object<jstring>());
+ QVERIFY(0 == ret);
+
+ ret = jString1.callMethod<jint>("compareToIgnoreCase", jString2.object<jstring>());
QVERIFY(0 == ret);
}
@@ -206,6 +206,17 @@ void tst_QJniObject::callMethodTest()
jlong ret = longObject.callMethod<jlong>("longValue");
QCOMPARE(ret, jLong);
}
+
+ // as of Qt 6.4, callMethod works with an object type as well!
+ {
+ const QString qString = QLatin1String("Hello, Java");
+ QJniObject jString = QJniObject::fromString(qString);
+ const QString qStringRet = jString.callMethod<jstring>("toUpperCase").toString();
+ QCOMPARE(qString.toUpper(), qStringRet);
+
+ QJniObject subString = jString.callMethod<jstring>("substring", 0, 4);
+ QCOMPARE(subString.toString(), qString.mid(0, 4));
+ }
}
void tst_QJniObject::callObjectMethodTest()
@@ -219,6 +230,10 @@ void tst_QJniObject::callObjectMethodTest()
"(II)Ljava/lang/String;",
0, 4);
QCOMPARE(subString.toString(), qString.mid(0, 4));
+
+ subString = jString.callObjectMethod<jstring>("substring", 0, 4);
+ QCOMPARE(subString.toString(), qString.mid(0, 4));
+
}
void tst_QJniObject::stringConvertionTest()
@@ -276,6 +291,16 @@ void tst_QJniObject::callStaticObjectMethodClassName()
QString returnedString = returnValue.toString();
QCOMPARE(returnedString, QString::fromLatin1("test format"));
+
+ returnValue = QJniObject::callStaticObjectMethod<jstring>("java/lang/String",
+ "format",
+ formatString.object<jstring>(),
+ jobjectArray(0));
+ QVERIFY(returnValue.isValid());
+
+ returnedString = returnValue.toString();
+
+ QCOMPARE(returnedString, QString::fromLatin1("test format"));
}
void tst_QJniObject::callStaticObjectMethod()
@@ -297,6 +322,27 @@ void tst_QJniObject::callStaticObjectMethod()
QString returnedString = returnValue.toString();
QCOMPARE(returnedString, QString::fromLatin1("test format"));
+
+ returnValue = QJniObject::callStaticObjectMethod<jstring>(cls,
+ "format",
+ formatString.object<jstring>(),
+ jobjectArray(0));
+ QVERIFY(returnValue.isValid());
+
+ returnedString = returnValue.toString();
+
+ QCOMPARE(returnedString, QString::fromLatin1("test format"));
+
+ // from 6.4 on we can use callStaticMethod
+ returnValue = QJniObject::callStaticMethod<jstring>(cls,
+ "format",
+ formatString.object<jstring>(),
+ jobjectArray(0));
+ QVERIFY(returnValue.isValid());
+
+ returnedString = returnValue.toString();
+
+ QCOMPARE(returnedString, QString::fromLatin1("test format"));
}
void tst_QJniObject::callStaticObjectMethodById()
@@ -319,6 +365,15 @@ void tst_QJniObject::callStaticObjectMethodById()
QString returnedString = returnValue.toString();
QCOMPARE(returnedString, QString::fromLatin1("test format"));
+
+ // from Qt 6.4 on we can use callStaticMethod as well
+ returnValue = QJniObject::callStaticMethod<jstring>(
+ cls, id, formatString.object<jstring>(), jobjectArray(0));
+ QVERIFY(returnValue.isValid());
+
+ returnedString = returnValue.toString();
+
+ QCOMPARE(returnedString, QString::fromLatin1("test format"));
}
void tst_QJniObject::callStaticBooleanMethod()
@@ -336,6 +391,9 @@ void tst_QJniObject::callStaticBooleanMethod()
"(Ljava/lang/String;)Z",
parameter.object<jstring>());
QVERIFY(b);
+
+ b = QJniObject::callStaticMethod<jboolean>(cls, "parseBoolean", parameter.object<jstring>());
+ QVERIFY(b);
}
{
@@ -347,6 +405,9 @@ void tst_QJniObject::callStaticBooleanMethod()
"(Ljava/lang/String;)Z",
parameter.object<jstring>());
QVERIFY(!b);
+
+ b = QJniObject::callStaticMethod<jboolean>(cls, "parseBoolean", parameter.object<jstring>());
+ QVERIFY(!b);
}
}
@@ -387,6 +448,10 @@ void tst_QJniObject::callStaticBooleanMethodClassName()
"(Ljava/lang/String;)Z",
parameter.object<jstring>());
QVERIFY(b);
+ b = QJniObject::callStaticMethod<jboolean>("java/lang/Boolean",
+ "parseBoolean",
+ parameter.object<jstring>());
+ QVERIFY(b);
}
{
@@ -398,6 +463,10 @@ void tst_QJniObject::callStaticBooleanMethodClassName()
"(Ljava/lang/String;)Z",
parameter.object<jstring>());
QVERIFY(!b);
+ b = QJniObject::callStaticMethod<jboolean>("java/lang/Boolean",
+ "parseBoolean",
+ parameter.object<jstring>());
+ QVERIFY(!b);
}
}
@@ -408,7 +477,6 @@ void tst_QJniObject::callStaticByteMethodClassName()
jbyte returnValue = QJniObject::callStaticMethod<jbyte>("java/lang/Byte",
"parseByte",
- "(Ljava/lang/String;)B",
parameter.object<jstring>());
QCOMPARE(returnValue, jbyte(number.toInt()));
}
@@ -424,7 +492,6 @@ void tst_QJniObject::callStaticByteMethod()
jbyte returnValue = QJniObject::callStaticMethod<jbyte>(cls,
"parseByte",
- "(Ljava/lang/String;)B",
parameter.object<jstring>());
QCOMPARE(returnValue, jbyte(number.toInt()));
}
@@ -452,7 +519,6 @@ void tst_QJniObject::callStaticIntMethodClassName()
jint returnValue = QJniObject::callStaticMethod<jint>("java/lang/Integer",
"parseInt",
- "(Ljava/lang/String;)I",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toInt());
}
@@ -469,7 +535,6 @@ void tst_QJniObject::callStaticIntMethod()
jint returnValue = QJniObject::callStaticMethod<jint>(cls,
"parseInt",
- "(Ljava/lang/String;)I",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toInt());
}
@@ -494,7 +559,6 @@ void tst_QJniObject::callStaticCharMethodClassName()
{
jchar returnValue = QJniObject::callStaticMethod<jchar>("java/lang/Character",
"toUpperCase",
- "(C)C",
jchar('a'));
QCOMPARE(returnValue, jchar('A'));
}
@@ -508,7 +572,6 @@ void tst_QJniObject::callStaticCharMethod()
jchar returnValue = QJniObject::callStaticMethod<jchar>(cls,
"toUpperCase",
- "(C)C",
jchar('a'));
QCOMPARE(returnValue, jchar('A'));
}
@@ -533,7 +596,6 @@ void tst_QJniObject::callStaticDoubleMethodClassName ()
jdouble returnValue = QJniObject::callStaticMethod<jdouble>("java/lang/Double",
"parseDouble",
- "(Ljava/lang/String;)D",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toDouble());
}
@@ -550,7 +612,6 @@ void tst_QJniObject::callStaticDoubleMethod()
jdouble returnValue = QJniObject::callStaticMethod<jdouble>(cls,
"parseDouble",
- "(Ljava/lang/String;)D",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toDouble());
}
@@ -579,7 +640,6 @@ void tst_QJniObject::callStaticFloatMethodClassName()
jfloat returnValue = QJniObject::callStaticMethod<jfloat>("java/lang/Float",
"parseFloat",
- "(Ljava/lang/String;)F",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toFloat());
}
@@ -596,7 +656,6 @@ void tst_QJniObject::callStaticFloatMethod()
jfloat returnValue = QJniObject::callStaticMethod<jfloat>(cls,
"parseFloat",
- "(Ljava/lang/String;)F",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toFloat());
}
@@ -624,7 +683,6 @@ void tst_QJniObject::callStaticShortMethodClassName()
jshort returnValue = QJniObject::callStaticMethod<jshort>("java/lang/Short",
"parseShort",
- "(Ljava/lang/String;)S",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toShort());
}
@@ -641,7 +699,6 @@ void tst_QJniObject::callStaticShortMethod()
jshort returnValue = QJniObject::callStaticMethod<jshort>(cls,
"parseShort",
- "(Ljava/lang/String;)S",
parameter.object<jstring>());
QCOMPARE(returnValue, number.toShort());
}
@@ -669,7 +726,6 @@ void tst_QJniObject::callStaticLongMethodClassName()
jlong returnValue = QJniObject::callStaticMethod<jlong>("java/lang/Long",
"parseLong",
- "(Ljava/lang/String;)J",
parameter.object<jstring>());
QCOMPARE(returnValue, jlong(number.toLong()));
}
@@ -685,7 +741,6 @@ void tst_QJniObject::callStaticLongMethod()
jlong returnValue = QJniObject::callStaticMethod<jlong>(cls,
"parseLong",
- "(Ljava/lang/String;)J",
parameter.object<jstring>());
QCOMPARE(returnValue, jlong(number.toLong()));
}
@@ -1044,9 +1099,15 @@ void tst_QJniObject::templateApiCheck()
1,
true,
'c');
+ QJniObject::callStaticMethod<void>(testClassName,
+ "staticVoidMethodWithArgs",
+ 1,
+ true,
+ 'c');
testClass.callMethod<void>("voidMethod");
testClass.callMethod<void>("voidMethodWithArgs", "(IZC)V", 1, true, 'c');
+ testClass.callMethod<void>("voidMethodWithArgs", 1, true, 'c');
// jboolean -----------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jboolean>(testClassName, "staticBooleanMethod"));
@@ -1056,6 +1117,11 @@ void tst_QJniObject::templateApiCheck()
true,
true,
true));
+ QVERIFY(QJniObject::callStaticMethod<jboolean>(testClassName,
+ "staticBooleanMethodWithArgs",
+ true,
+ true,
+ true));
QVERIFY(testClass.callMethod<jboolean>("booleanMethod"));
QVERIFY(testClass.callMethod<jboolean>("booleanMethodWithArgs",
@@ -1063,6 +1129,10 @@ void tst_QJniObject::templateApiCheck()
true,
true,
true));
+ QVERIFY(testClass.callMethod<jboolean>("booleanMethodWithArgs",
+ true,
+ true,
+ true));
// jbyte --------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jbyte>(testClassName,
@@ -1073,9 +1143,15 @@ void tst_QJniObject::templateApiCheck()
1,
1,
1) == A_BYTE_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jbyte>(testClassName,
+ "staticByteMethodWithArgs",
+ jbyte(1),
+ jbyte(1),
+ jbyte(1)) == A_BYTE_VALUE);
QVERIFY(testClass.callMethod<jbyte>("byteMethod") == A_BYTE_VALUE);
QVERIFY(testClass.callMethod<jbyte>("byteMethodWithArgs", "(BBB)B", 1, 1, 1) == A_BYTE_VALUE);
+ QVERIFY(testClass.callMethod<jbyte>("byteMethodWithArgs", jbyte(1), jbyte(1), jbyte(1)) == A_BYTE_VALUE);
// jchar --------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jchar>(testClassName,
@@ -1086,6 +1162,11 @@ void tst_QJniObject::templateApiCheck()
jchar(1),
jchar(1),
jchar(1)) == A_CHAR_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jchar>(testClassName,
+ "staticCharMethodWithArgs",
+ jchar(1),
+ jchar(1),
+ jchar(1)) == A_CHAR_VALUE);
QVERIFY(testClass.callMethod<jchar>("charMethod") == A_CHAR_VALUE);
QVERIFY(testClass.callMethod<jchar>("charMethodWithArgs",
@@ -1093,6 +1174,10 @@ void tst_QJniObject::templateApiCheck()
jchar(1),
jchar(1),
jchar(1)) == A_CHAR_VALUE);
+ QVERIFY(testClass.callMethod<jchar>("charMethodWithArgs",
+ jchar(1),
+ jchar(1),
+ jchar(1)) == A_CHAR_VALUE);
// jshort -------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jshort>(testClassName,
@@ -1103,6 +1188,11 @@ void tst_QJniObject::templateApiCheck()
jshort(1),
jshort(1),
jshort(1)) == A_SHORT_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jshort>(testClassName,
+ "staticShortMethodWithArgs",
+ jshort(1),
+ jshort(1),
+ jshort(1)) == A_SHORT_VALUE);
QVERIFY(testClass.callMethod<jshort>("shortMethod") == A_SHORT_VALUE);
QVERIFY(testClass.callMethod<jshort>("shortMethodWithArgs",
@@ -1110,6 +1200,10 @@ void tst_QJniObject::templateApiCheck()
jshort(1),
jshort(1),
jshort(1)) == A_SHORT_VALUE);
+ QVERIFY(testClass.callMethod<jshort>("shortMethodWithArgs",
+ jshort(1),
+ jshort(1),
+ jshort(1)) == A_SHORT_VALUE);
// jint ---------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jint>(testClassName,
@@ -1120,6 +1214,11 @@ void tst_QJniObject::templateApiCheck()
jint(1),
jint(1),
jint(1)) == A_INT_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jint>(testClassName,
+ "staticIntMethodWithArgs",
+ jint(1),
+ jint(1),
+ jint(1)) == A_INT_VALUE);
QVERIFY(testClass.callMethod<jint>("intMethod") == A_INT_VALUE);
QVERIFY(testClass.callMethod<jint>("intMethodWithArgs",
@@ -1127,6 +1226,10 @@ void tst_QJniObject::templateApiCheck()
jint(1),
jint(1),
jint(1)) == A_INT_VALUE);
+ QVERIFY(testClass.callMethod<jint>("intMethodWithArgs",
+ jint(1),
+ jint(1),
+ jint(1)) == A_INT_VALUE);
// jlong --------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jlong>(testClassName,
@@ -1137,6 +1240,11 @@ void tst_QJniObject::templateApiCheck()
jlong(1),
jlong(1),
jlong(1)) == A_LONG_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jlong>(testClassName,
+ "staticLongMethodWithArgs",
+ jlong(1),
+ jlong(1),
+ jlong(1)) == A_LONG_VALUE);
QVERIFY(testClass.callMethod<jlong>("longMethod") == A_LONG_VALUE);
QVERIFY(testClass.callMethod<jlong>("longMethodWithArgs",
@@ -1144,6 +1252,10 @@ void tst_QJniObject::templateApiCheck()
jlong(1),
jlong(1),
jlong(1)) == A_LONG_VALUE);
+ QVERIFY(testClass.callMethod<jlong>("longMethodWithArgs",
+ jlong(1),
+ jlong(1),
+ jlong(1)) == A_LONG_VALUE);
// jfloat -------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jfloat>(testClassName,
@@ -1154,6 +1266,11 @@ void tst_QJniObject::templateApiCheck()
jfloat(1.1),
jfloat(1.1),
jfloat(1.1)) == A_FLOAT_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jfloat>(testClassName,
+ "staticFloatMethodWithArgs",
+ jfloat(1.1),
+ jfloat(1.1),
+ jfloat(1.1)) == A_FLOAT_VALUE);
QVERIFY(testClass.callMethod<jfloat>("floatMethod") == A_FLOAT_VALUE);
QVERIFY(testClass.callMethod<jfloat>("floatMethodWithArgs",
@@ -1161,6 +1278,10 @@ void tst_QJniObject::templateApiCheck()
jfloat(1.1),
jfloat(1.1),
jfloat(1.1)) == A_FLOAT_VALUE);
+ QVERIFY(testClass.callMethod<jfloat>("floatMethodWithArgs",
+ jfloat(1.1),
+ jfloat(1.1),
+ jfloat(1.1)) == A_FLOAT_VALUE);
// jdouble ------------------------------------------------------------------------------------
QVERIFY(QJniObject::callStaticMethod<jdouble>(testClassName,
@@ -1171,6 +1292,11 @@ void tst_QJniObject::templateApiCheck()
jdouble(1.1),
jdouble(1.1),
jdouble(1.1)) == A_DOUBLE_VALUE);
+ QVERIFY(QJniObject::callStaticMethod<jdouble>(testClassName,
+ "staticDoubleMethodWithArgs",
+ jdouble(1.1),
+ jdouble(1.1),
+ jdouble(1.1)) == A_DOUBLE_VALUE);
QVERIFY(testClass.callMethod<jdouble>("doubleMethod") == A_DOUBLE_VALUE);
QVERIFY(testClass.callMethod<jdouble>("doubleMethodWithArgs",
@@ -1178,6 +1304,10 @@ void tst_QJniObject::templateApiCheck()
jdouble(1.1),
jdouble(1.1),
jdouble(1.1)) == A_DOUBLE_VALUE);
+ QVERIFY(testClass.callMethod<jdouble>("doubleMethodWithArgs",
+ jdouble(1.1),
+ jdouble(1.1),
+ jdouble(1.1)) == A_DOUBLE_VALUE);
// jobject ------------------------------------------------------------------------------------
{
diff --git a/tests/auto/corelib/kernel/qjnitypes/CMakeLists.txt b/tests/auto/corelib/kernel/qjnitypes/CMakeLists.txt
new file mode 100644
index 0000000000..8184e91a11
--- /dev/null
+++ b/tests/auto/corelib/kernel/qjnitypes/CMakeLists.txt
@@ -0,0 +1,4 @@
+qt_internal_add_test(tst_qjnitypes
+ SOURCES
+ tst_qjnitypes.cpp
+)
diff --git a/tests/auto/corelib/kernel/qjnitypes/tst_qjnitypes.cpp b/tests/auto/corelib/kernel/qjnitypes/tst_qjnitypes.cpp
new file mode 100644
index 0000000000..395028b8cb
--- /dev/null
+++ b/tests/auto/corelib/kernel/qjnitypes/tst_qjnitypes.cpp
@@ -0,0 +1,124 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include <QtTest>
+
+#include <QtCore/qjnitypes.h>
+
+class tst_QJniTypes : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QJniTypes() = default;
+
+private slots:
+ void initTestCase();
+ void nativeMethod();
+};
+
+struct QtJavaWrapper {};
+template<>
+constexpr auto QtJniTypes::typeSignature<QtJavaWrapper>()
+{
+ return QtJniTypes::String("Lorg/qtproject/qt/android/QtJavaWrapper;");
+}
+
+template<>
+constexpr auto QtJniTypes::typeSignature<QJniObject>()
+{
+ return QtJniTypes::String("Ljava/lang/Object;");
+}
+
+struct QtCustomJniObject : QJniObject {};
+template<>
+constexpr auto QtJniTypes::typeSignature<QtCustomJniObject>()
+{
+ return QtJniTypes::String("Lorg/qtproject/qt/android/QtCustomJniObject;");
+}
+
+static_assert(QtJniTypes::typeSignature<QtJavaWrapper>() == "Lorg/qtproject/qt/android/QtJavaWrapper;");
+static_assert(QtJniTypes::typeSignature<QtJavaWrapper>() != "Ljava/lang/Object;");
+static_assert(!(QtJniTypes::typeSignature<QtJavaWrapper>() == "X"));
+
+Q_DECLARE_JNI_TYPE(JavaType, "Lorg/qtproject/qt/JavaType;");
+static_assert(QtJniTypes::typeSignature<QtJniTypes::JavaType>() == "Lorg/qtproject/qt/JavaType;");
+Q_DECLARE_JNI_TYPE(ArrayType, "[Lorg/qtproject/qt/ArrayType;")
+static_assert(QtJniTypes::typeSignature<QtJniTypes::ArrayType>() == "[Lorg/qtproject/qt/ArrayType;");
+
+static_assert(QtJniTypes::className<jstring>() == "java/lang/String");
+
+Q_DECLARE_JNI_CLASS(QtTextToSpeech, "org/qtproject/qt/android/speech/QtTextToSpeech")
+static_assert(QtJniTypes::className<QtJniTypes::QtTextToSpeech>() == "org/qtproject/qt/android/speech/QtTextToSpeech");
+
+static_assert(QtJniTypes::fieldSignature<jint>() == "I");
+static_assert(QtJniTypes::fieldSignature<jint>() != "X");
+static_assert(QtJniTypes::fieldSignature<jint>() != "Ljava/lang/Object;");
+static_assert(QtJniTypes::fieldSignature<jlong>() == "J");
+static_assert(QtJniTypes::fieldSignature<jstring>() == "Ljava/lang/String;");
+static_assert(QtJniTypes::fieldSignature<jobject>() == "Ljava/lang/Object;");
+static_assert(QtJniTypes::fieldSignature<jobjectArray>() == "[Ljava/lang/Object;");
+static_assert(QtJniTypes::fieldSignature<QJniObject>() == "Ljava/lang/Object;");
+static_assert(QtJniTypes::fieldSignature<QtJavaWrapper>() == "Lorg/qtproject/qt/android/QtJavaWrapper;");
+static_assert(QtJniTypes::fieldSignature<QtCustomJniObject>() == "Lorg/qtproject/qt/android/QtCustomJniObject;");
+
+static_assert(QtJniTypes::methodSignature<void>() == "()V");
+static_assert(QtJniTypes::methodSignature<void>() != "()X");
+static_assert(QtJniTypes::methodSignature<void, jint>() == "(I)V");
+static_assert(QtJniTypes::methodSignature<void, jint, jstring>() == "(ILjava/lang/String;)V");
+static_assert(QtJniTypes::methodSignature<jlong, jint, jclass>() == "(ILjava/lang/Class;)J");
+static_assert(QtJniTypes::methodSignature<jobject, jint, jstring>() == "(ILjava/lang/String;)Ljava/lang/Object;");
+static_assert(QtJniTypes::methodSignature<QtJniTypes::JavaType, jint, jstring>()
+ == "(ILjava/lang/String;)Lorg/qtproject/qt/JavaType;");
+
+static_assert(QtJniTypes::isPrimitiveType<jint>());
+static_assert(QtJniTypes::isPrimitiveType<void>());
+static_assert(!QtJniTypes::isPrimitiveType<jobject>());
+static_assert(!QtJniTypes::isPrimitiveType<QtCustomJniObject>());
+
+static_assert(!QtJniTypes::isObjectType<jint>());
+static_assert(!QtJniTypes::isObjectType<void>());
+static_assert(QtJniTypes::isObjectType<jobject>());
+static_assert(QtJniTypes::isObjectType<jobjectArray>());
+static_assert(QtJniTypes::isObjectType<QtCustomJniObject>());
+
+static_assert(QtJniTypes::String("ABCDE").startsWith("ABC"));
+static_assert(QtJniTypes::String("ABCDE").startsWith("A"));
+static_assert(QtJniTypes::String("ABCDE").startsWith("ABCDE"));
+static_assert(!QtJniTypes::String("ABCDE").startsWith("ABCDEF"));
+static_assert(!QtJniTypes::String("ABCDE").startsWith("9AB"));
+static_assert(QtJniTypes::String("ABCDE").startsWith('A'));
+static_assert(!QtJniTypes::String("ABCDE").startsWith('B'));
+
+static_assert(QtJniTypes::String("ABCDE").endsWith("CDE"));
+static_assert(QtJniTypes::String("ABCDE").endsWith("E"));
+static_assert(QtJniTypes::String("ABCDE").endsWith("ABCDE"));
+static_assert(!QtJniTypes::String("ABCDE").endsWith("DEF"));
+static_assert(!QtJniTypes::String("ABCDE").endsWith("ABCDEF"));
+static_assert(QtJniTypes::String("ABCDE").endsWith('E'));
+static_assert(!QtJniTypes::String("ABCDE").endsWith('F'));
+
+void tst_QJniTypes::initTestCase()
+{
+
+}
+
+static bool nativeFunction(JNIEnv *, jclass, int, jstring, long)
+{
+ return true;
+}
+Q_DECLARE_JNI_NATIVE_METHOD(nativeFunction)
+
+static_assert(QtJniTypes::nativeMethodSignature(nativeFunction) == "(ILjava/lang/String;J)Z");
+
+void tst_QJniTypes::nativeMethod()
+{
+ const auto method = Q_JNI_NATIVE_METHOD(nativeFunction);
+ QVERIFY(method.fnPtr == nativeFunction);
+ QCOMPARE(method.name, "nativeFunction");
+ QCOMPARE(method.signature, "(ILjava/lang/String;J)Z");
+}
+
+QTEST_MAIN(tst_QJniTypes)
+
+#include "tst_qjnitypes.moc"
diff --git a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
index a94b984d47..d3d470ea5f 100644
--- a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
+++ b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2013 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qmath.h>
@@ -290,9 +265,6 @@ void tst_QMath::qNextPowerOfTwo32S_data()
QTest::newRow("2^30") << (1 << 30) << (1U << 31);
QTest::newRow("2^30 + 1") << (1 << 30) + 1 << (1U << 31);
QTest::newRow("2^31 - 1") << 0x7FFFFFFF << (1U<<31);
- QTest::newRow("-1") << -1 << 0U;
- QTest::newRow("-128") << -128 << 0U;
- QTest::newRow("-(2^31)") << int(0x80000000) << 0U;
}
void tst_QMath::qNextPowerOfTwo32S()
@@ -318,8 +290,6 @@ void tst_QMath::qNextPowerOfTwo32U_data()
QTest::newRow("2^30") << (1U << 30) << (1U << 31);
QTest::newRow("2^30 + 1") << (1U << 30) + 1 << (1U << 31);
QTest::newRow("2^31 - 1") << 2147483647U << 2147483648U;
- QTest::newRow("2^31") << 2147483648U << 0U;
- QTest::newRow("2^31 + 1") << 2147483649U << 0U;
}
void tst_QMath::qNextPowerOfTwo32U()
@@ -346,10 +316,6 @@ void tst_QMath::qNextPowerOfTwo64S_data()
QTest::newRow("2^31") << Q_INT64_C(2147483648) << Q_UINT64_C(0x100000000);
QTest::newRow("2^31 + 1") << Q_INT64_C(2147483649) << Q_UINT64_C(0x100000000);
QTest::newRow("2^63 - 1") << Q_INT64_C(0x7FFFFFFFFFFFFFFF) << Q_UINT64_C(0x8000000000000000);
- QTest::newRow("-1") << Q_INT64_C(-1) << Q_UINT64_C(0);
- QTest::newRow("-128") << Q_INT64_C(-128) << Q_UINT64_C(0);
- QTest::newRow("-(2^31)") << -Q_INT64_C(0x80000000) << Q_UINT64_C(0);
- QTest::newRow("-(2^63)") << (qint64)Q_INT64_C(0x8000000000000000) << Q_UINT64_C(0);
}
void tst_QMath::qNextPowerOfTwo64S()
@@ -373,8 +339,6 @@ void tst_QMath::qNextPowerOfTwo64U_data()
QTest::newRow("65535") << Q_UINT64_C(65535) << Q_UINT64_C(65536);
QTest::newRow("65536") << Q_UINT64_C(65536) << Q_UINT64_C(131072);
QTest::newRow("2^63 - 1") << Q_UINT64_C(0x7FFFFFFFFFFFFFFF) << Q_UINT64_C(0x8000000000000000);
- QTest::newRow("2^63") << Q_UINT64_C(0x8000000000000000) << Q_UINT64_C(0);
- QTest::newRow("2^63 + 1") << Q_UINT64_C(0x8000000000000001) << Q_UINT64_C(0);
}
void tst_QMath::qNextPowerOfTwo64U()
diff --git a/tests/auto/corelib/kernel/qmetacontainer/tst_qmetacontainer.cpp b/tests/auto/corelib/kernel/qmetacontainer/tst_qmetacontainer.cpp
index f2e0328ddc..606e94787a 100644
--- a/tests/auto/corelib/kernel/qmetacontainer/tst_qmetacontainer.cpp
+++ b/tests/auto/corelib/kernel/qmetacontainer/tst_qmetacontainer.cpp
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtTest/qtest.h>
#include <QtCore/qcontainerinfo.h>
#include <QtCore/qmetacontainer.h>
+#include <QtCore/QMap>
+#include <QtCore/QHash>
#include <QtCore/qvector.h>
#include <QtCore/qset.h>
diff --git a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
index 92a75ba8ed..980830e9ba 100644
--- a/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
+++ b/tests/auto/corelib/kernel/qmetaenum/tst_qmetaenum.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
index c1e88f3159..2b8ef8358d 100644
--- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
+++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index f13ffe8354..3b2066ba5d 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index d3f10ed815..36f792ec8a 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
@@ -67,6 +42,8 @@ private slots:
void cleanupTestCase();
+ void ownMetaTypeNoProperties();
+
private:
static bool checkForSideEffects
(const QMetaObjectBuilder& builder,
@@ -1481,9 +1458,7 @@ int TestObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
if (_id < ownMethodCount)
qt_static_metacall(this, _c, _id, _a);
_id -= ownMethodCount;
- }
-#ifndef QT_NO_PROPERTIES
- else if (_c == QMetaObject::ReadProperty) {
+ } else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< int*>(_v) = intProp(); break;
@@ -1506,7 +1481,6 @@ int TestObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
} else if (_c == QMetaObject::ResetProperty) {
_id -= ownPropertyCount;
}
-#endif // QT_NO_PROPERTIES
return _id;
}
@@ -1641,23 +1615,35 @@ void tst_QMetaObjectBuilder::classNameFirstInStringData()
}
struct MyFoo {};
+struct myParameter {};
void tst_QMetaObjectBuilder::propertyMetaType()
{
+ qRegisterMetaType<myParameter>();
QMetaType meta = QMetaType::fromType<MyFoo>();
auto metaId = meta.id();
QMetaObjectBuilder builder;
builder.setClassName("Test");
- builder.addProperty("test", "MyFoo");
+ builder.addProperty("myParameter", "MyFoo");
auto mo = builder.toMetaObject();
- QMetaProperty metaProp = mo->property(mo->indexOfProperty("test"));
+ QMetaProperty metaProp = mo->property(mo->indexOfProperty("myParameter"));
QCOMPARE(metaProp.typeName(), meta.name());
QCOMPARE(metaProp.typeId(), metaId);
QCOMPARE(metaProp.metaType(), meta);
free(mo);
}
+void tst_QMetaObjectBuilder::ownMetaTypeNoProperties()
+{
+ QMetaObjectBuilder builder;
+ builder.setClassName("NoProperties");
+ auto mo = builder.toMetaObject();
+ auto cleanup = qScopeGuard([&](){ free(mo); });
+ // own metatype should be invalid, as the dynamic metaobject has not been registered
+ QVERIFY(!mo->metaType().isValid());// should not crash
+}
+
void tst_QMetaObjectBuilder::cleanupTestCase()
{
for (QMetaObject *obj: dynamicMetaObjectsPendingFree)
diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
index 6638351928..f459068bef 100644
--- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
+++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp
@@ -1,37 +1,14 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <qobject.h>
#include <qmetaobject.h>
+#include <QMap>
+#include <QString>
struct CustomType
{
diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
index ac4fb55813..264c459a89 100644
--- a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
@@ -21,23 +21,6 @@ qt_internal_add_test(tst_qmetatype
TESTDATA ${test_data}
)
-if(INTEGRITY)
- # Resources:
- set(testdata_resource_files
- "typeFlags.bin"
- )
-
- qt_internal_add_resource(tst_qmetatype "testdata"
- PREFIX
- "/"
- FILES
- ${testdata_resource_files}
- )
-endif()
-
-## Scopes:
-#####################################################################
-
qt_internal_extend_target(tst_qmetatype CONDITION MSVC
COMPILE_OPTIONS
/bigobj
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index f69327a3f1..ed413107c0 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tst_qmetatype.h"
@@ -585,6 +560,10 @@ void tst_QMetaType::normalizedTypes()
#define TYPENAME_DATA(MetaTypeName, MetaTypeId, RealType)\
QTest::newRow(#RealType) << int(QMetaType::MetaTypeName) << #RealType;
+namespace enumerations {
+ enum Test { a = 0 };
+}
+
void tst_QMetaType::typeName_data()
{
QTest::addColumn<int>("aType");
@@ -621,6 +600,8 @@ void tst_QMetaType::typeName_data()
// template instance class derived from Q_GADGET enabled class
QTest::newRow("GadgetDerivedAndTyped<int>") << ::qMetaTypeId<GadgetDerivedAndTyped<int>>() << QString::fromLatin1("GadgetDerivedAndTyped<int>");
QTest::newRow("GadgetDerivedAndTyped<int>*") << ::qMetaTypeId<GadgetDerivedAndTyped<int>*>() << QString::fromLatin1("GadgetDerivedAndTyped<int>*");
+
+ QTest::newRow("msvcKeywordPartOfName") << ::qMetaTypeId<enumerations::Test>() << QString::fromLatin1("enumerations::Test");
}
void tst_QMetaType::typeName()
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
index 15fe3e6874..588e52c4f6 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.h
@@ -1,32 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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 <QtCore>
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
#include <QTest>
#include "tst_qmetatype_common.h"
#include "tst_qvariant_common.h"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
index 025353d9c0..95cc0e7ed8 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tst_qmetatype.h"
#include "tst_qvariant_common.h"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
index 52406b1e8d..95577e16da 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype3.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "tst_qmetatype.h"
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
index 1ba9c47fa8..3324cb5b32 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype_common.h
@@ -1,37 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// Used by both tst_qmetatype and tst_qsettings
#ifndef TST_QMETATYPE_H
#define TST_QMETATYPE_H
-#include <qmetatype.h>
+#include <QtCore>
+
#include <float.h>
#define FOR_EACH_PRIMITIVE_METATYPE(F) \
diff --git a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
index 92d745090d..16d5c5308e 100644
--- a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
+++ b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp
index 57fb1eb836..044f3ef230 100644
--- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp
+++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "signalbug.h"
diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h
index e6e40c35d9..c1786e2cbc 100644
--- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h
+++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SIGNAL_BUG_H
#define SIGNAL_BUG_H
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 2e34099e5b..f765440e71 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -1,32 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com>
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
// This test actually wants to practice narrowing conditions, so never define this.
#ifdef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
@@ -108,6 +83,7 @@ private slots:
void deleteSelfInSlot();
void disconnectSelfInSlotAndDeleteAfterEmit();
void dumpObjectInfo();
+ void dumpObjectTree();
void connectToSender();
void qobjectConstCast();
void uniqConnection();
@@ -3413,6 +3389,32 @@ void tst_QObject::dumpObjectInfo()
a.dumpObjectInfo(); // should not crash
}
+void tst_QObject::dumpObjectTree()
+{
+ QObject a;
+ Q_SET_OBJECT_NAME(a);
+
+ QTimer b(&a);
+ Q_SET_OBJECT_NAME(b);
+
+ QObject c(&b);
+ Q_SET_OBJECT_NAME(c);
+
+ QFile f(&a);
+ Q_SET_OBJECT_NAME(f);
+
+ const char * const output[] = {
+ "QObject::a ",
+ " QTimer::b ",
+ " QObject::c ",
+ " QFile::f ",
+ };
+ for (const char *line : output)
+ QTest::ignoreMessage(QtDebugMsg, line);
+
+ a.dumpObjectTree();
+}
+
class ConnectToSender : public QObject
{ Q_OBJECT
public slots:
@@ -4506,6 +4508,17 @@ void tst_QObject::pointerConnect()
con = connect(&r1, &ReceiverObject::slot4 , &s, &SenderObject::signal4);
QVERIFY(!con);
QVERIFY(!QObject::disconnect(con));
+
+ //connect an arbitrary PMF to a slot
+ QTest::ignoreMessage(QtWarningMsg, "QObject::connect: signal not found in ReceiverObject");
+ con = connect(&r1, &ReceiverObject::reset, &r1, &ReceiverObject::slot1);
+ QVERIFY(!con);
+ QVERIFY(!QObject::disconnect(con));
+
+ QTest::ignoreMessage(QtWarningMsg, "QObject::connect: signal not found in ReceiverObject");
+ con = connect(&r1, &ReceiverObject::reset, &r1, [](){});
+ QVERIFY(!con);
+ QVERIFY(!QObject::disconnect(con));
}
void tst_QObject::pointerDisconnect()
@@ -7026,7 +7039,7 @@ void tst_QObject::checkArgumentsForNarrowing()
{
// Clang and ICC masquerade as GCC, so introduce a more strict define
// for exactly GCC (to exclude/include it from some tests).
-#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
+#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG)
#define Q_CC_EXACTLY_GCC Q_CC_GNU
#endif
@@ -7337,7 +7350,7 @@ void tst_QObject::checkArgumentsForNarrowing()
// GCC, GHS and clang don't implement this properly yet:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99625
// https://bugs.llvm.org/show_bug.cgi?id=49676
-#if defined(Q_CC_MSVC) // at least since VS2017
+#if defined(Q_CC_MSVC) && !defined(Q_CC_CLANG) // at least since VS2017
struct ConstructibleFromInt {
/* implicit */ ConstructibleFromInt(int) {}
};
@@ -8211,5 +8224,22 @@ void tst_QObject::emitToDestroyedClass()
static_assert(QtPrivate::HasQ_OBJECT_Macro<tst_QObject>::Value);
static_assert(!QtPrivate::HasQ_OBJECT_Macro<SiblingDeleter>::Value);
+Q_DECLARE_SMART_POINTER_METATYPE(std::shared_ptr)
+Q_DECLARE_SMART_POINTER_METATYPE(std::unique_ptr)
+
+
+// QTBUG-103741: OK to use smart pointers to const QObject in signals/slots
+class SenderWithSharedPointerConstQObject : public QObject
+{
+ Q_OBJECT
+
+signals:
+ void aSignal1(const QSharedPointer<const QObject> &);
+ void aSignal2(const QWeakPointer<const QObject> &);
+ void aSignal3(const QPointer<const QObject> &);
+ void aSignal4(const std::shared_ptr<const QObject> &);
+ void aSignal5(const std::unique_ptr<const QObject> &);
+};
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
index 6f9a422820..9886ab84f2 100644
--- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
+++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QRunnable>
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
index ef4c6868cf..c0471890ee 100644
--- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
+++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QObject>
#include <QSignalSpy>
@@ -41,7 +16,7 @@
#endif
using namespace QtPrivate;
-
+using namespace Qt::StringLiterals;
struct DtorCounter {
static inline int counter = 0;
@@ -103,6 +78,8 @@ private slots:
void compatPropertySignals();
void noFakeDependencies();
+ void threadSafety();
+ void threadSafety2();
void bindablePropertyWithInitialization();
void noDoubleNotification();
@@ -117,6 +94,7 @@ private slots:
void selfBindingShouldNotCrash();
void qpropertyAlias();
+ void scheduleNotify();
};
void tst_QProperty::functorBinding()
@@ -1681,6 +1659,126 @@ void tst_QProperty::noFakeDependencies()
QCOMPARE(old, bindingFunctionCalled);
}
+struct ThreadSafetyTester : public QObject
+{
+ Q_OBJECT
+
+public:
+ ThreadSafetyTester(QObject *parent = nullptr) : QObject(parent) {}
+
+ Q_INVOKABLE bool hasCorrectStatus() const
+ {
+ return qGetBindingStorage(this)->status({}) == QtPrivate::getBindingStatus({});
+ }
+
+ Q_INVOKABLE bool bindingTest()
+ {
+ QProperty<QString> name(u"inThread"_s);
+ bindableObjectName().setBinding([&]() -> QString { return name; });
+ name = u"inThreadChanged"_s;
+ const bool nameChangedCorrectly = objectName() == name;
+ bindableObjectName().takeBinding();
+ return nameChangedCorrectly;
+ }
+};
+
+
+void tst_QProperty::threadSafety()
+{
+ QThread workerThread;
+ auto cleanup = qScopeGuard([&](){
+ QMetaObject::invokeMethod(&workerThread, "quit");
+ workerThread.wait();
+ });
+ QScopedPointer<ThreadSafetyTester> scopedObj1(new ThreadSafetyTester);
+ auto obj1 = scopedObj1.data();
+ auto child1 = new ThreadSafetyTester(obj1);
+ obj1->moveToThread(&workerThread);
+ const auto mainThreadBindingStatus = QtPrivate::getBindingStatus({});
+ QCOMPARE(qGetBindingStorage(child1)->status({}), nullptr);
+ workerThread.start();
+
+ bool correctStatus = false;
+ bool ok = QMetaObject::invokeMethod(obj1, "hasCorrectStatus", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, correctStatus));
+ QVERIFY(ok);
+ QVERIFY(correctStatus);
+
+ bool bindingWorks = false;
+ ok = QMetaObject::invokeMethod(obj1, "bindingTest", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, bindingWorks));
+ QVERIFY(ok);
+ QVERIFY(bindingWorks);
+
+ correctStatus = false;
+ ok = QMetaObject::invokeMethod(child1, "hasCorrectStatus", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, correctStatus));
+ QVERIFY(ok);
+ QVERIFY(correctStatus);
+
+ QScopedPointer scopedObj2(new ThreadSafetyTester);
+ auto obj2 = scopedObj2.data();
+ QCOMPARE(qGetBindingStorage(obj2)->status({}), mainThreadBindingStatus);
+
+ obj2->setObjectName("moved");
+ QCOMPARE(obj2->objectName(), "moved");
+
+ obj2->moveToThread(&workerThread);
+ correctStatus = false;
+ ok = QMetaObject::invokeMethod(obj2, "hasCorrectStatus", Qt::BlockingQueuedConnection,
+ Q_RETURN_ARG(bool, correctStatus));
+
+ QVERIFY(ok);
+ QVERIFY(correctStatus);
+ // potentially unsafe, but should still work (no writes in owning thread)
+ QCOMPARE(obj2->objectName(), "moved");
+
+
+ QScopedPointer scopedObj3(new ThreadSafetyTester);
+ auto obj3 = scopedObj3.data();
+ obj3->setObjectName("moved");
+ QCOMPARE(obj3->objectName(), "moved");
+ obj3->moveToThread(nullptr);
+ QCOMPARE(obj2->objectName(), "moved");
+ obj3->setObjectName("moved again");
+ QCOMPARE(obj3->objectName(), "moved again");
+}
+
+class QPropertyUsingThread : public QThread
+{
+public:
+ QPropertyUsingThread(QObject **dest, QThread *destThread) : dest(dest), destThread(destThread) {}
+ void run() override
+ {
+ scopedObj1.reset(new ThreadSafetyTester());
+ scopedObj1->setObjectName("test");
+ QObject *child = new ThreadSafetyTester(scopedObj1.get());
+ child->setObjectName("child");
+ exec();
+ scopedObj1->moveToThread(destThread);
+ *dest = scopedObj1.release();
+ }
+ std::unique_ptr<ThreadSafetyTester> scopedObj1;
+ QObject **dest;
+ QThread *destThread;
+};
+
+void tst_QProperty::threadSafety2()
+{
+ std::unique_ptr<QObject> movedObj;
+ {
+ QObject *tmp = nullptr;
+ QPropertyUsingThread workerThread(&tmp, QThread::currentThread());
+ workerThread.start();
+ workerThread.quit();
+ workerThread.wait();
+ movedObj.reset(tmp);
+ }
+
+ QCOMPARE(movedObj->objectName(), "test");
+ QCOMPARE(movedObj->children().first()->objectName(), "child");
+}
+
struct CustomType
{
CustomType() = default;
@@ -1929,6 +2027,21 @@ void tst_QProperty::qpropertyAlias()
QVERIFY(!alias.isValid());
}
+void tst_QProperty::scheduleNotify()
+{
+ int notifications = 0;
+ QProperty<int> p;
+ QCOMPARE(p.value(), 0);
+ const auto handler = p.addNotifier([&](){ ++notifications; });
+ QCOMPARE(notifications, 0);
+ QPropertyBinding<int> b([]() { return 0; }, QPropertyBindingSourceLocation());
+ QPropertyBindingPrivate::get(b)->scheduleNotify();
+ QCOMPARE(notifications, 0);
+ p.setBinding(b);
+ QCOMPARE(notifications, 1);
+ QCOMPARE(p.value(), 0);
+}
+
QTEST_MAIN(tst_QProperty);
#undef QT_SOURCE_LOCATION_NAMESPACE
diff --git a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp
index cdbb11e5a7..968b45aae1 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QSharedMemory>
#include <QStringList>
diff --git a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp
index 26cf67e9de..63a33d73a0 100644
--- a/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/corelib/kernel/qsharedmemory/tst_qsharedmemory.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QDebug>
#include <QFile>
@@ -124,7 +99,7 @@ private:
tst_QSharedMemory::tst_QSharedMemory()
: existingSharedMemory(0)
- , m_helperBinary("producerconsumer_helper")
+ , m_helperBinary("./producerconsumer_helper")
{
}
diff --git a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp
index aa9832f7ce..3345707a74 100644
--- a/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp
+++ b/tests/auto/corelib/kernel/qsignalblocker/tst_qsignalblocker.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@woboq.com>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp
index c3f7bb9b85..aee5751e47 100644
--- a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp
+++ b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index 0e9e6bd493..59ef20c6e4 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtTest/QTest>
#include <QtTest/QSignalSpy>
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp
index 7bfb6b16cc..979649d662 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QCoreApplication>
#include <QDebug>
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp
index b0f517d10f..e2f557b698 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#if QT_CONFIG(process)
@@ -74,7 +49,7 @@ private:
};
tst_QSystemSemaphore::tst_QSystemSemaphore()
- : m_helperBinary("acquirerelease_helper")
+ : m_helperBinary("./acquirerelease_helper")
{
}
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index b3a500fbd8..c91aba4790 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifdef QT_GUI_LIB
# include <QtGui/QGuiApplication>
diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
index 2486eeda5c..372a7a9db1 100644
--- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QWaitCondition>
diff --git a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt
index 45bfa4e480..85a90b440f 100644
--- a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt
+++ b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt
@@ -4,6 +4,12 @@
## tst_qvariant Test:
#####################################################################
+# Resources:
+set(qvariant_resource_files
+ "stream/qt4.9/"
+ "stream/qt5.0/"
+)
+
qt_internal_add_test(tst_qvariant
SOURCES
tst_qvariant.cpp
@@ -14,22 +20,10 @@ qt_internal_add_test(tst_qvariant
PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::Gui
+ TESTDATA ${qvariant_resource_files}
+ BUILTIN_TESTDATA
)
-# Resources:
-set(qvariant_resource_files
- "stream/qt4.9/"
- "stream/qt5.0/"
-)
-
-qt_internal_add_resource(tst_qvariant "qvariant"
- PREFIX
- "/"
- FILES
- ${qvariant_resource_files}
-)
-
-
## Scopes:
#####################################################################
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 437e3ccba5..520515df61 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -1,36 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
-** Copyright (C) 2016 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QQueue>
#include <QStack>
+#include <QSet>
#include <qvariant.h>
#include <QtCore/private/qvariant_p.h>
@@ -38,6 +14,7 @@
#include <qbytearraylist.h>
#include <qdatetime.h>
#include <qmap.h>
+#include <QHash>
#include <qiodevice.h>
#include <qurl.h>
#include <qlocale.h>
diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
index be1f2259e5..74122b6c83 100644
--- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
+++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QTestEventLoop>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
index 1637f644be..8a87d70234 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../tst_qmimedatabase.h"
#include <QDir>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
index e403baf714..72a07595a5 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "../tst_qmimedatabase.h"
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/test.qml b/tests/auto/corelib/mimetypes/qmimedatabase/test.qml
index 8b7437d2e6..752cf553e9 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/test.qml
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/test.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 David Faure <faure@kde.org>
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2012 David Faure <faure@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 1.1
Item {
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index e25dea9655..fae26f4971 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qmimedatabase.h>
@@ -78,12 +53,12 @@ static inline QString testSuiteWarning()
str << "\nCannot find the shared-mime-info test suite\nin the parent of: "
<< QDir::toNativeSeparators(QDir::currentPath()) << "\n"
"cd " << QDir::toNativeSeparators(QStringLiteral("tests/auto/corelib/mimetypes/qmimedatabase")) << "\n"
- "wget https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/2.1/shared-mime-info-2.1.zip\n"
- "unzip shared-mime-info-2.1.zip\n";
+ "wget https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/2.2/shared-mime-info-2.2.zip\n"
+ "unzip shared-mime-info-2.2.zip\n";
#ifdef Q_OS_WIN
- str << "mkdir testfiles\nxcopy /s shared-mime-info-2.1 s-m-i\n";
+ str << "mkdir testfiles\nxcopy /s shared-mime-info-2.2 s-m-i\n";
#else
- str << "ln -s shared-mime-info-2.1 s-m-i\n";
+ str << "ln -s shared-mime-info-2.2 s-m-i\n";
#endif
return result;
}
@@ -616,7 +591,7 @@ void tst_QMimeDatabase::allMimeTypes()
QVERIFY(!lst.isEmpty());
// Hardcoding this is the only way to check both providers find the same number of mimetypes.
- QCOMPARE(lst.count(), 811);
+ QCOMPARE(lst.count(), 851);
foreach (const QMimeType &mime, lst) {
const QString name = mime.name();
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
index 4918dc6f4a..5818e1b6eb 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef TST_QMIMEDATABASE_H
#define TST_QMIMEDATABASE_H
diff --git a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
index 6d180cd838..fda12298fe 100644
--- a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
+++ b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
@@ -1,35 +1,11 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <private/qmimetype_p.h>
#include <qmimetype.h>
#include <qmimedatabase.h>
+#include <QVariantMap>
#include <QTest>
diff --git a/tests/auto/corelib/platform/android/tst_android.cpp b/tests/auto/corelib/platform/android/tst_android.cpp
index 710e5b2ecf..2fa6ec6415 100644
--- a/tests/auto/corelib/platform/android/tst_android.cpp
+++ b/tests/auto/corelib/platform/android/tst_android.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <jni.h>
diff --git a/tests/auto/corelib/plugin/CMakeLists.txt b/tests/auto/corelib/plugin/CMakeLists.txt
index 14ce4c316d..710d471e8a 100644
--- a/tests/auto/corelib/plugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/CMakeLists.txt
@@ -1,16 +1,13 @@
# Generated from plugin.pro.
-# QTBUG-87438 # special case
-if(QT_BUILD_SHARED_LIBS AND NOT ANDROID)
+if(QT_BUILD_SHARED_LIBS)
add_subdirectory(qfactoryloader)
endif()
add_subdirectory(quuid)
-# QTBUG-87438 # special case
-if(QT_FEATURE_library AND NOT ANDROID)
+if(QT_FEATURE_library)
add_subdirectory(qpluginloader)
add_subdirectory(qlibrary)
endif()
-# QTBUG-87438 # special case
-if(QT_BUILD_SHARED_LIBS AND QT_FEATURE_library AND NOT ANDROID)
+if(QT_BUILD_SHARED_LIBS AND QT_FEATURE_library)
add_subdirectory(qplugin)
endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
index 247c905d9e..eec1abec3f 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/CMakeLists.txt
@@ -4,7 +4,7 @@
## plugin1 Generic Library:
#####################################################################
-qt_internal_add_cmake_library(plugin1
+qt_internal_add_cmake_library(tst_qfactoryloader_plugin1
MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
@@ -14,17 +14,17 @@ qt_internal_add_cmake_library(plugin1
Qt::Core
)
-#### Keys ignored in scope 1:.:.:plugin1.pro:<TRUE>:
-# INSTALLS = "target"
-# TEMPLATE = "lib"
-# target.path = "$$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin"
+if(ANDROID)
+ # On Android the plugins must match the following mask:
+ # "libplugins_{suffix}_*.so"
+ # and the testcase uses "bin" as a suffix
+ set_target_properties(tst_qfactoryloader_plugin1 PROPERTIES
+ OUTPUT_NAME "plugins_bin_tst_qfactoryloader_plugin1")
+endif()
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(plugin1 CONDITION NOT QT_FEATURE_library
+qt_internal_extend_target(tst_qfactoryloader_plugin1 CONDITION NOT QT_FEATURE_library
DEFINES
QT_STATICPLUGIN
)
-qt_autogen_tools_initial_setup(plugin1)
+qt_autogen_tools_initial_setup(tst_qfactoryloader_plugin1)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.cpp b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.cpp
index bfa49dc34e..51825f0017 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.cpp
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qstring.h>
#include "plugin1.h"
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h
index 8091ba52bf..8afb501f04 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef THEPLUGIN_H
#define THEPLUGIN_H
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugininterface1.h b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugininterface1.h
index 408e963adf..b7251db358 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugininterface1.h
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugininterface1.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PLUGININTERFACE1_H
#define PLUGININTERFACE1_H
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
index a384a40412..765ad0b262 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/CMakeLists.txt
@@ -4,7 +4,7 @@
## plugin2 Generic Library:
#####################################################################
-qt_internal_add_cmake_library(plugin2
+qt_internal_add_cmake_library(tst_qfactoryloader_plugin2
MODULE
INSTALL_DIRECTORY "${INSTALL_TESTSDIR}/tst_qfactoryloader/bin"
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../bin"
@@ -14,17 +14,17 @@ qt_internal_add_cmake_library(plugin2
Qt::Core
)
-#### Keys ignored in scope 1:.:.:plugin2.pro:<TRUE>:
-# INSTALLS = "target"
-# TEMPLATE = "lib"
-# target.path = "$$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin"
+if(ANDROID)
+ # On Android the plugins must match the following mask:
+ # "libplugins_{suffix}_*.so"
+ # and the testcase uses "bin" as a suffix
+ set_target_properties(tst_qfactoryloader_plugin2 PROPERTIES
+ OUTPUT_NAME "plugins_bin_tst_qfactoryloader_plugin2")
+endif()
-## Scopes:
-#####################################################################
-
-qt_internal_extend_target(plugin2 CONDITION NOT QT_FEATURE_library
+qt_internal_extend_target(tst_qfactoryloader_plugin2 CONDITION NOT QT_FEATURE_library
DEFINES
QT_STATICPLUGIN
)
-qt_autogen_tools_initial_setup(plugin2)
+qt_autogen_tools_initial_setup(tst_qfactoryloader_plugin2)
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.cpp b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.cpp
index 34a7207f10..88a34ac73e 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.cpp
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/qstring.h>
#include "plugin2.h"
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h
index ce214f7571..a2ccae198e 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef THEPLUGIN_H
#define THEPLUGIN_H
diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugininterface2.h b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugininterface2.h
index e9b7e14048..e332e80b89 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugininterface2.h
+++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugininterface2.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PLUGININTERFACE2_H
#define PLUGININTERFACE2_H
diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
index 675dbbd684..2869fca045 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qfactoryloader/test/CMakeLists.txt
@@ -10,60 +10,24 @@ qt_internal_add_test(tst_qfactoryloader
../plugin1/plugininterface1.h
../plugin2/plugininterface2.h
../tst_qfactoryloader.cpp
- PUBLIC_LIBRARIES
+ 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
-
qt_internal_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
+ LIBRARIES
+ tst_qfactoryloader_plugin1
+ tst_qfactoryloader_plugin2
)
-if(ANDROID)
- # special case begin
- set_source_files_properties(
- ${CMAKE_CURRENT_BINARY_DIR}/../bin/libplugin1.so
- PROPERTIES QT_RESOURCE_TARGET_DEPENDENCY plugin1
- )
+add_dependencies(tst_qfactoryloader tst_qfactoryloader_plugin1 tst_qfactoryloader_plugin2)
- 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()
- list(TRANSFORM qmake_libs_resource_files PREPEND "${CMAKE_CURRENT_BINARY_DIR}/../")
- # special case end
-
- qt_internal_add_resource(tst_qfactoryloader "qmake_libs"
- PREFIX
- "android_test_data"
- BASE
- "${CMAKE_CURRENT_BINARY_DIR}/.."
- FILES
- ${qmake_libs_resource_files}
+if(ANDROID)
+ # QT_ANDROID_EXTRA_PLUGINS requires a list of directories, not files!
+ set_target_properties(tst_qfactoryloader PROPERTIES
+ QT_ANDROID_EXTRA_PLUGINS "${CMAKE_CURRENT_BINARY_DIR}/../bin"
)
endif()
diff --git a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp
index 862877fa6f..a3ee6fa3d4 100644
--- a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp
+++ b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtTest/qtest.h>
#include <QtCore/qdir.h>
@@ -60,19 +35,16 @@ static const char binFolderC[] = "bin";
void tst_QFactoryLoader::initTestCase()
{
-#ifdef Q_OS_ANDROID
- directory = QEXTRACTTESTDATA("android_test_data");
- QVERIFY(directory);
- QVERIFY(directory->isValid());
- QVERIFY2(QDir::setCurrent(directory->path()), qPrintable("Could not chdir to " + directory->path()));
-#endif
+ // On Android the plugins are bundled into APK's libs subdir
+#ifndef Q_OS_ANDROID
binFolder = QFINDTESTDATA(binFolderC);
QVERIFY2(!binFolder.isEmpty(), "Unable to locate 'bin' folder");
+#endif
}
void tst_QFactoryLoader::usingTwoFactoriesFromSameDir()
{
-#if QT_CONFIG(library)
+#if QT_CONFIG(library) && !defined(Q_OS_ANDROID)
// set the library path to contain the directory where the 'bin' dir is located
QCoreApplication::setLibraryPaths( { QFileInfo(binFolder).absolutePath() });
#endif
@@ -101,15 +73,29 @@ void tst_QFactoryLoader::extraSearchPath()
#if defined(Q_OS_ANDROID) && !QT_CONFIG(library)
QSKIP("Test not applicable in this configuration.");
#else
+#ifdef Q_OS_ANDROID
+ // On Android the libs are not stored in binFolder, but bundled into
+ // APK's libs subdir
+ const QStringList androidLibsPaths = QCoreApplication::libraryPaths();
+ QCOMPARE(androidLibsPaths.size(), 1);
+#endif
QCoreApplication::setLibraryPaths(QStringList());
- QString absoluteBinPath = QFileInfo(binFolder).absoluteFilePath();
+#ifndef Q_OS_ANDROID
+ QString pluginsPath = QFileInfo(binFolder).absoluteFilePath();
QFactoryLoader loader1(PluginInterface1_iid, "/nonexistent");
+#else
+ QString pluginsPath = androidLibsPaths.first();
+ // On Android we still need to specify a valid suffix, because it's a part
+ // of a file name, not directory structure
+ const QString suffix = QLatin1Char('/') + QLatin1String(binFolderC);
+ QFactoryLoader loader1(PluginInterface1_iid, suffix);
+#endif
// it shouldn't have scanned anything because we haven't given it a path yet
QVERIFY(loader1.metaData().isEmpty());
- loader1.setExtraSearchPath(absoluteBinPath);
+ loader1.setExtraSearchPath(pluginsPath);
PluginInterface1 *plugin1 = qobject_cast<PluginInterface1 *>(loader1.instance(0));
QVERIFY2(plugin1,
qPrintable(QString::fromLatin1("Cannot load plugin '%1'")
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt
index 0dbae9af6f..25292c0cc5 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qlibrary/lib/CMakeLists.txt
@@ -35,10 +35,10 @@ if (MACOS)
"${CMAKE_CURRENT_BINARY_DIR}/../"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_BINARY_DIR}/*dylib"
- "${CMAKE_CURRENT_BINARY_DIR}/../"
- )
+ "${CMAKE_CURRENT_BINARY_DIR}/../")
elseif (UNIX)
- add_custom_command(TARGET mylib POST_BUILD
+ if (NOT ANDROID)
+ add_custom_command(TARGET mylib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:mylib>
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so.1.0.0"
@@ -48,13 +48,23 @@ elseif (UNIX)
COMMAND ${CMAKE_COMMAND} -E create_symlink
"libmylib.so.1.0.0"
"${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so1"
- )
+ VERBATIM)
+ else()
+ # Android does not use symlinks. Also, according to our conventions,
+ # libraries on Android MUST be named in the following pattern:
+ # lib*.so
+ add_custom_command(TARGET mylib POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ $<TARGET_FILE:mylib>
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so"
+ VERBATIM)
+ endif()
else() #Win32
add_custom_command(TARGET mylib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:mylib>
"${CMAKE_CURRENT_BINARY_DIR}/../mylib.dll"
- )
+ VERBATIM)
endif()
# special case end
diff --git a/tests/auto/corelib/plugin/qlibrary/lib/mylib.c b/tests/auto/corelib/plugin/qlibrary/lib/mylib.c
index 419c22a446..63622bdf1a 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib/mylib.c
+++ b/tests/auto/corelib/plugin/qlibrary/lib/mylib.c
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qglobal.h>
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt
index 7603f4f0cb..902c53ea84 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/CMakeLists.txt
@@ -40,25 +40,36 @@ if(WIN32)
endif()
if (UNIX)
- 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
+ if(NOT ANDROID)
+ 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
+ "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
+ "libmylib.so.2.0.0"
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ "libmylib.so.2.0.0"
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2"
+ VERBATIM)
+ else()
+ # Android does not use symlinks. Also, according to our conventions,
+ # libraries on Android MUST be named in the following pattern:
+ # lib*.so
+ add_custom_command(TARGET mylib2 POST_BUILD
+ 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
- "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
- "libmylib.so.2.0.0"
- "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so"
- COMMAND ${CMAKE_COMMAND} -E create_symlink
- "libmylib.so.2.0.0"
- "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so2"
- )
+ "${CMAKE_CURRENT_BINARY_DIR}/../libsystem.qt.test.mylib.so"
+ VERBATIM)
+ endif()
else() #Win32
add_custom_command(TARGET mylib2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
@@ -67,7 +78,7 @@ else() #Win32
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:mylib2>
"${CMAKE_CURRENT_BINARY_DIR}/../mylib.dl2"
- )
+ VERBATIM)
endif()
# special case end
diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/mylib.c b/tests/auto/corelib/plugin/qlibrary/lib2/mylib.c
index 74eb68b2ac..d036a1ae93 100644
--- a/tests/auto/corelib/plugin/qlibrary/lib2/mylib.c
+++ b/tests/auto/corelib/plugin/qlibrary/lib2/mylib.c
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qglobal.h>
diff --git a/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt
index 73c05aeebe..ee50a7f581 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qlibrary/tst/CMakeLists.txt
@@ -15,39 +15,13 @@ qt_internal_add_test(tst_qlibrary
LIBRARIES mylib mylib2 # special case
)
-## Scopes:
-#####################################################################
+add_dependencies(tst_qlibrary mylib mylib2)
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
- )
-
- list(TRANSFORM qmake_libs_resource_files PREPEND "${CMAKE_CURRENT_BINARY_DIR}/../")
-
- qt_internal_add_resource(tst_qlibrary "qmake_libs"
- PREFIX
- "android_test_data"
- BASE
- "${CMAKE_CURRENT_BINARY_DIR}/.."
- FILES
- ${qmake_libs_resource_files}
- )
+ list(APPEND extra_libs
+ "${CMAKE_CURRENT_BINARY_DIR}/../libmylib.so")
+ list(APPEND extra_libs
+ "${CMAKE_CURRENT_BINARY_DIR}/../libsystem.qt.test.mylib.so")
+ set_target_properties(tst_qlibrary PROPERTIES
+ QT_ANDROID_EXTRA_LIBS "${extra_libs}")
endif()
diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
index 6ecbf393e2..d36ca0f8d8 100644
--- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
+++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
@@ -104,9 +79,6 @@ enum QLibraryOperation {
QString sys_qualifiedLibraryName(const QString &fileName);
QString directory;
-#ifdef Q_OS_ANDROID
- QSharedPointer<QTemporaryDir> temporaryDir;
-#endif
private slots:
void initTestCase();
@@ -141,24 +113,9 @@ typedef int (*VersionFunction)(void);
void tst_QLibrary::initTestCase()
{
#ifdef Q_OS_ANDROID
- auto tempDir = QEXTRACTTESTDATA("android_test_data");
-
- QVERIFY2(QDir::setCurrent(tempDir->path()), qPrintable("Could not chdir to " + tempDir->path()));
-
- // copy :/library_path into ./library_path
- QVERIFY(QDir().mkdir("library_path"));
- QDirIterator iterator(":/library_path", QDirIterator::Subdirectories);
- while (iterator.hasNext()) {
- iterator.next();
- QFileInfo sourceFileInfo(iterator.path());
- QFileInfo targetFileInfo("./library_path/" + sourceFileInfo.fileName());
- if (!targetFileInfo.exists()) {
- QDir().mkpath(targetFileInfo.path());
- QVERIFY(QFile::copy(sourceFileInfo.filePath(), targetFileInfo.filePath()));
- }
- }
- directory = tempDir->path();
- temporaryDir = std::move(tempDir);
+ const QStringList paths = QCoreApplication::libraryPaths();
+ QVERIFY(!paths.isEmpty());
+ directory = paths.first();
#else
// chdir to our testdata directory, and use relative paths in some tests.
QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath();
@@ -224,7 +181,10 @@ void tst_QLibrary::load_data()
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << true;
# elif defined Q_OS_UNIX
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/libmylib" SUFFIX << true;
+#ifndef Q_OS_ANDROID
+ // We do not support non-standard suffixes on Android
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/libmylib.so2" << true;
+#endif
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.so" << true;
# endif // Q_OS_UNIX
}
@@ -438,7 +398,10 @@ void tst_QLibrary::loadHints_data()
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true;
# elif defined Q_OS_UNIX
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/libmylib" SUFFIX << int(lh) << true;
+#ifndef Q_OS_ANDROID
+ // We do not support non-standard suffixes on Android
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/libmylib.so2" << int(lh) << true;
+#endif
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.so" << int(lh) << true;
# endif // Q_OS_UNIX
}
diff --git a/tests/auto/corelib/plugin/qplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qplugin/CMakeLists.txt
index 2c901eff44..1713f8c2af 100644
--- a/tests/auto/corelib/plugin/qplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qplugin/CMakeLists.txt
@@ -1,27 +1,41 @@
# 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})
-
qt_internal_add_test(tst_qplugin
SOURCES
tst_qplugin.cpp
LIBRARIES
Qt::CorePrivate
- TESTDATA ${test_data}
)
+if(NOT ANDROID)
+ # Collect test data
+ file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ plugins/*)
+ list(APPEND test_data ${test_data_glob})
+ set_target_properties(tst_qplugin PROPERTIES TESTDATA "${test_data}")
+else()
+ # On Android the plugins must be located in the libs subdir of the APK.
+ # Use QT_ANDROID_EXTRA_LIBS to achieve that.
+ set(plugins
+ invalidplugin
+ debugplugin
+ releaseplugin
+ )
+ set(extra_libs)
+ foreach(plugin IN LISTS plugins)
+ list(APPEND extra_libs
+ "${CMAKE_CURRENT_BINARY_DIR}/plugins/lib${plugin}_${CMAKE_ANDROID_ARCH_ABI}.so")
+ endforeach()
+ set_target_properties(tst_qplugin PROPERTIES
+ QT_ANDROID_EXTRA_LIBS "${extra_libs}"
+ )
+endif()
+
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/main.cpp b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
index c610bfdc46..635dbd7856 100644
--- a/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qplugin/debugplugin/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtPlugin>
#include <QObject>
diff --git a/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp
index 50340467b5..083f3ad14f 100644
--- a/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qplugin/invalidplugin/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qplugin.h>
diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
index dd936f7da1..edb2340a7d 100644
--- a/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtPlugin>
#include <QObject>
diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
index ddc9ff7e7c..e96204c471 100644
--- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
+++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QCoreApplication>
@@ -54,8 +29,15 @@ private slots:
};
tst_QPlugin::tst_QPlugin()
- : dir(QFINDTESTDATA("plugins"))
{
+ // On Android the plugins must be located in the APK's libs subdir
+#ifndef Q_OS_ANDROID
+ dir = QFINDTESTDATA("plugins");
+#else
+ const QStringList paths = QCoreApplication::libraryPaths();
+ if (!paths.isEmpty())
+ dir = paths.first();
+#endif
}
void tst_QPlugin::initTestCase()
@@ -234,6 +216,11 @@ void tst_QPlugin::scanInvalidPlugin()
memset(data + offset + metadata.size(), 0, 512 - metadata.size());
}
+#if defined(Q_OS_QNX)
+ // On QNX plugin access is still too early
+ QTest::qSleep(1000);
+#endif
+
// now try to load this
QFETCH(bool, loads);
QFETCH(QString, errMsg);
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
index 75806dd285..afb77d8f3a 100644
--- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QString>
#include "almostplugin.h"
#include <QtCore/qplugin.h>
diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
index 4dd8df52f0..88592d9bbf 100644
--- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef ALMOSTPLUGIN_H
#define ALMOSTPLUGIN_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/fakeplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/fakeplugin.cpp
index 899586ed15..e52206579e 100644
--- a/tests/auto/corelib/plugin/qpluginloader/fakeplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/fakeplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QT_VERSION_MAJOR
# include <QtCore/qglobal.h>
#endif
diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/mylib.c b/tests/auto/corelib/plugin/qpluginloader/lib/mylib.c
index 8d23b999c4..087fc5aa31 100644
--- a/tests/auto/corelib/plugin/qpluginloader/lib/mylib.c
+++ b/tests/auto/corelib/plugin/qpluginloader/lib/mylib.c
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qglobal.h>
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/generate-bad.pl b/tests/auto/corelib/plugin/qpluginloader/machtest/generate-bad.pl
index 4fed135049..3de1eb581a 100755
--- a/tests/auto/corelib/plugin/qpluginloader/machtest/generate-bad.pl
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/generate-bad.pl
@@ -1,31 +1,6 @@
#!/usr/bin/perl
-#############################################################################
-##
-## Copyright (C) 2016 Intel Corporation.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is the build configuration utility 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$
-##
-#############################################################################
+# Copyright (C) 2016 Intel Corporation.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
use strict;
use constant FAT_MAGIC => 0xcafebabe;
diff --git a/tests/auto/corelib/plugin/qpluginloader/machtest/ppcconverter.pl b/tests/auto/corelib/plugin/qpluginloader/machtest/ppcconverter.pl
index 7242d7596b..64b937991a 100755
--- a/tests/auto/corelib/plugin/qpluginloader/machtest/ppcconverter.pl
+++ b/tests/auto/corelib/plugin/qpluginloader/machtest/ppcconverter.pl
@@ -1,31 +1,6 @@
#!/usr/bin/perl
-#############################################################################
-##
-## Copyright (C) 2016 Intel Corporation.
-## Contact: https://www.qt.io/licensing/
-##
-## This file is the build configuration utility 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$
-##
-#############################################################################
+# Copyright (C) 2016 Intel Corporation.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# Changes the Mach-O file type header to PowerPC.
#
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
index 1448ff3933..68d9a5da0a 100644
--- a/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/CMakeLists.txt
@@ -8,7 +8,7 @@ qt_internal_add_cmake_library(staticplugin
STATIC
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
MOC_OPTIONS
"-M"
diff --git a/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp
index 6d163ea336..d0d9d5f59d 100644
--- a/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/staticplugin/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2018 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtPlugin>
#include <QObject>
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
index 12285ba016..d139919a07 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/plugininterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp
index fd7a6e16d3..59f180b0e8 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "theoldplugin.h"
#include <QtCore/QString>
#include <QtCore/qplugin.h>
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h
index 57fd5a41c9..781fdefa2c 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theoldplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 Intel Corportaion.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2021 Intel Corportaion.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef THEOLDPLUGIN_H
#define THEOLDPLUGIN_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
index 01563c3dc9..1656718de3 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QString>
#include "theplugin.h"
#include <QtCore/qplugin.h>
diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
index 7c9324b8b3..3a2f0d09fd 100644
--- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
+++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef THEPLUGIN_H
#define THEPLUGIN_H
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
index 1193a9d731..ca27cef44b 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
+++ b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt
@@ -14,16 +14,43 @@ qt_internal_add_test(tst_qpluginloader
../fakeplugin.cpp
../theplugin/plugininterface.h
../tst_qpluginloader.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
staticplugin
TESTDATA ${test_data}
)
+add_dependencies(tst_qpluginloader tst_qpluginloaderlib staticplugin theplugin)
+if (UNIX)
+ if(NOT APPLE)
+ add_dependencies(tst_qpluginloader theoldplugin)
+ endif()
+ if (NOT ANDROID AND NOT APPLE)
+ add_dependencies(tst_qpluginloader almostplugin)
+ endif()
+endif()
+
+if(ANDROID)
+ add_compile_definitions(ANDROID_ARCH="${CMAKE_ANDROID_ARCH_ABI}")
+ set(plugins
+ theplugin
+ theoldplugin
+ tst_qpluginloaderlib
+ )
+ set(extra_libs)
+ foreach(plugin IN LISTS plugins)
+ list(APPEND extra_libs
+ "${CMAKE_CURRENT_BINARY_DIR}/../bin/lib${plugin}_${CMAKE_ANDROID_ARCH_ABI}.so")
+ endforeach()
+ set_target_properties(tst_qpluginloader PROPERTIES
+ QT_ANDROID_EXTRA_LIBS "${extra_libs}"
+ )
+endif()
+
## Scopes:
#####################################################################
qt_internal_extend_target(tst_qpluginloader CONDITION QT_FEATURE_private_tests
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
)
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
index fcce21433e..2c2b24acee 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
@@ -1,31 +1,6 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// Copyright (C) 2021 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QSignalSpy>
@@ -185,12 +160,22 @@ static std::unique_ptr<QTemporaryFile> patchElf(const QString &source, ElfPatche
static QString sys_qualifiedLibraryName(const QString &fileName)
{
+#ifdef Q_OS_ANDROID
+ // On Android all the libraries must be located in the APK's libs subdir
+ const QStringList paths = QCoreApplication::libraryPaths();
+ if (!paths.isEmpty()) {
+ return QLatin1String("%1/%2%3_%4%5").arg(paths.first(), PREFIX, fileName,
+ ANDROID_ARCH, SUFFIX);
+ }
+ return fileName;
+#else
QString name = QLatin1String("bin/") + QLatin1String(PREFIX) + fileName + QLatin1String(SUFFIX);
const QString libname = QFINDTESTDATA(name);
QFileInfo fi(libname);
if (fi.exists())
return fi.canonicalFilePath();
return libname;
+#endif
}
QT_FORWARD_DECLARE_CLASS(QPluginLoader)
@@ -349,10 +334,19 @@ void tst_QPluginLoader::loadHints()
QSKIP("This test requires Qt to create shared libraries.");
#endif
QPluginLoader loader;
- QCOMPARE(loader.loadHints(), QLibrary::LoadHints{}); //Do not crash
+ QCOMPARE(loader.loadHints(), QLibrary::PreventUnloadHint); //Do not crash
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
+ QCOMPARE(loader.loadHints(), QLibrary::ResolveAllSymbolsHint);
loader.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin
QCOMPARE(loader.loadHints(), QLibrary::ResolveAllSymbolsHint);
+
+ QPluginLoader loader2;
+ QCOMPARE(loader2.loadHints(), QLibrary::PreventUnloadHint);
+ loader2.setFileName(sys_qualifiedLibraryName("theplugin"));
+ QCOMPARE(loader2.loadHints(), QLibrary::PreventUnloadHint);
+
+ QPluginLoader loader3(sys_qualifiedLibraryName("theplugin"));
+ QCOMPARE(loader3.loadHints(), QLibrary::PreventUnloadHint);
}
void tst_QPluginLoader::deleteinstanceOnUnload()
@@ -909,11 +903,19 @@ void tst_QPluginLoader::relativePath()
#if !defined(QT_SHARED)
QSKIP("This test requires Qt to create shared libraries.");
#endif
+#ifdef Q_OS_ANDROID
+ // On Android we do not need to explicitly set library paths, as they are
+ // already set.
+ // But we need to use ARCH suffix in pulgin name
+ const QString pluginName("theplugin_" ANDROID_ARCH SUFFIX);
+#else
// Windows binaries run from release and debug subdirs, so we can't rely on the current dir.
const QString binDir = QFINDTESTDATA("bin");
QVERIFY(!binDir.isEmpty());
QCoreApplication::addLibraryPath(binDir);
- QPluginLoader loader("theplugin" SUFFIX);
+ const QString pluginName("theplugin" SUFFIX);
+#endif
+ QPluginLoader loader(pluginName);
loader.load(); // not recommended, instance() should do the job.
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
QVERIFY(instance);
@@ -926,13 +928,27 @@ void tst_QPluginLoader::absolutePath()
#if !defined(QT_SHARED)
QSKIP("This test requires Qt to create shared libraries.");
#endif
+#ifdef Q_OS_ANDROID
+ // On Android we need to clear library paths to make sure that the absolute
+ // path works
+ const QStringList libraryPaths = QCoreApplication::libraryPaths();
+ QVERIFY(!libraryPaths.isEmpty());
+ QCoreApplication::setLibraryPaths(QStringList());
+ const QString pluginPath(libraryPaths.first() + "/" PREFIX "theplugin_" ANDROID_ARCH SUFFIX);
+#else
// Windows binaries run from release and debug subdirs, so we can't rely on the current dir.
const QString binDir = QFINDTESTDATA("bin");
QVERIFY(!binDir.isEmpty());
QVERIFY(QDir::isAbsolutePath(binDir));
- QPluginLoader loader(binDir + "/" PREFIX "theplugin" SUFFIX);
+ const QString pluginPath(binDir + "/" PREFIX "theplugin" SUFFIX);
+#endif
+ QPluginLoader loader(pluginPath);
loader.load(); // not recommended, instance() should do the job.
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
+#ifdef Q_OS_ANDROID
+ // Restore library paths
+ QCoreApplication::setLibraryPaths(libraryPaths);
+#endif
QVERIFY(instance);
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
QVERIFY(loader.unload());
diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
index 126d2bb435..07109afabf 100644
--- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
+++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <stdio.h>
#include <QUuid>
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index 599996c142..eb0ce46502 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
index d895fabab9..a1f040fb4f 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtCore/QUuid>
#include <QTest>
diff --git a/tests/auto/corelib/serialization/CMakeLists.txt b/tests/auto/corelib/serialization/CMakeLists.txt
index 576261fcfe..b779ae8106 100644
--- a/tests/auto/corelib/serialization/CMakeLists.txt
+++ b/tests/auto/corelib/serialization/CMakeLists.txt
@@ -12,7 +12,6 @@ endif()
if(TARGET Qt::Network)
add_subdirectory(qtextstream)
endif()
-# QTBUG-87671 # special case
-if(TARGET Qt::Network AND TARGET Qt::Xml AND NOT ANDROID AND NOT INTEGRITY)
+if(TARGET Qt::Network AND TARGET Qt::Xml AND NOT INTEGRITY AND NOT QNX)
add_subdirectory(qxmlstream)
endif()
diff --git a/tests/auto/corelib/serialization/cborlargedatavalidation.cpp b/tests/auto/corelib/serialization/cborlargedatavalidation.cpp
index 9d1eb9a81b..ac1305057c 100644
--- a/tests/auto/corelib/serialization/cborlargedatavalidation.cpp
+++ b/tests/auto/corelib/serialization/cborlargedatavalidation.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Intel Corporation.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** 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-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QTest>
#include <QtEndian>
diff --git a/tests/auto/corelib/serialization/json/CMakeLists.txt b/tests/auto/corelib/serialization/json/CMakeLists.txt
index 9022ed9f3d..01432873f5 100644
--- a/tests/auto/corelib/serialization/json/CMakeLists.txt
+++ b/tests/auto/corelib/serialization/json/CMakeLists.txt
@@ -4,39 +4,24 @@
## tst_json Test:
#####################################################################
+set(json_resource_files
+ "bom.json"
+ "test.json"
+ "test2.json"
+ "test3.json"
+ "simple.duplicates.json"
+ "test.duplicates.json"
+ "test3.duplicates.json"
+)
+
qt_internal_add_test(tst_json
SOURCES
tst_qtjson.cpp
PUBLIC_LIBRARIES
Qt::CorePrivate
+ TESTDATA ${json_resource_files}
)
-## Scopes:
-#####################################################################
-
-#### Keys ignored in scope 2:.:.:json.pro:NOT ANDROID:
-# TESTDATA = "bom.json" "test.json" "test3.json" "test2.json"
-
-if(ANDROID OR INTEGRITY)
- # Resources:
- set(json_resource_files
- "bom.json"
- "test.json"
- "test2.json"
- "test3.json"
- "simple.duplicates.json"
- "test.duplicates.json"
- "test3.duplicates.json"
- )
-
- qt_internal_add_resource(tst_json "json"
- PREFIX
- "/"
- FILES
- ${json_resource_files}
- )
-endif()
-
qt_internal_extend_target(tst_json CONDITION NOT QT_FEATURE_doubleconversion AND NOT QT_FEATURE_system_doubleconversion
DEFINES
QT_NO_DOUBLECONVERSION
diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
index 72dfc4a47d..7e01ca3f98 100644
--- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp
@@ -1,33 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2021 Intel Corporation.
-** 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$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2022 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
+#include <QMap>
+#include <QVariantList>
QT_WARNING_DISABLE_DEPRECATED
@@ -73,6 +50,7 @@ private Q_SLOTS:
void testObjectNestedEmpty();
void testValueRef();
+ void testValueRefComparison();
void testObjectIteration();
void testArrayIteration();
@@ -105,6 +83,7 @@ private Q_SLOTS:
void toJson();
void toJsonSillyNumericValues();
void toJsonLargeNumericValues();
+ void toJsonDenormalValues();
void fromJson();
void fromJsonErrors();
void parseNumbers();
@@ -398,11 +377,14 @@ void tst_QtJson::testNumbers_2()
// Validate the last actual value is min denorm
QVERIFY2(floatValues_1[1074] == 4.9406564584124654417656879286822e-324, QString("Min denorm value is incorrect: %1").arg(floatValues_1[1074]).toLatin1());
- // Validate that every value is half the value before it up to 1
- for (int index = 1074; index > 0; index--) {
- QVERIFY2(floatValues_1[index] != 0, QString("2**- %1 should not be 0").arg(index).toLatin1());
-
- QVERIFY2(floatValues_1[index - 1] == (floatValues_1[index] * 2), QString("Value should be double adjacent value at index %1").arg(index).toLatin1());
+ if constexpr (std::numeric_limits<double>::has_denorm == std::denorm_present) {
+ // Validate that every value is half the value before it up to 1
+ for (int index = 1074; index > 0; index--) {
+ QVERIFY2(floatValues_1[index] != 0, QString("2**- %1 should not be 0").arg(index).toLatin1());
+ QVERIFY2(floatValues_1[index - 1] == (floatValues_1[index] * 2), QString("Value should be double adjacent value at index %1").arg(index).toLatin1());
+ }
+ } else {
+ qInfo("Skipping denormal test as this system's double type lacks support");
}
}
@@ -786,15 +768,20 @@ void tst_QtJson::testValueObject()
void tst_QtJson::testValueArray()
{
QJsonArray array;
+ QJsonArray otherArray = {"wrong value"};
+ QJsonValue value(array);
+ QCOMPARE(value.toArray(), array);
+ QCOMPARE(value.toArray(otherArray), array);
+
array.append(999.);
array.append(QLatin1String("test"));
array.append(true);
-
- QJsonValue value(array);
+ value = array;
// if we don't modify the original JsonArray, toArray()
// on the JsonValue should return the same object (non-detached).
QCOMPARE(value.toArray(), array);
+ QCOMPARE(value.toArray(otherArray), array);
// if we modify the original array, it should detach