summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/io/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/tst_bench_qdir_10000.cpp (renamed from tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp)153
-rw-r--r--tests/benchmarks/corelib/io/qdir/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt2
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt21
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp (renamed from tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp)78
-rw-r--r--tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.qrc (renamed from tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc)0
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp31
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h29
-rw-r--r--tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp (renamed from tests/benchmarks/corelib/io/qdiriterator/main.cpp)157
-rw-r--r--tests/benchmarks/corelib/io/qfile/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qfile/main.cpp707
-rw-r--r--tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp593
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qfileinfo/tst_bench_qfileinfo.cpp (renamed from tests/benchmarks/corelib/io/qfileinfo/main.cpp)55
-rw-r--r--tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qiodevice/tst_bench_qiodevice.cpp (renamed from tests/benchmarks/corelib/io/qiodevice/main.cpp)42
-rw-r--r--tests/benchmarks/corelib/io/qprocess/CMakeLists.txt3
-rw-r--r--tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp19
-rw-r--r--tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp44
-rw-r--r--tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp41
-rw-r--r--tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qtemporaryfile/main.cpp90
-rw-r--r--tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp64
-rw-r--r--tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/io/qtextstream/tst_bench_qtextstream.cpp (renamed from tests/benchmarks/corelib/io/qtextstream/main.cpp)39
-rw-r--r--tests/benchmarks/corelib/io/qurl/CMakeLists.txt14
-rw-r--r--tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp (renamed from tests/benchmarks/corelib/io/qurl/main.cpp)75
-rw-r--r--tests/benchmarks/corelib/itemmodels/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp (renamed from tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp)47
-rw-r--r--tests/benchmarks/corelib/json/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/json/tst_bench_qtjson.cpp30
-rw-r--r--tests/benchmarks/corelib/kernel/CMakeLists.txt4
-rw-r--r--tests/benchmarks/corelib/kernel/events/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/events/tst_bench_events.cpp (renamed from tests/benchmarks/corelib/kernel/events/main.cpp)32
-rw-r--r--tests/benchmarks/corelib/kernel/qcoreapplication/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qcoreapplication/main.cpp69
-rw-r--r--tests/benchmarks/corelib/kernel/qcoreapplication/tst_bench_qcoreapplication.cpp70
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaenum/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaenum/tst_bench_qmetaenum.cpp55
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp (renamed from tests/benchmarks/corelib/kernel/qmetaobject/main.cpp)68
-rw-r--r--tests/benchmarks/corelib/kernel/qmetatype/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qmetatype/tst_bench_qmetatype.cpp (renamed from tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp)31
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/object.cpp29
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/object.h29
-rw-r--r--tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp (renamed from tests/benchmarks/corelib/kernel/qobject/main.cpp)57
-rw-r--r--tests/benchmarks/corelib/kernel/qproperty/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/kernel/qproperty/propertytester.h29
-rw-r--r--tests/benchmarks/corelib/kernel/qproperty/tst_bench_qproperty.cpp (renamed from tests/benchmarks/corelib/kernel/qproperty/main.cpp)60
-rw-r--r--tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp33
-rw-r--r--tests/benchmarks/corelib/kernel/qvariant/CMakeLists.txt14
-rw-r--r--tests/benchmarks/corelib/kernel/qvariant/tst_bench_qvariant.cpp (renamed from tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp)99
-rw-r--r--tests/benchmarks/corelib/kernel/qwineventnotifier/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/kernel/qwineventnotifier/tst_bench_qwineventnotifier.cpp (renamed from tests/benchmarks/corelib/kernel/qwineventnotifier/main.cpp)39
-rw-r--r--tests/benchmarks/corelib/mimetypes/CMakeLists.txt3
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/N.tar.gzbin0 -> 115 bytes
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/X1
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/t.c1
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/u.txt4
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/y1
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/files/zbin0 -> 132 bytes
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp86
-rw-r--r--tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp146
-rw-r--r--tests/benchmarks/corelib/plugin/CMakeLists.txt3
-rw-r--r--tests/benchmarks/corelib/plugin/quuid/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp (renamed from tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp)84
-rw-r--r--tests/benchmarks/corelib/serialization/CMakeLists.txt4
-rw-r--r--tests/benchmarks/corelib/serialization/qcborvalue/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/serialization/qcborvalue/tst_bench_qcborvalue.cpp95
-rw-r--r--tests/benchmarks/corelib/text/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/text/qbytearray/tst_bench_qbytearray.cpp (renamed from tests/benchmarks/corelib/text/qbytearray/main.cpp)211
-rw-r--r--tests/benchmarks/corelib/text/qchar/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/text/qchar/tst_bench_qchar.cpp (renamed from tests/benchmarks/corelib/text/qchar/main.cpp)31
-rw-r--r--tests/benchmarks/corelib/text/qlocale/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp (renamed from tests/benchmarks/corelib/text/qlocale/main.cpp)252
-rw-r--r--tests/benchmarks/corelib/text/qregularexpression/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/text/qregularexpression/tst_bench_qregularexpression.cpp29
-rw-r--r--tests/benchmarks/corelib/text/qstring/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/text/qstring/main.cpp192
-rw-r--r--tests/benchmarks/corelib/text/qstring/tst_bench_qstring.cpp510
-rw-r--r--tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/text/qstringbuilder/tst_bench_qstringbuilder.cpp (renamed from tests/benchmarks/corelib/text/qstringbuilder/main.cpp)39
-rw-r--r--tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/text/qstringlist/tst_bench_qstringlist.cpp (renamed from tests/benchmarks/corelib/text/qstringlist/main.cpp)93
-rw-r--r--tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/text/qstringtokenizer/tst_bench_qstringtokenizer.cpp (renamed from tests/benchmarks/corelib/text/qstringtokenizer/main.cpp)31
-rw-r--r--tests/benchmarks/corelib/text/qutf8stringview/CMakeLists.txt14
-rw-r--r--tests/benchmarks/corelib/text/qutf8stringview/tst_bench_qutf8stringview.cpp263
-rw-r--r--tests/benchmarks/corelib/thread/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/thread/qfuture/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp (renamed from tests/benchmarks/corelib/thread/qfuture/tst_qfuture.cpp)51
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp (renamed from tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp)83
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/thread/qreadwritelock/tst_bench_qreadwritelock.cpp (renamed from tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp)99
-rw-r--r--tests/benchmarks/corelib/thread/qthreadpool/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/thread/qthreadpool/tst_bench_qthreadpool.cpp55
-rw-r--r--tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp79
-rw-r--r--tests/benchmarks/corelib/thread/qthreadstorage/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/thread/qthreadstorage/tst_bench_qthreadstorage.cpp85
-rw-r--r--tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp109
-rw-r--r--tests/benchmarks/corelib/thread/qwaitcondition/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/thread/qwaitcondition/tst_bench_qwaitcondition.cpp174
-rw-r--r--tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp129
-rw-r--r--tests/benchmarks/corelib/time/CMakeLists.txt3
-rw-r--r--tests/benchmarks/corelib/time/qdate/CMakeLists.txt5
-rw-r--r--tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp56
-rw-r--r--tests/benchmarks/corelib/time/qdatetime/CMakeLists.txt8
-rw-r--r--tests/benchmarks/corelib/time/qdatetime/tst_bench_qdatetime.cpp (renamed from tests/benchmarks/corelib/time/qdatetime/main.cpp)195
-rw-r--r--tests/benchmarks/corelib/time/qtimezone/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/time/qtimezone/tst_bench_qtimezone.cpp (renamed from tests/benchmarks/corelib/time/qtimezone/main.cpp)79
-rw-r--r--tests/benchmarks/corelib/tools/CMakeLists.txt6
-rw-r--r--tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt14
-rw-r--r--tests/benchmarks/corelib/tools/containers-associative/tst_bench_containers_associative.cpp (renamed from tests/benchmarks/corelib/tools/containers-associative/main.cpp)34
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt12
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/tst_bench_containers_sequential.cpp (renamed from tests/benchmarks/corelib/tools/containers-sequential/main.cpp)36
-rw-r--r--tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/tools/qcontiguouscache/tst_bench_qcontiguouscache.cpp (renamed from tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp)35
-rw-r--r--tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/tools/qcryptographichash/main.cpp188
-rw-r--r--tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp223
-rw-r--r--tests/benchmarks/corelib/tools/qhash/CMakeLists.txt13
-rw-r--r--tests/benchmarks/corelib/tools/qhash/main.h61
-rw-r--r--tests/benchmarks/corelib/tools/qhash/outofline.cpp47
-rw-r--r--tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp (renamed from tests/benchmarks/corelib/tools/qhash/main.cpp)90
-rw-r--r--tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h48
-rw-r--r--tests/benchmarks/corelib/tools/qlist/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/tools/qlist/tst_bench_qlist.cpp (renamed from tests/benchmarks/corelib/tools/qlist/main.cpp)241
-rw-r--r--tests/benchmarks/corelib/tools/qmap/CMakeLists.txt7
-rw-r--r--tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp (renamed from tests/benchmarks/corelib/tools/qmap/main.cpp)149
-rw-r--r--tests/benchmarks/corelib/tools/qrect/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp (renamed from tests/benchmarks/corelib/tools/qrect/main.cpp)77
-rw-r--r--tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt10
-rw-r--r--tests/benchmarks/corelib/tools/qringbuffer/main.cpp71
-rw-r--r--tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp46
-rw-r--r--tests/benchmarks/corelib/tools/qset/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/tools/qset/tst_bench_qset.cpp (renamed from tests/benchmarks/corelib/tools/qset/main.cpp)105
-rw-r--r--tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt12
-rw-r--r--tests/benchmarks/corelib/tools/qsharedpointer/tst_bench_shared_ptr.cpp111
-rw-r--r--tests/benchmarks/corelib/tools/qstack/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/tools/qstack/main.cpp84
-rw-r--r--tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp59
-rw-r--r--tests/benchmarks/corelib/tools/qvector/CMakeLists.txt11
-rw-r--r--tests/benchmarks/corelib/tools/qvector/main.cpp414
-rw-r--r--tests/benchmarks/corelib/tools/qvector/outofline.cpp55
-rw-r--r--tests/benchmarks/corelib/tools/qvector/qrawvector.h40
-rw-r--r--tests/benchmarks/corelib/tools/qvector/tst_bench_qvector.cpp228
-rw-r--r--tests/benchmarks/dbus/CMakeLists.txt3
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/CMakeLists.txt3
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt9
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/server/server.cpp29
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/serverobject.h29
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/test/CMakeLists.txt5
-rw-r--r--tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp31
-rw-r--r--tests/benchmarks/dbus/qdbustype/CMakeLists.txt7
-rw-r--r--tests/benchmarks/dbus/qdbustype/main.cpp29
-rw-r--r--tests/benchmarks/gui/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/animation/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/animation/qanimation/CMakeLists.txt5
-rw-r--r--tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/dummyanimation.h29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/dummyobject.cpp29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/dummyobject.h29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/main.cpp29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/rectanimation.cpp29
-rw-r--r--tests/benchmarks/gui/animation/qanimation/rectanimation.h29
-rw-r--r--tests/benchmarks/gui/image/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/image/blendbench/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/image/blendbench/main.cpp29
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/CMakeLists.txt9
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp29
-rw-r--r--tests/benchmarks/gui/image/qimagereader/CMakeLists.txt13
-rw-r--r--tests/benchmarks/gui/image/qimagereader/tst_bench_qimagereader.cpp (renamed from tests/benchmarks/gui/image/qimagereader/tst_qimagereader.cpp)91
-rw-r--r--tests/benchmarks/gui/image/qimagescale/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/image/qimagescale/tst_qimagescale.cpp29
-rw-r--r--tests/benchmarks/gui/image/qpixmap/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp29
-rw-r--r--tests/benchmarks/gui/image/qpixmapcache/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp29
-rw-r--r--tests/benchmarks/gui/kernel/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/kernel/qguimetatype/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp29
-rw-r--r--tests/benchmarks/gui/kernel/qguivariant/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp29
-rw-r--r--tests/benchmarks/gui/math3d/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/math3d/qmatrix4x4/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp29
-rw-r--r--tests/benchmarks/gui/math3d/qquaternion/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp29
-rw-r--r--tests/benchmarks/gui/painting/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/painting/drawtexture/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/drawtexture/tst_drawtexture.cpp29
-rw-r--r--tests/benchmarks/gui/painting/lancebench/CMakeLists.txt20
-rw-r--r--tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp41
-rw-r--r--tests/benchmarks/gui/painting/qcolor/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp29
-rw-r--r--tests/benchmarks/gui/painting/qpainter/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp86
-rw-r--r--tests/benchmarks/gui/painting/qregion/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qregion/main.cpp29
-rw-r--r--tests/benchmarks/gui/painting/qtbench/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qtbench/benchmarktests.h35
-rw-r--r--tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp36
-rw-r--r--tests/benchmarks/gui/painting/qtransform/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp71
-rw-r--r--tests/benchmarks/gui/text/CMakeLists.txt3
-rw-r--r--tests/benchmarks/gui/text/qfontmetrics/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/text/qfontmetrics/main.cpp29
-rw-r--r--tests/benchmarks/gui/text/qtext/CMakeLists.txt9
-rw-r--r--tests/benchmarks/gui/text/qtext/main.cpp43
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/CMakeLists.txt8
-rw-r--r--tests/benchmarks/gui/text/qtextdocument/main.cpp29
-rw-r--r--tests/benchmarks/network/CMakeLists.txt5
-rw-r--r--tests/benchmarks/network/access/CMakeLists.txt10
-rw-r--r--tests/benchmarks/network/access/qdecompresshelper/CMakeLists.txt11
-rw-r--r--tests/benchmarks/network/access/qdecompresshelper/main.cpp32
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp29
-rw-r--r--tests/benchmarks/network/access/qhttpheaders/CMakeLists.txt10
-rw-r--r--tests/benchmarks/network/access/qhttpheaders/tst_bench_qhttpheaders.cpp266
-rw-r--r--tests/benchmarks/network/access/qnetworkdiskcache/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp29
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp57
-rw-r--r--tests/benchmarks/network/access/qnetworkreply_from_cache/CMakeLists.txt5
-rw-r--r--tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp29
-rw-r--r--tests/benchmarks/network/kernel/CMakeLists.txt3
-rw-r--r--tests/benchmarks/network/kernel/qhostinfo/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/kernel/qhostinfo/main.cpp29
-rw-r--r--tests/benchmarks/network/socket/CMakeLists.txt13
-rw-r--r--tests/benchmarks/network/socket/qlocalsocket/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp75
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp29
-rw-r--r--tests/benchmarks/network/socket/qudpsocket/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/socket/qudpsocket/tst_qudpsocket.cpp29
-rw-r--r--tests/benchmarks/network/ssl/CMakeLists.txt3
-rw-r--r--tests/benchmarks/network/ssl/qsslsocket/CMakeLists.txt8
-rw-r--r--tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp29
-rw-r--r--tests/benchmarks/plugins/imageformats/jpeg/CMakeLists.txt9
-rw-r--r--tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp29
-rw-r--r--tests/benchmarks/sql/CMakeLists.txt3
-rw-r--r--tests/benchmarks/sql/kernel/CMakeLists.txt3
-rw-r--r--tests/benchmarks/sql/kernel/qsqlquery/CMakeLists.txt5
-rw-r--r--tests/benchmarks/sql/kernel/qsqlquery/main.cpp216
-rw-r--r--tests/benchmarks/sql/kernel/qsqlrecord/CMakeLists.txt7
-rw-r--r--tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp110
-rw-r--r--tests/benchmarks/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp224
-rw-r--r--tests/benchmarks/testlib/CMakeLists.txt3
-rw-r--r--tests/benchmarks/testlib/tostring/CMakeLists.txt5
-rw-r--r--tests/benchmarks/testlib/tostring/tst_tostring.cpp86
-rw-r--r--tests/benchmarks/widgets/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/graphicsview/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/CMakeLists.txt1
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/CMakeLists.txt11
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc85
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp74
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp33
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp31
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsitem/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp59
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslayout/CMakeLists.txt6
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp31
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsscene/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/CMakeLists.txt11
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/CMakeLists.txt14
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.debugbin863805 -> 0 bytes
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/CMakeLists.txt5
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/CMakeLists.txt5
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp31
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.cpp32
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.h29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/qgraphicsview.qrc9
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp29
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicswidget/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp29
-rw-r--r--tests/benchmarks/widgets/itemviews/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp29
-rw-r--r--tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp29
-rw-r--r--tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp45
-rw-r--r--tests/benchmarks/widgets/kernel/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/kernel/qapplication/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/kernel/qapplication/main.cpp29
-rw-r--r--tests/benchmarks/widgets/kernel/qwidget/CMakeLists.txt5
-rw-r--r--tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp31
-rw-r--r--tests/benchmarks/widgets/styles/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/styles/qstylesheetstyle/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/styles/qstylesheetstyle/main.cpp29
-rw-r--r--tests/benchmarks/widgets/widgets/CMakeLists.txt3
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/CMakeLists.txt8
-rw-r--r--tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp29
382 files changed, 5896 insertions, 9242 deletions
diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt
index a59ba35e50..f967392ecb 100644
--- a/tests/benchmarks/CMakeLists.txt
+++ b/tests/benchmarks/CMakeLists.txt
@@ -1,7 +1,7 @@
-# Generated from benchmarks.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(corelib)
-add_subdirectory(sql)
if(TARGET Qt::DBus)
add_subdirectory(dbus)
endif()
@@ -11,6 +11,9 @@ endif()
if(TARGET Qt::Network)
add_subdirectory(network)
endif()
+if(TARGET Qt::Sql)
+ add_subdirectory(sql)
+endif()
if(TARGET Qt::Test)
add_subdirectory(testlib)
endif()
diff --git a/tests/benchmarks/corelib/CMakeLists.txt b/tests/benchmarks/corelib/CMakeLists.txt
index ff30862180..890cbcfc6b 100644
--- a/tests/benchmarks/corelib/CMakeLists.txt
+++ b/tests/benchmarks/corelib/CMakeLists.txt
@@ -1,12 +1,16 @@
-# Generated from corelib.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(io)
add_subdirectory(itemmodels)
add_subdirectory(json)
-add_subdirectory(mimetypes)
+if(QT_FEATURE_mimetype)
+ add_subdirectory(mimetypes)
+endif()
add_subdirectory(kernel)
add_subdirectory(text)
add_subdirectory(thread)
add_subdirectory(time)
add_subdirectory(tools)
add_subdirectory(plugin)
+add_subdirectory(serialization)
diff --git a/tests/benchmarks/corelib/io/CMakeLists.txt b/tests/benchmarks/corelib/io/CMakeLists.txt
index 3419c4a28c..e9bf2292c0 100644
--- a/tests/benchmarks/corelib/io/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/CMakeLists.txt
@@ -1,12 +1,14 @@
-# Generated from io.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qdir)
add_subdirectory(qdiriterator)
add_subdirectory(qfile)
add_subdirectory(qfileinfo)
add_subdirectory(qiodevice)
-add_subdirectory(qtemporaryfile)
-add_subdirectory(qtextstream)
if(QT_FEATURE_process)
add_subdirectory(qprocess)
endif()
+add_subdirectory(qtemporaryfile)
+add_subdirectory(qtextstream)
+add_subdirectory(qurl)
diff --git a/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt
index e83c4e9acc..142c13aceb 100644
--- a/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from 10000.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qdir_10000 Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qdir_10000
SOURCES
- bench_qdir_10000.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qdir_10000.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:10000.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/tst_bench_qdir_10000.cpp
index 3184df0d7b..a53742b536 100644
--- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp
+++ b/tests/benchmarks/corelib/io/qdir/10000/tst_bench_qdir_10000.cpp
@@ -1,36 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <QTest>
#include <QDirIterator>
#ifdef Q_OS_WIN
-# include <windows.h>
+# include <qt_windows.h>
#else
# include <sys/stat.h>
# include <sys/types.h>
@@ -38,10 +15,12 @@
# include <unistd.h>
#endif
-class bench_QDir_10000 : public QObject{
- Q_OBJECT
+class tst_QDir_10000 : public QObject
+{
+ Q_OBJECT
public slots:
- void initTestCase() {
+ void initTestCase()
+ {
QDir testdir = QDir::tempPath();
const QString subfolder_name = QLatin1String("test_speed");
@@ -53,24 +32,16 @@ public slots:
file.open(QIODevice::WriteOnly);
}
}
- void cleanupTestCase() {
- {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
- testdir.setSorting(QDir::Unsorted);
- testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
- foreach (const QString &filename, testdir.entryList()) {
- testdir.remove(filename);
- }
- }
- const QDir temp = QDir(QDir::tempPath());
- temp.rmdir(QLatin1String("test_speed"));
+ void cleanupTestCase()
+ {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ QVERIFY(testdir.removeRecursively());
}
private slots:
- void baseline() {}
-
- void sizeSpeed() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ void sizeSpeed()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QFileInfoList fileInfoList = testdir.entryInfoList(QDir::Files, QDir::Unsorted);
foreach (const QFileInfo &fileInfo, fileInfoList) {
fileInfo.isDir();
@@ -78,43 +49,47 @@ private slots:
}
}
}
- void sizeSpeedIterator() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ void sizeSpeedIterator()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QDirIterator dit(testdir.path(), QDir::Files);
while (dit.hasNext()) {
- dit.next();
- dit.fileInfo().isDir();
- dit.fileInfo().size();
+ const auto fi = dit.nextFileInfo();
+ (void)fi.isDir();
+ (void)fi.size();
}
}
}
- void sizeSpeedWithoutFilter() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ void sizeSpeedWithoutFilter()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QFileInfoList fileInfoList = testdir.entryInfoList(QDir::NoFilter, QDir::Unsorted);
foreach (const QFileInfo &fileInfo, fileInfoList) {
fileInfo.size();
}
}
}
- void sizeSpeedWithoutFilterIterator() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ void sizeSpeedWithoutFilterIterator()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QDirIterator dit(testdir.path());
while (dit.hasNext()) {
- dit.next();
- dit.fileInfo().isDir();
- dit.fileInfo().size();
+ const auto fi = dit.nextFileInfo();
+ (void)fi.isDir();
+ (void)fi.size();
}
}
}
- void sizeSpeedWithoutFileInfoList() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
- testdir.setSorting(QDir::Unsorted);
+ void sizeSpeedWithoutFileInfoList()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ testdir.setSorting(QDir::Unsorted);
QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted);
foreach (const QString &filename, fileList) {
QFileInfo fileInfo(filename);
@@ -123,18 +98,20 @@ private slots:
}
}
- void iDontWantAnyStat() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
- testdir.setSorting(QDir::Unsorted);
- testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
+ void iDontWantAnyStat()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ testdir.setSorting(QDir::Unsorted);
+ testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Unsorted);
foreach (const QString &filename, fileList) {
Q_UNUSED(filename);
}
}
}
- void iDontWantAnyStatIterator() {
+ void iDontWantAnyStatIterator()
+ {
QBENCHMARK {
QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed"));
while (dit.hasNext()) {
@@ -143,11 +120,12 @@ private slots:
}
}
- void sorted_byTime() {
- QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
- testdir.setSorting(QDir::Time);
- testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
+ void sorted_byTime()
+ {
QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ testdir.setSorting(QDir::Time);
+ testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
QStringList fileList = testdir.entryList(QDir::NoFilter, QDir::Time);
foreach (const QString &filename, fileList) {
Q_UNUSED(filename);
@@ -155,7 +133,17 @@ private slots:
}
}
- void sizeSpeedWithoutFilterLowLevel() {
+ void sorted_byName()
+ {
+ QBENCHMARK {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
+ [[maybe_unused]] auto r = testdir.entryInfoList(QDir::NoFilter, QDir::Name);
+ }
+ }
+
+ void sizeSpeedWithoutFilterLowLevel()
+ {
QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
#ifdef Q_OS_WIN
const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16();
@@ -163,22 +151,22 @@ private slots:
wcscpy(appendedPath, dirpath);
wcscat(appendedPath, L"\\*");
- WIN32_FIND_DATA fd;
- HANDLE hSearch = FindFirstFileW(appendedPath, &fd);
- QVERIFY(hSearch != INVALID_HANDLE_VALUE);
-
QBENCHMARK {
+ WIN32_FIND_DATA fd;
+ HANDLE hSearch = FindFirstFileW(appendedPath, &fd);
+ QVERIFY(hSearch != INVALID_HANDLE_VALUE);
+
do {
} while (FindNextFile(hSearch, &fd));
+ FindClose(hSearch);
}
- FindClose(hSearch);
#else
- DIR *dir = opendir(qPrintable(testdir.absolutePath()));
- QVERIFY(dir);
-
QVERIFY(!chdir(qPrintable(testdir.absolutePath())));
QBENCHMARK {
+ DIR *dir = opendir(qPrintable(testdir.absolutePath()));
+ QVERIFY(dir);
+
struct dirent *item = readdir(dir);
while (item) {
char *fileName = item->d_name;
@@ -188,11 +176,12 @@ private slots:
item = readdir(dir);
}
+ closedir(dir);
}
- closedir(dir);
#endif
}
};
-QTEST_MAIN(bench_QDir_10000)
-#include "bench_qdir_10000.moc"
+QTEST_MAIN(tst_QDir_10000)
+
+#include "tst_bench_qdir_10000.moc"
diff --git a/tests/benchmarks/corelib/io/qdir/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/CMakeLists.txt
index 10185014fa..00991de9a9 100644
--- a/tests/benchmarks/corelib/io/qdir/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qdir/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from qdir.pro.
-
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(10000)
+add_subdirectory(tree)
diff --git a/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt b/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt
index ee5f7eabc1..6f1a208fe0 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt
+++ b/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt
@@ -7983,8 +7983,6 @@
qeventloop.cpp
qeventloop.h
qfunctions_p.h
- qfunctions_vxworks.cpp
- qfunctions_vxworks.h
qfunctions_wince.cpp
qfunctions_wince.h
qguard_p.h
diff --git a/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt
index c60bfcfdc3..f60c108480 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt
@@ -1,28 +1,25 @@
-# Generated from tree.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## bench_qdir_tree Binary:
+## tst_bench_qdir_tree Binary:
#####################################################################
-qt_internal_add_benchmark(bench_qdir_tree
+qt_internal_add_benchmark(tst_bench_qdir_tree
SOURCES
- bench_qdir_tree.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qdir_tree.cpp
+ LIBRARIES
Qt::Test
)
# Resources:
-set(bench_qdir_tree_resource_files
+set(qdir_tree_resource_files
"4.6.0-list.txt"
)
-qt_internal_add_resource(bench_qdir_tree "bench_qdir_tree"
+qt_internal_add_resource(tst_bench_qdir_tree "tst_bench_qdir_tree"
PREFIX
"/"
FILES
- ${bench_qdir_tree_resource_files}
+ ${qdir_tree_resource_files}
)
-
-
-#### Keys ignored in scope 1:.:.:tree.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp
index 0abf8769a6..4f122c876c 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp
+++ b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.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 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QTest>
@@ -35,14 +10,14 @@
#include "../../../../../shared/filesystem.h"
-class bench_QDir_tree
+class tst_QDir_tree
: public QObject
{
Q_OBJECT
public:
- bench_QDir_tree()
- : prefix("./test-tree/"),
+ tst_QDir_tree()
+ : prefix("test-tree/"),
musicprefix(QLatin1String("music")),
photoprefix(QLatin1String("photos")),
sourceprefix(QLatin1String("source")),
@@ -60,6 +35,7 @@ private:
qint64 musicsize;
qint64 photosize;
qint64 sourcesize;
+ FileSystem fs; // Uses QTemporaryDir to tidy away file tree created.
private slots:
void initTestCase()
@@ -71,7 +47,7 @@ private slots:
QStack<QByteArray> stack;
QByteArray line;
- Q_FOREVER {
+ while (true) {
char ch;
if (!list.getChar(&ch))
break;
@@ -89,12 +65,11 @@ private slots:
--pop;
}
- line = list.readLine();
- line.chop(1);
+ line = list.readLine().trimmed();
stack.push(line);
line = prefix;
- Q_FOREACH(const QByteArray &pathElement, stack)
+ for (const QByteArray &pathElement : std::as_const(stack))
line += pathElement;
if (line.endsWith('/'))
@@ -140,13 +115,11 @@ private slots:
QTest::addColumn<int>("filter");
QTest::addColumn<int>("entryCount");
- QTest::newRow("*.cpp") << QStringList("*.cpp")
- << int(QDir::Files)
- << 3813;
-
- QTest::newRow("executables") << QStringList("*")
+ QTest::newRow("*.cpp") << QStringList("*.cpp") << int(QDir::Files) << 3791;
+ QTest::newRow("executables")
+ << QStringList("*")
<< int(QDir::Executable | QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot)
- << 543;
+ << 536;
}
void fileSearch() const
@@ -158,8 +131,9 @@ private slots:
int count = 0;
QBENCHMARK {
// Recursive directory iteration
- QDirIterator iterator(prefix, nameFilters, QDir::Filter(filter),
- QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+ QDirIterator iterator(fs.absoluteFilePath(prefix),
+ nameFilters, QDir::Filter(filter),
+ QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
count = 0;
while (iterator.hasNext()) {
@@ -177,7 +151,8 @@ private slots:
{
int count = 0;
QBENCHMARK {
- QDirIterator iterator(prefix,
+ QDirIterator iterator(
+ fs.absoluteFilePath(prefix),
QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System,
QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
@@ -187,10 +162,10 @@ private slots:
++count;
}
- QCOMPARE(count, 11963);
+ QCOMPARE(count, 11906);
}
- QCOMPARE(count, 11963);
+ QCOMPARE(count, 11906);
}
void thousandFiles_data() const
@@ -209,19 +184,18 @@ private slots:
QBENCHMARK {
qint64 totalsize = 0;
int count = 0;
- QDirIterator iter(dirName, QDir::Files, QDirIterator::Subdirectories);
+ QDirIterator iter(fs.absoluteFilePath(dirName),
+ QDir::Files, QDirIterator::Subdirectories);
while(iter.hasNext()) {
- iter.next();
count++;
- totalsize += iter.fileInfo().size();
+ totalsize += iter.nextFileInfo().size();
}
QCOMPARE(count, 1000);
QCOMPARE(totalsize, expectedSize);
}
}
-private:
- FileSystem fs;
};
-QTEST_MAIN(bench_QDir_tree)
-#include "bench_qdir_tree.moc"
+QTEST_MAIN(tst_QDir_tree)
+
+#include "tst_bench_qdir_tree.moc"
diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.qrc
index d57cb6c368..d57cb6c368 100644
--- a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc
+++ b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.qrc
diff --git a/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt b/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt
index 8ba331a113..6a4579d35d 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdiriterator.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qdiriterator Binary:
@@ -6,9 +7,9 @@
qt_internal_add_benchmark(tst_bench_qdiriterator
SOURCES
- main.cpp
+ tst_bench_qdiriterator.cpp
qfilesystemiterator.cpp qfilesystemiterator.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
index 10b1b90ce2..16b64cf362 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.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
/*!
\since 4.5
@@ -85,7 +60,7 @@
#include <qplatformdefs.h>
#ifdef Q_OS_WIN
-# include <windows.h>
+# include <qt_windows.h>
#else
# include <sys/stat.h>
# include <sys/types.h>
diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h
index 26bd2f59d9..479ce7b392 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.h
+++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.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
#ifndef QFILESYSTEMITERATOR_H
#define QFILESYSTEMITERATOR_H
diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp
index 367913338f..66448bf838 100644
--- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp
+++ b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QDirIterator>
+#include <QDirListing>
#include <QString>
#include <qplatformdefs.h>
@@ -48,40 +24,52 @@
#include <filesystem>
#endif
-class tst_qdiriterator : public QObject
+using namespace Qt::StringLiterals;
+
+constexpr bool forceStat = false;
+
+class tst_QDirIterator : public QObject
{
Q_OBJECT
void data();
+
+ const QDir::Filters dirFilters =
+ // QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot
+ QDir::AllEntries | QDir::Hidden
+ //QDir::Files | QDir::NoDotAndDotDot,
+ // QDir::Files,
+ ;
+
private slots:
void posix();
void posix_data() { data(); }
void diriterator();
void diriterator_data() { data(); }
+ void dirlisting();
+ void dirlisting_data() { data(); }
void fsiterator();
void fsiterator_data() { data(); }
void stdRecursiveDirectoryIterator();
void stdRecursiveDirectoryIterator_data() { data(); }
};
-
-void tst_qdiriterator::data()
+void tst_QDirIterator::data()
{
-#if defined(Q_OS_WIN)
- const char *qtdir = "C:\\depot\\qt\\main";
-#else
- const char *qtdir = ::getenv("QTDIR");
-#endif
- if (!qtdir) {
- fprintf(stderr, "QTDIR not set\n");
- exit(1);
- }
+ const char hereRelative[] = "tests/benchmarks/corelib/io/qdiriterator";
+ QByteArray dir(QT_TESTCASE_SOURCEDIR);
+ // qDebug("Source dir: %s", dir.constData());
+ dir.chop(sizeof(hereRelative)); // Counts the '\0', making up for the omitted leading '/'
+ // qDebug("Root dir: %s", dir.constData());
QTest::addColumn<QByteArray>("dirpath");
- QByteArray ba = QByteArray(qtdir) + "/src/corelib";
- QByteArray ba1 = ba + "/io";
- QTest::newRow(ba) << ba;
- //QTest::newRow(ba1) << ba1;
+ const QByteArray ba = dir + "/src/corelib";
+
+ if (!QFileInfo(QString::fromLocal8Bit(ba)).isDir())
+ QSKIP("Missing Qt directory");
+
+ QTest::newRow("corelib") << ba;
+ QTest::newRow("corelib/io") << (ba + "/io");
}
#ifdef Q_OS_WIN
@@ -145,9 +133,20 @@ static int posix_helper(const char *dirpath)
QByteArray ba = dirpath;
ba += '/';
ba += entry->d_name;
+ bool isDir = false;
+#if defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
+ isDir = entry->d_type == DT_DIR;
+ if (forceStat) {
+ QT_STATBUF st;
+ QT_LSTAT(ba.constData(), &st);
+ }
+#else // d_type not available >>> must stat() to see if it's a dir
QT_STATBUF st;
QT_LSTAT(ba.constData(), &st);
- if (S_ISDIR(st.st_mode))
+ isDir = S_ISDIR(st.st_mode);
+#endif
+
+ if (isDir)
count += posix_helper(ba.constData());
}
@@ -157,7 +156,7 @@ static int posix_helper(const char *dirpath)
#endif
-void tst_qdiriterator::posix()
+void tst_QDirIterator::posix()
{
QFETCH(QByteArray, dirpath);
@@ -175,7 +174,7 @@ void tst_qdiriterator::posix()
qDebug() << count;
}
-void tst_qdiriterator::diriterator()
+void tst_QDirIterator::diriterator()
{
QFETCH(QByteArray, dirpath);
@@ -184,20 +183,40 @@ void tst_qdiriterator::diriterator()
QBENCHMARK {
int c = 0;
- QDirIterator dir(dirpath,
- //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot,
- //QDir::AllEntries | QDir::Hidden,
- QDir::Files,
- QDirIterator::Subdirectories);
+ QDirIterator dir(dirpath, dirFilters, QDirIterator::Subdirectories);
while (dir.hasNext()) {
- dir.next();
+ const auto fi = dir.nextFileInfo();
+ if (forceStat)
+ fi.size();
//printf("%s\n", qPrintable(dir.fileName()));
0 && printf("%d %s\n",
- dir.fileInfo().isDir(),
- //qPrintable(dir.fileInfo().absoluteFilePath()),
+ fi.isDir(),
+ //qPrintable(fi.absoluteFilePath()),
//qPrintable(dir.path()),
- qPrintable(dir.filePath()));
+ qPrintable(fi.filePath()));
+ ++c;
+ }
+ count = c;
+ }
+ qDebug() << count;
+}
+
+void tst_QDirIterator::dirlisting()
+{
+ QFETCH(QByteArray, dirpath);
+
+ int count = 0;
+
+ QBENCHMARK {
+ int c = 0;
+
+ QDirListing dir(dirpath, dirFilters, QDirListing::IteratorFlag::Recursive);
+
+ for (const auto &dirEntry : dir) {
+ const auto path = dirEntry.filePath();
+ if (forceStat)
+ dirEntry.size();
++c;
}
count = c;
@@ -205,7 +224,7 @@ void tst_qdiriterator::diriterator()
qDebug() << count;
}
-void tst_qdiriterator::fsiterator()
+void tst_QDirIterator::fsiterator()
{
QFETCH(QByteArray, dirpath);
@@ -216,14 +235,12 @@ void tst_qdiriterator::fsiterator()
int c = 0;
dump && printf("\n\n\n\n");
- QDirIteratorTest::QFileSystemIterator dir(dirpath,
- //QDir::AllEntries | QDir::Hidden | QDir::NoDotAndDotDot,
- //QDir::AllEntries | QDir::Hidden,
- //QDir::Files | QDir::NoDotAndDotDot,
- QDir::Files,
- QDirIteratorTest::QFileSystemIterator::Subdirectories);
+ QDirIteratorTest::QFileSystemIterator dir(
+ dirpath, dirFilters, QDirIteratorTest::QFileSystemIterator::Subdirectories);
for (; !dir.atEnd(); dir.next()) {
+ if (forceStat)
+ dir.fileInfo().size();
dump && printf("%d %s\n",
dir.fileInfo().isDir(),
//qPrintable(dir.fileInfo().absoluteFilePath()),
@@ -237,17 +254,23 @@ void tst_qdiriterator::fsiterator()
qDebug() << count;
}
-void tst_qdiriterator::stdRecursiveDirectoryIterator()
+void tst_QDirIterator::stdRecursiveDirectoryIterator()
{
#if QT_CONFIG(cxx17_filesystem)
QFETCH(QByteArray, dirpath);
int count = 0;
+ namespace fs = std::filesystem;
+ std::error_code ec;
+
+ // Note that fs::recursive_directory_iterator may be calling stat() internally,
+ // that depends on the implementation. So the benchmark times might "seem" higher
+ // than the other methods in this source file.
QBENCHMARK {
int c = 0;
- for (auto obj : std::filesystem::recursive_directory_iterator(dirpath.data())) {
- if (obj.is_directory())
+ for (const auto &dirEntry : fs::recursive_directory_iterator(dirpath.data(), ec)) {
+ if (dirEntry.is_directory())
continue;
c++;
}
@@ -259,6 +282,6 @@ void tst_qdiriterator::stdRecursiveDirectoryIterator()
#endif
}
-QTEST_MAIN(tst_qdiriterator)
+QTEST_MAIN(tst_QDirIterator)
-#include "main.moc"
+#include "tst_bench_qdiriterator.moc"
diff --git a/tests/benchmarks/corelib/io/qfile/CMakeLists.txt b/tests/benchmarks/corelib/io/qfile/CMakeLists.txt
index 6ae5029a8a..0cd6b5fb16 100644
--- a/tests/benchmarks/corelib/io/qfile/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qfile/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qfile.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qfile Binary:
@@ -6,15 +7,12 @@
qt_internal_add_benchmark(tst_bench_qfile
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qfile.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
-#### Keys ignored in scope 1:.:.:qfile.pro:<TRUE>:
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp
deleted file mode 100644
index 73b3ba8c48..0000000000
--- a/tests/benchmarks/corelib/io/qfile/main.cpp
+++ /dev/null
@@ -1,707 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include <QTemporaryFile>
-#include <QString>
-#include <QDirIterator>
-
-#include <private/qfsfileengine_p.h>
-
-#include <qtest.h>
-
-#include <stdio.h>
-
-#ifdef Q_OS_WIN
-# include <windows.h>
-#endif
-
-#if defined(Q_OS_QNX) && defined(open)
-#undef open
-#endif
-
-#define BUFSIZE 1024*512
-#define FACTOR 1024*512
-#define TF_SIZE FACTOR*81
-
-// 10 predefined (but random() seek positions
-// hardcoded to be comparable over several runs
-const int seekpos[] = {int(TF_SIZE*0.52),
- int(TF_SIZE*0.23),
- int(TF_SIZE*0.73),
- int(TF_SIZE*0.77),
- int(TF_SIZE*0.80),
- int(TF_SIZE*0.12),
- int(TF_SIZE*0.53),
- int(TF_SIZE*0.21),
- int(TF_SIZE*0.27),
- int(TF_SIZE*0.78)};
-
-const int sp_size = sizeof(seekpos)/sizeof(int);
-
-class tst_qfile: public QObject
-{
-Q_ENUMS(BenchmarkType)
-Q_OBJECT
-public:
- enum BenchmarkType {
- QFileBenchmark = 1,
-#ifdef QT_BUILD_INTERNAL
- QFSFileEngineBenchmark,
-#endif
- Win32Benchmark,
- PosixBenchmark,
- QFileFromPosixBenchmark
- };
-private slots:
- void initTestCase();
- void cleanupTestCase();
-
- void open_data();
- void open();
- void seek_data();
- void seek();
-
- void readSmallFiles_QFile();
- void readSmallFiles_QFSFileEngine();
- void readSmallFiles_posix();
- void readSmallFiles_Win32();
-
- void readSmallFiles_QFile_data();
- void readSmallFiles_QFSFileEngine_data();
- void readSmallFiles_posix_data();
- void readSmallFiles_Win32_data();
-
- void readBigFile_QFile_data();
- void readBigFile_QFSFileEngine_data();
- void readBigFile_posix_data();
- void readBigFile_Win32_data();
-
- void readBigFile_QFile();
- void readBigFile_QFSFileEngine();
- void readBigFile_posix();
- void readBigFile_Win32();
-
-private:
- void readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b);
- void readBigFile();
- void readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b);
- void readSmallFiles();
- void createFile();
- void fillFile(int factor=FACTOR);
- void removeFile();
- void createSmallFiles();
- void removeSmallFiles();
- QString filename;
- QString tmpDirName;
-};
-
-Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
-Q_DECLARE_METATYPE(QIODevice::OpenMode)
-Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
-
-void tst_qfile::createFile()
-{
- removeFile(); // Cleanup in case previous test case aborted before cleaning up
-
- QTemporaryFile tmpFile;
- tmpFile.setAutoRemove(false);
- if (!tmpFile.open())
- ::exit(1);
- filename = tmpFile.fileName();
- tmpFile.close();
-}
-
-void tst_qfile::removeFile()
-{
- if (!filename.isEmpty())
- QFile::remove(filename);
-}
-
-void tst_qfile::fillFile(int factor)
-{
- QFile tmpFile(filename);
- tmpFile.open(QIODevice::WriteOnly);
- //for (int row=0; row<factor; ++row) {
- // tmpFile.write(QByteArray().fill('0'+row%('0'-'z'), 80));
- // tmpFile.write("\n");
- //}
- tmpFile.seek(factor*80);
- tmpFile.putChar('\n');
- tmpFile.close();
- // let IO settle
- QTest::qSleep(2000);
-}
-
-void tst_qfile::initTestCase()
-{
-}
-
-void tst_qfile::cleanupTestCase()
-{
-}
-
-void tst_qfile::readBigFile_QFile() { readBigFile(); }
-void tst_qfile::readBigFile_QFSFileEngine()
-{
-#ifdef QT_BUILD_INTERNAL
- readBigFile();
-#else
- QSKIP("This test requires -developer-build.");
-#endif
-}
-void tst_qfile::readBigFile_posix()
-{
- readBigFile();
-}
-void tst_qfile::readBigFile_Win32() { readBigFile(); }
-
-void tst_qfile::readBigFile_QFile_data()
-{
- readBigFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
- readBigFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
- readBigFile_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen);
- readBigFile_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered);
-
-}
-
-void tst_qfile::readBigFile_QFSFileEngine_data()
-{
-#ifdef QT_BUILD_INTERNAL
- readBigFile_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
- readBigFile_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
- readBigFile_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::NotOpen);
- readBigFile_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered);
-#else
- QTest::addColumn<int>("dummy");
- QTest::newRow("Test will be skipped") << -1;
-#endif
-}
-
-void tst_qfile::readBigFile_posix_data()
-{
- readBigFile_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
-}
-
-void tst_qfile::readBigFile_Win32_data()
-{
- readBigFile_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen);
-}
-
-
-void tst_qfile::readBigFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b)
-{
- QTest::addColumn<tst_qfile::BenchmarkType>("testType");
- QTest::addColumn<int>("blockSize");
- QTest::addColumn<QFile::OpenModeFlag>("textMode");
- QTest::addColumn<QFile::OpenModeFlag>("bufferedMode");
-
- const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512};
- int bs_entries = sizeof(bs)/sizeof(const int);
-
- QString flagstring;
- if (t & QIODevice::Text) flagstring += "textMode ";
- if (b & QIODevice::Unbuffered) flagstring += "unbuffered ";
- if (flagstring.isEmpty()) flagstring = "none";
-
- for (int i=0; i<bs_entries; ++i)
- QTest::newRow((QString("BS: %1, Flags: %2" )).arg(bs[i]).arg(flagstring).toLatin1().constData()) << type << bs[i] << t << b;
-}
-
-void tst_qfile::readBigFile()
-{
- QFETCH(tst_qfile::BenchmarkType, testType);
- QFETCH(int, blockSize);
- QFETCH(QFile::OpenModeFlag, textMode);
- QFETCH(QFile::OpenModeFlag, bufferedMode);
-
-#ifndef Q_OS_WIN
- if (testType == Win32Benchmark)
- QSKIP("This is Windows only benchmark.");
-#endif
-
- char *buffer = new char[BUFSIZE];
- createFile();
- fillFile();
-
- switch (testType) {
- case(QFileBenchmark): {
- QFile file(filename);
- file.open(QIODevice::ReadOnly|textMode|bufferedMode);
- QBENCHMARK {
- while(!file.atEnd())
- file.read(blockSize);
- file.reset();
- }
- file.close();
- }
- break;
-#ifdef QT_BUILD_INTERNAL
- case(QFSFileEngineBenchmark): {
- QFSFileEngine fse(filename);
- fse.open(QIODevice::ReadOnly|textMode|bufferedMode);
- QBENCHMARK {
- //qWarning() << fse.supportsExtension(QAbstractFileEngine::AtEndExtension);
- while(fse.read(buffer, blockSize));
- fse.seek(0);
- }
- fse.close();
- }
- break;
-#endif
- case(PosixBenchmark): {
- QByteArray data = filename.toLocal8Bit();
- const char* cfilename = data.constData();
- FILE* cfile = ::fopen(cfilename, "rb");
- QBENCHMARK {
- while(!feof(cfile))
- ::fread(buffer, blockSize, 1, cfile);
- ::fseek(cfile, 0, SEEK_SET);
- }
- ::fclose(cfile);
- }
- break;
- case(QFileFromPosixBenchmark): {
- // No gain in benchmarking this case
- }
- break;
- case(Win32Benchmark): {
-#ifdef Q_OS_WIN
- HANDLE hndl;
-
- // ensure we don't account string conversion
- wchar_t* cfilename = (wchar_t*)filename.utf16();
-
- hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
- Q_ASSERT(hndl);
- wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
- DWORD numberOfBytesRead;
-
- QBENCHMARK {
- do {
- ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL);
- } while(numberOfBytesRead != 0);
- SetFilePointer(hndl, 0, NULL, FILE_BEGIN);
- }
- delete[] nativeBuffer;
- CloseHandle(hndl);
-#else
- QFAIL("Not running on a non-Windows platform!");
-#endif
- }
- break;
- }
-
- removeFile();
- delete[] buffer;
-}
-
-void tst_qfile::seek_data()
-{
- QTest::addColumn<tst_qfile::BenchmarkType>("testType");
- QTest::newRow("QFile") << QFileBenchmark;
-#ifdef QT_BUILD_INTERNAL
- QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark;
-#endif
- QTest::newRow("Posix FILE*") << PosixBenchmark;
-#ifdef Q_OS_WIN
- QTest::newRow("Win32 API") << Win32Benchmark;
-#endif
-}
-
-void tst_qfile::seek()
-{
- QFETCH(tst_qfile::BenchmarkType, testType);
- int i = 0;
-
- createFile();
- fillFile();
-
- switch (testType) {
- case(QFileBenchmark): {
- QFile file(filename);
- file.open(QIODevice::ReadOnly);
- QBENCHMARK {
- i=(i+1)%sp_size;
- file.seek(seekpos[i]);
- }
- file.close();
- }
- break;
-#ifdef QT_BUILD_INTERNAL
- case(QFSFileEngineBenchmark): {
- QFSFileEngine fse(filename);
- fse.open(QIODevice::ReadOnly);
- QBENCHMARK {
- i=(i+1)%sp_size;
- fse.seek(seekpos[i]);
- }
- fse.close();
- }
- break;
-#endif
- case(PosixBenchmark): {
- QByteArray data = filename.toLocal8Bit();
- const char* cfilename = data.constData();
- FILE* cfile = ::fopen(cfilename, "rb");
- QBENCHMARK {
- i=(i+1)%sp_size;
- ::fseek(cfile, seekpos[i], SEEK_SET);
- }
- ::fclose(cfile);
- }
- break;
- case(QFileFromPosixBenchmark): {
- // No gain in benchmarking this case
- }
- break;
- case(Win32Benchmark): {
-#ifdef Q_OS_WIN
- HANDLE hndl;
-
- // ensure we don't account string conversion
- wchar_t* cfilename = (wchar_t*)filename.utf16();
-
- hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
- Q_ASSERT(hndl);
- QBENCHMARK {
- i=(i+1)%sp_size;
- SetFilePointer(hndl, seekpos[i], NULL, 0);
- }
- CloseHandle(hndl);
-#else
- QFAIL("Not running on a Windows plattform!");
-#endif
- }
- break;
- }
-
- removeFile();
-}
-
-void tst_qfile::open_data()
-{
- QTest::addColumn<tst_qfile::BenchmarkType>("testType");
- QTest::newRow("QFile") << QFileBenchmark;
-#ifdef QT_BUILD_INTERNAL
- QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark;
-#endif
- QTest::newRow("Posix FILE*") << PosixBenchmark;
- QTest::newRow("QFile from FILE*") << QFileFromPosixBenchmark;
-#ifdef Q_OS_WIN
- QTest::newRow("Win32 API") << Win32Benchmark;
-#endif
-}
-
-void tst_qfile::open()
-{
- QFETCH(tst_qfile::BenchmarkType, testType);
-
- createFile();
-
- switch (testType) {
- case(QFileBenchmark): {
- QBENCHMARK {
- QFile file( filename );
- file.open( QIODevice::ReadOnly );
- file.close();
- }
- }
- break;
-#ifdef QT_BUILD_INTERNAL
- case(QFSFileEngineBenchmark): {
- QBENCHMARK {
- QFSFileEngine fse(filename);
- fse.open(QIODevice::ReadOnly);
- fse.close();
- }
- }
- break;
-#endif
- case(PosixBenchmark): {
- // ensure we don't account toLocal8Bit()
- QByteArray data = filename.toLocal8Bit();
- const char* cfilename = data.constData();
-
- QBENCHMARK {
- FILE* cfile = ::fopen(cfilename, "rb");
- ::fclose(cfile);
- }
- }
- break;
- case(QFileFromPosixBenchmark): {
- // ensure we don't account toLocal8Bit()
- QByteArray data = filename.toLocal8Bit();
- const char* cfilename = data.constData();
- FILE* cfile = ::fopen(cfilename, "rb");
-
- QBENCHMARK {
- QFile file;
- file.open(cfile, QIODevice::ReadOnly);
- file.close();
- }
- ::fclose(cfile);
- }
- break;
- case(Win32Benchmark): {
-#ifdef Q_OS_WIN
- HANDLE hndl;
-
- // ensure we don't account string conversion
- wchar_t* cfilename = (wchar_t*)filename.utf16();
-
- QBENCHMARK {
- hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
- Q_ASSERT(hndl);
- CloseHandle(hndl);
- }
-#else
- QFAIL("Not running on a non-Windows platform!");
-#endif
- }
- break;
- }
-
- removeFile();
-}
-
-
-void tst_qfile::readSmallFiles_QFile() { readSmallFiles(); }
-void tst_qfile::readSmallFiles_QFSFileEngine()
-{
-#ifdef QT_BUILD_INTERNAL
- readSmallFiles();
-#else
- QSKIP("This test requires -developer-build.");
-#endif
-}
-void tst_qfile::readSmallFiles_posix()
-{
- readSmallFiles();
-}
-void tst_qfile::readSmallFiles_Win32()
-{
- readSmallFiles();
-}
-
-void tst_qfile::readSmallFiles_QFile_data()
-{
- readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
- readSmallFiles_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
- readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen);
- readSmallFiles_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered);
-
-}
-
-void tst_qfile::readSmallFiles_QFSFileEngine_data()
-{
-#ifdef QT_BUILD_INTERNAL
- readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
- readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
- readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::NotOpen);
- readSmallFiles_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered);
-#else
- QTest::addColumn<int>("dummy");
- QTest::newRow("Test will be skipped") << -1;
-#endif
-}
-
-void tst_qfile::readSmallFiles_posix_data()
-{
- readSmallFiles_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
-}
-
-void tst_qfile::readSmallFiles_Win32_data()
-{
- readSmallFiles_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen);
-}
-
-
-void tst_qfile::readSmallFiles_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b)
-{
- QTest::addColumn<tst_qfile::BenchmarkType>("testType");
- QTest::addColumn<int>("blockSize");
- QTest::addColumn<QFile::OpenModeFlag>("textMode");
- QTest::addColumn<QFile::OpenModeFlag>("bufferedMode");
-
- const int bs[] = {1024, 1024*2, 1024*8, 1024*16, 1024*32,1024*512};
- int bs_entries = sizeof(bs)/sizeof(const int);
-
- QString flagstring;
- if (t & QIODevice::Text) flagstring += "textMode ";
- if (b & QIODevice::Unbuffered) flagstring += "unbuffered ";
- if (flagstring.isEmpty()) flagstring = "none";
-
- for (int i=0; i<bs_entries; ++i)
- QTest::newRow((QString("BS: %1, Flags: %2" )).arg(bs[i]).arg(flagstring).toLatin1().constData()) << type << bs[i] << t << b;
-
-}
-
-void tst_qfile::createSmallFiles()
-{
- QDir dir = QDir::temp();
- dir.mkdir("tst");
- dir.cd("tst");
- tmpDirName = dir.absolutePath();
-
- for (int i = 0; i < 1000; ++i) {
- QFile f(tmpDirName + QLatin1Char('/') + QString::number(i));
- f.open(QIODevice::WriteOnly);
- f.seek(511);
- f.putChar('\n');
- f.close();
- }
-}
-
-void tst_qfile::removeSmallFiles()
-{
- QDirIterator it(tmpDirName, QDirIterator::FollowSymlinks);
- while (it.hasNext())
- QFile::remove(it.next());
- QDir::temp().rmdir("tst");
-}
-
-
-void tst_qfile::readSmallFiles()
-{
- QFETCH(tst_qfile::BenchmarkType, testType);
- QFETCH(int, blockSize);
- QFETCH(QFile::OpenModeFlag, textMode);
- QFETCH(QFile::OpenModeFlag, bufferedMode);
-
-#ifndef Q_OS_WIN
- if (testType == Win32Benchmark)
- QSKIP("This is Windows only benchmark.");
-#endif
-
- createSmallFiles();
-
- QDir dir(tmpDirName);
- const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
- char *buffer = new char[BUFSIZE];
-
- switch (testType) {
- case(QFileBenchmark): {
- QList<QFile*> fileList;
- Q_FOREACH(QString file, files) {
- QFile *f = new QFile(tmpDirName + QLatin1Char('/') + file);
- f->open(QIODevice::ReadOnly|textMode|bufferedMode);
- fileList.append(f);
- }
-
- QBENCHMARK {
- Q_FOREACH(QFile *file, fileList) {
- while (!file->atEnd()) {
- file->read(buffer, blockSize);
- }
- }
- }
-
- Q_FOREACH(QFile *file, fileList) {
- file->close();
- delete file;
- }
- }
- break;
-#ifdef QT_BUILD_INTERNAL
- case(QFSFileEngineBenchmark): {
- QList<QFSFileEngine*> fileList;
- Q_FOREACH(QString file, files) {
- QFSFileEngine *fse = new QFSFileEngine(tmpDirName + QLatin1Char('/') + file);
- fse->open(QIODevice::ReadOnly|textMode|bufferedMode);
- fileList.append(fse);
- }
-
- QBENCHMARK {
- Q_FOREACH(QFSFileEngine *fse, fileList) {
- while (fse->read(buffer, blockSize));
- }
- }
-
- Q_FOREACH(QFSFileEngine *fse, fileList) {
- fse->close();
- delete fse;
- }
- }
- break;
-#endif
- case(PosixBenchmark): {
- QList<FILE*> fileList;
- Q_FOREACH(QString file, files) {
- fileList.append(::fopen(QFile::encodeName(tmpDirName + QLatin1Char('/') + file).constData(), "rb"));
- }
-
- QBENCHMARK {
- Q_FOREACH(FILE* cfile, fileList) {
- while(!feof(cfile))
- ::fread(buffer, blockSize, 1, cfile);
- ::fseek(cfile, 0, SEEK_SET);
- }
- }
-
- Q_FOREACH(FILE* cfile, fileList) {
- ::fclose(cfile);
- }
- }
- break;
- case(QFileFromPosixBenchmark): {
- // No gain in benchmarking this case
- }
- break;
- case(Win32Benchmark): {
-#ifdef Q_OS_WIN
- HANDLE hndl;
-
- // ensure we don't account string conversion
- wchar_t* cfilename = (wchar_t*)filename.utf16();
-
- hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
- Q_ASSERT(hndl);
- wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
- DWORD numberOfBytesRead;
- QBENCHMARK {
- do {
- ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL);
- } while(numberOfBytesRead != 0);
- }
- delete nativeBuffer;
- CloseHandle(hndl);
-#else
- QFAIL("Not running on a non-Windows platform!");
-#endif
- }
- break;
- }
-
- removeSmallFiles();
- delete[] buffer;
-}
-
-QTEST_MAIN(tst_qfile)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp b/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp
new file mode 100644
index 0000000000..b805726f5f
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qfile/tst_bench_qfile.cpp
@@ -0,0 +1,593 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QDebug>
+#include <QTemporaryFile>
+#include <QString>
+#include <QDirIterator>
+
+#include <private/qfsfileengine_p.h>
+
+#include <qtest.h>
+
+#include <stdio.h>
+
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
+
+#if defined(Q_OS_QNX) && defined(open)
+#undef open
+#endif
+
+#define BUFSIZE 1024*512
+#define FACTOR 1024*512
+#define TF_SIZE FACTOR*81
+
+// 10 predefined (but random() seek positions
+// hardcoded to be comparable over several runs
+const int seekpos[] = {int(TF_SIZE*0.52),
+ int(TF_SIZE*0.23),
+ int(TF_SIZE*0.73),
+ int(TF_SIZE*0.77),
+ int(TF_SIZE*0.80),
+ int(TF_SIZE*0.12),
+ int(TF_SIZE*0.53),
+ int(TF_SIZE*0.21),
+ int(TF_SIZE*0.27),
+ int(TF_SIZE*0.78)};
+
+const int sp_size = sizeof(seekpos)/sizeof(int);
+
+class tst_qfile: public QObject
+{
+Q_ENUMS(BenchmarkType)
+Q_OBJECT
+public:
+ enum BenchmarkType {
+ QFileBenchmark = 1,
+#ifdef QT_BUILD_INTERNAL
+ QFSFileEngineBenchmark,
+#endif
+ Win32Benchmark,
+ PosixBenchmark,
+ QFileFromPosixBenchmark
+ };
+private slots:
+ void initTestCase();
+
+ void open_data();
+ void open();
+ void seek_data();
+ void seek();
+
+ void readSmallFiles_QFile() { readSmallFiles(); }
+ void readSmallFiles_QFSFileEngine() { readSmallFiles(); }
+ void readSmallFiles_posix() { readSmallFiles(); }
+ void readSmallFiles_Win32() { readSmallFiles(); }
+
+ void readSmallFiles_QFile_data();
+ void readSmallFiles_QFSFileEngine_data();
+ void readSmallFiles_posix_data();
+ void readSmallFiles_Win32_data();
+
+ void readBigFile_QFile_data();
+ void readBigFile_QFSFileEngine_data();
+ void readBigFile_posix_data();
+ void readBigFile_Win32_data();
+
+ void readBigFile_QFile() { readBigFile(); }
+ void readBigFile_QFSFileEngine() { readBigFile(); }
+ void readBigFile_posix() { readBigFile(); }
+ void readBigFile_Win32() { readBigFile(); }
+
+private:
+ void readFile_data(BenchmarkType type, QIODevice::OpenModeFlag t, QIODevice::OpenModeFlag b);
+ void readBigFile();
+ void readSmallFiles();
+
+ class TestDataDir : public QTemporaryDir
+ {
+ void createFile();
+ void createSmallFiles();
+ public:
+ TestDataDir() : QTemporaryDir(), fail(errorString().toLocal8Bit())
+ {
+ if (fail.isEmpty() && !QTemporaryDir::isValid())
+ fail = "Failed to create temporary directory for data";
+ if (isValid())
+ createSmallFiles();
+ if (isValid())
+ createFile();
+ if (isValid())
+ QTest::qSleep(2000); // let IO settle
+ }
+ bool isValid() { return QTemporaryDir::isValid() && fail.isEmpty(); }
+ QByteArray fail;
+ QString filename;
+ } tempDir;
+};
+
+Q_DECLARE_METATYPE(tst_qfile::BenchmarkType)
+Q_DECLARE_METATYPE(QIODevice::OpenMode)
+Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+
+/* None of the tests modify the test data in tempDir, so it's OK to only create
+ * and tear down the directory once.
+ */
+void tst_qfile::TestDataDir::createFile()
+{
+ QFile tmpFile(filePath("testFile"));
+ if (!tmpFile.open(QIODevice::WriteOnly)) {
+ fail = "Unable to prepare files for test";
+ return;
+ }
+#if 0 // Varied data, rather than filling with '\0' bytes:
+ for (int row = 0; row < FACTOR; ++row) {
+ tmpFile.write(QByteArray().fill('0' + row % ('0' - 'z'), 80));
+ tmpFile.write("\n");
+ }
+#else
+ tmpFile.seek(FACTOR * 80);
+ tmpFile.putChar('\n');
+#endif
+ filename = tmpFile.fileName();
+ tmpFile.close();
+}
+
+void tst_qfile::TestDataDir::createSmallFiles()
+{
+ for (int i = 0; i < 1000; ++i) {
+ QFile f(filePath(QString::number(i)));
+ if (!f.open(QIODevice::WriteOnly)) {
+ fail = "Unable to prepare small files for test";
+ return;
+ }
+ f.seek(511);
+ f.putChar('\n');
+ f.close();
+ }
+}
+
+void tst_qfile::initTestCase()
+{
+ QVERIFY2(tempDir.isValid(), tempDir.fail.constData());
+}
+
+void tst_qfile::readFile_data(BenchmarkType type, QIODevice::OpenModeFlag t,
+ QIODevice::OpenModeFlag b)
+{
+ QTest::addColumn<tst_qfile::BenchmarkType>("testType");
+ QTest::addColumn<int>("blockSize");
+ QTest::addColumn<QFile::OpenModeFlag>("textMode");
+ QTest::addColumn<QFile::OpenModeFlag>("bufferedMode");
+
+ QByteArray flagstring;
+ if (t & QIODevice::Text)
+ flagstring += "textMode";
+ if (b & QIODevice::Unbuffered) {
+ if (flagstring.size())
+ flagstring += ' ';
+ flagstring += "unbuffered";
+ }
+ if (flagstring.isEmpty())
+ flagstring = "none";
+
+ const int kbs[] = {1, 2, 8, 16, 32, 512};
+ for (int kb : kbs) {
+ const int size = 1024 * kb;
+ QTest::addRow("BS: %d, Flags: %s", size, flagstring.constData())
+ << type << size << t << b;
+ }
+}
+
+void tst_qfile::readBigFile_QFile_data()
+{
+ readFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+ readFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
+ readFile_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen);
+ readFile_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered);
+
+}
+
+void tst_qfile::readBigFile_QFSFileEngine_data()
+{
+#ifdef QT_BUILD_INTERNAL
+ // Support for buffering dropped at 5.10, so only test Unbuffered
+ readFile_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
+ readFile_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered);
+#else
+ QSKIP("This test requires -developer-build.");
+#endif
+}
+
+void tst_qfile::readBigFile_posix_data()
+{
+ readFile_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+}
+
+void tst_qfile::readBigFile_Win32_data()
+{
+#ifdef Q_OS_WIN
+ readFile_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+#else
+ QSKIP("This is Windows only benchmark.");
+#endif
+}
+
+void tst_qfile::readBigFile()
+{
+ QFETCH(tst_qfile::BenchmarkType, testType);
+ QFETCH(int, blockSize);
+ QFETCH(QFile::OpenModeFlag, textMode);
+ QFETCH(QFile::OpenModeFlag, bufferedMode);
+
+ char buffer[BUFSIZE];
+ switch (testType) {
+ case QFileBenchmark: {
+ QFile file(tempDir.filename);
+ file.open(QIODevice::ReadOnly|textMode|bufferedMode);
+ QBENCHMARK {
+ while(!file.atEnd())
+ file.read(blockSize);
+ file.reset();
+ }
+ file.close();
+ }
+ break;
+#ifdef QT_BUILD_INTERNAL
+ case QFSFileEngineBenchmark: {
+ QFSFileEngine fse(tempDir.filename);
+ fse.open(QIODevice::ReadOnly | textMode | bufferedMode, std::nullopt);
+ QBENCHMARK {
+ //qWarning() << fse.supportsExtension(QAbstractFileEngine::AtEndExtension);
+ while (fse.read(buffer, blockSize)) {}
+ fse.seek(0);
+ }
+ fse.close();
+ }
+ break;
+#endif
+ case PosixBenchmark: {
+ QByteArray data = tempDir.filename.toLocal8Bit();
+ const char* cfilename = data.constData();
+ FILE* cfile = ::fopen(cfilename, "rb");
+ QBENCHMARK {
+ while(!feof(cfile))
+ [[maybe_unused]] auto r = ::fread(buffer, blockSize, 1, cfile);
+ ::fseek(cfile, 0, SEEK_SET);
+ }
+ ::fclose(cfile);
+ }
+ break;
+ case QFileFromPosixBenchmark: {
+ // No gain in benchmarking this case
+ }
+ break;
+ case Win32Benchmark: {
+#ifdef Q_OS_WIN
+ HANDLE hndl;
+
+ // ensure we don't account string conversion
+ const wchar_t *cfilename = reinterpret_cast<const wchar_t *>(tempDir.filename.utf16());
+
+ hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
+ Q_ASSERT(hndl);
+ wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
+ DWORD numberOfBytesRead;
+
+ QBENCHMARK {
+ do {
+ ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL);
+ } while(numberOfBytesRead != 0);
+ SetFilePointer(hndl, 0, NULL, FILE_BEGIN);
+ }
+ delete[] nativeBuffer;
+ CloseHandle(hndl);
+#else
+ QFAIL("Not running on a non-Windows platform!");
+#endif
+ }
+ break;
+ }
+}
+
+void tst_qfile::seek_data()
+{
+ QTest::addColumn<tst_qfile::BenchmarkType>("testType");
+ QTest::newRow("QFile") << QFileBenchmark;
+#ifdef QT_BUILD_INTERNAL
+ QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark;
+#endif
+ QTest::newRow("Posix FILE*") << PosixBenchmark;
+#ifdef Q_OS_WIN
+ QTest::newRow("Win32 API") << Win32Benchmark;
+#endif
+}
+
+void tst_qfile::seek()
+{
+ QFETCH(tst_qfile::BenchmarkType, testType);
+ int i = 0;
+
+ switch (testType) {
+ case QFileBenchmark: {
+ QFile file(tempDir.filename);
+ file.open(QIODevice::ReadOnly);
+ QBENCHMARK {
+ i=(i+1)%sp_size;
+ file.seek(seekpos[i]);
+ }
+ file.close();
+ }
+ break;
+#ifdef QT_BUILD_INTERNAL
+ case QFSFileEngineBenchmark: {
+ QFSFileEngine fse(tempDir.filename);
+ fse.open(QIODevice::ReadOnly | QIODevice::Unbuffered, std::nullopt);
+ QBENCHMARK {
+ i=(i+1)%sp_size;
+ fse.seek(seekpos[i]);
+ }
+ fse.close();
+ }
+ break;
+#endif
+ case PosixBenchmark: {
+ QByteArray data = tempDir.filename.toLocal8Bit();
+ const char* cfilename = data.constData();
+ FILE* cfile = ::fopen(cfilename, "rb");
+ QBENCHMARK {
+ i=(i+1)%sp_size;
+ ::fseek(cfile, seekpos[i], SEEK_SET);
+ }
+ ::fclose(cfile);
+ }
+ break;
+ case QFileFromPosixBenchmark: {
+ // No gain in benchmarking this case
+ }
+ break;
+ case Win32Benchmark: {
+#ifdef Q_OS_WIN
+ HANDLE hndl;
+
+ // ensure we don't account string conversion
+ const wchar_t *cfilename = reinterpret_cast<const wchar_t *>(tempDir.filename.utf16());
+
+ hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
+ Q_ASSERT(hndl);
+ QBENCHMARK {
+ i=(i+1)%sp_size;
+ SetFilePointer(hndl, seekpos[i], NULL, 0);
+ }
+ CloseHandle(hndl);
+#else
+ QFAIL("Not running on a Windows platform!");
+#endif
+ }
+ break;
+ }
+}
+
+void tst_qfile::open_data()
+{
+ QTest::addColumn<tst_qfile::BenchmarkType>("testType");
+ QTest::newRow("QFile") << QFileBenchmark;
+#ifdef QT_BUILD_INTERNAL
+ QTest::newRow("QFSFileEngine") << QFSFileEngineBenchmark;
+#endif
+ QTest::newRow("Posix FILE*") << PosixBenchmark;
+ QTest::newRow("QFile from FILE*") << QFileFromPosixBenchmark;
+#ifdef Q_OS_WIN
+ QTest::newRow("Win32 API") << Win32Benchmark;
+#endif
+}
+
+void tst_qfile::open()
+{
+ QFETCH(tst_qfile::BenchmarkType, testType);
+
+ switch (testType) {
+ case QFileBenchmark: {
+ QBENCHMARK {
+ QFile file(tempDir.filename);
+ file.open(QIODevice::ReadOnly);
+ file.close();
+ }
+ }
+ break;
+#ifdef QT_BUILD_INTERNAL
+ case QFSFileEngineBenchmark: {
+ QBENCHMARK {
+ QFSFileEngine fse(tempDir.filename);
+ fse.open(QIODevice::ReadOnly | QIODevice::Unbuffered, std::nullopt);
+ fse.close();
+ }
+ }
+ break;
+#endif
+ case PosixBenchmark: {
+ // ensure we don't account toLocal8Bit()
+ QByteArray data = tempDir.filename.toLocal8Bit();
+ const char* cfilename = data.constData();
+
+ QBENCHMARK {
+ FILE* cfile = ::fopen(cfilename, "rb");
+ ::fclose(cfile);
+ }
+ }
+ break;
+ case QFileFromPosixBenchmark: {
+ // ensure we don't account toLocal8Bit()
+ QByteArray data = tempDir.filename.toLocal8Bit();
+ const char* cfilename = data.constData();
+ FILE* cfile = ::fopen(cfilename, "rb");
+
+ QBENCHMARK {
+ QFile file;
+ file.open(cfile, QIODevice::ReadOnly);
+ file.close();
+ }
+ ::fclose(cfile);
+ }
+ break;
+ case Win32Benchmark: {
+#ifdef Q_OS_WIN
+ HANDLE hndl;
+
+ // ensure we don't account string conversion
+ const wchar_t *cfilename = reinterpret_cast<const wchar_t *>(tempDir.filename.utf16());
+
+ QBENCHMARK {
+ hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
+ Q_ASSERT(hndl);
+ CloseHandle(hndl);
+ }
+#else
+ QFAIL("Not running on a non-Windows platform!");
+#endif
+ }
+ break;
+ }
+}
+
+void tst_qfile::readSmallFiles_QFile_data()
+{
+ readFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+ readFile_data(QFileBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
+ readFile_data(QFileBenchmark, QIODevice::Text, QIODevice::NotOpen);
+ readFile_data(QFileBenchmark, QIODevice::Text, QIODevice::Unbuffered);
+
+}
+
+void tst_qfile::readSmallFiles_QFSFileEngine_data()
+{
+#ifdef QT_BUILD_INTERNAL
+ // Support for buffering dropped at 5.10, so only test Unbuffered
+ readFile_data(QFSFileEngineBenchmark, QIODevice::NotOpen, QIODevice::Unbuffered);
+ readFile_data(QFSFileEngineBenchmark, QIODevice::Text, QIODevice::Unbuffered);
+#else
+ QSKIP("This test requires -developer-build.");
+#endif
+}
+
+void tst_qfile::readSmallFiles_posix_data()
+{
+ readFile_data(PosixBenchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+}
+
+void tst_qfile::readSmallFiles_Win32_data()
+{
+
+#ifdef Q_OS_WIN
+ readFile_data(Win32Benchmark, QIODevice::NotOpen, QIODevice::NotOpen);
+#else
+ QSKIP("This is Windows only benchmark.");
+#endif
+}
+
+void tst_qfile::readSmallFiles()
+{
+ QFETCH(tst_qfile::BenchmarkType, testType);
+ QFETCH(int, blockSize);
+ QFETCH(QFile::OpenModeFlag, textMode);
+ QFETCH(QFile::OpenModeFlag, bufferedMode);
+
+ QDir dir(tempDir.path());
+ const QStringList files = dir.entryList(QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
+ char buffer[BUFSIZE];
+
+ switch (testType) {
+ case QFileBenchmark: {
+ QList<QFile*> fileList;
+ for (const QString &file : files) {
+ QFile *f = new QFile(tempDir.filePath(file));
+ f->open(QIODevice::ReadOnly|textMode|bufferedMode);
+ fileList.append(f);
+ }
+
+ QBENCHMARK {
+ for (QFile *const file : std::as_const(fileList)) {
+ while (!file->atEnd())
+ file->read(buffer, blockSize);
+ }
+ }
+
+ for (QFile *const file : std::as_const(fileList)) {
+ file->close();
+ delete file;
+ }
+ }
+ break;
+#ifdef QT_BUILD_INTERNAL
+ case QFSFileEngineBenchmark: {
+ QList<QFSFileEngine*> fileList;
+ for (const QString &file : files) {
+ QFSFileEngine *fse = new QFSFileEngine(tempDir.filePath(file));
+ fse->open(QIODevice::ReadOnly | textMode | bufferedMode, std::nullopt);
+ fileList.append(fse);
+ }
+
+ QBENCHMARK {
+ for (QFSFileEngine *const fse : std::as_const(fileList))
+ while (fse->read(buffer, blockSize)) {}
+ }
+
+ for (QFSFileEngine *const fse : std::as_const(fileList)) {
+ fse->close();
+ delete fse;
+ }
+ }
+ break;
+#endif
+ case PosixBenchmark: {
+ QList<FILE *> fileList;
+ for (const QString &file : files)
+ fileList.append(::fopen(QFile::encodeName(tempDir.filePath(file)).constData(), "rb"));
+
+ QBENCHMARK {
+ for (FILE *const cfile : std::as_const(fileList)) {
+ while (!feof(cfile))
+ [[maybe_unused]] auto f = ::fread(buffer, blockSize, 1, cfile);
+ ::fseek(cfile, 0, SEEK_SET);
+ }
+ }
+
+ for (FILE *const cfile : std::as_const(fileList))
+ ::fclose(cfile);
+ }
+ break;
+ case QFileFromPosixBenchmark: {
+ // No gain in benchmarking this case
+ }
+ break;
+ case Win32Benchmark: {
+#ifdef Q_OS_WIN
+ HANDLE hndl;
+
+ // ensure we don't account string conversion
+ const wchar_t *cfilename = reinterpret_cast<const wchar_t *>(tempDir.filename.utf16());
+
+ hndl = CreateFile(cfilename, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
+ Q_ASSERT(hndl);
+ wchar_t* nativeBuffer = new wchar_t[BUFSIZE];
+ DWORD numberOfBytesRead;
+ QBENCHMARK {
+ do {
+ ReadFile(hndl, nativeBuffer, blockSize, &numberOfBytesRead, NULL);
+ } while(numberOfBytesRead != 0);
+ }
+ delete nativeBuffer;
+ CloseHandle(hndl);
+#else
+ QFAIL("Not running on a non-Windows platform!");
+#endif
+ }
+ break;
+ }
+}
+
+QTEST_MAIN(tst_qfile)
+
+#include "tst_bench_qfile.moc"
diff --git a/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt b/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt
index 1c088bf71a..84a667ca7d 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qfileinfo.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qfileinfo Binary:
@@ -6,11 +7,8 @@
qt_internal_add_benchmark(tst_bench_qfileinfo
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qfileinfo.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qfileinfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/tst_bench_qfileinfo.cpp
index 2cd06eef27..2c626dde70 100644
--- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp
+++ b/tests/benchmarks/corelib/io/qfileinfo/tst_bench_qfileinfo.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
#include <QDebug>
#include <qtest.h>
#include <QTest>
@@ -35,7 +10,7 @@
#include "private/qfsfileengine_p.h"
#include "../../../../shared/filesystem.h"
-class qfileinfo : public QObject
+class tst_QFileInfo : public QObject
{
Q_OBJECT
private slots:
@@ -45,34 +20,22 @@ private slots:
void symLinkTargetPerformanceLNK();
void junctionTargetPerformanceMountpoint();
#endif
- void initTestCase();
- void cleanupTestCase();
-public:
- qfileinfo() : QObject() {};
};
-void qfileinfo::initTestCase()
-{
-}
-
-void qfileinfo::cleanupTestCase()
-{
-}
-
-void qfileinfo::existsTemporary()
+void tst_QFileInfo::existsTemporary()
{
QString appPath = QCoreApplication::applicationFilePath();
QBENCHMARK { QFileInfo(appPath).exists(); }
}
-void qfileinfo::existsStatic()
+void tst_QFileInfo::existsStatic()
{
QString appPath = QCoreApplication::applicationFilePath();
QBENCHMARK { QFileInfo::exists(appPath); }
}
#if defined(Q_OS_WIN)
-void qfileinfo::symLinkTargetPerformanceLNK()
+void tst_QFileInfo::symLinkTargetPerformanceLNK()
{
QVERIFY(QFile::link("file","link.lnk"));
QFileInfo info("link.lnk");
@@ -86,7 +49,7 @@ void qfileinfo::symLinkTargetPerformanceLNK()
QVERIFY(QFile::remove("link.lnk"));
}
-void qfileinfo::junctionTargetPerformanceMountpoint()
+void tst_QFileInfo::junctionTargetPerformanceMountpoint()
{
wchar_t buffer[MAX_PATH];
QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
@@ -109,6 +72,6 @@ void qfileinfo::junctionTargetPerformanceMountpoint()
}
#endif
-QTEST_MAIN(qfileinfo)
+QTEST_MAIN(tst_QFileInfo)
-#include "main.moc"
+#include "tst_bench_qfileinfo.moc"
diff --git a/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt b/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt
index 3af6d4f214..133a9a1ac3 100644
--- a/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qiodevice.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qiodevice Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qiodevice
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qiodevice.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qiodevice.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qiodevice/main.cpp b/tests/benchmarks/corelib/io/qiodevice/tst_bench_qiodevice.cpp
index de4660a253..cae90631ee 100644
--- a/tests/benchmarks/corelib/io/qiodevice/main.cpp
+++ b/tests/benchmarks/corelib/io/qiodevice/tst_bench_qiodevice.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
#include <QDebug>
#include <QIODevice>
#include <QFile>
@@ -32,8 +7,7 @@
#include <qtest.h>
-
-class tst_qiodevice : public QObject
+class tst_QIODevice : public QObject
{
Q_OBJECT
private slots:
@@ -48,7 +22,7 @@ private:
};
-void tst_qiodevice::read_data()
+void tst_QIODevice::read_data()
{
QTest::addColumn<qint64>("size");
QTest::newRow("10k") << qint64(10 * 1024);
@@ -59,7 +33,7 @@ void tst_qiodevice::read_data()
QTest::newRow("1000000k") << qint64(1000000 * 1024);
}
-void tst_qiodevice::read_old()
+void tst_QIODevice::read_old()
{
QFETCH(qint64, size);
@@ -88,7 +62,7 @@ void tst_qiodevice::read_old()
}
}
-void tst_qiodevice::peekAndRead()
+void tst_QIODevice::peekAndRead()
{
QFETCH(qint64, size);
@@ -119,6 +93,6 @@ void tst_qiodevice::peekAndRead()
}
}
-QTEST_MAIN(tst_qiodevice)
+QTEST_MAIN(tst_QIODevice)
-#include "main.moc"
+#include "tst_bench_qiodevice.moc"
diff --git a/tests/benchmarks/corelib/io/qprocess/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/CMakeLists.txt
index d599539142..3f3ffd3d70 100644
--- a/tests/benchmarks/corelib/io/qprocess/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qprocess/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qprocess.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(testProcessLoopback)
add_subdirectory(test)
diff --git a/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt
index ca7011a661..c8837d3d65 100644
--- a/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from test.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qprocess Binary:
@@ -7,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qprocess
SOURCES
../tst_bench_qprocess.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt
index 896435b27b..cd486bd9cc 100644
--- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt
@@ -1,5 +1,8 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## testProcessLoopback Binary:
#####################################################################
-add_executable(testProcessLoopback main.cpp)
+add_executable(testProcessLoopback loopback.cpp)
diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp
new file mode 100644
index 0000000000..1f47f6b0f1
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+
+#include <stdio.h>
+
+int main()
+{
+ char buffer[1024];
+ for (;;) {
+ size_t num = fread(buffer, 1, sizeof(buffer), stdin);
+ if (num <= 0)
+ break;
+ fwrite(buffer, num, 1, stdout);
+ fflush(stdout);
+ }
+
+ return 0;
+}
diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp
deleted file mode 100644
index 1773ba7496..0000000000
--- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <stdio.h>
-
-int main()
-{
- char buffer[1024];
- for (;;) {
- size_t num = fread(buffer, 1, sizeof(buffer), stdin);
- if (num <= 0)
- break;
- fwrite(buffer, num, 1, stdout);
- fflush(stdout);
- }
-
- return 0;
-}
diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
index 7077ec631a..9cf87a6653 100644
--- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp
+++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QSignalSpy>
@@ -40,10 +15,16 @@ private slots:
void echoTest_performance();
};
+#ifdef Q_OS_WIN
+# define EXE ".exe"
+#else
+# define EXE ""
+#endif
+
void tst_QProcess::echoTest_performance()
{
QProcess process;
- process.start("testProcessLoopback/testProcessLoopback");
+ process.start(QFINDTESTDATA("../testProcessLoopback/testProcessLoopback" EXE));
QByteArray array;
array.resize(1024 * 1024);
@@ -62,9 +43,9 @@ void tst_QProcess::echoTest_performance()
while (stopWatch.elapsed() < 2000) {
process.write(array);
while (process.bytesToWrite() > 0) {
- int readCount = readyReadSpy.count();
+ int readCount = readyReadSpy.size();
QVERIFY(process.waitForBytesWritten(5000));
- if (readyReadSpy.count() == readCount)
+ if (readyReadSpy.size() == readCount)
QVERIFY(process.waitForReadyRead(5000));
}
diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt b/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt
index a12bfd1260..a2a33a0dce 100644
--- a/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtemporaryfile.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtemporaryfile Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qtemporaryfile
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qtemporaryfile.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtemporaryfile.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp b/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp
deleted file mode 100644
index c50032d174..0000000000
--- a/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QDebug>
-#include <QIODevice>
-#include <QFile>
-#include <QString>
-#include <QTemporaryFile>
-#include <qtest.h>
-
-
-class tst_qtemporaryfile : public QObject
-{
- Q_OBJECT
-private slots:
- void openclose_data();
- void openclose();
- void readwrite_data() { openclose_data(); }
- void readwrite();
-
-private:
-};
-
-void tst_qtemporaryfile::openclose_data()
-{
- QTest::addColumn<qint64>("amount");
- QTest::newRow("100") << qint64(100);
- QTest::newRow("1000") << qint64(1000);
- QTest::newRow("10000") << qint64(10000);
-}
-
-void tst_qtemporaryfile::openclose()
-{
- QFETCH(qint64, amount);
-
- QBENCHMARK {
- for (qint64 i = 0; i < amount; ++i) {
- QTemporaryFile file;
- file.open();
- file.close();
- }
- }
-}
-
-void tst_qtemporaryfile::readwrite()
-{
- QFETCH(qint64, amount);
-
- const int dataSize = 4096;
- QByteArray data;
- data.fill('a', dataSize);
- QBENCHMARK {
- for (qint64 i = 0; i < amount; ++i) {
- QTemporaryFile file;
- file.open();
- file.write(data);
- file.seek(0);
- file.read(dataSize);
- file.close();
- }
- }
-}
-
-QTEST_MAIN(tst_qtemporaryfile)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp b/tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp
new file mode 100644
index 0000000000..c72b525827
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp
@@ -0,0 +1,64 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include <QDebug>
+#include <QIODevice>
+#include <QFile>
+#include <QString>
+#include <QTemporaryFile>
+#include <qtest.h>
+
+class tst_QTemporaryFile : public QObject
+{
+ Q_OBJECT
+private slots:
+ void openclose_data();
+ void openclose();
+ void readwrite_data() { openclose_data(); }
+ void readwrite();
+
+private:
+};
+
+void tst_QTemporaryFile::openclose_data()
+{
+ QTest::addColumn<qint64>("amount");
+ QTest::newRow("100") << qint64(100);
+ QTest::newRow("1000") << qint64(1000);
+ QTest::newRow("10000") << qint64(10000);
+}
+
+void tst_QTemporaryFile::openclose()
+{
+ QFETCH(qint64, amount);
+
+ QBENCHMARK {
+ for (qint64 i = 0; i < amount; ++i) {
+ QTemporaryFile file;
+ file.open();
+ file.close();
+ }
+ }
+}
+
+void tst_QTemporaryFile::readwrite()
+{
+ QFETCH(qint64, amount);
+
+ const int dataSize = 4096;
+ QByteArray data;
+ data.fill('a', dataSize);
+ QBENCHMARK {
+ for (qint64 i = 0; i < amount; ++i) {
+ QTemporaryFile file;
+ file.open();
+ file.write(data);
+ file.seek(0);
+ file.read(dataSize);
+ file.close();
+ }
+ }
+}
+
+QTEST_MAIN(tst_QTemporaryFile)
+
+#include "tst_bench_qtemporaryfile.moc"
diff --git a/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt b/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt
index 0393b91119..5e39b2fd90 100644
--- a/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtextstream.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtextstream Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qtextstream
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qtextstream.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtextstream.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/io/qtextstream/main.cpp b/tests/benchmarks/corelib/io/qtextstream/tst_bench_qtextstream.cpp
index 03dc3d1694..74552b85cf 100644
--- a/tests/benchmarks/corelib/io/qtextstream/main.cpp
+++ b/tests/benchmarks/corelib/io/qtextstream/tst_bench_qtextstream.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 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) 2014 David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QIODevice>
@@ -32,7 +7,7 @@
#include <QBuffer>
#include <qtest.h>
-class tst_qtextstream : public QObject
+class tst_QTextStream : public QObject
{
Q_OBJECT
private slots:
@@ -48,7 +23,7 @@ Q_DECLARE_METATYPE(Output);
enum Input { CharStarInput, QStringInput, CharInput, QCharInput };
Q_DECLARE_METATYPE(Input);
-void tst_qtextstream::writeSingleChar_data()
+void tst_QTextStream::writeSingleChar_data()
{
QTest::addColumn<Output>("output");
QTest::addColumn<Input>("input");
@@ -63,7 +38,7 @@ void tst_qtextstream::writeSingleChar_data()
QTest::newRow("device_qchar") << DeviceOutput << QCharInput;
}
-void tst_qtextstream::writeSingleChar()
+void tst_QTextStream::writeSingleChar()
{
QFETCH(Output, output);
QFETCH(Input, input);
@@ -115,6 +90,6 @@ void tst_qtextstream::writeSingleChar()
QCOMPARE(result.left(10), QString("hhhhhhhhhh"));
}
-QTEST_MAIN(tst_qtextstream)
+QTEST_MAIN(tst_QTextStream)
-#include "main.moc"
+#include "tst_bench_qtextstream.moc"
diff --git a/tests/benchmarks/corelib/io/qurl/CMakeLists.txt b/tests/benchmarks/corelib/io/qurl/CMakeLists.txt
index d38c8b18c0..fc8d48450d 100644
--- a/tests/benchmarks/corelib/io/qurl/CMakeLists.txt
+++ b/tests/benchmarks/corelib/io/qurl/CMakeLists.txt
@@ -1,23 +1,21 @@
-# Generated from qurl.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qurl Binary:
#####################################################################
-qt_internal_add_benchmark(tst_qurl
+qt_internal_add_benchmark(tst_bench_qurl
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qurl.cpp
+ LIBRARIES
Qt::Test
)
-#### Keys ignored in scope 1:.:.:qurl.pro:<TRUE>:
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
-qt_internal_extend_target(tst_qurl CONDITION WIN32
+qt_internal_extend_target(tst_bench_qurl CONDITION WIN32
DEFINES
_CRT_SECURE_NO_WARNINGS
)
diff --git a/tests/benchmarks/corelib/io/qurl/main.cpp b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp
index 5ad3c3bd47..87c4f51816 100644
--- a/tests/benchmarks/corelib/io/qurl/main.cpp
+++ b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** 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
#include <qurl.h>
#include <qtest.h>
-class tst_qurl: public QObject
+class tst_QUrl : public QObject
{
Q_OBJECT
@@ -53,28 +28,28 @@ private:
void generateFirstRunData();
};
-void tst_qurl::emptyUrl()
+void tst_QUrl::emptyUrl()
{
QBENCHMARK {
QUrl url;
}
}
-void tst_qurl::relativeUrl()
+void tst_QUrl::relativeUrl()
{
QBENCHMARK {
QUrl url("pics/avatar.png");
}
}
-void tst_qurl::absoluteUrl()
+void tst_QUrl::absoluteUrl()
{
QBENCHMARK {
QUrl url("/tmp/avatar.png");
}
}
-void tst_qurl::generateFirstRunData()
+void tst_QUrl::generateFirstRunData()
{
QTest::addColumn<bool>("firstRun");
@@ -82,12 +57,12 @@ void tst_qurl::generateFirstRunData()
QTest::newRow("subsequent runs") << false;
}
-void tst_qurl::isRelative_data()
+void tst_QUrl::isRelative_data()
{
generateFirstRunData();
}
-void tst_qurl::isRelative()
+void tst_QUrl::isRelative()
{
QFETCH(bool, firstRun);
if (firstRun) {
@@ -103,12 +78,12 @@ void tst_qurl::isRelative()
}
}
-void tst_qurl::toLocalFile_data()
+void tst_QUrl::toLocalFile_data()
{
generateFirstRunData();
}
-void tst_qurl::toLocalFile()
+void tst_QUrl::toLocalFile()
{
QFETCH(bool, firstRun);
if (firstRun) {
@@ -124,12 +99,12 @@ void tst_qurl::toLocalFile()
}
}
-void tst_qurl::toString_data()
+void tst_QUrl::toString_data()
{
generateFirstRunData();
}
-void tst_qurl::toString()
+void tst_QUrl::toString()
{
QFETCH(bool, firstRun);
if(firstRun) {
@@ -145,35 +120,37 @@ void tst_qurl::toString()
}
}
-void tst_qurl::resolved_data()
+void tst_QUrl::resolved_data()
{
generateFirstRunData();
}
-void tst_qurl::resolved()
+void tst_QUrl::resolved()
{
QFETCH(bool, firstRun);
- if(firstRun) {
+ QUrl expect("/home/user/pics/avatar.png"), actual;
+ if (firstRun) {
QBENCHMARK {
QUrl baseUrl("/home/user/");
QUrl url("pics/avatar.png");
- baseUrl.resolved(url);
+ actual = baseUrl.resolved(url);
}
} else {
QUrl baseUrl("/home/user/");
QUrl url("pics/avatar.png");
QBENCHMARK {
- baseUrl.resolved(url);
+ actual = baseUrl.resolved(url);
}
}
+ QCOMPARE(actual, expect);
}
-void tst_qurl::equality_data()
+void tst_QUrl::equality_data()
{
generateFirstRunData();
}
-void tst_qurl::equality()
+void tst_QUrl::equality()
{
QFETCH(bool, firstRun);
if(firstRun) {
@@ -186,12 +163,12 @@ void tst_qurl::equality()
QUrl url("pics/avatar.png");
QUrl url2("pics/avatar2.png");
QBENCHMARK {
- url == url2;
+ [[maybe_unused]] auto r = url == url2;
}
}
}
-void tst_qurl::qmlPropertyWriteUseCase()
+void tst_QUrl::qmlPropertyWriteUseCase()
{
QUrl base("file:///home/user/qt/examples/declarative/samegame/SamegameCore/");
QString str("pics/redStar.png");
@@ -203,6 +180,6 @@ void tst_qurl::qmlPropertyWriteUseCase()
}
}
-QTEST_MAIN(tst_qurl)
+QTEST_MAIN(tst_QUrl)
-#include "main.moc"
+#include "tst_bench_qurl.moc"
diff --git a/tests/benchmarks/corelib/itemmodels/CMakeLists.txt b/tests/benchmarks/corelib/itemmodels/CMakeLists.txt
index c74f36709c..8dc331aee2 100644
--- a/tests/benchmarks/corelib/itemmodels/CMakeLists.txt
+++ b/tests/benchmarks/corelib/itemmodels/CMakeLists.txt
@@ -1 +1,6 @@
-add_subdirectory(qsortfilterproxymodel)
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(QT_FEATURE_proxymodel)
+ add_subdirectory(qsortfilterproxymodel)
+endif()
diff --git a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/CMakeLists.txt b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/CMakeLists.txt
index a18678159b..f6f45fa1f4 100644
--- a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/CMakeLists.txt
+++ b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/CMakeLists.txt
@@ -1,6 +1,9 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_benchmark(tst_bench_qsortfilterproxymodel
SOURCES
- tst_qsortfilterproxymodel.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qsortfilterproxymodel.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp
index f7fc0963bc..0411972ce3 100644
--- a/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/benchmarks/corelib/itemmodels/qsortfilterproxymodel/tst_bench_qsortfilterproxymodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 Igor Kushnir <igorkuo@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) 2021 Igor Kushnir <igorkuo@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QSortFilterProxyModel>
#include <QString>
@@ -56,6 +31,7 @@ class tst_QSortFilterProxyModel : public QObject
private slots:
void clearFilter_data();
void clearFilter();
+ void setSourceModel();
private:
QStringList m_numberList; ///< Cache the strings for efficiency.
@@ -97,7 +73,7 @@ void tst_QSortFilterProxyModel::clearFilter()
{
QFETCH(const int, itemCount);
resizeNumberList(m_numberList, itemCount);
- QStringListModel model(qAsConst(m_numberList));
+ QStringListModel model(std::as_const(m_numberList));
QCOMPARE(model.rowCount(), itemCount);
QSortFilterProxyModel proxy;
@@ -118,6 +94,19 @@ void tst_QSortFilterProxyModel::clearFilter()
QCOMPARE(proxy.rowCount(), itemCount);
}
+void tst_QSortFilterProxyModel::setSourceModel()
+{
+ QStringListModel model1;
+ QStringListModel model2;
+
+ QSortFilterProxyModel proxy;
+
+ QBENCHMARK {
+ proxy.setSourceModel(&model1);
+ proxy.setSourceModel(&model2);
+ }
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
-#include "tst_qsortfilterproxymodel.moc"
+#include "tst_bench_qsortfilterproxymodel.moc"
diff --git a/tests/benchmarks/corelib/json/CMakeLists.txt b/tests/benchmarks/corelib/json/CMakeLists.txt
index 657a268741..f4feb1ebdb 100644
--- a/tests/benchmarks/corelib/json/CMakeLists.txt
+++ b/tests/benchmarks/corelib/json/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from json.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtjson Binary:
@@ -7,9 +8,6 @@
qt_internal_add_benchmark(tst_bench_qtjson
SOURCES
tst_bench_qtjson.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:json.pro:<TRUE>:
-# TESTDATA = "numbers.json" "test.json"
diff --git a/tests/benchmarks/corelib/json/tst_bench_qtjson.cpp b/tests/benchmarks/corelib/json/tst_bench_qtjson.cpp
index 1dc7fb322c..2202b9a576 100644
--- a/tests/benchmarks/corelib/json/tst_bench_qtjson.cpp
+++ b/tests/benchmarks/corelib/json/tst_bench_qtjson.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** 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
#include <QTest>
+#include <QVariantMap>
#include <qjsondocument.h>
#include <qjsonobject.h>
diff --git a/tests/benchmarks/corelib/kernel/CMakeLists.txt b/tests/benchmarks/corelib/kernel/CMakeLists.txt
index 34d457bb21..137ef37298 100644
--- a/tests/benchmarks/corelib/kernel/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from kernel.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(events)
add_subdirectory(qmetatype)
@@ -6,6 +7,7 @@ add_subdirectory(qvariant)
add_subdirectory(qcoreapplication)
add_subdirectory(qtimer_vs_qmetaobject)
add_subdirectory(qproperty)
+add_subdirectory(qmetaenum)
if(TARGET Qt::Widgets)
add_subdirectory(qmetaobject)
add_subdirectory(qobject)
diff --git a/tests/benchmarks/corelib/kernel/events/CMakeLists.txt b/tests/benchmarks/corelib/kernel/events/CMakeLists.txt
index 41add9350e..ba175fd3a0 100644
--- a/tests/benchmarks/corelib/kernel/events/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/events/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from events.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_events Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_events
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_events.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:events.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/events/main.cpp b/tests/benchmarks/corelib/kernel/events/tst_bench_events.cpp
index 973d96261c..17eb838af2 100644
--- a/tests/benchmarks/corelib/kernel/events/main.cpp
+++ b/tests/benchmarks/corelib/kernel/events/tst_bench_events.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
#include <QtCore>
#include <qtest.h>
@@ -113,6 +88,7 @@ void EventsBench::noEvent()
QBENCHMARK {
val += tst.foo(1);
}
+ QVERIFY(val > 0);
}
void EventsBench::sendEvent_data()
@@ -171,4 +147,4 @@ void EventsBench::postEvent()
QTEST_MAIN(EventsBench)
-#include "main.moc"
+#include "tst_bench_events.moc"
diff --git a/tests/benchmarks/corelib/kernel/qcoreapplication/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qcoreapplication/CMakeLists.txt
index 1618997909..1a553199d3 100644
--- a/tests/benchmarks/corelib/kernel/qcoreapplication/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qcoreapplication/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qcoreapplication.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qcoreapplication Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qcoreapplication
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qcoreapplication.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qcoreapplication.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qcoreapplication/main.cpp b/tests/benchmarks/corelib/kernel/qcoreapplication/main.cpp
deleted file mode 100644
index 018f689785..0000000000
--- a/tests/benchmarks/corelib/kernel/qcoreapplication/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Robin Burchell <robin+qt@viroteck.net>
-** 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>
-#include <qtest.h>
-#include <qcoreapplication.h>
-
-class QCoreApplicationBenchmark : public QObject
-{
-Q_OBJECT
-private slots:
- void event_posting_benchmark_data();
- void event_posting_benchmark();
-};
-
-void QCoreApplicationBenchmark::event_posting_benchmark_data()
-{
- QTest::addColumn<int>("size");
- QTest::newRow("50 events") << 50;
- QTest::newRow("100 events") << 100;
- QTest::newRow("200 events") << 200;
- QTest::newRow("1000 events") << 1000;
- QTest::newRow("10000 events") << 10000;
- QTest::newRow("100000 events") << 100000;
- QTest::newRow("1000000 events") << 1000000;
-}
-
-void QCoreApplicationBenchmark::event_posting_benchmark()
-{
- QFETCH(int, size);
-
- int type = QEvent::registerEventType();
- QCoreApplication *app = QCoreApplication::instance();
-
- // benchmark posting & sending events
- QBENCHMARK {
- for (int i = 0; i < size; ++i)
- QCoreApplication::postEvent(app, new QEvent(QEvent::Type(type)));
- QCoreApplication::sendPostedEvents();
- }
-}
-
-QTEST_MAIN(QCoreApplicationBenchmark)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/kernel/qcoreapplication/tst_bench_qcoreapplication.cpp b/tests/benchmarks/corelib/kernel/qcoreapplication/tst_bench_qcoreapplication.cpp
new file mode 100644
index 0000000000..d2ff489784
--- /dev/null
+++ b/tests/benchmarks/corelib/kernel/qcoreapplication/tst_bench_qcoreapplication.cpp
@@ -0,0 +1,70 @@
+// Copyright (C) 2011 Robin Burchell <robin+qt@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include <QtCore>
+#include <qtest.h>
+#include <qcoreapplication.h>
+
+class tst_QCoreApplication : public QObject
+{
+Q_OBJECT
+private slots:
+ void event_posting_benchmark_data();
+ void event_posting_benchmark();
+
+ void event_posting_multiple_objects_benchmark_data();
+ void event_posting_multiple_objects_benchmark();
+};
+
+void tst_QCoreApplication::event_posting_benchmark_data()
+{
+ QTest::addColumn<int>("size");
+ QTest::newRow("50 events") << 50;
+ QTest::newRow("100 events") << 100;
+ QTest::newRow("200 events") << 200;
+ QTest::newRow("1000 events") << 1000;
+ QTest::newRow("10000 events") << 10000;
+ QTest::newRow("100000 events") << 100000;
+ QTest::newRow("1000000 events") << 1000000;
+}
+
+void tst_QCoreApplication::event_posting_benchmark()
+{
+ QFETCH(int, size);
+
+ int type = QEvent::registerEventType();
+ QCoreApplication *app = QCoreApplication::instance();
+
+ // benchmark posting & sending events
+ QBENCHMARK {
+ for (int i = 0; i < size; ++i)
+ QCoreApplication::postEvent(app, new QEvent(QEvent::Type(type)));
+ QCoreApplication::sendPostedEvents();
+ }
+}
+
+void tst_QCoreApplication::event_posting_multiple_objects_benchmark_data()
+{
+ event_posting_benchmark_data();
+}
+
+void tst_QCoreApplication::event_posting_multiple_objects_benchmark()
+{
+ QFETCH(int, size);
+
+ QObject objects[15]; // The size of the array has not been chosen through any meaningful means
+
+ QRandomGenerator gen;
+
+ // benchmark posting & sending events
+ QBENCHMARK {
+ for (int i = 0; i < size; ++i) {
+ QCoreApplication::postEvent(&objects[gen.bounded(0, int(std::size(objects)))],
+ new QTimerEvent(i % 10));
+ }
+ QCoreApplication::sendPostedEvents();
+ }
+}
+
+QTEST_MAIN(tst_QCoreApplication)
+
+#include "tst_bench_qcoreapplication.moc"
diff --git a/tests/benchmarks/corelib/kernel/qmetaenum/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qmetaenum/CMakeLists.txt
new file mode 100644
index 0000000000..78bc30ea73
--- /dev/null
+++ b/tests/benchmarks/corelib/kernel/qmetaenum/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_benchmark(tst_bench_qmetaenum
+ SOURCES
+ tst_bench_qmetaenum.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Test
+)
diff --git a/tests/benchmarks/corelib/kernel/qmetaenum/tst_bench_qmetaenum.cpp b/tests/benchmarks/corelib/kernel/qmetaenum/tst_bench_qmetaenum.cpp
new file mode 100644
index 0000000000..1a88c49993
--- /dev/null
+++ b/tests/benchmarks/corelib/kernel/qmetaenum/tst_bench_qmetaenum.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QMetaEnum>
+#include <QTest>
+
+class tst_QMetaEnum: public QObject
+{
+ Q_OBJECT
+public:
+ using QObject::QObject;
+
+private Q_SLOTS:
+ void valueToKeys_data();
+ void valueToKeys();
+ void keysToValue_data() { valueToKeys_data(); }
+ void keysToValue();
+};
+
+void tst_QMetaEnum::valueToKeys_data()
+{
+ QTest::addColumn<int>("buttons");
+ QTest::addColumn<QByteArray>("string");
+ // Qt::MouseButtons has at least 24 enumerators, so it's a good performance test
+ const auto me = QMetaEnum::fromType<Qt::MouseButtons>();
+ int accu = 0;
+ for (int i = 0; i < std::min(31, me.keyCount()); ++i) {
+ accu <<= 1;
+ accu |= 1;
+ QTest::addRow("%d bits set", i) << accu << me.valueToKeys(accu);
+ }
+}
+
+void tst_QMetaEnum::valueToKeys()
+{
+ QFETCH(const int, buttons);
+ const auto me = QMetaEnum::fromType<Qt::MouseButtons>();
+ QBENCHMARK {
+ [[maybe_unused]] auto r = me.valueToKeys(buttons);
+ }
+}
+
+void tst_QMetaEnum::keysToValue()
+{
+ QFETCH(const QByteArray, string);
+ const auto me = QMetaEnum::fromType<Qt::MouseButtons>();
+ bool ok;
+ QBENCHMARK {
+ [[maybe_unused]] auto r = me.keysToValue(string.data(), &ok);
+ }
+}
+
+QTEST_MAIN(tst_QMetaEnum)
+
+#include "tst_bench_qmetaenum.moc"
diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
index db4c3ab12e..9e17608c57 100644
--- a/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qmetaobject/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmetaobject.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmetaobject Binary:
@@ -6,12 +7,9 @@
qt_internal_add_benchmark(tst_bench_qmetaobject
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qmetaobject.cpp
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qmetaobject.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp b/tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp
index 262dca7d52..6b02fb4ba4 100644
--- a/tests/benchmarks/corelib/kernel/qmetaobject/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qmetaobject/tst_bench_qmetaobject.cpp
@@ -1,35 +1,10 @@
-/****************************************************************************
-**
-** 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
#include <QtCore>
#include <QtWidgets/QTreeView>
#include <qtest.h>
-class LotsOfSignals : public QObject
+class LotsOfSignals : public QObject // for the unconnected() test
{
Q_OBJECT
public:
@@ -107,13 +82,10 @@ signals:
void extraSignal70();
};
-class tst_qmetaobject: public QObject
+class tst_QMetaObject: public QObject
{
Q_OBJECT
private slots:
- void initTestCase();
- void cleanupTestCase();
-
void indexOfProperty_data();
void indexOfProperty();
void indexOfMethod_data();
@@ -127,15 +99,7 @@ private slots:
void unconnected();
};
-void tst_qmetaobject::initTestCase()
-{
-}
-
-void tst_qmetaobject::cleanupTestCase()
-{
-}
-
-void tst_qmetaobject::indexOfProperty_data()
+void tst_QMetaObject::indexOfProperty_data()
{
QTest::addColumn<QByteArray>("name");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -145,7 +109,7 @@ void tst_qmetaobject::indexOfProperty_data()
}
}
-void tst_qmetaobject::indexOfProperty()
+void tst_QMetaObject::indexOfProperty()
{
QFETCH(QByteArray, name);
const char *p = name.constData();
@@ -155,7 +119,7 @@ void tst_qmetaobject::indexOfProperty()
}
}
-void tst_qmetaobject::indexOfMethod_data()
+void tst_QMetaObject::indexOfMethod_data()
{
QTest::addColumn<QByteArray>("method");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -166,7 +130,7 @@ void tst_qmetaobject::indexOfMethod_data()
}
}
-void tst_qmetaobject::indexOfMethod()
+void tst_QMetaObject::indexOfMethod()
{
QFETCH(QByteArray, method);
const char *p = method.constData();
@@ -176,7 +140,7 @@ void tst_qmetaobject::indexOfMethod()
}
}
-void tst_qmetaobject::indexOfSignal_data()
+void tst_QMetaObject::indexOfSignal_data()
{
QTest::addColumn<QByteArray>("signal");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -189,7 +153,7 @@ void tst_qmetaobject::indexOfSignal_data()
}
}
-void tst_qmetaobject::indexOfSignal()
+void tst_QMetaObject::indexOfSignal()
{
QFETCH(QByteArray, signal);
const char *p = signal.constData();
@@ -199,7 +163,7 @@ void tst_qmetaobject::indexOfSignal()
}
}
-void tst_qmetaobject::indexOfSlot_data()
+void tst_QMetaObject::indexOfSlot_data()
{
QTest::addColumn<QByteArray>("slot");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -212,7 +176,7 @@ void tst_qmetaobject::indexOfSlot_data()
}
}
-void tst_qmetaobject::indexOfSlot()
+void tst_QMetaObject::indexOfSlot()
{
QFETCH(QByteArray, slot);
const char *p = slot.constData();
@@ -222,7 +186,7 @@ void tst_qmetaobject::indexOfSlot()
}
}
-void tst_qmetaobject::unconnected_data()
+void tst_QMetaObject::unconnected_data()
{
QTest::addColumn<int>("signal_index");
QTest::newRow("signal--9") << 9;
@@ -233,7 +197,7 @@ void tst_qmetaobject::unconnected_data()
QTest::newRow("signal--70") << 70;
}
-void tst_qmetaobject::unconnected()
+void tst_QMetaObject::unconnected()
{
LotsOfSignals *obj = new LotsOfSignals;
QFETCH(int, signal_index);
@@ -247,6 +211,6 @@ void tst_qmetaobject::unconnected()
delete obj;
}
-QTEST_MAIN(tst_qmetaobject)
+QTEST_MAIN(tst_QMetaObject)
-#include "main.moc"
+#include "tst_bench_qmetaobject.moc"
diff --git a/tests/benchmarks/corelib/kernel/qmetatype/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qmetatype/CMakeLists.txt
index ae4bc9c906..f24a29d144 100644
--- a/tests/benchmarks/corelib/kernel/qmetatype/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qmetatype/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmetatype.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmetatype Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qmetatype
SOURCES
- tst_qmetatype.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qmetatype.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qmetatype.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/benchmarks/corelib/kernel/qmetatype/tst_bench_qmetatype.cpp
index d41823de71..94adfa4a8c 100644
--- a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/benchmarks/corelib/kernel/qmetatype/tst_bench_qmetatype.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
#include <qtest.h>
#include <QtCore/qmetatype.h>
@@ -321,4 +296,4 @@ void tst_QMetaType::constructInPlaceCopyStaticLess()
}
QTEST_MAIN(tst_QMetaType)
-#include "tst_qmetatype.moc"
+#include "tst_bench_qmetatype.moc"
diff --git a/tests/benchmarks/corelib/kernel/qobject/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qobject/CMakeLists.txt
index ce834905b0..15b71f0d60 100644
--- a/tests/benchmarks/corelib/kernel/qobject/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qobject/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qobject.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qobject Binary:
@@ -6,13 +7,10 @@
qt_internal_add_benchmark(tst_bench_qobject
SOURCES
- main.cpp
+ tst_bench_qobject.cpp
object.cpp object.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qobject.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qobject/object.cpp b/tests/benchmarks/corelib/kernel/qobject/object.cpp
index 11da3f09c1..9e0fba2e98 100644
--- a/tests/benchmarks/corelib/kernel/qobject/object.cpp
+++ b/tests/benchmarks/corelib/kernel/qobject/object.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
#include "object.h"
void Object::emitSignal0()
diff --git a/tests/benchmarks/corelib/kernel/qobject/object.h b/tests/benchmarks/corelib/kernel/qobject/object.h
index 271c4b9ac6..72705f7f34 100644
--- a/tests/benchmarks/corelib/kernel/qobject/object.h
+++ b/tests/benchmarks/corelib/kernel/qobject/object.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
#ifndef OBJECT_H
#define OBJECT_H
diff --git a/tests/benchmarks/corelib/kernel/qobject/main.cpp b/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.cpp
index 918227f74e..99c15f6317 100644
--- a/tests/benchmarks/corelib/kernel/qobject/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qobject/tst_bench_qobject.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
#include <QtCore>
#include <QtWidgets/QTreeView>
#include <qtest.h>
@@ -37,7 +12,7 @@ enum {
SignalsAndSlotsBenchmarkConstant = 456789
};
-class QObjectBenchmark : public QObject
+class tst_QObject : public QObject
{
Q_OBJECT
private slots:
@@ -95,7 +70,7 @@ inline void allocator()
}
}
-void QObjectBenchmark::stdAllocator()
+void tst_QObject::stdAllocator()
{
allocator<QObjectUsingStandardAllocator>();
}
@@ -104,7 +79,7 @@ struct Functor {
void operator()(){}
};
-void QObjectBenchmark::signal_slot_benchmark_data()
+void tst_QObject::signal_slot_benchmark_data()
{
QTest::addColumn<int>("type");
QTest::newRow("simple function") << 0;
@@ -115,7 +90,7 @@ void QObjectBenchmark::signal_slot_benchmark_data()
QTest::newRow("functor") << 5;
}
-void QObjectBenchmark::signal_slot_benchmark()
+void tst_QObject::signal_slot_benchmark()
{
QFETCH(int, type);
@@ -176,7 +151,7 @@ void QObjectBenchmark::signal_slot_benchmark()
}
}
-void QObjectBenchmark::signal_many_receivers_data()
+void tst_QObject::signal_many_receivers_data()
{
QTest::addColumn<int>("receiverCount");
QTest::newRow("100 receivers") << 100;
@@ -184,7 +159,7 @@ void QObjectBenchmark::signal_many_receivers_data()
QTest::newRow("10 000 receivers") << 10000;
}
-void QObjectBenchmark::signal_many_receivers()
+void tst_QObject::signal_many_receivers()
{
QFETCH(int, receiverCount);
Object sender;
@@ -198,7 +173,7 @@ void QObjectBenchmark::signal_many_receivers()
}
}
-void QObjectBenchmark::qproperty_benchmark_data()
+void tst_QObject::qproperty_benchmark_data()
{
QTest::addColumn<QByteArray>("name");
const QMetaObject *mo = &QTreeView::staticMetaObject;
@@ -209,7 +184,7 @@ void QObjectBenchmark::qproperty_benchmark_data()
}
}
-void QObjectBenchmark::qproperty_benchmark()
+void tst_QObject::qproperty_benchmark()
{
QFETCH(QByteArray, name);
const char *p = name.constData();
@@ -221,7 +196,7 @@ void QObjectBenchmark::qproperty_benchmark()
}
}
-void QObjectBenchmark::dynamic_property_benchmark()
+void tst_QObject::dynamic_property_benchmark()
{
QTreeView obj;
QBENCHMARK {
@@ -232,7 +207,7 @@ void QObjectBenchmark::dynamic_property_benchmark()
}
}
-void QObjectBenchmark::connect_disconnect_benchmark_data()
+void tst_QObject::connect_disconnect_benchmark_data()
{
QTest::addColumn<int>("type");
QTest::newRow("normalized signature") << 0;
@@ -243,7 +218,7 @@ void QObjectBenchmark::connect_disconnect_benchmark_data()
QTest::newRow("function pointer/handle") << 5;
QTest::newRow("functor/handle") << 6;}
-void QObjectBenchmark::connect_disconnect_benchmark()
+void tst_QObject::connect_disconnect_benchmark()
{
QFETCH(int, type);
switch (type) {
@@ -296,7 +271,7 @@ void QObjectBenchmark::connect_disconnect_benchmark()
}
}
-void QObjectBenchmark::receiver_destroyed_benchmark()
+void tst_QObject::receiver_destroyed_benchmark()
{
Object sender;
QBENCHMARK {
@@ -305,6 +280,6 @@ void QObjectBenchmark::receiver_destroyed_benchmark()
}
}
-QTEST_MAIN(QObjectBenchmark)
+QTEST_MAIN(tst_QObject)
-#include "main.moc"
+#include "tst_bench_qobject.moc"
diff --git a/tests/benchmarks/corelib/kernel/qproperty/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qproperty/CMakeLists.txt
index d6fc1c5a14..1a26f28f05 100644
--- a/tests/benchmarks/corelib/kernel/qproperty/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qproperty/CMakeLists.txt
@@ -1,8 +1,11 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_benchmark(tst_bench_qproperty
SOURCES
- main.cpp
+ tst_bench_qproperty.cpp
propertytester.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Test
)
diff --git a/tests/benchmarks/corelib/kernel/qproperty/propertytester.h b/tests/benchmarks/corelib/kernel/qproperty/propertytester.h
index daf55f8396..a89d51c286 100644
--- a/tests/benchmarks/corelib/kernel/qproperty/propertytester.h
+++ b/tests/benchmarks/corelib/kernel/qproperty/propertytester.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
#ifndef PROPERTYTESTER_H
#define PROPERTYTESTER_H
diff --git a/tests/benchmarks/corelib/kernel/qproperty/main.cpp b/tests/benchmarks/corelib/kernel/qproperty/tst_bench_qproperty.cpp
index 5d6db35d2b..c91ca1ea11 100644
--- a/tests/benchmarks/corelib/kernel/qproperty/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qproperty/tst_bench_qproperty.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
#include <QScopedPointer>
#include <QProperty>
@@ -33,7 +8,7 @@
#include "propertytester.h"
-class PropertyBenchmark : public QObject
+class tst_QProperty : public QObject
{
Q_OBJECT
private slots:
@@ -53,7 +28,7 @@ private slots:
void cppNotifyingDirectReadOnce();
};
-void PropertyBenchmark::cppOldBinding()
+void tst_QProperty::cppOldBinding()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
auto connection = connect(tester.data(), &PropertyTester::xOldChanged,
@@ -70,7 +45,7 @@ void PropertyBenchmark::cppOldBinding()
QObject::disconnect(connection);
}
-void PropertyBenchmark::cppOldBindingDirect()
+void tst_QProperty::cppOldBindingDirect()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
auto connection = connect(tester.data(), &PropertyTester::xOldChanged,
@@ -87,7 +62,7 @@ void PropertyBenchmark::cppOldBindingDirect()
QObject::disconnect(connection);
}
-void PropertyBenchmark::cppOldBindingReadOnce()
+void tst_QProperty::cppOldBindingReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
auto connection = connect(tester.data(), &PropertyTester::xOldChanged,
@@ -103,7 +78,7 @@ void PropertyBenchmark::cppOldBindingReadOnce()
QObject::disconnect(connection);
}
-void PropertyBenchmark::cppOldBindingDirectReadOnce()
+void tst_QProperty::cppOldBindingDirectReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
auto connection = connect(tester.data(), &PropertyTester::xOldChanged,
@@ -119,7 +94,7 @@ void PropertyBenchmark::cppOldBindingDirectReadOnce()
QObject::disconnect(connection);
}
-void PropertyBenchmark::cppNewBinding()
+void tst_QProperty::cppNewBinding()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->y.setBinding([&](){return tester->x.value();});
@@ -133,7 +108,7 @@ void PropertyBenchmark::cppNewBinding()
}
}
-void PropertyBenchmark::cppNewBindingDirect()
+void tst_QProperty::cppNewBindingDirect()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->y.setBinding([&](){return tester->x.value();});
@@ -146,7 +121,7 @@ void PropertyBenchmark::cppNewBindingDirect()
}
}
-void PropertyBenchmark::cppNewBindingReadOnce()
+void tst_QProperty::cppNewBindingReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->y.setBinding([&](){return tester->x.value();});
@@ -160,7 +135,7 @@ void PropertyBenchmark::cppNewBindingReadOnce()
QCOMPARE(tester->property("y").toInt(), i);
}
-void PropertyBenchmark::cppNewBindingDirectReadOnce()
+void tst_QProperty::cppNewBindingDirectReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->y.setBinding([&](){return tester->x.value();});
@@ -173,7 +148,7 @@ void PropertyBenchmark::cppNewBindingDirectReadOnce()
QCOMPARE(tester->y.value(), i);
}
-void PropertyBenchmark::cppNotifying()
+void tst_QProperty::cppNotifying()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->yNotified.setBinding([&](){return tester->xNotified.value();});
@@ -187,7 +162,7 @@ void PropertyBenchmark::cppNotifying()
}
}
-void PropertyBenchmark::cppNotifyingDirect()
+void tst_QProperty::cppNotifyingDirect()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->yNotified.setBinding([&](){return tester->xNotified.value();});
@@ -200,7 +175,7 @@ void PropertyBenchmark::cppNotifyingDirect()
}
}
-void PropertyBenchmark::cppNotifyingReadOnce()
+void tst_QProperty::cppNotifyingReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->yNotified.setBinding([&](){return tester->xNotified.value();});
@@ -214,7 +189,7 @@ void PropertyBenchmark::cppNotifyingReadOnce()
QCOMPARE(tester->property("yNotified").toInt(), i);
}
-void PropertyBenchmark::cppNotifyingDirectReadOnce()
+void tst_QProperty::cppNotifyingDirectReadOnce()
{
QScopedPointer<PropertyTester> tester {new PropertyTester};
tester->yNotified.setBinding([&](){return tester->xNotified.value();});
@@ -227,5 +202,6 @@ void PropertyBenchmark::cppNotifyingDirectReadOnce()
QCOMPARE(tester->yNotified.value(), i);
}
-QTEST_MAIN(PropertyBenchmark)
-#include "main.moc"
+QTEST_MAIN(tst_QProperty)
+
+#include "tst_bench_qproperty.moc"
diff --git a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
index 5ba14e43a2..22e04d98a2 100644
--- a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtimer_vs_qmetaobject.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## qtimer_vs_qmetaobject Binary:
@@ -9,9 +10,6 @@ qt_internal_add_benchmark(qtimer_vs_qmetaobject
tst_qtimer_vs_qmetaobject.cpp
INCLUDE_DIRECTORIES
.
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtimer_vs_qmetaobject.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp
index 52a726b292..d0b3e21772 100644
--- a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp
+++ b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_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
#include <QtCore>
#include <QTest>
@@ -126,13 +101,9 @@ void qtimer_vs_qmetaobject::bench_data()
void qtimer_vs_qmetaobject::benchBackgroundThread()
{
-#if !QT_CONFIG(cxx11_future)
- QSKIP("This test requires QThread::create");
-#else
QScopedPointer<QThread> thread(QThread::create([this]() { bench(); }));
thread->start();
QVERIFY(thread->wait());
-#endif
}
QTEST_MAIN(qtimer_vs_qmetaobject)
diff --git a/tests/benchmarks/corelib/kernel/qvariant/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qvariant/CMakeLists.txt
index 418fd1da9f..07978956b1 100644
--- a/tests/benchmarks/corelib/kernel/qvariant/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qvariant/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qvariant.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qvariant Binary:
@@ -6,16 +7,15 @@
qt_internal_add_benchmark(tst_bench_qvariant
SOURCES
- tst_qvariant.cpp
- PUBLIC_LIBRARIES
- Qt::Gui
+ tst_bench_qvariant.cpp
+ LIBRARIES
Qt::Test
)
## Scopes:
#####################################################################
-qt_internal_extend_target(tst_bench_qvariant CONDITION NOT TARGET Qt::Gui
- PUBLIC_LIBRARIES
- # Remove: gui
+qt_internal_extend_target(tst_bench_qvariant CONDITION TARGET Qt::Gui
+ LIBRARIES
+ Qt::Gui
)
diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_bench_qvariant.cpp
index f2618f7813..8b2e10c125 100644
--- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/benchmarks/corelib/kernel/qvariant/tst_bench_qvariant.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
#include <QtCore>
#ifdef QT_GUI_LIB
@@ -34,7 +9,7 @@
#define ITERATION_COUNT 1e5
-class tst_qvariant : public QObject
+class tst_QVariant : public QObject
{
Q_OBJECT
@@ -107,7 +82,7 @@ Q_DECLARE_TYPEINFO(SmallClass, Q_RELOCATABLE_TYPE);
QT_END_NAMESPACE
Q_DECLARE_METATYPE(SmallClass);
-void tst_qvariant::testBound()
+void tst_QVariant::testBound()
{
qreal d = qreal(.5);
QBENCHMARK {
@@ -148,7 +123,7 @@ void variantCreation<SmallClass>(SmallClass val)
}
template <>
-void variantCreation<tst_qvariant::ABenchmarkEnum>(tst_qvariant::ABenchmarkEnum val)
+void variantCreation<tst_QVariant::ABenchmarkEnum>(tst_QVariant::ABenchmarkEnum val)
{
QBENCHMARK {
for (int i = 0; i < ITERATION_COUNT; ++i) {
@@ -158,49 +133,49 @@ void variantCreation<tst_qvariant::ABenchmarkEnum>(tst_qvariant::ABenchmarkEnum
}
-void tst_qvariant::doubleVariantCreation()
+void tst_QVariant::doubleVariantCreation()
{
variantCreation<double>(0.0);
}
-void tst_qvariant::floatVariantCreation()
+void tst_QVariant::floatVariantCreation()
{
variantCreation<float>(0.0f);
}
-void tst_qvariant::rectVariantCreation()
+void tst_QVariant::rectVariantCreation()
{
variantCreation<QRect>(QRect(1, 2, 3, 4));
}
-void tst_qvariant::stringVariantCreation()
+void tst_QVariant::stringVariantCreation()
{
variantCreation<QString>(QString());
}
#ifdef QT_GUI_LIB
-void tst_qvariant::pixmapVariantCreation()
+void tst_QVariant::pixmapVariantCreation()
{
variantCreation<QPixmap>(QPixmap());
}
#endif
-void tst_qvariant::stringListVariantCreation()
+void tst_QVariant::stringListVariantCreation()
{
variantCreation<QStringList>(QStringList());
}
-void tst_qvariant::bigClassVariantCreation()
+void tst_QVariant::bigClassVariantCreation()
{
variantCreation<BigClass>(BigClass());
}
-void tst_qvariant::smallClassVariantCreation()
+void tst_QVariant::smallClassVariantCreation()
{
variantCreation<SmallClass>(SmallClass());
}
-void tst_qvariant::enumVariantCreation()
+void tst_QVariant::enumVariantCreation()
{
variantCreation<ABenchmarkEnum>(FirstEnumValue);
}
@@ -217,42 +192,42 @@ static void variantSetValue(T d)
}
}
-void tst_qvariant::doubleVariantSetValue()
+void tst_QVariant::doubleVariantSetValue()
{
variantSetValue<double>(0.0);
}
-void tst_qvariant::floatVariantSetValue()
+void tst_QVariant::floatVariantSetValue()
{
variantSetValue<float>(0.0f);
}
-void tst_qvariant::rectVariantSetValue()
+void tst_QVariant::rectVariantSetValue()
{
variantSetValue<QRect>(QRect());
}
-void tst_qvariant::stringVariantSetValue()
+void tst_QVariant::stringVariantSetValue()
{
variantSetValue<QString>(QString());
}
-void tst_qvariant::stringListVariantSetValue()
+void tst_QVariant::stringListVariantSetValue()
{
variantSetValue<QStringList>(QStringList());
}
-void tst_qvariant::bigClassVariantSetValue()
+void tst_QVariant::bigClassVariantSetValue()
{
variantSetValue<BigClass>(BigClass());
}
-void tst_qvariant::smallClassVariantSetValue()
+void tst_QVariant::smallClassVariantSetValue()
{
variantSetValue<SmallClass>(SmallClass());
}
-void tst_qvariant::enumVariantSetValue()
+void tst_QVariant::enumVariantSetValue()
{
variantSetValue<ABenchmarkEnum>(FirstEnumValue);
}
@@ -268,32 +243,32 @@ static void variantAssignment(T d)
}
}
-void tst_qvariant::doubleVariantAssignment()
+void tst_QVariant::doubleVariantAssignment()
{
variantAssignment<double>(0.0);
}
-void tst_qvariant::floatVariantAssignment()
+void tst_QVariant::floatVariantAssignment()
{
variantAssignment<float>(0.0f);
}
-void tst_qvariant::rectVariantAssignment()
+void tst_QVariant::rectVariantAssignment()
{
variantAssignment<QRect>(QRect());
}
-void tst_qvariant::stringVariantAssignment()
+void tst_QVariant::stringVariantAssignment()
{
variantAssignment<QString>(QString());
}
-void tst_qvariant::stringListVariantAssignment()
+void tst_QVariant::stringListVariantAssignment()
{
variantAssignment<QStringList>(QStringList());
}
-void tst_qvariant::doubleVariantValue()
+void tst_QVariant::doubleVariantValue()
{
QVariant v(0.0);
QBENCHMARK {
@@ -303,7 +278,7 @@ void tst_qvariant::doubleVariantValue()
}
}
-void tst_qvariant::floatVariantValue()
+void tst_QVariant::floatVariantValue()
{
QVariant v(0.0f);
QBENCHMARK {
@@ -313,7 +288,7 @@ void tst_qvariant::floatVariantValue()
}
}
-void tst_qvariant::rectVariantValue()
+void tst_QVariant::rectVariantValue()
{
QVariant v(QRect(1,2,3,4));
QBENCHMARK {
@@ -323,7 +298,7 @@ void tst_qvariant::rectVariantValue()
}
}
-void tst_qvariant::stringVariantValue()
+void tst_QVariant::stringVariantValue()
{
QVariant v = QString();
QBENCHMARK {
@@ -333,7 +308,7 @@ void tst_qvariant::stringVariantValue()
}
}
-void tst_qvariant::createCoreType_data()
+void tst_QVariant::createCoreType_data()
{
QTest::addColumn<int>("typeId");
for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i) {
@@ -346,7 +321,7 @@ void tst_qvariant::createCoreType_data()
// QVariant. The purpose of this benchmark is to measure the overhead
// of creating (and destroying) a QVariant compared to creating the
// type directly.
-void tst_qvariant::createCoreType()
+void tst_QVariant::createCoreType()
{
QFETCH(int, typeId);
QBENCHMARK {
@@ -355,7 +330,7 @@ void tst_qvariant::createCoreType()
}
}
-void tst_qvariant::createCoreTypeCopy_data()
+void tst_QVariant::createCoreTypeCopy_data()
{
createCoreType_data();
}
@@ -364,7 +339,7 @@ void tst_qvariant::createCoreTypeCopy_data()
// QVariant. The purpose of this benchmark is to measure the overhead
// of creating (and destroying) a QVariant compared to creating the
// type directly.
-void tst_qvariant::createCoreTypeCopy()
+void tst_QVariant::createCoreTypeCopy()
{
QFETCH(int, typeId);
QMetaType metaType(typeId);
@@ -376,6 +351,6 @@ void tst_qvariant::createCoreTypeCopy()
}
}
-QTEST_MAIN(tst_qvariant)
+QTEST_MAIN(tst_QVariant)
-#include "tst_qvariant.moc"
+#include "tst_bench_qvariant.moc"
diff --git a/tests/benchmarks/corelib/kernel/qwineventnotifier/CMakeLists.txt b/tests/benchmarks/corelib/kernel/qwineventnotifier/CMakeLists.txt
index a581b1eaef..e78d3250bc 100644
--- a/tests/benchmarks/corelib/kernel/qwineventnotifier/CMakeLists.txt
+++ b/tests/benchmarks/corelib/kernel/qwineventnotifier/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qwineventnotifier.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qwineventnotifier Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qwineventnotifier
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qwineventnotifier.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qwineventnotifier.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/kernel/qwineventnotifier/main.cpp b/tests/benchmarks/corelib/kernel/qwineventnotifier/tst_bench_qwineventnotifier.cpp
index 926ed5acdb..b1f87eabed 100644
--- a/tests/benchmarks/corelib/kernel/qwineventnotifier/main.cpp
+++ b/tests/benchmarks/corelib/kernel/qwineventnotifier/tst_bench_qwineventnotifier.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
#include <QTest>
#include <QtCore/qglobal.h>
@@ -34,7 +9,7 @@
#include <QtCore/qelapsedtimer.h>
#include <QtCore/qt_windows.h>
-class QWinEventNotifierBenchmark : public QObject
+class tst_QWinEventNotifier : public QObject
{
Q_OBJECT
@@ -102,7 +77,7 @@ protected:
int numberOfIterations;
};
-void QWinEventNotifierBenchmark::waves_data()
+void tst_QWinEventNotifier::waves_data()
{
QTest::addColumn<int>("waves");
QTest::addColumn<int>("notifiers");
@@ -112,7 +87,7 @@ void QWinEventNotifierBenchmark::waves_data()
}
}
-void QWinEventNotifierBenchmark::waves()
+void tst_QWinEventNotifier::waves()
{
QFETCH(int, waves);
QFETCH(int, notifiers);
@@ -131,6 +106,6 @@ void QWinEventNotifierBenchmark::waves()
emit factory.stop();
}
-QTEST_MAIN(QWinEventNotifierBenchmark)
+QTEST_MAIN(tst_QWinEventNotifier)
-#include "main.moc"
+#include "tst_bench_qwineventnotifier.moc"
diff --git a/tests/benchmarks/corelib/mimetypes/CMakeLists.txt b/tests/benchmarks/corelib/mimetypes/CMakeLists.txt
index c825780e69..f66834de23 100644
--- a/tests/benchmarks/corelib/mimetypes/CMakeLists.txt
+++ b/tests/benchmarks/corelib/mimetypes/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from mimetypes.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qmimedatabase)
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/CMakeLists.txt b/tests/benchmarks/corelib/mimetypes/qmimedatabase/CMakeLists.txt
index 7adc043639..3d4eb7b46f 100644
--- a/tests/benchmarks/corelib/mimetypes/qmimedatabase/CMakeLists.txt
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmimedatabase.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmimedatabase Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qmimedatabase
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qmimedatabase.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/N.tar.gz b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/N.tar.gz
new file mode 100644
index 0000000000..0a710447a5
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/N.tar.gz
Binary files differ
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/X b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/X
new file mode 100644
index 0000000000..a84546e5bc
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/X
@@ -0,0 +1 @@
+#include <math.h>
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/t.c b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/t.c
new file mode 100644
index 0000000000..3774c48f13
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/t.c
@@ -0,0 +1 @@
+void x();
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/u.txt b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/u.txt
new file mode 100644
index 0000000000..8d45724eff
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/u.txt
@@ -0,0 +1,4 @@
+foo
+bar
+-
+_
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/y b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/y
new file mode 100644
index 0000000000..399593b6ce
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/y
@@ -0,0 +1 @@
+diff --git a/plugins/patchreview/kdevpatchreview.json b/plugins/patchreview/kdevpatchreview.json
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/z b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/z
new file mode 100644
index 0000000000..d1ed8a45d1
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/files/z
Binary files differ
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
deleted file mode 100644
index 900e7028a4..0000000000
--- a/tests/benchmarks/corelib/mimetypes/qmimedatabase/main.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-#include <QMimeDatabase>
-
-class tst_QMimeDatabase: public QObject
-{
-
- Q_OBJECT
-
-private slots:
- void inheritsPerformance();
- void benchMimeTypeForName();
-};
-
-void tst_QMimeDatabase::inheritsPerformance()
-{
- // Check performance of inherits().
- // This benchmark (which started in 2009 in kmimetypetest.cpp) uses 40 mimetypes.
- QStringList mimeTypes;
- mimeTypes << QLatin1String("image/jpeg") << QLatin1String("image/png") << QLatin1String("image/tiff") << QLatin1String("text/plain") << QLatin1String("text/html");
- mimeTypes += mimeTypes;
- mimeTypes += mimeTypes;
- mimeTypes += mimeTypes;
- QCOMPARE(mimeTypes.count(), 40);
- QMimeDatabase db;
- QMimeType mime = db.mimeTypeForName(QString::fromLatin1("text/x-chdr"));
- QVERIFY(mime.isValid());
- QBENCHMARK {
- QString match;
- foreach (const QString &mt, mimeTypes) {
- if (mime.inherits(mt)) {
- match = mt;
- // of course there would normally be a "break" here, but we're testing worse-case
- // performance here
- }
- }
- QCOMPARE(match, QString::fromLatin1("text/plain"));
- }
- // Numbers from 2011, in release mode:
- // KDE 4.7 numbers: 0.21 msec / 494,000 ticks / 568,345 instr. loads per iteration
- // QMimeBinaryProvider (with Qt 5): 0.16 msec / NA / 416,049 instr. reads per iteration
- // QMimeXmlProvider (with Qt 5): 0.062 msec / NA / 172,889 instr. reads per iteration
- // (but the startup time is way higher)
- // And memory usage is flat at 200K with QMimeBinaryProvider, while it peaks at 6 MB when
- // parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes.
-}
-
-void tst_QMimeDatabase::benchMimeTypeForName()
-{
- QMimeDatabase db;
-
- QBENCHMARK {
- const auto s = db.mimeTypeForName(QStringLiteral("text/plain"));
- QVERIFY(s.isValid());
- }
-}
-
-QTEST_MAIN(tst_QMimeDatabase)
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp b/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp
new file mode 100644
index 0000000000..ffc65e7949
--- /dev/null
+++ b/tests/benchmarks/corelib/mimetypes/qmimedatabase/tst_bench_qmimedatabase.cpp
@@ -0,0 +1,146 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2021 Igor Kushnir <igorkuo@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QTest>
+#include <QMimeDatabase>
+
+using namespace Qt::StringLiterals;
+
+namespace {
+struct MatchModeInfo
+{
+ QMimeDatabase::MatchMode mode;
+ const char *name;
+};
+
+constexpr MatchModeInfo matchModes[] = { { QMimeDatabase::MatchDefault, "Default" },
+ { QMimeDatabase::MatchExtension, "Extension" },
+ { QMimeDatabase::MatchContent, "Content" } };
+
+void addFileRows(const char *tag, const QString &fileName, const QStringList &expectedMimeNames)
+{
+ QCOMPARE(static_cast<std::size_t>(expectedMimeNames.size()), std::size(matchModes));
+ for (int i = 0; i < expectedMimeNames.size(); ++i) {
+ QTest::addRow(qPrintable(tag + QStringLiteral(" - %s")), matchModes[i].name)
+ << fileName << matchModes[i].mode << expectedMimeNames[i];
+ }
+}
+
+void addExistentFileRows(const char *tag, const QString &fileName,
+ const QStringList &expectedMimeNames)
+{
+ const QString filePath = QFINDTESTDATA("files/" + fileName);
+ QVERIFY2(!filePath.isEmpty(),
+ qPrintable(QStringLiteral("Cannot find test file %1 in files/").arg(fileName)));
+ addFileRows(tag, filePath, expectedMimeNames);
+}
+}
+
+class tst_QMimeDatabase: public QObject
+{
+
+ Q_OBJECT
+
+private slots:
+ void inheritsPerformance();
+ void benchMimeTypeForName();
+ void benchMimeTypeForFile_data();
+ void benchMimeTypeForFile();
+};
+
+void tst_QMimeDatabase::inheritsPerformance()
+{
+ // Check performance of inherits().
+ // This benchmark (which started in 2009 in kmimetypetest.cpp) uses 40 mimetypes.
+ // (eight groups of five unique ones)
+ const QString uniqueMimeTypes[] = {
+ u"image/jpeg"_s,
+ u"image/png"_s,
+ u"image/tiff"_s,
+ u"text/plain"_s,
+ u"text/html"_s,
+ };
+ constexpr size_t NumOuterLoops = 40 / std::size(uniqueMimeTypes);
+ QMimeDatabase db;
+ const QMimeType mime = db.mimeTypeForName(u"text/x-chdr"_s);
+ QVERIFY(mime.isValid());
+ QString match;
+ QBENCHMARK {
+ for (size_t i = 0; i < NumOuterLoops; ++i) {
+ for (const QString &mt : uniqueMimeTypes) {
+ if (mime.inherits(mt)) {
+ match = mt;
+ // of course there would normally be a "break" here, but
+ // we're testing worse-case performance here
+ }
+ }
+ }
+ }
+ QCOMPARE(match, u"text/plain"_s);
+ // Numbers from 2011, in release mode:
+ // KDE 4.7 numbers: 0.21 msec / 494,000 ticks / 568,345 instr. loads per iteration
+ // QMimeBinaryProvider (with Qt 5): 0.16 msec / NA / 416,049 instr. reads per iteration
+ // QMimeXmlProvider (with Qt 5): 0.062 msec / NA / 172,889 instr. reads per iteration
+ // (but the startup time is way higher)
+ // And memory usage is flat at 200K with QMimeBinaryProvider, while it peaks at 6 MB when
+ // parsing XML, and then keeps being around 4.5 MB for all the in-memory hashes.
+}
+
+void tst_QMimeDatabase::benchMimeTypeForName()
+{
+ QMimeDatabase db;
+
+ QBENCHMARK {
+ const auto s = db.mimeTypeForName(QStringLiteral("text/plain"));
+ QVERIFY(s.isValid());
+ }
+}
+
+void tst_QMimeDatabase::benchMimeTypeForFile_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QMimeDatabase::MatchMode>("mode");
+ QTest::addColumn<QString>("expectedMimeName");
+
+ addFileRows("archive", "a.tar.gz",
+ { "application/x-compressed-tar",
+ "application/x-compressed-tar",
+ "application/octet-stream" });
+ addFileRows("OpenDocument Text", "b.odt",
+ { "application/vnd.oasis.opendocument.text",
+ "application/vnd.oasis.opendocument.text",
+ "application/octet-stream" });
+
+ addExistentFileRows(
+ "existent archive with extension", "N.tar.gz",
+ { "application/x-compressed-tar", "application/x-compressed-tar", "application/gzip" });
+ addExistentFileRows("existent C with extension", "t.c",
+ { "text/x-csrc", "text/x-csrc", "text/plain" });
+ addExistentFileRows("existent text file with extension", "u.txt",
+ { "text/plain", "text/plain", "text/plain" });
+ addExistentFileRows("existent C w/o extension", "X",
+ { "text/x-csrc", "application/octet-stream", "text/x-csrc" });
+ addExistentFileRows("existent patch w/o extension", "y",
+ { "text/x-patch", "application/octet-stream", "text/x-patch" });
+ addExistentFileRows("existent archive w/o extension", "z",
+ { "application/gzip", "application/octet-stream", "application/gzip" });
+}
+
+void tst_QMimeDatabase::benchMimeTypeForFile()
+{
+ QFETCH(const QString, fileName);
+ QFETCH(const QMimeDatabase::MatchMode, mode);
+ QFETCH(const QString, expectedMimeName);
+
+ QMimeDatabase db;
+
+ QBENCHMARK {
+ const auto mimeType = db.mimeTypeForFile(fileName, mode);
+ QCOMPARE(mimeType.name(), expectedMimeName);
+ }
+}
+
+QTEST_MAIN(tst_QMimeDatabase)
+
+#include "tst_bench_qmimedatabase.moc"
diff --git a/tests/benchmarks/corelib/plugin/CMakeLists.txt b/tests/benchmarks/corelib/plugin/CMakeLists.txt
index 3ae12b23f5..fdfc6d8b8c 100644
--- a/tests/benchmarks/corelib/plugin/CMakeLists.txt
+++ b/tests/benchmarks/corelib/plugin/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from plugin.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(quuid)
diff --git a/tests/benchmarks/corelib/plugin/quuid/CMakeLists.txt b/tests/benchmarks/corelib/plugin/quuid/CMakeLists.txt
index 3b787dc8e8..2c394b2bb2 100644
--- a/tests/benchmarks/corelib/plugin/quuid/CMakeLists.txt
+++ b/tests/benchmarks/corelib/plugin/quuid/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from quuid.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_quuid Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_quuid
SOURCES
- tst_quuid.cpp
- PUBLIC_LIBRARIES
+ tst_bench_quuid.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:quuid.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp b/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp
index 0bc0a7de93..7a6da7f84c 100644
--- a/tests/benchmarks/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/benchmarks/corelib/plugin/quuid/tst_bench_quuid.cpp
@@ -1,43 +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
#include <QtCore/QCoreApplication>
#include <QtCore/QUuid>
#include <QTest>
-class tst_bench_QUuid : public QObject
+class tst_QUuid : public QObject
{
Q_OBJECT
-public:
- tst_bench_QUuid()
- { }
-
private slots:
void createUuid();
void fromChar();
@@ -56,29 +27,29 @@ private slots:
void operatorMore();
};
-void tst_bench_QUuid::createUuid()
+void tst_QUuid::createUuid()
{
QBENCHMARK {
- QUuid::createUuid();
+ [[maybe_unused]] auto r = QUuid::createUuid();
}
}
-void tst_bench_QUuid::fromChar()
+void tst_QUuid::fromChar()
{
QBENCHMARK {
QUuid uuid("{67C8770B-44F1-410A-AB9A-F9B5446F13EE}");
}
}
-void tst_bench_QUuid::toString()
+void tst_QUuid::toString()
{
QUuid uuid = QUuid::createUuid();
QBENCHMARK {
- uuid.toString();
+ [[maybe_unused]] auto r = uuid.toString();
}
}
-void tst_bench_QUuid::fromString()
+void tst_QUuid::fromString()
{
QString string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}";
QBENCHMARK {
@@ -86,15 +57,15 @@ void tst_bench_QUuid::fromString()
}
}
-void tst_bench_QUuid::toByteArray()
+void tst_QUuid::toByteArray()
{
QUuid uuid = QUuid::createUuid();
QBENCHMARK {
- uuid.toByteArray();
+ [[maybe_unused]] auto r = uuid.toByteArray();
}
}
-void tst_bench_QUuid::fromByteArray()
+void tst_QUuid::fromByteArray()
{
QByteArray string = "{67C8770B-44F1-410A-AB9A-F9B5446F13EE}";
QBENCHMARK {
@@ -102,15 +73,15 @@ void tst_bench_QUuid::fromByteArray()
}
}
-void tst_bench_QUuid::toRfc4122()
+void tst_QUuid::toRfc4122()
{
QUuid uuid = QUuid::createUuid();
QBENCHMARK {
- uuid.toRfc4122();
+ [[maybe_unused]] auto r = uuid.toRfc4122();
}
}
-void tst_bench_QUuid::fromRfc4122()
+void tst_QUuid::fromRfc4122()
{
QByteArray string = QByteArray::fromHex("67C8770B44F1410AAB9AF9B5446F13EE");
QBENCHMARK {
@@ -119,7 +90,7 @@ void tst_bench_QUuid::fromRfc4122()
}
}
-void tst_bench_QUuid::createUuidV3()
+void tst_QUuid::createUuidV3()
{
QUuid ns = QUuid::createUuid();
QByteArray name = QByteArray("Test");
@@ -129,7 +100,7 @@ void tst_bench_QUuid::createUuidV3()
}
}
-void tst_bench_QUuid::createUuidV5()
+void tst_QUuid::createUuidV5()
{
QUuid ns = QUuid::createUuid();
QByteArray name = QByteArray("Test");
@@ -139,7 +110,7 @@ void tst_bench_QUuid::createUuidV5()
}
}
-void tst_bench_QUuid::toDataStream()
+void tst_QUuid::toDataStream()
{
QUuid uuid = QUuid::createUuid();
QByteArray ar;
@@ -151,7 +122,7 @@ void tst_bench_QUuid::toDataStream()
}
}
-void tst_bench_QUuid::fromDataStream()
+void tst_QUuid::fromDataStream()
{
QUuid uuid1, uuid2;
uuid1 = QUuid::createUuid();
@@ -168,33 +139,34 @@ void tst_bench_QUuid::fromDataStream()
}
}
-void tst_bench_QUuid::isNull()
+void tst_QUuid::isNull()
{
QUuid uuid = QUuid();
QBENCHMARK {
- uuid.isNull();
+ [[maybe_unused]] auto r = uuid.isNull();
}
}
-void tst_bench_QUuid::operatorLess()
+void tst_QUuid::operatorLess()
{
QUuid uuid1, uuid2;
uuid1 = QUuid::createUuid();
uuid2 = QUuid::createUuid();
QBENCHMARK {
- uuid1 < uuid2;
+ [[maybe_unused]] auto r = uuid1 < uuid2;
}
}
-void tst_bench_QUuid::operatorMore()
+void tst_QUuid::operatorMore()
{
QUuid uuid1, uuid2;
uuid1 = QUuid::createUuid();
uuid2 = QUuid::createUuid();
QBENCHMARK {
- uuid1 > uuid2;
+ [[maybe_unused]] auto r = uuid1 > uuid2;
}
}
-QTEST_MAIN(tst_bench_QUuid);
-#include "tst_quuid.moc"
+QTEST_MAIN(tst_QUuid)
+
+#include "tst_bench_quuid.moc"
diff --git a/tests/benchmarks/corelib/serialization/CMakeLists.txt b/tests/benchmarks/corelib/serialization/CMakeLists.txt
new file mode 100644
index 0000000000..98343d7688
--- /dev/null
+++ b/tests/benchmarks/corelib/serialization/CMakeLists.txt
@@ -0,0 +1,4 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+add_subdirectory(qcborvalue)
diff --git a/tests/benchmarks/corelib/serialization/qcborvalue/CMakeLists.txt b/tests/benchmarks/corelib/serialization/qcborvalue/CMakeLists.txt
new file mode 100644
index 0000000000..6ada5b983d
--- /dev/null
+++ b/tests/benchmarks/corelib/serialization/qcborvalue/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_benchmark(tst_bench_qcborvalue
+ SOURCES
+ tst_bench_qcborvalue.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::Test
+)
diff --git a/tests/benchmarks/corelib/serialization/qcborvalue/tst_bench_qcborvalue.cpp b/tests/benchmarks/corelib/serialization/qcborvalue/tst_bench_qcborvalue.cpp
new file mode 100644
index 0000000000..b9978fa25c
--- /dev/null
+++ b/tests/benchmarks/corelib/serialization/qcborvalue/tst_bench_qcborvalue.cpp
@@ -0,0 +1,95 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QCborMap>
+#include <QCborValue>
+
+#include <QTest>
+
+template <typename Char>
+struct SampleStrings
+{
+ static constexpr char key[] = "hello";
+};
+
+template <>
+struct SampleStrings<char16_t>
+{
+ static constexpr char16_t key[] = u"hello";
+};
+
+template <>
+struct SampleStrings<QChar>
+{
+ static const QChar *const key;
+};
+const QChar *const SampleStrings<QChar>::key =
+ reinterpret_cast<const QChar *>(SampleStrings<char16_t>::key);
+
+template <typename T, typename = void>
+constexpr bool hasValueType = false;
+
+template <typename T>
+constexpr bool hasValueType<T, std::void_t<typename T::value_type>> = true;
+
+class tst_QCborValue : public QObject
+{
+ Q_OBJECT
+private:
+ template <typename Type>
+ void doKeyLookup();
+
+ template <typename Type>
+ void doConstruct();
+
+private slots:
+ void keyLookupLatin1() { doKeyLookup<QLatin1StringView>(); }
+ void keyLookupString() { doKeyLookup<QString>(); }
+ void keyLookupConstCharPtr() { doKeyLookup<char>(); };
+
+ void constructLatin1() { doConstruct<QLatin1StringView>(); }
+ void constructString() { doConstruct<QString>(); }
+ void constructStringView() { doConstruct<QStringView>(); }
+ void constructConstCharPtr() { doConstruct<char>(); }
+};
+
+template <typename Type>
+void tst_QCborValue::doKeyLookup()
+{
+ const QCborMap m{{"hello", "world"}, {1, 2}};
+ const QCborValue v = m;
+
+ if constexpr (hasValueType<Type>) {
+ using Char = std::remove_cv_t<typename Type::value_type>;
+ using Strings = SampleStrings<Char>;
+ const Type s(Strings::key);
+ QBENCHMARK {
+ [[maybe_unused]] const QCborValue r = v[s];
+ }
+ } else {
+ QBENCHMARK {
+ [[maybe_unused]] const QCborValue r = v[SampleStrings<Type>::key];
+ }
+ }
+}
+
+template<typename Type>
+void tst_QCborValue::doConstruct()
+{
+ if constexpr (hasValueType<Type>) {
+ using Char = std::remove_cv_t<typename Type::value_type>;
+ using Strings = SampleStrings<Char>;
+ const Type s(Strings::key);
+ QBENCHMARK {
+ [[maybe_unused]] const auto v = QCborValue{s};
+ }
+ } else {
+ QBENCHMARK {
+ [[maybe_unused]] const auto v = QCborValue{SampleStrings<Type>::key};
+ }
+ }
+}
+
+QTEST_MAIN(tst_QCborValue)
+
+#include "tst_bench_qcborvalue.moc"
diff --git a/tests/benchmarks/corelib/text/CMakeLists.txt b/tests/benchmarks/corelib/text/CMakeLists.txt
index 8942b898d0..303aa51def 100644
--- a/tests/benchmarks/corelib/text/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from text.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qbytearray)
add_subdirectory(qchar)
@@ -7,6 +8,5 @@ add_subdirectory(qstringbuilder)
add_subdirectory(qstringlist)
add_subdirectory(qstringtokenizer)
add_subdirectory(qregularexpression)
-if(GCC)
- add_subdirectory(qstring)
-endif()
+add_subdirectory(qstring)
+add_subdirectory(qutf8stringview)
diff --git a/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt b/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt
index 50574aa221..1ea3660680 100644
--- a/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qbytearray.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qbytearray Binary:
@@ -6,11 +7,7 @@
qt_internal_add_benchmark(tst_bench_qbytearray
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qbytearray.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qbytearray.pro:<TRUE>:
-# TEMPLATE = "app"
-# TESTDATA = "main.cpp"
diff --git a/tests/benchmarks/corelib/text/qbytearray/main.cpp b/tests/benchmarks/corelib/text/qbytearray/tst_bench_qbytearray.cpp
index e421e7436b..a97cba7c50 100644
--- a/tests/benchmarks/corelib/text/qbytearray/main.cpp
+++ b/tests/benchmarks/corelib/text/qbytearray/tst_bench_qbytearray.cpp
@@ -1,40 +1,15 @@
-/****************************************************************************
-**
-** 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) 2021 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QIODevice>
#include <QFile>
#include <QString>
#include <qtest.h>
+#include <limits>
-
-class tst_qbytearray : public QObject
+class tst_QByteArray : public QObject
{
Q_OBJECT
QByteArray sourcecode;
@@ -43,21 +18,32 @@ private slots:
void append();
void append_data();
+ void toLongLong_data();
+ void toLongLong();
+ void toULongLong_data();
+ void toULongLong();
+
void latin1Uppercasing_qt54();
void latin1Uppercasing_xlate();
void latin1Uppercasing_xlate_checked();
void latin1Uppercasing_category();
void latin1Uppercasing_bitcheck();
+
+ void toPercentEncoding_data();
+ void toPercentEncoding();
+
+ void operator_assign_char();
+ void operator_assign_char_data();
};
-void tst_qbytearray::initTestCase()
+void tst_QByteArray::initTestCase()
{
- QFile self(QFINDTESTDATA("main.cpp"));
+ QFile self(QFINDTESTDATA("tst_bench_qbytearray.cpp"));
QVERIFY(self.open(QIODevice::ReadOnly));
sourcecode = self.readAll();
}
-void tst_qbytearray::append_data()
+void tst_QByteArray::append_data()
{
QTest::addColumn<int>("size");
QTest::newRow("1") << int(1);
@@ -71,7 +57,7 @@ void tst_qbytearray::append_data()
QTest::newRow("100000000") << int(100000000);
}
-void tst_qbytearray::append()
+void tst_QByteArray::append()
{
QFETCH(int, size);
@@ -83,7 +69,90 @@ void tst_qbytearray::append()
}
}
-void tst_qbytearray::latin1Uppercasing_qt54()
+static QByteArray decNext(QByteArray big)
+{
+ // Increments a decimal digit-string (ignoring sign, so decrements if
+ // negative); only intended for taking a boundary value just out of range,
+ // so big is never a string of only 9s (that'd be one less than a power of
+ // ten, which cannot be a power of two, as odd, or one less than one, as the
+ // power of ten isn't a power of two).
+ int i = big.size() - 1;
+ while (big.at(i) == '9')
+ big[i--] = '0';
+ big[i] += 1;
+ return big;
+}
+
+void tst_QByteArray::toLongLong_data()
+{
+ QTest::addColumn<QByteArray>("text");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<qlonglong>("number");
+#define ROW(n) QTest::newRow(#n) << QByteArray(#n) << true << n ## LL
+ ROW(0);
+ ROW(1);
+ ROW(-1);
+ ROW(17);
+ ROW(-17);
+ ROW(1234567890);
+ ROW(-1234567890);
+#undef ROW
+ using LL = std::numeric_limits<qlonglong>;
+ QTest::newRow("min") << QByteArray::number(LL::min()) << true << LL::min();
+ QTest::newRow("min-1") << decNext(QByteArray::number(LL::min())) << false << 0LL;
+ QTest::newRow("max") << QByteArray::number(LL::max()) << true << LL::max();
+ QTest::newRow("max+1") << decNext(QByteArray::number(LL::max())) << false << 0LL;
+}
+
+void tst_QByteArray::toLongLong()
+{
+ QFETCH(QByteArray, text);
+ QFETCH(bool, good);
+ QFETCH(qlonglong, number);
+
+ qlonglong actual = 0;
+ bool ok;
+ QBENCHMARK {
+ actual = text.toLongLong(&ok);
+ }
+ QCOMPARE(actual, number);
+ QCOMPARE(ok, good);
+}
+
+void tst_QByteArray::toULongLong_data()
+{
+ QTest::addColumn<QByteArray>("text");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<qulonglong>("number");
+#define ROW(n) \
+ QTest::newRow(#n) << QByteArray(#n) << true << n ## ULL; \
+ QTest::newRow("-" #n) << QByteArray("-" #n) << false << 0ULL
+ ROW(0);
+ ROW(1);
+ ROW(17);
+ ROW(1234567890);
+#undef ROW
+ using ULL = std::numeric_limits<qulonglong>;
+ QTest::newRow("max") << QByteArray::number(ULL::max()) << true << ULL::max();
+ QTest::newRow("max+1") << decNext(QByteArray::number(ULL::max())) << false << 0ULL;
+}
+
+void tst_QByteArray::toULongLong()
+{
+ QFETCH(QByteArray, text);
+ QFETCH(bool, good);
+ QFETCH(qulonglong, number);
+
+ qulonglong actual = 0;
+ bool ok;
+ QBENCHMARK {
+ actual = text.toULongLong(&ok);
+ }
+ QCOMPARE(actual, number);
+ QCOMPARE(ok, good);
+}
+
+void tst_QByteArray::latin1Uppercasing_qt54()
{
QByteArray s = sourcecode;
s.detach();
@@ -132,7 +201,7 @@ static const uchar uppercased[256] = {
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xf7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xff
};
-void tst_qbytearray::latin1Uppercasing_xlate()
+void tst_QByteArray::latin1Uppercasing_xlate()
{
QByteArray output = sourcecode;
output.detach();
@@ -146,7 +215,7 @@ void tst_qbytearray::latin1Uppercasing_xlate()
}
}
-void tst_qbytearray::latin1Uppercasing_xlate_checked()
+void tst_QByteArray::latin1Uppercasing_xlate_checked()
{
QByteArray output = sourcecode;
output.detach();
@@ -199,7 +268,7 @@ static const char categories[256] = {
2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,0
};
-void tst_qbytearray::latin1Uppercasing_category()
+void tst_QByteArray::latin1Uppercasing_category()
{
QByteArray output = sourcecode;
output.detach();
@@ -244,7 +313,7 @@ static bool bittest(const quint32 *data, uchar bit)
return data[bit / bitsperelem] & (1 << (bit & (bitsperelem - 1)));
}
-void tst_qbytearray::latin1Uppercasing_bitcheck()
+void tst_QByteArray::latin1Uppercasing_bitcheck()
{
QByteArray output = sourcecode;
output.detach();
@@ -258,7 +327,67 @@ void tst_qbytearray::latin1Uppercasing_bitcheck()
}
}
+void tst_QByteArray::toPercentEncoding_data()
+{
+ QTest::addColumn<QByteArray>("plaintext");
+ QTest::addColumn<QByteArray>("expected");
+
+ QTest::newRow("empty") << QByteArray("") << QByteArray("");
+ QTest::newRow("plain")
+ << QByteArray("the quick brown fox jumped over the lazy dogs")
+ << QByteArray("the%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dogs");
+ QTest::newRow("specials")
+ << QByteArray(
+ "\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15"
+ "\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\"#$%&'()*+,/:;<=>?@[\\]^`{|}\x7f")
+ << QByteArray(
+ "%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18"
+ "%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2F%3A%3B%3C"
+ "%3D%3E%3F%40%5B%5C%5D%5E%60%7B%7C%7D%7F");
+}
+
+void tst_QByteArray::toPercentEncoding()
+{
+ QFETCH(QByteArray, plaintext);
+ QByteArray encoded;
+ QBENCHMARK {
+ encoded = plaintext.toPercentEncoding();
+ }
+ QTEST(encoded, "expected");
+}
+
+void tst_QByteArray::operator_assign_char()
+{
+ QFETCH(QByteArray, data);
+ QString str(data.size(), Qt::Uninitialized);
+
+ const char *tdata = data.constData();
+ QBENCHMARK {
+ str.operator=(tdata);
+ }
+}
+
+void tst_QByteArray::operator_assign_char_data()
+{
+ QTest::addColumn<QByteArray>("data");
+
+ QByteArray data;
+ data.fill('a', 5);
+ QTest::newRow("length: 5") << data;
+ data.fill('b', 10);
+ QTest::newRow("length: 10") << data;
+ data.fill('c', 20);
+ QTest::newRow("length: 20") << data;
+ data.fill('d', 50);
+ QTest::newRow("length: 50") << data;
+ data.fill('e', 100);
+ QTest::newRow("length: 100") << data;
+ data.fill('f', 500);
+ QTest::newRow("length: 500") << data;
+ data.fill('g', 1'000);
+ QTest::newRow("length: 1'000") << data;
+}
-QTEST_MAIN(tst_qbytearray)
+QTEST_MAIN(tst_QByteArray)
-#include "main.moc"
+#include "tst_bench_qbytearray.moc"
diff --git a/tests/benchmarks/corelib/text/qchar/CMakeLists.txt b/tests/benchmarks/corelib/text/qchar/CMakeLists.txt
index afdf96e9d4..136d3ef6fa 100644
--- a/tests/benchmarks/corelib/text/qchar/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qchar/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qchar.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qchar Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qchar
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qchar.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qchar/main.cpp b/tests/benchmarks/corelib/text/qchar/tst_bench_qchar.cpp
index 746f9730f7..194dd27d36 100644
--- a/tests/benchmarks/corelib/text/qchar/main.cpp
+++ b/tests/benchmarks/corelib/text/qchar/tst_bench_qchar.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
#include <QTest>
#include <QChar>
@@ -133,4 +108,4 @@ void tst_QChar::isSpace()
QTEST_MAIN(tst_QChar)
-#include "main.moc"
+#include "tst_bench_qchar.moc"
diff --git a/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt b/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt
index 1c692af6c8..04c2f69b9f 100644
--- a/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qlocale.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qlocale Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qlocale
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qlocale.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qlocale/main.cpp b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp
index 887053ae4a..3d13174c9c 100644
--- a/tests/benchmarks/corelib/text/qlocale/main.cpp
+++ b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp
@@ -1,34 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** 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) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QLocale>
#include <QTest>
+using namespace Qt::StringLiterals;
+
class tst_QLocale : public QObject
{
Q_OBJECT
@@ -54,6 +31,12 @@ private Q_SLOTS:
void toUpper_QLocale_2();
void toUpper_QString();
void number_QString();
+ void toLongLong_data();
+ void toLongLong();
+ void toULongLong_data();
+ void toULongLong();
+ void toDouble_data();
+ void toDouble();
};
static QString data()
@@ -392,6 +375,219 @@ void tst_QLocale::number_QString()
}
}
+template <typename Integer>
+void toWholeCommon_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<Integer>("expected");
+
+ QTest::newRow("C: empty") << u""_s << u"C"_s << false << Integer(0ull);
+ QTest::newRow("C: 0") << u"0"_s << u"C"_s << true << Integer(0ull);
+ QTest::newRow("C: 1234") << u"1234"_s << u"C"_s << true << Integer(1234ull);
+ // C locale omits grouping, but doesn't reject it.
+ QTest::newRow("C: 1,234") << u"1,234"_s << u"C"_s << true << Integer(1234ull);
+ QTest::newRow("C: 123456789")
+ << u"123456789"_s << u"C"_s << true << Integer(123456789ull);
+ QTest::newRow("C: 123,456,789")
+ << u"123,456,789"_s << u"C"_s << true << Integer(123456789ull);
+
+ QTest::newRow("en: empty") << u""_s << u"en"_s << false << Integer(0ull);
+ QTest::newRow("en: 0") << u"0"_s << u"en"_s << true << Integer(0ull);
+ QTest::newRow("en: 1234") << u"1234"_s << u"en"_s << true << Integer(1234ull);
+ QTest::newRow("en: 1,234") << u"1,234"_s << u"en"_s << true << Integer(1234ull);
+ QTest::newRow("en: 123,456,789")
+ << u"123,456,789"_s << u"en"_s << true << Integer(123456789ull);
+ QTest::newRow("en: 123456789")
+ << u"123456789"_s << u"en"_s << true << Integer(123456789ull);
+
+ QTest::newRow("de: empty") << u""_s << u"de"_s << false << Integer(0ull);
+ QTest::newRow("de: 0") << u"0"_s << u"de"_s << true << Integer(0ull);
+ QTest::newRow("de: 1234") << u"1234"_s << u"de"_s << true << Integer(1234ull);
+ QTest::newRow("de: 1.234") << u"1.234"_s << u"de"_s << true << Integer(1234ull);
+ QTest::newRow("de: 123.456.789")
+ << u"123.456.789"_s << u"de"_s << true << Integer(123456789ull);
+ QTest::newRow("de: 123456789")
+ << u"123456789"_s << u"de"_s << true << Integer(123456789ull);
+
+ // Locales with non-single-character signs:
+ QTest::newRow("ar_EG: +403") // Arabic, Egypt
+ << u"\u061c+\u0664\u0660\u0663"_s << u"ar_EG"_s << true << Integer(403ull);
+ QTest::newRow("ar_EG: !403") // Only first character of the sign
+ << u"\u061c\u0664\u0660\u0663"_s << u"ar_EG"_s << false << Integer(0ull);
+ QTest::newRow("fa_IR: +403") // Farsi, Iran
+ << u"\u200e+\u06f4\u06f0\u06f3"_s << u"fa_IR"_s << true << Integer(403ull);
+ QTest::newRow("fa_IR: !403") // Only first character of sign
+ << u"\u200e\u06f4\u06f0\u06f3"_s << u"fa_IR"_s << false << Integer(0ull);
+}
+
+void tst_QLocale::toLongLong_data()
+{
+ toWholeCommon_data<qlonglong>();
+
+ QTest::newRow("C: -1234") << u"-1234"_s << u"C"_s << true << -1234ll;
+ QTest::newRow("C: -123456789") << u"-123456789"_s << u"C"_s << true << -123456789ll;
+ QTest::newRow("C: qlonglong-max")
+ << u"9223372036854775807"_s << u"C"_s << true
+ << std::numeric_limits<qlonglong>::max();
+ QTest::newRow("C: qlonglong-min")
+ << u"-9223372036854775808"_s << u"C"_s << true
+ << std::numeric_limits<qlonglong>::min();
+
+ // Locales with multi-character signs:
+ QTest::newRow("ar_EG: -403") // Arabic, Egypt
+ << u"\u061c-\u0664\u0660\u0663"_s << u"ar_EG"_s << true << -403ll;
+ QTest::newRow("fa_IR: -403") // Farsi, Iran
+ << u"\u200e\u2212\u06f4\u06f0\u06f3"_s << u"fa_IR"_s << true << -403ll;
+}
+
+void tst_QLocale::toLongLong()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, locale);
+ QFETCH(bool, good);
+ QFETCH(qlonglong, expected);
+
+ const QLocale loc(locale);
+ qlonglong actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = loc.toLongLong(text, &ok);
+ }
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
+void tst_QLocale::toULongLong_data()
+{
+ toWholeCommon_data<qulonglong>();
+
+ QTest::newRow("C: qlonglong-max + 1")
+ << u"9223372036854775808"_s << u"C"_s << true
+ << (qulonglong(std::numeric_limits<qlonglong>::max()) + 1);
+ QTest::newRow("C: qulonglong-max")
+ << u"18446744073709551615"_s << u"C"_s << true
+ << std::numeric_limits<qulonglong>::max();
+}
+
+void tst_QLocale::toULongLong()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, locale);
+ QFETCH(bool, good);
+ QFETCH(qulonglong, expected);
+
+ const QLocale loc(locale);
+ qulonglong actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = loc.toULongLong(text, &ok);
+ }
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
+
+void tst_QLocale::toDouble_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("locale");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<double>("expected");
+
+ QTest::newRow("C: empty") << u""_s << u"C"_s << false << 0.0;
+ QTest::newRow("C: 0") << u"0"_s << u"C"_s << true << 0.0;
+ QTest::newRow("C: 0.12340") << u"0.12340"_s << u"C"_s << true << 0.12340;
+ QTest::newRow("C: -0.12340") << u"-0.12340"_s << u"C"_s << true << -0.12340;
+ QTest::newRow("C: &minus;0.12340") << u"\u2212" "0.12340"_s << u"C"_s << true << -0.12340;
+ QTest::newRow("C: 1.0e-4") << u"1.0e-4"_s << u"C"_s << true << 1.0e-4;
+ QTest::newRow("C: 1.0e&minus;4") << u"1.0e\u2212" "4"_s << u"C"_s << true << 1.0e-4;
+ QTest::newRow("C: 1.0e+4") << u"1.0e+4"_s << u"C"_s << true << 1.0e+4;
+ QTest::newRow("C: 10.e+3") << u"10.e+3"_s << u"C"_s << true << 1.0e+4;
+ QTest::newRow("C: 10e+3.") << u"10e+3."_s << u"C"_s << false << 0.0; // exp...dot
+ QTest::newRow("C: 1e4") << u"1e4"_s << u"C"_s << true << 1.0e+4;
+
+ // NaN and infinity:
+ QTest::newRow("C: nan") << u"nan"_s << u"C"_s << true << qQNaN();
+ QTest::newRow("C: NaN") << u"NaN"_s << u"C"_s << true << qQNaN();
+ QTest::newRow("C: -nan") << u"-nan"_s << u"C"_s << false << 0.0;
+ QTest::newRow("C: +nan") << u"+nan"_s << u"C"_s << false << 0.0;
+ QTest::newRow("C: inf") << u"inf"_s << u"C"_s << true << qInf();
+ QTest::newRow("C: Inf") << u"Inf"_s << u"C"_s << true << qInf();
+ QTest::newRow("C: +inf") << u"+inf"_s << u"C"_s << true << qInf();
+ QTest::newRow("C: -inf") << u"-inf"_s << u"C"_s << true << -qInf();
+
+ // Wantonly long-form representations, with trailing and leading zeros:
+ QTest::newRow("C: 1e-64 long-form")
+ << (u"0."_s + QString(63, u'0') + u'1' + QString(962, u'0')) << u"C"_s << true << 1e-64;
+ QTest::newRow("C: 1e+64 long-form")
+ << (QString(961, u'0') + u'1' + QString(64, u'0') + u".0"_s) << u"C"_s << true << 1e+64;
+ QTest::newRow("C: long-form 1 via e+64")
+ << (u"0."_s + QString(63, u'0') + u'1' + QString(962, u'0') + u"e+64"_s)
+ << u"C"_s << true << 1.0;
+ QTest::newRow("C: long-form 1 via e-64")
+ << (QString(961, u'0') + u'1' + QString(64, u'0') + u".0e-64"_s)
+ << u"C"_s << true << 1.0;
+ QTest::newRow("C: 12345678.9") << u"12345678.9"_s << u"C"_s << true << 12345678.9;
+
+ // With and without grouping, en vs de for flipped separators:
+ QTest::newRow("en: 12345678.9") << u"12345678.9"_s << u"en"_s << true << 12345678.9;
+ QTest::newRow("en: 12,345,678.9") << u"12,345,678.9"_s << u"en"_s << true << 12'345'678.9;
+ QTest::newRow("de: 12345678,9") << u"12345678,9"_s << u"de"_s << true << 12345678.9;
+ QTest::newRow("de: 12.345.678,9") << u"12.345.678,9"_s << u"de"_s << true << 12'345'678.9;
+
+ // NaN and infinity are locale-independent (for now - QTBUG-95460)
+ QTest::newRow("cy: nan") << u"nan"_s << u"cy"_s << true << qQNaN();
+ QTest::newRow("cy: NaN") << u"NaN"_s << u"cy"_s << true << qQNaN();
+ QTest::newRow("cy: -nan") << u"-nan"_s << u"cy"_s << false << 0.0;
+ QTest::newRow("cy: +nan") << u"+nan"_s << u"cy"_s << false << 0.0;
+ QTest::newRow("cy: inf") << u"inf"_s << u"cy"_s << true << qInf();
+ QTest::newRow("cy: Inf") << u"Inf"_s << u"cy"_s << true << qInf();
+ QTest::newRow("cy: +inf") << u"+inf"_s << u"cy"_s << true << qInf();
+ QTest::newRow("cy: -inf") << u"-inf"_s << u"cy"_s << true << -qInf();
+ // Samples ready for QTBUG-95460:
+ QTest::newRow("en: &infin;") << u"\u221e"_s << u"en"_s << true << qInf();
+ QTest::newRow("ga: Nuimh") << u"Nuimh"_s << u"ga"_s << true << qQNaN();
+
+ // Locales with multi-character exponents:
+ QTest::newRow("sv_SE: 4e-3") // Swedish, Sweden
+ << u"4\u00d7" "10^\u2212" "03"_s << u"sv_SE"_s << true << 4e-3;
+ QTest::newRow("sv_SE: 4x-3") // Only first character of exponent
+ << u"4\u00d7\u2212" "03"_s << u"sv_SE"_s << false << 0.0;
+ QTest::newRow("se_NO: 4e-3") // Northern Sami, Norway
+ << u"4\u00b7" "10^\u2212" "03"_s << u"se_NO"_s << true << 4e-3;
+ QTest::newRow("se_NO: 4x-3") // Only first character of exponent
+ << u"4\u00b7\u2212" "03"_s << u"se_NO"_s << false << 0.0;
+ QTest::newRow("ar_EG: 4e-3") // Arabic, Egypt
+ << u"\u0664\u0627\u0633\u061c-\u0660\u0663"_s << u"ar_EG"_s << true << 4e-3;
+ QTest::newRow("ar_EG: 4x-3") // Only first character of exponent
+ << u"\u0664\u0627\u061c-\u0660\u0663"_s << u"ar_EG"_s << false << 0.0;
+ QTest::newRow("ar_EG: 4e!3") // Only first character of sign
+ << u"\u0664\u0627\u0633\u061c\u0660\u0663"_s << u"ar_EG"_s << false << 0.0;
+ QTest::newRow("ar_EG: 4x!3") // Only first character of sign and exponent
+ << u"\u0664\u0627\u061c\u0660\u0663"_s << u"ar_EG"_s << false << 0.0;
+}
+
+void tst_QLocale::toDouble()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, locale);
+ QFETCH(bool, good);
+ QFETCH(double, expected);
+
+ const QLocale loc(locale);
+ double actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = loc.toDouble(text, &ok);
+ }
+ QEXPECT_FAIL("en: &infin;", "Localized infinity support missing: QTBUG-95460", Abort);
+ QEXPECT_FAIL("ga: Nuimh", "Localized NaN support missing: QTBUG-95460", Abort);
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
QTEST_MAIN(tst_QLocale)
-#include "main.moc"
+#include "tst_bench_qlocale.moc"
diff --git a/tests/benchmarks/corelib/text/qregularexpression/CMakeLists.txt b/tests/benchmarks/corelib/text/qregularexpression/CMakeLists.txt
index 1e1f40a2e4..5d029439d0 100644
--- a/tests/benchmarks/corelib/text/qregularexpression/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qregularexpression/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qregularexpression.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qregularexpression Binary:
@@ -7,6 +8,6 @@
qt_internal_add_benchmark(tst_bench_qregularexpression
SOURCES
tst_bench_qregularexpression.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qregularexpression/tst_bench_qregularexpression.cpp b/tests/benchmarks/corelib/text/qregularexpression/tst_bench_qregularexpression.cpp
index 6c9c2ddaf5..83c87be0b1 100644
--- a/tests/benchmarks/corelib/text/qregularexpression/tst_bench_qregularexpression.cpp
+++ b/tests/benchmarks/corelib/text/qregularexpression/tst_bench_qregularexpression.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
#include <QRegularExpression>
#include <QTest>
diff --git a/tests/benchmarks/corelib/text/qstring/CMakeLists.txt b/tests/benchmarks/corelib/text/qstring/CMakeLists.txt
index 4b443cd4aa..f17088d2be 100644
--- a/tests/benchmarks/corelib/text/qstring/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qstring/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qstring.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qstring Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qstring
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qstring.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qstring/main.cpp b/tests/benchmarks/corelib/text/qstring/main.cpp
deleted file mode 100644
index 0214931b71..0000000000
--- a/tests/benchmarks/corelib/text/qstring/main.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QStringList>
-#include <QFile>
-#include <QTest>
-
-class tst_QString: public QObject
-{
- Q_OBJECT
-public:
- tst_QString();
-private slots:
- void section_regexp_data() { section_data_impl(); }
- void section_regularexpression_data() { section_data_impl(); }
- void section_regularexpression() { section_impl<QRegularExpression>(); }
- void section_string_data() { section_data_impl(false); }
- void section_string() { section_impl<QString>(); }
-
- void toUpper_data();
- void toUpper();
- void toLower_data();
- void toLower();
- void toCaseFolded_data();
- void toCaseFolded();
-
-private:
- void section_data_impl(bool includeRegExOnly = true);
- template <typename RX> void section_impl();
-};
-
-tst_QString::tst_QString()
-{
-}
-
-void tst_QString::section_data_impl(bool includeRegExOnly)
-{
- QTest::addColumn<QString>("s");
- QTest::addColumn<QString>("sep");
- QTest::addColumn<bool>("isRegExp");
-
- QTest::newRow("IPv4") << QStringLiteral("192.168.0.1") << QStringLiteral(".") << false;
- QTest::newRow("IPv6") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral(":") << false;
- if (includeRegExOnly) {
- QTest::newRow("IPv6-reversed-roles") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral("\\d+") << true;
- QTest::newRow("IPv6-complex") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral("(\\d+):\\1") << true;
- }
-}
-
-template <typename RX>
-inline QString escape(const QString &s)
-{ return RX::escape(s); }
-
-template <>
-inline QString escape<QString>(const QString &s)
-{ return s; }
-
-template <typename RX>
-inline void optimize(RX &) {}
-
-template <>
-inline void optimize(QRegularExpression &rx)
-{ rx.optimize(); }
-
-template <typename RX>
-void tst_QString::section_impl()
-{
- QFETCH(QString, s);
- QFETCH(QString, sep);
- QFETCH(bool, isRegExp);
-
- RX rx(isRegExp ? sep : escape<RX>(sep));
- optimize(rx);
- for (int i = 0; i < 20; ++i)
- (void) s.count(rx); // make (s, rx) hot
-
- QBENCHMARK {
- const QString result = s.section(rx, 0, 16);
- Q_UNUSED(result);
- }
-}
-
-void tst_QString::toUpper_data()
-{
- QTest::addColumn<QString>("s");
-
- QString lowerLatin1(300, QChar('a'));
- QString upperLatin1(300, QChar('A'));
-
- QString lowerDeseret;
- {
- QString pattern;
- pattern += QChar(QChar::highSurrogate(0x10428));
- pattern += QChar(QChar::lowSurrogate(0x10428));
- for (int i = 0; i < 300 / pattern.size(); ++i)
- lowerDeseret += pattern;
- }
- QString upperDeseret;
- {
- QString pattern;
- pattern += QChar(QChar::highSurrogate(0x10400));
- pattern += QChar(QChar::lowSurrogate(0x10400));
- for (int i = 0; i < 300 / pattern.size(); ++i)
- upperDeseret += pattern;
- }
-
- QString lowerLigature(600, QChar(0xFB03));
-
- QTest::newRow("600<a>") << (lowerLatin1 + lowerLatin1);
- QTest::newRow("600<A>") << (upperLatin1 + upperLatin1);
-
- QTest::newRow("300<a>+300<A>") << (lowerLatin1 + upperLatin1);
- QTest::newRow("300<A>+300<a>") << (upperLatin1 + lowerLatin1);
-
- QTest::newRow("300<10428>") << (lowerDeseret + lowerDeseret);
- QTest::newRow("300<10400>") << (upperDeseret + upperDeseret);
-
- QTest::newRow("150<10428>+150<10400>") << (lowerDeseret + upperDeseret);
- QTest::newRow("150<10400>+150<10428>") << (upperDeseret + lowerDeseret);
-
- QTest::newRow("300a+150<10400>") << (lowerLatin1 + upperDeseret);
- QTest::newRow("300a+150<10428>") << (lowerLatin1 + lowerDeseret);
- QTest::newRow("300A+150<10400>") << (upperLatin1 + upperDeseret);
- QTest::newRow("300A+150<10428>") << (upperLatin1 + lowerDeseret);
-
- QTest::newRow("600<FB03> (ligature)") << lowerLigature;
-}
-
-void tst_QString::toUpper()
-{
- QFETCH(QString, s);
-
- QBENCHMARK {
- s.toUpper();
- }
-}
-
-void tst_QString::toLower_data()
-{
- toUpper_data();
-}
-
-void tst_QString::toLower()
-{
- QFETCH(QString, s);
-
- QBENCHMARK {
- s.toLower();
- }
-}
-
-void tst_QString::toCaseFolded_data()
-{
- toUpper_data();
-}
-
-void tst_QString::toCaseFolded()
-{
- QFETCH(QString, s);
-
- QBENCHMARK {
- s.toCaseFolded();
- }
-}
-
-QTEST_APPLESS_MAIN(tst_QString)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/text/qstring/tst_bench_qstring.cpp b/tests/benchmarks/corelib/text/qstring/tst_bench_qstring.cpp
new file mode 100644
index 0000000000..da5c0ff359
--- /dev/null
+++ b/tests/benchmarks/corelib/text/qstring/tst_bench_qstring.cpp
@@ -0,0 +1,510 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+#include <QStringList>
+#include <QByteArray>
+#include <QLatin1StringView>
+#include <QFile>
+#include <QTest>
+#include <limits>
+
+using namespace Qt::StringLiterals;
+
+class tst_QString: public QObject
+{
+ Q_OBJECT
+public:
+ tst_QString();
+private slots:
+ void section_regexp_data() { section_data_impl(); }
+ void section_regularexpression_data() { section_data_impl(); }
+ void section_regularexpression() { section_impl<QRegularExpression>(); }
+ void section_string_data() { section_data_impl(false); }
+ void section_string() { section_impl<QString>(); }
+
+ void toUpper_data();
+ void toUpper();
+ void toLower_data();
+ void toLower();
+ void toCaseFolded_data();
+ void toCaseFolded();
+
+ // Serializing:
+ void number_qlonglong_data();
+ void number_qlonglong() { number_impl<qlonglong>(); }
+ void number_qulonglong_data();
+ void number_qulonglong() { number_impl<qulonglong>(); }
+
+ void number_double_data();
+ void number_double();
+
+ // Parsing:
+ void toLongLong_data();
+ void toLongLong();
+ void toULongLong_data();
+ void toULongLong();
+ void toDouble_data();
+ void toDouble();
+
+ // operator=(~)
+#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
+ void operator_assign_BA() { operator_assign<QByteArray>(); }
+ void operator_assign_BA_data() { operator_assign_data(); }
+ void operator_assign_char() { operator_assign<const char*>(); };
+ void operator_assign_char_data() { operator_assign_data();}
+#endif
+ void operator_assign_L1SV() { operator_assign<QLatin1StringView>(); }
+ void operator_assign_L1SV_data() { operator_assign_data(); }
+
+private:
+ void section_data_impl(bool includeRegExOnly = true);
+ template <typename RX> void section_impl();
+ template <typename Integer> void number_impl();
+ template <typename T> void operator_assign();
+ void operator_assign_data();
+};
+
+tst_QString::tst_QString()
+{
+}
+
+void tst_QString::section_data_impl(bool includeRegExOnly)
+{
+ QTest::addColumn<QString>("s");
+ QTest::addColumn<QString>("sep");
+ QTest::addColumn<bool>("isRegExp");
+
+ QTest::newRow("IPv4") << QStringLiteral("192.168.0.1") << QStringLiteral(".") << false;
+ QTest::newRow("IPv6") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral(":") << false;
+ if (includeRegExOnly) {
+ QTest::newRow("IPv6-reversed-roles") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral("\\d+") << true;
+ QTest::newRow("IPv6-complex") << QStringLiteral("2001:0db8:85a3:0000:0000:8a2e:0370:7334") << QStringLiteral("(\\d+):\\1") << true;
+ }
+}
+
+template <typename RX>
+inline QString escape(const QString &s)
+{ return RX::escape(s); }
+
+template <>
+inline QString escape<QString>(const QString &s)
+{ return s; }
+
+template <typename RX>
+inline void optimize(RX &) {}
+
+template <>
+inline void optimize(QRegularExpression &rx)
+{ rx.optimize(); }
+
+template <typename RX>
+void tst_QString::section_impl()
+{
+ QFETCH(QString, s);
+ QFETCH(QString, sep);
+ QFETCH(bool, isRegExp);
+
+ RX rx(isRegExp ? sep : escape<RX>(sep));
+ optimize(rx);
+ for (int i = 0; i < 20; ++i)
+ (void) s.count(rx); // make (s, rx) hot
+
+ QBENCHMARK {
+ const QString result = s.section(rx, 0, 16);
+ Q_UNUSED(result);
+ }
+}
+
+void tst_QString::toUpper_data()
+{
+ QTest::addColumn<QString>("s");
+
+ QString lowerLatin1(300, QChar('a'));
+ QString upperLatin1(300, QChar('A'));
+
+ QString lowerDeseret;
+ {
+ QString pattern;
+ pattern += QChar(QChar::highSurrogate(0x10428));
+ pattern += QChar(QChar::lowSurrogate(0x10428));
+ for (int i = 0; i < 300 / pattern.size(); ++i)
+ lowerDeseret += pattern;
+ }
+ QString upperDeseret;
+ {
+ QString pattern;
+ pattern += QChar(QChar::highSurrogate(0x10400));
+ pattern += QChar(QChar::lowSurrogate(0x10400));
+ for (int i = 0; i < 300 / pattern.size(); ++i)
+ upperDeseret += pattern;
+ }
+
+ QString lowerLigature(600, QChar(0xFB03));
+
+ QTest::newRow("600<a>") << (lowerLatin1 + lowerLatin1);
+ QTest::newRow("600<A>") << (upperLatin1 + upperLatin1);
+
+ QTest::newRow("300<a>+300<A>") << (lowerLatin1 + upperLatin1);
+ QTest::newRow("300<A>+300<a>") << (upperLatin1 + lowerLatin1);
+
+ QTest::newRow("300<10428>") << (lowerDeseret + lowerDeseret);
+ QTest::newRow("300<10400>") << (upperDeseret + upperDeseret);
+
+ QTest::newRow("150<10428>+150<10400>") << (lowerDeseret + upperDeseret);
+ QTest::newRow("150<10400>+150<10428>") << (upperDeseret + lowerDeseret);
+
+ QTest::newRow("300a+150<10400>") << (lowerLatin1 + upperDeseret);
+ QTest::newRow("300a+150<10428>") << (lowerLatin1 + lowerDeseret);
+ QTest::newRow("300A+150<10400>") << (upperLatin1 + upperDeseret);
+ QTest::newRow("300A+150<10428>") << (upperLatin1 + lowerDeseret);
+
+ QTest::newRow("600<FB03> (ligature)") << lowerLigature;
+}
+
+void tst_QString::toUpper()
+{
+ QFETCH(QString, s);
+
+ QBENCHMARK {
+ [[maybe_unused]] auto r = s.toUpper();
+ }
+}
+
+void tst_QString::toLower_data()
+{
+ toUpper_data();
+}
+
+void tst_QString::toLower()
+{
+ QFETCH(QString, s);
+
+ QBENCHMARK {
+ [[maybe_unused]] auto r = s.toLower();
+ }
+}
+
+void tst_QString::toCaseFolded_data()
+{
+ toUpper_data();
+}
+
+void tst_QString::toCaseFolded()
+{
+ QFETCH(QString, s);
+
+ QBENCHMARK {
+ [[maybe_unused]] auto r = s.toCaseFolded();
+ }
+}
+
+template <typename Integer>
+void tst_QString::number_impl()
+{
+ QFETCH(Integer, number);
+ QFETCH(int, base);
+ QFETCH(QString, expected);
+
+ QString actual;
+ QBENCHMARK {
+ actual = QString::number(number, base);
+ }
+ QCOMPARE(actual, expected);
+}
+
+template <typename Integer>
+void number_integer_common()
+{
+ QTest::addColumn<Integer>("number");
+ QTest::addColumn<int>("base");
+ QTest::addColumn<QString>("expected");
+
+ QTest::newRow("0") << Integer(0ull) << 10 << QStringLiteral("0");
+ QTest::newRow("1234") << Integer(1234ull) << 10 << QStringLiteral("1234");
+ QTest::newRow("123456789") << Integer(123456789ull) << 10 << QStringLiteral("123456789");
+ QTest::newRow("bad1dea, base 16") << Integer(0xBAD1DEAull) << 16 << QStringLiteral("bad1dea");
+ QTest::newRow("242, base 8") << Integer(0242ull) << 8 << QStringLiteral("242");
+ QTest::newRow("101101, base 2") << Integer(0b101101ull) << 2 << QStringLiteral("101101");
+ QTest::newRow("ad, base 30") << Integer(313ull) << 30 << QStringLiteral("ad");
+}
+
+void tst_QString::number_qlonglong_data()
+{
+ number_integer_common<qlonglong>();
+
+ QTest::newRow("-1234") << -1234ll << 10 << QStringLiteral("-1234");
+ QTest::newRow("-123456789") << -123456789ll << 10 << QStringLiteral("-123456789");
+ QTest::newRow("-bad1dea, base 16") << -0xBAD1DEAll << 16 << QStringLiteral("-bad1dea");
+ QTest::newRow("-242, base 8") << -0242ll << 8 << QStringLiteral("-242");
+ QTest::newRow("-101101, base 2") << -0b101101ll << 2 << QStringLiteral("-101101");
+ QTest::newRow("-ad, base 30") << -313ll << 30 << QStringLiteral("-ad");
+
+ QTest::newRow("qlonglong-max")
+ << std::numeric_limits<qlonglong>::max() << 10 << QStringLiteral("9223372036854775807");
+ QTest::newRow("qlonglong-min")
+ << std::numeric_limits<qlonglong>::min() << 10
+ << QStringLiteral("-9223372036854775808");
+ QTest::newRow("qlonglong-max, base 2")
+ << std::numeric_limits<qlonglong>::max() << 2 << QString(63, u'1');
+ QTest::newRow("qlonglong-min, base 2") << std::numeric_limits<qlonglong>::min() << 2
+ << (QStringLiteral("-1") + QString(63, u'0'));
+ QTest::newRow("qlonglong-max, base 16")
+ << std::numeric_limits<qlonglong>::max() << 16 << (QChar(u'7') + QString(15, u'f'));
+ QTest::newRow("qlonglong-min, base 16") << std::numeric_limits<qlonglong>::min() << 16
+ << (QStringLiteral("-8") + QString(15, u'0'));
+}
+
+void tst_QString::number_qulonglong_data()
+{
+ number_integer_common<qulonglong>();
+
+ QTest::newRow("qlonglong-max + 1")
+ << (qulonglong(std::numeric_limits<qlonglong>::max()) + 1) << 10
+ << QStringLiteral("9223372036854775808");
+ QTest::newRow("qulonglong-max")
+ << std::numeric_limits<qulonglong>::max() << 10
+ << QStringLiteral("18446744073709551615");
+ QTest::newRow("qulonglong-max, base 2")
+ << std::numeric_limits<qulonglong>::max() << 2 << QString(64, u'1');
+ QTest::newRow("qulonglong-max, base 16")
+ << std::numeric_limits<qulonglong>::max() << 16 << QString(16, u'f');
+}
+
+void tst_QString::number_double_data()
+{
+ QTest::addColumn<double>("number");
+ QTest::addColumn<char>("format");
+ QTest::addColumn<int>("precision");
+ QTest::addColumn<QString>("expected");
+
+ struct
+ {
+ double d;
+ char f;
+ int p;
+ QString expected;
+ } data[] = {
+ { 0.0, 'f', 0, QStringLiteral("0") },
+ { 0.0001, 'f', 0, QStringLiteral("0") },
+ { 0.1234, 'f', 5, QStringLiteral("0.12340") },
+ { -0.1234, 'f', 5, QStringLiteral("-0.12340") },
+ { 0.5 + qSqrt(1.25), 'f', 15, QStringLiteral("1.618033988749895") },
+ { std::numeric_limits<double>::epsilon(), 'g', 10, QStringLiteral("2.220446049e-16") },
+ { 0.0001, 'E', 1, QStringLiteral("1.0E-04") },
+ { 1e8, 'E', 1, QStringLiteral("1.0E+08") },
+ { -1e8, 'E', 1, QStringLiteral("-1.0E+08") },
+ };
+
+ for (auto &datum : data) {
+ QTest::addRow("%s, format '%c', precision %d", qPrintable(datum.expected), datum.f,
+ datum.p)
+ << datum.d << datum.f << datum.p << datum.expected;
+ }
+}
+
+void tst_QString::number_double()
+{
+ QFETCH(double, number);
+ QFETCH(char, format);
+ QFETCH(int, precision);
+ QFETCH(QString, expected);
+
+ QString actual;
+ QBENCHMARK {
+ actual = QString::number(number, format, precision);
+ }
+ QCOMPARE(actual, expected);
+}
+
+template <typename Integer>
+void toWholeCommon_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<int>("base");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<Integer>("expected");
+
+ QTest::newRow("empty") << u""_s << 10 << false << Integer(0ull);
+ QTest::newRow("0") << u"0"_s << 10 << true << Integer(0ull);
+ QTest::newRow("1234") << u"1234"_s << 10 << true << Integer(1234ull);
+ QTest::newRow("1,234") << u"1,234"_s << 10 << false << Integer(0ull);
+ QTest::newRow("123456789")
+ << u"123456789"_s << 10 << true << Integer(123456789ull);
+ QTest::newRow("bad1dea, base 16")
+ << u"bad1dea"_s << 16 << true << Integer(0xBAD1DEAull);
+ QTest::newRow("bad1dea, base 10") << u"bad1dea"_s << 10 << false << Integer(0ull);
+ QTest::newRow("42, base 13") << u"42"_s << 13 << true << Integer(6ull * 9ull);
+ QTest::newRow("242, base 8") << u"242"_s << 8 << true << Integer(0242ull);
+ QTest::newRow("495, base 8") << u"495"_s << 8 << false << Integer(0ull);
+ QTest::newRow("101101, base 2")
+ << u"101101"_s << 2 << true << Integer(0b101101ull);
+ QTest::newRow("ad, base 30") << u"ad"_s << 30 << true << Integer(313ull);
+}
+
+void tst_QString::toLongLong_data()
+{
+ toWholeCommon_data<qlonglong>();
+
+ QTest::newRow("-1234") << u"-1234"_s << 10 << true << -1234ll;
+ QTest::newRow("-123456789") << u"-123456789"_s << 10 << true << -123456789ll;
+ QTest::newRow("-bad1dea, base 16") << u"-bad1dea"_s << 16 << true << -0xBAD1DEAll;
+ QTest::newRow("-242, base 8") << u"-242"_s << 8 << true << -0242ll;
+ QTest::newRow("-101101, base 2") << u"-101101"_s << 2 << true << -0b101101ll;
+ QTest::newRow("-ad, base 30") << u"-ad"_s << 30 << true << -313ll;
+
+ QTest::newRow("qlonglong-max")
+ << u"9223372036854775807"_s << 10 << true
+ << std::numeric_limits<qlonglong>::max();
+ QTest::newRow("qlonglong-min")
+ << u"-9223372036854775808"_s << 10 << true
+ << std::numeric_limits<qlonglong>::min();
+ QTest::newRow("qlonglong-max, base 2")
+ << QString(63, u'1') << 2 << true << std::numeric_limits<qlonglong>::max();
+ QTest::newRow("qlonglong-min, base 2")
+ << (u"-1"_s + QString(63, u'0')) << 2 << true
+ << std::numeric_limits<qlonglong>::min();
+ QTest::newRow("qlonglong-max, base 16")
+ << (QChar(u'7') + QString(15, u'f')) << 16 << true
+ << std::numeric_limits<qlonglong>::max();
+ QTest::newRow("qlonglong-min, base 16")
+ << (u"-8"_s + QString(15, u'0')) << 16 << true
+ << std::numeric_limits<qlonglong>::min();
+}
+
+void tst_QString::toLongLong()
+{
+ QFETCH(QString, text);
+ QFETCH(int, base);
+ QFETCH(bool, good);
+ QFETCH(qlonglong, expected);
+
+ qlonglong actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = text.toLongLong(&ok, base);
+ }
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
+void tst_QString::toULongLong_data()
+{
+ toWholeCommon_data<qulonglong>();
+
+ QTest::newRow("qlonglong-max + 1")
+ << u"9223372036854775808"_s << 10 << true
+ << (qulonglong(std::numeric_limits<qlonglong>::max()) + 1);
+ QTest::newRow("qulonglong-max")
+ << u"18446744073709551615"_s << 10 << true
+ << std::numeric_limits<qulonglong>::max();
+ QTest::newRow("qulonglong-max, base 2")
+ << QString(64, u'1') << 2 << true << std::numeric_limits<qulonglong>::max();
+ QTest::newRow("qulonglong-max, base 16")
+ << QString(16, u'f') << 16 << true << std::numeric_limits<qulonglong>::max();
+}
+
+void tst_QString::toULongLong()
+{
+ QFETCH(QString, text);
+ QFETCH(int, base);
+ QFETCH(bool, good);
+ QFETCH(qulonglong, expected);
+
+ qulonglong actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = text.toULongLong(&ok, base);
+ }
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
+void tst_QString::toDouble_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("good");
+ QTest::addColumn<double>("expected");
+
+ QTest::newRow("empty") << u""_s << false << 0.0;
+ QTest::newRow("0") << u"0"_s << true << 0.0;
+ QTest::newRow("0.12340") << u"0.12340"_s << true << 0.12340;
+ QTest::newRow("-0.12340") << u"-0.12340"_s << true << -0.12340;
+ QTest::newRow("epsilon")
+ << u"2.220446049e-16"_s << true << std::numeric_limits<double>::epsilon();
+ QTest::newRow("1.0e-4") << u"1.0e-4"_s << true << 1.0e-4;
+ QTest::newRow("1.0e+4") << u"1.0e+4"_s << true << 1.0e+4;
+ QTest::newRow("10.e+3") << u"10.e+3"_s << true << 1.0e+4;
+ QTest::newRow("10e+3.") << u"10e+3."_s << false << 0.0;
+ QTest::newRow("1e4") << u"1e4"_s << true << 1.0e+4;
+ QTest::newRow("1.0e-8") << u"1.0e-8"_s << true << 1.0e-8;
+ QTest::newRow("1.0e+8") << u"1.0e+8"_s << true << 1.0e+8;
+
+ // NaN and infinity:
+ QTest::newRow("nan") << u"nan"_s << true << qQNaN();
+ QTest::newRow("NaN") << u"NaN"_s << true << qQNaN();
+ QTest::newRow("-nan") << u"-nan"_s << false << 0.0;
+ QTest::newRow("+nan") << u"+nan"_s << false << 0.0;
+ QTest::newRow("inf") << u"inf"_s << true << qInf();
+ QTest::newRow("Inf") << u"Inf"_s << true << qInf();
+ QTest::newRow("+inf") << u"+inf"_s << true << qInf();
+ QTest::newRow("-inf") << u"-inf"_s << true << -qInf();
+}
+
+void tst_QString::toDouble()
+{
+ QFETCH(QString, text);
+ QFETCH(bool, good);
+ QFETCH(double, expected);
+
+ double actual = expected;
+ bool ok = false;
+ QBENCHMARK {
+ actual = text.toDouble(&ok);
+ }
+ QCOMPARE(ok, good);
+ QCOMPARE(actual, expected);
+}
+
+template <typename T> void tst_QString::operator_assign()
+{
+ QFETCH(QByteArray, data);
+ QString str(data.size(), Qt::Uninitialized);
+
+ T tdata;
+ if constexpr (std::is_same_v<T, const char*>) {
+ tdata = data.constData();
+ } else if constexpr (std::is_same_v<T, QLatin1String>) {
+ tdata = T(data.constData(), data.size());
+ } else {
+ tdata = T(data.constData(), data.size());
+ tdata.detach();
+ }
+
+ QBENCHMARK {
+ str.operator=(tdata);
+ }
+}
+
+void tst_QString::operator_assign_data()
+{
+ QTest::addColumn<QByteArray>("data");
+
+ QByteArray data;
+ data.fill('a', 5);
+ QTest::newRow("length: 5") << data;
+ data.fill('b', 10);
+ QTest::newRow("length: 10") << data;
+ data.fill('c', 20);
+ QTest::newRow("length: 20") << data;
+ data.fill('d', 50);
+ QTest::newRow("length: 50") << data;
+ data.fill('e', 100);
+ QTest::newRow("length: 100") << data;
+ data.fill('f', 500);
+ QTest::newRow("length: 500") << data;
+ data.fill('g', 1'000);
+ QTest::newRow("length: 1'000") << data;
+}
+
+QTEST_APPLESS_MAIN(tst_QString)
+
+#include "tst_bench_qstring.moc"
diff --git a/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt
index 33b1b5fe5e..c3c95e233c 100644
--- a/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qstringbuilder.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qstringbuilder Binary:
@@ -6,13 +7,9 @@
qt_internal_add_benchmark(tst_bench_qstringbuilder
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qstringbuilder.cpp
+ LIBRARIES
Qt::Test
COMPILE_OPTIONS
-g
)
-
-#### Keys ignored in scope 1:.:.:qstringbuilder.pro:<TRUE>:
-# QMAKE_CFLAGS = "-g"
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp b/tests/benchmarks/corelib/text/qstringbuilder/tst_bench_qstringbuilder.cpp
index 757e2cc683..496abdaf3b 100644
--- a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp
+++ b/tests/benchmarks/corelib/text/qstringbuilder/tst_bench_qstringbuilder.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 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
// Select one of the scenarios below
#define SCENARIO 1
@@ -96,12 +71,12 @@
#define LITERAL "some string literal"
-class tst_qstringbuilder : public QObject
+class tst_QStringBuilder : public QObject
{
Q_OBJECT
public:
- tst_qstringbuilder()
+ tst_QStringBuilder()
: l1literal(LITERAL),
l1string(LITERAL),
ba(LITERAL),
@@ -408,8 +383,8 @@ private:
std::string stdr;
};
-QTEST_MAIN(tst_qstringbuilder)
-
#undef P
-#include "main.moc"
+QTEST_MAIN(tst_QStringBuilder)
+
+#include "tst_bench_qstringbuilder.moc"
diff --git a/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt
index 4649e3408a..da2f84d6e9 100644
--- a/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qstringlist.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qstringlist Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qstringlist
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qstringlist.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qstringlist/main.cpp b/tests/benchmarks/corelib/text/qstringlist/tst_bench_qstringlist.cpp
index eb507c7c64..2431446bf6 100644
--- a/tests/benchmarks/corelib/text/qstringlist/main.cpp
+++ b/tests/benchmarks/corelib/text/qstringlist/tst_bench_qstringlist.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
#include <QStringList>
#include <QTest>
@@ -33,6 +8,8 @@
#include <string>
#include <vector>
+using namespace Qt::StringLiterals;
+
class tst_QStringList: public QObject
{
Q_OBJECT
@@ -44,6 +21,11 @@ private slots:
void removeDuplicates() const;
void removeDuplicates_data() const;
+ void filter_data() const;
+ void filter() const;
+ void filter_stringMatcher_data() const { filter_data(); }
+ void filter_stringMatcher() const;
+
void split_qlist_qbytearray() const;
void split_qlist_qbytearray_data() const { return split_data(); }
@@ -68,9 +50,9 @@ private:
QStringList tst_QStringList::populateList(const int count, const QString &unit)
{
QStringList retval;
-
+ retval.reserve(count);
for (int i = 0; i < count; ++i)
- retval.append(unit);
+ retval.append(unit + QString::number(i));
return retval;
}
@@ -93,7 +75,7 @@ void tst_QStringList::join() const
QFETCH(QString, separator);
QBENCHMARK {
- input.join(separator);
+ [[maybe_unused]] auto r = input.join(separator);
}
}
@@ -102,20 +84,20 @@ void tst_QStringList::join_data() const
QTest::addColumn<QStringList>("input");
QTest::addColumn<QString>("separator");
- QTest::newRow("")
+ QTest::newRow("100")
<< populateList(100, QLatin1String("unit"))
<< QString();
- QTest::newRow("")
+ QTest::newRow("1000")
<< populateList(1000, QLatin1String("unit"))
<< QString();
- QTest::newRow("")
- << populateList(10000, QLatin1String("unit"))
+ QTest::newRow("10000")
+ << populateList(10'000, QLatin1String("unit"))
<< QString();
- QTest::newRow("")
- << populateList(100000, QLatin1String("unit"))
+ QTest::newRow("100000")
+ << populateList(100'000, QLatin1String("unit"))
<< QString();
}
@@ -155,6 +137,39 @@ void tst_QStringList::removeDuplicates_data() const
QTest::addRow("long-dup-0.75") << (l + l + l + l);
}
+void tst_QStringList::filter_data() const
+{
+ QTest::addColumn<QStringList>("list");
+ QTest::addColumn<QStringList>("expected");
+
+ for (int i : {10, 20, 30, 40, 50, 70, 80, 100, 300, 500, 700, 900, 10'000}) {
+ QStringList list = populateList(i, u"A rather long string to test QStringMatcher"_s);
+ list.append(u"Horse and cart from old"_s);
+ QTest::addRow("list%d", i) << list << QStringList(u"Horse and cart from old"_s);
+ }
+}
+
+void tst_QStringList::filter() const
+{
+ QFETCH(QStringList, list);
+ QFETCH(QStringList, expected);
+
+ QBENCHMARK {
+ QCOMPARE(list.filter(u"Horse and cart from old", Qt::CaseSensitive), expected);
+ }
+}
+
+void tst_QStringList::filter_stringMatcher() const
+{
+ QFETCH(QStringList, list);
+ QFETCH(QStringList, expected);
+
+ const QStringMatcher matcher(u"Horse and cart from old", Qt::CaseSensitive);
+ QBENCHMARK {
+ QCOMPARE(list.filter(matcher), expected);
+ }
+}
+
void tst_QStringList::split_data() const
{
QTest::addColumn<QString>("input");
@@ -173,7 +188,7 @@ void tst_QStringList::split_qlist_qbytearray() const
QByteArray ba = input.toLatin1();
QBENCHMARK {
- ba.split(splitChar);
+ [[maybe_unused]] auto r = ba.split(splitChar);
}
}
@@ -183,7 +198,7 @@ void tst_QStringList::split_qlist_qstring() const
const QChar splitChar = ':';
QBENCHMARK {
- input.split(splitChar);
+ [[maybe_unused]] auto r = input.split(splitChar);
}
}
@@ -237,4 +252,4 @@ void tst_QStringList::split_stdlist_stdstring() const
QTEST_MAIN(tst_QStringList)
-#include "main.moc"
+#include "tst_bench_qstringlist.moc"
diff --git a/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt
index c2bf848400..11720e5204 100644
--- a/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt
+++ b/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt
@@ -1,11 +1,14 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## tst_bench_qstringtokenizer Binary:
#####################################################################
qt_internal_add_benchmark(tst_bench_qstringtokenizer
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qstringtokenizer.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/text/qstringtokenizer/main.cpp b/tests/benchmarks/corelib/text/qstringtokenizer/tst_bench_qstringtokenizer.cpp
index 54f48d5ea5..eccfad91da 100644
--- a/tests/benchmarks/corelib/text/qstringtokenizer/main.cpp
+++ b/tests/benchmarks/corelib/text/qstringtokenizer/tst_bench_qstringtokenizer.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
#include <QtTest/QTest>
@@ -142,4 +117,4 @@ void tst_QStringTokenizer::tokenize() const
QTEST_MAIN(tst_QStringTokenizer)
-#include "main.moc"
+#include "tst_bench_qstringtokenizer.moc"
diff --git a/tests/benchmarks/corelib/text/qutf8stringview/CMakeLists.txt b/tests/benchmarks/corelib/text/qutf8stringview/CMakeLists.txt
new file mode 100644
index 0000000000..14613afe56
--- /dev/null
+++ b/tests/benchmarks/corelib/text/qutf8stringview/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+#####################################################################
+## tst_bench_qutf8stringview Binary:
+#####################################################################
+
+qt_internal_add_benchmark(tst_bench_qutf8stringview
+ SOURCES
+ tst_bench_qutf8stringview.cpp
+ LIBRARIES
+ Qt::Test
+ Qt::CorePrivate
+)
diff --git a/tests/benchmarks/corelib/text/qutf8stringview/tst_bench_qutf8stringview.cpp b/tests/benchmarks/corelib/text/qutf8stringview/tst_bench_qutf8stringview.cpp
new file mode 100644
index 0000000000..ec633ff67d
--- /dev/null
+++ b/tests/benchmarks/corelib/text/qutf8stringview/tst_bench_qutf8stringview.cpp
@@ -0,0 +1,263 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <qbytearray.h>
+#include <qdebug.h>
+#include <qstring.h>
+#include <qtest.h>
+#include <qutf8stringview.h>
+
+class tst_QUtf8StringView : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void equalStringsLatin1_data() { equalStrings_data(); }
+ void equalStringsLatin1();
+ void equalStringsUtf16_data() { equalStrings_data(); }
+ void equalStringsUtf16();
+ void equalStringsUtf8_data() { equalStrings_data(); }
+ void equalStringsUtf8();
+
+ void compareStringsCaseSensitiveLatin1_data() { compareStringsCaseSensitive_data(); }
+ void compareStringsCaseSensitiveLatin1() { compareStringsLatin1(true); }
+ void compareStringsCaseSensitiveUtf16_data() { compareStringsCaseSensitive_data(); }
+ void compareStringsCaseSensitiveUtf16() { compareStringsUtf16(true); }
+ void compareStringsCaseSensitiveUtf8_data() { compareStringsCaseSensitive_data(); }
+ void compareStringsCaseSensitiveUtf8() { compareStringsUtf8(true); }
+
+ void compareStringsCaseInsensitiveLatin1_data() { compareStringsCaseInsensitive_data(); }
+ void compareStringsCaseInsensitiveLatin1() { compareStringsLatin1(false); }
+ void compareStringsCaseInsensitiveUtf16_data() { compareStringsCaseInsensitive_data(); }
+ void compareStringsCaseInsensitiveUtf16() { compareStringsUtf16(false); }
+ void compareStringsCaseInsensitiveUtf8_data() { compareStringsCaseInsensitive_data(); }
+ void compareStringsCaseInsensitiveUtf8() { compareStringsUtf8(false); }
+
+ void compareStringsWithErrors_data();
+ void compareStringsWithErrors();
+
+private:
+ void equalStrings_data();
+ void compareStringsCaseSensitive_data();
+ void compareStringsCaseInsensitive_data();
+ void compareStringsLatin1(bool caseSensitive);
+ void compareStringsUtf16(bool caseSensitive);
+ void compareStringsUtf8(bool caseSensitive);
+};
+
+void tst_QUtf8StringView::equalStrings_data()
+{
+ QTest::addColumn<QString>("lhs");
+ QTest::addColumn<QString>("rhs");
+ QTest::addColumn<bool>("isEqual");
+
+ QTest::newRow("EqualStrings") << "Test"
+ << "Test" << true;
+ QTest::newRow("EqualStringsLong")
+ << "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ << "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" << true;
+ QTest::newRow("DifferentCase") << "test"
+ << "Test" << false;
+ QTest::newRow("DifferentCaseLong")
+ << "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ << "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" << false;
+ QTest::newRow("ReverseStrings") << "Test"
+ << "tseT" << false;
+ QTest::newRow("Latin1RangeCharacter") << u8"B\u00d8" << u8"B\u00d8" << true;
+ QTest::newRow("Latin1RangeCharacterDifferentCase") << u8"B\u00d8" << u8"B\u00f8" << false;
+}
+
+void tst_QUtf8StringView::equalStringsLatin1()
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(bool, isEqual);
+ QByteArray left = lhs.toUtf8();
+ QByteArray right = rhs.toLatin1();
+ QBasicUtf8StringView<false> lhv(left);
+ QLatin1StringView rhv(right);
+ bool result;
+
+ QBENCHMARK {
+ result = QtPrivate::equalStrings(lhv, rhv);
+ };
+ QCOMPARE(result, isEqual);
+}
+
+void tst_QUtf8StringView::equalStringsUtf16()
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(bool, isEqual);
+
+ QByteArray left = lhs.toUtf8();
+ QBasicUtf8StringView<false> lhv(left);
+ QStringView rhv(rhs);
+ bool result;
+
+ QBENCHMARK {
+ result = QtPrivate::equalStrings(lhv, rhv);
+ };
+ QCOMPARE(result, isEqual);
+}
+
+void tst_QUtf8StringView::equalStringsUtf8()
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(bool, isEqual);
+
+ QByteArray left = lhs.toUtf8();
+ QByteArray right = rhs.toUtf8();
+ QBasicUtf8StringView<false> lhv(left);
+ QBasicUtf8StringView<false> rhv(right);
+ bool result;
+
+ QBENCHMARK {
+ result = QtPrivate::equalStrings(lhv, rhv);
+ };
+ QCOMPARE(result, isEqual);
+}
+
+void tst_QUtf8StringView::compareStringsCaseSensitive_data()
+{
+ QTest::addColumn<QString>("lhs");
+ QTest::addColumn<QString>("rhs");
+ QTest::addColumn<int>("compareValue");
+
+ QTest::newRow("EqualStrings") << "Test"
+ << "Test" << 0;
+ QTest::newRow("EqualStringsLong") << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ"
+ << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ" << 0;
+ QTest::newRow("DifferentCase") << "test"
+ << "Test" << 32;
+ QTest::newRow("DifferentCaseLong")
+ << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ"
+ << "abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyz" << -32;
+ QTest::newRow("ReverseStrings") << "Test"
+ << "tseT" << -32;
+ QTest::newRow("Different Strings") << "Testing and testing"
+ << "Testing and resting" << 2;
+ QTest::newRow("Latin1RangeCharacter") << u8"B\u00d8" << u8"B\u00d8" << 0;
+ QTest::newRow("Latin1RangeCharacterDifferentCase") << u8"B\u00d8" << u8"B\u00f8" << -32;
+}
+
+void tst_QUtf8StringView::compareStringsCaseInsensitive_data()
+{
+ QTest::addColumn<QString>("lhs");
+ QTest::addColumn<QString>("rhs");
+ QTest::addColumn<int>("compareValue");
+
+ QTest::newRow("EqualStrings") << "Test"
+ << "Test" << 0;
+ QTest::newRow("EqualStringsLong") << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ"
+ << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ" << 0;
+ QTest::newRow("DifferentCase") << "test"
+ << "Test" << 0;
+ QTest::newRow("DifferentCaseLong") << "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ"
+ << "abcdefghijklmnopqrstuvxyzabcdefghijklmnopqrstuvxyz" << 0;
+ QTest::newRow("ReverseStrings") << "Test"
+ << "tseT" << -14;
+ QTest::newRow("Different Strings") << "Testing and testing"
+ << "Testing and resting" << 2;
+ QTest::newRow("Latin1RangeCharacter") << u8"B\u00d8" << u8"B\u00d8" << 0;
+ QTest::newRow("Latin1RangeCharacterDifferentCase") << u8"B\u00d8" << u8"B\u00f8" << 0;
+}
+
+void tst_QUtf8StringView::compareStringsLatin1(bool caseSensitive)
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(int, compareValue);
+ QByteArray left = lhs.toUtf8();
+ QByteArray right = rhs.toLatin1();
+ QBasicUtf8StringView<false> lhv(left);
+ QLatin1StringView rhv(right);
+ Qt::CaseSensitivity cs = caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int result;
+
+ QBENCHMARK {
+ result = lhv.compare(rhv, cs);
+ };
+ QCOMPARE(result, compareValue);
+}
+
+void tst_QUtf8StringView::compareStringsUtf16(bool caseSensitive)
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(int, compareValue);
+
+ QByteArray left = lhs.toUtf8();
+ QBasicUtf8StringView<false> lhv(left);
+ QStringView rhv(rhs);
+ Qt::CaseSensitivity cs = caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int result;
+
+ QBENCHMARK {
+ result = lhv.compare(rhv, cs);
+ };
+ QCOMPARE(result, compareValue);
+}
+
+void tst_QUtf8StringView::compareStringsUtf8(bool caseSensitive)
+{
+ QFETCH(QString, lhs);
+ QFETCH(QString, rhs);
+ QFETCH(int, compareValue);
+
+ QByteArray left = lhs.toUtf8();
+ QByteArray right = rhs.toUtf8();
+ QBasicUtf8StringView<false> lhv(left);
+ QBasicUtf8StringView<false> rhv(right);
+ Qt::CaseSensitivity cs = caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int result;
+
+ QBENCHMARK {
+ result = lhv.compare(rhv, cs);
+ };
+ QCOMPARE(result, compareValue);
+}
+
+void tst_QUtf8StringView::compareStringsWithErrors_data()
+{
+ QTest::addColumn<QByteArray>("lhs");
+ QTest::addColumn<QByteArray>("rhs");
+ QTest::addColumn<int>("compare");
+ QTest::addColumn<bool>("caseSensitive");
+
+ QTest::newRow("Compare errors 0xfe vs 0xff case-insensitive")
+ << QByteArray("\xfe") << QByteArray("\xff") << 0 << false;
+ QTest::newRow("Compare errors 0xff vs 0xff case-insensitive")
+ << QByteArray("\xff") << QByteArray("\xff") << 0 << false;
+ QTest::newRow("Compare 'a' with error 0xff case-insensitive")
+ << QByteArray("a") << QByteArray("\xff") << -65436 << false;
+ QTest::newRow("Compare errors 0xfe vs 0xff case-sensitive")
+ << QByteArray("\xfe") << QByteArray("\xff") << -1 << true;
+ QTest::newRow("Compare errors 0xff vs 0xff case-sensitive")
+ << QByteArray("\xff") << QByteArray("\xff") << 0 << true;
+ QTest::newRow("Compare 'a' with error 0xff case-sensitive")
+ << QByteArray("a") << QByteArray("\xff") << -158 << true;
+}
+
+void tst_QUtf8StringView::compareStringsWithErrors()
+{
+ QFETCH(QByteArray, lhs);
+ QFETCH(QByteArray, rhs);
+ QFETCH(int, compare);
+ QFETCH(bool, caseSensitive);
+ QBasicUtf8StringView<false> lhv(lhs);
+ QBasicUtf8StringView<false> rhv(rhs);
+ Qt::CaseSensitivity cs = caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int result;
+
+ QBENCHMARK {
+ result = lhv.compare(rhv, cs);
+ };
+ QCOMPARE(result, compare);
+ QCOMPARE(-result, rhv.compare(lhv, cs));
+}
+
+QTEST_MAIN(tst_QUtf8StringView)
+
+#include "tst_bench_qutf8stringview.moc"
diff --git a/tests/benchmarks/corelib/thread/CMakeLists.txt b/tests/benchmarks/corelib/thread/CMakeLists.txt
index 8f7b829a40..fd7cbe6117 100644
--- a/tests/benchmarks/corelib/thread/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/CMakeLists.txt
@@ -1,6 +1,9 @@
-# Generated from thread.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-add_subdirectory(qfuture)
+if(QT_FEATURE_future)
+ add_subdirectory(qfuture)
+endif()
add_subdirectory(qmutex)
add_subdirectory(qreadwritelock)
add_subdirectory(qthreadstorage)
diff --git a/tests/benchmarks/corelib/thread/qfuture/CMakeLists.txt b/tests/benchmarks/corelib/thread/qfuture/CMakeLists.txt
index 4a737c62b8..5988b1c0b0 100644
--- a/tests/benchmarks/corelib/thread/qfuture/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qfuture/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## tst_bench_qfuture Binary:
#####################################################################
@@ -5,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qfuture
EXCEPTIONS
SOURCES
- tst_qfuture.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qfuture.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/thread/qfuture/tst_qfuture.cpp b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp
index c7a4ff24d9..38b3f636c9 100644
--- a/tests/benchmarks/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp
@@ -1,35 +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
#include <QTest>
#include <qexception.h>
#include <qfuture.h>
+#include <qpromise.h>
#include <qsemaphore.h>
class tst_QFuture : public QObject
@@ -37,7 +13,7 @@ class tst_QFuture : public QObject
Q_OBJECT
private slots:
- void makeReadyfuture();
+ void makeReadyValueFuture();
#ifndef QT_NO_EXCEPTIONS
void makeExceptionalFuture();
#endif
@@ -67,10 +43,10 @@ private slots:
void progressText();
};
-void tst_QFuture::makeReadyfuture()
+void tst_QFuture::makeReadyValueFuture()
{
QBENCHMARK {
- auto future = QtFuture::makeReadyFuture(42);
+ auto future = QtFuture::makeReadyValueFuture(42);
Q_UNUSED(future);
}
}
@@ -88,7 +64,7 @@ void tst_QFuture::makeExceptionalFuture()
void tst_QFuture::result()
{
- auto future = QtFuture::makeReadyFuture(42);
+ auto future = QtFuture::makeReadyValueFuture(42);
QBENCHMARK {
auto value = future.result();
@@ -116,7 +92,7 @@ void tst_QFuture::results()
void tst_QFuture::takeResult()
{
QBENCHMARK {
- auto future = QtFuture::makeReadyFuture(42);
+ auto future = QtFuture::makeReadyValueFuture(42);
auto value = future.takeResult();
Q_UNUSED(value);
}
@@ -164,7 +140,7 @@ void tst_QFuture::reportException()
void tst_QFuture::then()
{
- auto f = QtFuture::makeReadyFuture(42);
+ auto f = QtFuture::makeReadyValueFuture(42);
QBENCHMARK {
auto future = f.then([](int value) { return value; });
Q_UNUSED(future);
@@ -173,7 +149,7 @@ void tst_QFuture::then()
void tst_QFuture::thenVoid()
{
- auto f = QtFuture::makeReadyFuture();
+ auto f = QtFuture::makeReadyVoidFuture();
QBENCHMARK {
auto future = f.then([] {});
Q_UNUSED(future);
@@ -229,7 +205,7 @@ void tst_QFuture::onFailedVoid()
void tst_QFuture::thenOnFailed()
{
- auto f = QtFuture::makeReadyFuture(42);
+ auto f = QtFuture::makeReadyValueFuture(42);
QBENCHMARK {
auto future =
f.then([](int) { throw std::runtime_error("error"); }).onFailed([] { return 0; });
@@ -239,7 +215,7 @@ void tst_QFuture::thenOnFailed()
void tst_QFuture::thenOnFailedVoid()
{
- auto f = QtFuture::makeReadyFuture();
+ auto f = QtFuture::makeReadyVoidFuture();
QBENCHMARK {
auto future = f.then([] { throw std::runtime_error("error"); }).onFailed([] {});
Q_UNUSED(future);
@@ -317,4 +293,5 @@ void tst_QFuture::progressText()
}
QTEST_MAIN(tst_QFuture)
-#include "tst_qfuture.moc"
+
+#include "tst_bench_qfuture.moc"
diff --git a/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt b/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
index 8872a50227..2d01f9ff1f 100644
--- a/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qmutex/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmutex.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmutex Binary:
@@ -6,10 +7,8 @@
qt_internal_add_benchmark(tst_bench_qmutex
SOURCES
- tst_qmutex.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qmutex.cpp
+ LIBRARIES
+ Qt::CorePrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qmutex.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
index 9cea995433..6ea0c25c0b 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
@@ -1,38 +1,16 @@
-/****************************************************************************
-**
-** 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
#include <QtCore/QtCore>
#include <QTest>
+#include <QtCore/private/qvolatile_p.h>
#include <math.h>
//#define USE_SEM_T
+using namespace std::chrono_literals;
+
#if defined(Q_OS_UNIX)
#if !defined(USE_SEM_T)
# include <pthread.h>
@@ -75,8 +53,7 @@ void NativeMutexUnlock(NativeMutexType *mutex)
}
#endif
#elif defined(Q_OS_WIN)
-# define _WIN32_WINNT 0x0400
-# include <windows.h>
+# include <qt_windows.h>
typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex)
{
@@ -158,7 +135,7 @@ void tst_QMutex::noThread()
QBENCHMARK {
count = 0;
for (int i = 0; i < N; i++) {
- count++;
+ QtPrivate::volatilePreIncrement(count);
}
}
break;
@@ -167,7 +144,7 @@ void tst_QMutex::noThread()
count = 0;
for (int i = 0; i < N; i++) {
mtx.lock();
- count++;
+ QtPrivate::volatilePreIncrement(count);
mtx.unlock();
}
}
@@ -177,7 +154,7 @@ void tst_QMutex::noThread()
count = 0;
for (int i = 0; i < N; i++) {
QMutexLocker locker(&mtx);
- count++;
+ QtPrivate::volatilePreIncrement(count);
}
}
break;
@@ -253,7 +230,8 @@ void tst_QMutex::contendedNative_data()
class NativeMutexThread : public QThread
{
NativeMutexType *mutex1, *mutex2;
- int iterations, msleepDuration;
+ int iterations;
+ std::chrono::milliseconds msleepDuration;
bool use2mutexes;
public:
bool done;
@@ -271,8 +249,8 @@ public:
NativeMutexLock(mutex1);
if (use2mutexes)
NativeMutexLock(mutex2);
- if (msleepDuration >= 0)
- msleep(msleepDuration);
+ if (msleepDuration >= 0ms)
+ sleep(msleepDuration);
if (use2mutexes)
NativeMutexUnlock(mutex2);
NativeMutexUnlock(mutex1);
@@ -296,7 +274,7 @@ void tst_QMutex::contendedNative()
NativeMutexInitialize(&mutex2);
QList<NativeMutexThread *> threads(threadCount);
- for (int i = 0; i < threads.count(); ++i) {
+ for (int i = 0; i < threads.size(); ++i) {
threads[i] = new NativeMutexThread(&mutex1, &mutex2, iterations, msleepDuration, use2mutexes);
threads[i]->start();
}
@@ -308,11 +286,11 @@ void tst_QMutex::contendedNative()
semaphore4.release(threadCount);
}
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->done = true;
semaphore1.acquire(threadCount);
semaphore2.release(threadCount);
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->wait();
qDeleteAll(threads);
@@ -323,7 +301,8 @@ void tst_QMutex::contendedNative()
class QMutexThread : public QThread
{
QMutex *mutex1, *mutex2;
- int iterations, msleepDuration;
+ int iterations;
+ std::chrono::milliseconds msleepDuration;
bool use2mutexes;
public:
bool done;
@@ -341,8 +320,8 @@ public:
mutex1->lock();
if (use2mutexes)
mutex2->lock();
- if (msleepDuration >= 0)
- msleep(msleepDuration);
+ if (msleepDuration >= 0ms)
+ sleep(msleepDuration);
if (use2mutexes)
mutex2->unlock();
mutex1->unlock();
@@ -364,7 +343,7 @@ void tst_QMutex::contendedQMutex()
QMutex mutex1, mutex2;
QList<QMutexThread *> threads(threadCount);
- for (int i = 0; i < threads.count(); ++i) {
+ for (int i = 0; i < threads.size(); ++i) {
threads[i] = new QMutexThread(&mutex1, &mutex2, iterations, msleepDuration, use2mutexes);
threads[i]->start();
}
@@ -376,11 +355,11 @@ void tst_QMutex::contendedQMutex()
semaphore4.release(threadCount);
}
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->done = true;
semaphore1.acquire(threadCount);
semaphore2.release(threadCount);
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->wait();
qDeleteAll(threads);
}
@@ -388,7 +367,8 @@ void tst_QMutex::contendedQMutex()
class QMutexLockerThread : public QThread
{
QMutex *mutex1, *mutex2;
- int iterations, msleepDuration;
+ int iterations;
+ std::chrono::milliseconds msleepDuration;
bool use2mutexes;
public:
bool done;
@@ -406,8 +386,8 @@ public:
{
QMutexLocker locker1(mutex1);
QMutexLocker locker2(use2mutexes ? mutex2 : 0);
- if (msleepDuration >= 0)
- msleep(msleepDuration);
+ if (msleepDuration >= 0ms)
+ sleep(msleepDuration);
}
QThread::yieldCurrentThread();
@@ -427,7 +407,7 @@ void tst_QMutex::contendedQMutexLocker()
QMutex mutex1, mutex2;
QList<QMutexLockerThread *> threads(threadCount);
- for (int i = 0; i < threads.count(); ++i) {
+ for (int i = 0; i < threads.size(); ++i) {
threads[i] = new QMutexLockerThread(&mutex1, &mutex2, iterations, msleepDuration, use2mutexes);
threads[i]->start();
}
@@ -439,14 +419,15 @@ void tst_QMutex::contendedQMutexLocker()
semaphore4.release(threadCount);
}
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->done = true;
semaphore1.acquire(threadCount);
semaphore2.release(threadCount);
- for (int i = 0; i < threads.count(); ++i)
+ for (int i = 0; i < threads.size(); ++i)
threads[i]->wait();
qDeleteAll(threads);
}
QTEST_MAIN(tst_QMutex)
-#include "tst_qmutex.moc"
+
+#include "tst_bench_qmutex.moc"
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/CMakeLists.txt b/tests/benchmarks/corelib/thread/qreadwritelock/CMakeLists.txt
index 79d3a2f879..b56f484b48 100644
--- a/tests/benchmarks/corelib/thread/qreadwritelock/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qreadwritelock.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qreadwritelock Binary:
@@ -6,11 +7,8 @@
qt_internal_add_benchmark(tst_bench_qreadwritelock
SOURCES
- tst_qreadwritelock.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qreadwritelock.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qreadwritelock.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp b/tests/benchmarks/corelib/thread/qreadwritelock/tst_bench_qreadwritelock.cpp
index 1018dae878..e63ac6573f 100644
--- a/tests/benchmarks/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
+++ b/tests/benchmarks/corelib/thread/qreadwritelock/tst_bench_qreadwritelock.cpp
@@ -1,39 +1,12 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 Olivier Goffart <ogoffart@woboq.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QtCore>
#include <QTest>
#include <mutex>
#if __has_include(<shared_mutex>)
-#if __cplusplus > 201103L
#include <shared_mutex>
#endif
-#endif
#include <vector>
// Wrapers that take pointers instead of reference to have the same interface as Qt
@@ -46,6 +19,49 @@ struct LockerWrapper : T
}
};
+struct QRecursiveReadWriteLock : QReadWriteLock
+{
+ QRecursiveReadWriteLock() : QReadWriteLock(Recursive) {}
+};
+
+template <typename T, size_t N>
+ // requires N = 2^M for some Integral M >= 0
+struct Recursive
+{
+ Recursive<T, N/2> r1, r2;
+
+ template <typename...Args>
+ Q_ALWAYS_INLINE
+ explicit Recursive(Args &&...args)
+ : r1(args...),
+ r2(args...)
+ {}
+};
+
+template <typename T>
+struct Recursive<T, 1>
+{
+ T t;
+ template <typename...Args>
+ Q_ALWAYS_INLINE
+ explicit Recursive(Args &&...args)
+ : t(args...) {}
+};
+
+template <typename T>
+struct Recursive<T, 0>
+{
+ template <typename...Args>
+ Q_ALWAYS_INLINE
+ explicit Recursive(Args &&...) {}
+};
+
+template <size_t N>
+using QRecursiveReadLocker = Recursive<QReadLocker, N>;
+
+template <size_t N>
+using QRecursiveWriteLocker = Recursive<QWriteLocker, N>;
+
int threadCount;
class tst_QReadWriteLock : public QObject
@@ -107,6 +123,15 @@ void tst_QReadWriteLock::uncontended_data()
<< FunctionPtrHolder(testUncontended<QReadWriteLock, QReadLocker>);
QTest::newRow("QReadWriteLock, write")
<< FunctionPtrHolder(testUncontended<QReadWriteLock, QWriteLocker>);
+#define ROW(n) \
+ QTest::addRow("QReadWriteLock, %s, recursive: %d", "read", n) \
+ << FunctionPtrHolder(testUncontended<QRecursiveReadWriteLock, QRecursiveReadLocker<n>>); \
+ QTest::addRow("QReadWriteLock, %s, recursive: %d", "write", n) \
+ << FunctionPtrHolder(testUncontended<QRecursiveReadWriteLock, QRecursiveWriteLocker<n>>)
+ ROW(1);
+ ROW(2);
+ ROW(32);
+#undef ROW
QTest::newRow("std::mutex") << FunctionPtrHolder(
testUncontended<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
#ifdef __cpp_lib_shared_mutex
@@ -174,6 +199,13 @@ void tst_QReadWriteLock::readOnly_data()
QTest::newRow("nothing") << FunctionPtrHolder(testReadOnly<int, FakeLock>);
QTest::newRow("QMutex") << FunctionPtrHolder(testReadOnly<QMutex, QMutexLocker<QMutex>>);
QTest::newRow("QReadWriteLock") << FunctionPtrHolder(testReadOnly<QReadWriteLock, QReadLocker>);
+#define ROW(n) \
+ QTest::addRow("QReadWriteLock, recursive: %d", n) \
+ << FunctionPtrHolder(testReadOnly<QRecursiveReadWriteLock, QRecursiveReadLocker<n>>)
+ ROW(1);
+ ROW(2);
+ ROW(32);
+#undef ROW
QTest::newRow("std::mutex") << FunctionPtrHolder(
testReadOnly<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
#ifdef __cpp_lib_shared_mutex
@@ -235,6 +267,13 @@ void tst_QReadWriteLock::writeOnly_data()
// QTest::newRow("nothing") << FunctionPtrHolder(testWriteOnly<int, FakeLock>);
QTest::newRow("QMutex") << FunctionPtrHolder(testWriteOnly<QMutex, QMutexLocker<QMutex>>);
QTest::newRow("QReadWriteLock") << FunctionPtrHolder(testWriteOnly<QReadWriteLock, QWriteLocker>);
+#define ROW(n) \
+ QTest::addRow("QReadWriteLock, recursive: %d", n) \
+ << FunctionPtrHolder(testWriteOnly<QRecursiveReadWriteLock, QRecursiveWriteLocker<n>>)
+ ROW(1);
+ ROW(2);
+ ROW(32);
+#undef ROW
QTest::newRow("std::mutex") << FunctionPtrHolder(
testWriteOnly<std::mutex, LockerWrapper<std::unique_lock<std::mutex>>>);
#ifdef __cpp_lib_shared_mutex
@@ -256,4 +295,4 @@ void tst_QReadWriteLock::writeOnly()
}
QTEST_MAIN(tst_QReadWriteLock)
-#include "tst_qreadwritelock.moc"
+#include "tst_bench_qreadwritelock.moc"
diff --git a/tests/benchmarks/corelib/thread/qthreadpool/CMakeLists.txt b/tests/benchmarks/corelib/thread/qthreadpool/CMakeLists.txt
index 7b0c81891e..1353eaa2c4 100644
--- a/tests/benchmarks/corelib/thread/qthreadpool/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qthreadpool/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qthreadpool.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qthreadpool Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qthreadpool
SOURCES
- tst_qthreadpool.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qthreadpool.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qthreadpool.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/thread/qthreadpool/tst_bench_qthreadpool.cpp b/tests/benchmarks/corelib/thread/qthreadpool/tst_bench_qthreadpool.cpp
new file mode 100644
index 0000000000..e7e5636307
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qthreadpool/tst_bench_qthreadpool.cpp
@@ -0,0 +1,55 @@
+// Copyright (C) 2013 David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <qtest.h>
+#include <QtCore>
+
+class tst_QThreadPool : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QThreadPool();
+ ~tst_QThreadPool();
+
+private slots:
+ void startRunnables();
+ void activeThreadCount();
+};
+
+tst_QThreadPool::tst_QThreadPool()
+{
+}
+
+tst_QThreadPool::~tst_QThreadPool()
+{
+}
+
+class NoOpRunnable : public QRunnable
+{
+public:
+ void run() override {
+ }
+};
+
+void tst_QThreadPool::startRunnables()
+{
+ QThreadPool threadPool;
+ threadPool.setMaxThreadCount(10);
+ QBENCHMARK {
+ threadPool.start(new NoOpRunnable());
+ }
+}
+
+void tst_QThreadPool::activeThreadCount()
+{
+ QThreadPool threadPool;
+ threadPool.start(new NoOpRunnable());
+ QBENCHMARK {
+ QVERIFY(threadPool.activeThreadCount() <= 10);
+ }
+}
+
+QTEST_MAIN(tst_QThreadPool)
+
+#include "tst_bench_qthreadpool.moc"
diff --git a/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp
deleted file mode 100644
index 10928e3afc..0000000000
--- a/tests/benchmarks/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 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$
-**
-****************************************************************************/
-
-#include <qtest.h>
-#include <QtCore>
-
-class tst_QThreadPool : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QThreadPool();
- ~tst_QThreadPool();
-
-private slots:
- void startRunnables();
- void activeThreadCount();
-};
-
-tst_QThreadPool::tst_QThreadPool()
-{
-}
-
-tst_QThreadPool::~tst_QThreadPool()
-{
-}
-
-class NoOpRunnable : public QRunnable
-{
-public:
- void run() override {
- }
-};
-
-void tst_QThreadPool::startRunnables()
-{
- QThreadPool threadPool;
- threadPool.setMaxThreadCount(10);
- QBENCHMARK {
- threadPool.start(new NoOpRunnable());
- }
-}
-
-void tst_QThreadPool::activeThreadCount()
-{
- QThreadPool threadPool;
- threadPool.start(new NoOpRunnable());
- QBENCHMARK {
- QVERIFY(threadPool.activeThreadCount() <= 10);
- }
-}
-
-QTEST_MAIN(tst_QThreadPool)
-#include "tst_qthreadpool.moc"
diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/CMakeLists.txt b/tests/benchmarks/corelib/thread/qthreadstorage/CMakeLists.txt
index 78ac072d35..916a2d8dee 100644
--- a/tests/benchmarks/corelib/thread/qthreadstorage/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qthreadstorage/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qthreadstorage.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qthreadstorage Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qthreadstorage
SOURCES
- tst_qthreadstorage.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qthreadstorage.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qthreadstorage.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/tst_bench_qthreadstorage.cpp b/tests/benchmarks/corelib/thread/qthreadstorage/tst_bench_qthreadstorage.cpp
new file mode 100644
index 0000000000..47db215465
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qthreadstorage/tst_bench_qthreadstorage.cpp
@@ -0,0 +1,85 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <qtest.h>
+#include <QtCore>
+
+QThreadStorage<int *> dummy[8];
+
+QThreadStorage<QString *> tls1;
+
+class tst_QThreadStorage : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QThreadStorage();
+ virtual ~tst_QThreadStorage();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void construct();
+ void get();
+ void set();
+};
+
+tst_QThreadStorage::tst_QThreadStorage()
+{
+}
+
+tst_QThreadStorage::~tst_QThreadStorage()
+{
+}
+
+void tst_QThreadStorage::init()
+{
+ dummy[1].setLocalData(new int(5));
+ dummy[2].setLocalData(new int(4));
+ dummy[3].setLocalData(new int(3));
+ tls1.setLocalData(new QString());
+}
+
+void tst_QThreadStorage::cleanup()
+{
+}
+
+void tst_QThreadStorage::construct()
+{
+ QBENCHMARK {
+ QThreadStorage<int *> ts;
+ }
+}
+
+
+void tst_QThreadStorage::get()
+{
+ QThreadStorage<int *> ts;
+ ts.setLocalData(new int(45));
+
+ int count = 0;
+ QBENCHMARK {
+ int *i = ts.localData();
+ count += *i;
+ }
+ QVERIFY(count > 0);
+ ts.setLocalData(0);
+}
+
+void tst_QThreadStorage::set()
+{
+ QThreadStorage<int *> ts;
+
+ int count = 0;
+ QBENCHMARK {
+ ts.setLocalData(new int(count));
+ count++;
+ }
+ ts.setLocalData(0);
+}
+
+QTEST_MAIN(tst_QThreadStorage)
+
+#include "tst_bench_qthreadstorage.moc"
diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
deleted file mode 100644
index c8f9f23c76..0000000000
--- a/tests/benchmarks/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qtest.h>
-#include <QtCore>
-
-QThreadStorage<int *> dummy[8];
-
-QThreadStorage<QString *> tls1;
-
-class tst_QThreadStorage : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QThreadStorage();
- virtual ~tst_QThreadStorage();
-
-public slots:
- void init();
- void cleanup();
-
-private slots:
- void construct();
- void get();
- void set();
-};
-
-tst_QThreadStorage::tst_QThreadStorage()
-{
-}
-
-tst_QThreadStorage::~tst_QThreadStorage()
-{
-}
-
-void tst_QThreadStorage::init()
-{
- dummy[1].setLocalData(new int(5));
- dummy[2].setLocalData(new int(4));
- dummy[3].setLocalData(new int(3));
- tls1.setLocalData(new QString());
-}
-
-void tst_QThreadStorage::cleanup()
-{
-}
-
-void tst_QThreadStorage::construct()
-{
- QBENCHMARK {
- QThreadStorage<int *> ts;
- }
-}
-
-
-void tst_QThreadStorage::get()
-{
- QThreadStorage<int *> ts;
- ts.setLocalData(new int(45));
-
- int count = 0;
- QBENCHMARK {
- int *i = ts.localData();
- count += *i;
- }
- ts.setLocalData(0);
-}
-
-void tst_QThreadStorage::set()
-{
- QThreadStorage<int *> ts;
-
- int count = 0;
- QBENCHMARK {
- ts.setLocalData(new int(count));
- count++;
- }
- ts.setLocalData(0);
-}
-
-
-QTEST_MAIN(tst_QThreadStorage)
-#include "tst_qthreadstorage.moc"
diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/CMakeLists.txt b/tests/benchmarks/corelib/thread/qwaitcondition/CMakeLists.txt
index 68c6e88342..c7a15f9e8a 100644
--- a/tests/benchmarks/corelib/thread/qwaitcondition/CMakeLists.txt
+++ b/tests/benchmarks/corelib/thread/qwaitcondition/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qwaitcondition.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qwaitcondition Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qwaitcondition
SOURCES
- tst_qwaitcondition.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qwaitcondition.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qwaitcondition.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/tst_bench_qwaitcondition.cpp b/tests/benchmarks/corelib/thread/qwaitcondition/tst_bench_qwaitcondition.cpp
new file mode 100644
index 0000000000..0abd53fc93
--- /dev/null
+++ b/tests/benchmarks/corelib/thread/qwaitcondition/tst_bench_qwaitcondition.cpp
@@ -0,0 +1,174 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QtCore>
+#include <QTest>
+
+#include <math.h>
+#include <condition_variable>
+#include <mutex>
+
+#include <limits.h>
+
+using namespace std::chrono_literals;
+
+class tst_QWaitCondition : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QWaitCondition()
+ {
+ }
+
+private slots:
+ void oscillate_QWaitCondition_QMutex_data() { oscillate_mutex_data(); }
+ void oscillate_QWaitCondition_QMutex();
+ void oscillate_QWaitCondition_QReadWriteLock_data() { oscillate_mutex_data(); }
+ void oscillate_QWaitCondition_QReadWriteLock();
+ void oscillate_std_condition_variable_std_mutex_data() { oscillate_mutex_data(); }
+ void oscillate_std_condition_variable_std_mutex();
+ void oscillate_std_condition_variable_any_QMutex_data() { oscillate_mutex_data(); }
+ void oscillate_std_condition_variable_any_QMutex();
+ void oscillate_std_condition_variable_any_QReadWriteLock_data() { oscillate_mutex_data(); }
+ void oscillate_std_condition_variable_any_QReadWriteLock();
+
+private:
+ void oscillate_mutex_data();
+};
+
+
+int turn;
+const int threadCount = 10;
+QWaitCondition cond;
+std::condition_variable cv;
+std::condition_variable_any cva;
+
+template <typename Cond>
+Cond *get();
+
+template <> std::condition_variable *get() { return &cv; }
+template <> std::condition_variable_any *get() { return &cva; }
+
+template <class Cond, class Mutex, class Locker>
+class OscillateThread : public QThread
+{
+public:
+ Mutex *mutex;
+ int m_threadid;
+ unsigned long timeout;
+
+ void run() override
+ {
+ for (int count = 0; count < 5000; ++count) {
+ Locker lock(*mutex);
+ while (m_threadid != turn) {
+ if (timeout == ULONG_MAX)
+ get<Cond>()->wait(lock);
+ else if (timeout == 0) // Windows doesn't unlock the mutex with a zero timeout
+ get<Cond>()->wait_for(lock, 1ns);
+ else
+ get<Cond>()->wait_for(lock, timeout * 1ms);
+ }
+ turn = (turn+1) % threadCount;
+ get<Cond>()->notify_all();
+ }
+ }
+};
+
+template <class Mutex, class Locker>
+class OscillateThread<QWaitCondition, Mutex, Locker> : public QThread
+{
+public:
+ Mutex *mutex;
+ int m_threadid;
+ unsigned long timeout;
+
+ void run() override
+ {
+ for (int count = 0; count < 5000; ++count) {
+
+ Locker lock(mutex);
+ while (m_threadid != turn) {
+ cond.wait(mutex, timeout);
+ }
+ turn = (turn+1) % threadCount;
+ cond.wakeAll();
+ }
+ }
+};
+
+template <class Cond, class Mutex, class Locker>
+void oscillate(unsigned long timeout) {
+
+ OscillateThread<Cond, Mutex, Locker> thrd[threadCount];
+ Mutex m;
+ for (int i = 0; i < threadCount; ++i) {
+ thrd[i].mutex = &m;
+ thrd[i].m_threadid = i;
+ thrd[i].timeout = timeout;
+ }
+
+ QBENCHMARK {
+ for (int i = 0; i < threadCount; ++i) {
+ thrd[i].start();
+ }
+ for (int i = 0; i < threadCount; ++i) {
+ thrd[i].wait();
+ }
+ }
+
+}
+
+void tst_QWaitCondition::oscillate_mutex_data()
+{
+ QTest::addColumn<unsigned long>("timeout");
+
+ QTest::newRow("0") << 0ul;
+ QTest::newRow("1") << 1ul;
+ QTest::newRow("1000") << 1000ul;
+ QTest::newRow("forever") << ULONG_MAX;
+}
+
+void tst_QWaitCondition::oscillate_QWaitCondition_QMutex()
+{
+ QFETCH(unsigned long, timeout);
+ oscillate<QWaitCondition, QMutex, QMutexLocker<QMutex>>(timeout);
+}
+
+void tst_QWaitCondition::oscillate_QWaitCondition_QReadWriteLock()
+{
+ QFETCH(unsigned long, timeout);
+ oscillate<QWaitCondition, QReadWriteLock, QWriteLocker>(timeout);
+}
+
+void tst_QWaitCondition::oscillate_std_condition_variable_std_mutex()
+{
+ QFETCH(unsigned long, timeout);
+ oscillate<std::condition_variable, std::mutex, std::unique_lock<std::mutex>>(timeout);
+}
+
+
+void tst_QWaitCondition::oscillate_std_condition_variable_any_QMutex()
+{
+ QFETCH(unsigned long, timeout);
+ oscillate<std::condition_variable_any, QMutex, std::unique_lock<QMutex>>(timeout);
+}
+
+
+void tst_QWaitCondition::oscillate_std_condition_variable_any_QReadWriteLock()
+{
+ QFETCH(unsigned long, timeout);
+
+ struct WriteLocker : QWriteLocker {
+ // adapt to BasicLockable
+ explicit WriteLocker(QReadWriteLock &m) : QWriteLocker{&m} {}
+ void lock() { relock(); }
+ };
+
+ oscillate<std::condition_variable_any, QReadWriteLock, WriteLocker>(timeout);
+}
+
+QTEST_MAIN(tst_QWaitCondition)
+
+#include "tst_bench_qwaitcondition.moc"
diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp
deleted file mode 100644
index b87da463dc..0000000000
--- a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QtCore>
-#include <QTest>
-
-#include <math.h>
-
-
-class tst_QWaitCondition : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QWaitCondition()
- {
- }
-
-private slots:
- void oscillate_mutex_data();
- void oscillate_mutex();
- void oscillate_writelock_data();
- void oscillate_writelock();
-};
-
-
-int turn;
-const int threadCount = 10;
-QWaitCondition cond;
-
-template <class Mutex, class Locker>
-class OscillateThread : public QThread
-{
-public:
- Mutex *mutex;
- int m_threadid;
- int timeout;
-
- void run() override
- {
- for (int count = 0; count < 5000; ++count) {
-
- Locker lock(mutex);
- while (m_threadid != turn) {
- cond.wait(mutex, timeout);
- }
- turn = (turn+1) % threadCount;
- cond.wakeAll();
- }
- }
-};
-
-template <class Mutex, class Locker>
-void oscillate(unsigned long timeout) {
-
- OscillateThread<Mutex, Locker> thrd[threadCount];
- Mutex m;
- for (int i = 0; i < threadCount; ++i) {
- thrd[i].mutex = &m;
- thrd[i].m_threadid = i;
- thrd[i].timeout = timeout;
- }
-
- QBENCHMARK {
- for (int i = 0; i < threadCount; ++i) {
- thrd[i].start();
- }
- for (int i = 0; i < threadCount; ++i) {
- thrd[i].wait();
- }
- }
-
-}
-
-void tst_QWaitCondition::oscillate_mutex_data()
-{
- QTest::addColumn<unsigned long>("timeout");
-
- QTest::newRow("0") << 0ul;
- QTest::newRow("1") << 1ul;
- QTest::newRow("1000") << 1000ul;
- QTest::newRow("forever") << ULONG_MAX;
-}
-
-void tst_QWaitCondition::oscillate_mutex()
-{
- QFETCH(unsigned long, timeout);
- oscillate<QMutex, QMutexLocker<QMutex>>(timeout);
-}
-
-void tst_QWaitCondition::oscillate_writelock_data()
-{
- oscillate_mutex_data();
-}
-
-void tst_QWaitCondition::oscillate_writelock()
-{
- QFETCH(unsigned long, timeout);
- oscillate<QReadWriteLock, QWriteLocker>(timeout);
-}
-
-
-QTEST_MAIN(tst_QWaitCondition)
-#include "tst_qwaitcondition.moc"
diff --git a/tests/benchmarks/corelib/time/CMakeLists.txt b/tests/benchmarks/corelib/time/CMakeLists.txt
index 086650edb6..7c9de68486 100644
--- a/tests/benchmarks/corelib/time/CMakeLists.txt
+++ b/tests/benchmarks/corelib/time/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from time.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qdate)
add_subdirectory(qdatetime)
diff --git a/tests/benchmarks/corelib/time/qdate/CMakeLists.txt b/tests/benchmarks/corelib/time/qdate/CMakeLists.txt
index edc55463d8..e4ef5e3edc 100644
--- a/tests/benchmarks/corelib/time/qdate/CMakeLists.txt
+++ b/tests/benchmarks/corelib/time/qdate/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdate.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qdate Binary:
@@ -7,6 +8,6 @@
qt_internal_add_benchmark(tst_bench_qdate
SOURCES
tst_bench_qdate.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp
index 196289148a..7dde3bf426 100644
--- a/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp
+++ b/tests/benchmarks/corelib/time/qdate/tst_bench_qdate.cpp
@@ -1,34 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 The Qt Company Ltd.
-** 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) 2019 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDate>
#include <QTest>
#include <QList>
+using namespace Qt::StringLiterals;
class tst_QDate : public QObject
{
@@ -58,6 +34,9 @@ private Q_SLOTS:
void addDays();
void addMonths();
void addYears();
+
+ void fromString_data();
+ void fromString();
};
QList<QDate> tst_QDate::daily(qint64 start, qint64 end)
@@ -209,5 +188,28 @@ void tst_QDate::addYears()
Q_UNUSED(store);
}
+void tst_QDate::fromString_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("format");
+ QTest::addColumn<int>("baseYear");
+
+ QTest::newRow("yyyyMMdd") << u"20240412"_s << u"yyyyMMdd"_s << 2000;
+ QTest::newRow("yyyy-MM-dd") << u"2024-04-12"_s << u"yyyy-MM-dd"_s << 2000;
+ QTest::newRow("YYYYMMDD") << u"20240412"_s << u"YYYYMMDD"_s << 2000; // Invalid, QTBUG-124465.
+}
+
+void tst_QDate::fromString()
+{
+ QFETCH(const QString, string);
+ QFETCH(const QString, format);
+ QFETCH(const int, baseYear);
+ QDate date;
+ QBENCHMARK {
+ date = QDate::fromString(string, format, baseYear);
+ }
+ Q_UNUSED(date);
+}
+
QTEST_MAIN(tst_QDate)
#include "tst_bench_qdate.moc"
diff --git a/tests/benchmarks/corelib/time/qdatetime/CMakeLists.txt b/tests/benchmarks/corelib/time/qdatetime/CMakeLists.txt
index 2585b0d25d..14c0b9c730 100644
--- a/tests/benchmarks/corelib/time/qdatetime/CMakeLists.txt
+++ b/tests/benchmarks/corelib/time/qdatetime/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdatetime.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qdatetime Binary:
@@ -6,7 +7,8 @@
qt_internal_add_benchmark(tst_bench_qdatetime
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qdatetime.cpp
+ LIBRARIES
Qt::Test
+ Qt::CorePrivate
)
diff --git a/tests/benchmarks/corelib/time/qdatetime/main.cpp b/tests/benchmarks/corelib/time/qdatetime/tst_bench_qdatetime.cpp
index c6d2b84597..1c86eae009 100644
--- a/tests/benchmarks/corelib/time/qdatetime/main.cpp
+++ b/tests/benchmarks/corelib/time/qdatetime/tst_bench_qdatetime.cpp
@@ -1,59 +1,25 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDateTime>
#include <QTimeZone>
#include <QTest>
#include <QList>
#include <qdebug.h>
+#include <QtCore/private/qdatetime_p.h>
class tst_QDateTime : public QObject
{
Q_OBJECT
- enum : qint64
- {
- SECS_PER_DAY = 86400,
- MSECS_PER_DAY = 86400000,
- JULIAN_DAY_1950 = 2433283,
- JULIAN_DAY_1960 = 2436935,
- JULIAN_DAY_1970 = 2440588, // Epoch
- JULIAN_DAY_2010 = 2455198,
- JULIAN_DAY_2011 = 2455563,
- JULIAN_DAY_2020 = 2458850,
- JULIAN_DAY_2050 = 2469808,
- JULIAN_DAY_2060 = 2473460
- };
-
static QList<QDateTime> daily(qint64 start, qint64 end);
+#if QT_CONFIG(timezone)
static QList<QDateTime> norse(qint64 start, qint64 end);
+#endif
+ void decade_data();
private Q_SLOTS:
+ void create_data() { decade_data(); }
void create();
void isNull();
void isValid();
@@ -62,27 +28,35 @@ private Q_SLOTS:
void timeSpec();
void offsetFromUtc();
void timeZoneAbbreviation();
+ void toMSecsSinceEpoch_data() { decade_data(); }
void toMSecsSinceEpoch();
- void toMSecsSinceEpoch1950();
- void toMSecsSinceEpoch2050();
+#if QT_CONFIG(timezone)
+ void toMSecsSinceEpochTz_data() { decade_data(); }
void toMSecsSinceEpochTz();
- void toMSecsSinceEpoch1950Tz();
- void toMSecsSinceEpoch2050Tz();
+#endif
void setDate();
void setTime();
+#if QT_DEPRECATED_SINCE(6, 9)
void setTimeSpec();
void setOffsetFromUtc();
+#endif
void setMSecsSinceEpoch();
+#if QT_CONFIG(timezone)
void setMSecsSinceEpochTz();
+#endif
void toString();
void toStringTextFormat();
void toStringIsoFormat();
void addDays();
+#if QT_CONFIG(timezone)
void addDaysTz();
- void addMSecs();
void addMSecsTz();
+#endif
+ void addMSecs();
+#if QT_DEPRECATED_SINCE(6, 9)
void toTimeSpec();
void toOffsetFromUtc();
+#endif
void daysTo();
void msecsTo();
void equivalent();
@@ -99,33 +73,64 @@ private Q_SLOTS:
void fromStringIso();
void fromMSecsSinceEpoch();
void fromMSecsSinceEpochUtc();
+#if QT_CONFIG(timezone)
void fromMSecsSinceEpochTz();
+#endif
};
+using namespace QtPrivate::DateTimeConstants;
+constexpr qint64 JULIAN_DAY_1 = 1721426;
+constexpr qint64 JULIAN_DAY_11 = 1725078;
+constexpr qint64 JULIAN_DAY_1890 = 2411369;
+constexpr qint64 JULIAN_DAY_1900 = 2415021;
+constexpr qint64 JULIAN_DAY_1950 = 2433283;
+constexpr qint64 JULIAN_DAY_1960 = 2436935;
+constexpr qint64 JULIAN_DAY_1970 = 2440588; // Epoch
+constexpr qint64 JULIAN_DAY_2010 = 2455198;
+constexpr qint64 JULIAN_DAY_2011 = 2455563;
+constexpr qint64 JULIAN_DAY_2020 = 2458850;
+constexpr qint64 JULIAN_DAY_2050 = 2469808;
+constexpr qint64 JULIAN_DAY_2060 = 2473460;
+
+void tst_QDateTime::decade_data()
+{
+ QTest::addColumn<qint64>("startJd");
+ QTest::addColumn<qint64>("stopJd");
+
+ QTest::newRow("first-decade-CE") << JULIAN_DAY_1 << JULIAN_DAY_11;
+ QTest::newRow("1890s") << JULIAN_DAY_1890 << JULIAN_DAY_1900;
+ QTest::newRow("1950s") << JULIAN_DAY_1950 << JULIAN_DAY_1960;
+ QTest::newRow("2010s") << JULIAN_DAY_2010 << JULIAN_DAY_2020;
+ QTest::newRow("2050s") << JULIAN_DAY_2050 << JULIAN_DAY_2060;
+}
+
QList<QDateTime> tst_QDateTime::daily(qint64 start, qint64 end)
{
QList<QDateTime> list;
list.reserve(end - start);
for (int jd = start; jd < end; ++jd)
- list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0)));
+ list.append(QDateTime(QDate::fromJulianDay(jd).startOfDay()));
return list;
}
-
+#if QT_CONFIG(timezone)
QList<QDateTime> tst_QDateTime::norse(qint64 start, qint64 end)
{
const QTimeZone cet("Europe/Oslo");
QList<QDateTime> list;
list.reserve(end - start);
for (int jd = start; jd < end; ++jd)
- list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet));
+ list.append(QDateTime(QDate::fromJulianDay(jd).startOfDay(cet)));
return list;
}
-
+#endif
void tst_QDateTime::create()
{
+ QFETCH(const qint64, startJd);
+ QFETCH(const qint64, stopJd);
+ const QTime noon = QTime::fromMSecsSinceStartOfDay(43200);
QBENCHMARK {
- for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) {
- QDateTime test(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0));
+ for (int jd = startJd; jd < stopJd; ++jd) {
+ QDateTime test(QDate::fromJulianDay(jd), noon);
Q_UNUSED(test);
}
}
@@ -196,64 +201,29 @@ void tst_QDateTime::timeZoneAbbreviation()
void tst_QDateTime::toMSecsSinceEpoch()
{
- const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
- QBENCHMARK {
- for (const QDateTime &test : list)
- test.toMSecsSinceEpoch();
- }
-}
-
-void tst_QDateTime::toMSecsSinceEpoch1950()
-{
- const auto list = daily(JULIAN_DAY_1950, JULIAN_DAY_1960);
+ QFETCH(const qint64, startJd);
+ QFETCH(const qint64, stopJd);
+ const auto list = daily(startJd, stopJd);
QBENCHMARK {
for (const QDateTime &test : list)
test.toMSecsSinceEpoch();
}
}
-
-void tst_QDateTime::toMSecsSinceEpoch2050()
-{
- const auto list = daily(JULIAN_DAY_2050, JULIAN_DAY_2060);
- QBENCHMARK {
- for (const QDateTime &test : list)
- test.toMSecsSinceEpoch();
- }
-}
-
+#if QT_CONFIG(timezone)
void tst_QDateTime::toMSecsSinceEpochTz()
{
- qint64 result;
- const auto list = norse(JULIAN_DAY_2010, JULIAN_DAY_2020);
- QBENCHMARK {
- for (const QDateTime &test : list)
- result = test.toMSecsSinceEpoch();
- }
- Q_UNUSED(result);
-}
-
-void tst_QDateTime::toMSecsSinceEpoch1950Tz()
-{
- qint64 result;
- const auto list = norse(JULIAN_DAY_1950, JULIAN_DAY_1960);
- QBENCHMARK {
- for (const QDateTime &test : list)
- result = test.toMSecsSinceEpoch();
- }
- Q_UNUSED(result);
-}
+ QFETCH(const qint64, startJd);
+ QFETCH(const qint64, stopJd);
+ const auto list = norse(startJd, stopJd);
-void tst_QDateTime::toMSecsSinceEpoch2050Tz()
-{
qint64 result;
- const auto list = norse(JULIAN_DAY_2050, JULIAN_DAY_2060);
QBENCHMARK {
for (const QDateTime &test : list)
result = test.toMSecsSinceEpoch();
}
Q_UNUSED(result);
}
-
+#endif
void tst_QDateTime::setDate()
{
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -272,6 +242,9 @@ void tst_QDateTime::setTime()
}
}
+#if QT_DEPRECATED_SINCE(6, 9)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void tst_QDateTime::setTimeSpec()
{
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -289,6 +262,8 @@ void tst_QDateTime::setOffsetFromUtc()
test.setOffsetFromUtc(3600);
}
}
+QT_WARNING_POP
+#endif // 6.9 deprecation
void tst_QDateTime::setMSecsSinceEpoch()
{
@@ -299,7 +274,7 @@ void tst_QDateTime::setMSecsSinceEpoch()
test.setMSecsSinceEpoch(msecs);
}
}
-
+#if QT_CONFIG(timezone)
void tst_QDateTime::setMSecsSinceEpochTz()
{
const qint64 msecs = qint64(JULIAN_DAY_2010 - JULIAN_DAY_1970 + 180) * MSECS_PER_DAY;
@@ -309,7 +284,7 @@ void tst_QDateTime::setMSecsSinceEpochTz()
test.setMSecsSinceEpoch(msecs);
}
}
-
+#endif
void tst_QDateTime::toString()
{
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2011);
@@ -347,7 +322,7 @@ void tst_QDateTime::addDays()
}
Q_UNUSED(next);
}
-
+#if QT_CONFIG(timezone)
void tst_QDateTime::addDaysTz()
{
const auto list = norse(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -356,7 +331,7 @@ void tst_QDateTime::addDaysTz()
QDateTime result = test.addDays(1);
}
}
-
+#endif
void tst_QDateTime::addMSecs()
{
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -367,7 +342,7 @@ void tst_QDateTime::addMSecs()
}
Q_UNUSED(next);
}
-
+#if QT_CONFIG(timezone)
void tst_QDateTime::addMSecsTz()
{
const auto list = norse(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -376,7 +351,10 @@ void tst_QDateTime::addMSecsTz()
QDateTime result = test.addMSecs(1);
}
}
-
+#endif
+#if QT_DEPRECATED_SINCE(6, 9)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
void tst_QDateTime::toTimeSpec()
{
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
@@ -394,6 +372,8 @@ void tst_QDateTime::toOffsetFromUtc()
test.toOffsetFromUtc(3600);
}
}
+QT_WARNING_POP
+#endif
void tst_QDateTime::daysTo()
{
@@ -434,7 +414,7 @@ void tst_QDateTime::equivalentUtc()
{
bool result = false;
const QDateTime other = QDateTime::fromMSecsSinceEpoch(
- qint64(JULIAN_DAY_2010 - JULIAN_DAY_1970) * MSECS_PER_DAY, Qt::UTC);
+ qint64(JULIAN_DAY_2010 - JULIAN_DAY_1970) * MSECS_PER_DAY, QTimeZone::UTC);
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
QBENCHMARK {
for (const QDateTime &test : list)
@@ -460,7 +440,7 @@ void tst_QDateTime::lessThanUtc()
{
bool result = false;
const QDateTime other = QDateTime::fromMSecsSinceEpoch(
- qint64(JULIAN_DAY_2010 - JULIAN_DAY_1970) * MSECS_PER_DAY, Qt::UTC);
+ qint64(JULIAN_DAY_2010 - JULIAN_DAY_1970) * MSECS_PER_DAY, QTimeZone::UTC);
const auto list = daily(JULIAN_DAY_2010, JULIAN_DAY_2020);
QBENCHMARK {
for (const QDateTime &test : list)
@@ -544,7 +524,7 @@ void tst_QDateTime::fromMSecsSinceEpoch()
const int end = JULIAN_DAY_2020 - JULIAN_DAY_1970;
QBENCHMARK {
for (int jd = start; jd < end; ++jd)
- QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, Qt::LocalTime);
+ QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY);
}
}
@@ -554,10 +534,10 @@ void tst_QDateTime::fromMSecsSinceEpochUtc()
const int end = JULIAN_DAY_2020 - JULIAN_DAY_1970;
QBENCHMARK {
for (int jd = start; jd < end; ++jd)
- QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, Qt::UTC);
+ QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, QTimeZone::UTC);
}
}
-
+#if QT_CONFIG(timezone)
void tst_QDateTime::fromMSecsSinceEpochTz()
{
const int start = JULIAN_DAY_2010 - JULIAN_DAY_1970;
@@ -568,7 +548,8 @@ void tst_QDateTime::fromMSecsSinceEpochTz()
QDateTime test = QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, cet);
}
}
+#endif
QTEST_MAIN(tst_QDateTime)
-#include "main.moc"
+#include "tst_bench_qdatetime.moc"
diff --git a/tests/benchmarks/corelib/time/qtimezone/CMakeLists.txt b/tests/benchmarks/corelib/time/qtimezone/CMakeLists.txt
index c6487499af..f80b64be2d 100644
--- a/tests/benchmarks/corelib/time/qtimezone/CMakeLists.txt
+++ b/tests/benchmarks/corelib/time/qtimezone/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtimezone.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtimezone Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qtimezone
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qtimezone.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/time/qtimezone/main.cpp b/tests/benchmarks/corelib/time/qtimezone/tst_bench_qtimezone.cpp
index 509d62d3bb..db8b910d98 100644
--- a/tests/benchmarks/corelib/time/qtimezone/main.cpp
+++ b/tests/benchmarks/corelib/time/qtimezone/tst_bench_qtimezone.cpp
@@ -1,31 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2019 Crimson AS <info@crimson.no>
-** Copyright (C) 2018 Klaralvdalens 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: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) 2019 Crimson AS <info@crimson.no>
+// Copyright (C) 2018 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTimeZone>
#include <QTest>
@@ -39,6 +15,7 @@ class tst_QTimeZone : public QObject
Q_OBJECT
private Q_SLOTS:
+#if QT_CONFIG(timezone)
void isTimeZoneIdAvailable();
void systemTimeZone();
void zoneByName_data();
@@ -49,31 +26,35 @@ private Q_SLOTS:
void transitionsForward();
void transitionsReverse_data() { transitionList_data(); }
void transitionsReverse();
+#endif
};
static QList<QByteArray> enoughZones()
{
#ifdef EXHAUSTIVE
- auto available = QTimeZone::availableTimeZoneIds();
- QList<QByteArray> result;
- result.reserve(available.size() + 1);
- for (conat auto &name : available)
- result << name;
+ QList<QByteArray> result = QTimeZone::availableTimeZoneIds();
#else
- QList<QByteArray> result { QByteArray("UTC"),
- // Those named overtly in tst_QDateTime:
- QByteArray("Europe/Oslo"), QByteArray("America/Vancouver"),
- QByteArray("Europe/Berlin"), QByteArray("America/Sao_Paulo"),
- QByteArray("Pacific/Auckland"), QByteArray("Australia/Eucla"),
- QByteArray("Asia/Kathmandu"), QByteArray("Pacific/Kiritimati"),
- QByteArray("Pacific/Apia"), QByteArray("UTC+12:00"),
- QByteArray("Australia/Sydney"), QByteArray("Asia/Singapore"),
- QByteArray("Australia/Brisbane") };
+ QList<QByteArray> result {
+ QByteArray("UTC"),
+ // Those named overtly in tst_QDateTime - special cases first:
+ QByteArray("UTC-02:00"), QByteArray("UTC+02:00"), QByteArray("UTC+12:00"),
+ QByteArray("Etc/GMT+3"), QByteArray("GMT-2"), QByteArray("GMT"),
+ // ... then ordinary names in alphabetic order:
+ QByteArray("America/New_York"), QByteArray("America/Sao_Paulo"),
+ QByteArray("America/Vancouver"),
+ QByteArray("Asia/Kathmandu"), QByteArray("Asia/Singapore"),
+ QByteArray("Australia/Brisbane"), QByteArray("Australia/Eucla"),
+ QByteArray("Australia/Sydney"),
+ QByteArray("Europe/Berlin"), QByteArray("Europe/Helsinki"),
+ QByteArray("Europe/Rome"), QByteArray("Europe/Oslo"),
+ QByteArray("Pacific/Apia"), QByteArray("Pacific/Auckland"),
+ QByteArray("Pacific/Kiritimati")
+ };
#endif
result << QByteArray("Vulcan/ShiKahr"); // invalid: also worth testing
return result;
}
-
+#if QT_CONFIG(timezone)
void tst_QTimeZone::isTimeZoneIdAvailable()
{
const QList<QByteArray> available = QTimeZone::availableTimeZoneIds();
@@ -89,7 +70,6 @@ void tst_QTimeZone::systemTimeZone()
QTimeZone::systemTimeZone();
}
}
-
void tst_QTimeZone::zoneByName_data()
{
QTest::addColumn<QByteArray>("name");
@@ -126,9 +106,9 @@ void tst_QTimeZone::transitionList()
{
QFETCH(QByteArray, name);
const QTimeZone zone = name.isEmpty() ? QTimeZone::systemTimeZone() : QTimeZone(name);
- const QDateTime early = QDate(1625, 6, 8).startOfDay(Qt::UTC); // Cassini's birth date
+ const QDateTime early = QDate(1625, 6, 8).startOfDay(QTimeZone::UTC); // Cassini's birth date
const QDateTime late // End of 32-bit signed time_t
- = QDateTime::fromSecsSinceEpoch(std::numeric_limits<qint32>::max(), Qt::UTC);
+ = QDateTime::fromSecsSinceEpoch(std::numeric_limits<qint32>::max(), QTimeZone::UTC);
QTimeZone::OffsetDataList seq;
QBENCHMARK {
seq = zone.transitions(early, late);
@@ -140,7 +120,7 @@ void tst_QTimeZone::transitionsForward()
{
QFETCH(QByteArray, name);
const QTimeZone zone = name.isEmpty() ? QTimeZone::systemTimeZone() : QTimeZone(name);
- const QDateTime early = QDate(1625, 6, 8).startOfDay(Qt::UTC); // Cassini's birth date
+ const QDateTime early = QDate(1625, 6, 8).startOfDay(QTimeZone::UTC); // Cassini's birth date
QBENCHMARK {
QTimeZone::OffsetData tran = zone.nextTransition(early);
while (tran.atUtc.isValid())
@@ -153,14 +133,15 @@ void tst_QTimeZone::transitionsReverse()
QFETCH(QByteArray, name);
const QTimeZone zone = name.isEmpty() ? QTimeZone::systemTimeZone() : QTimeZone(name);
const QDateTime late // End of 32-bit signed time_t
- = QDateTime::fromSecsSinceEpoch(std::numeric_limits<qint32>::max(), Qt::UTC);
+ = QDateTime::fromSecsSinceEpoch(std::numeric_limits<qint32>::max(), QTimeZone::UTC);
QBENCHMARK {
QTimeZone::OffsetData tran = zone.previousTransition(late);
while (tran.atUtc.isValid())
tran = zone.previousTransition(tran.atUtc);
}
}
+#endif
QTEST_MAIN(tst_QTimeZone)
-#include "main.moc"
+#include "tst_bench_qtimezone.moc"
diff --git a/tests/benchmarks/corelib/tools/CMakeLists.txt b/tests/benchmarks/corelib/tools/CMakeLists.txt
index c1b5cad1aa..b46eac4165 100644
--- a/tests/benchmarks/corelib/tools/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/CMakeLists.txt
@@ -1,12 +1,16 @@
-# Generated from tools.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(containers-associative)
add_subdirectory(containers-sequential)
add_subdirectory(qcontiguouscache)
add_subdirectory(qcryptographichash)
+add_subdirectory(qhash)
add_subdirectory(qlist)
add_subdirectory(qmap)
add_subdirectory(qrect)
add_subdirectory(qringbuffer)
+add_subdirectory(qset)
+add_subdirectory(qsharedpointer)
add_subdirectory(qstack)
add_subdirectory(qvector)
diff --git a/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt b/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt
index 1e653fa98d..7036fa96b7 100644
--- a/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt
@@ -1,15 +1,13 @@
-# Generated from containers-associative.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## tst_bench_containers-associative Binary:
+## tst_bench_containers_associative Binary:
#####################################################################
-qt_internal_add_benchmark(tst_bench_containers-associative
+qt_internal_add_benchmark(tst_bench_containers_associative
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_containers_associative.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:containers-associative.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/tst_bench_containers_associative.cpp
index 555d4bf843..a5618cfcaf 100644
--- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-associative/tst_bench_containers_associative.cpp
@@ -1,31 +1,8 @@
-/****************************************************************************
-**
-** 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
#include <QString>
+#include <QMap>
+#include <QHash>
#include <qtest.h>
@@ -127,4 +104,5 @@ void tst_associative_containers::lookup()
}
QTEST_MAIN(tst_associative_containers)
-#include "main.moc"
+
+#include "tst_bench_containers_associative.moc"
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt b/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt
index f8ebc69c29..d24f26e664 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt
@@ -1,15 +1,13 @@
-# Generated from containers-sequential.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_containers-sequential Binary:
#####################################################################
-qt_internal_add_benchmark(tst_bench_containers-sequential
+qt_internal_add_benchmark(tst_bench_containers_sequential
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_containers_sequential.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:containers-sequential.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/tst_bench_containers_sequential.cpp
index 1bb1a02a24..78c8016664 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-sequential/tst_bench_containers_sequential.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
// This file contains benchmarks for comparing QList against std::vector
#include <QtCore>
@@ -90,7 +65,7 @@ class UseCases_stdvector : public UseCases<T>
void insert(int size) override
{
std::vector<T> v;
- T t;
+ T t = {};
QBENCHMARK {
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -101,7 +76,7 @@ class UseCases_stdvector : public UseCases<T>
{
std::vector<T> v;
- T t;
+ T t = {};
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -244,4 +219,5 @@ void tst_vector_vs_std::lookup_Large()
}
QTEST_MAIN(tst_vector_vs_std)
-#include "main.moc"
+
+#include "tst_bench_containers_sequential.moc"
diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt b/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt
index e683d60de2..9a68212fc0 100644
--- a/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qcontiguouscache.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qcontiguouscache Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qcontiguouscache
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qcontiguouscache.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp b/tests/benchmarks/corelib/tools/qcontiguouscache/tst_bench_qcontiguouscache.cpp
index 368c8b66bb..ae2cf471b0 100644
--- a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp
+++ b/tests/benchmarks/corelib/tools/qcontiguouscache/tst_bench_qcontiguouscache.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
#include <QObject>
#include <QTest>
@@ -46,8 +21,6 @@ private slots:
void contiguousCacheBenchmark();
};
-QTEST_MAIN(tst_QContiguousCache)
-
void tst_QContiguousCache::asScrollingList()
{
int i;
@@ -176,4 +149,6 @@ void tst_QContiguousCache::contiguousCacheBenchmark()
}
}
-#include "main.moc"
+QTEST_MAIN(tst_QContiguousCache)
+
+#include "tst_bench_qcontiguouscache.moc"
diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt b/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt
index 2ca8e683e1..b69b884f7d 100644
--- a/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qcryptographichash.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qcryptographichash Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qcryptographichash
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qcryptographichash.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
deleted file mode 100644
index 1f0a7373bb..0000000000
--- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-#include <QByteArray>
-#include <QCryptographicHash>
-#include <QFile>
-#include <QRandomGenerator>
-#include <QString>
-#include <QTest>
-
-#include <time.h>
-
-class tst_bench_QCryptographicHash : public QObject
-{
- Q_OBJECT
- QByteArray blockOfData;
-
-public:
- tst_bench_QCryptographicHash();
-
-private Q_SLOTS:
- void hash_data();
- void hash();
- void addData_data() { hash_data(); }
- void addData();
- void addDataChunked_data() { hash_data(); }
- void addDataChunked();
-};
-
-const int MaxCryptoAlgorithm = QCryptographicHash::Sha3_512;
-const int MaxBlockSize = 65536;
-
-const char *algoname(int i)
-{
- switch (QCryptographicHash::Algorithm(i)) {
- case QCryptographicHash::Md4:
- return "md4-";
- case QCryptographicHash::Md5:
- return "md5-";
- case QCryptographicHash::Sha1:
- return "sha1-";
- case QCryptographicHash::Sha224:
- return "sha2_224-";
- case QCryptographicHash::Sha256:
- return "sha2_256-";
- case QCryptographicHash::Sha384:
- return "sha2_384-";
- case QCryptographicHash::Sha512:
- return "sha2_512-";
- case QCryptographicHash::Sha3_224:
- return "sha3_224-";
- case QCryptographicHash::Sha3_256:
- return "sha3_256-";
- case QCryptographicHash::Sha3_384:
- return "sha3_384-";
- case QCryptographicHash::Sha3_512:
- return "sha3_512-";
- case QCryptographicHash::Keccak_224:
- return "keccak_224-";
- case QCryptographicHash::Keccak_256:
- return "keccak_256-";
- case QCryptographicHash::Keccak_384:
- return "keccak_384-";
- case QCryptographicHash::Keccak_512:
- return "keccak_512-";
- case QCryptographicHash::Blake2b_160:
- return "blake2b_160-";
- case QCryptographicHash::Blake2b_256:
- return "blake2b_256-";
- case QCryptographicHash::Blake2b_384:
- return "blake2b_384-";
- case QCryptographicHash::Blake2b_512:
- return "blake2b_512-";
- case QCryptographicHash::Blake2s_128:
- return "blake2s_128-";
- case QCryptographicHash::Blake2s_160:
- return "blake2s_160-";
- case QCryptographicHash::Blake2s_224:
- return "blake2s_224-";
- case QCryptographicHash::Blake2s_256:
- return "blake2s_256-";
- }
- Q_UNREACHABLE();
- return nullptr;
-}
-
-tst_bench_QCryptographicHash::tst_bench_QCryptographicHash()
- : blockOfData(MaxBlockSize, Qt::Uninitialized)
-{
-#ifdef Q_OS_UNIX
- QFile urandom("/dev/urandom");
- if (urandom.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
- QCOMPARE(urandom.read(blockOfData.data(), blockOfData.size()), qint64(MaxBlockSize));
- } else
-#endif
- {
- for (int i = 0; i < MaxBlockSize; ++i)
- blockOfData[i] = QRandomGenerator::global()->generate();
- }
-}
-
-void tst_bench_QCryptographicHash::hash_data()
-{
- QTest::addColumn<int>("algorithm");
- QTest::addColumn<QByteArray>("data");
-
- static const int datasizes[] = { 0, 1, 64, 65, 512, 4095, 4096, 4097, 65536 };
- for (uint i = 0; i < sizeof(datasizes)/sizeof(datasizes[0]); ++i) {
- Q_ASSERT(datasizes[i] < MaxBlockSize);
- QByteArray data = QByteArray::fromRawData(blockOfData.constData(), datasizes[i]);
-
- for (int algo = QCryptographicHash::Md4; algo <= MaxCryptoAlgorithm; ++algo)
- QTest::newRow(algoname(algo) + QByteArray::number(datasizes[i])) << algo << data;
- }
-}
-
-void tst_bench_QCryptographicHash::hash()
-{
- QFETCH(int, algorithm);
- QFETCH(QByteArray, data);
-
- QCryptographicHash::Algorithm algo = QCryptographicHash::Algorithm(algorithm);
- QBENCHMARK {
- QCryptographicHash::hash(data, algo);
- }
-}
-
-void tst_bench_QCryptographicHash::addData()
-{
- QFETCH(int, algorithm);
- QFETCH(QByteArray, data);
-
- QCryptographicHash::Algorithm algo = QCryptographicHash::Algorithm(algorithm);
- QCryptographicHash hash(algo);
- QBENCHMARK {
- hash.reset();
- hash.addData(data);
- hash.result();
- }
-}
-
-void tst_bench_QCryptographicHash::addDataChunked()
-{
- QFETCH(int, algorithm);
- QFETCH(QByteArray, data);
-
- QCryptographicHash::Algorithm algo = QCryptographicHash::Algorithm(algorithm);
- QCryptographicHash hash(algo);
- QBENCHMARK {
- hash.reset();
-
- // add the data in chunks of 64 bytes
- for (int i = 0; i < data.size() / 64; ++i)
- hash.addData(data.constData() + 64 * i, 64);
- hash.addData(data.constData() + data.size() / 64 * 64, data.size() % 64);
-
- hash.result();
- }
-}
-
-QTEST_APPLESS_MAIN(tst_bench_QCryptographicHash)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp
new file mode 100644
index 0000000000..9f2d1c57f2
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp
@@ -0,0 +1,223 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// Copyright (C) 2017 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QByteArray>
+#include <QCryptographicHash>
+#include <QFile>
+#include <QMetaEnum>
+#include <QMessageAuthenticationCode>
+#include <QRandomGenerator>
+#include <QString>
+#include <QTest>
+
+#include <qxpfunctional.h>
+#include <numeric>
+
+#include <time.h>
+
+class tst_QCryptographicHash : public QObject
+{
+ Q_OBJECT
+ QByteArray blockOfData;
+
+ using Algorithm = QCryptographicHash::Algorithm;
+
+public:
+ tst_QCryptographicHash();
+
+private Q_SLOTS:
+ void hash_data();
+ void hash();
+ void addData_data() { hash_data(); }
+ void addData();
+ void addDataChunked_data() { hash_data(); }
+ void addDataChunked();
+
+ // QMessageAuthenticationCode:
+ void hmac_hash_data() { hash_data(); }
+ void hmac_hash();
+ void hmac_addData_data() { hash_data(); }
+ void hmac_addData();
+ void hmac_setKey_data();
+ void hmac_setKey();
+};
+
+const int MaxBlockSize = 65536;
+
+static void for_each_algorithm(qxp::function_ref<void(QCryptographicHash::Algorithm, const char*) const> f)
+{
+ using A = QCryptographicHash::Algorithm;
+ static const auto metaEnum = QMetaEnum::fromType<A>();
+ for (int i = 0, value = metaEnum.value(i); value != -1; value = metaEnum.value(++i))
+ f(A(value), metaEnum.key(i));
+}
+
+tst_QCryptographicHash::tst_QCryptographicHash()
+ : blockOfData(MaxBlockSize, Qt::Uninitialized)
+{
+#ifdef Q_OS_UNIX
+ QFile urandom("/dev/urandom");
+ if (urandom.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
+ QCOMPARE(urandom.read(blockOfData.data(), blockOfData.size()), qint64(MaxBlockSize));
+ } else
+#endif
+ {
+ for (int i = 0; i < MaxBlockSize; ++i)
+ blockOfData[i] = QRandomGenerator::global()->generate();
+ }
+}
+
+void tst_QCryptographicHash::hash_data()
+{
+ QTest::addColumn<Algorithm>("algo");
+ QTest::addColumn<QByteArray>("data");
+
+ static const int datasizes[] = { 0, 1, 64, 65, 512, 4095, 4096, 4097, 65536 };
+ for (uint i = 0; i < sizeof(datasizes)/sizeof(datasizes[0]); ++i) {
+ Q_ASSERT(datasizes[i] < MaxBlockSize);
+ QByteArray data = QByteArray::fromRawData(blockOfData.constData(), datasizes[i]);
+
+ for_each_algorithm([&] (Algorithm algo, const char *name) {
+ if (algo == Algorithm::NumAlgorithms)
+ return;
+ QTest::addRow("%s-%d", name, datasizes[i]) << algo << data;
+ });
+ }
+}
+
+#define SKIP_IF_NOT_SUPPORTED(algo) do { \
+ if (!QCryptographicHash::supportsAlgorithm(algo)) \
+ QSKIP("This algorithm is not supported in this configuration"); \
+ } while (false) \
+ /* end */
+
+void tst_QCryptographicHash::hash()
+{
+ QFETCH(const Algorithm, algo);
+ QFETCH(QByteArray, data);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ QBENCHMARK {
+ [[maybe_unused]]
+ auto r = QCryptographicHash::hash(data, algo);
+ }
+}
+
+void tst_QCryptographicHash::addData()
+{
+ QFETCH(const Algorithm, algo);
+ QFETCH(QByteArray, data);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ QCryptographicHash hash(algo);
+ QBENCHMARK {
+ hash.reset();
+ hash.addData(data);
+ [[maybe_unused]]
+ auto r = hash.resultView();
+ }
+}
+
+void tst_QCryptographicHash::addDataChunked()
+{
+ QFETCH(const Algorithm, algo);
+ QFETCH(QByteArray, data);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ QCryptographicHash hash(algo);
+ QBENCHMARK {
+ hash.reset();
+
+ // add the data in chunks of 64 bytes
+ for (int i = 0; i < data.size() / 64; ++i)
+ hash.addData({data.constData() + 64 * i, 64});
+ hash.addData({data.constData() + data.size() / 64 * 64, data.size() % 64});
+
+ [[maybe_unused]]
+ auto r = hash.resultView();
+ }
+}
+
+static QByteArray hmacKey() {
+ static QByteArray key = [] {
+ QByteArray result(277, Qt::Uninitialized);
+ std::iota(result.begin(), result.end(), uchar(0)); // uchar so wraps after UCHAR_MAX
+ return result;
+ }();
+ return key;
+}
+
+void tst_QCryptographicHash::hmac_hash()
+{
+ QFETCH(const Algorithm, algo);
+ QFETCH(const QByteArray, data);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ const auto key = hmacKey();
+ QBENCHMARK {
+ [[maybe_unused]]
+ auto r = QMessageAuthenticationCode::hash(data, key, algo);
+ }
+}
+
+void tst_QCryptographicHash::hmac_addData()
+{
+ QFETCH(const Algorithm, algo);
+ QFETCH(const QByteArray, data);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ const auto key = hmacKey();
+ QMessageAuthenticationCode mac(algo, key);
+ QBENCHMARK {
+ mac.reset();
+ mac.addData(data);
+ [[maybe_unused]]
+ auto r = mac.resultView();
+ }
+}
+
+void tst_QCryptographicHash::hmac_setKey_data()
+{
+ QTest::addColumn<Algorithm>("algo");
+ for_each_algorithm([] (Algorithm algo, const char *name) {
+ if (algo == Algorithm::NumAlgorithms)
+ return;
+ QTest::addRow("%s", name) << algo;
+ });
+}
+
+void tst_QCryptographicHash::hmac_setKey()
+{
+ QFETCH(const Algorithm, algo);
+
+ SKIP_IF_NOT_SUPPORTED(algo);
+
+ const QByteArrayList keys = [] {
+ QByteArrayList result;
+ const auto fullKey = hmacKey();
+ result.reserve(fullKey.size());
+ for (auto i = fullKey.size(); i > 0; --i)
+ result.push_back(fullKey.sliced(i));
+ return result;
+ }();
+
+ QMessageAuthenticationCode mac(algo);
+ QBENCHMARK {
+ for (const auto &key : keys) {
+ mac.setKey(key);
+ mac.addData("abc", 3); // avoid lazy setKey()
+ }
+ }
+}
+
+#undef SKIP_IF_NOT_SUPPORTED
+
+QTEST_APPLESS_MAIN(tst_QCryptographicHash)
+
+#include "tst_bench_qcryptographichash.moc"
diff --git a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
index 5286484b0c..9002cc0723 100644
--- a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt
@@ -1,15 +1,18 @@
-# Generated from qhash.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## tst_hash Binary:
+## tst_bench_qhash Binary:
#####################################################################
-qt_internal_add_benchmark(tst_hash
+qt_internal_add_benchmark(tst_bench_qhash
SOURCES
- main.cpp
+ tst_bench_qhash.cpp
outofline.cpp
+ NO_PCH_SOURCES
+ tst_bench_qhash.cpp # undef QT_NO_FOREACH
INCLUDE_DIRECTORIES
.
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qhash/main.h b/tests/benchmarks/corelib/tools/qhash/main.h
deleted file mode 100644
index eca4b61d58..0000000000
--- a/tests/benchmarks/corelib/tools/qhash/main.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtTest 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$
-**
-****************************************************************************/
-
-#include <QString>
-
-struct Qt4String : QString
-{
- Qt4String() {}
- Qt4String(const QString &s) : QString(s) {}
-};
-
-QT_BEGIN_NAMESPACE
-uint qHash(const Qt4String &);
-QT_END_NAMESPACE
-
-struct Qt50String : QString
-{
- Qt50String() {}
- Qt50String(const QString &s) : QString(s) {}
-};
-
-QT_BEGIN_NAMESPACE
-uint qHash(const Qt50String &, uint seed = 0);
-QT_END_NAMESPACE
-
-
-struct JavaString : QString
-{
- JavaString() {}
- JavaString(const QString &s) : QString(s) {}
-};
-
-QT_BEGIN_NAMESPACE
-uint qHash(const JavaString &);
-QT_END_NAMESPACE
-
diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
index 4e449e76b4..5b16c36ffb 100644
--- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
@@ -1,38 +1,13 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtTest 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
-#include "main.h"
+#include "tst_bench_qhash.h"
QT_BEGIN_NAMESPACE
-uint qHash(const Qt4String &str)
+size_t qHash(const Qt4String &str, size_t /* never used */)
{
- int n = str.length();
+ qsizetype n = str.size();
const QChar *p = str.unicode();
uint h = 0;
@@ -44,11 +19,11 @@ uint qHash(const Qt4String &str)
return h;
}
-uint qHash(const Qt50String &key, uint seed)
+size_t qHash(const Qt50String &key, size_t seed)
{
const QChar *p = key.unicode();
- int len = key.size();
- uint h = seed;
+ qsizetype len = key.size();
+ size_t h = seed;
for (int i = 0; i < len; ++i)
h = 31 * h + p[i].unicode();
return h;
@@ -65,10 +40,10 @@ uint qHash(const Qt50String &key, uint seed)
// Still, we can avoid writing the multiplication as "(h << 5) - h"
// -- the compiler will turn it into a shift and an addition anyway
// (for instance, gcc 4.4 does that even at -O0).
-uint qHash(const JavaString &str)
+size_t qHash(const JavaString &str, size_t /* never used */)
{
- const unsigned short *p = (unsigned short *)str.constData();
- const int len = str.size();
+ const auto *p = reinterpret_cast<const char16_t *>(str.constData());
+ const qsizetype len = str.size();
uint h = 0;
diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp
index f9b1624fcc..1a62a48437 100644
--- a/tests/benchmarks/corelib/tools/qhash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp
@@ -1,33 +1,10 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "main.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2016 Intel Corporation.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
+#include "tst_bench_qhash.h"
#include <QFile>
#include <QHash>
@@ -36,6 +13,8 @@
#include <QUuid>
#include <QTest>
+static constexpr quint64 RandomSeed32 = 1045982819;
+static constexpr quint64 RandomSeed64 = QtPrivate::QHashCombine{}(RandomSeed32, RandomSeed32);
class tst_QHash : public QObject
{
@@ -54,6 +33,8 @@ private slots:
void hashing_current_data() { data(); }
void hashing_current() { hashing_template<QString>(); }
+ void hashing_qbytearray_data() { data(); }
+ void hashing_qbytearray() { hashing_template<QByteArray>(); }
void hashing_qt50_data() { data(); }
void hashing_qt50() { hashing_template<Qt50String>(); }
void hashing_qt4_data() { data(); }
@@ -61,15 +42,25 @@ private slots:
void hashing_javaString_data() { data(); }
void hashing_javaString() { hashing_template<JavaString>(); }
+ void hashing_nonzero_current_data() { data(); }
+ void hashing_nonzero_current() { hashing_nonzero_template<QString>(); }
+ void hashing_nonzero_qbytearray_data() { data(); }
+ void hashing_nonzero_qbytearray() { hashing_nonzero_template<QByteArray>(); }
+ void hashing_nonzero_qlatin1string_data() { data(); }
+ void hashing_nonzero_qlatin1string() { hashing_nonzero_template<OwningLatin1String>(); }
+
private:
void data();
template <typename String> void qhash_template();
- template <typename String> void hashing_template();
+ template <typename String, size_t Seed = 0> void hashing_template();
+ template <typename String> void hashing_nonzero_template()
+ { hashing_template<String, size_t(RandomSeed64)>(); }
QStringList smallFilePaths;
QStringList uuids;
QStringList dict;
QStringList numbers;
+ QStringList longstrings;
};
///////////////////// QHash /////////////////////
@@ -78,7 +69,10 @@ private:
void tst_QHash::initTestCase()
{
- // small list of file paths
+ QHashSeed::setDeterministicGlobalSeed();
+
+ // small list of strings (that happen to look like file paths produced long
+ // ago by cd ../.. && find . -print, but that's irrelevant).
QFile smallPathsData(QFINDTESTDATA("paths_small_data.txt"));
QVERIFY(smallPathsData.open(QIODevice::ReadOnly));
smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n'));
@@ -88,15 +82,17 @@ void tst_QHash::initTestCase()
// guaranteed to be completely random, generated by http://xkcd.com/221/
QUuid ns = QUuid("{f43d2ef3-2fe9-4563-a6f5-5a0100c2d699}");
uuids.reserve(smallFilePaths.size());
+ longstrings.reserve(smallFilePaths.size());
foreach (const QString &path, smallFilePaths)
uuids.append(QUuid::createUuidV5(ns, path).toString());
-
+ for (qsizetype i = 0; i < uuids.size(); ++i)
+ longstrings.append(uuids.at(i).repeated(8));
// lots of strings with alphabetical characters, vaguely reminiscent of
// a dictionary.
//
- // this programatically generates a series like:
+ // this programmatically generates a series like:
// AAAAAA
// AAAAAB
// AAAAAC
@@ -109,7 +105,7 @@ void tst_QHash::initTestCase()
QByteArray id("AAAAAAA");
if (dict.isEmpty()) {
- for (int i = id.length() - 1; i > 0;) {
+ for (int i = id.size() - 1; i > 0;) {
dict.append(id);
char c = id.at(i);
id[i] = ++c;
@@ -132,6 +128,7 @@ void tst_QHash::data()
QTest::addColumn<QStringList>("items");
QTest::newRow("paths-small") << smallFilePaths;
QTest::newRow("uuids-list") << uuids;
+ QTest::newRow("longstrings-list") << longstrings;
QTest::newRow("dictionary") << dict;
QTest::newRow("numbers") << numbers;
}
@@ -152,22 +149,33 @@ template <typename String> void tst_QHash::qhash_template()
}
}
-template <typename String> void tst_QHash::hashing_template()
+template <typename String, size_t Seed> void tst_QHash::hashing_template()
{
// just the hashing function
QFETCH(QStringList, items);
QList<String> realitems;
realitems.reserve(items.size());
- foreach (const QString &s, items)
- realitems.append(s);
+ foreach (const QString &s, items) {
+ if constexpr (std::is_same_v<QString::value_type, typename String::value_type>) {
+ realitems.append(s);
+ } else if constexpr (sizeof(typename String::value_type) == 1) {
+ realitems.append(String(s.toLatin1()));
+ }
+ }
QBENCHMARK {
- for (int i = 0, n = realitems.size(); i != n; ++i)
- (void)qHash(realitems.at(i));
+ for (int i = 0, n = realitems.size(); i != n; ++i) {
+ volatile size_t h = qHash(realitems.at(i), Seed);
+ (void)h;
+#ifdef Q_CC_GNU
+ // "use" h
+ asm ("" : "+r" (h));
+#endif
+ }
}
}
QTEST_MAIN(tst_QHash)
-#include "main.moc"
+#include "tst_bench_qhash.moc"
diff --git a/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h
new file mode 100644
index 0000000000..501b4a8b7f
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QHashFunctions>
+#include <QString>
+
+struct OwningLatin1String : QByteArray
+{
+ OwningLatin1String() = default;
+ OwningLatin1String(const QByteArray &a) : QByteArray(a) {}
+ OwningLatin1String(QByteArray &&a) : QByteArray(std::move(a)) {}
+};
+QT_BEGIN_NAMESPACE
+inline size_t qHash(const OwningLatin1String &s, size_t seed = 0)
+{ return qHash(QLatin1StringView(s), seed); }
+QT_END_NAMESPACE
+
+struct Qt4String : QString
+{
+ Qt4String() {}
+ Qt4String(const QString &s) : QString(s) {}
+};
+
+QT_BEGIN_NAMESPACE
+size_t qHash(const Qt4String &, size_t = 0);
+QT_END_NAMESPACE
+
+struct Qt50String : QString
+{
+ Qt50String() {}
+ Qt50String(const QString &s) : QString(s) {}
+};
+
+QT_BEGIN_NAMESPACE
+size_t qHash(const Qt50String &, size_t seed = 0);
+QT_END_NAMESPACE
+
+
+struct JavaString : QString
+{
+ JavaString() {}
+ JavaString(const QString &s) : QString(s) {}
+};
+
+QT_BEGIN_NAMESPACE
+size_t qHash(const JavaString &, size_t = 0);
+QT_END_NAMESPACE
+
diff --git a/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt b/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt
index 46ca1c8514..dabfe08122 100644
--- a/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qlist.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qlist Binary:
@@ -6,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qlist
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qlist.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qlist/main.cpp b/tests/benchmarks/corelib/tools/qlist/tst_bench_qlist.cpp
index 47e7d8a4a6..24691d1f71 100644
--- a/tests/benchmarks/corelib/tools/qlist/main.cpp
+++ b/tests/benchmarks/corelib/tools/qlist/tst_bench_qlist.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QList>
#include <QTest>
@@ -35,86 +10,42 @@ static const int N = 1000;
struct MyBase
{
- MyBase(int i_)
- : isCopy(false)
- {
- ++liveCount;
-
- i = i_;
- }
+ MyBase(int i_) : i(i_) { }
- MyBase(const MyBase &other)
- : isCopy(true)
- {
- if (isCopy)
- ++copyCount;
- ++liveCount;
-
- i = other.i;
- }
+ MyBase(const MyBase &other) : i(other.i) { }
MyBase &operator=(const MyBase &other)
{
- if (!isCopy) {
- isCopy = true;
- ++copyCount;
- } else {
- ++errorCount;
- }
-
i = other.i;
return *this;
}
- ~MyBase()
- {
- if (isCopy) {
- if (!copyCount)
- ++errorCount;
- else
- --copyCount;
- }
- if (!liveCount)
- ++errorCount;
- else
- --liveCount;
- }
-
bool operator==(const MyBase &other) const
{ return i == other.i; }
protected:
- ushort i;
- bool isCopy;
-
-public:
- static int errorCount;
- static int liveCount;
- static int copyCount;
+ int i;
};
-int MyBase::errorCount = 0;
-int MyBase::liveCount = 0;
-int MyBase::copyCount = 0;
-
struct MyPrimitive : public MyBase
{
- MyPrimitive(int i = -1) : MyBase(i)
- { ++errorCount; }
- MyPrimitive(const MyPrimitive &other) : MyBase(other)
- { ++errorCount; }
- ~MyPrimitive()
- { ++errorCount; }
+ MyPrimitive(int i_ = -1) : MyBase(i_) { }
+ MyPrimitive(const MyPrimitive &other) : MyBase(other) { }
+ MyPrimitive &operator=(const MyPrimitive &other)
+ {
+ MyBase::operator=(other);
+ return *this;
+ }
};
struct MyMovable : public MyBase
{
- MyMovable(int i = -1) : MyBase(i) {}
+ MyMovable(int i_ = -1) : MyBase(i_) {}
};
struct MyComplex : public MyBase
{
- MyComplex(int i = -1) : MyBase(i) {}
+ MyComplex(int i_ = -1) : MyBase(i_) {}
};
QT_BEGIN_NAMESPACE
@@ -130,13 +61,14 @@ class tst_QList: public QObject
{
Q_OBJECT
+ const int million = 1000000;
private Q_SLOTS:
void removeAll_primitive_data();
- void removeAll_primitive();
- void removeAll_movable_data();
- void removeAll_movable();
- void removeAll_complex_data();
- void removeAll_complex();
+ void removeAll_primitive() { removeAll_impl<MyPrimitive>(); }
+ void removeAll_movable_data() { removeAll_primitive_data(); }
+ void removeAll_movable() { removeAll_impl<MyMovable>(); }
+ void removeAll_complex_data() { removeAll_primitive_data(); }
+ void removeAll_complex() { removeAll_impl<MyComplex>(); }
// append 1 element:
void appendOne_int_data() const { commonBenchmark_data<int>(); }
@@ -164,12 +96,12 @@ private Q_SLOTS:
void prependOne_complex() const { prependOne_impl<QList, MyComplex>(); }
void prependOne_QString() const { prependOne_impl<QList, QString>(); }
- // insert in middle 1 element:
- void midInsertOne_int_data() const { commonBenchmark_data<int>(); }
- void midInsertOne_primitive_data() const { commonBenchmark_data<MyPrimitive>(); }
- void midInsertOne_movable_data() const { commonBenchmark_data<MyMovable>(); }
- void midInsertOne_complex_data() const { commonBenchmark_data<MyComplex>(); }
- void midInsertOne_QString_data() const { commonBenchmark_data<QString>(); }
+ // insert in middle 1 element (quadratic, slow):
+ void midInsertOne_int_data() const { commonBenchmark_data<int>(million); }
+ void midInsertOne_primitive_data() const { commonBenchmark_data<MyPrimitive>(million); }
+ void midInsertOne_movable_data() const { commonBenchmark_data<MyMovable>(million); }
+ void midInsertOne_complex_data() const { commonBenchmark_data<MyComplex>(million / 10); }
+ void midInsertOne_QString_data() const { commonBenchmark_data<QString>(million / 10); }
void midInsertOne_int() const { midInsertOne_impl<QList, int>(); }
void midInsertOne_primitive() const { midInsertOne_impl<QList, MyPrimitive>(); }
@@ -206,12 +138,12 @@ private Q_SLOTS:
void prependAppendHalvesOne_complex() const { prependAppendHalvesOne_impl<QList, MyComplex>(); }
void prependAppendHalvesOne_QString() const { prependAppendHalvesOne_impl<QList, QString>(); }
- // emplace in middle 1 element:
- void midEmplaceOne_int_data() const { commonBenchmark_data<int>(); }
- void midEmplaceOne_primitive_data() const { commonBenchmark_data<MyPrimitive>(); }
- void midEmplaceOne_movable_data() const { commonBenchmark_data<MyMovable>(); }
- void midEmplaceOne_complex_data() const { commonBenchmark_data<MyComplex>(); }
- void midEmplaceOne_QString_data() const { commonBenchmark_data<QString>(); }
+ // emplace in middle 1 element (quadratic, slow):
+ void midEmplaceOne_int_data() const { commonBenchmark_data<int>(million); }
+ void midEmplaceOne_primitive_data() const { commonBenchmark_data<MyPrimitive>(million); }
+ void midEmplaceOne_movable_data() const { commonBenchmark_data<MyMovable>(million); }
+ void midEmplaceOne_complex_data() const { commonBenchmark_data<MyComplex>(million / 10); }
+ void midEmplaceOne_QString_data() const { commonBenchmark_data<QString>(million / 10); }
void midEmplaceOne_int() const { midEmplaceOne_impl<QList, int>(); }
void midEmplaceOne_primitive() const { midEmplaceOne_impl<QList, MyPrimitive>(); }
@@ -246,8 +178,11 @@ private Q_SLOTS:
void removeFirstSpecial_QString() const { removeFirstSpecial_impl<QList, QString>(); }
private:
+ template <class T>
+ void removeAll_impl() const;
+
template<typename>
- void commonBenchmark_data() const;
+ void commonBenchmark_data(int max = 200000000) const;
template<template<typename> typename, typename>
void appendOne_impl() const;
@@ -275,101 +210,48 @@ private:
};
template <class T>
-void removeAll_test(const QList<int> &i10, ushort valueToRemove, int itemsToRemove)
+void tst_QList::removeAll_impl() const
{
- bool isComplex = QTypeInfo<T>::isComplex;
-
- MyBase::errorCount = 0;
- MyBase::liveCount = 0;
- MyBase::copyCount = 0;
- {
- QList<T> list;
- QCOMPARE(MyBase::liveCount, 0);
- QCOMPARE(MyBase::copyCount, 0);
+ QFETCH(QList<int>, i10);
+ QFETCH(int, itemsToRemove);
- for (int i = 0; i < 10 * N; ++i) {
- T t(i10.at(i % 10));
- list.append(t);
- }
- QCOMPARE(MyBase::liveCount, isComplex ? list.size() : 0);
- QCOMPARE(MyBase::copyCount, isComplex ? list.size() : 0);
+ constexpr int valueToRemove = 5;
- T t(valueToRemove);
- QCOMPARE(MyBase::liveCount, isComplex ? list.size() + 1 : 1);
- QCOMPARE(MyBase::copyCount, isComplex ? list.size() : 0);
+ QList<T> list;
+ for (int i = 0; i < 10 * N; ++i) {
+ T t(i10.at(i % 10));
+ list.append(t);
+ }
- int removedCount = 0; // make compiler happy by setting to 0
- QList<T> l;
+ T t(valueToRemove);
- QBENCHMARK {
- l = list;
- removedCount = l.removeAll(t);
- }
- QCOMPARE(removedCount, itemsToRemove * N);
- QCOMPARE(l.size() + removedCount, list.size());
- QVERIFY(!l.contains(valueToRemove));
+ qsizetype removedCount = 0; // make compiler happy by setting to 0
+ QList<T> l;
- QCOMPARE(MyBase::liveCount, isComplex ? l.isDetached() ? list.size() + l.size() + 1 : list.size() + 1 : 1);
- QCOMPARE(MyBase::copyCount, isComplex ? l.isDetached() ? list.size() + l.size() : list.size() : 0);
+ QBENCHMARK {
+ l = list;
+ removedCount = l.removeAll(t);
}
- if (isComplex)
- QCOMPARE(MyBase::errorCount, 0);
+ QCOMPARE(removedCount, itemsToRemove * N);
+ QCOMPARE(l.size() + removedCount, list.size());
+ QVERIFY(!l.contains(valueToRemove));
}
-
void tst_QList::removeAll_primitive_data()
{
qRegisterMetaType<QList<int> >();
QTest::addColumn<QList<int> >("i10");
- QTest::addColumn<int>("valueToRemove");
QTest::addColumn<int>("itemsToRemove");
- QTest::newRow("0%") << (QList<int>() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0) << 5 << 0;
- QTest::newRow("10%") << (QList<int>() << 0 << 0 << 0 << 0 << 5 << 0 << 0 << 0 << 0 << 0) << 5 << 1;
- QTest::newRow("90%") << (QList<int>() << 5 << 5 << 5 << 5 << 0 << 5 << 5 << 5 << 5 << 5) << 5 << 9;
- QTest::newRow("100%") << (QList<int>() << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5 << 5) << 5 << 10;
-}
-
-void tst_QList::removeAll_primitive()
-{
- QFETCH(QList<int>, i10);
- QFETCH(int, valueToRemove);
- QFETCH(int, itemsToRemove);
-
- removeAll_test<MyPrimitive>(i10, valueToRemove, itemsToRemove);
-}
-
-void tst_QList::removeAll_movable_data()
-{
- removeAll_primitive_data();
-}
-
-void tst_QList::removeAll_movable()
-{
- QFETCH(QList<int>, i10);
- QFETCH(int, valueToRemove);
- QFETCH(int, itemsToRemove);
-
- removeAll_test<MyMovable>(i10, valueToRemove, itemsToRemove);
-}
-
-void tst_QList::removeAll_complex_data()
-{
- removeAll_primitive_data();
-}
-
-void tst_QList::removeAll_complex()
-{
- QFETCH(QList<int>, i10);
- QFETCH(int, valueToRemove);
- QFETCH(int, itemsToRemove);
-
- removeAll_test<MyComplex>(i10, valueToRemove, itemsToRemove);
+ QTest::newRow("0%") << QList<int>(10, 0) << 0;
+ QTest::newRow("10%") << (QList<int>() << 0 << 0 << 0 << 0 << 5 << 0 << 0 << 0 << 0 << 0) << 1;
+ QTest::newRow("90%") << (QList<int>() << 5 << 5 << 5 << 5 << 0 << 5 << 5 << 5 << 5 << 5) << 9;
+ QTest::newRow("100%") << QList<int>(10, 5) << 10;
}
template<typename T>
-void tst_QList::commonBenchmark_data() const
+void tst_QList::commonBenchmark_data(int max) const
{
QTest::addColumn<int>("elemCount");
@@ -380,7 +262,8 @@ void tst_QList::commonBenchmark_data() const
// cap at 20m elements to allow 5.15/6.0 coverage to be the same
for (auto pair : { p(100, "100"), p(1000, "1k"), p(10000, "10k"), p(100000, "100k"),
p(1000000, "1m"), p(10000000, "10m"), p(20000000, "20m") }) {
- addRow(pair.first, pair.second);
+ if (pair.first <= max)
+ addRow(pair.first, pair.second);
}
}
@@ -524,4 +407,4 @@ void tst_QList::removeFirstSpecial_impl() const
QTEST_APPLESS_MAIN(tst_QList)
-#include "main.moc"
+#include "tst_bench_qlist.moc"
diff --git a/tests/benchmarks/corelib/tools/qmap/CMakeLists.txt b/tests/benchmarks/corelib/tools/qmap/CMakeLists.txt
index 5937eda37c..4dc3dbb258 100644
--- a/tests/benchmarks/corelib/tools/qmap/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qmap/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmap.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmap Binary:
@@ -6,9 +7,9 @@
qt_internal_add_benchmark(tst_bench_qmap
SOURCES
- main.cpp
+ tst_bench_qmap.cpp
INCLUDE_DIRECTORIES
.
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qmap/main.cpp b/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.cpp
index 50cc853df6..db3c4fc7a2 100644
--- a/tests/benchmarks/corelib/tools/qmap/main.cpp
+++ b/tests/benchmarks/corelib/tools/qmap/tst_bench_qmap.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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QFile>
#include <QMap>
@@ -61,16 +36,41 @@ private slots:
void insertion_string_int2_hint();
void insertMap();
+
+private:
+ QStringList helloEachWorld(int count);
};
+QStringList tst_QMap::helloEachWorld(int count)
+{
+ QStringList result;
+ result.reserve(count);
+ result << QStringLiteral("Hello World"); // at index 0, not used
+
+ char16_t name[] = u"Hello World";
+ QStringView str(name);
+ for (int i = 1; i < count; ++i) {
+ auto p = name + 6; // In the gap between words.
+ for (const auto ch : QChar::fromUcs4(i))
+ p++[0] = ch;
+ result << str.toString();
+ }
+ return result;
+}
+
+constexpr int huge = 100000; // one hundred thousand; simple integral data tests
+// Sum of i with 0 <= i < huge; overflows, but that's OK as long as it's unsigned:
+constexpr uint hugeSum = (uint(huge) / 2) * uint(huge - 1);
+constexpr int bigish = 5000; // five thousand; tests using XString's expensive <
void tst_QMap::insertion_int_int()
{
QMap<int, int> map;
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_intx()
@@ -79,36 +79,40 @@ void tst_QMap::insertion_int_intx()
// The results in the beginning of the test seems to be a somewhat inaccurate.
QMap<int, int> map;
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_int_with_hint1()
{
QMap<int, int> map;
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(map.constEnd(), i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_int_int2()
{
QMap<int, int> map;
QBENCHMARK {
- for (int i = 100000; i >= 0; --i)
+ for (int i = huge; i >= 0; --i)
map.insert(i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge) + 1);
}
void tst_QMap::insertion_int_int_with_hint2()
{
QMap<int, int> map;
QBENCHMARK {
- for (int i = 100000; i >= 0; --i)
+ for (int i = huge; i >= 0; --i)
map.insert(map.constBegin(), i, i);
}
+ QCOMPARE(map.size(), qsizetype(huge) + 1);
}
void tst_QMap::insertion_int_string()
@@ -116,93 +120,100 @@ void tst_QMap::insertion_int_string()
QMap<int, QString> map;
QString str("Hello World");
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, str);
}
+ QCOMPARE(map.size(), qsizetype(huge));
}
void tst_QMap::insertion_string_int()
{
QMap<QString, int> map;
- QString str("Hello World");
+ const QStringList names = helloEachWorld(huge);
+ QCOMPARE(names.size(), qsizetype(huge));
QBENCHMARK {
- for (int i = 1; i < 100000; ++i) {
- str[0] = QChar(i);
- map.insert(str, i);
- }
+ for (int i = 1; i < huge; ++i)
+ map.insert(names.at(i), i);
}
+ QCOMPARE(map.size() + 1, qsizetype(huge));
}
-
void tst_QMap::lookup_int_int()
{
QMap<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
- int sum = 0;
+ uint sum = 0, count = 0;
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
sum += map.value(i);
+ ++count;
}
+ QCOMPARE(sum, hugeSum * count);
}
void tst_QMap::lookup_int_string()
{
QMap<int, QString> map;
QString str("Hello World");
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, str);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
- for (int i = 0; i < 100000; ++i)
- str += map.value(i);
+ for (int i = 0; i < huge; ++i)
+ str = map.value(i);
}
}
void tst_QMap::lookup_string_int()
{
QMap<QString, int> map;
- QString str("Hello World");
- for (int i = 1; i < 100000; ++i) {
- str[0] = QChar(i);
- map.insert(str, i);
- }
+ const QStringList names = helloEachWorld(huge);
+ for (int i = 1; i < huge; ++i)
+ map.insert(names.at(i), i);
+ QCOMPARE(map.size() + 1, qsizetype(huge));
- int sum = 0;
+ uint sum = 0, count = 0;
QBENCHMARK {
- for (int i = 1; i < 100000; ++i) {
- str[0] = QChar(i);
- sum += map.value(str);
- }
+ for (int i = 1; i < huge; ++i)
+ sum += map.value(names.at(i));
+ ++count;
}
+ QCOMPARE(sum, hugeSum * count);
}
// iteration speed doesn't depend on the type of the map.
void tst_QMap::iteration()
{
QMap<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
- int j = 0;
+ uint sum = 0, count = 0;
QBENCHMARK {
for (int i = 0; i < 100; ++i) {
QMap<int, int>::const_iterator it = map.constBegin();
QMap<int, int>::const_iterator end = map.constEnd();
while (it != end) {
- j += *it;
+ sum += *it;
++it;
}
}
+ ++count;
}
+ QCOMPARE(sum, hugeSum * 100u * count);
}
void tst_QMap::toStdMap()
{
QMap<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
std::map<int, int> n = map.toStdMap();
@@ -213,11 +224,12 @@ void tst_QMap::toStdMap()
void tst_QMap::iterator_begin()
{
QMap<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i, i);
+ QCOMPARE(map.size(), qsizetype(huge));
QBENCHMARK {
- for (int i = 0; i < 100000; ++i) {
+ for (int i = 0; i < huge; ++i) {
QMap<int, int>::const_iterator it = map.constBegin();
QMap<int, int>::const_iterator end = map.constEnd();
if (it == end) // same as if (false)
@@ -229,8 +241,9 @@ void tst_QMap::iterator_begin()
void tst_QMap::ctorStdMap()
{
std::map<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(std::pair<int, int>(i, i));
+ QCOMPARE(map.size(), size_t(huge));
QBENCHMARK {
QMap<int, int> qmap(map);
@@ -251,33 +264,35 @@ void tst_QMap::insertion_string_int2()
{
QMap<XString, int> map;
QBENCHMARK {
- for (int i = 1; i < 5000; ++i) {
+ for (int i = 1; i < bigish; ++i) {
XString str;
str.setNum(i);
map.insert(str, i);
}
}
+ QCOMPARE(map.size() + 1, qsizetype(bigish));
}
void tst_QMap::insertion_string_int2_hint()
{
QMap<XString, int> map;
QBENCHMARK {
- for (int i = 1; i < 5000; ++i) {
+ for (int i = 1; i < bigish; ++i) {
XString str;
str.setNum(i);
map.insert(map.end(), str, i);
}
}
+ QCOMPARE(map.size() + 1, qsizetype(bigish));
}
void tst_QMap::insertMap()
{
QMap<int, int> map;
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < huge; ++i)
map.insert(i * 4, 0);
QMap<int, int> map2;
- for (int i = 0; i < 50000; ++i)
+ for (int i = 0; i < huge / 2; ++i)
map2.insert(i * 7, 0);
QBENCHMARK_ONCE {
map.insert(map2);
@@ -286,4 +301,4 @@ void tst_QMap::insertMap()
QTEST_MAIN(tst_QMap)
-#include "main.moc"
+#include "tst_bench_qmap.moc"
diff --git a/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt b/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt
index 30234c7055..e28ca82c74 100644
--- a/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qrect.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qrect Binary:
@@ -6,10 +7,7 @@
qt_internal_add_benchmark(tst_bench_qrect
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qrect.cpp
+ LIBRARIES
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qrect.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/tools/qrect/main.cpp b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp
index 7ddf17845c..0ba9e15963 100644
--- a/tests/benchmarks/corelib/tools/qrect/main.cpp
+++ b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp
@@ -1,36 +1,13 @@
-/****************************************************************************
-**
-** 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
// This file contains benchmarks for QRect/QRectF functions.
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
+
#include <QDebug>
#include <qtest.h>
-class tst_qrect : public QObject
+class tst_QRect : public QObject
{
Q_OBJECT
private slots:
@@ -159,12 +136,12 @@ static void addRectPointData(bool includeProperArg = false)
}
}
-void tst_qrect::contains_point_data()
+void tst_QRect::contains_point_data()
{
addRectPointData(true);
}
-void tst_qrect::contains_point()
+void tst_QRect::contains_point()
{
QFETCH(QRectF, rf);
QFETCH(QPointF, pf);
@@ -176,12 +153,12 @@ void tst_qrect::contains_point()
}
}
-void tst_qrect::contains_rect_data()
+void tst_QRect::contains_rect_data()
{
addRectRectData(true);
}
-void tst_qrect::contains_rect()
+void tst_QRect::contains_rect()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -193,12 +170,12 @@ void tst_qrect::contains_rect()
}
}
-void tst_qrect::intersects_data()
+void tst_QRect::intersects_data()
{
addRectRectData();
}
-void tst_qrect::intersects()
+void tst_QRect::intersects()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -209,12 +186,12 @@ void tst_qrect::intersects()
}
}
-void tst_qrect::intersected_data()
+void tst_QRect::intersected_data()
{
addRectRectData();
}
-void tst_qrect::intersected()
+void tst_QRect::intersected()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -225,12 +202,12 @@ void tst_qrect::intersected()
}
}
-void tst_qrect::united_data()
+void tst_QRect::united_data()
{
addRectRectData();
}
-void tst_qrect::united()
+void tst_QRect::united()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -241,12 +218,12 @@ void tst_qrect::united()
}
}
-void tst_qrect::contains_point_f_data()
+void tst_QRect::contains_point_f_data()
{
addRectPointData();
}
-void tst_qrect::contains_point_f()
+void tst_QRect::contains_point_f()
{
QFETCH(QRectF, rf);
QFETCH(QPointF, pf);
@@ -255,12 +232,12 @@ void tst_qrect::contains_point_f()
}
}
-void tst_qrect::contains_rect_f_data()
+void tst_QRect::contains_rect_f_data()
{
addRectRectData();
}
-void tst_qrect::contains_rect_f()
+void tst_QRect::contains_rect_f()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -269,12 +246,12 @@ void tst_qrect::contains_rect_f()
}
}
-void tst_qrect::intersects_f_data()
+void tst_QRect::intersects_f_data()
{
addRectRectData();
}
-void tst_qrect::intersects_f()
+void tst_QRect::intersects_f()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -283,12 +260,12 @@ void tst_qrect::intersects_f()
}
}
-void tst_qrect::intersected_f_data()
+void tst_QRect::intersected_f_data()
{
addRectRectData();
}
-void tst_qrect::intersected_f()
+void tst_QRect::intersected_f()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -297,12 +274,12 @@ void tst_qrect::intersected_f()
}
}
-void tst_qrect::united_f_data()
+void tst_QRect::united_f_data()
{
addRectRectData();
}
-void tst_qrect::united_f()
+void tst_QRect::united_f()
{
QFETCH(QRectF, rf1);
QFETCH(QRectF, rf2);
@@ -311,6 +288,6 @@ void tst_qrect::united_f()
}
}
-QTEST_MAIN(tst_qrect)
+QTEST_MAIN(tst_QRect)
-#include "main.moc"
+#include "tst_bench_qrect.moc"
diff --git a/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt b/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt
index 63128f5f95..322fbbb83c 100644
--- a/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qringbuffer.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qringbuffer Binary:
@@ -6,11 +7,8 @@
qt_internal_add_benchmark(tst_bench_qringbuffer
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qringbuffer.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qringbuffer.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/corelib/tools/qringbuffer/main.cpp b/tests/benchmarks/corelib/tools/qringbuffer/main.cpp
deleted file mode 100644
index fad30a4e34..0000000000
--- a/tests/benchmarks/corelib/tools/qringbuffer/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qringbuffer_p.h>
-#include <QByteArray>
-
-#include <qtest.h>
-
-class tst_qringbuffer : public QObject
-{
- Q_OBJECT
-private slots:
- void reserveAndRead();
- void free();
-};
-
-void tst_qringbuffer::reserveAndRead()
-{
- QRingBuffer ringBuffer;
- QBENCHMARK {
- for (qint64 i = 1; i < 256; ++i)
- ringBuffer.reserve(i);
-
- for (qint64 i = 1; i < 256; ++i)
- ringBuffer.read(0, i);
- }
-}
-
-void tst_qringbuffer::free()
-{
- QRingBuffer ringBuffer;
- QBENCHMARK {
- ringBuffer.reserve(4096);
- ringBuffer.reserve(2048);
- ringBuffer.append(QByteArray("01234", 5));
-
- ringBuffer.free(1);
- ringBuffer.free(4096);
- ringBuffer.free(48);
- ringBuffer.free(2000);
- }
-}
-
-QTEST_MAIN(tst_qringbuffer)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp b/tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp
new file mode 100644
index 0000000000..f352cd56a9
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp
@@ -0,0 +1,46 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <private/qringbuffer_p.h>
+#include <QByteArray>
+
+#include <qtest.h>
+
+class tst_QRingBuffer : public QObject
+{
+ Q_OBJECT
+private slots:
+ void reserveAndRead();
+ void free();
+};
+
+void tst_QRingBuffer::reserveAndRead()
+{
+ QRingBuffer ringBuffer;
+ QBENCHMARK {
+ for (qint64 i = 1; i < 256; ++i)
+ ringBuffer.reserve(i);
+
+ for (qint64 i = 1; i < 256; ++i)
+ ringBuffer.read(0, i);
+ }
+}
+
+void tst_QRingBuffer::free()
+{
+ QRingBuffer ringBuffer;
+ QBENCHMARK {
+ ringBuffer.reserve(4096);
+ ringBuffer.reserve(2048);
+ ringBuffer.append(QByteArray("01234", 5));
+
+ ringBuffer.free(1);
+ ringBuffer.free(4096);
+ ringBuffer.free(48);
+ ringBuffer.free(2000);
+ }
+}
+
+QTEST_MAIN(tst_QRingBuffer)
+
+#include "tst_bench_qringbuffer.moc"
diff --git a/tests/benchmarks/corelib/tools/qset/CMakeLists.txt b/tests/benchmarks/corelib/tools/qset/CMakeLists.txt
index 00fd088776..7bbed20106 100644
--- a/tests/benchmarks/corelib/tools/qset/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qset/CMakeLists.txt
@@ -1,12 +1,13 @@
-# Generated from qset.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## tst_qset Binary:
+## tst_bench_qset Binary:
#####################################################################
-qt_internal_add_benchmark(tst_qset
+qt_internal_add_benchmark(tst_bench_qset
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qset.cpp
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qset/main.cpp b/tests/benchmarks/corelib/tools/qset/tst_bench_qset.cpp
index f6c40ec160..5bbec05aab 100644
--- a/tests/benchmarks/corelib/tools/qset/main.cpp
+++ b/tests/benchmarks/corelib/tools/qset/tst_bench_qset.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
#include <QSet>
#include <QTest>
@@ -34,12 +9,22 @@ class tst_QSet : public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void intersect_int_data();
void intersect_int();
void intersect_complexType_data();
void intersect_complexType();
+ void unite_int_data();
+ void unite_int();
+ void contains_then_insert_int_data();
+ void contains_then_insert_int();
};
+void tst_QSet::initTestCase()
+{
+ QHashSeed::setDeterministicGlobalSeed();
+}
+
void tst_QSet::intersect_int_data()
{
QTest::addColumn<int>("lhsSize");
@@ -123,6 +108,70 @@ void tst_QSet::intersect_complexType()
}
}
+void tst_QSet::unite_int_data()
+{
+ QTest::addColumn<int>("lhsSize");
+ QTest::addColumn<int>("rhsSize");
+ QTest::addColumn<int>("overlap");
+
+ QTest::newRow("1000000.unite(1000) - 0 overlap") << 1000000 << 1000 << 0;
+ QTest::newRow("1000000.unite(1000) - 100 overlap") << 1000000 << 1000 << 100;
+ QTest::newRow("1000000.unite(1000) - 1000 overlap") << 1000000 << 1000 << 1000;
+ QTest::newRow("1000.unite(1000000) - 0 overlap") << 1000 << 1000000 << 0;
+ QTest::newRow("1000.unite(1000000) - 100 overlap") << 1000 << 1000000 << 100;
+ QTest::newRow("1000.unite(1000000) - 1000 overlap") << 1000 << 1000000 << 1000;
+}
+
+auto build_sets(int lhsSize, int rhsSize, int overlap)
+{
+ QSet<int> lhs;
+ for (int i = 0; i < lhsSize; ++i)
+ lhs.insert(i);
+
+ QSet<int> rhs;
+ for (int i = lhsSize - overlap; i < rhsSize + lhsSize - overlap; ++i)
+ rhs.insert(i);
+
+ return std::make_pair(lhs, rhs);
+}
+
+void tst_QSet::unite_int()
+{
+ QFETCH(int, lhsSize);
+ QFETCH(int, rhsSize);
+ QFETCH(int, overlap);
+
+ auto [lhs, rhs] = build_sets(lhsSize, rhsSize, overlap);
+
+ QBENCHMARK {
+ QSet united = QSet(lhs).unite(rhs);
+ QCOMPARE(united.size(), lhsSize + rhsSize - overlap);
+ }
+}
+
+void tst_QSet::contains_then_insert_int_data()
+{
+ unite_int_data();
+}
+
+void tst_QSet::contains_then_insert_int()
+{
+ QFETCH(int, lhsSize);
+ QFETCH(int, rhsSize);
+ QFETCH(int, overlap);
+
+ auto [lhs, rhs] = build_sets(lhsSize, rhsSize, overlap);
+
+ QBENCHMARK {
+ QSet copy(lhs);
+ for (auto i : rhs) {
+ if (!copy.contains(i))
+ copy.insert(i);
+ }
+ QCOMPARE(copy.size(), lhsSize + rhsSize - overlap);
+ }
+}
+
QTEST_MAIN(tst_QSet)
-#include "main.moc"
+#include "tst_bench_qset.moc"
diff --git a/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt b/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
new file mode 100644
index 0000000000..6adf1f2e4e
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qsharedpointer/CMakeLists.txt
@@ -0,0 +1,12 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_benchmark(tst_bench_shared_ptr
+ SOURCES
+ tst_bench_shared_ptr.cpp
+ INCLUDE_DIRECTORIES
+ .
+ LIBRARIES
+ Qt::Core
+ Qt::Test
+)
diff --git a/tests/benchmarks/corelib/tools/qsharedpointer/tst_bench_shared_ptr.cpp b/tests/benchmarks/corelib/tools/qsharedpointer/tst_bench_shared_ptr.cpp
new file mode 100644
index 0000000000..6197863601
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qsharedpointer/tst_bench_shared_ptr.cpp
@@ -0,0 +1,111 @@
+// Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QObject>
+#include <QScopeGuard>
+#include <QSharedPointer>
+#include <QTest>
+
+#include <atomic>
+#include <memory>
+#include <thread>
+#include <vector>
+
+#if __has_include(<boost/shared_ptr.hpp>)
+# include <boost/shared_ptr.hpp>
+# include <boost/make_shared.hpp>
+
+# ifdef BOOST_NO_EXCEPTIONS
+// https://stackoverflow.com/a/9530546/134841
+// https://www.boost.org/doc/libs/1_79_0/libs/throw_exception/doc/html/throw_exception.html#throw_exception
+BOOST_NORETURN void boost::throw_exception(const std::exception &) { std::terminate(); }
+# if BOOST_VERSION >= 107300
+// https://www.boost.org/doc/libs/1_79_0/libs/throw_exception/doc/html/throw_exception.html#changes_in_1_73_0
+BOOST_NORETURN void boost::throw_exception(const std::exception &, const boost::source_location &)
+{ std::terminate(); }
+# endif // Boost v1.73
+# endif // BOOST_NO_EXCEPTIONS
+
+# define ONLY_IF_BOOST(x) x
+#else
+# define ONLY_IF_BOOST(x) QSKIP("This benchmark requires Boost.SharedPtr.")
+#endif
+
+class tst_QSharedPointer : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void refAndDeref_null_QSP_int() { refAndDeref<QSharedPointer<int>>(); }
+ void refAndDeref_null_SSP_int() { refAndDeref<std::shared_ptr<int>>(); }
+ void refAndDeref_null_BSP_int() { ONLY_IF_BOOST(refAndDeref<boost::shared_ptr<int>>()); }
+
+ void refAndDeref_null_QSP_QString() { refAndDeref<QSharedPointer<QString>>(); }
+ void refAndDeref_null_SSP_QString() { refAndDeref<std::shared_ptr<QString>>(); }
+ void refAndDeref_null_BSP_QString() { ONLY_IF_BOOST(refAndDeref<boost::shared_ptr<QString>>()); }
+
+ void refAndDeref_nonnull_QSP_int() { refAndDeref(QSharedPointer<int>::create(42)); }
+ void refAndDeref_nonnull_SSP_int() { refAndDeref(std::make_shared<int>(42)); }
+ void refAndDeref_nonnull_BSP_int() { ONLY_IF_BOOST(refAndDeref(boost::make_shared<int>(42))); }
+
+ void refAndDeref_nonnull_QSP_QString() { refAndDeref(QSharedPointer<QString>::create(QStringLiteral("Hello"))); }
+ void refAndDeref_nonnull_SSP_QString() { refAndDeref(std::make_shared<QString>(QStringLiteral("Hello"))); }
+ void refAndDeref_nonnull_BSP_QString() { ONLY_IF_BOOST(refAndDeref(boost::make_shared<QString>(QStringLiteral("Hello")))); }
+
+private:
+ template <typename SP>
+ void refAndDeref(SP sp = {})
+ {
+ QBENCHMARK {
+ [[maybe_unused]] auto copy = sp;
+ }
+ }
+
+private Q_SLOTS:
+ void threadedRefAndDeref_null_QSP_int() { threadedRefAndDeref<QSharedPointer<int>>(); }
+ void threadedRefAndDeref_null_SSP_int() { threadedRefAndDeref<std::shared_ptr<int>>(); }
+ void threadedRefAndDeref_null_BSP_int() { ONLY_IF_BOOST(threadedRefAndDeref<boost::shared_ptr<int>>()); }
+
+ void threadedRefAndDeref_null_QSP_QString() { threadedRefAndDeref<QSharedPointer<QString>>(); }
+ void threadedRefAndDeref_null_SSP_QString() { threadedRefAndDeref<std::shared_ptr<QString>>(); }
+ void threadedRefAndDeref_null_BSP_QString() { ONLY_IF_BOOST(threadedRefAndDeref<boost::shared_ptr<QString>>()); }
+
+ void threadedRefAndDeref_nonnull_QSP_int() { threadedRefAndDeref(QSharedPointer<int>::create(42)); }
+ void threadedRefAndDeref_nonnull_SSP_int() { threadedRefAndDeref(std::make_shared<int>(42)); }
+ void threadedRefAndDeref_nonnull_BSP_int() { ONLY_IF_BOOST(threadedRefAndDeref(boost::make_shared<int>(42))); }
+
+ void threadedRefAndDeref_nonnull_QSP_QString() { threadedRefAndDeref(QSharedPointer<QString>::create(QStringLiteral("Hello"))); }
+ void threadedRefAndDeref_nonnull_SSP_QString() { threadedRefAndDeref(std::make_shared<QString>(QStringLiteral("Hello"))); }
+ void threadedRefAndDeref_nonnull_BSP_QString() { ONLY_IF_BOOST(threadedRefAndDeref(boost::make_shared<QString>(QStringLiteral("Hello")))); }
+
+private:
+ template <typename SP>
+ void threadedRefAndDeref(SP sp = {})
+ {
+ std::atomic<bool> cancel = false;
+ std::vector<std::thread> threads;
+ const auto numCores = std::max(2U, std::thread::hardware_concurrency());
+ for (uint i = 0; i < numCores - 1; ++i) {
+ threads.emplace_back([sp, &cancel] {
+ while (!cancel.load(std::memory_order_relaxed)) {
+ for (int i = 0; i < 100; ++i)
+ [[maybe_unused]] auto copy = sp;
+ }
+ });
+ }
+ const auto join = qScopeGuard([&] {
+ cancel.store(true, std::memory_order_relaxed);
+ for (auto &t : threads)
+ t.join();
+ });
+
+ QBENCHMARK {
+ [[maybe_unused]] auto copy = sp;
+ }
+ }
+};
+
+QTEST_MAIN(tst_QSharedPointer)
+
+#include "tst_bench_shared_ptr.moc"
diff --git a/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt b/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt
index 4526af60db..e5ae510521 100644
--- a/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt
@@ -1,13 +1,14 @@
-# Generated from qstack.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## tst_bench_stack Binary:
+## tst_bench_qstack Binary:
#####################################################################
-qt_internal_add_benchmark(tst_bench_stack
+qt_internal_add_benchmark(tst_bench_qstack
SOURCES
- main.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qstack.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qstack/main.cpp b/tests/benchmarks/corelib/tools/qstack/main.cpp
deleted file mode 100644
index c69e5c3ed8..0000000000
--- a/tests/benchmarks/corelib/tools/qstack/main.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Robin Burchell <robin.burchell@viroteck.net>
-** 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 <QStack>
-#include <QDebug>
-#include <QTest>
-
-#include <vector>
-
-class tst_QStack: public QObject
-{
- Q_OBJECT
-
-private slots:
- void qstack_push();
- void qstack_pop();
- void qstack_pushpopone();
-};
-
-const int N = 1000000;
-
-void tst_QStack::qstack_push()
-{
- QStack<int> v;
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- v.push(i);
- v = QStack<int>();
- }
-}
-
-void tst_QStack::qstack_pop()
-{
- QStack<int> v;
- for (int i = 0; i != N; ++i)
- v.push(i);
-
- QBENCHMARK {
- QStack<int> v2 = v;
- for (int i = 0; i != N; ++i) {
- v2.pop();
- }
- }
-}
-
-void tst_QStack::qstack_pushpopone()
-{
- QBENCHMARK {
- QStack<int> v;
- for (int i = 0; i != N; ++i) {
- v.push(0);
- v.pop();
- }
- }
-}
-
-QTEST_MAIN(tst_QStack)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp b/tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp
new file mode 100644
index 0000000000..e0c8cda18c
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2015 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QStack>
+#include <QDebug>
+#include <QTest>
+
+#include <vector>
+
+class tst_QStack: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void qstack_push();
+ void qstack_pop();
+ void qstack_pushpopone();
+};
+
+const int N = 1000000;
+
+void tst_QStack::qstack_push()
+{
+ QStack<int> v;
+ QBENCHMARK {
+ for (int i = 0; i != N; ++i)
+ v.push(i);
+ v = QStack<int>();
+ }
+}
+
+void tst_QStack::qstack_pop()
+{
+ QStack<int> v;
+ for (int i = 0; i != N; ++i)
+ v.push(i);
+
+ QBENCHMARK {
+ QStack<int> v2 = v;
+ for (int i = 0; i != N; ++i) {
+ v2.pop();
+ }
+ }
+}
+
+void tst_QStack::qstack_pushpopone()
+{
+ QBENCHMARK {
+ QStack<int> v;
+ for (int i = 0; i != N; ++i) {
+ v.push(0);
+ v.pop();
+ }
+ }
+}
+
+QTEST_MAIN(tst_QStack)
+
+#include "tst_bench_qstack.moc"
diff --git a/tests/benchmarks/corelib/tools/qvector/CMakeLists.txt b/tests/benchmarks/corelib/tools/qvector/CMakeLists.txt
index 467405eea0..df2fc8ec6a 100644
--- a/tests/benchmarks/corelib/tools/qvector/CMakeLists.txt
+++ b/tests/benchmarks/corelib/tools/qvector/CMakeLists.txt
@@ -1,16 +1,17 @@
-# Generated from qvector.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## tst_bench_vector Binary:
+## tst_bench_qvector Binary:
#####################################################################
-qt_internal_add_benchmark(tst_bench_vector
+qt_internal_add_benchmark(tst_bench_qvector
SOURCES
- main.cpp
+ tst_bench_qvector.cpp
outofline.cpp
INCLUDE_DIRECTORIES
.
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Test
)
diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp
deleted file mode 100644
index b090c04480..0000000000
--- a/tests/benchmarks/corelib/tools/qvector/main.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QVector>
-#include <QDebug>
-#include <QTest>
-
-#include "qrawvector.h"
-
-#include <vector>
-
-/*
-
-Code generated by g++ 4.3.3. The lines marked with '!' are the ones that get
-executed inside the loop. Using the external 's' causes some load making the
-loop resembling a 'simple inner loop' in 'real' applications.
-
-
-qvector_mutable_read_access:
-
-.L166:
-! movl -16(%ebp), %edx
-! movl (%edx), %eax
-! subl $1, %eax
-! je .L165
- movl 4(%edx), %eax
- movl %eax, 8(%esp)
- movl 8(%edx), %eax
- movl %esi, (%esp)
- movl %eax, 4(%esp)
- call _ZN4myns7QVectorIdE7reallocEii
-.L165:
-! movl -16(%ebp), %eax
-! fldl s
-! faddl 16(%eax,%ebx,8)
-! addl $1, %ebx
-! cmpl $10000, %ebx
-! fstpl s
-! jne .L166
-
-
-qvector_const_read_access:
-
- movl -16(%ebp), %edx
- xorl %eax, %eax
-.L183:
-! fldl s
-! faddl 16(%edx,%eax,8)
-! addl $1, %eax
-! cmpl $10000, %eax
-! fstpl s
-! jne .L183
-
-
-stdvector_const_read_access and stdvector_mutable_read_access and
-qrawvector_const_read_access and qrawvector_mutable_read_access:
-
- xorl %eax, %eax
-.L64:
-! fldl s
-! faddl (%ebx,%eax,8)
-! addl $1, %eax
-! cmpl $10000, %eax
-! fstpl s
-! jne .L64
-
-
-
-Behaviour varies with small modifications, but total is more or
-less stable:
-
-qrawvector_mutable_read_access, using size() instead of N:
-
-.L145:
-! faddl (%edx,%eax,8)
-! addl $1, %eax
-! cmpl %ecx, %eax
-! fstl s
-! jne .L145
-! fstp %st(0)
-
-
-qrawvector_mutable_read_access, counting backward:
-
-.L145:
-! faddl (%edx,%eax,8)
-! subl $1, %eax
-! cmpl $-1, %eax
-! fstl s
-! jne .L145
-
-
-qrawvector_mutable_read_access, counting backward, using size():
-
-.L146:
-! faddl (%edx)
-! addl $1, %eax
-! subl $8, %edx
-! cmpl %ecx, %eax
-! fstl s
-! jne .L146
-
-
-
-*/
-
-
-/*
-
-////////////////////////////////////////////////////////////////////
-
-time ./tst_vector qvector_const_read_access
-real 0m12.912s
-user 0m12.401s
-sys 0m0.016s
-
-time ./tst_vector qvector_mutable_read_access
-real 0m38.566s
-user 0m36.754s
-sys 0m0.008s
-
-
-time ./tst_vector stdvector_mutable_read_access
-real 0m12.736s
-user 0m12.665s
-sys 0m0.004s
-
-
-////////////////////////////////////////////////////////////////////
-
-time ./tst_vector qvector_fill_and_return
-real 0m28.778s
-user 0m28.522s
-sys 0m0.012s
-
-time ./tst_vector stdvector_fill_and_return
-real 0m26.675s
-user 0m26.558s
-sys 0m0.012s
-
-time ./tst_vector qrawvector_fill_and_return
-real 0m23.370s
-user 0m23.269s
-sys 0m0.008s
-
-
-
-*/
-
-
-
-#define TEST_RETURN 1
-
-// For some reason, both 'plain' and '-callgrind' create strange results
-// (like varying instruction count for the same assembly code)
-// So replace it by a plain loop and measure wall clock time.
-//#undef QBENCHMARK
-//#define QBENCHMARK for (int j = 0; j != 10000; ++j)
-
-class tst_QVector: public QObject
-{
- Q_OBJECT
-
-private slots:
- void calibration();
-
- // Pure Qt solution
- void qvector_separator() { qWarning() << "QVector results: "; }
- void qvector_const_read_access();
- void qvector_mutable_read_access();
- void qvector_pop_back();
- #ifdef TEST_RETURN
- void qvector_fill_and_return();
- #endif
-
- // Purre Standard solution
- void stdvector() { qWarning() << "std::vector results: "; }
- void stdvector_const_read_access();
- void stdvector_mutable_read_access();
- void stdvector_pop_back();
-
- #ifdef TEST_RETURN
- void stdvector_fill_and_return();
- #endif
-
- // Build using std, pass as QVector
- void mixedvector() { qWarning() << "mixed results: "; }
- #ifdef TEST_RETURN
- void mixedvector_fill_and_return();
- #endif
-
- // Alternative implementation
- void qrawvector_separator() { qWarning() << "QRawVector results: "; }
- void qrawvector_const_read_access();
- void qrawvector_mutable_read_access();
- #ifdef TEST_RETURN
- void qrawvector_fill_and_return();
- #endif
-};
-
-const int N = 1000000;
-extern double s;
-
-void tst_QVector::calibration()
-{
- QVector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += i;
- }
-}
-
-///////////////////// QVector /////////////////////
-
-void tst_QVector::qvector_const_read_access()
-{
- QVector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- const QVector<double> &vc = v;
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += vc[i];
- }
-}
-
-void tst_QVector::qvector_mutable_read_access()
-{
- QVector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += v[i];
- }
-}
-
-#ifdef TEST_RETURN
-extern QVector<double> qvector_fill_and_return_helper();
-
-void tst_QVector::qvector_fill_and_return()
-{
- QBENCHMARK {
- QVector<double> v = qvector_fill_and_return_helper();
- s += v[1];
- }
-}
-
-#endif
-
-
-///////////////////// QRawVector /////////////////////
-
-void tst_QVector::qrawvector_const_read_access()
-{
- QRawVector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- const QRawVector<double> &vc = v;
- QBENCHMARK {
- for (int i = vc.size(); --i >= 0;)
- s += vc[i];
- }
-}
-
-void tst_QVector::qrawvector_mutable_read_access()
-{
- QRawVector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += v[i];
- }
-}
-
-void tst_QVector::qvector_pop_back()
-{
- const int c1 = 100000;
- QVERIFY(N % c1 == 0);
-
- QVector<int> v;
- v.resize(N);
-
- QBENCHMARK {
- for (int i = 0; i < c1; ++i)
- v.pop_back();
- if (v.size() == 0)
- v.resize(N);
- }
-}
-
-
-
-#ifdef TEST_RETURN
-extern QVector<double> qrawvector_fill_and_return_helper();
-
-void tst_QVector::qrawvector_fill_and_return()
-{
- QBENCHMARK {
- QVector<double> v = qrawvector_fill_and_return_helper();
- s += v[1];
- }
-}
-
-#endif
-
-
-///////////////////// std::vector /////////////////////
-
-void tst_QVector::stdvector_const_read_access()
-{
- std::vector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- const std::vector<double> &vc = v;
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += vc[i];
- }
-}
-
-void tst_QVector::stdvector_mutable_read_access()
-{
- std::vector<double> v(N);
- for (int i = 0; i != N; ++i)
- v[i] = i;
-
- QBENCHMARK {
- for (int i = 0; i != N; ++i)
- s += v[i];
- }
-}
-
-void tst_QVector::stdvector_pop_back()
-{
- const int c1 = 100000;
- QVERIFY(N % c1 == 0);
-
- std::vector<int> v;
- v.resize(N);
-
- QBENCHMARK {
- for (int i = 0; i < c1; ++i)
- v.pop_back();
- if (v.size() == 0)
- v.resize(N);
- }
-}
-
-#ifdef TEST_RETURN
-extern std::vector<double> stdvector_fill_and_return_helper();
-
-void tst_QVector::stdvector_fill_and_return()
-{
- QBENCHMARK {
- std::vector<double> v = stdvector_fill_and_return_helper();
- s += v[1];
- }
-}
-
-#endif
-
-///////////////////// mixed vector /////////////////////
-
-
-#ifdef TEST_RETURN
-extern QVector<double> mixedvector_fill_and_return_helper();
-
-void tst_QVector::mixedvector_fill_and_return()
-{
- QBENCHMARK {
- std::vector<double> v = stdvector_fill_and_return_helper();
- s += v[1];
- }
-}
-
-#endif
-
-QTEST_MAIN(tst_QVector)
-
-#include "main.moc"
diff --git a/tests/benchmarks/corelib/tools/qvector/outofline.cpp b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
index daa630efe1..eb4756f710 100644
--- a/tests/benchmarks/corelib/tools/qvector/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qvector/outofline.cpp
@@ -1,58 +1,33 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtTest 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QList>
-#include <vector>
#include "qrawvector.h"
+#include <vector>
-const int N = 1000000;
-double s = 0;
+// Used as accumulator in tests:
+double accumulate = 0;
QVector<double> qvector_fill_and_return_helper()
{
- QVector<double> v(N);
- for (int i = 0; i != N; ++i)
+ QVector<double> v(million);
+ for (int i = 0; i != million; ++i)
v[i] = i;
return v;
}
QVector<double> qrawvector_fill_and_return_helper()
{
- QRawVector<double> v(N);
- for (int i = 0; i != N; ++i)
+ QRawVector<double> v(million);
+ for (int i = 0; i != million; ++i)
v[i] = i;
return v.mutateToVector();
}
QVector<double> mixedvector_fill_and_return_helper()
{
- std::vector<double> v(N);
- for (int i = 0; i != N; ++i)
+ std::vector<double> v(million);
+ for (int i = 0; i != million; ++i)
v[i] = i;
return QVector<double>(v.begin(), v.end());
}
@@ -60,8 +35,8 @@ QVector<double> mixedvector_fill_and_return_helper()
std::vector<double> stdvector_fill_and_return_helper()
{
- std::vector<double> v(N);
- for (int i = 0; i != N; ++i)
+ std::vector<double> v(million);
+ for (int i = 0; i != million; ++i)
v[i] = i;
return v;
}
@@ -80,6 +55,8 @@ QVectorData *QVectorData::allocate(int size, int alignment)
return static_cast<QVectorData *>(alignment > alignmentThreshold() ? qMallocAligned(size, alignment) : ::malloc(size));
}
+QT_BEGIN_NAMESPACE
+
QVectorData *QVectorData::reallocate(QVectorData *x, int newsize, int oldsize, int alignment)
{
if (alignment > alignmentThreshold())
@@ -99,3 +76,5 @@ int QVectorData::grow(int sizeOfHeader, int size, int sizeOfT)
{
return qCalculateGrowingBlockSize(size, sizeOfT, sizeOfHeader).elementCount;
}
+
+QT_END_NAMESPACE
diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
index 1f615f6e69..9e68b81285 100644
--- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h
+++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QRAWVECTOR_H
#define QRAWVECTOR_H
@@ -41,8 +16,16 @@
#include <stdlib.h>
#include <string.h>
-QT_BEGIN_NAMESPACE
+const int million = 1000000;
+extern double accumulate;
+
+// Defined in outofline.cpp
+extern QVector<double> qvector_fill_and_return_helper();
+extern QVector<double> qrawvector_fill_and_return_helper();
+extern std::vector<double> stdvector_fill_and_return_helper();
+extern QVector<double> mixedvector_fill_and_return_helper();
+QT_BEGIN_NAMESPACE
struct QVectorData
{
@@ -217,6 +200,7 @@ private:
public:
QVector<T> mutateToVector()
{
+ Q_ASSERT(!"Fix QTBUG-95061 before calling this; it is broken beyond repair");
Data *d = toBase(m_begin);
d->ref.initializeOwned();
d->alloc = m_alloc;
diff --git a/tests/benchmarks/corelib/tools/qvector/tst_bench_qvector.cpp b/tests/benchmarks/corelib/tools/qvector/tst_bench_qvector.cpp
new file mode 100644
index 0000000000..0486beed4e
--- /dev/null
+++ b/tests/benchmarks/corelib/tools/qvector/tst_bench_qvector.cpp
@@ -0,0 +1,228 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QVector>
+#include <QDebug>
+#include <QTest>
+
+#include "qrawvector.h"
+
+#include <vector>
+
+/* Using 'extern accumulate' causes some load making the loop resembling a
+ 'simple inner loop' in 'real' applications.
+*/
+
+/* QRawVector::mutateToVector() hacks a semblance of a Qt 5 QVector.
+
+ However, Qt 6's QVector is Qt 6's QList and completely different in internal
+ layout. The QTypedArrayData inside it is also completely rearranged. Until
+ QRawVector can be rewritten to do whatever it's supposed to do in a
+ Qt6-compatible way, this test is suppressed, see QTBUG-95061.
+*/
+#define TEST_RAW 0
+
+// TODO: is this still a thing ? (Dates from g++ 4.3.3 in 2009.)
+// For some reason, both 'plain' and '-callgrind' create strange results
+// (like varying instruction count for the same assembly code)
+// So replace it by a plain loop and measure wall clock time.
+//#undef QBENCHMARK
+//#define QBENCHMARK for (int j = 0; j != 10000; ++j)
+
+class tst_QVector: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void calibration();
+
+ // Pure Qt solution
+ void qvector_separator() { qWarning() << "QVector results: "; }
+ void qvector_const_read_access();
+ void qvector_mutable_read_access();
+ void qvector_pop_back();
+ void qvector_fill_and_return();
+
+ // Purre Standard solution
+ void stdvector() { qWarning() << "std::vector results: "; }
+ void stdvector_const_read_access();
+ void stdvector_mutable_read_access();
+ void stdvector_pop_back();
+ void stdvector_fill_and_return();
+
+ // Build using std, pass as QVector
+ void mixedvector() { qWarning() << "mixed results: "; }
+ void mixedvector_fill_and_return();
+
+ // Alternative implementation
+ void qrawvector_separator() { qWarning() << "QRawVector results: "; }
+ void qrawvector_const_read_access();
+ void qrawvector_mutable_read_access();
+#if TEST_RAW
+ void qrawvector_fill_and_return();
+#endif
+};
+
+void tst_QVector::calibration()
+{
+ QVector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += i;
+ }
+}
+
+///////////////////// QVector /////////////////////
+
+void tst_QVector::qvector_const_read_access()
+{
+ QVector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ const QVector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += vc[i];
+ }
+}
+
+void tst_QVector::qvector_mutable_read_access()
+{
+ QVector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += v[i];
+ }
+}
+
+void tst_QVector::qvector_fill_and_return()
+{
+ QBENCHMARK {
+ QVector<double> v = qvector_fill_and_return_helper();
+ accumulate += v[1];
+ }
+}
+
+///////////////////// QRawVector /////////////////////
+
+void tst_QVector::qrawvector_const_read_access()
+{
+ QRawVector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ const QRawVector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = vc.size(); --i >= 0;)
+ accumulate += vc[i];
+ }
+}
+
+void tst_QVector::qrawvector_mutable_read_access()
+{
+ QRawVector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += v[i];
+ }
+}
+
+void tst_QVector::qvector_pop_back()
+{
+ const int c1 = 100000;
+ QVERIFY(million % c1 == 0);
+
+ QVector<int> v;
+ v.resize(million);
+
+ QBENCHMARK {
+ for (int i = 0; i < c1; ++i)
+ v.pop_back();
+ if (v.size() == 0)
+ v.resize(million);
+ }
+}
+
+#if TEST_RAW
+void tst_QVector::qrawvector_fill_and_return()
+{
+ QBENCHMARK {
+ QVector<double> v = qrawvector_fill_and_return_helper();
+ accumulate += v[1];
+ }
+}
+#endif
+
+///////////////////// std::vector /////////////////////
+
+void tst_QVector::stdvector_const_read_access()
+{
+ std::vector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ const std::vector<double> &vc = v;
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += vc[i];
+ }
+}
+
+void tst_QVector::stdvector_mutable_read_access()
+{
+ std::vector<double> v(million);
+ for (int i = 0; i < million; ++i)
+ v[i] = i;
+
+ QBENCHMARK {
+ for (int i = 0; i < million; ++i)
+ accumulate += v[i];
+ }
+}
+
+void tst_QVector::stdvector_pop_back()
+{
+ const int size = million / 10;
+ QVERIFY(million % size == 0);
+
+ std::vector<int> v;
+ v.resize(million);
+
+ QBENCHMARK {
+ for (int i = 0; i < size; ++i)
+ v.pop_back();
+ if (v.size() == 0)
+ v.resize(million);
+ }
+}
+
+void tst_QVector::stdvector_fill_and_return()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper();
+ accumulate += v[1];
+ }
+}
+
+///////////////////// mixed vector /////////////////////
+
+void tst_QVector::mixedvector_fill_and_return()
+{
+ QBENCHMARK {
+ std::vector<double> v = stdvector_fill_and_return_helper();
+ accumulate += v[1];
+ }
+}
+
+QTEST_MAIN(tst_QVector)
+
+#include "tst_bench_qvector.moc"
diff --git a/tests/benchmarks/dbus/CMakeLists.txt b/tests/benchmarks/dbus/CMakeLists.txt
index cd246922a1..03c1599742 100644
--- a/tests/benchmarks/dbus/CMakeLists.txt
+++ b/tests/benchmarks/dbus/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from dbus.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qdbustype)
if(QT_FEATURE_process)
diff --git a/tests/benchmarks/dbus/qdbusperformance/CMakeLists.txt b/tests/benchmarks/dbus/qdbusperformance/CMakeLists.txt
index 5d79f36090..4f070d26e4 100644
--- a/tests/benchmarks/dbus/qdbusperformance/CMakeLists.txt
+++ b/tests/benchmarks/dbus/qdbusperformance/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdbusperformance.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(server)
add_subdirectory(test)
diff --git a/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt b/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt
index ff4612d042..7136a2e571 100644
--- a/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt
+++ b/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt
@@ -1,15 +1,16 @@
-# Generated from server.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## server Binary:
#####################################################################
-qt_internal_add_benchmark(server
+qt_internal_add_executable(server
GUI
- OUTPUT_DIRECTORY "."
+ OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
SOURCES
../serverobject.h
server.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::DBus
)
diff --git a/tests/benchmarks/dbus/qdbusperformance/server/server.cpp b/tests/benchmarks/dbus/qdbusperformance/server/server.cpp
index 3831a62f71..5bf4ac1ec3 100644
--- a/tests/benchmarks/dbus/qdbusperformance/server/server.cpp
+++ b/tests/benchmarks/dbus/qdbusperformance/server/server.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
#include <QtCore/QtCore>
diff --git a/tests/benchmarks/dbus/qdbusperformance/serverobject.h b/tests/benchmarks/dbus/qdbusperformance/serverobject.h
index ea499f32ec..da12a56308 100644
--- a/tests/benchmarks/dbus/qdbusperformance/serverobject.h
+++ b/tests/benchmarks/dbus/qdbusperformance/serverobject.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
#ifndef SERVEROBJECT_H
diff --git a/tests/benchmarks/dbus/qdbusperformance/test/CMakeLists.txt b/tests/benchmarks/dbus/qdbusperformance/test/CMakeLists.txt
index 6b22096b4d..d62ab282a8 100644
--- a/tests/benchmarks/dbus/qdbusperformance/test/CMakeLists.txt
+++ b/tests/benchmarks/dbus/qdbusperformance/test/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from test.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qdbusperformance Binary:
@@ -8,7 +9,7 @@ qt_internal_add_benchmark(tst_qdbusperformance
SOURCES
../serverobject.h
../tst_qdbusperformance.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::DBus
Qt::Test
)
diff --git a/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp b/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp
index 1f76c413be..7f1957b87f 100644
--- a/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp
+++ b/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.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) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QTestEventLoop>
@@ -83,7 +58,7 @@ void tst_QDBusPerformance::initTestCase()
#else
# define EXE ""
#endif
- proc.start(QFINDTESTDATA("server/server" EXE));
+ proc.start(QFINDTESTDATA("../server/server" EXE));
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
QVERIFY(proc.waitForReadyRead());
diff --git a/tests/benchmarks/dbus/qdbustype/CMakeLists.txt b/tests/benchmarks/dbus/qdbustype/CMakeLists.txt
index 13169cc0a0..79597c435c 100644
--- a/tests/benchmarks/dbus/qdbustype/CMakeLists.txt
+++ b/tests/benchmarks/dbus/qdbustype/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdbustype.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qdbustype Binary:
@@ -7,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qdbustype
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::DBusPrivate
Qt::Test
@@ -19,7 +20,7 @@ qt_internal_add_benchmark(tst_bench_qdbustype
qt_internal_extend_target(tst_bench_qdbustype CONDITION QT_FEATURE_dbus_linked
DEFINES
QT_LINKED_LIBDBUS
- PUBLIC_LIBRARIES
+ LIBRARIES
dbus-1
)
diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp
index 6efdb81ae0..d3ee0da14c 100644
--- a/tests/benchmarks/dbus/qdbustype/main.cpp
+++ b/tests/benchmarks/dbus/qdbustype/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 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
#include <QTest>
#include <QtCore/QCoreApplication>
diff --git a/tests/benchmarks/gui/CMakeLists.txt b/tests/benchmarks/gui/CMakeLists.txt
index 6af9d8e224..c8c805a2a7 100644
--- a/tests/benchmarks/gui/CMakeLists.txt
+++ b/tests/benchmarks/gui/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from gui.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(animation)
add_subdirectory(image)
diff --git a/tests/benchmarks/gui/animation/CMakeLists.txt b/tests/benchmarks/gui/animation/CMakeLists.txt
index 6190f29a65..7a014c2a7a 100644
--- a/tests/benchmarks/gui/animation/CMakeLists.txt
+++ b/tests/benchmarks/gui/animation/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from animation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(TARGET Qt::Widgets)
add_subdirectory(qanimation)
diff --git a/tests/benchmarks/gui/animation/qanimation/CMakeLists.txt b/tests/benchmarks/gui/animation/qanimation/CMakeLists.txt
index 4d611eedb1..0193551ee1 100644
--- a/tests/benchmarks/gui/animation/qanimation/CMakeLists.txt
+++ b/tests/benchmarks/gui/animation/qanimation/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qanimation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qanimation Binary:
@@ -10,7 +11,7 @@ qt_internal_add_benchmark(tst_bench_qanimation
dummyobject.cpp dummyobject.h
main.cpp
rectanimation.cpp rectanimation.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp b/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp
index 71d628fda0..a877cca838 100644
--- a/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp
+++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.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 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
#include "dummyanimation.h"
#include "dummyobject.h"
diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.h b/tests/benchmarks/gui/animation/qanimation/dummyanimation.h
index adc805b726..5ac0e6431b 100644
--- a/tests/benchmarks/gui/animation/qanimation/dummyanimation.h
+++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.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
#include <QtGui>
diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp
index 9c691eaf57..a69c73a90b 100644
--- a/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp
+++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** 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) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "dummyobject.h"
diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.h b/tests/benchmarks/gui/animation/qanimation/dummyobject.h
index 980508598b..3bae6407ba 100644
--- a/tests/benchmarks/gui/animation/qanimation/dummyobject.h
+++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.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
#include <QtGui>
diff --git a/tests/benchmarks/gui/animation/qanimation/main.cpp b/tests/benchmarks/gui/animation/qanimation/main.cpp
index afe3bcfd5e..26c188bb4a 100644
--- a/tests/benchmarks/gui/animation/qanimation/main.cpp
+++ b/tests/benchmarks/gui/animation/qanimation/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 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
#include <QtWidgets>
#include <qtest.h>
diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp b/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp
index 48ad64b0d9..ec2fc340cf 100644
--- a/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp
+++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.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 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
#include "rectanimation.h"
#include "dummyobject.h"
diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.h b/tests/benchmarks/gui/animation/qanimation/rectanimation.h
index 9528b6c16d..359c9a8a9b 100644
--- a/tests/benchmarks/gui/animation/qanimation/rectanimation.h
+++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.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
#include <QtGui>
diff --git a/tests/benchmarks/gui/image/CMakeLists.txt b/tests/benchmarks/gui/image/CMakeLists.txt
index 77cfeedc3e..53768eda4c 100644
--- a/tests/benchmarks/gui/image/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from image.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(blendbench)
add_subdirectory(qimageconversion)
diff --git a/tests/benchmarks/gui/image/blendbench/CMakeLists.txt b/tests/benchmarks/gui/image/blendbench/CMakeLists.txt
index d0d61cea19..88a47c894b 100644
--- a/tests/benchmarks/gui/image/blendbench/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/blendbench/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from blendbench.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_blendbench Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_blendbench
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:blendbench.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp
index 039d822a39..4aaf89d029 100644
--- a/tests/benchmarks/gui/image/blendbench/main.cpp
+++ b/tests/benchmarks/gui/image/blendbench/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
#include <QtGui>
#include <QString>
diff --git a/tests/benchmarks/gui/image/qimageconversion/CMakeLists.txt b/tests/benchmarks/gui/image/qimageconversion/CMakeLists.txt
index f67a2b6908..034ed28fcd 100644
--- a/tests/benchmarks/gui/image/qimageconversion/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/qimageconversion/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qimageconversion.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_imageConversion Binary:
@@ -7,15 +8,11 @@
qt_internal_add_benchmark(tst_bench_imageConversion
SOURCES
tst_qimageconversion.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-#### Keys ignored in scope 1:.:.:qimageconversion.pro:<TRUE>:
-# QT_FOR_CONFIG = "gui-private"
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
index afc9292c1d..0c4243637c 100644
--- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
+++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.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
#include <qtest.h>
#include <QImage>
diff --git a/tests/benchmarks/gui/image/qimagereader/CMakeLists.txt b/tests/benchmarks/gui/image/qimagereader/CMakeLists.txt
index d0ef0e3984..ba3c2a7ec4 100644
--- a/tests/benchmarks/gui/image/qimagereader/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/qimagereader/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qimagereader.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qimagereader Binary:
@@ -6,17 +7,13 @@
qt_internal_add_benchmark(tst_bench_qimagereader
SOURCES
- tst_qimagereader.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qimagereader.cpp
+ LIBRARIES
+ Qt::CorePrivate
Qt::Gui
Qt::Test
)
-#### Keys ignored in scope 1:.:.:qimagereader.pro:<TRUE>:
-# QT_FOR_CONFIG = "gui-private"
-# TEMPLATE = "app"
-# TESTDATA = "images/*"
-
## Scopes:
#####################################################################
diff --git a/tests/benchmarks/gui/image/qimagereader/tst_qimagereader.cpp b/tests/benchmarks/gui/image/qimagereader/tst_bench_qimagereader.cpp
index 48e838148f..9b23741405 100644
--- a/tests/benchmarks/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/benchmarks/gui/image/qimagereader/tst_bench_qimagereader.cpp
@@ -1,32 +1,8 @@
-/****************************************************************************
-**
-** 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
#include <qtest.h>
+
#include <QBuffer>
#include <QDebug>
#include <QFile>
@@ -34,6 +10,8 @@
#include <QImageReader>
#include <QImageWriter>
#include <QPixmap>
+
+#include <QtCore/private/qfactoryloader_p.h>
#include <QSet>
#include <QTimer>
@@ -42,20 +20,20 @@ typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList)
-class tst_QImageReader : public QObject
+class tst_bench_QImageReader : public QObject
{
Q_OBJECT
public:
- tst_QImageReader();
- virtual ~tst_QImageReader();
+ tst_bench_QImageReader();
public slots:
void initTestCase();
- void init();
- void cleanup();
private slots:
+ void rawFactoryLoader_keyMap();
+ void rawFactoryLoader_instance();
+
void readImage_data();
void readImage();
@@ -71,9 +49,10 @@ private slots:
private:
QList< QPair<QString, QByteArray> > images; // filename, format
QString prefix;
+ QFactoryLoader m_loader{QImageIOHandlerFactoryInterface_iid, "/imageformats"};
};
-tst_QImageReader::tst_QImageReader()
+tst_bench_QImageReader::tst_bench_QImageReader()
{
images << QPair<QString, QByteArray>(QLatin1String("colorful.bmp"), QByteArray("bmp"));
images << QPair<QString, QByteArray>(QLatin1String("font.bmp"), QByteArray("bmp"));
@@ -100,26 +79,38 @@ tst_QImageReader::tst_QImageReader()
#endif
}
-tst_QImageReader::~tst_QImageReader()
-{
-}
-
-void tst_QImageReader::initTestCase()
+void tst_bench_QImageReader::initTestCase()
{
prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty())
QFAIL("Can't find images directory!");
}
-void tst_QImageReader::init()
+void tst_bench_QImageReader::rawFactoryLoader_keyMap()
{
+ if (m_loader.keyMap().isEmpty())
+ QSKIP("No image plugins found.");
+
+ QBENCHMARK {
+ [[maybe_unused]] auto r = m_loader.keyMap();
+ }
}
-void tst_QImageReader::cleanup()
+void tst_bench_QImageReader::rawFactoryLoader_instance()
{
+ if (m_loader.keyMap().isEmpty())
+ QSKIP("No image plugins found.");
+
+ const auto numInstances = m_loader.keyMap().uniqueKeys().size();
+
+ QBENCHMARK {
+ for (int i = 0; i < numInstances; ++i)
+ delete m_loader.instance(i);
+ }
}
-void tst_QImageReader::readImage_data()
+
+void tst_bench_QImageReader::readImage_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format");
@@ -131,7 +122,7 @@ void tst_QImageReader::readImage_data()
}
}
-void tst_QImageReader::readImage()
+void tst_bench_QImageReader::readImage()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
@@ -143,7 +134,7 @@ void tst_QImageReader::readImage()
}
}
-void tst_QImageReader::setScaledSize_data()
+void tst_bench_QImageReader::setScaledSize_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format");
@@ -161,7 +152,7 @@ void tst_QImageReader::setScaledSize_data()
}
}
-void tst_QImageReader::setScaledSize()
+void tst_bench_QImageReader::setScaledSize()
{
QFETCH(QString, fileName);
QFETCH(QSize, newSize);
@@ -175,7 +166,7 @@ void tst_QImageReader::setScaledSize()
}
}
-void tst_QImageReader::setClipRect_data()
+void tst_bench_QImageReader::setClipRect_data()
{
QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format");
@@ -188,7 +179,7 @@ void tst_QImageReader::setClipRect_data()
}
}
-void tst_QImageReader::setClipRect()
+void tst_bench_QImageReader::setClipRect()
{
QFETCH(QString, fileName);
QFETCH(QRect, newRect);
@@ -202,12 +193,12 @@ void tst_QImageReader::setClipRect()
}
}
-void tst_QImageReader::setScaledClipRect_data()
+void tst_bench_QImageReader::setScaledClipRect_data()
{
setClipRect_data();
}
-void tst_QImageReader::setScaledClipRect()
+void tst_bench_QImageReader::setScaledClipRect()
{
QFETCH(QString, fileName);
QFETCH(QRect, newRect);
@@ -222,5 +213,5 @@ void tst_QImageReader::setScaledClipRect()
}
}
-QTEST_MAIN(tst_QImageReader)
-#include "tst_qimagereader.moc"
+QTEST_MAIN(tst_bench_QImageReader)
+#include "tst_bench_qimagereader.moc"
diff --git a/tests/benchmarks/gui/image/qimagescale/CMakeLists.txt b/tests/benchmarks/gui/image/qimagescale/CMakeLists.txt
index 51610fa567..74d5c8e470 100644
--- a/tests/benchmarks/gui/image/qimagescale/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/qimagescale/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qimagescale.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_imageScale Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_imageScale
SOURCES
tst_qimagescale.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qimagescale.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/image/qimagescale/tst_qimagescale.cpp b/tests/benchmarks/gui/image/qimagescale/tst_qimagescale.cpp
index 2ba3731e9b..2819dc1c11 100644
--- a/tests/benchmarks/gui/image/qimagescale/tst_qimagescale.cpp
+++ b/tests/benchmarks/gui/image/qimagescale/tst_qimagescale.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
#include <qtest.h>
#include <QImage>
diff --git a/tests/benchmarks/gui/image/qpixmap/CMakeLists.txt b/tests/benchmarks/gui/image/qpixmap/CMakeLists.txt
index f8b1a4c754..db0546390a 100644
--- a/tests/benchmarks/gui/image/qpixmap/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/qpixmap/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qpixmap.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qpixmap Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qpixmap
SOURCES
tst_qpixmap.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qpixmap.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp
index 36f555ba61..7a6e4a2b3f 100644
--- a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.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
#include <qtest.h>
#include <QBitmap>
diff --git a/tests/benchmarks/gui/image/qpixmapcache/CMakeLists.txt b/tests/benchmarks/gui/image/qpixmapcache/CMakeLists.txt
index 0f4a57c191..f2939ab470 100644
--- a/tests/benchmarks/gui/image/qpixmapcache/CMakeLists.txt
+++ b/tests/benchmarks/gui/image/qpixmapcache/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qpixmapcache.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qpixmapcache Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qpixmapcache
SOURCES
tst_qpixmapcache.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qpixmapcache.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp
index b1f1a4c083..0c93e6d2ec 100644
--- a/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.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
#include <qtest.h>
#include <QPixmapCache>
diff --git a/tests/benchmarks/gui/kernel/CMakeLists.txt b/tests/benchmarks/gui/kernel/CMakeLists.txt
index 451b12388d..1f79c7d99b 100644
--- a/tests/benchmarks/gui/kernel/CMakeLists.txt
+++ b/tests/benchmarks/gui/kernel/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from kernel.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qguimetatype)
add_subdirectory(qguivariant)
diff --git a/tests/benchmarks/gui/kernel/qguimetatype/CMakeLists.txt b/tests/benchmarks/gui/kernel/qguimetatype/CMakeLists.txt
index 1b11788093..394706b078 100644
--- a/tests/benchmarks/gui/kernel/qguimetatype/CMakeLists.txt
+++ b/tests/benchmarks/gui/kernel/qguimetatype/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qguimetatype.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qguimetatype Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qguimetatype
SOURCES
tst_qguimetatype.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qguimetatype.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index ac4b45d044..2f7d278e87 100644
--- a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.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
#include <qtest.h>
#include <QtCore/qmetatype.h>
diff --git a/tests/benchmarks/gui/kernel/qguivariant/CMakeLists.txt b/tests/benchmarks/gui/kernel/qguivariant/CMakeLists.txt
index ef1c220259..a8e3ec8ec6 100644
--- a/tests/benchmarks/gui/kernel/qguivariant/CMakeLists.txt
+++ b/tests/benchmarks/gui/kernel/qguivariant/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qguivariant.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qguivariant Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qguivariant
SOURCES
tst_qguivariant.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qguivariant.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp
index 625df6aef4..9c49e467ce 100644
--- a/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp
+++ b/tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.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
#include <qtest.h>
#include <QtCore/qvariant.h>
diff --git a/tests/benchmarks/gui/math3d/CMakeLists.txt b/tests/benchmarks/gui/math3d/CMakeLists.txt
index 53e56a83a3..f8e6f7b16c 100644
--- a/tests/benchmarks/gui/math3d/CMakeLists.txt
+++ b/tests/benchmarks/gui/math3d/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from math3d.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qmatrix4x4)
add_subdirectory(qquaternion)
diff --git a/tests/benchmarks/gui/math3d/qmatrix4x4/CMakeLists.txt b/tests/benchmarks/gui/math3d/qmatrix4x4/CMakeLists.txt
index 28ada45257..2929d2d46f 100644
--- a/tests/benchmarks/gui/math3d/qmatrix4x4/CMakeLists.txt
+++ b/tests/benchmarks/gui/math3d/qmatrix4x4/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qmatrix4x4.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qmatrix4x4 Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qmatrix4x4
SOURCES
tst_qmatrix4x4.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qmatrix4x4.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp b/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp
index 528256d7df..ebc61495dd 100644
--- a/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp
+++ b/tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtOpenGL 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
#include <QTest>
#include <QtGui/qmatrix4x4.h>
diff --git a/tests/benchmarks/gui/math3d/qquaternion/CMakeLists.txt b/tests/benchmarks/gui/math3d/qquaternion/CMakeLists.txt
index 147f4ce15f..e5880c0916 100644
--- a/tests/benchmarks/gui/math3d/qquaternion/CMakeLists.txt
+++ b/tests/benchmarks/gui/math3d/qquaternion/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qquaternion.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qquaternion Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qquaternion
SOURCES
tst_qquaternion.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qquaternion.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp
index 6a97f417a8..07b47d6401 100644
--- a/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.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
#include <qtest.h>
#include <QQuaternion>
diff --git a/tests/benchmarks/gui/painting/CMakeLists.txt b/tests/benchmarks/gui/painting/CMakeLists.txt
index 080fe582f2..2313688038 100644
--- a/tests/benchmarks/gui/painting/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from painting.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(drawtexture)
add_subdirectory(qcolor)
diff --git a/tests/benchmarks/gui/painting/drawtexture/CMakeLists.txt b/tests/benchmarks/gui/painting/drawtexture/CMakeLists.txt
index 2d30686339..1e9af29d7f 100644
--- a/tests/benchmarks/gui/painting/drawtexture/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/drawtexture/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from drawtexture.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_drawtexture Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_drawtexture
SOURCES
tst_drawtexture.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:drawtexture.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/drawtexture/tst_drawtexture.cpp b/tests/benchmarks/gui/painting/drawtexture/tst_drawtexture.cpp
index c16e68a0b1..4ab0a2db1e 100644
--- a/tests/benchmarks/gui/painting/drawtexture/tst_drawtexture.cpp
+++ b/tests/benchmarks/gui/painting/drawtexture/tst_drawtexture.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
#include <qtest.h>
#include <QPainter>
diff --git a/tests/benchmarks/gui/painting/lancebench/CMakeLists.txt b/tests/benchmarks/gui/painting/lancebench/CMakeLists.txt
index e278f0ddc0..bfdd4df1c9 100644
--- a/tests/benchmarks/gui/painting/lancebench/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/lancebench/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from lancebench.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_lancebench Binary:
@@ -6,9 +7,11 @@
qt_internal_add_benchmark(tst_bench_lancebench
SOURCES
- ../../../../auto/other/lancelot/paintcommands.cpp ../../../../auto/other/lancelot/paintcommands.h
+ ../../../../baseline/shared/paintcommands.cpp ../../../../baseline/shared/paintcommands.h
tst_lancebench.cpp
- PUBLIC_LIBRARIES
+ INCLUDE_DIRECTORIES
+ ../../../../baseline/shared
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
@@ -47,26 +50,21 @@ set(images_resource_files
"images/zebra.png"
)
-list(TRANSFORM images_resource_files PREPEND "../../../../auto/other/lancelot/")
+list(TRANSFORM images_resource_files PREPEND "../../../../baseline/painting/")
qt_internal_add_resource(tst_bench_lancebench "images"
PREFIX
"/"
BASE
- "../../../../auto/other/lancelot"
+ "../../../../baseline/painting"
FILES
${images_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:lancebench.pro:<TRUE>:
-# TEMPLATE = "app"
-# TESTDATA = "../../../../auto/other/lancelot/scripts/*"
-
## Scopes:
#####################################################################
qt_internal_extend_target(tst_bench_lancebench CONDITION QT_FEATURE_opengl
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::OpenGL
)
diff --git a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp
index 1c17f86cf9..67bef8ebfe 100644
--- a/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp
+++ b/tests/benchmarks/gui/painting/lancebench/tst_lancebench.cpp
@@ -1,32 +1,7 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "../../../../auto/other/lancelot/paintcommands.h"
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include "paintcommands.h"
#include <qtest.h>
#include <QDir>
@@ -96,17 +71,17 @@ tst_LanceBench::tst_LanceBench()
void tst_LanceBench::initTestCase()
{
- QString baseDir = QFINDTESTDATA("../../../../auto/other/lancelot/scripts/text.qps");
+ QString baseDir = QFINDTESTDATA("../../../../baseline/painting/scripts/text.qps");
scriptsDir = baseDir.left(baseDir.lastIndexOf('/')) + '/';
QDir qpsDir(scriptsDir);
qpsFiles = qpsDir.entryList(QStringList() << QLatin1String("*.qps"), QDir::Files | QDir::Readable);
if (qpsFiles.isEmpty()) {
- QWARN("No qps script files found in " + qpsDir.path().toLatin1());
+ qWarning() << "No qps script files found in" << qpsDir.path();
QSKIP("Aborted due to errors.");
}
std::sort(qpsFiles.begin(), qpsFiles.end());
- for (const QString& fileName : qAsConst(qpsFiles)) {
+ for (const QString& fileName : std::as_const(qpsFiles)) {
QFile file(scriptsDir + fileName);
file.open(QFile::ReadOnly);
QByteArray cont = file.readAll();
@@ -262,7 +237,7 @@ void tst_LanceBench::testCoreOpenGL()
void tst_LanceBench::setupTestSuite(const QStringList& blacklist)
{
QTest::addColumn<QString>("qpsFile");
- for (const QString &fileName : qAsConst(qpsFiles)) {
+ for (const QString &fileName : std::as_const(qpsFiles)) {
if (blacklist.contains(fileName))
continue;
QTest::newRow(fileName.toLatin1()) << fileName;
diff --git a/tests/benchmarks/gui/painting/qcolor/CMakeLists.txt b/tests/benchmarks/gui/painting/qcolor/CMakeLists.txt
index d482102f1b..a450c698bf 100644
--- a/tests/benchmarks/gui/painting/qcolor/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qcolor/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qcolor.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qcolor Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qcolor
SOURCES
tst_qcolor.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qcolor.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp
index 52a7673c0c..02fe3f986e 100644
--- a/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/benchmarks/gui/painting/qcolor/tst_qcolor.cpp
@@ -1,30 +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 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 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 GPL-3.0-only
#include <qtest.h>
#include <QColor>
diff --git a/tests/benchmarks/gui/painting/qpainter/CMakeLists.txt b/tests/benchmarks/gui/painting/qpainter/CMakeLists.txt
index ce302599cf..13a99ecc1d 100644
--- a/tests/benchmarks/gui/painting/qpainter/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qpainter/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qpainter.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qpainter Binary:
@@ -7,13 +8,10 @@
qt_internal_add_benchmark(tst_bench_qpainter
SOURCES
tst_qpainter.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
Qt::Widgets
Qt::WidgetsPrivate
)
-
-#### Keys ignored in scope 1:.:.:qpainter.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
index d0719d716b..7954e964b3 100644
--- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
@@ -1,30 +1,7 @@
-/****************************************************************************
-**
-** 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <qtest.h>
#include <QPainter>
@@ -220,6 +197,9 @@ private slots:
void drawTransformedSemiTransparentImage();
void drawTransformedFilledImage();
+ void drawPathExceedingDevice_data();
+ void drawPathExceedingDevice();
+
private:
void setupBrushes();
void createPrimitives();
@@ -695,7 +675,7 @@ void tst_QPainter::drawPixmapImage_data_helper(bool pixmaps)
for (; *targetFormats != QImage::Format_Invalid; ++targetFormats) {
const QImage::Format *sourceFormats = pixmaps ? pixmapFormats : sourceImageFormats;
for (; *sourceFormats != QImage::Format_Invalid; ++sourceFormats) {
- for (const QSize &s : qAsConst(sizes)) {
+ for (const QSize &s : std::as_const(sizes)) {
for (int type=0; type<=3; ++type) {
QString name = QString::fromLatin1("%1 on %2, (%3x%4), %5")
.arg(formatNames[*sourceFormats])
@@ -1684,6 +1664,56 @@ void tst_QPainter::drawTransformedFilledImage()
}
}
+void tst_QPainter::drawPathExceedingDevice_data()
+{
+ QTest::addColumn<int>("dim");
+ QTest::addColumn<QPainterPath>("path");
+
+ const int dim = 512;
+ QPainterPath p;
+ const int ext = 10 * dim;
+ for (int i = 0; i < ext; i += (ext / 50)) {
+ p.lineTo(ext, i);
+ p.lineTo(0, dim);
+ p.moveTo(0, 0);
+ }
+
+ {
+ QPainterPath preClip;
+ preClip.addRect(0, 0, dim, dim);
+ QTest::newRow("devicesize") << dim << p.intersected(preClip);
+ }
+
+ {
+ QPainterPath preClip;
+ preClip.addRect(0, 0, 2*dim, 2*dim);
+ QTest::newRow("devicesizex2") << dim << p.intersected(preClip);
+ }
+
+ {
+ QPainterPath preClip;
+ preClip.addRect(0, 0, 5*dim, 5*dim);
+ QTest::newRow("devicesizex5") << dim << p.intersected(preClip);
+ }
+
+ QTest::newRow("devicesizex10") << dim << p;
+}
+
+void tst_QPainter::drawPathExceedingDevice()
+{
+ QFETCH(int, dim);
+ QFETCH(QPainterPath, path);
+
+ QImage img(dim, dim, QImage::Format_RGB32);
+ QPainter p(&img);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.setPen(QPen(Qt::black, 3));
+ p.setBrush(Qt::NoBrush);
+
+ QBENCHMARK {
+ p.drawPath(path);
+ }
+}
QTEST_MAIN(tst_QPainter)
diff --git a/tests/benchmarks/gui/painting/qregion/CMakeLists.txt b/tests/benchmarks/gui/painting/qregion/CMakeLists.txt
index 43d397c456..c242a2f588 100644
--- a/tests/benchmarks/gui/painting/qregion/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qregion/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qregion.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qregion Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qregion
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qregion.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qregion/main.cpp b/tests/benchmarks/gui/painting/qregion/main.cpp
index 9e926780ab..696972c140 100644
--- a/tests/benchmarks/gui/painting/qregion/main.cpp
+++ b/tests/benchmarks/gui/painting/qregion/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
// This file contains benchmarks for QRegion functions.
#include <QDebug>
diff --git a/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt b/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
index e6e2ed76ab..68fbf0984f 100644
--- a/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qtbench/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtbench.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtbench Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qtbench
SOURCES
tst_qtbench.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qtbench.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
index bffdd5bf2d..9d890f1577 100644
--- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
+++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
@@ -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
#ifndef BENCHMARKTESTS_H
#define BENCHMARKTESTS_H
@@ -554,13 +529,13 @@ public:
m_staticTexts.append(staticText);
QFontMetrics fm(p->font());
- m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height());
+ m_size = QSize(fm.horizontalAdvance(m_text, m_text.size()), fm.height());
break;
}
case PainterQPointMode: {
QFontMetrics fm(p->font());
- m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height());
+ m_size = QSize(fm.horizontalAdvance(m_text, m_text.size()), fm.height());
break;
}
@@ -601,7 +576,7 @@ public:
QString name() const override
{
- int letters = m_text.length();
+ int letters = m_text.size();
int lines = m_text.count('\n');
if (lines == 0)
lines = 1;
diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
index c44eeb3b67..45b7045f94 100644
--- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
+++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
@@ -1,30 +1,7 @@
-/****************************************************************************
-**
-** 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
+
+#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
#include <qtest.h>
@@ -132,9 +109,13 @@ class tst_QtBench : public QObject
{
Q_OBJECT
+ QList<Benchmark *> benchmarks;
+
private slots:
void qtBench();
void qtBench_data();
+
+ void cleanupTestCase() { qDeleteAll(benchmarks); }
};
QString makeString(int length)
@@ -184,7 +165,6 @@ void tst_QtBench::qtBench_data()
"i erat, sed pellentesque\n"
"mi. Curabitur sed.";
- QList<Benchmark *> benchmarks;
benchmarks << (new DrawText(shortString, DrawText::PainterMode));
benchmarks << (new DrawText(middleString, DrawText::PainterMode));
benchmarks << (new DrawText(longString, DrawText::PainterMode));
diff --git a/tests/benchmarks/gui/painting/qtransform/CMakeLists.txt b/tests/benchmarks/gui/painting/qtransform/CMakeLists.txt
index b9adb340dc..8915ca3eb7 100644
--- a/tests/benchmarks/gui/painting/qtransform/CMakeLists.txt
+++ b/tests/benchmarks/gui/painting/qtransform/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtransform.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtransform Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qtransform
SOURCES
tst_qtransform.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtransform.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp
index 65748997bb..e6442d0dff 100644
--- a/tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp
+++ b/tests/benchmarks/gui/painting/qtransform/tst_qtransform.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
#include <qtest.h>
#include <QTransform>
@@ -266,7 +241,7 @@ void tst_QTransform::operatorEqual()
QFETCH(QTransform, x2);
QTransform x = x1;
QBENCHMARK {
- x == x2;
+ [[maybe_unused]] auto r = x == x2;
}
}
@@ -278,7 +253,7 @@ void tst_QTransform::operatorNotEqual()
QFETCH(QTransform, x2);
QTransform x = x1;
QBENCHMARK {
- x != x2;
+ [[maybe_unused]] auto r = x != x2;
}
}
@@ -290,7 +265,7 @@ void tst_QTransform::operatorMultiply()
QFETCH(QTransform, x2);
QTransform x = x1;
QBENCHMARK {
- x * x2;
+ [[maybe_unused]] auto r = x * x2;
}
}
@@ -335,7 +310,7 @@ void tst_QTransform::operatorMultiplyEqualScalar()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x * 3;
+ x *= 3;
}
}
@@ -357,7 +332,7 @@ void tst_QTransform::mapQPoint()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x.map(QPoint(3, 3));
+ [[maybe_unused]] auto r = x.map(QPoint(3, 3));
}
}
@@ -368,7 +343,7 @@ void tst_QTransform::mapQPointF()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x.map(QPointF(3, 3));
+ [[maybe_unused]] auto r = x.map(QPointF(3, 3));
}
}
@@ -379,7 +354,7 @@ void tst_QTransform::mapRect()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x.mapRect(QRect(0, 0, 100, 100));
+ [[maybe_unused]] auto r = x.mapRect(QRect(0, 0, 100, 100));
}
}
@@ -390,7 +365,7 @@ void tst_QTransform::mapRectF()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x.mapRect(QRectF(0, 0, 100, 100));
+ [[maybe_unused]] auto r = x.mapRect(QRectF(0, 0, 100, 100));
}
}
@@ -402,7 +377,7 @@ void tst_QTransform::mapQPolygon()
QTransform x = transform;
QPolygon poly = QPolygon(QRect(0, 0, 100, 100));
QBENCHMARK {
- x.map(poly);
+ [[maybe_unused]] auto r = x.map(poly);
}
}
@@ -414,7 +389,7 @@ void tst_QTransform::mapQPolygonF()
QTransform x = transform;
QPolygonF poly = QPolygonF(QRectF(0, 0, 100, 100));
QBENCHMARK {
- x.map(poly);
+ [[maybe_unused]] auto r = x.map(poly);
}
}
@@ -428,7 +403,7 @@ void tst_QTransform::mapQRegion()
for (int i = 0; i < 10; ++i)
region += QRect(i * 10, i * 10, 100, 100);
QBENCHMARK {
- x.map(region);
+ [[maybe_unused]] auto r = x.map(region);
}
}
@@ -439,7 +414,7 @@ void tst_QTransform::mapToPolygon()
QFETCH(QTransform, transform);
QTransform x = transform;
QBENCHMARK {
- x.mapToPolygon(QRect(0, 0, 100, 100));
+ [[maybe_unused]] auto r = x.mapToPolygon(QRect(0, 0, 100, 100));
}
}
@@ -454,7 +429,7 @@ void tst_QTransform::mapQPainterPath()
for (int i = 0; i < 10; ++i)
path.addEllipse(i * 10, i * 10, 100, 100);
QBENCHMARK {
- x.map(path);
+ [[maybe_unused]] auto r = x.map(path);
}
}
@@ -464,7 +439,7 @@ void tst_QTransform::isIdentity()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isIdentity();
+ [[maybe_unused]] auto r = transform.isIdentity();
}
}
@@ -474,7 +449,7 @@ void tst_QTransform::isAffine()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isAffine();
+ [[maybe_unused]] auto r = transform.isAffine();
}
}
@@ -484,7 +459,7 @@ void tst_QTransform::isInvertible()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isInvertible();
+ [[maybe_unused]] auto r = transform.isInvertible();
}
}
@@ -494,7 +469,7 @@ void tst_QTransform::isRotating()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isRotating();
+ [[maybe_unused]] auto r = transform.isRotating();
}
}
@@ -504,7 +479,7 @@ void tst_QTransform::isScaling()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isScaling();
+ [[maybe_unused]] auto r = transform.isScaling();
}
}
@@ -514,7 +489,7 @@ void tst_QTransform::isTranslating()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.isTranslating();
+ [[maybe_unused]] auto r = transform.isTranslating();
}
}
@@ -524,7 +499,7 @@ void tst_QTransform::type()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.type();
+ [[maybe_unused]] auto r = transform.type();
}
}
@@ -534,7 +509,7 @@ void tst_QTransform::determinant()
{
QFETCH(QTransform, transform);
QBENCHMARK {
- transform.determinant();
+ [[maybe_unused]] auto r = transform.determinant();
}
}
diff --git a/tests/benchmarks/gui/text/CMakeLists.txt b/tests/benchmarks/gui/text/CMakeLists.txt
index 630f01091d..052d49e03c 100644
--- a/tests/benchmarks/gui/text/CMakeLists.txt
+++ b/tests/benchmarks/gui/text/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from text.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qfontmetrics)
add_subdirectory(qtext)
diff --git a/tests/benchmarks/gui/text/qfontmetrics/CMakeLists.txt b/tests/benchmarks/gui/text/qfontmetrics/CMakeLists.txt
index b580a6fd3d..4b9ae1e4c8 100644
--- a/tests/benchmarks/gui/text/qfontmetrics/CMakeLists.txt
+++ b/tests/benchmarks/gui/text/qfontmetrics/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qfontmetrics.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_QFontMetrics Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_QFontMetrics
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qfontmetrics.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/text/qfontmetrics/main.cpp b/tests/benchmarks/gui/text/qfontmetrics/main.cpp
index 86c7cebfd4..8aafa809f8 100644
--- a/tests/benchmarks/gui/text/qfontmetrics/main.cpp
+++ b/tests/benchmarks/gui/text/qfontmetrics/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
#include <QObject>
#include <QFont>
diff --git a/tests/benchmarks/gui/text/qtext/CMakeLists.txt b/tests/benchmarks/gui/text/qtext/CMakeLists.txt
index 5b154a431b..13cd6a2c3a 100644
--- a/tests/benchmarks/gui/text/qtext/CMakeLists.txt
+++ b/tests/benchmarks/gui/text/qtext/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtext.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_QText Binary:
@@ -7,12 +8,8 @@
qt_internal_add_benchmark(tst_bench_QText
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtext.pro:<TRUE>:
-# TEMPLATE = "app"
-# TESTDATA = "bidi.txt"
diff --git a/tests/benchmarks/gui/text/qtext/main.cpp b/tests/benchmarks/gui/text/qtext/main.cpp
index ef88f64d8f..9a2740253c 100644
--- a/tests/benchmarks/gui/text/qtext/main.cpp
+++ b/tests/benchmarks/gui/text/qtext/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
#include <QDebug>
#include <QTextDocument>
@@ -50,7 +25,9 @@ public:
private slots:
void loadHtml_data();
+#ifndef QT_NO_TEXTHTMLPARSER
void loadHtml();
+#endif
void shaping_data();
void shaping();
@@ -72,9 +49,11 @@ private slots:
void paintLayoutToPixmap();
void paintLayoutToPixmap_painterFill();
+#ifndef QT_NO_TEXTHTMLPARSER
void document();
void paintDocToPixmap();
void paintDocToPixmap_painterFill();
+#endif
private:
QSize setupTextLayout(QTextLayout *layout, bool wrap = true, int wrapWidth = 100);
@@ -101,6 +80,7 @@ void tst_QText::loadHtml_data()
+ parag;
}
+#ifndef QT_NO_TEXTHTMLPARSER
void tst_QText::loadHtml()
{
QFETCH(QString, source);
@@ -109,6 +89,7 @@ void tst_QText::loadHtml()
doc.setHtml(source);
}
}
+#endif
void tst_QText::shaping_data()
{
@@ -122,10 +103,10 @@ void tst_QText::shaping_data()
QFile file(testFile);
QVERIFY(file.open(QFile::ReadOnly));
QByteArray data = file.readAll();
- QVERIFY(data.count() > 1000);
+ QVERIFY(data.size() > 1000);
QStringList list = QString::fromUtf8(data.data()).split(QLatin1Char('\n'), Qt::SkipEmptyParts);
- QVERIFY(list.count() %2 == 0); // even amount as we have title and then content.
- for (int i=0; i < list.count(); i+=2) {
+ QVERIFY(list.size() % 2 == 0); // even amount as we have title and then content.
+ for (int i = 0; i < list.size(); i += 2) {
QTest::newRow(list.at(i).toLatin1()) << list.at(i+1);
}
}
@@ -396,6 +377,7 @@ void tst_QText::paintLayoutToPixmap_painterFill()
}
}
+#ifndef QT_NO_TEXTHTMLPARSER
void tst_QText::document()
{
QTextDocument *doc = new QTextDocument;
@@ -438,6 +420,7 @@ void tst_QText::paintDocToPixmap_painterFill()
doc->drawContents(&p);
}
}
+#endif
QTEST_MAIN(tst_QText)
diff --git a/tests/benchmarks/gui/text/qtextdocument/CMakeLists.txt b/tests/benchmarks/gui/text/qtextdocument/CMakeLists.txt
index 9a9017c8e0..2a95411335 100644
--- a/tests/benchmarks/gui/text/qtextdocument/CMakeLists.txt
+++ b/tests/benchmarks/gui/text/qtextdocument/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtextdocument.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_QTextDocument Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_QTextDocument
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::GuiPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtextdocument.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/gui/text/qtextdocument/main.cpp b/tests/benchmarks/gui/text/qtextdocument/main.cpp
index 17fee3b2eb..7bdff95235 100644
--- a/tests/benchmarks/gui/text/qtextdocument/main.cpp
+++ b/tests/benchmarks/gui/text/qtextdocument/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
-** 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 Robin Burchell <robin.burchell@viroteck.net>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QDebug>
#include <QTextDocument>
diff --git a/tests/benchmarks/network/CMakeLists.txt b/tests/benchmarks/network/CMakeLists.txt
index 4f20fb5ccd..50558e6999 100644
--- a/tests/benchmarks/network/CMakeLists.txt
+++ b/tests/benchmarks/network/CMakeLists.txt
@@ -1,6 +1,6 @@
-# Generated from network.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-# special case begin
# SSL library include path is not propagated with private tests which results in
# test not being able to find the ssl header when they are not in the standard
# include paths
@@ -13,7 +13,6 @@ if (QT_FEATURE_private_tests)
include_directories($<TARGET_PROPERTY:WrapOpenSSLHeaders::WrapOpenSSLHeaders,INTERFACE_INCLUDE_DIRECTORIES>)
endif()
endif()
-# special case end
add_subdirectory(access)
add_subdirectory(kernel)
diff --git a/tests/benchmarks/network/access/CMakeLists.txt b/tests/benchmarks/network/access/CMakeLists.txt
index 3069505252..bc5148af55 100644
--- a/tests/benchmarks/network/access/CMakeLists.txt
+++ b/tests/benchmarks/network/access/CMakeLists.txt
@@ -1,9 +1,13 @@
-# Generated from access.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qfile_vs_qnetworkaccessmanager)
+add_subdirectory(qhttpheaders)
add_subdirectory(qnetworkreply)
-add_subdirectory(qnetworkreply_from_cache)
-add_subdirectory(qnetworkdiskcache)
+if(QT_FEATURE_networkdiskcache)
+ add_subdirectory(qnetworkreply_from_cache)
+ add_subdirectory(qnetworkdiskcache)
+endif()
if(QT_FEATURE_private_tests)
add_subdirectory(qdecompresshelper)
endif()
diff --git a/tests/benchmarks/network/access/qdecompresshelper/CMakeLists.txt b/tests/benchmarks/network/access/qdecompresshelper/CMakeLists.txt
index 92a729d373..d2ca8db69d 100644
--- a/tests/benchmarks/network/access/qdecompresshelper/CMakeLists.txt
+++ b/tests/benchmarks/network/access/qdecompresshelper/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdecompresshelper.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## qdecompresshelper Binary:
@@ -8,12 +9,8 @@ qt_internal_add_benchmark(qdecompresshelper
SOURCES
main.cpp
DEFINES
- SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR} # special case
- PUBLIC_LIBRARIES
+ SRC_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ LIBRARIES
Qt::NetworkPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:decompresshelper.pro:<TRUE>:
-# TEMPLATE = "app"
-# _REQUIREMENTS = "qtConfig(private_tests)"
diff --git a/tests/benchmarks/network/access/qdecompresshelper/main.cpp b/tests/benchmarks/network/access/qdecompresshelper/main.cpp
index 3c651b16dd..7f8b09ef0e 100644
--- a/tests/benchmarks/network/access/qdecompresshelper/main.cpp
+++ b/tests/benchmarks/network/access/qdecompresshelper/main.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
#include <QtNetwork/private/qdecompresshelper_p.h>
@@ -76,13 +51,14 @@ void tst_QDecompressHelper::decompress()
file.seek(0);
QDecompressHelper helper;
helper.setEncoding(encoding);
+ helper.setDecompressedSafetyCheckThreshold(-1);
QVERIFY(helper.isValid());
helper.feed(file.readAll());
qsizetype bytes = 0;
+ QByteArray out(64 * 1024, Qt::Uninitialized);
while (helper.hasData()) {
- QByteArray out(64 * 1024, Qt::Uninitialized);
qsizetype bytesRead = helper.read(out.data(), out.size());
bytes += bytesRead;
}
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/CMakeLists.txt b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/CMakeLists.txt
index 929e87908b..fd1592ad17 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/CMakeLists.txt
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qfile_vs_qnetworkaccessmanager.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qfile_vs_qnetworkaccessmanager Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qfile_vs_qnetworkaccessmanager
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qfile_vs_qnetworkaccessmanager.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
index d0ed0f9b00..372158163f 100644
--- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.cpp
+++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/main.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
#include <QDebug>
#include <qtest.h>
#include <QTest>
diff --git a/tests/benchmarks/network/access/qhttpheaders/CMakeLists.txt b/tests/benchmarks/network/access/qhttpheaders/CMakeLists.txt
new file mode 100644
index 0000000000..6e89259141
--- /dev/null
+++ b/tests/benchmarks/network/access/qhttpheaders/CMakeLists.txt
@@ -0,0 +1,10 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_benchmark(tst_bench_qhttpheaders
+ SOURCES
+ tst_bench_qhttpheaders.cpp
+ LIBRARIES
+ Qt::Test
+ Qt::Network
+)
diff --git a/tests/benchmarks/network/access/qhttpheaders/tst_bench_qhttpheaders.cpp b/tests/benchmarks/network/access/qhttpheaders/tst_bench_qhttpheaders.cpp
new file mode 100644
index 0000000000..424b475b27
--- /dev/null
+++ b/tests/benchmarks/network/access/qhttpheaders/tst_bench_qhttpheaders.cpp
@@ -0,0 +1,266 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtNetwork/qhttpheaders.h>
+
+#include <QtCore/qstring.h>
+#include <QTest>
+
+using namespace Qt::StringLiterals;
+
+class tst_QHttpHeaders : public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase();
+
+ void append_enum();
+ void append_string_data();
+ void append_string();
+
+ void contains_enum_data() { setupBasicEnumData(); }
+ void contains_enum();
+ void contains_string_data() { setupBasicStringData(); }
+ void contains_string();
+
+ void values_enum_data() { setupBasicEnumData(); }
+ void values_enum();
+ void values_string_data() { setupBasicStringData(); }
+ void values_string();
+
+ void combinedValue_enum_data() { setupBasicEnumData(); }
+ void combinedValue_enum();
+ void combinedValue_string_data() { setupBasicStringData(); }
+ void combinedValue_string();
+
+ void removeAll_enum_data() { setupBasicEnumData(); }
+ void removeAll_enum();
+ void removeAll_string_data() { setupBasicStringData(); }
+ void removeAll_string();
+
+private:
+ using WKH = QHttpHeaders::WellKnownHeader;
+
+ void setupBasicEnumData()
+ {
+ QTest::addColumn<WKH>("name");
+ QTest::addColumn<bool>("exists");
+
+ QTest::newRow("Nonexistent enum") << WKH::CDNLoop << false;
+ QTest::newRow("Existent enum") << WKH::Accept << true;
+ }
+
+ void setupBasicStringData()
+ {
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<bool>("exists");
+
+ QTest::newRow("Nonexistent string") << "cdn-loop" << false;
+ QTest::newRow("Existent wellknown string") << "accept" << true;
+ QTest::newRow("Existent custom string") << "customheader" << true;
+ }
+
+ const QString customNameLowCase = u"customm-name"_s; // Not a typo, same length as knownName
+ const QString customNameMixCase = u"Customm-Name"_s;
+ const QString knownNameLowCase = u"content-type"_s;
+ const QString knownNameMixCase = u"Content-Type"_s;
+ static constexpr QAnyStringView value1{"value1"};
+ static constexpr QAnyStringView value2{"value2"};
+ static constexpr QAnyStringView value3{"value3"};
+ static constexpr QAnyStringView value4{"value4"};
+
+ QHttpHeaders m_complexHeaders;
+ QHttpHeaders m_simpleHeaders;
+};
+
+void tst_QHttpHeaders::initTestCase()
+{
+ // A mix of known and custom headers in non-alphabetical order.
+ // "accept" (wellknown header) and "customheader" (custom header)
+ // have four values and in same order: value3, value1, value2, value4
+ m_complexHeaders.append(WKH::Upgrade, value1);
+ m_complexHeaders.append("timeout", value1);
+ m_complexHeaders.append(WKH::KeepAlive, value1);
+ m_complexHeaders.append("nel", value1);
+ m_complexHeaders.append(WKH::Date, value1);
+ m_complexHeaders.append("accept", value3);
+ m_complexHeaders.append("customheader", value3);
+ m_complexHeaders.append(WKH::SoapAction, value1);
+ m_complexHeaders.append("foobar", value1);
+ m_complexHeaders.append(WKH::Accept, value1);
+ m_complexHeaders.append("customheader", value1);
+ m_complexHeaders.append(WKH::Cookie, value1);
+ m_complexHeaders.append("cookie", value1);
+ m_complexHeaders.append(WKH::ProxyStatus, value1);
+ m_complexHeaders.append("cookie", value1);
+ m_complexHeaders.append(WKH::Accept, value2);
+ m_complexHeaders.append("customheader", value2);
+ m_complexHeaders.append(WKH::Authorization, value1);
+ m_complexHeaders.append("content-type", value1);
+ m_complexHeaders.append(WKH::Destination, value1);
+ m_complexHeaders.append("rover", value1);
+ m_complexHeaders.append("accept", value4);
+ m_complexHeaders.append("customheader", value4);
+ m_complexHeaders.append(WKH::Range, value1);
+ m_complexHeaders.append("destination", value1);
+ m_complexHeaders.append(WKH::Location, value1);
+ m_complexHeaders.append("font", value1);
+
+ // Simple headers with one value-less entry; having at least one entry ensures
+ // we don't include initial memory allocation into a test, and having
+ // as few as possible reduces cost of copying (header re-set)
+ m_simpleHeaders.append(WKH::Accept, "");
+}
+
+void tst_QHttpHeaders::append_enum()
+{
+ QHttpHeaders headers;
+ QBENCHMARK {
+ headers = m_simpleHeaders; // (Re-)set as we'll modify the headers
+ headers.append(WKH::Link, value1);
+ }
+ QCOMPARE(headers.size(), m_simpleHeaders.size() + 1);
+ QCOMPARE(headers.nameAt(headers.size() - 1), "link");
+}
+
+void tst_QHttpHeaders::append_string_data()
+{
+ QTest::addColumn<QString>("name");
+ QTest::newRow("Custom lowcase string") << customNameLowCase;
+ QTest::newRow("WellKnown lowcase string") << knownNameLowCase;
+ QTest::newRow("Custom mixcase string") << customNameMixCase;
+ QTest::newRow("WellKnown mixcase string") << knownNameMixCase;
+}
+
+void tst_QHttpHeaders::append_string()
+{
+ QFETCH(QString, name);
+
+ QHttpHeaders headers;
+ QBENCHMARK {
+ headers = m_simpleHeaders; // (Re-)set as we'll modify the headers
+ headers.append(name, value1);
+ }
+ QCOMPARE(headers.size(), m_simpleHeaders.size() + 1);
+ QCOMPARE(headers.nameAt(headers.size() - 1), name.toLower());
+}
+
+void tst_QHttpHeaders::contains_enum()
+{
+ QFETCH(WKH, name);
+ QFETCH(bool, exists);
+
+ bool result;
+ QBENCHMARK {
+ result = m_complexHeaders.contains(name);
+ }
+ QCOMPARE(result, exists);
+}
+
+void tst_QHttpHeaders::contains_string()
+{
+ QFETCH(QString, name);
+ QFETCH(bool, exists);
+
+ bool result;
+ QBENCHMARK {
+ result = m_complexHeaders.contains(name);
+ }
+ QCOMPARE(result, exists);
+}
+
+void tst_QHttpHeaders::values_enum()
+{
+ QFETCH(WKH, name);
+ QFETCH(bool, exists);
+
+ QList<QByteArray> result;
+ const QList<QByteArray> expectedResult{"value3", "value1", "value2", "value4"};
+ QBENCHMARK {
+ result = m_complexHeaders.values(name);
+ }
+ if (exists)
+ QCOMPARE(result, expectedResult);
+ else
+ QVERIFY(result.isEmpty());
+}
+
+void tst_QHttpHeaders::values_string()
+{
+ QFETCH(QString, name);
+ QFETCH(bool, exists);
+
+ QList<QByteArray> result;
+ const QList<QByteArray> expectedResult{"value3", "value1", "value2", "value4"};
+ QBENCHMARK {
+ result = m_complexHeaders.values(name);
+ }
+ if (exists)
+ QCOMPARE(result, expectedResult);
+ else
+ QVERIFY(result.isEmpty());
+}
+
+void tst_QHttpHeaders::combinedValue_enum()
+{
+ QFETCH(WKH, name);
+ QFETCH(bool, exists);
+
+ QByteArray result;
+ constexpr QByteArrayView expectedResult = "value3, value1, value2, value4";
+ QBENCHMARK {
+ result = m_complexHeaders.combinedValue(name);
+ }
+ if (exists)
+ QCOMPARE(result, expectedResult);
+ else
+ QVERIFY(result.isEmpty());
+}
+
+void tst_QHttpHeaders::combinedValue_string()
+{
+ QFETCH(QString, name);
+ QFETCH(bool, exists);
+
+ QByteArray result;
+ constexpr QByteArrayView expectedResult = "value3, value1, value2, value4";
+ QBENCHMARK {
+ result = m_complexHeaders.combinedValue(name);
+ }
+ if (exists)
+ QCOMPARE(result, expectedResult);
+ else
+ QVERIFY(result.isEmpty());
+}
+
+void tst_QHttpHeaders::removeAll_enum()
+{
+ QFETCH(WKH, name);
+ QFETCH(bool, exists);
+
+ QHttpHeaders headers = m_complexHeaders;
+ QCOMPARE(headers.contains(name), exists);
+ QBENCHMARK {
+ headers = m_complexHeaders; // Restore as we'll modify the headers
+ headers.removeAll(name);
+ }
+ QVERIFY(!headers.contains(name));
+}
+
+void tst_QHttpHeaders::removeAll_string()
+{
+ QFETCH(QString, name);
+ QFETCH(bool, exists);
+
+ QHttpHeaders headers = m_complexHeaders;
+ QCOMPARE(headers.contains(name), exists);
+ QBENCHMARK {
+ headers = m_complexHeaders; // Restore as we'll modify the headers
+ headers.removeAll(name);
+ }
+ QVERIFY(!headers.contains(name));
+}
+
+QTEST_MAIN(tst_QHttpHeaders)
+
+#include "tst_bench_qhttpheaders.moc"
diff --git a/tests/benchmarks/network/access/qnetworkdiskcache/CMakeLists.txt b/tests/benchmarks/network/access/qnetworkdiskcache/CMakeLists.txt
index 4b8f3f4406..e049b221ff 100644
--- a/tests/benchmarks/network/access/qnetworkdiskcache/CMakeLists.txt
+++ b/tests/benchmarks/network/access/qnetworkdiskcache/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qnetworkdiskcache.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qnetworkdiskcache Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qnetworkdiskcache
SOURCES
tst_qnetworkdiskcache.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qnetworkdiskcache.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index 113cef2cba..c70248f590 100644
--- a/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.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
#include <QNetworkDiskCache>
#include <QNetworkCacheMetaData>
diff --git a/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt b/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt
index ad0224e82c..1d13192d97 100644
--- a/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt
+++ b/tests/benchmarks/network/access/qnetworkreply/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qnetworkreply.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qnetworkreply Binary:
@@ -7,12 +8,9 @@
qt_internal_add_benchmark(tst_bench_qnetworkreply
SOURCES
tst_qnetworkreply.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Network
Qt::NetworkPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qnetworkreply.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index d023d0300e..bab2743513 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.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
// This file contains benchmarks for QNetworkReply functions.
#include <QDebug>
@@ -46,6 +21,8 @@
#include <QtNetwork/private/qhostinfo_p.h>
#endif
+using namespace std::chrono_literals;
+
Q_DECLARE_METATYPE(QSharedPointer<char>)
class TimedSender: public QThread
@@ -481,7 +458,7 @@ void tst_qnetworkreply::httpLatency()
QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/"));
QNetworkReply* reply = manager.get(request);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
- QTestEventLoop::instance().enterLoop(5);
+ QTestEventLoop::instance().enterLoop(5s);
QVERIFY(!QTestEventLoop::instance().timeout());
delete reply;
}
@@ -495,7 +472,7 @@ QPair<QNetworkReply *, qint64> tst_qnetworkreply::runGetRequest(
QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors()));
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
- QTestEventLoop::instance().enterLoop(20);
+ QTestEventLoop::instance().enterLoop(20s);
qint64 elapsed = timer.elapsed();
return qMakePair(reply, elapsed);
}
@@ -526,7 +503,7 @@ void tst_qnetworkreply::echoPerformance()
QNetworkReply* reply = manager.post(request, data);
connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors()));
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
- QTestEventLoop::instance().enterLoop(5);
+ QTestEventLoop::instance().enterLoop(5s);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(reply->error() == QNetworkReply::NoError);
delete reply;
@@ -535,7 +512,7 @@ void tst_qnetworkreply::echoPerformance()
void tst_qnetworkreply::preConnectEncrypted()
{
- QFETCH(int, sleepTime);
+ QFETCH(std::chrono::milliseconds, sleepTime);
QString hostName = QLatin1String("www.google.com");
QNetworkAccessManager manager;
@@ -566,7 +543,7 @@ void tst_qnetworkreply::preConnectEncrypted()
// now try to make the connection beforehand
manager.connectToHostEncrypted(hostName);
- QTestEventLoop::instance().enterLoopMSecs(sleepTime);
+ QTestEventLoop::instance().enterLoop(sleepTime);
// now make another request and hopefully use the existing connection
QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request);
@@ -584,12 +561,12 @@ void tst_qnetworkreply::preConnectEncrypted()
void tst_qnetworkreply::preConnectEncrypted_data()
{
#ifndef QT_NO_OPENSSL
- QTest::addColumn<int>("sleepTime");
+ QTest::addColumn<std::chrono::milliseconds>("sleepTime");
// start a new normal request after preconnecting is done
- QTest::newRow("HTTPS-2secs") << 2000;
+ QTest::newRow("HTTPS-2secs") << 2000ms;
// start a new normal request while preconnecting is in-flight
- QTest::newRow("HTTPS-100ms") << 100;
+ QTest::newRow("HTTPS-100ms") << 100ms;
#endif // QT_NO_OPENSSL
}
@@ -631,9 +608,11 @@ void tst_qnetworkreply::uploadPerformance()
QVERIFY(!QTestEventLoop::instance().timeout());
}
+constexpr qint64 MiB = 1024 * 1024;
+
void tst_qnetworkreply::httpUploadPerformance()
{
- enum {UploadSize = 128*1024*1024}; // 128 MB
+ constexpr qint64 UploadSize = 128 * MiB;
ThreadedDataReaderHttpServer reader;
FixedSizeDataGenerator generator(UploadSize);
@@ -701,7 +680,7 @@ void tst_qnetworkreply::httpDownloadPerformance()
QFETCH(bool, serverSendsContentLength);
QFETCH(bool, chunkedEncoding);
- enum {UploadSize = 128*1024*1024}; // 128 MB
+ constexpr qint64 UploadSize = 128 * MiB;
HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
@@ -938,9 +917,9 @@ void tst_qnetworkreply::preConnect()
manager.clearAccessCache();
// now try to make the connection beforehand
- QFETCH(int, sleepTime);
+ QFETCH(std::chrono::milliseconds, sleepTime);
manager.connectToHost(hostName);
- QTestEventLoop::instance().enterLoopMSecs(sleepTime);
+ QTestEventLoop::instance().enterLoop(sleepTime);
// now make another request and hopefully use the existing connection
QPair<QNetworkReply *, qint64> preConnectResult = runGetRequest(&manager, request);
diff --git a/tests/benchmarks/network/access/qnetworkreply_from_cache/CMakeLists.txt b/tests/benchmarks/network/access/qnetworkreply_from_cache/CMakeLists.txt
index ced1a0850e..3e9bf3d23e 100644
--- a/tests/benchmarks/network/access/qnetworkreply_from_cache/CMakeLists.txt
+++ b/tests/benchmarks/network/access/qnetworkreply_from_cache/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qnetworkreply_from_cache.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qnetworkreply_from_cache Binary:
@@ -7,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qnetworkreply_from_cache
SOURCES
tst_qnetworkreply_from_cache.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
diff --git a/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp b/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp
index 1d7dd79fe2..c18daa8195 100644
--- a/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply_from_cache/tst_qnetworkreply_from_cache.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
-** 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 Hewlett-Packard Development Company, L.P.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QBuffer>
diff --git a/tests/benchmarks/network/kernel/CMakeLists.txt b/tests/benchmarks/network/kernel/CMakeLists.txt
index 13a7caecdb..4310cdc1ee 100644
--- a/tests/benchmarks/network/kernel/CMakeLists.txt
+++ b/tests/benchmarks/network/kernel/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from kernel.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(QT_FEATURE_private_tests)
add_subdirectory(qhostinfo)
diff --git a/tests/benchmarks/network/kernel/qhostinfo/CMakeLists.txt b/tests/benchmarks/network/kernel/qhostinfo/CMakeLists.txt
index 7611998c26..83b63ca501 100644
--- a/tests/benchmarks/network/kernel/qhostinfo/CMakeLists.txt
+++ b/tests/benchmarks/network/kernel/qhostinfo/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qhostinfo.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qhostinfo Binary:
@@ -7,12 +8,9 @@
qt_internal_add_benchmark(tst_bench_qhostinfo
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Network
Qt::NetworkPrivate
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qhostinfo.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/kernel/qhostinfo/main.cpp b/tests/benchmarks/network/kernel/qhostinfo/main.cpp
index 88112908d5..66e4f52ec2 100644
--- a/tests/benchmarks/network/kernel/qhostinfo/main.cpp
+++ b/tests/benchmarks/network/kernel/qhostinfo/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
#include <QDebug>
diff --git a/tests/benchmarks/network/socket/CMakeLists.txt b/tests/benchmarks/network/socket/CMakeLists.txt
index 7c122a73ef..411a933dbb 100644
--- a/tests/benchmarks/network/socket/CMakeLists.txt
+++ b/tests/benchmarks/network/socket/CMakeLists.txt
@@ -1,5 +1,12 @@
-# Generated from socket.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(QT_FEATURE_localserver)
+ add_subdirectory(qlocalsocket)
+endif()
+
+if(QT_FEATURE_udpsocket)
+ add_subdirectory(qudpsocket)
+endif()
-add_subdirectory(qlocalsocket)
add_subdirectory(qtcpserver)
-add_subdirectory(qudpsocket)
diff --git a/tests/benchmarks/network/socket/qlocalsocket/CMakeLists.txt b/tests/benchmarks/network/socket/qlocalsocket/CMakeLists.txt
index 7c56b0b946..660f2ee5b4 100644
--- a/tests/benchmarks/network/socket/qlocalsocket/CMakeLists.txt
+++ b/tests/benchmarks/network/socket/qlocalsocket/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#####################################################################
## tst_bench_qlocalsocket Binary:
#####################################################################
@@ -5,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qlocalsocket
SOURCES
tst_qlocalsocket.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qlocalsocket.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 86112f442d..a28869f24c 100644
--- a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -1,43 +1,21 @@
-/****************************************************************************
-**
-** Copyright (C) 2021 The Qt Company Ltd.
-** Copyright (C) 2021 Alex Trotsenko <alex1973tr@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) 2021 The Qt Company Ltd.
+// Copyright (C) 2021 Alex Trotsenko <alex1973tr@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
+#include <QtTest/qtesteventloop.h>
+
#include <QtCore/qglobal.h>
#include <QtCore/qthread.h>
#include <QtCore/qsemaphore.h>
#include <QtCore/qbytearray.h>
-#include <QtCore/qeventloop.h>
#include <QtCore/qvector.h>
#include <QtCore/qelapsedtimer.h>
#include <QtNetwork/qlocalsocket.h>
#include <QtNetwork/qlocalserver.h>
+using namespace std::chrono_literals;
+
class tst_QLocalSocket : public QObject
{
Q_OBJECT
@@ -75,7 +53,9 @@ public:
});
});
- QVERIFY(server.listen("foo"));
+ // TODO QTBUG-95136: on failure, remove the socket file and retry.
+ QVERIFY2(server.listen("foo"), qPrintable(server.errorString()));
+
running.release();
exec();
}
@@ -114,6 +94,10 @@ public:
});
socket->connectToServer("foo");
+ QVERIFY2(socket->waitForConnected(), "The system is probably reaching the maximum "
+ "number of open file descriptors. On Unix, "
+ "try to increase the limit with 'ulimit -n 32000' "
+ "and run the test again.");
QCOMPARE(socket->state(), QLocalSocket::ConnectedState);
}
}
@@ -146,7 +130,7 @@ void tst_QLocalSocket::pingPong()
QVERIFY(serverThread.running.tryAcquire(1, 3000));
SocketFactory factory(1, connections);
- QEventLoop eventLoop;
+ QTestEventLoop eventLoop;
QVector<qint64> bytesToRead;
QElapsedTimer timer;
@@ -157,15 +141,20 @@ void tst_QLocalSocket::pingPong()
if (--bytesToRead[channel] == 0 && --connections == 0) {
factory.stopped = true;
- eventLoop.quit();
+ eventLoop.exitLoop();
}
});
timer.start();
emit factory.start();
- eventLoop.exec();
-
- qDebug("Elapsed time: %.1f s", timer.elapsed() / 1000.0);
+ // QtTestLib's Watchdog defaults to 300 seconds; we want to give up before
+ // it bites.
+ eventLoop.enterLoop(290);
+
+ if (eventLoop.timeout())
+ qDebug("Timed out after %.1f s", timer.elapsed() / 1000.0);
+ else if (!QTest::currentTestFailed())
+ qDebug("Elapsed time: %.1f s", timer.elapsed() / 1000.0);
serverThread.quit();
serverThread.wait();
}
@@ -188,7 +177,7 @@ void tst_QLocalSocket::dataExchange()
QFETCH(int, chunkSize);
Q_ASSERT(chunkSize > 0 && connections > 0);
- const qint64 timeToTest = 5000;
+ const auto timeToTest = 5000ms;
ServerThread serverThread(chunkSize);
serverThread.start();
@@ -196,26 +185,26 @@ void tst_QLocalSocket::dataExchange()
QVERIFY(serverThread.running.tryAcquire(1, 3000));
SocketFactory factory(chunkSize, connections);
- QEventLoop eventLoop;
+ QTestEventLoop eventLoop;
qint64 totalReceived = 0;
QElapsedTimer timer;
- connect(&factory, &SocketFactory::bytesReceived,
- [&totalReceived, &timer, timeToTest, &factory, &eventLoop](int channel, qint64 bytes) {
+ connect(&factory, &SocketFactory::bytesReceived, [&](int channel, qint64 bytes) {
Q_UNUSED(channel);
totalReceived += bytes;
- if (timer.elapsed() >= timeToTest) {
+ if (timer.elapsed() >= timeToTest.count()) {
factory.stopped = true;
- eventLoop.quit();
+ eventLoop.exitLoop();
}
});
timer.start();
emit factory.start();
- eventLoop.exec();
+ eventLoop.enterLoop(timeToTest * 2);
- qDebug("Transfer rate: %.1f MB/s", totalReceived / 1048.576 / timer.elapsed());
+ if (!QTest::currentTestFailed())
+ qDebug("Transfer rate: %.1f MB/s", totalReceived / 1048.576 / timer.elapsed());
serverThread.quit();
serverThread.wait();
}
diff --git a/tests/benchmarks/network/socket/qtcpserver/CMakeLists.txt b/tests/benchmarks/network/socket/qtcpserver/CMakeLists.txt
index f566c4f341..ae2f491df0 100644
--- a/tests/benchmarks/network/socket/qtcpserver/CMakeLists.txt
+++ b/tests/benchmarks/network/socket/qtcpserver/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtcpserver.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtcpserver Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qtcpserver
SOURCES
tst_qtcpserver.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qtcpserver.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
index 06643dd1fd..68d60261d5 100644
--- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.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
#include <QTest>
#include <QtCore/QElapsedTimer>
diff --git a/tests/benchmarks/network/socket/qudpsocket/CMakeLists.txt b/tests/benchmarks/network/socket/qudpsocket/CMakeLists.txt
index 02293cdae6..0a39e8fc0c 100644
--- a/tests/benchmarks/network/socket/qudpsocket/CMakeLists.txt
+++ b/tests/benchmarks/network/socket/qudpsocket/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qudpsocket.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qudpsocket Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qudpsocket
SOURCES
tst_qudpsocket.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qudpsocket.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/benchmarks/network/socket/qudpsocket/tst_qudpsocket.cpp
index f2fd297414..d3ef636e74 100644
--- a/tests/benchmarks/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/benchmarks/network/socket/qudpsocket/tst_qudpsocket.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
#include <QTest>
#include <QtCore/qglobal.h>
diff --git a/tests/benchmarks/network/ssl/CMakeLists.txt b/tests/benchmarks/network/ssl/CMakeLists.txt
index bc469359f1..579816e153 100644
--- a/tests/benchmarks/network/ssl/CMakeLists.txt
+++ b/tests/benchmarks/network/ssl/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from ssl.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qsslsocket)
diff --git a/tests/benchmarks/network/ssl/qsslsocket/CMakeLists.txt b/tests/benchmarks/network/ssl/qsslsocket/CMakeLists.txt
index 95bbda6758..70e4448b73 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/CMakeLists.txt
+++ b/tests/benchmarks/network/ssl/qsslsocket/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qsslsocket.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qsslsocket Binary:
@@ -7,10 +8,7 @@
qt_internal_add_benchmark(tst_bench_qsslsocket
SOURCES
tst_qsslsocket.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Network
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:qsslsocket.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 96f6ad87e7..fd5f49863a 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.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
#include <QTest>
diff --git a/tests/benchmarks/plugins/imageformats/jpeg/CMakeLists.txt b/tests/benchmarks/plugins/imageformats/jpeg/CMakeLists.txt
index d0fcd51f4e..814dc124c7 100644
--- a/tests/benchmarks/plugins/imageformats/jpeg/CMakeLists.txt
+++ b/tests/benchmarks/plugins/imageformats/jpeg/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from jpeg.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## jpeg Binary:
@@ -7,11 +8,7 @@
qt_internal_add_benchmark(jpeg
SOURCES
jpeg.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
)
-
-#### Keys ignored in scope 1:.:.:jpeg.pro:<TRUE>:
-# TEMPLATE = "app"
-# TESTDATA = "n900.jpeg"
diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp
index ab5bad733e..d73b2477fa 100644
--- a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp
+++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.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
#include <QDebug>
#include <qtest.h>
diff --git a/tests/benchmarks/sql/CMakeLists.txt b/tests/benchmarks/sql/CMakeLists.txt
index c4d96e338d..6f16384761 100644
--- a/tests/benchmarks/sql/CMakeLists.txt
+++ b/tests/benchmarks/sql/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from sql.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(kernel)
diff --git a/tests/benchmarks/sql/kernel/CMakeLists.txt b/tests/benchmarks/sql/kernel/CMakeLists.txt
index 86108db75d..12681ea5a1 100644
--- a/tests/benchmarks/sql/kernel/CMakeLists.txt
+++ b/tests/benchmarks/sql/kernel/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from kernel.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qsqlquery)
add_subdirectory(qsqlrecord)
diff --git a/tests/benchmarks/sql/kernel/qsqlquery/CMakeLists.txt b/tests/benchmarks/sql/kernel/qsqlquery/CMakeLists.txt
index 977ea673ac..601f2556e1 100644
--- a/tests/benchmarks/sql/kernel/qsqlquery/CMakeLists.txt
+++ b/tests/benchmarks/sql/kernel/qsqlquery/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qsqlquery.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qsqlquery Binary:
@@ -7,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qsqlquery
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Sql
Qt::SqlPrivate
diff --git a/tests/benchmarks/sql/kernel/qsqlquery/main.cpp b/tests/benchmarks/sql/kernel/qsqlquery/main.cpp
index 444b8b0188..5c1bc7b88e 100644
--- a/tests/benchmarks/sql/kernel/qsqlquery/main.cpp
+++ b/tests/benchmarks/sql/kernel/qsqlquery/main.cpp
@@ -1,45 +1,17 @@
-/****************************************************************************
-**
-** 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
#include <QTest>
#include <QtSql/QtSql>
#include "../../../../auto/sql/kernel/qsqldatabase/tst_databases.h"
-const QString qtest(qTableName("qtest", __FILE__, QSqlDatabase()));
-
class tst_QSqlQuery : public QObject
{
Q_OBJECT
public:
- tst_QSqlQuery();
- virtual ~tst_QSqlQuery();
+ using QObject::QObject;
public slots:
void initTestCase();
@@ -55,45 +27,20 @@ private slots:
private:
// returns all database connections
- void generic_data(const QString &engine=QString());
- void dropTestTables( QSqlDatabase db );
- void createTestTables( QSqlDatabase db );
- void populateTestTables( QSqlDatabase db );
+ void generic_data(const QString &engine = QString());
tst_Databases dbs;
};
QTEST_MAIN(tst_QSqlQuery)
-tst_QSqlQuery::tst_QSqlQuery()
-{
-}
-
-tst_QSqlQuery::~tst_QSqlQuery()
-{
-}
-
void tst_QSqlQuery::initTestCase()
{
dbs.open();
-
- for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) {
- QSqlDatabase db = QSqlDatabase::database(( *it ) );
- CHECK_DATABASE( db );
- dropTestTables( db ); //in case of leftovers
- createTestTables( db );
- populateTestTables( db );
- }
}
void tst_QSqlQuery::cleanupTestCase()
{
- for ( QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it ) {
- QSqlDatabase db = QSqlDatabase::database(( *it ) );
- CHECK_DATABASE( db );
- dropTestTables( db );
- }
-
dbs.close();
}
@@ -103,29 +50,11 @@ void tst_QSqlQuery::init()
void tst_QSqlQuery::cleanup()
{
- QFETCH( QString, dbName );
- QSqlDatabase db = QSqlDatabase::database( dbName );
- CHECK_DATABASE( db );
- const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
-
- if ( QTest::currentTestFunction() == QLatin1String( "numRowsAffected" )
- || QTest::currentTestFunction() == QLatin1String( "transactions" )
- || QTest::currentTestFunction() == QLatin1String( "size" )
- || QTest::currentTestFunction() == QLatin1String( "isActive" )
- || QTest::currentTestFunction() == QLatin1String( "lastInsertId" ) ) {
- populateTestTables( db );
- }
-
- if (QTest::currentTestFailed() && (dbType == QSqlDriver::Oracle || db.driverName().startsWith("QODBC"))) {
- //since Oracle ODBC totally craps out on error, we init again
- db.close();
- db.open();
- }
}
-void tst_QSqlQuery::generic_data(const QString& engine)
+void tst_QSqlQuery::generic_data(const QString &engine)
{
- if ( dbs.fillTestTable(engine) == 0 ) {
+ if (dbs.fillTestTable(engine) == 0) {
if (engine.isEmpty())
QSKIP( "No database drivers are available in this Qt configuration");
else
@@ -133,153 +62,48 @@ void tst_QSqlQuery::generic_data(const QString& engine)
}
}
-void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
-{
- QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
- QStringList tablenames;
- // drop all the table in case a testcase failed
- tablenames << qtest
- << qTableName("qtest_null", __FILE__, db)
- << qTableName("qtest_blob", __FILE__, db)
- << qTableName("qtest_bittest", __FILE__, db)
- << qTableName("qtest_nullblob", __FILE__, db)
- << qTableName("qtest_rawtest", __FILE__, db)
- << qTableName("qtest_precision", __FILE__, db)
- << qTableName("qtest_prepare", __FILE__, db)
- << qTableName("qtestj1", __FILE__, db)
- << qTableName("qtestj2", __FILE__, db)
- << qTableName("char1Select", __FILE__, db)
- << qTableName("char1SU", __FILE__, db)
- << qTableName("qxmltest", __FILE__, db)
- << qTableName("qtest_exerr", __FILE__, db)
- << qTableName("qtest_empty", __FILE__, db)
- << qTableName("clobby", __FILE__, db)
- << qTableName("bindtest", __FILE__, db)
- << qTableName("more_results", __FILE__, db)
- << qTableName("blobstest", __FILE__, db)
- << qTableName("oraRowId", __FILE__, db)
- << qTableName("qtest_batch", __FILE__, db)
- << qTableName("bug6421", __FILE__, db).toUpper()
- << qTableName("bug5765", __FILE__, db)
- << qTableName("bug6852", __FILE__, db)
- << qTableName("qtest_lockedtable", __FILE__, db)
- << qTableName("Planet", __FILE__, db)
- << qTableName("task_250026", __FILE__, db)
- << qTableName("task_234422", __FILE__, db)
- << qTableName("test141895", __FILE__, db)
- << qTableName("qtest_oraOCINumber", __FILE__, db);
-
- if (dbType == QSqlDriver::PostgreSQL)
- tablenames << qTableName("task_233829", __FILE__, db);
-
- if (dbType == QSqlDriver::SQLite)
- tablenames << qTableName("record_sqlite", __FILE__, db);
-
- if (dbType == QSqlDriver::MSSqlServer || dbType == QSqlDriver::Oracle)
- tablenames << qTableName("qtest_longstr", __FILE__, db);
-
- if (dbType == QSqlDriver::MSSqlServer)
- db.exec("DROP PROCEDURE " + qTableName("test141895_proc", __FILE__, db));
-
- if (dbType == QSqlDriver::MySqlServer)
- db.exec("DROP PROCEDURE IF EXISTS "+qTableName("bug6852_proc", __FILE__, db));
-
- tst_Databases::safeDropTables( db, tablenames );
-
- if (dbType == QSqlDriver::Oracle) {
- QSqlQuery q( db );
- q.exec("DROP PACKAGE " + qTableName("pkg", __FILE__, db));
- }
-}
-
-void tst_QSqlQuery::createTestTables( QSqlDatabase db )
-{
- const QString qtestNull = qTableName("qtest_null", __FILE__, db);
- QSqlQuery q( db );
- QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
- if (dbType == QSqlDriver::MySqlServer)
- // ### stupid workaround until we find a way to hardcode this
- // in the MySQL server startup script
- q.exec( "set table_type=innodb" );
- else if (dbType == QSqlDriver::PostgreSQL)
- QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
-
- if (dbType == QSqlDriver::PostgreSQL)
- QVERIFY_SQL( q, exec( "create table " + qtest + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) );
- else
- QVERIFY_SQL( q, exec( "create table " + qtest + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) );
-
- if (dbType == QSqlDriver::MSSqlServer || dbType == QSqlDriver::Sybase)
- QVERIFY_SQL(q, exec("create table " + qtestNull + " (id int null, t_varchar varchar(20) null)"));
- else
- QVERIFY_SQL(q, exec("create table " + qtestNull + " (id int, t_varchar varchar(20))"));
-}
-
-void tst_QSqlQuery::populateTestTables( QSqlDatabase db )
-{
- QSqlQuery q( db );
- const QString qtest_null(qTableName("qtest_null", __FILE__, db));
- q.exec( "delete from " + qtest );
- QVERIFY_SQL( q, exec( "insert into " + qtest + " values (1, 'VarChar1', 'Char1')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest + " values (2, 'VarChar2', 'Char2')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest + " values (3, 'VarChar3', 'Char3')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest + " values (4, 'VarChar4', 'Char4')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest + " values (5, 'VarChar5', 'Char5')" ) );
-
- q.exec( "delete from " + qtest_null );
- QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (0, NULL)" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (1, 'n')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (2, 'i')" ) );
- QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (3, NULL)" ) );
-}
-
void tst_QSqlQuery::benchmark()
{
- QFETCH( QString, dbName );
- QSqlDatabase db = QSqlDatabase::database( dbName );
- CHECK_DATABASE( db );
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
QSqlQuery q(db);
- const QString tableName(qTableName("benchmark", __FILE__, db));
-
- tst_Databases::safeDropTable( db, tableName );
+ TableScope ts(db, "benchmark", __FILE__);
- QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n"
+ QVERIFY_SQL(q, exec("CREATE TABLE " + ts.tableName() + "(\n"
"MainKey INT NOT NULL,\n"
"OtherTextCol VARCHAR(45) NOT NULL,\n"
- "PRIMARY KEY(`MainKey`))"));
+ "PRIMARY KEY(MainKey))"));
int i=1;
QBENCHMARK {
- QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES("+QString::number(i)+", \"Value"+QString::number(i)+"\")"));
+ const QString num = QString::number(i);
+ QVERIFY_SQL(q, exec("INSERT INTO " + ts.tableName() + " VALUES(" + num + ", 'Value" + num + "')"));
i++;
}
-
- tst_Databases::safeDropTable( db, tableName );
}
void tst_QSqlQuery::benchmarkSelectPrepared()
{
- QFETCH( QString, dbName );
+ QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
QSqlQuery q(db);
- const QString tableName(qTableName("benchmark", __FILE__, db));
+ TableScope ts(db, "benchmark", __FILE__);
- tst_Databases::safeDropTable(db, tableName);
-
- QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + "(id INT NOT NULL)"));
+ QVERIFY_SQL(q, exec("CREATE TABLE " + ts.tableName() + "(id INT NOT NULL)"));
const int NUM_ROWS = 1000;
int expectedSum = 0;
- QString fillQuery = "INSERT INTO " + tableName + " VALUES (0)";
+ QString fillQuery = "INSERT INTO " + ts.tableName() + " VALUES (0)";
for (int i = 1; i < NUM_ROWS; ++i) {
fillQuery += ", (" + QString::number(i) + QLatin1Char(')');
expectedSum += i;
}
QVERIFY_SQL(q, exec(fillQuery));
- QVERIFY_SQL(q, prepare("SELECT id FROM "+tableName));
+ QVERIFY_SQL(q, prepare("SELECT id FROM " + ts.tableName()));
QBENCHMARK {
QVERIFY_SQL(q, exec());
int sum = 0;
@@ -289,8 +113,6 @@ void tst_QSqlQuery::benchmarkSelectPrepared()
QCOMPARE(sum, expectedSum);
}
-
- tst_Databases::safeDropTable(db, tableName);
}
#include "main.moc"
diff --git a/tests/benchmarks/sql/kernel/qsqlrecord/CMakeLists.txt b/tests/benchmarks/sql/kernel/qsqlrecord/CMakeLists.txt
index ac42589146..11a3f6bcc3 100644
--- a/tests/benchmarks/sql/kernel/qsqlrecord/CMakeLists.txt
+++ b/tests/benchmarks/sql/kernel/qsqlrecord/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qsqlrecord.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qsqlrecord Binary:
@@ -6,8 +7,8 @@
qt_internal_add_benchmark(tst_bench_qsqlrecord
SOURCES
- tst_qsqlrecord.cpp
- PUBLIC_LIBRARIES
+ tst_bench_qsqlrecord.cpp
+ LIBRARIES
Qt::CorePrivate
Qt::Sql
Qt::SqlPrivate
diff --git a/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp b/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp
new file mode 100644
index 0000000000..55ec1983ee
--- /dev/null
+++ b/tests/benchmarks/sql/kernel/qsqlrecord/tst_bench_qsqlrecord.cpp
@@ -0,0 +1,110 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QTest>
+#include <QtSql/QtSql>
+
+#include "../../../../auto/sql/kernel/qsqldatabase/tst_databases.h"
+
+class tst_QSqlRecord : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void cleanup();
+
+private slots:
+ void benchmarkRecord_data() { generic_data(); }
+ void benchmarkRecord();
+ void benchFieldName_data() { generic_data("QPSQL"); }
+ void benchFieldName();
+ void benchFieldIndex_data() { generic_data("QPSQL"); }
+ void benchFieldIndex();
+
+private:
+ void generic_data(const QString &engine = QString());
+
+ tst_Databases dbs;
+};
+
+QTEST_MAIN(tst_QSqlRecord)
+
+void tst_QSqlRecord::initTestCase()
+{
+ dbs.open();
+}
+
+void tst_QSqlRecord::cleanupTestCase()
+{
+ dbs.close();
+}
+
+void tst_QSqlRecord::cleanup()
+{
+}
+
+void tst_QSqlRecord::generic_data(const QString &engine)
+{
+ if (dbs.fillTestTable(engine) == 0) {
+ if (engine.isEmpty())
+ QSKIP("No database drivers are available in this Qt configuration");
+ else
+ QSKIP(QString("No database drivers of type %1 are available in this Qt configuration").arg(engine).toLocal8Bit());
+ }
+}
+
+void tst_QSqlRecord::benchmarkRecord()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ TableScope ts(db, "record", __FILE__);
+ {
+ QSqlQuery qry(db);
+ QVERIFY_SQL(qry, exec("create table " + ts.tableName() +
+ " (id int NOT NULL, t_varchar varchar(20), "
+ "t_char char(20), primary key(id))"));
+ // Limit to 500: at 600, the set-up takes nearly 5 minutes
+ for (int i = 0; i < 500; i++)
+ QVERIFY_SQL(qry, exec(QString("INSERT INTO " + ts.tableName() +
+ " VALUES (%1, 'VarChar%1', 'Char%1')").arg(i)));
+ QVERIFY_SQL(qry, exec(QString("SELECT * from ") + ts.tableName()));
+ QBENCHMARK {
+ while (qry.next())
+ qry.record();
+ QVERIFY(qry.seek(0));
+ }
+ }
+}
+
+void tst_QSqlRecord::benchFieldName()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ QCOMPARE(tst_Databases::getDatabaseType(db), QSqlDriver::PostgreSQL);
+ QSqlQuery qry(db);
+ QVERIFY_SQL(qry, exec("SELECT GENERATE_SERIES(1,5000) AS r"));
+ QBENCHMARK {
+ while (qry.next())
+ qry.value("r");
+ QVERIFY(qry.seek(0));
+ }
+}
+
+void tst_QSqlRecord::benchFieldIndex()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ QCOMPARE(tst_Databases::getDatabaseType(db), QSqlDriver::PostgreSQL);
+ QSqlQuery qry(db);
+ QVERIFY_SQL(qry, exec("SELECT GENERATE_SERIES(1,5000) AS r"));
+ QBENCHMARK {
+ while (qry.next())
+ qry.value(0);
+ QVERIFY(qry.seek(0));
+ }
+}
+
+#include "tst_bench_qsqlrecord.moc"
diff --git a/tests/benchmarks/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/benchmarks/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
deleted file mode 100644
index 2973070872..0000000000
--- a/tests/benchmarks/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
- **
- ** 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$
- **
- ****************************************************************************/
-
-#include <QTest>
-#include <QtSql/QtSql>
-
-#include "../../../../auto/sql/kernel/qsqldatabase/tst_databases.h"
-
-const QString qtest(qTableName("qtest", __FILE__, QSqlDatabase()));
-
-class tst_QSqlRecord : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QSqlRecord();
- virtual ~tst_QSqlRecord();
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void benchmarkRecord_data() { generic_data(); }
- void benchmarkRecord();
- void benchFieldName_data() { generic_data(); }
- void benchFieldName();
- void benchFieldIndex_data() { generic_data(); }
- void benchFieldIndex();
-
-private:
- void generic_data(const QString &engine = QString());
- void dropTestTables(QSqlDatabase db);
- void createTestTables(QSqlDatabase db);
- void populateTestTables(QSqlDatabase db);
-
- tst_Databases dbs;
-};
-
-QTEST_MAIN(tst_QSqlRecord)
-
-tst_QSqlRecord::tst_QSqlRecord()
-{
-}
-
-tst_QSqlRecord::~tst_QSqlRecord()
-{
-}
-
-void tst_QSqlRecord::initTestCase()
-{
- dbs.open();
- for (const auto &dbName : qAsConst(dbs.dbNames)) {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- dropTestTables(db); // In case of leftovers
- createTestTables(db);
- populateTestTables(db);
- }
-}
-
-void tst_QSqlRecord::cleanupTestCase()
-{
- for (const auto &dbName : qAsConst(dbs.dbNames)) {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- dropTestTables(db);
- }
- dbs.close();
-}
-
-void tst_QSqlRecord::init()
-{
-}
-
-void tst_QSqlRecord::cleanup()
-{
- QFETCH(QString, dbName);
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
-
- if (QTest::currentTestFailed() && (dbType == QSqlDriver::Oracle ||
- db.driverName().startsWith("QODBC"))) {
- // Since Oracle ODBC has a problem when encountering an error, we init again
- db.close();
- db.open();
- }
-}
-
-void tst_QSqlRecord::generic_data(const QString &engine)
-{
- if (dbs.fillTestTable(engine) == 0) {
- if (engine.isEmpty())
- QSKIP("No database drivers are available in this Qt configuration");
- else
- QSKIP(QString("No database drivers of type %1 are available in this Qt configuration").arg(engine).toLocal8Bit());
- }
-}
-
-void tst_QSqlRecord::dropTestTables(QSqlDatabase db)
-{
- QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
- QStringList tablenames;
- // drop all the tables in case a testcase failed
- tablenames << qtest
- << qTableName("record", __FILE__, db);
- tst_Databases::safeDropTables(db, tablenames);
-
- if (dbType == QSqlDriver::Oracle) {
- QSqlQuery q(db);
- q.exec("DROP PACKAGE " + qTableName("pkg", __FILE__, db));
- }
-}
-
-void tst_QSqlRecord::createTestTables(QSqlDatabase db)
-{
- QSqlQuery q(db);
- switch (tst_Databases::getDatabaseType(db)) {
- case QSqlDriver::PostgreSQL:
- QVERIFY_SQL(q, exec("set client_min_messages='warning'"));
- QVERIFY_SQL(q, exec("create table " + qtest + " (id serial NOT NULL, t_varchar varchar(20), "
- "t_char char(20), primary key(id)) WITH OIDS"));
- break;
- case QSqlDriver::MySqlServer:
- QVERIFY_SQL(q, exec("set table_type=innodb"));
- Q_FALLTHROUGH();
- default:
- QVERIFY_SQL(q, exec("create table " + qtest + " (id int " + tst_Databases::autoFieldName(db) +
- " NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))"));
- break;
- }
-}
-
-void tst_QSqlRecord::populateTestTables(QSqlDatabase db)
-{
- QSqlQuery q(db);
- QVERIFY_SQL(q, exec("delete from " + qtest));
- QVERIFY_SQL(q, exec("insert into " + qtest + " values (1, 'VarChar1', 'Char1')"));
- QVERIFY_SQL(q, exec("insert into " + qtest + " values (2, 'VarChar2', 'Char2')"));
- QVERIFY_SQL(q, exec("insert into " + qtest + " values (3, 'VarChar3', 'Char3')"));
- QVERIFY_SQL(q, exec("insert into " + qtest + " values (4, 'VarChar4', 'Char4')"));
- QVERIFY_SQL(q, exec("insert into " + qtest + " values (5, 'VarChar5', 'Char5')"));
-}
-
-void tst_QSqlRecord::benchmarkRecord()
-{
- QFETCH(QString, dbName);
- QSqlDatabase db = QSqlDatabase::database(dbName);
- CHECK_DATABASE(db);
- const auto tableName = qTableName("record", __FILE__, db);
- {
- QSqlQuery qry(db);
- QVERIFY_SQL(qry, exec("create table " + tableName + " (id int NOT NULL, t_varchar varchar(20), "
- "t_char char(20), primary key(id))"));
- for (int i = 0; i < 1000; i++)
- QVERIFY_SQL(qry, exec(QString("INSERT INTO " + tableName +
- " VALUES (%1, 'VarChar%1', 'Char%1')").arg(i)));
- QVERIFY_SQL(qry, exec(QString("SELECT * from ") + tableName));
- QBENCHMARK {
- while (qry.next())
- qry.record();
- }
- }
- tst_Databases::safeDropTables(db, QStringList() << tableName);
-}
-
-void tst_QSqlRecord::benchFieldName()
-{
- QFETCH(QString, dbName);
- QSqlDatabase db = QSqlDatabase::database(dbName);
- if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) {
- QSqlQuery qry(db);
- QVERIFY_SQL(qry, exec("SELECT GENERATE_SERIES(1,5000) AS r"));
- QBENCHMARK {
- while (qry.next())
- qry.value("r");
- }
- }
-}
-
-void tst_QSqlRecord::benchFieldIndex()
-{
- QFETCH(QString, dbName);
- QSqlDatabase db = QSqlDatabase::database(dbName);
- if (tst_Databases::getDatabaseType(db) == QSqlDriver::PostgreSQL) {
- QSqlQuery qry(db);
- QVERIFY_SQL(qry, exec("SELECT GENERATE_SERIES(1,5000) AS r"));
- qry = db.exec("SELECT GENERATE_SERIES(1,5000) AS r");
- QBENCHMARK {
- while (qry.next())
- qry.value(0);
- }
- }
-}
-
-#include "tst_qsqlrecord.moc"
diff --git a/tests/benchmarks/testlib/CMakeLists.txt b/tests/benchmarks/testlib/CMakeLists.txt
index e7bd29b564..a1891b447d 100644
--- a/tests/benchmarks/testlib/CMakeLists.txt
+++ b/tests/benchmarks/testlib/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from testlib.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(tostring)
diff --git a/tests/benchmarks/testlib/tostring/CMakeLists.txt b/tests/benchmarks/testlib/tostring/CMakeLists.txt
index 161fae4c01..e9484ce9b4 100644
--- a/tests/benchmarks/testlib/tostring/CMakeLists.txt
+++ b/tests/benchmarks/testlib/tostring/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from tostring.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_tostring Binary:
@@ -7,6 +8,6 @@
qt_internal_add_benchmark(tst_bench_tostring
SOURCES
tst_tostring.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Test
)
diff --git a/tests/benchmarks/testlib/tostring/tst_tostring.cpp b/tests/benchmarks/testlib/tostring/tst_tostring.cpp
index 03455748f4..e00b12ef53 100644
--- a/tests/benchmarks/testlib/tostring/tst_tostring.cpp
+++ b/tests/benchmarks/testlib/tostring/tst_tostring.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
#include <QTest>
#include <QtCore/qmath.h> // pi, e
@@ -50,6 +25,36 @@ private slots:
void quint64Tst() { numeric<quint64>(); }
void qint64Tst_data() { numeric_data<qint64>(); }
void qint64Tst() { numeric<qint64>(); }
+
+private:
+ template <typename T> void compare();
+ template <typename T> void compare_eq();
+
+private slots:
+ void floatCompare_data() { numeric_data<float>(); }
+ void floatCompare() { compare<float>(); }
+ void floatCompareEq_data() { numeric_data<float>(); }
+ void floatCompareEq() { compare_eq<float>(); }
+ void doubleCompare_data() { numeric_data<double>(); }
+ void doubleCompare() { compare<double>(); }
+ void doubleCompareEq_data() { numeric_data<double>(); }
+ void doubleCompareEq() { compare_eq<double>(); }
+ void intCompare_data() { numeric_data<int>(); }
+ void intCompare() { compare<int>(); }
+ void intCompareEq_data() { numeric_data<int>(); }
+ void intCompareEq() { compare_eq<int>(); }
+ void unsignedCompare_data() { numeric_data<unsigned>(); }
+ void unsignedCompare() { compare<unsigned>(); }
+ void unsignedCompareEq_data() { numeric_data<unsigned>(); }
+ void unsignedCompareEq() { compare_eq<unsigned>(); }
+ void quint64Compare_data() { numeric_data<quint64>(); }
+ void quint64Compare() { compare<quint64>(); }
+ void quint64CompareEq_data() { numeric_data<quint64>(); }
+ void quint64CompareEq() { compare_eq<quint64>(); }
+ void qint64Compare_data() { numeric_data<qint64>(); }
+ void qint64Compare() { compare<qint64>(); }
+ void qint64CompareEq_data() { numeric_data<qint64>(); }
+ void qint64CompareEq() { compare_eq<qint64>(); }
};
template <typename T>
@@ -95,10 +100,35 @@ void tst_toString::numeric()
QFETCH(T, datum);
QBENCHMARK {
- auto tst = QTest::toString<T>(datum);
+ auto tst = QTest::toString(datum);
delete [] tst;
}
}
+template <typename T>
+void tst_toString::compare()
+{
+ QFETCH(T, datum);
+
+ QBENCHMARK {
+ QCOMPARE(datum, datum);
+ }
+}
+
+template <typename T>
+void tst_toString::compare_eq()
+{
+ QFETCH(T, datum);
+
+ if constexpr (std::numeric_limits<T>::has_quiet_NaN) {
+ if (qIsNaN(datum))
+ QSKIP("Unlike QCOMPARE, QCOMPARE_EQ doesn't handle NaN specially");
+ }
+
+ QBENCHMARK {
+ QCOMPARE_EQ(datum, datum);
+ }
+}
+
QTEST_MAIN(tst_toString)
#include "tst_tostring.moc"
diff --git a/tests/benchmarks/widgets/CMakeLists.txt b/tests/benchmarks/widgets/CMakeLists.txt
index bf543e664d..afea392472 100644
--- a/tests/benchmarks/widgets/CMakeLists.txt
+++ b/tests/benchmarks/widgets/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from widgets.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(graphicsview)
add_subdirectory(itemviews)
diff --git a/tests/benchmarks/widgets/graphicsview/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/CMakeLists.txt
index 3928328a98..bcb905aa1b 100644
--- a/tests/benchmarks/widgets/graphicsview/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from graphicsview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(functional)
add_subdirectory(qgraphicsanchorlayout)
diff --git a/tests/benchmarks/widgets/graphicsview/functional/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/functional/CMakeLists.txt
index 20e4286a6e..8b13789179 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/functional/CMakeLists.txt
@@ -1,2 +1 @@
-# Generated from functional.pro.
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/CMakeLists.txt
index 491b7fc6d1..c7b18103a5 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from GraphicsViewBenchmark.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_GraphicsViewBenchmark Binary:
@@ -38,7 +39,7 @@ qt_internal_add_benchmark(tst_GraphicsViewBenchmark
widgets/topbar.cpp widgets/topbar.h
INCLUDE_DIRECTORIES
widgets
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Svg
Qt::Test
@@ -354,15 +355,11 @@ qt_internal_add_resource(tst_GraphicsViewBenchmark "GraphicsViewBenchmark3"
${GraphicsViewBenchmark3_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:GraphicsViewBenchmark.pro:<TRUE>:
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
qt_internal_extend_target(tst_GraphicsViewBenchmark CONDITION TARGET Qt::OpenGL
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::OpenGL
Qt::OpenGLWidgets
)
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc
deleted file mode 100644
index 18ae04dd69..0000000000
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc
+++ /dev/null
@@ -1,85 +0,0 @@
-<RCC>
- <qresource prefix="/themes/blue">
- <file alias="background.svg">resources/blue_SVG/blue_background_360x640px.svg</file>
- <file alias="background_horisontal.svg">resources/blue_SVG/blue_background_horisontal_640x360px.svg</file>
- <file alias="contact_default_icon.svg">resources/blue_SVG/blue_contact_default_icon_52x52px.svg</file>
- <file alias="contact_list_divider.svg">resources/blue_SVG/blue_contact_list_divider_360x76px.svg</file>
- <file alias="contact_list_highlighter.svg">resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg</file>
- <file alias="contact_status_idle.svg">resources/blue_SVG/blue_contact_status_idle_33x33px.svg</file>
- <file alias="contact_status_offline.svg">resources/blue_SVG/blue_contact_status_offline_33x33px.svg</file>
- <file alias="contact_status_online.svg">resources/blue_SVG/blue_contact_status_online_33x33px.svg</file>
- <file alias="scrollbar.svg">resources/blue_SVG/blue_scrollbar_7x14px.svg</file>
- <file alias="scroll.svg">resources/blue_SVG/blue_scroll_16x80px.svg</file>
- <file alias="status_field_left.svg">resources/blue_SVG/blue_status_field_left_14x24px.svg</file>
- <file alias="status_field_middle.svg">resources/blue_SVG/blue_status_field_middle_14x24px.svg</file>
- <file alias="status_field_right.svg">resources/blue_SVG/blue_status_field_right_14x24px.svg</file>
- <file alias="topbar.svg">resources/blue_SVG/blue_topbar_356x96px.svg</file>
- <file alias="topbar_horisontal.svg">resources/blue_SVG/blue_topbar_horisontal_636x96px.svg</file>
- <file alias="user_default_icon.svg">resources/blue_SVG/blue_user_default_icon_68x68px.svg</file>
- <file alias="user_status_idle.svg">resources/blue_SVG/blue_user_status_idle_38x38px.svg</file>
- <file alias="user_status_offline.svg">resources/blue_SVG/blue_user_status_offline_38x38px.svg</file>
- <file alias="user_status_online.svg">resources/blue_SVG/blue_user_status_online_38x38px.svg</file>
- </qresource>
-
- <qresource prefix="/themes/lime">
- <file alias="background.svg">resources/lime_SVG/lime_background_360x640px.svg</file>
- <file alias="background_horisontal.svg">resources/lime_SVG/lime_background_horisontal_640x360px.svg</file>
- <file alias="contact_default_icon.svg">resources/lime_SVG/lime_contact_default_icon_53x53px.svg</file>
- <file alias="contact_default_icon_highlight.svg">resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg</file>
- <file alias="contact_list_divider.svg">resources/lime_SVG/lime_contact_list_divider_360x76px.svg</file>
- <file alias="contact_list_highlighter.svg">resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg</file>
- <file alias="contact_status_idle.svg">resources/blue_SVG/blue_contact_status_idle_33x33px.svg</file>
- <file alias="contact_status_offline.svg">resources/blue_SVG/blue_contact_status_offline_33x33px.svg</file>
- <file alias="contact_status_online.svg">resources/blue_SVG/blue_contact_status_online_33x33px.svg</file>
- <file alias="scrollbar.svg">resources/lime_SVG/lime_scrollbar_5x14px.svg</file>
- <file alias="scroll.svg">resources/lime_SVG/lime_scroll_5x80px.svg</file>
- <file alias="status_field_left.svg">resources/lime_SVG/lime_status_field_left_14x24px.svg</file>
- <file alias="status_field_middle.svg">resources/lime_SVG/lime_status_field_middle_10x24px.svg</file>
- <file alias="status_field_right.svg">resources/lime_SVG/lime_status_field_right_14x24px.svg</file>
- <file alias="topbar.svg">resources/lime_SVG/lime_topbar_356x96px.svg</file>
- <file alias="topbar_horisontal.svg">resources/lime_SVG/lime_topbar_horisontal_636x96px.svg</file>
- <file alias="user_default_icon.svg">resources/lime_SVG/lime_user_default_icon_84x68px.svg</file>
- <file alias="user_status_idle.svg">resources/lime_SVG/lime_user_status_idle_24x24px.svg</file>
- <file alias="user_status_offline.svg">resources/lime_SVG/lime_user_status_offline_24x24px.svg</file>
- <file alias="user_status_online.svg">resources/lime_SVG/lime_user_status_online_24x24px.svg</file>
- </qresource>
-
- <qresource prefix="/avatars">
- <file alias="avatar_001.png">resources/avatars/avatar_man_001_58x58.png</file>
- <file alias="avatar_002.png">resources/avatars/avatar_man_002_58x58.png</file>
- <file alias="avatar_003.png">resources/avatars/avatar_man_003_58x58.png</file>
- <file alias="avatar_004.png">resources/avatars/avatar_man_004_58x58.png</file>
- <file alias="avatar_005.png">resources/avatars/avatar_man_005_58x58.png</file>
- <file alias="avatar_006.png">resources/avatars/avatar_man_006_58x58.png</file>
- <file alias="avatar_007.png">resources/avatars/avatar_man_007_58x58.png</file>
- <file alias="avatar_008.png">resources/avatars/avatar_man_008_58x58.png</file>
- <file alias="avatar_009.png">resources/avatars/avatar_man_009_58x58.png</file>
- <file alias="avatar_010.png">resources/avatars/avatar_man_010_58x58.png</file>
-
- <file alias="avatar_011.png">resources/avatars/avatar_picture_001_58x58.png</file>
- <file alias="avatar_012.png">resources/avatars/avatar_picture_002_58x58.png</file>
- <file alias="avatar_013.png">resources/avatars/avatar_picture_003_58x58.png</file>
- <file alias="avatar_014.png">resources/avatars/avatar_picture_004_58x58.png</file>
- <file alias="avatar_015.png">resources/avatars/avatar_picture_005_58x58.png</file>
-
- <file alias="avatar_016.png">resources/avatars/avatar_woman_001_58x58.png</file>
- <file alias="avatar_017.png">resources/avatars/avatar_woman_002_58x58.png</file>
- <file alias="avatar_018.png">resources/avatars/avatar_woman_003_58x58.png</file>
- <file alias="avatar_019.png">resources/avatars/avatar_woman_004_58x58.png</file>
- <file alias="avatar_020.png">resources/avatars/avatar_woman_005_58x58.png</file>
- <file alias="avatar_021.png">resources/avatars/avatar_woman_006_58x58.png</file>
- <file alias="avatar_022.png">resources/avatars/avatar_woman_007_58x58.png</file>
- <file alias="avatar_023.png">resources/avatars/avatar_woman_008_58x58.png</file>
- <file alias="avatar_024.png">resources/avatars/avatar_woman_009_58x58.png</file>
- <file alias="avatar_025.png">resources/avatars/avatar_woman_010_58x58.png</file>
- </qresource>
-
- <qresource prefix="/contact">
- <file alias="areacodes.txt">resources/contacts/areacodes.txt</file>
- <file alias="firstnamesF.txt">resources/contacts/firstnamesF.txt</file>
- <file alias="firstnamesM.txt">resources/contacts/firstnamesM.txt</file>
- <file alias="lastnames.txt">resources/contacts/lastnames.txt</file>
- </qresource>
-
-</RCC>
-
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp
index 8463354af3..fa47ca9fa6 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/main.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/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
#include <QTest>
@@ -566,23 +541,11 @@ void tst_GraphicsViewBenchmark::update_data()
QTest::addColumn<bool>("subtreeCache");
QTest::addColumn<int>("rotationAngle");
- QList<ListType> listTypes;
- listTypes << Simple << Recycling;
-
- QList<int> listSizes;
- listSizes << 10 << 50 << 500;
-
- QList<Theme::Themes> themes;
- themes << Theme::Blue << Theme::Lime;
-
- QList<int> rotationAngles;
- rotationAngles << 0 << 90;
-
// Generate rows:
- foreach (ListType listType, listTypes) {
- foreach (int listSize, listSizes) {
- foreach (int angle, rotationAngles) {
- foreach (Theme::Themes theme, themes) {
+ for (ListType listType : {Simple, Recycling}) {
+ for (int listSize : {10, 50, 500}) {
+ for (int angle : {0, 90}) {
+ for (Theme::Themes theme : {Theme::Blue, Theme::Lime}) {
for (int toImage = 0; toImage < 2; ++toImage) {
for (int cache = 0; cache < 2; ++cache) {
QString string = rowString(listSize, listType, theme, toImage, cache, angle);
@@ -638,27 +601,12 @@ void tst_GraphicsViewBenchmark::scroll_data()
QTest::addColumn<int>("rotationAngle");
QTest::addColumn<ScrollStep>("scrollStep");
- QList<ListType> listTypes;
- listTypes << Simple << Recycling;
-
- QList<int> listSizes;
- listSizes << 10 << 50 << 500;
-
- QList<Theme::Themes> themes;
- themes << Theme::Blue << Theme::Lime;
-
- QList<int> rotationAngles;
- rotationAngles << 0 << 90;
-
- QList<ScrollStep> scrollSteps;
- scrollSteps << Slow << Normal << Fast;
-
// Generate rows:
- foreach (ListType listType, listTypes) {
- foreach (int listSize, listSizes) {
- foreach (int angle, rotationAngles) {
- foreach (ScrollStep step, scrollSteps) {
- foreach (Theme::Themes theme, themes) {
+ for (ListType listType : {Simple, Recycling}) {
+ for (int listSize : {10, 50, 500}) {
+ for (int angle : {0, 90}) {
+ for (ScrollStep step : {Slow, Normal, Fast}) {
+ for (Theme::Themes theme : {Theme::Blue, Theme::Lime}) {
for (int cache = 0; cache < 2; ++cache) {
QString string = rowString(listSize, listType, theme, cache, angle, step);
QTest::newRow(string.toLatin1()) << listSize << listType << theme
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp
index 00481a638d..9cf6ffcaa2 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QGraphicsLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h
index 7373f66deb..d3d1b334f4 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ABSTRACTITEMCONTAINER_H
#define ABSTRACTITEMCONTAINER_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp
index e5214b51fb..87350f6b62 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsLayout>
#include "abstractitemview.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h
index 80c3b3b943..6242c9647b 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ABSTRACTITEMVIEW_H
#define ABSTRACTITEMVIEW_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp
index e4588cc1d1..c390550cb9 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsSceneResizeEvent>
#include <QGraphicsWidget>
@@ -115,9 +90,9 @@ void AbstractScrollArea::setViewport(QGraphicsWidget *viewport)
if (m_viewport) {
m_viewport->setParentItem(0);
- QList<QGraphicsItem*> children = m_viewport->childItems();
+ const QList<QGraphicsItem*> children = m_viewport->childItems();
- foreach (QGraphicsItem *child, children)
+ for (QGraphicsItem *child : children)
child->setParentItem(0);
delete m_viewport;
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h
index 4c530b2059..0fefcfe271 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ABSTRACTSCROLLAREA_H
#define ABSTRACTSCROLLAREA_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp
index dbd7c40c35..b12cf4c81a 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "abstractviewitem.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h
index 423ed4f654..c85ad3d203 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ABSTRACTVIEWITEM_H
#define ABSTRACTVIEWITEM_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp
index 1b928ab908..16eeb25467 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QStyleOptionGraphicsItem>
#include <QGraphicsSceneResizeEvent>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h
index 0cb0ee778c..ba961e2792 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __BACKGROUNDITEM_H__
#define __BACKGROUNDITEM_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp
index 98bf9f8521..d9d6e48f99 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "button.h"
#include "theme.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h
index 8e76b88463..0c117d2c81 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef BUTTON_H
#define BUTTON_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp
index 226c60cec8..492eb95628 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QStringList>
#include <QDebug>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h
index eaddeac59d..59be7e87f1 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef COMMANDLINE_H
#define COMMANDLINE_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp
index 7809b38050..19cbb62770 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QFile>
#include <QRandomGenerator>
@@ -123,5 +98,5 @@ QString DummyDataGenerator::randomStatusItem()
case 1: return Theme::p()->pixmapPath() + "contact_status_offline.svg";
case 2: return Theme::p()->pixmapPath() + "contact_status_idle.svg";
}
- return 0;
+ return {};
}
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h
index bcb9681d5d..114380c264 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __DUMMYDATAGEN_H__
#define __DUMMYDATAGEN_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp
index 93285c0723..efa35db679 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QtGui>
#include "gvbwidget.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h
index f9f0a9a2cd..54d7cac5a5 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef GVBWIDGET_H
#define GVBWIDGET_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp
index a081e1b064..088f517105 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QtGui>
#include <QSvgRenderer>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h
index a2dc81e4f5..53bcce2466 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ICONITEM_H
#define ICONITEM_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp
index 0aa73b9e26..3e9669cd44 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QElapsedTimer>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h
index 15969a6e09..7dc6b3e224 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ITEMRECYCLINGLIST_H
#define ITEMRECYCLINGLIST_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp
index 5aa93256ff..7406c37677 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "itemrecyclinglistview.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h
index 28c5c0acb0..b7ab0f3004 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef ITEMRECYCLINGLISTVIEW_H
#define ITEMRECYCLINGLISTVIEW_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp
index 5fb2ee1a51..c09043df93 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QtGui>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h
index 1ecbe8ae49..6d6705027e 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef TEXTITEM_H
#define TEXTITEM_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp
index 1872bcc9d3..6c11effa28 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QGraphicsGridLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h
index db08e948b0..01c1d61ea4 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef LISTITEM_H
#define LISTITEM_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp
index 0e4520d0a8..ed8943aa7b 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsItem>
#include <QPainter>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h
index ba35023bbc..0827ae1cea 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef LISTITEMCACHE_H
#define LISTITEMCACHE_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp
index 496919214d..5815dfa103 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <qmath.h>
#include <QGraphicsLinearLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h
index 62c9450c38..6c03a9e116 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef LISTITEMCONTAINER_H
#define LISTITEMCONTAINER_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp
index 1aa2cfa1ea..eb10745328 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "listmodel.h"
#include "recycledlistitem.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h
index d58db8de41..b6fdbcb837 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef LISTMODEL_H
#define LISTMODEL_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp
index 6e09a09d81..fbb82777b9 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsSceneResizeEvent>
#include <QGraphicsGridLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h
index a1120d1871..cbd23ca19a 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef LISTWIDGET_H
#define LISTWIDGET_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
index d8e778f151..1f92107729 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QApplication>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h
index 23043136f3..d2ff03f039 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __MAINWINDOW_H__
#define __MAINWINDOW_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp
index 1cc75d569b..8c2ff7b7ce 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsView>
#include <QGraphicsWidget>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h
index 074d5b9d95..fd50fe5039 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __MENU_H__
#define __MENU_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp
index c0aed25abb..a457b69be9 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsGridLayout>
#include <QDebug>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h
index 021a8b8902..82dd304b38 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef RECYCLEDLISTITEM_H
#define RECYCLEDLISTITEM_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h
index b03f09048a..6d58d139bb 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __RESOURCEMONINTERFACE_H__
#define __RESOURCEMONINTERFACE_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp
index 81f123e2b7..3361c1e1c0 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsWidget>
#include <QPainter>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h
index 966052676c..9abd5d264b 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SCROLLBAR_H
#define SCROLLBAR_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp
index 203ea7e046..241d752365 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QScrollBar>
#include <QEvent>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h
index d81db64d5e..db9c47d838 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SCROLLER_H
#define SCROLLER_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h
index c8769f59b2..c18f4069e3 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SCROLLER_P_H
#define SCROLLER_P_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp
index 9cb44882a6..4b0adffe5c 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "settings.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h
index dc228162c4..da961493ad 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SETTINGS_H
#define SETTINGS_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp
index d64f3ac38d..0020e2491d 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QGraphicsLinearLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h
index 3c1ec4f82a..ef29d5c855 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SIMPLELIST_H_
#define SIMPLELIST_H_
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp
index b1467238f8..3de5554e61 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "simplelistview.h"
#include "scrollbar.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h
index 34eb7594ad..32ed0af937 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef SIMPLELISTVIEW_H
#define SIMPLELISTVIEW_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp
index 06851b0fd8..8de0b612df 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QDebug>
#include <QPainter>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h
index 1e5cd8ad3b..b78a9033f9 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef THEME_H
#define THEME_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
index 1209b4a0f7..4df67b63bf 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include "themeevent.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
index 4ae63d8755..4b06f54267 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __THEMEEVENT_H__
#define __THEMEEVENT_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp
index 7c3d97b859..ece0cfa66f 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#include <QGraphicsView>
#include <QStyleOptionGraphicsItem>
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h
index 53750ca706..152b4ba2b6 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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
#ifndef __TOPBAR_H__
#define __TOPBAR_H__
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp
index d09bd43214..c3c14a6362 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.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
#include "webview.h"
#include "webview_p.h"
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.h
index d5d32f146f..8eafb65048 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.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
#ifndef WEBVIEW_H
#define WEBVIEW_H
diff --git a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h
index 98817e6762..f0c87e5a0f 100644
--- a/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h
+++ b/tests/benchmarks/widgets/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.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
#ifndef WEBVIEW_P_H
#define WEBVIEW_P_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/CMakeLists.txt
index eca0a60d0d..53c5068d7b 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicsanchorlayout.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicsanchorlayout Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qgraphicsanchorlayout
SOURCES
tst_qgraphicsanchorlayout.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qgraphicsanchorlayout.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 7e86e96830..d65246a568 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.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
#include <QTest>
#include <QtWidgets/qgraphicsanchorlayout.h>
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/CMakeLists.txt
index e5d19ceb24..0ab35585fb 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicsitem.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicsitem Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qgraphicsitem
SOURCES
tst_qgraphicsitem.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qgraphicsitem.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 56b34fff2a..7556864ded 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.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 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
#include <qtest.h>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsView>
+#include <QTextDocument>
class tst_QGraphicsItem : public QObject
{
@@ -57,6 +33,8 @@ private slots:
void scale();
void shear();
void translate();
+ void createTextItem();
+ void createTextItemNoLayouting();
};
tst_QGraphicsItem::tst_QGraphicsItem()
@@ -230,5 +208,32 @@ void tst_QGraphicsItem::translate()
}
}
+void tst_QGraphicsItem::createTextItem()
+{
+ // Ensure QFontDatabase loaded the font beforehand
+ QFontInfo(qApp->font()).family();
+ const QString text = "This is some text";
+ QBENCHMARK {
+ QGraphicsTextItem item(text);
+ }
+}
+
+void tst_QGraphicsItem::createTextItemNoLayouting()
+{
+ // Ensure QFontDatabase loaded the font beforehand
+ QFontInfo(qApp->font()).family();
+ const QString text = "This is some text";
+ QBENCHMARK {
+ QGraphicsTextItem item;
+ item.document()->setLayoutEnabled(false);
+ // Prepare everything
+ item.setPlainText(text);
+ QTextOption option = item.document()->defaultTextOption();
+ option.setAlignment(Qt::AlignHCenter);
+ item.document()->setDefaultTextOption(option);
+ // And (in a real app) enable layouting here
+ }
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/CMakeLists.txt
index 5e50712496..0a33918c39 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicslayout.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicslayout Binary:
@@ -7,11 +8,10 @@
qt_internal_add_benchmark(tst_bench_qgraphicslayout
SOURCES
tst_qgraphicslayout.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-#### Keys ignored in scope 1:.:.:qgraphicslayout.pro:<TRUE>:
# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
index 73fad597b2..f583606266 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.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
#include <QTest>
#include <QGraphicsLayout>
@@ -120,7 +95,7 @@ void tst_QGraphicsLayout::invalidate()
QBENCHMARK {
leaf->setMinimumSize(size);
leaf->setMaximumSize(size);
- while (setGeometryCalls->count() < depth) {
+ while (setGeometryCalls->size() < depth) {
QApplication::sendPostedEvents();
}
// force a resize on each widget, this will ensure
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/CMakeLists.txt
index 247ca92eff..10e59e0ecf 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicslinearlayout.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicslinearlayout Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qgraphicslinearlayout
SOURCES
tst_qgraphicslinearlayout.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qgraphicslinearlayout.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index afa11cd553..6dd9dc7d9a 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.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
#include <QTest>
#include <QGraphicsLinearLayout>
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsscene/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
index 4ac043e058..1a39b258db 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsscene/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicsscene.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicsscene Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qgraphicsscene
SOURCES
tst_qgraphicsscene.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qgraphicsscene.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 5f36759c9b..cc53100a43 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.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
#include <qtest.h>
#include <QGraphicsItem>
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsview/CMakeLists.txt
index 60509247e3..c9eff6db3c 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicsview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicsview Binary:
@@ -9,7 +10,7 @@ qt_internal_add_benchmark(tst_bench_qgraphicsview
chiptester/chip.cpp chiptester/chip.h
chiptester/chiptester.cpp chiptester/chiptester.h
tst_qgraphicsview.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
@@ -42,14 +43,10 @@ qt_internal_add_resource(tst_bench_qgraphicsview "images"
${images_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:qgraphicsview.pro:<TRUE>:
-# TEMPLATE = "app"
-
## Scopes:
#####################################################################
qt_internal_extend_target(tst_bench_qgraphicsview CONDITION TARGET Qt::OpenGL
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::OpenGL
)
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/CMakeLists.txt
index c3a708a56c..e3577fd91e 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from chip.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## chip Binary:
@@ -11,7 +12,7 @@ qt_internal_add_benchmark(chip
main.cpp
mainwindow.cpp mainwindow.h
view.cpp view.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
)
@@ -32,17 +33,10 @@ qt_internal_add_resource(chip "images"
${images_resource_files}
)
-
-#### Keys ignored in scope 1:.:.:chip.pro:<TRUE>:
-# INSTALLS = "target" "sources"
-# sources.files = "$$SOURCES" "$$HEADERS" "$$RESOURCES" "*.png" "*.pro" "*.html" "*.doc" "images"
-# sources.path = "$$[QT_INSTALL_EXAMPLES]/graphicsview/chip"
-# target.path = "$$[QT_INSTALL_EXAMPLES]/graphicsview/chip"
-
## Scopes:
#####################################################################
qt_internal_extend_target(chip CONDITION TARGET Qt::OpenGL
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::OpenGL
)
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp
index 4937edf8fd..94c779658d 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.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
#include "chip.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug
deleted file mode 100644
index 8fe1e5b0f1..0000000000
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug
+++ /dev/null
Binary files differ
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.h b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.h
index 1f5142f35f..5852b5055e 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.h
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/chip.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
#ifndef CHIP_H
#define CHIP_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp
index 53fcfa7192..e2c6a943dd 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/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
#include "mainwindow.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp
index b162461403..48aa7f5d71 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.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
#include "mainwindow.h"
#include "view.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h
index dd3cc2a2ad..aae2435a32 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
index 60e8dd0032..4689532eae 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.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
#include "view.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.h b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.h
index a31b07f3f7..d3cbea87d9 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.h
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/chipTest/view.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
#ifndef VIEW_H
#define VIEW_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/CMakeLists.txt
index 82f665c4d4..3bbeb08350 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from moveItems.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## moveItems Binary:
@@ -8,6 +9,6 @@ qt_internal_add_benchmark(moveItems
GUI
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
)
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
index 140278b8f6..f6ab1c6714 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/moveItems/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
#include <QtGui>
#include "valgrind/callgrind.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/CMakeLists.txt
index f30ca15082..f35781b344 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from scrolltest.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## scrolltest Binary:
@@ -8,6 +9,6 @@ qt_internal_add_benchmark(scrolltest
GUI
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
)
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
index 566d16ca51..acd0b38ec1 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/benchapps/scrolltest/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
#include <QtGui>
#include "valgrind/callgrind.h"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp
index 7eaca1e9c1..fc81c460ce 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.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
#include "chip.h"
@@ -97,7 +72,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
// Draw text
if (lod >= 2) {
- QFont font("Times", 10);
+ QFont font(QStringList{"Times"}, 10);
font.setStyleStrategy(QFont::ForceOutline);
painter->setFont(font);
painter->save();
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.h b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.h
index e716b4dafc..ce5fb5222e 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.h
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chip.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
#ifndef CHIP_H
#define CHIP_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.cpp
index 6b108f7be9..d6c0b46487 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.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
#include "chiptester.h"
#include "chip.h"
@@ -104,7 +79,6 @@ void ChipTester::populateScene()
// Populate scene
int xx = 0;
- int nitems = 0;
for (int i = -1100; i < 1100; i += 110) {
++xx;
int yy = 0;
@@ -117,8 +91,6 @@ void ChipTester::populateScene()
QGraphicsItem *item = new Chip(color, xx, yy);
item->setPos(QPointF(i, j));
scene->addItem(item);
-
- ++nitems;
}
}
}
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.h
index e6d383dc1b..7be17d7144 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.h
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/chiptester/chiptester.h
@@ -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
#ifndef CHIPTESTER_H
#define CHIPTESTER_H
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/qgraphicsview.qrc b/tests/benchmarks/widgets/graphicsview/qgraphicsview/qgraphicsview.qrc
deleted file mode 100644
index 3681648f56..0000000000
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/qgraphicsview.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>images/designer.png</file>
- <file>images/wine.jpeg</file>
- <file>images/wine-big.jpeg</file>
- <file>random.data</file>
-</qresource>
-</RCC>
-
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 1b275fbd29..cefbc75e76 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.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
#include <qtest.h>
#include <QtCore/QDebug>
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicswidget/CMakeLists.txt b/tests/benchmarks/widgets/graphicsview/qgraphicswidget/CMakeLists.txt
index f2c32fbb78..c8d7bc0301 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicswidget/CMakeLists.txt
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicswidget/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qgraphicswidget.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qgraphicswidget Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qgraphicswidget
SOURCES
tst_qgraphicswidget.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qgraphicswidget.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index d9bc7f21b6..fb274160fa 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.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
#include <qtest.h>
#include <QGraphicsItem>
diff --git a/tests/benchmarks/widgets/itemviews/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/CMakeLists.txt
index 76747b527d..33224ca61f 100644
--- a/tests/benchmarks/widgets/itemviews/CMakeLists.txt
+++ b/tests/benchmarks/widgets/itemviews/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from itemviews.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qtableview)
add_subdirectory(qheaderview)
diff --git a/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt
index 74fa7a37ed..ee98e2e8c3 100644
--- a/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt
+++ b/tests/benchmarks/widgets/itemviews/qheaderview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qheaderview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qheaderview Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qheaderview
SOURCES
qheaderviewbench.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qheaderview.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp b/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp
index ba1dc2d750..f04ca82cdc 100644
--- a/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp
+++ b/tests/benchmarks/widgets/itemviews/qheaderview/qheaderviewbench.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]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) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtWidgets/QtWidgets>
diff --git a/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt
index 0a9a89f7cb..9b40adadb1 100644
--- a/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt
+++ b/tests/benchmarks/widgets/itemviews/qlistview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qlistview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qlistview Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qlistview
SOURCES
tst_qlistview.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qlistview.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp
index 01496743c2..2e588adc58 100644
--- a/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/benchmarks/widgets/itemviews/qlistview/tst_qlistview.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
#include <qtest.h>
#include <QListView>
diff --git a/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt b/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt
index 9fecbeb232..aae0f7e4e6 100644
--- a/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt
+++ b/tests/benchmarks/widgets/itemviews/qtableview/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtableview.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qtableview Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qtableview
SOURCES
tst_qtableview.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qtableview.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp
index 157ee7a152..e625066800 100644
--- a/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/benchmarks/widgets/itemviews/qtableview/tst_qtableview.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
#include <qtest.h>
#include <QDebug>
@@ -258,13 +233,13 @@ void tst_QTableView::rowInsertion_data()
void tst_QTableView::rowInsertion()
{
- QFETCH(SpanList, spans);
+ QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
- foreach (QRect span, spans)
+ for (QRect span : spans)
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
QTest::qWait(50);
@@ -284,13 +259,13 @@ void tst_QTableView::rowRemoval_data()
void tst_QTableView::rowRemoval()
{
- QFETCH(SpanList, spans);
+ QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
- foreach (QRect span, spans)
+ for (QRect span : spans)
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
QTest::qWait(50);
@@ -307,14 +282,14 @@ void tst_QTableView::columnInsertion_data()
void tst_QTableView::columnInsertion()
{
- QFETCH(SpanList, spans);
+ QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
// Same set as for rowInsertion, just swapping columns and rows.
- foreach (QRect span, spans)
+ for (QRect span : spans)
view.setSpan(span.left(), span.top(), span.width(), span.height());
view.show();
QTest::qWait(50);
@@ -334,14 +309,14 @@ void tst_QTableView::columnRemoval_data()
void tst_QTableView::columnRemoval()
{
- QFETCH(SpanList, spans);
+ QFETCH(const SpanList, spans);
QtTestTableModel model(10, 10);
QTableView view;
view.setModel(&model);
// Same set as for rowRemoval, just swapping columns and rows.
- foreach (QRect span, spans)
+ for (QRect span : spans)
view.setSpan(span.left(), span.top(), span.width(), span.height());
view.show();
QTest::qWait(50);
diff --git a/tests/benchmarks/widgets/kernel/CMakeLists.txt b/tests/benchmarks/widgets/kernel/CMakeLists.txt
index b55b31fe67..a1f9f91042 100644
--- a/tests/benchmarks/widgets/kernel/CMakeLists.txt
+++ b/tests/benchmarks/widgets/kernel/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from kernel.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qapplication)
add_subdirectory(qwidget)
diff --git a/tests/benchmarks/widgets/kernel/qapplication/CMakeLists.txt b/tests/benchmarks/widgets/kernel/qapplication/CMakeLists.txt
index a89faa0c0e..620ac09a59 100644
--- a/tests/benchmarks/widgets/kernel/qapplication/CMakeLists.txt
+++ b/tests/benchmarks/widgets/kernel/qapplication/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qapplication.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qapplication Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qapplication
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qapplication.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/kernel/qapplication/main.cpp b/tests/benchmarks/widgets/kernel/qapplication/main.cpp
index 49de765ef0..5ada0728e7 100644
--- a/tests/benchmarks/widgets/kernel/qapplication/main.cpp
+++ b/tests/benchmarks/widgets/kernel/qapplication/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
#include <QApplication>
#include <qtest.h>
diff --git a/tests/benchmarks/widgets/kernel/qwidget/CMakeLists.txt b/tests/benchmarks/widgets/kernel/qwidget/CMakeLists.txt
index fcdffbf425..6469727d0d 100644
--- a/tests/benchmarks/widgets/kernel/qwidget/CMakeLists.txt
+++ b/tests/benchmarks/widgets/kernel/qwidget/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qwidget.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qwidget Binary:
@@ -7,7 +8,7 @@
qt_internal_add_benchmark(tst_bench_qwidget
SOURCES
tst_qwidget.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
diff --git a/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp
index f906f05a4b..4f55fbc84c 100644
--- a/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/benchmarks/widgets/kernel/qwidget/tst_qwidget.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
#include <qtest.h>
@@ -74,7 +49,7 @@ public:
void setOpaqueChildren(bool enable)
{
if (opaqueChildren != enable) {
- foreach (QWidget *w, children)
+ for (QWidget *w : std::as_const(children))
w->setAttribute(Qt::WA_OpaquePaintEvent, enable);
opaqueChildren = enable;
processEvents();
diff --git a/tests/benchmarks/widgets/styles/CMakeLists.txt b/tests/benchmarks/widgets/styles/CMakeLists.txt
index 74e57c5731..999c10ed19 100644
--- a/tests/benchmarks/widgets/styles/CMakeLists.txt
+++ b/tests/benchmarks/widgets/styles/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from styles.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(TARGET Qt::Widgets)
add_subdirectory(qstylesheetstyle)
diff --git a/tests/benchmarks/widgets/styles/qstylesheetstyle/CMakeLists.txt b/tests/benchmarks/widgets/styles/qstylesheetstyle/CMakeLists.txt
index be43709be7..33880337b8 100644
--- a/tests/benchmarks/widgets/styles/qstylesheetstyle/CMakeLists.txt
+++ b/tests/benchmarks/widgets/styles/qstylesheetstyle/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qstylesheetstyle.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_qstylesheetstyle Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_qstylesheetstyle
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qstylesheetstyle.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/widgets/styles/qstylesheetstyle/main.cpp
index 9dbf618dd9..011914dae2 100644
--- a/tests/benchmarks/widgets/styles/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/widgets/styles/qstylesheetstyle/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
// This file contains benchmarks for QRect/QRectF functions.
#include <QtWidgets/QWidget>
diff --git a/tests/benchmarks/widgets/widgets/CMakeLists.txt b/tests/benchmarks/widgets/widgets/CMakeLists.txt
index 81a8fccc05..3672f573f0 100644
--- a/tests/benchmarks/widgets/widgets/CMakeLists.txt
+++ b/tests/benchmarks/widgets/widgets/CMakeLists.txt
@@ -1,3 +1,4 @@
-# Generated from widgets.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qtextbrowser)
diff --git a/tests/benchmarks/widgets/widgets/qtextbrowser/CMakeLists.txt b/tests/benchmarks/widgets/widgets/qtextbrowser/CMakeLists.txt
index 22c321d5bb..8a6b966eaf 100644
--- a/tests/benchmarks/widgets/widgets/qtextbrowser/CMakeLists.txt
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qtextbrowser.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_bench_QTextBrowser Binary:
@@ -7,11 +8,8 @@
qt_internal_add_benchmark(tst_bench_QTextBrowser
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Test
Qt::Widgets
)
-
-#### Keys ignored in scope 1:.:.:qtextbrowser.pro:<TRUE>:
-# TEMPLATE = "app"
diff --git a/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp b/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
index e469ddcb5b..ad4e370d36 100644
--- a/tests/benchmarks/widgets/widgets/qtextbrowser/main.cpp
+++ b/tests/benchmarks/widgets/widgets/qtextbrowser/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
#include <QDebug>
#include <QTextBrowser>