summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/BLACKLIST2
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp4
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp7
-rw-r--r--tests/auto/corelib/global/global.pro1
-rw-r--r--tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp67
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/qrandomgenerator.pro4
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp960
-rw-r--r--tests/auto/corelib/global/qtendian/qtendian.pro2
-rw-r--r--tests/auto/corelib/global/qtendian/tst_qtendian.cpp84
-rw-r--r--tests/auto/corelib/io/io.pro9
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp4
-rw-r--r--tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp15
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp41
-rw-r--r--tests/auto/corelib/io/qfile/BLACKLIST4
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp30
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp464
-rw-r--r--tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp6
-rw-r--r--tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp91
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp10
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp6
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp2
-rw-r--r--tests/auto/corelib/io/qprocess/testDetached/main.cpp85
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp68
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp60
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp76
-rw-r--r--tests/auto/corelib/io/qstandardpaths/BLACKLIST3
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp32
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp85
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp17
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro4
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp331
-rw-r--r--tests/auto/corelib/itemmodels/itemmodels.pro1
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp169
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/.gitignore1
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/qsortfilterproxymodel_recursive.pro8
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp727
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp120
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro2
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp13
-rw-r--r--tests/auto/corelib/kernel/qmath/tst_qmath.cpp29
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp262
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp10
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp24
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp46
-rw-r--r--tests/auto/corelib/kernel/qtimer/qtimer.pro2
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp15
-rw-r--r--tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp47
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp93
-rw-r--r--tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp99
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp1
-rw-r--r--tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp40
-rw-r--r--tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp3
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid.cpp56
-rw-r--r--tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm12
-rw-r--r--tests/auto/corelib/thread/qfuture/tst_qfuture.cpp5
-rw-r--r--tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp50
-rw-r--r--tests/auto/corelib/thread/qthread/qthread.pro2
-rw-r--r--tests/auto/corelib/thread/qthread/tst_qthread.cpp259
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp68
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/.gitignore1
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro7
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp100
-rw-r--r--tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp11
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp29
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp2
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp94
-rw-r--r--tests/auto/corelib/tools/qhash/tst_qhash.cpp55
-rw-r--r--tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp28
-rw-r--r--tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp17
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp99
-rw-r--r--tests/auto/corelib/tools/qmacautoreleasepool/qmacautoreleasepool.pro4
-rw-r--r--tests/auto/corelib/tools/qmacautoreleasepool/tst_qmacautoreleasepool.mm111
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp54
-rw-r--r--tests/auto/corelib/tools/qrect/tst_qrect.cpp32
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp3
-rw-r--r--tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp2
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp5
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp58
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro1
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp751
-rw-r--r--tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp12
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp9
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp4
-rw-r--r--tests/auto/corelib/tools/qstringview/.gitignore1
-rw-r--r--tests/auto/corelib/tools/qstringview/qstringview.pro6
-rw-r--r--tests/auto/corelib/tools/qstringview/tst_qstringview.cpp624
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp154
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp2
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp8
-rw-r--r--tests/auto/corelib/tools/tools.pro3
-rw-r--r--tests/auto/gui/gui.pro3
-rw-r--r--tests/auto/gui/image/qicon/tst_qicon.cpp10
-rw-r--r--tests/auto/gui/image/qiconhighdpi/icons/misc/button.9.pngbin0 -> 329 bytes
-rw-r--r--tests/auto/gui/image/qiconhighdpi/icons/misc/button@2x.9.pngbin0 -> 616 bytes
-rw-r--r--tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.cpp19
-rw-r--r--tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.qrc2
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp131
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp18
-rw-r--r--tests/auto/gui/kernel/kernel.pro1
-rw-r--r--tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp2
-rw-r--r--tests/auto/gui/kernel/qcursor/qcursor.pro6
-rw-r--r--tests/auto/gui/kernel/qcursor/tst_qcursor.cpp123
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp6
-rw-r--r--tests/auto/gui/kernel/qguitimer/qguitimer.pro2
-rw-r--r--tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp12
-rw-r--r--tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp10
-rw-r--r--tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp4
-rw-r--r--tests/auto/gui/kernel/qwindow/BLACKLIST4
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp57
-rw-r--r--tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp4
-rw-r--r--tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp2
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp27
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp56
-rw-r--r--tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp5
-rw-r--r--tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp42
-rw-r--r--tests/auto/gui/painting/qtransform/tst_qtransform.cpp5
-rw-r--r--tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp105
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp4
-rw-r--r--tests/auto/gui/qvulkan/qvulkan.pro9
-rw-r--r--tests/auto/gui/qvulkan/tst_qvulkan.cpp435
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp6
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp49
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp4
-rw-r--r--tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp19
-rw-r--r--tests/auto/gui/text/qtextscriptengine/BLACKLIST2
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp60
-rw-r--r--tests/auto/gui/util/qshadergenerator/qshadergenerator.pro5
-rw-r--r--tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp895
-rw-r--r--tests/auto/gui/util/qshadergraph/qshadergraph.pro5
-rw-r--r--tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp779
-rw-r--r--tests/auto/gui/util/qshadergraphloader/qshadergraphloader.pro5
-rw-r--r--tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp625
-rw-r--r--tests/auto/gui/util/qshadernodes/qshadernodes.pro5
-rw-r--r--tests/auto/gui/util/qshadernodes/tst_qshadernodes.cpp548
-rw-r--r--tests/auto/gui/util/qshadernodesloader/qshadernodesloader.pro5
-rw-r--r--tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp323
-rw-r--r--tests/auto/gui/util/util.pro5
-rw-r--r--tests/auto/network/access/hpack/tst_hpack.cpp12
-rw-r--r--tests/auto/network/access/hsts/tst_qhsts.cpp72
-rw-r--r--tests/auto/network/access/http2/http2srv.cpp217
-rw-r--r--tests/auto/network/access/http2/http2srv.h46
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp94
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp3
-rw-r--r--tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp15
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp10
-rw-r--r--tests/auto/network/kernel/qhostinfo/BLACKLIST6
-rw-r--r--tests/auto/network/kernel/qhostinfo/qhostinfo.pro3
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp42
-rw-r--r--tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp35
-rw-r--r--tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp114
-rw-r--r--tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp4
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp2
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp8
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp29
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp4
-rw-r--r--tests/auto/opengl/qglthreads/tst_qglthreads.cpp22
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp10
-rw-r--r--tests/auto/other/lancelot/scripts/gradientxform_device.qps67
-rw-r--r--tests/auto/other/lancelot/scripts/gradientxform_logical.qps67
-rw-r--r--tests/auto/other/lancelot/scripts/gradientxform_object.qps68
-rw-r--r--tests/auto/other/macnativeevents/BLACKLIST20
-rw-r--r--tests/auto/other/macnativeevents/macnativeevents.pro3
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.cpp4
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.h4
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents_mac.cpp42
-rw-r--r--tests/auto/other/macnativeevents/tst_macnativeevents.cpp6
-rw-r--r--tests/auto/other/modeltest/dynamictreemodel.cpp301
-rw-r--r--tests/auto/other/modeltest/dynamictreemodel.h192
-rw-r--r--tests/auto/other/modeltest/modeltest.cpp350
-rw-r--r--tests/auto/other/modeltest/modeltest.h61
-rw-r--r--tests/auto/other/modeltest/tst_modeltest.cpp39
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp3
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp14
-rw-r--r--tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp4
-rw-r--r--tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro1
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp4
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp2
-rw-r--r--tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/BLACKLIST2
-rw-r--r--tests/auto/shared/platformclipboard.h10
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp34
-rw-r--r--tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp21
-rw-r--r--tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp36
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp21
-rw-r--r--tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp18
-rw-r--r--tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp53
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.lightxml98
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.teamcity78
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.txt85
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml98
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xunitxml26
-rw-r--r--tests/auto/testlib/selftests/expected_pairdiagnostics.lightxml30
-rw-r--r--tests/auto/testlib/selftests/expected_pairdiagnostics.teamcity12
-rw-r--r--tests/auto/testlib/selftests/expected_pairdiagnostics.txt14
-rw-r--r--tests/auto/testlib/selftests/expected_pairdiagnostics.xml33
-rw-r--r--tests/auto/testlib/selftests/expected_pairdiagnostics.xunitxml21
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py96
-rw-r--r--tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro6
-rw-r--r--tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp63
-rw-r--r--tests/auto/testlib/selftests/selftests.pri1
-rw-r--r--tests/auto/testlib/selftests/selftests.qrc5
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp1
-rw-r--r--tests/auto/tools/moc/error-on-wrong-notify.h2
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp22
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp38
-rw-r--r--tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/Main_Window.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/Widget.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/addlinkdialog.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/addtorrentform.ui.h34
-rw-r--r--tests/auto/tools/uic/baseline/authenticationdialog.ui.h12
-rw-r--r--tests/auto/tools/uic/baseline/backside.ui.h38
-rw-r--r--tests/auto/tools/uic/baseline/batchtranslation.ui.h20
-rw-r--r--tests/auto/tools/uic/baseline/bookmarkdialog.ui.h12
-rw-r--r--tests/auto/tools/uic/baseline/bookwindow.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/browserwidget.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h4
-rw-r--r--tests/auto/tools/uic/baseline/calculator.ui.h56
-rw-r--r--tests/auto/tools/uic/baseline/calculatorform.ui.h14
-rw-r--r--tests/auto/tools/uic/baseline/certificateinfo.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/chatdialog.ui.h4
-rw-r--r--tests/auto/tools/uic/baseline/chatmainwindow.ui.h24
-rw-r--r--tests/auto/tools/uic/baseline/chatsetnickname.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/config.ui.h81
-rw-r--r--tests/auto/tools/uic/baseline/connectdialog.ui.h12
-rw-r--r--tests/auto/tools/uic/baseline/controller.ui.h12
-rw-r--r--tests/auto/tools/uic/baseline/cookies.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/cookiesexceptions.ui.h18
-rw-r--r--tests/auto/tools/uic/baseline/default.ui.h103
-rw-r--r--tests/auto/tools/uic/baseline/dialog.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/downloaditem.ui.h12
-rw-r--r--tests/auto/tools/uic/baseline/downloads.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/embeddeddialog.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/enumnostdset.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/filespage.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/filternamedialog.ui.h4
-rw-r--r--tests/auto/tools/uic/baseline/filterpage.ui.h14
-rw-r--r--tests/auto/tools/uic/baseline/finddialog.ui.h36
-rw-r--r--tests/auto/tools/uic/baseline/form.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/formwindowsettings.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/generalpage.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/gridalignment.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/gridpanel.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/helpdialog.ui.h66
-rw-r--r--tests/auto/tools/uic/baseline/history.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/icontheme.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/identifierpage.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/imagedialog.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/inputpage.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/installdialog.ui.h14
-rw-r--r--tests/auto/tools/uic/baseline/languagesdialog.ui.h24
-rw-r--r--tests/auto/tools/uic/baseline/listwidgeteditor.ui.h24
-rw-r--r--tests/auto/tools/uic/baseline/mainwindow.ui.h48
-rw-r--r--tests/auto/tools/uic/baseline/mydialog.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/myform.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/newactiondialog.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/newform.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/orderdialog.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/outputpage.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/pagefold.ui.h109
-rw-r--r--tests/auto/tools/uic/baseline/paletteeditor.ui.h18
-rw-r--r--tests/auto/tools/uic/baseline/passworddialog.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/pathpage.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/phrasebookbox.ui.h32
-rw-r--r--tests/auto/tools/uic/baseline/plugindialog.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/preferencesdialog.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/previewdialogbase.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/previewwidget.ui.h29
-rw-r--r--tests/auto/tools/uic/baseline/proxy.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/qfiledialog.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h46
-rw-r--r--tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h38
-rw-r--r--tests/auto/tools/uic/baseline/qprintwidget.ui.h18
-rw-r--r--tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h24
-rw-r--r--tests/auto/tools/uic/baseline/qtgradientdialog.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/qtgradienteditor.ui.h112
-rw-r--r--tests/auto/tools/uic/baseline/qtgradientview.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h2
-rw-r--r--tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/qttoolbardialog.ui.h38
-rw-r--r--tests/auto/tools/uic/baseline/querywidget.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/remotecontrol.ui.h26
-rw-r--r--tests/auto/tools/uic/baseline/saveformastemplate.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/settings.ui.h14
-rw-r--r--tests/auto/tools/uic/baseline/signalslotdialog.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/sslclient.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/sslerrors.ui.h10
-rw-r--r--tests/auto/tools/uic/baseline/statistics.ui.h26
-rw-r--r--tests/auto/tools/uic/baseline/stringlisteditor.ui.h22
-rw-r--r--tests/auto/tools/uic/baseline/stylesheeteditor.ui.h23
-rw-r--r--tests/auto/tools/uic/baseline/tabbedbrowser.ui.h14
-rw-r--r--tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h52
-rw-r--r--tests/auto/tools/uic/baseline/tetrixwindow.ui.h16
-rw-r--r--tests/auto/tools/uic/baseline/textfinder.ui.h6
-rw-r--r--tests/auto/tools/uic/baseline/topicchooser.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/translatedialog.ui.h32
-rw-r--r--tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h2
-rw-r--r--tests/auto/tools/uic/baseline/translationsettings.ui.h8
-rw-r--r--tests/auto/tools/uic/baseline/treewidgeteditor.ui.h60
-rw-r--r--tests/auto/tools/uic/baseline/trpreviewtool.ui.h26
-rw-r--r--tests/auto/tools/uic/baseline/validators.ui.h36
-rw-r--r--tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h66
-rw-r--r--tests/auto/tools/uic/tst_uic.cpp5
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp5
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp43
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/BLACKLIST2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp10
-rw-r--r--tests/auto/widgets/gestures/gestures.pro6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp19
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp30
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp14
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp23
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp10
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp103
-rw-r--r--tests/auto/widgets/kernel/kernel.pro4
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp35
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp6
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST (renamed from tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST)0
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/qgesturerecognizer.pro (renamed from tests/auto/widgets/gestures/qgesturerecognizer/qgesturerecognizer.pro)0
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp (renamed from tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp)0
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp306
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp73
-rw-r--r--tests/auto/widgets/styles/qmacstyle/qmacstyle.pro2
-rw-r--r--tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp43
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp40
-rw-r--r--tests/auto/widgets/widgets.pro1
-rw-r--r--tests/auto/widgets/widgets/qcombobox/BLACKLIST4
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp70
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp21
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_0_0.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_0_1.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_0_2.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_1_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_1_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_1_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_2_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_2_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_plain_2_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_0_0.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_0_1.pngbin129 -> 128 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_0_2.pngbin126 -> 126 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_1_0.pngbin135 -> 135 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_1_1.pngbin158 -> 158 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_1_2.pngbin162 -> 162 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_2_0.pngbin148 -> 148 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_2_1.pngbin182 -> 182 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_raised_2_2.pngbin182 -> 182 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.pngbin103 -> 103 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.pngbin129 -> 128 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.pngbin126 -> 126 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.pngbin138 -> 138 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.pngbin159 -> 159 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.pngbin163 -> 163 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.pngbin148 -> 148 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.pngbin182 -> 182 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.pngbin182 -> 182 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.pngbin114 -> 114 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.pngbin148 -> 146 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.pngbin154 -> 152 bytes
-rw-r--r--tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp4
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp40
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmenu/BLACKLIST7
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp35
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp112
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp39
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp7
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp8
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp2
-rw-r--r--tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp24
425 files changed, 14187 insertions, 3459 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/BLACKLIST b/tests/auto/concurrent/qtconcurrentmap/BLACKLIST
new file mode 100644
index 0000000000..7cd8961f6f
--- /dev/null
+++ b/tests/auto/concurrent/qtconcurrentmap/BLACKLIST
@@ -0,0 +1,2 @@
+[qFutureAssignmentLeak]
+ci opensuse
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 96656a6dff..2d7c0c2f64 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -2204,13 +2204,13 @@ InstanceCounter slowMap(const InstanceCounter &in)
InstanceCounter fastMap(const InstanceCounter &in)
{
- QTest::qSleep(rand() % 2 + 1);
+ QTest::qSleep(QRandomGenerator::global()->bounded(2) + 1);
return in;
}
void slowReduce(int &result, const InstanceCounter&)
{
- QTest::qSleep(rand() % 4 + 1);
+ QTest::qSleep(QRandomGenerator::global()->bounded(4) + 1);
++result;
}
diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
index 0f2e9b5d68..c3b53a2fc0 100644
--- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp
@@ -126,6 +126,7 @@ void tst_QTextCodec::toUnicode()
}
QVERIFY(!uniString.isEmpty());
QCOMPARE( ba, c->fromUnicode( uniString ) );
+ QCOMPARE(ba, c->fromUnicode(QStringView(uniString)) );
char ch = '\0';
QVERIFY(c->toUnicode(&ch, 1).length() == 1);
@@ -262,7 +263,7 @@ void tst_QTextCodec::fromUnicode()
If the encoding is a superset of ASCII, test that the byte
array is correct (no off by one, no trailing '\0').
*/
- QByteArray result = codec->fromUnicode(QString("abc"));
+ QByteArray result = codec->fromUnicode(QStringViewLiteral("abc"));
if (result.startsWith('a')) {
QCOMPARE(result.size(), 3);
QCOMPARE(result, QByteArray("abc"));
@@ -397,6 +398,7 @@ void tst_QTextCodec::asciiToIscii() const
QVERIFY2(textCodec->canEncode(ascii), qPrintable(QString::fromLatin1("Failed for full string with encoding %1")
.arg(QString::fromLatin1(textCodec->name().constData()))));
+ QVERIFY(textCodec->canEncode(QStringView(ascii)));
}
}
@@ -404,12 +406,11 @@ void tst_QTextCodec::nonFlaggedCodepointFFFF() const
{
//Check that the code point 0xFFFF (=non-character code 0xEFBFBF) is not flagged
const QChar ch(0xFFFF);
- QString input(ch);
QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8
QVERIFY(codec);
- const QByteArray asDecoded(codec->fromUnicode(input));
+ const QByteArray asDecoded = codec->fromUnicode(QStringView(&ch, 1));
QCOMPARE(asDecoded, QByteArray("\357\277\277"));
QByteArray ffff("\357\277\277");
diff --git a/tests/auto/corelib/global/global.pro b/tests/auto/corelib/global/global.pro
index b4cc8035e6..139e073644 100644
--- a/tests/auto/corelib/global/global.pro
+++ b/tests/auto/corelib/global/global.pro
@@ -7,6 +7,7 @@ SUBDIRS=\
qnumeric \
qfloat16 \
qrand \
+ qrandomgenerator \
qlogging \
qtendian \
qglobalstatic \
diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
index 09abb953ba..f02e902468 100644
--- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
+++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** 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.
@@ -30,12 +31,16 @@
#include <QtTest/QtTest>
#include <qglobal.h>
+#ifdef Q_OS_WIN
+#include <qt_windows.h>
+#endif
class tst_QGetPutEnv : public QObject
{
Q_OBJECT
private slots:
void getSetCheck();
+ void encoding();
void intValue_data();
void intValue();
};
@@ -53,7 +58,11 @@ void tst_QGetPutEnv::getSetCheck()
QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0);
QVERIFY(!ok);
QByteArray result = qgetenv(varName);
- QCOMPARE(result, QByteArray());
+ QVERIFY(result.isNull());
+ QString sresult = qEnvironmentVariable(varName);
+ QVERIFY(sresult.isNull());
+ sresult = qEnvironmentVariable(varName, "hello");
+ QCOMPARE(sresult, QString("hello"));
#ifndef Q_OS_WIN
QVERIFY(qputenv(varName, "")); // deletes varName instead of making it empty, on Windows
@@ -64,6 +73,16 @@ void tst_QGetPutEnv::getSetCheck()
QCOMPARE(qEnvironmentVariableIntValue(varName), 0);
QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0);
QVERIFY(!ok);
+
+ result = qgetenv(varName);
+ QVERIFY(!result.isNull());
+ QCOMPARE(result, QByteArray());
+ sresult = qEnvironmentVariable(varName);
+ QVERIFY(!sresult.isNull());
+ QCOMPARE(sresult, QString());
+ sresult = qEnvironmentVariable(varName, "hello");
+ QVERIFY(!sresult.isNull());
+ QCOMPARE(sresult, QString());
#endif
QVERIFY(qputenv(varName, QByteArray("supervalue")));
@@ -76,19 +95,61 @@ void tst_QGetPutEnv::getSetCheck()
QVERIFY(!ok);
result = qgetenv(varName);
QCOMPARE(result, QByteArrayLiteral("supervalue"));
+ sresult = qEnvironmentVariable(varName);
+ QCOMPARE(sresult, QString("supervalue"));
+ sresult = qEnvironmentVariable(varName, "hello");
+ QCOMPARE(sresult, QString("supervalue"));
qputenv(varName,QByteArray());
// Now test qunsetenv
QVERIFY(qunsetenv(varName));
- QVERIFY(!qEnvironmentVariableIsSet(varName));
+ QVERIFY(!qEnvironmentVariableIsSet(varName)); // note: might fail on some systems!
QVERIFY(qEnvironmentVariableIsEmpty(varName));
ok = true;
QCOMPARE(qEnvironmentVariableIntValue(varName), 0);
QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0);
QVERIFY(!ok);
+
result = qgetenv(varName);
- QCOMPARE(result, QByteArray());
+ QVERIFY(result.isNull());
+ sresult = qEnvironmentVariable(varName);
+ QVERIFY(sresult.isNull());
+ sresult = qEnvironmentVariable(varName, "hello");
+ QCOMPARE(sresult, QString("hello"));
+}
+
+void tst_QGetPutEnv::encoding()
+{
+ // The test string is:
+ // U+0061 LATIN SMALL LETTER A
+ // U+00E1 LATIN SMALL LETTER A WITH ACUTE
+ // U+03B1 GREEK SMALL LETTER ALPHA
+ // U+0430 CYRILLIC SMALL LETTER A
+ // This has letters in three different scripts, so no locale besides
+ // UTF-8 is able handle them all.
+ // The LATIN SMALL LETTER A WITH ACUTE is NFC for NFD:
+ // U+0061 U+0301 LATIN SMALL LETTER A + COMBINING ACUTE ACCENT
+
+ const char varName[] = "should_not_exist";
+ static const wchar_t rawvalue[] = { 'a', 0x00E1, 0x03B1, 0x0430, 0 };
+ QString value = QString::fromWCharArray(rawvalue);
+
+#if defined(Q_OS_WINRT)
+ QSKIP("Test cannot be run on this platform");
+#elif defined(Q_OS_WIN)
+ const wchar_t wvarName[] = L"should_not_exist";
+ _wputenv_s(wvarName, rawvalue);
+#else
+ // confirm the locale is UTF-8
+ if (value.toLocal8Bit() != "a\xc3\xa1\xce\xb1\xd0\xb0")
+ QSKIP("Locale is not UTF-8, cannot test");
+
+ qputenv(varName, QFile::encodeName(value));
+#endif
+
+ QVERIFY(qEnvironmentVariableIsSet(varName));
+ QCOMPARE(qEnvironmentVariable(varName), value);
}
void tst_QGetPutEnv::intValue_data()
diff --git a/tests/auto/corelib/global/qrandomgenerator/qrandomgenerator.pro b/tests/auto/corelib/global/qrandomgenerator/qrandomgenerator.pro
new file mode 100644
index 0000000000..0307b0c1eb
--- /dev/null
+++ b/tests/auto/corelib/global/qrandomgenerator/qrandomgenerator.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qrandomgenerator
+QT = core-private testlib
+SOURCES = tst_qrandomgenerator.cpp
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
new file mode 100644
index 0000000000..220ec9a2f8
--- /dev/null
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -0,0 +1,960 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest>
+#include <qlinkedlist.h>
+#include <qobject.h>
+#include <qrandom.h>
+#include <qvector.h>
+#include <private/qrandom_p.h>
+
+#include <algorithm>
+#include <random>
+
+#if !QT_CONFIG(getentropy) && (defined(Q_OS_BSD4) || defined(Q_OS_WIN))
+# define HAVE_FALLBACK_ENGINE
+#endif
+
+#define COMMA ,
+#define QVERIFY_3TIMES(statement) \
+ do {\
+ if (!static_cast<bool>(statement))\
+ if (!static_cast<bool>(statement))\
+ if (!QTest::qVerify(static_cast<bool>(statement), #statement, "3rd try", __FILE__, __LINE__))\
+ return;\
+ } while (0)
+
+// values chosen at random
+static const quint32 RandomValue32 = 0x4d1169f1U;
+static const quint64 RandomValue64 = Q_UINT64_C(0x3ce63161b998aa91);
+static const double RandomValueFP = double(0.3010463714599609f);
+
+static void setRNGControl(uint v)
+{
+#ifdef QT_BUILD_INTERNAL
+ qt_randomdevice_control.store(v);
+#else
+ Q_UNUSED(v);
+#endif
+}
+
+class tst_QRandomGenerator : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void cleanup() { setRNGControl(0); }
+
+private slots:
+ void basics();
+ void knownSequence();
+ void discard();
+ void copying();
+ void copyingGlobal();
+ void copyingSystem();
+ void systemRng();
+ void securelySeeding();
+
+ void generate32_data();
+ void generate32();
+ void generate64_data() { generate32_data(); }
+ void generate64();
+ void quality_data() { generate32_data(); }
+ void quality();
+ void fillRangeUInt_data() { generate32_data(); }
+ void fillRangeUInt();
+ void fillRangeULong_data() { generate32_data(); }
+ void fillRangeULong();
+ void fillRangeULLong_data() { generate32_data(); }
+ void fillRangeULLong();
+ void generateUInt_data() { generate32_data(); }
+ void generateUInt();
+ void generateULLong_data() { generate32_data(); }
+ void generateULLong();
+ void generateNonContiguous_data() { generate32_data(); }
+ void generateNonContiguous();
+
+ void bounded_data();
+ void bounded();
+ void boundedQuality_data() { generate32_data(); }
+ void boundedQuality();
+
+ void generateReal_data() { generate32_data(); }
+ void generateReal();
+ void qualityReal_data() { generate32_data(); }
+ void qualityReal();
+
+ void seedStdRandomEngines();
+ void stdUniformIntDistribution_data();
+ void stdUniformIntDistribution();
+ void stdGenerateCanonical_data() { generateReal_data(); }
+ void stdGenerateCanonical();
+ void stdUniformRealDistribution_data();
+ void stdUniformRealDistribution();
+ void stdRandomDistributions();
+};
+
+// The first 20 results of the sequence:
+static const quint32 defaultRngResults[] = {
+ 853323747U, 2396352728U, 3025954838U, 2985633182U, 2815751046U,
+ 340588426U, 3587208406U, 298087538U, 2912478009U, 3642122814U,
+ 3202916223U, 799257577U, 1872145992U, 639469699U, 3201121432U,
+ 2388658094U, 1735523408U, 2215232359U, 668106566U, 2554687763U
+};
+
+
+using namespace std;
+QT_WARNING_DISABLE_GCC("-Wfloat-equal")
+QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
+
+struct RandomGenerator : public QRandomGenerator
+{
+ RandomGenerator(uint control)
+ : QRandomGenerator(control ?
+ QRandomGenerator(control & RandomDataMask) :
+ *QRandomGenerator::global())
+ {
+ setRNGControl(control);
+ }
+};
+
+void tst_QRandomGenerator::basics()
+{
+ // default constructible
+ QRandomGenerator rng;
+
+ // copyable && movable
+ rng = rng;
+ rng = std::move(rng);
+
+ // 64-bit
+ QRandomGenerator64 rng64;
+ rng64 = rng64;
+ rng64 = std::move(rng64);
+
+ // 32- and 64-bit should be interchangeable:
+ rng = rng64;
+ rng64 = rng;
+ rng = std::move(rng64);
+ rng64 = std::move(rng);
+
+ rng = QRandomGenerator64::securelySeeded();
+ rng64 = QRandomGenerator::securelySeeded();
+
+ // access global
+ QRandomGenerator *global = QRandomGenerator::global();
+ QRandomGenerator globalCopy = *global;
+ globalCopy = *global;
+ QRandomGenerator64 *global64 = QRandomGenerator64::global();
+ QRandomGenerator64 globalCopy64 = *global64;
+ globalCopy64 = *global64;
+
+ // access system
+ QRandomGenerator *system = QRandomGenerator::system();
+ QRandomGenerator systemRng = *system;
+ systemRng = *system;
+
+ QRandomGenerator64 *system64 = QRandomGenerator64::system();
+ QRandomGenerator64 systemRng64 = *system64;
+ systemRng64 = *system64;
+
+ Q_STATIC_ASSERT(std::is_same<decltype(rng64.generate()) COMMA quint64>::value);
+ Q_STATIC_ASSERT(std::is_same<decltype(system64->generate()) COMMA quint64>::value);
+}
+
+void tst_QRandomGenerator::knownSequence()
+{
+ QRandomGenerator rng;
+ for (quint32 x : defaultRngResults)
+ QCOMPARE(rng(), x);
+
+ // should work again if we reseed it
+ rng.seed();
+ for (quint32 x : defaultRngResults)
+ QCOMPARE(rng(), x);
+}
+
+void tst_QRandomGenerator::discard()
+{
+ QRandomGenerator rng;
+ rng.discard(1);
+ QCOMPARE(rng(), defaultRngResults[1]);
+
+ rng.discard(9);
+ QCOMPARE(rng(), defaultRngResults[11]);
+}
+
+void tst_QRandomGenerator::copying()
+{
+ QRandomGenerator rng1;
+ QRandomGenerator rng2 = rng1;
+ QCOMPARE(rng1, rng2);
+
+ quint32 samples[20];
+ rng1.fillRange(samples);
+
+ // not equal anymore
+ QVERIFY(rng1 != rng2);
+
+ // should produce the same sequence, whichever it was
+ for (quint32 x : samples)
+ QCOMPARE(rng2(), x);
+
+ // now they should compare equal again
+ QCOMPARE(rng1, rng2);
+}
+
+void tst_QRandomGenerator::copyingGlobal()
+{
+ QRandomGenerator &global = *QRandomGenerator::global();
+ QRandomGenerator copy = global;
+ QCOMPARE(copy, global);
+ QCOMPARE(global, copy);
+
+ quint32 samples[20];
+ global.fillRange(samples);
+
+ // not equal anymore
+ QVERIFY(copy != global);
+
+ // should produce the same sequence, whichever it was
+ for (quint32 x : samples)
+ QCOMPARE(copy(), x);
+
+ // equal again
+ QCOMPARE(copy, global);
+ QCOMPARE(global, copy);
+}
+
+void tst_QRandomGenerator::copyingSystem()
+{
+ QRandomGenerator &system = *QRandomGenerator::system();
+ QRandomGenerator copy = system;
+ QRandomGenerator copy2 = copy;
+ copy2 = copy;
+ QCOMPARE(system, copy);
+ QCOMPARE(copy, copy2);
+
+ quint32 samples[20];
+ copy2.fillRange(samples);
+
+ // they still compre equally
+ QCOMPARE(system, copy);
+ QCOMPARE(copy, copy2);
+
+ // should NOT produce the same sequence, whichever it was
+ int sameCount = 0;
+ for (quint32 x : samples)
+ sameCount += (copy() == x);
+ QVERIFY(sameCount < 20);
+
+ QCOMPARE(system, copy);
+ QCOMPARE(copy, copy2);
+}
+
+void tst_QRandomGenerator::systemRng()
+{
+ QRandomGenerator *rng = QRandomGenerator::system();
+ rng->generate();
+ rng->generate64();
+ rng->generateDouble();
+ rng->bounded(100);
+ rng->bounded(100U);
+
+#ifdef QT_BUILD_INTERNAL
+ quint32 setpoint = std::numeric_limits<int>::max();
+ ++setpoint;
+ quint64 setpoint64 = quint64(setpoint) << 32 | setpoint;
+ setRNGControl(SetRandomData | setpoint);
+
+ QCOMPARE(rng->generate(), setpoint);
+ QCOMPARE(rng->generate64(), setpoint64);
+ QCOMPARE(rng->generateDouble(), ldexp(setpoint64, -64));
+ QCOMPARE(rng->bounded(100), 50);
+#endif
+}
+
+void tst_QRandomGenerator::securelySeeding()
+{
+ QRandomGenerator rng1 = QRandomGenerator::securelySeeded();
+ QRandomGenerator rng2 = QRandomGenerator::securelySeeded();
+
+ quint32 samples[20];
+ rng1.fillRange(samples);
+
+ // should NOT produce the same sequence, whichever it was
+ int sameCount = 0;
+ for (quint32 x : samples)
+ sameCount += (rng2() == x);
+ QVERIFY(sameCount < 20);
+}
+
+void tst_QRandomGenerator::generate32_data()
+{
+ QTest::addColumn<uint>("control");
+ QTest::newRow("fixed") << (RandomValue32 & RandomDataMask);
+ QTest::newRow("global") << 0U;
+#ifdef QT_BUILD_INTERNAL
+ if (qt_has_hwrng())
+ QTest::newRow("hwrng") << uint(UseSystemRNG);
+ QTest::newRow("system") << uint(UseSystemRNG | SkipHWRNG);
+# ifdef HAVE_FALLBACK_ENGINE
+ QTest::newRow("system-fallback") << uint(UseSystemRNG | SkipHWRNG | SkipSystemRNG);
+# endif
+#endif
+}
+
+void tst_QRandomGenerator::generate32()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ quint32 value = rng.generate();
+ return value != 0 && value != RandomValue32;
+ }());
+ }
+
+ // and should hopefully be different from repeated calls
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(rng.generate() != rng.generate());
+}
+
+void tst_QRandomGenerator::generate64()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ QVERIFY_3TIMES(rng.generate64() > std::numeric_limits<quint32>::max());
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ quint64 value = rng.generate64();
+ return value != 0 && value != RandomValue32 && value != RandomValue64;
+ }());
+ }
+
+ // and should hopefully be different from repeated calls
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(rng.generate64() != rng.generate64());
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(rng.generate() != quint32(rng.generate64()));
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(rng.generate() != (rng.generate64() >> 32));
+}
+
+void tst_QRandomGenerator::quality()
+{
+ enum {
+ BufferSize = 2048,
+ BufferCount = BufferSize / sizeof(quint32),
+
+ // if the distribution were perfect, each byte in the buffer would
+ // appear exactly:
+ PerfectDistribution = BufferSize / (UCHAR_MAX + 1),
+
+ // The chance of a value appearing N times above its perfect
+ // distribution is the same as it appearing N times in a row:
+ // N Probability
+ // 1 100%
+ // 2 0.390625%
+ // 3 15.25 in a million
+ // 4 59.60 in a billion
+ // 8 5.421e-20
+ // 16 2.938e-39
+
+ AcceptableThreshold = 4 * PerfectDistribution,
+ FailureThreshold = 16 * PerfectDistribution
+ };
+ Q_STATIC_ASSERT(FailureThreshold > AcceptableThreshold);
+
+ QFETCH(uint, control);
+ if (control & RandomDataMask)
+ return;
+ RandomGenerator rng(control);
+
+ int histogram[UCHAR_MAX + 1];
+ memset(histogram, 0, sizeof(histogram));
+
+ {
+ // test the quality of the generator
+ quint32 buffer[BufferCount];
+ memset(buffer, 0xcc, sizeof(buffer));
+ generate_n(buffer, +BufferCount, [&] { return rng.generate(); });
+
+ quint8 *ptr = reinterpret_cast<quint8 *>(buffer);
+ quint8 *end = ptr + sizeof(buffer);
+ for ( ; ptr != end; ++ptr)
+ histogram[*ptr]++;
+ }
+
+ for (uint i = 0; i < sizeof(histogram)/sizeof(histogram[0]); ++i) {
+ int v = histogram[i];
+ if (v > AcceptableThreshold)
+ qDebug() << i << "above threshold:" << v;
+ QVERIFY2(v < FailureThreshold, QByteArray::number(i));
+ }
+ qDebug() << "Average:" << (std::accumulate(begin(histogram), end(histogram), 0) / (1. * (UCHAR_MAX + 1)))
+ << "(expected" << int(PerfectDistribution) << "ideally)"
+ << "Max:" << *std::max_element(begin(histogram), end(histogram))
+ << "at" << std::max_element(begin(histogram), end(histogram)) - histogram
+ << "Min:" << *std::min_element(begin(histogram), end(histogram))
+ << "at" << std::min_element(begin(histogram), end(histogram)) - histogram;
+}
+
+template <typename T> void fillRange_template()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ T value[1] = { RandomValue32 };
+ rng.fillRange(value);
+ return value[0] != 0 && value[0] != RandomValue32;
+ }());
+ }
+
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ T array[2] = {};
+ rng.fillRange(array);
+ return array[0] != array[1];
+ }());
+ }
+
+ if (sizeof(T) > sizeof(quint32)) {
+ // just to shut up a warning about shifting uint more than the width
+ enum { Shift = sizeof(T) / 2 * CHAR_BIT };
+ QVERIFY_3TIMES([&] {
+ T value[1] = { };
+ rng.fillRange(value);
+ return quint32(value[0] >> Shift) != quint32(value[0]);
+ }());
+ }
+
+ // fill in a longer range
+ auto longerArrayCheck = [&] {
+ T array[32];
+ memset(array, 0, sizeof(array));
+ rng.fillRange(array);
+ if (sizeof(T) == sizeof(RandomValue64)
+ && find(begin(array), end(array), RandomValue64) != end(array))
+ return false;
+ return find(begin(array), end(array), 0) == end(array) &&
+ find(begin(array), end(array), RandomValue32) == end(array);
+ };
+ QVERIFY_3TIMES(longerArrayCheck());
+}
+
+void tst_QRandomGenerator::fillRangeUInt() { fillRange_template<uint>(); }
+void tst_QRandomGenerator::fillRangeULong() { fillRange_template<ulong>(); }
+void tst_QRandomGenerator::fillRangeULLong() { fillRange_template<qulonglong>(); }
+
+template <typename T> void generate_template()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ // almost the same as fillRange, but limited to 32 bits
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ T value[1] = { RandomValue32 };
+ QRandomGenerator().generate(begin(value), end(value));
+ return value[0] != 0 && value[0] != RandomValue32
+ && value[0] <= numeric_limits<quint32>::max();
+ }());
+ }
+
+ // fill in a longer range
+ auto longerArrayCheck = [&] {
+ T array[72] = {}; // at least 256 bytes
+ QRandomGenerator().generate(begin(array), end(array));
+ return find_if(begin(array), end(array), [&](T cur) {
+ return cur == 0 || cur == RandomValue32 ||
+ cur == RandomValue64 || cur > numeric_limits<quint32>::max();
+ }) == end(array);
+ };
+ QVERIFY_3TIMES(longerArrayCheck());
+}
+
+void tst_QRandomGenerator::generateUInt() { generate_template<uint>(); }
+void tst_QRandomGenerator::generateULLong() { generate_template<qulonglong>(); }
+
+void tst_QRandomGenerator::generateNonContiguous()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ QLinkedList<quint64> list = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ auto longerArrayCheck = [&] {
+ QRandomGenerator().generate(list.begin(), list.end());
+ return find_if(list.begin(), list.end(), [&](quint64 cur) {
+ return cur == 0 || cur == RandomValue32 ||
+ cur == RandomValue64 || cur > numeric_limits<quint32>::max();
+ }) == list.end();
+ };
+ QVERIFY_3TIMES(longerArrayCheck());
+}
+
+void tst_QRandomGenerator::bounded_data()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("Test only possible in developer builds");
+#endif
+
+ QTest::addColumn<uint>("control");
+ QTest::addColumn<quint32>("sup");
+ QTest::addColumn<quint32>("expected");
+
+ auto newRow = [&](quint32 val, quint32 sup) {
+ // calculate the scaled value
+ quint64 scaled = val;
+ scaled <<= 32;
+ scaled /= sup;
+ unsigned shifted = unsigned(scaled);
+ Q_ASSERT(val < sup);
+ Q_ASSERT((shifted & RandomDataMask) == shifted);
+
+ unsigned control = SetRandomData | shifted;
+ QTest::addRow("%u,%u", val, sup) << control << sup << val;
+ };
+
+ // useless: we can only generate zeroes:
+ newRow(0, 1);
+
+ newRow(25, 200);
+ newRow(50, 200);
+ newRow(75, 200);
+}
+
+void tst_QRandomGenerator::bounded()
+{
+ QFETCH(uint, control);
+ QFETCH(quint32, sup);
+ QFETCH(quint32, expected);
+ RandomGenerator rng(control);
+
+ quint32 value = rng.bounded(sup);
+ QVERIFY(value < sup);
+ QCOMPARE(value, expected);
+
+ int ivalue = rng.bounded(sup);
+ QVERIFY(ivalue < int(sup));
+ QCOMPARE(ivalue, int(expected));
+
+ // confirm only the bound now
+ setRNGControl(control & (SkipHWRNG|SkipSystemRNG|UseSystemRNG));
+ value = rng.bounded(sup);
+ QVERIFY(value < sup);
+
+ value = rng.bounded(sup / 2, 3 * sup / 2);
+ QVERIFY(value >= sup / 2);
+ QVERIFY(value < 3 * sup / 2);
+
+ ivalue = rng.bounded(-int(sup), int(sup));
+ QVERIFY(ivalue >= -int(sup));
+ QVERIFY(ivalue < int(sup));
+
+ // wholly negative range
+ ivalue = rng.bounded(-int(sup), 0);
+ QVERIFY(ivalue >= -int(sup));
+ QVERIFY(ivalue < 0);
+}
+
+void tst_QRandomGenerator::boundedQuality()
+{
+ enum { Bound = 283 }; // a prime number
+ enum {
+ BufferCount = Bound * 32,
+
+ // if the distribution were perfect, each byte in the buffer would
+ // appear exactly:
+ PerfectDistribution = BufferCount / Bound,
+
+ // The chance of a value appearing N times above its perfect
+ // distribution is the same as it appearing N times in a row:
+ // N Probability
+ // 1 100%
+ // 2 0.390625%
+ // 3 15.25 in a million
+ // 4 59.60 in a billion
+ // 8 5.421e-20
+ // 16 2.938e-39
+
+ AcceptableThreshold = 4 * PerfectDistribution,
+ FailureThreshold = 16 * PerfectDistribution
+ };
+ Q_STATIC_ASSERT(FailureThreshold > AcceptableThreshold);
+
+ QFETCH(uint, control);
+ if (control & RandomDataMask)
+ return;
+ RandomGenerator rng(control);
+
+ int histogram[Bound];
+ memset(histogram, 0, sizeof(histogram));
+
+ {
+ // test the quality of the generator
+ QVector<quint32> buffer(BufferCount, 0xcdcdcdcd);
+ generate(buffer.begin(), buffer.end(), [&] { return rng.bounded(Bound); });
+
+ for (quint32 value : qAsConst(buffer)) {
+ QVERIFY(value < Bound);
+ histogram[value]++;
+ }
+ }
+
+ for (unsigned i = 0; i < sizeof(histogram)/sizeof(histogram[0]); ++i) {
+ int v = histogram[i];
+ if (v > AcceptableThreshold)
+ qDebug() << i << "above threshold:" << v;
+ QVERIFY2(v < FailureThreshold, QByteArray::number(i));
+ }
+
+ qDebug() << "Average:" << (std::accumulate(begin(histogram), end(histogram), 0) / qreal(Bound))
+ << "(expected" << int(PerfectDistribution) << "ideally)"
+ << "Max:" << *std::max_element(begin(histogram), end(histogram))
+ << "at" << std::max_element(begin(histogram), end(histogram)) - histogram
+ << "Min:" << *std::min_element(begin(histogram), end(histogram))
+ << "at" << std::min_element(begin(histogram), end(histogram)) - histogram;
+}
+
+void tst_QRandomGenerator::generateReal()
+{
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ qreal value = rng.generateDouble();
+ return value >= 0 && value < 1 && value != RandomValueFP;
+ }());
+ }
+
+ // and should hopefully be different from repeated calls
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(rng.generateDouble() != rng.generateDouble());
+}
+
+void tst_QRandomGenerator::qualityReal()
+{
+ QFETCH(uint, control);
+ if (control & RandomDataMask)
+ return;
+ RandomGenerator rng(control);
+
+ enum {
+ SampleSize = 160,
+
+ // Expected value: sample size times proportion of the range:
+ PerfectOctile = SampleSize / 8,
+ PerfectHalf = SampleSize / 2,
+
+ // Variance is (1 - proportion of range) * expected; sqrt() for standard deviations.
+ // Should usually be within twice that and almost never outside four times:
+ RangeHalf = 25, // floor(4 * sqrt((1 - 0.5) * PerfectHalf))
+ RangeOctile = 16 // floor(4 * sqrt((1 - 0.125) * PerfectOctile))
+ };
+
+ double data[SampleSize];
+ std::generate(std::begin(data), std::end(data), [&rng] { return rng.generateDouble(); });
+
+ int aboveHalf = 0;
+ int belowOneEighth = 0;
+ int aboveSevenEighths = 0;
+ for (double x : data) {
+ aboveHalf += x >= 0.5;
+ belowOneEighth += x < 0.125;
+ aboveSevenEighths += x >= 0.875;
+
+ // these are strict requirements
+ QVERIFY(x >= 0);
+ QVERIFY(x < 1);
+ }
+
+ qInfo("Halfway distribution: %.1f - %.1f", 100. * aboveHalf / SampleSize, 100 - 100. * aboveHalf / SampleSize);
+ qInfo("%.1f below 1/8 (expected 12.5%% ideally)", 100. * belowOneEighth / SampleSize);
+ qInfo("%.1f above 7/8 (expected 12.5%% ideally)", 100. * aboveSevenEighths / SampleSize);
+
+ QVERIFY(aboveHalf < PerfectHalf + RangeHalf);
+ QVERIFY(aboveHalf > PerfectHalf - RangeHalf);
+ QVERIFY(aboveSevenEighths < PerfectOctile + RangeOctile);
+ QVERIFY(aboveSevenEighths > PerfectOctile - RangeOctile);
+ QVERIFY(belowOneEighth < PerfectOctile + RangeOctile);
+ QVERIFY(belowOneEighth > PerfectOctile - RangeOctile);
+}
+
+template <typename Engine> void seedStdRandomEngine()
+{
+ {
+ QRandomGenerator &rd = *QRandomGenerator::system();
+ Engine e(rd);
+ QVERIFY_3TIMES(e() != 0);
+
+ e.seed(rd);
+ QVERIFY_3TIMES(e() != 0);
+ }
+ {
+ QRandomGenerator64 &rd = *QRandomGenerator64::system();
+ Engine e(rd);
+ QVERIFY_3TIMES(e() != 0);
+
+ e.seed(rd);
+ QVERIFY_3TIMES(e() != 0);
+ }
+}
+
+void tst_QRandomGenerator::seedStdRandomEngines()
+{
+ seedStdRandomEngine<std::default_random_engine>();
+ seedStdRandomEngine<std::minstd_rand0>();
+ seedStdRandomEngine<std::minstd_rand>();
+ seedStdRandomEngine<std::mt19937>();
+ seedStdRandomEngine<std::mt19937_64>();
+ seedStdRandomEngine<std::ranlux24_base>();
+ seedStdRandomEngine<std::ranlux48_base>();
+ seedStdRandomEngine<std::ranlux24>();
+ seedStdRandomEngine<std::ranlux48>();
+}
+
+void tst_QRandomGenerator::stdUniformIntDistribution_data()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("Test only possible in developer builds");
+#endif
+
+ QTest::addColumn<uint>("control");
+ QTest::addColumn<quint32>("max");
+
+ auto newRow = [&](quint32 max) {
+#ifdef QT_BUILD_INTERNAL
+ if (qt_has_hwrng())
+ QTest::addRow("hwrng:%u", max) << uint(UseSystemRNG) << max;
+ QTest::addRow("system:%u", max) << uint(UseSystemRNG | SkipHWRNG) << max;
+# ifdef HAVE_FALLBACK_ENGINE
+ QTest::addRow("system-fallback:%u", max) << uint(UseSystemRNG | SkipHWRNG | SkipSystemRNG) << max;
+# endif
+#endif
+ QTest::addRow("global:%u", max) << 0U << max;
+ };
+
+ // useless: we can only generate zeroes:
+ newRow(0);
+
+ newRow(1);
+ newRow(199);
+ newRow(numeric_limits<quint32>::max());
+}
+
+void tst_QRandomGenerator::stdUniformIntDistribution()
+{
+ QFETCH(uint, control);
+ QFETCH(quint32, max);
+ RandomGenerator rng(control);
+
+ {
+ QRandomGenerator rd;
+ {
+ std::uniform_int_distribution<quint32> dist(0, max);
+ quint32 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ if ((3 * max / 2) > max) {
+ std::uniform_int_distribution<quint32> dist(max / 2, 3 * max / 2);
+ quint32 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+
+ {
+ std::uniform_int_distribution<quint64> dist(0, quint64(max) << 32);
+ quint64 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ {
+ std::uniform_int_distribution<quint64> dist(max / 2, 3 * quint64(max) / 2);
+ quint64 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ }
+
+ {
+ QRandomGenerator64 rd;
+ {
+ std::uniform_int_distribution<quint32> dist(0, max);
+ quint32 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ if ((3 * max / 2) > max) {
+ std::uniform_int_distribution<quint32> dist(max / 2, 3 * max / 2);
+ quint32 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+
+ {
+ std::uniform_int_distribution<quint64> dist(0, quint64(max) << 32);
+ quint64 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ {
+ std::uniform_int_distribution<quint64> dist(max / 2, 3 * quint64(max) / 2);
+ quint64 value = dist(rd);
+ QVERIFY(value >= dist.min());
+ QVERIFY(value <= dist.max());
+ }
+ }
+}
+
+void tst_QRandomGenerator::stdGenerateCanonical()
+{
+#if defined(Q_CC_MSVC) && Q_CC_MSVC < 1900
+ // see https://connect.microsoft.com/VisualStudio/feedback/details/811611
+ QSKIP("MSVC 2013's std::generate_canonical is broken");
+#else
+ QFETCH(uint, control);
+ RandomGenerator rng(control);
+
+ for (int i = 0; i < 4; ++i) {
+ QVERIFY_3TIMES([&] {
+ qreal value = std::generate_canonical<qreal COMMA 32>(rng);
+ return value > 0 && value < 1 && value != RandomValueFP;
+ }());
+ }
+
+ // and should hopefully be different from repeated calls
+ for (int i = 0; i < 4; ++i)
+ QVERIFY_3TIMES(std::generate_canonical<qreal COMMA 32>(rng) !=
+ std::generate_canonical<qreal COMMA 32>(rng));
+#endif
+}
+
+void tst_QRandomGenerator::stdUniformRealDistribution_data()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("Test only possible in developer builds");
+#endif
+
+ QTest::addColumn<uint>("control");
+ QTest::addColumn<double>("min");
+ QTest::addColumn<double>("sup");
+
+ auto newRow = [&](double min, double sup) {
+#ifdef QT_BUILD_INTERNAL
+ if (qt_has_hwrng())
+ QTest::addRow("hwrng:%g-%g", min, sup) << uint(UseSystemRNG) << min << sup;
+ QTest::addRow("system:%g-%g", min, sup) << uint(UseSystemRNG | SkipHWRNG) << min << sup;
+# ifdef HAVE_FALLBACK_ENGINE
+ QTest::addRow("system-fallback:%g-%g", min, sup) << uint(UseSystemRNG | SkipHWRNG | SkipSystemRNG) << min << sup;
+# endif
+#endif
+ QTest::addRow("global:%g-%g", min, sup) << 0U << min << sup;
+ };
+
+ newRow(0, 0); // useless: we can only generate zeroes
+ newRow(0, 1); // canonical
+ newRow(0, 200);
+ newRow(0, numeric_limits<quint32>::max() + 1.);
+ newRow(0, numeric_limits<quint64>::max() + 1.);
+ newRow(-1, 1.6);
+}
+
+void tst_QRandomGenerator::stdUniformRealDistribution()
+{
+ QFETCH(uint, control);
+ QFETCH(double, min);
+ QFETCH(double, sup);
+ RandomGenerator rng(control & (SkipHWRNG|SkipSystemRNG|UseSystemRNG));
+
+ {
+ QRandomGenerator rd;
+ {
+ std::uniform_real_distribution<double> dist(min, sup);
+ double value = dist(rd);
+ QVERIFY(value >= dist.min());
+ if (min != sup)
+ QVERIFY(value < dist.max());
+ }
+ }
+
+ {
+ QRandomGenerator64 rd;
+ {
+ std::uniform_real_distribution<double> dist(min, sup);
+ double value = dist(rd);
+ QVERIFY(value >= dist.min());
+ if (min != sup)
+ QVERIFY(value < dist.max());
+ }
+ }
+}
+
+template <typename Generator> void stdRandomDistributions_template()
+{
+ Generator rd;
+
+ std::bernoulli_distribution()(rd);
+
+ std::binomial_distribution<quint32>()(rd);
+ std::binomial_distribution<quint64>()(rd);
+
+ std::negative_binomial_distribution<quint32>()(rd);
+ std::negative_binomial_distribution<quint64>()(rd);
+
+ std::poisson_distribution<int>()(rd);
+ std::poisson_distribution<qint64>()(rd);
+
+ std::normal_distribution<qreal>()(rd);
+
+ {
+ std::discrete_distribution<int> discrete{0, 1, 1, 10000, 2};
+ QVERIFY(discrete(rd) != 0);
+ QVERIFY_3TIMES(discrete(rd) == 3);
+ }
+}
+
+void tst_QRandomGenerator::stdRandomDistributions()
+{
+ // just a compile check for some of the distributions, besides
+ // std::uniform_int_distribution and std::uniform_real_distribution (tested
+ // above)
+
+ stdRandomDistributions_template<QRandomGenerator>();
+ stdRandomDistributions_template<QRandomGenerator64>();
+}
+
+QTEST_APPLESS_MAIN(tst_QRandomGenerator)
+
+#include "tst_qrandomgenerator.moc"
diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro
index 214c706ca5..890976d26c 100644
--- a/tests/auto/corelib/global/qtendian/qtendian.pro
+++ b/tests/auto/corelib/global/qtendian/qtendian.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_qtendian
-QT = core testlib
+QT = core core-private testlib
SOURCES = tst_qtendian.cpp
diff --git a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
index 915e40954b..6934818dcf 100644
--- a/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
+++ b/tests/auto/corelib/global/qtendian/tst_qtendian.cpp
@@ -29,6 +29,7 @@
#include <QtTest/QtTest>
#include <QtCore/qendian.h>
+#include <QtCore/private/qendian_p.h>
class tst_QtEndian: public QObject
@@ -41,6 +42,11 @@ private slots:
void toBigEndian();
void toLittleEndian();
+
+ void endianIntegers_data();
+ void endianIntegers();
+
+ void endianBitfields();
};
struct TestData
@@ -129,5 +135,83 @@ void tst_QtEndian::toLittleEndian()
#undef ENDIAN_TEST
+void tst_QtEndian::endianIntegers_data()
+{
+ QTest::addColumn<int>("val");
+
+ QTest::newRow("-30000") << -30000;
+ QTest::newRow("-1") << -1;
+ QTest::newRow("0") << 0;
+ QTest::newRow("1020") << 1020;
+ QTest::newRow("16385") << 16385;
+}
+
+void tst_QtEndian::endianIntegers()
+{
+ QFETCH(int, val);
+
+ qint16 vi16 = val;
+ qint32 vi32 = val;
+ qint64 vi64 = val;
+ quint16 vu16 = val;
+ quint32 vu32 = val;
+ quint64 vu64 = val;
+
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ QCOMPARE(*reinterpret_cast<qint16_be*>(&vi16), vi16);
+ QCOMPARE(*reinterpret_cast<qint32_be*>(&vi32), vi32);
+ QCOMPARE(*reinterpret_cast<qint64_be*>(&vi64), vi64);
+ QCOMPARE(*reinterpret_cast<qint16_le*>(&vi16), qbswap(vi16));
+ QCOMPARE(*reinterpret_cast<qint32_le*>(&vi32), qbswap(vi32));
+ QCOMPARE(*reinterpret_cast<qint64_le*>(&vi64), qbswap(vi64));
+ QCOMPARE(*reinterpret_cast<quint16_be*>(&vu16), vu16);
+ QCOMPARE(*reinterpret_cast<quint32_be*>(&vu32), vu32);
+ QCOMPARE(*reinterpret_cast<quint64_be*>(&vu64), vu64);
+ QCOMPARE(*reinterpret_cast<quint16_le*>(&vu16), qbswap(vu16));
+ QCOMPARE(*reinterpret_cast<quint32_le*>(&vu32), qbswap(vu32));
+ QCOMPARE(*reinterpret_cast<quint64_le*>(&vu64), qbswap(vu64));
+#else
+ QCOMPARE(*reinterpret_cast<qint16_be*>(&vi16), qbswap(vi16));
+ QCOMPARE(*reinterpret_cast<qint32_be*>(&vi32), qbswap(vi32));
+ QCOMPARE(*reinterpret_cast<qint64_be*>(&vi64), qbswap(vi64));
+ QCOMPARE(*reinterpret_cast<qint16_le*>(&vi16), vi16);
+ QCOMPARE(*reinterpret_cast<qint32_le*>(&vi32), vi32);
+ QCOMPARE(*reinterpret_cast<qint64_le*>(&vi64), vi64);
+ QCOMPARE(*reinterpret_cast<quint16_be*>(&vu16), qbswap(vu16));
+ QCOMPARE(*reinterpret_cast<quint32_be*>(&vu32), qbswap(vu32));
+ QCOMPARE(*reinterpret_cast<quint64_be*>(&vu64), qbswap(vu64));
+ QCOMPARE(*reinterpret_cast<quint16_le*>(&vu16), vu16);
+ QCOMPARE(*reinterpret_cast<quint32_le*>(&vu32), vu32);
+ QCOMPARE(*reinterpret_cast<quint64_le*>(&vu64), vu64);
+#endif
+}
+
+void tst_QtEndian::endianBitfields()
+{
+ union {
+ quint32_be_bitfield<21, 11> upper;
+ quint32_be_bitfield<10, 11> lower;
+ qint32_be_bitfield<0, 10> bottom;
+ } u;
+
+ u.upper = 200;
+ QCOMPARE(u.upper, 200U);
+ u.lower = 1000;
+ u.bottom = -8;
+ QCOMPARE(u.lower, 1000U);
+ QCOMPARE(u.upper, 200U);
+
+ u.lower += u.upper;
+ QCOMPARE(u.upper, 200U);
+ QCOMPARE(u.lower, 1200U);
+
+ u.upper = 65536 + 7;
+ u.lower = 65535;
+ QCOMPARE(u.lower, 65535U & ((1<<11) - 1));
+ QCOMPARE(u.upper, 7U);
+
+ QCOMPARE(u.bottom, -8);
+}
+
QTEST_MAIN(tst_QtEndian)
#include "tst_qtendian.moc"
diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro
index 01ed84fda9..bd2a9f4c8e 100644
--- a/tests/auto/corelib/io/io.pro
+++ b/tests/auto/corelib/io/io.pro
@@ -34,12 +34,6 @@ SUBDIRS=\
qurl \
qurlinternal \
qurlquery \
- qwinoverlappedionotifier \
-
-!win32 {
- SUBDIRS -=\
- qwinoverlappedionotifier
-}
!qtHaveModule(gui): SUBDIRS -= \
qdatastream \
@@ -73,5 +67,4 @@ win32:!qtConfig(private_tests): SUBDIRS -= \
qprocess-noapplication
winrt: SUBDIRS -= \
- qstorageinfo \
- qwinoverlappedionotifier
+ qstorageinfo
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index 5975303ca6..2d13e6166d 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -31,6 +31,7 @@
#include <QtAlgorithms>
#include <QFile>
#include <QFileInfo>
+#include <QRandomGenerator>
#include <qplatformdefs.h>
#include <QDebug>
@@ -174,8 +175,7 @@ static inline QByteArray generateDataBlock(int blockSize, QString text, qint64 u
static qint64 counter = 0;
- qint64 randomBits = ((qint64)qrand() << 32)
- | ((qint64)qrand() & 0x00000000ffffffff);
+ qint64 randomBits = QRandomGenerator::global()->generate64();
appendRaw(block, randomBits);
appendRaw(block, userBits);
diff --git a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
index ddfd14550b..1072cb44f9 100644
--- a/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
+++ b/tests/auto/corelib/io/qabstractfileengine/tst_qabstractfileengine.cpp
@@ -341,8 +341,10 @@ public:
if (file) {
QMutexLocker lock(&file->mutex);
switch (time) {
- case CreationTime:
- return file->creation;
+ case BirthTime:
+ return file->birth;
+ case MetadataChangeTime:
+ return file->change;
case ModificationTime:
return file->modification;
case AccessTime:
@@ -353,6 +355,13 @@ public:
return QDateTime();
}
+ bool setFileTime(const QDateTime &newDate, FileTime time)
+ {
+ Q_UNUSED(newDate);
+ Q_UNUSED(time);
+ return false;
+ }
+
void setFileName(const QString &file)
{
if (openForRead_ || openForWrite_)
@@ -449,7 +458,7 @@ protected:
uint userId, groupId;
QAbstractFileEngine::FileFlags fileFlags;
- QDateTime creation, modification, access;
+ QDateTime birth, change, modification, access;
QByteArray content;
};
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 7147405f3b..b43ea7cfa5 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -51,6 +51,7 @@ private slots:
void qDebugQChar() const;
void qDebugQString() const;
void qDebugQStringRef() const;
+ void qDebugQStringView() const;
void qDebugQLatin1String() const;
void qDebugQByteArray() const;
void qDebugQFlags() const;
@@ -492,6 +493,46 @@ void tst_QDebug::qDebugQStringRef() const
}
}
+void tst_QDebug::qDebugQStringView() const
+{
+ /* Use a basic string. */
+ {
+ QLatin1String file, function;
+ int line = 0;
+ const QStringView inView = QStringViewLiteral("input");
+
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << inView; }
+#ifndef QT_NO_MESSAGELOGCONTEXT
+ file = QLatin1String(__FILE__); line = __LINE__ - 2; function = QLatin1String(Q_FUNC_INFO);
+#endif
+ QCOMPARE(s_msgType, QtDebugMsg);
+ QCOMPARE(s_msg, QLatin1String("\"input\""));
+ QCOMPARE(QLatin1String(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QLatin1String(s_function), function);
+ }
+
+ /* Use a null QStringView. */
+ {
+ QString file, function;
+ int line = 0;
+
+ const QStringView inView;
+
+ MessageHandlerSetter mhs(myMessageHandler);
+ { qDebug() << inView; }
+#ifndef QT_NO_MESSAGELOGCONTEXT
+ file = __FILE__; line = __LINE__ - 2; function = Q_FUNC_INFO;
+#endif
+ QCOMPARE(s_msgType, QtDebugMsg);
+ QCOMPARE(s_msg, QLatin1String("\"\""));
+ QCOMPARE(QLatin1String(s_file), file);
+ QCOMPARE(s_line, line);
+ QCOMPARE(QLatin1String(s_function), function);
+ }
+}
+
void tst_QDebug::qDebugQLatin1String() const
{
QString file, function;
diff --git a/tests/auto/corelib/io/qfile/BLACKLIST b/tests/auto/corelib/io/qfile/BLACKLIST
index 8d636d40b8..8366667166 100644
--- a/tests/auto/corelib/io/qfile/BLACKLIST
+++ b/tests/auto/corelib/io/qfile/BLACKLIST
@@ -5,7 +5,3 @@ msvc-2017 ci
[readLineStdin_lineByLine]
msvc-2015 ci
msvc-2017 ci
-[openStandardStreamsFileDescriptors]
-osx
-[openStandardStreamsBufferedStreams]
-osx
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 5f0eae6fc3..c173a87a41 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -2138,6 +2138,7 @@ public:
uint ownerId(FileOwner) const { return 0; }
QString owner(FileOwner) const { return QString(); }
QDateTime fileTime(FileTime) const { return QDateTime(); }
+ bool setFileTime(const QDateTime &newDate, FileTime time) { return false; }
private:
int number;
@@ -3247,22 +3248,39 @@ static qint64 streamExpectedSize(int fd)
QT_STATBUF sb;
if (QT_FSTAT(fd, &sb) != -1)
return sb.st_size;
+ qErrnoWarning("Could not fstat fd %d", fd);
return 0;
}
static qint64 streamCurrentPosition(int fd)
{
- QT_OFF_T pos = QT_LSEEK(fd, 0, SEEK_CUR);
- if (pos != -1)
- return pos;
+ QT_STATBUF sb;
+ if (QT_FSTAT(fd, &sb) != -1) {
+ QT_OFF_T pos = -1;
+ if ((sb.st_mode & QT_STAT_MASK) == QT_STAT_REG)
+ pos = QT_LSEEK(fd, 0, SEEK_CUR);
+ if (pos != -1)
+ return pos;
+ // failure to lseek() is not a problem
+ } else {
+ qErrnoWarning("Could not fstat fd %d", fd);
+ }
return 0;
}
static qint64 streamCurrentPosition(FILE *f)
{
- QT_OFF_T pos = QT_FTELL(f);
- if (pos != -1)
- return pos;
+ QT_STATBUF sb;
+ if (QT_FSTAT(QT_FILENO(f), &sb) != -1) {
+ QT_OFF_T pos = -1;
+ if ((sb.st_mode & QT_STAT_MASK) == QT_STAT_REG)
+ pos = QT_FTELL(f);
+ if (pos != -1)
+ return pos;
+ // failure to ftell() is not a problem
+ } else {
+ qErrnoWarning("Could not fstat fd %d", QT_FILENO(f));
+ }
return 0;
}
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index f35dab2cad..44e79985d4 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -35,6 +35,7 @@
#include <qtemporarydir.h>
#include <qdir.h>
#include <qfileinfo.h>
+#include <qstorageinfo.h>
#ifdef Q_OS_UNIX
#include <errno.h>
#include <fcntl.h>
@@ -47,7 +48,6 @@
#endif
#ifdef Q_OS_WIN
#include <qt_windows.h>
-#include <qlibrary.h>
#if !defined(Q_OS_WINRT)
#include <lm.h>
#endif
@@ -64,84 +64,38 @@
#define Q_NO_SYMLINKS
#endif
-
-#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
-inline bool qt_isEvilFsTypeName(const char *name)
-{
- return (qstrncmp(name, "nfs", 3) == 0
- || qstrncmp(name, "autofs", 6) == 0
- || qstrncmp(name, "cachefs", 7) == 0);
-}
-
-#if defined(Q_OS_BSD4) && !defined(Q_OS_NETBSD)
-# include <sys/param.h>
-# include <sys/mount.h>
-
-bool qIsLikelyToBeNfs(int handle)
-{
- struct statfs buf;
- if (fstatfs(handle, &buf) != 0)
- return false;
- return qt_isEvilFsTypeName(buf.f_fstypename);
-}
-
-#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
-
-# include <sys/vfs.h>
-# ifdef QT_LINUXBASE
- // LSB 3.2 has fstatfs in sys/statfs.h, sys/vfs.h is just an empty dummy header
-# include <sys/statfs.h>
-# endif
-
-# ifndef NFS_SUPER_MAGIC
-# define NFS_SUPER_MAGIC 0x00006969
-# endif
-# ifndef AUTOFS_SUPER_MAGIC
-# define AUTOFS_SUPER_MAGIC 0x00000187
-# endif
-# ifndef AUTOFSNG_SUPER_MAGIC
-# define AUTOFSNG_SUPER_MAGIC 0x7d92b1a0
-# endif
-
-bool qIsLikelyToBeNfs(int handle)
+inline bool qIsLikelyToBeFat(const QString &path)
{
- struct statfs buf;
- if (fstatfs(handle, &buf) != 0)
- return false;
- return buf.f_type == NFS_SUPER_MAGIC
- || buf.f_type == AUTOFS_SUPER_MAGIC
- || buf.f_type == AUTOFSNG_SUPER_MAGIC;
+ QByteArray name = QStorageInfo(path).fileSystemType().toLower();
+ return name.contains("fat") || name.contains("msdos");
}
-#elif defined(Q_OS_SOLARIS) || defined(Q_OS_IRIX) || defined(Q_OS_AIX) || defined(Q_OS_HPUX) \
- || defined(Q_OS_OSF) || defined(Q_OS_QNX) || defined(Q_OS_SCO) \
- || defined(Q_OS_UNIXWARE) || defined(Q_OS_RELIANT) || defined(Q_OS_NETBSD)
-
-# include <sys/statvfs.h>
-
-bool qIsLikelyToBeNfs(int handle)
+inline bool qIsLikelyToBeNfs(const QString &path)
{
- struct statvfs buf;
- if (fstatvfs(handle, &buf) != 0)
- return false;
-#if defined(Q_OS_NETBSD)
- return qt_isEvilFsTypeName(buf.f_fstypename);
+#ifdef Q_OS_WIN
+ Q_UNUSED(path);
+ return false;
#else
- return qt_isEvilFsTypeName(buf.f_basetype);
+ QByteArray type = QStorageInfo(path).fileSystemType();
+ const char *name = type.constData();
+
+ return (qstrncmp(name, "nfs", 3) == 0
+ || qstrncmp(name, "autofs", 6) == 0
+ || qstrncmp(name, "autofsng", 8) == 0
+ || qstrncmp(name, "cachefs", 7) == 0);
#endif
}
-#else
-inline bool qIsLikelyToBeNfs(int /* handle */)
-{
- return false;
-}
-#endif
-#endif
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentSecsSinceEpoch());
- return QDir::tempPath() + "/tst_qfileinfo-XXXXXX";
+ QString base;
+#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID)
+ // use XDG_RUNTIME_DIR as it's a fully-capable FS
+ base = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
+#endif
+ if (base.isEmpty())
+ base = QDir::tempPath();
+ return base + "/tst_qfileinfo-XXXXXX";
}
static QByteArray msgDoesNotExist(const QString &name)
@@ -277,8 +231,9 @@ private slots:
#endif
void group();
+ void invalidState_data();
void invalidState();
- void nonExistingFileDates();
+ void nonExistingFile();
private:
const QString m_currentDir;
@@ -728,18 +683,12 @@ void tst_QFileInfo::canonicalFilePath()
#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- typedef BOOL (WINAPI *PtrCreateSymbolicLink)(LPTSTR, LPTSTR, DWORD);
- PtrCreateSymbolicLink ptrCreateSymbolicLink =
- (PtrCreateSymbolicLink)QLibrary::resolve(QLatin1String("kernel32"), "CreateSymbolicLinkW");
-
- if (!ptrCreateSymbolicLink) {
- QSKIP("Symbolic links aren't supported by FS");
- } else {
+ {
// CreateSymbolicLink can return TRUE & still fail to create the link,
// the error code in that case is ERROR_PRIVILEGE_NOT_HELD (1314)
SetLastError(0);
const QString linkTarget = QStringLiteral("res");
- BOOL ret = ptrCreateSymbolicLink((wchar_t*)linkTarget.utf16(), (wchar_t*)m_resourcesDir.utf16(), 1);
+ BOOL ret = CreateSymbolicLink((wchar_t*)linkTarget.utf16(), (wchar_t*)m_resourcesDir.utf16(), 1);
DWORD dwErr = GetLastError();
if (!ret)
QSKIP("Symbolic links aren't supported by FS");
@@ -1034,6 +983,11 @@ void tst_QFileInfo::systemFiles()
QVERIFY2(fi.exists(), msgDoesNotExist(fi.absoluteFilePath()).constData());
QVERIFY(fi.size() > 0);
QVERIFY(fi.lastModified().isValid());
+ QVERIFY(fi.metadataChangeTime().isValid());
+ QCOMPARE(fi.metadataChangeTime(), fi.lastModified()); // On Windows, they're the same
+ QVERIFY(fi.birthTime().isValid());
+ QVERIFY(fi.birthTime() <= fi.lastModified());
+ QCOMPARE(fi.created(), fi.birthTime()); // On Windows, they're the same
}
void tst_QFileInfo::compare_data()
@@ -1124,43 +1078,92 @@ void tst_QFileInfo::fileTimes_data()
void tst_QFileInfo::fileTimes()
{
- int sleepTime = 2000;
+ auto datePairString = [](const QDateTime &actual, const QDateTime &before) {
+ return (actual.toString(Qt::ISODateWithMs) + " (should be >) " + before.toString(Qt::ISODateWithMs))
+ .toLatin1();
+ };
+
QFETCH(QString, fileName);
+ int sleepTime = 100;
+
+ // on Linux and Windows, the filesystem timestamps may be slightly out of
+ // sync with the system clock (maybe they're using CLOCK_REALTIME_COARSE),
+ // so add a margin of error to our comparisons
+ int fsClockSkew = 10;
+#ifdef Q_OS_WIN
+ fsClockSkew = 500;
+#endif
+
+ // NFS clocks may be WAY out of sync
+ if (qIsLikelyToBeNfs(fileName))
+ QSKIP("This test doesn't work on NFS");
+
+ bool noAccessTime = false;
+ {
+ // try to guess if file times on this filesystem round to the second
+ QFileInfo cwd(".");
+ if (cwd.lastModified().toMSecsSinceEpoch() % 1000 == 0
+ && cwd.lastRead().toMSecsSinceEpoch() % 1000 == 0) {
+ fsClockSkew = sleepTime = 1000;
+
+ noAccessTime = qIsLikelyToBeFat(fileName);
+ if (noAccessTime) {
+ // FAT filesystems (but maybe not exFAT) store timestamps with 2-second
+ // granularity and access time with 1-day granularity
+ fsClockSkew = sleepTime = 2000;
+ }
+ }
+ }
+
if (QFile::exists(fileName)) {
QVERIFY(QFile::remove(fileName));
}
- QTest::qSleep(sleepTime);
+
+ QDateTime beforeBirth, beforeWrite, beforeMetadataChange, beforeRead;
+ QDateTime birthTime, writeTime, metadataChangeTime, readTime;
+
+ // --- Create file and write to it
+ beforeBirth = QDateTime::currentDateTime().addMSecs(-fsClockSkew);
{
QFile file(fileName);
QVERIFY(file.open(QFile::WriteOnly | QFile::Text));
-#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
- if (qIsLikelyToBeNfs(file.handle()))
- QSKIP("This Test doesn't work on NFS");
-#endif
+ QFileInfo fileInfo(fileName);
+ birthTime = fileInfo.birthTime();
+ QVERIFY2(!birthTime.isValid() || birthTime > beforeBirth,
+ datePairString(birthTime, beforeBirth));
+
+ QTest::qSleep(sleepTime);
+ beforeWrite = QDateTime::currentDateTime().addMSecs(-fsClockSkew);
QTextStream ts(&file);
ts << fileName << endl;
}
- QTest::qSleep(sleepTime);
- QDateTime beforeWrite = QDateTime::currentDateTime();
- QTest::qSleep(sleepTime);
{
QFileInfo fileInfo(fileName);
- QVERIFY(fileInfo.created() < beforeWrite);
- QFile file(fileName);
- QVERIFY(file.open(QFile::ReadWrite | QFile::Text));
- QTextStream ts(&file);
- ts << fileName << endl;
+ writeTime = fileInfo.lastModified();
+ QVERIFY2(writeTime > beforeWrite, datePairString(writeTime, beforeWrite));
+ QCOMPARE(fileInfo.birthTime(), birthTime); // mustn't have changed
}
+
+ // --- Change the file's metadata
QTest::qSleep(sleepTime);
- QDateTime beforeRead = QDateTime::currentDateTime();
- QTest::qSleep(sleepTime);
+ beforeMetadataChange = QDateTime::currentDateTime().addMSecs(-fsClockSkew);
+ {
+ QFile file(fileName);
+ file.setPermissions(file.permissions());
+ }
{
QFileInfo fileInfo(fileName);
-// On unix created() returns the same as lastModified().
-#if !defined(Q_OS_UNIX)
- QVERIFY(fileInfo.created() < beforeWrite);
-#endif
- QVERIFY(fileInfo.lastModified() > beforeWrite);
+ metadataChangeTime = fileInfo.metadataChangeTime();
+ QVERIFY2(metadataChangeTime > beforeMetadataChange,
+ datePairString(metadataChangeTime, beforeMetadataChange));
+ QVERIFY(metadataChangeTime >= writeTime); // not all filesystems can store both times
+ QCOMPARE(fileInfo.birthTime(), birthTime); // mustn't have changed
+ }
+
+ // --- Read the file
+ QTest::qSleep(sleepTime);
+ beforeRead = QDateTime::currentDateTime().addMSecs(-fsClockSkew);
+ {
QFile file(fileName);
QVERIFY(file.open(QFile::ReadOnly | QFile::Text));
QTextStream ts(&file);
@@ -1169,13 +1172,17 @@ void tst_QFileInfo::fileTimes()
}
QFileInfo fileInfo(fileName);
-#if !defined(Q_OS_UNIX)
- QVERIFY(fileInfo.created() < beforeWrite);
-#endif
+ readTime = fileInfo.lastRead();
+ QCOMPARE(fileInfo.lastModified(), writeTime); // mustn't have changed
+ QCOMPARE(fileInfo.birthTime(), birthTime); // mustn't have changed
+ QVERIFY(readTime.isValid());
+
+#if defined(Q_OS_WINRT) || defined(Q_OS_QNX) || defined(Q_OS_ANDROID)
+ noAccessTime = true;
+#elif defined(Q_OS_WIN)
//In Vista the last-access timestamp is not updated when the file is accessed/touched (by default).
//To enable this the HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
//is set to 0, in the test machine.
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
HKEY key;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\FileSystem",
0, KEY_READ, &key)) {
@@ -1184,75 +1191,43 @@ void tst_QFileInfo::fileTimes()
LONG error = RegQueryValueEx(key, L"NtfsDisableLastAccessUpdate"
, NULL, NULL, (LPBYTE)&disabledAccessTimes, &size);
if (ERROR_SUCCESS == error && disabledAccessTimes)
- QEXPECT_FAIL("", "File access times are disabled in windows registry (this is the default setting)", Continue);
+ noAccessTime = true;
RegCloseKey(key);
}
#endif
-#if defined(Q_OS_WINRT)
- QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue);
-#elif defined(Q_OS_QNX)
- QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue);
-#elif defined(Q_OS_ANDROID)
- if (fileInfo.lastRead() <= beforeRead)
- QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue);
-#endif
- QVERIFY(fileInfo.lastRead() > beforeRead);
- QVERIFY(fileInfo.lastModified() > beforeWrite);
- QVERIFY(fileInfo.lastModified() < beforeRead);
+ if (noAccessTime)
+ return;
+
+ QVERIFY2(readTime > beforeRead, datePairString(readTime, beforeRead));
+ QVERIFY(writeTime < beforeRead);
}
void tst_QFileInfo::fileTimes_oldFile()
{
- // This is not supported on WinRT
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- // All files are opened in share mode (both read and write).
- DWORD shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
-
- // All files on Windows can be read; there's no such thing as an
- // unreadable file. Add GENERIC_WRITE if WriteOnly is passed.
- int accessRights = GENERIC_READ | GENERIC_WRITE;
-
- SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
-
- // Regular file mode. In Unbuffered mode, pass the no-buffering flag.
- DWORD flagsAndAtts = FILE_ATTRIBUTE_NORMAL;
-
- // WriteOnly can create files, ReadOnly cannot.
- DWORD creationDisp = OPEN_ALWAYS;
-
- // Create the file handle.
- HANDLE fileHandle = CreateFile(L"oldfile.txt",
- accessRights,
- shareMode,
- &securityAtts,
- creationDisp,
- flagsAndAtts,
- NULL);
-
- // Set file times back to 1601.
- SYSTEMTIME stime;
- stime.wYear = 1601;
- stime.wMonth = 1;
- stime.wDayOfWeek = 1;
- stime.wDay = 1;
- stime.wHour = 1;
- stime.wMinute = 0;
- stime.wSecond = 0;
- stime.wMilliseconds = 0;
-
- FILETIME ctime;
- QVERIFY(SystemTimeToFileTime(&stime, &ctime));
- FILETIME atime = ctime;
- FILETIME mtime = atime;
- QVERIFY(fileHandle);
- QVERIFY(SetFileTime(fileHandle, &ctime, &atime, &mtime) != 0);
-
- CloseHandle(fileHandle);
-
- QFileInfo info("oldfile.txt");
- QCOMPARE(info.lastModified(), QDateTime(QDate(1601, 1, 1), QTime(1, 0), Qt::UTC).toLocalTime());
-#endif
+ // This is 2^{31} seconds before 1970-01-01 15:14:8,
+ // i.e. shortly after the start of time_t, in any time-zone:
+ const QDateTime early(QDate(1901, 12, 14), QTime(12, 0));
+ QFile file("ancientfile.txt");
+ file.open(QIODevice::WriteOnly);
+ file.write("\n", 1);
+ file.close();
+
+ /*
+ QFile's setFileTime calls QFSFileEngine::setFileTime() which fails unless
+ the file is open at the time. Of course, when writing, close() changes
+ modification time, so need to re-open for read in order to setFileTime().
+ */
+ file.open(QIODevice::ReadOnly);
+ bool ok = file.setFileTime(early, QFileDevice::FileModificationTime);
+ file.close();
+
+ if (ok) {
+ QFileInfo info(file.fileName());
+ QCOMPARE(info.lastModified(), early);
+ } else {
+ QSKIP("Unable to set file metadata to ancient values");
+ }
}
void tst_QFileInfo::isSymLink_data()
@@ -1392,7 +1367,7 @@ void tst_QFileInfo::isNativePath_data()
QTest::addColumn<bool>("isNativePath");
QTest::newRow("default-constructed") << QString() << false;
- QTest::newRow("empty") << QString("") << true;
+ QTest::newRow("empty") << QString("") << false;
QTest::newRow("local root") << QString::fromLatin1("/") << true;
QTest::newRow("local non-existent file") << QString::fromLatin1("/abrakadabra.boo") << true;
@@ -1461,16 +1436,6 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QDir pwd;
pwd.mkdir("target");
- QLibrary kernel32("kernel32");
- typedef BOOLEAN (WINAPI *PtrCreateSymbolicLink)(LPCWSTR, LPCWSTR, DWORD);
- PtrCreateSymbolicLink createSymbolicLinkW = 0;
- createSymbolicLinkW = (PtrCreateSymbolicLink) kernel32.resolve("CreateSymbolicLinkW");
- if (!createSymbolicLinkW) {
- //we need at least one data set for the test not to fail when skipping _data function
- QDir target("target");
- QTest::newRow("dummy") << target.path() << false << "" << target.canonicalPath();
- QSKIP("symbolic links not supported by operating system");
- }
{
//Directory symlinks
QDir target("target");
@@ -1490,10 +1455,10 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
DWORD err = ERROR_SUCCESS ;
if (!pwd.exists("abs_symlink"))
- if (!createSymbolicLinkW((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x1))
+ if (!CreateSymbolicLink((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x1))
err = GetLastError();
if (err == ERROR_SUCCESS && !pwd.exists(relSymlink))
- if (!createSymbolicLinkW((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x1))
+ if (!CreateSymbolicLink((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x1))
err = GetLastError();
if (err != ERROR_SUCCESS) {
wchar_t errstr[0x100];
@@ -1523,10 +1488,9 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QString relSymlink = "rel_symlink.cpp";
QString relToRelTarget = QDir::toNativeSeparators(relativeDir.relativeFilePath(target.absoluteFilePath()));
QString relToRelSymlink = "relative/rel_symlink";
- QVERIFY(pwd.exists("abs_symlink.cpp") || createSymbolicLinkW((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x0));
- QVERIFY(pwd.exists(relSymlink) || createSymbolicLinkW((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x0));
- QVERIFY(pwd.exists(relToRelSymlink)
- || createSymbolicLinkW((wchar_t*)relToRelSymlink.utf16(), (wchar_t*)relToRelTarget.utf16(),0x0));
+ QVERIFY(pwd.exists("abs_symlink.cpp") || CreateSymbolicLink((wchar_t*)absSymlink.utf16(),(wchar_t*)absTarget.utf16(),0x0));
+ QVERIFY(pwd.exists(relSymlink) || CreateSymbolicLink((wchar_t*)relSymlink.utf16(),(wchar_t*)relTarget.utf16(),0x0));
+ QVERIFY(pwd.exists(relToRelSymlink) || CreateSymbolicLink((wchar_t*)relToRelSymlink.utf16(), (wchar_t*)relToRelTarget.utf16(),0x0));
QTest::newRow("absolute file symlink") << absSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath();
QTest::newRow("relative file symlink") << relSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath();
QTest::newRow("relative to relative file symlink") << relToRelSymlink << true << QDir::fromNativeSeparators(absTarget) << target.canonicalFilePath();
@@ -1553,20 +1517,14 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks_data()
QTest::newRow("junction_root") << junction << false << QString() << QString();
//Mountpoint
- typedef BOOLEAN (WINAPI *PtrGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD);
- PtrGetVolumeNameForVolumeMountPointW getVolumeNameForVolumeMountPointW = 0;
- getVolumeNameForVolumeMountPointW = (PtrGetVolumeNameForVolumeMountPointW) kernel32.resolve("GetVolumeNameForVolumeMountPointW");
- if(getVolumeNameForVolumeMountPointW)
- {
- wchar_t buffer[MAX_PATH];
- QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
- QVERIFY(getVolumeNameForVolumeMountPointW((wchar_t*)rootPath.utf16(), buffer, MAX_PATH));
- QString rootVolume = QString::fromWCharArray(buffer);
- junction = "mountpoint";
- rootVolume.replace("\\\\?\\","\\??\\");
- FileSystem::createNtfsJunction(rootVolume, junction);
- QTest::newRow("mountpoint") << junction << false << QString() << QString();
- }
+ wchar_t buffer[MAX_PATH];
+ QString rootPath = QDir::toNativeSeparators(QDir::rootPath());
+ QVERIFY(GetVolumeNameForVolumeMountPoint((wchar_t*)rootPath.utf16(), buffer, MAX_PATH));
+ QString rootVolume = QString::fromWCharArray(buffer);
+ junction = "mountpoint";
+ rootVolume.replace("\\\\?\\","\\??\\");
+ FileSystem::createNtfsJunction(rootVolume, junction);
+ QTest::newRow("mountpoint") << junction << false << QString() << QString();
}
void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
@@ -1928,56 +1886,96 @@ void tst_QFileInfo::group()
QCOMPARE(fi.group(), expected);
}
-void tst_QFileInfo::invalidState()
+static void stateCheck(const QFileInfo &info, const QString &dirname, const QString &filename)
{
- // Shouldn't crash;
-
- {
- QFileInfo info;
- QCOMPARE(info.size(), qint64(0));
- QVERIFY(!info.exists());
-
- info.setCaching(false);
+ QCOMPARE(info.size(), qint64(0));
+ QVERIFY(!info.exists());
- info.created();
- info.lastRead();
- info.lastModified();
+ QString path;
+ QString abspath;
+ if (!dirname.isEmpty()) {
+ path = ".";
+ abspath = dirname + '/' + filename;
}
- {
- QFileInfo info("");
- QCOMPARE(info.size(), qint64(0));
- QVERIFY(!info.exists());
-
- info.setCaching(false);
+ QCOMPARE(info.filePath(), filename);
+ QCOMPARE(info.absoluteFilePath(), abspath);
+ QCOMPARE(info.canonicalFilePath(), QString());
+ QCOMPARE(info.fileName(), filename);
+ QCOMPARE(info.baseName(), filename);
+ QCOMPARE(info.completeBaseName(), filename);
+ QCOMPARE(info.suffix(), QString());
+ QCOMPARE(info.bundleName(), QString());
+ QCOMPARE(info.completeSuffix(), QString());
+
+ QVERIFY(info.isRelative());
+ QCOMPARE(info.path(), path);
+ QCOMPARE(info.absolutePath(), dirname);
+ QCOMPARE(info.dir().path(), ".");
+
+ // these don't look right
+ QCOMPARE(info.canonicalPath(), path);
+ QCOMPARE(info.absoluteDir().path(), dirname.isEmpty() ? "." : dirname);
+
+ QVERIFY(!info.isReadable());
+ QVERIFY(!info.isWritable());
+ QVERIFY(!info.isExecutable());
+ QVERIFY(!info.isHidden());
+ QVERIFY(!info.isFile());
+ QVERIFY(!info.isDir());
+ QVERIFY(!info.isSymLink());
+ QVERIFY(!info.isBundle());
+ QVERIFY(!info.isRoot());
+ QCOMPARE(info.isNativePath(), !filename.isEmpty());
+
+ QCOMPARE(info.readLink(), QString());
+ QCOMPARE(info.ownerId(), uint(-2));
+ QCOMPARE(info.groupId(), uint(-2));
+ QCOMPARE(info.owner(), QString());
+ QCOMPARE(info.group(), QString());
+
+ QCOMPARE(info.permissions(), QFile::Permissions());
- info.created();
- info.lastRead();
- info.lastModified();
- }
+ QVERIFY(!info.created().isValid());
+ QVERIFY(!info.birthTime().isValid());
+ QVERIFY(!info.metadataChangeTime().isValid());
+ QVERIFY(!info.lastRead().isValid());
+ QVERIFY(!info.lastModified().isValid());
+};
- {
- QFileInfo info("file-doesn't-really-exist.txt");
- QCOMPARE(info.size(), qint64(0));
- QVERIFY(!info.exists());
+void tst_QFileInfo::invalidState_data()
+{
+ QTest::addColumn<int>("mode");
+ QTest::newRow("default") << 0;
+ QTest::newRow("empty") << 1;
+ QTest::newRow("copy-of-default") << 2;
+ QTest::newRow("copy-of-empty") << 3;
+}
- info.setCaching(false);
+void tst_QFileInfo::invalidState()
+{
+ // Shouldn't crash or produce warnings
+ QFETCH(int, mode);
+ const QFileInfo &info = (mode & 1 ? QFileInfo("") : QFileInfo());
- info.created();
- info.lastRead();
- info.lastModified();
+ if (mode & 2) {
+ QFileInfo copy(info);
+ stateCheck(copy, QString(), QString());
+ } else {
+ stateCheck(info, QString(), QString());
}
-
- QVERIFY(true);
}
-void tst_QFileInfo::nonExistingFileDates()
+void tst_QFileInfo::nonExistingFile()
{
- QFileInfo info("non-existing-file.foobar");
- QVERIFY(!info.exists());
- QVERIFY(!info.created().isValid());
- QVERIFY(!info.lastRead().isValid());
- QVERIFY(!info.lastModified().isValid());
+ QString dirname = QDir::currentPath();
+ QString cdirname = QFileInfo(dirname).canonicalFilePath();
+ if (dirname != cdirname)
+ QDir::setCurrent(cdirname); // chdir() to our canonical path
+
+ QString filename = "non-existing-file-foobar";
+ QFileInfo info(filename);
+ stateCheck(info, dirname, filename);
}
QTEST_MAIN(tst_QFileInfo)
diff --git a/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp b/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
index 1c104688a5..ea4da39cd5 100644
--- a/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
+++ b/tests/auto/corelib/io/qfilesystemmetadata/tst_qfilesystemmetadata.cpp
@@ -66,14 +66,16 @@ void tst_QFileSystemMetaData::timeSinceEpoch()
/* data.ftLastAccessTime = data.ftLastWriteTime = */
data.ftCreationTime = epochToFileTime(afterEpochUtc);
meta.fillFromFindData(data);
+ QCOMPARE(meta.birthTime().toUTC(),
+ QDateTime::fromMSecsSinceEpoch(afterEpochUtc * qint64(1000), Qt::UTC));
#else
QT_STATBUF data;
memset(&data, 0, sizeof(data));
data.st_ctime = afterEpochUtc;
meta.fillFromStatBuf(data);
-#endif
- QCOMPARE(meta.creationTime().toUTC(),
+ QCOMPARE(meta.metadataChangeTime().toUTC(),
QDateTime::fromMSecsSinceEpoch(afterEpochUtc * qint64(1000), Qt::UTC));
+#endif
}
#else // i.e. no Q_AUTOTEST_EXPORT
void tst_QFileSystemMetaData::timeSinceEpoch()
diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
index a76fd4703e..a0188f8ba9 100644
--- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
+++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
@@ -55,6 +55,10 @@ private slots:
void readAllKeepPosition();
void writeInTextMode();
+ void skip_data();
+ void skip();
+ void skipAfterPeek_data();
+ void skipAfterPeek();
void transaction_data();
void transaction();
@@ -628,6 +632,93 @@ void tst_QIODevice::writeInTextMode()
#endif
}
+void tst_QIODevice::skip_data()
+{
+ QTest::addColumn<bool>("sequential");
+ QTest::addColumn<QByteArray>("data");
+ QTest::addColumn<int>("read");
+ QTest::addColumn<int>("skip");
+ QTest::addColumn<int>("skipped");
+ QTest::addColumn<char>("expect");
+
+ QByteArray bigData;
+ bigData.fill('a', 20000);
+ bigData[10001] = 'x';
+
+ bool sequential = true;
+ do {
+ QByteArray devName(sequential ? "sequential" : "random-access");
+
+ QTest::newRow(qPrintable(devName + "-small_data")) << true << QByteArray("abcdefghij")
+ << 3 << 6 << 6 << 'j';
+ QTest::newRow(qPrintable(devName + "-big_data")) << true << bigData
+ << 1 << 10000 << 10000 << 'x';
+ QTest::newRow(qPrintable(devName + "-beyond_the_end")) << true << bigData
+ << 1 << 20000 << 19999 << '\0';
+
+ sequential = !sequential;
+ } while (!sequential);
+}
+
+void tst_QIODevice::skip()
+{
+ QFETCH(bool, sequential);
+ QFETCH(QByteArray, data);
+ QFETCH(int, read);
+ QFETCH(int, skip);
+ QFETCH(int, skipped);
+ QFETCH(char, expect);
+ char lastChar = 0;
+
+ QScopedPointer<QIODevice> dev(sequential ? (QIODevice *) new SequentialReadBuffer(&data)
+ : (QIODevice *) new QBuffer(&data));
+ dev->open(QIODevice::ReadOnly);
+
+ for (int i = 0; i < read; ++i)
+ dev->getChar(nullptr);
+
+ QCOMPARE(dev->skip(skip), skipped);
+ dev->getChar(&lastChar);
+ QCOMPARE(lastChar, expect);
+}
+
+void tst_QIODevice::skipAfterPeek_data()
+{
+ QTest::addColumn<bool>("sequential");
+ QTest::addColumn<QByteArray>("data");
+
+ QByteArray bigData;
+ for (int i = 0; i < 1000; ++i)
+ bigData += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+ QTest::newRow("sequential") << true << bigData;
+ QTest::newRow("random-access") << false << bigData;
+}
+
+void tst_QIODevice::skipAfterPeek()
+{
+ QFETCH(bool, sequential);
+ QFETCH(QByteArray, data);
+
+ QScopedPointer<QIODevice> dev(sequential ? (QIODevice *) new SequentialReadBuffer(&data)
+ : (QIODevice *) new QBuffer(&data));
+ int readSoFar = 0;
+ qint64 bytesToSkip = 1;
+
+ dev->open(QIODevice::ReadOnly);
+ forever {
+ QByteArray chunk = dev->peek(bytesToSkip);
+ if (chunk.isEmpty())
+ break;
+
+ QCOMPARE(dev->skip(bytesToSkip), qint64(chunk.size()));
+ QCOMPARE(chunk, data.mid(readSoFar, chunk.size()));
+ readSoFar += chunk.size();
+ bytesToSkip <<= 1;
+ }
+ QCOMPARE(readSoFar, data.size());
+}
+
void tst_QIODevice::transaction_data()
{
QTest::addColumn<bool>("sequential");
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
index f10c2a7c98..e086bf1904 100644
--- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
@@ -31,6 +31,12 @@
#include <QLockFile>
#include <QThread>
+#ifdef Q_OS_UNIX
+# include <unistd.h>
+#else
+# include <stdlib.h>
+#endif
+
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
@@ -44,11 +50,11 @@ int main(int argc, char *argv[])
if (argc > 2)
option = QString::fromLocal8Bit(argv[2]);
- if (option == "-crash") {
+ if (option == "-uncleanexit") {
QLockFile lockFile(lockName);
lockFile.lock();
// exit on purpose, so that the lock remains!
- exit(0);
+ _exit(0);
} else if (option == "-busy") {
QLockFile lockFile(lockName);
lockFile.lock();
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index d2f345feb5..835c4a2778 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -262,7 +262,7 @@ void tst_QLockFile::staleLockFromCrashedProcess()
QFETCH(int, staleLockTime);
const QString fileName = dir.path() + "/staleLockFromCrashedProcess";
- int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QTRY_VERIFY(QFile::exists(fileName));
@@ -288,7 +288,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
#else
const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid";
- int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QVERIFY(QFile::exists(fileName));
QVERIFY(overwritePidInLockFile(fileName, QCoreApplication::applicationPid()));
@@ -397,7 +397,7 @@ void tst_QLockFile::staleLockRace()
// Only one thread should delete it, otherwise a race will ensue
const QString fileName = dir.path() + "/sharedFile";
const QString lockName = fileName + ".lock";
- int ret = QProcess::execute(m_helperApp, QStringList() << lockName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << lockName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QTRY_VERIFY(QFile::exists(lockName));
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index b0acb1c58d..b78fa29fb6 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -64,7 +64,7 @@ void tst_QNoDebug::noDebugOutput() const
void tst_QNoDebug::streaming() const
{
QDateTime dt(QDate(1,2,3),QTime(4,5,6));
- const QByteArray debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")).toLatin1();
+ const QByteArray debugString = dt.toString(QStringViewLiteral("yyyy-MM-dd HH:mm:ss.zzz t")).toLatin1();
const QByteArray message = "QDateTime(" + debugString + " Qt::TimeSpec(LocalTime))";
QTest::ignoreMessage(QtWarningMsg, message.constData());
qWarning() << dt;
diff --git a/tests/auto/corelib/io/qprocess/testDetached/main.cpp b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
index 702cabe873..c10e32d584 100644
--- a/tests/auto/corelib/io/qprocess/testDetached/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testDetached/main.cpp
@@ -40,32 +40,89 @@
#include <windows.h>
#endif
+static void writeStuff(QFile &f)
+{
+ f.write(QDir::currentPath().toUtf8());
+ f.putChar('\n');
+#if defined(Q_OS_UNIX)
+ f.write(QByteArray::number(quint64(getpid())));
+#elif defined(Q_OS_WIN)
+ f.write(QByteArray::number(quint64(GetCurrentProcessId())));
+#endif
+ f.putChar('\n');
+ f.write(qgetenv("tst_QProcess"));
+ f.putChar('\n');
+}
+
+struct Args
+{
+ int exitCode = 0;
+ QByteArray errorMessage;
+ QString fileName;
+ FILE *channel = nullptr;
+ QByteArray channelName;
+};
+
+static Args parseArguments(const QStringList &args)
+{
+ Args result;
+ if (args.count() < 2) {
+ result.exitCode = 128;
+ result.errorMessage = "Usage: testDetached [--out-channel={stdout|stderr}] filename.txt\n";
+ return result;
+ }
+ for (const QString &arg : args) {
+ if (arg.startsWith("--")) {
+ if (!arg.startsWith("--out-channel=")) {
+ result.exitCode = 2;
+ result.errorMessage = "Unknown argument " + arg.toLocal8Bit();
+ return result;
+ }
+ result.channelName = arg.mid(14).toLocal8Bit();
+ if (result.channelName == "stdout") {
+ result.channel = stdout;
+ } else if (result.channelName == "stderr") {
+ result.channel = stderr;
+ } else {
+ result.exitCode = 3;
+ result.errorMessage = "Unknown channel " + result.channelName;
+ return result;
+ }
+ } else {
+ result.fileName = arg;
+ }
+ }
+ return result;
+}
+
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
- QStringList args = app.arguments();
- if (args.count() != 2) {
- fprintf(stderr, "Usage: testDetached filename.txt\n");
- return 128;
+ const Args args = parseArguments(app.arguments());
+ if (args.exitCode) {
+ fprintf(stderr, "testDetached: %s\n", args.errorMessage.constData());
+ return args.exitCode;
}
- QFile f(args.at(1));
+ if (args.channel) {
+ QFile channel;
+ if (!channel.open(args.channel, QIODevice::WriteOnly | QIODevice::Text)) {
+ fprintf(stderr, "Cannot open channel %s for writing: %s\n",
+ qPrintable(args.channelName), qPrintable(channel.errorString()));
+ return 4;
+ }
+ writeStuff(channel);
+ }
+
+ QFile f(args.fileName);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
fprintf(stderr, "Cannot open %s for writing: %s\n",
qPrintable(f.fileName()), qPrintable(f.errorString()));
return 1;
}
- f.write(QDir::currentPath().toUtf8());
- f.putChar('\n');
-#if defined(Q_OS_UNIX)
- f.write(QByteArray::number(quint64(getpid())));
-#elif defined(Q_OS_WIN)
- f.write(QByteArray::number(quint64(GetCurrentProcessId())));
-#endif
- f.putChar('\n');
-
+ writeStuff(f);
f.close();
return 0;
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index f4d6d5cb40..de6eb28503 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -127,7 +127,8 @@ private slots:
void systemEnvironment();
void lockupsInStartDetached();
void waitForReadyReadForNonexistantProcess();
- void detachedWorkingDirectoryAndPid();
+ void detachedProcessParameters_data();
+ void detachedProcessParameters();
void startFinishStartFinish();
void invalidProgramString_data();
void invalidProgramString();
@@ -2072,21 +2073,54 @@ void tst_QProcess::fileWriterProcess()
} while (stopWatch.elapsed() < 3000);
}
-void tst_QProcess::detachedWorkingDirectoryAndPid()
+void tst_QProcess::detachedProcessParameters_data()
{
+ QTest::addColumn<QString>("outChannel");
+ QTest::newRow("none") << QString();
+ QTest::newRow("stdout") << QString("stdout");
+ QTest::newRow("stderr") << QString("stderr");
+}
+
+void tst_QProcess::detachedProcessParameters()
+{
+ QFETCH(QString, outChannel);
qint64 pid;
QFile infoFile(m_temporaryDir.path() + QLatin1String("/detachedinfo.txt"));
if (infoFile.exists())
QVERIFY(infoFile.remove());
+ QFile channelFile(m_temporaryDir.path() + QLatin1String("detachedinfo2.txt"));
+ if (channelFile.exists())
+ QVERIFY(channelFile.remove());
QString workingDir = QDir::currentPath() + "/testDetached";
QVERIFY(QFile::exists(workingDir));
- QStringList args;
- args << infoFile.fileName();
- QVERIFY(QProcess::startDetached(QDir::currentPath() + QLatin1String("/testDetached/testDetached"), args, workingDir, &pid));
+ QVERIFY(qgetenv("tst_QProcess").isEmpty());
+ QByteArray envVarValue("foobarbaz");
+ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
+ environment.insert(QStringLiteral("tst_QProcess"), QString::fromUtf8(envVarValue));
+
+ QProcess process;
+ process.setProgram(QDir::currentPath() + QLatin1String("/testDetached/testDetached"));
+#ifdef Q_OS_WIN
+ int modifierCalls = 0;
+ process.setCreateProcessArgumentsModifier(
+ [&modifierCalls] (QProcess::CreateProcessArguments *) { modifierCalls++; });
+#endif
+ QStringList args(infoFile.fileName());
+ if (!outChannel.isEmpty()) {
+ args << QStringLiteral("--out-channel=") + outChannel;
+ if (outChannel == "stdout")
+ process.setStandardOutputFile(channelFile.fileName());
+ else if (outChannel == "stderr")
+ process.setStandardErrorFile(channelFile.fileName());
+ }
+ process.setArguments(args);
+ process.setWorkingDirectory(workingDir);
+ process.setProcessEnvironment(environment);
+ QVERIFY(process.startDetached(&pid));
QFileInfo fi(infoFile);
fi.setCaching(false);
@@ -2097,19 +2131,35 @@ void tst_QProcess::detachedWorkingDirectoryAndPid()
}
QVERIFY(infoFile.open(QIODevice::ReadOnly | QIODevice::Text));
- QString actualWorkingDir = QString::fromUtf8(infoFile.readLine());
- actualWorkingDir.chop(1); // strip off newline
- QByteArray processIdString = infoFile.readLine();
- processIdString.chop(1);
+ QString actualWorkingDir = QString::fromUtf8(infoFile.readLine()).trimmed();
+ QByteArray processIdString = infoFile.readLine().trimmed();
+ QByteArray actualEnvVarValue = infoFile.readLine().trimmed();
+ QByteArray infoFileContent;
+ if (!outChannel.isEmpty()) {
+ infoFile.seek(0);
+ infoFileContent = infoFile.readAll();
+ }
infoFile.close();
infoFile.remove();
+ if (!outChannel.isEmpty()) {
+ QVERIFY(channelFile.open(QIODevice::ReadOnly | QIODevice::Text));
+ QByteArray channelContent = channelFile.readAll();
+ channelFile.close();
+ channelFile.remove();
+ QCOMPARE(channelContent, infoFileContent);
+ }
+
bool ok = false;
qint64 actualPid = processIdString.toLongLong(&ok);
QVERIFY(ok);
QCOMPARE(actualWorkingDir, workingDir);
QCOMPARE(actualPid, pid);
+ QCOMPARE(actualEnvVarValue, envVarValue);
+#ifdef Q_OS_WIN
+ QCOMPARE(modifierCalls, 1);
+#endif
}
void tst_QProcess::switchReadChannels()
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index 9573f3078b..96970421d3 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -82,6 +82,11 @@ private slots:
void transactionalWriteErrorRenaming();
void symlink();
void directory();
+
+#ifdef Q_OS_WIN
+ void alternateDataStream_data();
+ void alternateDataStream();
+#endif
};
static inline QByteArray msgCannotOpen(const QFileDevice &f)
@@ -474,5 +479,60 @@ void tst_QSaveFile::directory()
#endif
}
+#ifdef Q_OS_WIN
+void tst_QSaveFile::alternateDataStream_data()
+{
+ QTest::addColumn<bool>("directWriteFallback");
+ QTest::addColumn<bool>("success");
+
+ QTest::newRow("default") << false << false;
+ QTest::newRow("directWriteFallback") << true << true;
+}
+
+void tst_QSaveFile::alternateDataStream()
+{
+ QFETCH(bool, directWriteFallback);
+ QFETCH(bool, success);
+ static const char newContent[] = "New content\r\n";
+
+ QTemporaryDir dir;
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
+ QString baseName = dir.path() + QLatin1String("/base");
+ {
+ QFile baseFile(baseName);
+ QVERIFY2(baseFile.open(QIODevice::ReadWrite), qPrintable(baseFile.errorString()));
+ }
+
+ // First, create a file with old content
+ QString adsName = baseName + QLatin1String(":outfile");
+ {
+ QFile targetFile(adsName);
+ if (!targetFile.open(QIODevice::ReadWrite))
+ QSKIP("Failed to ceate ADS file (" + targetFile.errorString().toUtf8()
+ + "). Temp dir is FAT?");
+ targetFile.write("Old content\r\n");
+ }
+
+ // And write to it again using QSaveFile; only works if directWriteFallback is enabled
+ QSaveFile file(adsName);
+ file.setDirectWriteFallback(directWriteFallback);
+ QCOMPARE(file.directWriteFallback(), directWriteFallback);
+
+ if (success) {
+ QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(file.errorString()));
+ file.write(newContent);
+ QVERIFY2(file.commit(), qPrintable(file.errorString()));
+
+ // check the contents
+ QFile targetFile(adsName);
+ QVERIFY2(targetFile.open(QIODevice::ReadOnly), qPrintable(targetFile.errorString()));
+ QByteArray contents = targetFile.readAll();
+ QCOMPARE(contents, QByteArray(newContent));
+ } else {
+ QVERIFY(!file.open(QIODevice::WriteOnly));
+ }
+}
+#endif
+
QTEST_MAIN(tst_QSaveFile)
#include "tst_qsavefile.moc"
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index 332c2dcc01..012ce5f2f5 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -118,6 +118,10 @@ private slots:
void remove();
void contains();
void sync();
+ void syncNonWriteableDir();
+#ifdef Q_OS_WIN
+ void syncAlternateDataStream();
+#endif
void setFallbacksEnabled();
void setFallbacksEnabled_data();
void fromFile_data();
@@ -1750,6 +1754,78 @@ void tst_QSettings::sync()
QCOMPARE(settings1.allKeys().count(), 11);
}
+void tst_QSettings::syncNonWriteableDir()
+{
+ QTemporaryDir tempDir;
+ QVERIFY2(tempDir.isValid(), qUtf8Printable(tempDir.errorString()));
+
+ // first, create a file
+ QString filename = tempDir.path() + "/config.ini";
+ {
+ QFile f(filename);
+ QVERIFY2(f.open(QIODevice::WriteOnly), qUtf8Printable(f.errorString()));
+ }
+
+ // second, make the dir unwriteable
+ QVERIFY(QFile::setPermissions(tempDir.path(), QFile::ReadUser | QFile::ExeUser));
+ struct UndoSetPermissions {
+ QString name;
+ UndoSetPermissions(const QString &name) : name(name) {}
+ ~UndoSetPermissions()
+ { QFile::setPermissions(name, QFile::ReadUser | QFile::WriteUser | QFile::ExeUser); }
+ };
+ UndoSetPermissions undo(tempDir.path()); // otherwise, QTemporaryDir will fail
+
+ {
+ QSettings settings(filename, QSettings::IniFormat);
+ QVERIFY(settings.isAtomicSyncRequired());
+ settings.setAtomicSyncRequired(false);
+ settings.setValue("alpha/beta", 1);
+ settings.sync();
+ QCOMPARE(settings.status(), QSettings::NoError);
+ }
+
+ QVERIFY(QFileInfo(filename).size() != 0);
+ QSettings settings(filename, QSettings::IniFormat);
+ QCOMPARE(settings.value("alpha/beta"), QVariant(1));
+}
+
+#ifdef Q_OS_WIN
+void tst_QSettings::syncAlternateDataStream()
+{
+ QTemporaryDir tempDir;
+ QVERIFY2(tempDir.isValid(), qUtf8Printable(tempDir.errorString()));
+
+ // first, create a file
+ QString filename = tempDir.path() + "/file";
+ {
+ QFile f(filename);
+ QVERIFY2(f.open(QIODevice::WriteOnly), qUtf8Printable(f.errorString()));
+ }
+
+ // then create an ADS
+ filename += ":config.ini";
+ {
+ QFile f(filename);
+ if (!f.open(QIODevice::WriteOnly))
+ QSKIP("Could not create ADS file (" + f.errorString().toUtf8() + ") - FAT drive?");
+ }
+
+ {
+ QSettings settings(filename, QSettings::IniFormat);
+ QVERIFY(settings.isAtomicSyncRequired());
+ settings.setAtomicSyncRequired(false);
+ settings.setValue("alpha/beta", 1);
+ settings.sync();
+ QCOMPARE(settings.status(), QSettings::NoError);
+ }
+
+ QVERIFY(QFileInfo(filename).size() != 0);
+ QSettings settings(filename, QSettings::IniFormat);
+ QCOMPARE(settings.value("alpha/beta"), QVariant(1));
+}
+#endif
+
void tst_QSettings::setFallbacksEnabled_data()
{
populateWithFormats();
diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST
new file mode 100644
index 0000000000..d5ee9650cd
--- /dev/null
+++ b/tests/auto/corelib/io/qstandardpaths/BLACKLIST
@@ -0,0 +1,3 @@
+[testFindExecutable]
+# QTBUG-64404
+b2qt 64bit
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 4cb3bfe549..76462be376 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -139,25 +139,24 @@ void tst_QTemporaryDir::fileTemplate_data()
{
QTest::addColumn<QString>("constructorTemplate");
QTest::addColumn<QString>("prefix");
+ QTest::addColumn<QString>("suffix");
+
+ QTest::newRow("default") << "" << "tst_qtemporarydir-" << "";
- QTest::newRow("constructor default") << "" << "tst_qtemporarydir-";
-
- QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "qt_XXXXXXxxx";
- QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "qt_XXXXXXxXx";
- QTest::newRow("constructor with no suffix") << "qt_XXXXXX" << "qt_";
- QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_";
- // When more than 6 X are present at the end, linux and windows will only replace the last 6,
- // while Mac OS will actually replace all of them so we can only expect "qt_" (and check isValid).
- QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_";
- QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_";
- QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_";
+ QTest::newRow("xxx-suffix") << "qt_XXXXXXxxx" << "qt_" << "xxx";
+ QTest::newRow("xXx-suffix") << "qt_XXXXXXxXx" << "qt_" << "xXx";
+ QTest::newRow("no-suffix") << "qt_XXXXXX" << "qt_" << "";
+ QTest::newRow("10X") << "qt_XXXXXXXXXX" << "qt_" << "";
+ QTest::newRow("4Xsuffix") << "qt_XXXXXX_XXXX" << "qt_" << "_XXXX";
+ QTest::newRow("4Xprefix") << "qt_XXXX" << "qt_XXXX" << "";
+ QTest::newRow("5Xprefix") << "qt_XXXXX" << "qt_XXXXX" << "";
if (QTestPrivate::canHandleUnicodeFileNames()) {
// Test Umlauts (contained in Latin1)
QString prefix = "qt_" + umlautTestText();
- QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix;
- // Test Chinese
+ QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << "";
+ // test non-Latin1
prefix = "qt_" + hanTestText();
- QTest::newRow("Chinese characters") << (prefix + "XXXXXX") << prefix;
+ QTest::newRow("Chinese") << (prefix + "XXXXXX" + umlautTestText()) << prefix << umlautTestText();
}
}
@@ -165,14 +164,17 @@ void tst_QTemporaryDir::fileTemplate()
{
QFETCH(QString, constructorTemplate);
QFETCH(QString, prefix);
+ QFETCH(QString, suffix);
QTemporaryDir tempDir(constructorTemplate);
QVERIFY(tempDir.isValid());
QString dirName = QDir(tempDir.path()).dirName();
- if (prefix.length())
+ if (prefix.length()) {
QCOMPARE(dirName.left(prefix.length()), prefix);
+ QCOMPARE(dirName.right(suffix.length()), suffix);
+ }
}
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index 64b61839c1..f3ce902bbd 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -32,6 +33,7 @@
#include <qtemporarydir.h>
#include <qtemporaryfile.h>
#include <qfile.h>
+#include <qdatetime.h>
#include <qdir.h>
#include <qset.h>
#include <qtextcodec.h>
@@ -65,7 +67,7 @@ private slots:
void fileNameIsEmpty();
void autoRemove();
void nonWritableCurrentDir();
- void write();
+ void io();
void openCloseOpenClose();
void removeAndReOpen();
void size();
@@ -278,6 +280,18 @@ void tst_QTemporaryFile::autoRemove()
fileName = file.fileName();
file.close();
}
+ QVERIFY(!fileName.isEmpty());
+ QVERIFY(!QFile::exists(fileName));
+
+ // same, but gets the file name after closing
+ {
+ QTemporaryFile file("tempXXXXXX");
+ file.setAutoRemove(true);
+ QVERIFY(file.open());
+ file.close();
+ fileName = file.fileName();
+ }
+ QVERIFY(!fileName.isEmpty());
QVERIFY(!QFile::exists(fileName));
// Test if disabling auto remove works.
@@ -288,6 +302,19 @@ void tst_QTemporaryFile::autoRemove()
fileName = file.fileName();
file.close();
}
+ QVERIFY(!fileName.isEmpty());
+ QVERIFY(QFile::exists(fileName));
+ QVERIFY(QFile::remove(fileName));
+
+ // same, but gets the file name after closing
+ {
+ QTemporaryFile file("tempXXXXXX");
+ file.setAutoRemove(false);
+ QVERIFY(file.open());
+ file.close();
+ fileName = file.fileName();
+ }
+ QVERIFY(!fileName.isEmpty());
QVERIFY(QFile::exists(fileName));
QVERIFY(QFile::remove(fileName));
@@ -338,17 +365,51 @@ void tst_QTemporaryFile::nonWritableCurrentDir()
#endif
}
-void tst_QTemporaryFile::write()
+void tst_QTemporaryFile::io()
{
QByteArray data("OLE\nOLE\nOLE");
QTemporaryFile file;
+ QDateTime before = QDateTime::currentDateTimeUtc().addMSecs(-250);
+
+ // discard msec component (round down) - not all FSs and OSs support them
+ before.setSecsSinceEpoch(before.toSecsSinceEpoch());
+
QVERIFY(file.open());
+ QVERIFY(file.readLink().isEmpty()); // it's not a link!
+ QFile::Permissions perm = file.permissions();
+ QVERIFY(perm & QFile::ReadOwner);
+ QVERIFY(file.setPermissions(perm));
+
+ QCOMPARE(int(file.size()), 0);
+ QVERIFY(file.resize(data.size()));
+ QCOMPARE(int(file.size()), data.size());
QCOMPARE((int)file.write(data), data.size());
+ QCOMPARE(int(file.size()), data.size());
+
+ QDateTime mtime = file.fileTime(QFile::FileModificationTime).toUTC();
+ QDateTime btime = file.fileTime(QFile::FileBirthTime).toUTC();
+ QDateTime ctime = file.fileTime(QFile::FileMetadataChangeTime).toUTC();
+ QDateTime atime = file.fileTime(QFile::FileAccessTime).toUTC();
+
+ QDateTime after = QDateTime::currentDateTimeUtc().toUTC().addMSecs(250);
+ // round msecs up
+ after.setSecsSinceEpoch(after.toSecsSinceEpoch() + 1);
+
+ // mtime must be valid, the rest could fail
+ QVERIFY(mtime <= after && mtime >= before);
+ QVERIFY(!btime.isValid() || (btime <= after && btime >= before));
+ QVERIFY(!ctime.isValid() || (ctime <= after && ctime >= before));
+ QVERIFY(!btime.isValid() || (btime <= after && btime >= before));
+
+ QVERIFY(file.setFileTime(before.addSecs(-10), QFile::FileModificationTime));
+ mtime = file.fileTime(QFile::FileModificationTime).toUTC();
+ QCOMPARE(mtime, before.addSecs(-10));
+
file.reset();
QFile compare(file.fileName());
compare.open(QIODevice::ReadOnly);
QCOMPARE(compare.readAll() , data);
- file.close();
+ QCOMPARE(compare.fileTime(QFile::FileModificationTime), mtime);
}
void tst_QTemporaryFile::openCloseOpenClose()
@@ -399,17 +460,19 @@ void tst_QTemporaryFile::size()
{
QTemporaryFile file;
QVERIFY(file.open());
- QVERIFY(file.exists());
QVERIFY(!file.isSequential());
QByteArray str("foobar");
file.write(str);
- QVERIFY(QFile::exists(file.fileName()));
+
// On CE it takes more time for the filesystem to update
// the information. Usually you have to close it or seek
// to get latest information. flush() does not help either.
QCOMPARE(file.size(), qint64(6));
file.seek(0);
QCOMPARE(file.size(), qint64(6));
+
+ QVERIFY(QFile::exists(file.fileName()));
+ QVERIFY(file.exists());
}
void tst_QTemporaryFile::resize()
@@ -806,6 +869,14 @@ void tst_QTemporaryFile::QTBUG_4796()
QCOMPARE(file5.open(), openResult);
QCOMPARE(file6.open(), openResult);
+ // force the files to exist, if they are supposed to
+ QCOMPARE(!file1.fileName().isEmpty(), openResult);
+ QCOMPARE(!file2.fileName().isEmpty(), openResult);
+ QCOMPARE(!file3.fileName().isEmpty(), openResult);
+ QCOMPARE(!file4.fileName().isEmpty(), openResult);
+ QCOMPARE(!file5.fileName().isEmpty(), openResult);
+ QCOMPARE(!file6.fileName().isEmpty(), openResult);
+
QCOMPARE(file1.exists(), openResult);
QCOMPARE(file2.exists(), openResult);
QCOMPARE(file3.exists(), openResult);
@@ -861,8 +932,6 @@ void tst_QTemporaryFile::guaranteeUnique()
// First pass. See which filename QTemporaryFile will try first.
{
- // Fix the random seed.
- qsrand(1135);
QTemporaryFile tmpFile("testFile1.XXXXXX");
tmpFile.open();
takenFileName = tmpFile.fileName();
@@ -876,8 +945,6 @@ void tst_QTemporaryFile::guaranteeUnique()
// Second pass, now we have blocked its first attempt with a directory.
{
- // Fix the random seed.
- qsrand(1135);
QTemporaryFile tmpFile("testFile1.XXXXXX");
QVERIFY(tmpFile.open());
QString uniqueFileName = tmpFile.fileName();
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 0bbd1b9f15..20282068cb 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1384,18 +1384,6 @@ void tst_QUrl::compat_constructor_01_data()
void tst_QUrl::compat_constructor_01()
{
- /* The following should work as expected:
- *
- * QUrlOperator op;
- * op.copy( QString( "Makefile" ),
- * QString("ftp://rms:grmpf12@nibbler/home/rms/tmp"),
- * false );
- *
- * as well as the following:
- *
- * QUrlOperator op;
- * op.copy(QString("ftp://ftp.qt-project.org/qt/INSTALL"), ".");
- */
QFETCH( QString, urlStr );
{
@@ -1425,11 +1413,6 @@ void tst_QUrl::compat_constructor_02_data()
void tst_QUrl::compat_constructor_02()
{
- /* The following should work as expected:
- *
- * QUrlOperator op( "ftp://ftp.qt-project.org/qt" );
- * op.copy(QString("INSTALL"), ".");
- */
QFETCH( QString, urlStr );
QFETCH( QString, fileName );
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro b/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro
deleted file mode 100644
index 4f0e9da3c2..0000000000
--- a/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qwinoverlappedionotifier
-QT = core-private testlib
-SOURCES = tst_qwinoverlappedionotifier.cpp
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
deleted file mode 100644
index 7034c2c9fd..0000000000
--- a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <private/qwinoverlappedionotifier_p.h>
-#include <qbytearray.h>
-#include <qt_windows.h>
-
-#ifndef PIPE_REJECT_REMOTE_CLIENTS
-#define PIPE_REJECT_REMOTE_CLIENTS 0x08
-#endif
-
-class tst_QWinOverlappedIoNotifier : public QObject
-{
- Q_OBJECT
-
-private slots:
- void initTestCase();
- void readFile_data();
- void readFile();
- void waitForNotified_data();
- void waitForNotified();
- void waitForAnyNotified();
- void brokenPipe();
- void multipleOperations();
-
-private:
- QFileInfo sourceFileInfo;
- DWORD notifiedBytesRead;
- DWORD notifiedErrorCode;
-};
-
-class NotifierSink : public QObject
-{
- Q_OBJECT
-public:
- NotifierSink(QWinOverlappedIoNotifier *notifier)
- : QObject(notifier),
- threshold(1)
- {
- connect(notifier, &QWinOverlappedIoNotifier::notified, this, &NotifierSink::notified);
- }
-
-protected slots:
- void notified(DWORD bytesRead, DWORD errorCode, OVERLAPPED *overlapped)
- {
- IOResult ioResult;
- ioResult.bytes = bytesRead;
- ioResult.errorCode = errorCode;
- ioResult.overlapped = overlapped;
- notifications.append(ioResult);
- if (notifications.count() >= threshold)
- emit notificationReceived();
- }
-
-signals:
- void notificationReceived();
-
-public:
- int threshold;
-
- struct IOResult
- {
- IOResult()
- : bytes(0), errorCode(ERROR_SUCCESS), overlapped(0)
- {}
- DWORD bytes;
- DWORD errorCode;
- OVERLAPPED *overlapped;
- };
-
- QList<IOResult> notifications;
-};
-
-void tst_QWinOverlappedIoNotifier::initTestCase()
-{
- sourceFileInfo.setFile(QFINDTESTDATA("tst_qwinoverlappedionotifier.cpp"));
- QVERIFY2(sourceFileInfo.exists(), "File tst_qwinoverlappedionotifier.cpp not found.");
-}
-
-void tst_QWinOverlappedIoNotifier::readFile_data()
-{
- QTest::addColumn<QString>("fileName");
- QTest::addColumn<int>("readBufferSize");
- QTest::addColumn<DWORD>("expectedBytesRead");
-
- QString sourceFileName = QDir::toNativeSeparators(sourceFileInfo.absoluteFilePath());
- int sourceFileSize = sourceFileInfo.size();
-
- QTest::newRow("read file, less than available")
- << sourceFileName << sourceFileSize / 2 << DWORD(sourceFileSize / 2);
- QTest::newRow("read file, more than available")
- << sourceFileName << sourceFileSize * 2 << DWORD(sourceFileSize);
-}
-
-void tst_QWinOverlappedIoNotifier::readFile()
-{
- QFETCH(QString, fileName);
- QFETCH(int, readBufferSize);
- QFETCH(DWORD, expectedBytesRead);
-
- QWinOverlappedIoNotifier notifier;
- NotifierSink sink(&notifier);
- connect(&sink, &NotifierSink::notificationReceived, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
-
- HANDLE hFile = CreateFile(reinterpret_cast<const wchar_t*>(fileName.utf16()),
- GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
- notifier.setHandle(hFile);
- notifier.setEnabled(true);
-
- OVERLAPPED overlapped;
- ZeroMemory(&overlapped, sizeof(OVERLAPPED));
- QByteArray buffer(readBufferSize, 0);
- BOOL readSuccess = ReadFile(hFile, buffer.data(), buffer.size(), NULL, &overlapped);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- QTestEventLoop::instance().enterLoop(3);
- CloseHandle(hFile);
- QCOMPARE(sink.notifications.count(), 1);
- QCOMPARE(sink.notifications.last().bytes, expectedBytesRead);
- QCOMPARE(sink.notifications.last().errorCode, DWORD(ERROR_SUCCESS));
- QCOMPARE(sink.notifications.last().overlapped, &overlapped);
-}
-
-void tst_QWinOverlappedIoNotifier::waitForNotified_data()
-{
- readFile_data();
-}
-
-void tst_QWinOverlappedIoNotifier::waitForNotified()
-{
- QFETCH(QString, fileName);
- QFETCH(int, readBufferSize);
- QFETCH(DWORD, expectedBytesRead);
-
- QWinOverlappedIoNotifier notifier;
- NotifierSink sink(&notifier);
- HANDLE hFile = CreateFile(reinterpret_cast<const wchar_t*>(fileName.utf16()),
- GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
- notifier.setHandle(hFile);
- notifier.setEnabled(true);
- QCOMPARE(notifier.waitForNotified(100, 0), false);
-
- OVERLAPPED overlapped;
- ZeroMemory(&overlapped, sizeof(OVERLAPPED));
- QByteArray buffer(readBufferSize, 0);
- BOOL readSuccess = ReadFile(hFile, buffer.data(), buffer.size(), NULL, &overlapped);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- QCOMPARE(notifier.waitForNotified(3000, &overlapped), true);
- CloseHandle(hFile);
- QCOMPARE(sink.notifications.count(), 1);
- QCOMPARE(sink.notifications.last().bytes, expectedBytesRead);
- QCOMPARE(sink.notifications.last().errorCode, DWORD(ERROR_SUCCESS));
- QCOMPARE(sink.notifications.last().overlapped, &overlapped);
- QCOMPARE(notifier.waitForNotified(100, &overlapped), false);
-}
-
-void tst_QWinOverlappedIoNotifier::waitForAnyNotified()
-{
- const QString fileName = QDir::toNativeSeparators(sourceFileInfo.absoluteFilePath());
- const int readBufferSize = sourceFileInfo.size();
-
- QWinOverlappedIoNotifier notifier;
- HANDLE hFile = CreateFile(reinterpret_cast<const wchar_t*>(fileName.utf16()),
- GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
- notifier.setHandle(hFile);
- notifier.setEnabled(true);
- QVERIFY(!notifier.waitForAnyNotified(100));
-
- OVERLAPPED overlapped1;
- ZeroMemory(&overlapped1, sizeof(OVERLAPPED));
- QByteArray buffer1(readBufferSize, 0);
- BOOL readSuccess = ReadFile(hFile, buffer1.data(), buffer1.size(), NULL, &overlapped1);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- OVERLAPPED overlapped2;
- ZeroMemory(&overlapped2, sizeof(OVERLAPPED));
- QByteArray buffer2(readBufferSize, 0);
- readSuccess = ReadFile(hFile, buffer2.data(), buffer2.size(), NULL, &overlapped2);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- QSet<OVERLAPPED *> overlappedObjects;
- overlappedObjects << &overlapped1 << &overlapped2;
-
- for (int i = 1; i <= 2; ++i) {
- OVERLAPPED *notifiedOverlapped = notifier.waitForAnyNotified(3000);
- QVERIFY(overlappedObjects.contains(notifiedOverlapped));
- overlappedObjects.remove(notifiedOverlapped);
- }
-
- CloseHandle(hFile);
- QVERIFY(overlappedObjects.isEmpty());
- QVERIFY(!notifier.waitForAnyNotified(100));
-}
-
-void tst_QWinOverlappedIoNotifier::brokenPipe()
-{
- QWinOverlappedIoNotifier notifier;
- NotifierSink sink(&notifier);
- connect(&sink, &NotifierSink::notificationReceived, &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
-
- wchar_t pipeName[] = L"\\\\.\\pipe\\tst_QWinOverlappedIoNotifier_brokenPipe";
- HANDLE hPipe = CreateNamedPipe(pipeName,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE | PIPE_NOWAIT | PIPE_REJECT_REMOTE_CLIENTS,
- 1, 0, 0, 0, NULL);
- QVERIFY(hPipe != INVALID_HANDLE_VALUE);
- HANDLE hReadEnd = CreateFile(pipeName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
- QVERIFY(hReadEnd != INVALID_HANDLE_VALUE);
- notifier.setHandle(hReadEnd);
- notifier.setEnabled(true);
-
- OVERLAPPED overlapped;
- ZeroMemory(&overlapped, sizeof(OVERLAPPED));
- QByteArray buffer(1024, 0);
- BOOL readSuccess = ReadFile(hReadEnd, buffer.data(), buffer.size(), NULL, &overlapped);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- // close the write end of the pipe
- CloseHandle(hPipe);
-
- QTestEventLoop::instance().enterLoop(3);
- CloseHandle(hReadEnd);
- QCOMPARE(sink.notifications.count(), 1);
- QCOMPARE(sink.notifications.last().bytes, DWORD(0));
- QCOMPARE(sink.notifications.last().errorCode, DWORD(ERROR_BROKEN_PIPE));
- QCOMPARE(sink.notifications.last().overlapped, &overlapped);
-}
-
-void tst_QWinOverlappedIoNotifier::multipleOperations()
-{
- QWinOverlappedIoNotifier clientNotifier;
- NotifierSink sink(&clientNotifier);
- sink.threshold = 2;
- connect(&sink, &NotifierSink::notificationReceived,
- &QTestEventLoop::instance(), &QTestEventLoop::exitLoop);
-
- wchar_t pipeName[] = L"\\\\.\\pipe\\tst_QWinOverlappedIoNotifier_multipleOperations";
- HANDLE hServer = CreateNamedPipe(pipeName,
- PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_BYTE | PIPE_NOWAIT | PIPE_REJECT_REMOTE_CLIENTS,
- 1, 0, 0, 0, NULL);
- QVERIFY(hServer != INVALID_HANDLE_VALUE);
- HANDLE hClient = CreateFile(pipeName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
- QVERIFY(hClient != INVALID_HANDLE_VALUE);
- clientNotifier.setHandle(hClient);
- clientNotifier.setEnabled(true);
-
- // start async read on client
- QByteArray clientReadBuffer(377, Qt::Uninitialized);
- OVERLAPPED clientReadOverlapped;
- ZeroMemory(&clientReadOverlapped, sizeof(clientReadOverlapped));
- BOOL readSuccess = ReadFile(hClient, clientReadBuffer.data(), clientReadBuffer.size(),
- NULL, &clientReadOverlapped);
- QVERIFY(readSuccess || GetLastError() == ERROR_IO_PENDING);
-
- // start async write client -> server
- QByteArray clientDataToWrite(233, 'B');
- OVERLAPPED clientWriteOverlapped;
- ZeroMemory(&clientWriteOverlapped, sizeof(clientWriteOverlapped));
- BOOL writeSuccess = WriteFile(hClient, clientDataToWrite.data(), clientDataToWrite.size(),
- NULL, &clientWriteOverlapped);
- QVERIFY(writeSuccess || GetLastError() == ERROR_IO_PENDING);
-
- // start async write server -> client
- QByteArray serverDataToWrite(144, 'A');
- OVERLAPPED serverOverlapped;
- ZeroMemory(&serverOverlapped, sizeof(serverOverlapped));
- writeSuccess = WriteFile(hServer, serverDataToWrite.data(), serverDataToWrite.size(),
- NULL, &serverOverlapped);
- QVERIFY(writeSuccess || GetLastError() == ERROR_IO_PENDING);
-
- // read synchronously on server to complete the client -> server write
- QByteArray serverReadBuffer(610, Qt::Uninitialized);
- DWORD dwBytesRead = 0;
- readSuccess = ReadFile(hServer, serverReadBuffer.data(), serverReadBuffer.size(),
- &dwBytesRead, NULL);
- QVERIFY(readSuccess);
- QCOMPARE(int(dwBytesRead), clientDataToWrite.size());
- serverReadBuffer.resize(dwBytesRead);
- QCOMPARE(serverReadBuffer, clientDataToWrite);
-
- QTestEventLoop::instance().enterLoop(3);
- QTRY_COMPARE(sink.notifications.count(), 2);
- foreach (const NotifierSink::IOResult &r, sink.notifications) {
- QCOMPARE(r.errorCode, DWORD(ERROR_SUCCESS));
- if (r.bytes == DWORD(serverDataToWrite.count()))
- QCOMPARE(r.overlapped, &clientReadOverlapped);
- else if (r.bytes == DWORD(clientDataToWrite.count()))
- QCOMPARE(r.overlapped, &clientWriteOverlapped);
- else
- QVERIFY2(false, "Unexpected number of bytes received.");
- }
-
- CloseHandle(hClient);
- CloseHandle(hServer);
-}
-
-QTEST_MAIN(tst_QWinOverlappedIoNotifier)
-
-#include "tst_qwinoverlappedionotifier.moc"
diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro
index c1d75cc2cb..a09f03a7b4 100644
--- a/tests/auto/corelib/itemmodels/itemmodels.pro
+++ b/tests/auto/corelib/itemmodels/itemmodels.pro
@@ -7,6 +7,7 @@ qtHaveModule(gui): SUBDIRS += \
qabstractproxymodel \
qidentityproxymodel \
qitemselectionmodel \
+ qsortfilterproxymodel_recursive \
qtHaveModule(widgets) {
SUBDIRS += \
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index bc8f0c1c51..1fb51490db 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -94,6 +94,7 @@ private slots:
void changeSourceDataKeepsStableSorting_qtbug1548();
void changeSourceDataForwardsRoles_qtbug35440();
void resortingDoesNotBreakTreeModels();
+ void dynamicFilterWithoutSort();
void sortFilterRole();
void selectionFilteredOut();
void match_data();
@@ -148,6 +149,9 @@ private slots:
void sourceLayoutChangeLeavesValidPersistentIndexes();
void rowMoveLeavesValidPersistentIndexes();
+ void emitLayoutChangedOnlyIfSortingChanged_data();
+ void emitLayoutChangedOnlyIfSortingChanged();
+
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
void checkHierarchy(const QStringList &data, const QAbstractItemModel *model);
@@ -2057,8 +2061,6 @@ static void checkSortedTableModel(const QAbstractItemModel *model, const QString
void tst_QSortFilterProxyModel::changeSourceDataKeepsStableSorting_qtbug1548()
{
- QSKIP("This test will fail, see QTBUG-1548");
-
// Check that emitting dataChanged from the source model
// for a change of a role which is not the sorting role
// doesn't alter the sorting. In this case, we sort on the DisplayRole,
@@ -3568,6 +3570,13 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
parentItem = item;
}
}
+ // item 0
+ // item 10
+ // - item 1
+ // - item 11
+ // - item 2
+ // - item 12
+ // ...
QSortFilterProxyModel proxy;
proxy.sort(0, Qt::AscendingOrder);
@@ -3609,11 +3618,12 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
QVERIFY(proxy2ParentsChangedSpy.isValid());
QStandardItem *item = model.invisibleRootItem()->child(1)->child(1);
+ QCOMPARE(item->text(), QStringLiteral("item 11"));
// Ensure mapped:
proxy.mapFromSource(model.indexFromItem(item));
- item->setData("Changed");
+ item->setText("Changed");
QCOMPARE(dataChangedSpy.size(), 1);
QCOMPARE(layoutAboutToBeChangedSpy.size(), 1);
@@ -3883,7 +3893,7 @@ void tst_QSortFilterProxyModel::hierarchyFilterInvalidation()
view.setCurrentIndex(proxy.index(2, 0).child(0, 0));
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
proxy.setMode(true);
}
@@ -3940,7 +3950,7 @@ void tst_QSortFilterProxyModel::simpleFilterInvalidation()
view.setModel(&proxy);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
proxy.setMode(true);
model.insertRow(0, new QStandardItem("extra"));
@@ -4026,7 +4036,7 @@ public:
}
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const
+ QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
{
Q_ASSERT(sourceModel());
return QSortFilterProxyModel::mapToSource(proxyIndex);
@@ -4353,5 +4363,152 @@ void tst_QSortFilterProxyModel::rowMoveLeavesValidPersistentIndexes()
QVERIFY(persistentIndex.parent().isValid());
}
+void tst_QSortFilterProxyModel::emitLayoutChangedOnlyIfSortingChanged_data()
+{
+ QTest::addColumn<int>("changedRow");
+ QTest::addColumn<Qt::ItemDataRole>("changedRole");
+ QTest::addColumn<QString>("newData");
+ QTest::addColumn<QString>("expectedSourceRowTexts");
+ QTest::addColumn<QString>("expectedProxyRowTexts");
+ QTest::addColumn<int>("expectedLayoutChanged");
+
+ // Starting point:
+ // a source model with 8,7,6,5,4,3,2,1
+ // a proxy model keeping only even rows and sorting them, therefore showing 2,4,6,8
+
+ // When setData changes ordering, layoutChanged should be emitted
+ QTest::newRow("ordering_change") << 0 << Qt::DisplayRole << "0" << "07654321" << "0246" << 1;
+
+ // When setData on visible row doesn't change ordering, layoutChanged should not be emitted
+ QTest::newRow("no_ordering_change") << 6 << Qt::DisplayRole << "0" << "87654301" << "0468" << 0;
+
+ // When setData happens on a filtered out row, layoutChanged should not be emitted
+ QTest::newRow("filtered_out") << 1 << Qt::DisplayRole << "9" << "89654321" << "2468" << 0;
+
+ // When setData makes a row visible, layoutChanged should not be emitted (rowsInserted is emitted instead)
+ QTest::newRow("make_row_visible") << 7 << Qt::DisplayRole << "0" << "87654320" << "02468" << 0;
+
+ // When setData makes a row hidden, layoutChanged should not be emitted (rowsRemoved is emitted instead)
+ QTest::newRow("make_row_hidden") << 4 << Qt::DisplayRole << "1" << "87651321" << "268" << 0;
+
+ // When setData happens on an unrelated role, layoutChanged should not be emitted
+ QTest::newRow("unrelated_role") << 0 << Qt::DecorationRole << "" << "87654321" << "2468" << 0;
+
+ // When many changes happen together... and trigger removal, insertion, and layoutChanged
+ QTest::newRow("many_changes") << -1 << Qt::DisplayRole << "3,4,2,5,6,0,7,9" << "34256079" << "0246" << 1;
+
+ // When many changes happen together... and trigger removal, insertion, but no change in ordering of visible rows => no layoutChanged
+ QTest::newRow("many_changes_no_layoutChanged") << -1 << Qt::DisplayRole << "7,5,4,3,2,1,0,8" << "75432108" << "0248" << 0;
+}
+
+void tst_QSortFilterProxyModel::emitLayoutChangedOnlyIfSortingChanged()
+{
+ QFETCH(int, changedRow);
+ QFETCH(QString, newData);
+ QFETCH(Qt::ItemDataRole, changedRole);
+ QFETCH(QString, expectedSourceRowTexts);
+ QFETCH(QString, expectedProxyRowTexts);
+ QFETCH(int, expectedLayoutChanged);
+
+ // Custom version of QStringListModel which supports emitting dataChanged for many rows at once
+ class CustomStringListModel : public QAbstractListModel
+ {
+ public:
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override
+ {
+ if (index.row() >= 0 && index.row() < lst.size()
+ && (role == Qt::EditRole || role == Qt::DisplayRole)) {
+ lst.replace(index.row(), value.toString());
+ emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole});
+ return true;
+ }
+ return false;
+ }
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
+ {
+ if (role == Qt::DisplayRole || role == Qt::EditRole)
+ return lst.at(index.row());
+ return QVariant();
+ }
+ int rowCount(const QModelIndex & = QModelIndex()) const override
+ {
+ return lst.count();
+ }
+
+ void replaceData(const QStringList &newData)
+ {
+ lst = newData;
+ emit dataChanged(index(0, 0), index(rowCount()-1, 0), {Qt::DisplayRole, Qt::EditRole});
+ }
+
+ void emitDecorationChangedSignal()
+ {
+ const QModelIndex idx = index(0, 0);
+ emit dataChanged(idx, idx, {Qt::DecorationRole});
+ }
+ private:
+ QStringList lst;
+ };
+ CustomStringListModel model;
+ QStringList strings;
+ for (auto i = 8; i >= 1; --i)
+ strings.append(QString::number(i));
+ model.replaceData(strings);
+ QCOMPARE(rowTexts(&model), QStringLiteral("87654321"));
+
+ class FilterEvenRowsProxyModel : public QSortFilterProxyModel
+ {
+ public:
+ bool filterAcceptsRow(int srcRow, const QModelIndex& srcParent) const override
+ {
+ return sourceModel()->index(srcRow, 0, srcParent).data().toInt() % 2 == 0;
+ }
+ };
+
+ FilterEvenRowsProxyModel proxy;
+ proxy.sort(0);
+ proxy.setSourceModel(&model);
+ QCOMPARE(rowTexts(&proxy), QStringLiteral("2468"));
+
+ QSignalSpy modelDataChangedSpy(&model, &QAbstractItemModel::dataChanged);
+ QSignalSpy proxyLayoutChangedSpy(&proxy, &QAbstractItemModel::layoutChanged);
+
+ if (changedRole == Qt::DecorationRole)
+ model.emitDecorationChangedSignal();
+ else if (changedRow == -1)
+ model.replaceData(newData.split(QLatin1Char(',')));
+ else
+ model.setData(model.index(changedRow, 0), newData, changedRole);
+
+ QCOMPARE(rowTexts(&model), expectedSourceRowTexts);
+ QCOMPARE(rowTexts(&proxy), expectedProxyRowTexts);
+ QCOMPARE(modelDataChangedSpy.size(), 1);
+ QCOMPARE(proxyLayoutChangedSpy.size(), expectedLayoutChanged);
+}
+
+void tst_QSortFilterProxyModel::dynamicFilterWithoutSort()
+{
+ QStringListModel model;
+ const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' '));
+ model.setStringList(initial);
+ QSortFilterProxyModel proxy;
+ proxy.setDynamicSortFilter(true);
+ proxy.setSourceModel(&model);
+
+ QSignalSpy layoutChangeSpy(&proxy, &QAbstractItemModel::layoutChanged);
+ QSignalSpy resetSpy(&proxy, &QAbstractItemModel::modelReset);
+
+ QVERIFY(layoutChangeSpy.isValid());
+ QVERIFY(resetSpy.isValid());
+
+ model.setStringList(QStringList() << "Monday" << "Tuesday" << "Wednesday" << "Thursday" << "Friday");
+
+ QVERIFY(layoutChangeSpy.isEmpty());
+
+ QCOMPARE(model.stringList(), QStringList() << "Monday" << "Tuesday" << "Wednesday" << "Thursday" << "Friday");
+
+ QCOMPARE(resetSpy.count(), 1);
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/.gitignore b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/.gitignore
new file mode 100644
index 0000000000..2007aaabbd
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/.gitignore
@@ -0,0 +1 @@
+tst_qsortfilterproxymodel_recursive
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/qsortfilterproxymodel_recursive.pro b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/qsortfilterproxymodel_recursive.pro
new file mode 100644
index 0000000000..a8b793dbc6
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/qsortfilterproxymodel_recursive.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase
+CONFIG += parallel_test
+TARGET = tst_qsortfilterproxymodel_recursive
+
+QT += testlib
+
+SOURCES += tst_qsortfilterproxymodel_recursive.cpp
+DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
new file mode 100644
index 0000000000..54c79e0893
--- /dev/null
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
@@ -0,0 +1,727 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, authors Filipe Azevedo <filipe.azevedo@kdab.com> and David Faure <david.faure@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTest>
+#include <QSignalSpy>
+
+#include <QtCore/QSortFilterProxyModel>
+#include <QtGui/QStandardItem>
+
+Q_DECLARE_METATYPE(QModelIndex)
+
+class ModelSignalSpy : public QObject {
+ Q_OBJECT
+public:
+ explicit ModelSignalSpy(QAbstractItemModel &model) {
+ connect(&model, &QAbstractItemModel::rowsInserted, this, &ModelSignalSpy::onRowsInserted);
+ connect(&model, &QAbstractItemModel::rowsRemoved, this, &ModelSignalSpy::onRowsRemoved);
+ connect(&model, &QAbstractItemModel::rowsAboutToBeInserted, this, &ModelSignalSpy::onRowsAboutToBeInserted);
+ connect(&model, &QAbstractItemModel::rowsAboutToBeRemoved, this, &ModelSignalSpy::onRowsAboutToBeRemoved);
+ connect(&model, &QAbstractItemModel::rowsMoved, this, &ModelSignalSpy::onRowsMoved);
+ connect(&model, &QAbstractItemModel::dataChanged, this, &ModelSignalSpy::onDataChanged);
+ connect(&model, &QAbstractItemModel::layoutChanged, this, &ModelSignalSpy::onLayoutChanged);
+ connect(&model, &QAbstractItemModel::modelReset, this, &ModelSignalSpy::onModelReset);
+ }
+
+ QStringList mSignals;
+
+private Q_SLOTS:
+ void onRowsInserted(QModelIndex p, int start, int end) {
+ mSignals << QLatin1String("rowsInserted(") + textForRowSpy(p, start, end) + ')';
+ }
+ void onRowsRemoved(QModelIndex p, int start, int end) {
+ mSignals << QLatin1String("rowsRemoved(") + textForRowSpy(p, start, end) + ')';
+ }
+ void onRowsAboutToBeInserted(QModelIndex p, int start, int end) {
+ mSignals << QLatin1String("rowsAboutToBeInserted(") + textForRowSpy(p, start, end) + ')';
+ }
+ void onRowsAboutToBeRemoved(QModelIndex p, int start, int end) {
+ mSignals << QLatin1String("rowsAboutToBeRemoved(") + textForRowSpy(p, start, end) + ')';
+ }
+ void onRowsMoved(QModelIndex,int,int,QModelIndex,int) {
+ mSignals << QStringLiteral("rowsMoved");
+ }
+ void onDataChanged(const QModelIndex &from, const QModelIndex& ) {
+ mSignals << QStringLiteral("dataChanged(%1)").arg(from.data().toString());
+ }
+ void onLayoutChanged() {
+ mSignals << QStringLiteral("layoutChanged");
+ }
+ void onModelReset() {
+ mSignals << QStringLiteral("modelReset");
+ }
+private:
+ QString textForRowSpy(const QModelIndex &parent, int start, int end)
+ {
+ QString txt = parent.data().toString();
+ if (!txt.isEmpty())
+ txt += QLatin1Char('.');
+ txt += QString::number(start+1);
+ if (start != end)
+ txt += QLatin1Char('-') + QString::number(end+1);
+ return txt;
+ }
+};
+
+class TestModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ TestModel(QAbstractItemModel *sourceModel)
+ : QSortFilterProxyModel()
+ {
+ setRecursiveFiltering(true);
+ setSourceModel(sourceModel);
+ }
+
+ virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
+ {
+ return sourceModel()->index(sourceRow, 0, sourceParent).data(Qt::UserRole +1).toBool()
+ && QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
+ }
+};
+
+// Represents this tree
+// - A
+// - - B
+// - - - C
+// - - - D
+// - - E
+// as a single string, englobing children in brackets, like this:
+// [A[B[C D] E]]
+// In addition, items that match the filtering (data(UserRole+1) == true) have a * after their value.
+static QString treeAsString(const QAbstractItemModel &model, const QModelIndex &parent = QModelIndex())
+{
+ QString ret;
+ const int rowCount = model.rowCount(parent);
+ if (rowCount > 0) {
+ ret += QLatin1Char('[');
+ for (int row = 0 ; row < rowCount; ++row) {
+ if (row > 0) {
+ ret += ' ';
+ }
+ const QModelIndex child = model.index(row, 0, parent);
+ ret += child.data().toString();
+ if (child.data(Qt::UserRole+1).toBool())
+ ret += QLatin1Char('*');
+ ret += treeAsString(model, child);
+ }
+ ret += QLatin1Char(']');
+ }
+ return ret;
+}
+
+// Fill a tree model based on a string representation (see treeAsString)
+static void fillModel(QStandardItemModel &model, const QString &str)
+{
+ QCOMPARE(str.count('['), str.count(']'));
+ QStandardItem *item = 0;
+ QString data;
+ for ( int i = 0 ; i < str.length() ; ++i ) {
+ const QChar ch = str.at(i);
+ if ((ch == '[' || ch == ']' || ch == ' ') && !data.isEmpty()) {
+ if (data.endsWith('*')) {
+ item->setData(true, Qt::UserRole + 1);
+ data.chop(1);
+ }
+ item->setText(data);
+ data.clear();
+ }
+ if (ch == '[') {
+ // Create new child
+ QStandardItem *child = new QStandardItem;
+ if (item)
+ item->appendRow(child);
+ else
+ model.appendRow(child);
+ item = child;
+ } else if (ch == ']') {
+ // Go up to parent
+ item = item->parent();
+ } else if (ch == ' ') {
+ // Create new sibling
+ QStandardItem *child = new QStandardItem;
+ QStandardItem *parent = item->parent();
+ if (parent)
+ parent->appendRow(child);
+ else
+ model.appendRow(child);
+ item = child;
+ } else {
+ data += ch;
+ }
+ }
+}
+
+class tst_QSortFilterProxyModel_Recursive : public QObject
+{
+ Q_OBJECT
+private:
+private Q_SLOTS:
+ void testInitialFiltering_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("proxyStr");
+
+ QTest::newRow("empty") << "[]" << "";
+ QTest::newRow("no") << "[1]" << "";
+ QTest::newRow("yes") << "[1*]" << "[1*]";
+ QTest::newRow("second") << "[1 2*]" << "[2*]";
+ QTest::newRow("child_yes") << "[1 2[2.1*]]" << "[2[2.1*]]";
+ QTest::newRow("grandchild_yes") << "[1 2[2.1[2.1.1*]]]" << "[2[2.1[2.1.1*]]]";
+ // 1, 3.1 and 4.2.1 match, so their parents are in the model
+ QTest::newRow("more") << "[1* 2[2.1] 3[3.1*] 4[4.1 4.2[4.2.1*]]]" << "[1* 3[3.1*] 4[4.2[4.2.1*]]]";
+ }
+
+ void testInitialFiltering()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, proxyStr);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), proxyStr);
+ }
+
+ // Test changing a role that is unrelated to the filtering.
+ void testUnrelatedDataChange()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1[1.1.1*]]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), sourceStr);
+
+ ModelSignalSpy spy(proxy);
+ QStandardItem *item_1_1_1 = model.item(0)->child(0)->child(0);
+
+ // When changing the text on the item
+ item_1_1_1->setText(QStringLiteral("ME"));
+
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[ME*]]]"));
+
+ QCOMPARE(spy.mSignals, QStringList()
+ << QStringLiteral("dataChanged(ME)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+ }
+
+ // Test changing a role that is unrelated to the filtering, in a hidden item.
+ void testHiddenDataChange()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1[1.1.1]]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), QString());
+
+ ModelSignalSpy spy(proxy);
+ QStandardItem *item_1_1_1 = model.item(0)->child(0)->child(0);
+
+ // When changing the text on a hidden item
+ item_1_1_1->setText(QStringLiteral("ME"));
+
+ QCOMPARE(treeAsString(proxy), QString());
+ QCOMPARE(spy.mSignals, QStringList());
+ }
+
+ // Test that we properly react to a data-changed signal in a descendant and include all required rows
+ void testDataChangeIn_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("initialProxyStr");
+ QTest::addColumn<QString>("add"); // set the flag on this item
+ QTest::addColumn<QString>("expectedProxyStr");
+ QTest::addColumn<QStringList>("expectedSignals");
+
+ QTest::newRow("toplevel") << "[1]" << "" << "1" << "[1*]"
+ << (QStringList() << QStringLiteral("rowsAboutToBeInserted(1)") << QStringLiteral("rowsInserted(1)"));
+ QTest::newRow("show_parents") << "[1[1.1[1.1.1]]]" << "" << "1.1.1" << "[1[1.1[1.1.1*]]]"
+ << (QStringList() << QStringLiteral("rowsAboutToBeInserted(1)") << QStringLiteral("rowsInserted(1)"));
+
+ const QStringList insert_1_1_1 = QStringList()
+ << QStringLiteral("rowsAboutToBeInserted(1.1.1)")
+ << QStringLiteral("rowsInserted(1.1.1)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)")
+ ;
+ QTest::newRow("parent_visible") << "[1[1.1*[1.1.1]]]" << "[1[1.1*]]" << "1.1.1" << "[1[1.1*[1.1.1*]]]"
+ << insert_1_1_1;
+
+ QTest::newRow("sibling_visible") << "[1[1.1[1.1.1 1.1.2*]]]" << "[1[1.1[1.1.2*]]]" << "1.1.1" << "[1[1.1[1.1.1* 1.1.2*]]]"
+ << insert_1_1_1;
+
+ QTest::newRow("visible_cousin") << "[1[1.1[1.1.1 1.1.2[1.1.2.1*]]]]" << "[1[1.1[1.1.2[1.1.2.1*]]]]" << "1.1.1" << "[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]"
+ << insert_1_1_1;
+
+ QTest::newRow("show_parent") << "[1[1.1[1.1.1 1.1.2] 1.2*]]" << "[1[1.2*]]" << "1.1.1" << "[1[1.1[1.1.1*] 1.2*]]"
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeInserted(1.1)")
+ << QStringLiteral("rowsInserted(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ QTest::newRow("with_children") << "[1[1.1[1.1.1[1.1.1.1*]]] 2*]" << "[1[1.1[1.1.1[1.1.1.1*]]] 2*]" << "1.1.1" << "[1[1.1[1.1.1*[1.1.1.1*]]] 2*]"
+ << (QStringList()
+ << QStringLiteral("dataChanged(1.1.1)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ }
+
+ void testDataChangeIn()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, initialProxyStr);
+ QFETCH(QString, add);
+ QFETCH(QString, expectedProxyStr);
+ QFETCH(QStringList, expectedSignals);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), initialProxyStr);
+
+ ModelSignalSpy spy(proxy);
+ // When changing the data on the designated item to show this row
+ QStandardItem *itemToChange = itemByText(model, add);
+ QVERIFY(!itemToChange->data().toBool());
+ itemToChange->setData(true);
+
+ // The proxy should update as expected
+ QCOMPARE(treeAsString(proxy), expectedProxyStr);
+
+ //qDebug() << spy.mSignals;
+ QCOMPARE(spy.mSignals, expectedSignals);
+ }
+
+ void testDataChangeOut_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("initialProxyStr");
+ QTest::addColumn<QString>("remove"); // unset the flag on this item
+ QTest::addColumn<QString>("expectedProxyStr");
+ QTest::addColumn<QStringList>("expectedSignals");
+
+ const QStringList remove1_1_1 = (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ QTest::newRow("toplevel") << "[1*]" << "[1*]" << "1" << ""
+ << (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1)") << QStringLiteral("rowsRemoved(1)"));
+
+ QTest::newRow("hide_parent") << "[1[1.1[1.1.1*]]]" << "[1[1.1[1.1.1*]]]" << "1.1.1" << "" <<
+ (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1.1)")
+ << QStringLiteral("rowsRemoved(1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1)")
+ << QStringLiteral("rowsRemoved(1)"));
+
+ QTest::newRow("parent_visible") << "[1[1.1*[1.1.1*]]]" << "[1[1.1*[1.1.1*]]]" << "1.1.1" << "[1[1.1*]]"
+ << remove1_1_1;
+
+ QTest::newRow("visible") << "[1[1.1[1.1.1* 1.1.2*]]]" << "[1[1.1[1.1.1* 1.1.2*]]]" << "1.1.1" << "[1[1.1[1.1.2*]]]"
+ << remove1_1_1;
+ QTest::newRow("visible_cousin") << "[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]" << "[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]" << "1.1.1" << "[1[1.1[1.1.2[1.1.2.1*]]]]"
+ << remove1_1_1;
+
+ // The following tests trigger the removal of an ascendant.
+ QTest::newRow("remove_parent") << "[1[1.1[1.1.1* 1.1.2] 1.2*]]" << "[1[1.1[1.1.1*] 1.2*]]" << "1.1.1" << "[1[1.2*]]"
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1.1)")
+ << QStringLiteral("rowsRemoved(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ QTest::newRow("with_children") << "[1[1.1[1.1.1*[1.1.1.1*]]] 2*]" << "[1[1.1[1.1.1*[1.1.1.1*]]] 2*]" << "1.1.1" << "[1[1.1[1.1.1[1.1.1.1*]]] 2*]"
+ << (QStringList()
+ << QStringLiteral("dataChanged(1.1.1)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ QTest::newRow("last_visible") << "[1[1.1[1.1.1* 1.1.2]]]" << "[1[1.1[1.1.1*]]]" << "1.1.1" << ""
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1.1)")
+ << QStringLiteral("rowsRemoved(1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1)")
+ << QStringLiteral("rowsRemoved(1)"));
+
+ }
+
+ void testDataChangeOut()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, initialProxyStr);
+ QFETCH(QString, remove);
+ QFETCH(QString, expectedProxyStr);
+ QFETCH(QStringList, expectedSignals);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), initialProxyStr);
+
+ ModelSignalSpy spy(proxy);
+
+ // When changing the data on the designated item to exclude this row again
+ QStandardItem *itemToChange = itemByText(model, remove);
+ QVERIFY(itemToChange->data().toBool());
+ itemToChange->setData(false);
+
+ // The proxy should update as expected
+ QCOMPARE(treeAsString(proxy), expectedProxyStr);
+
+ //qDebug() << spy.mSignals;
+ QCOMPARE(spy.mSignals, expectedSignals);
+ }
+
+ void testInsert()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1[1.1.1]]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), QString());
+
+ ModelSignalSpy spy(proxy);
+ QStandardItem *item_1_1_1 = model.item(0)->child(0)->child(0);
+ QStandardItem *item_1_1_1_1 = new QStandardItem(QStringLiteral("1.1.1.1"));
+ item_1_1_1_1->setData(true);
+ item_1_1_1->appendRow(item_1_1_1_1);
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[1.1.1[1.1.1.1*]]]]"));
+
+ QCOMPARE(spy.mSignals, QStringList() << QStringLiteral("rowsAboutToBeInserted(1)")
+ << QStringLiteral("rowsInserted(1)"));
+ }
+
+ // Start from [1[1.1[1.1.1 1.1.2[1.1.2.1*]]]]
+ // where 1.1.1 is hidden but 1.1 is shown, we want to insert a shown child in 1.1.1.
+ // The proxy ensures dataChanged is called on 1.1,
+ // so that 1.1.1 and 1.1.1.1 are included in the model.
+ void testInsertCousin()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1[1.1.1 1.1.2[1.1.2.1*]]]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[1.1.2[1.1.2.1*]]]]"));
+
+ ModelSignalSpy spy(proxy);
+ {
+ QStandardItem *item_1_1_1_1 = new QStandardItem(QStringLiteral("1.1.1.1"));
+ item_1_1_1_1->setData(true);
+ QStandardItem *item_1_1_1 = model.item(0)->child(0)->child(0);
+ item_1_1_1->appendRow(item_1_1_1_1);
+ }
+
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[1.1.1[1.1.1.1*] 1.1.2[1.1.2.1*]]]]"));
+ //qDebug() << spy.mSignals;
+ QCOMPARE(spy.mSignals, QStringList()
+ << QStringLiteral("rowsAboutToBeInserted(1.1.1)")
+ << QStringLiteral("rowsInserted(1.1.1)")
+ << QStringLiteral("dataChanged(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+ }
+
+ void testInsertWithChildren()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), QString());
+
+ ModelSignalSpy spy(proxy);
+ {
+ QStandardItem *item_1_1_1 = new QStandardItem(QStringLiteral("1.1.1"));
+ QStandardItem *item_1_1_1_1 = new QStandardItem(QStringLiteral("1.1.1.1"));
+ item_1_1_1_1->setData(true);
+ item_1_1_1->appendRow(item_1_1_1_1);
+
+ QStandardItem *item_1_1 = model.item(0)->child(0);
+ item_1_1->appendRow(item_1_1_1);
+ }
+
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[1.1.1[1.1.1.1*]]]]"));
+ QCOMPARE(spy.mSignals, QStringList()
+ << QStringLiteral("rowsAboutToBeInserted(1)")
+ << QStringLiteral("rowsInserted(1)"));
+ }
+
+ void testInsertIntoVisibleWithChildren()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1[1.1.1*]]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), sourceStr);
+
+ ModelSignalSpy spy(proxy);
+ {
+ QStandardItem *item_1_1_2 = new QStandardItem(QStringLiteral("1.1.2"));
+ QStandardItem *item_1_1_2_1 = new QStandardItem(QStringLiteral("1.1.2.1"));
+ item_1_1_2_1->setData(true);
+ item_1_1_2->appendRow(item_1_1_2_1);
+
+ QStandardItem *item_1_1 = model.item(0)->child(0);
+ item_1_1->appendRow(item_1_1_2);
+ }
+
+ QCOMPARE(treeAsString(proxy), QStringLiteral("[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]"));
+ QCOMPARE(spy.mSignals, QStringList()
+ << QStringLiteral("rowsAboutToBeInserted(1.1.2)")
+ << QStringLiteral("rowsInserted(1.1.2)"));
+ }
+
+ void testInsertBefore()
+ {
+ QStandardItemModel model;
+ const QString sourceStr = "[1[1.1[1.1.2*]]]";
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), sourceStr);
+
+ ModelSignalSpy spy(proxy);
+ {
+ QStandardItem *item_1_1_1 = new QStandardItem("1.1.1");
+
+ QStandardItem *item_1_1 = model.item(0)->child(0);
+ item_1_1->insertRow(0, item_1_1_1);
+ }
+
+ QCOMPARE(treeAsString(proxy), QString("[1[1.1[1.1.2*]]]"));
+ QCOMPARE(spy.mSignals, QStringList());
+ }
+
+ void testInsertHidden() // inserting filtered-out rows shouldn't emit anything
+ {
+ QStandardItemModel model;
+ const QString sourceStr = QStringLiteral("[1[1.1]]");
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), QString());
+
+ ModelSignalSpy spy(proxy);
+ {
+ QStandardItem *item_1_1_1 = new QStandardItem(QStringLiteral("1.1.1"));
+ QStandardItem *item_1_1_1_1 = new QStandardItem(QStringLiteral("1.1.1.1"));
+ item_1_1_1->appendRow(item_1_1_1_1);
+
+ QStandardItem *item_1_1 = model.item(0)->child(0);
+ item_1_1->appendRow(item_1_1_1);
+ }
+
+ QCOMPARE(treeAsString(proxy), QString());
+ QCOMPARE(spy.mSignals, QStringList());
+ }
+
+ void testConsecutiveInserts_data()
+ {
+ testInitialFiltering_data();
+ }
+
+ void testConsecutiveInserts()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, proxyStr);
+
+ QStandardItemModel model;
+ TestModel proxy(&model); // this time the proxy listens to the model while we fill it
+
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+ QCOMPARE(treeAsString(proxy), proxyStr);
+ }
+
+ void testRemove_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("initialProxyStr");
+ QTest::addColumn<QString>("remove"); // remove this item
+ QTest::addColumn<QString>("expectedProxyStr");
+ QTest::addColumn<QStringList>("expectedSignals");
+
+ const QStringList remove1_1_1 = (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1.1.1)") << QStringLiteral("rowsRemoved(1.1.1)"));
+
+ QTest::newRow("toplevel") << "[1* 2* 3*]" << "[1* 2* 3*]" << "1" << "[2* 3*]"
+ << (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1)") << QStringLiteral("rowsRemoved(1)"));
+
+ QTest::newRow("remove_hidden") << "[1 2* 3*]" << "[2* 3*]" << "1" << "[2* 3*]" << QStringList();
+
+ QTest::newRow("parent_hidden") << "[1[1.1[1.1.1]]]" << "" << "1.1.1" << "" << QStringList();
+
+ QTest::newRow("child_hidden") << "[1[1.1*[1.1.1]]]" << "[1[1.1*]]" << "1.1.1" << "[1[1.1*]]" << QStringList();
+
+ QTest::newRow("parent_visible") << "[1[1.1*[1.1.1*]]]" << "[1[1.1*[1.1.1*]]]" << "1.1.1" << "[1[1.1*]]"
+ << remove1_1_1;
+
+ QTest::newRow("visible") << "[1[1.1[1.1.1* 1.1.2*]]]" << "[1[1.1[1.1.1* 1.1.2*]]]" << "1.1.1" << "[1[1.1[1.1.2*]]]"
+ << remove1_1_1;
+ QTest::newRow("visible_cousin") << "[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]" << "[1[1.1[1.1.1* 1.1.2[1.1.2.1*]]]]" << "1.1.1" << "[1[1.1[1.1.2[1.1.2.1*]]]]"
+ << remove1_1_1;
+
+ // The following tests trigger the removal of an ascendant.
+ // We could optimize the rows{AboutToBe,}Removed(1.1.1) away...
+
+ QTest::newRow("remove_parent") << "[1[1.1[1.1.1* 1.1.2] 1.2*]]" << "[1[1.1[1.1.1*] 1.2*]]" << "1.1.1" << "[1[1.2*]]"
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1.1)")
+ << QStringLiteral("rowsRemoved(1.1)")
+ << QStringLiteral("dataChanged(1)"));
+
+ QTest::newRow("with_children") << "[1[1.1[1.1.1[1.1.1.1*]]] 2*]" << "[1[1.1[1.1.1[1.1.1.1*]]] 2*]" << "1.1.1" << "[2*]"
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1)")
+ << QStringLiteral("rowsRemoved(1)"));
+
+ QTest::newRow("last_visible") << "[1[1.1[1.1.1* 1.1.2]]]" << "[1[1.1[1.1.1*]]]" << "1.1.1" << ""
+ << (QStringList()
+ << QStringLiteral("rowsAboutToBeRemoved(1.1.1)")
+ << QStringLiteral("rowsRemoved(1.1.1)")
+ << QStringLiteral("rowsAboutToBeRemoved(1)")
+ << QStringLiteral("rowsRemoved(1)"));
+
+
+ }
+
+ void testRemove()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, initialProxyStr);
+ QFETCH(QString, remove);
+ QFETCH(QString, expectedProxyStr);
+ QFETCH(QStringList, expectedSignals);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), initialProxyStr);
+
+ ModelSignalSpy spy(proxy);
+ QStandardItem *itemToRemove = itemByText(model, remove);
+ QVERIFY(itemToRemove);
+ if (itemToRemove->parent())
+ itemToRemove->parent()->removeRow(itemToRemove->row());
+ else
+ model.removeRow(itemToRemove->row());
+ QCOMPARE(treeAsString(proxy), expectedProxyStr);
+
+ //qDebug() << spy.mSignals;
+ QCOMPARE(spy.mSignals, expectedSignals);
+ }
+
+ void testStandardFiltering_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("initialProxyStr");
+ QTest::addColumn<QString>("filter");
+ QTest::addColumn<QString>("expectedProxyStr");
+
+ QTest::newRow("select_child") << "[1[1.1[1.1.1* 1.1.2*]]]" << "[1[1.1[1.1.1* 1.1.2*]]]"
+ << "1.1.2" << "[1[1.1[1.1.2*]]]";
+
+ QTest::newRow("filter_all_out") << "[1[1.1[1.1.1*]]]" << "[1[1.1[1.1.1*]]]"
+ << "test" << "";
+
+ QTest::newRow("select_parent") << "[1[1.1[1.1.1*[child*] 1.1.2*]]]" << "[1[1.1[1.1.1*[child*] 1.1.2*]]]"
+ << "1.1.1" << "[1[1.1[1.1.1*]]]";
+
+ }
+
+ void testStandardFiltering()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, initialProxyStr);
+ QFETCH(QString, filter);
+ QFETCH(QString, expectedProxyStr);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+ QCOMPARE(treeAsString(model), sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), initialProxyStr);
+
+ ModelSignalSpy spy(proxy);
+
+ //qDebug() << "setFilterFixedString";
+ proxy.setFilterFixedString(filter);
+
+ QCOMPARE(treeAsString(proxy), expectedProxyStr);
+
+ }
+
+private:
+ QStandardItem *itemByText(const QStandardItemModel& model, const QString &text) const {
+ QModelIndexList list = model.match(model.index(0, 0), Qt::DisplayRole, text, 1, Qt::MatchRecursive);
+ return list.isEmpty() ? 0 : model.itemFromIndex(list.first());
+ }
+};
+
+QTEST_GUILESS_MAIN(tst_QSortFilterProxyModel_Recursive)
+#include "tst_qsortfilterproxymodel_recursive.moc"
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index b215364f0e..1e3604ac9e 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -80,7 +80,10 @@ private Q_SLOTS:
void undefinedValues();
+ void fromVariant_data();
void fromVariant();
+ void toVariant_data();
+ void toVariant();
void fromVariantMap();
void fromVariantHash();
void toVariantMap();
@@ -145,6 +148,9 @@ private Q_SLOTS:
void parseErrorOffset_data();
void parseErrorOffset();
+ void implicitValueType();
+ void implicitDocumentType();
+
private:
QString testDataDir;
};
@@ -1092,8 +1098,11 @@ void tst_QtJson::undefinedValues()
QCOMPARE(array.at(-1).type(), QJsonValue::Undefined);
}
-void tst_QtJson::fromVariant()
+void tst_QtJson::fromVariant_data()
{
+ QTest::addColumn<QVariant>("variant");
+ QTest::addColumn<QJsonValue>("jsonvalue");
+
bool boolValue = true;
int intValue = -1;
uint uintValue = 1;
@@ -1116,44 +1125,66 @@ void tst_QtJson::fromVariant()
variantList.append(doubleValue);
variantList.append(stringValue);
variantList.append(stringList);
- variantList.append(QVariant());
+ variantList.append(QVariant::fromValue(nullptr));
QJsonArray jsonArray_variant;
jsonArray_variant.append(boolValue);
jsonArray_variant.append(floatValue);
jsonArray_variant.append(doubleValue);
jsonArray_variant.append(stringValue);
jsonArray_variant.append(jsonArray_string);
- jsonArray_variant.append(QJsonValue());
+ jsonArray_variant.append(QJsonValue(QJsonValue::Null));
QVariantMap variantMap;
variantMap["bool"] = boolValue;
variantMap["float"] = floatValue;
variantMap["string"] = stringValue;
variantMap["array"] = variantList;
+ QVariantHash variantHash;
+ variantHash["bool"] = boolValue;
+ variantHash["float"] = floatValue;
+ variantHash["string"] = stringValue;
+ variantHash["array"] = variantList;
QJsonObject jsonObject;
jsonObject["bool"] = boolValue;
jsonObject["float"] = floatValue;
jsonObject["string"] = stringValue;
jsonObject["array"] = jsonArray_variant;
- QCOMPARE(QJsonValue::fromVariant(QVariant::fromValue(nullptr)), QJsonValue(QJsonValue::Null));
- QCOMPARE(QJsonValue::fromVariant(QVariant(boolValue)), QJsonValue(boolValue));
- QCOMPARE(QJsonValue::fromVariant(QVariant(intValue)), QJsonValue(intValue));
- QCOMPARE(QJsonValue::fromVariant(QVariant(uintValue)), QJsonValue(static_cast<double>(uintValue)));
- QCOMPARE(QJsonValue::fromVariant(QVariant(longlongValue)), QJsonValue(longlongValue));
- QCOMPARE(QJsonValue::fromVariant(QVariant(ulonglongValue)), QJsonValue(static_cast<double>(ulonglongValue)));
- QCOMPARE(QJsonValue::fromVariant(QVariant(floatValue)), QJsonValue(static_cast<double>(floatValue)));
- QCOMPARE(QJsonValue::fromVariant(QVariant(doubleValue)), QJsonValue(doubleValue));
- QCOMPARE(QJsonValue::fromVariant(QVariant(stringValue)), QJsonValue(stringValue));
- QCOMPARE(QJsonValue::fromVariant(QVariant(stringList)), QJsonValue(jsonArray_string));
- QCOMPARE(QJsonValue::fromVariant(QVariant(variantList)), QJsonValue(jsonArray_variant));
- QCOMPARE(QJsonValue::fromVariant(QVariant(variantMap)), QJsonValue(jsonObject));
-
- QVERIFY(QJsonValue::fromVariant(QVariant(QJsonValue(true))).isBool());
- QVERIFY(QJsonValue::fromVariant(QVariant(jsonArray_string)).isArray());
- QVERIFY(QJsonValue::fromVariant(QVariant(QJsonDocument(jsonArray_string))).isArray());
- QVERIFY(QJsonValue::fromVariant(QVariant(jsonObject)).isObject());
- QVERIFY(QJsonValue::fromVariant(QVariant(QJsonDocument(jsonObject))).isObject());
+ QTest::newRow("nullptr") << QVariant::fromValue(nullptr) << QJsonValue(QJsonValue::Null);
+ QTest::newRow("bool") << QVariant(boolValue) << QJsonValue(boolValue);
+ QTest::newRow("int") << QVariant(intValue) << QJsonValue(intValue);
+ QTest::newRow("uint") << QVariant(uintValue) << QJsonValue(static_cast<double>(uintValue));
+ QTest::newRow("longlong") << QVariant(longlongValue) << QJsonValue(longlongValue);
+ QTest::newRow("ulonglong") << QVariant(ulonglongValue) << QJsonValue(static_cast<double>(ulonglongValue));
+ QTest::newRow("float") << QVariant(floatValue) << QJsonValue(floatValue);
+ QTest::newRow("double") << QVariant(doubleValue) << QJsonValue(doubleValue);
+ QTest::newRow("string") << QVariant(stringValue) << QJsonValue(stringValue);
+ QTest::newRow("stringList") << QVariant(stringList) << QJsonValue(jsonArray_string);
+ QTest::newRow("variantList") << QVariant(variantList) << QJsonValue(jsonArray_variant);
+ QTest::newRow("variantMap") << QVariant(variantMap) << QJsonValue(jsonObject);
+ QTest::newRow("variantHash") << QVariant(variantHash) << QJsonValue(jsonObject);
+}
+
+void tst_QtJson::fromVariant()
+{
+ QFETCH( QVariant, variant );
+ QFETCH( QJsonValue, jsonvalue );
+
+ QCOMPARE(QJsonValue::fromVariant(variant), jsonvalue);
+ QCOMPARE(variant.toJsonValue(), jsonvalue);
+}
+
+void tst_QtJson::toVariant_data()
+{
+ fromVariant_data();
+}
+
+void tst_QtJson::toVariant()
+{
+ QFETCH( QVariant, variant );
+ QFETCH( QJsonValue, jsonvalue );
+
+ QCOMPARE(jsonvalue.toVariant(), variant);
}
void tst_QtJson::fromVariantMap()
@@ -2908,5 +2939,52 @@ void tst_QtJson::parseErrorOffset()
QCOMPARE(error.offset, errorOffset);
}
+void tst_QtJson::implicitValueType()
+{
+ QJsonObject rootObject{
+ {"object", QJsonObject{{"value", 42}}},
+ {"array", QJsonArray{665, 666, 667}}
+ };
+
+ QJsonValue objectValue = rootObject["object"];
+ QCOMPARE(objectValue["value"].toInt(), 42);
+ QCOMPARE(objectValue["missingValue"], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(objectValue[123], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(objectValue["missingValue"].toInt(123), 123);
+
+ QJsonValue arrayValue = rootObject["array"];
+ QCOMPARE(arrayValue[1].toInt(), 666);
+ QCOMPARE(arrayValue[-1], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(arrayValue["asObject"], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(arrayValue[-1].toInt(123), 123);
+
+ const QJsonObject constObject = rootObject;
+ QCOMPARE(constObject["object"]["value"].toInt(), 42);
+ QCOMPARE(constObject["array"][1].toInt(), 666);
+
+ QJsonValue objectAsValue(rootObject);
+ QCOMPARE(objectAsValue["object"]["value"].toInt(), 42);
+ QCOMPARE(objectAsValue["array"][1].toInt(), 666);
+}
+
+void tst_QtJson::implicitDocumentType()
+{
+ QJsonDocument emptyDocument;
+ QCOMPARE(emptyDocument["asObject"], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(emptyDocument[123], QJsonValue(QJsonValue::Undefined));
+
+ QJsonDocument objectDocument(QJsonObject{{"value", 42}});
+ QCOMPARE(objectDocument["value"].toInt(), 42);
+ QCOMPARE(objectDocument["missingValue"], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(objectDocument[123], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(objectDocument["missingValue"].toInt(123), 123);
+
+ QJsonDocument arrayDocument(QJsonArray{665, 666, 667});
+ QCOMPARE(arrayDocument[1].toInt(), 666);
+ QCOMPARE(arrayDocument[-1], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(arrayDocument["asObject"], QJsonValue(QJsonValue::Undefined));
+ QCOMPARE(arrayDocument[-1].toInt(123), 123);
+}
+
QTEST_MAIN(tst_QtJson)
#include "tst_qtjson.moc"
diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
index e37542be65..1a76085c1b 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
+++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro
@@ -5,5 +5,5 @@ SOURCES = tst_qcoreapplication.cpp
HEADERS = tst_qcoreapplication.h
win32: VERSION = 1.2.3.4
else: VERSION = 1.2.3
-darwin: QMAKE_LFLAGS += -Wl,-sectcreate,__TEXT,__info_plist,$$shell_quote($$PWD/Info.plist)
+QMAKE_INFO_PLIST = $$PWD/Info.plist
requires(qtConfig(private_tests))
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index 0b4f76ef70..109f5b77f6 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -637,11 +637,6 @@ void tst_QEventLoop::testQuitLock()
{
QEventLoop eventLoop;
- QTimer timer;
- timer.setInterval(100);
- QSignalSpy timerSpy(&timer, &QTimer::timeout);
- timer.start();
-
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));
QCOMPARE(privateClass->quitLockRef.load(), 0);
@@ -655,9 +650,6 @@ void tst_QEventLoop::testQuitLock()
QCOMPARE(privateClass->quitLockRef.load(), 0);
- // The job takes long enough that the timer times out several times.
- QVERIFY(timerSpy.count() > 3);
- timerSpy.clear();
job1 = new JobObject(&eventLoop, this);
job1->start(200);
@@ -670,11 +662,6 @@ void tst_QEventLoop::testQuitLock()
}
eventLoop.exec();
-
- qDebug() << timerSpy.count();
- // The timer times out more if it has more subjobs to do.
- // We run 10 jobs in sequence here of about 200ms each.
- QVERIFY(timerSpy.count() > 17);
}
QTEST_MAIN(tst_QEventLoop)
diff --git a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
index ad40b0140d..feb704e0aa 100644
--- a/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
+++ b/tests/auto/corelib/kernel/qmath/tst_qmath.cpp
@@ -30,8 +30,6 @@
#include <QtTest/QtTest>
#include <qmath.h>
-static const double PI = 3.14159265358979323846264338327950288;
-
class tst_QMath : public QObject
{
Q_OBJECT
@@ -55,8 +53,9 @@ void tst_QMath::fastSinCos()
{
// Test evenly spaced angles from 0 to 2pi radians.
const int LOOP_COUNT = 100000;
+ const qreal loopAngle = 2 * M_PI / (LOOP_COUNT - 1);
for (int i = 0; i < LOOP_COUNT; ++i) {
- qreal angle = i * 2 * PI / (LOOP_COUNT - 1);
+ qreal angle = i * loopAngle;
QVERIFY(qAbs(qSin(angle) - qFastSin(angle)) < 1e-5);
QVERIFY(qAbs(qCos(angle) - qFastCos(angle)) < 1e-5);
}
@@ -69,18 +68,18 @@ void tst_QMath::degreesToRadians_data()
QTest::addColumn<double>("degreesDouble");
QTest::addColumn<double>("radiansDouble");
- QTest::newRow( "pi" ) << 180.0f << float(M_PI) << 180.0 << PI;
- QTest::newRow( "doublepi" ) << 360.0f << float(2*M_PI) << 360.0 << 2*PI;
- QTest::newRow( "halfpi" ) << 90.0f << float(M_PI_2) << 90.0 << PI/2;
+ QTest::newRow( "pi" ) << 180.0f << float(M_PI) << 180.0 << M_PI;
+ QTest::newRow( "doublepi" ) << 360.0f << float(2 * M_PI) << 360.0 << 2 * M_PI;
+ QTest::newRow( "halfpi" ) << 90.0f << float(M_PI_2) << 90.0 << M_PI_2;
QTest::newRow( "random" ) << 123.1234567f << 2.1489097058516724f << 123.123456789123456789 << 2.148909707407169856192285627;
QTest::newRow( "bigrandom" ) << 987654321.9876543f << 17237819.79023679f << 987654321987654321.987654321987654321 << 17237819790236794.0;
QTest::newRow( "zero" ) << 0.0f << 0.0f << 0.0 << 0.0;
- QTest::newRow( "minuspi" ) << -180.0f << float(-M_PI) << 180.0 << PI;
- QTest::newRow( "minusdoublepi" ) << -360.0f << float(-2*M_PI) << -360.0 << -2*PI;
- QTest::newRow( "minushalfpi" ) << -90.0f << float(-M_PI_2) << -90.0 << -PI/2;
+ QTest::newRow( "minuspi" ) << -180.0f << float(-M_PI) << 180.0 << M_PI;
+ QTest::newRow( "minusdoublepi" ) << -360.0f << float(-2 * M_PI) << -360.0 << -2 * M_PI;
+ QTest::newRow( "minushalfpi" ) << -90.0f << float(-M_PI_2) << -90.0 << -M_PI_2;
QTest::newRow( "minusrandom" ) << -123.1234567f << -2.1489097058516724f << -123.123456789123456789 << -2.148909707407169856192285627;
QTest::newRow( "minusbigrandom" ) << -987654321.9876543f << -17237819.79023679f << -987654321987654321.987654321987654321 << -17237819790236794.0;
@@ -104,18 +103,18 @@ void tst_QMath::radiansToDegrees_data()
QTest::addColumn<double>("radiansDouble");
QTest::addColumn<double>("degreesDouble");
- QTest::newRow( "pi" ) << float(M_PI) << 180.0f << PI << 180.0;
- QTest::newRow( "doublepi" ) << float(2*M_PI) << 360.0f << 2*PI << 360.0;
- QTest::newRow( "halfpi" ) << float(M_PI_2) << 90.0f<< PI/2 << 90.0;
+ QTest::newRow( "pi" ) << float(M_PI) << 180.0f << M_PI << 180.0;
+ QTest::newRow( "doublepi" ) << float(2 * M_PI) << 360.0f << 2 * M_PI << 360.0;
+ QTest::newRow( "halfpi" ) << float(M_PI_2) << 90.0f << M_PI_2 << 90.0;
QTest::newRow( "random" ) << 123.1234567f << 7054.454427971739f << 123.123456789123456789 << 7054.4544330781363896676339209079742431640625;
QTest::newRow( "bigrandom" ) << 987654321.9876543f << 56588424267.74745f << 987654321987654321.987654321987654321 << 56588424267747450880.0;
QTest::newRow( "zero" ) << 0.0f << 0.0f << 0.0 << 0.0;
- QTest::newRow( "minuspi" ) << float(-M_PI) << -180.0f << -PI << -180.0;
- QTest::newRow( "minusdoublepi" ) << float(-2*M_PI) << -360.0f << -2*PI << -360.0;
- QTest::newRow( "minushalfpi" ) << float(-M_PI_2) << -90.0f << -PI/2 << -90.0;
+ QTest::newRow( "minuspi" ) << float(-M_PI) << -180.0f << -M_PI << -180.0;
+ QTest::newRow( "minusdoublepi" ) << float(-2 * M_PI) << -360.0f << -2 * M_PI << -360.0;
+ QTest::newRow( "minushalfpi" ) << float(-M_PI_2) << -90.0f << -M_PI_2 << -90.0;
QTest::newRow( "minusrandom" ) << -123.1234567f << -7054.454427971739f << -123.123456789123456789 << -7054.4544330781363896676339209079742431640625;
QTest::newRow( "minusbigrandom" ) << -987654321.9876543f << -56588424267.74745f << -987654321987654321.987654321987654321 << -56588424267747450880.0;
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index e793d71fe2..35e14b7dbf 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -147,6 +147,77 @@ namespace MyNamespace {
{
Q_OBJECT
};
+
+ class ClassWithSetterGetterSignals : public QObject
+ {
+ Q_OBJECT
+
+ public:
+ int value1() const { return m_value1; }
+ void setValue1(int v) {
+ if (v != m_value1) {
+ m_value1 = v;
+ Q_EMIT value1Changed();
+ }
+ }
+
+ int value2() const { return m_value2; }
+ void setValue2(int v) {
+ if (v != m_value2) {
+ m_value2 = v;
+ Q_EMIT value2Changed();
+ }
+ }
+
+ Q_SIGNALS:
+ void value1Changed();
+ void value2Changed();
+
+ private:
+ int m_value1 = 0;
+ int m_value2 = 0;
+ };
+
+ class ClassWithSetterGetterSignalsAddsProperties : public ClassWithSetterGetterSignals
+ {
+ Q_OBJECT
+ Q_PROPERTY(int value1 READ value1 WRITE setValue1 NOTIFY value1Changed)
+ Q_PROPERTY(int value2 READ value2 WRITE setValue2 NOTIFY value2Changed)
+ };
+
+ class ClassWithChangedSignal : public QObject
+ {
+ Q_OBJECT
+
+ public:
+ int value1() const { return m_value1; }
+ void setValue1(int v) {
+ if (v != m_value1) {
+ m_value1 = v;
+ Q_EMIT propertiesChanged();
+ }
+ }
+
+ void thisIsNotASignal() { }
+
+ Q_SIGNALS:
+ void propertiesChanged();
+
+ private:
+ int m_value1 = 0;
+ };
+
+ class ClassWithChangedSignalNewValue : public ClassWithChangedSignal
+ {
+ Q_OBJECT
+
+ Q_PROPERTY(int value2 MEMBER m_value2 NOTIFY propertiesChanged)
+ Q_PROPERTY(int value3 MEMBER m_value3 NOTIFY thisIsNotASignal)
+
+ private:
+ int m_value2 = 0;
+ int m_value3 = 0;
+ };
}
@@ -200,8 +271,11 @@ public:
private slots:
void connectSlotsByName();
void invokeMetaMember();
+ void invokePointer();
void invokeQueuedMetaMember();
+ void invokeQueuedPointer();
void invokeBlockingQueuedMetaMember();
+ void invokeBlockingQueuedPointer();
void invokeCustomTypes();
void invokeMetaConstructor();
void invokeTypedefTypes();
@@ -242,6 +316,8 @@ private slots:
void inherits_data();
void inherits();
+ void notifySignalsInParentClass();
+
signals:
void value6Changed();
void value7Changed(const QString &);
@@ -427,6 +503,10 @@ public slots:
+ QString::number(o6.size());
}
+public:
+ static void staticFunction0();
+ static qint64 staticFunction1();
+
signals:
void sig0();
QString sig1(QString s1);
@@ -440,8 +520,11 @@ private:
public:
QString slotResult;
+ static QString staticResult;
};
+QString QtTestObject::staticResult;
+
QtTestObject::QtTestObject()
{
connect(this, SIGNAL(sig0()), this, SLOT(sl0()));
@@ -500,6 +583,13 @@ void QtTestObject::testSender()
void QtTestObject::slotWithUnregisteredParameterType(MyUnregisteredType)
{ slotResult = "slotWithUnregisteredReturnType"; }
+void QtTestObject::staticFunction0()
+{
+ staticResult = "staticFunction0";
+}
+
+qint64 QtTestObject::staticFunction1()
+{ staticResult = "staticFunction1"; return Q_INT64_C(123456789)*123456789; }
void tst_QMetaObject::invokeMetaMember()
{
@@ -508,9 +598,18 @@ void tst_QMetaObject::invokeMetaMember()
QString t1("1"); QString t2("2"); QString t3("3"); QString t4("4"); QString t5("5");
QString t6("6"); QString t7("7"); QString t8("8"); QString t9("9"); QString t10("X");
- QVERIFY(!QMetaObject::invokeMethod(0, 0));
- QVERIFY(!QMetaObject::invokeMethod(0, "sl0"));
- QVERIFY(!QMetaObject::invokeMethod(&obj, 0));
+ // Test nullptr
+ char *nullCharArray = nullptr;
+ const char *nullConstCharArray = nullptr;
+ QVERIFY(!QMetaObject::invokeMethod(nullptr, nullCharArray));
+ QVERIFY(!QMetaObject::invokeMethod(nullptr, nullConstCharArray));
+ QVERIFY(!QMetaObject::invokeMethod(nullptr, "sl0"));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullCharArray));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullConstCharArray));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullCharArray, Qt::AutoConnection));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullConstCharArray, Qt::AutoConnection));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullCharArray, Qt::AutoConnection, QGenericReturnArgument()));
+ QVERIFY(!QMetaObject::invokeMethod(&obj, nullConstCharArray, Qt::AutoConnection, QGenericReturnArgument()));
QVERIFY(QMetaObject::invokeMethod(&obj, "sl0"));
QCOMPARE(obj.slotResult, QString("sl0"));
@@ -639,6 +738,56 @@ void tst_QMetaObject::invokeMetaMember()
QCOMPARE(obj.slotResult, QString("sl1:hehe"));
}
+void testFunction(){}
+
+
+void tst_QMetaObject::invokePointer()
+{
+ QtTestObject obj;
+ QtTestObject *const nullTestObject = nullptr;
+
+ QString t1("1");
+
+ // Test member functions
+ QVERIFY(!QMetaObject::invokeMethod(nullTestObject, &QtTestObject::sl0));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sl0));
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::testSender));
+ QCOMPARE(obj.slotResult, QString("0x0"));
+
+ qint64 return64 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sl14, &return64));
+ QCOMPARE(return64, Q_INT64_C(123456789)*123456789);
+ QCOMPARE(obj.slotResult, QString("sl14"));
+
+ // signals
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sig0));
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ // Test function pointers
+ QVERIFY(!QMetaObject::invokeMethod(0, &testFunction));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &testFunction));
+
+ QVERIFY(!QMetaObject::invokeMethod(0, &QtTestObject::staticFunction0));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::staticFunction0));
+ QCOMPARE(QtTestObject::staticResult, QString("staticFunction0"));
+
+ return64 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::staticFunction1, &return64));
+ QCOMPARE(return64, Q_INT64_C(123456789)*123456789);
+ QCOMPARE(QtTestObject::staticResult, QString("staticFunction1"));
+
+ // Test lambdas
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&](){obj.sl1(t1);}));
+ QCOMPARE(obj.slotResult, QString("sl1:1"));
+
+ QString exp;
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&]()->QString{return obj.sl1("bubu");}, &exp));
+ QCOMPARE(exp, QString("yessir"));
+ QCOMPARE(obj.slotResult, QString("sl1:bubu"));
+}
+
void tst_QMetaObject::invokeQueuedMetaMember()
{
QtTestObject obj;
@@ -699,6 +848,44 @@ void tst_QMetaObject::invokeQueuedMetaMember()
}
}
+void tst_QMetaObject::invokeQueuedPointer()
+{
+ QtTestObject obj;
+
+ // Test member function
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sl0, Qt::QueuedConnection));
+ QVERIFY(obj.slotResult.isEmpty());
+ qApp->processEvents(QEventLoop::AllEvents);
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ // signals
+ obj.slotResult.clear();
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sig0, Qt::QueuedConnection));
+ QVERIFY(obj.slotResult.isEmpty());
+ qApp->processEvents(QEventLoop::AllEvents);
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ // Test function pointers
+ QtTestObject::staticResult.clear();
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::staticFunction0, Qt::QueuedConnection));
+ QVERIFY(QtTestObject::staticResult.isEmpty());
+ qApp->processEvents(QEventLoop::AllEvents);
+ QCOMPARE(QtTestObject::staticResult, QString("staticFunction0"));
+
+ // Test lambda
+ obj.slotResult.clear();
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&](){obj.sl0();}, Qt::QueuedConnection));
+ QVERIFY(obj.slotResult.isEmpty());
+ qApp->processEvents(QEventLoop::AllEvents);
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ qint32 var = 0;
+ QTest::ignoreMessage(QtWarningMsg, "QMetaObject::invokeMethod: Unable to invoke methods with return values in queued connections");
+ QVERIFY(!QMetaObject::invokeMethod(&obj, []()->qint32{return 1;}, Qt::QueuedConnection, &var));
+ QCOMPARE(var, 0);
+}
+
+
void tst_QMetaObject::invokeBlockingQueuedMetaMember()
{
QThread t;
@@ -832,6 +1019,62 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember()
}
+void tst_QMetaObject::invokeBlockingQueuedPointer()
+{
+ QtTestObject *const nullTestObject = nullptr;
+
+ QThread t;
+ t.start();
+ QtTestObject obj;
+ obj.moveToThread(&t);
+
+ QString t1("1");
+
+ // Test member functions
+ QVERIFY(!QMetaObject::invokeMethod(nullTestObject, &QtTestObject::sl0, Qt::BlockingQueuedConnection));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sl0, Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::testSender, Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("0x0"));
+
+ // return qint64
+ qint64 return64 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sl14, Qt::BlockingQueuedConnection,
+ &return64));
+ QCOMPARE(return64, Q_INT64_C(123456789)*123456789);
+ QCOMPARE(obj.slotResult, QString("sl14"));
+
+ //test signals
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::sig0, Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("sl0"));
+
+ // Test function pointers
+ QVERIFY(!QMetaObject::invokeMethod(0, &testFunction, Qt::BlockingQueuedConnection));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &testFunction, Qt::BlockingQueuedConnection));
+
+ QVERIFY(!QMetaObject::invokeMethod(0, &QtTestObject::staticFunction0, Qt::BlockingQueuedConnection));
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::staticFunction0, Qt::BlockingQueuedConnection));
+ QCOMPARE(QtTestObject::staticResult, QString("staticFunction0"));
+
+ return64 = 0;
+ QVERIFY(QMetaObject::invokeMethod(&obj, &QtTestObject::staticFunction1, Qt::BlockingQueuedConnection, &return64));
+ QCOMPARE(return64, Q_INT64_C(123456789)*123456789);
+ QCOMPARE(QtTestObject::staticResult, QString("staticFunction1"));
+
+ // Test lambdas
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&](){obj.sl1(t1);}, Qt::BlockingQueuedConnection));
+ QCOMPARE(obj.slotResult, QString("sl1:1"));
+
+ QString exp;
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&]()->QString{return obj.sl1("bubu");}, Qt::BlockingQueuedConnection, &exp));
+ QCOMPARE(exp, QString("yessir"));
+ QCOMPARE(obj.slotResult, QString("sl1:bubu"));
+
+ QVERIFY(QMetaObject::invokeMethod(&obj, [&](){obj.moveToThread(QThread::currentThread());}, Qt::BlockingQueuedConnection));
+ t.quit();
+ QVERIFY(t.wait());
+}
void tst_QMetaObject::qtMetaObjectInheritance()
@@ -1502,5 +1745,18 @@ void tst_QMetaObject::inherits()
QCOMPARE(derivedMetaObject->inherits(baseMetaObject), inheritsResult);
}
+void tst_QMetaObject::notifySignalsInParentClass()
+{
+ MyNamespace::ClassWithSetterGetterSignalsAddsProperties obj;
+ QCOMPARE(obj.metaObject()->property(obj.metaObject()->indexOfProperty("value1")).notifySignal().name(), QByteArray("value1Changed"));
+ QCOMPARE(obj.metaObject()->property(obj.metaObject()->indexOfProperty("value2")).notifySignal().name(), QByteArray("value2Changed"));
+
+ MyNamespace::ClassWithChangedSignalNewValue obj2;
+ QCOMPARE(obj2.metaObject()->property(obj2.metaObject()->indexOfProperty("value2")).notifySignal().name(), QByteArray("propertiesChanged"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QMetaProperty::notifySignal: cannot find the NOTIFY signal thisIsNotASignal in class MyNamespace::ClassWithChangedSignalNewValue for property 'value3'");
+ obj2.metaObject()->property(obj2.metaObject()->indexOfProperty("value3")).notifySignal();
+}
+
QTEST_MAIN(tst_QMetaObject)
#include "tst_qmetaobject.moc"
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 9ae39449f8..6bb031e357 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -806,6 +806,7 @@ void tst_QMetaObjectBuilder::enumerator()
QMetaEnumBuilder enum1 = builder.addEnumerator("foo");
QCOMPARE(enum1.name(), QByteArray("foo"));
QVERIFY(!enum1.isFlag());
+ QVERIFY(!enum1.isScoped());
QCOMPARE(enum1.keyCount(), 0);
QCOMPARE(enum1.index(), 0);
QCOMPARE(builder.enumeratorCount(), 1);
@@ -814,6 +815,7 @@ void tst_QMetaObjectBuilder::enumerator()
QMetaEnumBuilder enum2 = builder.addEnumerator("bar");
QCOMPARE(enum2.name(), QByteArray("bar"));
QVERIFY(!enum2.isFlag());
+ QVERIFY(!enum2.isScoped());
QCOMPARE(enum2.keyCount(), 0);
QCOMPARE(enum2.index(), 1);
QCOMPARE(builder.enumeratorCount(), 2);
@@ -827,6 +829,7 @@ void tst_QMetaObjectBuilder::enumerator()
// Modify the attributes on enum1.
enum1.setIsFlag(true);
+ enum1.setIsScoped(true);
QCOMPARE(enum1.addKey("ABC", 0), 0);
QCOMPARE(enum1.addKey("DEF", 1), 1);
QCOMPARE(enum1.addKey("GHI", -1), 2);
@@ -834,6 +837,7 @@ void tst_QMetaObjectBuilder::enumerator()
// Check that enum1 is changed, but enum2 is not.
QCOMPARE(enum1.name(), QByteArray("foo"));
QVERIFY(enum1.isFlag());
+ QVERIFY(enum1.isScoped());
QCOMPARE(enum1.keyCount(), 3);
QCOMPARE(enum1.index(), 0);
QCOMPARE(enum1.key(0), QByteArray("ABC"));
@@ -845,6 +849,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum1.value(2), -1);
QCOMPARE(enum2.name(), QByteArray("bar"));
QVERIFY(!enum2.isFlag());
+ QVERIFY(!enum2.isScoped());
QCOMPARE(enum2.keyCount(), 0);
QCOMPARE(enum2.index(), 1);
@@ -856,6 +861,7 @@ void tst_QMetaObjectBuilder::enumerator()
// This time check that only method2 changed.
QCOMPARE(enum1.name(), QByteArray("foo"));
QVERIFY(enum1.isFlag());
+ QVERIFY(enum1.isScoped());
QCOMPARE(enum1.keyCount(), 3);
QCOMPARE(enum1.index(), 0);
QCOMPARE(enum1.key(0), QByteArray("ABC"));
@@ -867,6 +873,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum1.value(2), -1);
QCOMPARE(enum2.name(), QByteArray("bar"));
QVERIFY(enum2.isFlag());
+ QVERIFY(!enum2.isScoped());
QCOMPARE(enum2.keyCount(), 2);
QCOMPARE(enum2.index(), 1);
QCOMPARE(enum2.key(0), QByteArray("XYZ"));
@@ -879,6 +886,7 @@ void tst_QMetaObjectBuilder::enumerator()
enum1.removeKey(2);
QCOMPARE(enum1.name(), QByteArray("foo"));
QVERIFY(enum1.isFlag());
+ QVERIFY(enum1.isScoped());
QCOMPARE(enum1.keyCount(), 2);
QCOMPARE(enum1.index(), 0);
QCOMPARE(enum1.key(0), QByteArray("ABC"));
@@ -889,6 +897,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum1.value(2), -1);
QCOMPARE(enum2.name(), QByteArray("bar"));
QVERIFY(enum2.isFlag());
+ QVERIFY(!enum2.isScoped());
QCOMPARE(enum2.keyCount(), 2);
QCOMPARE(enum2.index(), 1);
QCOMPARE(enum2.key(0), QByteArray("XYZ"));
@@ -903,6 +912,7 @@ void tst_QMetaObjectBuilder::enumerator()
enum2 = builder.enumerator(0);
QCOMPARE(enum2.name(), QByteArray("bar"));
QVERIFY(enum2.isFlag());
+ QVERIFY(!enum2.isScoped());
QCOMPARE(enum2.keyCount(), 2);
QCOMPARE(enum2.index(), 0);
QCOMPARE(enum2.key(0), QByteArray("XYZ"));
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index f9ddd59aaa..076610a0c5 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -155,7 +155,9 @@ void tst_QMetaType::defined()
QCOMPARE(int(QMetaTypeId2<int*>::Defined), 0);
QCOMPARE(int(QMetaTypeId2<CustomQObject::CustomQEnum>::Defined), 1);
QCOMPARE(int(QMetaTypeId2<CustomGadget>::Defined), 1);
+ QCOMPARE(int(QMetaTypeId2<CustomGadget*>::Defined), 1);
QVERIFY(!QMetaTypeId2<GadgetDerived>::Defined);
+ QVERIFY(!QMetaTypeId2<GadgetDerived*>::Defined);
QVERIFY(int(QMetaTypeId2<CustomQObject*>::Defined));
QVERIFY(!QMetaTypeId2<CustomQObject>::Defined);
QVERIFY(!QMetaTypeId2<CustomNonQObject>::Defined);
@@ -397,6 +399,7 @@ void tst_QMetaType::typeName_data()
QTest::newRow("CustomQObject*") << ::qMetaTypeId<CustomQObject*>() << QString::fromLatin1("CustomQObject*");
QTest::newRow("CustomGadget") << ::qMetaTypeId<CustomGadget>() << QString::fromLatin1("CustomGadget");
+ QTest::newRow("CustomGadget*") << ::qMetaTypeId<CustomGadget*>() << QString::fromLatin1("CustomGadget*");
QTest::newRow("CustomQObject::CustomQEnum") << ::qMetaTypeId<CustomQObject::CustomQEnum>() << QString::fromLatin1("CustomQObject::CustomQEnum");
QTest::newRow("Qt::ArrowType") << ::qMetaTypeId<Qt::ArrowType>() << QString::fromLatin1("Qt::ArrowType");
}
@@ -1684,6 +1687,7 @@ public:
};
Q_DECLARE_METATYPE(MyGadget);
+Q_DECLARE_METATYPE(MyGadget*);
Q_DECLARE_METATYPE(const QMetaObject *);
Q_DECLARE_METATYPE(Qt::ScrollBarPolicy);
Q_DECLARE_METATYPE(MyGadget::MyEnum);
@@ -1693,16 +1697,18 @@ void tst_QMetaType::metaObject_data()
QTest::addColumn<int>("type");
QTest::addColumn<const QMetaObject*>("result");
QTest::addColumn<bool>("isGadget");
+ QTest::addColumn<bool>("isGadgetPtr");
QTest::addColumn<bool>("isQObjectPtr");
- QTest::newRow("QObject") << int(QMetaType::QObjectStar) << &QObject::staticMetaObject << false << true;
- QTest::newRow("QFile*") << ::qMetaTypeId<QFile*>() << &QFile::staticMetaObject << false << true;
- QTest::newRow("MyObject*") << ::qMetaTypeId<MyObject*>() << &MyObject::staticMetaObject << false << true;
- QTest::newRow("int") << int(QMetaType::Int) << static_cast<const QMetaObject *>(0) << false << false;
- QTest::newRow("QEasingCurve") << ::qMetaTypeId<QEasingCurve>() << &QEasingCurve::staticMetaObject << true << false;
- QTest::newRow("MyGadget") << ::qMetaTypeId<MyGadget>() << &MyGadget::staticMetaObject << true << false;
- QTest::newRow("MyEnum") << ::qMetaTypeId<MyGadget::MyEnum>() << &MyGadget::staticMetaObject << false << false;
- QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &QObject::staticQtMetaObject << false << false;
+ QTest::newRow("QObject") << int(QMetaType::QObjectStar) << &QObject::staticMetaObject << false << false << true;
+ QTest::newRow("QFile*") << ::qMetaTypeId<QFile*>() << &QFile::staticMetaObject << false << false << true;
+ QTest::newRow("MyObject*") << ::qMetaTypeId<MyObject*>() << &MyObject::staticMetaObject << false << false << true;
+ QTest::newRow("int") << int(QMetaType::Int) << static_cast<const QMetaObject *>(0) << false << false << false;
+ QTest::newRow("QEasingCurve") << ::qMetaTypeId<QEasingCurve>() << &QEasingCurve::staticMetaObject << true << false << false;
+ QTest::newRow("MyGadget") << ::qMetaTypeId<MyGadget>() << &MyGadget::staticMetaObject << true << false << false;
+ QTest::newRow("MyGadget*") << ::qMetaTypeId<MyGadget*>() << &MyGadget::staticMetaObject << false << true << false;
+ QTest::newRow("MyEnum") << ::qMetaTypeId<MyGadget::MyEnum>() << &MyGadget::staticMetaObject << false << false << false;
+ QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &QObject::staticQtMetaObject << false << false << false;
}
@@ -1711,12 +1717,14 @@ void tst_QMetaType::metaObject()
QFETCH(int, type);
QFETCH(const QMetaObject *, result);
QFETCH(bool, isGadget);
+ QFETCH(bool, isGadgetPtr);
QFETCH(bool, isQObjectPtr);
QCOMPARE(QMetaType::metaObjectForType(type), result);
QMetaType mt(type);
QCOMPARE(mt.metaObject(), result);
QCOMPARE(!!(mt.flags() & QMetaType::IsGadget), isGadget);
+ QCOMPARE(!!(mt.flags() & QMetaType::PointerToGadget), isGadgetPtr);
QCOMPARE(!!(mt.flags() & QMetaType::PointerToQObject), isQObjectPtr);
}
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 642d48d721..5ecdd92228 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -140,6 +140,7 @@ private slots:
void connectFunctorWithContext();
void connectFunctorWithContextUnique();
void connectFunctorDeadlock();
+ void connectFunctorMoveOnly();
void connectStaticSlotWithObject();
void disconnectDoesNotLeakFunctor();
void contextDoesNotLeakFunctor();
@@ -2361,8 +2362,8 @@ void tst_QObject::testUserData()
// Randomize the table a bit
for (int i=0; i<100; ++i) {
- int p1 = rand() % USER_DATA_COUNT;
- int p2 = rand() % USER_DATA_COUNT;
+ int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
+ int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
int tmp = user_data_ids[p1];
user_data_ids[p1] = user_data_ids[p2];
@@ -6237,6 +6238,47 @@ void tst_QObject::connectFunctorDeadlock()
sender.emitSignal1();
}
+void tst_QObject::connectFunctorMoveOnly()
+{
+ struct MoveOnlyFunctor {
+ Q_DISABLE_COPY(MoveOnlyFunctor)
+ MoveOnlyFunctor(int *status) : status(status) {}
+ MoveOnlyFunctor(MoveOnlyFunctor &&o) : status(o.status) { o.status = nullptr; };
+ void operator()(int i) { *status = i; }
+ void operator()() { *status = -8; }
+ int *status;
+ };
+
+ int status = 1;
+ SenderObject obj;
+ QEventLoop e;
+
+ connect(&obj, &SenderObject::signal1, MoveOnlyFunctor(&status));
+ QCOMPARE(status, 1);
+ obj.signal1();
+ QCOMPARE(status, -8);
+
+ connect(&obj, &SenderObject::signal7, MoveOnlyFunctor(&status));
+ QCOMPARE(status, -8);
+ obj.signal7(7888, "Hello");
+ QCOMPARE(status, 7888);
+
+ // With a context
+ status = 1;
+ connect(&obj, &SenderObject::signal2, this, MoveOnlyFunctor(&status));
+ QCOMPARE(status, 1);
+ obj.signal2();
+ QCOMPARE(status, -8);
+
+ // QueuedConnection
+ status = 1;
+ connect(&obj, &SenderObject::signal3, this, MoveOnlyFunctor(&status), Qt::QueuedConnection);
+ obj.signal3();
+ QCOMPARE(status, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(status, -8);
+}
+
static int s_static_slot_checker = 1;
class StaticSlotChecker : public QObject
diff --git a/tests/auto/corelib/kernel/qtimer/qtimer.pro b/tests/auto/corelib/kernel/qtimer/qtimer.pro
index b27d862bc5..710dfea682 100644
--- a/tests/auto/corelib/kernel/qtimer/qtimer.pro
+++ b/tests/auto/corelib/kernel/qtimer/qtimer.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
TARGET = tst_qtimer
-QT = core testlib
+QT = core core-private testlib
SOURCES = tst_qtimer.cpp
# Force C++17 if available
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index fd704f582d..b921c0f13d 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -33,11 +33,11 @@
# include <QtCore/QCoreApplication>
#endif
+#include <QtCore/private/qglobal_p.h>
#include <QtTest/QtTest>
#include <qtimer.h>
#include <qthread.h>
-#include <qoperatingsystemversion.h>
#if defined Q_OS_UNIX
#include <unistd.h>
@@ -500,7 +500,7 @@ void tst_QTimer::moveToThread()
#if defined(Q_OS_WIN32)
QSKIP("Does not work reliably on Windows :(");
#elif defined(Q_OS_MACOS)
- if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSierra)
+ if (__builtin_available(macOS 10.12, *))
QSKIP("Does not work reliably on macOS 10.12 (QTBUG-59679)");
#endif
QTimer ti1;
@@ -836,7 +836,6 @@ void tst_QTimer::singleShotToFunctors()
QTest::qWait(800);
QCOMPARE(count, 2);
-#if defined(Q_COMPILER_LAMBDA)
QTimer::singleShot(0, [&count] { ++count; });
QCoreApplication::processEvents();
QCOMPARE(count, 3);
@@ -855,7 +854,15 @@ void tst_QTimer::singleShotToFunctors()
thread.quit();
thread.wait();
-#endif
+
+ struct MoveOnly : CountedStruct {
+ Q_DISABLE_COPY(MoveOnly);
+ MoveOnly(MoveOnly &&o) : CountedStruct(std::move(o)) {};
+ MoveOnly(int *c) : CountedStruct(c) {}
+ };
+ QTimer::singleShot(0, MoveOnly(&count));
+ QCoreApplication::processEvents();
+ QCOMPARE(count, 5);
_e.reset();
_t = Q_NULLPTR;
diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
index 66971af7b4..5bfe133966 100644
--- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
@@ -50,6 +50,7 @@ private slots:
void loadFromResource();
void loadDirectory();
void dependencies();
+ void translationInThreadWhileInstallingTranslator();
private:
int languageChangeEventCounter;
@@ -287,6 +288,52 @@ void tst_QTranslator::dependencies()
}
}
+struct TranslateThread : public QThread
+{
+ bool ok = false;
+ QAtomicInt terminate;
+ QMutex startupLock;
+ QWaitCondition runningCondition;
+
+ void run() {
+ bool startSignalled = false;
+
+ while (terminate.load() == 0) {
+ const QString result = QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0);
+
+ if (!startSignalled) {
+ QMutexLocker startupLocker(&startupLock);
+ runningCondition.wakeAll();
+ startSignalled = true;
+ }
+
+ ok = (result == QLatin1String("Hallo 0 Welten!"))
+ || (result == QLatin1String("Hello 0 world(s)!"));
+ if (!ok)
+ break;
+ }
+ }
+};
+
+void tst_QTranslator::translationInThreadWhileInstallingTranslator()
+{
+ TranslateThread thread;
+
+ QMutexLocker startupLocker(&thread.startupLock);
+
+ thread.start();
+
+ thread.runningCondition.wait(&thread.startupLock);
+
+ QTranslator *tor = new QTranslator;
+ tor->load("hellotr_la");
+ QCoreApplication::installTranslator(tor);
+
+ ++thread.terminate;
+
+ QVERIFY(thread.wait());
+ QVERIFY(thread.ok);
+}
QTEST_MAIN(tst_QTranslator)
#include "tst_qtranslator.moc"
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index e43b7acfb8..0d45159d09 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -277,6 +277,8 @@ private slots:
void compareSanity();
void compareRich();
+ void nullConvert();
+
void accessSequentialContainerKey();
private:
@@ -369,6 +371,8 @@ void tst_QVariant::copy_constructor()
QVERIFY(var8.isNull());
}
+Q_DECLARE_METATYPE(int*)
+
void tst_QVariant::isNull()
{
QVariant var;
@@ -411,6 +415,18 @@ void tst_QVariant::isNull()
QVERIFY(var9.isNull());
var9 = QVariant::fromValue<QJsonValue>(QJsonValue(QJsonValue::Null));
QVERIFY(var9.isNull());
+
+ QVariant var10(QMetaType::VoidStar, nullptr);
+ QVERIFY(var10.isNull());
+ var10 = QVariant::fromValue<void*>(nullptr);
+ QVERIFY(var10.isNull());
+
+ QVariant var11(QMetaType::QObjectStar, nullptr);
+ QVERIFY(var11.isNull());
+ var11 = QVariant::fromValue<QObject*>(nullptr);
+ QVERIFY(var11.isNull());
+
+ QVERIFY(QVariant::fromValue<int*>(nullptr).isNull());
}
void tst_QVariant::swap()
@@ -1046,6 +1062,7 @@ void tst_QVariant::toByteArray_data()
QTest::newRow( "longlong" ) << QVariant( (qlonglong)34 ) << QByteArray( "34" );
QTest::newRow( "ulonglong" ) << QVariant( (qulonglong)34 ) << QByteArray( "34" );
+ QTest::newRow( "nullptr" ) << QVariant::fromValue(nullptr) << QByteArray();
}
void tst_QVariant::toByteArray()
@@ -1055,7 +1072,13 @@ void tst_QVariant::toByteArray()
QVERIFY( value.isValid() );
QVERIFY( value.canConvert( QVariant::ByteArray ) );
QByteArray ba = value.toByteArray();
+ QCOMPARE( ba.isNull(), result.isNull() );
QCOMPARE( ba, result );
+
+ QVERIFY( value.convert( QVariant::ByteArray ) );
+ QCOMPARE( value.isNull(), result.isNull() );
+ QCOMPARE( value.toByteArray().isNull(), result.isNull() );
+ QCOMPARE( value.toByteArray(), result );
}
void tst_QVariant::toString_data()
@@ -1082,6 +1105,7 @@ void tst_QVariant::toString_data()
QString( "123456789012" );
QTest::newRow("QJsonValue") << QVariant(QJsonValue(QString("hello"))) << QString("hello");
QTest::newRow("QJsonValue(Null)") << QVariant(QJsonValue(QJsonValue::Null)) << QString();
+ QTest::newRow("nullptr") << QVariant::fromValue(nullptr) << QString();
}
void tst_QVariant::toString()
@@ -1091,7 +1115,13 @@ void tst_QVariant::toString()
QVERIFY( value.isValid() );
QVERIFY( value.canConvert( QVariant::String ) );
QString str = value.toString();
+ QCOMPARE( str.isNull(), result.isNull() );
QCOMPARE( str, result );
+
+ QVERIFY( value.convert( QVariant::String ) );
+ QCOMPARE( value.isNull(), result.isNull() );
+ QCOMPARE( value.toString().isNull(), result.isNull() );
+ QCOMPARE( value.toString(), result );
}
void tst_QVariant::toDate_data()
@@ -2648,7 +2678,7 @@ void tst_QVariant::qvariant_cast_QObject_data()
QTest::newRow("null QObject") << QVariant::fromValue<QObject*>(0) << true << true;
QTest::newRow("null derived QObject") << QVariant::fromValue<CustomQObject*>(0) << true << true;
QTest::newRow("null custom object") << QVariant::fromValue<CustomNonQObject*>(0) << false << true;
- QTest::newRow("null int") << QVariant::fromValue<int>(0) << false << true;
+ QTest::newRow("zero int") << QVariant::fromValue<int>(0) << false << false;
}
void tst_QVariant::qvariant_cast_QObject()
@@ -2666,12 +2696,14 @@ void tst_QVariant::qvariant_cast_QObject()
QVERIFY(data.canConvert(QMetaType::QObjectStar));
QVERIFY(data.canConvert(::qMetaTypeId<QObject*>()));
QCOMPARE(data.value<QObject*>() == 0, isNull);
+ QCOMPARE(data.isNull(), isNull);
QVERIFY(data.convert(QMetaType::QObjectStar));
QCOMPARE(data.userType(), int(QMetaType::QObjectStar));
} else {
QVERIFY(!data.canConvert<QObject*>());
QVERIFY(!data.canConvert(QMetaType::QObjectStar));
QVERIFY(!data.canConvert(::qMetaTypeId<QObject*>()));
+ QCOMPARE(data.isNull(), isNull);
QVERIFY(!data.value<QObject*>());
QVERIFY(!data.convert(QMetaType::QObjectStar));
QVERIFY(data.userType() != QMetaType::QObjectStar);
@@ -3403,21 +3435,6 @@ void tst_QVariant::toIntFromDouble() const
QCOMPARE(result, 2147483630);
}
-void tst_QVariant::setValue()
-{
- QJsonDocument t; //we just take a value so that we're sure that it will be shared
- QVariant v1 = QVariant::fromValue(t);
- QVERIFY( v1.isDetached() );
- QVariant v2 = v1;
- QVERIFY( !v1.isDetached() );
- QVERIFY( !v2.isDetached() );
-
- v2.setValue(3); //set an integer value
-
- QVERIFY( v1.isDetached() );
- QVERIFY( v2.isDetached() );
-}
-
void tst_QVariant::fpStringRoundtrip_data() const
{
QTest::addColumn<QVariant>("number");
@@ -3649,6 +3666,20 @@ Q_DECLARE_METATYPE(MyMovable *)
Q_DECLARE_METATYPE(MyNotMovable *)
Q_DECLARE_METATYPE(QSharedDataPointer<MyShared>)
+void tst_QVariant::setValue()
+{
+ MyNotMovable t; //we just take a value so that we're sure that it will be shared
+ QVariant v1 = QVariant::fromValue(t);
+ QVERIFY( v1.isDetached() );
+ QVariant v2 = v1;
+ QVERIFY( !v1.isDetached() );
+ QVERIFY( !v2.isDetached() );
+
+ v2.setValue(3); //set an integer value
+
+ QVERIFY( v1.isDetached() );
+ QVERIFY( v2.isDetached() );
+}
void tst_QVariant::moreCustomTypes()
{
@@ -3751,7 +3782,7 @@ void tst_QVariant::moreCustomTypes()
{
int i = 5;
PLAY_WITH_VARIANT((void *)(&i), false, QString(), 0, false);
- PLAY_WITH_VARIANT((void *)(0), false, QString(), 0, false);
+ PLAY_WITH_VARIANT((void *)(0), true, QString(), 0, false);
}
{
@@ -4862,6 +4893,33 @@ void tst_QVariant::compareRich()
<< QStringLiteral("d"));
}
+void tst_QVariant::nullConvert()
+{
+ // Test quirks with QVariants different types of null states.
+
+ // null variant with no initialized value
+ QVariant nullVar(QVariant::String);
+ QVERIFY(nullVar.isValid());
+ QVERIFY(nullVar.isNull());
+ // We can not convert a variant with no value
+ QVERIFY(!nullVar.convert(QVariant::Url));
+ QCOMPARE(nullVar.type(), QVariant::Url);
+ QVERIFY(nullVar.isNull());
+
+ // variant initialized with null value
+ QVariant nullStr = QVariant::fromValue(QString());
+ QVERIFY(nullStr.isValid());
+ QVERIFY(nullStr.isNull());
+ // We can convert an initialized null value however
+ QVERIFY(nullStr.convert(QVariant::Url));
+ QCOMPARE(nullStr.type(), QVariant::Url);
+ QVERIFY(nullStr.isValid());
+ // QUrl does not have an isNull method
+ QVERIFY(!nullStr.isNull());
+ // The URL is not valid however
+ QVERIFY(!nullStr.toUrl().isValid());
+}
+
void tst_QVariant::accessSequentialContainerKey()
{
QString nameResult;
@@ -4886,6 +4944,5 @@ void tst_QVariant::accessSequentialContainerKey()
QCOMPARE(nameResult, QStringLiteral("Seven"));
}
-
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
index 3221587300..15a39b62c0 100644
--- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
+++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp
@@ -31,6 +31,8 @@
#include <qtimer.h>
#include <qt_windows.h>
+#include <memory>
+
class tst_QWinEventNotifier : public QObject
{
Q_OBJECT
@@ -39,7 +41,9 @@ protected slots:
void simple_activated();
void simple_timerSet();
private slots:
+ void simple_data();
void simple();
+ void manyNotifiers();
private:
HANDLE simpleHEvent;
@@ -58,9 +62,17 @@ void tst_QWinEventNotifier::simple_timerSet()
SetEvent((HANDLE)simpleHEvent);
}
+void tst_QWinEventNotifier::simple_data()
+{
+ QTest::addColumn<bool>("resetManually");
+ QTest::newRow("manual_reset") << true;
+ QTest::newRow("auto_reset") << false;
+}
+
void tst_QWinEventNotifier::simple()
{
- simpleHEvent = CreateEvent(0, true, false, 0);
+ QFETCH(bool, resetManually);
+ simpleHEvent = CreateEvent(0, resetManually, false, 0);
QVERIFY(simpleHEvent);
QWinEventNotifier n(simpleHEvent);
@@ -87,6 +99,91 @@ void tst_QWinEventNotifier::simple()
QVERIFY(simpleActivated);
}
+class EventWithNotifier : public QObject
+{
+ Q_OBJECT
+public:
+ EventWithNotifier()
+ {
+ connect(&notifier, &QWinEventNotifier::activated,
+ this, &EventWithNotifier::onNotifierActivated);
+ notifier.setHandle(CreateEvent(0, TRUE, FALSE, 0));
+ notifier.setEnabled(true);
+
+ static int nextIndex = 0;
+ idx = nextIndex++;
+ }
+
+ ~EventWithNotifier()
+ {
+ notifier.setEnabled(false);
+ CloseHandle(notifier.handle());
+ }
+
+ HANDLE eventHandle() const { return notifier.handle(); }
+ int numberOfTimesActivated() const { return activatedCount; }
+
+signals:
+ void activated();
+
+public slots:
+ void onNotifierActivated()
+ {
+ ResetEvent(notifier.handle());
+ activatedCount++;
+ emit activated();
+ }
+
+private:
+ QWinEventNotifier notifier;
+ int activatedCount = 0;
+ int idx = 0;
+};
+
+void tst_QWinEventNotifier::manyNotifiers()
+{
+ const size_t maxEvents = 100;
+ const size_t middleEvenEvent = maxEvents / 2;
+ Q_ASSERT(middleEvenEvent % 2 == 0);
+ using EventWithNotifierPtr = std::unique_ptr<EventWithNotifier>;
+ std::vector<EventWithNotifierPtr> events(maxEvents);
+ std::generate(events.begin(), events.end(), [] () {
+ return EventWithNotifierPtr(new EventWithNotifier);
+ });
+
+ QTestEventLoop loop;
+ auto connection = connect(events.at(8).get(), &EventWithNotifier::activated, &loop, &QTestEventLoop::exitLoop);
+ for (const auto &ewn : events) {
+ connect(ewn.get(), &EventWithNotifier::activated, [&events, &loop] () {
+ if (std::all_of(events.cbegin(), events.cend(),
+ [] (const EventWithNotifierPtr &ewn) {
+ return ewn->numberOfTimesActivated() > 0; })) {
+ loop.exitLoop();
+ }
+ });
+ }
+
+ // Activate all even events before running the event loop.
+ for (size_t i = 0; i < events.size(); i += 2)
+ SetEvent(events.at(i)->eventHandle());
+
+ // Wait until event notifier with index 8 has been activated.
+ loop.enterLoop(30);
+ QObject::disconnect(connection);
+
+ // Activate all odd events after the event loop has run for a bit.
+ for (size_t i = 1; i < events.size(); i += 2)
+ SetEvent(events.at(i)->eventHandle());
+
+ // Wait until all event notifiers have fired.
+ loop.enterLoop(30);
+
+ // All notifiers must have been activated exactly once.
+ QVERIFY(std::all_of(events.cbegin(), events.cend(), [] (const EventWithNotifierPtr &ewn) {
+ return ewn->numberOfTimesActivated() == 1;
+ }));
+}
+
QTEST_MAIN(tst_QWinEventNotifier)
#include "tst_qwineventnotifier.moc"
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 8a46bc1c55..8883b6360f 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -115,7 +115,6 @@ Q_CONSTRUCTOR_FUNCTION(initializeLang)
static QString seedAndTemplate()
{
- qsrand(QDateTime::currentSecsSinceEpoch());
return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX";
}
diff --git a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
index d93603f641..c74bce3b5b 100644
--- a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
+++ b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp
@@ -46,6 +46,7 @@ private slots:
void genericIconName();
void iconName();
void suffixes();
+ void gadget();
};
// ------------------------------------------------------------------------------------------------
@@ -201,5 +202,44 @@ void tst_qmimetype::suffixes()
// ------------------------------------------------------------------------------------------------
+void tst_qmimetype::gadget()
+{
+ QMimeType instantiatedQMimeType (
+ buildQMimeType (
+ qMimeTypeName(),
+ qMimeTypeGenericIconName(),
+ qMimeTypeIconName(),
+ qMimeTypeGlobPatterns()
+ )
+ );
+
+ const QMetaObject *metaObject = &instantiatedQMimeType.staticMetaObject;
+
+ QCOMPARE(metaObject->className(), "QMimeType");
+ QVariantMap properties;
+ for (int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); i++) {
+ QMetaProperty property = metaObject->property(i);
+ properties[property.name()] = property.readOnGadget(&instantiatedQMimeType);
+ }
+
+ QCOMPARE(properties["valid"].toBool(), instantiatedQMimeType.isValid());
+ QCOMPARE(properties["isDefault"].toBool(), instantiatedQMimeType.isDefault());
+ QCOMPARE(properties["name"].toString(), instantiatedQMimeType.name());
+ QCOMPARE(properties["comment"].toString(), instantiatedQMimeType.comment());
+ QCOMPARE(properties["genericIconName"].toString(), instantiatedQMimeType.genericIconName());
+ QCOMPARE(properties["iconName"].toString(), instantiatedQMimeType.iconName());
+ QCOMPARE(properties["globPatterns"].toStringList(), instantiatedQMimeType.globPatterns());
+ QCOMPARE(properties["parentMimeTypes"].toStringList(), instantiatedQMimeType.parentMimeTypes());
+ QCOMPARE(properties["allAncestors"].toStringList(), instantiatedQMimeType.allAncestors());
+ QCOMPARE(properties["aliases"].toStringList(), instantiatedQMimeType.aliases());
+ QCOMPARE(properties["suffixes"].toStringList(), instantiatedQMimeType.suffixes());
+ QCOMPARE(properties["preferredSuffix"].toString(), instantiatedQMimeType.preferredSuffix());
+ QCOMPARE(properties["filterString"].toString(), instantiatedQMimeType.filterString());
+
+ QVERIFY(metaObject->indexOfMethod("inherits(QString)") >= 0);
+}
+
+// ------------------------------------------------------------------------------------------------
+
QTEST_GUILESS_MAIN(tst_qmimetype)
#include "tst_qmimetype.moc"
diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
index daf9b1579a..d1e138d8eb 100644
--- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
+++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/main.cpp
@@ -35,9 +35,6 @@ int main(int argc, char **argv)
Q_UNUSED(argc)
Q_UNUSED(argv)
- // First, break QUuid.
- qrand();
-
// Now print a few uuids.
printf("%s", qPrintable(QUuid::createUuid().toString()));
printf("%s", qPrintable(QUuid::createUuid().toString()));
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
index d3102c7ee5..9e3edc96ec 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp
@@ -41,6 +41,7 @@ private slots:
void fromChar();
void toString();
+ void fromString_data();
void fromString();
void toByteArray();
void fromByteArray();
@@ -127,15 +128,58 @@ void tst_QUuid::toString()
QCOMPARE(uuidB.toString(), QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"));
}
+void tst_QUuid::fromString_data()
+{
+ QTest::addColumn<QUuid>("expected");
+ QTest::addColumn<QString>("input");
+
+ QUuid invalid = {};
+
+#define ROW(which, string) \
+ QTest::addRow("%-38s -> %s", string, #which) << which << string
+ ROW(uuidA, "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}");
+ ROW(uuidA, "fc69b59e-cc34-4436-a43c-ee95d128b8c5}");
+ ROW(uuidA, "{fc69b59e-cc34-4436-a43c-ee95d128b8c5" );
+ ROW(uuidA, "fc69b59e-cc34-4436-a43c-ee95d128b8c5" );
+
+ ROW(uuidA, "{fc69b59e-cc34-4436-a43c-ee95d128b8c56"); // too long (not an error!)
+ ROW(invalid, "{fc69b59e-cc34-4436-a43c-ee95d128b8c" ); // premature end (within length limits)
+ ROW(invalid, " fc69b59e-cc34-4436-a43c-ee95d128b8c5}"); // leading space
+ ROW(uuidA, "{fc69b59e-cc34-4436-a43c-ee95d128b8c5 "); // trailing space (not an error!)
+ ROW(invalid, "{gc69b59e-cc34-4436-a43c-ee95d128b8c5}"); // non-hex digit in 1st group
+ ROW(invalid, "{fc69b59e-cp34-4436-a43c-ee95d128b8c5}"); // non-hex digit in 2nd group
+ ROW(invalid, "{fc69b59e-cc34-44r6-a43c-ee95d128b8c5}"); // non-hex digit in 3rd group
+ ROW(invalid, "{fc69b59e-cc34-4436-a4yc-ee95d128b8c5}"); // non-hex digit in 4th group
+ ROW(invalid, "{fc69b59e-cc34-4436-a43c-ee95d128j8c5}"); // non-hex digit in last group
+ ROW(invalid, "(fc69b59e-cc34-4436-a43c-ee95d128b8c5}"); // wrong initial character
+ ROW(invalid, "{fc69b59e+cc34-4436-a43c-ee95d128b8c5}"); // wrong 1st separator
+ ROW(invalid, "{fc69b59e-cc34*4436-a43c-ee95d128b8c5}"); // wrong 2nd separator
+ ROW(invalid, "{fc69b59e-cc34-44366a43c-ee95d128b8c5}"); // wrong 3rd separator
+ ROW(invalid, "{fc69b59e-cc34-4436-a43c\303\244ee95d128b8c5}"); // wrong 4th separator (&auml;)
+ ROW(uuidA, "{fc69b59e-cc34-4436-a43c-ee95d128b8c5)"); // wrong final character (not an error!)
+
+ ROW(uuidB, "{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}");
+#undef ROW
+}
+
void tst_QUuid::fromString()
{
- QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
- QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
- QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
- QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
- QCOMPARE(QUuid(), QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c")));
+ QFETCH(const QUuid, expected);
+ QFETCH(const QString, input);
- QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+ const auto inputL1 = input.toLatin1();
+ const auto inputU8 = input.toUtf8();
+
+ QCOMPARE(expected, QUuid(input));
+ QCOMPARE(expected, QUuid(inputU8));
+ QCOMPARE(expected, QUuid(inputL1));
+
+ QCOMPARE(expected, QUuid::fromString(input));
+
+ // for QLatin1String, construct one whose data() is not NUL-terminated:
+ const auto longerInputL1 = inputL1 + '5'; // the '5' makes the premature end check incorrectly succeed
+ const auto inputL1S = QLatin1String(longerInputL1.data(), inputL1.size());
+ QCOMPARE(expected, QUuid::fromString(inputL1S));
}
void tst_QUuid::toByteArray()
diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
index d90bff65b3..41ccece115 100644
--- a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
+++ b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm
@@ -36,7 +36,7 @@ void tst_QUuid_darwinTypes()
{
// QUuid <-> CFUUID
{
- QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
+ const auto qtUuid = QUuid::fromString(QLatin1String("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
const CFUUIDRef cfuuid = qtUuid.toCFUUID();
QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuid);
CFStringRef cfstring = CFUUIDCreateString(0, cfuuid);
@@ -45,10 +45,10 @@ void tst_QUuid_darwinTypes()
CFRelease(cfuuid);
}
{
- QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
+ auto qtUuid = QUuid::fromString(QLatin1String("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
const CFUUIDRef cfuuid = qtUuid.toCFUUID();
QUuid qtUuidCopy(qtUuid);
- qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify
+ qtUuid = QUuid::fromString(QLatin1String("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify
QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuidCopy);
CFStringRef cfstring = CFUUIDCreateString(0, cfuuid);
QCOMPARE(QString::fromCFString(cfstring), qtUuidCopy.toString().mid(1, 36).toUpper());
@@ -59,7 +59,7 @@ void tst_QUuid_darwinTypes()
{
QMacAutoReleasePool pool;
- QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
+ const auto qtUuid = QUuid::fromString(QLatin1String("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
const NSUUID *nsuuid = qtUuid.toNSUUID();
QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuid);
QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuid.toString().mid(1, 36).toUpper());
@@ -67,10 +67,10 @@ void tst_QUuid_darwinTypes()
{
QMacAutoReleasePool pool;
- QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
+ auto qtUuid = QUuid::fromString(QLatin1String("0f7169cc-5711-4af9-99d9-fecb2329fdef"));
const NSUUID *nsuuid = qtUuid.toNSUUID();
QUuid qtUuidCopy(qtUuid);
- qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify
+ qtUuid = QUuid::fromString(QLatin1String("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify
QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuidCopy);
QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuidCopy.toString().mid(1, 36).toUpper());
}
diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
index a546cad225..58bebe19ac 100644
--- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
+++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp
@@ -36,6 +36,7 @@
#include <qresultstore.h>
#include <qthreadpool.h>
#include <qexception.h>
+#include <qrandom.h>
#include <private/qfutureinterface_p.h>
// COM interface macro.
@@ -1205,8 +1206,6 @@ void tst_QFuture::pause()
Interface.reportFinished();
}
-const int resultCount = 1000;
-
class ResultObject : public QObject
{
Q_OBJECT
@@ -1458,7 +1457,7 @@ void tst_QFuture::nonGlobalThreadPool()
void run() Q_DECL_OVERRIDE
{
- const int ms = 100 + (qrand() % 100 - 100/2);
+ const int ms = 100 + (QRandomGenerator::global()->bounded(100) - 100/2);
QThread::msleep(ms);
reportResult(Answer);
reportFinished();
diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
index ce093f769c..a67ecc2471 100644
--- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp
@@ -44,6 +44,7 @@ private slots:
void tryAcquireWithTimeoutForever_data();
void tryAcquireWithTimeoutForever();
void producerConsumer();
+ void raii();
};
static QSemaphore *semaphore = 0;
@@ -480,5 +481,54 @@ void tst_QSemaphore::producerConsumer()
consumer.wait();
}
+void tst_QSemaphore::raii()
+{
+ QSemaphore sem;
+
+ QCOMPARE(sem.available(), 0);
+
+ // basic operation:
+ {
+ QSemaphoreReleaser r0;
+ const QSemaphoreReleaser r1(sem);
+ const QSemaphoreReleaser r2(sem, 2);
+
+ QCOMPARE(r0.semaphore(), nullptr);
+ QCOMPARE(r1.semaphore(), &sem);
+ QCOMPARE(r2.semaphore(), &sem);
+ }
+
+ QCOMPARE(sem.available(), 3);
+
+ // cancel:
+ {
+ const QSemaphoreReleaser r1(sem);
+ QSemaphoreReleaser r2(sem, 2);
+
+ QCOMPARE(r2.cancel(), &sem);
+ QCOMPARE(r2.semaphore(), nullptr);
+ }
+
+ QCOMPARE(sem.available(), 4);
+
+ // move-assignment:
+ {
+ const QSemaphoreReleaser r1(sem);
+ QSemaphoreReleaser r2(sem, 2);
+
+ QCOMPARE(sem.available(), 4);
+
+ r2 = QSemaphoreReleaser();
+
+ QCOMPARE(sem.available(), 6);
+
+ r2 = QSemaphoreReleaser(sem, 42);
+
+ QCOMPARE(sem.available(), 6);
+ }
+
+ QCOMPARE(sem.available(), 49);
+}
+
QTEST_MAIN(tst_QSemaphore)
#include "tst_qsemaphore.moc"
diff --git a/tests/auto/corelib/thread/qthread/qthread.pro b/tests/auto/corelib/thread/qthread/qthread.pro
index e0ef506d2c..37552f1fca 100644
--- a/tests/auto/corelib/thread/qthread/qthread.pro
+++ b/tests/auto/corelib/thread/qthread/qthread.pro
@@ -2,6 +2,8 @@ CONFIG += testcase
TARGET = tst_qthread
QT = core testlib
SOURCES = tst_qthread.cpp
+qtConfig(c++14):CONFIG += c++14
+qtConfig(c++1z):CONFIG += c++1z
INCLUDEPATH += ../../../../shared/
HEADERS += ../../../../shared/emulationdetector.h
diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
index 5c8522a313..0405896ca7 100644
--- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp
+++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp
@@ -47,6 +47,10 @@
#endif
#endif
+#ifndef QT_NO_EXCEPTIONS
+#include <exception>
+#endif
+
#include "emulationdetector.h"
class tst_QThread : public QObject
@@ -100,6 +104,8 @@ private slots:
void stressTest();
void quitLock();
+
+ void create();
};
enum { one_minute = 60 * 1000, five_minutes = 5 * one_minute };
@@ -1330,6 +1336,259 @@ void tst_QThread::quitLock()
QVERIFY(exitThreadCalled);
}
+void tst_QThread::create()
+{
+#if !QT_CONFIG(cxx11_future)
+ QSKIP("This test requires QThread::create");
+#else
+ {
+ const auto &function = [](){};
+ QScopedPointer<QThread> thread(QThread::create(function));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ }
+
+ {
+ // no side effects before starting
+ int i = 0;
+ const auto &function = [&i]() { i = 42; };
+ QScopedPointer<QThread> thread(QThread::create(function));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ QCOMPARE(i, 0);
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 42);
+ }
+
+ {
+ // control thread progress
+ QSemaphore semaphore1;
+ QSemaphore semaphore2;
+
+ const auto &function = [&semaphore1, &semaphore2]() -> void
+ {
+ semaphore1.acquire();
+ semaphore2.release();
+ };
+
+ QScopedPointer<QThread> thread(QThread::create(function));
+
+ QVERIFY(thread);
+ thread->start();
+ QTRY_VERIFY(thread->isRunning());
+ semaphore1.release();
+ semaphore2.acquire();
+ QVERIFY(thread->wait());
+ QVERIFY(!thread->isRunning());
+ }
+
+ {
+ // ignore return values
+ const auto &function = []() { return 42; };
+ QScopedPointer<QThread> thread(QThread::create(function));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ }
+
+ {
+ // return value of create
+ QScopedPointer<QThread> thread;
+ QSemaphore s;
+ const auto &function = [&thread, &s]() -> void
+ {
+ s.acquire();
+ QCOMPARE(thread.data(), QThread::currentThread());
+ };
+
+ thread.reset(QThread::create(function));
+ QVERIFY(thread);
+ thread->start();
+ QTRY_VERIFY(thread->isRunning());
+ s.release();
+ QVERIFY(thread->wait());
+ }
+
+ {
+ // move-only parameters
+ struct MoveOnlyValue {
+ explicit MoveOnlyValue(int v) : v(v) {}
+ ~MoveOnlyValue() = default;
+ MoveOnlyValue(const MoveOnlyValue &) = delete;
+ MoveOnlyValue(MoveOnlyValue &&) = default;
+ MoveOnlyValue &operator=(const MoveOnlyValue &) = delete;
+ MoveOnlyValue &operator=(MoveOnlyValue &&) = default;
+ int v;
+ };
+
+ struct MoveOnlyFunctor {
+ explicit MoveOnlyFunctor(int *i) : i(i) {}
+ ~MoveOnlyFunctor() = default;
+ MoveOnlyFunctor(const MoveOnlyFunctor &) = delete;
+ MoveOnlyFunctor(MoveOnlyFunctor &&) = default;
+ MoveOnlyFunctor &operator=(const MoveOnlyFunctor &) = delete;
+ MoveOnlyFunctor &operator=(MoveOnlyFunctor &&) = default;
+ int operator()() { return (*i = 42); }
+ int *i;
+ };
+
+ {
+ int i = 0;
+ MoveOnlyFunctor f(&i);
+ QScopedPointer<QThread> thread(QThread::create(std::move(f)));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 42);
+ }
+
+#if defined(__cpp_init_captures) && __cpp_init_captures >= 201304
+ {
+ int i = 0;
+ MoveOnlyValue mo(123);
+ auto moveOnlyFunction = [&i, mo = std::move(mo)]() { i = mo.v; };
+ QScopedPointer<QThread> thread(QThread::create(std::move(moveOnlyFunction)));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 123);
+ }
+#endif // __cpp_init_captures
+
+#ifdef QTHREAD_HAS_VARIADIC_CREATE
+ {
+ int i = 0;
+ const auto &function = [&i](MoveOnlyValue &&mo) { i = mo.v; };
+ QScopedPointer<QThread> thread(QThread::create(function, MoveOnlyValue(123)));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 123);
+ }
+
+ {
+ int i = 0;
+ const auto &function = [&i](MoveOnlyValue &&mo) { i = mo.v; };
+ MoveOnlyValue mo(-1);
+ QScopedPointer<QThread> thread(QThread::create(function, std::move(mo)));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, -1);
+ }
+#endif // QTHREAD_HAS_VARIADIC_CREATE
+ }
+
+#ifdef QTHREAD_HAS_VARIADIC_CREATE
+ {
+ // simple parameter passing
+ int i = 0;
+ const auto &function = [&i](int j, int k) { i = j * k; };
+ QScopedPointer<QThread> thread(QThread::create(function, 3, 4));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ QCOMPARE(i, 0);
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 12);
+ }
+
+ {
+ // ignore return values (with parameters)
+ const auto &function = [](double d) { return d * 2.0; };
+ QScopedPointer<QThread> thread(QThread::create(function, 3.14));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+ }
+
+ {
+ // handling of pointers to member functions, std::ref, etc.
+ struct S {
+ S() : v(0) {}
+ void doSomething() { ++v; }
+ int v;
+ };
+
+ S object;
+
+ QCOMPARE(object.v, 0);
+
+ QScopedPointer<QThread> thread;
+ thread.reset(QThread::create(&S::doSomething, object));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+
+ QCOMPARE(object.v, 0); // a copy was passed, this should still be 0
+
+ thread.reset(QThread::create(&S::doSomething, std::ref(object)));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+
+ QCOMPARE(object.v, 1);
+
+ thread.reset(QThread::create(&S::doSomething, &object));
+ QVERIFY(thread);
+ QVERIFY(!thread->isRunning());
+ thread->start();
+ QVERIFY(thread->wait());
+
+ QCOMPARE(object.v, 2);
+ }
+
+ {
+ // std::ref into ordinary reference
+ int i = 42;
+ const auto &function = [](int &i) { i *= 2; };
+ QScopedPointer<QThread> thread(QThread::create(function, std::ref(i)));
+ QVERIFY(thread);
+ thread->start();
+ QVERIFY(thread->wait());
+ QCOMPARE(i, 84);
+ }
+
+#ifndef QT_NO_EXCEPTIONS
+ {
+ // exceptions when copying/decaying the arguments are thrown at build side and won't terminate
+ class ThreadException : public std::exception
+ {
+ };
+
+ struct ThrowWhenCopying
+ {
+ ThrowWhenCopying() = default;
+ ThrowWhenCopying(const ThrowWhenCopying &)
+ {
+ throw ThreadException();
+ }
+ ~ThrowWhenCopying() = default;
+ ThrowWhenCopying &operator=(const ThrowWhenCopying &) = default;
+ };
+
+ const auto &function = [](const ThrowWhenCopying &){};
+ QScopedPointer<QThread> thread;
+ ThrowWhenCopying t;
+ QVERIFY_EXCEPTION_THROWN(thread.reset(QThread::create(function, t)), ThreadException);
+ QVERIFY(!thread);
+ }
+#endif // QT_NO_EXCEPTIONS
+#endif // QTHREAD_HAS_VARIADIC_CREATE
+#endif // QT_CONFIG(cxx11_future)
+}
+
class StopableJob : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 0eaf8a4b77..1092216fb7 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -92,6 +92,7 @@ private slots:
void tryTake();
void waitForDoneTimeout();
void destroyingWaitsForTasksToFinish();
+ void stackSize();
void stressTest();
void takeAllAndIncreaseMaxThreadCount();
void waitForDoneAfterTake();
@@ -963,21 +964,6 @@ void tst_QThreadPool::cancel()
QSemaphore sem(0);
QSemaphore startedThreads(0);
- class SemaphoreReleaser
- {
- QSemaphore &sem;
- int n;
- Q_DISABLE_COPY(SemaphoreReleaser)
- public:
- explicit SemaphoreReleaser(QSemaphore &sem, int n)
- : sem(sem), n(n) {}
-
- ~SemaphoreReleaser()
- {
- sem.release(n);
- }
- };
-
class BlockingRunnable : public QRunnable
{
public:
@@ -1016,7 +1002,7 @@ void tst_QThreadPool::cancel()
// ensure that the QThreadPool doesn't deadlock if any of the checks fail
// and cause an early return:
- const SemaphoreReleaser semReleaser(sem, runs);
+ const QSemaphoreReleaser semReleaser(sem, runs);
count.store(0);
QAtomicInt dtorCounter = 0;
@@ -1050,21 +1036,6 @@ void tst_QThreadPool::tryTake()
QSemaphore sem(0);
QSemaphore startedThreads(0);
- class SemaphoreReleaser
- {
- QSemaphore &sem;
- int n;
- Q_DISABLE_COPY(SemaphoreReleaser)
- public:
- explicit SemaphoreReleaser(QSemaphore &sem, int n)
- : sem(sem), n(n) {}
-
- ~SemaphoreReleaser()
- {
- sem.release(n);
- }
- };
-
class BlockingRunnable : public QRunnable
{
public:
@@ -1103,7 +1074,7 @@ void tst_QThreadPool::tryTake()
// ensure that the QThreadPool doesn't deadlock if any of the checks fail
// and cause an early return:
- const SemaphoreReleaser semReleaser(sem, Runs);
+ const QSemaphoreReleaser semReleaser(sem, Runs);
count.store(0);
QAtomicInt dtorCounter = 0;
@@ -1168,6 +1139,39 @@ void tst_QThreadPool::destroyingWaitsForTasksToFinish()
}
}
+// Verify that QThreadPool::stackSize is used when creating
+// new threads. Note that this tests the Qt property only
+// since QThread::stackSize() does not reflect the actual
+// stack size used by the native thread.
+void tst_QThreadPool::stackSize()
+{
+ uint targetStackSize = 512 * 1024;
+ uint threadStackSize = 1; // impossible value
+
+ class StackSizeChecker : public QRunnable
+ {
+ public:
+ uint *stackSize;
+
+ StackSizeChecker(uint *stackSize)
+ :stackSize(stackSize)
+ {
+
+ }
+
+ void run()
+ {
+ *stackSize = QThread::currentThread()->stackSize();
+ }
+ };
+
+ QThreadPool threadPool;
+ threadPool.setStackSize(targetStackSize);
+ threadPool.start(new StackSizeChecker(&threadStackSize));
+ QVERIFY(threadPool.waitForDone(30000)); // 30s timeout
+ QCOMPARE(threadStackSize, targetStackSize);
+}
+
void tst_QThreadPool::stressTest()
{
class Task : public QRunnable
diff --git a/tests/auto/corelib/tools/containerapisymmetry/.gitignore b/tests/auto/corelib/tools/containerapisymmetry/.gitignore
new file mode 100644
index 0000000000..172ca970f2
--- /dev/null
+++ b/tests/auto/corelib/tools/containerapisymmetry/.gitignore
@@ -0,0 +1 @@
+tst_containerapisymmetry
diff --git a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
new file mode 100644
index 0000000000..30dc8026ef
--- /dev/null
+++ b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase
+TARGET = tst_containerapisymmetry
+SOURCES += tst_containerapisymmetry.cpp
+QT = core testlib
+
+# This test does not work with strict iterators
+DEFINES -= QT_STRICT_ITERATORS
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
new file mode 100644
index 0000000000..3b8111f1a3
--- /dev/null
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@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 <QtTest/QtTest>
+
+#include "qbytearray.h"
+#include "qlinkedlist.h"
+#include "qlist.h"
+#include "qstring.h"
+#include "qvarlengtharray.h"
+#include "qvector.h"
+
+#include <vector> // for reference
+
+class tst_ContainerApiSymmetry : public QObject
+{
+ Q_OBJECT
+
+private:
+ template <typename Container>
+ void front_back_impl() const;
+
+private Q_SLOTS:
+ void front_back_std_vector() { front_back_impl<std::vector<int>>(); }
+ void front_back_QVector() { front_back_impl<QVector<int>>(); }
+ void front_back_QList() { front_back_impl<QList<qintptr>>(); }
+ void front_back_QLinkedList() { front_back_impl<QLinkedList<int>>(); }
+ void front_back_QVarLengthArray() { front_back_impl<QVarLengthArray<int>>(); }
+ void front_back_QString() { front_back_impl<QString>(); }
+ void front_back_QStringRef() { front_back_impl<QStringRef>(); }
+ void front_back_QStringView() { front_back_impl<QStringView>(); }
+ void front_back_QLatin1String() { front_back_impl<QLatin1String>(); }
+ void front_back_QByteArray() { front_back_impl<QByteArray>(); }
+};
+
+template <typename Container>
+Container make(int size)
+{
+ Container c;
+ int i = 1;
+ while (size--)
+ c.push_back(typename Container::value_type(i++));
+ return c;
+}
+
+static QString s_string = QStringLiteral("\1\2\3\4\5\6\7");
+
+template <> QStringRef make(int size) { return s_string.leftRef(size); }
+template <> QStringView make(int size) { return QStringView(s_string).left(size); }
+template <> QLatin1String make(int size) { return QLatin1String("\1\2\3\4\5\6\7", size); }
+
+template <typename T> T clean(T &&t) { return std::forward<T>(t); }
+inline QChar clean(QCharRef ch) { return ch; }
+inline char clean(QByteRef ch) { return ch; }
+inline char clean(QLatin1Char ch) { return ch.toLatin1(); }
+
+template <typename Container>
+void tst_ContainerApiSymmetry::front_back_impl() const
+{
+ using V = typename Container::value_type;
+ auto c1 = make<Container>(1);
+ QCOMPARE(clean(c1.front()), V(1));
+ QCOMPARE(clean(c1.back()), V(1));
+ QCOMPARE(clean(qAsConst(c1).front()), V(1));
+ QCOMPARE(clean(qAsConst(c1).back()), V(1));
+
+ auto c2 = make<Container>(2);
+ QCOMPARE(clean(c2.front()), V(1));
+ QCOMPARE(clean(c2.back()), V(2));
+ QCOMPARE(clean(qAsConst(c2).front()), V(1));
+ QCOMPARE(clean(qAsConst(c2).back()), V(2));
+}
+
+QTEST_APPLESS_MAIN(tst_ContainerApiSymmetry)
+#include "tst_containerapisymmetry.moc"
diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
index e13c2894af..72299402f0 100644
--- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
+++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp
@@ -37,6 +37,7 @@
#include <qalgorithms.h>
#include <QStringList>
#include <QString>
+#include <QRandomGenerator>
#include <QVector>
#define Q_TEST_PERFORMANCE 0
@@ -133,7 +134,7 @@ QVector<DataType> generateData(QString dataSetType, const int length)
QVector<DataType> container;
if (dataSetType == "Random") {
for (int i = 0; i < length; ++i)
- container.append(rand());
+ container.append(QRandomGenerator::global()->generate());
} else if (dataSetType == "Ascending") {
for (int i = 0; i < length; ++i)
container.append(i);
@@ -1082,12 +1083,12 @@ void tst_QAlgorithms::popCount_data_impl(size_t sizeof_T_Int)
// and some random ones:
if (sizeof_T_Int >= 8)
for (size_t i = 0; i < 1000; ++i) {
- const quint64 input = quint64(qrand()) << 32 | quint32(qrand());
+ const quint64 input = QRandomGenerator::global()->generate64();
QTest::addRow("0x%016llx", input) << input << bitsSetInInt64(input);
}
else if (sizeof_T_Int >= 2)
for (size_t i = 0; i < 1000 ; ++i) {
- const quint32 input = qrand();
+ const quint32 input = QRandomGenerator::global()->generate();
if (sizeof_T_Int >= 4)
QTest::addRow("0x%08x", input) << quint64(input) << bitsSetInInt(input);
else
@@ -1129,7 +1130,7 @@ void tst_QAlgorithms::countTrailing_data_impl(size_t sizeof_T_Int)
// and some random ones:
for (uint i = 0; i < sizeof_T_Int*8; ++i) {
for (uint j = 0; j < sizeof_T_Int*3; ++j) { // 3 is arbitrary
- const quint64 r = quint64(qrand()) << 32 | quint32(qrand());
+ const quint64 r = QRandomGenerator::global()->generate64();
const quint64 b = Q_UINT64_C(1) << i;
const quint64 mask = ((~(b-1)) ^ b) & type_mask;
const quint64 input = (r&mask) | b;
@@ -1166,7 +1167,7 @@ void tst_QAlgorithms::countLeading_data_impl(size_t sizeof_T_Int)
// and some random ones:
for (uint i = 0; i < sizeof_T_Int*8; ++i) {
for (uint j = 0; j < sizeof_T_Int*3; ++j) { // 3 is arbitrary
- const quint64 r = quint64(qrand()) << 32 | quint32(qrand());
+ const quint64 r = QRandomGenerator::global()->generate64();
const quint64 b = Q_UINT64_C(1) << i;
const quint64 mask = b-1;
const quint64 input = (r&mask) | b;
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index e5a6e953d3..cf4f6d21e2 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -36,6 +36,8 @@ class tst_QChar : public QObject
{
Q_OBJECT
private slots:
+ void fromChar16_t();
+ void fromWchar_t();
void operator_eqeq_null();
void operators_data();
void operators();
@@ -72,6 +74,33 @@ private slots:
void unicodeVersion();
};
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+
+void tst_QChar::fromChar16_t()
+{
+#if defined(Q_COMPILER_UNICODE_STRINGS)
+ QChar aUmlaut = u'\u00E4'; // German small letter a-umlaut
+ QCOMPARE(aUmlaut, QChar(0xE4));
+ QChar replacementCharacter = u'\uFFFD';
+ QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter));
+#else
+ QSKIP("This test requires C++11 char16_t support enabled in the compiler.");
+#endif
+}
+
+void tst_QChar::fromWchar_t()
+{
+#if defined(Q_OS_WIN)
+ QChar aUmlaut = L'\u00E4'; // German small letter a-umlaut
+ QCOMPARE(aUmlaut, QChar(0xE4));
+ QChar replacementCharacter = L'\uFFFD';
+ QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter));
+#else
+ QSKIP("This is a Windows-only test.");
+#endif
+}
+
void tst_QChar::operator_eqeq_null()
{
{
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index f88eac1a9f..ff31f01d7c 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -1490,7 +1490,7 @@ void tst_QDate::roundtrip() const
void tst_QDate::qdebug() const
{
- QTest::ignoreMessage(QtDebugMsg, "QDate(\"\")");
+ QTest::ignoreMessage(QtDebugMsg, "QDate(Invalid)");
qDebug() << QDate();
QTest::ignoreMessage(QtDebugMsg, "QDate(\"1983-08-07\")");
qDebug() << QDate(1983, 8, 7);
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 28ad2d193c..c0ed88e154 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -131,6 +131,8 @@ private slots:
void setOffsetFromUtc();
void toOffsetFromUtc();
+ void zoneAtTime_data();
+ void zoneAtTime();
void timeZoneAbbreviation();
void getDate();
@@ -1378,11 +1380,13 @@ void tst_QDateTime::toTimeSpec()
QCOMPARE(utcToLocal.date(), fromLocal.date());
QCOMPARE(utcToLocal.time(), fromLocal.time());
QCOMPARE(utcToLocal.timeSpec(), Qt::LocalTime);
+ QCOMPARE(utcToLocal.toTimeSpec(Qt::UTC), fromUtc);
QCOMPARE(localToUtc, fromUtc);
QCOMPARE(localToUtc.date(), fromUtc.date());
QCOMPARE(localToUtc.time(), fromUtc.time());
QCOMPARE(localToUtc.timeSpec(), Qt::UTC);
+ QCOMPARE(localToUtc.toTimeSpec(Qt::LocalTime), fromLocal);
QCOMPARE(utcToUtc, localToUtc);
QCOMPARE(utcToUtc.date(), localToUtc.date());
@@ -1399,11 +1403,13 @@ void tst_QDateTime::toTimeSpec()
QCOMPARE(utcToOffset.date(), fromUtc.date());
QCOMPARE(utcToOffset.time(), fromUtc.time());
QCOMPARE(utcToOffset.timeSpec(), Qt::UTC);
+ QCOMPARE(utcToOffset.toTimeSpec(Qt::UTC), fromUtc);
QCOMPARE(localToOffset, fromUtc);
QCOMPARE(localToOffset.date(), fromUtc.date());
QCOMPARE(localToOffset.time(), fromUtc.time());
QCOMPARE(localToOffset.timeSpec(), Qt::UTC);
+ QCOMPARE(localToOffset.toTimeSpec(Qt::LocalTime), fromLocal);
} else {
QSKIP("Not tested with timezone other than Central European (CET/CEST)");
}
@@ -2277,6 +2283,9 @@ void tst_QDateTime::fromStringDateFormat_data()
QTest::newRow("ISO .99999 of a minute (comma)") << QString::fromLatin1("2012-01-01T08:00,99999")
<< Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 59, 999), Qt::LocalTime);
QTest::newRow("ISO empty") << QString::fromLatin1("") << Qt::ISODate << invalidDateTime();
+ QTest::newRow("ISO short") << QString::fromLatin1("2017-07-01T") << Qt::ISODate << invalidDateTime();
+ QTest::newRow("ISO zoned date") << QString::fromLatin1("2017-07-01Z") << Qt::ISODate << invalidDateTime();
+ QTest::newRow("ISO zoned empty time") << QString::fromLatin1("2017-07-01TZ") << Qt::ISODate << invalidDateTime();
// Test Qt::RFC2822Date format (RFC 2822).
QTest::newRow("RFC 2822 +0100") << QString::fromLatin1("13 Feb 1987 13:24:51 +0100")
@@ -2476,21 +2485,19 @@ void tst_QDateTime::fromStringToStringLocale()
QLocale def;
QLocale::setDefault(QLocale(QLocale::French, QLocale::France));
+#define ROUNDTRIP(format) \
+ QCOMPARE(QDateTime::fromString(dateTime.toString(format), format), dateTime)
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::DefaultLocaleShortDate), Qt::DefaultLocaleShortDate), dateTime);
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::SystemLocaleShortDate), Qt::SystemLocaleShortDate), dateTime);
+ ROUNDTRIP(Qt::DefaultLocaleShortDate);
+ ROUNDTRIP(Qt::SystemLocaleShortDate);
// obsolete
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::SystemLocaleDate), Qt::SystemLocaleDate), dateTime);
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::LocaleDate), Qt::LocaleDate), dateTime);
-
- QEXPECT_FAIL("data0", "This format is apparently failing because of a bug in the datetime parser. (QTBUG-22833)", Continue);
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::DefaultLocaleLongDate), Qt::DefaultLocaleLongDate), dateTime);
-#ifndef Q_OS_WIN
- QEXPECT_FAIL("data0", "This format is apparently failing because of a bug in the datetime parser. (QTBUG-22833)", Continue);
-#endif
- QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::SystemLocaleLongDate), Qt::SystemLocaleLongDate), dateTime);
+ ROUNDTRIP(Qt::SystemLocaleDate);
+ ROUNDTRIP(Qt::LocaleDate);
+ ROUNDTRIP(Qt::DefaultLocaleLongDate);
+ ROUNDTRIP(Qt::SystemLocaleLongDate);
+#undef ROUNDTRIP
QLocale::setDefault(def);
}
@@ -2625,6 +2632,71 @@ void tst_QDateTime::toOffsetFromUtc()
QCOMPARE(dt2.time(), QTime(0, 0, 0));
}
+void tst_QDateTime::zoneAtTime_data()
+{
+ QTest::addColumn<QByteArray>("ianaID");
+ QTest::addColumn<QDate>("date");
+ QTest::addColumn<int>("offset");
+#define ADDROW(name, zone, date, offset) \
+ QTest::newRow(name) << QByteArray(zone) << (date) << (offset)
+
+ // Check DST handling around epoch:
+ {
+ QDate epoch(1970, 1, 1);
+ ADDROW("epoch:UTC", "UTC", epoch, 0);
+ // Paris and Berlin skipped DST around 1970; but Rome used it.
+ ADDROW("epoch:CET", "Europe/Rome", epoch, 3600);
+ ADDROW("epoch:PST", "America/Vancouver", epoch, -8 * 3600);
+ ADDROW("epoch:EST", "America/New_York", epoch, -5 * 3600);
+ }
+ {
+ // QDateTime deliberately ignores DST before the epoch.
+ QDate summer69(1969, 8, 15); // Woodstock started
+ ADDROW("summer69:UTC", "UTC", summer69, 0);
+ ADDROW("summer69:CET", "Europe/Rome", summer69, 3600);
+ ADDROW("summer69:PST", "America/Vancouver", summer69, -8 * 3600);
+ ADDROW("summer69:EST", "America/New_York", summer69, -5 * 3600);
+ }
+ {
+ // ... but takes it into account after:
+ QDate summer70(1970, 8, 26); // Isle of Wight festival
+ ADDROW("summer70:UTC", "UTC", summer70, 0);
+ ADDROW("summer70:CET", "Europe/Rome", summer70, 2 * 3600);
+ ADDROW("summer70:PST", "America/Vancouver", summer70, -7 * 3600);
+ ADDROW("summer70:EST", "America/New_York", summer70, -4 * 3600);
+ }
+
+#ifndef Q_OS_WIN
+ // Bracket a few noteworthy transitions:
+ ADDROW("before:ACWST", "Australia/Eucla", QDate(1974, 10, 26), 31500); // 8:45
+ ADDROW("after:ACWST", "Australia/Eucla", QDate(1974, 10, 27), 35100); // 9:45
+ ADDROW("before:NPT", "Asia/Kathmandu", QDate(1985, 12, 31), 19800); // 5:30
+ ADDROW("after:NPT", "Asia/Kathmandu", QDate(1986, 1, 1), 20700); // 5:45
+ // The two that have skipped a day (each):
+ ADDROW("before:LINT", "Pacific/Kiritimati", QDate(1994, 12, 31), -36000);
+ ADDROW("after:LINT", "Pacific/Kiritimati", QDate(1995, 2, 1), 14 * 3600);
+ ADDROW("after:WST", "Pacific/Apia", QDate(2011, 12, 31), 14 * 3600);
+#endif // MS lacks ACWST, NPT; doesn't grok date-line crossings; and Windows 7 lacks LINT.
+ ADDROW("before:WST", "Pacific/Apia", QDate(2011, 12, 29), -36000);
+#undef ADDROW
+}
+
+void tst_QDateTime::zoneAtTime()
+{
+ QFETCH(QByteArray, ianaID);
+ QFETCH(QDate, date);
+ QFETCH(int, offset);
+ const QTime noon(12, 0);
+
+ QTimeZone zone(ianaID);
+ QVERIFY(zone.isValid());
+ QCOMPARE(QDateTime(date, noon, zone).offsetFromUtc(), offset);
+ if (date.year() < 1970)
+ QCOMPARE(zone.standardTimeOffset(QDateTime(date, noon, zone)), offset);
+ else // zone.offsetFromUtc *does* include DST, even before epoch
+ QCOMPARE(zone.offsetFromUtc(QDateTime(date, noon, zone)), offset);
+}
+
void tst_QDateTime::timeZoneAbbreviation()
{
QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60);
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
index 943b4316ff..0015efacfa 100644
--- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp
+++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp
@@ -60,6 +60,7 @@ private slots:
void compare2();
void iterators(); // sligthly modified from tst_QMap
void keyIterator();
+ void keyValueIterator();
void keys_values_uniqueKeys(); // slightly modified from tst_QMap
void noNeedlessRehashes();
@@ -1124,6 +1125,60 @@ void tst_QHash::keyIterator()
Q_STATIC_ASSERT(std::is_default_constructible<keyIterator>::value);
}
+void tst_QHash::keyValueIterator()
+{
+ QHash<int, int> hash;
+ typedef QHash<int, int>::const_key_value_iterator::value_type entry_type;
+
+ for (int i = 0; i < 100; ++i)
+ hash.insert(i, i * 100);
+
+ auto key_value_it = hash.constKeyValueBegin();
+ auto it = hash.cbegin();
+
+
+ for (int i = 0; i < hash.size(); ++i) {
+ QVERIFY(key_value_it != hash.constKeyValueEnd());
+ QVERIFY(it != hash.cend());
+
+ entry_type pair(it.key(), it.value());
+ QCOMPARE(*key_value_it, pair);
+ ++key_value_it;
+ ++it;
+ }
+
+ QVERIFY(key_value_it == hash.constKeyValueEnd());
+ QVERIFY(it == hash.cend());
+
+ int key = 50;
+ int value = 50 * 100;
+ entry_type pair(key, value);
+ key_value_it = std::find(hash.constKeyValueBegin(), hash.constKeyValueEnd(), pair);
+ it = std::find(hash.cbegin(), hash.cend(), value);
+
+ QVERIFY(key_value_it != hash.constKeyValueEnd());
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ ++it;
+ ++key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ --it;
+ --key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ ++it;
+ ++key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ --it;
+ --key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+ key = 99;
+ value = 99 * 100;
+ QCOMPARE(std::count(hash.constKeyValueBegin(), hash.constKeyValueEnd(), entry_type(key, value)), 1);
+}
+
void tst_QHash::rehash_isnt_quadratic()
{
// this test should be incredibly slow if rehash() is quadratic
diff --git a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
index 4a81adf9fe..124e3cdf00 100644
--- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
+++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp
@@ -49,6 +49,7 @@ public slots:
void init();
private Q_SLOTS:
+ void consistent();
void qhash();
void qhash_of_empty_and_null_qstring();
void qhash_of_empty_and_null_qbytearray();
@@ -61,6 +62,17 @@ private Q_SLOTS:
void setGlobalQHashSeed();
};
+void tst_QHashFunctions::consistent()
+{
+ // QString-like
+ {
+ const QString s = QStringLiteral("abcdefghijklmnopqrstuvxyz").repeated(16);
+
+ QCOMPARE(qHash(s), qHash(QStringRef(&s)));
+ QCOMPARE(qHash(s), qHash(QStringView(s)));
+ }
+}
+
void tst_QHashFunctions::initTestCase()
{
Q_STATIC_ASSERT(int(RandomSeed) > 0);
@@ -160,6 +172,14 @@ void tst_QHashFunctions::qhash_of_empty_and_null_qstring()
QString null, empty("");
QCOMPARE(null, empty);
QCOMPARE(qHash(null, seed), qHash(empty, seed));
+
+ QStringRef nullRef, emptyRef(&empty);
+ QCOMPARE(nullRef, emptyRef);
+ QCOMPARE(qHash(nullRef, seed), qHash(emptyRef, seed));
+
+ QStringView nullView, emptyView(empty);
+ QCOMPARE(nullView, emptyView);
+ QCOMPARE(qHash(nullView, seed), qHash(emptyView, seed));
}
void tst_QHashFunctions::qhash_of_empty_and_null_qbytearray()
@@ -264,17 +284,17 @@ void tst_QHashFunctions::rangeCommutative()
void tst_QHashFunctions::setGlobalQHashSeed()
{
// Setter works as advertised
- qSetGlobalQHashSeed(0x10101010);
- QCOMPARE(qGlobalQHashSeed(), 0x10101010);
+ qSetGlobalQHashSeed(0);
+ QCOMPARE(qGlobalQHashSeed(), 0);
// Creating a new QHash doesn't reset the seed
QHash<QString, int> someHash;
someHash.insert("foo", 42);
- QCOMPARE(qGlobalQHashSeed(), 0x10101010);
+ QCOMPARE(qGlobalQHashSeed(), 0);
// Reset works as advertised
qSetGlobalQHashSeed(-1);
- QVERIFY(qGlobalQHashSeed() != -1);
+ QVERIFY(qGlobalQHashSeed() > 0);
}
QTEST_APPLESS_MAIN(tst_QHashFunctions)
diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
index a68671d899..c8373b6ae9 100644
--- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
+++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp
@@ -48,6 +48,7 @@ private Q_SLOTS:
void midLeftRight();
void nullString();
void emptyString();
+ void iterators();
void relationalOperators_data();
void relationalOperators();
};
@@ -155,6 +156,22 @@ void tst_QLatin1String::emptyString()
}
}
+void tst_QLatin1String::iterators()
+{
+ QLatin1String hello("hello");
+ QLatin1String olleh("olleh");
+
+ QVERIFY(std::equal(hello.begin(), hello.end(),
+ olleh.rbegin()));
+ QVERIFY(std::equal(hello.rbegin(), hello.rend(),
+ QT_MAKE_CHECKED_ARRAY_ITERATOR(olleh.begin(), olleh.size())));
+
+ QVERIFY(std::equal(hello.cbegin(), hello.cend(),
+ olleh.rbegin()));
+ QVERIFY(std::equal(hello.crbegin(), hello.crend(),
+ QT_MAKE_CHECKED_ARRAY_ITERATOR(olleh.begin(), olleh.size())));
+}
+
void tst_QLatin1String::relationalOperators_data()
{
QTest::addColumn<QLatin1StringContainer>("lhs");
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 10d78b1f2f..d424e6086d 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -137,6 +137,8 @@ private slots:
void textDirection_data();
void textDirection();
+ void formattedDataSize_data();
+ void formattedDataSize();
void bcp47Name();
private:
@@ -1221,6 +1223,9 @@ void tst_QLocale::dayOfWeek()
QCOMPARE(QLocale::c().toString(date, "ddd"), shortName);
QCOMPARE(QLocale::c().toString(date, "dddd"), longName);
+
+ QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("ddd")), shortName);
+ QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("dddd")), longName);
}
void tst_QLocale::formatDate_data()
@@ -1263,6 +1268,7 @@ void tst_QLocale::formatDate()
QLocale l(QLocale::C);
QCOMPARE(l.toString(date, format), result);
+ QCOMPARE(l.toString(date, QStringView(format)), result);
}
@@ -1319,6 +1325,7 @@ void tst_QLocale::formatTime()
QLocale l(QLocale::C);
QCOMPARE(l.toString(time, format), result);
+ QCOMPARE(l.toString(time, QStringView(format)), result);
}
@@ -1480,6 +1487,7 @@ void tst_QLocale::formatDateTime()
QLocale l(localeName);
QCOMPARE(l.toString(dateTime, format), result);
+ QCOMPARE(l.toString(dateTime, QStringView(format)), result);
}
void tst_QLocale::formatTimeZone()
@@ -2203,9 +2211,9 @@ void tst_QLocale::timeFormat()
QCOMPARE(c.timeFormat(QLocale::NarrowFormat), c.timeFormat(QLocale::ShortFormat));
const QLocale no("no_NO");
- QCOMPARE(no.timeFormat(QLocale::NarrowFormat), QLatin1String("HH.mm"));
- QCOMPARE(no.timeFormat(QLocale::ShortFormat), QLatin1String("HH.mm"));
- QCOMPARE(no.timeFormat(QLocale::LongFormat), QLatin1String("HH.mm.ss t"));
+ QCOMPARE(no.timeFormat(QLocale::NarrowFormat), QLatin1String("HH:mm"));
+ QCOMPARE(no.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
+ QCOMPARE(no.timeFormat(QLocale::LongFormat), QLatin1String("HH:mm:ss t"));
const QLocale id("id_ID");
QCOMPARE(id.timeFormat(QLocale::ShortFormat), QLatin1String("HH.mm"));
@@ -2227,9 +2235,9 @@ void tst_QLocale::dateTimeFormat()
QCOMPARE(c.dateTimeFormat(QLocale::NarrowFormat), c.dateTimeFormat(QLocale::ShortFormat));
const QLocale no("no_NO");
- QCOMPARE(no.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.yyyy HH.mm"));
- QCOMPARE(no.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yyyy HH.mm"));
- QCOMPARE(no.dateTimeFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy HH.mm.ss t"));
+ QCOMPARE(no.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.yyyy HH:mm"));
+ QCOMPARE(no.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yyyy HH:mm"));
+ QCOMPARE(no.dateTimeFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy HH:mm:ss t"));
}
void tst_QLocale::monthName()
@@ -2510,8 +2518,8 @@ void tst_QLocale::textDirection_data()
default:
break;
}
- QString testName = QLocalePrivate::languageToCode(QLocale::Language(language));
- QTest::newRow(testName.toLatin1().constData()) << language << int(QLocale::AnyScript) << rightToLeft;
+ const QLatin1String testName = QLocalePrivate::languageToCode(QLocale::Language(language));
+ QTest::newRow(qPrintable(testName)) << language << int(QLocale::AnyScript) << rightToLeft;
}
QTest::newRow("pa_Arab") << int(QLocale::Punjabi) << int(QLocale::ArabicScript) << true;
QTest::newRow("uz_Arab") << int(QLocale::Uzbek) << int(QLocale::ArabicScript) << true;
@@ -2527,6 +2535,81 @@ void tst_QLocale::textDirection()
QCOMPARE(locale.textDirection() == Qt::RightToLeft, rightToLeft);
}
+void tst_QLocale::formattedDataSize_data()
+{
+ QTest::addColumn<QLocale::Language>("language");
+ QTest::addColumn<int>("decimalPlaces");
+ QTest::addColumn<QLocale::DataSizeFormats>("units");
+ QTest::addColumn<int>("bytes");
+ QTest::addColumn<QString>("output");
+
+ struct {
+ const char *name;
+ QLocale::Language lang;
+ const char *bytes;
+ const char abbrev;
+ const char sep; // decimal separator
+ } data[] = {
+ { "English", QLocale::English, "bytes", 'B', '.' },
+ { "French", QLocale::French, "octets", 'o', ',' },
+ { "C", QLocale::C, "bytes", 'B', '.' }
+ };
+
+ for (const auto row : data) {
+#define ROWB(id, deci, num, text) \
+ QTest::addRow("%s-%s", row.name, id) \
+ << row.lang << deci << format \
+ << num << (QString(text) + QChar(' ') + QString(row.bytes))
+#define ROWQ(id, deci, num, head, tail) \
+ QTest::addRow("%s-%s", row.name, id) \
+ << row.lang << deci << format \
+ << num << (QString(head) + QChar(row.sep) + QString(tail) + QChar(row.abbrev))
+
+ // Metatype system fails to handle raw enum members as format; needs variable
+ {
+ const QLocale::DataSizeFormats format = QLocale::DataSizeIecFormat;
+ ROWB("IEC-0", 2, 0, "0");
+ ROWB("IEC-10", 2, 10, "10");
+ ROWQ("IEC-12Ki", 2, 12345, "12", "06 Ki");
+ ROWQ("IEC-16Ki", 2, 16384, "16", "00 Ki");
+ ROWQ("IEC-1235k", 2, 1234567, "1", "18 Mi");
+ ROWQ("IEC-1374k", 2, 1374744, "1", "31 Mi");
+ ROWQ("IEC-1234M", 2, 1234567890, "1", "15 Gi");
+ }
+ {
+ const QLocale::DataSizeFormats format = QLocale::DataSizeTraditionalFormat;
+ ROWB("Trad-0", 2, 0, "0");
+ ROWB("Trad-10", 2, 10, "10");
+ ROWQ("Trad-12Ki", 2, 12345, "12", "06 k");
+ ROWQ("Trad-16Ki", 2, 16384, "16", "00 k");
+ ROWQ("Trad-1235k", 2, 1234567, "1", "18 M");
+ ROWQ("Trad-1374k", 2, 1374744, "1", "31 M");
+ ROWQ("Trad-1234M", 2, 1234567890, "1", "15 G");
+ }
+ {
+ const QLocale::DataSizeFormats format = QLocale::DataSizeSIFormat;
+ ROWB("Decimal-0", 2, 0, "0");
+ ROWB("Decimal-10", 2, 10, "10");
+ ROWQ("Decimal-16Ki", 2, 16384, "16", "38 k");
+ ROWQ("Decimal-1234k", 2, 1234567, "1", "23 M");
+ ROWQ("Decimal-1374k", 2, 1374744, "1", "37 M");
+ ROWQ("Decimal-1234M", 2, 1234567890, "1", "23 G");
+ }
+#undef ROWQ
+#undef ROWB
+ }
+}
+
+void tst_QLocale::formattedDataSize()
+{
+ QFETCH(QLocale::Language, language);
+ QFETCH(int, decimalPlaces);
+ QFETCH(QLocale::DataSizeFormats, units);
+ QFETCH(int, bytes);
+ QFETCH(QString, output);
+ QCOMPARE(QLocale(language).formattedDataSize(bytes, decimalPlaces, units), output);
+}
+
void tst_QLocale::bcp47Name()
{
QCOMPARE(QLocale("C").bcp47Name(), QStringLiteral("en"));
diff --git a/tests/auto/corelib/tools/qmacautoreleasepool/qmacautoreleasepool.pro b/tests/auto/corelib/tools/qmacautoreleasepool/qmacautoreleasepool.pro
new file mode 100644
index 0000000000..26b3a47472
--- /dev/null
+++ b/tests/auto/corelib/tools/qmacautoreleasepool/qmacautoreleasepool.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase
+TARGET = tst_qmacautoreleasepool
+QT = core testlib
+SOURCES = tst_qmacautoreleasepool.mm
diff --git a/tests/auto/corelib/tools/qmacautoreleasepool/tst_qmacautoreleasepool.mm b/tests/auto/corelib/tools/qmacautoreleasepool/tst_qmacautoreleasepool.mm
new file mode 100644
index 0000000000..8f1069f419
--- /dev/null
+++ b/tests/auto/corelib/tools/qmacautoreleasepool/tst_qmacautoreleasepool.mm
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <Foundation/Foundation.h>
+
+class tst_QMacAutoreleasePool : public QObject
+{
+ Q_OBJECT
+private slots:
+ void noPool();
+ void rootLevelPool();
+ void stackAllocatedPool();
+ void heapAllocatedPool();
+};
+
+static id lastDeallocedObject = nil;
+
+@interface DeallocTracker : NSObject @end
+@implementation DeallocTracker
+-(void)dealloc
+{
+ lastDeallocedObject = self;
+ [super dealloc];
+}
+@end
+
+void tst_QMacAutoreleasePool::noPool()
+{
+ // No pool, will not be released, but should not crash
+
+ [[[DeallocTracker alloc] init] autorelease];
+}
+
+void tst_QMacAutoreleasePool::rootLevelPool()
+{
+ // The root level case, no NSAutoreleasePool since we're not in the main
+ // runloop, and objects autoreleased as part of main.
+
+ NSObject *allocedObject = nil;
+ {
+ QMacAutoReleasePool qtPool;
+ allocedObject = [[[DeallocTracker alloc] init] autorelease];
+ }
+ QCOMPARE(lastDeallocedObject, allocedObject);
+}
+
+void tst_QMacAutoreleasePool::stackAllocatedPool()
+{
+ // The normal case, other pools surrounding our pool, draining
+ // our pool before any other pool.
+
+ NSObject *allocedObject = nil;
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ {
+ QMacAutoReleasePool qtPool;
+ allocedObject = [[[DeallocTracker alloc] init] autorelease];
+ }
+ QCOMPARE(lastDeallocedObject, allocedObject);
+ [pool drain];
+}
+
+void tst_QMacAutoreleasePool::heapAllocatedPool()
+{
+ // The special case, a pool allocated on the heap, or as a member of a
+ // heap allocated object. This is not a supported use of QMacAutoReleasePool,
+ // and will result in warnings if the pool is prematurely drained.
+
+ NSObject *allocedObject = nil;
+ {
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QMacAutoReleasePool *qtPool = nullptr;
+ {
+ qtPool = new QMacAutoReleasePool;
+ allocedObject = [[[DeallocTracker alloc] init] autorelease];
+ }
+ [pool drain];
+ delete qtPool;
+ }
+ QCOMPARE(lastDeallocedObject, allocedObject);
+}
+
+QTEST_APPLESS_MAIN(tst_QMacAutoreleasePool)
+
+#include "tst_qmacautoreleasepool.moc"
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index f42ffc0471..b39444e76f 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -61,6 +61,7 @@ private slots:
void iterators();
void keyIterator();
+ void keyValueIterator();
void keys_values_uniqueKeys();
void qmultimap_specific();
@@ -863,6 +864,59 @@ void tst_QMap::keyIterator()
Q_STATIC_ASSERT(std::is_default_constructible<keyIterator>::value);
}
+void tst_QMap::keyValueIterator()
+{
+ QMap<int, int> map;
+ typedef QMap<int, int>::const_key_value_iterator::value_type entry_type;
+
+ for (int i = 0; i < 100; ++i)
+ map.insert(i, i * 100);
+
+ auto key_value_it = map.constKeyValueBegin();
+ auto it = map.cbegin();
+
+ for (int i = 0; i < map.size(); ++i) {
+ QVERIFY(key_value_it != map.constKeyValueEnd());
+ QVERIFY(it != map.cend());
+
+ entry_type pair(it.key(), it.value());
+ QCOMPARE(*key_value_it, pair);
+ ++key_value_it;
+ ++it;
+ }
+
+ QVERIFY(key_value_it == map.constKeyValueEnd());
+ QVERIFY(it == map.cend());
+
+ int key = 50;
+ int value = 50 * 100;
+ entry_type pair(key, value);
+ key_value_it = std::find(map.constKeyValueBegin(), map.constKeyValueEnd(), pair);
+ it = std::find(map.cbegin(), map.cend(), value);
+
+ QVERIFY(key_value_it != map.constKeyValueEnd());
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ ++it;
+ ++key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ --it;
+ --key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ ++it;
+ ++key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+
+ --it;
+ --key_value_it;
+ QCOMPARE(*key_value_it, entry_type(it.key(), it.value()));
+ key = 99;
+ value = 99 * 100;
+ QCOMPARE(std::count(map.constKeyValueBegin(), map.constKeyValueEnd(), entry_type(key, value)), 1);
+}
+
void tst_QMap::keys_values_uniqueKeys()
{
QMap<QString, int> map;
diff --git a/tests/auto/corelib/tools/qrect/tst_qrect.cpp b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
index d3c6412b0d..1c2221ec29 100644
--- a/tests/auto/corelib/tools/qrect/tst_qrect.cpp
+++ b/tests/auto/corelib/tools/qrect/tst_qrect.cpp
@@ -171,6 +171,7 @@ private slots:
void containsPointF_data();
void containsPointF();
void smallRects() const;
+ void toRect();
};
// Used to work around some floating point precision problems.
@@ -4331,5 +4332,36 @@ void tst_QRect::smallRects() const
QVERIFY(r1 != r2);
}
+void tst_QRect::toRect()
+{
+ for (qreal x = 1.0; x < 2.0; x += 0.25) {
+ for (qreal y = 1.0; y < 2.0; y += 0.25) {
+ for (qreal w = 1.0; w < 2.0; w += 0.25) {
+ for (qreal h = 1.0; h < 2.0; h += 0.25) {
+ const QRectF rectf(x, y, w, h);
+ const QRectF rect = rectf.toRect();
+ QVERIFY(qAbs(rect.x() - rectf.x()) < 1.0);
+ QVERIFY(qAbs(rect.y() - rectf.y()) < 1.0);
+ QVERIFY(qAbs(rect.width() - rectf.width()) < 1.0);
+ QVERIFY(qAbs(rect.height() - rectf.height()) < 1.0);
+ QVERIFY(qAbs(rect.right() - rectf.right()) < 1.0);
+ QVERIFY(qAbs(rect.bottom() - rectf.bottom()) < 1.0);
+
+ const QRectF arect = rectf.toAlignedRect();
+ QVERIFY(qAbs(arect.x() - rectf.x()) < 1.0);
+ QVERIFY(qAbs(arect.y() - rectf.y()) < 1.0);
+ QVERIFY(qAbs(arect.width() - rectf.width()) < 2.0);
+ QVERIFY(qAbs(arect.height() - rectf.height()) < 2.0);
+ QVERIFY(qAbs(arect.right() - rectf.right()) < 1.0);
+ QVERIFY(qAbs(arect.bottom() - rectf.bottom()) < 1.0);
+
+ QVERIFY(arect.contains(rectf));
+ QVERIFY(arect.contains(rect));
+ }
+ }
+ }
+ }
+}
+
QTEST_MAIN(tst_QRect)
#include "tst_qrect.moc"
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
index 2a93250ba5..c828551e44 100644
--- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -169,6 +169,7 @@ void consistencyCheck(const QRegularExpressionMatch &match)
int length = match.capturedLength(i);
QString captured = match.captured(i);
QStringRef capturedRef = match.capturedRef(i);
+ QStringView capturedView = match.capturedView(i);
if (!captured.isNull()) {
QVERIFY(startPos >= 0);
@@ -177,11 +178,13 @@ void consistencyCheck(const QRegularExpressionMatch &match)
QVERIFY(endPos >= startPos);
QVERIFY((endPos - startPos) == length);
QVERIFY(captured == capturedRef);
+ QVERIFY(captured == capturedView);
} else {
QVERIFY(startPos == -1);
QVERIFY(endPos == -1);
QVERIFY((endPos - startPos) == length);
QVERIFY(capturedRef.isNull());
+ QVERIFY(capturedView.isNull());
}
}
}
diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
index 21efaede00..a4b06d1b3b 100644
--- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp
@@ -88,7 +88,7 @@ class MySubClass : public MyClass
void tst_QScopedPointer::useSubClassInConstructor()
{
/* Use a syntax which users typically would do. */
- QScopedPointer<MyClass> p(new MyClass());
+ QScopedPointer<MyClass> p(new MySubClass());
}
void tst_QScopedPointer::dataOnValue()
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 442d4d089c..e1dcdb8407 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -1884,7 +1884,7 @@ class StrongThread: public QThread
protected:
void run()
{
- usleep(rand() % 2000);
+ usleep(QRandomGenerator::global()->bounded(2000));
ptr->ref();
ptr.clear();
}
@@ -1897,7 +1897,7 @@ class WeakThread: public QThread
protected:
void run()
{
- usleep(rand() % 2000);
+ usleep(QRandomGenerator::global()->bounded(2000));
QSharedPointer<ThreadData> ptr = weak;
if (ptr)
ptr->ref();
@@ -1959,7 +1959,6 @@ void tst_QSharedPointer::threadStressTest()
base.clear();
- srand(time(NULL));
// start threads
for (int i = 0; i < allThreads.count(); ++i)
if (allThreads[i]) allThreads[i]->start();
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 24f16b9911..70ccc72630 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4726,8 +4726,8 @@ void tst_QString::arg()
QString s14( "%1%2%3" );
QCOMPARE( s4.arg("foo"), QLatin1String("[foo]") );
- QCOMPARE( s5.arg("foo"), QLatin1String("[foo]") );
- QCOMPARE( s6.arg("foo"), QLatin1String("[foo]") );
+ QCOMPARE( s5.arg(QLatin1String("foo")), QLatin1String("[foo]") );
+ QCOMPARE( s6.arg(QStringViewLiteral("foo")), QLatin1String("[foo]") );
QCOMPARE( s7.arg("foo"), QLatin1String("[foo]") );
QCOMPARE( s8.arg("foo"), QLatin1String("[foo %1]") );
QCOMPARE( s8.arg("foo").arg("bar"), QLatin1String("[foo bar]") );
@@ -4788,11 +4788,11 @@ void tst_QString::arg()
QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QLatin1String("%%foo%%bar") );
QCOMPARE( QString("%1").arg("hello", -10), QLatin1String("hello ") );
- QCOMPARE( QString("%1").arg("hello", -5), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", -2), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QLatin1String("hello"), -5), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QStringViewLiteral("hello"), -2), QLatin1String("hello") );
QCOMPARE( QString("%1").arg("hello", 0), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", 2), QLatin1String("hello") );
- QCOMPARE( QString("%1").arg("hello", 5), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QLatin1String("hello"), 2), QLatin1String("hello") );
+ QCOMPARE( QString("%1").arg(QStringViewLiteral("hello"), 5), QLatin1String("hello") );
QCOMPARE( QString("%1").arg("hello", 10), QLatin1String(" hello") );
QCOMPARE( QString("%1%1").arg("hello"), QLatin1String("hellohello") );
QCOMPARE( QString("%2%1").arg("hello"), QLatin1String("%2hello") );
@@ -6067,14 +6067,6 @@ void tst_QString::compare_data()
lower += QChar(QChar::lowSurrogate(0x10428));
QTest::newRow("data8") << upper << lower << -1 << 0;
- QTest::newRow("vectorized-boundaries-7") << QString("1234567") << QString("abcdefg") << -1 << -1;
- QTest::newRow("vectorized-boundaries-8") << QString("12345678") << QString("abcdefgh") << -1 << -1;
- QTest::newRow("vectorized-boundaries-9") << QString("123456789") << QString("abcdefghi") << -1 << -1;
-
- QTest::newRow("vectorized-boundaries-15") << QString("123456789012345") << QString("abcdefghiklmnop") << -1 << -1;
- QTest::newRow("vectorized-boundaries-16") << QString("1234567890123456") << QString("abcdefghiklmnopq") << -1 << -1;
- QTest::newRow("vectorized-boundaries-17") << QString("12345678901234567") << QString("abcdefghiklmnopqr") << -1 << -1;
-
// embedded nulls
// These don't work as of now. It's OK that these don't work since \0 is not a valid unicode
/*QTest::newRow("data10") << QString(QByteArray("\0", 1)) << QString(QByteArray("\0", 1)) << 0 << 0;
@@ -6083,6 +6075,44 @@ void tst_QString::compare_data()
QTest::newRow("data13") << QString("ab\0c") << QString(QByteArray("ab\0c", 4)) << 0 << 0;
QTest::newRow("data14") << QString(QByteArray("ab\0c", 4)) << QString("abc") << -1 << -1;
QTest::newRow("data15") << QString("abc") << QString(QByteArray("ab\0c", 4)) << 1 << 1;*/
+
+ // All tests below (generated by the 3 for-loops) are meant to excercise the vectorized versions
+ // of ucstrncmp.
+
+ QString in1, in2;
+ for (int i = 0; i < 70; ++i) {
+ in1 += QString::number(i % 10);
+ in2 += QString::number((70 - i + 1) % 10);
+ }
+ Q_ASSERT(in1.length() == in2.length());
+ Q_ASSERT(in1 != in2);
+ Q_ASSERT(in1.at(0) < in2.at(0));
+ for (int i = 0; i < in1.length(); ++i) {
+ Q_ASSERT(in1.at(i) != in2.at(i));
+ }
+
+ for (int i = 1; i <= 65; ++i) {
+ QString inp1 = in1.left(i);
+ QString inp2 = in2.left(i);
+ QTest::addRow("all-different-%d", i) << inp1 << inp2 << -1 << -1;
+ }
+
+ for (int i = 1; i <= 65; ++i) {
+ QString start(i - 1, 'a');
+
+ QString in = start + QLatin1Char('a');
+ QTest::addRow("all-same-%d", i) << in << in << 0 << 0;
+
+ QString in2 = start + QLatin1Char('b');
+ QTest::addRow("last-different-%d", i) << in << in2 << -1 << -1;
+ }
+
+ for (int i = 0; i < 16; ++i) {
+ QString in1(16, 'a');
+ QString in2 = in1;
+ in2[i] = 'b';
+ QTest::addRow("all-same-except-char-%d", i) << in1 << in2 << -1 << -1;
+ }
}
static bool isLatin(const QString &s)
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro
index bc38b17949..a4e91e38bd 100644
--- a/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro
+++ b/tests/auto/corelib/tools/qstringapisymmetry/qstringapisymmetry.pro
@@ -3,3 +3,4 @@ TARGET = tst_qstringapisymmetry
QT = core testlib
SOURCES = tst_qstringapisymmetry.cpp
qtConfig(c++14): CONFIG += c++14
+qtConfig(c++1z): CONFIG += c++1z
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
index 9d9b47b61e..61d1f86f00 100644
--- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -31,6 +31,7 @@
#undef QT_ASCII_CAST_WARNINGS
#include <QString>
+#include <QStringView>
#include <QChar>
#include <QStringRef>
#include <QLatin1String>
@@ -44,6 +45,7 @@ Q_DECLARE_METATYPE(QStringRef)
template <typename T>
QString toQString(const T &t) { return QString(t); }
QString toQString(const QStringRef &ref) { return ref.toString(); }
+QString toQString(QStringView view) { return view.toString(); }
// FIXME: these are missing at the time of writing, add them, then remove the dummies here:
#define MAKE_RELOP(op, A1, A2) \
@@ -81,13 +83,15 @@ class tst_QStringApiSymmetry : public QObject
void compare_impl() const;
private Q_SLOTS:
- // test all combinations of {QChar, QStringRef, QString, QLatin1String, QByteArray, const char*}
+ // test all combinations of {QChar, QStringRef, QString, QStringView, QLatin1String, QByteArray, const char*}
void compare_QChar_QChar_data() { compare_data(false); }
void compare_QChar_QChar() { compare_impl<QChar, QChar>(); }
void compare_QChar_QStringRef_data() { compare_data(false); }
void compare_QChar_QStringRef() { compare_impl<QChar, QStringRef>(); }
void compare_QChar_QString_data() { compare_data(false); }
void compare_QChar_QString() { compare_impl<QChar, QString>(); }
+ void compare_QChar_QStringView_data() { compare_data(false); }
+ void compare_QChar_QStringView() { compare_impl<QChar, QStringView>(); }
void compare_QChar_QLatin1String_data() { compare_data(false); }
void compare_QChar_QLatin1String() { compare_impl<QChar, QLatin1String>(); }
void compare_QChar_QByteArray_data() { compare_data(false); }
@@ -101,6 +105,8 @@ private Q_SLOTS:
void compare_QStringRef_QStringRef() { compare_impl<QStringRef, QStringRef>(); }
void compare_QStringRef_QString_data() { compare_data(); }
void compare_QStringRef_QString() { compare_impl<QStringRef, QString>(); }
+ void compare_QStringRef_QStringView_data() { compare_data(); }
+ void compare_QStringRef_QStringView() { compare_impl<QStringRef, QStringView>(); }
void compare_QStringRef_QLatin1String_data() { compare_data(); }
void compare_QStringRef_QLatin1String() { compare_impl<QStringRef, QLatin1String>(); }
void compare_QStringRef_QByteArray_data() { compare_data(); }
@@ -114,6 +120,8 @@ private Q_SLOTS:
void compare_QString_QStringRef() { compare_impl<QString, QStringRef>(); }
void compare_QString_QString_data() { compare_data(); }
void compare_QString_QString() { compare_impl<QString, QString>(); }
+ void compare_QString_QStringView_data() { compare_data(); }
+ void compare_QString_QStringView() { compare_impl<QString, QStringView>(); }
void compare_QString_QLatin1String_data() { compare_data(); }
void compare_QString_QLatin1String() { compare_impl<QString, QLatin1String>(); }
void compare_QString_QByteArray_data() { compare_data(); }
@@ -121,12 +129,25 @@ private Q_SLOTS:
void compare_QString_const_char_star_data() { compare_data(); }
void compare_QString_const_char_star() { compare_impl<QString, const char *>(); }
+ void compare_QStringView_QChar_data() { compare_data(false); }
+ void compare_QStringView_QChar() { compare_impl<QStringView, QChar>(); }
+ void compare_QStringView_QStringRef_data() { compare_data(); }
+ void compare_QStringView_QStringRef() { compare_impl<QStringView, QStringRef>(); }
+ void compare_QStringView_QString_data() { compare_data(); }
+ void compare_QStringView_QString() { compare_impl<QStringView, QString>(); }
+ void compare_QStringView_QStringView_data() { compare_data(); }
+ void compare_QStringView_QStringView() { compare_impl<QStringView, QStringView>(); }
+ void compare_QStringView_QLatin1String_data() { compare_data(); }
+ void compare_QStringView_QLatin1String() { compare_impl<QStringView, QLatin1String>(); }
+
void compare_QLatin1String_QChar_data() { compare_data(false); }
void compare_QLatin1String_QChar() { compare_impl<QLatin1String, QChar>(); }
void compare_QLatin1String_QStringRef_data() { compare_data(); }
void compare_QLatin1String_QStringRef() { compare_impl<QLatin1String, QStringRef>(); }
void compare_QLatin1String_QString_data() { compare_data(); }
void compare_QLatin1String_QString() { compare_impl<QLatin1String, QString>(); }
+ void compare_QLatin1String_QStringView_data() { compare_data(); }
+ void compare_QLatin1String_QStringView() { compare_impl<QLatin1String, QStringView>(); }
void compare_QLatin1String_QLatin1String_data() { compare_data(); }
void compare_QLatin1String_QLatin1String() { compare_impl<QLatin1String, QLatin1String>(); }
void compare_QLatin1String_QByteArray_data() { compare_data(); }
@@ -160,6 +181,181 @@ private Q_SLOTS:
//void compare_const_char_star_const_char_star_data() { compare_data(); }
//void compare_const_char_star_const_char_star() { compare_impl<const char *, const char *>(); }
+private:
+ void startsWith_data(bool rhsIsQChar = false);
+ template <typename Haystack, typename Needle> void startsWith_impl() const;
+
+ void endsWith_data(bool rhsIsQChar = false);
+ template <typename Haystack, typename Needle> void endsWith_impl() const;
+
+private Q_SLOTS:
+ // test all combinations of {QString, QStringRef, QStringView, QLatin1String} x {QString, QStringRef, QStringView, QLatin1String, QChar}:
+ void startsWith_QString_QString_data() { startsWith_data(); }
+ void startsWith_QString_QString() { startsWith_impl<QString, QString>(); }
+ void startsWith_QString_QStringRef_data() { startsWith_data(); }
+ void startsWith_QString_QStringRef() { startsWith_impl<QString, QStringRef>(); }
+ void startsWith_QString_QStringView_data() { startsWith_data(); }
+ void startsWith_QString_QStringView() { startsWith_impl<QString, QStringView>(); }
+ void startsWith_QString_QLatin1String_data() { startsWith_data(); }
+ void startsWith_QString_QLatin1String() { startsWith_impl<QString, QLatin1String>(); }
+ void startsWith_QString_QChar_data() { startsWith_data(false); }
+ void startsWith_QString_QChar() { startsWith_impl<QString, QChar>(); }
+
+ void startsWith_QStringRef_QString_data() { startsWith_data(); }
+ void startsWith_QStringRef_QString() { startsWith_impl<QStringRef, QString>(); }
+ void startsWith_QStringRef_QStringRef_data() { startsWith_data(); }
+ void startsWith_QStringRef_QStringRef() { startsWith_impl<QStringRef, QStringRef>(); }
+ void startsWith_QStringRef_QStringView_data() { startsWith_data(); }
+ void startsWith_QStringRef_QStringView() { startsWith_impl<QStringRef, QStringView>(); }
+ void startsWith_QStringRef_QLatin1String_data() { startsWith_data(); }
+ void startsWith_QStringRef_QLatin1String() { startsWith_impl<QStringRef, QLatin1String>(); }
+ void startsWith_QStringRef_QChar_data() { startsWith_data(false); }
+ void startsWith_QStringRef_QChar() { startsWith_impl<QStringRef, QChar>(); }
+
+ void startsWith_QStringView_QString_data() { startsWith_data(); }
+ void startsWith_QStringView_QString() { startsWith_impl<QStringView, QString>(); }
+ void startsWith_QStringView_QStringRef_data() { startsWith_data(); }
+ void startsWith_QStringView_QStringRef() { startsWith_impl<QStringView, QStringRef>(); }
+ void startsWith_QStringView_QStringView_data() { startsWith_data(); }
+ void startsWith_QStringView_QStringView() { startsWith_impl<QStringView, QStringView>(); }
+ void startsWith_QStringView_QLatin1String_data() { startsWith_data(); }
+ void startsWith_QStringView_QLatin1String() { startsWith_impl<QStringView, QLatin1String>(); }
+ void startsWith_QStringView_QChar_data() { startsWith_data(false); }
+ void startsWith_QStringView_QChar() { startsWith_impl<QStringView, QChar>(); }
+
+ void startsWith_QLatin1String_QString_data() { startsWith_data(); }
+ void startsWith_QLatin1String_QString() { startsWith_impl<QLatin1String, QString>(); }
+ void startsWith_QLatin1String_QStringRef_data() { startsWith_data(); }
+ void startsWith_QLatin1String_QStringRef() { startsWith_impl<QLatin1String, QStringRef>(); }
+ void startsWith_QLatin1String_QStringView_data() { startsWith_data(); }
+ void startsWith_QLatin1String_QStringView() { startsWith_impl<QLatin1String, QStringView>(); }
+ void startsWith_QLatin1String_QLatin1String_data() { startsWith_data(); }
+ void startsWith_QLatin1String_QLatin1String() { startsWith_impl<QLatin1String, QLatin1String>(); }
+ void startsWith_QLatin1String_QChar_data() { startsWith_data(false); }
+ void startsWith_QLatin1String_QChar() { startsWith_impl<QLatin1String, QChar>(); }
+
+ void endsWith_QString_QString_data() { endsWith_data(); }
+ void endsWith_QString_QString() { endsWith_impl<QString, QString>(); }
+ void endsWith_QString_QStringRef_data() { endsWith_data(); }
+ void endsWith_QString_QStringRef() { endsWith_impl<QString, QStringRef>(); }
+ void endsWith_QString_QStringView_data() { endsWith_data(); }
+ void endsWith_QString_QStringView() { endsWith_impl<QString, QStringView>(); }
+ void endsWith_QString_QLatin1String_data() { endsWith_data(); }
+ void endsWith_QString_QLatin1String() { endsWith_impl<QString, QLatin1String>(); }
+ void endsWith_QString_QChar_data() { endsWith_data(false); }
+ void endsWith_QString_QChar() { endsWith_impl<QString, QChar>(); }
+
+ void endsWith_QStringRef_QString_data() { endsWith_data(); }
+ void endsWith_QStringRef_QString() { endsWith_impl<QStringRef, QString>(); }
+ void endsWith_QStringRef_QStringRef_data() { endsWith_data(); }
+ void endsWith_QStringRef_QStringRef() { endsWith_impl<QStringRef, QStringRef>(); }
+ void endsWith_QStringRef_QStringView_data() { endsWith_data(); }
+ void endsWith_QStringRef_QStringView() { endsWith_impl<QStringRef, QStringView>(); }
+ void endsWith_QStringRef_QLatin1String_data() { endsWith_data(); }
+ void endsWith_QStringRef_QLatin1String() { endsWith_impl<QStringRef, QLatin1String>(); }
+ void endsWith_QStringRef_QChar_data() { endsWith_data(false); }
+ void endsWith_QStringRef_QChar() { endsWith_impl<QStringRef, QChar>(); }
+
+ void endsWith_QStringView_QString_data() { endsWith_data(); }
+ void endsWith_QStringView_QString() { endsWith_impl<QStringView, QString>(); }
+ void endsWith_QStringView_QStringRef_data() { endsWith_data(); }
+ void endsWith_QStringView_QStringRef() { endsWith_impl<QStringView, QStringRef>(); }
+ void endsWith_QStringView_QStringView_data() { endsWith_data(); }
+ void endsWith_QStringView_QStringView() { endsWith_impl<QStringView, QStringView>(); }
+ void endsWith_QStringView_QLatin1String_data() { endsWith_data(); }
+ void endsWith_QStringView_QLatin1String() { endsWith_impl<QStringView, QLatin1String>(); }
+ void endsWith_QStringView_QChar_data() { endsWith_data(false); }
+ void endsWith_QStringView_QChar() { endsWith_impl<QStringView, QChar>(); }
+
+ void endsWith_QLatin1String_QString_data() { endsWith_data(); }
+ void endsWith_QLatin1String_QString() { endsWith_impl<QLatin1String, QString>(); }
+ void endsWith_QLatin1String_QStringRef_data() { endsWith_data(); }
+ void endsWith_QLatin1String_QStringRef() { endsWith_impl<QLatin1String, QStringRef>(); }
+ void endsWith_QLatin1String_QStringView_data() { endsWith_data(); }
+ void endsWith_QLatin1String_QStringView() { endsWith_impl<QLatin1String, QStringView>(); }
+ void endsWith_QLatin1String_QLatin1String_data() { endsWith_data(); }
+ void endsWith_QLatin1String_QLatin1String() { endsWith_impl<QLatin1String, QLatin1String>(); }
+ void endsWith_QLatin1String_QChar_data() { endsWith_data(false); }
+ void endsWith_QLatin1String_QChar() { endsWith_impl<QLatin1String, QChar>(); }
+
+private:
+ void mid_data();
+ template <typename String> void mid_impl();
+
+ void left_data();
+ template <typename String> void left_impl();
+
+ void right_data();
+ template <typename String> void right_impl();
+
+ void chop_data();
+ template <typename String> void chop_impl();
+
+ void truncate_data() { left_data(); }
+ template <typename String> void truncate_impl();
+
+private Q_SLOTS:
+
+ void mid_QString_data() { mid_data(); }
+ void mid_QString() { mid_impl<QString>(); }
+ void mid_QStringRef_data() { mid_data(); }
+ void mid_QStringRef() { mid_impl<QStringRef>(); }
+ void mid_QStringView_data() { mid_data(); }
+ void mid_QStringView() { mid_impl<QStringView>(); }
+ void mid_QLatin1String_data() { mid_data(); }
+ void mid_QLatin1String() { mid_impl<QLatin1String>(); }
+ void mid_QByteArray_data() { mid_data(); }
+ void mid_QByteArray() { mid_impl<QByteArray>(); }
+
+ void left_truncate_QString_data() { left_data(); }
+ void left_truncate_QString() { left_impl<QString>(); }
+ void left_truncate_QStringRef_data() { left_data(); }
+ void left_truncate_QStringRef() { left_impl<QStringRef>(); }
+ void left_truncate_QStringView_data() { left_data(); }
+ void left_truncate_QStringView() { left_impl<QStringView>(); }
+ void left_truncate_QLatin1String_data() { left_data(); }
+ void left_truncate_QLatin1String() { left_impl<QLatin1String>(); }
+ void left_truncate_QByteArray_data() { left_data(); }
+ void left_truncate_QByteArray() { left_impl<QByteArray>(); }
+
+ void right_QString_data() { right_data(); }
+ void right_QString() { right_impl<QString>(); }
+ void right_QStringRef_data() { right_data(); }
+ void right_QStringRef() { right_impl<QStringRef>(); }
+ void right_QStringView_data() { right_data(); }
+ void right_QStringView() { right_impl<QStringView>(); }
+ void right_QLatin1String_data() { right_data(); }
+ void right_QLatin1String() { right_impl<QLatin1String>(); }
+ void right_QByteArray_data() { right_data(); }
+ void right_QByteArray() { right_impl<QByteArray>(); }
+
+ void chop_QString_data() { chop_data(); }
+ void chop_QString() { chop_impl<QString>(); }
+ void chop_QStringRef_data() { chop_data(); }
+ void chop_QStringRef() { chop_impl<QStringRef>(); }
+ void chop_QStringView_data() { chop_data(); }
+ void chop_QStringView() { chop_impl<QStringView>(); }
+ void chop_QLatin1String_data() { chop_data(); }
+ void chop_QLatin1String() { chop_impl<QLatin1String>(); }
+ void chop_QByteArray_data() { chop_data(); }
+ void chop_QByteArray() { chop_impl<QByteArray>(); }
+
+private:
+ void trimmed_data();
+ template <typename String> void trimmed_impl();
+
+private Q_SLOTS:
+ void trim_trimmed_QString_data() { trimmed_data(); }
+ void trim_trimmed_QString() { trimmed_impl<QString>(); }
+ void trim_trimmed_QStringRef_data() { trimmed_data(); }
+ void trim_trimmed_QStringRef() { trimmed_impl<QStringRef>(); }
+ void trim_trimmed_QStringView_data() { trimmed_data(); }
+ void trim_trimmed_QStringView() { trimmed_impl<QStringView>(); }
+ void trim_trimmed_QLatin1String_data() { trimmed_data(); }
+ void trim_trimmed_QLatin1String() { trimmed_impl<QLatin1String>(); }
+ void trim_trimmed_QByteArray_data() { trimmed_data(); }
+ void trim_trimmed_QByteArray() { trimmed_impl<QByteArray>(); }
+
//
// UTF-16-only checks:
//
@@ -183,21 +379,29 @@ private Q_SLOTS:
void toLocal8Bit_QString() { toLocal8Bit_impl<QString>(); }
void toLocal8Bit_QStringRef_data() { toLocal8Bit_data(); }
void toLocal8Bit_QStringRef() { toLocal8Bit_impl<QStringRef>(); }
+ void toLocal8Bit_QStringView_data() { toLocal8Bit_data(); }
+ void toLocal8Bit_QStringView() { toLocal8Bit_impl<QStringView>(); }
void toLatin1_QString_data() { toLatin1_data(); }
void toLatin1_QString() { toLatin1_impl<QString>(); }
void toLatin1_QStringRef_data() { toLatin1_data(); }
void toLatin1_QStringRef() { toLatin1_impl<QStringRef>(); }
+ void toLatin1_QStringView_data() { toLatin1_data(); }
+ void toLatin1_QStringView() { toLatin1_impl<QStringView>(); }
void toUtf8_QString_data() { toUtf8_data(); }
void toUtf8_QString() { toUtf8_impl<QString>(); }
void toUtf8_QStringRef_data() { toUtf8_data(); }
void toUtf8_QStringRef() { toUtf8_impl<QStringRef>(); }
+ void toUtf8_QStringView_data() { toUtf8_data(); }
+ void toUtf8_QStringView() { toUtf8_impl<QStringView>(); }
void toUcs4_QString_data() { toUcs4_data(); }
void toUcs4_QString() { toUcs4_impl<QString>(); }
void toUcs4_QStringRef_data() { toUcs4_data(); }
void toUcs4_QStringRef() { toUcs4_impl<QStringRef>(); }
+ void toUcs4_QStringView_data() { toUcs4_data(); }
+ void toUcs4_QStringView() { toUcs4_impl<QStringView>(); }
};
void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty)
@@ -217,6 +421,9 @@ void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty)
QTest::newRow("null <> empty") << QStringRef() << QLatin1String()
<< QStringRef(&empty) << QLatin1String("")
<< 0 << 0;
+ QTest::newRow("empty <> null") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef() << QLatin1String()
+ << 0 << 0;
}
#define ROW(lhs, rhs) \
@@ -239,10 +446,20 @@ void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty)
#undef ROW
}
+template <typename String> String detached(String s)
+{
+ if (!s.isNull()) { // detaching loses nullness, but we need to preserve it
+ auto d = s.data();
+ Q_UNUSED(d);
+ }
+ return s;
+}
+
template <class Str> Str make(const QStringRef &sf, QLatin1String l1, const QByteArray &u8);
template <> QChar make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf.isEmpty() ? QChar() : sf.at(0); }
template <> QStringRef make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf; }
template <> QString make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf.toString(); }
+template <> QStringView make(const QStringRef &sf, QLatin1String, const QByteArray &) { return sf; }
template <> QLatin1String make(const QStringRef &, QLatin1String l1, const QByteArray &) { return l1; }
template <> QByteArray make(const QStringRef &, QLatin1String, const QByteArray &u8) { return u8; }
template <> const char * make(const QStringRef &, QLatin1String, const QByteArray &u8) { return u8.data(); }
@@ -260,6 +477,12 @@ struct has_nothrow_compare {
};
template <typename LHS, typename RHS>
+struct has_qCompareStrings {
+ enum { value = !std::is_same<LHS, QChar>::value && !std::is_same<RHS, QChar>::value &&
+ !is_utf8_encoded<LHS>::value && !is_utf8_encoded<RHS>::value };
+};
+
+template <typename LHS, typename RHS>
void tst_QStringApiSymmetry::compare_impl() const
{
QFETCH(QStringRef, lhsUnicode);
@@ -267,6 +490,8 @@ void tst_QStringApiSymmetry::compare_impl() const
QFETCH(QStringRef, rhsUnicode);
QFETCH(QLatin1String, rhsLatin1);
QFETCH(int, caseSensitiveCompareResult);
+ QFETCH(const int, caseInsensitiveCompareResult);
+ Q_UNUSED(caseInsensitiveCompareResult);
const auto lhsU8 = lhsUnicode.toUtf8();
const auto rhsU8 = rhsUnicode.toUtf8();
@@ -300,6 +525,529 @@ void tst_QStringApiSymmetry::compare_impl() const
#undef CHECK
}
+static QString empty = QLatin1String("");
+// the tests below rely on the fact that these objects' names match their contents:
+static QString a = QStringLiteral("a");
+static QString A = QStringLiteral("A");
+static QString b = QStringLiteral("b");
+static QString B = QStringLiteral("B");
+static QString c = QStringLiteral("c");
+static QString C = QStringLiteral("C");
+static QString ab = QStringLiteral("ab");
+static QString aB = QStringLiteral("aB");
+static QString Ab = QStringLiteral("Ab");
+static QString AB = QStringLiteral("AB");
+static QString bc = QStringLiteral("bc");
+static QString bC = QStringLiteral("bC");
+static QString Bc = QStringLiteral("Bc");
+static QString BC = QStringLiteral("BC");
+static QString abc = QStringLiteral("abc");
+static QString abC = QStringLiteral("abC");
+static QString aBc = QStringLiteral("aBc");
+static QString aBC = QStringLiteral("aBC");
+static QString Abc = QStringLiteral("Abc");
+static QString AbC = QStringLiteral("AbC");
+static QString ABc = QStringLiteral("ABc");
+static QString ABC = QStringLiteral("ABC");
+
+void tst_QStringApiSymmetry::startsWith_data(bool rhsHasVariableLength)
+{
+ QTest::addColumn<QStringRef>("haystackU16");
+ QTest::addColumn<QLatin1String>("haystackL1");
+ QTest::addColumn<QStringRef>("needleU16");
+ QTest::addColumn<QLatin1String>("needleL1");
+ QTest::addColumn<bool>("resultCS");
+ QTest::addColumn<bool>("resultCIS");
+
+ if (rhsHasVariableLength) {
+ QTest::addRow("null ~= ^null") << QStringRef() << QLatin1String()
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("empty ~= ^null") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("a ~= ^null") << QStringRef(&a) << QLatin1String("a")
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("null ~= ^empty") << QStringRef() << QLatin1String()
+ << QStringRef(&empty) << QLatin1String("") << false << false;
+ QTest::addRow("a ~= ^empty") << QStringRef(&a) << QLatin1String("a")
+ << QStringRef(&empty) << QLatin1String("") << true << true;
+ QTest::addRow("empty ~= ^empty") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef(&empty) << QLatin1String("") << true << true;
+ }
+ QTest::addRow("null ~= ^a") << QStringRef() << QLatin1String()
+ << QStringRef(&a) << QLatin1String("a") << false << false;
+ QTest::addRow("empty ~= ^a") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef(&a) << QLatin1String("a") << false << false;
+
+#define ROW(h, n, cs, cis) \
+ QTest::addRow("%s ~= ^%s", #h, #n) << QStringRef(&h) << QLatin1String(#h) \
+ << QStringRef(&n) << QLatin1String(#n) \
+ << bool(cs) << bool(cis)
+ ROW(a, a, 1, 1);
+ ROW(a, A, 0, 1);
+ ROW(a, b, 0, 0);
+
+ if (rhsHasVariableLength)
+ ROW(a, aB, 0, 0);
+
+ ROW(ab, a, 1, 1);
+ if (rhsHasVariableLength) {
+ ROW(ab, ab, 1, 1);
+ ROW(ab, aB, 0, 1);
+ ROW(ab, Ab, 0, 1);
+ }
+ ROW(ab, c, 0, 0);
+
+ if (rhsHasVariableLength)
+ ROW(ab, abc, 0, 0);
+
+ ROW(Abc, c, 0, 0);
+ if (rhsHasVariableLength) {
+ ROW(Abc, ab, 0, 1);
+ ROW(Abc, aB, 0, 1);
+ ROW(Abc, Ab, 1, 1);
+ ROW(Abc, AB, 0, 1);
+ ROW(aBC, ab, 0, 1);
+ ROW(aBC, aB, 1, 1);
+ ROW(aBC, Ab, 0, 1);
+ ROW(aBC, AB, 0, 1);
+ }
+ ROW(ABC, b, 0, 0);
+ ROW(ABC, a, 0, 1);
+#undef ROW
+}
+
+template <typename Haystack, typename Needle>
+void tst_QStringApiSymmetry::startsWith_impl() const
+{
+ QFETCH(const QStringRef, haystackU16);
+ QFETCH(const QLatin1String, haystackL1);
+ QFETCH(const QStringRef, needleU16);
+ QFETCH(const QLatin1String, needleL1);
+ QFETCH(const bool, resultCS);
+ QFETCH(const bool, resultCIS);
+
+ const auto haystackU8 = haystackU16.toUtf8();
+ const auto needleU8 = needleU16.toUtf8();
+
+ const auto haystack = make<Haystack>(haystackU16, haystackL1, haystackU8);
+ const auto needle = make<Needle>(needleU16, needleL1, needleU8);
+
+ QCOMPARE(haystack.startsWith(needle), resultCS);
+ QCOMPARE(haystack.startsWith(needle, Qt::CaseSensitive), resultCS);
+ QCOMPARE(haystack.startsWith(needle, Qt::CaseInsensitive), resultCIS);
+}
+
+void tst_QStringApiSymmetry::endsWith_data(bool rhsHasVariableLength)
+{
+ QTest::addColumn<QStringRef>("haystackU16");
+ QTest::addColumn<QLatin1String>("haystackL1");
+ QTest::addColumn<QStringRef>("needleU16");
+ QTest::addColumn<QLatin1String>("needleL1");
+ QTest::addColumn<bool>("resultCS");
+ QTest::addColumn<bool>("resultCIS");
+
+ if (rhsHasVariableLength) {
+ QTest::addRow("null ~= null$") << QStringRef() << QLatin1String()
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("empty ~= null$") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("a ~= null$") << QStringRef(&a) << QLatin1String("a")
+ << QStringRef() << QLatin1String() << true << true;
+ QTest::addRow("null ~= empty$") << QStringRef() << QLatin1String()
+ << QStringRef(&empty) << QLatin1String("") << false << false;
+ QTest::addRow("a ~= empty$") << QStringRef(&a) << QLatin1String("a")
+ << QStringRef(&empty) << QLatin1String("") << true << true;
+ QTest::addRow("empty ~= empty$") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef(&empty) << QLatin1String("") << true << true;
+ }
+ QTest::addRow("null ~= a$") << QStringRef() << QLatin1String()
+ << QStringRef(&a) << QLatin1String("a") << false << false;
+ QTest::addRow("empty ~= a$") << QStringRef(&empty) << QLatin1String("")
+ << QStringRef(&a) << QLatin1String("a") << false << false;
+
+#define ROW(h, n, cs, cis) \
+ QTest::addRow("%s ~= %s$", #h, #n) << QStringRef(&h) << QLatin1String(#h) \
+ << QStringRef(&n) << QLatin1String(#n) \
+ << bool(cs) << bool(cis)
+ ROW(a, a, 1, 1);
+ ROW(a, A, 0, 1);
+ ROW(a, b, 0, 0);
+
+ if (rhsHasVariableLength)
+ ROW(b, ab, 0, 0);
+
+ ROW(ab, b, 1, 1);
+ if (rhsHasVariableLength) {
+ ROW(ab, ab, 1, 1);
+ ROW(ab, aB, 0, 1);
+ ROW(ab, Ab, 0, 1);
+ }
+ ROW(ab, c, 0, 0);
+
+ if (rhsHasVariableLength)
+ ROW(bc, abc, 0, 0);
+
+ ROW(Abc, c, 1, 1);
+ if (rhsHasVariableLength) {
+ ROW(Abc, bc, 1, 1);
+ ROW(Abc, bC, 0, 1);
+ ROW(Abc, Bc, 0, 1);
+ ROW(Abc, BC, 0, 1);
+ ROW(aBC, bc, 0, 1);
+ ROW(aBC, bC, 0, 1);
+ ROW(aBC, Bc, 0, 1);
+ ROW(aBC, BC, 1, 1);
+ }
+ ROW(ABC, b, 0, 0);
+ ROW(ABC, a, 0, 0);
+#undef ROW
+}
+
+template <typename Haystack, typename Needle>
+void tst_QStringApiSymmetry::endsWith_impl() const
+{
+ QFETCH(const QStringRef, haystackU16);
+ QFETCH(const QLatin1String, haystackL1);
+ QFETCH(const QStringRef, needleU16);
+ QFETCH(const QLatin1String, needleL1);
+ QFETCH(const bool, resultCS);
+ QFETCH(const bool, resultCIS);
+
+ const auto haystackU8 = haystackU16.toUtf8();
+ const auto needleU8 = needleU16.toUtf8();
+
+ const auto haystack = make<Haystack>(haystackU16, haystackL1, haystackU8);
+ const auto needle = make<Needle>(needleU16, needleL1, needleU8);
+
+ QCOMPARE(haystack.endsWith(needle), resultCS);
+ QCOMPARE(haystack.endsWith(needle, Qt::CaseSensitive), resultCS);
+ QCOMPARE(haystack.endsWith(needle, Qt::CaseInsensitive), resultCIS);
+}
+
+void tst_QStringApiSymmetry::mid_data()
+{
+ QTest::addColumn<QStringRef>("unicode");
+ QTest::addColumn<QLatin1String>("latin1");
+ QTest::addColumn<int>("pos");
+ QTest::addColumn<int>("n");
+ QTest::addColumn<QStringRef>("result");
+ QTest::addColumn<QStringRef>("result2");
+
+ QTest::addRow("null") << QStringRef() << QLatin1String() << 0 << 0 << QStringRef() << QStringRef();
+ QTest::addRow("empty") << QStringRef(&empty) << QLatin1String("") << 0 << 0 << QStringRef(&empty) << QStringRef(&empty);
+
+ // Some classes' mid() implementations have a wide contract, others a narrow one
+ // so only test valid arguents here:
+#define ROW(base, p, n, r1, r2) \
+ QTest::addRow("%s%d%d", #base, p, n) << QStringRef(&base) << QLatin1String(#base) << p << n << QStringRef(&r1) << QStringRef(&r2)
+
+ ROW(a, 0, 0, a, empty);
+ ROW(a, 0, 1, a, a);
+ ROW(a, 1, 0, empty, empty);
+
+ ROW(ab, 0, 0, ab, empty);
+ ROW(ab, 0, 1, ab, a);
+ ROW(ab, 0, 2, ab, ab);
+ ROW(ab, 1, 0, b, empty);
+ ROW(ab, 1, 1, b, b);
+ ROW(ab, 2, 0, empty, empty);
+
+ ROW(abc, 0, 0, abc, empty);
+ ROW(abc, 0, 1, abc, a);
+ ROW(abc, 0, 2, abc, ab);
+ ROW(abc, 0, 3, abc, abc);
+ ROW(abc, 1, 0, bc, empty);
+ ROW(abc, 1, 1, bc, b);
+ ROW(abc, 1, 2, bc, bc);
+ ROW(abc, 2, 0, c, empty);
+ ROW(abc, 2, 1, c, c);
+ ROW(abc, 3, 0, empty, empty);
+#undef ROW
+}
+
+template <typename String>
+void tst_QStringApiSymmetry::mid_impl()
+{
+ QFETCH(const QStringRef, unicode);
+ QFETCH(const QLatin1String, latin1);
+ QFETCH(const int, pos);
+ QFETCH(const int, n);
+ QFETCH(const QStringRef, result);
+ QFETCH(const QStringRef, result2);
+
+ const auto utf8 = unicode.toUtf8();
+
+ const auto s = make<String>(unicode, latin1, utf8);
+
+ {
+ const auto mid = s.mid(pos);
+ const auto mid2 = s.mid(pos, n);
+
+ QCOMPARE(mid, result);
+ QCOMPARE(mid.isNull(), result.isNull());
+ QCOMPARE(mid.isEmpty(), result.isEmpty());
+
+ QCOMPARE(mid2, result2);
+ QCOMPARE(mid2.isNull(), result2.isNull());
+ QCOMPARE(mid2.isEmpty(), result2.isEmpty());
+ }
+ {
+ const auto mid = detached(s).mid(pos);
+ const auto mid2 = detached(s).mid(pos, n);
+
+ QCOMPARE(mid, result);
+ QCOMPARE(mid.isNull(), result.isNull());
+ QCOMPARE(mid.isEmpty(), result.isEmpty());
+
+ QCOMPARE(mid2, result2);
+ QCOMPARE(mid2.isNull(), result2.isNull());
+ QCOMPARE(mid2.isEmpty(), result2.isEmpty());
+ }
+}
+
+void tst_QStringApiSymmetry::left_data()
+{
+ QTest::addColumn<QStringRef>("unicode");
+ QTest::addColumn<QLatin1String>("latin1");
+ QTest::addColumn<int>("n");
+ QTest::addColumn<QStringRef>("result");
+
+ QTest::addRow("null") << QStringRef() << QLatin1String() << 0 << QStringRef();
+ QTest::addRow("empty") << QStringRef(&empty) << QLatin1String("") << 0 << QStringRef(&empty);
+
+ // Some classes' left() implementations have a wide contract, others a narrow one
+ // so only test valid arguents here:
+#define ROW(base, n, res) \
+ QTest::addRow("%s%d", #base, n) << QStringRef(&base) << QLatin1String(#base) << n << QStringRef(&res);
+
+ ROW(a, 0, empty);
+ ROW(a, 1, a);
+
+ ROW(ab, 0, empty);
+ ROW(ab, 1, a);
+ ROW(ab, 2, ab);
+
+ ROW(abc, 0, empty);
+ ROW(abc, 1, a);
+ ROW(abc, 2, ab);
+ ROW(abc, 3, abc);
+#undef ROW
+}
+
+template <typename String>
+void tst_QStringApiSymmetry::left_impl()
+{
+ QFETCH(const QStringRef, unicode);
+ QFETCH(const QLatin1String, latin1);
+ QFETCH(const int, n);
+ QFETCH(const QStringRef, result);
+
+ const auto utf8 = unicode.toUtf8();
+
+ const auto s = make<String>(unicode, latin1, utf8);
+
+ {
+ const auto left = s.left(n);
+
+ QCOMPARE(left, result);
+ QCOMPARE(left.isNull(), result.isNull());
+ QCOMPARE(left.isEmpty(), result.isEmpty());
+ }
+ {
+ const auto left = detached(s).left(n);
+
+ QCOMPARE(left, result);
+ QCOMPARE(left.isNull(), result.isNull());
+ QCOMPARE(left.isEmpty(), result.isEmpty());
+ }
+ {
+ auto left = s;
+ left.truncate(n);
+
+ QCOMPARE(left, result);
+ QCOMPARE(left.isNull(), result.isNull());
+ QCOMPARE(left.isEmpty(), result.isEmpty());
+ }
+}
+
+void tst_QStringApiSymmetry::right_data()
+{
+ QTest::addColumn<QStringRef>("unicode");
+ QTest::addColumn<QLatin1String>("latin1");
+ QTest::addColumn<int>("n");
+ QTest::addColumn<QStringRef>("result");
+
+ QTest::addRow("null") << QStringRef() << QLatin1String() << 0 << QStringRef();
+ QTest::addRow("empty") << QStringRef(&empty) << QLatin1String("") << 0 << QStringRef(&empty);
+
+ // Some classes' right() implementations have a wide contract, others a narrow one
+ // so only test valid arguents here:
+#define ROW(base, n, res) \
+ QTest::addRow("%s%d", #base, n) << QStringRef(&base) << QLatin1String(#base) << n << QStringRef(&res);
+
+ ROW(a, 0, empty);
+ ROW(a, 1, a);
+
+ ROW(ab, 0, empty);
+ ROW(ab, 1, b);
+ ROW(ab, 2, ab);
+
+ ROW(abc, 0, empty);
+ ROW(abc, 1, c);
+ ROW(abc, 2, bc);
+ ROW(abc, 3, abc);
+#undef ROW
+}
+
+template <typename String>
+void tst_QStringApiSymmetry::right_impl()
+{
+ QFETCH(const QStringRef, unicode);
+ QFETCH(const QLatin1String, latin1);
+ QFETCH(const int, n);
+ QFETCH(const QStringRef, result);
+
+ const auto utf8 = unicode.toUtf8();
+
+ const auto s = make<String>(unicode, latin1, utf8);
+
+ {
+ const auto right = s.right(n);
+
+ QCOMPARE(right, result);
+ QCOMPARE(right.isNull(), result.isNull());
+ QCOMPARE(right.isEmpty(), result.isEmpty());
+ }
+ {
+ const auto right = detached(s).right(n);
+
+ QCOMPARE(right, result);
+ QCOMPARE(right.isNull(), result.isNull());
+ QCOMPARE(right.isEmpty(), result.isEmpty());
+ }
+}
+
+void tst_QStringApiSymmetry::chop_data()
+{
+ QTest::addColumn<QStringRef>("unicode");
+ QTest::addColumn<QLatin1String>("latin1");
+ QTest::addColumn<int>("n");
+ QTest::addColumn<QStringRef>("result");
+
+ QTest::addRow("null") << QStringRef() << QLatin1String() << 0 << QStringRef();
+ QTest::addRow("empty") << QStringRef(&empty) << QLatin1String("") << 0 << QStringRef(&empty);
+
+ // Some classes' truncate() implementations have a wide contract, others a narrow one
+ // so only test valid arguents here:
+#define ROW(base, n, res) \
+ QTest::addRow("%s%d", #base, n) << QStringRef(&base) << QLatin1String(#base) << n << QStringRef(&res);
+
+ ROW(a, 0, a);
+ ROW(a, 1, empty);
+
+ ROW(ab, 0, ab);
+ ROW(ab, 1, a);
+ ROW(ab, 2, empty);
+
+ ROW(abc, 0, abc);
+ ROW(abc, 1, ab);
+ ROW(abc, 2, a);
+ ROW(abc, 3, empty);
+#undef ROW
+}
+
+template <typename String>
+void tst_QStringApiSymmetry::chop_impl()
+{
+ QFETCH(const QStringRef, unicode);
+ QFETCH(const QLatin1String, latin1);
+ QFETCH(const int, n);
+ QFETCH(const QStringRef, result);
+
+ const auto utf8 = unicode.toUtf8();
+
+ const auto s = make<String>(unicode, latin1, utf8);
+
+ {
+ const auto chopped = s.chopped(n);
+
+ QCOMPARE(chopped, result);
+ QCOMPARE(chopped.isNull(), result.isNull());
+ QCOMPARE(chopped.isEmpty(), result.isEmpty());
+ }
+ {
+ const auto chopped = detached(s).chopped(n);
+
+ QCOMPARE(chopped, result);
+ QCOMPARE(chopped.isNull(), result.isNull());
+ QCOMPARE(chopped.isEmpty(), result.isEmpty());
+ }
+ {
+ auto chopped = s;
+ chopped.chop(n);
+
+ QCOMPARE(chopped, result);
+ QCOMPARE(chopped.isNull(), result.isNull());
+ QCOMPARE(chopped.isEmpty(), result.isEmpty());
+ }
+}
+
+void tst_QStringApiSymmetry::trimmed_data()
+{
+ QTest::addColumn<QString>("unicode");
+ QTest::addColumn<QStringRef>("result");
+
+ const auto latin1Whitespace = QLatin1String(" \r\n\t\f\v");
+
+ QTest::addRow("null") << QString() << QStringRef();
+
+ auto add = [latin1Whitespace](const QString &str) {
+ // run through all substrings of latin1Whitespace
+ for (int len = 0; len < latin1Whitespace.size(); ++len) {
+ for (int pos = 0; pos < latin1Whitespace.size() - len; ++pos) {
+ const QString unicode = latin1Whitespace.mid(pos, len) + str + latin1Whitespace.mid(pos, len);
+ const QScopedPointer<const char> escaped(QTest::toString(unicode));
+ QTest::addRow("%s", escaped.data()) << unicode << QStringRef(&str);
+ }
+ }
+ };
+
+ add(empty);
+ add(a);
+ add(ab);
+}
+
+template <typename String>
+void tst_QStringApiSymmetry::trimmed_impl()
+{
+ QFETCH(const QString, unicode);
+ QFETCH(const QStringRef, result);
+
+ const auto utf8 = unicode.toUtf8();
+ const auto l1s = unicode.toLatin1();
+ const auto l1 = l1s.isNull() ? QLatin1String() : QLatin1String(l1s);
+
+ const auto ref = unicode.isNull() ? QStringRef() : QStringRef(&unicode);
+ const auto s = make<String>(ref, l1, utf8);
+
+ QCOMPARE(s.isNull(), unicode.isNull());
+
+ {
+ const auto trimmed = s.trimmed();
+
+ QCOMPARE(trimmed, result);
+ QCOMPARE(trimmed.isNull(), result.isNull());
+ QCOMPARE(trimmed.isEmpty(), result.isEmpty());
+ }
+ {
+ const auto trimmed = detached(s).trimmed();
+
+ QCOMPARE(trimmed, result);
+ QCOMPARE(trimmed.isNull(), result.isNull());
+ QCOMPARE(trimmed.isEmpty(), result.isEmpty());
+ }
+}
+
//
//
// UTF-16-only checks:
@@ -309,6 +1057,7 @@ void tst_QStringApiSymmetry::compare_impl() const
template <class Str> Str make(const QString &s);
template <> QStringRef make(const QString &s) { return QStringRef(&s); }
template <> QString make(const QString &s) { return s; }
+template <> QStringView make(const QString &s) { return s; }
#define REPEAT_16X(X) X X X X X X X X X X X X X X X X
#define LONG_STRING_256 REPEAT_16X("0123456789abcdef")
diff --git a/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp b/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp
index 319f772516..7d5504c22c 100644
--- a/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp
+++ b/tests/auto/corelib/tools/qstringiterator/tst_qstringiterator.cpp
@@ -326,22 +326,22 @@ void tst_QStringIterator::position()
QLatin1Char('p')
// codeunit count: 35
};
+ static const int stringDataSize = sizeof(stringData) / sizeof(stringData[0]);
- const QString string(stringData, sizeof(stringData) / sizeof(stringData[0]));
- QStringIterator i(string);
+ QStringIterator i(QStringView(stringData, stringDataSize));
- QCOMPARE(i.position(), string.constBegin());
+ QCOMPARE(i.position(), stringData);
QVERIFY(i.hasNext());
QVERIFY(!i.hasPrevious());
- i.setPosition(string.constEnd());
- QCOMPARE(i.position(), string.constEnd());
+ i.setPosition(stringData + stringDataSize);
+ QCOMPARE(i.position(), stringData + stringDataSize);
QVERIFY(!i.hasNext());
QVERIFY(i.hasPrevious());
#define QCHAR_UNICODE_VALUE(x) ((uint)(QChar(x).unicode()))
- const QString::const_iterator begin = string.constBegin();
+ const QChar *begin = stringData;
i.setPosition(begin);
QCOMPARE(i.position(), begin);
QCOMPARE(i.peekNext(), QCHAR_UNICODE_VALUE(QLatin1Char('a')));
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 2385aa992c..9f054190e5 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -264,6 +264,15 @@ void tst_QStringList::contains()
QVERIFY(list.contains("ARTHUR", Qt::CaseInsensitive));
QVERIFY(list.contains("dent", Qt::CaseInsensitive));
QVERIFY(!list.contains("hans", Qt::CaseInsensitive));
+
+ QVERIFY(list.contains(QLatin1String("arthur")));
+ QVERIFY(!list.contains(QLatin1String("ArthuR")));
+ QVERIFY(!list.contains(QLatin1String("Hans")));
+ QVERIFY(list.contains(QLatin1String("arthur"), Qt::CaseInsensitive));
+ QVERIFY(list.contains(QLatin1String("ArthuR"), Qt::CaseInsensitive));
+ QVERIFY(list.contains(QLatin1String("ARTHUR"), Qt::CaseInsensitive));
+ QVERIFY(list.contains(QLatin1String("dent"), Qt::CaseInsensitive));
+ QVERIFY(!list.contains(QLatin1String("hans"), Qt::CaseInsensitive));
}
void tst_QStringList::removeDuplicates_data()
diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
index d2374fe0ae..473f563f9b 100644
--- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
+++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp
@@ -1862,7 +1862,9 @@ void tst_QStringRef::double_conversion()
void tst_QStringRef::trimmed()
{
- QString a;
+ QVERIFY(QStringRef().trimmed().isNull());
+ QString a = "";
+ QVERIFY(!QStringRef(&a).trimmed().isNull());
QStringRef b;
a = "Text";
b = a.leftRef(-1);
diff --git a/tests/auto/corelib/tools/qstringview/.gitignore b/tests/auto/corelib/tools/qstringview/.gitignore
new file mode 100644
index 0000000000..5f757d448a
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringview/.gitignore
@@ -0,0 +1 @@
+tst_qstringview
diff --git a/tests/auto/corelib/tools/qstringview/qstringview.pro b/tests/auto/corelib/tools/qstringview/qstringview.pro
new file mode 100644
index 0000000000..e0e9973c91
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringview/qstringview.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_qstringview
+QT = core testlib
+contains(QT_CONFIG, c++14):CONFIG *= c++14
+contains(QT_CONFIG, c++1z):CONFIG *= c++1z
+SOURCES += tst_qstringview.cpp
diff --git a/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp b/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp
new file mode 100644
index 0000000000..4174b85f4c
--- /dev/null
+++ b/tests/auto/corelib/tools/qstringview/tst_qstringview.cpp
@@ -0,0 +1,624 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QStringView>
+#include <QString>
+#include <QChar>
+#include <QStringRef>
+
+#include <QTest>
+
+#include <string>
+
+template <typename T>
+using CanConvert = std::is_convertible<T, QStringView>;
+
+Q_STATIC_ASSERT(!CanConvert<QLatin1String>::value);
+Q_STATIC_ASSERT(!CanConvert<const char*>::value);
+Q_STATIC_ASSERT(!CanConvert<QByteArray>::value);
+
+// QStringView qchar_does_not_compile() { return QStringView(QChar('a')); }
+// QStringView qlatin1string_does_not_compile() { return QStringView(QLatin1String("a")); }
+// QStringView const_char_star_does_not_compile() { return QStringView("a"); }
+// QStringView qbytearray_does_not_compile() { return QStringView(QByteArray("a")); }
+
+//
+// QChar
+//
+
+Q_STATIC_ASSERT(!CanConvert<QChar>::value);
+
+Q_STATIC_ASSERT(CanConvert<QChar[123]>::value);
+
+Q_STATIC_ASSERT(CanConvert< QString >::value);
+Q_STATIC_ASSERT(CanConvert<const QString >::value);
+Q_STATIC_ASSERT(CanConvert< QString&>::value);
+Q_STATIC_ASSERT(CanConvert<const QString&>::value);
+
+Q_STATIC_ASSERT(CanConvert< QStringRef >::value);
+Q_STATIC_ASSERT(CanConvert<const QStringRef >::value);
+Q_STATIC_ASSERT(CanConvert< QStringRef&>::value);
+Q_STATIC_ASSERT(CanConvert<const QStringRef&>::value);
+
+
+//
+// ushort
+//
+
+Q_STATIC_ASSERT(!CanConvert<ushort>::value);
+
+Q_STATIC_ASSERT(CanConvert<ushort[123]>::value);
+
+Q_STATIC_ASSERT(CanConvert< ushort*>::value);
+Q_STATIC_ASSERT(CanConvert<const ushort*>::value);
+
+
+//
+// char16_t
+//
+
+#if defined(Q_COMPILER_UNICODE_STRINGS)
+
+Q_STATIC_ASSERT(!CanConvert<char16_t>::value);
+
+Q_STATIC_ASSERT(CanConvert< char16_t*>::value);
+Q_STATIC_ASSERT(CanConvert<const char16_t*>::value);
+
+#endif
+
+#if defined(Q_STDLIB_UNICODE_STRINGS)
+
+Q_STATIC_ASSERT(CanConvert< std::u16string >::value);
+Q_STATIC_ASSERT(CanConvert<const std::u16string >::value);
+Q_STATIC_ASSERT(CanConvert< std::u16string&>::value);
+Q_STATIC_ASSERT(CanConvert<const std::u16string&>::value);
+
+#endif
+
+
+//
+// wchar_t
+//
+
+Q_CONSTEXPR bool CanConvertFromWCharT =
+#ifdef Q_OS_WIN
+ true
+#else
+ false
+#endif
+ ;
+
+Q_STATIC_ASSERT(!CanConvert<wchar_t>::value);
+
+Q_STATIC_ASSERT(CanConvert< wchar_t*>::value == CanConvertFromWCharT);
+Q_STATIC_ASSERT(CanConvert<const wchar_t*>::value == CanConvertFromWCharT);
+
+Q_STATIC_ASSERT(CanConvert< std::wstring >::value == CanConvertFromWCharT);
+Q_STATIC_ASSERT(CanConvert<const std::wstring >::value == CanConvertFromWCharT);
+Q_STATIC_ASSERT(CanConvert< std::wstring&>::value == CanConvertFromWCharT);
+Q_STATIC_ASSERT(CanConvert<const std::wstring&>::value == CanConvertFromWCharT);
+
+
+class tst_QStringView : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void constExpr() const;
+ void basics() const;
+ void literals() const;
+ void at() const;
+
+ void fromQString() const;
+ void fromQStringRef() const;
+
+ void fromQCharStar() const
+ {
+ const QChar str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 0 };
+ fromLiteral(str);
+ }
+
+ void fromUShortStar() const
+ {
+ const ushort str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!', 0 };
+ fromLiteral(str);
+ }
+
+ void fromChar16TStar() const
+ {
+#if defined(Q_COMPILER_UNICODE_STRINGS)
+ fromLiteral(u"Hello, World!");
+#else
+ QSKIP("This test requires C++11 char16_t support enabled in the compiler");
+#endif
+ }
+
+ void fromWCharTStar() const
+ {
+#ifdef Q_OS_WIN
+ fromLiteral(L"Hello, World!");
+#else
+ QSKIP("This is a Windows-only test");
+#endif
+ }
+
+ void fromQCharRange() const
+ {
+ const QChar str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!' };
+ fromRange(std::begin(str), std::end(str));
+ }
+
+ void fromUShortRange() const
+ {
+ const ushort str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!' };
+ fromRange(std::begin(str), std::end(str));
+ }
+
+ void fromChar16TRange() const
+ {
+#if defined(Q_COMPILER_UNICODE_STRINGS)
+ const char16_t str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!' };
+ fromRange(std::begin(str), std::end(str));
+#else
+ QSKIP("This test requires C++11 char16_t support enabled in the compiler");
+#endif
+ }
+
+ void fromWCharTRange() const
+ {
+#ifdef Q_OS_WIN
+ const wchar_t str[] = { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!' };
+ fromRange(std::begin(str), std::end(str));
+#else
+ QSKIP("This is a Windows-only test");
+#endif
+ }
+
+ // std::basic_string
+ void fromStdStringWCharT() const
+ {
+#ifdef Q_OS_WIN
+ fromStdString<wchar_t>();
+#else
+ QSKIP("This is a Windows-only test");
+#endif
+ }
+ void fromStdStringChar16T() const
+ {
+#ifdef Q_STDLIB_UNICODE_STRINGS
+ fromStdString<char16_t>();
+#else
+ QSKIP("This test requires C++11 char16_t support enabled in compiler & stdlib");
+#endif
+ }
+
+private:
+ template <typename String>
+ void conversion_tests(String arg) const;
+ template <typename Char>
+ void fromLiteral(const Char *arg) const;
+ template <typename Char>
+ void fromRange(const Char *first, const Char *last) const;
+ template <typename Char, typename Container>
+ void fromContainer() const;
+ template <typename Char>
+ void fromStdString() const { fromContainer<Char, std::basic_string<Char> >(); }
+};
+
+void tst_QStringView::constExpr() const
+{
+ // compile-time checks
+#ifdef Q_COMPILER_CONSTEXPR
+ {
+ constexpr QStringView sv;
+ Q_STATIC_ASSERT(sv.size() == 0);
+ Q_STATIC_ASSERT(sv.isNull());
+ Q_STATIC_ASSERT(sv.empty());
+ Q_STATIC_ASSERT(sv.isEmpty());
+ Q_STATIC_ASSERT(sv.utf16() == nullptr);
+
+ constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ Q_STATIC_ASSERT(sv2.isNull());
+ Q_STATIC_ASSERT(sv2.empty());
+ }
+ {
+ constexpr QStringView sv = QStringViewLiteral("");
+ Q_STATIC_ASSERT(sv.size() == 0);
+ Q_STATIC_ASSERT(!sv.isNull());
+ Q_STATIC_ASSERT(sv.empty());
+ Q_STATIC_ASSERT(sv.isEmpty());
+ Q_STATIC_ASSERT(sv.utf16() != nullptr);
+
+ constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ Q_STATIC_ASSERT(!sv2.isNull());
+ Q_STATIC_ASSERT(sv2.empty());
+ }
+ {
+ constexpr QStringView sv = QStringViewLiteral("Hello");
+ Q_STATIC_ASSERT(sv.size() == 5);
+ Q_STATIC_ASSERT(!sv.empty());
+ Q_STATIC_ASSERT(!sv.isEmpty());
+ Q_STATIC_ASSERT(!sv.isNull());
+ Q_STATIC_ASSERT(*sv.utf16() == 'H');
+ Q_STATIC_ASSERT(sv[0] == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.at(0) == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.front() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.first() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv[4] == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.at(4) == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.back() == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.last() == QLatin1Char('o'));
+
+ constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ Q_STATIC_ASSERT(!sv2.isNull());
+ Q_STATIC_ASSERT(!sv2.empty());
+ Q_STATIC_ASSERT(sv2.size() == 5);
+ }
+#if !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS)
+ {
+ Q_STATIC_ASSERT(QStringView(u"Hello").size() == 5);
+ constexpr QStringView sv = u"Hello";
+ Q_STATIC_ASSERT(sv.size() == 5);
+ Q_STATIC_ASSERT(!sv.empty());
+ Q_STATIC_ASSERT(!sv.isEmpty());
+ Q_STATIC_ASSERT(!sv.isNull());
+ Q_STATIC_ASSERT(*sv.utf16() == 'H');
+ Q_STATIC_ASSERT(sv[0] == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.at(0) == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.front() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.first() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv[4] == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.at(4) == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.back() == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.last() == QLatin1Char('o'));
+
+ constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ Q_STATIC_ASSERT(!sv2.isNull());
+ Q_STATIC_ASSERT(!sv2.empty());
+ Q_STATIC_ASSERT(sv2.size() == 5);
+
+ constexpr char16_t *null = nullptr;
+ constexpr QStringView sv3(null);
+ Q_STATIC_ASSERT(sv3.isNull());
+ Q_STATIC_ASSERT(sv3.isEmpty());
+ Q_STATIC_ASSERT(sv3.size() == 0);
+ }
+#else // storage_type is wchar_t
+ {
+ Q_STATIC_ASSERT(QStringView(L"Hello").size() == 5);
+ constexpr QStringView sv = L"Hello";
+ Q_STATIC_ASSERT(sv.size() == 5);
+ Q_STATIC_ASSERT(!sv.empty());
+ Q_STATIC_ASSERT(!sv.isEmpty());
+ Q_STATIC_ASSERT(!sv.isNull());
+ Q_STATIC_ASSERT(*sv.utf16() == 'H');
+ Q_STATIC_ASSERT(sv[0] == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.at(0) == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.front() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv.first() == QLatin1Char('H'));
+ Q_STATIC_ASSERT(sv[4] == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.at(4) == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.back() == QLatin1Char('o'));
+ Q_STATIC_ASSERT(sv.last() == QLatin1Char('o'));
+
+ constexpr QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ Q_STATIC_ASSERT(!sv2.isNull());
+ Q_STATIC_ASSERT(!sv2.empty());
+ Q_STATIC_ASSERT(sv2.size() == 5);
+
+ constexpr wchar_t *null = nullptr;
+ constexpr QStringView sv3(null);
+ Q_STATIC_ASSERT(sv3.isNull());
+ Q_STATIC_ASSERT(sv3.isEmpty());
+ Q_STATIC_ASSERT(sv3.size() == 0);
+ }
+#endif
+#endif
+}
+
+void tst_QStringView::basics() const
+{
+ QStringView sv1;
+
+ // a default-constructed QStringView is null:
+ QVERIFY(sv1.isNull());
+ // which implies it's empty();
+ QVERIFY(sv1.isEmpty());
+
+ QStringView sv2;
+
+ QVERIFY(sv2 == sv1);
+ QVERIFY(!(sv2 != sv1));
+}
+
+void tst_QStringView::literals() const
+{
+#if !defined(Q_OS_WIN) || defined(Q_COMPILER_UNICODE_STRINGS)
+ const char16_t hello[] = u"Hello";
+ const char16_t longhello[] =
+ u"Hello World. This is a much longer message, to exercise qustrlen.";
+ const char16_t withnull[] = u"a\0zzz";
+#else // storage_type is wchar_t
+ const wchar_t hello[] = L"Hello";
+ const wchar_t longhello[] =
+ L"Hello World. This is a much longer message, to exercise qustrlen.";
+ const wchar_t withnull[] = L"a\0zzz";
+#endif
+ Q_STATIC_ASSERT(sizeof(longhello) >= 16);
+
+ QCOMPARE(QStringView(hello).size(), 5);
+ QCOMPARE(QStringView(hello + 0).size(), 5); // forces decay to pointer
+ QStringView sv = hello;
+ QCOMPARE(sv.size(), 5);
+ QVERIFY(!sv.empty());
+ QVERIFY(!sv.isEmpty());
+ QVERIFY(!sv.isNull());
+ QCOMPARE(*sv.utf16(), 'H');
+ QCOMPARE(sv[0], QLatin1Char('H'));
+ QCOMPARE(sv.at(0), QLatin1Char('H'));
+ QCOMPARE(sv.front(), QLatin1Char('H'));
+ QCOMPARE(sv.first(), QLatin1Char('H'));
+ QCOMPARE(sv[4], QLatin1Char('o'));
+ QCOMPARE(sv.at(4), QLatin1Char('o'));
+ QCOMPARE(sv.back(), QLatin1Char('o'));
+ QCOMPARE(sv.last(), QLatin1Char('o'));
+
+ QStringView sv2(sv.utf16(), sv.utf16() + sv.size());
+ QVERIFY(!sv2.isNull());
+ QVERIFY(!sv2.empty());
+ QCOMPARE(sv2.size(), 5);
+
+ QStringView sv3(longhello);
+ QCOMPARE(size_t(sv3.size()), sizeof(longhello)/sizeof(longhello[0]) - 1);
+ QCOMPARE(sv3.last(), QLatin1Char('.'));
+ sv3 = longhello;
+ QCOMPARE(size_t(sv3.size()), sizeof(longhello)/sizeof(longhello[0]) - 1);
+
+ for (int i = 0; i < sv3.size(); ++i) {
+ QStringView sv4(longhello + i);
+ QCOMPARE(size_t(sv4.size()), sizeof(longhello)/sizeof(longhello[0]) - 1 - i);
+ QCOMPARE(sv4.last(), QLatin1Char('.'));
+ sv4 = longhello + i;
+ QCOMPARE(size_t(sv4.size()), sizeof(longhello)/sizeof(longhello[0]) - 1 - i);
+ }
+
+ // these are different results
+ QCOMPARE(size_t(QStringView(withnull).size()), sizeof(withnull)/sizeof(withnull[0]) - 1);
+ QCOMPARE(QStringView(withnull + 0).size(), 1);
+}
+
+void tst_QStringView::at() const
+{
+ QString hello("Hello");
+ QStringView sv(hello);
+ QCOMPARE(sv.at(0), QChar('H')); QCOMPARE(sv[0], QChar('H'));
+ QCOMPARE(sv.at(1), QChar('e')); QCOMPARE(sv[1], QChar('e'));
+ QCOMPARE(sv.at(2), QChar('l')); QCOMPARE(sv[2], QChar('l'));
+ QCOMPARE(sv.at(3), QChar('l')); QCOMPARE(sv[3], QChar('l'));
+ QCOMPARE(sv.at(4), QChar('o')); QCOMPARE(sv[4], QChar('o'));
+}
+
+void tst_QStringView::fromQString() const
+{
+ QString null;
+ QString empty = "";
+
+ QVERIFY( QStringView(null).isNull());
+ QVERIFY( QStringView(null).isEmpty());
+ QVERIFY( QStringView(empty).isEmpty());
+ QVERIFY(!QStringView(empty).isNull());
+
+ conversion_tests(QString("Hello World!"));
+}
+
+void tst_QStringView::fromQStringRef() const
+{
+ QStringRef null;
+ QString emptyS = "";
+ QStringRef empty(&emptyS);
+
+ QVERIFY( QStringView(null).isNull());
+ QVERIFY( QStringView(null).isEmpty());
+ QVERIFY( QStringView(empty).isEmpty());
+ QVERIFY(!QStringView(empty).isNull());
+
+ conversion_tests(QString("Hello World!").midRef(6));
+}
+
+template <typename Char>
+void tst_QStringView::fromLiteral(const Char *arg) const
+{
+ const Char *null = nullptr;
+ const Char empty[] = { 0 };
+
+ QCOMPARE(QStringView(null).size(), qssize_t(0));
+ QCOMPARE(QStringView(null).data(), nullptr);
+ QCOMPARE(QStringView(empty).size(), qssize_t(0));
+ QCOMPARE(static_cast<const void*>(QStringView(empty).data()),
+ static_cast<const void*>(empty));
+
+ QVERIFY( QStringView(null).isNull());
+ QVERIFY( QStringView(null).isEmpty());
+ QVERIFY( QStringView(empty).isEmpty());
+ QVERIFY(!QStringView(empty).isNull());
+
+ conversion_tests(arg);
+}
+
+template <typename Char>
+void tst_QStringView::fromRange(const Char *first, const Char *last) const
+{
+ const Char *null = nullptr;
+ QCOMPARE(QStringView(null, null).size(), 0);
+ QCOMPARE(QStringView(null, null).data(), nullptr);
+ QCOMPARE(QStringView(first, first).size(), 0);
+ QCOMPARE(static_cast<const void*>(QStringView(first, first).data()),
+ static_cast<const void*>(first));
+
+ const auto sv = QStringView(first, last);
+ QCOMPARE(sv.size(), last - first);
+ QCOMPARE(static_cast<const void*>(sv.data()),
+ static_cast<const void*>(first));
+
+ // can't call conversion_tests() here, as it requires a single object
+}
+
+template <typename Char, typename Container>
+void tst_QStringView::fromContainer() const
+{
+ const QString s = "Hello World!";
+
+ Container c;
+ // unspecified whether empty containers make null QStringViews
+ QVERIFY(QStringView(c).isEmpty());
+
+ QCOMPARE(sizeof(Char), sizeof(QChar));
+
+ const auto *data = reinterpret_cast<const Char *>(s.utf16());
+ std::copy(data, data + s.size(), std::back_inserter(c));
+ conversion_tests(std::move(c));
+}
+
+namespace help {
+template <typename T>
+size_t size(const T &t) { return size_t(t.size()); }
+template <typename T>
+size_t size(const T *t)
+{
+ size_t result = 0;
+ if (t) {
+ while (*t++)
+ ++result;
+ }
+ return result;
+}
+size_t size(const QChar *t)
+{
+ size_t result = 0;
+ if (t) {
+ while (!t++->isNull())
+ ++result;
+ }
+ return result;
+}
+
+template <typename T>
+typename T::const_iterator cbegin(const T &t) { return t.cbegin(); }
+template <typename T>
+const T * cbegin(const T *t) { return t; }
+
+template <typename T>
+typename T::const_iterator cend(const T &t) { return t.cend(); }
+template <typename T>
+const T * cend(const T *t) { return t + size(t); }
+
+template <typename T>
+typename T::const_reverse_iterator crbegin(const T &t) { return t.crbegin(); }
+template <typename T>
+std::reverse_iterator<const T*> crbegin(const T *t) { return std::reverse_iterator<const T*>(cend(t)); }
+
+template <typename T>
+typename T::const_reverse_iterator crend(const T &t) { return t.crend(); }
+template <typename T>
+std::reverse_iterator<const T*> crend(const T *t) { return std::reverse_iterator<const T*>(cbegin(t)); }
+
+} // namespace help
+
+template <typename String>
+void tst_QStringView::conversion_tests(String string) const
+{
+ // copy-construct:
+ {
+ QStringView sv = string;
+
+ QCOMPARE(help::size(sv), help::size(string));
+
+ // check iterators:
+
+ QVERIFY(std::equal(help::cbegin(string), help::cend(string),
+ QT_MAKE_CHECKED_ARRAY_ITERATOR(sv.cbegin(), sv.size())));
+ QVERIFY(std::equal(help::cbegin(string), help::cend(string),
+ QT_MAKE_CHECKED_ARRAY_ITERATOR(sv.begin(), sv.size())));
+ QVERIFY(std::equal(help::crbegin(string), help::crend(string),
+ sv.crbegin()));
+ QVERIFY(std::equal(help::crbegin(string), help::crend(string),
+ sv.rbegin()));
+
+ QCOMPARE(sv, string);
+ }
+
+ QStringView sv;
+
+ // copy-assign:
+ {
+ sv = string;
+
+ QCOMPARE(help::size(sv), help::size(string));
+
+ // check relational operators:
+
+ QCOMPARE(sv, string);
+ QCOMPARE(string, sv);
+
+ QVERIFY(!(sv != string));
+ QVERIFY(!(string != sv));
+
+ QVERIFY(!(sv < string));
+ QVERIFY(sv <= string);
+ QVERIFY(!(sv > string));
+ QVERIFY(sv >= string);
+
+ QVERIFY(!(string < sv));
+ QVERIFY(string <= sv);
+ QVERIFY(!(string > sv));
+ QVERIFY(string >= sv);
+ }
+
+ // copy-construct from rvalue (QStringView never assumes ownership):
+ {
+ QStringView sv2 = std::move(string);
+ QCOMPARE(sv2, sv);
+ QCOMPARE(sv2, string);
+ }
+
+ // copy-assign from rvalue (QStringView never assumes ownership):
+ {
+ QStringView sv2;
+ sv2 = std::move(string);
+ QCOMPARE(sv2, sv);
+ QCOMPARE(sv2, string);
+ }
+}
+
+QTEST_APPLESS_MAIN(tst_QStringView)
+#include "tst_qstringview.moc"
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index e75ed5cc67..9f22c3d51d 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -62,7 +62,9 @@ private slots:
private:
void printTimeZone(const QTimeZone &tz);
#ifdef QT_BUILD_INTERNAL
+ // Generic tests of privates, called by implementation-specific private tests:
void testCetPrivate(const QTimeZonePrivate &tzp);
+ void testEpochTranPrivate(const QTimeZonePrivate &tzp);
#endif // QT_BUILD_INTERNAL
const bool debug;
};
@@ -167,11 +169,11 @@ void tst_QTimeZone::createTest()
QDateTime jun = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC);
QDateTime janPrev = QDateTime(QDate(2011, 1, 1), QTime(0, 0, 0), Qt::UTC);
- QCOMPARE(tz.offsetFromUtc(jan), 46800);
- QCOMPARE(tz.offsetFromUtc(jun), 43200);
+ QCOMPARE(tz.offsetFromUtc(jan), 13 * 3600);
+ QCOMPARE(tz.offsetFromUtc(jun), 12 * 3600);
- QCOMPARE(tz.standardTimeOffset(jan), 43200);
- QCOMPARE(tz.standardTimeOffset(jun), 43200);
+ QCOMPARE(tz.standardTimeOffset(jan), 12 * 3600);
+ QCOMPARE(tz.standardTimeOffset(jun), 12 * 3600);
QCOMPARE(tz.daylightTimeOffset(jan), 3600);
QCOMPARE(tz.daylightTimeOffset(jun), 0);
@@ -183,38 +185,46 @@ void tst_QTimeZone::createTest()
// Only test transitions if host system supports them
if (tz.hasTransitions()) {
QTimeZone::OffsetData tran = tz.nextTransition(jan);
- QCOMPARE(tran.atUtc.toMSecsSinceEpoch(), (qint64)1333202400000);
- QCOMPARE(tran.offsetFromUtc, 43200);
- QCOMPARE(tran.standardTimeOffset, 43200);
+ // 2012-04-01 03:00 NZDT, +13 -> +12
+ QCOMPARE(tran.atUtc,
+ QDateTime(QDate(2012, 4, 1), QTime(3, 0), Qt::OffsetFromUTC, 13 * 3600));
+ QCOMPARE(tran.offsetFromUtc, 12 * 3600);
+ QCOMPARE(tran.standardTimeOffset, 12 * 3600);
QCOMPARE(tran.daylightTimeOffset, 0);
tran = tz.nextTransition(jun);
- QCOMPARE(tran.atUtc.toMSecsSinceEpoch(), (qint64)1348927200000);
- QCOMPARE(tran.offsetFromUtc, 46800);
- QCOMPARE(tran.standardTimeOffset, 43200);
+ // 2012-09-30 02:00 NZST, +12 -> +13
+ QCOMPARE(tran.atUtc,
+ QDateTime(QDate(2012, 9, 30), QTime(2, 0), Qt::OffsetFromUTC, 12 * 3600));
+ QCOMPARE(tran.offsetFromUtc, 13 * 3600);
+ QCOMPARE(tran.standardTimeOffset, 12 * 3600);
QCOMPARE(tran.daylightTimeOffset, 3600);
tran = tz.previousTransition(jan);
- QCOMPARE(tran.atUtc.toMSecsSinceEpoch(), (qint64)1316872800000);
- QCOMPARE(tran.offsetFromUtc, 46800);
- QCOMPARE(tran.standardTimeOffset, 43200);
+ // 2011-09-25 02:00 NZST, +12 -> +13
+ QCOMPARE(tran.atUtc,
+ QDateTime(QDate(2011, 9, 25), QTime(2, 0), Qt::OffsetFromUTC, 12 * 3600));
+ QCOMPARE(tran.offsetFromUtc, 13 * 3600);
+ QCOMPARE(tran.standardTimeOffset, 12 * 3600);
QCOMPARE(tran.daylightTimeOffset, 3600);
tran = tz.previousTransition(jun);
- QCOMPARE(tran.atUtc.toMSecsSinceEpoch(), (qint64)1333202400000);
- QCOMPARE(tran.offsetFromUtc, 43200);
- QCOMPARE(tran.standardTimeOffset, 43200);
+ // 2012-04-01 03:00 NZDT, +13 -> +12 (again)
+ QCOMPARE(tran.atUtc,
+ QDateTime(QDate(2012, 4, 1), QTime(3, 0), Qt::OffsetFromUTC, 13 * 3600));
+ QCOMPARE(tran.offsetFromUtc, 12 * 3600);
+ QCOMPARE(tran.standardTimeOffset, 12 * 3600);
QCOMPARE(tran.daylightTimeOffset, 0);
QTimeZone::OffsetDataList expected;
- tran.atUtc = QDateTime::fromMSecsSinceEpoch(1301752800000, Qt::UTC);
- tran.offsetFromUtc = 46800;
- tran.standardTimeOffset = 43200;
+ tran.atUtc = QDateTime(QDate(2011, 4, 3), QTime(2, 0), Qt::OffsetFromUTC, 13 * 3600);
+ tran.offsetFromUtc = 13 * 3600;
+ tran.standardTimeOffset = 12 * 3600;
tran.daylightTimeOffset = 3600;
expected << tran;
- tran.atUtc = QDateTime::fromMSecsSinceEpoch(1316872800000, Qt::UTC);
- tran.offsetFromUtc = 43200;
- tran.standardTimeOffset = 43200;
+ tran.atUtc = QDateTime(QDate(2011, 9, 25), QTime(2, 0), Qt::OffsetFromUTC, 12 * 3600);
+ tran.offsetFromUtc = 12 * 3600;
+ tran.standardTimeOffset = 12 * 3600;
tran.daylightTimeOffset = 0;
expected << tran;
QTimeZone::OffsetDataList result = tz.transitions(janPrev, jan);
@@ -749,12 +759,13 @@ void tst_QTimeZone::icuTest()
}
testCetPrivate(tzp);
+ testEpochTranPrivate(QIcuTimeZonePrivate("America/Toronto"));
#endif // QT_USE_ICU
}
void tst_QTimeZone::tzTest()
{
-#if defined QT_BUILD_INTERNAL && defined Q_OS_UNIX && !defined Q_OS_MAC
+#if defined QT_BUILD_INTERNAL && defined Q_OS_UNIX && !defined Q_OS_DARWIN
// Known datetimes
qint64 std = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
qint64 dst = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
@@ -822,6 +833,7 @@ void tst_QTimeZone::tzTest()
}
testCetPrivate(tzp);
+ testEpochTranPrivate(QTzTimeZonePrivate("America/Toronto"));
// Test first and last transition rule
// Warning: This could vary depending on age of TZ file!
@@ -845,7 +857,8 @@ void tst_QTimeZone::tzTest()
}
dat = tzp.nextTransition(-9999999999999);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(dat.atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600),
+ QDateTime(QDate(1893, 4, 1), QTime(0, 6, 32), Qt::OffsetFromUTC, 3600));
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
@@ -855,37 +868,41 @@ void tst_QTimeZone::tzTest()
// Tets high dates use the POSIX rule
dat = tzp.data(stdHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)stdHi);
+ QCOMPARE(dat.atMSecsSinceEpoch - stdHi, (qint64)0);
QCOMPARE(dat.offsetFromUtc, 3600);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
dat = tzp.data(dstHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)dstHi);
+ QCOMPARE(dat.atMSecsSinceEpoch - dstHi, (qint64)0);
QCOMPARE(dat.offsetFromUtc, 7200);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 3600);
dat = tzp.previousTransition(stdHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)4096659600000);
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(dat.atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600),
+ QDateTime(QDate(2099, 10, 26), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(dat.offsetFromUtc, 3600);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
dat = tzp.previousTransition(dstHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)4109965200000);
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(dat.atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600),
+ QDateTime(QDate(2100, 3, 29), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(dat.offsetFromUtc, 7200);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 3600);
dat = tzp.nextTransition(stdHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)4109965200000);
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(dat.atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600),
+ QDateTime(QDate(2100, 3, 29), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(dat.offsetFromUtc, 7200);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 3600);
dat = tzp.nextTransition(dstHi);
- QCOMPARE(dat.atMSecsSinceEpoch, (qint64)4128109200000);
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(dat.atMSecsSinceEpoch, Qt::OffsetFromUTC, 3600),
+ QDateTime(QDate(2100, 10, 25), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(dat.offsetFromUtc, 3600);
QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
@@ -917,12 +934,12 @@ void tst_QTimeZone::tzTest()
QDateTime dt(QDate(2016, 3, 28), QTime(0, 0, 0), Qt::UTC);
QCOMPARE(tzBarnaul.data(dt.toMSecsSinceEpoch()).abbreviation, QString("+07"));
}
-#endif // Q_OS_UNIX
+#endif // QT_BUILD_INTERNAL && Q_OS_UNIX && !Q_OS_DARWIN
}
void tst_QTimeZone::macTest()
{
-#if defined(QT_BUILD_INTERNAL) && defined (Q_OS_MAC)
+#if defined(QT_BUILD_INTERNAL) && defined(Q_OS_DARWIN)
// Known datetimes
qint64 std = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
qint64 dst = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC).toMSecsSinceEpoch();
@@ -969,7 +986,8 @@ void tst_QTimeZone::macTest()
}
testCetPrivate(tzp);
-#endif // Q_OS_MAC
+ testEpochTranPrivate(QMacTimeZonePrivate("America/Toronto"));
+#endif // QT_BUILD_INTERNAL && Q_OS_DARWIN
}
void tst_QTimeZone::darwinTypes()
@@ -1034,6 +1052,7 @@ void tst_QTimeZone::winTest()
}
testCetPrivate(tzp);
+ testEpochTranPrivate(QWinTimeZonePrivate("America/Toronto"));
#endif // Q_OS_WIN
}
@@ -1076,50 +1095,103 @@ void tst_QTimeZone::testCetPrivate(const QTimeZonePrivate &tzp)
// Only test transitions if host system supports them
if (tzp.hasTransitions()) {
QTimeZonePrivate::Data tran = tzp.nextTransition(std);
- QCOMPARE(tran.atMSecsSinceEpoch, (qint64)1332637200000);
+ // 2012-03-25 02:00 CET, +1 -> +2
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC),
+ QDateTime(QDate(2012, 3, 25), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(tran.offsetFromUtc, 7200);
QCOMPARE(tran.standardTimeOffset, 3600);
QCOMPARE(tran.daylightTimeOffset, 3600);
tran = tzp.nextTransition(dst);
- QCOMPARE(tran.atMSecsSinceEpoch, (qint64)1351386000000);
+ // 2012-10-28 03:00 CEST, +2 -> +1
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC),
+ QDateTime(QDate(2012, 10, 28), QTime(3, 0), Qt::OffsetFromUTC, 2 * 3600));
QCOMPARE(tran.offsetFromUtc, 3600);
QCOMPARE(tran.standardTimeOffset, 3600);
QCOMPARE(tran.daylightTimeOffset, 0);
tran = tzp.previousTransition(std);
- QCOMPARE(tran.atMSecsSinceEpoch, (qint64)1319936400000);
+ // 2011-10-30 03:00 CEST, +2 -> +1
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC),
+ QDateTime(QDate(2011, 10, 30), QTime(3, 0), Qt::OffsetFromUTC, 2 * 3600));
QCOMPARE(tran.offsetFromUtc, 3600);
QCOMPARE(tran.standardTimeOffset, 3600);
QCOMPARE(tran.daylightTimeOffset, 0);
tran = tzp.previousTransition(dst);
- QCOMPARE(tran.atMSecsSinceEpoch, (qint64)1332637200000);
+ // 2012-03-25 02:00 CET, +1 -> +2 (again)
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC),
+ QDateTime(QDate(2012, 3, 25), QTime(2, 0), Qt::OffsetFromUTC, 3600));
QCOMPARE(tran.offsetFromUtc, 7200);
QCOMPARE(tran.standardTimeOffset, 3600);
QCOMPARE(tran.daylightTimeOffset, 3600);
QTimeZonePrivate::DataList expected;
- tran.atMSecsSinceEpoch = (qint64)1301752800000;
+ // 2011-03-27 02:00 CET, +1 -> +2
+ tran.atMSecsSinceEpoch = QDateTime(QDate(2011, 3, 27), QTime(2, 0),
+ Qt::OffsetFromUTC, 3600).toMSecsSinceEpoch();
tran.offsetFromUtc = 7200;
tran.standardTimeOffset = 3600;
tran.daylightTimeOffset = 3600;
expected << tran;
- tran.atMSecsSinceEpoch = (qint64)1316872800000;
+ // 2011-10-30 03:00 CEST, +2 -> +1
+ tran.atMSecsSinceEpoch = QDateTime(QDate(2011, 10, 30), QTime(3, 0),
+ Qt::OffsetFromUTC, 2 * 3600).toMSecsSinceEpoch();
tran.offsetFromUtc = 3600;
tran.standardTimeOffset = 3600;
tran.daylightTimeOffset = 0;
expected << tran;
QTimeZonePrivate::DataList result = tzp.transitions(prev, std);
QCOMPARE(result.count(), expected.count());
- for (int i = 0; i > expected.count(); ++i) {
- QCOMPARE(result.at(i).atMSecsSinceEpoch, expected.at(i).atMSecsSinceEpoch);
+ for (int i = 0; i < expected.count(); ++i) {
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(result.at(i).atMSecsSinceEpoch,
+ Qt::OffsetFromUTC, 3600),
+ QDateTime::fromMSecsSinceEpoch(expected.at(i).atMSecsSinceEpoch,
+ Qt::OffsetFromUTC, 3600));
QCOMPARE(result.at(i).offsetFromUtc, expected.at(i).offsetFromUtc);
QCOMPARE(result.at(i).standardTimeOffset, expected.at(i).standardTimeOffset);
QCOMPARE(result.at(i).daylightTimeOffset, expected.at(i).daylightTimeOffset);
}
}
}
+
+// Needs a zone with DST around the epoch; currently America/Toronto (EST5EDT)
+void tst_QTimeZone::testEpochTranPrivate(const QTimeZonePrivate &tzp)
+{
+ if (!tzp.hasTransitions())
+ return; // test only viable for transitions
+
+ QTimeZonePrivate::Data tran = tzp.nextTransition(0); // i.e. first after epoch
+ // 1970-04-26 02:00 EST, -5 -> -4
+ const QDateTime after = QDateTime(QDate(1970, 4, 26), QTime(2, 0), Qt::OffsetFromUTC, -5 * 3600);
+ const QDateTime found = QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC);
+#ifdef Q_OS_WIN // MS gets the date wrong: 5th April instead of 26th.
+ QCOMPARE(found.toOffsetFromUtc(-5 * 3600).time(), after.time());
+#else
+ QCOMPARE(found, after);
+#endif
+ QCOMPARE(tran.offsetFromUtc, -4 * 3600);
+ QCOMPARE(tran.standardTimeOffset, -5 * 3600);
+ QCOMPARE(tran.daylightTimeOffset, 3600);
+
+ // Pre-epoch time-zones might not be supported at all:
+ tran = tzp.nextTransition(QDateTime(QDate(1601, 1, 1), QTime(0, 0),
+ Qt::UTC).toMSecsSinceEpoch());
+ if (tran.atMSecsSinceEpoch != QTimeZonePrivate::invalidSeconds()
+ && tran.atMSecsSinceEpoch < 0) {
+ // ... but, if they are, we should be able to search back to them:
+ tran = tzp.previousTransition(0); // i.e. last before epoch
+ // 1969-10-26 02:00 EDT, -4 -> -5
+ QCOMPARE(QDateTime::fromMSecsSinceEpoch(tran.atMSecsSinceEpoch, Qt::UTC),
+ QDateTime(QDate(1969, 10, 26), QTime(2, 0), Qt::OffsetFromUTC, -4 * 3600));
+ QCOMPARE(tran.offsetFromUtc, -5 * 3600);
+ QCOMPARE(tran.standardTimeOffset, -5 * 3600);
+ QCOMPARE(tran.daylightTimeOffset, 0);
+ } else {
+ // Do not use QSKIP(): that would discard the rest of this sub-test's caller.
+ qDebug() << "No support for pre-epoch time-zone transitions";
+ }
+}
#endif // QT_BUILD_INTERNAL
QTEST_APPLESS_MAIN(tst_QTimeZone)
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index 0806ad1318..3971353cbb 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -30,8 +30,6 @@
#include <qvarlengtharray.h>
#include <qvariant.h>
-const int N = 1;
-
class tst_QVarLengthArray : public QObject
{
Q_OBJECT
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index 2e34e82388..9812d93a50 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -513,6 +513,14 @@ void tst_QVersionNumber::fromString()
QCOMPARE(QVersionNumber::fromString(constructionString), expectedVersion);
QCOMPARE(QVersionNumber::fromString(constructionString, &index), expectedVersion);
QCOMPARE(index, suffixIndex);
+
+ QCOMPARE(QVersionNumber::fromString(QStringView(constructionString)), expectedVersion);
+ QCOMPARE(QVersionNumber::fromString(QStringView(constructionString), &index), expectedVersion);
+ QCOMPARE(index, suffixIndex);
+
+ QCOMPARE(QVersionNumber::fromString(QLatin1String(constructionString.toLatin1())), expectedVersion);
+ QCOMPARE(QVersionNumber::fromString(QLatin1String(constructionString.toLatin1()), &index), expectedVersion);
+ QCOMPARE(index, suffixIndex);
}
void tst_QVersionNumber::toString_data()
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index e45771a704..f35ed026ac 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -1,6 +1,7 @@
TEMPLATE=subdirs
SUBDIRS=\
collections \
+ containerapisymmetry \
qalgorithms \
qarraydata \
qarraydata_strictiterators \
@@ -56,6 +57,7 @@ SUBDIRS=\
qstringlist \
qstringmatcher \
qstringref \
+ qstringview \
qtextboundaryfinder \
qtime \
qtimezone \
@@ -65,3 +67,4 @@ SUBDIRS=\
qvector_strictiterators \
qversionnumber
+darwin: SUBDIRS += qmacautoreleasepool
diff --git a/tests/auto/gui/gui.pro b/tests/auto/gui/gui.pro
index 2fd3024afe..d7cda11513 100644
--- a/tests/auto/gui/gui.pro
+++ b/tests/auto/gui/gui.pro
@@ -9,8 +9,11 @@ SUBDIRS = \
painting \
qopenglconfig \
qopengl \
+ qvulkan \
text \
util \
itemmodels \
!qtConfig(opengl): SUBDIRS -= qopengl qopenglconfig
+
+!qtConfig(vulkan): SUBDIRS -= qvulkan
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp
index 175179699d..bf8f7ade9e 100644
--- a/tests/auto/gui/image/qicon/tst_qicon.cpp
+++ b/tests/auto/gui/image/qicon/tst_qicon.cpp
@@ -530,16 +530,6 @@ void tst_QIcon::streamAvailableSizes()
}
}
-
-static inline bool operator<(const QSize &lhs, const QSize &rhs)
-{
- if (lhs.width() < rhs.width())
- return true;
- else if (lhs.width() == lhs.width())
- return lhs.height() < lhs.height();
- return false;
-}
-
#ifndef QT_NO_WIDGETS
void tst_QIcon::task184901_badCache()
{
diff --git a/tests/auto/gui/image/qiconhighdpi/icons/misc/button.9.png b/tests/auto/gui/image/qiconhighdpi/icons/misc/button.9.png
new file mode 100644
index 0000000000..1a560a1d74
--- /dev/null
+++ b/tests/auto/gui/image/qiconhighdpi/icons/misc/button.9.png
Binary files differ
diff --git a/tests/auto/gui/image/qiconhighdpi/icons/misc/button@2x.9.png b/tests/auto/gui/image/qiconhighdpi/icons/misc/button@2x.9.png
new file mode 100644
index 0000000000..f010dc55c7
--- /dev/null
+++ b/tests/auto/gui/image/qiconhighdpi/icons/misc/button@2x.9.png
Binary files differ
diff --git a/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.cpp b/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.cpp
index ce7f68a0a6..51892cca04 100644
--- a/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.cpp
+++ b/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.cpp
@@ -39,6 +39,7 @@ private slots:
void initTestCase();
void fromTheme_data();
void fromTheme();
+ void ninePatch();
};
tst_QIconHighDpi::tst_QIconHighDpi()
@@ -182,6 +183,24 @@ void tst_QIconHighDpi::fromTheme()
QCOMPARE(pixmap.devicePixelRatio(), expectedDpr);
}
+void tst_QIconHighDpi::ninePatch()
+{
+ const QIcon icon(":/icons/misc/button.9.png");
+ const int dpr = qCeil(qApp->devicePixelRatio());
+
+ switch (dpr) {
+ case 1:
+ QCOMPARE(icon.availableSizes().size(), 1);
+ QCOMPARE(icon.availableSizes().at(0), QSize(42, 42));
+ break;
+ case 2:
+ QCOMPARE(icon.availableSizes().size(), 2);
+ QCOMPARE(icon.availableSizes().at(0), QSize(42, 42));
+ QCOMPARE(icon.availableSizes().at(1), QSize(82, 82));
+ break;
+ }
+}
+
int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
diff --git a/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.qrc b/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.qrc
index 80b5e38ee6..5cc1c6d9b1 100644
--- a/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.qrc
+++ b/tests/auto/gui/image/qiconhighdpi/tst_qiconhighdpi.qrc
@@ -4,5 +4,7 @@
<file>icons/testtheme/22x22/actions/appointment-new.png</file>
<file>icons/testtheme/index.theme</file>
<file>icons/testtheme/22x22@2/actions/appointment-new.png</file>
+ <file>icons/misc/button.9.png</file>
+ <file>icons/misc/button@2x.9.png</file>
</qresource>
</RCC>
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 73e11e7cc7..54eb8ab99c 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -33,6 +33,7 @@
#include <qimagereader.h>
#include <qlist.h>
#include <qmatrix.h>
+#include <qrandom.h>
#include <stdio.h>
#include <qpainter.h>
@@ -219,69 +220,71 @@ private slots:
void toCGImage();
#endif
+ void hugeQImage();
+
private:
const QString m_prefix;
};
-static QString formatToString(QImage::Format format)
+static QLatin1String formatToString(QImage::Format format)
{
switch (format) {
case QImage::Format_Invalid:
- return QStringLiteral("Invalid");
+ return QLatin1String("Invalid");
case QImage::Format_Mono:
- return QStringLiteral("Mono");
+ return QLatin1String("Mono");
case QImage::Format_MonoLSB:
- return QStringLiteral("MonoLSB");
+ return QLatin1String("MonoLSB");
case QImage::Format_Indexed8:
- return QStringLiteral("Indexed8");
+ return QLatin1String("Indexed8");
case QImage::Format_RGB32:
- return QStringLiteral("RGB32");
+ return QLatin1String("RGB32");
case QImage::Format_ARGB32:
- return QStringLiteral("ARGB32");
+ return QLatin1String("ARGB32");
case QImage::Format_ARGB32_Premultiplied:
- return QStringLiteral("ARGB32pm");
+ return QLatin1String("ARGB32pm");
case QImage::Format_RGB16:
- return QStringLiteral("RGB16");
+ return QLatin1String("RGB16");
case QImage::Format_ARGB8565_Premultiplied:
- return QStringLiteral("ARGB8565pm");
+ return QLatin1String("ARGB8565pm");
case QImage::Format_RGB666:
- return QStringLiteral("RGB666");
+ return QLatin1String("RGB666");
case QImage::Format_ARGB6666_Premultiplied:
- return QStringLiteral("ARGB6666pm");
+ return QLatin1String("ARGB6666pm");
case QImage::Format_RGB555:
- return QStringLiteral("RGB555");
+ return QLatin1String("RGB555");
case QImage::Format_ARGB8555_Premultiplied:
- return QStringLiteral("ARGB8555pm");
+ return QLatin1String("ARGB8555pm");
case QImage::Format_RGB888:
- return QStringLiteral("RGB888");
+ return QLatin1String("RGB888");
case QImage::Format_RGB444:
- return QStringLiteral("RGB444");
+ return QLatin1String("RGB444");
case QImage::Format_ARGB4444_Premultiplied:
- return QStringLiteral("ARGB4444pm");
+ return QLatin1String("ARGB4444pm");
case QImage::Format_RGBX8888:
- return QStringLiteral("RGBx88888");
+ return QLatin1String("RGBx88888");
case QImage::Format_RGBA8888:
- return QStringLiteral("RGBA88888");
+ return QLatin1String("RGBA88888");
case QImage::Format_RGBA8888_Premultiplied:
- return QStringLiteral("RGBA88888pm");
+ return QLatin1String("RGBA88888pm");
case QImage::Format_BGR30:
- return QStringLiteral("BGR30");
+ return QLatin1String("BGR30");
case QImage::Format_A2BGR30_Premultiplied:
- return QStringLiteral("A2BGR30pm");
+ return QLatin1String("A2BGR30pm");
case QImage::Format_RGB30:
- return QStringLiteral("RGB30");
+ return QLatin1String("RGB30");
case QImage::Format_A2RGB30_Premultiplied:
- return QStringLiteral("A2RGB30pm");
+ return QLatin1String("A2RGB30pm");
case QImage::Format_Alpha8:
- return QStringLiteral("Alpha8");
+ return QLatin1String("Alpha8");
case QImage::Format_Grayscale8:
- return QStringLiteral("Grayscale8");
+ return QLatin1String("Grayscale8");
default:
break;
};
Q_UNREACHABLE();
qWarning("Unhandled image format");
- return QStringLiteral("unknown");
+ return QLatin1String("unknown");
}
tst_QImage::tst_QImage()
@@ -315,8 +318,7 @@ void tst_QImage::create()
{
bool cr = true;
QT_TRY {
- //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian);
- QImage image(7000000, 7000000, QImage::Format_Indexed8);
+ QImage image(700000000, 70000000, QImage::Format_Indexed8);
image.setColorCount(256);
cr = !image.isNull();
} QT_CATCH (...) {
@@ -1753,7 +1755,7 @@ void tst_QImage::smoothScale2()
static inline int rand8()
{
- return int(256. * (qrand() / (RAND_MAX + 1.0)));
+ return QRandomGenerator::global()->bounded(256);
}
void tst_QImage::smoothScale3_data()
@@ -2334,7 +2336,7 @@ void tst_QImage::rgbSwapped_data()
QTest::addColumn<QImage::Format>("format");
for (int i = QImage::Format_Indexed8; i < QImage::Format_Alpha8; ++i) {
- QTest::newRow(qPrintable(formatToString(QImage::Format(i)))) << QImage::Format(i);
+ QTest::addRow("%s", formatToString(QImage::Format(i)).data()) << QImage::Format(i);
}
}
@@ -2379,7 +2381,7 @@ void tst_QImage::rgbSwapped()
QCOMPARE(image, imageSwappedTwice);
- QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.byteCount()), 0);
+ QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.sizeInBytes()), 0);
}
void tst_QImage::mirrored_data()
@@ -2491,7 +2493,7 @@ void tst_QImage::mirrored()
QCOMPARE(image, imageMirroredTwice);
if (format != QImage::Format_Mono && format != QImage::Format_MonoLSB)
- QCOMPARE(memcmp(image.constBits(), imageMirroredTwice.constBits(), image.byteCount()), 0);
+ QCOMPARE(memcmp(image.constBits(), imageMirroredTwice.constBits(), image.sizeInBytes()), 0);
else {
for (int i = 0; i < image.height(); ++i)
for (int j = 0; j < image.width(); ++j)
@@ -2553,8 +2555,8 @@ void tst_QImage::inplaceRgbSwapped()
QImage dataSwapped;
{
QVERIFY(!orig.isNull());
- volatileData = new uchar[orig.byteCount()];
- memcpy(volatileData, orig.constBits(), orig.byteCount());
+ volatileData = new uchar[orig.sizeInBytes()];
+ memcpy(volatileData, orig.constBits(), orig.sizeInBytes());
QImage dataImage;
if (rw)
@@ -2589,11 +2591,12 @@ void tst_QImage::inplaceMirrored_data()
continue;
if (i == QImage::Format_RGB444 || i == QImage::Format_ARGB4444_Premultiplied)
continue;
- QTest::newRow(qPrintable(formatToString(QImage::Format(i)) + QStringLiteral(", vertical")))
+ const auto fmt = formatToString(QImage::Format(i));
+ QTest::addRow("%s, vertical", fmt.data())
<< QImage::Format(i) << true << false;
- QTest::newRow(qPrintable(formatToString(QImage::Format(i)) + QStringLiteral(", horizontal")))
+ QTest::addRow("%s, horizontal", fmt.data())
<< QImage::Format(i) << false << true;
- QTest::newRow(qPrintable(formatToString(QImage::Format(i)) + QStringLiteral(", horizontal+vertical")))
+ QTest::addRow("%s, horizontal+vertical", fmt.data())
<< QImage::Format(i) << true << true;
}
}
@@ -2664,8 +2667,8 @@ void tst_QImage::inplaceMirrored()
QImage dataSwapped;
{
QVERIFY(!orig.isNull());
- volatileData = new uchar[orig.byteCount()];
- memcpy(volatileData, orig.constBits(), orig.byteCount());
+ volatileData = new uchar[orig.sizeInBytes()];
+ memcpy(volatileData, orig.constBits(), orig.sizeInBytes());
QImage dataImage;
if (rw)
@@ -2757,12 +2760,12 @@ void tst_QImage::genericRgbConversion_data()
QTest::addColumn<QImage::Format>("dest_format");
for (int i = QImage::Format_RGB32; i < QImage::Format_Alpha8; ++i) {
- const QString formatI = formatToString(QImage::Format(i));
+ const QLatin1String formatI = formatToString(QImage::Format(i));
for (int j = QImage::Format_RGB32; j < QImage::Format_Alpha8; ++j) {
if (i == j)
continue;
- const QString test = formatI + QLatin1String(" -> ") + formatToString(QImage::Format(j));
- QTest::newRow(qPrintable(test)) << QImage::Format(i) << QImage::Format(j);
+ QTest::addRow("%s -> %s", formatI.data(), formatToString(QImage::Format(j)).data())
+ << QImage::Format(i) << QImage::Format(j);
}
}
}
@@ -2799,8 +2802,8 @@ void tst_QImage::inplaceRgbConversion_data()
for (int j = QImage::Format_RGB32; j < QImage::Format_Alpha8; ++j) {
if (i == j)
continue;
- QString test = QString::fromLatin1("%1 -> %2").arg(formatToString(QImage::Format(i))).arg(formatToString(QImage::Format(j)));
- QTest::newRow(qPrintable(test)) << QImage::Format(i) << QImage::Format(j);
+ QTest::addRow("%s -> %s", formatToString(QImage::Format(i)).data(), formatToString(QImage::Format(j)).data())
+ << QImage::Format(i) << QImage::Format(j);
}
}
}
@@ -2966,7 +2969,7 @@ void tst_QImage::invertPixelsRGB_data()
QTest::addColumn<QImage::Format>("image_format");
for (int i = QImage::Format_RGB32; i < QImage::Format_Alpha8; ++i) {
- QTest::newRow(qPrintable(formatToString(QImage::Format(i)))) << QImage::Format(i);
+ QTest::addRow("%s", formatToString(QImage::Format(i)).data()) << QImage::Format(i);
}
}
@@ -3143,10 +3146,10 @@ void tst_QImage::rgb30Repremul_data()
{
QTest::addColumn<uint>("color");
for (int i = 255; i > 0; i -= 15) {
- QTest::newRow(qPrintable(QStringLiteral("100% red=") + QString::number(i))) << qRgba(i, 0, 0, 0xff);
- QTest::newRow(qPrintable(QStringLiteral("75% red=") + QString::number(i))) << qRgba(i, 0, 0, 0xc0);
- QTest::newRow(qPrintable(QStringLiteral("50% red=") + QString::number(i))) << qRgba(i, 0, 0, 0x80);
- QTest::newRow(qPrintable(QStringLiteral("37.5% red=") + QString::number(i))) << qRgba(i, 0, 0, 0x60);
+ QTest::addRow("100%% red=%d", i) << qRgba(i, 0, 0, 0xff);
+ QTest::addRow("75%% red=%d", i) << qRgba(i, 0, 0, 0xc0);
+ QTest::addRow("50%% red=%d", i) << qRgba(i, 0, 0, 0x80);
+ QTest::addRow("37.5%% red=%d", i) << qRgba(i, 0, 0, 0x60);
}
}
@@ -3406,7 +3409,7 @@ void tst_QImage::toCGImage_data()
QImage::Format_RGBA8888, QImage::Format_RGBX8888, QImage::Format_ARGB32_Premultiplied };
for (int i = QImage::Format_Invalid; i < QImage::Format_Grayscale8; ++i) {
- QTest::newRow(qPrintable(formatToString(QImage::Format(i))))
+ QTest::addRow("%s", formatToString(QImage::Format(i)).data())
<< QImage::Format(i) << supported.contains(QImage::Format(i));
}
}
@@ -3428,6 +3431,32 @@ void tst_QImage::toCGImage()
#endif
+void tst_QImage::hugeQImage()
+{
+#if Q_PROCESSOR_WORDSIZE < 8
+ QSKIP("Test only makes sense on 64-bit machines");
+#else
+ QImage image(25000, 25000, QImage::Format_RGB32);
+
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.height(), 25000);
+ QCOMPARE(image.width(), 25000);
+ QCOMPARE(image.sizeInBytes(), qssize_t(25000)*25000*4);
+ QCOMPARE(image.bytesPerLine(), 25000 * 4);
+
+ QCOMPARE(image.constScanLine(24990), image.constBits() + qssize_t(25000)*24990*4);
+
+ image.setPixel(20000, 24990, 0xffaabbcc);
+ QCOMPARE(image.pixel(20000, 24990), 0xffaabbcc);
+ QCOMPARE((reinterpret_cast<const unsigned int *>(image.constScanLine(24990)))[20000], 0xffaabbcc);
+
+ QImage canvas(100, 100, QImage::Format_RGB32);
+ QPainter painter(&canvas);
+ painter.drawImage(0,0, image, 19950, 24900, 100, 100);
+ painter.end();
+ QCOMPARE(reinterpret_cast<const unsigned int *>(canvas.constScanLine(90))[50], 0xffaabbcc);
+#endif
+}
QTEST_GUILESS_MAIN(tst_QImage)
#include "tst_qimage.moc"
diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
index d5c624833c..a53c2ddb5b 100644
--- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp
@@ -77,6 +77,9 @@ private slots:
void saveWithNoFormat();
void saveToTemporaryFile();
+
+ void writeEmpty();
+
private:
QTemporaryDir m_temporaryDir;
QString prefix;
@@ -463,7 +466,7 @@ void tst_QImageWriter::saveWithNoFormat()
SKIP_IF_UNSUPPORTED(format);
QImage niceImage(64, 64, QImage::Format_ARGB32);
- memset(niceImage.bits(), 0, niceImage.byteCount());
+ memset(niceImage.bits(), 0, niceImage.sizeInBytes());
QImageWriter writer(fileName /* , 0 - no format! */);
if (error != 0) {
@@ -529,5 +532,18 @@ void tst_QImageWriter::saveToTemporaryFile()
}
}
+void tst_QImageWriter::writeEmpty()
+{
+ // check writing a null QImage errors gracefully
+ QTemporaryDir dir;
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
+ QString fileName(dir.path() + QLatin1String("/testimage.bmp"));
+ QVERIFY(!QFileInfo(fileName).exists());
+ QImageWriter writer(fileName);
+ QVERIFY(!writer.write(QImage()));
+ QCOMPARE(writer.error(), QImageWriter::InvalidImageError);
+ QVERIFY(!QFileInfo(fileName).exists());
+}
+
QTEST_MAIN(tst_QImageWriter)
#include "tst_qimagewriter.moc"
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index 559395a9ae..46786262c0 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -2,6 +2,7 @@ TEMPLATE=subdirs
SUBDIRS=\
qbackingstore \
qclipboard \
+ qcursor \
qdrag \
qevent \
qfileopenevent \
diff --git a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
index 37d97cd3db..4fca9a07fc 100644
--- a/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
+++ b/tests/auto/gui/kernel/noqteventloop/tst_noqteventloop.cpp
@@ -64,7 +64,7 @@ public:
m_received.clear();
}
- bool event(QEvent *event)
+ bool event(QEvent *event) override
{
m_received[event->type()]++;
return QWindow::event(event);
diff --git a/tests/auto/gui/kernel/qcursor/qcursor.pro b/tests/auto/gui/kernel/qcursor/qcursor.pro
new file mode 100644
index 0000000000..16e7d7c41c
--- /dev/null
+++ b/tests/auto/gui/kernel/qcursor/qcursor.pro
@@ -0,0 +1,6 @@
+QT += testlib
+TARGET = tst_qcursor
+CONFIG += testcase
+CONFIG -= app_bundle
+
+SOURCES += tst_qcursor.cpp
diff --git a/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp b/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp
new file mode 100644
index 0000000000..d505f5a655
--- /dev/null
+++ b/tests/auto/gui/kernel/qcursor/tst_qcursor.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <qcursor.h>
+#include <qpixmap.h>
+#include <qbitmap.h>
+
+class tst_QCursor : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void equality();
+};
+
+#define VERIFY_EQUAL(lhs, rhs) \
+ QVERIFY(lhs == rhs); \
+ QVERIFY(rhs == lhs); \
+ QVERIFY(!(rhs != lhs)); \
+ QVERIFY(!(lhs != rhs))
+
+#define VERIFY_DIFFERENT(lhs, rhs) \
+ QVERIFY(lhs != rhs); \
+ QVERIFY(rhs != lhs); \
+ QVERIFY(!(rhs == lhs)); \
+ QVERIFY(!(lhs == rhs))
+
+void tst_QCursor::equality()
+{
+ VERIFY_EQUAL(QCursor(), QCursor());
+ VERIFY_EQUAL(QCursor(Qt::CrossCursor), QCursor(Qt::CrossCursor));
+ VERIFY_DIFFERENT(QCursor(Qt::CrossCursor), QCursor());
+
+ // Shape
+ QCursor shapeCursor(Qt::WaitCursor);
+ VERIFY_EQUAL(shapeCursor, shapeCursor);
+ QCursor shapeCursorCopy(shapeCursor);
+ VERIFY_EQUAL(shapeCursor, shapeCursorCopy);
+ shapeCursorCopy.setShape(Qt::DragMoveCursor);
+ VERIFY_DIFFERENT(shapeCursor, shapeCursorCopy);
+ shapeCursorCopy.setShape(shapeCursor.shape());
+ VERIFY_EQUAL(shapeCursor, shapeCursorCopy);
+
+ // Pixmap
+ QPixmap pixmap(16, 16);
+ QCursor pixmapCursor(pixmap);
+ VERIFY_EQUAL(pixmapCursor, pixmapCursor);
+ VERIFY_EQUAL(pixmapCursor, QCursor(pixmapCursor));
+ VERIFY_EQUAL(pixmapCursor, QCursor(pixmap));
+ VERIFY_DIFFERENT(pixmapCursor, QCursor());
+ VERIFY_DIFFERENT(pixmapCursor, QCursor(pixmap, 5, 5));
+ VERIFY_DIFFERENT(pixmapCursor, QCursor(QPixmap(16, 16)));
+ VERIFY_DIFFERENT(pixmapCursor, shapeCursor);
+
+ // Bitmap & mask
+ QBitmap bitmap(16, 16);
+ QBitmap mask(16, 16);
+ QCursor bitmapCursor(bitmap, mask);
+ VERIFY_EQUAL(bitmapCursor, bitmapCursor);
+ VERIFY_EQUAL(bitmapCursor, QCursor(bitmapCursor));
+ VERIFY_EQUAL(bitmapCursor, QCursor(bitmap, mask));
+ VERIFY_DIFFERENT(bitmapCursor, QCursor());
+ VERIFY_DIFFERENT(bitmapCursor, QCursor(bitmap, mask, 5, 5));
+ VERIFY_DIFFERENT(bitmapCursor, QCursor(bitmap, QBitmap(16, 16)));
+ VERIFY_DIFFERENT(bitmapCursor, QCursor(QBitmap(16, 16), mask));
+ VERIFY_DIFFERENT(bitmapCursor, shapeCursor);
+ VERIFY_DIFFERENT(bitmapCursor, pixmapCursor);
+
+ // Empty pixmap
+ QPixmap emptyPixmap;
+ QCursor emptyPixmapCursor(emptyPixmap);
+ QCOMPARE(emptyPixmapCursor.shape(), Qt::ArrowCursor);
+ VERIFY_EQUAL(emptyPixmapCursor, QCursor());
+ VERIFY_EQUAL(emptyPixmapCursor, QCursor(emptyPixmap, 5, 5));
+ VERIFY_DIFFERENT(emptyPixmapCursor, shapeCursor);
+ VERIFY_DIFFERENT(emptyPixmapCursor, pixmapCursor);
+ VERIFY_DIFFERENT(emptyPixmapCursor, bitmapCursor);
+
+ // Empty bitmap & mask
+ QBitmap emptyBitmap;
+ QCursor emptyBitmapCursor(emptyBitmap, emptyBitmap);
+ QCOMPARE(emptyBitmapCursor.shape(), Qt::ArrowCursor);
+ VERIFY_EQUAL(emptyBitmapCursor, QCursor());
+ VERIFY_EQUAL(emptyBitmapCursor, QCursor(emptyBitmap, emptyBitmap, 5, 5));
+ VERIFY_EQUAL(emptyBitmapCursor, QCursor(emptyBitmap, mask));
+ VERIFY_EQUAL(emptyBitmapCursor, QCursor(bitmap, emptyBitmap));
+ VERIFY_EQUAL(emptyBitmapCursor, emptyPixmapCursor);
+ VERIFY_DIFFERENT(emptyBitmapCursor, shapeCursor);
+ VERIFY_DIFFERENT(emptyBitmapCursor, pixmapCursor);
+ VERIFY_DIFFERENT(emptyBitmapCursor, bitmapCursor);
+}
+
+#undef VERIFY_EQUAL
+#undef VERIFY_DIFFERENT
+
+QTEST_MAIN(tst_QCursor)
+#include "tst_qcursor.moc"
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index a935258fb8..6ba488aaa7 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -227,7 +227,7 @@ void tst_QGuiApplication::focusObject()
QOpenGLContext context;
context.create();
context.makeCurrent(&window1);
- QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window
+ QVERIFY(QTest::qWaitForWindowExposed(&window1)); // Buffer swap only succeeds with exposed window
context.swapBuffers(&window1);
#endif
@@ -392,7 +392,7 @@ void tst_QGuiApplication::changeFocusWindow()
QOpenGLContext context;
context.create();
context.makeCurrent(&window1);
- QTest::qWaitForWindowExposed(&window1); // Buffer swap only succeeds with exposed window
+ QVERIFY(QTest::qWaitForWindowExposed(&window1)); // Buffer swap only succeeds with exposed window
context.swapBuffers(&window1);
#endif
FocusChangeWindow window2;
@@ -406,7 +406,7 @@ void tst_QGuiApplication::changeFocusWindow()
#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store
// and then post the window in order for screen to show the window
context.makeCurrent(&window2);
- QTest::qWaitForWindowExposed(&window2); // Buffer swap only succeeds with exposed window
+ QVERIFY(QTest::qWaitForWindowExposed(&window2)); // Buffer swap only succeeds with exposed window
context.swapBuffers(&window2);
#endif
QVERIFY(QTest::qWaitForWindowExposed(&window1));
diff --git a/tests/auto/gui/kernel/qguitimer/qguitimer.pro b/tests/auto/gui/kernel/qguitimer/qguitimer.pro
index 8a71e48007..9c58f0e22c 100644
--- a/tests/auto/gui/kernel/qguitimer/qguitimer.pro
+++ b/tests/auto/gui/kernel/qguitimer/qguitimer.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_qguitimer
-QT = core gui testlib
+QT = core core-private gui testlib
SOURCES += ../../../corelib/kernel/qtimer/tst_qtimer.cpp
diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
index 6394a956bd..f8b6bf064a 100644
--- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
+++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp
@@ -36,14 +36,18 @@
#include <QLibraryInfo>
#ifdef Q_OS_MAC
-#ifdef Q_OS_OSX
-#include <Carbon/Carbon.h>
-#endif
struct MacSpecialKey {
int key;
ushort macSymbol;
};
+// Unicode code points for the glyphs associated with these keys
+// Defined by Carbon headers but not anywhere in Cocoa
+static const int kShiftUnicode = 0x21E7;
+static const int kControlUnicode = 0x2303;
+static const int kOptionUnicode = 0x2325;
+static const int kCommandUnicode = 0x2318;
+
static const int NumEntries = 21;
static const MacSpecialKey entries[NumEntries] = {
{ Qt::Key_Escape, 0x238B },
@@ -61,12 +65,10 @@ static const MacSpecialKey entries[NumEntries] = {
{ Qt::Key_Down, 0x2193 },
{ Qt::Key_PageUp, 0x21DE },
{ Qt::Key_PageDown, 0x21DF },
-#ifdef Q_OS_OSX
{ Qt::Key_Shift, kShiftUnicode },
{ Qt::Key_Control, kCommandUnicode },
{ Qt::Key_Meta, kControlUnicode },
{ Qt::Key_Alt, kOptionUnicode },
-#endif
{ Qt::Key_CapsLock, 0x21EA },
};
diff --git a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
index 58dee6f6ca..d882dc3888 100644
--- a/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
+++ b/tests/auto/gui/kernel/qopenglwindow/tst_qopenglwindow.cpp
@@ -62,7 +62,7 @@ void tst_QOpenGLWindow::create()
w.resize(640, 480);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(w.isValid());
}
@@ -111,7 +111,7 @@ void tst_QOpenGLWindow::basic()
w.reset();
w.resize(640, 480);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
// Check that the virtuals are invoked.
QCOMPARE(w.initCount, 1);
@@ -170,7 +170,7 @@ void tst_QOpenGLWindow::painter()
PainterWindow w;
w.resize(400, 400);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QCOMPARE(w.img.size(), w.size() * w.devicePixelRatio());
QVERIFY(w.img.pixel(QPoint(5, 5) * w.devicePixelRatio()) == qRgb(0, 0, 255));
@@ -212,7 +212,7 @@ void tst_QOpenGLWindow::partial()
PartialPainterWindow w(u);
w.resize(800, 400);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
// Add a couple of small blue rects.
for (int i = 0; i < 10; ++i) {
@@ -285,7 +285,7 @@ void tst_QOpenGLWindow::underOver()
PaintUnderOverWindow w;
w.resize(400, 400);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
// under -> paint -> over -> under -> paint -> ... is the only acceptable sequence
QCOMPARE(w.m_state, PaintUnderOverWindow::PaintOver);
diff --git a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
index 41fcdf9f30..3421622fe3 100644
--- a/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
+++ b/tests/auto/gui/kernel/qrasterwindow/tst_qrasterwindow.cpp
@@ -46,7 +46,7 @@ void tst_QRasterWindow::create()
w.resize(640, 480);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
}
class PainterWindow : public QRasterWindow
@@ -70,7 +70,7 @@ void tst_QRasterWindow::basic()
w.reset();
w.resize(400, 400);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));;
QVERIFY(w.paintCount >= 1);
diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST
index 1a4885b895..3e03d9e236 100644
--- a/tests/auto/gui/kernel/qwindow/BLACKLIST
+++ b/tests/auto/gui/kernel/qwindow/BLACKLIST
@@ -19,5 +19,9 @@ ubuntu-16.04
osx
[modalWindowModallity]
osx
+[visibility]
+osx-10.11 ci
+osx-10.12 ci
+
[testInputEvents]
rhel-7.4
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 6452b9ecd0..039d095ce6 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -269,12 +269,21 @@ class Window : public QWindow
{
public:
Window(const Qt::WindowFlags flags = Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
+ : QWindow(), lastReceivedWindowState(windowState())
{
reset();
setFlags(flags);
#if defined(Q_OS_QNX)
setSurfaceType(QSurface::OpenGLSurface);
#endif
+
+#if !defined(Q_OS_MACOS)
+ // FIXME: All platforms should send window-state change events, regardless
+ // of the sync/async nature of the the underlying platform, but they don't.
+ connect(this, &QWindow::windowStateChanged, [=]() {
+ lastReceivedWindowState = windowState();
+ });
+#endif
}
void reset()
@@ -299,6 +308,10 @@ public:
case QEvent::Move:
m_framePositionsOnMove << framePosition();
break;
+
+ case QEvent::WindowStateChange:
+ lastReceivedWindowState = windowState();
+
default:
break;
}
@@ -327,6 +340,8 @@ public:
}
QVector<QPoint> m_framePositionsOnMove;
+ Qt::WindowStates lastReceivedWindowState;
+
private:
QHash<QEvent::Type, int> m_received;
QVector<QEvent::Type> m_order;
@@ -475,7 +490,7 @@ void tst_QWindow::positioning()
window.showNormal();
QCoreApplication::processEvents();
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QMargins originalMargins = window.frameMargins();
@@ -487,17 +502,15 @@ void tst_QWindow::positioning()
window.reset();
window.setWindowState(Qt::WindowFullScreen);
- QCoreApplication::processEvents();
+ QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowFullScreen);
QTRY_VERIFY(window.received(QEvent::Resize) > 0);
- QTest::qWait(2000);
window.reset();
window.setWindowState(Qt::WindowNoState);
- QCoreApplication::processEvents();
+ QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowNoState);
QTRY_VERIFY(window.received(QEvent::Resize) > 0);
- QTest::qWait(2000);
QTRY_COMPARE(originalPos, window.position());
QTRY_COMPARE(originalFramePos, window.framePosition());
@@ -1470,7 +1483,7 @@ void tst_QWindow::activateAndClose()
window.showNormal();
#if defined(Q_OS_QNX) // We either need to create a eglSurface or a create a backing store
// and then post the window in order for screen to show the window
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QOpenGLContext context;
context.create();
context.makeCurrent(&window);
@@ -1753,7 +1766,7 @@ void tst_QWindow::visibility()
{
qRegisterMetaType<Qt::WindowModality>("QWindow::Visibility");
- QWindow window;
+ Window window;
QSignalSpy spy(&window, SIGNAL(visibilityChanged(QWindow::Visibility)));
window.setVisibility(QWindow::AutomaticVisibility);
@@ -1774,11 +1787,13 @@ void tst_QWindow::visibility()
QCOMPARE(window.windowState(), Qt::WindowFullScreen);
QCOMPARE(window.visibility(), QWindow::FullScreen);
QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowFullScreen);
spy.clear();
window.setWindowState(Qt::WindowNoState);
QCOMPARE(window.visibility(), QWindow::Windowed);
QCOMPARE(spy.count(), 1);
+ QTRY_COMPARE(window.lastReceivedWindowState, Qt::WindowNoState);
spy.clear();
window.setVisible(false);
@@ -1791,16 +1806,27 @@ void tst_QWindow::mask()
{
QRegion mask = QRect(10, 10, 800 - 20, 600 - 20);
- QWindow window;
- window.resize(800, 600);
- window.setMask(mask);
+ {
+ QWindow window;
+ window.resize(800, 600);
+ QCOMPARE(window.mask(), QRegion());
- QCOMPARE(window.mask(), QRegion());
+ window.create();
+ window.setMask(mask);
+ QCOMPARE(window.mask(), mask);
+ }
- window.create();
- window.setMask(mask);
+ {
+ QWindow window;
+ window.resize(800, 600);
+ QCOMPARE(window.mask(), QRegion());
+
+ window.setMask(mask);
+ QCOMPARE(window.mask(), mask);
+ window.create();
+ QCOMPARE(window.mask(), mask);
+ }
- QCOMPARE(window.mask(), mask);
}
void tst_QWindow::initialSize()
@@ -1845,6 +1871,9 @@ void tst_QWindow::modalDialog()
if (!QGuiApplication::platformName().compare(QLatin1String("wayland"), Qt::CaseInsensitive))
QSKIP("Wayland: This fails. Figure out why.");
+ if (QGuiApplication::platformName() == QLatin1String("cocoa"))
+ QSKIP("Test fails due to QTBUG-61965, and is slow due to QTBUG-61964");
+
QWindow normalWindow;
normalWindow.setFramePosition(m_availableTopLeft + QPoint(80, 80));
normalWindow.resize(m_testWindowSize);
diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index c2c04b69c5..96d983c8f7 100644
--- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -2278,8 +2278,8 @@ void tst_QMatrixNxN::rotate4x4_data()
float y = 2.0f;
float z = -6.0f;
float angle = -45.0f;
- float c = std::cos(angle * M_PI / 180.0f);
- float s = std::sin(angle * M_PI / 180.0f);
+ float c = std::cos(qDegreesToRadians(angle));
+ float s = std::sin(qDegreesToRadians(angle));
float len = std::sqrt(x * x + y * y + z * z);
float xu = x / len;
float yu = y / len;
diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
index 53af65e010..097dd111d3 100644
--- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
+++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp
@@ -815,7 +815,7 @@ void tst_QQuaternion::fromAxisAndAngle()
// http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56
// to calculate the answer we expect to get.
QVector3D vector = QVector3D(x1, y1, z1).normalized();
- const float a = (angle * M_PI / 180.0) / 2.0;
+ const float a = qDegreesToRadians(angle) / 2.0;
const float sin_a = std::sin(a);
const float cos_a = std::cos(a);
QQuaternion result(cos_a,
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 1ce7e797fc..6809aea086 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -545,19 +545,32 @@ void tst_QColor::setNamedColor_data()
QColor bySetNamedColor; \
bySetNamedColor.setNamedColor(expr); \
auto byCtor = QColor(expr); \
- QTest::newRow(e.name + QByteArrayLiteral(#expr)) \
+ QTest::addRow("%s: %s", e.name, #expr) \
<< byCtor << bySetNamedColor << expected; \
} while (0) \
/*end*/
- ROW(QLatin1String(e.name));
- ROW(QString(QLatin1String(e.name)));
+ const auto l1 = QLatin1String(e.name);
+ const auto l1UpperBA = QByteArray(e.name).toUpper();
+ const auto l1Upper = QLatin1String(l1UpperBA);
+ const auto l1SpaceBA = QByteArray(e.name).insert(1, ' ');
+ const auto l1Space = QLatin1String(l1SpaceBA);
+
+ const auto u16 = QString(l1);
+ const auto u16Upper = u16.toUpper();
+ const auto u16Space = QString(u16).insert(1, ' ');
+
+ ROW(l1);
+ ROW(u16);
+ ROW(QStringView(u16));
// name should be case insensitive
- ROW(QLatin1String(QByteArray(e.name).toUpper()));
- ROW(QString(e.name).toUpper());
+ ROW(l1Upper);
+ ROW(u16Upper);
+ ROW(QStringView(u16Upper));
// spaces should be ignored
- ROW(QLatin1String(QByteArray(e.name).insert(1, ' ')));
- ROW(QString(e.name).insert(1, ' '));
+ ROW(l1Space);
+ ROW(u16Space);
+ ROW(QStringView(u16Space));
#undef ROW
}
}
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 6b6869c2ba..b8243a2b54 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -45,6 +45,7 @@
#include <qdesktopwidget.h>
#endif
#include <qpixmap.h>
+#include <qrandom.h>
#include <private/qdrawhelper_p.h>
#include <qpainter.h>
@@ -399,51 +400,6 @@ void tst_QPainter::cleanupTestCase()
QFile::remove(QLatin1String("foo.png"));
}
-static const char* const maskSource_data[] = {
-"16 13 6 1",
-". c None",
-"d c #000000",
-"# c #999999",
-"c c #cccccc",
-"b c #ffff00",
-"a c #ffffff",
-"...#####........",
-"..#aaaaa#.......",
-".#abcbcba######.",
-".#acbcbcaaaaaa#d",
-".#abcbcbcbcbcb#d",
-"#############b#d",
-"#aaaaaaaaaa##c#d",
-"#abcbcbcbcbbd##d",
-".#abcbcbcbcbcd#d",
-".#acbcbcbcbcbd#d",
-"..#acbcbcbcbb#dd",
-"..#############d",
-"...ddddddddddddd"};
-
-static const char* const maskResult_data[] = {
-"16 13 6 1",
-". c #ff0000",
-"d c #000000",
-"# c #999999",
-"c c #cccccc",
-"b c #ffff00",
-"a c #ffffff",
-"...#####........",
-"..#aaaaa#.......",
-".#abcbcba######.",
-".#acbcbcaaaaaa#d",
-".#abcbcbcbcbcb#d",
-"#############b#d",
-"#aaaaaaaaaa##c#d",
-"#abcbcbcbcbbd##d",
-".#abcbcbcbcbcd#d",
-".#acbcbcbcbcbd#d",
-"..#acbcbcbcbb#dd",
-"..#############d",
-"...ddddddddddddd"};
-
-
#ifndef QT_NO_WIDGETS
void tst_QPainter::drawPixmap_comp_data()
{
@@ -3097,7 +3053,7 @@ void tst_QPainter::fpe_steepSlopes_data()
qreal randf()
{
- return rand() / (RAND_MAX + 1.0);
+ return QRandomGenerator::global()->bounded(1.0);
}
QPointF randInRect(const QRectF &rect)
@@ -3559,11 +3515,9 @@ void tst_QPainter::drawImage_data()
continue;
for (int odd_x = 0; odd_x <= 1; ++odd_x) {
for (int odd_width = 0; odd_width <= 1; ++odd_width) {
- QString description =
- QString("srcFormat %1, dstFormat %2, odd x: %3, odd width: %4")
- .arg(srcFormat).arg(dstFormat).arg(odd_x).arg(odd_width);
-
- QTest::newRow(qPrintable(description)) << (10 + odd_x) << 10 << (20 + odd_width) << 20
+ QTest::addRow("srcFormat %d, dstFormat %d, odd x: %d, odd width: %d",
+ srcFormat, dstFormat, odd_x, odd_width)
+ << (10 + odd_x) << 10 << (20 + odd_width) << 20
<< QImage::Format(srcFormat)
<< QImage::Format(dstFormat);
}
diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
index 14ba9c5c84..93035af7d3 100644
--- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
+++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp
@@ -35,6 +35,7 @@
#include <qpolygon.h>
#include <qdebug.h>
#include <qpainter.h>
+#include <qrandom.h>
#include <math.h>
@@ -423,8 +424,8 @@ void tst_QPathClipper::clip()
static inline QPointF randomPointInRect(const QRectF &rect)
{
- qreal rx = qrand() / (RAND_MAX + 1.);
- qreal ry = qrand() / (RAND_MAX + 1.);
+ qreal rx = QRandomGenerator::global()->bounded(1.0);
+ qreal ry = QRandomGenerator::global()->bounded(1.0);
return QPointF(rect.left() + rx * rect.width(),
rect.top() + ry * rect.height());
diff --git a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
index 13b6e28f5f..bf3e5dfb52 100644
--- a/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
+++ b/tests/auto/gui/painting/qpolygon/tst_qpolygon.cpp
@@ -49,6 +49,8 @@ private slots:
void boundingRectF();
void makeEllipse();
void swap();
+ void intersections_data();
+ void intersections();
};
tst_QPolygon::tst_QPolygon()
@@ -159,5 +161,45 @@ void tst_QPolygon::swap()
QCOMPARE(p2.count(),3);
}
+void tst_QPolygon::intersections_data()
+{
+ QTest::addColumn<QPolygon>("poly1");
+ QTest::addColumn<QPolygon>("poly2");
+ QTest::addColumn<bool>("result");
+
+ QTest::newRow("empty intersects nothing")
+ << QPolygon()
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(10,10) << QPoint(-10,10))
+ << false;
+ QTest::newRow("identical triangles")
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(10,10) << QPoint(-10,10))
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(10,10) << QPoint(-10,10))
+ << true;
+ QTest::newRow("not intersecting")
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(10,10) << QPoint(-10,10))
+ << QPolygon(QVector<QPoint>() << QPoint(0,20) << QPoint(10,12) << QPoint(-10,12))
+ << false;
+ QTest::newRow("clean intersection of squares")
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(0,10) << QPoint(10,10) << QPoint(10,0))
+ << QPolygon(QVector<QPoint>() << QPoint(5,5) << QPoint(5,15) << QPoint(15,15) << QPoint(15,5))
+ << true;
+ QTest::newRow("clean contains of squares")
+ << QPolygon(QVector<QPoint>() << QPoint(0,0) << QPoint(0,10) << QPoint(10,10) << QPoint(10,0))
+ << QPolygon(QVector<QPoint>() << QPoint(5,5) << QPoint(5,8) << QPoint(8,8) << QPoint(8,5))
+ << true;
+}
+
+void tst_QPolygon::intersections()
+{
+ QFETCH(QPolygon, poly1);
+ QFETCH(QPolygon, poly2);
+ QFETCH(bool, result);
+
+ QCOMPARE(poly2.intersects(poly1), poly1.intersects(poly2));
+ QCOMPARE(poly2.intersected(poly1).isEmpty(), poly1.intersected(poly2).isEmpty());
+ QCOMPARE(!poly1.intersected(poly2).isEmpty(), poly1.intersects(poly2));
+ QCOMPARE(poly1.intersects(poly2), result);
+}
+
QTEST_APPLESS_MAIN(tst_QPolygon)
#include "tst_qpolygon.moc"
diff --git a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp
index 0c089cdaa3..0a6a95daca 100644
--- a/tests/auto/gui/painting/qtransform/tst_qtransform.cpp
+++ b/tests/auto/gui/painting/qtransform/tst_qtransform.cpp
@@ -29,7 +29,6 @@
#include <QtTest/QtTest>
#include "qtransform.h"
-#include <math.h>
#include <qpolygon.h>
#include <qdebug.h>
@@ -67,10 +66,6 @@ private:
Q_DECLARE_METATYPE(QTransform)
-#if defined(Q_OS_WIN) && !defined(M_PI)
-#define M_PI 3.14159265897932384626433832795f
-#endif
-
void tst_QTransform::mapRect_data()
{
mapping_data();
diff --git a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
index a79526c434..da88a868f3 100644
--- a/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
+++ b/tests/auto/gui/painting/qwmatrix/tst_qwmatrix.cpp
@@ -114,131 +114,96 @@ void tst_QWMatrix::mapping_data()
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -300, -400, 300, 400 ) );
-#if defined(Q_OS_WIN) && !defined(M_PI)
-#define M_PI 3.14159265897932384626433832795f
-#endif
+ const auto rotate = [](qreal degrees) {
+ const qreal rad = qDegreesToRadians(degrees);
+ return QMatrix(std::cos(rad), -std::sin(rad),
+ std::sin(rad), std::cos(rad), 0, 0);
+ };
// rotations
- float deg = 0.;
- QTest::newRow( "rot 0 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 0 a" ) << rotate(0.)
<< QRect( 0, 0, 30, 40 )
<< QPolygon ( QRect( 0, 0, 30, 40 ) );
- deg = 0.00001f;
- QTest::newRow( "rot 0 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 0 b" ) << rotate(0.00001f)
<< QRect( 0, 0, 30, 40 )
<< QPolygon ( QRect( 0, 0, 30, 40 ) );
- deg = 0.;
- QTest::newRow( "rot 0 c" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 0 c" ) << rotate(0.)
<< QRect( 10, 20, 30, 40 )
<< QPolygon ( QRect( 10, 20, 30, 40 ) );
- deg = 0.00001f;
- QTest::newRow( "rot 0 d" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 0 d" ) << rotate(0.00001f)
<< QRect( 10, 20, 30, 40 )
<< QPolygon ( QRect( 10, 20, 30, 40 ) );
#if 0
- // rotations
- deg = 90.;
- QTest::newRow( "rotscale 90 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ const auto rotScale = [](qreal degrees, qreal scale) {
+ const qreal rad = qDegreesToRadians(degrees);
+ return QMatrix(scale * std::cos(rad), -scale * std::sin(rad),
+ scale * std::sin(rad), scale * std::cos(rad), 0, 0);
+ };
+ // rotations with scaling
+ QTest::newRow( "rotscale 90 a" ) << rotScale(90., 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( 0, -299, 400, 300 ) );
- deg = 90.00001;
- QTest::newRow( "rotscale 90 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 90 b" ) << rotScale(90.00001, 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( 0, -299, 400, 300 ) );
- deg = 90.;
- QTest::newRow( "rotscale 90 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 90 c" ) << rotScale(90., 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( 200, -399, 400, 300 ) );
- deg = 90.00001;
- QTest::newRow( "rotscale 90 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 90 d" ) << rotScale(90.00001, 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( 200, -399, 400, 300 ) );
- deg = 180.;
- QTest::newRow( "rotscale 180 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 180 a" ) << rotScale(180., 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -299, -399, 300, 400 ) );
- deg = 180.000001;
- QTest::newRow( "rotscale 180 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 180 b" ) << rotScale(180.000001, 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -299, -399, 300, 400 ) );
- deg = 180.;
- QTest::newRow( "rotscale 180 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 180 c" ) << rotScale(180., 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -399, -599, 300, 400 ) );
- deg = 180.000001;
- QTest::newRow( "rotscale 180 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 180 d" ) << rotScale(180.000001, 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -399, -599, 300, 400 ) );
- deg = 270.;
- QTest::newRow( "rotscale 270 a" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 270 a" ) << rotScale(270., 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -399, 00, 400, 300 ) );
- deg = 270.0000001;
- QTest::newRow( "rotscale 270 b" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 270 b" ) << rotScale(270.0000001, 10)
<< QRect( 0, 0, 30, 40 )
<< QPolygon( QRect( -399, 00, 400, 300 ) );
- deg = 270.;
- QTest::newRow( "rotscale 270 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 270 c" ) << rotScale(270., 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -599, 100, 400, 300 ) );
- deg = 270.000001;
- QTest::newRow( "rotscale 270 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rotscale 270 d" ) << rotScale(270.000001, 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -599, 100, 400, 300 ) );
// rotations that are not multiples of 90 degrees. mapRect returns the bounding rect here.
- deg = 45;
- QTest::newRow( "rot 45 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 45 a" ) << rotate(45)
<< QRect( 0, 0, 10, 10 )
<< QPolygon( QRect( 0, -7, 14, 14 ) );
- QTest::newRow( "rot 45 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 45 b" ) << rotate(45)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( 21, -14, 49, 49 ) );
- QTest::newRow( "rot 45 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 45 c" ) << rotScale(45, 10)
<< QRect( 0, 0, 10, 10 )
<< QPolygon( QRect( 0, -70, 141, 141 ) );
- QTest::newRow( "rot 45 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot 45 d" ) << rotScale(45, 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( 212, -141, 495, 495 ) );
- deg = -45;
- QTest::newRow( "rot -45 a" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot -45 a" ) << rotate(-45)
<< QRect( 0, 0, 10, 10 )
<< QPolygon( QRect( -7, 0, 14, 14 ) );
- QTest::newRow( "rot -45 b" ) << QMatrix( std::cos( M_PI*deg/180. ), -std::sin( M_PI*deg/180. ),
- std::sin( M_PI*deg/180. ), std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot -45 b" ) << rotate(-45)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -35, 21, 49, 49 ) );
- QTest::newRow( "rot -45 c" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot -45 c" ) << rotScale(-45, 10)
<< QRect( 0, 0, 10, 10 )
<< QPolygon( QRect( -70, 0, 141, 141 ) );
- QTest::newRow( "rot -45 d" ) << QMatrix( 10*std::cos( M_PI*deg/180. ), -10*std::sin( M_PI*deg/180. ),
- 10*std::sin( M_PI*deg/180. ), 10*std::cos( M_PI*deg/180. ), 0, 0 )
+ QTest::newRow( "rot -45 d" ) << rotScale(-45, 10)
<< QRect( 10, 20, 30, 40 )
<< QPolygon( QRect( -353, 212, 495, 495 ) );
#endif
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 6d9456fa69..82b3657b56 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -1413,7 +1413,7 @@ void tst_QOpenGL::glxContextWrap()
window->setSurfaceType(QWindow::OpenGLSurface);
window->setGeometry(0, 0, 10, 10);
window->show();
- QTest::qWaitForWindowExposed(window);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
QPlatformNativeInterface *nativeIf = QGuiApplicationPrivate::instance()->platformIntegration()->nativeInterface();
QVERIFY(nativeIf);
@@ -1457,7 +1457,7 @@ void tst_QOpenGL::wglContextWrap()
window->setSurfaceType(QWindow::OpenGLSurface);
window->setGeometry(0, 0, 256, 256);
window->show();
- QTest::qWaitForWindowExposed(window.data());
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVariant v = ctx->nativeHandle();
QVERIFY(!v.isNull());
diff --git a/tests/auto/gui/qvulkan/qvulkan.pro b/tests/auto/gui/qvulkan/qvulkan.pro
new file mode 100644
index 0000000000..0db990a2d6
--- /dev/null
+++ b/tests/auto/gui/qvulkan/qvulkan.pro
@@ -0,0 +1,9 @@
+############################################################
+# Project file for autotest for gui/vulkan functionality
+############################################################
+
+CONFIG += testcase
+TARGET = tst_qvulkan
+QT += gui-private core-private testlib
+
+SOURCES += tst_qvulkan.cpp
diff --git a/tests/auto/gui/qvulkan/tst_qvulkan.cpp b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
new file mode 100644
index 0000000000..cc4bc43f92
--- /dev/null
+++ b/tests/auto/gui/qvulkan/tst_qvulkan.cpp
@@ -0,0 +1,435 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include <QtGui/QVulkanInstance>
+#include <QtGui/QVulkanFunctions>
+#include <QtGui/QVulkanWindow>
+
+#include <QtTest/QtTest>
+
+#include <QSignalSpy>
+
+class tst_QVulkan : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void vulkanInstance();
+ void vulkanCheckSupported();
+ void vulkanPlainWindow();
+ void vulkanVersionRequest();
+ void vulkanWindow();
+ void vulkanWindowRenderer();
+ void vulkanWindowGrab();
+};
+
+void tst_QVulkan::vulkanInstance()
+{
+ QVulkanInstance inst;
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ QVERIFY(inst.isValid());
+ QVERIFY(inst.vkInstance() != VK_NULL_HANDLE);
+ QVERIFY(inst.functions());
+ QVERIFY(!inst.flags().testFlag(QVulkanInstance::NoDebugOutputRedirect));
+
+ inst.destroy();
+
+ QVERIFY(!inst.isValid());
+ QVERIFY(inst.handle() == nullptr);
+
+ inst.setFlags(QVulkanInstance::NoDebugOutputRedirect);
+ // pass a bogus layer and extension
+ inst.setExtensions(QByteArrayList() << "abcdefg" << "notanextension");
+ inst.setLayers(QByteArrayList() << "notalayer");
+ QVERIFY(inst.create());
+
+ QVERIFY(inst.isValid());
+ QVERIFY(inst.vkInstance() != VK_NULL_HANDLE);
+ QVERIFY(inst.handle() != nullptr);
+ QVERIFY(inst.functions());
+ QVERIFY(inst.flags().testFlag(QVulkanInstance::NoDebugOutputRedirect));
+ QVERIFY(!inst.extensions().contains("abcdefg"));
+ QVERIFY(!inst.extensions().contains("notanextension"));
+ QVERIFY(!inst.extensions().contains("notalayer"));
+ // at least the surface extensions should be there however
+ QVERIFY(inst.extensions().contains("VK_KHR_surface"));
+
+ QVERIFY(inst.getInstanceProcAddr("vkGetDeviceQueue"));
+}
+
+void tst_QVulkan::vulkanCheckSupported()
+{
+ // Test the early calls to supportedLayers/extensions that need the library
+ // and some basics, but do not initialize the instance.
+ QVulkanInstance inst;
+ QVERIFY(!inst.isValid());
+
+ QVulkanInfoVector<QVulkanLayer> vl = inst.supportedLayers();
+ qDebug() << vl;
+ QVERIFY(!inst.isValid());
+
+ QVulkanInfoVector<QVulkanExtension> ve = inst.supportedExtensions();
+ qDebug() << ve;
+ QVERIFY(!inst.isValid());
+
+ if (inst.create()) { // skip the rest when Vulkan is not supported at all
+ QVERIFY(!ve.isEmpty());
+ QVERIFY(ve == inst.supportedExtensions());
+ }
+}
+
+void tst_QVulkan::vulkanPlainWindow()
+{
+ QVulkanInstance inst;
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ QWindow w;
+ w.setSurfaceType(QSurface::VulkanSurface);
+ w.setVulkanInstance(&inst);
+ w.resize(1024, 768);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+
+ QCOMPARE(w.vulkanInstance(), &inst);
+
+ VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(&w);
+ QVERIFY(surface != VK_NULL_HANDLE);
+
+ // exercise supportsPresent (and QVulkanFunctions) a bit
+ QVulkanFunctions *f = inst.functions();
+ VkPhysicalDevice physDev;
+ uint32_t count = 1;
+ VkResult err = f->vkEnumeratePhysicalDevices(inst.vkInstance(), &count, &physDev);
+ if (err != VK_SUCCESS)
+ QSKIP("No physical devices; skip");
+
+ VkPhysicalDeviceProperties physDevProps;
+ f->vkGetPhysicalDeviceProperties(physDev, &physDevProps);
+ qDebug("Device name: %s Driver version: %d.%d.%d", physDevProps.deviceName,
+ VK_VERSION_MAJOR(physDevProps.driverVersion), VK_VERSION_MINOR(physDevProps.driverVersion),
+ VK_VERSION_PATCH(physDevProps.driverVersion));
+
+ bool supports = inst.supportsPresent(physDev, 0, &w);
+ qDebug("queue family 0 supports presenting to window = %d", supports);
+}
+
+void tst_QVulkan::vulkanVersionRequest()
+{
+ QVulkanInstance inst;
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ // Now that we know Vulkan is functional, check the requested apiVersion is
+ // passed to vkCreateInstance as expected.
+
+ inst.destroy();
+
+ inst.setApiVersion(QVersionNumber(10, 0, 0));
+ QVERIFY(!inst.create());
+ QCOMPARE(inst.errorCode(), VK_ERROR_INCOMPATIBLE_DRIVER);
+}
+
+static void waitForUnexposed(QWindow *w)
+{
+ QElapsedTimer timer;
+ timer.start();
+ while (w->isExposed()) {
+ int remaining = 5000 - int(timer.elapsed());
+ if (remaining <= 0)
+ break;
+ QCoreApplication::processEvents(QEventLoop::AllEvents, remaining);
+ QCoreApplication::sendPostedEvents(Q_NULLPTR, QEvent::DeferredDelete);
+ QTest::qSleep(10);
+ }
+}
+
+void tst_QVulkan::vulkanWindow()
+{
+ QVulkanInstance inst;
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ // First let's forget to set the instance.
+ QVulkanWindow w;
+ QVERIFY(!w.isValid());
+ w.resize(1024, 768);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QVERIFY(!w.isValid());
+
+ // Now set it. A simple hide - show should be enough to correct, this, no
+ // need for a full destroy - create.
+ w.hide();
+ waitForUnexposed(&w);
+ w.setVulkanInstance(&inst);
+ QVector<VkPhysicalDeviceProperties> pdevs = w.availablePhysicalDevices();
+ if (pdevs.isEmpty())
+ QSKIP("No Vulkan physical devices; skip");
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QVERIFY(w.isValid());
+ QCOMPARE(w.vulkanInstance(), &inst);
+ QVulkanInfoVector<QVulkanExtension> exts = w.supportedDeviceExtensions();
+
+ // Now destroy and recreate.
+ w.destroy();
+ waitForUnexposed(&w);
+ QVERIFY(!w.isValid());
+ // check that flags can be set between a destroy() - show()
+ w.setFlags(QVulkanWindow::PersistentResources);
+ // supported lists can be queried before expose too
+ QVERIFY(w.supportedDeviceExtensions() == exts);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QVERIFY(w.isValid());
+ QVERIFY(w.flags().testFlag(QVulkanWindow::PersistentResources));
+
+ QVERIFY(w.physicalDevice() != VK_NULL_HANDLE);
+ QVERIFY(w.physicalDeviceProperties() != nullptr);
+ QVERIFY(w.device() != VK_NULL_HANDLE);
+ QVERIFY(w.graphicsQueue() != VK_NULL_HANDLE);
+ QVERIFY(w.graphicsCommandPool() != VK_NULL_HANDLE);
+ QVERIFY(w.defaultRenderPass() != VK_NULL_HANDLE);
+
+ QVERIFY(w.concurrentFrameCount() > 0);
+ QVERIFY(w.concurrentFrameCount() <= QVulkanWindow::MAX_CONCURRENT_FRAME_COUNT);
+}
+
+class TestVulkanRenderer;
+
+class TestVulkanWindow : public QVulkanWindow
+{
+public:
+ QVulkanWindowRenderer *createRenderer() override;
+
+private:
+ TestVulkanRenderer *m_renderer = nullptr;
+};
+
+struct TestVulkan {
+ int preInitResCount = 0;
+ int initResCount = 0;
+ int initSwcResCount = 0;
+ int releaseResCount = 0;
+ int releaseSwcResCount = 0;
+ int startNextFrameCount = 0;
+} testVulkan;
+
+class TestVulkanRenderer : public QVulkanWindowRenderer
+{
+public:
+ TestVulkanRenderer(QVulkanWindow *w) : m_window(w) { }
+
+ void preInitResources() override;
+ void initResources() override;
+ void initSwapChainResources() override;
+ void releaseSwapChainResources() override;
+ void releaseResources() override;
+
+ void startNextFrame() override;
+
+private:
+ QVulkanWindow *m_window;
+ QVulkanDeviceFunctions *m_devFuncs;
+};
+
+void TestVulkanRenderer::preInitResources()
+{
+ if (testVulkan.initResCount) {
+ qWarning("initResources called before preInitResources?!");
+ testVulkan.preInitResCount = -1;
+ return;
+ }
+
+ // Ensure the physical device and the surface are available at this stage.
+ VkPhysicalDevice physDev = m_window->physicalDevice();
+ if (physDev == VK_NULL_HANDLE) {
+ qWarning("No physical device in preInitResources");
+ testVulkan.preInitResCount = -1;
+ return;
+ }
+ VkSurfaceKHR surface = m_window->vulkanInstance()->surfaceForWindow(m_window);
+ if (surface == VK_NULL_HANDLE) {
+ qWarning("No surface in preInitResources");
+ testVulkan.preInitResCount = -1;
+ return;
+ }
+
+ ++testVulkan.preInitResCount;
+}
+
+void TestVulkanRenderer::initResources()
+{
+ m_devFuncs = m_window->vulkanInstance()->deviceFunctions(m_window->device());
+ ++testVulkan.initResCount;
+}
+
+void TestVulkanRenderer::initSwapChainResources()
+{
+ ++testVulkan.initSwcResCount;
+}
+
+void TestVulkanRenderer::releaseSwapChainResources()
+{
+ ++testVulkan.releaseSwcResCount;
+}
+
+void TestVulkanRenderer::releaseResources()
+{
+ ++testVulkan.releaseResCount;
+}
+
+void TestVulkanRenderer::startNextFrame()
+{
+ ++testVulkan.startNextFrameCount;
+
+ VkClearColorValue clearColor = { 0, 1, 0, 1 };
+ VkClearDepthStencilValue clearDS = { 1, 0 };
+ VkClearValue clearValues[2];
+ memset(clearValues, 0, sizeof(clearValues));
+ clearValues[0].color = clearColor;
+ clearValues[1].depthStencil = clearDS;
+
+ VkRenderPassBeginInfo rpBeginInfo;
+ memset(&rpBeginInfo, 0, sizeof(rpBeginInfo));
+ rpBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
+ rpBeginInfo.renderPass = m_window->defaultRenderPass();
+ rpBeginInfo.framebuffer = m_window->currentFramebuffer();
+ const QSize sz = m_window->swapChainImageSize();
+ rpBeginInfo.renderArea.extent.width = sz.width();
+ rpBeginInfo.renderArea.extent.height = sz.height();
+ rpBeginInfo.clearValueCount = 2;
+ rpBeginInfo.pClearValues = clearValues;
+ VkCommandBuffer cmdBuf = m_window->currentCommandBuffer();
+ m_devFuncs->vkCmdBeginRenderPass(cmdBuf, &rpBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
+
+ m_devFuncs->vkCmdEndRenderPass(cmdBuf);
+
+ m_window->frameReady();
+}
+
+QVulkanWindowRenderer *TestVulkanWindow::createRenderer()
+{
+ Q_ASSERT(!m_renderer);
+ m_renderer = new TestVulkanRenderer(this);
+ return m_renderer;
+}
+
+void tst_QVulkan::vulkanWindowRenderer()
+{
+ QVulkanInstance inst;
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ testVulkan = TestVulkan();
+
+ TestVulkanWindow w;
+ w.setVulkanInstance(&inst);
+ w.resize(1024, 768);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+
+ if (w.availablePhysicalDevices().isEmpty())
+ QSKIP("No Vulkan physical devices; skip");
+
+ QVERIFY(testVulkan.preInitResCount == 1);
+ QVERIFY(testVulkan.initResCount == 1);
+ QVERIFY(testVulkan.initSwcResCount == 1);
+ // this has to be QTRY due to the async update in QVulkanWindowPrivate::ensureStarted()
+ QTRY_VERIFY(testVulkan.startNextFrameCount >= 1);
+
+ QVERIFY(!w.swapChainImageSize().isEmpty());
+ QVERIFY(w.colorFormat() != VK_FORMAT_UNDEFINED);
+ QVERIFY(w.depthStencilFormat() != VK_FORMAT_UNDEFINED);
+
+ w.destroy();
+ waitForUnexposed(&w);
+ QVERIFY(testVulkan.releaseSwcResCount == 1);
+ QVERIFY(testVulkan.releaseResCount == 1);
+}
+
+void tst_QVulkan::vulkanWindowGrab()
+{
+ QVulkanInstance inst;
+ inst.setLayers(QByteArrayList() << "VK_LAYER_LUNARG_standard_validation");
+ if (!inst.create())
+ QSKIP("Vulkan init failed; skip");
+
+ testVulkan = TestVulkan();
+
+ TestVulkanWindow w;
+ w.setVulkanInstance(&inst);
+ w.resize(1024, 768);
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+
+ if (w.availablePhysicalDevices().isEmpty())
+ QSKIP("No Vulkan physical devices; skip");
+
+ if (!w.supportsGrab())
+ QSKIP("No grab support; skip");
+
+ QVERIFY(!w.swapChainImageSize().isEmpty());
+
+ QImage img1 = w.grab();
+ QImage img2 = w.grab();
+ QImage img3 = w.grab();
+
+ QVERIFY(!img1.isNull());
+ QVERIFY(!img2.isNull());
+ QVERIFY(!img3.isNull());
+
+ QCOMPARE(img1.size(), w.swapChainImageSize());
+ QCOMPARE(img2.size(), w.swapChainImageSize());
+ QCOMPARE(img3.size(), w.swapChainImageSize());
+
+ QRgb a = img1.pixel(10, 20);
+ QRgb b = img2.pixel(5, 5);
+ QRgb c = img3.pixel(50, 30);
+
+ QCOMPARE(a, b);
+ QCOMPARE(b, c);
+ QRgb refPixel = qRgb(0, 255, 0);
+
+ int redFuzz = qAbs(qRed(a) - qRed(refPixel));
+ int greenFuzz = qAbs(qGreen(a) - qGreen(refPixel));
+ int blueFuzz = qAbs(qBlue(a) - qBlue(refPixel));
+
+ QVERIFY(redFuzz <= 1);
+ QVERIFY(blueFuzz <= 1);
+ QVERIFY(greenFuzz <= 1);
+
+ w.destroy();
+}
+
+QTEST_MAIN(tst_QVulkan)
+
+#include "tst_qvulkan.moc"
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index 8667caa1ef..0a422fca17 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -47,7 +47,11 @@ private slots:
void elidedText();
void veryNarrowElidedText();
void averageCharWidth();
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void bypassShaping();
+#endif
+
void elidedMultiLength();
void elidedMultiLengthF();
void inFontUcs4();
@@ -187,6 +191,7 @@ void tst_QFontMetrics::averageCharWidth()
QVERIFY(fmf.averageCharWidth() != 0);
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void tst_QFontMetrics::bypassShaping()
{
QFont f;
@@ -201,6 +206,7 @@ void tst_QFontMetrics::bypassShaping()
// This assertion is needed in Qt WebKit's WebCore::Font::offsetForPositionForSimpleText
QCOMPARE(textWidth, charsWidth);
}
+#endif
template<class FontMetrics, typename PrimitiveType> void elidedMultiLength_helper()
{
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 764b99646b..2f3da2c196 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -187,6 +187,7 @@ private slots:
void cssInheritance();
void lineHeightType();
+ void cssLineHeightMultiplier();
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
void buildRegExpData();
@@ -3398,6 +3399,33 @@ void tst_QTextDocument::lineHeightType()
{
QTextDocument td;
+ td.setHtml("<html><head><style type=\"text/css\">body { -qt-line-height-type: fixed; line-height: 10; -qt-line-height-type: fixed; }</style></head><body>Foobar</body></html>");
+ QTextBlock block = td.begin();
+ QTextBlockFormat format = block.blockFormat();
+ QCOMPARE(int(format.lineHeightType()), int(QTextBlockFormat::FixedHeight));
+ QCOMPARE(format.lineHeight(), 10.0);
+ }
+
+ {
+ QTextDocument td;
+ td.setHtml("<html><head><style type=\"text/css\">body { -qt-line-height-type: proportional; line-height: 3; }</style></head><body>Foobar</body></html>");
+ QTextBlock block = td.begin();
+ QTextBlockFormat format = block.blockFormat();
+ QCOMPARE(int(format.lineHeightType()), int(QTextBlockFormat::ProportionalHeight));
+ QCOMPARE(format.lineHeight(), 3.0);
+ }
+
+ {
+ QTextDocument td;
+ td.setHtml("<html><head><style type=\"text/css\">body { line-height: 2.5; -qt-line-height-type: proportional; }</style></head><body>Foobar</body></html>");
+ QTextBlock block = td.begin();
+ QTextBlockFormat format = block.blockFormat();
+ QCOMPARE(int(format.lineHeightType()), int(QTextBlockFormat::ProportionalHeight));
+ QCOMPARE(format.lineHeight(), 2.5);
+ }
+
+ {
+ QTextDocument td;
td.setHtml("<html><head><style type=\"text/css\">body { line-height: 33; -qt-line-height-type: minimum; }</style></head><body>Foobar</body></html>");
QTextBlock block = td.begin();
QTextBlockFormat format = block.blockFormat();
@@ -3424,5 +3452,26 @@ void tst_QTextDocument::lineHeightType()
}
}
+void tst_QTextDocument::cssLineHeightMultiplier()
+{
+ {
+ QTextDocument td;
+ td.setHtml("<html><head><style type=\"text/css\">body { line-height: 10; }</style></head><body>Foobar</body></html>");
+ QTextBlock block = td.begin();
+ QTextBlockFormat format = block.blockFormat();
+ QCOMPARE(int(format.lineHeightType()), int(QTextBlockFormat::ProportionalHeight));
+ QCOMPARE(format.lineHeight(), 1000.0);
+ }
+
+ {
+ QTextDocument td;
+ td.setHtml("<html><head><style type=\"text/css\">body {line-height: 1.38; }</style></head><body>Foobar</body></html>");
+ QTextBlock block = td.begin();
+ QTextBlockFormat format = block.blockFormat();
+ QCOMPARE(int(format.lineHeightType()), int(QTextBlockFormat::ProportionalHeight));
+ QCOMPARE(format.lineHeight(), 138.0);
+ }
+}
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index b8af5271ea..b68a014bff 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -1312,7 +1312,7 @@ void tst_QTextLayout::testDefaultTabs()
QCOMPARE(line.cursorToX(31), 480.);
QTextOption option = layout.textOption();
- option.setTabStop(90);
+ option.setTabStopDistance(90);
layout.setTextOption(option);
layout.beginLayout();
line = layout.createLine();
@@ -1351,7 +1351,7 @@ void tst_QTextLayout::testTabs()
layout.setCacheEnabled(true);
QTextOption option = layout.textOption();
- option.setTabStop(150);
+ option.setTabStopDistance(150);
layout.setTextOption(option);
layout.beginLayout();
diff --git a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
index ca01e83dbe..39f5e9ecc3 100644
--- a/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
+++ b/tests/auto/gui/text/qtextpiecetable/tst_qtextpiecetable.cpp
@@ -145,7 +145,7 @@ void tst_QTextPieceTable::insertion3()
{
QString compare;
for (int i = 0; i < 20000; ++i) {
- int pos = rand() % (i+1);
+ int pos = QRandomGenerator::global()->bounded(i+1);
QChar c((unsigned short)(i & 0xff) + 1);
QString str;
str += c;
@@ -159,7 +159,7 @@ void tst_QTextPieceTable::insertion4()
{
QString compare;
for (int i = 0; i < 20000; ++i) {
- int pos = rand() % (i+1);
+ int pos = QRandomGenerator::global()->generate() % (i+1);
QChar c((unsigned short)((i % 26) + (i>25?'A':'a')));
QString str;
str += c;
@@ -178,7 +178,7 @@ void tst_QTextPieceTable::insertion5()
{
QString compare;
for (int i = 0; i < 20000; ++i) {
- int pos = rand() % (i+1);
+ int pos = QRandomGenerator::global()->generate() % (i+1);
QChar c((unsigned short)((i % 26) + (i>25?'A':'a')));
QString str;
str += c;
@@ -236,8 +236,8 @@ void tst_QTextPieceTable::removal3()
QString compare;
int l = 0;
for (int i = 0; i < 20000; ++i) {
- bool remove = l && (rand() % 2);
- int pos = rand() % (remove ? l : (l+1));
+ bool remove = l && (QRandomGenerator::global()->bounded(2));
+ int pos = QRandomGenerator::global()->bounded(remove ? l : (l+1));
QChar c((unsigned short)((i % 26) + (i>25?'A':'a')));
QString str;
str += c;
@@ -263,8 +263,8 @@ void tst_QTextPieceTable::removal4()
QString compare;
int l = 0;
for (int i = 0; i < 20000; ++i) {
- bool remove = l && (rand() % 2);
- int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0;
+ bool remove = l && (QRandomGenerator::global()->bounded(2));
+ int pos = (l > 1) ? QRandomGenerator::global()->bounded(remove ? l-1 : l) : 0;
QChar c((unsigned short)((i % 26) + (i>25?'A':'a')));
QString str;
if (c != 'a') {
@@ -472,13 +472,12 @@ void tst_QTextPieceTable::undoRedo10()
void tst_QTextPieceTable::undoRedo11()
{
- srand(3);
const int loops = 20;
QString compare;
int l = 0;
for (int i = 0; i < loops; ++i) {
- bool remove = l && (rand() % 2);
- int pos = (l > 1) ? rand() % (remove ? l-1 : l) : 0;
+ bool remove = l && (QRandomGenerator::global()->bounded(2));
+ int pos = (l > 1) ? QRandomGenerator::global()->bounded(remove ? l-1 : l) : 0;
QChar c((unsigned short)((i % 26) + (i>25?'A':'a')));
QString str;
str += c;
diff --git a/tests/auto/gui/text/qtextscriptengine/BLACKLIST b/tests/auto/gui/text/qtextscriptengine/BLACKLIST
new file mode 100644
index 0000000000..52eb9086a9
--- /dev/null
+++ b/tests/auto/gui/text/qtextscriptengine/BLACKLIST
@@ -0,0 +1,2 @@
+[thaiWithZWJ]
+rhel-7.2
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index ee50b98733..0371f51961 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -78,6 +78,9 @@ private slots:
void thaiIsolatedSaraAm();
void thaiWithZWJ();
void thaiMultipleVowels();
+
+ void shapingDisabledDevanagari();
+ void shapingDisabledLatin();
private:
bool haveTestFonts;
};
@@ -1280,5 +1283,62 @@ void tst_QTextScriptEngine::thaiMultipleVowels()
// If we haven't crashed at this point, then the test has passed.
}
+void tst_QTextScriptEngine::shapingDisabledLatin()
+{
+ QString s("fi");
+
+ QFont font("Calibri");
+ font.setStyleStrategy(QFont::PreferNoShaping);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QList<QGlyphRun> runs = layout.glyphRuns();
+
+ QCOMPARE(runs.size(), 1);
+ QCOMPARE(runs.first().glyphIndexes().size(), 2);
+}
+
+void tst_QTextScriptEngine::shapingDisabledDevanagari()
+{
+ QString s;
+ s += QChar(0x0915); // KA
+ s += QChar(0x094D); // VIRAMA
+ s += QChar(0x0915); // KA
+
+
+ QList<QGlyphRun> normalRuns;
+ {
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ normalRuns = layout.glyphRuns();
+ }
+
+ QFont font;
+ font.setStyleStrategy(QFont::PreferNoShaping);
+
+ QList<QGlyphRun> noShapingRuns;
+ {
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ noShapingRuns = layout.glyphRuns();
+ }
+
+ // Even though shaping is disabled, Devanagari requires it, so the flag should be ignored.
+ QCOMPARE(normalRuns.size(), 1);
+ QCOMPARE(noShapingRuns.size(), 1);
+ QCOMPARE(noShapingRuns.first().glyphIndexes().size(), normalRuns.first().glyphIndexes().size());
+}
+
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"
diff --git a/tests/auto/gui/util/qshadergenerator/qshadergenerator.pro b/tests/auto/gui/util/qshadergenerator/qshadergenerator.pro
new file mode 100644
index 0000000000..c1f610e029
--- /dev/null
+++ b/tests/auto/gui/util/qshadergenerator/qshadergenerator.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+QT += testlib gui-private
+
+SOURCES += tst_qshadergenerator.cpp
+TARGET = tst_qshadergenerator
diff --git a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp
new file mode 100644
index 0000000000..d0a0225055
--- /dev/null
+++ b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp
@@ -0,0 +1,895 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtCore/qmetaobject.h>
+#include <QtGui/private/qshadergenerator_p.h>
+#include <QtGui/private/qshaderlanguage_p.h>
+
+namespace
+{
+ QShaderFormat createFormat(QShaderFormat::Api api, int majorVersion, int minorVersion)
+ {
+ auto format = QShaderFormat();
+ format.setApi(api);
+ format.setVersion(QVersionNumber(majorVersion, minorVersion));
+ return format;
+ }
+
+ QShaderNodePort createPort(QShaderNodePort::Direction portDirection, const QString &portName)
+ {
+ auto port = QShaderNodePort();
+ port.direction = portDirection;
+ port.name = portName;
+ return port;
+ }
+
+ QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList())
+ {
+ auto node = QShaderNode();
+ node.setUuid(QUuid::createUuid());
+ node.setLayers(layers);
+ for (const auto &port : ports)
+ node.addPort(port);
+ return node;
+ }
+
+ QShaderGraph::Edge createEdge(const QUuid &sourceUuid, const QString &sourceName,
+ const QUuid &targetUuid, const QString &targetName,
+ const QStringList &layers = QStringList())
+ {
+ auto edge = QShaderGraph::Edge();
+ edge.sourceNodeUuid = sourceUuid;
+ edge.sourcePortName = sourceName;
+ edge.targetNodeUuid = targetUuid;
+ edge.targetPortName = targetName;
+ edge.layers = layers;
+ return edge;
+ }
+
+ QShaderGraph createGraph()
+ {
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+
+ auto graph = QShaderGraph();
+
+ auto worldPosition = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ worldPosition.setParameter("name", "worldPosition");
+ worldPosition.addRule(openGLES2, QShaderNode::Rule("highp vec3 $value = $name;",
+ QByteArrayList() << "varying highp vec3 $name;"));
+ worldPosition.addRule(openGL3, QShaderNode::Rule("vec3 $value = $name;",
+ QByteArrayList() << "in vec3 $name;"));
+
+ auto texture = createNode({
+ createPort(QShaderNodePort::Output, "texture")
+ });
+ texture.addRule(openGLES2, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+ texture.addRule(openGL3, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+
+ auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ });
+ texCoord.addRule(openGLES2, QShaderNode::Rule("highp vec2 $texCoord = texCoord;",
+ QByteArrayList() << "varying highp vec2 texCoord;"));
+ texCoord.addRule(openGL3, QShaderNode::Rule("vec2 $texCoord = texCoord;",
+ QByteArrayList() << "in vec2 texCoord;"));
+
+ auto lightIntensity = createNode({
+ createPort(QShaderNodePort::Output, "lightIntensity")
+ });
+ lightIntensity.addRule(openGLES2, QShaderNode::Rule("highp float $lightIntensity = lightIntensity;",
+ QByteArrayList() << "uniform highp float lightIntensity;"));
+ lightIntensity.addRule(openGL3, QShaderNode::Rule("float $lightIntensity = lightIntensity;",
+ QByteArrayList() << "uniform float lightIntensity;"));
+
+ auto exposure = createNode({
+ createPort(QShaderNodePort::Output, "exposure")
+ });
+ exposure.addRule(openGLES2, QShaderNode::Rule("highp float $exposure = exposure;",
+ QByteArrayList() << "uniform highp float exposure;"));
+ exposure.addRule(openGL3, QShaderNode::Rule("float $exposure = exposure;",
+ QByteArrayList() << "uniform float exposure;"));
+
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.addRule(openGLES2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(openGL3, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+
+ auto sampleTexture = createNode({
+ createPort(QShaderNodePort::Input, "sampler"),
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ });
+ sampleTexture.addRule(openGLES2, QShaderNode::Rule("highp vec4 $color = texture2D($sampler, $coord);"));
+ sampleTexture.addRule(openGL3, QShaderNode::Rule("vec4 $color = texture2D($sampler, $coord);"));
+
+ auto lightFunction = createNode({
+ createPort(QShaderNodePort::Input, "baseColor"),
+ createPort(QShaderNodePort::Input, "position"),
+ createPort(QShaderNodePort::Input, "lightIntensity"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ lightFunction.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include es2/lightmodel.frag.inc"));
+ lightFunction.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include gl3/lightmodel.frag.inc"));
+
+ auto exposureFunction = createNode({
+ createPort(QShaderNodePort::Input, "inputColor"),
+ createPort(QShaderNodePort::Input, "exposure"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ exposureFunction.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+ exposureFunction.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+
+ graph.addNode(worldPosition);
+ graph.addNode(texture);
+ graph.addNode(texCoord);
+ graph.addNode(lightIntensity);
+ graph.addNode(exposure);
+ graph.addNode(fragColor);
+ graph.addNode(sampleTexture);
+ graph.addNode(lightFunction);
+ graph.addNode(exposureFunction);
+
+ graph.addEdge(createEdge(texture.uuid(), "texture", sampleTexture.uuid(), "sampler"));
+ graph.addEdge(createEdge(texCoord.uuid(), "texCoord", sampleTexture.uuid(), "coord"));
+
+ graph.addEdge(createEdge(worldPosition.uuid(), "value", lightFunction.uuid(), "position"));
+ graph.addEdge(createEdge(sampleTexture.uuid(), "color", lightFunction.uuid(), "baseColor"));
+ graph.addEdge(createEdge(lightIntensity.uuid(), "lightIntensity", lightFunction.uuid(), "lightIntensity"));
+
+ graph.addEdge(createEdge(lightFunction.uuid(), "outputColor", exposureFunction.uuid(), "inputColor"));
+ graph.addEdge(createEdge(exposure.uuid(), "exposure", exposureFunction.uuid(), "exposure"));
+
+ graph.addEdge(createEdge(exposureFunction.uuid(), "outputColor", fragColor.uuid(), "fragColor"));
+
+ return graph;
+ }
+}
+
+class tst_QShaderGenerator : public QObject
+{
+ Q_OBJECT
+private slots:
+ void shouldHaveDefaultState();
+ void shouldGenerateShaderCode_data();
+ void shouldGenerateShaderCode();
+ void shouldGenerateVersionCommands_data();
+ void shouldGenerateVersionCommands();
+ void shouldProcessLanguageQualifierAndTypeEnums_data();
+ void shouldProcessLanguageQualifierAndTypeEnums();
+ void shouldGenerateDifferentCodeDependingOnActiveLayers();
+};
+
+void tst_QShaderGenerator::shouldHaveDefaultState()
+{
+ // GIVEN
+ auto generator = QShaderGenerator();
+
+ // THEN
+ QVERIFY(generator.graph.nodes().isEmpty());
+ QVERIFY(generator.graph.edges().isEmpty());
+ QVERIFY(!generator.format.isValid());
+}
+
+void tst_QShaderGenerator::shouldGenerateShaderCode_data()
+{
+ QTest::addColumn<QShaderGraph>("graph");
+ QTest::addColumn<QShaderFormat>("format");
+ QTest::addColumn<QByteArray>("expectedCode");
+
+ const auto graph = createGraph();
+
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+ const auto openGL32 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 2);
+ const auto openGL4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0);
+
+ const auto versionGLES2 = QByteArrayList() << "#version 100" << "";
+ const auto versionGL3 = QByteArrayList() << "#version 130" << "";
+ const auto versionGL32 = QByteArrayList() << "#version 150 core" << "";
+ const auto versionGL4 = QByteArrayList() << "#version 400 core" << "";
+
+ const auto es2Code = QByteArrayList() << "varying highp vec3 worldPosition;"
+ << "uniform sampler2D texture;"
+ << "varying highp vec2 texCoord;"
+ << "uniform highp float lightIntensity;"
+ << "uniform highp float exposure;"
+ << "#pragma include es2/lightmodel.frag.inc"
+ << ""
+ << "void main()"
+ << "{"
+ << " highp vec2 v2 = texCoord;"
+ << " sampler2D v1 = texture;"
+ << " highp float v3 = lightIntensity;"
+ << " highp vec4 v5 = texture2D(v1, v2);"
+ << " highp vec3 v0 = worldPosition;"
+ << " highp float v4 = exposure;"
+ << " highp vec4 v6 = lightModel(v5, v0, v3);"
+ << " highp vec4 v7 = v6 * pow(2.0, v4);"
+ << " gl_fragColor = v7;"
+ << "}"
+ << "";
+
+ const auto gl3Code = QByteArrayList() << "in vec3 worldPosition;"
+ << "uniform sampler2D texture;"
+ << "in vec2 texCoord;"
+ << "uniform float lightIntensity;"
+ << "uniform float exposure;"
+ << "out vec4 fragColor;"
+ << "#pragma include gl3/lightmodel.frag.inc"
+ << ""
+ << "void main()"
+ << "{"
+ << " vec2 v2 = texCoord;"
+ << " sampler2D v1 = texture;"
+ << " float v3 = lightIntensity;"
+ << " vec4 v5 = texture2D(v1, v2);"
+ << " vec3 v0 = worldPosition;"
+ << " float v4 = exposure;"
+ << " vec4 v6 = lightModel(v5, v0, v3);"
+ << " vec4 v7 = v6 * pow(2.0, v4);"
+ << " fragColor = v7;"
+ << "}"
+ << "";
+
+ QTest::newRow("EmptyGraphAndFormat") << QShaderGraph() << QShaderFormat() << QByteArrayLiteral("\nvoid main()\n{\n}\n");
+ QTest::newRow("LightExposureGraphAndES2") << graph << openGLES2 << (versionGLES2 + es2Code).join('\n');
+ QTest::newRow("LightExposureGraphAndGL3") << graph << openGL3 << (versionGL3 + gl3Code).join('\n');
+ QTest::newRow("LightExposureGraphAndGL32") << graph << openGL32 << (versionGL32 + gl3Code).join('\n');
+ QTest::newRow("LightExposureGraphAndGL4") << graph << openGL4 << (versionGL4 + gl3Code).join('\n');
+}
+
+void tst_QShaderGenerator::shouldGenerateShaderCode()
+{
+ // GIVEN
+ QFETCH(QShaderGraph, graph);
+ QFETCH(QShaderFormat, format);
+
+ auto generator = QShaderGenerator();
+ generator.graph = graph;
+ generator.format = format;
+
+ // WHEN
+ const auto code = generator.createShaderCode();
+
+ // THEN
+ QFETCH(QByteArray, expectedCode);
+ QCOMPARE(code, expectedCode);
+}
+
+void tst_QShaderGenerator::shouldGenerateVersionCommands_data()
+{
+ QTest::addColumn<QShaderFormat>("format");
+ QTest::addColumn<QByteArray>("version");
+
+ QTest::newRow("GLES2") << createFormat(QShaderFormat::OpenGLES, 2, 0) << QByteArrayLiteral("#version 100");
+ QTest::newRow("GLES3") << createFormat(QShaderFormat::OpenGLES, 3, 0) << QByteArrayLiteral("#version 300 es");
+
+ QTest::newRow("GL20") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0) << QByteArrayLiteral("#version 110");
+ QTest::newRow("GL21") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 1) << QByteArrayLiteral("#version 120");
+ QTest::newRow("GL30") << createFormat(QShaderFormat::OpenGLNoProfile, 3, 0) << QByteArrayLiteral("#version 130");
+ QTest::newRow("GL31") << createFormat(QShaderFormat::OpenGLNoProfile, 3, 1) << QByteArrayLiteral("#version 140");
+ QTest::newRow("GL32") << createFormat(QShaderFormat::OpenGLNoProfile, 3, 2) << QByteArrayLiteral("#version 150");
+ QTest::newRow("GL33") << createFormat(QShaderFormat::OpenGLNoProfile, 3, 3) << QByteArrayLiteral("#version 330");
+ QTest::newRow("GL40") << createFormat(QShaderFormat::OpenGLNoProfile, 4, 0) << QByteArrayLiteral("#version 400");
+ QTest::newRow("GL41") << createFormat(QShaderFormat::OpenGLNoProfile, 4, 1) << QByteArrayLiteral("#version 410");
+ QTest::newRow("GL42") << createFormat(QShaderFormat::OpenGLNoProfile, 4, 2) << QByteArrayLiteral("#version 420");
+ QTest::newRow("GL43") << createFormat(QShaderFormat::OpenGLNoProfile, 4, 3) << QByteArrayLiteral("#version 430");
+
+ QTest::newRow("GL20core") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0) << QByteArrayLiteral("#version 110");
+ QTest::newRow("GL21core") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 1) << QByteArrayLiteral("#version 120");
+ QTest::newRow("GL30core") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0) << QByteArrayLiteral("#version 130");
+ QTest::newRow("GL31core") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1) << QByteArrayLiteral("#version 140");
+ QTest::newRow("GL32core") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 2) << QByteArrayLiteral("#version 150 core");
+ QTest::newRow("GL33core") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 3) << QByteArrayLiteral("#version 330 core");
+ QTest::newRow("GL40core") << createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0) << QByteArrayLiteral("#version 400 core");
+ QTest::newRow("GL41core") << createFormat(QShaderFormat::OpenGLCoreProfile, 4, 1) << QByteArrayLiteral("#version 410 core");
+ QTest::newRow("GL42core") << createFormat(QShaderFormat::OpenGLCoreProfile, 4, 2) << QByteArrayLiteral("#version 420 core");
+ QTest::newRow("GL43core") << createFormat(QShaderFormat::OpenGLCoreProfile, 4, 3) << QByteArrayLiteral("#version 430 core");
+
+ QTest::newRow("GL20compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0) << QByteArrayLiteral("#version 110");
+ QTest::newRow("GL21compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 1) << QByteArrayLiteral("#version 120");
+ QTest::newRow("GL30compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 3, 0) << QByteArrayLiteral("#version 130");
+ QTest::newRow("GL31compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 3, 1) << QByteArrayLiteral("#version 140");
+ QTest::newRow("GL32compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 3, 2) << QByteArrayLiteral("#version 150 compatibility");
+ QTest::newRow("GL33compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 3, 3) << QByteArrayLiteral("#version 330 compatibility");
+ QTest::newRow("GL40compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 4, 0) << QByteArrayLiteral("#version 400 compatibility");
+ QTest::newRow("GL41compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 4, 1) << QByteArrayLiteral("#version 410 compatibility");
+ QTest::newRow("GL42compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 4, 2) << QByteArrayLiteral("#version 420 compatibility");
+ QTest::newRow("GL43compatibility") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 4, 3) << QByteArrayLiteral("#version 430 compatibility");
+}
+
+void tst_QShaderGenerator::shouldGenerateVersionCommands()
+{
+ // GIVEN
+ QFETCH(QShaderFormat, format);
+
+ auto generator = QShaderGenerator();
+ generator.format = format;
+
+ // WHEN
+ const auto code = generator.createShaderCode();
+
+ // THEN
+ QFETCH(QByteArray, version);
+ const auto expectedCode = (QByteArrayList() << version
+ << ""
+ << ""
+ << "void main()"
+ << "{"
+ << "}"
+ << "").join('\n');
+ QCOMPARE(code, expectedCode);
+}
+
+
+namespace {
+ QString toGlsl(QShaderLanguage::StorageQualifier qualifier, const QShaderFormat &format)
+ {
+ if (format.version().majorVersion() <= 2) {
+ // Note we're assuming fragment shader only here, it'd be different
+ // values for vertex shader, will need to be fixed properly at some
+ // point but isn't necessary yet (this problem already exists in past
+ // commits anyway)
+ switch (qualifier) {
+ case QShaderLanguage::Const:
+ return "const";
+ case QShaderLanguage::Input:
+ return "varying";
+ case QShaderLanguage::Output:
+ return ""; // Although fragment shaders for <=2 only have fixed outputs
+ case QShaderLanguage::Uniform:
+ return "uniform";
+ }
+ } else {
+ switch (qualifier) {
+ case QShaderLanguage::Const:
+ return "const";
+ case QShaderLanguage::Input:
+ return "in";
+ case QShaderLanguage::Output:
+ return "out";
+ case QShaderLanguage::Uniform:
+ return "uniform";
+ }
+ }
+
+ Q_UNREACHABLE();
+ }
+
+ QString toGlsl(QShaderLanguage::VariableType type)
+ {
+ switch (type) {
+ case QShaderLanguage::Bool:
+ return "bool";
+ case QShaderLanguage::Int:
+ return "int";
+ case QShaderLanguage::Uint:
+ return "uint";
+ case QShaderLanguage::Float:
+ return "float";
+ case QShaderLanguage::Double:
+ return "double";
+ case QShaderLanguage::Vec2:
+ return "vec2";
+ case QShaderLanguage::Vec3:
+ return "vec3";
+ case QShaderLanguage::Vec4:
+ return "vec4";
+ case QShaderLanguage::DVec2:
+ return "dvec2";
+ case QShaderLanguage::DVec3:
+ return "dvec3";
+ case QShaderLanguage::DVec4:
+ return "dvec4";
+ case QShaderLanguage::BVec2:
+ return "bvec2";
+ case QShaderLanguage::BVec3:
+ return "bvec3";
+ case QShaderLanguage::BVec4:
+ return "bvec4";
+ case QShaderLanguage::IVec2:
+ return "ivec2";
+ case QShaderLanguage::IVec3:
+ return "ivec3";
+ case QShaderLanguage::IVec4:
+ return "ivec4";
+ case QShaderLanguage::UVec2:
+ return "uvec2";
+ case QShaderLanguage::UVec3:
+ return "uvec3";
+ case QShaderLanguage::UVec4:
+ return "uvec4";
+ case QShaderLanguage::Mat2:
+ return "mat2";
+ case QShaderLanguage::Mat3:
+ return "mat3";
+ case QShaderLanguage::Mat4:
+ return "mat4";
+ case QShaderLanguage::Mat2x2:
+ return "mat2x2";
+ case QShaderLanguage::Mat2x3:
+ return "mat2x3";
+ case QShaderLanguage::Mat2x4:
+ return "mat2x4";
+ case QShaderLanguage::Mat3x2:
+ return "mat3x2";
+ case QShaderLanguage::Mat3x3:
+ return "mat3x3";
+ case QShaderLanguage::Mat3x4:
+ return "mat3x4";
+ case QShaderLanguage::Mat4x2:
+ return "mat4x2";
+ case QShaderLanguage::Mat4x3:
+ return "mat4x3";
+ case QShaderLanguage::Mat4x4:
+ return "mat4x4";
+ case QShaderLanguage::DMat2:
+ return "dmat2";
+ case QShaderLanguage::DMat3:
+ return "dmat3";
+ case QShaderLanguage::DMat4:
+ return "dmat4";
+ case QShaderLanguage::DMat2x2:
+ return "dmat2x2";
+ case QShaderLanguage::DMat2x3:
+ return "dmat2x3";
+ case QShaderLanguage::DMat2x4:
+ return "dmat2x4";
+ case QShaderLanguage::DMat3x2:
+ return "dmat3x2";
+ case QShaderLanguage::DMat3x3:
+ return "dmat3x3";
+ case QShaderLanguage::DMat3x4:
+ return "dmat3x4";
+ case QShaderLanguage::DMat4x2:
+ return "dmat4x2";
+ case QShaderLanguage::DMat4x3:
+ return "dmat4x3";
+ case QShaderLanguage::DMat4x4:
+ return "dmat4x4";
+ case QShaderLanguage::Sampler1D:
+ return "sampler1D";
+ case QShaderLanguage::Sampler2D:
+ return "sampler2D";
+ case QShaderLanguage::Sampler3D:
+ return "sampler3D";
+ case QShaderLanguage::SamplerCube:
+ return "samplerCube";
+ case QShaderLanguage::Sampler2DRect:
+ return "sampler2DRect";
+ case QShaderLanguage::Sampler2DMs:
+ return "sampler2DMS";
+ case QShaderLanguage::SamplerBuffer:
+ return "samplerBuffer";
+ case QShaderLanguage::Sampler1DArray:
+ return "sampler1DArray";
+ case QShaderLanguage::Sampler2DArray:
+ return "sampler2DArray";
+ case QShaderLanguage::Sampler2DMsArray:
+ return "sampler2DMSArray";
+ case QShaderLanguage::SamplerCubeArray:
+ return "samplerCubeArray";
+ case QShaderLanguage::Sampler1DShadow:
+ return "sampler1DShadow";
+ case QShaderLanguage::Sampler2DShadow:
+ return "sampler2DShadow";
+ case QShaderLanguage::Sampler2DRectShadow:
+ return "sampler2DRectShadow";
+ case QShaderLanguage::Sampler1DArrayShadow:
+ return "sampler1DArrayShadow";
+ case QShaderLanguage::Sampler2DArrayShadow:
+ return "sample2DArrayShadow";
+ case QShaderLanguage::SamplerCubeShadow:
+ return "samplerCubeShadow";
+ case QShaderLanguage::SamplerCubeArrayShadow:
+ return "samplerCubeArrayShadow";
+ case QShaderLanguage::ISampler1D:
+ return "isampler1D";
+ case QShaderLanguage::ISampler2D:
+ return "isampler2D";
+ case QShaderLanguage::ISampler3D:
+ return "isampler3D";
+ case QShaderLanguage::ISamplerCube:
+ return "isamplerCube";
+ case QShaderLanguage::ISampler2DRect:
+ return "isampler2DRect";
+ case QShaderLanguage::ISampler2DMs:
+ return "isampler2DMS";
+ case QShaderLanguage::ISamplerBuffer:
+ return "isamplerBuffer";
+ case QShaderLanguage::ISampler1DArray:
+ return "isampler1DArray";
+ case QShaderLanguage::ISampler2DArray:
+ return "isampler2DArray";
+ case QShaderLanguage::ISampler2DMsArray:
+ return "isampler2DMSArray";
+ case QShaderLanguage::ISamplerCubeArray:
+ return "isamplerCubeArray";
+ case QShaderLanguage::USampler1D:
+ return "usampler1D";
+ case QShaderLanguage::USampler2D:
+ return "usampler2D";
+ case QShaderLanguage::USampler3D:
+ return "usampler3D";
+ case QShaderLanguage::USamplerCube:
+ return "usamplerCube";
+ case QShaderLanguage::USampler2DRect:
+ return "usampler2DRect";
+ case QShaderLanguage::USampler2DMs:
+ return "usampler2DMS";
+ case QShaderLanguage::USamplerBuffer:
+ return "usamplerBuffer";
+ case QShaderLanguage::USampler1DArray:
+ return "usampler1DArray";
+ case QShaderLanguage::USampler2DArray:
+ return "usampler2DArray";
+ case QShaderLanguage::USampler2DMsArray:
+ return "usampler2DMSArray";
+ case QShaderLanguage::USamplerCubeArray:
+ return "usamplerCubeArray";
+ }
+
+ Q_UNREACHABLE();
+ }
+}
+
+void tst_QShaderGenerator::shouldProcessLanguageQualifierAndTypeEnums_data()
+{
+ QTest::addColumn<QShaderGraph>("graph");
+ QTest::addColumn<QShaderFormat>("format");
+ QTest::addColumn<QByteArray>("expectedCode");
+
+ const auto es2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto es3 = createFormat(QShaderFormat::OpenGLES, 3, 0);
+ const auto gl2 = createFormat(QShaderFormat::OpenGLNoProfile, 2, 0);
+ const auto gl3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+ const auto gl4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0);
+
+ const auto qualifierEnum = QMetaEnum::fromType<QShaderLanguage::StorageQualifier>();
+ const auto typeEnum = QMetaEnum::fromType<QShaderLanguage::VariableType>();
+
+ for (int qualifierIndex = 0; qualifierIndex < qualifierEnum.keyCount(); qualifierIndex++) {
+ const auto qualifierName = qualifierEnum.key(qualifierIndex);
+ const auto qualifierValue = static_cast<QShaderLanguage::StorageQualifier>(qualifierEnum.value(qualifierIndex));
+
+ for (int typeIndex = 0; typeIndex < typeEnum.keyCount(); typeIndex++) {
+ const auto typeName = typeEnum.key(typeIndex);
+ const auto typeValue = static_cast<QShaderLanguage::VariableType>(typeEnum.value(typeIndex));
+
+ auto graph = QShaderGraph();
+
+ auto worldPosition = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ worldPosition.setParameter("name", "worldPosition");
+ worldPosition.setParameter("qualifier", QVariant::fromValue<QShaderLanguage::StorageQualifier>(qualifierValue));
+ worldPosition.setParameter("type", QVariant::fromValue<QShaderLanguage::VariableType>(typeValue));
+ worldPosition.addRule(es2, QShaderNode::Rule("highp $type $value = $name;",
+ QByteArrayList() << "$qualifier highp $type $name;"));
+ worldPosition.addRule(gl2, QShaderNode::Rule("$type $value = $name;",
+ QByteArrayList() << "$qualifier $type $name;"));
+ worldPosition.addRule(gl3, QShaderNode::Rule("$type $value = $name;",
+ QByteArrayList() << "$qualifier $type $name;"));
+
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.addRule(es2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(gl2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(gl3, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+
+ graph.addNode(worldPosition);
+ graph.addNode(fragColor);
+
+ graph.addEdge(createEdge(worldPosition.uuid(), "value", fragColor.uuid(), "fragColor"));
+
+ const auto gl2Code = (QByteArrayList() << "#version 110"
+ << ""
+ << QStringLiteral("%1 %2 worldPosition;").arg(toGlsl(qualifierValue, gl2))
+ .arg(toGlsl(typeValue))
+ .toUtf8()
+ << ""
+ << "void main()"
+ << "{"
+ << QStringLiteral(" %1 v0 = worldPosition;").arg(toGlsl(typeValue)).toUtf8()
+ << " gl_fragColor = v0;"
+ << "}"
+ << "").join("\n");
+ const auto gl3Code = (QByteArrayList() << "#version 130"
+ << ""
+ << QStringLiteral("%1 %2 worldPosition;").arg(toGlsl(qualifierValue, gl3))
+ .arg(toGlsl(typeValue))
+ .toUtf8()
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << QStringLiteral(" %1 v0 = worldPosition;").arg(toGlsl(typeValue)).toUtf8()
+ << " fragColor = v0;"
+ << "}"
+ << "").join("\n");
+ const auto gl4Code = (QByteArrayList() << "#version 400 core"
+ << ""
+ << QStringLiteral("%1 %2 worldPosition;").arg(toGlsl(qualifierValue, gl4))
+ .arg(toGlsl(typeValue))
+ .toUtf8()
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << QStringLiteral(" %1 v0 = worldPosition;").arg(toGlsl(typeValue)).toUtf8()
+ << " fragColor = v0;"
+ << "}"
+ << "").join("\n");
+ const auto es2Code = (QByteArrayList() << "#version 100"
+ << ""
+ << QStringLiteral("%1 highp %2 worldPosition;").arg(toGlsl(qualifierValue, es2))
+ .arg(toGlsl(typeValue))
+ .toUtf8()
+ << ""
+ << "void main()"
+ << "{"
+ << QStringLiteral(" highp %1 v0 = worldPosition;").arg(toGlsl(typeValue)).toUtf8()
+ << " gl_fragColor = v0;"
+ << "}"
+ << "").join("\n");
+ const auto es3Code = (QByteArrayList() << "#version 300 es"
+ << ""
+ << QStringLiteral("%1 highp %2 worldPosition;").arg(toGlsl(qualifierValue, es3))
+ .arg(toGlsl(typeValue))
+ .toUtf8()
+ << ""
+ << "void main()"
+ << "{"
+ << QStringLiteral(" highp %1 v0 = worldPosition;").arg(toGlsl(typeValue)).toUtf8()
+ << " gl_fragColor = v0;"
+ << "}"
+ << "").join("\n");
+
+ QTest::addRow("%s %s ES2", qualifierName, typeName) << graph << es2 << es2Code;
+ QTest::addRow("%s %s ES3", qualifierName, typeName) << graph << es3 << es3Code;
+ QTest::addRow("%s %s GL2", qualifierName, typeName) << graph << gl2 << gl2Code;
+ QTest::addRow("%s %s GL3", qualifierName, typeName) << graph << gl3 << gl3Code;
+ QTest::addRow("%s %s GL4", qualifierName, typeName) << graph << gl4 << gl4Code;
+ }
+ }
+}
+
+void tst_QShaderGenerator::shouldProcessLanguageQualifierAndTypeEnums()
+{
+ // GIVEN
+ QFETCH(QShaderGraph, graph);
+ QFETCH(QShaderFormat, format);
+
+ auto generator = QShaderGenerator();
+ generator.graph = graph;
+ generator.format = format;
+
+ // WHEN
+ const auto code = generator.createShaderCode();
+
+ // THEN
+ QFETCH(QByteArray, expectedCode);
+ QCOMPARE(code, expectedCode);
+}
+
+void tst_QShaderGenerator::shouldGenerateDifferentCodeDependingOnActiveLayers()
+{
+ // GIVEN
+ const auto gl4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0);
+
+ auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ }, {
+ "diffuseTexture",
+ "normalTexture"
+ });
+ texCoord.addRule(gl4, QShaderNode::Rule("vec2 $texCoord = texCoord;",
+ QByteArrayList() << "in vec2 texCoord;"));
+ auto diffuseUniform = createNode({
+ createPort(QShaderNodePort::Output, "color")
+ }, {"diffuseUniform"});
+ diffuseUniform.addRule(gl4, QShaderNode::Rule("vec4 $color = diffuseUniform;",
+ QByteArrayList() << "uniform vec4 diffuseUniform;"));
+ auto diffuseTexture = createNode({
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ }, {"diffuseTexture"});
+ diffuseTexture.addRule(gl4, QShaderNode::Rule("vec4 $color = texture2D(diffuseTexture, $coord);",
+ QByteArrayList() << "uniform sampler2D diffuseTexture;"));
+ auto normalUniform = createNode({
+ createPort(QShaderNodePort::Output, "normal")
+ }, {"normalUniform"});
+ normalUniform.addRule(gl4, QShaderNode::Rule("vec3 $normal = normalUniform;",
+ QByteArrayList() << "uniform vec3 normalUniform;"));
+ auto normalTexture = createNode({
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "normal")
+ }, {"normalTexture"});
+ normalTexture.addRule(gl4, QShaderNode::Rule("vec3 $normal = texture2D(normalTexture, $coord).rgb;",
+ QByteArrayList() << "uniform sampler2D normalTexture;"));
+ auto lightFunction = createNode({
+ createPort(QShaderNodePort::Input, "color"),
+ createPort(QShaderNodePort::Input, "normal"),
+ createPort(QShaderNodePort::Output, "output")
+ });
+ lightFunction.addRule(gl4, QShaderNode::Rule("vec4 $output = lightModel($color, $normal);",
+ QByteArrayList() << "#pragma include gl4/lightmodel.frag.inc"));
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.addRule(gl4, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+
+ res.addNode(texCoord);
+ res.addNode(diffuseUniform);
+ res.addNode(diffuseTexture);
+ res.addNode(normalUniform);
+ res.addNode(normalTexture);
+ res.addNode(lightFunction);
+ res.addNode(fragColor);
+
+ res.addEdge(createEdge(diffuseUniform.uuid(), "color", lightFunction.uuid(), "color", {"diffuseUniform"}));
+ res.addEdge(createEdge(texCoord.uuid(), "texCoord", diffuseTexture.uuid(), "coord", {"diffuseTexture"}));
+ res.addEdge(createEdge(diffuseTexture.uuid(), "color", lightFunction.uuid(), "color", {"diffuseTexture"}));
+
+ res.addEdge(createEdge(normalUniform.uuid(), "normal", lightFunction.uuid(), "normal", {"normalUniform"}));
+ res.addEdge(createEdge(texCoord.uuid(), "texCoord", normalTexture.uuid(), "coord", {"normalTexture"}));
+ res.addEdge(createEdge(normalTexture.uuid(), "normal", lightFunction.uuid(), "normal", {"normalTexture"}));
+
+ res.addEdge(createEdge(lightFunction.uuid(), "output", fragColor.uuid(), "fragColor"));
+
+ return res;
+ }();
+
+ auto generator = QShaderGenerator();
+ generator.graph = graph;
+ generator.format = gl4;
+
+ {
+ // WHEN
+ const auto code = generator.createShaderCode({"diffuseUniform", "normalUniform"});
+
+ // THEN
+ const auto expected = QByteArrayList()
+ << "#version 400 core"
+ << ""
+ << "uniform vec4 diffuseUniform;"
+ << "uniform vec3 normalUniform;"
+ << "#pragma include gl4/lightmodel.frag.inc"
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << " vec3 v1 = normalUniform;"
+ << " vec4 v0 = diffuseUniform;"
+ << " vec4 v2 = lightModel(v0, v1);"
+ << " fragColor = v2;"
+ << "}"
+ << "";
+ QCOMPARE(code, expected.join("\n"));
+ }
+
+ {
+ // WHEN
+ const auto code = generator.createShaderCode({"diffuseUniform", "normalTexture"});
+
+ // THEN
+ const auto expected = QByteArrayList()
+ << "#version 400 core"
+ << ""
+ << "in vec2 texCoord;"
+ << "uniform vec4 diffuseUniform;"
+ << "uniform sampler2D normalTexture;"
+ << "#pragma include gl4/lightmodel.frag.inc"
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << " vec2 v0 = texCoord;"
+ << " vec3 v2 = texture2D(normalTexture, v0).rgb;"
+ << " vec4 v1 = diffuseUniform;"
+ << " vec4 v3 = lightModel(v1, v2);"
+ << " fragColor = v3;"
+ << "}"
+ << "";
+ QCOMPARE(code, expected.join("\n"));
+ }
+
+ {
+ // WHEN
+ const auto code = generator.createShaderCode({"diffuseTexture", "normalUniform"});
+
+ // THEN
+ const auto expected = QByteArrayList()
+ << "#version 400 core"
+ << ""
+ << "in vec2 texCoord;"
+ << "uniform sampler2D diffuseTexture;"
+ << "uniform vec3 normalUniform;"
+ << "#pragma include gl4/lightmodel.frag.inc"
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << " vec2 v0 = texCoord;"
+ << " vec3 v2 = normalUniform;"
+ << " vec4 v1 = texture2D(diffuseTexture, v0);"
+ << " vec4 v3 = lightModel(v1, v2);"
+ << " fragColor = v3;"
+ << "}"
+ << "";
+ QCOMPARE(code, expected.join("\n"));
+ }
+
+ {
+ // WHEN
+ const auto code = generator.createShaderCode({"diffuseTexture", "normalTexture"});
+
+ // THEN
+ const auto expected = QByteArrayList()
+ << "#version 400 core"
+ << ""
+ << "in vec2 texCoord;"
+ << "uniform sampler2D diffuseTexture;"
+ << "uniform sampler2D normalTexture;"
+ << "#pragma include gl4/lightmodel.frag.inc"
+ << "out vec4 fragColor;"
+ << ""
+ << "void main()"
+ << "{"
+ << " vec2 v0 = texCoord;"
+ << " vec3 v2 = texture2D(normalTexture, v0).rgb;"
+ << " vec4 v1 = texture2D(diffuseTexture, v0);"
+ << " vec4 v3 = lightModel(v1, v2);"
+ << " fragColor = v3;"
+ << "}"
+ << "";
+ QCOMPARE(code, expected.join("\n"));
+ }
+}
+
+QTEST_MAIN(tst_QShaderGenerator)
+
+#include "tst_qshadergenerator.moc"
diff --git a/tests/auto/gui/util/qshadergraph/qshadergraph.pro b/tests/auto/gui/util/qshadergraph/qshadergraph.pro
new file mode 100644
index 0000000000..ec54941c77
--- /dev/null
+++ b/tests/auto/gui/util/qshadergraph/qshadergraph.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+QT += testlib gui-private
+
+SOURCES += tst_qshadergraph.cpp
+TARGET = tst_qshadergraph
diff --git a/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp
new file mode 100644
index 0000000000..ce2d38c24f
--- /dev/null
+++ b/tests/auto/gui/util/qshadergraph/tst_qshadergraph.cpp
@@ -0,0 +1,779 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtGui/private/qshadergraph_p.h>
+
+namespace
+{
+ QShaderNodePort createPort(QShaderNodePort::Direction portDirection, const QString &portName)
+ {
+ auto port = QShaderNodePort();
+ port.direction = portDirection;
+ port.name = portName;
+ return port;
+ }
+
+ QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList())
+ {
+ auto node = QShaderNode();
+ node.setUuid(QUuid::createUuid());
+ node.setLayers(layers);
+ for (const auto &port : ports)
+ node.addPort(port);
+ return node;
+ }
+
+ QShaderGraph::Edge createEdge(const QUuid &sourceUuid, const QString &sourceName,
+ const QUuid &targetUuid, const QString &targetName,
+ const QStringList &layers = QStringList())
+ {
+ auto edge = QShaderGraph::Edge();
+ edge.sourceNodeUuid = sourceUuid;
+ edge.sourcePortName = sourceName;
+ edge.targetNodeUuid = targetUuid;
+ edge.targetPortName = targetName;
+ edge.layers = layers;
+ return edge;
+ }
+
+ QShaderGraph::Statement createStatement(const QShaderNode &node,
+ const QVector<int> &inputs = QVector<int>(),
+ const QVector<int> &outputs = QVector<int>())
+ {
+ auto statement = QShaderGraph::Statement();
+ statement.node = node;
+ statement.inputs = inputs;
+ statement.outputs = outputs;
+ return statement;
+ }
+
+ void debugStatement(const QString &prefix, const QShaderGraph::Statement &statement)
+ {
+ qDebug() << prefix << statement.inputs << statement.uuid().toString() << statement.outputs;
+ }
+
+ void dumpStatementsIfNeeded(const QVector<QShaderGraph::Statement> &statements, const QVector<QShaderGraph::Statement> &expected)
+ {
+ if (statements != expected) {
+ for (int i = 0; i < qMax(statements.size(), expected.size()); i++) {
+ qDebug() << "----" << i << "----";
+ if (i < statements.size())
+ debugStatement("A:", statements.at(i));
+ if (i < expected.size())
+ debugStatement("E:", expected.at(i));
+ qDebug() << "-----------";
+ }
+ }
+ }
+}
+
+class tst_QShaderGraph : public QObject
+{
+ Q_OBJECT
+private slots:
+ void shouldHaveEdgeDefaultState();
+ void shouldTestEdgesEquality_data();
+ void shouldTestEdgesEquality();
+ void shouldManipulateStatementMembers();
+ void shouldTestStatementsEquality_data();
+ void shouldTestStatementsEquality();
+ void shouldFindIndexFromPortNameInStatements_data();
+ void shouldFindIndexFromPortNameInStatements();
+ void shouldManageNodeList();
+ void shouldManageEdgeList();
+ void shouldSerializeGraphForCodeGeneration();
+ void shouldHandleUnboundPortsDuringGraphSerialization();
+ void shouldSurviveCyclesDuringGraphSerialization();
+ void shouldDealWithEdgesJumpingOverLayers();
+ void shouldGenerateDifferentStatementsDependingOnActiveLayers();
+};
+
+void tst_QShaderGraph::shouldHaveEdgeDefaultState()
+{
+ // GIVEN
+ auto edge = QShaderGraph::Edge();
+
+ // THEN
+ QVERIFY(edge.sourceNodeUuid.isNull());
+ QVERIFY(edge.sourcePortName.isEmpty());
+ QVERIFY(edge.targetNodeUuid.isNull());
+ QVERIFY(edge.targetPortName.isEmpty());
+}
+
+void tst_QShaderGraph::shouldTestEdgesEquality_data()
+{
+ QTest::addColumn<QShaderGraph::Edge>("left");
+ QTest::addColumn<QShaderGraph::Edge>("right");
+ QTest::addColumn<bool>("expected");
+
+ const auto sourceUuid1 = QUuid::createUuid();
+ const auto sourceUuid2 = QUuid::createUuid();
+ const auto targetUuid1 = QUuid::createUuid();
+ const auto targetUuid2 = QUuid::createUuid();
+
+ QTest::newRow("Equals") << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << true;
+ QTest::newRow("SourceUuid") << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << createEdge(sourceUuid2, "foo", targetUuid1, "bar")
+ << false;
+ QTest::newRow("SourceName") << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << createEdge(sourceUuid1, "bleh", targetUuid1, "bar")
+ << false;
+ QTest::newRow("TargetUuid") << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << createEdge(sourceUuid1, "foo", targetUuid2, "bar")
+ << false;
+ QTest::newRow("TargetName") << createEdge(sourceUuid1, "foo", targetUuid1, "bar")
+ << createEdge(sourceUuid1, "foo", targetUuid1, "bleh")
+ << false;
+}
+
+void tst_QShaderGraph::shouldTestEdgesEquality()
+{
+ // GIVEN
+ QFETCH(QShaderGraph::Edge, left);
+ QFETCH(QShaderGraph::Edge, right);
+
+ // WHEN
+ const auto equal = (left == right);
+ const auto notEqual = (left != right);
+
+ // THEN
+ QFETCH(bool, expected);
+ QCOMPARE(equal, expected);
+ QCOMPARE(notEqual, !expected);
+}
+
+void tst_QShaderGraph::shouldManipulateStatementMembers()
+{
+ // GIVEN
+ auto statement = QShaderGraph::Statement();
+
+ // THEN (default state)
+ QVERIFY(statement.inputs.isEmpty());
+ QVERIFY(statement.outputs.isEmpty());
+ QVERIFY(statement.node.uuid().isNull());
+ QVERIFY(statement.uuid().isNull());
+
+ // WHEN
+ const auto node = createNode({});
+ statement.node = node;
+
+ // THEN
+ QCOMPARE(statement.uuid(), node.uuid());
+
+ // WHEN
+ statement.node = QShaderNode();
+
+ // THEN
+ QVERIFY(statement.uuid().isNull());
+}
+
+void tst_QShaderGraph::shouldTestStatementsEquality_data()
+{
+ QTest::addColumn<QShaderGraph::Statement>("left");
+ QTest::addColumn<QShaderGraph::Statement>("right");
+ QTest::addColumn<bool>("expected");
+
+ const auto node1 = createNode({});
+ const auto node2 = createNode({});
+
+ QTest::newRow("EqualNodes") << createStatement(node1, {1, 2}, {3, 4})
+ << createStatement(node1, {1, 2}, {3, 4})
+ << true;
+ QTest::newRow("EqualInvalids") << createStatement(QShaderNode(), {1, 2}, {3, 4})
+ << createStatement(QShaderNode(), {1, 2}, {3, 4})
+ << true;
+ QTest::newRow("Nodes") << createStatement(node1, {1, 2}, {3, 4})
+ << createStatement(node2, {1, 2}, {3, 4})
+ << false;
+ QTest::newRow("Inputs") << createStatement(node1, {1, 2}, {3, 4})
+ << createStatement(node1, {1, 2, 0}, {3, 4})
+ << false;
+ QTest::newRow("Outputs") << createStatement(node1, {1, 2}, {3, 4})
+ << createStatement(node1, {1, 2}, {3, 0, 4})
+ << false;
+}
+
+void tst_QShaderGraph::shouldTestStatementsEquality()
+{
+ // GIVEN
+ QFETCH(QShaderGraph::Statement, left);
+ QFETCH(QShaderGraph::Statement, right);
+
+ // WHEN
+ const auto equal = (left == right);
+ const auto notEqual = (left != right);
+
+ // THEN
+ QFETCH(bool, expected);
+ QCOMPARE(equal, expected);
+ QCOMPARE(notEqual, !expected);
+}
+
+void tst_QShaderGraph::shouldFindIndexFromPortNameInStatements_data()
+{
+ QTest::addColumn<QShaderGraph::Statement>("statement");
+ QTest::addColumn<QString>("portName");
+ QTest::addColumn<int>("expectedInputIndex");
+ QTest::addColumn<int>("expectedOutputIndex");
+
+ const auto inputNodeStatement = createStatement(createNode({
+ createPort(QShaderNodePort::Output, "input")
+ }));
+ const auto outputNodeStatement = createStatement(createNode({
+ createPort(QShaderNodePort::Input, "output")
+ }));
+ const auto functionNodeStatement = createStatement(createNode({
+ createPort(QShaderNodePort::Input, "input1"),
+ createPort(QShaderNodePort::Output, "output1"),
+ createPort(QShaderNodePort::Input, "input2"),
+ createPort(QShaderNodePort::Output, "output2"),
+ createPort(QShaderNodePort::Output, "output3"),
+ createPort(QShaderNodePort::Input, "input3")
+ }));
+
+ QTest::newRow("Invalid") << QShaderGraph::Statement() << "foo" << -1 << -1;
+ QTest::newRow("InputNodeWrongName") << inputNodeStatement << "foo" << -1 << -1;
+ QTest::newRow("InputNodeExistingName") << inputNodeStatement << "input" << -1 << 0;
+ QTest::newRow("OutputNodeWrongName") << outputNodeStatement << "foo" << -1 << -1;
+ QTest::newRow("OutputNodeExistingName") << outputNodeStatement << "output" << 0 << -1;
+ QTest::newRow("FunctionNodeWrongName") << functionNodeStatement << "foo" << -1 << -1;
+ QTest::newRow("FunctionNodeInput1") << functionNodeStatement << "input1" << 0 << -1;
+ QTest::newRow("FunctionNodeOutput1") << functionNodeStatement << "output1" << -1 << 0;
+ QTest::newRow("FunctionNodeInput2") << functionNodeStatement << "input2" << 1 << -1;
+ QTest::newRow("FunctionNodeOutput2") << functionNodeStatement << "output2" << -1 << 1;
+ QTest::newRow("FunctionNodeInput3") << functionNodeStatement << "input3" << 2 << -1;
+ QTest::newRow("FunctionNodeOutput3") << functionNodeStatement << "output3" << -1 << 2;
+}
+
+void tst_QShaderGraph::shouldFindIndexFromPortNameInStatements()
+{
+ // GIVEN
+ QFETCH(QShaderGraph::Statement, statement);
+ QFETCH(QString, portName);
+ QFETCH(int, expectedInputIndex);
+ QFETCH(int, expectedOutputIndex);
+
+ // WHEN
+ const auto inputIndex = statement.portIndex(QShaderNodePort::Input, portName);
+ const auto outputIndex = statement.portIndex(QShaderNodePort::Output, portName);
+
+ // THEN
+ QCOMPARE(inputIndex, expectedInputIndex);
+ QCOMPARE(outputIndex, expectedOutputIndex);
+}
+
+void tst_QShaderGraph::shouldManageNodeList()
+{
+ // GIVEN
+ const auto node1 = createNode({createPort(QShaderNodePort::Output, "node1")});
+ const auto node2 = createNode({createPort(QShaderNodePort::Output, "node2")});
+
+ auto graph = QShaderGraph();
+
+ // THEN (default state)
+ QVERIFY(graph.nodes().isEmpty());
+
+ // WHEN
+ graph.addNode(node1);
+
+ // THEN
+ QCOMPARE(graph.nodes().size(), 1);
+ QCOMPARE(graph.nodes().at(0).uuid(), node1.uuid());
+ QCOMPARE(graph.nodes().at(0).ports().at(0).name, node1.ports().at(0).name);
+
+ // WHEN
+ graph.addNode(node2);
+
+ // THEN
+ QCOMPARE(graph.nodes().size(), 2);
+ QCOMPARE(graph.nodes().at(0).uuid(), node1.uuid());
+ QCOMPARE(graph.nodes().at(0).ports().at(0).name, node1.ports().at(0).name);
+ QCOMPARE(graph.nodes().at(1).uuid(), node2.uuid());
+ QCOMPARE(graph.nodes().at(1).ports().at(0).name, node2.ports().at(0).name);
+
+
+ // WHEN
+ graph.removeNode(node2);
+
+ // THEN
+ QCOMPARE(graph.nodes().size(), 1);
+ QCOMPARE(graph.nodes().at(0).uuid(), node1.uuid());
+ QCOMPARE(graph.nodes().at(0).ports().at(0).name, node1.ports().at(0).name);
+
+ // WHEN
+ graph.addNode(node2);
+
+ // THEN
+ QCOMPARE(graph.nodes().size(), 2);
+ QCOMPARE(graph.nodes().at(0).uuid(), node1.uuid());
+ QCOMPARE(graph.nodes().at(0).ports().at(0).name, node1.ports().at(0).name);
+ QCOMPARE(graph.nodes().at(1).uuid(), node2.uuid());
+ QCOMPARE(graph.nodes().at(1).ports().at(0).name, node2.ports().at(0).name);
+
+ // WHEN
+ const auto node1bis = [node1] {
+ auto res = node1;
+ auto port = res.ports().at(0);
+ port.name = QStringLiteral("node1bis");
+ res.addPort(port);
+ return res;
+ }();
+ graph.addNode(node1bis);
+
+ // THEN
+ QCOMPARE(graph.nodes().size(), 2);
+ QCOMPARE(graph.nodes().at(0).uuid(), node2.uuid());
+ QCOMPARE(graph.nodes().at(0).ports().at(0).name, node2.ports().at(0).name);
+ QCOMPARE(graph.nodes().at(1).uuid(), node1bis.uuid());
+ QCOMPARE(graph.nodes().at(1).ports().at(0).name, node1bis.ports().at(0).name);
+}
+
+void tst_QShaderGraph::shouldManageEdgeList()
+{
+ // GIVEN
+ const auto edge1 = createEdge(QUuid::createUuid(), "foo", QUuid::createUuid(), "bar");
+ const auto edge2 = createEdge(QUuid::createUuid(), "baz", QUuid::createUuid(), "boo");
+
+ auto graph = QShaderGraph();
+
+ // THEN (default state)
+ QVERIFY(graph.edges().isEmpty());
+
+ // WHEN
+ graph.addEdge(edge1);
+
+ // THEN
+ QCOMPARE(graph.edges().size(), 1);
+ QCOMPARE(graph.edges().at(0), edge1);
+
+ // WHEN
+ graph.addEdge(edge2);
+
+ // THEN
+ QCOMPARE(graph.edges().size(), 2);
+ QCOMPARE(graph.edges().at(0), edge1);
+ QCOMPARE(graph.edges().at(1), edge2);
+
+
+ // WHEN
+ graph.removeEdge(edge2);
+
+ // THEN
+ QCOMPARE(graph.edges().size(), 1);
+ QCOMPARE(graph.edges().at(0), edge1);
+
+ // WHEN
+ graph.addEdge(edge2);
+
+ // THEN
+ QCOMPARE(graph.edges().size(), 2);
+ QCOMPARE(graph.edges().at(0), edge1);
+ QCOMPARE(graph.edges().at(1), edge2);
+
+ // WHEN
+ graph.addEdge(edge1);
+
+ // THEN
+ QCOMPARE(graph.edges().size(), 2);
+ QCOMPARE(graph.edges().at(0), edge1);
+ QCOMPARE(graph.edges().at(1), edge2);
+}
+
+void tst_QShaderGraph::shouldSerializeGraphForCodeGeneration()
+{
+ // GIVEN
+ const auto input1 = createNode({
+ createPort(QShaderNodePort::Output, "input1Value")
+ });
+ const auto input2 = createNode({
+ createPort(QShaderNodePort::Output, "input2Value")
+ });
+ const auto output1 = createNode({
+ createPort(QShaderNodePort::Input, "output1Value")
+ });
+ const auto output2 = createNode({
+ createPort(QShaderNodePort::Input, "output2Value")
+ });
+ const auto function1 = createNode({
+ createPort(QShaderNodePort::Input, "function1Input"),
+ createPort(QShaderNodePort::Output, "function1Output")
+ });
+ const auto function2 = createNode({
+ createPort(QShaderNodePort::Input, "function2Input1"),
+ createPort(QShaderNodePort::Input, "function2Input2"),
+ createPort(QShaderNodePort::Output, "function2Output")
+ });
+ const auto function3 = createNode({
+ createPort(QShaderNodePort::Input, "function3Input1"),
+ createPort(QShaderNodePort::Input, "function3Input2"),
+ createPort(QShaderNodePort::Output, "function3Output1"),
+ createPort(QShaderNodePort::Output, "function3Output2")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+ res.addNode(input1);
+ res.addNode(input2);
+ res.addNode(output1);
+ res.addNode(output2);
+ res.addNode(function1);
+ res.addNode(function2);
+ res.addNode(function3);
+ res.addEdge(createEdge(input1.uuid(), "input1Value", function1.uuid(), "function1Input"));
+ res.addEdge(createEdge(input1.uuid(), "input1Value", function2.uuid(), "function2Input1"));
+ res.addEdge(createEdge(input2.uuid(), "input2Value", function2.uuid(), "function2Input2"));
+ res.addEdge(createEdge(function1.uuid(), "function1Output", function3.uuid(), "function3Input1"));
+ res.addEdge(createEdge(function2.uuid(), "function2Output", function3.uuid(), "function3Input2"));
+ res.addEdge(createEdge(function3.uuid(), "function3Output1", output1.uuid(), "output1Value"));
+ res.addEdge(createEdge(function3.uuid(), "function3Output2", output2.uuid(), "output2Value"));
+ return res;
+ }();
+
+ // WHEN
+ const auto statements = graph.createStatements();
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(input2, {}, {1})
+ << createStatement(input1, {}, {0})
+ << createStatement(function2, {0, 1}, {3})
+ << createStatement(function1, {0}, {2})
+ << createStatement(function3, {2, 3}, {4, 5})
+ << createStatement(output2, {5}, {})
+ << createStatement(output1, {4}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+}
+
+void tst_QShaderGraph::shouldHandleUnboundPortsDuringGraphSerialization()
+{
+ // GIVEN
+ const auto input = createNode({
+ createPort(QShaderNodePort::Output, "input")
+ });
+ const auto unboundInput = createNode({
+ createPort(QShaderNodePort::Output, "unbound")
+ });
+ const auto output = createNode({
+ createPort(QShaderNodePort::Input, "output")
+ });
+ const auto unboundOutput = createNode({
+ createPort(QShaderNodePort::Input, "unbound")
+ });
+ const auto function = createNode({
+ createPort(QShaderNodePort::Input, "functionInput1"),
+ createPort(QShaderNodePort::Input, "functionInput2"),
+ createPort(QShaderNodePort::Input, "functionInput3"),
+ createPort(QShaderNodePort::Output, "functionOutput1"),
+ createPort(QShaderNodePort::Output, "functionOutput2"),
+ createPort(QShaderNodePort::Output, "functionOutput3")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+ res.addNode(input);
+ res.addNode(unboundInput);
+ res.addNode(output);
+ res.addNode(unboundOutput);
+ res.addNode(function);
+ res.addEdge(createEdge(input.uuid(), "input", function.uuid(), "functionInput2"));
+ res.addEdge(createEdge(function.uuid(), "functionOutput2", output.uuid(), "output"));
+ return res;
+ }();
+
+ // WHEN
+ const auto statements = graph.createStatements();
+
+ // THEN
+ // Note that no edge leads to the unbound input
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(input, {}, {0})
+ << createStatement(function, {-1, 0, -1}, {2, 3, 4})
+ << createStatement(unboundOutput, {-1}, {})
+ << createStatement(output, {3}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+}
+
+void tst_QShaderGraph::shouldSurviveCyclesDuringGraphSerialization()
+{
+ // GIVEN
+ const auto input = createNode({
+ createPort(QShaderNodePort::Output, "input")
+ });
+ const auto output = createNode({
+ createPort(QShaderNodePort::Input, "output")
+ });
+ const auto function1 = createNode({
+ createPort(QShaderNodePort::Input, "function1Input1"),
+ createPort(QShaderNodePort::Input, "function1Input2"),
+ createPort(QShaderNodePort::Output, "function1Output")
+ });
+ const auto function2 = createNode({
+ createPort(QShaderNodePort::Input, "function2Input"),
+ createPort(QShaderNodePort::Output, "function2Output")
+ });
+ const auto function3 = createNode({
+ createPort(QShaderNodePort::Input, "function3Input"),
+ createPort(QShaderNodePort::Output, "function3Output")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+ res.addNode(input);
+ res.addNode(output);
+ res.addNode(function1);
+ res.addNode(function2);
+ res.addNode(function3);
+ res.addEdge(createEdge(input.uuid(), "input", function1.uuid(), "function1Input1"));
+ res.addEdge(createEdge(function1.uuid(), "function1Output", function2.uuid(), "function2Input"));
+ res.addEdge(createEdge(function2.uuid(), "function2Output", function3.uuid(), "function3Input"));
+ res.addEdge(createEdge(function3.uuid(), "function3Output", function1.uuid(), "function1Input2"));
+ res.addEdge(createEdge(function2.uuid(), "function2Output", output.uuid(), "output"));
+ return res;
+ }();
+
+ // WHEN
+ const auto statements = graph.createStatements();
+
+ // THEN
+ // Obviously will lead to a compile failure later on since it cuts everything beyond the cycle
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(output, {2}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+}
+
+void tst_QShaderGraph::shouldDealWithEdgesJumpingOverLayers()
+{
+ // GIVEN
+ const auto worldPosition = createNode({
+ createPort(QShaderNodePort::Output, "worldPosition")
+ });
+ const auto texture = createNode({
+ createPort(QShaderNodePort::Output, "texture")
+ });
+ const auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ });
+ const auto lightIntensity = createNode({
+ createPort(QShaderNodePort::Output, "lightIntensity")
+ });
+ const auto exposure = createNode({
+ createPort(QShaderNodePort::Output, "exposure")
+ });
+ const auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ const auto sampleTexture = createNode({
+ createPort(QShaderNodePort::Input, "sampler"),
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ });
+ const auto lightFunction = createNode({
+ createPort(QShaderNodePort::Input, "baseColor"),
+ createPort(QShaderNodePort::Input, "position"),
+ createPort(QShaderNodePort::Input, "lightIntensity"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ const auto exposureFunction = createNode({
+ createPort(QShaderNodePort::Input, "inputColor"),
+ createPort(QShaderNodePort::Input, "exposure"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+
+ res.addNode(worldPosition);
+ res.addNode(texture);
+ res.addNode(texCoord);
+ res.addNode(lightIntensity);
+ res.addNode(exposure);
+ res.addNode(fragColor);
+ res.addNode(sampleTexture);
+ res.addNode(lightFunction);
+ res.addNode(exposureFunction);
+
+ res.addEdge(createEdge(texture.uuid(), "texture", sampleTexture.uuid(), "sampler"));
+ res.addEdge(createEdge(texCoord.uuid(), "texCoord", sampleTexture.uuid(), "coord"));
+
+ res.addEdge(createEdge(worldPosition.uuid(), "worldPosition", lightFunction.uuid(), "position"));
+ res.addEdge(createEdge(sampleTexture.uuid(), "color", lightFunction.uuid(), "baseColor"));
+ res.addEdge(createEdge(lightIntensity.uuid(), "lightIntensity", lightFunction.uuid(), "lightIntensity"));
+
+ res.addEdge(createEdge(lightFunction.uuid(), "outputColor", exposureFunction.uuid(), "inputColor"));
+ res.addEdge(createEdge(exposure.uuid(), "exposure", exposureFunction.uuid(), "exposure"));
+
+ res.addEdge(createEdge(exposureFunction.uuid(), "outputColor", fragColor.uuid(), "fragColor"));
+
+ return res;
+ }();
+
+ // WHEN
+ const auto statements = graph.createStatements();
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(texCoord, {}, {2})
+ << createStatement(texture, {}, {1})
+ << createStatement(lightIntensity, {}, {3})
+ << createStatement(sampleTexture, {1, 2}, {5})
+ << createStatement(worldPosition, {}, {0})
+ << createStatement(exposure, {}, {4})
+ << createStatement(lightFunction, {5, 0, 3}, {6})
+ << createStatement(exposureFunction, {6, 4}, {7})
+ << createStatement(fragColor, {7}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+}
+
+void tst_QShaderGraph::shouldGenerateDifferentStatementsDependingOnActiveLayers()
+{
+ // GIVEN
+ const auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ }, {
+ "diffuseTexture",
+ "normalTexture"
+ });
+ const auto diffuseUniform = createNode({
+ createPort(QShaderNodePort::Output, "color")
+ }, {"diffuseUniform"});
+ const auto diffuseTexture = createNode({
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ }, {"diffuseTexture"});
+ const auto normalUniform = createNode({
+ createPort(QShaderNodePort::Output, "normal")
+ }, {"normalUniform"});
+ const auto normalTexture = createNode({
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "normal")
+ }, {"normalTexture"});
+ const auto lightFunction = createNode({
+ createPort(QShaderNodePort::Input, "color"),
+ createPort(QShaderNodePort::Input, "normal"),
+ createPort(QShaderNodePort::Output, "output")
+ });
+ const auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+
+ const auto graph = [=] {
+ auto res = QShaderGraph();
+
+ res.addNode(texCoord);
+ res.addNode(diffuseUniform);
+ res.addNode(diffuseTexture);
+ res.addNode(normalUniform);
+ res.addNode(normalTexture);
+ res.addNode(lightFunction);
+ res.addNode(fragColor);
+
+ res.addEdge(createEdge(diffuseUniform.uuid(), "color", lightFunction.uuid(), "color", {"diffuseUniform"}));
+ res.addEdge(createEdge(texCoord.uuid(), "texCoord", diffuseTexture.uuid(), "coord", {"diffuseTexture"}));
+ res.addEdge(createEdge(diffuseTexture.uuid(), "color", lightFunction.uuid(), "color", {"diffuseTexture"}));
+
+ res.addEdge(createEdge(normalUniform.uuid(), "normal", lightFunction.uuid(), "normal", {"normalUniform"}));
+ res.addEdge(createEdge(texCoord.uuid(), "texCoord", normalTexture.uuid(), "coord", {"normalTexture"}));
+ res.addEdge(createEdge(normalTexture.uuid(), "normal", lightFunction.uuid(), "normal", {"normalTexture"}));
+
+ res.addEdge(createEdge(lightFunction.uuid(), "output", fragColor.uuid(), "fragColor"));
+
+ return res;
+ }();
+
+ {
+ // WHEN
+ const auto statements = graph.createStatements({"diffuseUniform", "normalUniform"});
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(normalUniform, {}, {1})
+ << createStatement(diffuseUniform, {}, {0})
+ << createStatement(lightFunction, {0, 1}, {2})
+ << createStatement(fragColor, {2}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+ }
+
+ {
+ // WHEN
+ const auto statements = graph.createStatements({"diffuseUniform", "normalTexture"});
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(texCoord, {}, {0})
+ << createStatement(normalTexture, {0}, {2})
+ << createStatement(diffuseUniform, {}, {1})
+ << createStatement(lightFunction, {1, 2}, {3})
+ << createStatement(fragColor, {3}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+ }
+
+ {
+ // WHEN
+ const auto statements = graph.createStatements({"diffuseTexture", "normalUniform"});
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(texCoord, {}, {0})
+ << createStatement(normalUniform, {}, {2})
+ << createStatement(diffuseTexture, {0}, {1})
+ << createStatement(lightFunction, {1, 2}, {3})
+ << createStatement(fragColor, {3}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+ }
+
+ {
+ // WHEN
+ const auto statements = graph.createStatements({"diffuseTexture", "normalTexture"});
+
+ // THEN
+ const auto expected = QVector<QShaderGraph::Statement>()
+ << createStatement(texCoord, {}, {0})
+ << createStatement(normalTexture, {0}, {2})
+ << createStatement(diffuseTexture, {0}, {1})
+ << createStatement(lightFunction, {1, 2}, {3})
+ << createStatement(fragColor, {3}, {});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+ }
+}
+
+QTEST_MAIN(tst_QShaderGraph)
+
+#include "tst_qshadergraph.moc"
diff --git a/tests/auto/gui/util/qshadergraphloader/qshadergraphloader.pro b/tests/auto/gui/util/qshadergraphloader/qshadergraphloader.pro
new file mode 100644
index 0000000000..e80a93f9e8
--- /dev/null
+++ b/tests/auto/gui/util/qshadergraphloader/qshadergraphloader.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+QT += testlib gui-private
+
+SOURCES += tst_qshadergraphloader.cpp
+TARGET = tst_qshadergraphloader
diff --git a/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp b/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp
new file mode 100644
index 0000000000..761e03a195
--- /dev/null
+++ b/tests/auto/gui/util/qshadergraphloader/tst_qshadergraphloader.cpp
@@ -0,0 +1,625 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtCore/qbuffer.h>
+
+#include <QtGui/private/qshadergraphloader_p.h>
+#include <QtGui/private/qshaderlanguage_p.h>
+
+using QBufferPointer = QSharedPointer<QBuffer>;
+Q_DECLARE_METATYPE(QBufferPointer);
+
+using PrototypeHash = QHash<QString, QShaderNode>;
+Q_DECLARE_METATYPE(PrototypeHash);
+
+namespace
+{
+ QBufferPointer createBuffer(const QByteArray &data, QIODevice::OpenMode openMode = QIODevice::ReadOnly)
+ {
+ auto buffer = QBufferPointer::create();
+ buffer->setData(data);
+ if (openMode != QIODevice::NotOpen)
+ buffer->open(openMode);
+ return buffer;
+ }
+
+ QShaderFormat createFormat(QShaderFormat::Api api, int majorVersion, int minorVersion)
+ {
+ auto format = QShaderFormat();
+ format.setApi(api);
+ format.setVersion(QVersionNumber(majorVersion, minorVersion));
+ return format;
+ }
+
+ QShaderNodePort createPort(QShaderNodePort::Direction portDirection, const QString &portName)
+ {
+ auto port = QShaderNodePort();
+ port.direction = portDirection;
+ port.name = portName;
+ return port;
+ }
+
+ QShaderNode createNode(const QVector<QShaderNodePort> &ports, const QStringList &layers = QStringList())
+ {
+ auto node = QShaderNode();
+ node.setUuid(QUuid::createUuid());
+ node.setLayers(layers);
+ for (const auto &port : ports)
+ node.addPort(port);
+ return node;
+ }
+
+ QShaderGraph::Edge createEdge(const QUuid &sourceUuid, const QString &sourceName,
+ const QUuid &targetUuid, const QString &targetName,
+ const QStringList &layers = QStringList())
+ {
+ auto edge = QShaderGraph::Edge();
+ edge.sourceNodeUuid = sourceUuid;
+ edge.sourcePortName = sourceName;
+ edge.targetNodeUuid = targetUuid;
+ edge.targetPortName = targetName;
+ edge.layers = layers;
+ return edge;
+ }
+
+ QShaderGraph createGraph()
+ {
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+
+ auto graph = QShaderGraph();
+
+ auto worldPosition = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ worldPosition.setUuid(QUuid("{00000000-0000-0000-0000-000000000001}"));
+ worldPosition.setParameter("name", "worldPosition");
+ worldPosition.setParameter("qualifier", QVariant::fromValue<QShaderLanguage::StorageQualifier>(QShaderLanguage::Input));
+ worldPosition.setParameter("type", QVariant::fromValue<QShaderLanguage::VariableType>(QShaderLanguage::Vec3));
+ worldPosition.addRule(openGLES2, QShaderNode::Rule("highp $type $value = $name;",
+ QByteArrayList() << "$qualifier highp $type $name;"));
+ worldPosition.addRule(openGL3, QShaderNode::Rule("$type $value = $name;",
+ QByteArrayList() << "$qualifier $type $name;"));
+
+ auto texture = createNode({
+ createPort(QShaderNodePort::Output, "texture")
+ });
+ texture.setUuid(QUuid("{00000000-0000-0000-0000-000000000002}"));
+ texture.addRule(openGLES2, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+ texture.addRule(openGL3, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+
+ auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ });
+ texCoord.setUuid(QUuid("{00000000-0000-0000-0000-000000000003}"));
+ texCoord.addRule(openGLES2, QShaderNode::Rule("highp vec2 $texCoord = texCoord;",
+ QByteArrayList() << "varying highp vec2 texCoord;"));
+ texCoord.addRule(openGL3, QShaderNode::Rule("vec2 $texCoord = texCoord;",
+ QByteArrayList() << "in vec2 texCoord;"));
+
+ auto lightIntensity = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ lightIntensity.setUuid(QUuid("{00000000-0000-0000-0000-000000000004}"));
+ lightIntensity.setParameter("name", "defaultName");
+ lightIntensity.setParameter("qualifier", QVariant::fromValue<QShaderLanguage::StorageQualifier>(QShaderLanguage::Uniform));
+ lightIntensity.setParameter("type", QVariant::fromValue<QShaderLanguage::VariableType>(QShaderLanguage::Float));
+ lightIntensity.addRule(openGLES2, QShaderNode::Rule("highp $type $value = $name;",
+ QByteArrayList() << "$qualifier highp $type $name;"));
+ lightIntensity.addRule(openGL3, QShaderNode::Rule("$type $value = $name;",
+ QByteArrayList() << "$qualifier $type $name;"));
+
+ auto exposure = createNode({
+ createPort(QShaderNodePort::Output, "exposure")
+ });
+ exposure.setUuid(QUuid("{00000000-0000-0000-0000-000000000005}"));
+ exposure.addRule(openGLES2, QShaderNode::Rule("highp float $exposure = exposure;",
+ QByteArrayList() << "uniform highp float exposure;"));
+ exposure.addRule(openGL3, QShaderNode::Rule("float $exposure = exposure;",
+ QByteArrayList() << "uniform float exposure;"));
+
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.setUuid(QUuid("{00000000-0000-0000-0000-000000000006}"));
+ fragColor.addRule(openGLES2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(openGL3, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+
+ auto sampleTexture = createNode({
+ createPort(QShaderNodePort::Input, "sampler"),
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ });
+ sampleTexture.setUuid(QUuid("{00000000-0000-0000-0000-000000000007}"));
+ sampleTexture.addRule(openGLES2, QShaderNode::Rule("highp vec4 $color = texture2D($sampler, $coord);"));
+ sampleTexture.addRule(openGL3, QShaderNode::Rule("vec4 $color = texture2D($sampler, $coord);"));
+
+ auto lightFunction = createNode({
+ createPort(QShaderNodePort::Input, "baseColor"),
+ createPort(QShaderNodePort::Input, "position"),
+ createPort(QShaderNodePort::Input, "lightIntensity"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ lightFunction.setUuid(QUuid("{00000000-0000-0000-0000-000000000008}"));
+ lightFunction.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include es2/lightmodel.frag.inc"));
+ lightFunction.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include gl3/lightmodel.frag.inc"));
+
+ auto exposureFunction = createNode({
+ createPort(QShaderNodePort::Input, "inputColor"),
+ createPort(QShaderNodePort::Input, "exposure"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ exposureFunction.setUuid(QUuid("{00000000-0000-0000-0000-000000000009}"));
+ exposureFunction.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+ exposureFunction.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+
+ graph.addNode(worldPosition);
+ graph.addNode(texture);
+ graph.addNode(texCoord);
+ graph.addNode(lightIntensity);
+ graph.addNode(exposure);
+ graph.addNode(fragColor);
+ graph.addNode(sampleTexture);
+ graph.addNode(lightFunction);
+ graph.addNode(exposureFunction);
+
+ graph.addEdge(createEdge(texture.uuid(), "texture", sampleTexture.uuid(), "sampler"));
+ graph.addEdge(createEdge(texCoord.uuid(), "texCoord", sampleTexture.uuid(), "coord"));
+
+ graph.addEdge(createEdge(worldPosition.uuid(), "value", lightFunction.uuid(), "position"));
+ graph.addEdge(createEdge(sampleTexture.uuid(), "color", lightFunction.uuid(), "baseColor"));
+ graph.addEdge(createEdge(lightIntensity.uuid(), "value", lightFunction.uuid(), "lightIntensity"));
+
+ graph.addEdge(createEdge(lightFunction.uuid(), "outputColor", exposureFunction.uuid(), "inputColor"));
+ graph.addEdge(createEdge(exposure.uuid(), "exposure", exposureFunction.uuid(), "exposure"));
+
+ graph.addEdge(createEdge(exposureFunction.uuid(), "outputColor", fragColor.uuid(), "fragColor"));
+
+ return graph;
+ }
+
+ void debugStatement(const QString &prefix, const QShaderGraph::Statement &statement)
+ {
+ qDebug() << prefix << statement.inputs << statement.uuid().toString() << statement.outputs;
+ }
+
+ void dumpStatementsIfNeeded(const QVector<QShaderGraph::Statement> &statements, const QVector<QShaderGraph::Statement> &expected)
+ {
+ if (statements != expected) {
+ for (int i = 0; i < qMax(statements.size(), expected.size()); i++) {
+ qDebug() << "----" << i << "----";
+ if (i < statements.size())
+ debugStatement("A:", statements.at(i));
+ if (i < expected.size())
+ debugStatement("E:", expected.at(i));
+ qDebug() << "-----------";
+ }
+ }
+ }
+}
+
+class tst_QShaderGraphLoader : public QObject
+{
+ Q_OBJECT
+private slots:
+ void shouldManipulateLoaderMembers();
+ void shouldLoadFromJsonStream_data();
+ void shouldLoadFromJsonStream();
+};
+
+void tst_QShaderGraphLoader::shouldManipulateLoaderMembers()
+{
+ // GIVEN
+ auto loader = QShaderGraphLoader();
+
+ // THEN (default state)
+ QCOMPARE(loader.status(), QShaderGraphLoader::Null);
+ QVERIFY(!loader.device());
+ QVERIFY(loader.graph().nodes().isEmpty());
+ QVERIFY(loader.graph().edges().isEmpty());
+ QVERIFY(loader.prototypes().isEmpty());
+
+ // WHEN
+ auto device1 = createBuffer(QByteArray("..........."), QIODevice::NotOpen);
+ loader.setDevice(device1.data());
+
+ // THEN
+ QCOMPARE(loader.status(), QShaderGraphLoader::Error);
+ QCOMPARE(loader.device(), device1.data());
+ QVERIFY(loader.graph().nodes().isEmpty());
+ QVERIFY(loader.graph().edges().isEmpty());
+
+ // WHEN
+ auto device2 = createBuffer(QByteArray("..........."), QIODevice::ReadOnly);
+ loader.setDevice(device2.data());
+
+ // THEN
+ QCOMPARE(loader.status(), QShaderGraphLoader::Waiting);
+ QCOMPARE(loader.device(), device2.data());
+ QVERIFY(loader.graph().nodes().isEmpty());
+ QVERIFY(loader.graph().edges().isEmpty());
+
+
+ // WHEN
+ const auto prototypes = [this]{
+ auto res = QHash<QString, QShaderNode>();
+ res.insert("foo", createNode({}));
+ return res;
+ }();
+ loader.setPrototypes(prototypes);
+
+ // THEN
+ QCOMPARE(loader.prototypes().size(), prototypes.size());
+ QVERIFY(loader.prototypes().contains("foo"));
+ QCOMPARE(loader.prototypes().value("foo").uuid(), prototypes.value("foo").uuid());
+}
+
+void tst_QShaderGraphLoader::shouldLoadFromJsonStream_data()
+{
+ QTest::addColumn<QBufferPointer>("device");
+ QTest::addColumn<PrototypeHash>("prototypes");
+ QTest::addColumn<QShaderGraph>("graph");
+ QTest::addColumn<QShaderGraphLoader::Status>("status");
+
+ QTest::newRow("empty") << createBuffer("", QIODevice::ReadOnly) << PrototypeHash()
+ << QShaderGraph() << QShaderGraphLoader::Error;
+
+ const auto smallJson = "{"
+ " \"nodes\": ["
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000001}\","
+ " \"type\": \"MyInput\","
+ " \"layers\": [\"foo\", \"bar\"]"
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000002}\","
+ " \"type\": \"MyOutput\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000003}\","
+ " \"type\": \"MyFunction\""
+ " }"
+ " ],"
+ " \"edges\": ["
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000001}\","
+ " \"sourcePort\": \"input\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000003}\","
+ " \"targetPort\": \"functionInput\","
+ " \"layers\": [\"bar\", \"baz\"]"
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000003}\","
+ " \"sourcePort\": \"functionOutput\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000002}\","
+ " \"targetPort\": \"output\""
+ " }"
+ " ]"
+ "}";
+
+ const auto smallProtos = [this]{
+ auto protos = PrototypeHash();
+
+ auto input = createNode({
+ createPort(QShaderNodePort::Output, "input")
+ });
+ protos.insert("MyInput", input);
+
+ auto output = createNode({
+ createPort(QShaderNodePort::Input, "output")
+ });
+ protos.insert("MyOutput", output);
+
+ auto function = createNode({
+ createPort(QShaderNodePort::Input, "functionInput"),
+ createPort(QShaderNodePort::Output, "functionOutput")
+ });
+ protos.insert("MyFunction", function);
+ return protos;
+ }();
+
+ const auto smallGraph = [this]{
+ auto graph = QShaderGraph();
+
+ auto input = createNode({
+ createPort(QShaderNodePort::Output, "input")
+ }, {"foo", "bar"});
+ input.setUuid(QUuid("{00000000-0000-0000-0000-000000000001}"));
+ auto output = createNode({
+ createPort(QShaderNodePort::Input, "output")
+ });
+ output.setUuid(QUuid("{00000000-0000-0000-0000-000000000002}"));
+ auto function = createNode({
+ createPort(QShaderNodePort::Input, "functionInput"),
+ createPort(QShaderNodePort::Output, "functionOutput")
+ });
+ function.setUuid(QUuid("{00000000-0000-0000-0000-000000000003}"));
+
+ graph.addNode(input);
+ graph.addNode(output);
+ graph.addNode(function);
+ graph.addEdge(createEdge(input.uuid(), "input", function.uuid(), "functionInput", {"bar", "baz"}));
+ graph.addEdge(createEdge(function.uuid(), "functionOutput", output.uuid(), "output"));
+
+ return graph;
+ }();
+
+ QTest::newRow("TwoNodesOneEdge") << createBuffer(smallJson) << smallProtos << smallGraph << QShaderGraphLoader::Ready;
+ QTest::newRow("NotOpen") << createBuffer(smallJson, QIODevice::NotOpen) << smallProtos << QShaderGraph() << QShaderGraphLoader::Error;
+ QTest::newRow("NoPrototype") << createBuffer(smallJson) << PrototypeHash() << QShaderGraph() << QShaderGraphLoader::Error;
+
+ const auto complexJson = "{"
+ " \"nodes\": ["
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000001}\","
+ " \"type\": \"inputValue\","
+ " \"parameters\": {"
+ " \"name\": \"worldPosition\","
+ " \"qualifier\": {"
+ " \"type\": \"QShaderLanguage::StorageQualifier\","
+ " \"value\": \"QShaderLanguage::Input\""
+ " },"
+ " \"type\": {"
+ " \"type\": \"QShaderLanguage::VariableType\","
+ " \"value\": \"QShaderLanguage::Vec3\""
+ " }"
+ " }"
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000002}\","
+ " \"type\": \"texture\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000003}\","
+ " \"type\": \"texCoord\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000004}\","
+ " \"type\": \"inputValue\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000005}\","
+ " \"type\": \"exposure\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000006}\","
+ " \"type\": \"fragColor\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000007}\","
+ " \"type\": \"sampleTexture\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000008}\","
+ " \"type\": \"lightModel\""
+ " },"
+ " {"
+ " \"uuid\": \"{00000000-0000-0000-0000-000000000009}\","
+ " \"type\": \"exposureFunction\""
+ " }"
+ " ],"
+ " \"edges\": ["
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000002}\","
+ " \"sourcePort\": \"texture\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000007}\","
+ " \"targetPort\": \"sampler\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000003}\","
+ " \"sourcePort\": \"texCoord\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000007}\","
+ " \"targetPort\": \"coord\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000001}\","
+ " \"sourcePort\": \"value\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000008}\","
+ " \"targetPort\": \"position\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000007}\","
+ " \"sourcePort\": \"color\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000008}\","
+ " \"targetPort\": \"baseColor\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000004}\","
+ " \"sourcePort\": \"value\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000008}\","
+ " \"targetPort\": \"lightIntensity\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000008}\","
+ " \"sourcePort\": \"outputColor\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000009}\","
+ " \"targetPort\": \"inputColor\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000005}\","
+ " \"sourcePort\": \"exposure\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000009}\","
+ " \"targetPort\": \"exposure\""
+ " },"
+ " {"
+ " \"sourceUuid\": \"{00000000-0000-0000-0000-000000000009}\","
+ " \"sourcePort\": \"outputColor\","
+ " \"targetUuid\": \"{00000000-0000-0000-0000-000000000006}\","
+ " \"targetPort\": \"fragColor\""
+ " }"
+ " ]"
+ "}";
+
+ const auto complexProtos = [this]{
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+
+ auto protos = PrototypeHash();
+
+ auto inputValue = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ inputValue.setParameter("name", "defaultName");
+ inputValue.setParameter("qualifier", QVariant::fromValue<QShaderLanguage::StorageQualifier>(QShaderLanguage::Uniform));
+ inputValue.setParameter("type", QVariant::fromValue<QShaderLanguage::VariableType>(QShaderLanguage::Float));
+ inputValue.addRule(openGLES2, QShaderNode::Rule("highp $type $value = $name;",
+ QByteArrayList() << "$qualifier highp $type $name;"));
+ inputValue.addRule(openGL3, QShaderNode::Rule("$type $value = $name;",
+ QByteArrayList() << "$qualifier $type $name;"));
+ protos.insert("inputValue", inputValue);
+
+ auto texture = createNode({
+ createPort(QShaderNodePort::Output, "texture")
+ });
+ texture.addRule(openGLES2, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+ texture.addRule(openGL3, QShaderNode::Rule("sampler2D $texture = texture;",
+ QByteArrayList() << "uniform sampler2D texture;"));
+ protos.insert("texture", texture);
+
+ auto texCoord = createNode({
+ createPort(QShaderNodePort::Output, "texCoord")
+ });
+ texCoord.addRule(openGLES2, QShaderNode::Rule("highp vec2 $texCoord = texCoord;",
+ QByteArrayList() << "varying highp vec2 texCoord;"));
+ texCoord.addRule(openGL3, QShaderNode::Rule("vec2 $texCoord = texCoord;",
+ QByteArrayList() << "in vec2 texCoord;"));
+ protos.insert("texCoord", texCoord);
+
+ auto exposure = createNode({
+ createPort(QShaderNodePort::Output, "exposure")
+ });
+ exposure.addRule(openGLES2, QShaderNode::Rule("highp float $exposure = exposure;",
+ QByteArrayList() << "uniform highp float exposure;"));
+ exposure.addRule(openGL3, QShaderNode::Rule("float $exposure = exposure;",
+ QByteArrayList() << "uniform float exposure;"));
+ protos.insert("exposure", exposure);
+
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.addRule(openGLES2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(openGL3, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+ protos.insert("fragColor", fragColor);
+
+ auto sampleTexture = createNode({
+ createPort(QShaderNodePort::Input, "sampler"),
+ createPort(QShaderNodePort::Input, "coord"),
+ createPort(QShaderNodePort::Output, "color")
+ });
+ sampleTexture.addRule(openGLES2, QShaderNode::Rule("highp vec4 $color = texture2D($sampler, $coord);"));
+ sampleTexture.addRule(openGL3, QShaderNode::Rule("vec4 $color = texture2D($sampler, $coord);"));
+ protos.insert("sampleTexture", sampleTexture);
+
+ auto lightModel = createNode({
+ createPort(QShaderNodePort::Input, "baseColor"),
+ createPort(QShaderNodePort::Input, "position"),
+ createPort(QShaderNodePort::Input, "lightIntensity"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ lightModel.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include es2/lightmodel.frag.inc"));
+ lightModel.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include gl3/lightmodel.frag.inc"));
+ protos.insert("lightModel", lightModel);
+
+ auto exposureFunction = createNode({
+ createPort(QShaderNodePort::Input, "inputColor"),
+ createPort(QShaderNodePort::Input, "exposure"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ exposureFunction.addRule(openGLES2, QShaderNode::Rule("highp vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+ exposureFunction.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = $inputColor * pow(2.0, $exposure);"));
+ protos.insert("exposureFunction", exposureFunction);
+
+ return protos;
+ }();
+
+ const auto complexGraph = createGraph();
+
+ QTest::newRow("ComplexGraph") << createBuffer(complexJson) << complexProtos << complexGraph << QShaderGraphLoader::Ready;
+}
+
+void tst_QShaderGraphLoader::shouldLoadFromJsonStream()
+{
+ // GIVEN
+ QFETCH(QBufferPointer, device);
+ QFETCH(PrototypeHash, prototypes);
+
+ auto loader = QShaderGraphLoader();
+
+ // WHEN
+ loader.setPrototypes(prototypes);
+ loader.setDevice(device.data());
+ loader.load();
+
+ // THEN
+ QFETCH(QShaderGraphLoader::Status, status);
+ QCOMPARE(loader.status(), status);
+
+ QFETCH(QShaderGraph, graph);
+ const auto statements = loader.graph().createStatements({"foo", "bar", "baz"});
+ const auto expected = graph.createStatements({"foo", "bar", "baz"});
+ dumpStatementsIfNeeded(statements, expected);
+ QCOMPARE(statements, expected);
+
+ const auto sortedParameters = [](const QShaderNode &node) {
+ auto res = node.parameterNames();
+ res.sort();
+ return res;
+ };
+
+ for (int i = 0; i < statements.size(); i++) {
+ const auto actualNode = statements.at(i).node;
+ const auto expectedNode = expected.at(i).node;
+
+ QCOMPARE(actualNode.layers(), expectedNode.layers());
+ QCOMPARE(actualNode.ports(), expectedNode.ports());
+ QCOMPARE(sortedParameters(actualNode), sortedParameters(expectedNode));
+ for (const auto &name : expectedNode.parameterNames()) {
+ QCOMPARE(actualNode.parameter(name), expectedNode.parameter(name));
+ }
+ QCOMPARE(actualNode.availableFormats(), expectedNode.availableFormats());
+ for (const auto &format : expectedNode.availableFormats()) {
+ QCOMPARE(actualNode.rule(format), expectedNode.rule(format));
+ }
+ }
+}
+
+QTEST_MAIN(tst_QShaderGraphLoader)
+
+#include "tst_qshadergraphloader.moc"
diff --git a/tests/auto/gui/util/qshadernodes/qshadernodes.pro b/tests/auto/gui/util/qshadernodes/qshadernodes.pro
new file mode 100644
index 0000000000..5ab8b73a51
--- /dev/null
+++ b/tests/auto/gui/util/qshadernodes/qshadernodes.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+QT += testlib gui-private
+
+SOURCES += tst_qshadernodes.cpp
+TARGET = tst_qshadernodes
diff --git a/tests/auto/gui/util/qshadernodes/tst_qshadernodes.cpp b/tests/auto/gui/util/qshadernodes/tst_qshadernodes.cpp
new file mode 100644
index 0000000000..9eb738a1b2
--- /dev/null
+++ b/tests/auto/gui/util/qshadernodes/tst_qshadernodes.cpp
@@ -0,0 +1,548 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtGui/private/qshaderformat_p.h>
+#include <QtGui/private/qshadernode_p.h>
+#include <QtGui/private/qshadernodeport_p.h>
+
+namespace
+{
+ QShaderFormat createFormat(QShaderFormat::Api api, int majorVersion, int minorVersion,
+ const QStringList &extensions = QStringList(),
+ const QString &vendor = QString())
+ {
+ auto format = QShaderFormat();
+ format.setApi(api);
+ format.setVersion(QVersionNumber(majorVersion, minorVersion));
+ format.setExtensions(extensions);
+ format.setVendor(vendor);
+ return format;
+ }
+
+ QShaderNodePort createPort(QShaderNodePort::Direction direction, const QString &name)
+ {
+ auto port = QShaderNodePort();
+ port.direction = direction;
+ port.name = name;
+ return port;
+ }
+}
+
+class tst_QShaderNodes : public QObject
+{
+ Q_OBJECT
+private slots:
+ void shouldManipulateFormatMembers();
+ void shouldVerifyFormatsEquality_data();
+ void shouldVerifyFormatsEquality();
+ void shouldVerifyFormatsCompatibilities_data();
+ void shouldVerifyFormatsCompatibilities();
+
+ void shouldHaveDefaultPortState();
+ void shouldVerifyPortsEquality_data();
+ void shouldVerifyPortsEquality();
+
+ void shouldManipulateNodeMembers();
+ void shouldHandleNodeRulesSupportAndOrder();
+};
+
+void tst_QShaderNodes::shouldManipulateFormatMembers()
+{
+ // GIVEN
+ auto format = QShaderFormat();
+
+ // THEN (default state)
+ QCOMPARE(format.api(), QShaderFormat::NoApi);
+ QCOMPARE(format.version().majorVersion(), 0);
+ QCOMPARE(format.version().minorVersion(), 0);
+ QCOMPARE(format.extensions(), QStringList());
+ QCOMPARE(format.vendor(), QString());
+ QVERIFY(!format.isValid());
+
+ // WHEN
+ format.setApi(QShaderFormat::OpenGLES);
+
+ // THEN
+ QCOMPARE(format.api(), QShaderFormat::OpenGLES);
+ QCOMPARE(format.version().majorVersion(), 0);
+ QCOMPARE(format.version().minorVersion(), 0);
+ QCOMPARE(format.extensions(), QStringList());
+ QCOMPARE(format.vendor(), QString());
+ QVERIFY(!format.isValid());
+
+ // WHEN
+ format.setVersion(QVersionNumber(3));
+
+ // THEN
+ QCOMPARE(format.api(), QShaderFormat::OpenGLES);
+ QCOMPARE(format.version().majorVersion(), 3);
+ QCOMPARE(format.version().minorVersion(), 0);
+ QCOMPARE(format.extensions(), QStringList());
+ QCOMPARE(format.vendor(), QString());
+ QVERIFY(format.isValid());
+
+ // WHEN
+ format.setVersion(QVersionNumber(3, 2));
+
+ // THEN
+ QCOMPARE(format.api(), QShaderFormat::OpenGLES);
+ QCOMPARE(format.version().majorVersion(), 3);
+ QCOMPARE(format.version().minorVersion(), 2);
+ QCOMPARE(format.extensions(), QStringList());
+ QCOMPARE(format.vendor(), QString());
+ QVERIFY(format.isValid());
+
+ // WHEN
+ format.setExtensions({"foo", "bar"});
+
+ // THEN
+ QCOMPARE(format.api(), QShaderFormat::OpenGLES);
+ QCOMPARE(format.version().majorVersion(), 3);
+ QCOMPARE(format.version().minorVersion(), 2);
+ QCOMPARE(format.extensions(), QStringList({"bar", "foo"}));
+ QCOMPARE(format.vendor(), QString());
+ QVERIFY(format.isValid());
+
+ // WHEN
+ format.setVendor(QStringLiteral("KDAB"));
+
+ // THEN
+ QCOMPARE(format.api(), QShaderFormat::OpenGLES);
+ QCOMPARE(format.version().majorVersion(), 3);
+ QCOMPARE(format.version().minorVersion(), 2);
+ QCOMPARE(format.extensions(), QStringList({"bar", "foo"}));
+ QCOMPARE(format.vendor(), QStringLiteral("KDAB"));
+ QVERIFY(format.isValid());
+}
+
+void tst_QShaderNodes::shouldVerifyFormatsEquality_data()
+{
+ QTest::addColumn<QShaderFormat>("left");
+ QTest::addColumn<QShaderFormat>("right");
+ QTest::addColumn<bool>("expected");
+
+ QTest::newRow("Equals") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << true;
+ QTest::newRow("Apis") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLNoProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << false;
+ QTest::newRow("Major") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0, {"foo", "bar"}, "KDAB")
+ << false;
+ QTest::newRow("Minor") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1, {"foo", "bar"}, "KDAB")
+ << false;
+ QTest::newRow("Extensions") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"}, "KDAB")
+ << false;
+ QTest::newRow("Vendor") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
+ << false;
+}
+
+void tst_QShaderNodes::shouldVerifyFormatsEquality()
+{
+ // GIVEN
+ QFETCH(QShaderFormat, left);
+ QFETCH(QShaderFormat, right);
+
+ // WHEN
+ const auto equal = (left == right);
+ const auto notEqual = (left != right);
+
+ // THEN
+ QFETCH(bool, expected);
+ QCOMPARE(equal, expected);
+ QCOMPARE(notEqual, !expected);
+}
+
+void tst_QShaderNodes::shouldVerifyFormatsCompatibilities_data()
+{
+ QTest::addColumn<QShaderFormat>("reference");
+ QTest::addColumn<QShaderFormat>("tested");
+ QTest::addColumn<bool>("expected");
+
+ QTest::newRow("NoProfileVsES") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << true;
+ QTest::newRow("CoreProfileVsES") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << false;
+ QTest::newRow("CompatProfileVsES") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << true;
+
+ QTest::newRow("ESVsNoProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << false;
+ QTest::newRow("ESVsCoreProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << false;
+ QTest::newRow("ESVsCompatProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << false;
+
+ QTest::newRow("CoreVsNoProfile") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << false;
+ QTest::newRow("CoreVsCompat") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << false;
+ QTest::newRow("CoreVsCore") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << true;
+
+ QTest::newRow("NoProfileVsCore") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << true;
+ QTest::newRow("NoProvileVsCompat") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << true;
+ QTest::newRow("NoProfileVsNoProfile") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << true;
+
+ QTest::newRow("CompatVsCore") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << true;
+ QTest::newRow("CompatVsCompat") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << true;
+ QTest::newRow("CompatVsNoProfile") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
+ << true;
+
+ QTest::newRow("MajorForwardCompat_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << true;
+ QTest::newRow("MajorForwardCompat_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 4)
+ << true;
+ QTest::newRow("MajorForwardCompat_3") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << false;
+ QTest::newRow("MajorForwardCompat_4") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 4)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << false;
+
+ QTest::newRow("MinorForwardCompat_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << true;
+ QTest::newRow("MinorForwardCompat_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1)
+ << false;
+
+ QTest::newRow("Extensions_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"})
+ << true;
+ QTest::newRow("Extensions_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"})
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
+ << false;
+
+ QTest::newRow("Vendor_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {})
+ << true;
+ QTest::newRow("Vendor_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {})
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
+ << false;
+ QTest::newRow("Vendor_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
+ << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
+ << true;
+}
+
+void tst_QShaderNodes::shouldVerifyFormatsCompatibilities()
+{
+ // GIVEN
+ QFETCH(QShaderFormat, reference);
+ QFETCH(QShaderFormat, tested);
+
+ // WHEN
+ const auto supported = reference.supports(tested);
+
+ // THEN
+ QFETCH(bool, expected);
+ QCOMPARE(supported, expected);
+}
+
+void tst_QShaderNodes::shouldHaveDefaultPortState()
+{
+ // GIVEN
+ auto port = QShaderNodePort();
+
+ // THEN
+ QCOMPARE(port.direction, QShaderNodePort::Output);
+ QVERIFY(port.name.isEmpty());
+}
+
+void tst_QShaderNodes::shouldVerifyPortsEquality_data()
+{
+ QTest::addColumn<QShaderNodePort>("left");
+ QTest::addColumn<QShaderNodePort>("right");
+ QTest::addColumn<bool>("expected");
+
+ QTest::newRow("Equals") << createPort(QShaderNodePort::Input, "foo")
+ << createPort(QShaderNodePort::Input, "foo")
+ << true;
+ QTest::newRow("Direction") << createPort(QShaderNodePort::Input, "foo")
+ << createPort(QShaderNodePort::Output, "foo")
+ << false;
+ QTest::newRow("Name") << createPort(QShaderNodePort::Input, "foo")
+ << createPort(QShaderNodePort::Input, "bar")
+ << false;
+}
+
+void tst_QShaderNodes::shouldVerifyPortsEquality()
+{
+ // GIVEN
+ QFETCH(QShaderNodePort, left);
+ QFETCH(QShaderNodePort, right);
+
+ // WHEN
+ const auto equal = (left == right);
+ const auto notEqual = (left != right);
+
+ // THEN
+ QFETCH(bool, expected);
+ QCOMPARE(equal, expected);
+ QCOMPARE(notEqual, !expected);
+}
+
+void tst_QShaderNodes::shouldManipulateNodeMembers()
+{
+ // GIVEN
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+
+ const auto es2Rule = QShaderNode::Rule(QByteArrayLiteral("gles2"), {"#pragma include es2/foo.inc", "#pragma include es2/bar.inc"});
+ const auto gl3Rule = QShaderNode::Rule(QByteArrayLiteral("gl3"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
+ const auto gl3bisRule = QShaderNode::Rule(QByteArrayLiteral("gl3bis"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
+
+ auto node = QShaderNode();
+
+ // THEN (default state)
+ QCOMPARE(node.type(), QShaderNode::Invalid);
+ QVERIFY(node.uuid().isNull());
+ QVERIFY(node.layers().isEmpty());
+ QVERIFY(node.ports().isEmpty());
+ QVERIFY(node.parameterNames().isEmpty());
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ const auto uuid = QUuid::createUuid();
+ node.setUuid(uuid);
+
+ // THEN
+ QCOMPARE(node.uuid(), uuid);
+
+ // WHEN
+ node.setLayers({"foo", "bar"});
+
+ // THEN
+ QCOMPARE(node.layers(), QStringList({"foo", "bar"}));
+
+ // WHEN
+ auto firstPort = QShaderNodePort();
+ firstPort.direction = QShaderNodePort::Input;
+ firstPort.name = QStringLiteral("foo");
+ node.addPort(firstPort);
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Output);
+ QCOMPARE(node.ports().size(), 1);
+ QCOMPARE(node.ports().at(0), firstPort);
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ auto secondPort = QShaderNodePort();
+ secondPort.direction = QShaderNodePort::Output;
+ secondPort.name = QStringLiteral("bar");
+ node.addPort(secondPort);
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Function);
+ QCOMPARE(node.ports().size(), 2);
+ QCOMPARE(node.ports().at(0), firstPort);
+ QCOMPARE(node.ports().at(1), secondPort);
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ node.removePort(firstPort);
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Input);
+ QCOMPARE(node.ports().size(), 1);
+ QCOMPARE(node.ports().at(0), secondPort);
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ node.setParameter(QStringLiteral("baz"), 42);
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Input);
+ QCOMPARE(node.ports().size(), 1);
+ QCOMPARE(node.ports().at(0), secondPort);
+ auto parameterNames = node.parameterNames();
+ parameterNames.sort();
+ QCOMPARE(parameterNames.size(), 1);
+ QCOMPARE(parameterNames.at(0), QStringLiteral("baz"));
+ QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant(42));
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ node.setParameter(QStringLiteral("bleh"), QStringLiteral("value"));
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Input);
+ QCOMPARE(node.ports().size(), 1);
+ QCOMPARE(node.ports().at(0), secondPort);
+ parameterNames = node.parameterNames();
+ parameterNames.sort();
+ QCOMPARE(parameterNames.size(), 2);
+ QCOMPARE(parameterNames.at(0), QStringLiteral("baz"));
+ QCOMPARE(parameterNames.at(1), QStringLiteral("bleh"));
+ QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant(42));
+ QCOMPARE(node.parameter(QStringLiteral("bleh")), QVariant(QStringLiteral("value")));
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ node.clearParameter(QStringLiteral("baz"));
+
+ // THEN
+ QCOMPARE(node.type(), QShaderNode::Input);
+ QCOMPARE(node.ports().size(), 1);
+ QCOMPARE(node.ports().at(0), secondPort);
+ parameterNames = node.parameterNames();
+ parameterNames.sort();
+ QCOMPARE(parameterNames.size(), 1);
+ QCOMPARE(parameterNames.at(0), QStringLiteral("bleh"));
+ QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant());
+ QCOMPARE(node.parameter(QStringLiteral("bleh")), QVariant(QStringLiteral("value")));
+ QVERIFY(node.availableFormats().isEmpty());
+
+ // WHEN
+ node.addRule(openGLES2, es2Rule);
+ node.addRule(openGL3, gl3Rule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 2);
+ QCOMPARE(node.availableFormats().at(0), openGLES2);
+ QCOMPARE(node.availableFormats().at(1), openGL3);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3Rule);
+
+ // WHEN
+ node.removeRule(openGLES2);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 1);
+ QCOMPARE(node.availableFormats().at(0), openGL3);
+ QCOMPARE(node.rule(openGL3), gl3Rule);
+
+ // WHEN
+ node.addRule(openGLES2, es2Rule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 2);
+ QCOMPARE(node.availableFormats().at(0), openGL3);
+ QCOMPARE(node.availableFormats().at(1), openGLES2);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3Rule);
+
+ // WHEN
+ node.addRule(openGL3, gl3bisRule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 2);
+ QCOMPARE(node.availableFormats().at(0), openGLES2);
+ QCOMPARE(node.availableFormats().at(1), openGL3);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3bisRule);
+}
+
+void tst_QShaderNodes::shouldHandleNodeRulesSupportAndOrder()
+{
+ // GIVEN
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
+ const auto openGL32 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 2);
+ const auto openGL4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0);
+
+ const auto es2Rule = QShaderNode::Rule(QByteArrayLiteral("gles2"), {"#pragma include es2/foo.inc", "#pragma include es2/bar.inc"});
+ const auto gl3Rule = QShaderNode::Rule(QByteArrayLiteral("gl3"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
+ const auto gl32Rule = QShaderNode::Rule(QByteArrayLiteral("gl32"), {"#pragma include gl32/foo.inc", "#pragma include gl32/bar.inc"});
+ const auto gl3bisRule = QShaderNode::Rule(QByteArrayLiteral("gl3bis"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
+
+ auto node = QShaderNode();
+
+ // WHEN
+ node.addRule(openGLES2, es2Rule);
+ node.addRule(openGL3, gl3Rule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 2);
+ QCOMPARE(node.availableFormats().at(0), openGLES2);
+ QCOMPARE(node.availableFormats().at(1), openGL3);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3Rule);
+ QCOMPARE(node.rule(openGL32), gl3Rule);
+ QCOMPARE(node.rule(openGL4), gl3Rule);
+
+ // WHEN
+ node.addRule(openGL32, gl32Rule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 3);
+ QCOMPARE(node.availableFormats().at(0), openGLES2);
+ QCOMPARE(node.availableFormats().at(1), openGL3);
+ QCOMPARE(node.availableFormats().at(2), openGL32);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3Rule);
+ QCOMPARE(node.rule(openGL32), gl32Rule);
+ QCOMPARE(node.rule(openGL4), gl32Rule);
+
+ // WHEN
+ node.addRule(openGL3, gl3bisRule);
+
+ // THEN
+ QCOMPARE(node.availableFormats().size(), 3);
+ QCOMPARE(node.availableFormats().at(0), openGLES2);
+ QCOMPARE(node.availableFormats().at(1), openGL32);
+ QCOMPARE(node.availableFormats().at(2), openGL3);
+ QCOMPARE(node.rule(openGLES2), es2Rule);
+ QCOMPARE(node.rule(openGL3), gl3bisRule);
+ QCOMPARE(node.rule(openGL32), gl3bisRule);
+ QCOMPARE(node.rule(openGL4), gl3bisRule);
+}
+
+QTEST_MAIN(tst_QShaderNodes)
+
+#include "tst_qshadernodes.moc"
diff --git a/tests/auto/gui/util/qshadernodesloader/qshadernodesloader.pro b/tests/auto/gui/util/qshadernodesloader/qshadernodesloader.pro
new file mode 100644
index 0000000000..b9c26a2942
--- /dev/null
+++ b/tests/auto/gui/util/qshadernodesloader/qshadernodesloader.pro
@@ -0,0 +1,5 @@
+CONFIG += testcase
+QT += testlib gui-private
+
+SOURCES += tst_qshadernodesloader.cpp
+TARGET = tst_qshadernodesloader
diff --git a/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp
new file mode 100644
index 0000000000..4782e40ed8
--- /dev/null
+++ b/tests/auto/gui/util/qshadernodesloader/tst_qshadernodesloader.cpp
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <QtCore/qbuffer.h>
+
+#include <QtGui/private/qshadernodesloader_p.h>
+#include <QtGui/private/qshaderlanguage_p.h>
+
+using QBufferPointer = QSharedPointer<QBuffer>;
+Q_DECLARE_METATYPE(QBufferPointer);
+
+using NodeHash = QHash<QString, QShaderNode>;
+Q_DECLARE_METATYPE(NodeHash);
+
+namespace
+{
+ QBufferPointer createBuffer(const QByteArray &data, QIODevice::OpenMode openMode = QIODevice::ReadOnly)
+ {
+ auto buffer = QBufferPointer::create();
+ buffer->setData(data);
+ if (openMode != QIODevice::NotOpen)
+ buffer->open(openMode);
+ return buffer;
+ }
+
+ QShaderFormat createFormat(QShaderFormat::Api api, int majorVersion, int minorVersion,
+ const QStringList &extensions = QStringList(),
+ const QString &vendor = QString())
+ {
+ auto format = QShaderFormat();
+ format.setApi(api);
+ format.setVersion(QVersionNumber(majorVersion, minorVersion));
+ format.setExtensions(extensions);
+ format.setVendor(vendor);
+ return format;
+ }
+
+ QShaderNodePort createPort(QShaderNodePort::Direction portDirection, const QString &portName)
+ {
+ auto port = QShaderNodePort();
+ port.direction = portDirection;
+ port.name = portName;
+ return port;
+ }
+
+ QShaderNode createNode(const QVector<QShaderNodePort> &ports)
+ {
+ auto node = QShaderNode();
+ for (const auto &port : ports)
+ node.addPort(port);
+ return node;
+ }
+}
+
+class tst_QShaderNodesLoader : public QObject
+{
+ Q_OBJECT
+private slots:
+ void shouldManipulateLoaderMembers();
+ void shouldLoadFromJsonStream_data();
+ void shouldLoadFromJsonStream();
+};
+
+void tst_QShaderNodesLoader::shouldManipulateLoaderMembers()
+{
+ // GIVEN
+ auto loader = QShaderNodesLoader();
+
+ // THEN (default state)
+ QCOMPARE(loader.status(), QShaderNodesLoader::Null);
+ QVERIFY(!loader.device());
+ QVERIFY(loader.nodes().isEmpty());
+
+ // WHEN
+ auto device1 = createBuffer(QByteArray("..........."), QIODevice::NotOpen);
+ loader.setDevice(device1.data());
+
+ // THEN
+ QCOMPARE(loader.status(), QShaderNodesLoader::Error);
+ QCOMPARE(loader.device(), device1.data());
+ QVERIFY(loader.nodes().isEmpty());
+
+ // WHEN
+ auto device2 = createBuffer(QByteArray("..........."), QIODevice::ReadOnly);
+ loader.setDevice(device2.data());
+
+ // THEN
+ QCOMPARE(loader.status(), QShaderNodesLoader::Waiting);
+ QCOMPARE(loader.device(), device2.data());
+ QVERIFY(loader.nodes().isEmpty());
+}
+
+void tst_QShaderNodesLoader::shouldLoadFromJsonStream_data()
+{
+ QTest::addColumn<QBufferPointer>("device");
+ QTest::addColumn<NodeHash>("nodes");
+ QTest::addColumn<QShaderNodesLoader::Status>("status");
+
+ QTest::newRow("empty") << createBuffer("", QIODevice::ReadOnly) << NodeHash() << QShaderNodesLoader::Error;
+
+ const auto smallJson = "{"
+ " \"inputValue\": {"
+ " \"outputs\": ["
+ " \"value\""
+ " ],"
+ " \"parameters\": {"
+ " \"name\": \"defaultName\","
+ " \"qualifier\": {"
+ " \"type\": \"QShaderLanguage::StorageQualifier\","
+ " \"value\": \"QShaderLanguage::Uniform\""
+ " },"
+ " \"type\": {"
+ " \"type\": \"QShaderLanguage::VariableType\","
+ " \"value\": \"QShaderLanguage::Vec3\""
+ " },"
+ " \"defaultValue\": {"
+ " \"type\": \"float\","
+ " \"value\": \"1.25\""
+ " }"
+ " },"
+ " \"rules\": ["
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLES\","
+ " \"major\": 2,"
+ " \"minor\": 0"
+ " },"
+ " \"substitution\": \"highp vec3 $value = $name;\","
+ " \"headerSnippets\": [ \"varying highp vec3 $name;\" ]"
+ " },"
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLCompatibilityProfile\","
+ " \"major\": 2,"
+ " \"minor\": 1"
+ " },"
+ " \"substitution\": \"vec3 $value = $name;\","
+ " \"headerSnippets\": [ \"in vec3 $name;\" ]"
+ " }"
+ " ]"
+ " },"
+ " \"fragColor\": {"
+ " \"inputs\": ["
+ " \"fragColor\""
+ " ],"
+ " \"rules\": ["
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLES\","
+ " \"major\": 2,"
+ " \"minor\": 0"
+ " },"
+ " \"substitution\": \"gl_fragColor = $fragColor;\""
+ " },"
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLNoProfile\","
+ " \"major\": 4,"
+ " \"minor\": 0"
+ " },"
+ " \"substitution\": \"fragColor = $fragColor;\","
+ " \"headerSnippets\": [ \"out vec4 fragColor;\" ]"
+ " }"
+ " ]"
+ " },"
+ " \"lightModel\": {"
+ " \"inputs\": ["
+ " \"baseColor\","
+ " \"position\","
+ " \"lightIntensity\""
+ " ],"
+ " \"outputs\": ["
+ " \"outputColor\""
+ " ],"
+ " \"rules\": ["
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLES\","
+ " \"major\": 2,"
+ " \"minor\": 0,"
+ " \"extensions\": [ \"ext1\", \"ext2\" ],"
+ " \"vendor\": \"kdab\""
+ " },"
+ " \"substitution\": \"highp vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);\","
+ " \"headerSnippets\": [ \"#pragma include es2/lightmodel.frag.inc\" ]"
+ " },"
+ " {"
+ " \"format\": {"
+ " \"api\": \"OpenGLCoreProfile\","
+ " \"major\": 3,"
+ " \"minor\": 3"
+ " },"
+ " \"substitution\": \"vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);\","
+ " \"headerSnippets\": [ \"#pragma include gl3/lightmodel.frag.inc\" ]"
+ " }"
+ " ]"
+ " }"
+ "}";
+
+ const auto smallProtos = [this]{
+ const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
+ const auto openGLES2Extended = createFormat(QShaderFormat::OpenGLES, 2, 0, {"ext1", "ext2"}, "kdab");
+ const auto openGL2 = createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 1);
+ const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 3);
+ const auto openGL4 = createFormat(QShaderFormat::OpenGLNoProfile, 4, 0);
+
+ auto protos = NodeHash();
+
+ auto inputValue = createNode({
+ createPort(QShaderNodePort::Output, "value")
+ });
+ inputValue.setParameter("name", "defaultName");
+ inputValue.setParameter("qualifier", QVariant::fromValue<QShaderLanguage::StorageQualifier>(QShaderLanguage::Uniform));
+ inputValue.setParameter("type", QVariant::fromValue<QShaderLanguage::VariableType>(QShaderLanguage::Vec3));
+ inputValue.setParameter("defaultValue", QVariant(1.25f));
+ inputValue.addRule(openGLES2, QShaderNode::Rule("highp vec3 $value = $name;",
+ QByteArrayList() << "varying highp vec3 $name;"));
+ inputValue.addRule(openGL2, QShaderNode::Rule("vec3 $value = $name;",
+ QByteArrayList() << "in vec3 $name;"));
+ protos.insert("inputValue", inputValue);
+
+ auto fragColor = createNode({
+ createPort(QShaderNodePort::Input, "fragColor")
+ });
+ fragColor.addRule(openGLES2, QShaderNode::Rule("gl_fragColor = $fragColor;"));
+ fragColor.addRule(openGL4, QShaderNode::Rule("fragColor = $fragColor;",
+ QByteArrayList() << "out vec4 fragColor;"));
+ protos.insert(QStringLiteral("fragColor"), fragColor);
+
+ auto lightModel = createNode({
+ createPort(QShaderNodePort::Input, "baseColor"),
+ createPort(QShaderNodePort::Input, "position"),
+ createPort(QShaderNodePort::Input, "lightIntensity"),
+ createPort(QShaderNodePort::Output, "outputColor")
+ });
+ lightModel.addRule(openGLES2Extended, QShaderNode::Rule("highp vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include es2/lightmodel.frag.inc"));
+ lightModel.addRule(openGL3, QShaderNode::Rule("vec4 $outputColor = lightModel($baseColor, $position, $lightIntensity);",
+ QByteArrayList() << "#pragma include gl3/lightmodel.frag.inc"));
+ protos.insert("lightModel", lightModel);
+
+ return protos;
+ }();
+
+ QTest::newRow("NotOpen") << createBuffer(smallJson, QIODevice::NotOpen) << NodeHash() << QShaderNodesLoader::Error;
+ QTest::newRow("CorrectJSON") << createBuffer(smallJson) << smallProtos << QShaderNodesLoader::Ready;
+}
+
+void tst_QShaderNodesLoader::shouldLoadFromJsonStream()
+{
+ // GIVEN
+ QFETCH(QBufferPointer, device);
+
+ auto loader = QShaderNodesLoader();
+
+ // WHEN
+ loader.setDevice(device.data());
+ loader.load();
+
+ // THEN
+ QFETCH(QShaderNodesLoader::Status, status);
+ QCOMPARE(loader.status(), status);
+
+ QFETCH(NodeHash, nodes);
+ const auto sortedKeys = [](const NodeHash &nodes) {
+ auto res = nodes.keys();
+ res.sort();
+ return res;
+ };
+ const auto sortedParameters = [](const QShaderNode &node) {
+ auto res = node.parameterNames();
+ res.sort();
+ return res;
+ };
+ QCOMPARE(sortedKeys(loader.nodes()), sortedKeys(nodes));
+ for (const auto &key : nodes.keys()) {
+ const auto actual = loader.nodes().value(key);
+ const auto expected = nodes.value(key);
+
+ QVERIFY(actual.uuid().isNull());
+ QCOMPARE(actual.ports(), expected.ports());
+ QCOMPARE(sortedParameters(actual), sortedParameters(expected));
+ for (const auto &name : expected.parameterNames()) {
+ QCOMPARE(actual.parameter(name), expected.parameter(name));
+ }
+ QCOMPARE(actual.availableFormats(), expected.availableFormats());
+ for (const auto &format : expected.availableFormats()) {
+ QCOMPARE(actual.rule(format), expected.rule(format));
+ }
+ }
+}
+
+QTEST_MAIN(tst_QShaderNodesLoader)
+
+#include "tst_qshadernodesloader.moc"
diff --git a/tests/auto/gui/util/util.pro b/tests/auto/gui/util/util.pro
index f2c4515dc2..940e892e5f 100644
--- a/tests/auto/gui/util/util.pro
+++ b/tests/auto/gui/util/util.pro
@@ -5,4 +5,9 @@ SUBDIRS= \
qintvalidator \
qregexpvalidator \
qregularexpressionvalidator \
+ qshadergenerator \
+ qshadergraph \
+ qshadergraphloader \
+ qshadernodes \
+ qshadernodesloader \
diff --git a/tests/auto/network/access/hpack/tst_hpack.cpp b/tests/auto/network/access/hpack/tst_hpack.cpp
index bd337c9f5f..810745a065 100644
--- a/tests/auto/network/access/hpack/tst_hpack.cpp
+++ b/tests/auto/network/access/hpack/tst_hpack.cpp
@@ -273,13 +273,13 @@ void tst_Hpack::bitstreamCompression()
std::vector<uchar> buffer;
BitOStream out(buffer);
for (unsigned i = 0; i < nValues; ++i) {
- const bool isString = std::rand() % 1000 > 500;
+ const bool isString = QRandomGenerator::global()->bounded(1000) > 500;
isA.push_back(isString);
if (!isString) {
- integers.push_back(std::rand() % 1000);
+ integers.push_back(QRandomGenerator::global()->bounded(1000u));
out.write(integers.back());
} else {
- const auto start = std::rand() % (bytes.length() / 2);
+ const auto start = QRandomGenerator::global()->bounded(uint(bytes.length()) / 2);
auto end = start * 2;
if (!end)
end = bytes.length() / 2;
@@ -287,7 +287,7 @@ void tst_Hpack::bitstreamCompression()
const auto &s = strings.back();
totalStringBytes += s.size();
QByteArray data(s.c_str(), int(s.size()));
- const bool compressed(std::rand() % 1000 > 500);
+ const bool compressed(QRandomGenerator::global()->bounded(1000) > 500);
out.write(data, compressed);
}
}
@@ -442,8 +442,8 @@ void tst_Hpack::lookupTableDynamic()
// Strings are repeating way too often, I want to
// have at least some items really evicted and not found,
// therefore these weird dances with start/len.
- const quint32 start = std::rand() % (dataSize - 10);
- quint32 len = std::rand() % (dataSize - start);
+ const quint32 start = QRandomGenerator::global()->bounded(dataSize - 10);
+ quint32 len = QRandomGenerator::global()->bounded(dataSize - start);
if (!len)
len = 1;
diff --git a/tests/auto/network/access/hsts/tst_qhsts.cpp b/tests/auto/network/access/hsts/tst_qhsts.cpp
index 656516f46b..d72991a2eb 100644
--- a/tests/auto/network/access/hsts/tst_qhsts.cpp
+++ b/tests/auto/network/access/hsts/tst_qhsts.cpp
@@ -32,7 +32,9 @@
#include <QtCore/qvector.h>
#include <QtCore/qpair.h>
#include <QtCore/qurl.h>
+#include <QtCore/qdir.h>
+#include <QtNetwork/private/qhstsstore_p.h>
#include <QtNetwork/private/qhsts_p.h>
QT_USE_NAMESPACE
@@ -46,6 +48,7 @@ private Q_SLOTS:
void testMultilpeKnownHosts();
void testPolicyExpiration();
void testSTSHeaderParser();
+ void testStore();
};
void tst_QHsts::testSingleKnownHost_data()
@@ -313,6 +316,75 @@ void tst_QHsts::testSTSHeaderParser()
QVERIFY(!parser.expirationDate().isValid());
}
+const QLatin1String storeDir(".");
+
+struct TestStoreDeleter
+{
+ ~TestStoreDeleter()
+ {
+ QDir cwd;
+ if (!cwd.remove(QHstsStore::absoluteFilePath(storeDir)))
+ qWarning() << "tst_QHsts::testStore: failed to remove the hsts store file";
+ }
+};
+
+void tst_QHsts::testStore()
+{
+ // Delete the store's file after we finish the test.
+ TestStoreDeleter cleaner;
+
+ const QUrl exampleCom(QStringLiteral("http://example.com"));
+ const QUrl subDomain(QStringLiteral("http://subdomain.example.com"));
+ const QDateTime validDate(QDateTime::currentDateTimeUtc().addDays(1));
+
+ {
+ // We start from an empty cache and empty store:
+ QHstsCache cache;
+ QHstsStore store(storeDir);
+ cache.setStore(&store);
+ QVERIFY(!cache.isKnownHost(exampleCom));
+ QVERIFY(!cache.isKnownHost(subDomain));
+ // (1) This will also store the policy:
+ cache.updateKnownHost(exampleCom, validDate, true);
+ QVERIFY(cache.isKnownHost(exampleCom));
+ QVERIFY(cache.isKnownHost(subDomain));
+ }
+ {
+ // Test the policy stored at (1):
+ QHstsCache cache;
+ QHstsStore store(storeDir);
+ cache.setStore(&store);
+ QVERIFY(cache.isKnownHost(exampleCom));
+ QVERIFY(cache.isKnownHost(subDomain));
+ // (2) Remove subdomains:
+ cache.updateKnownHost(exampleCom, validDate, false);
+ QVERIFY(!cache.isKnownHost(subDomain));
+ }
+ {
+ // Test the previous update (2):
+ QHstsCache cache;
+ QHstsStore store(storeDir);
+ cache.setStore(&store);
+ QVERIFY(cache.isKnownHost(exampleCom));
+ QVERIFY(!cache.isKnownHost(subDomain));
+ }
+ {
+ QHstsCache cache;
+ cache.updateKnownHost(subDomain, validDate, false);
+ QVERIFY(cache.isKnownHost(subDomain));
+ QHstsStore store(storeDir);
+ // (3) This should store policy from cache, over old policy from store:
+ cache.setStore(&store);
+ }
+ {
+ // Test that (3) was stored:
+ QHstsCache cache;
+ QHstsStore store(storeDir);
+ cache.setStore(&store);
+ QVERIFY(cache.isKnownHost(subDomain));
+ }
+}
+
QTEST_MAIN(tst_QHsts)
#include "tst_qhsts.moc"
diff --git a/tests/auto/network/access/http2/http2srv.cpp b/tests/auto/network/access/http2/http2srv.cpp
index d0686eb01c..69e480b164 100644
--- a/tests/auto/network/access/http2/http2srv.cpp
+++ b/tests/auto/network/access/http2/http2srv.cpp
@@ -76,13 +76,11 @@ void fill_push_header(const HttpHeader &originalRequest, HttpHeader &promisedReq
}
-Http2Server::Http2Server(bool h2c, const Http2Settings &ss, const Http2Settings &cs)
+Http2Server::Http2Server(bool h2c, const Http2::RawSettings &ss, const Http2::RawSettings &cs)
: serverSettings(ss),
+ expectedClientSettings(cs),
clearTextHTTP2(h2c)
{
- for (const auto &s : cs)
- expectedClientSettings[quint16(s.identifier)] = s.value;
-
responseBody = "<html>\n"
"<head>\n"
"<title>Sample \"Hello, World\" Application</title>\n"
@@ -132,8 +130,23 @@ void Http2Server::startServer()
if (!clearTextHTTP2)
return;
#endif
- if (listen())
+ if (listen()) {
+ if (clearTextHTTP2)
+ authority = QStringLiteral("127.0.0.1:%1").arg(serverPort()).toLatin1();
emit serverStarted(serverPort());
+ }
+}
+
+bool Http2Server::sendProtocolSwitchReply()
+{
+ Q_ASSERT(socket);
+ Q_ASSERT(clearTextHTTP2 && upgradeProtocol);
+ // The first and the last HTTP/1.1 response we send:
+ const char response[] = "HTTP/1.1 101 Switching Protocols\r\n"
+ "Connection: Upgrade\r\n"
+ "Upgrade: h2c\r\n\r\n";
+ const qint64 size = sizeof response - 1;
+ return socket->write(response, size) == size;
}
void Http2Server::sendServerSettings()
@@ -144,11 +157,11 @@ void Http2Server::sendServerSettings()
return;
writer.start(FrameType::SETTINGS, FrameFlag::EMPTY, connectionStreamID);
- for (const auto &s : serverSettings) {
- writer.append(s.identifier);
- writer.append(s.value);
- if (s.identifier == Settings::INITIAL_WINDOW_SIZE_ID)
- streamRecvWindowSize = s.value;
+ for (auto it = serverSettings.cbegin(); it != serverSettings.cend(); ++it) {
+ writer.append(it.key());
+ writer.append(it.value());
+ if (it.key() == Settings::INITIAL_WINDOW_SIZE_ID)
+ streamRecvWindowSize = it.value();
}
writer.write(*socket);
// Now, let's update our peer on a session recv window size:
@@ -232,6 +245,7 @@ void Http2Server::incomingConnection(qintptr socketDescriptor)
Q_ASSERT(set);
// Stop listening:
close();
+ upgradeProtocol = true;
QMetaObject::invokeMethod(this, "connectionEstablished",
Qt::QueuedConnection);
} else {
@@ -269,25 +283,83 @@ void Http2Server::incomingConnection(qintptr socketDescriptor)
quint32 Http2Server::clientSetting(Http2::Settings identifier, quint32 defaultValue)
{
- const auto it = expectedClientSettings.find(quint16(identifier));
+ const auto it = expectedClientSettings.find(identifier);
if (it != expectedClientSettings.end())
- return it->second;
+ return it.value();
return defaultValue;
}
+bool Http2Server::readMethodLine()
+{
+ // We know for sure that Qt did the right thing sending us the correct
+ // Request-line with CRLF at the end ...
+ // We're overly simplistic here but all we need to know - the method.
+ while (socket->bytesAvailable()) {
+ char c = 0;
+ if (socket->read(&c, 1) != 1)
+ return false;
+ if (c == '\n' && requestLine.endsWith('\r')) {
+ if (requestLine.startsWith("GET"))
+ requestType = QHttpNetworkRequest::Get;
+ else if (requestLine.startsWith("POST"))
+ requestType = QHttpNetworkRequest::Post;
+ else
+ requestType = QHttpNetworkRequest::Custom; // 'invalid'.
+ requestLine.clear();
+
+ return true;
+ } else {
+ requestLine.append(c);
+ }
+ }
+
+ return false;
+}
+
+bool Http2Server::verifyProtocolUpgradeRequest()
+{
+ Q_ASSERT(protocolUpgradeHandler.data());
+
+ bool connectionOk = false;
+ bool upgradeOk = false;
+ bool settingsOk = false;
+
+ QHttpNetworkReplyPrivate *firstRequestReader = protocolUpgradeHandler->d_func();
+
+ // That's how we append them, that's what I expect to find:
+ for (const auto &header : firstRequestReader->fields) {
+ if (header.first == "Connection")
+ connectionOk = header.second.contains("Upgrade, HTTP2-Settings");
+ else if (header.first == "Upgrade")
+ upgradeOk = header.second.contains("h2c");
+ else if (header.first == "HTTP2-Settings")
+ settingsOk = true;
+ }
+
+ return connectionOk && upgradeOk && settingsOk;
+}
+
+void Http2Server::triggerGOAWAYEmulation()
+{
+ Q_ASSERT(testingGOAWAY);
+ auto timer = new QTimer(this);
+ timer->setSingleShot(true);
+ connect(timer, &QTimer::timeout, [this]() {
+ sendGOAWAY(quint32(connectionStreamID), quint32(INTERNAL_ERROR), 0);
+ });
+ timer->start(goawayTimeout);
+}
+
void Http2Server::connectionEstablished()
{
using namespace Http2;
- if (testingGOAWAY) {
- auto timer = new QTimer(this);
- timer->setSingleShot(true);
- connect(timer, &QTimer::timeout, [this]() {
- sendGOAWAY(quint32(connectionStreamID), quint32(INTERNAL_ERROR), 0);
- });
- timer->start(goawayTimeout);
- return;
- }
+ if (testingGOAWAY && !clearTextHTTP2)
+ return triggerGOAWAYEmulation();
+
+ // For clearTextHTTP2 we first have to respond with 'protocol switch'
+ // and then continue with whatever logic we have (testingGOAWAY or not),
+ // otherwise our 'peer' cannot process HTTP/2 frames yet.
connect(socket.data(), SIGNAL(readyRead()),
this, SLOT(readReady()));
@@ -296,9 +368,17 @@ void Http2Server::connectionEstablished()
waitingClientAck = false;
waitingClientSettings = false;
settingsSent = false;
- // We immediately send our settings so that our client
- // can use flow control correctly.
- sendServerSettings();
+
+ if (clearTextHTTP2) {
+ requestLine.clear();
+ // Now we have to handle HTTP/1.1 request. We use Get/Post in our test,
+ // so set requestType to something unsupported:
+ requestType = QHttpNetworkRequest::Options;
+ } else {
+ // We immediately send our settings so that our client
+ // can use flow control correctly.
+ sendServerSettings();
+ }
if (socket->bytesAvailable())
readReady();
@@ -328,7 +408,9 @@ void Http2Server::readReady()
if (connectionError)
return;
- if (waitingClientPreface) {
+ if (upgradeProtocol) {
+ handleProtocolUpgrade();
+ } else if (waitingClientPreface) {
handleConnectionPreface();
} else {
const auto status = reader.read(*socket);
@@ -348,6 +430,79 @@ void Http2Server::readReady()
QMetaObject::invokeMethod(this, "readReady", Qt::QueuedConnection);
}
+void Http2Server::handleProtocolUpgrade()
+{
+ using ReplyPrivate = QHttpNetworkReplyPrivate;
+ Q_ASSERT(upgradeProtocol);
+
+ if (!protocolUpgradeHandler.data())
+ protocolUpgradeHandler.reset(new Http11Reply);
+
+ QHttpNetworkReplyPrivate *firstRequestReader = protocolUpgradeHandler->d_func();
+
+ // QHttpNetworkReplyPrivate parses ... reply. It will, unfortunately, fail
+ // on the first line ... which is a part of request. So we read this line
+ // and extract the method first.
+ if (firstRequestReader->state == ReplyPrivate::NothingDoneState) {
+ if (!readMethodLine())
+ return;
+
+ if (requestType != QHttpNetworkRequest::Get && requestType != QHttpNetworkRequest::Post) {
+ emit invalidRequest(1);
+ return;
+ }
+
+ firstRequestReader->state = ReplyPrivate::ReadingHeaderState;
+ }
+
+ if (!socket->bytesAvailable())
+ return;
+
+ if (firstRequestReader->state == ReplyPrivate::ReadingHeaderState)
+ firstRequestReader->readHeader(socket.data());
+ else if (firstRequestReader->state == ReplyPrivate::ReadingDataState)
+ firstRequestReader->readBodyFast(socket.data(), &firstRequestReader->responseData);
+
+ switch (firstRequestReader->state) {
+ case ReplyPrivate::ReadingHeaderState:
+ return;
+ case ReplyPrivate::ReadingDataState:
+ if (requestType == QHttpNetworkRequest::Post)
+ return;
+ break;
+ case ReplyPrivate::AllDoneState:
+ break;
+ default:
+ socket->close();
+ return;
+ }
+
+ if (!verifyProtocolUpgradeRequest() || !sendProtocolSwitchReply()) {
+ socket->close();
+ return;
+ }
+
+ upgradeProtocol = false;
+ protocolUpgradeHandler.reset(nullptr);
+
+ if (testingGOAWAY)
+ return triggerGOAWAYEmulation();
+
+ // HTTP/1.1 'fields' we have in firstRequestRead are useless (they are not
+ // even allowed in HTTP/2 header). Let's pretend we have received
+ // valid HTTP/2 headers and can extract fields we need:
+ HttpHeader h2header;
+ h2header.push_back(HeaderField(":scheme", "http")); // we are in clearTextHTTP2 mode.
+ h2header.push_back(HeaderField(":authority", authority));
+ activeRequests[1] = std::move(h2header);
+ // After protocol switch we immediately send our SETTINGS.
+ sendServerSettings();
+ if (requestType == QHttpNetworkRequest::Get)
+ emit receivedRequest(1);
+ else
+ emit receivedData(1);
+}
+
void Http2Server::handleConnectionPreface()
{
Q_ASSERT(waitingClientPreface);
@@ -382,6 +537,16 @@ void Http2Server::handleIncomingFrame()
// 7. RST_STREAM
// 8. GOAWAY
+ if (testingGOAWAY) {
+ // GOAWAY test is simplistic for now: after HTTP/2 was
+ // negotiated (via ALPN/NPN or a protocol switch), send
+ // a GOAWAY frame after some (probably non-zero) timeout.
+ // We do not handle any frames, but timeout gives QNAM
+ // more time to initiate more streams and thus make the
+ // test more interesting/complex (on a client side).
+ return;
+ }
+
inboundFrame = std::move(reader.inboundFrame());
if (continuedRequest.size()) {
@@ -456,7 +621,7 @@ void Http2Server::handleSETTINGS()
const auto notFound = expectedClientSettings.end();
while (src != end) {
- const auto id = qFromBigEndian<quint16>(src);
+ const auto id = Http2::Settings(qFromBigEndian<quint16>(src));
const auto value = qFromBigEndian<quint32>(src + 2);
if (expectedClientSettings.find(id) == notFound ||
expectedClientSettings[id] != value) {
diff --git a/tests/auto/network/access/http2/http2srv.h b/tests/auto/network/access/http2/http2srv.h
index 63a4a4c8e9..ff4a1319e2 100644
--- a/tests/auto/network/access/http2/http2srv.h
+++ b/tests/auto/network/access/http2/http2srv.h
@@ -29,11 +29,14 @@
#ifndef HTTP2SRV_H
#define HTTP2SRV_H
+#include <QtNetwork/private/qhttpnetworkrequest_p.h>
+#include <QtNetwork/private/qhttpnetworkreply_p.h>
#include <QtNetwork/private/http2protocol_p.h>
#include <QtNetwork/private/http2frames_p.h>
#include <QtNetwork/private/hpack_p.h>
#include <QtNetwork/qabstractsocket.h>
+#include <QtCore/qsharedpointer.h>
#include <QtCore/qscopedpointer.h>
#include <QtNetwork/qtcpserver.h>
#include <QtCore/qbytearray.h>
@@ -45,25 +48,25 @@
QT_BEGIN_NAMESPACE
-struct Http2Setting
+// At the moment we do not have any public API parsing HTTP headers. Even worse -
+// the code that can do this exists only in QHttpNetworkReplyPrivate class.
+// To be able to access reply's d_func() we have these classes:
+class Http11ReplyPrivate : public QHttpNetworkReplyPrivate
{
- Http2::Settings identifier;
- quint32 value = 0;
-
- Http2Setting(Http2::Settings ident, quint32 v)
- : identifier(ident),
- value(v)
- {}
};
-using Http2Settings = std::vector<Http2Setting>;
+class Http11Reply : public QHttpNetworkReply
+{
+public:
+ Q_DECLARE_PRIVATE(Http11Reply)
+};
class Http2Server : public QTcpServer
{
Q_OBJECT
public:
- Http2Server(bool clearText, const Http2Settings &serverSettings,
- const Http2Settings &clientSettings);
+ Http2Server(bool clearText, const Http2::RawSettings &serverSettings,
+ const Http2::RawSettings &clientSettings);
~Http2Server();
@@ -75,6 +78,7 @@ public:
// Invokables, since we can call them from the main thread,
// but server (can) work on its own thread.
Q_INVOKABLE void startServer();
+ bool sendProtocolSwitchReply();
Q_INVOKABLE void sendServerSettings();
Q_INVOKABLE void sendGOAWAY(quint32 streamID, quint32 error,
quint32 lastStreamID);
@@ -82,6 +86,7 @@ public:
Q_INVOKABLE void sendDATA(quint32 streamID, quint32 windowSize);
Q_INVOKABLE void sendWINDOW_UPDATE(quint32 streamID, quint32 delta);
+ Q_INVOKABLE void handleProtocolUpgrade();
Q_INVOKABLE void handleConnectionPreface();
Q_INVOKABLE void handleIncomingFrame();
Q_INVOKABLE void handleSETTINGS();
@@ -114,6 +119,9 @@ private:
void incomingConnection(qintptr socketDescriptor) Q_DECL_OVERRIDE;
quint32 clientSetting(Http2::Settings identifier, quint32 defaultValue);
+ bool readMethodLine();
+ bool verifyProtocolUpgradeRequest();
+ void triggerGOAWAYEmulation();
QScopedPointer<QAbstractSocket> socket;
@@ -123,8 +131,8 @@ private:
bool settingsSent = false;
bool waitingClientAck = false;
- Http2Settings serverSettings;
- std::map<quint16, quint32> expectedClientSettings;
+ Http2::RawSettings serverSettings;
+ Http2::RawSettings expectedClientSettings;
bool connectionError = false;
@@ -166,6 +174,18 @@ private:
bool testingGOAWAY = false;
int goawayTimeout = 0;
+ // Clear text HTTP/2, we have to deal with the protocol upgrade request
+ // from the initial HTTP/1.1 request.
+ bool upgradeProtocol = false;
+ QByteArray requestLine;
+ QHttpNetworkRequest::Operation requestType;
+ // We need QHttpNetworkReply (actually its private d-object) to handle the
+ // first HTTP/1.1 request. QHttpNetworkReplyPrivate does parsing + in case
+ // of POST it is also reading the body for us.
+ QScopedPointer<Http11Reply> protocolUpgradeHandler;
+ // We need it for PUSH_PROMISE, with the correct port number appended,
+ // when replying to essentially 1.1 request.
+ QByteArray authority;
protected slots:
void ignoreErrorSlot();
};
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index d7a57f5e26..51e1849512 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -30,6 +30,7 @@
#include "http2srv.h"
+#include <QtNetwork/private/http2protocol_p.h>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkreply.h>
@@ -47,10 +48,12 @@
#include <cstdlib>
#include <string>
-// At the moment our HTTP/2 imlpementation requires ALPN and this means OpenSSL.
#if !defined(QT_NO_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_TLSEXT)
+// HTTP/2 over TLS requires ALPN/NPN to negotiate the protocol version.
const bool clearTextHTTP2 = false;
#else
+// No ALPN/NPN support to negotiate HTTP/2, we'll use cleartext 'h2c' with
+// a protocol upgrade procedure.
const bool clearTextHTTP2 = true;
#endif
@@ -94,8 +97,8 @@ private:
// small payload.
void runEventLoop(int ms = 5000);
void stopEventLoop();
- Http2Server *newServer(const Http2Settings &serverSettings,
- const Http2Settings &clientSettings = defaultClientSettings);
+ Http2Server *newServer(const Http2::RawSettings &serverSettings,
+ const Http2::ProtocolParameters &clientSettings = {});
// Send a get or post request, depending on a payload (empty or not).
void sendRequest(int streamNumber,
QNetworkRequest::Priority priority = QNetworkRequest::NormalPriority,
@@ -116,13 +119,10 @@ private:
bool prefaceOK = false;
bool serverGotSettingsACK = false;
- static const Http2Settings defaultServerSettings;
- static const Http2Settings defaultClientSettings;
+ static const Http2::RawSettings defaultServerSettings;
};
-const Http2Settings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}};
-const Http2Settings tst_Http2::defaultClientSettings{{Http2::Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)},
- {Http2::Settings::ENABLE_PUSH_ID, quint32(0)}};
+const Http2::RawSettings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}};
namespace {
@@ -139,27 +139,6 @@ struct ServerDeleter
using ServerPtr = QScopedPointer<Http2Server, ServerDeleter>;
-struct EnvVarGuard
-{
- EnvVarGuard(const char *name, const QByteArray &value)
- : varName(name),
- prevValue(qgetenv(name))
- {
- Q_ASSERT(name);
- qputenv(name, value);
- }
- ~EnvVarGuard()
- {
- if (prevValue.size())
- qputenv(varName.c_str(), prevValue);
- else
- qunsetenv(varName.c_str());
- }
-
- const std::string varName;
- const QByteArray prevValue;
-};
-
} // unnamed namespace
tst_Http2::tst_Http2()
@@ -238,12 +217,14 @@ void tst_Http2::multipleRequests()
// Just to make the order a bit more interesting
// we'll index this randomly:
- QNetworkRequest::Priority priorities[] = {QNetworkRequest::HighPriority,
- QNetworkRequest::NormalPriority,
- QNetworkRequest::LowPriority};
+ const QNetworkRequest::Priority priorities[] = {
+ QNetworkRequest::HighPriority,
+ QNetworkRequest::NormalPriority,
+ QNetworkRequest::LowPriority
+ };
for (int i = 0; i < nRequests; ++i)
- sendRequest(i, priorities[std::rand() % 3]);
+ sendRequest(i, priorities[QRandomGenerator::global()->bounded(3)]);
runEventLoop();
@@ -255,11 +236,11 @@ void tst_Http2::multipleRequests()
void tst_Http2::flowControlClientSide()
{
// Create a server but impose limits:
- // 1. Small MAX frame size, so we test CONTINUATION frames.
- // 2. Small client windows so server responses cause client streams
- // to suspend and server sends WINDOW_UPDATE frames.
- // 3. Few concurrent streams, to test protocol handler can resume
- // suspended requests.
+ // 1. Small client receive windows so server's responses cause client
+ // streams to suspend and protocol handler has to send WINDOW_UPDATE
+ // frames.
+ // 2. Few concurrent streams supported by the server, to test protocol
+ // handler in the client can suspend and then resume streams.
using namespace Http2;
clearHTTP2State();
@@ -268,11 +249,20 @@ void tst_Http2::flowControlClientSide()
nRequests = 10;
windowUpdates = 0;
- const Http2Settings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 3}};
+ Http2::ProtocolParameters params;
+ // A small window size for a session, and even a smaller one per stream -
+ // this will result in WINDOW_UPDATE frames both on connection stream and
+ // per stream.
+ params.maxSessionReceiveWindowSize = Http2::defaultSessionWindowSize * 5;
+ params.settingsFrameData[Settings::INITIAL_WINDOW_SIZE_ID] = Http2::defaultSessionWindowSize;
+ // Inform our manager about non-default settings:
+ manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
- ServerPtr srv(newServer(serverSettings));
+ const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, quint32(3)}};
+ ServerPtr srv(newServer(serverSettings, params));
- const QByteArray respond(int(Http2::defaultSessionWindowSize * 50), 'x');
+
+ const QByteArray respond(int(Http2::defaultSessionWindowSize * 10), 'x');
srv->setResponseBody(respond);
QMetaObject::invokeMethod(srv.data(), "startServer", Qt::QueuedConnection);
@@ -306,7 +296,7 @@ void tst_Http2::flowControlServerSide()
serverPort = 0;
nRequests = 30;
- const Http2Settings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 7}};
+ const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, 7}};
ServerPtr srv(newServer(serverSettings));
@@ -338,11 +328,12 @@ void tst_Http2::pushPromise()
serverPort = 0;
nRequests = 1;
- const EnvVarGuard env("QT_HTTP2_ENABLE_PUSH_PROMISE", "1");
- const Http2Settings clientSettings{{Settings::MAX_FRAME_SIZE_ID, quint32(Http2::maxFrameSize)},
- {Settings::ENABLE_PUSH_ID, quint32(1)}};
+ Http2::ProtocolParameters params;
+ // Defaults are good, except ENABLE_PUSH:
+ params.settingsFrameData[Settings::ENABLE_PUSH_ID] = 1;
+ manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
- ServerPtr srv(newServer(defaultServerSettings, clientSettings));
+ ServerPtr srv(newServer(defaultServerSettings, params));
srv->enablePushPromise(true, QByteArray("/script.js"));
QMetaObject::invokeMethod(srv.data(), "startServer", Qt::QueuedConnection);
@@ -416,7 +407,7 @@ void tst_Http2::goaway()
serverPort = 0;
nRequests = 3;
- ServerPtr srv(newServer(defaultServerSettings, defaultClientSettings));
+ ServerPtr srv(newServer(defaultServerSettings));
srv->emulateGOAWAY(responseTimeoutMS);
QMetaObject::invokeMethod(srv.data(), "startServer", Qt::QueuedConnection);
runEventLoop();
@@ -459,6 +450,7 @@ void tst_Http2::clearHTTP2State()
windowUpdates = 0;
prefaceOK = false;
serverGotSettingsACK = false;
+ manager.setProperty(Http2::http2ParametersPropertyName, QVariant());
}
void tst_Http2::runEventLoop(int ms)
@@ -474,11 +466,12 @@ void tst_Http2::stopEventLoop()
eventLoop.quit();
}
-Http2Server *tst_Http2::newServer(const Http2Settings &serverSettings,
- const Http2Settings &clientSettings)
+Http2Server *tst_Http2::newServer(const Http2::RawSettings &serverSettings,
+ const Http2::ProtocolParameters &clientSettings)
{
using namespace Http2;
- auto srv = new Http2Server(clearTextHTTP2, serverSettings, clientSettings);
+ auto srv = new Http2Server(clearTextHTTP2, serverSettings,
+ clientSettings.settingsFrameData);
using Srv = Http2Server;
using Cl = tst_Http2;
@@ -507,6 +500,7 @@ void tst_Http2::sendRequest(int streamNumber,
QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
+ request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));
request.setPriority(priority);
QNetworkReply *reply = nullptr;
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index fba0508f04..4bc43f068c 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -276,8 +276,7 @@ void tst_QFtp::init()
inFileDirExistsFunction = false;
- srand(time(0));
- uniqueExtension = QString::number((quintptr)this) + QString::number(rand())
+ uniqueExtension = QString::number((quintptr)this) + QString::number(QRandomGenerator::global()->generate())
+ QString::number((qulonglong)time(0));
}
diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index af6f2d0e10..856033fb63 100644
--- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -30,6 +30,7 @@
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
#include <qnetworkdiskcache.h>
+#include <qrandom.h>
#include <algorithm>
@@ -281,6 +282,7 @@ void tst_QNetworkDiskCache::clear()
// don't delete files that it didn't create
QTemporaryFile file(cacheDirectory + "/XXXXXX");
if (file.open()) {
+ file.fileName(); // make sure it exists with a name
QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
cache.clear();
QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
@@ -692,25 +694,25 @@ public:
if (write) {
QNetworkCacheMetaData m;
- if (qrand() % 2 == 0)
+ if (QRandomGenerator::global()->bounded(2) == 0)
m = metaData;
else
m = metaData2;
- if (qrand() % 20 == 1) {
+ if (QRandomGenerator::global()->bounded(20) == 1) {
//qDebug() << "write update";
cache.updateMetaData(m);
continue;
}
QIODevice *device = cache.prepare(m);
- if (qrand() % 20 == 1) {
+ if (QRandomGenerator::global()->bounded(20) == 1) {
//qDebug() << "write remove";
cache.remove(url);
continue;
}
QVERIFY(device);
- if (qrand() % 2 == 0)
+ if (QRandomGenerator::global()->bounded(2) == 0)
device->write(longString);
else
device->write(longString2);
@@ -739,9 +741,9 @@ public:
delete d;
}
}
- if (qrand() % 5 == 1)
+ if (QRandomGenerator::global()->bounded(5) == 1)
cache.remove(url);
- if (qrand() % 5 == 1)
+ if (QRandomGenerator::global()->bounded(5) == 1)
cache.clear();
sleep(0);
}
@@ -790,7 +792,6 @@ void tst_QNetworkDiskCache::sync()
return;
QTime midnight(0, 0, 0);
- qsrand(midnight.secsTo(QTime::currentTime()));
Runner reader(tempDir.path());
reader.dt = QDateTime::currentDateTime();
reader.write = false;
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 57f33d5863..d6fc717e37 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -38,3 +38,5 @@ windows
windows
[getFromUnreachableIp]
windows msvc-2017
+[ioHttpRedirectErrors:too-many-redirects]
+rhel-6.6 ci
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 9fa54597f1..a2e602e4c5 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -33,6 +33,7 @@
#include <QtCore/QUrl>
#include <QtCore/QEventLoop>
#include <QtCore/QFile>
+#include <QtCore/QRandomGenerator>
#include <QtCore/QSharedPointer>
#include <QtCore/QScopedPointer>
#include <QtCore/QTemporaryFile>
@@ -120,12 +121,11 @@ class tst_QNetworkReply: public QObject
static QString createUniqueExtension()
{
if (!seedCreated) {
- qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) + QCoreApplication::applicationPid());
seedCreated = true; // not thread-safe, but who cares
}
return QString::number(QTime(0, 0, 0).msecsTo(QTime::currentTime()))
+ QLatin1Char('-') + QString::number(QCoreApplication::applicationPid())
- + QLatin1Char('-') + QString::number(qrand());
+ + QLatin1Char('-') + QString::number(QRandomGenerator::global()->generate());
}
static QString tempRedirectReplyStr() {
@@ -4867,7 +4867,7 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
// server send the data much faster than expected.
// So better provide random data that cannot be compressed.
for (int i = 0; i < wantedSize; ++i)
- sourceFile += (char)qrand();
+ sourceFile += (char)QRandomGenerator::global()->generate();
// emulate a minimal https server
SslServer server;
@@ -4947,7 +4947,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
// server send the data much faster than expected.
// So better provide random data that cannot be compressed.
for (int i = 0; i < wantedSize; ++i)
- testData += (char)qrand();
+ testData += (char)QRandomGenerator::global()->generate();
QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: ");
httpResponse += QByteArray::number(testData.size());
@@ -8817,7 +8817,7 @@ public slots:
m_receivedData += data;
if (!m_parsedHeaders && m_receivedData.contains("\r\n\r\n")) {
m_parsedHeaders = true;
- QTimer::singleShot(qrand()%60, this, SLOT(closeDelayed())); // simulate random network latency
+ QTimer::singleShot(QRandomGenerator::global()->bounded(60), this, SLOT(closeDelayed())); // simulate random network latency
// This server simulates a web server connection closing, e.g. because of Apaches MaxKeepAliveRequests or KeepAliveTimeout
// In this case QNAM needs to re-send the upload data but it had a bug which then corrupts the upload
// This test catches that.
diff --git a/tests/auto/network/kernel/qhostinfo/BLACKLIST b/tests/auto/network/kernel/qhostinfo/BLACKLIST
new file mode 100644
index 0000000000..87c5fe991f
--- /dev/null
+++ b/tests/auto/network/kernel/qhostinfo/BLACKLIST
@@ -0,0 +1,6 @@
+# These tests fail due to a DNS server issue
+# (this is not a Qt bug)
+[lookupIPv6:a-plus-aaaa]
+windows ci
+[blockingLookup:a-plus-aaaa]
+windows ci
diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
index 67a37faeb5..3d8457dd46 100644
--- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
+++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro
@@ -8,7 +8,4 @@ QT = core-private network-private testlib
win32:LIBS += -lws2_32
-# needed for getaddrinfo with official MinGW
-mingw:DEFINES += _WIN32_WINNT=0x0501
-
winrt: WINRT_MANIFEST.capabilities += internetClientServer
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index 14bffaf7ca..82825f608c 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -64,14 +64,10 @@
#include <qhostinfo.h>
#include "private/qhostinfo_p.h"
-#if !defined(QT_NO_GETADDRINFO)
-# include <sys/types.h>
-# if defined(Q_OS_UNIX)
+#include <sys/types.h>
+#if defined(Q_OS_UNIX)
# include <sys/socket.h>
-# endif
-# if !defined(Q_OS_WIN)
# include <netdb.h>
-# endif
#endif
#include "../../../network-settings.h"
@@ -86,6 +82,8 @@ class tst_QHostInfo : public QObject
private slots:
void init();
void initTestCase();
+ void swapFunction();
+ void moveOperator();
void getSetCheck();
void staticInformation();
void lookupIPv4_data();
@@ -129,6 +127,29 @@ private:
#endif
};
+void tst_QHostInfo::swapFunction()
+{
+ QHostInfo obj1, obj2;
+ obj1.setError(QHostInfo::HostInfoError(0));
+ obj2.setError(QHostInfo::HostInfoError(1));
+ obj1.swap(obj2);
+ QCOMPARE(QHostInfo::HostInfoError(0), obj2.error());
+ QCOMPARE(QHostInfo::HostInfoError(1), obj1.error());
+}
+
+void tst_QHostInfo::moveOperator()
+{
+ QHostInfo obj1, obj2, obj3(1);
+ obj1.setError(QHostInfo::HostInfoError(0));
+ obj2.setError(QHostInfo::HostInfoError(1));
+ obj1 = std::move(obj2);
+ obj2 = obj3;
+ QCOMPARE(QHostInfo::HostInfoError(1), obj1.error());
+ QCOMPARE(obj3.lookupId(), obj2.lookupId());
+}
+
+
+
// Testing get/set functions
void tst_QHostInfo::getSetCheck()
{
@@ -166,7 +187,7 @@ void tst_QHostInfo::initTestCase()
networkSession.reset(new QNetworkSession(networkConfiguration));
if (!networkSession->isOpen()) {
networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ networkSession->waitForOpened(30000);
}
#endif
@@ -179,15 +200,13 @@ void tst_QHostInfo::initTestCase()
ipv6Available = true;
}
-// HP-UX 11i does not support IPv6 reverse lookups.
-#if !defined(QT_NO_GETADDRINFO) && !(defined(Q_OS_HPUX) && defined(__ia64))
// check if the system getaddrinfo can do IPv6 lookups
struct addrinfo hint, *result = 0;
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_UNSPEC;
-# ifdef AI_ADDRCONFIG
+#ifdef AI_ADDRCONFIG
hint.ai_flags = AI_ADDRCONFIG;
-# endif
+#endif
int res = getaddrinfo("::1", "80", &hint, &result);
if (res == 0) {
@@ -199,7 +218,6 @@ void tst_QHostInfo::initTestCase()
ipv6LookupsAvailable = true;
}
}
-#endif
// run each testcase with and without test enabled
QTest::addColumn<bool>("cache");
diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
index 5695f90c53..36dcec0a82 100644
--- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -32,7 +32,7 @@
#include <qcoreapplication.h>
#include <qnetworkinterface.h>
-#include <qtcpsocket.h>
+#include <qudpsocket.h>
#ifndef QT_NO_BEARERMANAGEMENT
#include <QNetworkConfigurationManager>
#include <QNetworkSession>
@@ -48,6 +48,8 @@ public:
tst_QNetworkInterface();
virtual ~tst_QNetworkInterface();
+ bool isIPv6Working();
+
private slots:
void initTestCase();
void cleanupTestCase();
@@ -76,6 +78,13 @@ tst_QNetworkInterface::~tst_QNetworkInterface()
{
}
+bool tst_QNetworkInterface::isIPv6Working()
+{
+ QUdpSocket socket;
+ socket.connectToHost(QHostAddress::LocalHostIPv6, 1234);
+ return socket.state() == QAbstractSocket::ConnectedState || socket.waitForConnected(100);
+}
+
void tst_QNetworkInterface::initTestCase()
{
if (!QtNetworkSettings::verifyTestNetworkSettings())
@@ -172,35 +181,21 @@ void tst_QNetworkInterface::loopbackIPv4()
void tst_QNetworkInterface::loopbackIPv6()
{
+ if (!isIPv6Working())
+ QSKIP("IPv6 not active on this machine");
QList<QHostAddress> all = QNetworkInterface::allAddresses();
-
- bool loopbackfound = false;
- bool anyIPv6 = false;
- foreach (QHostAddress addr, all)
- if (addr == QHostAddress::LocalHostIPv6) {
- loopbackfound = true;
- anyIPv6 = true;
- break;
- } else if (addr.protocol() == QAbstractSocket::IPv6Protocol)
- anyIPv6 = true;
-
- QVERIFY(!anyIPv6 || loopbackfound);
+ QVERIFY(all.contains(QHostAddress(QHostAddress::LocalHostIPv6)));
}
void tst_QNetworkInterface::localAddress()
{
- QTcpSocket socket;
+ QUdpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 80);
QVERIFY(socket.waitForConnected(5000));
QHostAddress local = socket.localAddress();
- // make Apache happy on fluke
- socket.write("GET / HTTP/1.0\r\n\r\n");
- socket.waitForBytesWritten(1000);
- socket.close();
-
- // test that we can find the address that QTcpSocket reported
+ // test that we can find the address that QUdpSocket reported
QList<QHostAddress> all = QNetworkInterface::allAddresses();
QVERIFY(all.contains(local));
}
diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 7fef603003..90da0b64e2 100644
--- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -34,10 +34,8 @@
#include <qdebug.h>
#include <qnetworkproxy.h>
-#include <QNetworkConfiguration>
-#include <QNetworkConfigurationManager>
-#include <QNetworkSession>
#include <QNetworkAccessManager>
+#include <QNetworkInterface>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QList>
@@ -71,11 +69,6 @@ private slots:
void systemProxyForQuery_data();
void systemProxyForQuery() const;
void systemProxyForQuery_local();
-#ifndef QT_NO_BEARERMANAGEMENT
- void fromConfigurations();
- void inNetworkAccessManager_data();
- void inNetworkAccessManager();
-#endif
void genericSystemProxy();
void genericSystemProxy_data();
@@ -253,111 +246,6 @@ void tst_QNetworkProxyFactory::systemProxyForQuery_local()
QVERIFY(list.isEmpty() || (list[0].type() == QNetworkProxy::NoProxy));
}
-#ifndef QT_NO_BEARERMANAGEMENT
-
-//Purpose of this test is just to check systemProxyForQuery doesn't hang or crash
-//with any given configuration including no configuration.
-//We can't test it returns the right proxies without implementing the native proxy code
-//again here, which would be testing our implementation against itself.
-//Therefore it's just testing that something valid is returned (at least a NoProxy entry)
-void tst_QNetworkProxyFactory::fromConfigurations()
-{
- QNetworkConfigurationManager manager;
- QList<QNetworkProxy> proxies;
- QUrl url(QLatin1String("http://qt-project.org"));
- //get from known configurations
- foreach (QNetworkConfiguration config, manager.allConfigurations()) {
- QNetworkProxyQuery query(config, url, QNetworkProxyQuery::UrlRequest);
- proxies = QNetworkProxyFactory::systemProxyForQuery(query);
- QVERIFY(!proxies.isEmpty());
- foreach (QNetworkProxy proxy, proxies) {
- qDebug() << config.name() << " - " << config.identifier() << " - " << formatProxyName(proxy);
- }
- }
-
- //get from default configuration
- QNetworkProxyQuery defaultquery(url, QNetworkProxyQuery::UrlRequest);
- proxies = QNetworkProxyFactory::systemProxyForQuery(defaultquery);
- QVERIFY(!proxies.isEmpty());
- foreach (QNetworkProxy proxy, proxies) {
- qDebug() << "default - " << formatProxyName(proxy);
- }
-
- //get from active configuration
- QNetworkSession session(manager.defaultConfiguration());
- session.open();
- QVERIFY(session.waitForOpened(30000));
- proxies = QNetworkProxyFactory::systemProxyForQuery(defaultquery);
- QVERIFY(!proxies.isEmpty());
- foreach (QNetworkProxy proxy, proxies) {
- qDebug() << "active - " << formatProxyName(proxy);
- }
-
- //get from known configurations while there is one active
- foreach (QNetworkConfiguration config, manager.allConfigurations()) {
- QNetworkProxyQuery query(config, url, QNetworkProxyQuery::UrlRequest);
- proxies = QNetworkProxyFactory::systemProxyForQuery(query);
- QVERIFY(!proxies.isEmpty());
- foreach (QNetworkProxy proxy, proxies) {
- qDebug() << config.name() << " - " << config.identifier() << " - " << formatProxyName(proxy);
- }
- }
-}
-
-void tst_QNetworkProxyFactory::inNetworkAccessManager_data()
-{
- QTest::addColumn<QNetworkConfiguration>("config");
- QTest::addColumn<QList<QNetworkProxy> >("proxies");
- QNetworkConfigurationManager manager;
- //get from known configurations
- foreach (QNetworkConfiguration config, manager.allConfigurations()) {
- QNetworkProxyQuery query(config, QUrl(QString("http://qt-project.org")), QNetworkProxyQuery::UrlRequest);
- QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(query);
- QTest::newRow(config.name().toUtf8()) << config << proxies;
- }
-}
-
-//Purpose of this test is to check that QNetworkAccessManager uses the proxy from the configuration it
-//has been given. Needs two or more working configurations to be a good test.
-void tst_QNetworkProxyFactory::inNetworkAccessManager()
-{
- QFETCH(QNetworkConfiguration, config);
- QFETCH(QList<QNetworkProxy>, proxies);
-
- int count = QDebugProxyFactory::requestCounter;
-
- QNetworkAccessManager manager;
- manager.setConfiguration(config);
-
- //using an internet server, because cellular APs won't have a route to the test server.
- QNetworkRequest req(QUrl(QString("http://qt-project.org")));
- QNetworkReply *reply = manager.get(req);
- connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QTestEventLoop::instance().enterLoop(30);
- delete reply;
-
- if (count == QDebugProxyFactory::requestCounter) {
- //RND phones are preconfigured with several test access points which won't work without a matching SIM
- //If the network fails to start, QNAM won't ask the factory for proxies so we can't test.
- QSKIP("network configuration didn't start");
- }
- QVERIFY(factory);
-
- qDebug() << "testing network configuration for" << config.name();
- foreach (QNetworkProxy proxy, factory->returnedList) {
- qDebug() << formatProxyName(proxy);
- }
- qDebug() << " <vs> ";
- foreach (QNetworkProxy proxy, proxies) {
- qDebug() << formatProxyName(proxy);
- }
- if (config.type() != QNetworkConfiguration::InternetAccessPoint)
- QEXPECT_FAIL("","QNetworkProxyFactory::systemProxyForQuery doesn't work for service networks yet", Continue);
- QCOMPARE(factory->returnedList, proxies);
-}
-
-#endif //QT_NO_BEARERMANAGEMENT
-
Q_DECLARE_METATYPE(QNetworkProxy::ProxyType)
void tst_QNetworkProxyFactory::genericSystemProxy()
diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
index 43b5422635..bc53faf106 100644
--- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
+++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
@@ -76,7 +76,9 @@ private slots:
void serverTest();
void udpLoopbackPerformance();
void tcpLoopbackPerformance();
+#if 0
void readWriteBufferSize();
+#endif
void bind();
void networkError();
void setSocketDescriptor();
@@ -485,6 +487,7 @@ void tst_PlatformSocketEngine::tcpLoopbackPerformance()
(readBytes / (timer.elapsed() / 1000.0)) / (1024 * 1024));
}
+#if 0 // unused
//---------------------------------------------------------------------------
void tst_PlatformSocketEngine::readWriteBufferSize()
{
@@ -503,6 +506,7 @@ void tst_PlatformSocketEngine::readWriteBufferSize()
QVERIFY(device.sendBufferSize() > bufferSize);
}
+#endif
//---------------------------------------------------------------------------
void tst_PlatformSocketEngine::tooManySockets()
diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
index 60ee4eb471..7760138067 100644
--- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp
@@ -306,9 +306,11 @@ void tst_QLocalSocket::listen()
// already isListening
QTest::ignoreMessage(QtWarningMsg, "QLocalServer::listen() called when already listening");
QVERIFY(!server.listen(name));
+ QVERIFY(server.socketDescriptor() != -1);
} else {
QVERIFY(!server.errorString().isEmpty());
QCOMPARE(server.serverError(), QAbstractSocket::HostNotFoundError);
+ QCOMPARE(server.socketDescriptor(), -1);
}
QCOMPARE(server.maxPendingConnections(), 30);
bool timedOut = false;
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index f64a88cc05..e45eda2940 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -57,6 +57,7 @@
#if QT_CONFIG(process)
# include <QProcess>
#endif
+#include <QRandomGenerator>
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
@@ -305,8 +306,6 @@ public:
tst_QTcpSocket::tst_QTcpSocket()
: firstFailName("qt-test-server-first-fail")
{
- qsrand(time(NULL));
-
tmpSocket = 0;
//This code relates to the socketsConstructedBeforeEventLoop test case
@@ -581,8 +580,7 @@ void tst_QTcpSocket::bind()
// try to get a random port number
// we do this to ensure we're not trying to bind to the same port as we've just used in
// a previous run - race condition with the OS actually freeing the port
- Q_STATIC_ASSERT(RAND_MAX > 1024);
- port = qrand() & USHRT_MAX;
+ port = QRandomGenerator::global()->generate() & USHRT_MAX;
if (port < 1024)
continue;
}
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index f97627cb42..4de77a9080 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -1171,6 +1171,19 @@ void tst_QSslSocket::protocolServerSide_data()
QTest::addColumn<QSsl::SslProtocol>("clientProtocol");
QTest::addColumn<bool>("works");
+#if QT_CONFIG(opensslv11)
+#if !defined(OPENSSL_NO_SSL2)
+ // OpenSSL 1.1 has removed SSL2 support. But there is no OPENSSL_NO_SSL2 macro ...
+#define OPENSSL_NO_SSL2
+#endif
+ // A client using our OpenSSL1.1 backend will negotiate up from TLS 1.0 or 1.1
+ // to TLS 1.2 if the server asks for it, where our older backend fails to compromise.
+ // So some tests that fail for the old pass with the new.
+ const bool willUseTLS12 = true;
+#else
+ const bool willUseTLS12 = false;
+#endif // opensslv11
+
#if !defined(OPENSSL_NO_SSL2) && !defined(QT_SECURETRANSPORT)
QTest::newRow("ssl2-ssl2") << QSsl::SslV2 << QSsl::SslV2 << false; // no idea why it does not work, but we don't care about SSL 2
#endif
@@ -1263,7 +1276,8 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("tls1.1orlater-ssl3") << QSsl::TlsV1_1OrLater << QSsl::SslV3 << false;
#endif
- QTest::newRow("tls1.1orlater-tls1.0") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_0 << false;
+
+ QTest::newRow("tls1.1orlater-tls1.0") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_0 << willUseTLS12;
QTest::newRow("tls1.1orlater-tls1.1") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_1 << true;
QTest::newRow("tls1.1orlater-tls1.2") << QSsl::TlsV1_1OrLater << QSsl::TlsV1_2 << true;
@@ -1273,8 +1287,8 @@ void tst_QSslSocket::protocolServerSide_data()
#if !defined(OPENSSL_NO_SSL3)
QTest::newRow("tls1.2orlater-ssl3") << QSsl::TlsV1_2OrLater << QSsl::SslV3 << false;
#endif
- QTest::newRow("tls1.2orlater-tls1.0") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_0 << false;
- QTest::newRow("tls1.2orlater-tls1.1") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_1 << false;
+ QTest::newRow("tls1.2orlater-tls1.0") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_0 << willUseTLS12;
+ QTest::newRow("tls1.2orlater-tls1.1") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_1 << willUseTLS12;
QTest::newRow("tls1.2orlater-tls1.2") << QSsl::TlsV1_2OrLater << QSsl::TlsV1_2 << true;
QTest::newRow("any-tls1.0") << QSsl::AnyProtocol << QSsl::TlsV1_0 << true;
@@ -2168,6 +2182,13 @@ void tst_QSslSocket::waitForMinusOne()
// fifth verification: it should wait for 200 ms more
QVERIFY(socket.waitForDisconnected(-1));
+
+ // sixth verification: reading from a disconnected socket returns -1
+ // once we deplete the read buffer
+ QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
+ socket.readAll();
+ char aux;
+ QCOMPARE(socket.read(&aux, 1), -1);
}
class VerifyServer : public QTcpServer
@@ -3670,7 +3691,9 @@ void tst_QSslSocket::ephemeralServerKey_data()
QTest::addColumn<QString>("cipher");
QTest::addColumn<bool>("emptyKey");
+#if !QT_CONFIG(opensslv11) // 1.1 drops support for RC4-SHA
QTest::newRow("NonForwardSecrecyCipher") << "RC4-SHA" << true;
+#endif // !opensslv11
QTest::newRow("ForwardSecrecyCipher") << "ECDHE-RSA-AES256-SHA" << (QSslSocket::sslLibraryVersionNumber() < 0x10002000L);
}
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index 7dfa8e4e22..46e2345c6a 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -868,7 +868,7 @@ void tst_QGL::graphicsViewClipping()
scene.setSceneRect(view.viewport()->rect());
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(view.viewport()->windowHandle()));
#ifdef Q_OS_MAC
// The black rectangle jumps from the center to the upper left for some reason.
QTest::qWait(100);
@@ -2142,7 +2142,7 @@ void tst_QGL::textureCleanup()
QGLWidget w;
w.resize(200,200);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
w.makeCurrent();
// Test pixmaps which have been loaded via QPixmapCache are removed from the texture cache
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
index ce895f734a..90fc4e0f2a 100644
--- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
@@ -138,7 +138,7 @@ public:
makeCurrent();
QPainter p(this);
- p.fillRect(rect(), QColor(rand() % 256, rand() % 256, rand() % 256));
+ p.fillRect(rect(), QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
p.setPen(Qt::red);
p.setFont(QFont("SansSerif", 24));
p.drawText(rect(), Qt::AlignCenter, "This is an autotest");
@@ -229,7 +229,7 @@ public:
int height = 300;
QImage image(width, height, QImage::Format_RGB32);
QPainter p(&image);
- p.fillRect(image.rect(), QColor(rand() % 256, rand() % 256, rand() % 256));
+ p.fillRect(image.rect(), QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
p.setPen(Qt::red);
p.setFont(QFont("SansSerif", 24));
p.drawText(image.rect(), Qt::AlignCenter, "This is an autotest");
@@ -271,7 +271,7 @@ public:
public slots:
void receiveImage(const QImage &image) {
m_images << image;
- m_positions << QPoint(-rand() % width() / 2, -rand() % height() / 2);
+ m_positions << QPoint(-QRandomGenerator::global()->bounded(width() / 2), -QRandomGenerator::global()->bounded(height() / 2));
m_semaphore->release(1);
@@ -326,7 +326,7 @@ void tst_QGLThreads::textureUploadInThread()
if that works, we're in good shape..
*/
-static inline float qrandom() { return (rand() % 100) / 100.f; }
+static inline float qrandom() { return (QRandomGenerator::global()->bounded(100)) / 100.f; }
void renderAScene(int w, int h)
{
@@ -345,12 +345,12 @@ void renderAScene(int w, int h)
for (int i=0; i<1000; ++i) {
GLfloat pos[] = {
- (rand() % 100) / 100.f,
- (rand() % 100) / 100.f,
- (rand() % 100) / 100.f,
- (rand() % 100) / 100.f,
- (rand() % 100) / 100.f,
- (rand() % 100) / 100.f
+ (QRandomGenerator::global()->bounded(100)) / 100.f,
+ (QRandomGenerator::global()->bounded(100)) / 100.f,
+ (QRandomGenerator::global()->bounded(100)) / 100.f,
+ (QRandomGenerator::global()->bounded(100)) / 100.f,
+ (QRandomGenerator::global()->bounded(100)) / 100.f,
+ (QRandomGenerator::global()->bounded(100)) / 100.f
};
funcs->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos);
@@ -523,7 +523,7 @@ public:
GLWidgetWrapper() {
widget.resize(150, 150);
widget.show();
- QTest::qWaitForWindowExposed(&widget);
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
widget.doneCurrent();
}
QPaintDevice *realPaintDevice() { return &widget; }
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index 121d731757..8b59f2758f 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -802,7 +802,7 @@ void tst_Compiler::cxx11_auto_type()
QSKIP("Compiler does not support C++11 feature");
#else
auto i = 1;
- auto x = qrand();
+ auto x = QRandomGenerator::global()->generate();
auto l = 1L;
auto s = QStringLiteral("Hello World");
@@ -851,8 +851,8 @@ void tst_Compiler::cxx11_decltype()
#ifndef Q_COMPILER_DECLTYPE
QSKIP("Compiler does not support C++11 feature");
#else
- decltype(qrand()) i = 0;
- QCOMPARE(i, 0);
+ decltype(QRandomGenerator::global()->generate()) i = 0;
+ QCOMPARE(i, 0U);
#endif
}
@@ -1549,7 +1549,7 @@ void tst_Compiler::runtimeArrays()
#if __cpp_runtime_arrays-0 < 201304
QSKIP("Compiler does not support this C++14 feature");
#else
- int i[qrand() & 0x1f];
+ int i[QRandomGenerator::global()->generate() & 0x1f];
Q_UNUSED(i);
#endif
}
diff --git a/tests/auto/other/lancelot/scripts/gradientxform_device.qps b/tests/auto/other/lancelot/scripts/gradientxform_device.qps
new file mode 100644
index 0000000000..82ebb536bb
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/gradientxform_device.qps
@@ -0,0 +1,67 @@
+# Version: 1
+# CheckVsReference: 5%
+
+gradient_clearStops
+gradient_appendStop 0 black
+gradient_appendStop 0.4 yellow
+gradient_appendStop 1 gray
+
+gradient_setSpread PadSpread
+
+gradient_setCoordinateMode StretchToDeviceMode
+
+# first run is dummy, make it offscreen
+save
+translate -500 -500
+
+begin_block row
+save
+
+setPen nopen
+drawRect 50 0 100 100
+
+setPen brush 30
+setBrush lightblue
+drawRect 175 15 70 70
+
+setFont "times" 110 99
+drawText 270 100 "X"
+
+restore
+end_block row
+
+restore
+
+drawText 160 20 "PLAIN"
+drawText 560 20 "BRUSH XFORM"
+translate 0 20
+
+begin_block block
+save
+
+drawText 75 20 "Brush Fill"
+drawText 176 20 "Pen Stroke"
+drawText 277 20 "Text Stroke"
+translate 0 30
+drawText 0 50 "Linear"
+drawText 0 160 "Radial"
+drawText 0 270 "Conical"
+
+gradient_setLinear 0.0 0.0 0.4 0.0
+repeat_block row
+
+translate 0 110
+gradient_setRadial 0.04 0.08 0.3 0.3 0.05
+repeat_block row
+
+translate 0 110
+gradient_setConical 0.25 0.1 45
+repeat_block row
+restore
+end_block block
+
+translate 400 0
+brushRotate 30.0
+brushScale 1.5 .5
+brushTranslate 0 -80
+repeat_block block
diff --git a/tests/auto/other/lancelot/scripts/gradientxform_logical.qps b/tests/auto/other/lancelot/scripts/gradientxform_logical.qps
new file mode 100644
index 0000000000..1bb157b635
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/gradientxform_logical.qps
@@ -0,0 +1,67 @@
+# Version: 1
+# CheckVsReference: 5%
+
+gradient_clearStops
+gradient_appendStop 0 black
+gradient_appendStop 0.4 yellow
+gradient_appendStop 1 gray
+
+gradient_setSpread PadSpread
+
+gradient_setCoordinateMode LogicalMode
+
+# first run is dummy, make it offscreen
+save
+translate -500 -500
+
+begin_block row
+save
+
+setPen nopen
+drawRect 50 0 100 100
+
+setPen brush 30
+setBrush lightblue
+drawRect 175 15 70 70
+
+setFont "times" 110 99
+drawText 270 100 "X"
+
+restore
+end_block row
+
+restore
+
+drawText 160 20 "PLAIN"
+drawText 560 20 "BRUSH XFORM"
+translate 0 20
+
+begin_block block
+save
+
+drawText 75 20 "Brush Fill"
+drawText 176 20 "Pen Stroke"
+drawText 277 20 "Text Stroke"
+translate 0 30
+drawText 0 50 "Linear"
+drawText 0 160 "Radial"
+drawText 0 270 "Conical"
+
+gradient_setLinear 0 0 400 0
+repeat_block row
+
+translate 0 110
+gradient_setRadial 200 50 140 70 20
+repeat_block row
+
+translate 0 110
+gradient_setConical 220 60 45
+repeat_block row
+restore
+end_block block
+
+translate 400 0
+brushRotate 30.0
+brushScale 1.5 .5
+brushTranslate 0 -80
+repeat_block block
diff --git a/tests/auto/other/lancelot/scripts/gradientxform_object.qps b/tests/auto/other/lancelot/scripts/gradientxform_object.qps
new file mode 100644
index 0000000000..d785a008c0
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/gradientxform_object.qps
@@ -0,0 +1,68 @@
+# Version: 1
+# CheckVsReference: 5%
+
+gradient_clearStops
+gradient_appendStop 0 black
+gradient_appendStop 0.4 yellow
+gradient_appendStop 1 gray
+
+gradient_setSpread PadSpread
+
+gradient_setCoordinateMode ObjectBoundingMode
+
+# first run is dummy, make it offscreen
+save
+translate -500 -500
+
+begin_block row
+save
+
+setPen nopen
+drawRect 50 0 100 100
+
+setPen brush 30
+setBrush lightblue
+translate 110 0
+drawRect 65 15 70 70
+
+translate 110 0
+setFont "times" 110 99
+drawText 50 100 "X"
+
+restore
+end_block row
+
+restore
+
+drawText 160 20 "PLAIN"
+drawText 560 20 "BRUSH XFORM"
+translate 0 20
+
+begin_block block
+save
+
+drawText 75 20 "Brush Fill"
+drawText 176 20 "Pen Stroke"
+drawText 277 20 "Text Stroke"
+translate 0 30
+drawText 0 50 "Linear"
+drawText 0 160 "Radial"
+drawText 0 270 "Conical"
+
+gradient_setLinear 0.1 0.0 0.5 0.0
+repeat_block row
+
+translate 0 110
+gradient_setRadial 0.3 0.2 0.5 0.4 0.5
+repeat_block row
+
+translate 0 110
+gradient_setConical 0.5 0.7 45
+repeat_block row
+restore
+end_block block
+
+translate 400 0
+brushRotate 30.0
+brushScale 1.5 .5
+repeat_block block
diff --git a/tests/auto/other/macnativeevents/BLACKLIST b/tests/auto/other/macnativeevents/BLACKLIST
index 3998eb616a..1bc530ecc8 100644
--- a/tests/auto/other/macnativeevents/BLACKLIST
+++ b/tests/auto/other/macnativeevents/BLACKLIST
@@ -21,22 +21,22 @@ osx
osx
[testMouseDragToNonClientArea]
osx
-# QTQAINFRA-1292
-[testPushButtonPressRelease]
-osx-10.11 ci
osx-10.12 ci
-# QTQAINFRA-1292
+# The following key tests fail after switching to synchronous
+# expose events, and we don't know why yet. QTBUG-62042
[testKeyPressOnToplevel]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierShift]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierAlt]
-osx-10.12 ci
-# QTQAINFRA-1292
+osx
[testModifierCtrl]
+osx
+# QTQAINFRA-1292
+[testPushButtonPressRelease]
+osx-10.11 ci
osx-10.12 ci
+
# QTQAINFRA-1292
[testModifierCtrlWithDontSwapCtrlAndMeta]
osx-10.12 ci
diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro
index 48ad04bbff..0611377d0b 100644
--- a/tests/auto/other/macnativeevents/macnativeevents.pro
+++ b/tests/auto/other/macnativeevents/macnativeevents.pro
@@ -1,9 +1,8 @@
CONFIG += testcase
TARGET = tst_macnativeevents
-LIBS += -framework Carbon
QT += widgets testlib
HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h
-SOURCES += qnativeevents.cpp qnativeevents_mac.cpp
+SOURCES += qnativeevents.cpp qnativeevents_mac.cpp
SOURCES += expectedeventlist.cpp nativeeventlist.cpp
SOURCES += tst_macnativeevents.cpp
diff --git a/tests/auto/other/macnativeevents/qnativeevents.cpp b/tests/auto/other/macnativeevents/qnativeevents.cpp
index 758c0a94b8..f04b33151a 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents.cpp
@@ -72,7 +72,7 @@ void QNativeInput::nativeEvent(QNativeEvent *event)
}
}
-Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event, int pid)
+Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event)
{
switch (event.id()){
case QNativeMouseMoveEvent::eventId:
@@ -84,7 +84,7 @@ Qt::Native::Status QNativeInput::sendNativeEvent(const QNativeEvent &event, int
case QNativeMouseWheelEvent::eventId:
return sendNativeMouseWheelEvent(static_cast<const QNativeMouseWheelEvent &>(event));
case QNativeKeyEvent::eventId:
- return sendNativeKeyEvent(static_cast<const QNativeKeyEvent &>(event), pid);
+ return sendNativeKeyEvent(static_cast<const QNativeKeyEvent &>(event));
case QNativeModifierEvent::eventId:
return sendNativeModifierEvent(static_cast<const QNativeModifierEvent &>(event));
case QNativeEvent::eventId:
diff --git a/tests/auto/other/macnativeevents/qnativeevents.h b/tests/auto/other/macnativeevents/qnativeevents.h
index 605d6d196e..2e30d849f2 100644
--- a/tests/auto/other/macnativeevents/qnativeevents.h
+++ b/tests/auto/other/macnativeevents/qnativeevents.h
@@ -204,10 +204,10 @@ class QNativeInput
static Qt::Native::Status sendNativeMouseMoveEvent(const QNativeMouseMoveEvent &event);
static Qt::Native::Status sendNativeMouseDragEvent(const QNativeMouseDragEvent &event);
static Qt::Native::Status sendNativeMouseWheelEvent(const QNativeMouseWheelEvent &event);
- static Qt::Native::Status sendNativeKeyEvent(const QNativeKeyEvent &event, int pid = 0);
+ static Qt::Native::Status sendNativeKeyEvent(const QNativeKeyEvent &event);
static Qt::Native::Status sendNativeModifierEvent(const QNativeModifierEvent &event);
// sendNativeEvent will NOT differ from OS to OS.
- static Qt::Native::Status sendNativeEvent(const QNativeEvent &event, int pid = 0);
+ static Qt::Native::Status sendNativeEvent(const QNativeEvent &event);
// The following methods will differ in implementation from OS to OS:
Qt::Native::Status subscribeForNativeEvents();
diff --git a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
index 6671813188..6d7fbbecc1 100644
--- a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
+++ b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp
@@ -27,7 +27,7 @@
****************************************************************************/
#include "qnativeevents.h"
-#include <Carbon/Carbon.h>
+#include <CoreGraphics/CoreGraphics.h>
#include <QtCore>
// ************************************************************
@@ -176,28 +176,18 @@ static CGEventRef EventHandler_Quartz(CGEventTapProxy proxy, CGEventType type, C
return inEvent;
}
-Qt::Native::Status insertEventHandler_Quartz(QNativeInput *nativeInput, int pid = 0)
+Qt::Native::Status insertEventHandler_Quartz(QNativeInput *nativeInput)
{
uid_t uid = geteuid();
if (uid != 0)
qWarning("MacNativeEvents: You must be root to listen for key events!");
- CFMachPortRef port;
- if (!pid){
- port = CGEventTapCreate(kCGHIDEventTap,
- kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
- kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
- } else {
- ProcessSerialNumber psn;
- GetProcessForPID(pid, &psn);
- port = CGEventTapCreateForPSN(&psn,
- kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
- kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
- }
+ CFMachPortRef port = CGEventTapCreate(kCGHIDEventTap,
+ kCGHeadInsertEventTap, kCGEventTapOptionListenOnly,
+ kCGEventMaskForAllEvents, EventHandler_Quartz, nativeInput);
CFRunLoopSourceRef eventSrc = CFMachPortCreateRunLoopSource(NULL, port, 0);
- CFRunLoopAddSource((CFRunLoopRef) GetCFRunLoopFromEventLoop(GetMainEventLoop()),
- eventSrc, kCFRunLoopCommonModes);
+ CFRunLoopAddSource(CFRunLoopGetMain(), eventSrc, kCFRunLoopCommonModes);
return Qt::Native::Success;
}
@@ -207,19 +197,6 @@ Qt::Native::Status removeEventHandler_Quartz()
return Qt::Native::Success; // ToDo:
}
-Qt::Native::Status sendNativeKeyEventToProcess_Quartz(const QNativeKeyEvent &event, int pid)
-{
- ProcessSerialNumber psn;
- GetProcessForPID(pid, &psn);
-
- CGEventRef e = CGEventCreateKeyboardEvent(0, (uint)event.nativeKeyCode, event.press);
- setModifiersFromQNativeEvent(e, event);
- SetFrontProcess(&psn);
- CGEventPostToPSN(&psn, e);
- CFRelease(e);
- return Qt::Native::Success;
-}
-
Qt::Native::Status sendNativeKeyEvent_Quartz(const QNativeKeyEvent &event)
{
CGEventRef e = CGEventCreateKeyboardEvent(0, (uint)event.nativeKeyCode, event.press);
@@ -344,12 +321,9 @@ Qt::Native::Status QNativeInput::sendNativeMouseWheelEvent(const QNativeMouseWhe
return sendNativeMouseWheelEvent_Quartz(event);
}
-Qt::Native::Status QNativeInput::sendNativeKeyEvent(const QNativeKeyEvent &event, int pid)
+Qt::Native::Status QNativeInput::sendNativeKeyEvent(const QNativeKeyEvent &event)
{
- if (!pid)
- return sendNativeKeyEvent_Quartz(event);
- else
- return sendNativeKeyEventToProcess_Quartz(event, pid);
+ return sendNativeKeyEvent_Quartz(event);
}
Qt::Native::Status QNativeInput::sendNativeModifierEvent(const QNativeModifierEvent &event)
diff --git a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
index 5edff7aabe..e8970e6f24 100644
--- a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
+++ b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp
@@ -35,10 +35,14 @@
#include "qnativeevents.h"
#include "nativeeventlist.h"
#include "expectedeventlist.h"
-#include <Carbon/Carbon.h>
QT_USE_NAMESPACE
+// Unicode code points for the glyphs associated with these keys
+// Defined by Carbon headers but not anywhere in Cocoa
+static const int kControlUnicode = 0x2303;
+static const int kCommandUnicode = 0x2318;
+
class tst_MacNativeEvents : public QObject
{
Q_OBJECT
diff --git a/tests/auto/other/modeltest/dynamictreemodel.cpp b/tests/auto/other/modeltest/dynamictreemodel.cpp
index 1f6463db8a..fc979bce2d 100644
--- a/tests/auto/other/modeltest/dynamictreemodel.cpp
+++ b/tests/auto/other/modeltest/dynamictreemodel.cpp
@@ -33,9 +33,8 @@
#include <QtCore/QTimer>
#include <QtCore/QDebug>
-
-DynamicTreeModel::DynamicTreeModel(QObject *parent)
- : QAbstractItemModel(parent),
+DynamicTreeModel::DynamicTreeModel(QObject *parent) :
+ QAbstractItemModel(parent),
nextId(1)
{
}
@@ -45,186 +44,172 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
// if (column != 0)
// return QModelIndex();
+ if (column < 0 || row < 0)
+ return QModelIndex();
- if ( column < 0 || row < 0 )
- return QModelIndex();
-
- QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
+ QList<QList<qint64> > childIdColumns = m_childItems.value(parent.internalId());
- const qint64 grandParent = findParentId(parent.internalId());
- if (grandParent >= 0) {
- QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
- if (parent.column() >= parentTable.size())
- qFatal("%s: parent.column() must be less than parentTable.size()", Q_FUNC_INFO);
- QList<qint64> parentSiblings = parentTable.at(parent.column());
- if (parent.row() >= parentSiblings.size())
- qFatal("%s: parent.row() must be less than parentSiblings.size()", Q_FUNC_INFO);
- }
-
- if (childIdColumns.size() == 0)
- return QModelIndex();
+ const qint64 grandParent = findParentId(parent.internalId());
+ if (grandParent >= 0) {
+ QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
+ if (parent.column() >= parentTable.size())
+ qFatal("%s: parent.column() must be less than parentTable.size()", Q_FUNC_INFO);
+ QList<qint64> parentSiblings = parentTable.at(parent.column());
+ if (parent.row() >= parentSiblings.size())
+ qFatal("%s: parent.row() must be less than parentSiblings.size()", Q_FUNC_INFO);
+ }
- if (column >= childIdColumns.size())
- return QModelIndex();
+ if (childIdColumns.size() == 0)
+ return QModelIndex();
- QList<qint64> rowIds = childIdColumns.at(column);
+ if (column >= childIdColumns.size())
+ return QModelIndex();
- if ( row >= rowIds.size())
- return QModelIndex();
+ QList<qint64> rowIds = childIdColumns.at(column);
- qint64 id = rowIds.at(row);
+ if (row >= rowIds.size())
+ return QModelIndex();
- return createIndex(row, column, reinterpret_cast<void *>(id));
+ qint64 id = rowIds.at(row);
+ return createIndex(row, column, reinterpret_cast<void *>(id));
}
qint64 DynamicTreeModel::findParentId(qint64 searchId) const
{
- if (searchId <= 0)
- return -1;
-
- QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
- while (i.hasNext())
- {
- i.next();
- QListIterator<QList<qint64> > j(i.value());
- while (j.hasNext())
- {
- QList<qint64> l = j.next();
- if (l.contains(searchId))
- {
- return i.key();
- }
+ if (searchId <= 0)
+ return -1;
+
+ QHashIterator<qint64, QList<QList<qint64> > > i(m_childItems);
+ while (i.hasNext()) {
+ i.next();
+ QListIterator<QList<qint64> > j(i.value());
+ while (j.hasNext()) {
+ QList<qint64> l = j.next();
+ if (l.contains(searchId))
+ return i.key();
+ }
}
- }
- return -1;
+ return -1;
}
QModelIndex DynamicTreeModel::parent(const QModelIndex &index) const
{
- if (!index.isValid())
- return QModelIndex();
+ if (!index.isValid())
+ return QModelIndex();
- qint64 searchId = index.internalId();
- qint64 parentId = findParentId(searchId);
- // Will never happen for valid index, but what the hey...
- if (parentId <= 0)
- return QModelIndex();
+ qint64 searchId = index.internalId();
+ qint64 parentId = findParentId(searchId);
+ // Will never happen for valid index, but what the hey...
+ if (parentId <= 0)
+ return QModelIndex();
- qint64 grandParentId = findParentId(parentId);
- if (grandParentId < 0)
- grandParentId = 0;
+ qint64 grandParentId = findParentId(parentId);
+ if (grandParentId < 0)
+ grandParentId = 0;
- int column = 0;
- QList<qint64> childList = m_childItems.value(grandParentId).at(column);
+ int column = 0;
+ QList<qint64> childList = m_childItems.value(grandParentId).at(column);
- int row = childList.indexOf(parentId);
-
- return createIndex(row, column, reinterpret_cast<void *>(parentId));
+ int row = childList.indexOf(parentId);
+ return createIndex(row, column, reinterpret_cast<void *>(parentId));
}
-int DynamicTreeModel::rowCount(const QModelIndex &index ) const
+int DynamicTreeModel::rowCount(const QModelIndex &index) const
{
- QList<QList<qint64> > cols = m_childItems.value(index.internalId());
+ QList<QList<qint64> > cols = m_childItems.value(index.internalId());
- if (cols.size() == 0 )
- return 0;
+ if (cols.size() == 0)
+ return 0;
- if (index.column() > 0)
- return 0;
+ if (index.column() > 0)
+ return 0;
- return cols.at(0).size();
+ return cols.at(0).size();
}
-int DynamicTreeModel::columnCount(const QModelIndex &index ) const
+int DynamicTreeModel::columnCount(const QModelIndex &index) const
{
// Q_UNUSED(index);
- return m_childItems.value(index.internalId()).size();
+ return m_childItems.value(index.internalId()).size();
}
QVariant DynamicTreeModel::data(const QModelIndex &index, int role) const
{
- if (!index.isValid())
- return QVariant();
+ if (!index.isValid())
+ return QVariant();
- if (Qt::DisplayRole == role)
- {
- return m_items.value(index.internalId());
- }
- return QVariant();
+ if (Qt::DisplayRole == role)
+ return m_items.value(index.internalId());
+ return QVariant();
}
void DynamicTreeModel::clear()
{
- beginResetModel();
- m_items.clear();
- m_childItems.clear();
- nextId = 1;
- endResetModel();
+ beginResetModel();
+ m_items.clear();
+ m_childItems.clear();
+ nextId = 1;
+ endResetModel();
}
-
-ModelChangeCommand::ModelChangeCommand( DynamicTreeModel *model, QObject *parent )
- : QObject(parent), m_model(model), m_numCols(1), m_startRow(-1), m_endRow(-1)
+ModelChangeCommand::ModelChangeCommand(DynamicTreeModel *model, QObject *parent) :
+ QObject(parent),
+ m_model(model),
+ m_numCols(1),
+ m_startRow(-1),
+ m_endRow(-1)
{
-
}
QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
{
- const int col = 0;
- QModelIndex parent = QModelIndex();
- QListIterator<int> i(rows);
- while (i.hasNext())
- {
- parent = m_model->index(i.next(), col, parent);
- if (!parent.isValid())
- qFatal("%s: parent must be valid", Q_FUNC_INFO);
- }
- return parent;
+ const int col = 0;
+ QModelIndex parent = QModelIndex();
+ QListIterator<int> i(rows);
+ while (i.hasNext()) {
+ parent = m_model->index(i.next(), col, parent);
+ if (!parent.isValid())
+ qFatal("%s: parent must be valid", Q_FUNC_INFO);
+ }
+ return parent;
}
-ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent )
- : ModelChangeCommand(model, parent)
+ModelInsertCommand::ModelInsertCommand(DynamicTreeModel *model, QObject *parent) :
+ ModelChangeCommand(model, parent)
{
-
}
void ModelInsertCommand::doCommand()
{
- QModelIndex parent = findIndex(m_rowNumbers);
- m_model->beginInsertRows(parent, m_startRow, m_endRow);
- qint64 parentId = parent.internalId();
- for (int row = m_startRow; row <= m_endRow; row++)
- {
- for(int col = 0; col < m_numCols; col++ )
- {
- if (m_model->m_childItems[parentId].size() <= col)
- {
- m_model->m_childItems[parentId].append(QList<qint64>());
- }
+ QModelIndex parent = findIndex(m_rowNumbers);
+ m_model->beginInsertRows(parent, m_startRow, m_endRow);
+ qint64 parentId = parent.internalId();
+ for (int row = m_startRow; row <= m_endRow; row++) {
+ for (int col = 0; col < m_numCols; col++) {
+ if (m_model->m_childItems[parentId].size() <= col)
+ m_model->m_childItems[parentId].append(QList<qint64>());
// QString name = QUuid::createUuid().toString();
- qint64 id = m_model->newId();
- QString name = QString::number(id);
-
- m_model->m_items.insert(id, name);
- m_model->m_childItems[parentId][col].insert(row, id);
+ qint64 id = m_model->newId();
+ QString name = QString::number(id);
+ m_model->m_items.insert(id, name);
+ m_model->m_childItems[parentId][col].insert(row, id);
+ }
}
- }
- m_model->endInsertRows();
+ m_model->endInsertRows();
}
-
-ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent)
- : ModelChangeCommand(model, parent)
+ModelMoveCommand::ModelMoveCommand(DynamicTreeModel *model, QObject *parent) :
+ ModelChangeCommand(model, parent)
{
-
}
-bool ModelMoveCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
+
+bool ModelMoveCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow)
{
- return m_model->beginMoveRows(srcParent, srcStart, srcEnd, destParent, destRow);
+ return m_model->beginMoveRows(srcParent, srcStart, srcEnd, destParent, destRow);
}
void ModelMoveCommand::doCommand()
@@ -233,33 +218,26 @@ void ModelMoveCommand::doCommand()
QModelIndex destParent = findIndex(m_destRowNumbers);
if (!emitPreSignal(srcParent, m_startRow, m_endRow, destParent, m_destRow))
- {
return;
- }
- for (int column = 0; column < m_numCols; ++column)
- {
- QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(m_startRow, m_endRow - m_startRow + 1 );
+ for (int column = 0; column < m_numCols; ++column) {
+ QList<qint64> l = m_model->m_childItems.value(srcParent.internalId())[column].mid(
+ m_startRow, m_endRow - m_startRow + 1);
- for (int i = m_startRow; i <= m_endRow ; i++)
- {
+ for (int i = m_startRow; i <= m_endRow; i++)
m_model->m_childItems[srcParent.internalId()][column].removeAt(m_startRow);
- }
int d;
- if (m_destRow < m_startRow)
+ if (m_destRow < m_startRow) {
d = m_destRow;
- else
- {
+ } else {
if (srcParent == destParent)
d = m_destRow - (m_endRow - m_startRow + 1);
else
d = m_destRow - (m_endRow - m_startRow) + 1;
}
- foreach(const qint64 id, l)
- {
+ foreach (const qint64 id, l)
m_model->m_childItems[destParent.internalId()][column].insert(d++, id);
- }
}
emitPostSignal();
@@ -270,18 +248,17 @@ void ModelMoveCommand::emitPostSignal()
m_model->endMoveRows();
}
-ModelResetCommand::ModelResetCommand(DynamicTreeModel* model, QObject* parent)
- : ModelMoveCommand(model, parent)
+ModelResetCommand::ModelResetCommand(DynamicTreeModel *model, QObject *parent) :
+ ModelMoveCommand(model, parent)
{
-
}
ModelResetCommand::~ModelResetCommand()
{
-
}
-bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
+bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow)
{
Q_UNUSED(srcParent);
Q_UNUSED(srcStart);
@@ -298,18 +275,17 @@ void ModelResetCommand::emitPostSignal()
m_model->endResetModel();
}
-ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent)
- : ModelMoveCommand(model, parent)
+ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent) :
+ ModelMoveCommand(model, parent)
{
-
}
ModelResetCommandFixed::~ModelResetCommandFixed()
{
-
}
-bool ModelResetCommandFixed::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow)
+bool ModelResetCommandFixed::emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow)
{
Q_UNUSED(srcParent);
Q_UNUSED(srcStart);
@@ -326,10 +302,10 @@ void ModelResetCommandFixed::emitPostSignal()
m_model->endResetModel();
}
-ModelChangeChildrenLayoutsCommand::ModelChangeChildrenLayoutsCommand(DynamicTreeModel* model, QObject* parent)
- : ModelChangeCommand(model, parent)
+ModelChangeChildrenLayoutsCommand::ModelChangeChildrenLayoutsCommand(DynamicTreeModel *model,
+ QObject *parent) :
+ ModelChangeCommand(model, parent)
{
-
}
void ModelChangeChildrenLayoutsCommand::doCommand()
@@ -346,17 +322,16 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
int rowSize1 = -1;
int rowSize2 = -1;
- for (int column = 0; column < m_numCols; ++column)
- {
+ for (int column = 0; column < m_numCols; ++column) {
{
- QList<qint64> &l = m_model->m_childItems[parent1.internalId()][column];
- rowSize1 = l.size();
- l.prepend(l.takeLast());
+ QList<qint64> &l = m_model->m_childItems[parent1.internalId()][column];
+ rowSize1 = l.size();
+ l.prepend(l.takeLast());
}
{
- QList<qint64> &l = m_model->m_childItems[parent2.internalId()][column];
- rowSize2 = l.size();
- l.append(l.takeFirst());
+ QList<qint64> &l = m_model->m_childItems[parent2.internalId()][column];
+ rowSize2 = l.size();
+ l.append(l.takeFirst());
}
}
@@ -373,15 +348,23 @@ void ModelChangeChildrenLayoutsCommand::doCommand()
foreach (const QModelIndex &idx, persistent) {
if (idx.parent() == parent1) {
if (idx.row() == rowSize1 - 1) {
- m_model->changePersistentIndex(idx, m_model->createIndex(0, idx.column(), idx.internalPointer()));
+ m_model->changePersistentIndex(idx,
+ m_model->createIndex(0, idx.column(),
+ idx.internalPointer()));
} else {
- m_model->changePersistentIndex(idx, m_model->createIndex(idx.row() + 1, idx.column(), idx.internalPointer()));
+ m_model->changePersistentIndex(idx,
+ m_model->createIndex(idx.row() + 1, idx.column(),
+ idx.internalPointer()));
}
} else if (idx.parent() == parent2) {
if (idx.row() == 0) {
- m_model->changePersistentIndex(idx, m_model->createIndex(rowSize2 - 1, idx.column(), idx.internalPointer()));
+ m_model->changePersistentIndex(idx,
+ m_model->createIndex(rowSize2 - 1, idx.column(),
+ idx.internalPointer()));
} else {
- m_model->changePersistentIndex(idx, m_model->createIndex(idx.row() - 1, idx.column(), idx.internalPointer()));
+ m_model->changePersistentIndex(idx,
+ m_model->createIndex(idx.row() - 1, idx.column(),
+ idx.internalPointer()));
}
}
}
diff --git a/tests/auto/other/modeltest/dynamictreemodel.h b/tests/auto/other/modeltest/dynamictreemodel.h
index e31c4569fd..709751dd27 100644
--- a/tests/auto/other/modeltest/dynamictreemodel.h
+++ b/tests/auto/other/modeltest/dynamictreemodel.h
@@ -34,119 +34,142 @@
#include <QtCore/QHash>
#include <QtCore/QList>
-
class DynamicTreeModel : public QAbstractItemModel
{
- Q_OBJECT
+ Q_OBJECT
public:
- DynamicTreeModel(QObject *parent = 0);
+ DynamicTreeModel(QObject *parent = 0);
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index) const;
- int rowCount(const QModelIndex &index = QModelIndex()) const;
- int columnCount(const QModelIndex &index = QModelIndex()) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &index = QModelIndex()) const;
+ int columnCount(const QModelIndex &index = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- void clear();
+ void clear();
protected slots:
- /**
- Finds the parent id of the string with id @p searchId.
+ /**
+ Finds the parent id of the string with id @p searchId.
- Returns -1 if not found.
- */
- qint64 findParentId(qint64 searchId) const;
+ Returns -1 if not found.
+ */
+ qint64 findParentId(qint64 searchId) const;
private:
- QHash<qint64, QString> m_items;
- QHash<qint64, QList<QList<qint64> > > m_childItems;
- qint64 nextId;
- qint64 newId() { return nextId++; };
-
- QModelIndex m_nextParentIndex;
- int m_nextRow;
-
- int m_depth;
- int maxDepth;
-
- friend class ModelInsertCommand;
- friend class ModelMoveCommand;
- friend class ModelResetCommand;
- friend class ModelResetCommandFixed;
- friend class ModelChangeChildrenLayoutsCommand;
-
+ QHash<qint64, QString> m_items;
+ QHash<qint64, QList<QList<qint64> > > m_childItems;
+ qint64 nextId;
+ qint64 newId()
+ {
+ return nextId++;
+ }
+
+ QModelIndex m_nextParentIndex;
+ int m_nextRow;
+
+ int m_depth;
+ int maxDepth;
+
+ friend class ModelInsertCommand;
+ friend class ModelMoveCommand;
+ friend class ModelResetCommand;
+ friend class ModelResetCommandFixed;
+ friend class ModelChangeChildrenLayoutsCommand;
};
-
class ModelChangeCommand : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelChangeCommand( DynamicTreeModel *model, QObject *parent = 0 );
+ ModelChangeCommand(DynamicTreeModel *model, QObject *parent = 0);
- virtual ~ModelChangeCommand() {}
+ virtual ~ModelChangeCommand()
+ {
+ }
- void setAncestorRowNumbers(QList<int> rowNumbers) { m_rowNumbers = rowNumbers; }
+ void setAncestorRowNumbers(QList<int> rowNumbers)
+ {
+ m_rowNumbers = rowNumbers;
+ }
- QModelIndex findIndex(QList<int> rows);
+ QModelIndex findIndex(QList<int> rows);
- void setStartRow(int row) { m_startRow = row; }
+ void setStartRow(int row)
+ {
+ m_startRow = row;
+ }
- void setEndRow(int row) { m_endRow = row; }
+ void setEndRow(int row)
+ {
+ m_endRow = row;
+ }
- void setNumCols(int cols) { m_numCols = cols; }
+ void setNumCols(int cols)
+ {
+ m_numCols = cols;
+ }
- virtual void doCommand() = 0;
+ virtual void doCommand() = 0;
protected:
- DynamicTreeModel* m_model;
- QList<int> m_rowNumbers;
- int m_numCols;
- int m_startRow;
- int m_endRow;
-
+ DynamicTreeModel *m_model;
+ QList<int> m_rowNumbers;
+ int m_numCols;
+ int m_startRow;
+ int m_endRow;
};
-typedef QList<ModelChangeCommand*> ModelChangeCommandList;
+typedef QList<ModelChangeCommand *> ModelChangeCommandList;
class ModelInsertCommand : public ModelChangeCommand
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelInsertCommand(DynamicTreeModel *model, QObject *parent = 0 );
- virtual ~ModelInsertCommand() {}
+ ModelInsertCommand(DynamicTreeModel *model, QObject *parent = 0);
+ virtual ~ModelInsertCommand()
+ {
+ }
- virtual void doCommand();
+ virtual void doCommand();
};
-
class ModelMoveCommand : public ModelChangeCommand
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelMoveCommand(DynamicTreeModel *model, QObject *parent);
+ ModelMoveCommand(DynamicTreeModel *model, QObject *parent);
- virtual ~ModelMoveCommand() {}
+ virtual ~ModelMoveCommand()
+ {
+ }
- virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
+ virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow);
- virtual void doCommand();
+ virtual void doCommand();
- virtual void emitPostSignal();
+ virtual void emitPostSignal();
- void setDestAncestors( QList<int> rows ) { m_destRowNumbers = rows; }
+ void setDestAncestors(QList<int> rows)
+ {
+ m_destRowNumbers = rows;
+ }
- void setDestRow(int row) { m_destRow = row; }
+ void setDestRow(int row)
+ {
+ m_destRow = row;
+ }
protected:
- QList<int> m_destRowNumbers;
- int m_destRow;
+ QList<int> m_destRowNumbers;
+ int m_destRow;
};
/**
@@ -154,15 +177,15 @@ protected:
*/
class ModelResetCommand : public ModelMoveCommand
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelResetCommand(DynamicTreeModel* model, QObject* parent = 0);
+ ModelResetCommand(DynamicTreeModel *model, QObject *parent = 0);
- virtual ~ModelResetCommand();
-
- virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
- virtual void emitPostSignal();
+ virtual ~ModelResetCommand();
+ virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow);
+ virtual void emitPostSignal();
};
/**
@@ -170,32 +193,37 @@ public:
*/
class ModelResetCommandFixed : public ModelMoveCommand
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent = 0);
-
- virtual ~ModelResetCommandFixed();
+ ModelResetCommandFixed(DynamicTreeModel *model, QObject *parent = 0);
- virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd, const QModelIndex &destParent, int destRow);
- virtual void emitPostSignal();
+ virtual ~ModelResetCommandFixed();
+ virtual bool emitPreSignal(const QModelIndex &srcParent, int srcStart, int srcEnd,
+ const QModelIndex &destParent, int destRow);
+ virtual void emitPostSignal();
};
class ModelChangeChildrenLayoutsCommand : public ModelChangeCommand
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelChangeChildrenLayoutsCommand(DynamicTreeModel *model, QObject *parent);
+ ModelChangeChildrenLayoutsCommand(DynamicTreeModel *model, QObject *parent);
- virtual ~ModelChangeChildrenLayoutsCommand() {}
+ virtual ~ModelChangeChildrenLayoutsCommand()
+ {
+ }
- virtual void doCommand();
+ virtual void doCommand();
- void setSecondAncestorRowNumbers( QList<int> rows ) { m_secondRowNumbers = rows; }
+ void setSecondAncestorRowNumbers(QList<int> rows)
+ {
+ m_secondRowNumbers = rows;
+ }
protected:
- QList<int> m_secondRowNumbers;
- int m_destRow;
+ QList<int> m_secondRowNumbers;
+ int m_destRow;
};
#endif
diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp
index 4da00bda4d..611f9e904b 100644
--- a/tests/auto/other/modeltest/modeltest.cpp
+++ b/tests/auto/other/modeltest/modeltest.cpp
@@ -34,60 +34,62 @@
/*!
Connect to all of the models signals. Whenever anything happens recheck everything.
*/
-ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false )
+ModelTest::ModelTest(QAbstractItemModel *_model, QObject *parent) : QObject(parent),
+ model(_model),
+ fetchingMore(false)
{
if (!model)
qFatal("%s: model must not be null", Q_FUNC_INFO);
connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
- this, SLOT(runAllTests()) );
- connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()) );
- connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()) );
- connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
+ connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()));
+ connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()));
+ connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(runAllTests()) );
+ this, SLOT(runAllTests()));
// Special checks for changes
connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(layoutAboutToBeChanged()) );
+ this, SLOT(layoutAboutToBeChanged()));
connect(model, SIGNAL(layoutChanged()),
- this, SLOT(layoutChanged()) );
+ this, SLOT(layoutChanged()));
connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
- this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)) );
+ this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
- this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)) );
+ this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(rowsInserted(QModelIndex,int,int)) );
+ this, SLOT(rowsInserted(QModelIndex,int,int)));
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
- this, SLOT(rowsRemoved(QModelIndex,int,int)) );
+ this, SLOT(rowsRemoved(QModelIndex,int,int)));
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this, SLOT(dataChanged(QModelIndex,QModelIndex)) );
+ this, SLOT(dataChanged(QModelIndex,QModelIndex)));
connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
- this, SLOT(headerDataChanged(Qt::Orientation,int,int)) );
+ this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
runAllTests();
}
void ModelTest::runAllTests()
{
- if ( fetchingMore )
+ if (fetchingMore)
return;
nonDestructiveBasicTest();
rowCount();
@@ -105,31 +107,31 @@ void ModelTest::runAllTests()
void ModelTest::nonDestructiveBasicTest()
{
QVERIFY(!model->buddy(QModelIndex()).isValid());
- model->canFetchMore ( QModelIndex() );
- QVERIFY( model->columnCount ( QModelIndex() ) >= 0 );
+ model->canFetchMore(QModelIndex());
+ QVERIFY(model->columnCount(QModelIndex()) >= 0);
QCOMPARE(model->data(QModelIndex()), QVariant());
fetchingMore = true;
- model->fetchMore ( QModelIndex() );
+ model->fetchMore(QModelIndex());
fetchingMore = false;
- Qt::ItemFlags flags = model->flags ( QModelIndex() );
- QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 );
- model->hasChildren ( QModelIndex() );
- model->hasIndex ( 0, 0 );
- model->headerData ( 0, Qt::Horizontal );
- model->index ( 0, 0 );
- model->itemData ( QModelIndex() );
+ Qt::ItemFlags flags = model->flags(QModelIndex());
+ QVERIFY(flags == Qt::ItemIsDropEnabled || flags == 0);
+ model->hasChildren(QModelIndex());
+ model->hasIndex(0, 0);
+ model->headerData(0, Qt::Horizontal);
+ model->index(0, 0);
+ model->itemData(QModelIndex());
QVariant cache;
- model->match ( QModelIndex(), -1, cache );
+ model->match(QModelIndex(), -1, cache);
model->mimeTypes();
QVERIFY(!model->parent(QModelIndex()).isValid());
- QVERIFY( model->rowCount() >= 0 );
+ QVERIFY(model->rowCount() >= 0);
QVariant variant;
- model->setData ( QModelIndex(), variant, -1 );
- model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
- model->setHeaderData ( 999999, Qt::Horizontal, QVariant() );
+ model->setData(QModelIndex(), variant, -1);
+ model->setHeaderData(-1, Qt::Horizontal, QVariant());
+ model->setHeaderData(999999, Qt::Horizontal, QVariant());
QMap<int, QVariant> roles;
- model->sibling ( 0, 0, QModelIndex() );
- model->span ( QModelIndex() );
+ model->sibling(0, 0, QModelIndex());
+ model->span(QModelIndex());
model->supportedDropActions();
}
@@ -142,19 +144,19 @@ void ModelTest::rowCount()
{
// qDebug() << "rc";
// check top row
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- int rows = model->rowCount ( topIndex );
- QVERIFY( rows >= 0 );
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( topIndex ) );
-
- QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
- if ( secondLevelIndex.isValid() ) { // not the top level
+ QModelIndex topIndex = model->index(0, 0, QModelIndex());
+ int rows = model->rowCount(topIndex);
+ QVERIFY(rows >= 0);
+ if (rows > 0)
+ QVERIFY(model->hasChildren(topIndex));
+
+ QModelIndex secondLevelIndex = model->index(0, 0, topIndex);
+ if (secondLevelIndex.isValid()) { // not the top level
// check a row count where parent is valid
- rows = model->rowCount ( secondLevelIndex );
- QVERIFY( rows >= 0 );
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( secondLevelIndex ) );
+ rows = model->rowCount(secondLevelIndex);
+ QVERIFY(rows >= 0);
+ if (rows > 0)
+ QVERIFY(model->hasChildren(secondLevelIndex));
}
// The models rowCount() is tested more extensively in checkChildren(),
@@ -167,13 +169,13 @@ void ModelTest::rowCount()
void ModelTest::columnCount()
{
// check top row
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
- QVERIFY( model->columnCount ( topIndex ) >= 0 );
+ QModelIndex topIndex = model->index(0, 0, QModelIndex());
+ QVERIFY(model->columnCount(topIndex) >= 0);
// check a column count where parent is valid
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
- if ( childIndex.isValid() )
- QVERIFY( model->columnCount ( childIndex ) >= 0 );
+ QModelIndex childIndex = model->index(0, 0, topIndex);
+ if (childIndex.isValid())
+ QVERIFY(model->columnCount(childIndex) >= 0);
// columnCount() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@@ -186,19 +188,19 @@ void ModelTest::hasIndex()
{
// qDebug() << "hi";
// Make sure that invalid values returns an invalid index
- QVERIFY( !model->hasIndex ( -2, -2 ) );
- QVERIFY( !model->hasIndex ( -2, 0 ) );
- QVERIFY( !model->hasIndex ( 0, -2 ) );
+ QVERIFY(!model->hasIndex(-2, -2));
+ QVERIFY(!model->hasIndex(-2, 0));
+ QVERIFY(!model->hasIndex(0, -2));
int rows = model->rowCount();
int columns = model->columnCount();
// check out of bounds
- QVERIFY( !model->hasIndex ( rows, columns ) );
- QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) );
+ QVERIFY(!model->hasIndex(rows, columns));
+ QVERIFY(!model->hasIndex(rows + 1, columns + 1));
- if ( rows > 0 )
- QVERIFY( model->hasIndex ( 0, 0 ) );
+ if (rows > 0)
+ QVERIFY(model->hasIndex(0, 0));
// hasIndex() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@@ -218,7 +220,7 @@ void ModelTest::index()
int rows = model->rowCount();
int columns = model->columnCount();
- if ( rows == 0 )
+ if (rows == 0)
return;
// Catch off by one errors
@@ -226,8 +228,8 @@ void ModelTest::index()
QVERIFY(model->index(0, 0).isValid());
// Make sure that the same index is *always* returned
- QModelIndex a = model->index ( 0, 0 );
- QModelIndex b = model->index ( 0, 0 );
+ QModelIndex a = model->index(0, 0);
+ QModelIndex b = model->index(0, 0);
QCOMPARE(a, b);
// index() is tested more extensively in checkChildren(),
@@ -244,7 +246,7 @@ void ModelTest::parent()
// when asked for the parent of an invalid index.
QVERIFY(!model->parent(QModelIndex()).isValid());
- if ( model->rowCount() == 0 )
+ if (model->rowCount() == 0)
return;
// Column 0 | Column 1 |
@@ -254,29 +256,29 @@ void ModelTest::parent()
// Common error test #1, make sure that a top level index has a parent
// that is a invalid QModelIndex.
- QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
+ QModelIndex topIndex = model->index(0, 0, QModelIndex());
QVERIFY(!model->parent(topIndex).isValid());
// Common error test #2, make sure that a second level index has a parent
// that is the first level index.
- if ( model->rowCount ( topIndex ) > 0 ) {
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
+ if (model->rowCount(topIndex) > 0) {
+ QModelIndex childIndex = model->index(0, 0, topIndex);
QCOMPARE(model->parent(childIndex), topIndex);
}
// Common error test #3, the second column should NOT have the same children
// as the first column in a row.
// Usually the second column shouldn't have children.
- QModelIndex topIndex1 = model->index ( 0, 1, QModelIndex() );
- if ( model->rowCount ( topIndex1 ) > 0 ) {
- QModelIndex childIndex = model->index ( 0, 0, topIndex );
- QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
- QVERIFY( childIndex != childIndex1 );
+ QModelIndex topIndex1 = model->index(0, 1, QModelIndex());
+ if (model->rowCount(topIndex1) > 0) {
+ QModelIndex childIndex = model->index(0, 0, topIndex);
+ QModelIndex childIndex1 = model->index(0, 0, topIndex1);
+ QVERIFY(childIndex != childIndex1);
}
// Full test, walk n levels deep through the model making sure that all
// parent's children correctly specify their parent.
- checkChildren ( QModelIndex() );
+ checkChildren(QModelIndex());
}
/*!
@@ -293,73 +295,75 @@ void ModelTest::parent()
found the basic bugs because it is easier to figure out the problem in
those tests then this one.
*/
-void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
+void ModelTest::checkChildren(const QModelIndex &parent, int currentDepth)
{
// First just try walking back up the tree.
QModelIndex p = parent;
- while ( p.isValid() )
+ while (p.isValid())
p = p.parent();
// For models that are dynamically populated
- if ( model->canFetchMore ( parent ) ) {
+ if (model->canFetchMore(parent)) {
fetchingMore = true;
- model->fetchMore ( parent );
+ model->fetchMore(parent);
fetchingMore = false;
}
- int rows = model->rowCount ( parent );
- int columns = model->columnCount ( parent );
+ int rows = model->rowCount(parent);
+ int columns = model->columnCount(parent);
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( parent ) );
+ if (rows > 0)
+ QVERIFY(model->hasChildren(parent));
// Some further testing against rows(), columns(), and hasChildren()
- QVERIFY( rows >= 0 );
- QVERIFY( columns >= 0 );
- if ( rows > 0 )
- QVERIFY( model->hasChildren ( parent ) );
+ QVERIFY(rows >= 0);
+ QVERIFY(columns >= 0);
+ if (rows > 0)
+ QVERIFY(model->hasChildren(parent));
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
- const QModelIndex topLeftChild = model->index( 0, 0, parent );
+ const QModelIndex topLeftChild = model->index(0, 0, parent);
- QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) );
- for ( int r = 0; r < rows; ++r ) {
- if ( model->canFetchMore ( parent ) ) {
+ QVERIFY(!model->hasIndex(rows + 1, 0, parent));
+ for (int r = 0; r < rows; ++r) {
+ if (model->canFetchMore(parent)) {
fetchingMore = true;
- model->fetchMore ( parent );
+ model->fetchMore(parent);
fetchingMore = false;
}
- QVERIFY( !model->hasIndex ( r, columns + 1, parent ) );
- for ( int c = 0; c < columns; ++c ) {
- QVERIFY( model->hasIndex ( r, c, parent ) );
- QModelIndex index = model->index ( r, c, parent );
+ QVERIFY(!model->hasIndex(r, columns + 1, parent));
+ for (int c = 0; c < columns; ++c) {
+ QVERIFY(model->hasIndex(r, c, parent));
+ QModelIndex index = model->index(r, c, parent);
// rowCount() and columnCount() said that it existed...
+ if (!index.isValid())
+ qWarning() << "Got invalid index at row=" << r << "col=" << c << "parent=" << parent;
QVERIFY(index.isValid());
// index() should always return the same index when called twice in a row
- QModelIndex modifiedIndex = model->index ( r, c, parent );
+ QModelIndex modifiedIndex = model->index(r, c, parent);
QCOMPARE(index, modifiedIndex);
// Make sure we get the same index if we request it twice in a row
- QModelIndex a = model->index ( r, c, parent );
- QModelIndex b = model->index ( r, c, parent );
+ QModelIndex a = model->index(r, c, parent);
+ QModelIndex b = model->index(r, c, parent);
QCOMPARE(a, b);
{
- const QModelIndex sibling = model->sibling( r, c, topLeftChild );
+ const QModelIndex sibling = model->sibling(r, c, topLeftChild);
QCOMPARE(index, sibling);
}
{
- const QModelIndex sibling = topLeftChild.sibling( r, c );
+ const QModelIndex sibling = topLeftChild.sibling(r, c);
QCOMPARE(index, sibling);
}
// Some basic checking on the index that is returned
QCOMPARE(index.model(), model);
- QCOMPARE( index.row(), r );
- QCOMPARE( index.column(), c );
+ QCOMPARE(index.row(), r);
+ QCOMPARE(index.column(), c);
// While you can technically return a QVariant usually this is a sign
// of a bug in data(). Disable if this really is ok in your model.
// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
@@ -377,16 +381,16 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
}
// Check that we can get back our real parent.
- QCOMPARE( model->parent ( index ), parent );
+ QCOMPARE(model->parent(index), parent);
// recursively go down the children
- if ( model->hasChildren ( index ) && currentDepth < 10 ) {
+ if (model->hasChildren(index) && currentDepth < 10) {
//qDebug() << r << c << "has children" << model->rowCount(index);
- checkChildren ( index, ++currentDepth );
+ checkChildren(index, ++currentDepth);
}/* else { if (currentDepth >= 10) qDebug() << "checked 10 deep"; };*/
// make sure that after testing the children that the index doesn't change.
- QModelIndex newerIndex = model->index ( r, c, parent );
+ QModelIndex newerIndex = model->index(r, c, parent);
QCOMPARE(index, newerIndex);
}
}
@@ -398,68 +402,61 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
void ModelTest::data()
{
// Invalid index should return an invalid qvariant
- QVERIFY( !model->data ( QModelIndex() ).isValid() );
+ QVERIFY(!model->data(QModelIndex()).isValid());
- if ( model->rowCount() == 0 )
+ if (model->rowCount() == 0)
return;
// A valid index should have a valid QVariant data
- QVERIFY( model->index ( 0, 0 ).isValid() );
+ QVERIFY(model->index(0, 0).isValid());
// shouldn't be able to set data on an invalid index
- QVERIFY( !model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) );
+ QVERIFY(!model->setData(QModelIndex(), QLatin1String("foo"), Qt::DisplayRole));
// General Purpose roles that should return a QString
- QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert<QString>() );
- }
- variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert<QString>() );
- }
- variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert<QString>() );
- }
+ QVariant variant = model->data(model->index(0, 0), Qt::ToolTipRole);
+ if (variant.isValid())
+ QVERIFY(variant.canConvert<QString>());
+ variant = model->data(model->index(0, 0), Qt::StatusTipRole);
+ if (variant.isValid())
+ QVERIFY(variant.canConvert<QString>());
+ variant = model->data(model->index(0, 0), Qt::WhatsThisRole);
+ if (variant.isValid())
+ QVERIFY(variant.canConvert<QString>());
// General Purpose roles that should return a QSize
- variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
- if ( variant.isValid() ) {
- QVERIFY( variant.canConvert<QSize>() );
- }
+ variant = model->data(model->index(0, 0), Qt::SizeHintRole);
+ if (variant.isValid())
+ QVERIFY(variant.canConvert<QSize>());
// General Purpose roles that should return a QFont
- QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
- if ( fontVariant.isValid() ) {
- QVERIFY( fontVariant.canConvert<QFont>() );
- }
+ QVariant fontVariant = model->data(model->index(0, 0), Qt::FontRole);
+ if (fontVariant.isValid())
+ QVERIFY(fontVariant.canConvert<QFont>());
// Check that the alignment is one we know about
- QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
- if ( textAlignmentVariant.isValid() ) {
+ QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole);
+ if (textAlignmentVariant.isValid()) {
Qt::Alignment alignment = textAlignmentVariant.value<Qt::Alignment>();
- QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
+ QCOMPARE(alignment, (alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)));
}
// General Purpose roles that should return a QColor
- QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
- if ( colorVariant.isValid() ) {
- QVERIFY( colorVariant.canConvert<QColor>() );
- }
+ QVariant colorVariant = model->data(model->index(0, 0), Qt::BackgroundColorRole);
+ if (colorVariant.isValid())
+ QVERIFY(colorVariant.canConvert<QColor>());
- colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
- if ( colorVariant.isValid() ) {
- QVERIFY( colorVariant.canConvert<QColor>() );
- }
+ colorVariant = model->data(model->index(0, 0), Qt::TextColorRole);
+ if (colorVariant.isValid())
+ QVERIFY(colorVariant.canConvert<QColor>());
// Check that the "check state" is one we know about.
- QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
- if ( checkStateVariant.isValid() ) {
+ QVariant checkStateVariant = model->data(model->index(0, 0), Qt::CheckStateRole);
+ if (checkStateVariant.isValid()) {
int state = checkStateVariant.toInt();
- QVERIFY( state == Qt::Unchecked ||
- state == Qt::PartiallyChecked ||
- state == Qt::Checked );
+ QVERIFY(state == Qt::Unchecked
+ || state == Qt::PartiallyChecked
+ || state == Qt::Checked);
}
}
@@ -468,7 +465,7 @@ void ModelTest::data()
\sa rowsInserted()
*/
-void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int /* end */)
+void ModelTest::rowsAboutToBeInserted(const QModelIndex &parent, int start, int /* end */)
{
// Q_UNUSED(end);
// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
@@ -476,10 +473,10 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
// qDebug() << model->index(start-1, 0, parent) << model->data( model->index(start-1, 0, parent) );
Changing c;
c.parent = parent;
- c.oldSize = model->rowCount ( parent );
- c.last = model->data ( model->index ( start - 1, 0, parent ) );
- c.next = model->data ( model->index ( start, 0, parent ) );
- insert.push ( c );
+ c.oldSize = model->rowCount(parent);
+ c.last = model->data(model->index(start - 1, 0, parent));
+ c.next = model->data(model->index(start, 0, parent));
+ insert.push(c);
}
/*!
@@ -487,10 +484,10 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
\sa rowsAboutToBeInserted()
*/
-void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
+void ModelTest::rowsInserted(const QModelIndex &parent, int start, int end)
{
Changing c = insert.pop();
- QCOMPARE(c.parent, parent);
+ QCOMPARE(parent, c.parent);
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
@@ -500,30 +497,30 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
// }
// qDebug();
- QCOMPARE(c.oldSize + (end - start + 1), model->rowCount(parent));
- QCOMPARE(c.last, model->data(model->index(start - 1, 0, c.parent)));
+ QCOMPARE(model->rowCount(parent), c.oldSize + (end - start + 1));
+ QCOMPARE(model->data(model->index(start - 1, 0, c.parent)), c.last);
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
qDebug() << start << end;
- for (int i=0; i < model->rowCount(); ++i)
+ for (int i = 0; i < model->rowCount(); ++i)
qDebug() << model->index(i, 0).data().toString();
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
}
- QCOMPARE(c.next, model->data(model->index(end + 1, 0, c.parent)));
+ QCOMPARE(model->data(model->index(end + 1, 0, c.parent)), c.next);
}
void ModelTest::layoutAboutToBeChanged()
{
- for ( int i = 0; i < qBound ( 0, model->rowCount(), 100 ); ++i )
- changing.append ( QPersistentModelIndex ( model->index ( i, 0 ) ) );
+ for (int i = 0; i < qBound(0, model->rowCount(), 100); ++i)
+ changing.append(QPersistentModelIndex(model->index(i, 0)));
}
void ModelTest::layoutChanged()
{
- for ( int i = 0; i < changing.count(); ++i ) {
+ for (int i = 0; i < changing.count(); ++i) {
QPersistentModelIndex p = changing[i];
- QCOMPARE(QModelIndex(p), model->index(p.row(), p.column(), p.parent()));
+ QCOMPARE(model->index(p.row(), p.column(), p.parent()), QModelIndex(p));
}
changing.clear();
}
@@ -533,15 +530,15 @@ void ModelTest::layoutChanged()
\sa rowsRemoved()
*/
-void ModelTest::rowsAboutToBeRemoved ( const QModelIndex &parent, int start, int end )
+void ModelTest::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
-qDebug() << "ratbr" << parent << start << end;
+ qDebug() << "ratbr" << parent << start << end;
Changing c;
c.parent = parent;
- c.oldSize = model->rowCount ( parent );
- c.last = model->data ( model->index ( start - 1, 0, parent ) );
- c.next = model->data ( model->index ( end + 1, 0, parent ) );
- remove.push ( c );
+ c.oldSize = model->rowCount(parent);
+ c.last = model->data(model->index(start - 1, 0, parent));
+ c.next = model->data(model->index(end + 1, 0, parent));
+ remove.push(c);
}
/*!
@@ -549,14 +546,14 @@ qDebug() << "ratbr" << parent << start << end;
\sa rowsAboutToBeRemoved()
*/
-void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
+void ModelTest::rowsRemoved(const QModelIndex &parent, int start, int end)
{
- qDebug() << "rr" << parent << start << end;
+ qDebug() << "rr" << parent << start << end;
Changing c = remove.pop();
- QCOMPARE(c.parent, parent);
- QCOMPARE(c.oldSize - (end - start + 1), model->rowCount(parent));
- QCOMPARE(c.last, model->data(model->index(start - 1, 0, c.parent)));
- QCOMPARE(c.next, model->data(model->index(start, 0, c.parent)));
+ QCOMPARE(parent, c.parent);
+ QCOMPARE(model->rowCount(parent), c.oldSize - (end - start + 1));
+ QCOMPARE(model->data(model->index(start - 1, 0, c.parent)), c.last);
+ QCOMPARE(model->data(model->index(start, 0, c.parent)), c.next);
}
void ModelTest::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
@@ -582,4 +579,3 @@ void ModelTest::headerDataChanged(Qt::Orientation orientation, int start, int en
QVERIFY(start < itemCount);
QVERIFY(end < itemCount);
}
-
diff --git a/tests/auto/other/modeltest/modeltest.h b/tests/auto/other/modeltest/modeltest.h
index 735a422729..4676bf4434 100644
--- a/tests/auto/other/modeltest/modeltest.h
+++ b/tests/auto/other/modeltest/modeltest.h
@@ -26,7 +26,6 @@
**
****************************************************************************/
-
#ifndef MODELTEST_H
#define MODELTEST_H
@@ -36,48 +35,48 @@
class ModelTest : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- ModelTest( QAbstractItemModel *model, QObject *parent = 0 );
+ ModelTest(QAbstractItemModel *model, QObject *parent = 0);
private Q_SLOTS:
- void nonDestructiveBasicTest();
- void rowCount();
- void columnCount();
- void hasIndex();
- void index();
- void parent();
- void data();
+ void nonDestructiveBasicTest();
+ void rowCount();
+ void columnCount();
+ void hasIndex();
+ void index();
+ void parent();
+ void data();
protected Q_SLOTS:
- void runAllTests();
- void layoutAboutToBeChanged();
- void layoutChanged();
- void rowsAboutToBeInserted( const QModelIndex &parent, int start, int end );
- void rowsInserted( const QModelIndex & parent, int start, int end );
- void rowsAboutToBeRemoved( const QModelIndex &parent, int start, int end );
- void rowsRemoved( const QModelIndex & parent, int start, int end );
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- void headerDataChanged(Qt::Orientation orientation, int start, int end);
+ void runAllTests();
+ void layoutAboutToBeChanged();
+ void layoutChanged();
+ void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end);
+ void rowsInserted(const QModelIndex &parent, int start, int end);
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
+ void rowsRemoved(const QModelIndex &parent, int start, int end);
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void headerDataChanged(Qt::Orientation orientation, int start, int end);
private:
- void checkChildren( const QModelIndex &parent, int currentDepth = 0 );
+ void checkChildren(const QModelIndex &parent, int currentDepth = 0);
- QAbstractItemModel *model;
+ QAbstractItemModel *model;
- struct Changing {
- QModelIndex parent;
- int oldSize;
- QVariant last;
- QVariant next;
- };
- QStack<Changing> insert;
- QStack<Changing> remove;
+ struct Changing {
+ QModelIndex parent;
+ int oldSize;
+ QVariant last;
+ QVariant next;
+ };
+ QStack<Changing> insert;
+ QStack<Changing> remove;
- bool fetchingMore;
+ bool fetchingMore;
- QList<QPersistentModelIndex> changing;
+ QList<QPersistentModelIndex> changing;
};
#endif
diff --git a/tests/auto/other/modeltest/tst_modeltest.cpp b/tests/auto/other/modeltest/tst_modeltest.cpp
index f81fefe9d1..e2d002844b 100644
--- a/tests/auto/other/modeltest/tst_modeltest.cpp
+++ b/tests/auto/other/modeltest/tst_modeltest.cpp
@@ -26,7 +26,6 @@
**
****************************************************************************/
-
#include <QtTest/QtTest>
#include <QtGui/QtGui>
#include <QtWidgets/QtWidgets>
@@ -34,7 +33,6 @@
#include "modeltest.h"
#include "dynamictreemodel.h"
-
class tst_ModelTest : public QObject
{
Q_OBJECT
@@ -63,7 +61,7 @@ void tst_ModelTest::stringListModel()
proxy.setSourceModel(&model);
model.setStringList(QStringList() << "2" << "3" << "1");
- model.setStringList(QStringList() << "a" << "e" << "plop" << "b" << "c" );
+ model.setStringList(QStringList() << "a" << "e" << "plop" << "b" << "c");
proxy.setDynamicSortFilter(true);
proxy.setFilterRegExp(QRegExp("[^b]"));
@@ -76,9 +74,8 @@ void tst_ModelTest::treeWidgetModel()
ModelTest t1(widget.model());
QTreeWidgetItem *root = new QTreeWidgetItem(&widget, QStringList("root"));
- for (int i = 0; i < 20; ++i) {
+ for (int i = 0; i < 20; ++i)
new QTreeWidgetItem(root, QStringList(QString::number(i)));
- }
QTreeWidgetItem *remove = root->child(2);
root->removeChild(remove);
QTreeWidgetItem *parent = new QTreeWidgetItem(&widget, QStringList("parent"));
@@ -90,10 +87,9 @@ void tst_ModelTest::treeWidgetModel()
void tst_ModelTest::standardItemModel()
{
- QStandardItemModel model(10,10);
+ QStandardItemModel model(10, 10);
QSortFilterProxyModel proxy;
-
ModelTest t1(&model);
ModelTest t2(&proxy);
@@ -105,8 +101,8 @@ void tst_ModelTest::standardItemModel()
model.insertColumns(2, 5);
model.removeColumns(4, 5);
- model.insertRows(0,5, model.index(1,1));
- model.insertColumns(0,5, model.index(1,3));
+ model.insertRows(0, 5, model.index(1, 1));
+ model.insertColumns(0, 5, model.index(1, 3));
}
void tst_ModelTest::testInsertThroughProxy()
@@ -148,7 +144,9 @@ class AccessibleProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
- AccessibleProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) {}
+ AccessibleProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent)
+ {
+ }
QModelIndexList persistent()
{
@@ -160,14 +158,16 @@ class ObservingObject : public QObject
{
Q_OBJECT
public:
- ObservingObject(AccessibleProxyModel *proxy, QObject *parent = 0)
- : QObject(parent)
- , m_proxy(proxy)
- , storePersistentFailureCount(0)
- , checkPersistentFailureCount(0)
+ ObservingObject(AccessibleProxyModel *proxy, QObject *parent = 0) :
+ QObject(parent),
+ m_proxy(proxy),
+ storePersistentFailureCount(0),
+ checkPersistentFailureCount(0)
{
- connect(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(storePersistent()));
- connect(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), SLOT(checkPersistent()));
+ connect(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ SLOT(storePersistent()));
+ connect(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ SLOT(checkPersistent()));
}
public slots:
@@ -195,7 +195,7 @@ public slots:
void storePersistent()
{
// This method is called from rowsAboutToBeMoved. Persistent indexes should be valid
- foreach(const QModelIndex &idx, m_persistentProxyIndexes)
+ foreach (const QModelIndex &idx, m_persistentProxyIndexes)
if (!idx.isValid()) {
qWarning("%s: persistentProxyIndexes contains invalid index", Q_FUNC_INFO);
++storePersistentFailureCount;
@@ -233,7 +233,7 @@ public slots:
}
private:
- AccessibleProxyModel *m_proxy;
+ AccessibleProxyModel *m_proxy;
QList<QPersistentModelIndex> m_persistentSourceIndexes;
QList<QPersistentModelIndex> m_persistentProxyIndexes;
public:
@@ -296,6 +296,5 @@ void tst_ModelTest::testResetThroughProxy()
QCOMPARE(observer.checkPersistentFailureCount, 0);
}
-
QTEST_MAIN(tst_ModelTest)
#include "tst_modeltest.moc"
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 3b696604b5..dc353d2090 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -30,6 +30,7 @@
#include <QtNetwork/QtNetwork>
#include <QtCore/QDateTime>
#include <QtCore/QTextStream>
+#include <QtCore/QRandomGenerator>
#include <QtCore/QStandardPaths>
#include <QtCore/private/qiodevice_p.h>
@@ -538,7 +539,7 @@ void tst_NetworkSelfTest::imapServer()
void tst_NetworkSelfTest::httpServer()
{
QByteArray uniqueExtension = QByteArray::number((qulonglong)this) +
- QByteArray::number((qulonglong)qrand()) +
+ QByteArray::number((qulonglong)QRandomGenerator::global()->generate()) +
QByteArray::number(QDateTime::currentSecsSinceEpoch());
netChat(80, QList<Chat>()
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index d98bbe28b7..29fbffa541 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -352,7 +352,7 @@ void tst_QAccessibility::customWidget()
{
QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz");
widget->show();
- QTest::qWaitForWindowExposed(widget);
+ QVERIFY(QTest::qWaitForWindowExposed(widget));
// By default we create QAccessibleWidget
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget);
QVERIFY(iface != 0);
@@ -368,7 +368,7 @@ void tst_QAccessibility::customWidget()
QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory);
QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz");
widget->show();
- QTest::qWaitForWindowExposed(widget);
+ QVERIFY(QTest::qWaitForWindowExposed(widget));
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget);
QVERIFY(iface != 0);
QVERIFY(iface->isValid());
@@ -1749,7 +1749,7 @@ void tst_QAccessibility::textEditTest()
}
edit.show();
- QTest::qWaitForWindowExposed(&edit);
+ QVERIFY(QTest::qWaitForWindowExposed(&edit));
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit);
QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText());
QVERIFY(iface->state().focusable);
@@ -2161,7 +2161,7 @@ void tst_QAccessibility::lineEditTest()
QLineEdit le(QStringLiteral("My characters have geometries."), toplevel);
// characterRect()
le.show();
- QTest::qWaitForWindowExposed(&le);
+ QVERIFY(QTest::qWaitForWindowExposed(&le));
QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(&le));
QAccessibleTextInterface* textIface = iface->textInterface();
QVERIFY(textIface);
@@ -3071,7 +3071,7 @@ void tst_QAccessibility::tableTest()
tableView->resize(600,600);
tableView->show();
- QTest::qWaitForWindowExposed(tableView);
+ QVERIFY(QTest::qWaitForWindowExposed(tableView));
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
QCOMPARE(verifyHierarchy(iface), 0);
@@ -3445,7 +3445,7 @@ void tst_QAccessibility::dockWidgetTest()
mw->resize(600,400);
mw->show();
- QTest::qWaitForWindowExposed(mw);
+ QVERIFY(QTest::qWaitForWindowExposed(mw));
QAccessibleInterface *accMainWindow = QAccessible::queryAccessibleInterface(mw);
// 4 children: menu bar, dock1, dock2, and central widget
@@ -3628,7 +3628,7 @@ void tst_QAccessibility::labelTest()
window->resize(320, 200);
window->show();
- QTest::qWaitForWindowExposed(window);
+ QVERIFY(QTest::qWaitForWindowExposed(window));
#if defined(Q_OS_UNIX)
QCoreApplication::processEvents();
#endif
diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
index d40f9130ba..2575f22309 100644
--- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
+++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp
@@ -63,7 +63,7 @@ public:
{
layout()->addWidget(widget);
widget->show();
- QTest::qWaitForWindowExposed(widget);
+ QVERIFY(QTest::qWaitForWindowExposed(widget));
}
void clearChildren()
@@ -182,7 +182,7 @@ void tst_QAccessibilityLinux::initTestCase()
m_window = new AccessibleTestWindow();
m_window->show();
- QTest::qWaitForWindowExposed(m_window);
+ QVERIFY(QTest::qWaitForWindowExposed(m_window));
registerDbus();
}
diff --git a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro
index ceed81c914..e55757775e 100644
--- a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro
+++ b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro
@@ -1,6 +1,5 @@
CONFIG += testcase
TARGET = tst_qaccessibilitymac
-# LIBS += -framework Carbon
QT += widgets testlib
HEADERS += tst_qaccessibilitymac_helpers.h
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
index 13c933aa14..ba0562f049 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
@@ -49,7 +49,7 @@ public:
{
layout()->addWidget(widget);
widget->show();
- QTest::qWaitForWindowExposed(widget);
+ QVERIFY(QTest::qWaitForWindowExposed(widget));
}
void clearChildren()
@@ -84,7 +84,7 @@ void tst_QAccessibilityMac::init()
m_window->show();
m_window->resize(400, 400);
- QTest::qWaitForWindowExposed(m_window);
+ QVERIFY(QTest::qWaitForWindowExposed(m_window));
}
void tst_QAccessibilityMac::cleanup()
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 2e2945ee5d..35441010f7 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -287,7 +287,7 @@ void tst_QFocusEvent::checkReason_Shortcut()
void tst_QFocusEvent::checkReason_focusWidget()
{
// This test checks that a widget doesn't loose
- // its focuswidget just because the focuswidget looses focus.
+ // its focuswidget just because the focuswidget loses focus.
QWidget window1;
QWidget frame1;
QWidget frame2;
diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/BLACKLIST b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/BLACKLIST
new file mode 100644
index 0000000000..aea819fc2e
--- /dev/null
+++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/BLACKLIST
@@ -0,0 +1,2 @@
+[downloadCheck:with-zeroCopy]
+windows
diff --git a/tests/auto/shared/platformclipboard.h b/tests/auto/shared/platformclipboard.h
index c5f1a64dce..15801f6add 100644
--- a/tests/auto/shared/platformclipboard.h
+++ b/tests/auto/shared/platformclipboard.h
@@ -31,22 +31,12 @@
#include <qglobal.h>
-#ifdef Q_OS_OSX
-#include <Carbon/Carbon.h>
-#endif
-
struct PlatformClipboard
{
static inline bool isAvailable()
{
#if defined(QT_NO_CLIPBOARD)
return false;
-#elif defined(Q_OS_OSX)
- PasteboardRef pasteboard;
- OSStatus status = PasteboardCreate(0, &pasteboard);
- if (status == noErr)
- CFRelease(pasteboard);
- return status == noErr;
#else
return true;
#endif
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
index 05c3d4c90d..4395a04976 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
@@ -188,6 +188,9 @@ private slots:
void sqlite_enable_cache_mode_data() { generic_data("QSQLITE"); }
void sqlite_enable_cache_mode();
+ void sqlite_enableRegexp_data() { generic_data("QSQLITE"); }
+ void sqlite_enableRegexp();
+
private:
void createTestTables(QSqlDatabase db);
void dropTestTables(QSqlDatabase db);
@@ -345,7 +348,8 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
<< qTableName("qtest_sqlguid", __FILE__, db)
<< qTableName("uint_table", __FILE__, db)
<< qTableName("uint_test", __FILE__, db)
- << qTableName("bug_249059", __FILE__, db);
+ << qTableName("bug_249059", __FILE__, db)
+ << qTableName("regexp_test", __FILE__, db);
QSqlQuery q(0, db);
if (dbType == QSqlDriver::PostgreSQL) {
@@ -2259,5 +2263,33 @@ void tst_QSqlDatabase::sqlite_enable_cache_mode()
db2.close();
}
+void tst_QSqlDatabase::sqlite_enableRegexp()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ if (db.driverName().startsWith("QSQLITE2"))
+ QSKIP("SQLite3 specific test");
+
+ db.close();
+ db.setConnectOptions("QSQLITE_ENABLE_REGEXP");
+ QVERIFY_SQL(db, open());
+
+ QSqlQuery q(db);
+ const QString tableName(qTableName("regexp_test", __FILE__, db));
+ QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(text TEXT)").arg(tableName)));
+ QVERIFY_SQL(q, prepare(QString("INSERT INTO %1 VALUES(?)").arg(tableName)));
+ q.addBindValue("a0");
+ QVERIFY_SQL(q, exec());
+ q.addBindValue("a1");
+ QVERIFY_SQL(q, exec());
+
+ QVERIFY_SQL(q, exec(QString("SELECT text FROM %1 WHERE text REGEXP 'a[^0]' "
+ "ORDER BY text").arg(tableName)));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toString(), QString("a1"));
+ QFAIL_SQL(q, next());
+}
+
QTEST_MAIN(tst_QSqlDatabase)
#include "tst_qsqldatabase.moc"
diff --git a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp
index 07a6c9c835..08c6039e37 100644
--- a/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp
+++ b/tests/auto/sql/kernel/qsqlerror/tst_qsqlerror.cpp
@@ -44,6 +44,7 @@ public:
private slots:
void getSetCheck();
void construction();
+ void moveOperator();
void operators();
};
@@ -143,6 +144,26 @@ void tst_QSqlError::construction()
QCOMPARE(obj7.number(), -1);
QCOMPARE(obj7.nativeErrorCode(), QString());
+ // Move constructor
+ QSqlError obj8(std::move(obj3));
+ QCOMPARE(obj8.driverText(), obj2.driverText());
+ QCOMPARE(obj8.databaseText(), obj2.databaseText());
+ QCOMPARE(obj8.type(), obj2.type());
+ QCOMPARE(obj8.number(), obj2.number());
+ QCOMPARE(obj8.nativeErrorCode(), obj2.nativeErrorCode());
+ QVERIFY(obj8.isValid());
+}
+
+void tst_QSqlError::moveOperator()
+{
+ QSqlError obj1("drivertext", "databasetext", QSqlError::UnknownError, 123), obj2;
+ obj2 = std::move(obj1);
+ QCOMPARE(obj2.driverText(), QString("drivertext"));
+ QCOMPARE(obj2.databaseText(), QString("databasetext"));
+ QCOMPARE(obj2.type(), QSqlError::UnknownError);
+ QCOMPARE(obj2.number(), 123);
+ QCOMPARE(obj2.nativeErrorCode(), QStringLiteral("123"));
+ QVERIFY(obj2.isValid());
}
void tst_QSqlError::operators()
diff --git a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp
index cee33be3df..7efd19a2b8 100644
--- a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp
+++ b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp
@@ -62,6 +62,8 @@ private slots:
void isNull();
void clear_data();
void clear();
+ void setTableName_data();
+ void setTableName();
};
// Testing get/set functions
@@ -212,6 +214,9 @@ void tst_QSqlField::operator_Assign()
field3.clear();
field1 = field3;
QVERIFY( field1 == field3 );
+ QSqlField field4("test", QVariant::String, "ATable");
+ field1 = field4;
+ QVERIFY(field1 == field4);
}
void tst_QSqlField::operator_Equal()
@@ -219,8 +224,18 @@ void tst_QSqlField::operator_Equal()
QSqlField field1( "test", QVariant::String );
QSqlField field2( "test2", QVariant::String );
QSqlField field3( "test", QVariant::Int );
+ QSqlField field4("test", QVariant::String, QString("ATable"));
+ QSqlField field5("test2", QVariant::String, QString("ATable"));
+ QSqlField field6("test", QVariant::String, QString("BTable"));
+
QVERIFY( !(field1 == field2) );
QVERIFY( !(field1 == field3) );
+ QVERIFY(field1 != field4);
+ QVERIFY(field1 != field5);
+ QVERIFY(field1 != field6);
+ QVERIFY(field4 != field5);
+ QVERIFY(field4 != field6);
+
field2.setName( "test" );
QVERIFY( field1 == field2 );
QVERIFY( field1 == field2 );
@@ -232,6 +247,10 @@ void tst_QSqlField::operator_Equal()
QVERIFY( !(field1 == field2) );
field2.setReadOnly( true );
QVERIFY( field1 == field2 );
+ field4.setTableName("BTable");
+ QCOMPARE(field4, field6);
+ field6.setName("test3");
+ QVERIFY(field4 != field6);
}
void tst_QSqlField::setName_data()
@@ -333,5 +352,22 @@ void tst_QSqlField::type()
QVERIFY( field3.type() == QVariant::Double );
}
+void tst_QSqlField::setTableName_data()
+{
+ QTest::addColumn<QString>("tableName");
+
+ QTest::newRow("data0") << QString("");
+ QTest::newRow("data1") << QString("tbl");
+}
+
+void tst_QSqlField::setTableName()
+{
+ QSqlField field("test", QVariant::String, "test");
+ QFETCH(QString, tableName);
+ QCOMPARE(field.tableName(), QLatin1String("test"));
+ field.setTableName(tableName);
+ QCOMPARE(field.tableName(), tableName);
+}
+
QTEST_MAIN(tst_QSqlField)
#include "tst_qsqlfield.moc"
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index dc304513e2..3ea13896d8 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -170,6 +170,8 @@ private slots:
void blobsPreparedQuery();
void emptyTableNavigate_data() { generic_data(); }
void emptyTableNavigate();
+ void timeStampParsing_data() { generic_data(); }
+ void timeStampParsing();
#ifdef NOT_READY_YET
void task_229811();
@@ -2887,6 +2889,25 @@ void tst_QSqlQuery::emptyTableNavigate()
}
}
+void tst_QSqlQuery::timeStampParsing()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec(
+ "CREATE TABLE \"main\".\"datetest\" ("
+ "\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT,"
+ "\"datefield\" timestamp);"
+ ));
+ QVERIFY_SQL(q, exec(
+ "INSERT INTO datetest (datefield) VALUES (current_timestamp);"
+ ));
+ QVERIFY_SQL(q, exec("SELECT * FROM datetest;"));
+ while (q.next())
+ QVERIFY(q.value(1).toDateTime().isValid());
+}
+
void tst_QSqlQuery::task_217003()
{
QFETCH( QString, dbName );
diff --git a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
index c5cca6c33b..83a61b91d7 100644
--- a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
+++ b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
@@ -111,10 +111,10 @@ void tst_QSqlRecord::createTestRecord()
{
delete rec;
rec = new QSqlRecord();
- fields[ 0 ] = new QSqlField( "string", QVariant::String );
- fields[ 1 ] = new QSqlField( "int", QVariant::Int );
- fields[ 2 ] = new QSqlField( "double", QVariant::Double );
- fields[ 3 ] = new QSqlField( "bool", QVariant::Bool );
+ fields[0] = new QSqlField(QStringLiteral("string"), QVariant::String, QStringLiteral("stringtable"));
+ fields[1] = new QSqlField(QStringLiteral("int"), QVariant::Int, QStringLiteral("inttable"));
+ fields[2] = new QSqlField(QStringLiteral("double"), QVariant::Double, QStringLiteral("doubletable"));
+ fields[3] = new QSqlField(QStringLiteral("bool"), QVariant::Bool);
for ( int i = 0; i < NUM_FIELDS; ++i )
rec->append( *(fields[ i ] ) );
}
@@ -124,12 +124,14 @@ void tst_QSqlRecord::append()
{
delete rec;
rec = new QSqlRecord();
- rec->append( QSqlField( "string", QVariant::String ) );
+ rec->append(QSqlField("string", QVariant::String, QStringLiteral("stringtable")));
QCOMPARE( rec->field( 0 ).name(), (QString) "string" );
+ QCOMPARE(rec->field(0).tableName(), QStringLiteral("stringtable"));
QVERIFY( !rec->isEmpty() );
QCOMPARE( (int)rec->count(), 1 );
- rec->append( QSqlField( "int", QVariant::Int ) );
+ rec->append(QSqlField("int", QVariant::Int, QStringLiteral("inttable")));
QCOMPARE( rec->field( 1 ).name(), (QString) "int" );
+ QCOMPARE(rec->field(1).tableName(), QStringLiteral("inttable"));
QCOMPARE( (int)rec->count(), 2 );
rec->append( QSqlField( "double", QVariant::Double ) );
QCOMPARE( rec->field( 2 ).name(), (QString) "double" );
@@ -381,7 +383,7 @@ void tst_QSqlRecord::operator_Assign()
buf3.remove( NUM_FIELDS - 1 );
QSqlRecord buf5 = buf3;
for ( i = 0; i < NUM_FIELDS - 1; ++i ) {
- QSqlField fi ( fields[ i ]->name(), fields[ i ]->type() );
+ QSqlField fi(fields[i]->name(), fields[i]->type(), fields[i]->tableName());
fi.clear();
QVERIFY( buf5.field( i ) == fi );
QVERIFY( buf5.isGenerated( i ) );
@@ -394,6 +396,8 @@ void tst_QSqlRecord::position()
int i;
for ( i = 0; i < NUM_FIELDS; ++i ) {
QCOMPARE( rec->indexOf( fields[ i ]->name() ), i );
+ if (!fields[i]->tableName().isEmpty())
+ QCOMPARE(rec->indexOf(fields[i]->tableName() + QChar('.') + fields[i]->name()), i);
}
}
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
index 97eb19599b..a662fea615 100644
--- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
+++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp
@@ -33,6 +33,9 @@
#include <QtGui/QColor>
#include <QtGui/QImage>
#include <QtGui/QPixmap>
+#include <QtGui/QVector2D>
+#include <QtGui/QVector3D>
+#include <QtGui/QVector4D>
#endif
/* XPM test data for QPixmap, QImage tests (use drag cursors as example) */
@@ -137,6 +140,7 @@ private slots:
void compareQListInt();
void compareQListDouble();
#ifdef QT_GUI_LIB
+ void compareQColor_data();
void compareQColor();
void compareQPixmaps();
void compareQPixmaps_data();
@@ -144,6 +148,9 @@ private slots:
void compareQImages_data();
void compareQRegion_data();
void compareQRegion();
+ void compareQVector2D();
+ void compareQVector3D();
+ void compareQVector4D();
#endif
void verify();
void verify2();
@@ -371,13 +378,22 @@ void tst_Cmptest::compareQListDouble()
}
#ifdef QT_GUI_LIB
+void tst_Cmptest::compareQColor_data()
+{
+ QTest::addColumn<QColor>("colorA");
+ QTest::addColumn<QColor>("colorB");
+
+ QTest::newRow("Qt::yellow vs \"yellow\"") << QColor(Qt::yellow) << QColor(QStringLiteral("yellow"));
+ QTest::newRow("Qt::yellow vs Qt::green") << QColor(Qt::yellow) << QColor(Qt::green);
+ QTest::newRow("0x88ff0000 vs 0xffff0000") << QColor::fromRgba(0x88ff0000) << QColor::fromRgba(0xffff0000);
+}
+
void tst_Cmptest::compareQColor()
{
- const QColor yellow(Qt::yellow);
- const QColor yellowFromName(QStringLiteral("yellow"));
- const QColor green(Qt::green);
- QCOMPARE(yellow, yellowFromName);
- QCOMPARE(yellow, green);
+ QFETCH(QColor, colorA);
+ QFETCH(QColor, colorB);
+
+ QCOMPARE(colorA, colorB);
}
void tst_Cmptest::compareQPixmaps_data()
@@ -454,6 +470,33 @@ void tst_Cmptest::compareQRegion()
QCOMPARE(rA, rB);
}
+
+void tst_Cmptest::compareQVector2D()
+{
+ QVector2D v2a{1, 2};
+ QVector2D v2b = v2a;
+ QCOMPARE(v2a, v2b);
+ v2b.setY(3);
+ QCOMPARE(v2a, v2b);
+}
+
+void tst_Cmptest::compareQVector3D()
+{
+ QVector3D v3a{1, 2, 3};
+ QVector3D v3b = v3a;
+ QCOMPARE(v3a, v3b);
+ v3b.setY(3);
+ QCOMPARE(v3a, v3b);
+}
+
+void tst_Cmptest::compareQVector4D()
+{
+ QVector4D v4a{1, 2, 3, 4};
+ QVector4D v4b = v4a;
+ QCOMPARE(v4a, v4b);
+ v4b.setY(3);
+ QCOMPARE(v4a, v4b);
+}
#endif // QT_GUI_LIB
static int opaqueFunc()
diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml
index 621aceb887..d47967a445 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.lightxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml
@@ -8,13 +8,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="160">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="167">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday]]></Description>
@@ -22,7 +22,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="173">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -42,7 +42,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -51,19 +51,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -78,31 +78,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -111,7 +111,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="363">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -119,7 +119,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="370">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
@@ -127,10 +127,20 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQColor">
-<Incident type="fail" file="tst_cmptest.cpp" line="380">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[Qt::yellow vs "yellow"]]></DataTag>
+</Incident>
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <DataTag><![CDATA[Qt::yellow vs Qt::green]]></DataTag>
+ <Description><![CDATA[Compared values are not the same
+ Actual (colorA): #ffffff00
+ Expected (colorB): #ff00ff00]]></Description>
+</Incident>
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <DataTag><![CDATA[0x88ff0000 vs 0xffff0000]]></DataTag>
<Description><![CDATA[Compared values are not the same
- Actual (yellow): #ffff00
- Expected (green) : #00ff00]]></Description>
+ Actual (colorA): #88ff0000
+ Expected (colorB): #ffff0000]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
@@ -138,13 +148,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -153,13 +163,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -169,13 +179,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -184,19 +194,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -206,7 +216,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal-empty]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="455">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[1-empty]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -215,7 +225,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="455">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different lists]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -223,26 +233,50 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQVector2D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector3D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector4D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="467">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="473">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="479">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="485">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.teamcity b/tests/auto/testlib/selftests/expected_cmptest.teamcity
index f9cb5447d0..a0dc509279 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.teamcity
+++ b/tests/auto/testlib/selftests/expected_cmptest.teamcity
@@ -2,13 +2,13 @@
##teamcity[testStarted name='initTestCase()' flowId='tst_Cmptest']
##teamcity[testFinished name='initTestCase()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_unregistered_enums()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(160)|]' details='Compared values are not the same' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_unregistered_enums()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_unregistered_enums()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_registered_enums()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: tst_cmptest.cpp(167)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_registered_enums()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (Qt::Monday): Monday|n Expected (Qt::Sunday): Sunday' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_registered_enums()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_class_enums()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: tst_cmptest.cpp(173)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_class_enums()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1|n Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_class_enums()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_boolfuncs()' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_boolfuncs()' flowId='tst_Cmptest']
@@ -17,103 +17,117 @@
##teamcity[testStarted name='compare_pointerfuncs()' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_pointerfuncs()' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_tostring(int, string)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_tostring(int, string)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actual) : QVariant(int,123)|n Expected (expected): QVariant(QString,hi)' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_tostring(int, string)' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_tostring(both invalid)' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_tostring(both invalid)' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_tostring(null hash, invalid)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_tostring(null hash, invalid)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QVariantHash)|n Expected (expected): QVariant()' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_tostring(null hash, invalid)' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_tostring(string, null user type)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_tostring(string, null user type)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actual) : QVariant(QString,A simple string)|n Expected (expected): QVariant(PhonyClass)' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_tostring(string, null user type)' flowId='tst_Cmptest']
##teamcity[testStarted name='compare_tostring(both non-null user type)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: tst_cmptest.cpp(262)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compare_tostring(both non-null user type)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (actual) : QVariant(PhonyClass,<value not representable as string>)|n Expected (expected): QVariant(PhonyClass,<value not representable as string>)' flowId='tst_Cmptest']
##teamcity[testFinished name='compare_tostring(both non-null user type)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(empty lists)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(empty lists)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(equal lists)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(equal lists)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(last item different)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQStringLists(last item different)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(last item different)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(second-last item different)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQStringLists(second-last item different)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (opA): "string3"|n Expected (opB): "DIFFERS"' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(second-last item different)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(prefix)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQStringLists(prefix)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (opA) size: 2|n Expected (opB) size: 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(prefix)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(short list second)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQStringLists(short list second)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (opA) size: 12|n Expected (opB) size: 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(short list second)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQStringLists(short list first)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: tst_cmptest.cpp(356)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQStringLists(short list first)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists have different sizes.|n Actual (opA) size: 1|n Expected (opB) size: 12' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQStringLists(short list first)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQListInt()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: tst_cmptest.cpp(363)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQListInt()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 2.|n Actual (int1): 3|n Expected (int2): 4' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQListInt()' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQListDouble()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: tst_cmptest.cpp(370)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQListDouble()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared lists differ at index 0.|n Actual (double1): 1.5|n Expected (double2): 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQListDouble()' flowId='tst_Cmptest']
-##teamcity[testStarted name='compareQColor()' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQColor()' message='Failure! |[Loc: tst_cmptest.cpp(380)|]' details='Compared values are not the same|n Actual (yellow): #ffff00|n Expected (green) : #00ff00' flowId='tst_Cmptest']
-##teamcity[testFinished name='compareQColor()' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQColor(Qt::yellow vs "yellow")' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQColor(Qt::yellow vs "yellow")' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQColor(Qt::yellow vs Qt::green)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQColor(Qt::yellow vs Qt::green)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (colorA): #ffffff00|n Expected (colorB): #ff00ff00' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQColor(Qt::yellow vs Qt::green)' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQColor(0x88ff0000 vs 0xffff0000)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQColor(0x88ff0000 vs 0xffff0000)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (colorA): #88ff0000|n Expected (colorB): #ffff0000' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQColor(0x88ff0000 vs 0xffff0000)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(both null)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(both null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(one null)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQPixmaps(one null)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(one null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(other null)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQPixmaps(other null)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QPixmaps differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(other null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(equal)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(equal)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(different size)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQPixmaps(different size)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QPixmaps differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(different size)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQPixmaps(different pixels)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(405)|]' details='Compared values are not the same' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQPixmaps(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQPixmaps(different pixels)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(both null)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(both null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(one null)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQImages(one null)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 1|n Expected (opB).isNull(): 0' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(one null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(other null)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQImages(other null)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QImages differ.|n Actual (opA).isNull(): 0|n Expected (opB).isNull(): 1' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(other null)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(equal)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(equal)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(different size)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQImages(different size)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QImages differ in size.|n Actual (opA): 11x20|n Expected (opB): 20x20' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(different size)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(different format)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQImages(different format)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared QImages differ in format.|n Actual (opA): 6|n Expected (opB): 3' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(different format)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQImages(different pixels)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: tst_cmptest.cpp(432)|]' details='Compared values are not the same' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQImages(different pixels)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQImages(different pixels)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(equal-empty)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQRegion(equal-empty)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(1-empty)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQRegion(1-empty)' message='Failure! |[Loc: tst_cmptest.cpp(455)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(null)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQRegion(1-empty)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(null)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQRegion(1-empty)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(equal)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQRegion(equal)' flowId='tst_Cmptest']
##teamcity[testStarted name='compareQRegion(different lists)' flowId='tst_Cmptest']
-##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: tst_cmptest.cpp(455)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQRegion(different lists)' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (rA): QRegion(200x50+10+10)|n Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)' flowId='tst_Cmptest']
##teamcity[testFinished name='compareQRegion(different lists)' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQVector2D()' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQVector2D()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v2a): QVector2D(1, 2)|n Expected (v2b): QVector2D(1, 3)' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQVector2D()' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQVector3D()' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQVector3D()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v3a): QVector3D(1, 2, 3)|n Expected (v3b): QVector3D(1, 3, 3)' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQVector3D()' flowId='tst_Cmptest']
+##teamcity[testStarted name='compareQVector4D()' flowId='tst_Cmptest']
+##teamcity[testFailed name='compareQVector4D()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='Compared values are not the same|n Actual (v4a): QVector4D(1, 2, 3, 4)|n Expected (v4b): QVector4D(1, 3, 3, 4)' flowId='tst_Cmptest']
+##teamcity[testFinished name='compareQVector4D()' flowId='tst_Cmptest']
##teamcity[testStarted name='verify()' flowId='tst_Cmptest']
-##teamcity[testFailed name='verify()' message='Failure! |[Loc: tst_cmptest.cpp(467)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest']
+##teamcity[testFailed name='verify()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest']
##teamcity[testFinished name='verify()' flowId='tst_Cmptest']
##teamcity[testStarted name='verify2()' flowId='tst_Cmptest']
-##teamcity[testFailed name='verify2()' message='Failure! |[Loc: tst_cmptest.cpp(473)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)' flowId='tst_Cmptest']
+##teamcity[testFailed name='verify2()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)' flowId='tst_Cmptest']
##teamcity[testFinished name='verify2()' flowId='tst_Cmptest']
##teamcity[testStarted name='tryVerify()' flowId='tst_Cmptest']
-##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: tst_cmptest.cpp(479)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest']
+##teamcity[testFailed name='tryVerify()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. ()' flowId='tst_Cmptest']
##teamcity[testFinished name='tryVerify()' flowId='tst_Cmptest']
##teamcity[testStarted name='tryVerify2()' flowId='tst_Cmptest']
-##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: tst_cmptest.cpp(485)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)' flowId='tst_Cmptest']
+##teamcity[testFailed name='tryVerify2()' message='Failure! |[Loc: qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)|]' details='|'opaqueFunc() < 2|' returned FALSE. (42)' flowId='tst_Cmptest']
##teamcity[testFinished name='tryVerify2()' flowId='tst_Cmptest']
##teamcity[testStarted name='verifyExplicitOperatorBool()' flowId='tst_Cmptest']
##teamcity[testFinished name='verifyExplicitOperatorBool()' flowId='tst_Cmptest']
diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt
index 9c7f56e6c3..78df990dea 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.txt
+++ b/tests/auto/testlib/selftests/expected_cmptest.txt
@@ -2,124 +2,141 @@
Config: Using QtTest library
PASS : tst_Cmptest::initTestCase()
FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same
- Loc: [tst_cmptest.cpp(160)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday
- Loc: [tst_cmptest.cpp(167)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2
- Loc: [tst_cmptest.cpp(173)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compare_boolfuncs()
PASS : tst_Cmptest::compare_to_nullptr()
PASS : tst_Cmptest::compare_pointerfuncs()
FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same
Actual (actual) : QVariant(int,123)
Expected (expected): QVariant(QString,hi)
- Loc: [tst_cmptest.cpp(262)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compare_tostring(both invalid)
FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()
- Loc: [tst_cmptest.cpp(262)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)
- Loc: [tst_cmptest.cpp(262)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
Expected (expected): QVariant(PhonyClass,<value not representable as string>)
- Loc: [tst_cmptest.cpp(262)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQStringLists(empty lists)
PASS : tst_Cmptest::compareQStringLists(equal lists)
FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(356)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"
- Loc: [tst_cmptest.cpp(356)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(356)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1
- Loc: [tst_cmptest.cpp(356)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes.
Actual (opA) size: 1
Expected (opB) size: 12
- Loc: [tst_cmptest.cpp(356)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4
- Loc: [tst_cmptest.cpp(363)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1
- Loc: [tst_cmptest.cpp(370)]
-FAIL! : tst_Cmptest::compareQColor() Compared values are not the same
- Actual (yellow): #ffff00
- Expected (green) : #00ff00
- Loc: [tst_cmptest.cpp(380)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
+PASS : tst_Cmptest::compareQColor(Qt::yellow vs "yellow")
+FAIL! : tst_Cmptest::compareQColor(Qt::yellow vs Qt::green) Compared values are not the same
+ Actual (colorA): #ffffff00
+ Expected (colorB): #ff00ff00
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
+FAIL! : tst_Cmptest::compareQColor(0x88ff0000 vs 0xffff0000) Compared values are not the same
+ Actual (colorA): #88ff0000
+ Expected (colorB): #ffff0000
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQPixmaps(both null)
FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(405)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(405)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQPixmaps(equal)
FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(405)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(405)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQImages(both null)
FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0
- Loc: [tst_cmptest.cpp(432)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ.
Actual (opA).isNull(): 0
Expected (opB).isNull(): 1
- Loc: [tst_cmptest.cpp(432)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQImages(equal)
FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20
- Loc: [tst_cmptest.cpp(432)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3
- Loc: [tst_cmptest.cpp(432)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same
- Loc: [tst_cmptest.cpp(432)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQRegion(equal-empty)
FAIL! : tst_Cmptest::compareQRegion(1-empty) Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(null)
- Loc: [tst_cmptest.cpp(455)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::compareQRegion(equal)
FAIL! : tst_Cmptest::compareQRegion(different lists) Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)
- Loc: [tst_cmptest.cpp(455)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
+FAIL! : tst_Cmptest::compareQVector2D() Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
+FAIL! : tst_Cmptest::compareQVector3D() Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
+FAIL! : tst_Cmptest::compareQVector4D() Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. ()
- Loc: [tst_cmptest.cpp(467)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42)
- Loc: [tst_cmptest.cpp(473)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. ()
- Loc: [tst_cmptest.cpp(479)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42)
- Loc: [tst_cmptest.cpp(485)]
+ Loc: [qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp(0)]
PASS : tst_Cmptest::verifyExplicitOperatorBool()
PASS : tst_Cmptest::cleanupTestCase()
-Totals: 15 passed, 30 failed, 0 skipped, 0 blacklisted, 244ms
+Totals: 16 passed, 34 failed, 0 skipped, 0 blacklisted, 0ms
********* Finished testing of tst_Cmptest *********
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml
index f64ffe3792..01b725f247 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xml
@@ -10,13 +10,13 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_unregistered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="160">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_registered_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="167">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (Qt::Monday): Monday
Expected (Qt::Sunday): Sunday]]></Description>
@@ -24,7 +24,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_class_enums">
-<Incident type="fail" file="tst_cmptest.cpp" line="173">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared values are not the same
Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1
Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description>
@@ -44,7 +44,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compare_tostring">
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[int, string]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(int,123)
@@ -53,19 +53,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both invalid]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[null hash, invalid]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QVariantHash)
Expected (expected): QVariant()]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[string, null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(QString,A simple string)
Expected (expected): QVariant(PhonyClass)]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="262">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[both non-null user type]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (actual) : QVariant(PhonyClass,<value not representable as string>)
@@ -80,31 +80,31 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal lists]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[second-last item different]]></DataTag>
<Description><![CDATA[Compared lists differ at index 2.
Actual (opA): "string3"
Expected (opB): "DIFFERS"]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[prefix]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 2
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[short list second]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 12
Expected (opB) size: 1]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="356">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[short list first]]></DataTag>
<Description><![CDATA[Compared lists have different sizes.
Actual (opA) size: 1
@@ -113,7 +113,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListInt">
-<Incident type="fail" file="tst_cmptest.cpp" line="363">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared lists differ at index 2.
Actual (int1): 3
Expected (int2): 4]]></Description>
@@ -121,7 +121,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQListDouble">
-<Incident type="fail" file="tst_cmptest.cpp" line="370">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA[Compared lists differ at index 0.
Actual (double1): 1.5
Expected (double2): 1]]></Description>
@@ -129,10 +129,20 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="compareQColor">
-<Incident type="fail" file="tst_cmptest.cpp" line="380">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[Qt::yellow vs "yellow"]]></DataTag>
+</Incident>
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <DataTag><![CDATA[Qt::yellow vs Qt::green]]></DataTag>
+ <Description><![CDATA[Compared values are not the same
+ Actual (colorA): #ffffff00
+ Expected (colorB): #ff00ff00]]></Description>
+</Incident>
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <DataTag><![CDATA[0x88ff0000 vs 0xffff0000]]></DataTag>
<Description><![CDATA[Compared values are not the same
- Actual (yellow): #ffff00
- Expected (green) : #00ff00]]></Description>
+ Actual (colorA): #88ff0000
+ Expected (colorB): #ffff0000]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
@@ -140,13 +150,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ.
Actual (opA).isNull(): 0
@@ -155,13 +165,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QPixmaps differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="405">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -171,13 +181,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[both null]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[one null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 1
Expected (opB).isNull(): 0]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[other null]]></DataTag>
<Description><![CDATA[Compared QImages differ.
Actual (opA).isNull(): 0
@@ -186,19 +196,19 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different size]]></DataTag>
<Description><![CDATA[Compared QImages differ in size.
Actual (opA): 11x20
Expected (opB): 20x20]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different format]]></DataTag>
<Description><![CDATA[Compared QImages differ in format.
Actual (opA): 6
Expected (opB): 3]]></Description>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="432">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different pixels]]></DataTag>
<Description><![CDATA[Compared values are not the same]]></Description>
</Incident>
@@ -208,7 +218,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal-empty]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="455">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[1-empty]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -217,7 +227,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[equal]]></DataTag>
</Incident>
-<Incident type="fail" file="tst_cmptest.cpp" line="455">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<DataTag><![CDATA[different lists]]></DataTag>
<Description><![CDATA[Compared values are not the same
Actual (rA): QRegion(200x50+10+10)
@@ -225,26 +235,50 @@
</Incident>
<Duration msecs="0"/>
</TestFunction>
+<TestFunction name="compareQVector2D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector3D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="compareQVector4D">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
+ <Description><![CDATA[Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
<TestFunction name="verify">
-<Incident type="fail" file="tst_cmptest.cpp" line="467">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="verify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="473">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify">
-<Incident type="fail" file="tst_cmptest.cpp" line="479">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description>
</Incident>
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="tryVerify2">
-<Incident type="fail" file="tst_cmptest.cpp" line="485">
+<Incident type="fail" file="qtbase/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp" line="0">
<Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
index de47ac97f5..812696ffcf 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="0" failures="30" tests="21" name="tst_Cmptest">
+<testsuite errors="0" failures="34" tests="24" name="tst_Cmptest">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
@@ -64,9 +64,12 @@
Expected (double2): 1" result="fail"/>
</testcase>
<testcase result="fail" name="compareQColor">
- <failure message="Compared values are not the same
- Actual (yellow): #ffff00
- Expected (green) : #00ff00" result="fail"/>
+ <failure tag="Qt::yellow vs Qt::green" message="Compared values are not the same
+ Actual (colorA): #ffffff00
+ Expected (colorB): #ff00ff00" result="fail"/>
+ <failure tag="0x88ff0000 vs 0xffff0000" message="Compared values are not the same
+ Actual (colorA): #88ff0000
+ Expected (colorB): #ffff0000" result="fail"/>
</testcase>
<testcase result="fail" name="compareQPixmaps">
<failure tag="one null" message="Compared QPixmaps differ.
@@ -103,6 +106,21 @@
Actual (rA): QRegion(200x50+10+10)
Expected (rB): QRegion(2 rectangles, 50x200+100+200, 200x50+10+10)" result="fail"/>
</testcase>
+ <testcase result="fail" name="compareQVector2D">
+ <failure message="Compared values are not the same
+ Actual (v2a): QVector2D(1, 2)
+ Expected (v2b): QVector2D(1, 3)" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="compareQVector3D">
+ <failure message="Compared values are not the same
+ Actual (v3a): QVector3D(1, 2, 3)
+ Expected (v3b): QVector3D(1, 3, 3)" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="compareQVector4D">
+ <failure message="Compared values are not the same
+ Actual (v4a): QVector4D(1, 2, 3, 4)
+ Expected (v4b): QVector4D(1, 3, 3, 4)" result="fail"/>
+ </testcase>
<testcase result="fail" name="verify">
<failure message="&apos;opaqueFunc() &lt; 2&apos; returned FALSE. ()" result="fail"/>
</testcase>
diff --git a/tests/auto/testlib/selftests/expected_pairdiagnostics.lightxml b/tests/auto/testlib/selftests/expected_pairdiagnostics.lightxml
new file mode 100644
index 0000000000..95b932e3c4
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_pairdiagnostics.lightxml
@@ -0,0 +1,30 @@
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="testQPair">
+<Incident type="fail" file="../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp" line="51">
+ <Description><![CDATA[Compared values are not the same
+ Actual (pair1): "QPair(1,1)"
+ Expected (pair2): "QPair(1,2)"]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="testStdPair">
+<Incident type="fail" file="../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp" line="58">
+ <Description><![CDATA[Compared values are not the same
+ Actual (pair1): "std::pair(1,1)"
+ Expected (pair2): "std::pair(1,2)"]]></Description>
+</Incident>
+ <Duration msecs="0"/>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0"/>
+</TestFunction>
+<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_pairdiagnostics.teamcity b/tests/auto/testlib/selftests/expected_pairdiagnostics.teamcity
new file mode 100644
index 0000000000..06883570ac
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_pairdiagnostics.teamcity
@@ -0,0 +1,12 @@
+##teamcity[testSuiteStarted name='tst_PairDiagnostics' flowId='tst_PairDiagnostics']
+##teamcity[testStarted name='initTestCase()' flowId='tst_PairDiagnostics']
+##teamcity[testFinished name='initTestCase()' flowId='tst_PairDiagnostics']
+##teamcity[testStarted name='testQPair()' flowId='tst_PairDiagnostics']
+##teamcity[testFailed name='testQPair()' message='Failure! |[Loc: ../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp(51)|]' details='Compared values are not the same|n Actual (pair1): "QPair(1,1)"|n Expected (pair2): "QPair(1,2)"' flowId='tst_PairDiagnostics']
+##teamcity[testFinished name='testQPair()' flowId='tst_PairDiagnostics']
+##teamcity[testStarted name='testStdPair()' flowId='tst_PairDiagnostics']
+##teamcity[testFailed name='testStdPair()' message='Failure! |[Loc: ../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp(58)|]' details='Compared values are not the same|n Actual (pair1): "std::pair(1,1)"|n Expected (pair2): "std::pair(1,2)"' flowId='tst_PairDiagnostics']
+##teamcity[testFinished name='testStdPair()' flowId='tst_PairDiagnostics']
+##teamcity[testStarted name='cleanupTestCase()' flowId='tst_PairDiagnostics']
+##teamcity[testFinished name='cleanupTestCase()' flowId='tst_PairDiagnostics']
+##teamcity[testSuiteFinished name='tst_PairDiagnostics' flowId='tst_PairDiagnostics']
diff --git a/tests/auto/testlib/selftests/expected_pairdiagnostics.txt b/tests/auto/testlib/selftests/expected_pairdiagnostics.txt
new file mode 100644
index 0000000000..e09b9a560f
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_pairdiagnostics.txt
@@ -0,0 +1,14 @@
+********* Start testing of tst_PairDiagnostics *********
+Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
+PASS : tst_PairDiagnostics::initTestCase()
+FAIL! : tst_PairDiagnostics::testQPair() Compared values are not the same
+ Actual (pair1): "QPair(1,1)"
+ Expected (pair2): "QPair(1,2)"
+ Loc: [../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp(51)]
+FAIL! : tst_PairDiagnostics::testStdPair() Compared values are not the same
+ Actual (pair1): "std::pair(1,1)"
+ Expected (pair2): "std::pair(1,2)"
+ Loc: [../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp(58)]
+PASS : tst_PairDiagnostics::cleanupTestCase()
+Totals: 2 passed, 2 failed, 0 skipped, 0 blacklisted, 1ms
+********* Finished testing of tst_PairDiagnostics *********
diff --git a/tests/auto/testlib/selftests/expected_pairdiagnostics.xml b/tests/auto/testlib/selftests/expected_pairdiagnostics.xml
new file mode 100644
index 0000000000..47921e0b8a
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_pairdiagnostics.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestCase name="tst_PairDiagnostics">
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0.680795"/>
+</TestFunction>
+<TestFunction name="testQPair">
+<Incident type="fail" file="../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp" line="51">
+ <Description><![CDATA[Compared values are not the same
+ Actual (pair1): "QPair(1,1)"
+ Expected (pair2): "QPair(1,2)"]]></Description>
+</Incident>
+ <Duration msecs="0.085705"/>
+</TestFunction>
+<TestFunction name="testStdPair">
+<Incident type="fail" file="../../../qt5/qtbase_fixItemData/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp" line="58">
+ <Description><![CDATA[Compared values are not the same
+ Actual (pair1): "std::pair(1,1)"
+ Expected (pair2): "std::pair(1,2)"]]></Description>
+</Incident>
+ <Duration msecs="0.030780"/>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+ <Duration msecs="0.039052"/>
+</TestFunction>
+<Duration msecs="0.995227"/>
+</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_pairdiagnostics.xunitxml b/tests/auto/testlib/selftests/expected_pairdiagnostics.xunitxml
new file mode 100644
index 0000000000..cf2a30b84a
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_pairdiagnostics.xunitxml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="0" failures="2" tests="4" name="tst_PairDiagnostics">
+ <properties>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ <property value="" name="QtBuild"/>
+ </properties>
+ <testcase result="pass" name="initTestCase"/>
+ <testcase result="fail" name="testQPair">
+ <failure message="Compared values are not the same
+ Actual (pair1): &quot;QPair(1,1)&quot;
+ Expected (pair2): &quot;QPair(1,2)&quot;" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testStdPair">
+ <failure message="Compared values are not the same
+ Actual (pair1): &quot;std::pair(1,1)&quot;
+ Expected (pair2): &quot;std::pair(1,2)&quot;" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="cleanupTestCase"/>
+ <system-err/>
+</testsuite>
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index 202c4cc426..a3a66da98b 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -32,9 +32,18 @@
# Usage: cd to the build directory corresponding to this script's
# location; invoke this script; optionally pass the names of sub-dirs
# to limit which tests to regenerate expected_* files for.
+#
+# The saved test output is used by ./tst_selftests.cpp, which compares
+# it to the output of each test, ignoring various boring changes.
+# This script canonicalises the parts that would exhibit those boring
+# changes, so as to avoid noise in git (and conflicts in merges) for
+# the saved copies of the output. If you add or remove any files, be
+# sure to update selftests.qrc to match; the selftest only sees files
+# listed there.
import os
import subprocess
+import re
class Fail (Exception): pass
@@ -55,17 +64,18 @@ class Cleaner (object):
def __init__(self, here, command):
"""Set up the details we need for later cleaning.
- Takes two parameters: here is $PWD and command is how this
- script was invoked, from which we'll work out where it is; in
- a shadow build, the former is the build tree's location
- corresponding to this last. Checks $PWD does look as expected
- in a build tree - raising Fail() if not - then invokes qmake
- to discover Qt version (saved as .version for the benefit of
- clients) and prepares the sequence of (regex, replace) pairs
- that .clean() needs to do its job."""
- self.version, self.__replace = self.__getPatterns(here, command)
-
- import re
+ Takes two parameters: here is os.getcwd() and command is how
+ this script was invoked, from which we'll work out where it
+ is; in a shadow build, the former is the build tree's location
+ corresponding to this last. Saves the directory of this
+ script as self.sourceDir, so client can find tst_selftests.cpp
+ there. Checks here does look as expected in a build tree -
+ raising Fail() if not - then invokes qmake to discover Qt
+ version (saved as .version for the benefit of clients) and
+ prepares the sequence of (regex, replace) pairs that .clean()
+ needs to do its job."""
+ self.version, self.sourceDir, self.__replace = self.__getPatterns(here, command)
+
@staticmethod
def __getPatterns(here, command,
patterns = (
@@ -80,9 +90,10 @@ class Cleaner (object):
(r'( *<QtBuild)>[^<]+</QtBuild>', r'\1/>'), # xml, lightxml
(r'(<property value=")[^"]+(" name="QtBuild"/>)', r'\1\2'), # xunitxml
# Line numbers in source files:
+ (r'(ASSERT: ".*" in file .*, line) \d+', r'\1 0'), # lightxml
(r'(Loc: \[[^[\]()]+)\(\d+\)', r'\1(0)'), # txt
(r'(\[Loc: [^[\]()]+)\(\d+\)', r'\1(0)'), # teamcity
- (r'(<Incident.*\bfile=.*\bline=)"\d+"', r'\1"0"'), # lightxml, xml
+ (r'(<(?:Incident|Message)\b.*\bfile=.*\bline=)"\d+"', r'\1"0"'), # lightxml, xml
),
precook = re.compile):
"""Private implementation details of __init__()."""
@@ -131,8 +142,7 @@ class Cleaner (object):
patterns += tuple((root.replace('-', '&#x0*2D;'), r'')
for root in roots if '-' in root)
- return qtver, tuple((precook(p), r) for p, r in patterns)
- del re
+ return qtver, scriptPath, tuple((precook(p), r) for p, r in patterns)
def clean(self, data):
"""Remove volatile details from test output.
@@ -145,6 +155,62 @@ class Cleaner (object):
line = searchRe.sub(replaceExp, line)
yield line
+class Scanner (object):
+ """Knows which subdirectories to generate output for.
+
+ Tell its constructor the name of this source directory (see
+ Cleaner's .sourceDir) and it'll scan tst_selftests.cpp for the
+ list. Its .subdirs() can then filter a user-supplied list of
+ subdirs or generate the full list, when the user supplied
+ none."""
+ def __init__(self, srcDir):
+ self.__tested = tuple(self.__scan_cpp(os.path.join(srcDir, 'tst_selftests.cpp')))
+
+ @staticmethod
+ def __scan_cpp(name,
+ trimc = re.compile(r'/\*.*?\*/').sub,
+ trimcpp = re.compile(r'//.*$').sub,
+ first = re.compile(r'(QStringList|auto)\s+tests\s*=\s*QStringList\(\)').match,
+ match = re.compile(r'(?:tests\s*)?<<\s*"(\w+)"').match,
+ last = re.compile(r'\bfor.*\b(LoggerSet|auto)\b.*\ballLoggerSets\(\)').search):
+ """Scans tst_selftests.cpp to find which subdirs matter.
+
+ There's a list, tests, to which all subdir names get added, if
+ they're to be tested. Other sub-dirs aren't tested, so
+ there's no sense in generating output for them."""
+ scan = False
+ with open(name) as src:
+ for line in src:
+ line = trimcpp('', trimc('', line.strip())).strip()
+ if not scan:
+ got = first(line)
+ if got:
+ scan, line = True, line[len(got.group()):]
+ if scan:
+ if last(line): break
+ got = match(line)
+ while got:
+ yield got.group(1)
+ line = line[len(got.group()):].strip()
+ got = match(line)
+
+ def subdirs(self, given):
+ if given:
+ for d in given:
+ if not os.path.isdir(d):
+ print('No such directory:', d, '- skipped')
+ elif d in self.__tested:
+ yield d
+ else:
+ print('Directory', d, 'is not tested by tst_selftests.cpp')
+ else:
+ for d in self.__tested:
+ if os.path.isdir(d):
+ yield d
+ else:
+ print('tst_selftests.cpp names', d, "as a test, but it doesn't exist")
+del re
+
def generateTestData(testname, clean,
formats = ('xml', 'txt', 'xunitxml', 'lightxml', 'teamcity'),
extraArgs = {
@@ -190,7 +256,7 @@ def main(name, *args):
herePath = os.getcwd()
cleaner = Cleaner(herePath, name)
- tests = args if args else [d for d in os.listdir('.') if os.path.isdir(d)]
+ tests = tuple(Scanner(cleaner.sourceDir).subdirs(args))
print("Generating", len(tests), "test results for", cleaner.version, "in:", herePath)
for path in tests:
generateTestData(path, cleaner.clean)
diff --git a/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro
new file mode 100644
index 0000000000..1c07c93e9d
--- /dev/null
+++ b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro
@@ -0,0 +1,6 @@
+SOURCES += tst_pairdiagnostics.cpp
+QT = core testlib
+
+CONFIG -= app_bundle debug_and_release_target
+
+TARGET = pairdiagnostics
diff --git a/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp b/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp
new file mode 100644
index 0000000000..bbee5334fe
--- /dev/null
+++ b/tests/auto/testlib/selftests/pairdiagnostics/tst_pairdiagnostics.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// Make sure we get a real Q_ASSERT even in release builds
+#ifdef QT_NO_DEBUG
+# undef QT_NO_DEBUG
+#endif
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QPair>
+#include <QtTest/QtTest>
+
+class tst_PairDiagnostics: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testQPair() const;
+ void testStdPair() const;
+};
+
+void tst_PairDiagnostics::testQPair() const
+{
+ QPair<int, int> pair1 = qMakePair(1, 1);
+ QPair<int, int> pair2 = qMakePair(1, 2);
+ QCOMPARE(pair1, pair2);
+}
+
+void tst_PairDiagnostics::testStdPair() const
+{
+ std::pair<int, int> pair1 = std::make_pair(1, 1);
+ std::pair<int, int> pair2 = std::make_pair(1, 2);
+ QCOMPARE(pair1, pair2);
+}
+
+QTEST_MAIN(tst_PairDiagnostics)
+
+#include "tst_pairdiagnostics.moc"
diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri
index 66c7e06760..0287e35447 100644
--- a/tests/auto/testlib/selftests/selftests.pri
+++ b/tests/auto/testlib/selftests/selftests.pri
@@ -28,6 +28,7 @@ SUBPROGRAMS = \
longstring \
maxwarnings \
multiexec \
+ pairdiagnostics \
printdatatags \
printdatatagswithglobaltags \
qexecstringlist \
diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc
index 3c3fef28d9..02e8adb6b4 100644
--- a/tests/auto/testlib/selftests/selftests.qrc
+++ b/tests/auto/testlib/selftests/selftests.qrc
@@ -115,6 +115,11 @@
<file>expected_maxwarnings.xml</file>
<file>expected_maxwarnings.xunitxml</file>
<file>expected_multiexec.txt</file>
+ <file>expected_pairdiagnostics.lightxml</file>
+ <file>expected_pairdiagnostics.teamcity</file>
+ <file>expected_pairdiagnostics.txt</file>
+ <file>expected_pairdiagnostics.xml</file>
+ <file>expected_pairdiagnostics.xunitxml</file>
<file>expected_printdatatags.txt</file>
<file>expected_printdatatagswithglobaltags.txt</file>
<file>expected_qexecstringlist.txt</file>
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index e7123fc059..64f324e26c 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -395,6 +395,7 @@ void tst_Selftests::runSubTest_data()
<< "longstring"
<< "maxwarnings"
<< "multiexec"
+ << "pairdiagnostics"
<< "printdatatags"
<< "printdatatagswithglobaltags"
<< "qexecstringlist"
diff --git a/tests/auto/tools/moc/error-on-wrong-notify.h b/tests/auto/tools/moc/error-on-wrong-notify.h
index 11f5e954db..9e6b27bff3 100644
--- a/tests/auto/tools/moc/error-on-wrong-notify.h
+++ b/tests/auto/tools/moc/error-on-wrong-notify.h
@@ -28,7 +28,7 @@
#ifndef ERROR_ON_WRONG_NOTIFY_H
#define ERROR_ON_WRONG_NOTIFY_H
-#include <QObject>
+#include <QtCore/QObject>
class ClassWithWrongNOTIFY : public QObject
{
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 8189227cbe..55e8054a70 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1830,13 +1830,25 @@ void tst_Moc::notifyError()
const QString header = m_sourceDirectory + QStringLiteral("/error-on-wrong-notify.h");
proc.start(m_moc, QStringList(header));
QVERIFY(proc.waitForFinished());
- QCOMPARE(proc.exitCode(), 1);
+ QCOMPARE(proc.exitCode(), 0);
QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
QByteArray mocOut = proc.readAllStandardOutput();
- QVERIFY(mocOut.isEmpty());
- QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
- QCOMPARE(mocError, header +
- QString(":42: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
+ QVERIFY(!mocOut.isEmpty());
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+
+ QStringList args;
+ args << "-c" << "-x" << "c++" << "-I" << "."
+ << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-";
+ proc.start("gcc", args);
+ QVERIFY(proc.waitForStarted());
+ proc.write(mocOut);
+ proc.closeWriteChannel();
+
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 1);
+ const QString gccOutput = QString::fromLocal8Bit(proc.readAllStandardError());
+ QVERIFY(gccOutput.contains(QLatin1String("error")));
+ QVERIFY(gccOutput.contains(QLatin1String("fooChanged")));
#else
QSKIP("Only tested on linux/gcc");
#endif
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index 03fd4753fd..387a2fb84e 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -2191,6 +2191,44 @@ void tst_qmakelib::addTestFunctions(const QString &qindir)
<< ""
<< true;
+ QTest::newRow("versionAtLeast(): true")
+ << "VAR = 1.2.3\nversionAtLeast(VAR, 1.2.3): OK = 1"
+ << "OK = 1"
+ << ""
+ << true;
+
+ QTest::newRow("versionAtLeast(): false")
+ << "VAR = 1.2.2\nversionAtLeast(VAR, 1.2.3): OK = 1"
+ << "OK = UNDEF"
+ << ""
+ << true;
+
+ QTest::newRow("versionAtLeast(): bad number of arguments")
+ << "versionAtLeast(1): OK = 1\nversionAtLeast(1, 2, 3): OK = 1"
+ << "OK = UNDEF"
+ << "##:1: versionAtLeast(variable, versionNumber) requires two arguments.\n"
+ "##:2: versionAtLeast(variable, versionNumber) requires two arguments."
+ << true;
+
+ QTest::newRow("versionAtMost(): true")
+ << "VAR = 1.2.3\nversionAtMost(VAR, 1.2.3): OK = 1"
+ << "OK = 1"
+ << ""
+ << true;
+
+ QTest::newRow("versionAtMost(): false")
+ << "VAR = 1.2.3\nversionAtMost(VAR, 1.2.2): OK = 1"
+ << "OK = UNDEF"
+ << ""
+ << true;
+
+ QTest::newRow("versionAtMost(): bad number of arguments")
+ << "versionAtMost(1): OK = 1\nversionAtMost(1, 2, 3): OK = 1"
+ << "OK = UNDEF"
+ << "##:1: versionAtMost(variable, versionNumber) requires two arguments.\n"
+ "##:2: versionAtMost(variable, versionNumber) requires two arguments."
+ << true;
+
QTest::newRow("clear(): top-level")
<< "VAR = there\nclear(VAR): OK = 1"
<< "OK = 1\nVAR ="
diff --git a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
index f63995af24..81908b1eae 100644
--- a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
+++ b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Bottom.ui.h
@@ -44,7 +44,7 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h
index 5cee346d35..55dfd6ba49 100644
--- a/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h
+++ b/tests/auto/tools/uic/baseline/Dialog_with_Buttons_Right.ui.h
@@ -44,7 +44,7 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h
index 05330c9a2a..d1592b950c 100644
--- a/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h
+++ b/tests/auto/tools/uic/baseline/Dialog_without_Buttons.ui.h
@@ -35,7 +35,7 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/Main_Window.ui.h b/tests/auto/tools/uic/baseline/Main_Window.ui.h
index da2f4c8e07..7fc0781262 100644
--- a/tests/auto/tools/uic/baseline/Main_Window.ui.h
+++ b/tests/auto/tools/uic/baseline/Main_Window.ui.h
@@ -50,7 +50,7 @@ public:
void retranslateUi(QMainWindow *MainWindow)
{
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR));
+ MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/Widget.ui.h b/tests/auto/tools/uic/baseline/Widget.ui.h
index b812386645..4705159fea 100644
--- a/tests/auto/tools/uic/baseline/Widget.ui.h
+++ b/tests/auto/tools/uic/baseline/Widget.ui.h
@@ -60,13 +60,13 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Form", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr));
Alabel->setText(QApplication::translate("Form", "A label.\n"
"One new line.\n"
"Another new line.\n"
-"Last line.", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("Form", "A Group Box", Q_NULLPTR));
- pushButton->setText(QApplication::translate("Form", "PushButton", Q_NULLPTR));
+"Last line.", nullptr));
+ groupBox->setTitle(QApplication::translate("Form", "A Group Box", nullptr));
+ pushButton->setText(QApplication::translate("Form", "PushButton", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/addlinkdialog.ui.h b/tests/auto/tools/uic/baseline/addlinkdialog.ui.h
index 9430d47c00..466f8660fd 100644
--- a/tests/auto/tools/uic/baseline/addlinkdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/addlinkdialog.ui.h
@@ -100,9 +100,9 @@ public:
void retranslateUi(QDialog *AddLinkDialog)
{
- AddLinkDialog->setWindowTitle(QApplication::translate("AddLinkDialog", "Insert Link", Q_NULLPTR));
- label->setText(QApplication::translate("AddLinkDialog", "Title:", Q_NULLPTR));
- label_2->setText(QApplication::translate("AddLinkDialog", "URL:", Q_NULLPTR));
+ AddLinkDialog->setWindowTitle(QApplication::translate("AddLinkDialog", "Insert Link", nullptr));
+ label->setText(QApplication::translate("AddLinkDialog", "Title:", nullptr));
+ label_2->setText(QApplication::translate("AddLinkDialog", "URL:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/addtorrentform.ui.h b/tests/auto/tools/uic/baseline/addtorrentform.ui.h
index 9d40907ad2..521a76847b 100644
--- a/tests/auto/tools/uic/baseline/addtorrentform.ui.h
+++ b/tests/auto/tools/uic/baseline/addtorrentform.ui.h
@@ -212,23 +212,23 @@ public:
void retranslateUi(QDialog *AddTorrentFile)
{
- AddTorrentFile->setWindowTitle(QApplication::translate("AddTorrentFile", "Add a torrent", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("AddTorrentFile", "Select a torrent source", Q_NULLPTR));
- label_4->setText(QApplication::translate("AddTorrentFile", "Destination:", Q_NULLPTR));
- label_2->setText(QApplication::translate("AddTorrentFile", "Tracker URL:", Q_NULLPTR));
- browseTorrents->setText(QApplication::translate("AddTorrentFile", "Browse", Q_NULLPTR));
- label_5->setText(QApplication::translate("AddTorrentFile", "File(s):", Q_NULLPTR));
- label_3->setText(QApplication::translate("AddTorrentFile", "Size:", Q_NULLPTR));
- label_6->setText(QApplication::translate("AddTorrentFile", "Creator:", Q_NULLPTR));
- announceUrl->setText(QApplication::translate("AddTorrentFile", "<none>", Q_NULLPTR));
- label->setText(QApplication::translate("AddTorrentFile", "Torrent file:", Q_NULLPTR));
- browseDestination->setText(QApplication::translate("AddTorrentFile", "Browse", Q_NULLPTR));
- label_7->setText(QApplication::translate("AddTorrentFile", "Comment:", Q_NULLPTR));
- commentLabel->setText(QApplication::translate("AddTorrentFile", "<none>", Q_NULLPTR));
- creatorLabel->setText(QApplication::translate("AddTorrentFile", "<none>", Q_NULLPTR));
- sizeLabel->setText(QApplication::translate("AddTorrentFile", "0", Q_NULLPTR));
- okButton->setText(QApplication::translate("AddTorrentFile", "&OK", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("AddTorrentFile", "&Cancel", Q_NULLPTR));
+ AddTorrentFile->setWindowTitle(QApplication::translate("AddTorrentFile", "Add a torrent", nullptr));
+ groupBox->setTitle(QApplication::translate("AddTorrentFile", "Select a torrent source", nullptr));
+ label_4->setText(QApplication::translate("AddTorrentFile", "Destination:", nullptr));
+ label_2->setText(QApplication::translate("AddTorrentFile", "Tracker URL:", nullptr));
+ browseTorrents->setText(QApplication::translate("AddTorrentFile", "Browse", nullptr));
+ label_5->setText(QApplication::translate("AddTorrentFile", "File(s):", nullptr));
+ label_3->setText(QApplication::translate("AddTorrentFile", "Size:", nullptr));
+ label_6->setText(QApplication::translate("AddTorrentFile", "Creator:", nullptr));
+ announceUrl->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr));
+ label->setText(QApplication::translate("AddTorrentFile", "Torrent file:", nullptr));
+ browseDestination->setText(QApplication::translate("AddTorrentFile", "Browse", nullptr));
+ label_7->setText(QApplication::translate("AddTorrentFile", "Comment:", nullptr));
+ commentLabel->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr));
+ creatorLabel->setText(QApplication::translate("AddTorrentFile", "<none>", nullptr));
+ sizeLabel->setText(QApplication::translate("AddTorrentFile", "0", nullptr));
+ okButton->setText(QApplication::translate("AddTorrentFile", "&OK", nullptr));
+ cancelButton->setText(QApplication::translate("AddTorrentFile", "&Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/authenticationdialog.ui.h b/tests/auto/tools/uic/baseline/authenticationdialog.ui.h
index fbc379a1c1..2c760be6c8 100644
--- a/tests/auto/tools/uic/baseline/authenticationdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/authenticationdialog.ui.h
@@ -106,12 +106,12 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Http authentication required", Q_NULLPTR));
- label->setText(QApplication::translate("Dialog", "You need to supply a Username and a Password to access this site", Q_NULLPTR));
- label_2->setText(QApplication::translate("Dialog", "Username:", Q_NULLPTR));
- label_3->setText(QApplication::translate("Dialog", "Password:", Q_NULLPTR));
- label_4->setText(QApplication::translate("Dialog", "Site:", Q_NULLPTR));
- siteDescription->setText(QApplication::translate("Dialog", "%1 at %2", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Http authentication required", nullptr));
+ label->setText(QApplication::translate("Dialog", "You need to supply a Username and a Password to access this site", nullptr));
+ label_2->setText(QApplication::translate("Dialog", "Username:", nullptr));
+ label_3->setText(QApplication::translate("Dialog", "Password:", nullptr));
+ label_4->setText(QApplication::translate("Dialog", "Site:", nullptr));
+ siteDescription->setText(QApplication::translate("Dialog", "%1 at %2", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/backside.ui.h b/tests/auto/tools/uic/baseline/backside.ui.h
index abbf331182..c78b474277 100644
--- a/tests/auto/tools/uic/baseline/backside.ui.h
+++ b/tests/auto/tools/uic/baseline/backside.ui.h
@@ -146,40 +146,40 @@ public:
void retranslateUi(QWidget *BackSide)
{
- BackSide->setWindowTitle(QApplication::translate("BackSide", "BackSide", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("BackSide", "Settings", Q_NULLPTR));
- label->setText(QApplication::translate("BackSide", "Title:", Q_NULLPTR));
- hostName->setText(QApplication::translate("BackSide", "Pad Navigator Example", Q_NULLPTR));
- label_2->setText(QApplication::translate("BackSide", "Modified:", Q_NULLPTR));
- label_3->setText(QApplication::translate("BackSide", "Extent", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("BackSide", "Other input", Q_NULLPTR));
+ BackSide->setWindowTitle(QApplication::translate("BackSide", "BackSide", nullptr));
+ groupBox->setTitle(QApplication::translate("BackSide", "Settings", nullptr));
+ label->setText(QApplication::translate("BackSide", "Title:", nullptr));
+ hostName->setText(QApplication::translate("BackSide", "Pad Navigator Example", nullptr));
+ label_2->setText(QApplication::translate("BackSide", "Modified:", nullptr));
+ label_3->setText(QApplication::translate("BackSide", "Extent", nullptr));
+ groupBox_2->setTitle(QApplication::translate("BackSide", "Other input", nullptr));
QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("BackSide", "Widgets On Graphics View", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("BackSide", "Widgets On Graphics View", nullptr));
const bool __sortingEnabled = treeWidget->isSortingEnabled();
treeWidget->setSortingEnabled(false);
QTreeWidgetItem *___qtreewidgetitem1 = treeWidget->topLevelItem(0);
- ___qtreewidgetitem1->setText(0, QApplication::translate("BackSide", "QGraphicsProxyWidget", Q_NULLPTR));
+ ___qtreewidgetitem1->setText(0, QApplication::translate("BackSide", "QGraphicsProxyWidget", nullptr));
QTreeWidgetItem *___qtreewidgetitem2 = ___qtreewidgetitem1->child(0);
- ___qtreewidgetitem2->setText(0, QApplication::translate("BackSide", "QGraphicsWidget", Q_NULLPTR));
+ ___qtreewidgetitem2->setText(0, QApplication::translate("BackSide", "QGraphicsWidget", nullptr));
QTreeWidgetItem *___qtreewidgetitem3 = ___qtreewidgetitem2->child(0);
- ___qtreewidgetitem3->setText(0, QApplication::translate("BackSide", "QObject", Q_NULLPTR));
+ ___qtreewidgetitem3->setText(0, QApplication::translate("BackSide", "QObject", nullptr));
QTreeWidgetItem *___qtreewidgetitem4 = ___qtreewidgetitem2->child(1);
- ___qtreewidgetitem4->setText(0, QApplication::translate("BackSide", "QGraphicsItem", Q_NULLPTR));
+ ___qtreewidgetitem4->setText(0, QApplication::translate("BackSide", "QGraphicsItem", nullptr));
QTreeWidgetItem *___qtreewidgetitem5 = ___qtreewidgetitem2->child(2);
- ___qtreewidgetitem5->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", Q_NULLPTR));
+ ___qtreewidgetitem5->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr));
QTreeWidgetItem *___qtreewidgetitem6 = treeWidget->topLevelItem(1);
- ___qtreewidgetitem6->setText(0, QApplication::translate("BackSide", "QGraphicsGridLayout", Q_NULLPTR));
+ ___qtreewidgetitem6->setText(0, QApplication::translate("BackSide", "QGraphicsGridLayout", nullptr));
QTreeWidgetItem *___qtreewidgetitem7 = ___qtreewidgetitem6->child(0);
- ___qtreewidgetitem7->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", Q_NULLPTR));
+ ___qtreewidgetitem7->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", nullptr));
QTreeWidgetItem *___qtreewidgetitem8 = ___qtreewidgetitem7->child(0);
- ___qtreewidgetitem8->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", Q_NULLPTR));
+ ___qtreewidgetitem8->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr));
QTreeWidgetItem *___qtreewidgetitem9 = treeWidget->topLevelItem(2);
- ___qtreewidgetitem9->setText(0, QApplication::translate("BackSide", "QGraphicsLinearLayout", Q_NULLPTR));
+ ___qtreewidgetitem9->setText(0, QApplication::translate("BackSide", "QGraphicsLinearLayout", nullptr));
QTreeWidgetItem *___qtreewidgetitem10 = ___qtreewidgetitem9->child(0);
- ___qtreewidgetitem10->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", Q_NULLPTR));
+ ___qtreewidgetitem10->setText(0, QApplication::translate("BackSide", "QGraphicsLayout", nullptr));
QTreeWidgetItem *___qtreewidgetitem11 = ___qtreewidgetitem10->child(0);
- ___qtreewidgetitem11->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", Q_NULLPTR));
+ ___qtreewidgetitem11->setText(0, QApplication::translate("BackSide", "QGraphicsLayoutItem", nullptr));
treeWidget->setSortingEnabled(__sortingEnabled);
} // retranslateUi
diff --git a/tests/auto/tools/uic/baseline/batchtranslation.ui.h b/tests/auto/tools/uic/baseline/batchtranslation.ui.h
index 87c140deff..53fc9052b2 100644
--- a/tests/auto/tools/uic/baseline/batchtranslation.ui.h
+++ b/tests/auto/tools/uic/baseline/batchtranslation.ui.h
@@ -216,16 +216,16 @@ public:
void retranslateUi(QDialog *databaseTranslationDialog)
{
- databaseTranslationDialog->setWindowTitle(QApplication::translate("databaseTranslationDialog", "Qt Linguist - Batch Translation", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("databaseTranslationDialog", "Options", Q_NULLPTR));
- ckOnlyUntranslated->setText(QApplication::translate("databaseTranslationDialog", "Only translate entries with no translation", Q_NULLPTR));
- ckMarkFinished->setText(QApplication::translate("databaseTranslationDialog", "Set translated entries to finished", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("databaseTranslationDialog", "Phrase book preference", Q_NULLPTR));
- moveUpButton->setText(QApplication::translate("databaseTranslationDialog", "Move up", Q_NULLPTR));
- moveDownButton->setText(QApplication::translate("databaseTranslationDialog", "Move down", Q_NULLPTR));
- label->setText(QApplication::translate("databaseTranslationDialog", "The batch translator will search through the selected phrasebooks in the order given above.", Q_NULLPTR));
- runButton->setText(QApplication::translate("databaseTranslationDialog", "&Run", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("databaseTranslationDialog", "&Cancel", Q_NULLPTR));
+ databaseTranslationDialog->setWindowTitle(QApplication::translate("databaseTranslationDialog", "Qt Linguist - Batch Translation", nullptr));
+ groupBox->setTitle(QApplication::translate("databaseTranslationDialog", "Options", nullptr));
+ ckOnlyUntranslated->setText(QApplication::translate("databaseTranslationDialog", "Only translate entries with no translation", nullptr));
+ ckMarkFinished->setText(QApplication::translate("databaseTranslationDialog", "Set translated entries to finished", nullptr));
+ groupBox_2->setTitle(QApplication::translate("databaseTranslationDialog", "Phrase book preference", nullptr));
+ moveUpButton->setText(QApplication::translate("databaseTranslationDialog", "Move up", nullptr));
+ moveDownButton->setText(QApplication::translate("databaseTranslationDialog", "Move down", nullptr));
+ label->setText(QApplication::translate("databaseTranslationDialog", "The batch translator will search through the selected phrasebooks in the order given above.", nullptr));
+ runButton->setText(QApplication::translate("databaseTranslationDialog", "&Run", nullptr));
+ cancelButton->setText(QApplication::translate("databaseTranslationDialog", "&Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h b/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h
index 6e62aeaec5..f5ec343a89 100644
--- a/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/bookmarkdialog.ui.h
@@ -150,13 +150,13 @@ public:
void retranslateUi(QDialog *BookmarkDialog)
{
- BookmarkDialog->setWindowTitle(QApplication::translate("BookmarkDialog", "Add Bookmark", Q_NULLPTR));
- label->setText(QApplication::translate("BookmarkDialog", "Bookmark:", Q_NULLPTR));
- label_2->setText(QApplication::translate("BookmarkDialog", "Add in Folder:", Q_NULLPTR));
- toolButton->setText(QApplication::translate("BookmarkDialog", "+", Q_NULLPTR));
+ BookmarkDialog->setWindowTitle(QApplication::translate("BookmarkDialog", "Add Bookmark", nullptr));
+ label->setText(QApplication::translate("BookmarkDialog", "Bookmark:", nullptr));
+ label_2->setText(QApplication::translate("BookmarkDialog", "Add in Folder:", nullptr));
+ toolButton->setText(QApplication::translate("BookmarkDialog", "+", nullptr));
QTreeWidgetItem *___qtreewidgetitem = bookmarkWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("BookmarkDialog", "1", Q_NULLPTR));
- newFolderButton->setText(QApplication::translate("BookmarkDialog", "New Folder", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("BookmarkDialog", "1", nullptr));
+ newFolderButton->setText(QApplication::translate("BookmarkDialog", "New Folder", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/bookwindow.ui.h b/tests/auto/tools/uic/baseline/bookwindow.ui.h
index 57ac4b3bdd..daf441e5d9 100644
--- a/tests/auto/tools/uic/baseline/bookwindow.ui.h
+++ b/tests/auto/tools/uic/baseline/bookwindow.ui.h
@@ -159,15 +159,15 @@ public:
void retranslateUi(QMainWindow *BookWindow)
{
- BookWindow->setWindowTitle(QApplication::translate("BookWindow", "Books", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("BookWindow", "Books", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("BookWindow", "Details", Q_NULLPTR));
- label_5->setText(QApplication::translate("BookWindow", "<b>Title:</b>", Q_NULLPTR));
- label_2_2_2_2->setText(QApplication::translate("BookWindow", "<b>Author: </b>", Q_NULLPTR));
- label_3->setText(QApplication::translate("BookWindow", "<b>Genre:</b>", Q_NULLPTR));
- label_4->setText(QApplication::translate("BookWindow", "<b>Year:</b>", Q_NULLPTR));
+ BookWindow->setWindowTitle(QApplication::translate("BookWindow", "Books", nullptr));
+ groupBox->setTitle(QApplication::translate("BookWindow", "Books", nullptr));
+ groupBox_2->setTitle(QApplication::translate("BookWindow", "Details", nullptr));
+ label_5->setText(QApplication::translate("BookWindow", "<b>Title:</b>", nullptr));
+ label_2_2_2_2->setText(QApplication::translate("BookWindow", "<b>Author: </b>", nullptr));
+ label_3->setText(QApplication::translate("BookWindow", "<b>Genre:</b>", nullptr));
+ label_4->setText(QApplication::translate("BookWindow", "<b>Year:</b>", nullptr));
yearEdit->setPrefix(QString());
- label->setText(QApplication::translate("BookWindow", "<b>Rating:</b>", Q_NULLPTR));
+ label->setText(QApplication::translate("BookWindow", "<b>Rating:</b>", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/browserwidget.ui.h b/tests/auto/tools/uic/baseline/browserwidget.ui.h
index 876e99d504..e5bebd8f59 100644
--- a/tests/auto/tools/uic/baseline/browserwidget.ui.h
+++ b/tests/auto/tools/uic/baseline/browserwidget.ui.h
@@ -156,18 +156,18 @@ public:
void retranslateUi(QWidget *Browser)
{
- Browser->setWindowTitle(QApplication::translate("Browser", "Qt SQL Browser", Q_NULLPTR));
- insertRowAction->setText(QApplication::translate("Browser", "&Insert Row", Q_NULLPTR));
+ Browser->setWindowTitle(QApplication::translate("Browser", "Qt SQL Browser", nullptr));
+ insertRowAction->setText(QApplication::translate("Browser", "&Insert Row", nullptr));
#ifndef QT_NO_STATUSTIP
- insertRowAction->setStatusTip(QApplication::translate("Browser", "Inserts a new Row", Q_NULLPTR));
+ insertRowAction->setStatusTip(QApplication::translate("Browser", "Inserts a new Row", nullptr));
#endif // QT_NO_STATUSTIP
- deleteRowAction->setText(QApplication::translate("Browser", "&Delete Row", Q_NULLPTR));
+ deleteRowAction->setText(QApplication::translate("Browser", "&Delete Row", nullptr));
#ifndef QT_NO_STATUSTIP
- deleteRowAction->setStatusTip(QApplication::translate("Browser", "Deletes the current Row", Q_NULLPTR));
+ deleteRowAction->setStatusTip(QApplication::translate("Browser", "Deletes the current Row", nullptr));
#endif // QT_NO_STATUSTIP
- groupBox->setTitle(QApplication::translate("Browser", "SQL Query", Q_NULLPTR));
- clearButton->setText(QApplication::translate("Browser", "&Clear", Q_NULLPTR));
- submitButton->setText(QApplication::translate("Browser", "&Submit", Q_NULLPTR));
+ groupBox->setTitle(QApplication::translate("Browser", "SQL Query", nullptr));
+ clearButton->setText(QApplication::translate("Browser", "&Clear", nullptr));
+ submitButton->setText(QApplication::translate("Browser", "&Submit", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h b/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h
index d72ca81be6..caac7e31aa 100644
--- a/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h
+++ b/tests/auto/tools/uic/baseline/bug18156QTreeWidget.ui.h
@@ -59,9 +59,9 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(1, QApplication::translate("Dialog", "4", Q_NULLPTR));
+ ___qtreewidgetitem->setText(1, QApplication::translate("Dialog", "4", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/calculator.ui.h b/tests/auto/tools/uic/baseline/calculator.ui.h
index 88644eaaaf..5c8b8640d3 100644
--- a/tests/auto/tools/uic/baseline/calculator.ui.h
+++ b/tests/auto/tools/uic/baseline/calculator.ui.h
@@ -159,34 +159,34 @@ public:
void retranslateUi(QWidget *Calculator)
{
- Calculator->setWindowTitle(QApplication::translate("Calculator", "Calculator", Q_NULLPTR));
- backspaceButton->setText(QApplication::translate("Calculator", "Backspace", Q_NULLPTR));
- clearButton->setText(QApplication::translate("Calculator", "Clear", Q_NULLPTR));
- clearAllButton->setText(QApplication::translate("Calculator", "Clear All", Q_NULLPTR));
- clearMemoryButton->setText(QApplication::translate("Calculator", "MC", Q_NULLPTR));
- readMemoryButton->setText(QApplication::translate("Calculator", "MR", Q_NULLPTR));
- setMemoryButton->setText(QApplication::translate("Calculator", "MS", Q_NULLPTR));
- addToMemoryButton->setText(QApplication::translate("Calculator", "M+", Q_NULLPTR));
- sevenButton->setText(QApplication::translate("Calculator", "7", Q_NULLPTR));
- eightButton->setText(QApplication::translate("Calculator", "8", Q_NULLPTR));
- nineButton->setText(QApplication::translate("Calculator", "9", Q_NULLPTR));
- fourButton->setText(QApplication::translate("Calculator", "4", Q_NULLPTR));
- fiveButton->setText(QApplication::translate("Calculator", "5", Q_NULLPTR));
- sixButton->setText(QApplication::translate("Calculator", "6", Q_NULLPTR));
- oneButton->setText(QApplication::translate("Calculator", "1", Q_NULLPTR));
- twoButton->setText(QApplication::translate("Calculator", "2", Q_NULLPTR));
- threeButton->setText(QApplication::translate("Calculator", "3", Q_NULLPTR));
- zeroButton->setText(QApplication::translate("Calculator", "0", Q_NULLPTR));
- pointButton->setText(QApplication::translate("Calculator", ".", Q_NULLPTR));
- changeSignButton->setText(QApplication::translate("Calculator", "+-", Q_NULLPTR));
- plusButton->setText(QApplication::translate("Calculator", "+", Q_NULLPTR));
- divisionButton->setText(QApplication::translate("Calculator", "/", Q_NULLPTR));
- timesButton->setText(QApplication::translate("Calculator", "*", Q_NULLPTR));
- minusButton->setText(QApplication::translate("Calculator", "-", Q_NULLPTR));
- squareRootButton->setText(QApplication::translate("Calculator", "Sqrt", Q_NULLPTR));
- powerButton->setText(QApplication::translate("Calculator", "x^2", Q_NULLPTR));
- reciprocalButton->setText(QApplication::translate("Calculator", "1/x", Q_NULLPTR));
- equalButton->setText(QApplication::translate("Calculator", "=", Q_NULLPTR));
+ Calculator->setWindowTitle(QApplication::translate("Calculator", "Calculator", nullptr));
+ backspaceButton->setText(QApplication::translate("Calculator", "Backspace", nullptr));
+ clearButton->setText(QApplication::translate("Calculator", "Clear", nullptr));
+ clearAllButton->setText(QApplication::translate("Calculator", "Clear All", nullptr));
+ clearMemoryButton->setText(QApplication::translate("Calculator", "MC", nullptr));
+ readMemoryButton->setText(QApplication::translate("Calculator", "MR", nullptr));
+ setMemoryButton->setText(QApplication::translate("Calculator", "MS", nullptr));
+ addToMemoryButton->setText(QApplication::translate("Calculator", "M+", nullptr));
+ sevenButton->setText(QApplication::translate("Calculator", "7", nullptr));
+ eightButton->setText(QApplication::translate("Calculator", "8", nullptr));
+ nineButton->setText(QApplication::translate("Calculator", "9", nullptr));
+ fourButton->setText(QApplication::translate("Calculator", "4", nullptr));
+ fiveButton->setText(QApplication::translate("Calculator", "5", nullptr));
+ sixButton->setText(QApplication::translate("Calculator", "6", nullptr));
+ oneButton->setText(QApplication::translate("Calculator", "1", nullptr));
+ twoButton->setText(QApplication::translate("Calculator", "2", nullptr));
+ threeButton->setText(QApplication::translate("Calculator", "3", nullptr));
+ zeroButton->setText(QApplication::translate("Calculator", "0", nullptr));
+ pointButton->setText(QApplication::translate("Calculator", ".", nullptr));
+ changeSignButton->setText(QApplication::translate("Calculator", "+-", nullptr));
+ plusButton->setText(QApplication::translate("Calculator", "+", nullptr));
+ divisionButton->setText(QApplication::translate("Calculator", "/", nullptr));
+ timesButton->setText(QApplication::translate("Calculator", "*", nullptr));
+ minusButton->setText(QApplication::translate("Calculator", "-", nullptr));
+ squareRootButton->setText(QApplication::translate("Calculator", "Sqrt", nullptr));
+ powerButton->setText(QApplication::translate("Calculator", "x^2", nullptr));
+ reciprocalButton->setText(QApplication::translate("Calculator", "1/x", nullptr));
+ equalButton->setText(QApplication::translate("Calculator", "=", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/calculatorform.ui.h b/tests/auto/tools/uic/baseline/calculatorform.ui.h
index 3688c79d04..86482c7814 100644
--- a/tests/auto/tools/uic/baseline/calculatorform.ui.h
+++ b/tests/auto/tools/uic/baseline/calculatorform.ui.h
@@ -173,13 +173,13 @@ public:
void retranslateUi(QWidget *CalculatorForm)
{
- CalculatorForm->setWindowTitle(QApplication::translate("CalculatorForm", "Calculator Builder", Q_NULLPTR));
- label->setText(QApplication::translate("CalculatorForm", "Input 1", Q_NULLPTR));
- label_3->setText(QApplication::translate("CalculatorForm", "+", Q_NULLPTR));
- label_2->setText(QApplication::translate("CalculatorForm", "Input 2", Q_NULLPTR));
- label_3_2->setText(QApplication::translate("CalculatorForm", "=", Q_NULLPTR));
- label_2_2_2->setText(QApplication::translate("CalculatorForm", "Output", Q_NULLPTR));
- outputWidget->setText(QApplication::translate("CalculatorForm", "0", Q_NULLPTR));
+ CalculatorForm->setWindowTitle(QApplication::translate("CalculatorForm", "Calculator Builder", nullptr));
+ label->setText(QApplication::translate("CalculatorForm", "Input 1", nullptr));
+ label_3->setText(QApplication::translate("CalculatorForm", "+", nullptr));
+ label_2->setText(QApplication::translate("CalculatorForm", "Input 2", nullptr));
+ label_3_2->setText(QApplication::translate("CalculatorForm", "=", nullptr));
+ label_2_2_2->setText(QApplication::translate("CalculatorForm", "Output", nullptr));
+ outputWidget->setText(QApplication::translate("CalculatorForm", "0", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/certificateinfo.ui.h b/tests/auto/tools/uic/baseline/certificateinfo.ui.h
index 183b89aaff..ac31a209e2 100644
--- a/tests/auto/tools/uic/baseline/certificateinfo.ui.h
+++ b/tests/auto/tools/uic/baseline/certificateinfo.ui.h
@@ -93,9 +93,9 @@ public:
void retranslateUi(QDialog *CertificateInfo)
{
- CertificateInfo->setWindowTitle(QApplication::translate("CertificateInfo", "Display Certificate Information", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("CertificateInfo", "Certification Path", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("CertificateInfo", "Certificate Information", Q_NULLPTR));
+ CertificateInfo->setWindowTitle(QApplication::translate("CertificateInfo", "Display Certificate Information", nullptr));
+ groupBox->setTitle(QApplication::translate("CertificateInfo", "Certification Path", nullptr));
+ groupBox_2->setTitle(QApplication::translate("CertificateInfo", "Certificate Information", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/chatdialog.ui.h b/tests/auto/tools/uic/baseline/chatdialog.ui.h
index b678b85eb9..48c6e2d3a1 100644
--- a/tests/auto/tools/uic/baseline/chatdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/chatdialog.ui.h
@@ -100,8 +100,8 @@ public:
void retranslateUi(QDialog *ChatDialog)
{
- ChatDialog->setWindowTitle(QApplication::translate("ChatDialog", "Chat", Q_NULLPTR));
- label->setText(QApplication::translate("ChatDialog", "Message:", Q_NULLPTR));
+ ChatDialog->setWindowTitle(QApplication::translate("ChatDialog", "Chat", nullptr));
+ label->setText(QApplication::translate("ChatDialog", "Message:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
index 7f8b026ba5..2764761023 100644
--- a/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
+++ b/tests/auto/tools/uic/baseline/chatmainwindow.ui.h
@@ -149,29 +149,29 @@ public:
void retranslateUi(QMainWindow *ChatMainWindow)
{
- ChatMainWindow->setWindowTitle(QApplication::translate("ChatMainWindow", "Qt D-Bus Chat", Q_NULLPTR));
- actionQuit->setText(QApplication::translate("ChatMainWindow", "Quit", Q_NULLPTR));
+ ChatMainWindow->setWindowTitle(QApplication::translate("ChatMainWindow", "Qt D-Bus Chat", nullptr));
+ actionQuit->setText(QApplication::translate("ChatMainWindow", "Quit", nullptr));
#ifndef QT_NO_SHORTCUT
- actionQuit->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+Q", Q_NULLPTR));
+ actionQuit->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+Q", nullptr));
#endif // QT_NO_SHORTCUT
- actionAboutQt->setText(QApplication::translate("ChatMainWindow", "About Qt...", Q_NULLPTR));
- actionChangeNickname->setText(QApplication::translate("ChatMainWindow", "Change nickname...", Q_NULLPTR));
+ actionAboutQt->setText(QApplication::translate("ChatMainWindow", "About Qt...", nullptr));
+ actionChangeNickname->setText(QApplication::translate("ChatMainWindow", "Change nickname...", nullptr));
#ifndef QT_NO_SHORTCUT
- actionChangeNickname->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+N", Q_NULLPTR));
+ actionChangeNickname->setShortcut(QApplication::translate("ChatMainWindow", "Ctrl+N", nullptr));
#endif // QT_NO_SHORTCUT
#ifndef QT_NO_TOOLTIP
- chatHistory->setToolTip(QApplication::translate("ChatMainWindow", "Messages sent and received from other users", Q_NULLPTR));
+ chatHistory->setToolTip(QApplication::translate("ChatMainWindow", "Messages sent and received from other users", nullptr));
#endif // QT_NO_TOOLTIP
- label->setText(QApplication::translate("ChatMainWindow", "Message:", Q_NULLPTR));
+ label->setText(QApplication::translate("ChatMainWindow", "Message:", nullptr));
#ifndef QT_NO_TOOLTIP
- sendButton->setToolTip(QApplication::translate("ChatMainWindow", "Sends a message to other people", Q_NULLPTR));
+ sendButton->setToolTip(QApplication::translate("ChatMainWindow", "Sends a message to other people", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
sendButton->setWhatsThis(QString());
#endif // QT_NO_WHATSTHIS
- sendButton->setText(QApplication::translate("ChatMainWindow", "Send", Q_NULLPTR));
- menuQuit->setTitle(QApplication::translate("ChatMainWindow", "Help", Q_NULLPTR));
- menuFile->setTitle(QApplication::translate("ChatMainWindow", "File", Q_NULLPTR));
+ sendButton->setText(QApplication::translate("ChatMainWindow", "Send", nullptr));
+ menuQuit->setTitle(QApplication::translate("ChatMainWindow", "Help", nullptr));
+ menuFile->setTitle(QApplication::translate("ChatMainWindow", "File", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/chatsetnickname.ui.h b/tests/auto/tools/uic/baseline/chatsetnickname.ui.h
index aa023a56fb..0fc8d99ab3 100644
--- a/tests/auto/tools/uic/baseline/chatsetnickname.ui.h
+++ b/tests/auto/tools/uic/baseline/chatsetnickname.ui.h
@@ -115,10 +115,10 @@ public:
void retranslateUi(QDialog *NicknameDialog)
{
- NicknameDialog->setWindowTitle(QApplication::translate("NicknameDialog", "Set nickname", Q_NULLPTR));
- label->setText(QApplication::translate("NicknameDialog", "New nickname:", Q_NULLPTR));
- okButton->setText(QApplication::translate("NicknameDialog", "OK", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("NicknameDialog", "Cancel", Q_NULLPTR));
+ NicknameDialog->setWindowTitle(QApplication::translate("NicknameDialog", "Set nickname", nullptr));
+ label->setText(QApplication::translate("NicknameDialog", "New nickname:", nullptr));
+ okButton->setText(QApplication::translate("NicknameDialog", "OK", nullptr));
+ cancelButton->setText(QApplication::translate("NicknameDialog", "Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/config.ui.h b/tests/auto/tools/uic/baseline/config.ui.h
index 2dadae383e..d0c4c95e72 100644
--- a/tests/auto/tools/uic/baseline/config.ui.h
+++ b/tests/auto/tools/uic/baseline/config.ui.h
@@ -31,7 +31,7 @@
/********************************************************************************
** Form generated from reading UI file 'config.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -286,6 +286,7 @@ public:
hboxLayout2->addWidget(TextLabel1_3);
skin = new QComboBox(Config);
+ skin->addItem(QString());
skin->setObjectName(QStringLiteral("skin"));
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed);
sizePolicy2.setHorizontalStretch(0);
@@ -708,46 +709,44 @@ public:
void retranslateUi(QDialog *Config)
{
- Config->setWindowTitle(QApplication::translate("Config", "Configure", Q_NULLPTR));
- ButtonGroup1->setTitle(QApplication::translate("Config", "Size", Q_NULLPTR));
- size_176_220->setText(QApplication::translate("Config", "176x220 \"SmartPhone\"", Q_NULLPTR));
- size_240_320->setText(QApplication::translate("Config", "240x320 \"PDA\"", Q_NULLPTR));
- size_320_240->setText(QApplication::translate("Config", "320x240 \"TV\" / \"QVGA\"", Q_NULLPTR));
- size_640_480->setText(QApplication::translate("Config", "640x480 \"VGA\"", Q_NULLPTR));
- size_800_600->setText(QApplication::translate("Config", "800x600", Q_NULLPTR));
- size_1024_768->setText(QApplication::translate("Config", "1024x768", Q_NULLPTR));
- size_custom->setText(QApplication::translate("Config", "Custom", Q_NULLPTR));
- ButtonGroup2->setTitle(QApplication::translate("Config", "Depth", Q_NULLPTR));
- depth_1->setText(QApplication::translate("Config", "1 bit monochrome", Q_NULLPTR));
- depth_4gray->setText(QApplication::translate("Config", "4 bit grayscale", Q_NULLPTR));
- depth_8->setText(QApplication::translate("Config", "8 bit", Q_NULLPTR));
- depth_12->setText(QApplication::translate("Config", "12 (16) bit", Q_NULLPTR));
- depth_15->setText(QApplication::translate("Config", "15 bit", Q_NULLPTR));
- depth_16->setText(QApplication::translate("Config", "16 bit", Q_NULLPTR));
- depth_18->setText(QApplication::translate("Config", "18 bit", Q_NULLPTR));
- depth_24->setText(QApplication::translate("Config", "24 bit", Q_NULLPTR));
- depth_32->setText(QApplication::translate("Config", "32 bit", Q_NULLPTR));
- depth_32_argb->setText(QApplication::translate("Config", "32 bit ARGB", Q_NULLPTR));
- TextLabel1_3->setText(QApplication::translate("Config", "Skin", Q_NULLPTR));
- skin->clear();
- skin->insertItems(0, QStringList()
- << QApplication::translate("Config", "None", Q_NULLPTR)
- );
- touchScreen->setText(QApplication::translate("Config", "Emulate touch screen (no mouse move)", Q_NULLPTR));
- lcdScreen->setText(QApplication::translate("Config", "Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)", Q_NULLPTR));
- TextLabel1->setText(QApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", Q_NULLPTR));
- GroupBox1->setTitle(QApplication::translate("Config", "Gamma", Q_NULLPTR));
- TextLabel3->setText(QApplication::translate("Config", "Blue", Q_NULLPTR));
- blabel->setText(QApplication::translate("Config", "1.0", Q_NULLPTR));
- TextLabel2->setText(QApplication::translate("Config", "Green", Q_NULLPTR));
- glabel->setText(QApplication::translate("Config", "1.0", Q_NULLPTR));
- TextLabel7->setText(QApplication::translate("Config", "All", Q_NULLPTR));
- TextLabel8->setText(QApplication::translate("Config", "1.0", Q_NULLPTR));
- TextLabel1_2->setText(QApplication::translate("Config", "Red", Q_NULLPTR));
- rlabel->setText(QApplication::translate("Config", "1.0", Q_NULLPTR));
- PushButton3->setText(QApplication::translate("Config", "Set all to 1.0", Q_NULLPTR));
- buttonOk->setText(QApplication::translate("Config", "&OK", Q_NULLPTR));
- buttonCancel->setText(QApplication::translate("Config", "&Cancel", Q_NULLPTR));
+ Config->setWindowTitle(QApplication::translate("Config", "Configure", nullptr));
+ ButtonGroup1->setTitle(QApplication::translate("Config", "Size", nullptr));
+ size_176_220->setText(QApplication::translate("Config", "176x220 \"SmartPhone\"", nullptr));
+ size_240_320->setText(QApplication::translate("Config", "240x320 \"PDA\"", nullptr));
+ size_320_240->setText(QApplication::translate("Config", "320x240 \"TV\" / \"QVGA\"", nullptr));
+ size_640_480->setText(QApplication::translate("Config", "640x480 \"VGA\"", nullptr));
+ size_800_600->setText(QApplication::translate("Config", "800x600", nullptr));
+ size_1024_768->setText(QApplication::translate("Config", "1024x768", nullptr));
+ size_custom->setText(QApplication::translate("Config", "Custom", nullptr));
+ ButtonGroup2->setTitle(QApplication::translate("Config", "Depth", nullptr));
+ depth_1->setText(QApplication::translate("Config", "1 bit monochrome", nullptr));
+ depth_4gray->setText(QApplication::translate("Config", "4 bit grayscale", nullptr));
+ depth_8->setText(QApplication::translate("Config", "8 bit", nullptr));
+ depth_12->setText(QApplication::translate("Config", "12 (16) bit", nullptr));
+ depth_15->setText(QApplication::translate("Config", "15 bit", nullptr));
+ depth_16->setText(QApplication::translate("Config", "16 bit", nullptr));
+ depth_18->setText(QApplication::translate("Config", "18 bit", nullptr));
+ depth_24->setText(QApplication::translate("Config", "24 bit", nullptr));
+ depth_32->setText(QApplication::translate("Config", "32 bit", nullptr));
+ depth_32_argb->setText(QApplication::translate("Config", "32 bit ARGB", nullptr));
+ TextLabel1_3->setText(QApplication::translate("Config", "Skin", nullptr));
+ skin->setItemText(0, QApplication::translate("Config", "None", nullptr));
+
+ touchScreen->setText(QApplication::translate("Config", "Emulate touch screen (no mouse move)", nullptr));
+ lcdScreen->setText(QApplication::translate("Config", "Emulate LCD screen (Only with fixed zoom of 3.0 times magnification)", nullptr));
+ TextLabel1->setText(QApplication::translate("Config", "<p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>.", nullptr));
+ GroupBox1->setTitle(QApplication::translate("Config", "Gamma", nullptr));
+ TextLabel3->setText(QApplication::translate("Config", "Blue", nullptr));
+ blabel->setText(QApplication::translate("Config", "1.0", nullptr));
+ TextLabel2->setText(QApplication::translate("Config", "Green", nullptr));
+ glabel->setText(QApplication::translate("Config", "1.0", nullptr));
+ TextLabel7->setText(QApplication::translate("Config", "All", nullptr));
+ TextLabel8->setText(QApplication::translate("Config", "1.0", nullptr));
+ TextLabel1_2->setText(QApplication::translate("Config", "Red", nullptr));
+ rlabel->setText(QApplication::translate("Config", "1.0", nullptr));
+ PushButton3->setText(QApplication::translate("Config", "Set all to 1.0", nullptr));
+ buttonOk->setText(QApplication::translate("Config", "&OK", nullptr));
+ buttonCancel->setText(QApplication::translate("Config", "&Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/connectdialog.ui.h b/tests/auto/tools/uic/baseline/connectdialog.ui.h
index 384f406582..fde460c483 100644
--- a/tests/auto/tools/uic/baseline/connectdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/connectdialog.ui.h
@@ -129,12 +129,12 @@ public:
void retranslateUi(QDialog *ConnectDialog)
{
- ConnectDialog->setWindowTitle(QApplication::translate("ConnectDialog", "Configure Connection", Q_NULLPTR));
- signalGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", Q_NULLPTR));
- editSignalsButton->setText(QApplication::translate("ConnectDialog", "Edit...", Q_NULLPTR));
- slotGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", Q_NULLPTR));
- editSlotsButton->setText(QApplication::translate("ConnectDialog", "Edit...", Q_NULLPTR));
- showAllCheckBox->setText(QApplication::translate("ConnectDialog", "Show signals and slots inherited from QWidget", Q_NULLPTR));
+ ConnectDialog->setWindowTitle(QApplication::translate("ConnectDialog", "Configure Connection", nullptr));
+ signalGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", nullptr));
+ editSignalsButton->setText(QApplication::translate("ConnectDialog", "Edit...", nullptr));
+ slotGroupBox->setTitle(QApplication::translate("ConnectDialog", "GroupBox", nullptr));
+ editSlotsButton->setText(QApplication::translate("ConnectDialog", "Edit...", nullptr));
+ showAllCheckBox->setText(QApplication::translate("ConnectDialog", "Show signals and slots inherited from QWidget", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/controller.ui.h b/tests/auto/tools/uic/baseline/controller.ui.h
index 6f3162c5c6..41e3c005d2 100644
--- a/tests/auto/tools/uic/baseline/controller.ui.h
+++ b/tests/auto/tools/uic/baseline/controller.ui.h
@@ -78,12 +78,12 @@ public:
void retranslateUi(QWidget *Controller)
{
- Controller->setWindowTitle(QApplication::translate("Controller", "Controller", Q_NULLPTR));
- label->setText(QApplication::translate("Controller", "Controller", Q_NULLPTR));
- decelerate->setText(QApplication::translate("Controller", "Decelerate", Q_NULLPTR));
- accelerate->setText(QApplication::translate("Controller", "Accelerate", Q_NULLPTR));
- right->setText(QApplication::translate("Controller", "Right", Q_NULLPTR));
- left->setText(QApplication::translate("Controller", "Left", Q_NULLPTR));
+ Controller->setWindowTitle(QApplication::translate("Controller", "Controller", nullptr));
+ label->setText(QApplication::translate("Controller", "Controller", nullptr));
+ decelerate->setText(QApplication::translate("Controller", "Decelerate", nullptr));
+ accelerate->setText(QApplication::translate("Controller", "Accelerate", nullptr));
+ right->setText(QApplication::translate("Controller", "Right", nullptr));
+ left->setText(QApplication::translate("Controller", "Left", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/cookies.ui.h b/tests/auto/tools/uic/baseline/cookies.ui.h
index f1c7a6a4f9..d6b3c4a2f2 100644
--- a/tests/auto/tools/uic/baseline/cookies.ui.h
+++ b/tests/auto/tools/uic/baseline/cookies.ui.h
@@ -93,9 +93,9 @@ public:
void retranslateUi(QDialog *CookiesDialog)
{
- CookiesDialog->setWindowTitle(QApplication::translate("CookiesDialog", "Cookies", Q_NULLPTR));
- removeButton->setText(QApplication::translate("CookiesDialog", "&Remove", Q_NULLPTR));
- removeAllButton->setText(QApplication::translate("CookiesDialog", "Remove &All Cookies", Q_NULLPTR));
+ CookiesDialog->setWindowTitle(QApplication::translate("CookiesDialog", "Cookies", nullptr));
+ removeButton->setText(QApplication::translate("CookiesDialog", "&Remove", nullptr));
+ removeAllButton->setText(QApplication::translate("CookiesDialog", "Remove &All Cookies", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h b/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h
index a86c40d289..80f40d0228 100644
--- a/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h
+++ b/tests/auto/tools/uic/baseline/cookiesexceptions.ui.h
@@ -160,15 +160,15 @@ public:
void retranslateUi(QDialog *CookiesExceptionsDialog)
{
- CookiesExceptionsDialog->setWindowTitle(QApplication::translate("CookiesExceptionsDialog", "Cookie Exceptions", Q_NULLPTR));
- newExceptionGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "New Exception", Q_NULLPTR));
- label->setText(QApplication::translate("CookiesExceptionsDialog", "Domain:", Q_NULLPTR));
- blockButton->setText(QApplication::translate("CookiesExceptionsDialog", "Block", Q_NULLPTR));
- allowForSessionButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow For Session", Q_NULLPTR));
- allowButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow", Q_NULLPTR));
- ExceptionsGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "Exceptions", Q_NULLPTR));
- removeButton->setText(QApplication::translate("CookiesExceptionsDialog", "&Remove", Q_NULLPTR));
- removeAllButton->setText(QApplication::translate("CookiesExceptionsDialog", "Remove &All", Q_NULLPTR));
+ CookiesExceptionsDialog->setWindowTitle(QApplication::translate("CookiesExceptionsDialog", "Cookie Exceptions", nullptr));
+ newExceptionGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "New Exception", nullptr));
+ label->setText(QApplication::translate("CookiesExceptionsDialog", "Domain:", nullptr));
+ blockButton->setText(QApplication::translate("CookiesExceptionsDialog", "Block", nullptr));
+ allowForSessionButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow For Session", nullptr));
+ allowButton->setText(QApplication::translate("CookiesExceptionsDialog", "Allow", nullptr));
+ ExceptionsGroupBox->setTitle(QApplication::translate("CookiesExceptionsDialog", "Exceptions", nullptr));
+ removeButton->setText(QApplication::translate("CookiesExceptionsDialog", "&Remove", nullptr));
+ removeAllButton->setText(QApplication::translate("CookiesExceptionsDialog", "Remove &All", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/default.ui.h b/tests/auto/tools/uic/baseline/default.ui.h
index 03d97f86f1..46dfa8240c 100644
--- a/tests/auto/tools/uic/baseline/default.ui.h
+++ b/tests/auto/tools/uic/baseline/default.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'default.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -91,6 +91,10 @@ public:
gridLayout->addWidget(nameLabel, 0, 0, 1, 1);
nameCombo = new QComboBox(centralwidget);
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
nameCombo->setObjectName(QStringLiteral("nameCombo"));
nameCombo->setEditable(true);
@@ -169,6 +173,11 @@ public:
gridLayout->addWidget(professionList, 5, 1, 1, 3);
countryCombo = new QComboBox(centralwidget);
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
countryCombo->setObjectName(QStringLiteral("countryCombo"));
gridLayout->addWidget(countryCombo, 4, 1, 1, 3);
@@ -219,88 +228,84 @@ public:
void retranslateUi(QMainWindow *MainWindow)
{
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR));
- exitAction->setText(QApplication::translate("MainWindow", "&Exit", Q_NULLPTR));
- aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", Q_NULLPTR));
- editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", Q_NULLPTR));
- aboutAction->setText(QApplication::translate("MainWindow", "About", Q_NULLPTR));
- nameLabel->setText(QApplication::translate("MainWindow", "&Name:", Q_NULLPTR));
- nameCombo->clear();
- nameCombo->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Girish", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Jasmin", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Simon", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Zack", Q_NULLPTR)
- );
+ MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr));
+ exitAction->setText(QApplication::translate("MainWindow", "&Exit", nullptr));
+ aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", nullptr));
+ editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", nullptr));
+ aboutAction->setText(QApplication::translate("MainWindow", "About", nullptr));
+ nameLabel->setText(QApplication::translate("MainWindow", "&Name:", nullptr));
+ nameCombo->setItemText(0, QApplication::translate("MainWindow", "Girish", nullptr));
+ nameCombo->setItemText(1, QApplication::translate("MainWindow", "Jasmin", nullptr));
+ nameCombo->setItemText(2, QApplication::translate("MainWindow", "Simon", nullptr));
+ nameCombo->setItemText(3, QApplication::translate("MainWindow", "Zack", nullptr));
+
#ifndef QT_NO_TOOLTIP
- nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", Q_NULLPTR));
+ nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- femaleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are female", Q_NULLPTR));
+ femaleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are female", nullptr));
#endif // QT_NO_TOOLTIP
- femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", Q_NULLPTR));
+ femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", nullptr));
#ifndef QT_NO_TOOLTIP
- agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the license before checking this", Q_NULLPTR));
+ agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the license before checking this", nullptr));
#endif // QT_NO_TOOLTIP
- agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and conditions", Q_NULLPTR));
+ agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and conditions", nullptr));
#ifndef QT_NO_TOOLTIP
- maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", Q_NULLPTR));
+ maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", nullptr));
#endif // QT_NO_TOOLTIP
- maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", Q_NULLPTR));
- genderLabel->setText(QApplication::translate("MainWindow", "Gender:", Q_NULLPTR));
+ maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", nullptr));
+ genderLabel->setText(QApplication::translate("MainWindow", "Gender:", nullptr));
#ifndef QT_NO_TOOLTIP
- ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", Q_NULLPTR));
+ ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age here", Q_NULLPTR));
+ ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age here", nullptr));
#endif // QT_NO_STATUSTIP
- ageLabel->setText(QApplication::translate("MainWindow", "&Age:", Q_NULLPTR));
- passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", Q_NULLPTR));
+ ageLabel->setText(QApplication::translate("MainWindow", "&Age:", nullptr));
+ passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", nullptr));
#ifndef QT_NO_TOOLTIP
- passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", Q_NULLPTR));
+ passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password here", Q_NULLPTR));
+ passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password here", nullptr));
#endif // QT_NO_STATUSTIP
- passwordEdit->setText(QApplication::translate("MainWindow", "Password", Q_NULLPTR));
- label->setText(QApplication::translate("MainWindow", "Profession", Q_NULLPTR));
- countryLabel->setText(QApplication::translate("MainWindow", "&Country", Q_NULLPTR));
+ passwordEdit->setText(QApplication::translate("MainWindow", "Password", nullptr));
+ label->setText(QApplication::translate("MainWindow", "Profession", nullptr));
+ countryLabel->setText(QApplication::translate("MainWindow", "&Country", nullptr));
const bool __sortingEnabled = professionList->isSortingEnabled();
professionList->setSortingEnabled(false);
QListWidgetItem *___qlistwidgetitem = professionList->item(0);
- ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", Q_NULLPTR));
+ ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", nullptr));
QListWidgetItem *___qlistwidgetitem1 = professionList->item(1);
- ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", Q_NULLPTR));
+ ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", nullptr));
QListWidgetItem *___qlistwidgetitem2 = professionList->item(2);
- ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", Q_NULLPTR));
+ ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", nullptr));
professionList->setSortingEnabled(__sortingEnabled);
#ifndef QT_NO_TOOLTIP
- professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", Q_NULLPTR));
+ professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- professionList->setStatusTip(QApplication::translate("MainWindow", "Select your profession", Q_NULLPTR));
+ professionList->setStatusTip(QApplication::translate("MainWindow", "Select your profession", nullptr));
#endif // QT_NO_STATUSTIP
#ifndef QT_NO_WHATSTHIS
- professionList->setWhatsThis(QApplication::translate("MainWindow", "Select your profession", Q_NULLPTR));
+ professionList->setWhatsThis(QApplication::translate("MainWindow", "Select your profession", nullptr));
#endif // QT_NO_WHATSTHIS
- countryCombo->clear();
- countryCombo->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Germany", Q_NULLPTR)
- << QApplication::translate("MainWindow", "India", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Norway", Q_NULLPTR)
- << QApplication::translate("MainWindow", "United States Of America", Q_NULLPTR)
- << QApplication::translate("MainWindow", "United Kingdom", Q_NULLPTR)
- );
+ countryCombo->setItemText(0, QApplication::translate("MainWindow", "Germany", nullptr));
+ countryCombo->setItemText(1, QApplication::translate("MainWindow", "India", nullptr));
+ countryCombo->setItemText(2, QApplication::translate("MainWindow", "Norway", nullptr));
+ countryCombo->setItemText(3, QApplication::translate("MainWindow", "United States Of America", nullptr));
+ countryCombo->setItemText(4, QApplication::translate("MainWindow", "United Kingdom", nullptr));
+
#ifndef QT_NO_TOOLTIP
- countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify your country", Q_NULLPTR));
+ countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify your country", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify your country here", Q_NULLPTR));
+ countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify your country here", nullptr));
#endif // QT_NO_STATUSTIP
- menu_File->setTitle(QApplication::translate("MainWindow", "&File", Q_NULLPTR));
- menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", Q_NULLPTR));
+ menu_File->setTitle(QApplication::translate("MainWindow", "&File", nullptr));
+ menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/dialog.ui.h b/tests/auto/tools/uic/baseline/dialog.ui.h
index 88ca359e20..afcb9f2f8b 100644
--- a/tests/auto/tools/uic/baseline/dialog.ui.h
+++ b/tests/auto/tools/uic/baseline/dialog.ui.h
@@ -61,10 +61,10 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
- loadFromFileButton->setText(QApplication::translate("Dialog", "Load Image From File...", Q_NULLPTR));
- label->setText(QApplication::translate("Dialog", "Launch two of these dialogs. In the first, press the top button and load an image from a file. In the second, press the bottom button and display the loaded image from shared memory.", Q_NULLPTR));
- loadFromSharedMemoryButton->setText(QApplication::translate("Dialog", "Display Image From Shared Memory", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
+ loadFromFileButton->setText(QApplication::translate("Dialog", "Load Image From File...", nullptr));
+ label->setText(QApplication::translate("Dialog", "Launch two of these dialogs. In the first, press the top button and load an image from a file. In the second, press the bottom button and display the loaded image from shared memory.", nullptr));
+ loadFromSharedMemoryButton->setText(QApplication::translate("Dialog", "Display Image From Shared Memory", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/downloaditem.ui.h b/tests/auto/tools/uic/baseline/downloaditem.ui.h
index 87f2efe3eb..cd3068daee 100644
--- a/tests/auto/tools/uic/baseline/downloaditem.ui.h
+++ b/tests/auto/tools/uic/baseline/downloaditem.ui.h
@@ -127,13 +127,13 @@ public:
void retranslateUi(QWidget *DownloadItem)
{
- DownloadItem->setWindowTitle(QApplication::translate("DownloadItem", "Form", Q_NULLPTR));
- fileIcon->setText(QApplication::translate("DownloadItem", "Ico", Q_NULLPTR));
- fileNameLabel->setProperty("text", QVariant(QApplication::translate("DownloadItem", "Filename", Q_NULLPTR)));
+ DownloadItem->setWindowTitle(QApplication::translate("DownloadItem", "Form", nullptr));
+ fileIcon->setText(QApplication::translate("DownloadItem", "Ico", nullptr));
+ fileNameLabel->setProperty("text", QVariant(QApplication::translate("DownloadItem", "Filename", nullptr)));
downloadInfoLabel->setProperty("text", QVariant(QString()));
- tryAgainButton->setText(QApplication::translate("DownloadItem", "Try Again", Q_NULLPTR));
- stopButton->setText(QApplication::translate("DownloadItem", "Stop", Q_NULLPTR));
- openButton->setText(QApplication::translate("DownloadItem", "Open", Q_NULLPTR));
+ tryAgainButton->setText(QApplication::translate("DownloadItem", "Try Again", nullptr));
+ stopButton->setText(QApplication::translate("DownloadItem", "Stop", nullptr));
+ openButton->setText(QApplication::translate("DownloadItem", "Open", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/downloads.ui.h b/tests/auto/tools/uic/baseline/downloads.ui.h
index 4fbcceb7b4..4bc5f70bde 100644
--- a/tests/auto/tools/uic/baseline/downloads.ui.h
+++ b/tests/auto/tools/uic/baseline/downloads.ui.h
@@ -81,9 +81,9 @@ public:
void retranslateUi(QDialog *DownloadDialog)
{
- DownloadDialog->setWindowTitle(QApplication::translate("DownloadDialog", "Downloads", Q_NULLPTR));
- cleanupButton->setText(QApplication::translate("DownloadDialog", "Clean up", Q_NULLPTR));
- itemCount->setText(QApplication::translate("DownloadDialog", "0 Items", Q_NULLPTR));
+ DownloadDialog->setWindowTitle(QApplication::translate("DownloadDialog", "Downloads", nullptr));
+ cleanupButton->setText(QApplication::translate("DownloadDialog", "Clean up", nullptr));
+ itemCount->setText(QApplication::translate("DownloadDialog", "0 Items", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/embeddeddialog.ui.h b/tests/auto/tools/uic/baseline/embeddeddialog.ui.h
index 69027286b6..554c5d754c 100644
--- a/tests/auto/tools/uic/baseline/embeddeddialog.ui.h
+++ b/tests/auto/tools/uic/baseline/embeddeddialog.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'embeddeddialog.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -49,6 +49,8 @@ public:
formLayout->setWidget(0, QFormLayout::LabelRole, label);
layoutDirection = new QComboBox(embeddedDialog);
+ layoutDirection->addItem(QString());
+ layoutDirection->addItem(QString());
layoutDirection->setObjectName(QStringLiteral("layoutDirection"));
formLayout->setWidget(0, QFormLayout::FieldRole, layoutDirection);
@@ -98,16 +100,14 @@ public:
void retranslateUi(QDialog *embeddedDialog)
{
- embeddedDialog->setWindowTitle(QApplication::translate("embeddedDialog", "Embedded Dialog", Q_NULLPTR));
- label->setText(QApplication::translate("embeddedDialog", "Layout Direction:", Q_NULLPTR));
- layoutDirection->clear();
- layoutDirection->insertItems(0, QStringList()
- << QApplication::translate("embeddedDialog", "Left to Right", Q_NULLPTR)
- << QApplication::translate("embeddedDialog", "Right to Left", Q_NULLPTR)
- );
- label_2->setText(QApplication::translate("embeddedDialog", "Select Font:", Q_NULLPTR));
- label_3->setText(QApplication::translate("embeddedDialog", "Style:", Q_NULLPTR));
- label_4->setText(QApplication::translate("embeddedDialog", "Layout spacing:", Q_NULLPTR));
+ embeddedDialog->setWindowTitle(QApplication::translate("embeddedDialog", "Embedded Dialog", nullptr));
+ label->setText(QApplication::translate("embeddedDialog", "Layout Direction:", nullptr));
+ layoutDirection->setItemText(0, QApplication::translate("embeddedDialog", "Left to Right", nullptr));
+ layoutDirection->setItemText(1, QApplication::translate("embeddedDialog", "Right to Left", nullptr));
+
+ label_2->setText(QApplication::translate("embeddedDialog", "Select Font:", nullptr));
+ label_3->setText(QApplication::translate("embeddedDialog", "Style:", nullptr));
+ label_4->setText(QApplication::translate("embeddedDialog", "Layout spacing:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/enumnostdset.ui.h b/tests/auto/tools/uic/baseline/enumnostdset.ui.h
index 2c7d4cb591..31e1348a1a 100644
--- a/tests/auto/tools/uic/baseline/enumnostdset.ui.h
+++ b/tests/auto/tools/uic/baseline/enumnostdset.ui.h
@@ -41,7 +41,7 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Form", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/filespage.ui.h b/tests/auto/tools/uic/baseline/filespage.ui.h
index d84d609e01..7337c3a044 100644
--- a/tests/auto/tools/uic/baseline/filespage.ui.h
+++ b/tests/auto/tools/uic/baseline/filespage.ui.h
@@ -83,10 +83,10 @@ public:
void retranslateUi(QWidget *FilesPage)
{
- FilesPage->setWindowTitle(QApplication::translate("FilesPage", "Form", Q_NULLPTR));
- fileLabel->setText(QApplication::translate("FilesPage", "Files:", Q_NULLPTR));
- removeButton->setText(QApplication::translate("FilesPage", "Remove", Q_NULLPTR));
- removeAllButton->setText(QApplication::translate("FilesPage", "Remove All", Q_NULLPTR));
+ FilesPage->setWindowTitle(QApplication::translate("FilesPage", "Form", nullptr));
+ fileLabel->setText(QApplication::translate("FilesPage", "Files:", nullptr));
+ removeButton->setText(QApplication::translate("FilesPage", "Remove", nullptr));
+ removeAllButton->setText(QApplication::translate("FilesPage", "Remove All", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/filternamedialog.ui.h b/tests/auto/tools/uic/baseline/filternamedialog.ui.h
index b789b9045b..1a223e28aa 100644
--- a/tests/auto/tools/uic/baseline/filternamedialog.ui.h
+++ b/tests/auto/tools/uic/baseline/filternamedialog.ui.h
@@ -79,8 +79,8 @@ public:
void retranslateUi(QDialog *FilterNameDialogClass)
{
- FilterNameDialogClass->setWindowTitle(QApplication::translate("FilterNameDialogClass", "FilterNameDialog", Q_NULLPTR));
- label->setText(QApplication::translate("FilterNameDialogClass", "Filter Name:", Q_NULLPTR));
+ FilterNameDialogClass->setWindowTitle(QApplication::translate("FilterNameDialogClass", "FilterNameDialog", nullptr));
+ label->setText(QApplication::translate("FilterNameDialogClass", "Filter Name:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/filterpage.ui.h b/tests/auto/tools/uic/baseline/filterpage.ui.h
index d2e37dc5a4..c260c82efe 100644
--- a/tests/auto/tools/uic/baseline/filterpage.ui.h
+++ b/tests/auto/tools/uic/baseline/filterpage.ui.h
@@ -105,14 +105,14 @@ public:
void retranslateUi(QWidget *FilterPage)
{
- FilterPage->setWindowTitle(QApplication::translate("FilterPage", "Form", Q_NULLPTR));
- label->setText(QApplication::translate("FilterPage", "Filter attributes for current documentation (comma separated list):", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("FilterPage", "Custom Filters", Q_NULLPTR));
+ FilterPage->setWindowTitle(QApplication::translate("FilterPage", "Form", nullptr));
+ label->setText(QApplication::translate("FilterPage", "Filter attributes for current documentation (comma separated list):", nullptr));
+ groupBox->setTitle(QApplication::translate("FilterPage", "Custom Filters", nullptr));
QTreeWidgetItem *___qtreewidgetitem = customFilterWidget->headerItem();
- ___qtreewidgetitem->setText(1, QApplication::translate("FilterPage", "2", Q_NULLPTR));
- ___qtreewidgetitem->setText(0, QApplication::translate("FilterPage", "1", Q_NULLPTR));
- addButton->setText(QApplication::translate("FilterPage", "Add", Q_NULLPTR));
- removeButton->setText(QApplication::translate("FilterPage", "Remove", Q_NULLPTR));
+ ___qtreewidgetitem->setText(1, QApplication::translate("FilterPage", "2", nullptr));
+ ___qtreewidgetitem->setText(0, QApplication::translate("FilterPage", "1", nullptr));
+ addButton->setText(QApplication::translate("FilterPage", "Add", nullptr));
+ removeButton->setText(QApplication::translate("FilterPage", "Remove", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/finddialog.ui.h b/tests/auto/tools/uic/baseline/finddialog.ui.h
index de354627f0..4d7d1ac92c 100644
--- a/tests/auto/tools/uic/baseline/finddialog.ui.h
+++ b/tests/auto/tools/uic/baseline/finddialog.ui.h
@@ -196,40 +196,40 @@ public:
void retranslateUi(QDialog *FindDialog)
{
- FindDialog->setWindowTitle(QApplication::translate("FindDialog", "Find", Q_NULLPTR));
+ FindDialog->setWindowTitle(QApplication::translate("FindDialog", "Find", nullptr));
#ifndef QT_NO_WHATSTHIS
- FindDialog->setWhatsThis(QApplication::translate("FindDialog", "This window allows you to search for some text in the translation source file.", Q_NULLPTR));
+ FindDialog->setWhatsThis(QApplication::translate("FindDialog", "This window allows you to search for some text in the translation source file.", nullptr));
#endif // QT_NO_WHATSTHIS
- findWhat->setText(QApplication::translate("FindDialog", "&Find what:", Q_NULLPTR));
+ findWhat->setText(QApplication::translate("FindDialog", "&Find what:", nullptr));
#ifndef QT_NO_WHATSTHIS
- led->setWhatsThis(QApplication::translate("FindDialog", "Type in the text to search for.", Q_NULLPTR));
+ led->setWhatsThis(QApplication::translate("FindDialog", "Type in the text to search for.", nullptr));
#endif // QT_NO_WHATSTHIS
- groupBox->setTitle(QApplication::translate("FindDialog", "Options", Q_NULLPTR));
+ groupBox->setTitle(QApplication::translate("FindDialog", "Options", nullptr));
#ifndef QT_NO_WHATSTHIS
- sourceText->setWhatsThis(QApplication::translate("FindDialog", "Source texts are searched when checked.", Q_NULLPTR));
+ sourceText->setWhatsThis(QApplication::translate("FindDialog", "Source texts are searched when checked.", nullptr));
#endif // QT_NO_WHATSTHIS
- sourceText->setText(QApplication::translate("FindDialog", "&Source texts", Q_NULLPTR));
+ sourceText->setText(QApplication::translate("FindDialog", "&Source texts", nullptr));
#ifndef QT_NO_WHATSTHIS
- translations->setWhatsThis(QApplication::translate("FindDialog", "Translations are searched when checked.", Q_NULLPTR));
+ translations->setWhatsThis(QApplication::translate("FindDialog", "Translations are searched when checked.", nullptr));
#endif // QT_NO_WHATSTHIS
- translations->setText(QApplication::translate("FindDialog", "&Translations", Q_NULLPTR));
+ translations->setText(QApplication::translate("FindDialog", "&Translations", nullptr));
#ifndef QT_NO_WHATSTHIS
- matchCase->setWhatsThis(QApplication::translate("FindDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", Q_NULLPTR));
+ matchCase->setWhatsThis(QApplication::translate("FindDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr));
#endif // QT_NO_WHATSTHIS
- matchCase->setText(QApplication::translate("FindDialog", "&Match case", Q_NULLPTR));
+ matchCase->setText(QApplication::translate("FindDialog", "&Match case", nullptr));
#ifndef QT_NO_WHATSTHIS
- comments->setWhatsThis(QApplication::translate("FindDialog", "Comments and contexts are searched when checked.", Q_NULLPTR));
+ comments->setWhatsThis(QApplication::translate("FindDialog", "Comments and contexts are searched when checked.", nullptr));
#endif // QT_NO_WHATSTHIS
- comments->setText(QApplication::translate("FindDialog", "&Comments", Q_NULLPTR));
- ignoreAccelerators->setText(QApplication::translate("FindDialog", "Ignore &accelerators", Q_NULLPTR));
+ comments->setText(QApplication::translate("FindDialog", "&Comments", nullptr));
+ ignoreAccelerators->setText(QApplication::translate("FindDialog", "Ignore &accelerators", nullptr));
#ifndef QT_NO_WHATSTHIS
- findNxt->setWhatsThis(QApplication::translate("FindDialog", "Click here to find the next occurrence of the text you typed in.", Q_NULLPTR));
+ findNxt->setWhatsThis(QApplication::translate("FindDialog", "Click here to find the next occurrence of the text you typed in.", nullptr));
#endif // QT_NO_WHATSTHIS
- findNxt->setText(QApplication::translate("FindDialog", "Find Next", Q_NULLPTR));
+ findNxt->setText(QApplication::translate("FindDialog", "Find Next", nullptr));
#ifndef QT_NO_WHATSTHIS
- cancel->setWhatsThis(QApplication::translate("FindDialog", "Click here to close this window.", Q_NULLPTR));
+ cancel->setWhatsThis(QApplication::translate("FindDialog", "Click here to close this window.", nullptr));
#endif // QT_NO_WHATSTHIS
- cancel->setText(QApplication::translate("FindDialog", "Cancel", Q_NULLPTR));
+ cancel->setText(QApplication::translate("FindDialog", "Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/form.ui.h b/tests/auto/tools/uic/baseline/form.ui.h
index 89a08c2050..4cd134102c 100644
--- a/tests/auto/tools/uic/baseline/form.ui.h
+++ b/tests/auto/tools/uic/baseline/form.ui.h
@@ -126,9 +126,9 @@ public:
void retranslateUi(QWidget *WorldTimeForm)
{
- WorldTimeForm->setWindowTitle(QApplication::translate("WorldTimeForm", "World Time Clock", Q_NULLPTR));
- label->setText(QApplication::translate("WorldTimeForm", "Current time:", Q_NULLPTR));
- label_2->setText(QApplication::translate("WorldTimeForm", "Set time zone:", Q_NULLPTR));
+ WorldTimeForm->setWindowTitle(QApplication::translate("WorldTimeForm", "World Time Clock", nullptr));
+ label->setText(QApplication::translate("WorldTimeForm", "Current time:", nullptr));
+ label_2->setText(QApplication::translate("WorldTimeForm", "Set time zone:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/formwindowsettings.ui.h b/tests/auto/tools/uic/baseline/formwindowsettings.ui.h
index 2aafa8b6c0..77d0109548 100644
--- a/tests/auto/tools/uic/baseline/formwindowsettings.ui.h
+++ b/tests/auto/tools/uic/baseline/formwindowsettings.ui.h
@@ -274,17 +274,17 @@ public:
void retranslateUi(QDialog *FormWindowSettings)
{
- FormWindowSettings->setWindowTitle(QApplication::translate("FormWindowSettings", "Form Settings", Q_NULLPTR));
- layoutDefaultGroupBox->setTitle(QApplication::translate("FormWindowSettings", "Layout &Default", Q_NULLPTR));
- label_2->setText(QApplication::translate("FormWindowSettings", "&Spacing:", Q_NULLPTR));
- label->setText(QApplication::translate("FormWindowSettings", "&Margin:", Q_NULLPTR));
- layoutFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Layout Function", Q_NULLPTR));
- label_3->setText(QApplication::translate("FormWindowSettings", "Ma&rgin:", Q_NULLPTR));
- label_3_2->setText(QApplication::translate("FormWindowSettings", "Spa&cing:", Q_NULLPTR));
- pixmapFunctionGroupBox_2->setTitle(QApplication::translate("FormWindowSettings", "&Author", Q_NULLPTR));
- includeHintsGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Include Hints", Q_NULLPTR));
- pixmapFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Pixmap Function", Q_NULLPTR));
- gridPanel->setTitle(QApplication::translate("FormWindowSettings", "Grid", Q_NULLPTR));
+ FormWindowSettings->setWindowTitle(QApplication::translate("FormWindowSettings", "Form Settings", nullptr));
+ layoutDefaultGroupBox->setTitle(QApplication::translate("FormWindowSettings", "Layout &Default", nullptr));
+ label_2->setText(QApplication::translate("FormWindowSettings", "&Spacing:", nullptr));
+ label->setText(QApplication::translate("FormWindowSettings", "&Margin:", nullptr));
+ layoutFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Layout Function", nullptr));
+ label_3->setText(QApplication::translate("FormWindowSettings", "Ma&rgin:", nullptr));
+ label_3_2->setText(QApplication::translate("FormWindowSettings", "Spa&cing:", nullptr));
+ pixmapFunctionGroupBox_2->setTitle(QApplication::translate("FormWindowSettings", "&Author", nullptr));
+ includeHintsGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Include Hints", nullptr));
+ pixmapFunctionGroupBox->setTitle(QApplication::translate("FormWindowSettings", "&Pixmap Function", nullptr));
+ gridPanel->setTitle(QApplication::translate("FormWindowSettings", "Grid", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/generalpage.ui.h b/tests/auto/tools/uic/baseline/generalpage.ui.h
index 6cdc6f812e..3c36c75bfa 100644
--- a/tests/auto/tools/uic/baseline/generalpage.ui.h
+++ b/tests/auto/tools/uic/baseline/generalpage.ui.h
@@ -76,9 +76,9 @@ public:
void retranslateUi(QWidget *GeneralPage)
{
- GeneralPage->setWindowTitle(QApplication::translate("GeneralPage", "Form", Q_NULLPTR));
- label->setText(QApplication::translate("GeneralPage", "Namespace:", Q_NULLPTR));
- label_2->setText(QApplication::translate("GeneralPage", "Virtual Folder:", Q_NULLPTR));
+ GeneralPage->setWindowTitle(QApplication::translate("GeneralPage", "Form", nullptr));
+ label->setText(QApplication::translate("GeneralPage", "Namespace:", nullptr));
+ label_2->setText(QApplication::translate("GeneralPage", "Virtual Folder:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/gridalignment.ui.h b/tests/auto/tools/uic/baseline/gridalignment.ui.h
index 3513e0e727..f7f2d6372f 100644
--- a/tests/auto/tools/uic/baseline/gridalignment.ui.h
+++ b/tests/auto/tools/uic/baseline/gridalignment.ui.h
@@ -64,11 +64,11 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Form", Q_NULLPTR));
- pushButton->setText(QApplication::translate("Form", "Left", Q_NULLPTR));
- pushButton_3->setText(QApplication::translate("Form", "Top", Q_NULLPTR));
- pushButton_2->setText(QApplication::translate("Form", "Right", Q_NULLPTR));
- pushButton_4->setText(QApplication::translate("Form", "Bottom", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr));
+ pushButton->setText(QApplication::translate("Form", "Left", nullptr));
+ pushButton_3->setText(QApplication::translate("Form", "Top", nullptr));
+ pushButton_2->setText(QApplication::translate("Form", "Right", nullptr));
+ pushButton_4->setText(QApplication::translate("Form", "Bottom", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/gridpanel.ui.h b/tests/auto/tools/uic/baseline/gridpanel.ui.h
index 2c61c7228b..95437a27cf 100644
--- a/tests/auto/tools/uic/baseline/gridpanel.ui.h
+++ b/tests/auto/tools/uic/baseline/gridpanel.ui.h
@@ -135,14 +135,14 @@ public:
void retranslateUi(QWidget *qdesigner_internal__GridPanel)
{
- qdesigner_internal__GridPanel->setWindowTitle(QApplication::translate("qdesigner_internal::GridPanel", "Form", Q_NULLPTR));
- m_gridGroupBox->setTitle(QApplication::translate("qdesigner_internal::GridPanel", "Grid", Q_NULLPTR));
- m_visibleCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Visible", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &X", Q_NULLPTR));
- m_snapXCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", Q_NULLPTR));
- m_resetButton->setText(QApplication::translate("qdesigner_internal::GridPanel", "Reset", Q_NULLPTR));
- label_2->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &Y", Q_NULLPTR));
- m_snapYCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", Q_NULLPTR));
+ qdesigner_internal__GridPanel->setWindowTitle(QApplication::translate("qdesigner_internal::GridPanel", "Form", nullptr));
+ m_gridGroupBox->setTitle(QApplication::translate("qdesigner_internal::GridPanel", "Grid", nullptr));
+ m_visibleCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Visible", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &X", nullptr));
+ m_snapXCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr));
+ m_resetButton->setText(QApplication::translate("qdesigner_internal::GridPanel", "Reset", nullptr));
+ label_2->setText(QApplication::translate("qdesigner_internal::GridPanel", "Grid &Y", nullptr));
+ m_snapYCheckBox->setText(QApplication::translate("qdesigner_internal::GridPanel", "Snap", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/helpdialog.ui.h b/tests/auto/tools/uic/baseline/helpdialog.ui.h
index 77cc30314f..39f9852620 100644
--- a/tests/auto/tools/uic/baseline/helpdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/helpdialog.ui.h
@@ -298,77 +298,77 @@ public:
void retranslateUi(QWidget *HelpDialog)
{
- HelpDialog->setWindowTitle(QApplication::translate("HelpDialog", "Help", Q_NULLPTR));
+ HelpDialog->setWindowTitle(QApplication::translate("HelpDialog", "Help", nullptr));
#ifndef QT_NO_WHATSTHIS
- HelpDialog->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p>", Q_NULLPTR));
+ HelpDialog->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_WHATSTHIS
- tabWidget->setWhatsThis(QApplication::translate("HelpDialog", "Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.", Q_NULLPTR));
+ tabWidget->setWhatsThis(QApplication::translate("HelpDialog", "Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.", nullptr));
#endif // QT_NO_WHATSTHIS
QTreeWidgetItem *___qtreewidgetitem = listContents->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("HelpDialog", "column 1", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("HelpDialog", "column 1", nullptr));
#ifndef QT_NO_WHATSTHIS
- listContents->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p>", Q_NULLPTR));
+ listContents->setWhatsThis(QApplication::translate("HelpDialog", "<b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
- tabWidget->setTabText(tabWidget->indexOf(contentPage), QApplication::translate("HelpDialog", "Con&tents", Q_NULLPTR));
- TextLabel1->setText(QApplication::translate("HelpDialog", "&Look For:", Q_NULLPTR));
+ tabWidget->setTabText(tabWidget->indexOf(contentPage), QApplication::translate("HelpDialog", "Con&tents", nullptr));
+ TextLabel1->setText(QApplication::translate("HelpDialog", "&Look For:", nullptr));
#ifndef QT_NO_TOOLTIP
- editIndex->setToolTip(QApplication::translate("HelpDialog", "Enter keyword", Q_NULLPTR));
+ editIndex->setToolTip(QApplication::translate("HelpDialog", "Enter keyword", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- editIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p>", Q_NULLPTR));
+ editIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_WHATSTHIS
- listIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p>", Q_NULLPTR));
+ listIndex->setWhatsThis(QApplication::translate("HelpDialog", "<b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
- tabWidget->setTabText(tabWidget->indexOf(indexPage), QApplication::translate("HelpDialog", "&Index", Q_NULLPTR));
+ tabWidget->setTabText(tabWidget->indexOf(indexPage), QApplication::translate("HelpDialog", "&Index", nullptr));
QTreeWidgetItem *___qtreewidgetitem1 = listBookmarks->headerItem();
- ___qtreewidgetitem1->setText(0, QApplication::translate("HelpDialog", "column 1", Q_NULLPTR));
+ ___qtreewidgetitem1->setText(0, QApplication::translate("HelpDialog", "column 1", nullptr));
#ifndef QT_NO_WHATSTHIS
- listBookmarks->setWhatsThis(QApplication::translate("HelpDialog", "Displays the list of bookmarks.", Q_NULLPTR));
+ listBookmarks->setWhatsThis(QApplication::translate("HelpDialog", "Displays the list of bookmarks.", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_TOOLTIP
- buttonAdd->setToolTip(QApplication::translate("HelpDialog", "Add new bookmark", Q_NULLPTR));
+ buttonAdd->setToolTip(QApplication::translate("HelpDialog", "Add new bookmark", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- buttonAdd->setWhatsThis(QApplication::translate("HelpDialog", "Add the currently displayed page as a new bookmark.", Q_NULLPTR));
+ buttonAdd->setWhatsThis(QApplication::translate("HelpDialog", "Add the currently displayed page as a new bookmark.", nullptr));
#endif // QT_NO_WHATSTHIS
- buttonAdd->setText(QApplication::translate("HelpDialog", "&New", Q_NULLPTR));
+ buttonAdd->setText(QApplication::translate("HelpDialog", "&New", nullptr));
#ifndef QT_NO_TOOLTIP
- buttonRemove->setToolTip(QApplication::translate("HelpDialog", "Delete bookmark", Q_NULLPTR));
+ buttonRemove->setToolTip(QApplication::translate("HelpDialog", "Delete bookmark", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- buttonRemove->setWhatsThis(QApplication::translate("HelpDialog", "Delete the selected bookmark.", Q_NULLPTR));
+ buttonRemove->setWhatsThis(QApplication::translate("HelpDialog", "Delete the selected bookmark.", nullptr));
#endif // QT_NO_WHATSTHIS
- buttonRemove->setText(QApplication::translate("HelpDialog", "&Delete", Q_NULLPTR));
- tabWidget->setTabText(tabWidget->indexOf(bookmarkPage), QApplication::translate("HelpDialog", "&Bookmarks", Q_NULLPTR));
- TextLabel1_2->setText(QApplication::translate("HelpDialog", "Searching f&or:", Q_NULLPTR));
+ buttonRemove->setText(QApplication::translate("HelpDialog", "&Delete", nullptr));
+ tabWidget->setTabText(tabWidget->indexOf(bookmarkPage), QApplication::translate("HelpDialog", "&Bookmarks", nullptr));
+ TextLabel1_2->setText(QApplication::translate("HelpDialog", "Searching f&or:", nullptr));
#ifndef QT_NO_TOOLTIP
- termsEdit->setToolTip(QApplication::translate("HelpDialog", "Enter searchword(s).", Q_NULLPTR));
+ termsEdit->setToolTip(QApplication::translate("HelpDialog", "Enter searchword(s).", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- termsEdit->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p>", Q_NULLPTR));
+ termsEdit->setWhatsThis(QApplication::translate("HelpDialog", "<b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_WHATSTHIS
- resultBox->setWhatsThis(QApplication::translate("HelpDialog", "<b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p>", Q_NULLPTR));
+ resultBox->setWhatsThis(QApplication::translate("HelpDialog", "<b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p>", nullptr));
#endif // QT_NO_WHATSTHIS
- TextLabel2->setText(QApplication::translate("HelpDialog", "Found &Documents:", Q_NULLPTR));
+ TextLabel2->setText(QApplication::translate("HelpDialog", "Found &Documents:", nullptr));
#ifndef QT_NO_TOOLTIP
- helpButton->setToolTip(QApplication::translate("HelpDialog", "Display the help page.", Q_NULLPTR));
+ helpButton->setToolTip(QApplication::translate("HelpDialog", "Display the help page.", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- helpButton->setWhatsThis(QApplication::translate("HelpDialog", "Display the help page for the full text search.", Q_NULLPTR));
+ helpButton->setWhatsThis(QApplication::translate("HelpDialog", "Display the help page for the full text search.", nullptr));
#endif // QT_NO_WHATSTHIS
- helpButton->setText(QApplication::translate("HelpDialog", "He&lp", Q_NULLPTR));
+ helpButton->setText(QApplication::translate("HelpDialog", "He&lp", nullptr));
#ifndef QT_NO_TOOLTIP
- searchButton->setToolTip(QApplication::translate("HelpDialog", "Start searching.", Q_NULLPTR));
+ searchButton->setToolTip(QApplication::translate("HelpDialog", "Start searching.", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- searchButton->setWhatsThis(QApplication::translate("HelpDialog", "Pressing this button starts the search.", Q_NULLPTR));
+ searchButton->setWhatsThis(QApplication::translate("HelpDialog", "Pressing this button starts the search.", nullptr));
#endif // QT_NO_WHATSTHIS
- searchButton->setText(QApplication::translate("HelpDialog", "&Search", Q_NULLPTR));
- tabWidget->setTabText(tabWidget->indexOf(searchPage), QApplication::translate("HelpDialog", "&Search", Q_NULLPTR));
- labelPrepare->setText(QApplication::translate("HelpDialog", "Preparing...", Q_NULLPTR));
+ searchButton->setText(QApplication::translate("HelpDialog", "&Search", nullptr));
+ tabWidget->setTabText(tabWidget->indexOf(searchPage), QApplication::translate("HelpDialog", "&Search", nullptr));
+ labelPrepare->setText(QApplication::translate("HelpDialog", "Preparing...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/history.ui.h b/tests/auto/tools/uic/baseline/history.ui.h
index b0eccba5bc..ed0637bfcf 100644
--- a/tests/auto/tools/uic/baseline/history.ui.h
+++ b/tests/auto/tools/uic/baseline/history.ui.h
@@ -93,9 +93,9 @@ public:
void retranslateUi(QDialog *HistoryDialog)
{
- HistoryDialog->setWindowTitle(QApplication::translate("HistoryDialog", "History", Q_NULLPTR));
- removeButton->setText(QApplication::translate("HistoryDialog", "&Remove", Q_NULLPTR));
- removeAllButton->setText(QApplication::translate("HistoryDialog", "Remove &All", Q_NULLPTR));
+ HistoryDialog->setWindowTitle(QApplication::translate("HistoryDialog", "History", nullptr));
+ removeButton->setText(QApplication::translate("HistoryDialog", "&Remove", nullptr));
+ removeAllButton->setText(QApplication::translate("HistoryDialog", "Remove &All", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/icontheme.ui.h b/tests/auto/tools/uic/baseline/icontheme.ui.h
index f9cc837761..2724c7d147 100644
--- a/tests/auto/tools/uic/baseline/icontheme.ui.h
+++ b/tests/auto/tools/uic/baseline/icontheme.ui.h
@@ -77,10 +77,10 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Form", Q_NULLPTR));
- fileicon->setText(QApplication::translate("Form", "fileicon", Q_NULLPTR));
- fileandthemeicon->setText(QApplication::translate("Form", "PushButton", Q_NULLPTR));
- themeicon->setText(QApplication::translate("Form", "PushButton", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Form", nullptr));
+ fileicon->setText(QApplication::translate("Form", "fileicon", nullptr));
+ fileandthemeicon->setText(QApplication::translate("Form", "PushButton", nullptr));
+ themeicon->setText(QApplication::translate("Form", "PushButton", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/identifierpage.ui.h b/tests/auto/tools/uic/baseline/identifierpage.ui.h
index 68649a8a9e..fd77cc3f8c 100644
--- a/tests/auto/tools/uic/baseline/identifierpage.ui.h
+++ b/tests/auto/tools/uic/baseline/identifierpage.ui.h
@@ -92,10 +92,10 @@ public:
void retranslateUi(QWidget *IdentifierPage)
{
- IdentifierPage->setWindowTitle(QApplication::translate("IdentifierPage", "Form", Q_NULLPTR));
- identifierCheckBox->setText(QApplication::translate("IdentifierPage", "Create identifiers", Q_NULLPTR));
- globalButton->setText(QApplication::translate("IdentifierPage", "Global prefix:", Q_NULLPTR));
- fileNameButton->setText(QApplication::translate("IdentifierPage", "Inherit prefix from file names", Q_NULLPTR));
+ IdentifierPage->setWindowTitle(QApplication::translate("IdentifierPage", "Form", nullptr));
+ identifierCheckBox->setText(QApplication::translate("IdentifierPage", "Create identifiers", nullptr));
+ globalButton->setText(QApplication::translate("IdentifierPage", "Global prefix:", nullptr));
+ fileNameButton->setText(QApplication::translate("IdentifierPage", "Inherit prefix from file names", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/imagedialog.ui.h b/tests/auto/tools/uic/baseline/imagedialog.ui.h
index 9ce2a577f0..2b55d1f0ab 100644
--- a/tests/auto/tools/uic/baseline/imagedialog.ui.h
+++ b/tests/auto/tools/uic/baseline/imagedialog.ui.h
@@ -199,14 +199,14 @@ public:
void retranslateUi(QDialog *dialog)
{
- dialog->setWindowTitle(QApplication::translate("ImageDialog", "Create Image", Q_NULLPTR));
- widthLabel->setText(QApplication::translate("ImageDialog", "Width:", Q_NULLPTR));
- heightLabel->setText(QApplication::translate("ImageDialog", "Height:", Q_NULLPTR));
- nameLineEdit->setText(QApplication::translate("ImageDialog", "Untitled image", Q_NULLPTR));
- nameLabel->setText(QApplication::translate("ImageDialog", "Name:", Q_NULLPTR));
- colorDepthLabel->setText(QApplication::translate("ImageDialog", "Color depth:", Q_NULLPTR));
- okButton->setText(QApplication::translate("ImageDialog", "OK", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("ImageDialog", "Cancel", Q_NULLPTR));
+ dialog->setWindowTitle(QApplication::translate("ImageDialog", "Create Image", nullptr));
+ widthLabel->setText(QApplication::translate("ImageDialog", "Width:", nullptr));
+ heightLabel->setText(QApplication::translate("ImageDialog", "Height:", nullptr));
+ nameLineEdit->setText(QApplication::translate("ImageDialog", "Untitled image", nullptr));
+ nameLabel->setText(QApplication::translate("ImageDialog", "Name:", nullptr));
+ colorDepthLabel->setText(QApplication::translate("ImageDialog", "Color depth:", nullptr));
+ okButton->setText(QApplication::translate("ImageDialog", "OK", nullptr));
+ cancelButton->setText(QApplication::translate("ImageDialog", "Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/inputpage.ui.h b/tests/auto/tools/uic/baseline/inputpage.ui.h
index ad97dfcf85..542cf82b91 100644
--- a/tests/auto/tools/uic/baseline/inputpage.ui.h
+++ b/tests/auto/tools/uic/baseline/inputpage.ui.h
@@ -84,9 +84,9 @@ public:
void retranslateUi(QWidget *InputPage)
{
- InputPage->setWindowTitle(QApplication::translate("InputPage", "Form", Q_NULLPTR));
- label->setText(QApplication::translate("InputPage", "File name:", Q_NULLPTR));
- browseButton->setText(QApplication::translate("InputPage", "...", Q_NULLPTR));
+ InputPage->setWindowTitle(QApplication::translate("InputPage", "Form", nullptr));
+ label->setText(QApplication::translate("InputPage", "File name:", nullptr));
+ browseButton->setText(QApplication::translate("InputPage", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/installdialog.ui.h b/tests/auto/tools/uic/baseline/installdialog.ui.h
index 5bbd7b6f08..657e88712d 100644
--- a/tests/auto/tools/uic/baseline/installdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/installdialog.ui.h
@@ -123,13 +123,13 @@ public:
void retranslateUi(QDialog *InstallDialog)
{
- InstallDialog->setWindowTitle(QApplication::translate("InstallDialog", "Install Documentation", Q_NULLPTR));
- label->setText(QApplication::translate("InstallDialog", "Available Documentation:", Q_NULLPTR));
- installButton->setText(QApplication::translate("InstallDialog", "Install", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("InstallDialog", "Cancel", Q_NULLPTR));
- closeButton->setText(QApplication::translate("InstallDialog", "Close", Q_NULLPTR));
- label_4->setText(QApplication::translate("InstallDialog", "Installation Path:", Q_NULLPTR));
- browseButton->setText(QApplication::translate("InstallDialog", "...", Q_NULLPTR));
+ InstallDialog->setWindowTitle(QApplication::translate("InstallDialog", "Install Documentation", nullptr));
+ label->setText(QApplication::translate("InstallDialog", "Available Documentation:", nullptr));
+ installButton->setText(QApplication::translate("InstallDialog", "Install", nullptr));
+ cancelButton->setText(QApplication::translate("InstallDialog", "Cancel", nullptr));
+ closeButton->setText(QApplication::translate("InstallDialog", "Close", nullptr));
+ label_4->setText(QApplication::translate("InstallDialog", "Installation Path:", nullptr));
+ browseButton->setText(QApplication::translate("InstallDialog", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/languagesdialog.ui.h b/tests/auto/tools/uic/baseline/languagesdialog.ui.h
index 7d22656471..20e1ed857c 100644
--- a/tests/auto/tools/uic/baseline/languagesdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/languagesdialog.ui.h
@@ -109,39 +109,39 @@ public:
void retranslateUi(QDialog *LanguagesDialog)
{
- LanguagesDialog->setWindowTitle(QApplication::translate("LanguagesDialog", "Auxiliary Languages", Q_NULLPTR));
+ LanguagesDialog->setWindowTitle(QApplication::translate("LanguagesDialog", "Auxiliary Languages", nullptr));
QTreeWidgetItem *___qtreewidgetitem = languagesList->headerItem();
- ___qtreewidgetitem->setText(1, QApplication::translate("LanguagesDialog", "File", Q_NULLPTR));
- ___qtreewidgetitem->setText(0, QApplication::translate("LanguagesDialog", "Locale", Q_NULLPTR));
+ ___qtreewidgetitem->setText(1, QApplication::translate("LanguagesDialog", "File", nullptr));
+ ___qtreewidgetitem->setText(0, QApplication::translate("LanguagesDialog", "Locale", nullptr));
#ifndef QT_NO_TOOLTIP
upButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Move selected language up</p></body></html>", Q_NULLPTR));
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Move selected language up</p></body></html>", nullptr));
#endif // QT_NO_TOOLTIP
- upButton->setText(QApplication::translate("LanguagesDialog", "up", Q_NULLPTR));
+ upButton->setText(QApplication::translate("LanguagesDialog", "up", nullptr));
#ifndef QT_NO_TOOLTIP
downButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\">Move selected language down</p></body></html>", Q_NULLPTR));
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\">Move selected language down</p></body></html>", nullptr));
#endif // QT_NO_TOOLTIP
- downButton->setText(QApplication::translate("LanguagesDialog", "down", Q_NULLPTR));
+ downButton->setText(QApplication::translate("LanguagesDialog", "down", nullptr));
#ifndef QT_NO_TOOLTIP
removeButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Remove selected language</p></body></html>", Q_NULLPTR));
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Remove selected language</p></body></html>", nullptr));
#endif // QT_NO_TOOLTIP
- removeButton->setText(QApplication::translate("LanguagesDialog", "remove", Q_NULLPTR));
+ removeButton->setText(QApplication::translate("LanguagesDialog", "remove", nullptr));
#ifndef QT_NO_TOOLTIP
openFileButton->setToolTip(QApplication::translate("LanguagesDialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Open auxiliary language files</p></body></html>", Q_NULLPTR));
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Open auxiliary language files</p></body></html>", nullptr));
#endif // QT_NO_TOOLTIP
- openFileButton->setText(QApplication::translate("LanguagesDialog", "...", Q_NULLPTR));
- okButton->setText(QApplication::translate("LanguagesDialog", "OK", Q_NULLPTR));
+ openFileButton->setText(QApplication::translate("LanguagesDialog", "...", nullptr));
+ okButton->setText(QApplication::translate("LanguagesDialog", "OK", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h b/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h
index 2e18e6d71c..f3f09e2f1e 100644
--- a/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/listwidgeteditor.ui.h
@@ -175,28 +175,28 @@ public:
void retranslateUi(QDialog *qdesigner_internal__ListWidgetEditor)
{
- qdesigner_internal__ListWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Dialog", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", Q_NULLPTR));
+ qdesigner_internal__ListWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Dialog", nullptr));
+ groupBox->setTitle(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr));
#ifndef QT_NO_TOOLTIP
- listWidget->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", Q_NULLPTR));
+ listWidget->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Items List", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "New Item", Q_NULLPTR));
+ newItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "New Item", nullptr));
#endif // QT_NO_TOOLTIP
- newItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&New", Q_NULLPTR));
+ newItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&New", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Delete Item", Q_NULLPTR));
+ deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Delete Item", nullptr));
#endif // QT_NO_TOOLTIP
- deleteItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&Delete", Q_NULLPTR));
+ deleteItemButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "&Delete", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Up", Q_NULLPTR));
+ moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Up", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemUpButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "U", Q_NULLPTR));
+ moveItemUpButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "U", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Down", Q_NULLPTR));
+ moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Move Item Down", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemDownButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "D", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Icon", Q_NULLPTR));
+ moveItemDownButton->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "D", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::ListWidgetEditor", "Icon", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/mainwindow.ui.h b/tests/auto/tools/uic/baseline/mainwindow.ui.h
index 62b1e8766c..496b105e5d 100644
--- a/tests/auto/tools/uic/baseline/mainwindow.ui.h
+++ b/tests/auto/tools/uic/baseline/mainwindow.ui.h
@@ -363,30 +363,30 @@ public:
void retranslateUi(QMainWindow *MainWindow)
{
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MakeQPF", Q_NULLPTR));
- actionAdd_Custom_Font->setText(QApplication::translate("MainWindow", "&Add Custom Font...", Q_NULLPTR));
- action_Exit->setText(QApplication::translate("MainWindow", "&Exit", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("MainWindow", "Font Properties", Q_NULLPTR));
- label->setText(QApplication::translate("MainWindow", "Family:", Q_NULLPTR));
- label_2->setText(QApplication::translate("MainWindow", "Pixel Size:", Q_NULLPTR));
- label_7->setText(QApplication::translate("MainWindow", "Weight:", Q_NULLPTR));
- italic->setText(QApplication::translate("MainWindow", "Italic", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("MainWindow", "Glyph Coverage", Q_NULLPTR));
- chooseFromCodePoints->setText(QApplication::translate("MainWindow", "Choose from Unicode Codepoints:", Q_NULLPTR));
- selectAll->setText(QApplication::translate("MainWindow", "Select &All", Q_NULLPTR));
- deselectAll->setText(QApplication::translate("MainWindow", "&Deselect All", Q_NULLPTR));
- invertSelection->setText(QApplication::translate("MainWindow", "&Invert Selection", Q_NULLPTR));
- chooseFromSampleFile->setText(QApplication::translate("MainWindow", "Choose from Sample Text File (UTF-8 Encoded):", Q_NULLPTR));
- label_5->setText(QApplication::translate("MainWindow", "Path:", Q_NULLPTR));
- browseSampleFile->setText(QApplication::translate("MainWindow", "Browse...", Q_NULLPTR));
- charCount->setText(QApplication::translate("MainWindow", "TextLabel", Q_NULLPTR));
- groupBox_3->setTitle(QApplication::translate("MainWindow", "Preview", Q_NULLPTR));
- groupBox_4->setTitle(QApplication::translate("MainWindow", "Output Options", Q_NULLPTR));
- label_3->setText(QApplication::translate("MainWindow", "Path:", Q_NULLPTR));
- browsePath->setText(QApplication::translate("MainWindow", "Browse...", Q_NULLPTR));
- label_4->setText(QApplication::translate("MainWindow", "Filename:", Q_NULLPTR));
- generate->setText(QApplication::translate("MainWindow", "Generate Pre-Rendered Font...", Q_NULLPTR));
- menuFile->setTitle(QApplication::translate("MainWindow", "File", Q_NULLPTR));
+ MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MakeQPF", nullptr));
+ actionAdd_Custom_Font->setText(QApplication::translate("MainWindow", "&Add Custom Font...", nullptr));
+ action_Exit->setText(QApplication::translate("MainWindow", "&Exit", nullptr));
+ groupBox->setTitle(QApplication::translate("MainWindow", "Font Properties", nullptr));
+ label->setText(QApplication::translate("MainWindow", "Family:", nullptr));
+ label_2->setText(QApplication::translate("MainWindow", "Pixel Size:", nullptr));
+ label_7->setText(QApplication::translate("MainWindow", "Weight:", nullptr));
+ italic->setText(QApplication::translate("MainWindow", "Italic", nullptr));
+ groupBox_2->setTitle(QApplication::translate("MainWindow", "Glyph Coverage", nullptr));
+ chooseFromCodePoints->setText(QApplication::translate("MainWindow", "Choose from Unicode Codepoints:", nullptr));
+ selectAll->setText(QApplication::translate("MainWindow", "Select &All", nullptr));
+ deselectAll->setText(QApplication::translate("MainWindow", "&Deselect All", nullptr));
+ invertSelection->setText(QApplication::translate("MainWindow", "&Invert Selection", nullptr));
+ chooseFromSampleFile->setText(QApplication::translate("MainWindow", "Choose from Sample Text File (UTF-8 Encoded):", nullptr));
+ label_5->setText(QApplication::translate("MainWindow", "Path:", nullptr));
+ browseSampleFile->setText(QApplication::translate("MainWindow", "Browse...", nullptr));
+ charCount->setText(QApplication::translate("MainWindow", "TextLabel", nullptr));
+ groupBox_3->setTitle(QApplication::translate("MainWindow", "Preview", nullptr));
+ groupBox_4->setTitle(QApplication::translate("MainWindow", "Output Options", nullptr));
+ label_3->setText(QApplication::translate("MainWindow", "Path:", nullptr));
+ browsePath->setText(QApplication::translate("MainWindow", "Browse...", nullptr));
+ label_4->setText(QApplication::translate("MainWindow", "Filename:", nullptr));
+ generate->setText(QApplication::translate("MainWindow", "Generate Pre-Rendered Font...", nullptr));
+ menuFile->setTitle(QApplication::translate("MainWindow", "File", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/mydialog.ui.h b/tests/auto/tools/uic/baseline/mydialog.ui.h
index 279dd0e9bf..35b787b591 100644
--- a/tests/auto/tools/uic/baseline/mydialog.ui.h
+++ b/tests/auto/tools/uic/baseline/mydialog.ui.h
@@ -59,11 +59,11 @@ public:
void retranslateUi(QDialog *MyDialog)
{
- MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Mach 2!", Q_NULLPTR));
- aLabel->setText(QApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", Q_NULLPTR));
- aButton->setText(QApplication::translate("MyDialog", "&Quit", Q_NULLPTR));
+ MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Mach 2!", nullptr));
+ aLabel->setText(QApplication::translate("MyDialog", "Join the life in the fastlane; - PCH enable your project today! -", nullptr));
+ aButton->setText(QApplication::translate("MyDialog", "&Quit", nullptr));
#ifndef QT_NO_SHORTCUT
- aButton->setShortcut(QApplication::translate("MyDialog", "Alt+Q", Q_NULLPTR));
+ aButton->setShortcut(QApplication::translate("MyDialog", "Alt+Q", nullptr));
#endif // QT_NO_SHORTCUT
} // retranslateUi
diff --git a/tests/auto/tools/uic/baseline/myform.ui.h b/tests/auto/tools/uic/baseline/myform.ui.h
index 6e7873c5ad..eeddb03306 100644
--- a/tests/auto/tools/uic/baseline/myform.ui.h
+++ b/tests/auto/tools/uic/baseline/myform.ui.h
@@ -123,17 +123,17 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Export Document", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("Form", "Export Options", Q_NULLPTR));
- radioButton_2->setText(QApplication::translate("Form", "&DocBook", Q_NULLPTR));
- radioButton->setText(QApplication::translate("Form", "&LaTeX", Q_NULLPTR));
- checkBox_2->setText(QApplication::translate("Form", "Include p&ictures", Q_NULLPTR));
- checkBox->setText(QApplication::translate("Form", "&Compress", Q_NULLPTR));
- radioButton_2_2->setText(QApplication::translate("Form", "&HTML", Q_NULLPTR));
- radioButton_3->setText(QApplication::translate("Form", "&PostScript", Q_NULLPTR));
- radioButton_4->setText(QApplication::translate("Form", "PD&F", Q_NULLPTR));
- checkBox_3->setText(QApplication::translate("Form", "Include &metadata", Q_NULLPTR));
- checkBox_4->setText(QApplication::translate("Form", "Create inde&x", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Export Document", nullptr));
+ groupBox->setTitle(QApplication::translate("Form", "Export Options", nullptr));
+ radioButton_2->setText(QApplication::translate("Form", "&DocBook", nullptr));
+ radioButton->setText(QApplication::translate("Form", "&LaTeX", nullptr));
+ checkBox_2->setText(QApplication::translate("Form", "Include p&ictures", nullptr));
+ checkBox->setText(QApplication::translate("Form", "&Compress", nullptr));
+ radioButton_2_2->setText(QApplication::translate("Form", "&HTML", nullptr));
+ radioButton_3->setText(QApplication::translate("Form", "&PostScript", nullptr));
+ radioButton_4->setText(QApplication::translate("Form", "PD&F", nullptr));
+ checkBox_3->setText(QApplication::translate("Form", "Include &metadata", nullptr));
+ checkBox_4->setText(QApplication::translate("Form", "Create inde&x", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/newactiondialog.ui.h b/tests/auto/tools/uic/baseline/newactiondialog.ui.h
index 14c215c972..a2dbb6e8c2 100644
--- a/tests/auto/tools/uic/baseline/newactiondialog.ui.h
+++ b/tests/auto/tools/uic/baseline/newactiondialog.ui.h
@@ -162,10 +162,10 @@ public:
void retranslateUi(QDialog *qdesigner_internal__NewActionDialog)
{
- qdesigner_internal__NewActionDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewActionDialog", "New Action...", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Text:", Q_NULLPTR));
- label_3->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "Object &name:", Q_NULLPTR));
- label_2->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Icon:", Q_NULLPTR));
+ qdesigner_internal__NewActionDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewActionDialog", "New Action...", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Text:", nullptr));
+ label_3->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "Object &name:", nullptr));
+ label_2->setText(QApplication::translate("qdesigner_internal::NewActionDialog", "&Icon:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h
index 43a7250737..85109748e4 100644
--- a/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h
+++ b/tests/auto/tools/uic/baseline/newdynamicpropertydialog.ui.h
@@ -111,9 +111,9 @@ public:
void retranslateUi(QDialog *qdesigner_internal__NewDynamicPropertyDialog)
{
- qdesigner_internal__NewDynamicPropertyDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Create Dynamic Property", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Name", Q_NULLPTR));
- label_2->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Type", Q_NULLPTR));
+ qdesigner_internal__NewDynamicPropertyDialog->setWindowTitle(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Create Dynamic Property", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Name", nullptr));
+ label_2->setText(QApplication::translate("qdesigner_internal::NewDynamicPropertyDialog", "Property Type", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/newform.ui.h b/tests/auto/tools/uic/baseline/newform.ui.h
index 438a537580..34b5b1a3eb 100644
--- a/tests/auto/tools/uic/baseline/newform.ui.h
+++ b/tests/auto/tools/uic/baseline/newform.ui.h
@@ -134,11 +134,11 @@ public:
void retranslateUi(QDialog *NewForm)
{
- NewForm->setWindowTitle(QApplication::translate("NewForm", "New Form", Q_NULLPTR));
+ NewForm->setWindowTitle(QApplication::translate("NewForm", "New Form", nullptr));
QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("NewForm", "0", Q_NULLPTR));
- lblPreview->setText(QApplication::translate("NewForm", "Choose a template for a preview", Q_NULLPTR));
- chkShowOnStartup->setText(QApplication::translate("NewForm", "Show this Dialog on Startup", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("NewForm", "0", nullptr));
+ lblPreview->setText(QApplication::translate("NewForm", "Choose a template for a preview", nullptr));
+ chkShowOnStartup->setText(QApplication::translate("NewForm", "Show this Dialog on Startup", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/orderdialog.ui.h b/tests/auto/tools/uic/baseline/orderdialog.ui.h
index 483db65de2..eb1f90d23b 100644
--- a/tests/auto/tools/uic/baseline/orderdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/orderdialog.ui.h
@@ -133,13 +133,13 @@ public:
void retranslateUi(QDialog *qdesigner_internal__OrderDialog)
{
- qdesigner_internal__OrderDialog->setWindowTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Change Page Order", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Page Order", Q_NULLPTR));
+ qdesigner_internal__OrderDialog->setWindowTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Change Page Order", nullptr));
+ groupBox->setTitle(QApplication::translate("qdesigner_internal::OrderDialog", "Page Order", nullptr));
#ifndef QT_NO_TOOLTIP
- upButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page up", Q_NULLPTR));
+ upButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page up", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- downButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page down", Q_NULLPTR));
+ downButton->setToolTip(QApplication::translate("qdesigner_internal::OrderDialog", "Move page down", nullptr));
#endif // QT_NO_TOOLTIP
} // retranslateUi
diff --git a/tests/auto/tools/uic/baseline/outputpage.ui.h b/tests/auto/tools/uic/baseline/outputpage.ui.h
index 6d0c392f7e..9648be0ed4 100644
--- a/tests/auto/tools/uic/baseline/outputpage.ui.h
+++ b/tests/auto/tools/uic/baseline/outputpage.ui.h
@@ -90,9 +90,9 @@ public:
void retranslateUi(QWidget *OutputPage)
{
- OutputPage->setWindowTitle(QApplication::translate("OutputPage", "Form", Q_NULLPTR));
- label->setText(QApplication::translate("OutputPage", "Project file name:", Q_NULLPTR));
- label_2->setText(QApplication::translate("OutputPage", "Collection file name:", Q_NULLPTR));
+ OutputPage->setWindowTitle(QApplication::translate("OutputPage", "Form", nullptr));
+ label->setText(QApplication::translate("OutputPage", "Project file name:", nullptr));
+ label_2->setText(QApplication::translate("OutputPage", "Collection file name:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/pagefold.ui.h b/tests/auto/tools/uic/baseline/pagefold.ui.h
index b82c8d7fbd..255ed41400 100644
--- a/tests/auto/tools/uic/baseline/pagefold.ui.h
+++ b/tests/auto/tools/uic/baseline/pagefold.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'pagefold.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -102,6 +102,10 @@ public:
#endif
gridLayout->setObjectName(QStringLiteral("gridLayout"));
nameCombo = new QComboBox(mainFrame);
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
+ nameCombo->addItem(QString());
nameCombo->setObjectName(QStringLiteral("nameCombo"));
nameCombo->setEditable(true);
@@ -180,6 +184,13 @@ public:
gridLayout->addWidget(label, 5, 0, 1, 1);
countryCombo = new QComboBox(mainFrame);
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
+ countryCombo->addItem(QString());
countryCombo->setObjectName(QStringLiteral("countryCombo"));
gridLayout->addWidget(countryCombo, 4, 1, 1, 3);
@@ -233,88 +244,84 @@ public:
void retranslateUi(QMainWindow *MainWindow)
{
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR));
- exitAction->setText(QApplication::translate("MainWindow", "&Exit", Q_NULLPTR));
- aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", Q_NULLPTR));
- editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", Q_NULLPTR));
- aboutAction->setText(QApplication::translate("MainWindow", "About", Q_NULLPTR));
- nameCombo->clear();
- nameCombo->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Girish", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Jasmin", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Simon", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Zack", Q_NULLPTR)
- );
+ MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", nullptr));
+ exitAction->setText(QApplication::translate("MainWindow", "&Exit", nullptr));
+ aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", nullptr));
+ editStyleAction->setText(QApplication::translate("MainWindow", "Edit &Style", nullptr));
+ aboutAction->setText(QApplication::translate("MainWindow", "About", nullptr));
+ nameCombo->setItemText(0, QApplication::translate("MainWindow", "Girish", nullptr));
+ nameCombo->setItemText(1, QApplication::translate("MainWindow", "Jasmin", nullptr));
+ nameCombo->setItemText(2, QApplication::translate("MainWindow", "Simon", nullptr));
+ nameCombo->setItemText(3, QApplication::translate("MainWindow", "Zack", nullptr));
+
#ifndef QT_NO_TOOLTIP
- nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", Q_NULLPTR));
+ nameCombo->setToolTip(QApplication::translate("MainWindow", "Specify your name", nullptr));
#endif // QT_NO_TOOLTIP
- femaleRadioButton->setStyleSheet(QApplication::translate("MainWindow", "Check this if you are female", Q_NULLPTR));
- femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", Q_NULLPTR));
- genderLabel->setText(QApplication::translate("MainWindow", "Gender:", Q_NULLPTR));
- ageLabel->setText(QApplication::translate("MainWindow", "&Age:", Q_NULLPTR));
+ femaleRadioButton->setStyleSheet(QApplication::translate("MainWindow", "Check this if you are female", nullptr));
+ femaleRadioButton->setText(QApplication::translate("MainWindow", "&Female", nullptr));
+ genderLabel->setText(QApplication::translate("MainWindow", "Gender:", nullptr));
+ ageLabel->setText(QApplication::translate("MainWindow", "&Age:", nullptr));
#ifndef QT_NO_TOOLTIP
- maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", Q_NULLPTR));
+ maleRadioButton->setToolTip(QApplication::translate("MainWindow", "Check this if you are male", nullptr));
#endif // QT_NO_TOOLTIP
- maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", Q_NULLPTR));
- nameLabel->setText(QApplication::translate("MainWindow", "&Name:", Q_NULLPTR));
- passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", Q_NULLPTR));
+ maleRadioButton->setText(QApplication::translate("MainWindow", "&Male", nullptr));
+ nameLabel->setText(QApplication::translate("MainWindow", "&Name:", nullptr));
+ passwordLabel->setText(QApplication::translate("MainWindow", "&Password:", nullptr));
#ifndef QT_NO_TOOLTIP
- ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", Q_NULLPTR));
+ ageSpinBox->setToolTip(QApplication::translate("MainWindow", "Specify your age", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age", Q_NULLPTR));
+ ageSpinBox->setStatusTip(QApplication::translate("MainWindow", "Specify your age", nullptr));
#endif // QT_NO_STATUSTIP
#ifndef QT_NO_TOOLTIP
- agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the LICENSE file before checking", Q_NULLPTR));
+ agreeCheckBox->setToolTip(QApplication::translate("MainWindow", "Please read the LICENSE file before checking", nullptr));
#endif // QT_NO_TOOLTIP
- agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and &conditions", Q_NULLPTR));
+ agreeCheckBox->setText(QApplication::translate("MainWindow", "I &accept the terms and &conditions", nullptr));
#ifndef QT_NO_TOOLTIP
- passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", Q_NULLPTR));
+ passwordEdit->setToolTip(QApplication::translate("MainWindow", "Specify your password", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password", Q_NULLPTR));
+ passwordEdit->setStatusTip(QApplication::translate("MainWindow", "Specify your password", nullptr));
#endif // QT_NO_STATUSTIP
- passwordEdit->setText(QApplication::translate("MainWindow", "Password", Q_NULLPTR));
+ passwordEdit->setText(QApplication::translate("MainWindow", "Password", nullptr));
const bool __sortingEnabled = professionList->isSortingEnabled();
professionList->setSortingEnabled(false);
QListWidgetItem *___qlistwidgetitem = professionList->item(0);
- ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", Q_NULLPTR));
+ ___qlistwidgetitem->setText(QApplication::translate("MainWindow", "Developer", nullptr));
QListWidgetItem *___qlistwidgetitem1 = professionList->item(1);
- ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", Q_NULLPTR));
+ ___qlistwidgetitem1->setText(QApplication::translate("MainWindow", "Student", nullptr));
QListWidgetItem *___qlistwidgetitem2 = professionList->item(2);
- ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", Q_NULLPTR));
+ ___qlistwidgetitem2->setText(QApplication::translate("MainWindow", "Fisherman", nullptr));
professionList->setSortingEnabled(__sortingEnabled);
#ifndef QT_NO_TOOLTIP
- professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", Q_NULLPTR));
+ professionList->setToolTip(QApplication::translate("MainWindow", "Select your profession", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- professionList->setStatusTip(QApplication::translate("MainWindow", "Specify your name here", Q_NULLPTR));
+ professionList->setStatusTip(QApplication::translate("MainWindow", "Specify your name here", nullptr));
#endif // QT_NO_STATUSTIP
#ifndef QT_NO_WHATSTHIS
- professionList->setWhatsThis(QApplication::translate("MainWindow", "Specify your name here", Q_NULLPTR));
+ professionList->setWhatsThis(QApplication::translate("MainWindow", "Specify your name here", nullptr));
#endif // QT_NO_WHATSTHIS
- label->setText(QApplication::translate("MainWindow", "Profession:", Q_NULLPTR));
- countryCombo->clear();
- countryCombo->insertItems(0, QStringList()
- << QApplication::translate("MainWindow", "Egypt", Q_NULLPTR)
- << QApplication::translate("MainWindow", "France", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Germany", Q_NULLPTR)
- << QApplication::translate("MainWindow", "India", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Italy", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Korea", Q_NULLPTR)
- << QApplication::translate("MainWindow", "Norway", Q_NULLPTR)
- );
+ label->setText(QApplication::translate("MainWindow", "Profession:", nullptr));
+ countryCombo->setItemText(0, QApplication::translate("MainWindow", "Egypt", nullptr));
+ countryCombo->setItemText(1, QApplication::translate("MainWindow", "France", nullptr));
+ countryCombo->setItemText(2, QApplication::translate("MainWindow", "Germany", nullptr));
+ countryCombo->setItemText(3, QApplication::translate("MainWindow", "India", nullptr));
+ countryCombo->setItemText(4, QApplication::translate("MainWindow", "Italy", nullptr));
+ countryCombo->setItemText(5, QApplication::translate("MainWindow", "Korea", nullptr));
+ countryCombo->setItemText(6, QApplication::translate("MainWindow", "Norway", nullptr));
+
#ifndef QT_NO_TOOLTIP
- countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify country of origin", Q_NULLPTR));
+ countryCombo->setToolTip(QApplication::translate("MainWindow", "Specify country of origin", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
- countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify country of origin", Q_NULLPTR));
+ countryCombo->setStatusTip(QApplication::translate("MainWindow", "Specify country of origin", nullptr));
#endif // QT_NO_STATUSTIP
- countryLabel->setText(QApplication::translate("MainWindow", "Pro&fession", Q_NULLPTR));
- menu_File->setTitle(QApplication::translate("MainWindow", "&File", Q_NULLPTR));
- menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", Q_NULLPTR));
+ countryLabel->setText(QApplication::translate("MainWindow", "Pro&fession", nullptr));
+ menu_File->setTitle(QApplication::translate("MainWindow", "&File", nullptr));
+ menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/paletteeditor.ui.h b/tests/auto/tools/uic/baseline/paletteeditor.ui.h
index 17edb548ef..c91658a4bf 100644
--- a/tests/auto/tools/uic/baseline/paletteeditor.ui.h
+++ b/tests/auto/tools/uic/baseline/paletteeditor.ui.h
@@ -199,16 +199,16 @@ public:
void retranslateUi(QDialog *qdesigner_internal__PaletteEditor)
{
- qdesigner_internal__PaletteEditor->setWindowTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Edit Palette", Q_NULLPTR));
- advancedBox->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Tune Palette", Q_NULLPTR));
+ qdesigner_internal__PaletteEditor->setWindowTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Edit Palette", nullptr));
+ advancedBox->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Tune Palette", nullptr));
buildButton->setText(QString());
- detailsRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Show Details", Q_NULLPTR));
- computeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Compute Details", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Quick", Q_NULLPTR));
- GroupBox126->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Preview", Q_NULLPTR));
- disabledRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Disabled", Q_NULLPTR));
- inactiveRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Inactive", Q_NULLPTR));
- activeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Active", Q_NULLPTR));
+ detailsRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Show Details", nullptr));
+ computeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Compute Details", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Quick", nullptr));
+ GroupBox126->setTitle(QApplication::translate("qdesigner_internal::PaletteEditor", "Preview", nullptr));
+ disabledRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Disabled", nullptr));
+ inactiveRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Inactive", nullptr));
+ activeRadio->setText(QApplication::translate("qdesigner_internal::PaletteEditor", "Active", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/passworddialog.ui.h b/tests/auto/tools/uic/baseline/passworddialog.ui.h
index a9c9ed842f..9d42642b93 100644
--- a/tests/auto/tools/uic/baseline/passworddialog.ui.h
+++ b/tests/auto/tools/uic/baseline/passworddialog.ui.h
@@ -101,11 +101,11 @@ public:
void retranslateUi(QDialog *PasswordDialog)
{
- PasswordDialog->setWindowTitle(QApplication::translate("PasswordDialog", "Authentication Required", Q_NULLPTR));
- iconLabel->setText(QApplication::translate("PasswordDialog", "DUMMY ICON", Q_NULLPTR));
- introLabel->setText(QApplication::translate("PasswordDialog", "INTRO TEXT DUMMY", Q_NULLPTR));
- label->setText(QApplication::translate("PasswordDialog", "Username:", Q_NULLPTR));
- lblPassword->setText(QApplication::translate("PasswordDialog", "Password:", Q_NULLPTR));
+ PasswordDialog->setWindowTitle(QApplication::translate("PasswordDialog", "Authentication Required", nullptr));
+ iconLabel->setText(QApplication::translate("PasswordDialog", "DUMMY ICON", nullptr));
+ introLabel->setText(QApplication::translate("PasswordDialog", "INTRO TEXT DUMMY", nullptr));
+ label->setText(QApplication::translate("PasswordDialog", "Username:", nullptr));
+ lblPassword->setText(QApplication::translate("PasswordDialog", "Password:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/pathpage.ui.h b/tests/auto/tools/uic/baseline/pathpage.ui.h
index 10a11d5fbd..49a2c56f2e 100644
--- a/tests/auto/tools/uic/baseline/pathpage.ui.h
+++ b/tests/auto/tools/uic/baseline/pathpage.ui.h
@@ -107,11 +107,11 @@ public:
void retranslateUi(QWidget *PathPage)
{
- PathPage->setWindowTitle(QApplication::translate("PathPage", "Form", Q_NULLPTR));
- label_2->setText(QApplication::translate("PathPage", "File filters:", Q_NULLPTR));
- label->setText(QApplication::translate("PathPage", "Documentation source file paths:", Q_NULLPTR));
- addButton->setText(QApplication::translate("PathPage", "Add", Q_NULLPTR));
- removeButton->setText(QApplication::translate("PathPage", "Remove", Q_NULLPTR));
+ PathPage->setWindowTitle(QApplication::translate("PathPage", "Form", nullptr));
+ label_2->setText(QApplication::translate("PathPage", "File filters:", nullptr));
+ label->setText(QApplication::translate("PathPage", "Documentation source file paths:", nullptr));
+ addButton->setText(QApplication::translate("PathPage", "Add", nullptr));
+ removeButton->setText(QApplication::translate("PathPage", "Remove", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/phrasebookbox.ui.h b/tests/auto/tools/uic/baseline/phrasebookbox.ui.h
index cc8963fcae..7f2c052f63 100644
--- a/tests/auto/tools/uic/baseline/phrasebookbox.ui.h
+++ b/tests/auto/tools/uic/baseline/phrasebookbox.ui.h
@@ -186,38 +186,38 @@ public:
void retranslateUi(QDialog *PhraseBookBox)
{
- PhraseBookBox->setWindowTitle(QApplication::translate("PhraseBookBox", "Edit Phrase Book", Q_NULLPTR));
+ PhraseBookBox->setWindowTitle(QApplication::translate("PhraseBookBox", "Edit Phrase Book", nullptr));
#ifndef QT_NO_WHATSTHIS
- PhraseBookBox->setWhatsThis(QApplication::translate("PhraseBookBox", "This window allows you to add, modify, or delete phrases in a phrase book.", Q_NULLPTR));
+ PhraseBookBox->setWhatsThis(QApplication::translate("PhraseBookBox", "This window allows you to add, modify, or delete phrases in a phrase book.", nullptr));
#endif // QT_NO_WHATSTHIS
- target->setText(QApplication::translate("PhraseBookBox", "&Translation:", Q_NULLPTR));
+ target->setText(QApplication::translate("PhraseBookBox", "&Translation:", nullptr));
#ifndef QT_NO_WHATSTHIS
- targetLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the target language corresponding to the source phrase.", Q_NULLPTR));
+ targetLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the target language corresponding to the source phrase.", nullptr));
#endif // QT_NO_WHATSTHIS
- source->setText(QApplication::translate("PhraseBookBox", "S&ource phrase:", Q_NULLPTR));
+ source->setText(QApplication::translate("PhraseBookBox", "S&ource phrase:", nullptr));
#ifndef QT_NO_WHATSTHIS
- definitionLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is a definition for the source phrase.", Q_NULLPTR));
+ definitionLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is a definition for the source phrase.", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_WHATSTHIS
- sourceLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the source language.", Q_NULLPTR));
+ sourceLed->setWhatsThis(QApplication::translate("PhraseBookBox", "This is the phrase in the source language.", nullptr));
#endif // QT_NO_WHATSTHIS
- definition->setText(QApplication::translate("PhraseBookBox", "&Definition:", Q_NULLPTR));
+ definition->setText(QApplication::translate("PhraseBookBox", "&Definition:", nullptr));
#ifndef QT_NO_WHATSTHIS
- newBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to add the phrase to the phrase book.", Q_NULLPTR));
+ newBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to add the phrase to the phrase book.", nullptr));
#endif // QT_NO_WHATSTHIS
- newBut->setText(QApplication::translate("PhraseBookBox", "&New Phrase", Q_NULLPTR));
+ newBut->setText(QApplication::translate("PhraseBookBox", "&New Phrase", nullptr));
#ifndef QT_NO_WHATSTHIS
- removeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to remove the phrase from the phrase book.", Q_NULLPTR));
+ removeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to remove the phrase from the phrase book.", nullptr));
#endif // QT_NO_WHATSTHIS
- removeBut->setText(QApplication::translate("PhraseBookBox", "&Remove Phrase", Q_NULLPTR));
+ removeBut->setText(QApplication::translate("PhraseBookBox", "&Remove Phrase", nullptr));
#ifndef QT_NO_WHATSTHIS
- saveBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to save the changes made.", Q_NULLPTR));
+ saveBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to save the changes made.", nullptr));
#endif // QT_NO_WHATSTHIS
- saveBut->setText(QApplication::translate("PhraseBookBox", "&Save", Q_NULLPTR));
+ saveBut->setText(QApplication::translate("PhraseBookBox", "&Save", nullptr));
#ifndef QT_NO_WHATSTHIS
- closeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to close this window.", Q_NULLPTR));
+ closeBut->setWhatsThis(QApplication::translate("PhraseBookBox", "Click here to close this window.", nullptr));
#endif // QT_NO_WHATSTHIS
- closeBut->setText(QApplication::translate("PhraseBookBox", "Close", Q_NULLPTR));
+ closeBut->setText(QApplication::translate("PhraseBookBox", "Close", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/plugindialog.ui.h b/tests/auto/tools/uic/baseline/plugindialog.ui.h
index d8b034b9ee..56228c0fea 100644
--- a/tests/auto/tools/uic/baseline/plugindialog.ui.h
+++ b/tests/auto/tools/uic/baseline/plugindialog.ui.h
@@ -113,11 +113,11 @@ public:
void retranslateUi(QDialog *PluginDialog)
{
- PluginDialog->setWindowTitle(QApplication::translate("PluginDialog", "Plugin Information", Q_NULLPTR));
- label->setText(QApplication::translate("PluginDialog", "TextLabel", Q_NULLPTR));
+ PluginDialog->setWindowTitle(QApplication::translate("PluginDialog", "Plugin Information", nullptr));
+ label->setText(QApplication::translate("PluginDialog", "TextLabel", nullptr));
QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("PluginDialog", "1", Q_NULLPTR));
- message->setText(QApplication::translate("PluginDialog", "TextLabel", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("PluginDialog", "1", nullptr));
+ message->setText(QApplication::translate("PluginDialog", "TextLabel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/preferencesdialog.ui.h b/tests/auto/tools/uic/baseline/preferencesdialog.ui.h
index 078d13a7f5..3f7a23f970 100644
--- a/tests/auto/tools/uic/baseline/preferencesdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/preferencesdialog.ui.h
@@ -153,11 +153,11 @@ public:
void retranslateUi(QDialog *PreferencesDialog)
{
- PreferencesDialog->setWindowTitle(QApplication::translate("PreferencesDialog", "Preferences", Q_NULLPTR));
- m_uiModeGroupBox->setTitle(QApplication::translate("PreferencesDialog", "User Interface Mode", Q_NULLPTR));
- m_templatePathGroupBox->setTitle(QApplication::translate("PreferencesDialog", "Additional Template Paths", Q_NULLPTR));
- m_addTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", Q_NULLPTR));
- m_removeTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", Q_NULLPTR));
+ PreferencesDialog->setWindowTitle(QApplication::translate("PreferencesDialog", "Preferences", nullptr));
+ m_uiModeGroupBox->setTitle(QApplication::translate("PreferencesDialog", "User Interface Mode", nullptr));
+ m_templatePathGroupBox->setTitle(QApplication::translate("PreferencesDialog", "Additional Template Paths", nullptr));
+ m_addTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", nullptr));
+ m_removeTemplatePathButton->setText(QApplication::translate("PreferencesDialog", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h
index 3209e203e8..3ed75ec2b5 100644
--- a/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h
+++ b/tests/auto/tools/uic/baseline/previewconfigurationwidget.ui.h
@@ -111,14 +111,14 @@ public:
void retranslateUi(QGroupBox *PreviewConfigurationWidget)
{
- PreviewConfigurationWidget->setWindowTitle(QApplication::translate("PreviewConfigurationWidget", "Form", Q_NULLPTR));
- PreviewConfigurationWidget->setTitle(QApplication::translate("PreviewConfigurationWidget", "Print/Preview Configuration", Q_NULLPTR));
- m_styleLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style", Q_NULLPTR));
- m_appStyleSheetLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style sheet", Q_NULLPTR));
- m_appStyleSheetChangeButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", Q_NULLPTR));
- m_appStyleSheetClearButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", Q_NULLPTR));
- m_skinLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Device skin", Q_NULLPTR));
- m_skinRemoveButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", Q_NULLPTR));
+ PreviewConfigurationWidget->setWindowTitle(QApplication::translate("PreviewConfigurationWidget", "Form", nullptr));
+ PreviewConfigurationWidget->setTitle(QApplication::translate("PreviewConfigurationWidget", "Print/Preview Configuration", nullptr));
+ m_styleLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style", nullptr));
+ m_appStyleSheetLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Style sheet", nullptr));
+ m_appStyleSheetChangeButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr));
+ m_appStyleSheetClearButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr));
+ m_skinLabel->setText(QApplication::translate("PreviewConfigurationWidget", "Device skin", nullptr));
+ m_skinRemoveButton->setText(QApplication::translate("PreviewConfigurationWidget", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/previewdialogbase.ui.h b/tests/auto/tools/uic/baseline/previewdialogbase.ui.h
index de046d575a..b379d9195f 100644
--- a/tests/auto/tools/uic/baseline/previewdialogbase.ui.h
+++ b/tests/auto/tools/uic/baseline/previewdialogbase.ui.h
@@ -172,11 +172,11 @@ public:
void retranslateUi(QDialog *PreviewDialogBase)
{
- PreviewDialogBase->setWindowTitle(QApplication::translate("PreviewDialogBase", "Print Preview", Q_NULLPTR));
- label->setText(QApplication::translate("PreviewDialogBase", "&Paper Size:", Q_NULLPTR));
- label_2->setText(QApplication::translate("PreviewDialogBase", "&Orientation:", Q_NULLPTR));
+ PreviewDialogBase->setWindowTitle(QApplication::translate("PreviewDialogBase", "Print Preview", nullptr));
+ label->setText(QApplication::translate("PreviewDialogBase", "&Paper Size:", nullptr));
+ label_2->setText(QApplication::translate("PreviewDialogBase", "&Orientation:", nullptr));
QTreeWidgetItem *___qtreewidgetitem = pageList->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("PreviewDialogBase", "1", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("PreviewDialogBase", "1", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/previewwidget.ui.h b/tests/auto/tools/uic/baseline/previewwidget.ui.h
index 1fb96c8c70..7bfcbac86a 100644
--- a/tests/auto/tools/uic/baseline/previewwidget.ui.h
+++ b/tests/auto/tools/uic/baseline/previewwidget.ui.h
@@ -31,7 +31,7 @@
/********************************************************************************
** Form generated from reading UI file 'previewwidget.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -122,6 +122,7 @@ public:
vboxLayout->addWidget(LineEdit1);
ComboBox1 = new QComboBox(qdesigner_internal__PreviewWidget);
+ ComboBox1->addItem(QString());
ComboBox1->setObjectName(QStringLiteral("ComboBox1"));
vboxLayout->addWidget(ComboBox1);
@@ -237,20 +238,18 @@ public:
void retranslateUi(QWidget *qdesigner_internal__PreviewWidget)
{
- qdesigner_internal__PreviewWidget->setWindowTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "Preview Window", Q_NULLPTR));
- LineEdit1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "LineEdit", Q_NULLPTR));
- ComboBox1->clear();
- ComboBox1->insertItems(0, QStringList()
- << QApplication::translate("qdesigner_internal::PreviewWidget", "ComboBox", Q_NULLPTR)
- );
- PushButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "PushButton", Q_NULLPTR));
- ButtonGroup2->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup2", Q_NULLPTR));
- CheckBox1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox1", Q_NULLPTR));
- CheckBox2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox2", Q_NULLPTR));
- ButtonGroup1->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup", Q_NULLPTR));
- RadioButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton1", Q_NULLPTR));
- RadioButton2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton2", Q_NULLPTR));
- RadioButton3->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton3", Q_NULLPTR));
+ qdesigner_internal__PreviewWidget->setWindowTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "Preview Window", nullptr));
+ LineEdit1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "LineEdit", nullptr));
+ ComboBox1->setItemText(0, QApplication::translate("qdesigner_internal::PreviewWidget", "ComboBox", nullptr));
+
+ PushButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "PushButton", nullptr));
+ ButtonGroup2->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup2", nullptr));
+ CheckBox1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox1", nullptr));
+ CheckBox2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "CheckBox2", nullptr));
+ ButtonGroup1->setTitle(QApplication::translate("qdesigner_internal::PreviewWidget", "ButtonGroup", nullptr));
+ RadioButton1->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton1", nullptr));
+ RadioButton2->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton2", nullptr));
+ RadioButton3->setText(QApplication::translate("qdesigner_internal::PreviewWidget", "RadioButton3", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/proxy.ui.h b/tests/auto/tools/uic/baseline/proxy.ui.h
index 79a33251b7..67a9ab2b35 100644
--- a/tests/auto/tools/uic/baseline/proxy.ui.h
+++ b/tests/auto/tools/uic/baseline/proxy.ui.h
@@ -90,11 +90,11 @@ public:
void retranslateUi(QDialog *ProxyDialog)
{
- ProxyDialog->setWindowTitle(QApplication::translate("ProxyDialog", "Proxy Authentication", Q_NULLPTR));
- iconLabel->setText(QApplication::translate("ProxyDialog", "ICON", Q_NULLPTR));
- introLabel->setText(QApplication::translate("ProxyDialog", "Connect to proxy", Q_NULLPTR));
- usernameLabel->setText(QApplication::translate("ProxyDialog", "Username:", Q_NULLPTR));
- passwordLabel->setText(QApplication::translate("ProxyDialog", "Password:", Q_NULLPTR));
+ ProxyDialog->setWindowTitle(QApplication::translate("ProxyDialog", "Proxy Authentication", nullptr));
+ iconLabel->setText(QApplication::translate("ProxyDialog", "ICON", nullptr));
+ introLabel->setText(QApplication::translate("ProxyDialog", "Connect to proxy", nullptr));
+ usernameLabel->setText(QApplication::translate("ProxyDialog", "Username:", nullptr));
+ passwordLabel->setText(QApplication::translate("ProxyDialog", "Password:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qfiledialog.ui.h b/tests/auto/tools/uic/baseline/qfiledialog.ui.h
index 24bf810f72..98b05c34b6 100644
--- a/tests/auto/tools/uic/baseline/qfiledialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qfiledialog.ui.h
@@ -273,26 +273,26 @@ public:
void retranslateUi(QDialog *QFileDialog)
{
- lookInLabel->setText(QApplication::translate("QFileDialog", "Look in:", Q_NULLPTR));
+ lookInLabel->setText(QApplication::translate("QFileDialog", "Look in:", nullptr));
#ifndef QT_NO_TOOLTIP
- backButton->setToolTip(QApplication::translate("QFileDialog", "Back", Q_NULLPTR));
+ backButton->setToolTip(QApplication::translate("QFileDialog", "Back", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- forwardButton->setToolTip(QApplication::translate("QFileDialog", "Forward", Q_NULLPTR));
+ forwardButton->setToolTip(QApplication::translate("QFileDialog", "Forward", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- toParentButton->setToolTip(QApplication::translate("QFileDialog", "Parent Directory", Q_NULLPTR));
+ toParentButton->setToolTip(QApplication::translate("QFileDialog", "Parent Directory", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newFolderButton->setToolTip(QApplication::translate("QFileDialog", "Create New Folder", Q_NULLPTR));
+ newFolderButton->setToolTip(QApplication::translate("QFileDialog", "Create New Folder", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- listModeButton->setToolTip(QApplication::translate("QFileDialog", "List View", Q_NULLPTR));
+ listModeButton->setToolTip(QApplication::translate("QFileDialog", "List View", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- detailModeButton->setToolTip(QApplication::translate("QFileDialog", "Detail View", Q_NULLPTR));
+ detailModeButton->setToolTip(QApplication::translate("QFileDialog", "Detail View", nullptr));
#endif // QT_NO_TOOLTIP
- fileTypeLabel->setText(QApplication::translate("QFileDialog", "Files of type:", Q_NULLPTR));
+ fileTypeLabel->setText(QApplication::translate("QFileDialog", "Files of type:", nullptr));
Q_UNUSED(QFileDialog);
} // retranslateUi
diff --git a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h
index d75f7f1146..b49853b1c4 100644
--- a/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h
+++ b/tests/auto/tools/uic/baseline/qpagesetupwidget.ui.h
@@ -307,45 +307,45 @@ public:
void retranslateUi(QWidget *QPageSetupWidget)
{
- QPageSetupWidget->setWindowTitle(QApplication::translate("QPageSetupWidget", "Form", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("QPageSetupWidget", "Paper", Q_NULLPTR));
- pageSizeLabel->setText(QApplication::translate("QPageSetupWidget", "Page size:", Q_NULLPTR));
- widthLabel->setText(QApplication::translate("QPageSetupWidget", "Width:", Q_NULLPTR));
- heightLabel->setText(QApplication::translate("QPageSetupWidget", "Height:", Q_NULLPTR));
- paperSourceLabel->setText(QApplication::translate("QPageSetupWidget", "Paper source:", Q_NULLPTR));
- groupBox_3->setTitle(QApplication::translate("QPageSetupWidget", "Orientation", Q_NULLPTR));
- portrait->setText(QApplication::translate("QPageSetupWidget", "Portrait", Q_NULLPTR));
- landscape->setText(QApplication::translate("QPageSetupWidget", "Landscape", Q_NULLPTR));
- reverseLandscape->setText(QApplication::translate("QPageSetupWidget", "Reverse landscape", Q_NULLPTR));
- reversePortrait->setText(QApplication::translate("QPageSetupWidget", "Reverse portrait", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("QPageSetupWidget", "Margins", Q_NULLPTR));
+ QPageSetupWidget->setWindowTitle(QApplication::translate("QPageSetupWidget", "Form", nullptr));
+ groupBox_2->setTitle(QApplication::translate("QPageSetupWidget", "Paper", nullptr));
+ pageSizeLabel->setText(QApplication::translate("QPageSetupWidget", "Page size:", nullptr));
+ widthLabel->setText(QApplication::translate("QPageSetupWidget", "Width:", nullptr));
+ heightLabel->setText(QApplication::translate("QPageSetupWidget", "Height:", nullptr));
+ paperSourceLabel->setText(QApplication::translate("QPageSetupWidget", "Paper source:", nullptr));
+ groupBox_3->setTitle(QApplication::translate("QPageSetupWidget", "Orientation", nullptr));
+ portrait->setText(QApplication::translate("QPageSetupWidget", "Portrait", nullptr));
+ landscape->setText(QApplication::translate("QPageSetupWidget", "Landscape", nullptr));
+ reverseLandscape->setText(QApplication::translate("QPageSetupWidget", "Reverse landscape", nullptr));
+ reversePortrait->setText(QApplication::translate("QPageSetupWidget", "Reverse portrait", nullptr));
+ groupBox->setTitle(QApplication::translate("QPageSetupWidget", "Margins", nullptr));
#ifndef QT_NO_TOOLTIP
- topMargin->setToolTip(QApplication::translate("QPageSetupWidget", "top margin", Q_NULLPTR));
+ topMargin->setToolTip(QApplication::translate("QPageSetupWidget", "top margin", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_ACCESSIBILITY
- topMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "top margin", Q_NULLPTR));
+ topMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "top margin", nullptr));
#endif // QT_NO_ACCESSIBILITY
#ifndef QT_NO_TOOLTIP
- leftMargin->setToolTip(QApplication::translate("QPageSetupWidget", "left margin", Q_NULLPTR));
+ leftMargin->setToolTip(QApplication::translate("QPageSetupWidget", "left margin", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_ACCESSIBILITY
- leftMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "left margin", Q_NULLPTR));
+ leftMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "left margin", nullptr));
#endif // QT_NO_ACCESSIBILITY
#ifndef QT_NO_TOOLTIP
- rightMargin->setToolTip(QApplication::translate("QPageSetupWidget", "right margin", Q_NULLPTR));
+ rightMargin->setToolTip(QApplication::translate("QPageSetupWidget", "right margin", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_ACCESSIBILITY
- rightMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "right margin", Q_NULLPTR));
+ rightMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "right margin", nullptr));
#endif // QT_NO_ACCESSIBILITY
#ifndef QT_NO_TOOLTIP
- bottomMargin->setToolTip(QApplication::translate("QPageSetupWidget", "bottom margin", Q_NULLPTR));
+ bottomMargin->setToolTip(QApplication::translate("QPageSetupWidget", "bottom margin", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_ACCESSIBILITY
- bottomMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "bottom margin", Q_NULLPTR));
+ bottomMargin->setAccessibleName(QApplication::translate("QPageSetupWidget", "bottom margin", nullptr));
#endif // QT_NO_ACCESSIBILITY
- pagesPerSheetButtonGroup->setTitle(QApplication::translate("QPageSetupWidget", "Page Layout", Q_NULLPTR));
- label->setText(QApplication::translate("QPageSetupWidget", "Page order:", Q_NULLPTR));
- label_2->setText(QApplication::translate("QPageSetupWidget", "Pages per sheet:", Q_NULLPTR));
+ pagesPerSheetButtonGroup->setTitle(QApplication::translate("QPageSetupWidget", "Page Layout", nullptr));
+ label->setText(QApplication::translate("QPageSetupWidget", "Page order:", nullptr));
+ label_2->setText(QApplication::translate("QPageSetupWidget", "Pages per sheet:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h
index dcd6ca6efd..9f1b96129e 100644
--- a/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h
+++ b/tests/auto/tools/uic/baseline/qprintpropertieswidget.ui.h
@@ -81,9 +81,9 @@ public:
void retranslateUi(QWidget *QPrintPropertiesWidget)
{
- QPrintPropertiesWidget->setWindowTitle(QApplication::translate("QPrintPropertiesWidget", "Form", Q_NULLPTR));
- tabs->setTabText(tabs->indexOf(tabPage), QApplication::translate("QPrintPropertiesWidget", "Page", Q_NULLPTR));
- tabs->setTabText(tabs->indexOf(cupsPropertiesPage), QApplication::translate("QPrintPropertiesWidget", "Advanced", Q_NULLPTR));
+ QPrintPropertiesWidget->setWindowTitle(QApplication::translate("QPrintPropertiesWidget", "Form", nullptr));
+ tabs->setTabText(tabs->indexOf(tabPage), QApplication::translate("QPrintPropertiesWidget", "Page", nullptr));
+ tabs->setTabText(tabs->indexOf(cupsPropertiesPage), QApplication::translate("QPrintPropertiesWidget", "Advanced", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h
index a11709c014..04978f44b7 100644
--- a/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h
+++ b/tests/auto/tools/uic/baseline/qprintsettingsoutput.ui.h
@@ -279,25 +279,25 @@ public:
void retranslateUi(QWidget *QPrintSettingsOutput)
{
- QPrintSettingsOutput->setWindowTitle(QApplication::translate("QPrintSettingsOutput", "Form", Q_NULLPTR));
- gbPrintRange->setTitle(QApplication::translate("QPrintSettingsOutput", "Print range", Q_NULLPTR));
- printAll->setText(QApplication::translate("QPrintSettingsOutput", "Print all", Q_NULLPTR));
- printRange->setText(QApplication::translate("QPrintSettingsOutput", "Pages from", Q_NULLPTR));
- label_3->setText(QApplication::translate("QPrintSettingsOutput", "to", Q_NULLPTR));
- printSelection->setText(QApplication::translate("QPrintSettingsOutput", "Selection", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("QPrintSettingsOutput", "Output Settings", Q_NULLPTR));
- label->setText(QApplication::translate("QPrintSettingsOutput", "Copies:", Q_NULLPTR));
- collate->setText(QApplication::translate("QPrintSettingsOutput", "Collate", Q_NULLPTR));
- reverse->setText(QApplication::translate("QPrintSettingsOutput", "Reverse", Q_NULLPTR));
- tabs->setTabText(tabs->indexOf(copiesTab), QApplication::translate("QPrintSettingsOutput", "Copies", Q_NULLPTR));
- colorMode->setTitle(QApplication::translate("QPrintSettingsOutput", "Color Mode", Q_NULLPTR));
- color->setText(QApplication::translate("QPrintSettingsOutput", "Color", Q_NULLPTR));
- grayscale->setText(QApplication::translate("QPrintSettingsOutput", "Grayscale", Q_NULLPTR));
- duplex->setTitle(QApplication::translate("QPrintSettingsOutput", "Duplex Printing", Q_NULLPTR));
- noDuplex->setText(QApplication::translate("QPrintSettingsOutput", "None", Q_NULLPTR));
- duplexLong->setText(QApplication::translate("QPrintSettingsOutput", "Long side", Q_NULLPTR));
- duplexShort->setText(QApplication::translate("QPrintSettingsOutput", "Short side", Q_NULLPTR));
- tabs->setTabText(tabs->indexOf(optionsTab), QApplication::translate("QPrintSettingsOutput", "Options", Q_NULLPTR));
+ QPrintSettingsOutput->setWindowTitle(QApplication::translate("QPrintSettingsOutput", "Form", nullptr));
+ gbPrintRange->setTitle(QApplication::translate("QPrintSettingsOutput", "Print range", nullptr));
+ printAll->setText(QApplication::translate("QPrintSettingsOutput", "Print all", nullptr));
+ printRange->setText(QApplication::translate("QPrintSettingsOutput", "Pages from", nullptr));
+ label_3->setText(QApplication::translate("QPrintSettingsOutput", "to", nullptr));
+ printSelection->setText(QApplication::translate("QPrintSettingsOutput", "Selection", nullptr));
+ groupBox->setTitle(QApplication::translate("QPrintSettingsOutput", "Output Settings", nullptr));
+ label->setText(QApplication::translate("QPrintSettingsOutput", "Copies:", nullptr));
+ collate->setText(QApplication::translate("QPrintSettingsOutput", "Collate", nullptr));
+ reverse->setText(QApplication::translate("QPrintSettingsOutput", "Reverse", nullptr));
+ tabs->setTabText(tabs->indexOf(copiesTab), QApplication::translate("QPrintSettingsOutput", "Copies", nullptr));
+ colorMode->setTitle(QApplication::translate("QPrintSettingsOutput", "Color Mode", nullptr));
+ color->setText(QApplication::translate("QPrintSettingsOutput", "Color", nullptr));
+ grayscale->setText(QApplication::translate("QPrintSettingsOutput", "Grayscale", nullptr));
+ duplex->setTitle(QApplication::translate("QPrintSettingsOutput", "Duplex Printing", nullptr));
+ noDuplex->setText(QApplication::translate("QPrintSettingsOutput", "None", nullptr));
+ duplexLong->setText(QApplication::translate("QPrintSettingsOutput", "Long side", nullptr));
+ duplexShort->setText(QApplication::translate("QPrintSettingsOutput", "Short side", nullptr));
+ tabs->setTabText(tabs->indexOf(optionsTab), QApplication::translate("QPrintSettingsOutput", "Options", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qprintwidget.ui.h b/tests/auto/tools/uic/baseline/qprintwidget.ui.h
index 7a81f3daf5..f22d0741f2 100644
--- a/tests/auto/tools/uic/baseline/qprintwidget.ui.h
+++ b/tests/auto/tools/uic/baseline/qprintwidget.ui.h
@@ -143,15 +143,15 @@ public:
void retranslateUi(QWidget *QPrintWidget)
{
- QPrintWidget->setWindowTitle(QApplication::translate("QPrintWidget", "Form", Q_NULLPTR));
- printerGroup->setTitle(QApplication::translate("QPrintWidget", "Printer", Q_NULLPTR));
- label->setText(QApplication::translate("QPrintWidget", "&Name:", Q_NULLPTR));
- properties->setText(QApplication::translate("QPrintWidget", "P&roperties", Q_NULLPTR));
- label_2->setText(QApplication::translate("QPrintWidget", "Location:", Q_NULLPTR));
- preview->setText(QApplication::translate("QPrintWidget", "Preview", Q_NULLPTR));
- label_3->setText(QApplication::translate("QPrintWidget", "Type:", Q_NULLPTR));
- lOutput->setText(QApplication::translate("QPrintWidget", "Output &file:", Q_NULLPTR));
- fileBrowser->setText(QApplication::translate("QPrintWidget", "...", Q_NULLPTR));
+ QPrintWidget->setWindowTitle(QApplication::translate("QPrintWidget", "Form", nullptr));
+ printerGroup->setTitle(QApplication::translate("QPrintWidget", "Printer", nullptr));
+ label->setText(QApplication::translate("QPrintWidget", "&Name:", nullptr));
+ properties->setText(QApplication::translate("QPrintWidget", "P&roperties", nullptr));
+ label_2->setText(QApplication::translate("QPrintWidget", "Location:", nullptr));
+ preview->setText(QApplication::translate("QPrintWidget", "Preview", nullptr));
+ label_3->setText(QApplication::translate("QPrintWidget", "Type:", nullptr));
+ lOutput->setText(QApplication::translate("QPrintWidget", "Output &file:", nullptr));
+ fileBrowser->setText(QApplication::translate("QPrintWidget", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h
index bffb9a1b63..e2de642905 100644
--- a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h
@@ -209,18 +209,18 @@ public:
void retranslateUi(QDialog *QSqlConnectionDialogUi)
{
- QSqlConnectionDialogUi->setWindowTitle(QApplication::translate("QSqlConnectionDialogUi", "Connect...", Q_NULLPTR));
- connGroupBox->setTitle(QApplication::translate("QSqlConnectionDialogUi", "Connection settings", Q_NULLPTR));
- textLabel4->setText(QApplication::translate("QSqlConnectionDialogUi", "&Username:", Q_NULLPTR));
- textLabel2->setText(QApplication::translate("QSqlConnectionDialogUi", "D&river", Q_NULLPTR));
- portSpinBox->setSpecialValueText(QApplication::translate("QSqlConnectionDialogUi", "Default", Q_NULLPTR));
- textLabel3->setText(QApplication::translate("QSqlConnectionDialogUi", "Database Name:", Q_NULLPTR));
- textLabel5->setText(QApplication::translate("QSqlConnectionDialogUi", "&Hostname:", Q_NULLPTR));
- textLabel5_2->setText(QApplication::translate("QSqlConnectionDialogUi", "P&ort:", Q_NULLPTR));
- textLabel4_2->setText(QApplication::translate("QSqlConnectionDialogUi", "&Password:", Q_NULLPTR));
- dbCheckBox->setText(QApplication::translate("QSqlConnectionDialogUi", "Us&e predefined in-memory database", Q_NULLPTR));
- okButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&OK", Q_NULLPTR));
- cancelButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&Cancel", Q_NULLPTR));
+ QSqlConnectionDialogUi->setWindowTitle(QApplication::translate("QSqlConnectionDialogUi", "Connect...", nullptr));
+ connGroupBox->setTitle(QApplication::translate("QSqlConnectionDialogUi", "Connection settings", nullptr));
+ textLabel4->setText(QApplication::translate("QSqlConnectionDialogUi", "&Username:", nullptr));
+ textLabel2->setText(QApplication::translate("QSqlConnectionDialogUi", "D&river", nullptr));
+ portSpinBox->setSpecialValueText(QApplication::translate("QSqlConnectionDialogUi", "Default", nullptr));
+ textLabel3->setText(QApplication::translate("QSqlConnectionDialogUi", "Database Name:", nullptr));
+ textLabel5->setText(QApplication::translate("QSqlConnectionDialogUi", "&Hostname:", nullptr));
+ textLabel5_2->setText(QApplication::translate("QSqlConnectionDialogUi", "P&ort:", nullptr));
+ textLabel4_2->setText(QApplication::translate("QSqlConnectionDialogUi", "&Password:", nullptr));
+ dbCheckBox->setText(QApplication::translate("QSqlConnectionDialogUi", "Us&e predefined in-memory database", nullptr));
+ okButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&OK", nullptr));
+ cancelButton->setText(QApplication::translate("QSqlConnectionDialogUi", "&Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h
index a4599607b8..9da153f156 100644
--- a/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qtgradientdialog.ui.h
@@ -92,7 +92,7 @@ public:
void retranslateUi(QDialog *QtGradientDialog)
{
- QtGradientDialog->setWindowTitle(QApplication::translate("QtGradientDialog", "Edit Gradient", Q_NULLPTR));
+ QtGradientDialog->setWindowTitle(QApplication::translate("QtGradientDialog", "Edit Gradient", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h
index 8b7a4c1293..76e0001e16 100644
--- a/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/qtgradienteditor.ui.h
@@ -586,119 +586,119 @@ public:
void retranslateUi(QWidget *QtGradientEditor)
{
- QtGradientEditor->setWindowTitle(QApplication::translate("QtGradientEditor", "Form", Q_NULLPTR));
+ QtGradientEditor->setWindowTitle(QApplication::translate("QtGradientEditor", "Form", nullptr));
#ifndef QT_NO_TOOLTIP
- gradientWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Editor", Q_NULLPTR));
+ gradientWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Editor", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- gradientWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area shows a preview of the gradient being edited. It also allows you to edit parameters specific to the gradient's type such as start and final point, radius, etc. by drag & drop.", Q_NULLPTR));
+ gradientWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area shows a preview of the gradient being edited. It also allows you to edit parameters specific to the gradient's type such as start and final point, radius, etc. by drag & drop.", nullptr));
#endif // QT_NO_WHATSTHIS
- label1->setText(QApplication::translate("QtGradientEditor", "1", Q_NULLPTR));
- label2->setText(QApplication::translate("QtGradientEditor", "2", Q_NULLPTR));
- label3->setText(QApplication::translate("QtGradientEditor", "3", Q_NULLPTR));
- label4->setText(QApplication::translate("QtGradientEditor", "4", Q_NULLPTR));
- label5->setText(QApplication::translate("QtGradientEditor", "5", Q_NULLPTR));
+ label1->setText(QApplication::translate("QtGradientEditor", "1", nullptr));
+ label2->setText(QApplication::translate("QtGradientEditor", "2", nullptr));
+ label3->setText(QApplication::translate("QtGradientEditor", "3", nullptr));
+ label4->setText(QApplication::translate("QtGradientEditor", "4", nullptr));
+ label5->setText(QApplication::translate("QtGradientEditor", "5", nullptr));
#ifndef QT_NO_TOOLTIP
- gradientStopsWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Stops Editor", Q_NULLPTR));
+ gradientStopsWidget->setToolTip(QApplication::translate("QtGradientEditor", "Gradient Stops Editor", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
- gradientStopsWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area allows you to edit gradient stops. Double click on the existing stop handle to duplicate it. Double click outside of the existing stop handles to create a new stop. Drag & drop the handle to reposition it. Use right mouse button to popup context menu with extra actions.", Q_NULLPTR));
+ gradientStopsWidget->setWhatsThis(QApplication::translate("QtGradientEditor", "This area allows you to edit gradient stops. Double click on the existing stop handle to duplicate it. Double click outside of the existing stop handles to create a new stop. Drag & drop the handle to reposition it. Use right mouse button to popup context menu with extra actions.", nullptr));
#endif // QT_NO_WHATSTHIS
- zoomLabel->setText(QApplication::translate("QtGradientEditor", "Zoom", Q_NULLPTR));
+ zoomLabel->setText(QApplication::translate("QtGradientEditor", "Zoom", nullptr));
#ifndef QT_NO_TOOLTIP
- zoomAllButton->setToolTip(QApplication::translate("QtGradientEditor", "Reset Zoom", Q_NULLPTR));
+ zoomAllButton->setToolTip(QApplication::translate("QtGradientEditor", "Reset Zoom", nullptr));
#endif // QT_NO_TOOLTIP
- zoomAllButton->setText(QApplication::translate("QtGradientEditor", "Reset Zoom", Q_NULLPTR));
- positionLabel->setText(QApplication::translate("QtGradientEditor", "Position", Q_NULLPTR));
+ zoomAllButton->setText(QApplication::translate("QtGradientEditor", "Reset Zoom", nullptr));
+ positionLabel->setText(QApplication::translate("QtGradientEditor", "Position", nullptr));
#ifndef QT_NO_TOOLTIP
- hLabel->setToolTip(QApplication::translate("QtGradientEditor", "Hue", Q_NULLPTR));
+ hLabel->setToolTip(QApplication::translate("QtGradientEditor", "Hue", nullptr));
#endif // QT_NO_TOOLTIP
- hLabel->setText(QApplication::translate("QtGradientEditor", "H", Q_NULLPTR));
+ hLabel->setText(QApplication::translate("QtGradientEditor", "H", nullptr));
#ifndef QT_NO_TOOLTIP
- hueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Hue", Q_NULLPTR));
+ hueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Hue", nullptr));
#endif // QT_NO_TOOLTIP
- hueLabel->setText(QApplication::translate("QtGradientEditor", "Hue", Q_NULLPTR));
+ hueLabel->setText(QApplication::translate("QtGradientEditor", "Hue", nullptr));
#ifndef QT_NO_TOOLTIP
- sLabel->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", Q_NULLPTR));
+ sLabel->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", nullptr));
#endif // QT_NO_TOOLTIP
- sLabel->setText(QApplication::translate("QtGradientEditor", "S", Q_NULLPTR));
+ sLabel->setText(QApplication::translate("QtGradientEditor", "S", nullptr));
#ifndef QT_NO_TOOLTIP
- saturationColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", Q_NULLPTR));
+ saturationColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Saturation", nullptr));
#endif // QT_NO_TOOLTIP
- saturationLabel->setText(QApplication::translate("QtGradientEditor", "Sat", Q_NULLPTR));
+ saturationLabel->setText(QApplication::translate("QtGradientEditor", "Sat", nullptr));
#ifndef QT_NO_TOOLTIP
- vLabel->setToolTip(QApplication::translate("QtGradientEditor", "Value", Q_NULLPTR));
+ vLabel->setToolTip(QApplication::translate("QtGradientEditor", "Value", nullptr));
#endif // QT_NO_TOOLTIP
- vLabel->setText(QApplication::translate("QtGradientEditor", "V", Q_NULLPTR));
+ vLabel->setText(QApplication::translate("QtGradientEditor", "V", nullptr));
#ifndef QT_NO_TOOLTIP
- valueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Value", Q_NULLPTR));
+ valueColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Value", nullptr));
#endif // QT_NO_TOOLTIP
- valueLabel->setText(QApplication::translate("QtGradientEditor", "Val", Q_NULLPTR));
+ valueLabel->setText(QApplication::translate("QtGradientEditor", "Val", nullptr));
#ifndef QT_NO_TOOLTIP
- aLabel->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", Q_NULLPTR));
+ aLabel->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", nullptr));
#endif // QT_NO_TOOLTIP
- aLabel->setText(QApplication::translate("QtGradientEditor", "A", Q_NULLPTR));
+ aLabel->setText(QApplication::translate("QtGradientEditor", "A", nullptr));
#ifndef QT_NO_TOOLTIP
- alphaColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", Q_NULLPTR));
+ alphaColorLine->setToolTip(QApplication::translate("QtGradientEditor", "Alpha", nullptr));
#endif // QT_NO_TOOLTIP
- alphaLabel->setText(QApplication::translate("QtGradientEditor", "Alpha", Q_NULLPTR));
+ alphaLabel->setText(QApplication::translate("QtGradientEditor", "Alpha", nullptr));
#ifndef QT_NO_TOOLTIP
- typeComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Type", Q_NULLPTR));
+ typeComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Type", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- spreadComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Spread", Q_NULLPTR));
+ spreadComboBox->setToolTip(QApplication::translate("QtGradientEditor", "Spread", nullptr));
#endif // QT_NO_TOOLTIP
- colorLabel->setText(QApplication::translate("QtGradientEditor", "Color", Q_NULLPTR));
+ colorLabel->setText(QApplication::translate("QtGradientEditor", "Color", nullptr));
#ifndef QT_NO_TOOLTIP
- colorButton->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's color", Q_NULLPTR));
+ colorButton->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's color", nullptr));
#endif // QT_NO_TOOLTIP
colorButton->setText(QString());
#ifndef QT_NO_TOOLTIP
- hsvRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show HSV specification", Q_NULLPTR));
+ hsvRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show HSV specification", nullptr));
#endif // QT_NO_TOOLTIP
- hsvRadioButton->setText(QApplication::translate("QtGradientEditor", "HSV", Q_NULLPTR));
+ hsvRadioButton->setText(QApplication::translate("QtGradientEditor", "HSV", nullptr));
#ifndef QT_NO_TOOLTIP
- rgbRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show RGB specification", Q_NULLPTR));
+ rgbRadioButton->setToolTip(QApplication::translate("QtGradientEditor", "Show RGB specification", nullptr));
#endif // QT_NO_TOOLTIP
- rgbRadioButton->setText(QApplication::translate("QtGradientEditor", "RGB", Q_NULLPTR));
+ rgbRadioButton->setText(QApplication::translate("QtGradientEditor", "RGB", nullptr));
#ifndef QT_NO_TOOLTIP
- positionSpinBox->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's position", Q_NULLPTR));
+ positionSpinBox->setToolTip(QApplication::translate("QtGradientEditor", "Current stop's position", nullptr));
#endif // QT_NO_TOOLTIP
- zoomSpinBox->setSuffix(QApplication::translate("QtGradientEditor", "%", Q_NULLPTR));
+ zoomSpinBox->setSuffix(QApplication::translate("QtGradientEditor", "%", nullptr));
#ifndef QT_NO_TOOLTIP
- zoomInButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom In", Q_NULLPTR));
+ zoomInButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom In", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- zoomOutButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom Out", Q_NULLPTR));
+ zoomOutButton->setToolTip(QApplication::translate("QtGradientEditor", "Zoom Out", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- detailsButton->setToolTip(QApplication::translate("QtGradientEditor", "Toggle details extension", Q_NULLPTR));
+ detailsButton->setToolTip(QApplication::translate("QtGradientEditor", "Toggle details extension", nullptr));
#endif // QT_NO_TOOLTIP
- detailsButton->setText(QApplication::translate("QtGradientEditor", ">", Q_NULLPTR));
+ detailsButton->setText(QApplication::translate("QtGradientEditor", ">", nullptr));
#ifndef QT_NO_TOOLTIP
- linearButton->setToolTip(QApplication::translate("QtGradientEditor", "Linear Type", Q_NULLPTR));
+ linearButton->setToolTip(QApplication::translate("QtGradientEditor", "Linear Type", nullptr));
#endif // QT_NO_TOOLTIP
- linearButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ linearButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- radialButton->setToolTip(QApplication::translate("QtGradientEditor", "Radial Type", Q_NULLPTR));
+ radialButton->setToolTip(QApplication::translate("QtGradientEditor", "Radial Type", nullptr));
#endif // QT_NO_TOOLTIP
- radialButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ radialButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- conicalButton->setToolTip(QApplication::translate("QtGradientEditor", "Conical Type", Q_NULLPTR));
+ conicalButton->setToolTip(QApplication::translate("QtGradientEditor", "Conical Type", nullptr));
#endif // QT_NO_TOOLTIP
- conicalButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ conicalButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- padButton->setToolTip(QApplication::translate("QtGradientEditor", "Pad Spread", Q_NULLPTR));
+ padButton->setToolTip(QApplication::translate("QtGradientEditor", "Pad Spread", nullptr));
#endif // QT_NO_TOOLTIP
- padButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ padButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- repeatButton->setToolTip(QApplication::translate("QtGradientEditor", "Repeat Spread", Q_NULLPTR));
+ repeatButton->setToolTip(QApplication::translate("QtGradientEditor", "Repeat Spread", nullptr));
#endif // QT_NO_TOOLTIP
- repeatButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ repeatButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- reflectButton->setToolTip(QApplication::translate("QtGradientEditor", "Reflect Spread", Q_NULLPTR));
+ reflectButton->setToolTip(QApplication::translate("QtGradientEditor", "Reflect Spread", nullptr));
#endif // QT_NO_TOOLTIP
- reflectButton->setText(QApplication::translate("QtGradientEditor", "...", Q_NULLPTR));
+ reflectButton->setText(QApplication::translate("QtGradientEditor", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qtgradientview.ui.h b/tests/auto/tools/uic/baseline/qtgradientview.ui.h
index 14cb1da6b2..8b1fe38cfc 100644
--- a/tests/auto/tools/uic/baseline/qtgradientview.ui.h
+++ b/tests/auto/tools/uic/baseline/qtgradientview.ui.h
@@ -108,11 +108,11 @@ public:
void retranslateUi(QWidget *QtGradientView)
{
- QtGradientView->setWindowTitle(QApplication::translate("QtGradientView", "Gradient View", Q_NULLPTR));
- newButton->setText(QApplication::translate("QtGradientView", "New...", Q_NULLPTR));
- editButton->setText(QApplication::translate("QtGradientView", "Edit...", Q_NULLPTR));
- renameButton->setText(QApplication::translate("QtGradientView", "Rename", Q_NULLPTR));
- removeButton->setText(QApplication::translate("QtGradientView", "Remove", Q_NULLPTR));
+ QtGradientView->setWindowTitle(QApplication::translate("QtGradientView", "Gradient View", nullptr));
+ newButton->setText(QApplication::translate("QtGradientView", "New...", nullptr));
+ editButton->setText(QApplication::translate("QtGradientView", "Edit...", nullptr));
+ renameButton->setText(QApplication::translate("QtGradientView", "Rename", nullptr));
+ removeButton->setText(QApplication::translate("QtGradientView", "Remove", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h
index e2f8a3da03..ab90939445 100644
--- a/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qtgradientviewdialog.ui.h
@@ -92,7 +92,7 @@ public:
void retranslateUi(QDialog *QtGradientViewDialog)
{
- QtGradientViewDialog->setWindowTitle(QApplication::translate("QtGradientViewDialog", "Select Gradient", Q_NULLPTR));
+ QtGradientViewDialog->setWindowTitle(QApplication::translate("QtGradientViewDialog", "Select Gradient", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h
index 50c844cf35..604cbdaf9d 100644
--- a/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qtresourceeditordialog.ui.h
@@ -143,25 +143,25 @@ public:
void retranslateUi(QDialog *QtResourceEditorDialog)
{
- QtResourceEditorDialog->setWindowTitle(QApplication::translate("QtResourceEditorDialog", "Dialog", Q_NULLPTR));
+ QtResourceEditorDialog->setWindowTitle(QApplication::translate("QtResourceEditorDialog", "Dialog", nullptr));
#ifndef QT_NO_TOOLTIP
- newQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New File", Q_NULLPTR));
+ newQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New File", nullptr));
#endif // QT_NO_TOOLTIP
- newQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "N", Q_NULLPTR));
+ newQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "N", nullptr));
#ifndef QT_NO_TOOLTIP
- removeQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove File", Q_NULLPTR));
+ removeQrcButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove File", nullptr));
#endif // QT_NO_TOOLTIP
- removeQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "R", Q_NULLPTR));
- importQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "I", Q_NULLPTR));
+ removeQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "R", nullptr));
+ importQrcButton->setText(QApplication::translate("QtResourceEditorDialog", "I", nullptr));
#ifndef QT_NO_TOOLTIP
- newResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New Resource", Q_NULLPTR));
+ newResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "New Resource", nullptr));
#endif // QT_NO_TOOLTIP
- newResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "N", Q_NULLPTR));
- addResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "A", Q_NULLPTR));
+ newResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "N", nullptr));
+ addResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "A", nullptr));
#ifndef QT_NO_TOOLTIP
- removeResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove Resource or File", Q_NULLPTR));
+ removeResourceButton->setToolTip(QApplication::translate("QtResourceEditorDialog", "Remove Resource or File", nullptr));
#endif // QT_NO_TOOLTIP
- removeResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "R", Q_NULLPTR));
+ removeResourceButton->setText(QApplication::translate("QtResourceEditorDialog", "R", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h b/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h
index 6694cf4ccd..f329cc2b8b 100644
--- a/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h
+++ b/tests/auto/tools/uic/baseline/qttoolbardialog.ui.h
@@ -180,40 +180,40 @@ public:
void retranslateUi(QDialog *QtToolBarDialog)
{
- QtToolBarDialog->setWindowTitle(QApplication::translate("QtToolBarDialog", "Customize Toolbars", Q_NULLPTR));
+ QtToolBarDialog->setWindowTitle(QApplication::translate("QtToolBarDialog", "Customize Toolbars", nullptr));
QTreeWidgetItem *___qtreewidgetitem = actionTree->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("QtToolBarDialog", "1", Q_NULLPTR));
- label->setText(QApplication::translate("QtToolBarDialog", "Actions", Q_NULLPTR));
- label_2->setText(QApplication::translate("QtToolBarDialog", "Toolbars", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("QtToolBarDialog", "1", nullptr));
+ label->setText(QApplication::translate("QtToolBarDialog", "Actions", nullptr));
+ label_2->setText(QApplication::translate("QtToolBarDialog", "Toolbars", nullptr));
#ifndef QT_NO_TOOLTIP
- newButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add new toolbar", Q_NULLPTR));
+ newButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add new toolbar", nullptr));
#endif // QT_NO_TOOLTIP
- newButton->setText(QApplication::translate("QtToolBarDialog", "New", Q_NULLPTR));
+ newButton->setText(QApplication::translate("QtToolBarDialog", "New", nullptr));
#ifndef QT_NO_TOOLTIP
- removeButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove selected toolbar", Q_NULLPTR));
+ removeButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove selected toolbar", nullptr));
#endif // QT_NO_TOOLTIP
- removeButton->setText(QApplication::translate("QtToolBarDialog", "Remove", Q_NULLPTR));
+ removeButton->setText(QApplication::translate("QtToolBarDialog", "Remove", nullptr));
#ifndef QT_NO_TOOLTIP
- renameButton->setToolTip(QApplication::translate("QtToolBarDialog", "Rename toolbar", Q_NULLPTR));
+ renameButton->setToolTip(QApplication::translate("QtToolBarDialog", "Rename toolbar", nullptr));
#endif // QT_NO_TOOLTIP
- renameButton->setText(QApplication::translate("QtToolBarDialog", "Rename", Q_NULLPTR));
+ renameButton->setText(QApplication::translate("QtToolBarDialog", "Rename", nullptr));
#ifndef QT_NO_TOOLTIP
- upButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action up", Q_NULLPTR));
+ upButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action up", nullptr));
#endif // QT_NO_TOOLTIP
- upButton->setText(QApplication::translate("QtToolBarDialog", "Up", Q_NULLPTR));
+ upButton->setText(QApplication::translate("QtToolBarDialog", "Up", nullptr));
#ifndef QT_NO_TOOLTIP
- leftButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove action from toolbar", Q_NULLPTR));
+ leftButton->setToolTip(QApplication::translate("QtToolBarDialog", "Remove action from toolbar", nullptr));
#endif // QT_NO_TOOLTIP
- leftButton->setText(QApplication::translate("QtToolBarDialog", "<-", Q_NULLPTR));
+ leftButton->setText(QApplication::translate("QtToolBarDialog", "<-", nullptr));
#ifndef QT_NO_TOOLTIP
- rightButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add action to toolbar", Q_NULLPTR));
+ rightButton->setToolTip(QApplication::translate("QtToolBarDialog", "Add action to toolbar", nullptr));
#endif // QT_NO_TOOLTIP
- rightButton->setText(QApplication::translate("QtToolBarDialog", "->", Q_NULLPTR));
+ rightButton->setText(QApplication::translate("QtToolBarDialog", "->", nullptr));
#ifndef QT_NO_TOOLTIP
- downButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action down", Q_NULLPTR));
+ downButton->setToolTip(QApplication::translate("QtToolBarDialog", "Move action down", nullptr));
#endif // QT_NO_TOOLTIP
- downButton->setText(QApplication::translate("QtToolBarDialog", "Down", Q_NULLPTR));
- label_3->setText(QApplication::translate("QtToolBarDialog", "Current Toolbar Actions", Q_NULLPTR));
+ downButton->setText(QApplication::translate("QtToolBarDialog", "Down", nullptr));
+ label_3->setText(QApplication::translate("QtToolBarDialog", "Current Toolbar Actions", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/querywidget.ui.h b/tests/auto/tools/uic/baseline/querywidget.ui.h
index 531df0d614..092259784b 100644
--- a/tests/auto/tools/uic/baseline/querywidget.ui.h
+++ b/tests/auto/tools/uic/baseline/querywidget.ui.h
@@ -156,10 +156,10 @@ public:
void retranslateUi(QMainWindow *QueryWidget)
{
- QueryWidget->setWindowTitle(QApplication::translate("QueryWidget", "Recipes XQuery Example", Q_NULLPTR));
- inputGroupBox->setTitle(QApplication::translate("QueryWidget", "Input Document", Q_NULLPTR));
- queryGroupBox->setTitle(QApplication::translate("QueryWidget", "Select your query:", Q_NULLPTR));
- outputGroupBox->setTitle(QApplication::translate("QueryWidget", "Output Document", Q_NULLPTR));
+ QueryWidget->setWindowTitle(QApplication::translate("QueryWidget", "Recipes XQuery Example", nullptr));
+ inputGroupBox->setTitle(QApplication::translate("QueryWidget", "Input Document", nullptr));
+ queryGroupBox->setTitle(QApplication::translate("QueryWidget", "Select your query:", nullptr));
+ outputGroupBox->setTitle(QApplication::translate("QueryWidget", "Output Document", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/remotecontrol.ui.h b/tests/auto/tools/uic/baseline/remotecontrol.ui.h
index 00af983ed7..c1a8f8ae1c 100644
--- a/tests/auto/tools/uic/baseline/remotecontrol.ui.h
+++ b/tests/auto/tools/uic/baseline/remotecontrol.ui.h
@@ -223,22 +223,22 @@ public:
void retranslateUi(QMainWindow *RemoteControlClass)
{
- RemoteControlClass->setWindowTitle(QApplication::translate("RemoteControlClass", "RemoteControl", Q_NULLPTR));
- actionQuit->setText(QApplication::translate("RemoteControlClass", "Quit", Q_NULLPTR));
- label->setText(QApplication::translate("RemoteControlClass", "Start URL:", Q_NULLPTR));
- launchButton->setText(QApplication::translate("RemoteControlClass", "Launch Qt HelpViewer", Q_NULLPTR));
- actionGroupBox->setTitle(QApplication::translate("RemoteControlClass", "Actions", Q_NULLPTR));
- label_2->setText(QApplication::translate("RemoteControlClass", "Search in Index:", Q_NULLPTR));
+ RemoteControlClass->setWindowTitle(QApplication::translate("RemoteControlClass", "RemoteControl", nullptr));
+ actionQuit->setText(QApplication::translate("RemoteControlClass", "Quit", nullptr));
+ label->setText(QApplication::translate("RemoteControlClass", "Start URL:", nullptr));
+ launchButton->setText(QApplication::translate("RemoteControlClass", "Launch Qt HelpViewer", nullptr));
+ actionGroupBox->setTitle(QApplication::translate("RemoteControlClass", "Actions", nullptr));
+ label_2->setText(QApplication::translate("RemoteControlClass", "Search in Index:", nullptr));
indexButton->setText(QString());
- label_4->setText(QApplication::translate("RemoteControlClass", "Identifier:", Q_NULLPTR));
+ label_4->setText(QApplication::translate("RemoteControlClass", "Identifier:", nullptr));
identifierButton->setText(QString());
- label_3->setText(QApplication::translate("RemoteControlClass", "Show URL:", Q_NULLPTR));
+ label_3->setText(QApplication::translate("RemoteControlClass", "Show URL:", nullptr));
urlButton->setText(QString());
- syncContentsButton->setText(QApplication::translate("RemoteControlClass", "Sync Contents", Q_NULLPTR));
- contentsCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Contents", Q_NULLPTR));
- indexCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Index", Q_NULLPTR));
- bookmarksCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Bookmarks", Q_NULLPTR));
- menuFile->setTitle(QApplication::translate("RemoteControlClass", "File", Q_NULLPTR));
+ syncContentsButton->setText(QApplication::translate("RemoteControlClass", "Sync Contents", nullptr));
+ contentsCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Contents", nullptr));
+ indexCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Index", nullptr));
+ bookmarksCheckBox->setText(QApplication::translate("RemoteControlClass", "Show Bookmarks", nullptr));
+ menuFile->setTitle(QApplication::translate("RemoteControlClass", "File", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/saveformastemplate.ui.h b/tests/auto/tools/uic/baseline/saveformastemplate.ui.h
index 953bb211a9..ba458e5ac7 100644
--- a/tests/auto/tools/uic/baseline/saveformastemplate.ui.h
+++ b/tests/auto/tools/uic/baseline/saveformastemplate.ui.h
@@ -134,10 +134,10 @@ public:
void retranslateUi(QDialog *SaveFormAsTemplate)
{
- SaveFormAsTemplate->setWindowTitle(QApplication::translate("SaveFormAsTemplate", "Save Form As Template", Q_NULLPTR));
- label->setText(QApplication::translate("SaveFormAsTemplate", "&Name:", Q_NULLPTR));
+ SaveFormAsTemplate->setWindowTitle(QApplication::translate("SaveFormAsTemplate", "Save Form As Template", nullptr));
+ label->setText(QApplication::translate("SaveFormAsTemplate", "&Name:", nullptr));
templateNameEdit->setText(QString());
- label_2->setText(QApplication::translate("SaveFormAsTemplate", "&Category:", Q_NULLPTR));
+ label_2->setText(QApplication::translate("SaveFormAsTemplate", "&Category:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/settings.ui.h b/tests/auto/tools/uic/baseline/settings.ui.h
index 7342810462..e2ab074a46 100644
--- a/tests/auto/tools/uic/baseline/settings.ui.h
+++ b/tests/auto/tools/uic/baseline/settings.ui.h
@@ -185,13 +185,13 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
- label->setText(QApplication::translate("Dialog", "Audio device:", Q_NULLPTR));
- label_6->setText(QApplication::translate("Dialog", "Audio effect:", Q_NULLPTR));
- crossFadeLabel->setText(QApplication::translate("Dialog", "Cross fade:", Q_NULLPTR));
- label_3->setText(QApplication::translate("Dialog", "-10 Sec", Q_NULLPTR));
- label_5->setText(QApplication::translate("Dialog", "0", Q_NULLPTR));
- label_4->setText(QApplication::translate("Dialog", "10 Sec", Q_NULLPTR));
+ Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", nullptr));
+ label->setText(QApplication::translate("Dialog", "Audio device:", nullptr));
+ label_6->setText(QApplication::translate("Dialog", "Audio effect:", nullptr));
+ crossFadeLabel->setText(QApplication::translate("Dialog", "Cross fade:", nullptr));
+ label_3->setText(QApplication::translate("Dialog", "-10 Sec", nullptr));
+ label_5->setText(QApplication::translate("Dialog", "0", nullptr));
+ label_4->setText(QApplication::translate("Dialog", "10 Sec", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/signalslotdialog.ui.h b/tests/auto/tools/uic/baseline/signalslotdialog.ui.h
index 5c1483c651..9063482969 100644
--- a/tests/auto/tools/uic/baseline/signalslotdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/signalslotdialog.ui.h
@@ -136,25 +136,25 @@ public:
void retranslateUi(QDialog *SignalSlotDialogClass)
{
- SignalSlotDialogClass->setWindowTitle(QApplication::translate("SignalSlotDialogClass", "Signals and slots", Q_NULLPTR));
- slotGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Slots", Q_NULLPTR));
+ SignalSlotDialogClass->setWindowTitle(QApplication::translate("SignalSlotDialogClass", "Signals and slots", nullptr));
+ slotGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Slots", nullptr));
#ifndef QT_NO_TOOLTIP
- addSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", Q_NULLPTR));
+ addSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", nullptr));
#endif // QT_NO_TOOLTIP
- addSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", Q_NULLPTR));
+ addSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- removeSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", Q_NULLPTR));
+ removeSlotButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", nullptr));
#endif // QT_NO_TOOLTIP
- removeSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", Q_NULLPTR));
- signalGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Signals", Q_NULLPTR));
+ removeSlotButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr));
+ signalGroupBox->setTitle(QApplication::translate("SignalSlotDialogClass", "Signals", nullptr));
#ifndef QT_NO_TOOLTIP
- addSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", Q_NULLPTR));
+ addSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Add", nullptr));
#endif // QT_NO_TOOLTIP
- addSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", Q_NULLPTR));
+ addSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr));
#ifndef QT_NO_TOOLTIP
- removeSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", Q_NULLPTR));
+ removeSignalButton->setToolTip(QApplication::translate("SignalSlotDialogClass", "Delete", nullptr));
#endif // QT_NO_TOOLTIP
- removeSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", Q_NULLPTR));
+ removeSignalButton->setText(QApplication::translate("SignalSlotDialogClass", "...", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/sslclient.ui.h b/tests/auto/tools/uic/baseline/sslclient.ui.h
index 7c8676eec7..ad3b5b99e4 100644
--- a/tests/auto/tools/uic/baseline/sslclient.ui.h
+++ b/tests/auto/tools/uic/baseline/sslclient.ui.h
@@ -158,20 +158,20 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Secure Socket Client", Q_NULLPTR));
- hostNameLabel->setText(QApplication::translate("Form", "Host name:", Q_NULLPTR));
- hostNameEdit->setText(QApplication::translate("Form", "imap.example.com", Q_NULLPTR));
- portLabel->setText(QApplication::translate("Form", "Port:", Q_NULLPTR));
- connectButton->setText(QApplication::translate("Form", "Connect to host", Q_NULLPTR));
- sessionBox->setTitle(QApplication::translate("Form", "Active session", Q_NULLPTR));
- cipherText->setText(QApplication::translate("Form", "Cryptographic Cipher:", Q_NULLPTR));
- cipherLabel->setText(QApplication::translate("Form", "<none>", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Secure Socket Client", nullptr));
+ hostNameLabel->setText(QApplication::translate("Form", "Host name:", nullptr));
+ hostNameEdit->setText(QApplication::translate("Form", "imap.example.com", nullptr));
+ portLabel->setText(QApplication::translate("Form", "Port:", nullptr));
+ connectButton->setText(QApplication::translate("Form", "Connect to host", nullptr));
+ sessionBox->setTitle(QApplication::translate("Form", "Active session", nullptr));
+ cipherText->setText(QApplication::translate("Form", "Cryptographic Cipher:", nullptr));
+ cipherLabel->setText(QApplication::translate("Form", "<none>", nullptr));
sessionOutput->setHtml(QApplication::translate("Form", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", Q_NULLPTR));
- sessionInputLabel->setText(QApplication::translate("Form", "Input:", Q_NULLPTR));
- sendButton->setText(QApplication::translate("Form", "&Send", Q_NULLPTR));
+"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>", nullptr));
+ sessionInputLabel->setText(QApplication::translate("Form", "Input:", nullptr));
+ sendButton->setText(QApplication::translate("Form", "&Send", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/sslerrors.ui.h b/tests/auto/tools/uic/baseline/sslerrors.ui.h
index 0149eee45a..246d622632 100644
--- a/tests/auto/tools/uic/baseline/sslerrors.ui.h
+++ b/tests/auto/tools/uic/baseline/sslerrors.ui.h
@@ -89,14 +89,14 @@ public:
void retranslateUi(QDialog *SslErrors)
{
- SslErrors->setWindowTitle(QApplication::translate("SslErrors", "Unable To Validate The Connection", Q_NULLPTR));
+ SslErrors->setWindowTitle(QApplication::translate("SslErrors", "Unable To Validate The Connection", nullptr));
label->setText(QApplication::translate("SslErrors", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
-"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ff0000;\">Warning</span><span style=\" color:#ff0000;\">:</span><span style=\" color:#000000;\"> One or more errors with this connection prevent validating the authenticity of the host you are connecting to. Please review the following list of errors, and click </span><span style=\" color:#000000;\">Ignore</span><span style=\" color:#000000;\"> to continue, or </span><span style=\" color:#000000;\">Cancel</span><span style=\" color:#000000;\"> to abort the connection.</span></p></body></html>", Q_NULLPTR));
- certificateChainButton->setText(QApplication::translate("SslErrors", "View Certificate Chain", Q_NULLPTR));
- pushButton->setText(QApplication::translate("SslErrors", "Ignore", Q_NULLPTR));
- pushButton_2->setText(QApplication::translate("SslErrors", "Cancel", Q_NULLPTR));
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; color:#ff0000;\">Warning</span><span style=\" color:#ff0000;\">:</span><span style=\" color:#000000;\"> One or more errors with this connection prevent validating the authenticity of the host you are connecting to. Please review the following list of errors, and click </span><span style=\" color:#000000;\">Ignore</span><span style=\" color:#000000;\"> to continue, or </span><span style=\" color:#000000;\">Cancel</span><span style=\" color:#000000;\"> to abort the connection.</span></p></body></html>", nullptr));
+ certificateChainButton->setText(QApplication::translate("SslErrors", "View Certificate Chain", nullptr));
+ pushButton->setText(QApplication::translate("SslErrors", "Ignore", nullptr));
+ pushButton_2->setText(QApplication::translate("SslErrors", "Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/statistics.ui.h b/tests/auto/tools/uic/baseline/statistics.ui.h
index 8bcdd8b6d8..fb47be7135 100644
--- a/tests/auto/tools/uic/baseline/statistics.ui.h
+++ b/tests/auto/tools/uic/baseline/statistics.ui.h
@@ -182,19 +182,19 @@ public:
void retranslateUi(QDialog *Statistics)
{
- Statistics->setWindowTitle(QApplication::translate("Statistics", "Statistics", Q_NULLPTR));
- closeBtn->setText(QApplication::translate("Statistics", "&Close", Q_NULLPTR));
- textLabel4->setText(QApplication::translate("Statistics", "Translation", Q_NULLPTR));
- textLabel5->setText(QApplication::translate("Statistics", "Source", Q_NULLPTR));
- untrWords->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
- trWords->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
- textLabel1->setText(QApplication::translate("Statistics", "Words:", Q_NULLPTR));
- trChars->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
- untrChars->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
- textLabel3->setText(QApplication::translate("Statistics", "Characters:", Q_NULLPTR));
- textLabel6->setText(QApplication::translate("Statistics", "Characters (with spaces):", Q_NULLPTR));
- trCharsSpc->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
- untrCharsSpc->setText(QApplication::translate("Statistics", "0", Q_NULLPTR));
+ Statistics->setWindowTitle(QApplication::translate("Statistics", "Statistics", nullptr));
+ closeBtn->setText(QApplication::translate("Statistics", "&Close", nullptr));
+ textLabel4->setText(QApplication::translate("Statistics", "Translation", nullptr));
+ textLabel5->setText(QApplication::translate("Statistics", "Source", nullptr));
+ untrWords->setText(QApplication::translate("Statistics", "0", nullptr));
+ trWords->setText(QApplication::translate("Statistics", "0", nullptr));
+ textLabel1->setText(QApplication::translate("Statistics", "Words:", nullptr));
+ trChars->setText(QApplication::translate("Statistics", "0", nullptr));
+ untrChars->setText(QApplication::translate("Statistics", "0", nullptr));
+ textLabel3->setText(QApplication::translate("Statistics", "Characters:", nullptr));
+ textLabel6->setText(QApplication::translate("Statistics", "Characters (with spaces):", nullptr));
+ trCharsSpc->setText(QApplication::translate("Statistics", "0", nullptr));
+ untrCharsSpc->setText(QApplication::translate("Statistics", "0", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/stringlisteditor.ui.h b/tests/auto/tools/uic/baseline/stringlisteditor.ui.h
index 2dba42b4d5..96b6df74ea 100644
--- a/tests/auto/tools/uic/baseline/stringlisteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/stringlisteditor.ui.h
@@ -217,25 +217,25 @@ public:
void retranslateUi(QDialog *qdesigner_internal__Dialog)
{
- qdesigner_internal__Dialog->setWindowTitle(QApplication::translate("qdesigner_internal::Dialog", "Dialog", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("qdesigner_internal::Dialog", "StringList", Q_NULLPTR));
+ qdesigner_internal__Dialog->setWindowTitle(QApplication::translate("qdesigner_internal::Dialog", "Dialog", nullptr));
+ groupBox->setTitle(QApplication::translate("qdesigner_internal::Dialog", "StringList", nullptr));
#ifndef QT_NO_TOOLTIP
- newButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "New String", Q_NULLPTR));
+ newButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "New String", nullptr));
#endif // QT_NO_TOOLTIP
- newButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&New", Q_NULLPTR));
+ newButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&New", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Delete String", Q_NULLPTR));
+ deleteButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Delete String", nullptr));
#endif // QT_NO_TOOLTIP
- deleteButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&Delete", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::Dialog", "&Value:", Q_NULLPTR));
+ deleteButton->setText(QApplication::translate("qdesigner_internal::Dialog", "&Delete", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::Dialog", "&Value:", nullptr));
#ifndef QT_NO_TOOLTIP
- upButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Up", Q_NULLPTR));
+ upButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Up", nullptr));
#endif // QT_NO_TOOLTIP
- upButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Up", Q_NULLPTR));
+ upButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Up", nullptr));
#ifndef QT_NO_TOOLTIP
- downButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Down", Q_NULLPTR));
+ downButton->setToolTip(QApplication::translate("qdesigner_internal::Dialog", "Move String Down", nullptr));
#endif // QT_NO_TOOLTIP
- downButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Down", Q_NULLPTR));
+ downButton->setText(QApplication::translate("qdesigner_internal::Dialog", "Down", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h b/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h
index 94ffa45509..539d6fdab9 100644
--- a/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/stylesheeteditor.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'stylesheeteditor.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -63,6 +63,9 @@ public:
gridLayout->addItem(spacerItem1, 0, 0, 1, 1);
styleSheetCombo = new QComboBox(StyleSheetEditor);
+ styleSheetCombo->addItem(QString());
+ styleSheetCombo->addItem(QString());
+ styleSheetCombo->addItem(QString());
styleSheetCombo->setObjectName(QStringLiteral("styleSheetCombo"));
gridLayout->addWidget(styleSheetCombo, 0, 5, 1, 1);
@@ -130,16 +133,14 @@ public:
void retranslateUi(QWidget *StyleSheetEditor)
{
- StyleSheetEditor->setWindowTitle(QApplication::translate("StyleSheetEditor", "Style Editor", Q_NULLPTR));
- styleSheetCombo->clear();
- styleSheetCombo->insertItems(0, QStringList()
- << QApplication::translate("StyleSheetEditor", "Default", Q_NULLPTR)
- << QApplication::translate("StyleSheetEditor", "Coffee", Q_NULLPTR)
- << QApplication::translate("StyleSheetEditor", "Pagefold", Q_NULLPTR)
- );
- label_7->setText(QApplication::translate("StyleSheetEditor", "Style:", Q_NULLPTR));
- applyButton->setText(QApplication::translate("StyleSheetEditor", "&Apply", Q_NULLPTR));
- label_8->setText(QApplication::translate("StyleSheetEditor", "Style Sheet:", Q_NULLPTR));
+ StyleSheetEditor->setWindowTitle(QApplication::translate("StyleSheetEditor", "Style Editor", nullptr));
+ styleSheetCombo->setItemText(0, QApplication::translate("StyleSheetEditor", "Default", nullptr));
+ styleSheetCombo->setItemText(1, QApplication::translate("StyleSheetEditor", "Coffee", nullptr));
+ styleSheetCombo->setItemText(2, QApplication::translate("StyleSheetEditor", "Pagefold", nullptr));
+
+ label_7->setText(QApplication::translate("StyleSheetEditor", "Style:", nullptr));
+ applyButton->setText(QApplication::translate("StyleSheetEditor", "&Apply", nullptr));
+ label_8->setText(QApplication::translate("StyleSheetEditor", "Style Sheet:", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h b/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h
index acf0ddaef4..869e33c3aa 100644
--- a/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h
+++ b/tests/auto/tools/uic/baseline/tabbedbrowser.ui.h
@@ -183,14 +183,14 @@ public:
void retranslateUi(QWidget *TabbedBrowser)
{
- TabbedBrowser->setWindowTitle(QApplication::translate("TabbedBrowser", "TabbedBrowser", Q_NULLPTR));
- tab->setTabText(tab->indexOf(frontpage), QApplication::translate("TabbedBrowser", "Untitled", Q_NULLPTR));
+ TabbedBrowser->setWindowTitle(QApplication::translate("TabbedBrowser", "TabbedBrowser", nullptr));
+ tab->setTabText(tab->indexOf(frontpage), QApplication::translate("TabbedBrowser", "Untitled", nullptr));
toolClose->setText(QString());
- toolPrevious->setText(QApplication::translate("TabbedBrowser", "Previous", Q_NULLPTR));
- toolNext->setText(QApplication::translate("TabbedBrowser", "Next", Q_NULLPTR));
- checkCase->setText(QApplication::translate("TabbedBrowser", "Case Sensitive", Q_NULLPTR));
- checkWholeWords->setText(QApplication::translate("TabbedBrowser", "Whole words", Q_NULLPTR));
- labelWrapped->setText(QApplication::translate("TabbedBrowser", "<img src=\":/qt-project.org/assistant/images/wrap.png\">&nbsp;Search wrapped", Q_NULLPTR));
+ toolPrevious->setText(QApplication::translate("TabbedBrowser", "Previous", nullptr));
+ toolNext->setText(QApplication::translate("TabbedBrowser", "Next", nullptr));
+ checkCase->setText(QApplication::translate("TabbedBrowser", "Case Sensitive", nullptr));
+ checkWholeWords->setText(QApplication::translate("TabbedBrowser", "Whole words", nullptr));
+ labelWrapped->setText(QApplication::translate("TabbedBrowser", "<img src=\":/qt-project.org/assistant/images/wrap.png\">&nbsp;Search wrapped", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h
index 51c053a9c1..5c39ab4444 100644
--- a/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/tablewidgeteditor.ui.h
@@ -313,54 +313,54 @@ public:
void retranslateUi(QDialog *qdesigner_internal__TableWidgetEditor)
{
- qdesigner_internal__TableWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Edit Table Widget", Q_NULLPTR));
- itemsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", Q_NULLPTR));
+ qdesigner_internal__TableWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Edit Table Widget", nullptr));
+ itemsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr));
#ifndef QT_NO_TOOLTIP
- tableWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", Q_NULLPTR));
+ tableWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Items", nullptr));
#endif // QT_NO_TOOLTIP
- label_3->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", Q_NULLPTR));
- columnsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Columns", Q_NULLPTR));
+ label_3->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr));
+ columnsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Columns", nullptr));
#ifndef QT_NO_TOOLTIP
- columnsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Columns", Q_NULLPTR));
+ columnsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Columns", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Column", Q_NULLPTR));
+ newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Column", nullptr));
#endif // QT_NO_TOOLTIP
- newColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", Q_NULLPTR));
+ newColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Column", Q_NULLPTR));
+ deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Column", nullptr));
#endif // QT_NO_TOOLTIP
- deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", Q_NULLPTR));
+ deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr));
#ifndef QT_NO_TOOLTIP
- moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Up", Q_NULLPTR));
+ moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Up", nullptr));
#endif // QT_NO_TOOLTIP
- moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", Q_NULLPTR));
+ moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr));
#ifndef QT_NO_TOOLTIP
- moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Down", Q_NULLPTR));
+ moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Column Down", nullptr));
#endif // QT_NO_TOOLTIP
- moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", Q_NULLPTR));
- rowsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Rows", Q_NULLPTR));
+ moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr));
+ rowsBox->setTitle(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Rows", nullptr));
#ifndef QT_NO_TOOLTIP
- rowsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Rows", Q_NULLPTR));
+ rowsListWidget->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Table Rows", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Row", Q_NULLPTR));
+ newRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New Row", nullptr));
#endif // QT_NO_TOOLTIP
- newRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", Q_NULLPTR));
+ newRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "New", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Row", Q_NULLPTR));
+ deleteRowButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete Row", nullptr));
#endif // QT_NO_TOOLTIP
- deleteRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", Q_NULLPTR));
+ deleteRowButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Delete", nullptr));
#ifndef QT_NO_TOOLTIP
- moveRowUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Up", Q_NULLPTR));
+ moveRowUpButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Up", nullptr));
#endif // QT_NO_TOOLTIP
- moveRowUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", Q_NULLPTR));
+ moveRowUpButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "U", nullptr));
#ifndef QT_NO_TOOLTIP
- moveRowDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Down", Q_NULLPTR));
+ moveRowDownButton->setToolTip(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Move Row Down", nullptr));
#endif // QT_NO_TOOLTIP
- moveRowDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", Q_NULLPTR));
- label_2->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", Q_NULLPTR));
+ moveRowDownButton->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "D", nullptr));
+ label_2->setText(QApplication::translate("qdesigner_internal::TableWidgetEditor", "Icon", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/tetrixwindow.ui.h b/tests/auto/tools/uic/baseline/tetrixwindow.ui.h
index f3ec6d6fc9..131a352714 100644
--- a/tests/auto/tools/uic/baseline/tetrixwindow.ui.h
+++ b/tests/auto/tools/uic/baseline/tetrixwindow.ui.h
@@ -150,15 +150,15 @@ public:
void retranslateUi(QWidget *TetrixWindow)
{
- TetrixWindow->setWindowTitle(QApplication::translate("TetrixWindow", "Tetrix", Q_NULLPTR));
- startButton->setText(QApplication::translate("TetrixWindow", "&Start", Q_NULLPTR));
- linesRemovedLabel->setText(QApplication::translate("TetrixWindow", "LINES REMOVED", Q_NULLPTR));
- pauseButton->setText(QApplication::translate("TetrixWindow", "&Pause", Q_NULLPTR));
- levelLabel->setText(QApplication::translate("TetrixWindow", "LEVEL", Q_NULLPTR));
- nextLabel->setText(QApplication::translate("TetrixWindow", "NEXT", Q_NULLPTR));
- scoreLabel->setText(QApplication::translate("TetrixWindow", "SCORE", Q_NULLPTR));
+ TetrixWindow->setWindowTitle(QApplication::translate("TetrixWindow", "Tetrix", nullptr));
+ startButton->setText(QApplication::translate("TetrixWindow", "&Start", nullptr));
+ linesRemovedLabel->setText(QApplication::translate("TetrixWindow", "LINES REMOVED", nullptr));
+ pauseButton->setText(QApplication::translate("TetrixWindow", "&Pause", nullptr));
+ levelLabel->setText(QApplication::translate("TetrixWindow", "LEVEL", nullptr));
+ nextLabel->setText(QApplication::translate("TetrixWindow", "NEXT", nullptr));
+ scoreLabel->setText(QApplication::translate("TetrixWindow", "SCORE", nullptr));
nextPieceLabel->setText(QString());
- quitButton->setText(QApplication::translate("TetrixWindow", "&Quit", Q_NULLPTR));
+ quitButton->setText(QApplication::translate("TetrixWindow", "&Quit", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/textfinder.ui.h b/tests/auto/tools/uic/baseline/textfinder.ui.h
index 159cb54c0a..7443eacc48 100644
--- a/tests/auto/tools/uic/baseline/textfinder.ui.h
+++ b/tests/auto/tools/uic/baseline/textfinder.ui.h
@@ -96,9 +96,9 @@ public:
void retranslateUi(QWidget *Form)
{
- Form->setWindowTitle(QApplication::translate("Form", "Find Text", Q_NULLPTR));
- searchLabel->setText(QApplication::translate("Form", "&Keyword:", Q_NULLPTR));
- findButton->setText(QApplication::translate("Form", "&Find", Q_NULLPTR));
+ Form->setWindowTitle(QApplication::translate("Form", "Find Text", nullptr));
+ searchLabel->setText(QApplication::translate("Form", "&Keyword:", nullptr));
+ findButton->setText(QApplication::translate("Form", "&Find", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/topicchooser.ui.h b/tests/auto/tools/uic/baseline/topicchooser.ui.h
index 5580b437da..9a30232ff7 100644
--- a/tests/auto/tools/uic/baseline/topicchooser.ui.h
+++ b/tests/auto/tools/uic/baseline/topicchooser.ui.h
@@ -103,10 +103,10 @@ public:
void retranslateUi(QDialog *TopicChooser)
{
- TopicChooser->setWindowTitle(QApplication::translate("TopicChooser", "Choose Topic", Q_NULLPTR));
- label->setText(QApplication::translate("TopicChooser", "&Topics", Q_NULLPTR));
- buttonDisplay->setText(QApplication::translate("TopicChooser", "&Display", Q_NULLPTR));
- buttonCancel->setText(QApplication::translate("TopicChooser", "&Close", Q_NULLPTR));
+ TopicChooser->setWindowTitle(QApplication::translate("TopicChooser", "Choose Topic", nullptr));
+ label->setText(QApplication::translate("TopicChooser", "&Topics", nullptr));
+ buttonDisplay->setText(QApplication::translate("TopicChooser", "&Display", nullptr));
+ buttonCancel->setText(QApplication::translate("TopicChooser", "&Close", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/translatedialog.ui.h b/tests/auto/tools/uic/baseline/translatedialog.ui.h
index 14b1622d8f..0dcd249d68 100644
--- a/tests/auto/tools/uic/baseline/translatedialog.ui.h
+++ b/tests/auto/tools/uic/baseline/translatedialog.ui.h
@@ -208,34 +208,34 @@ public:
void retranslateUi(QDialog *TranslateDialog)
{
- TranslateDialog->setWindowTitle(QApplication::translate("TranslateDialog", "Qt Linguist", Q_NULLPTR));
+ TranslateDialog->setWindowTitle(QApplication::translate("TranslateDialog", "Qt Linguist", nullptr));
#ifndef QT_NO_WHATSTHIS
- TranslateDialog->setWhatsThis(QApplication::translate("TranslateDialog", "This window allows you to search for some text in the translation source file.", Q_NULLPTR));
+ TranslateDialog->setWhatsThis(QApplication::translate("TranslateDialog", "This window allows you to search for some text in the translation source file.", nullptr));
#endif // QT_NO_WHATSTHIS
#ifndef QT_NO_WHATSTHIS
- ledTranslateTo->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", Q_NULLPTR));
+ ledTranslateTo->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr));
#endif // QT_NO_WHATSTHIS
- findWhat->setText(QApplication::translate("TranslateDialog", "Find &source text:", Q_NULLPTR));
- translateTo->setText(QApplication::translate("TranslateDialog", "&Translate to:", Q_NULLPTR));
+ findWhat->setText(QApplication::translate("TranslateDialog", "Find &source text:", nullptr));
+ translateTo->setText(QApplication::translate("TranslateDialog", "&Translate to:", nullptr));
#ifndef QT_NO_WHATSTHIS
- ledFindWhat->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", Q_NULLPTR));
+ ledFindWhat->setWhatsThis(QApplication::translate("TranslateDialog", "Type in the text to search for.", nullptr));
#endif // QT_NO_WHATSTHIS
- groupBox->setTitle(QApplication::translate("TranslateDialog", "Search options", Q_NULLPTR));
+ groupBox->setTitle(QApplication::translate("TranslateDialog", "Search options", nullptr));
#ifndef QT_NO_WHATSTHIS
- ckMatchCase->setWhatsThis(QApplication::translate("TranslateDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", Q_NULLPTR));
+ ckMatchCase->setWhatsThis(QApplication::translate("TranslateDialog", "Texts such as 'TeX' and 'tex' are considered as different when checked.", nullptr));
#endif // QT_NO_WHATSTHIS
- ckMatchCase->setText(QApplication::translate("TranslateDialog", "Match &case", Q_NULLPTR));
- ckMarkFinished->setText(QApplication::translate("TranslateDialog", "Mark new translation as &finished", Q_NULLPTR));
+ ckMatchCase->setText(QApplication::translate("TranslateDialog", "Match &case", nullptr));
+ ckMarkFinished->setText(QApplication::translate("TranslateDialog", "Mark new translation as &finished", nullptr));
#ifndef QT_NO_WHATSTHIS
- findNxt->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to find the next occurrence of the text you typed in.", Q_NULLPTR));
+ findNxt->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to find the next occurrence of the text you typed in.", nullptr));
#endif // QT_NO_WHATSTHIS
- findNxt->setText(QApplication::translate("TranslateDialog", "Find Next", Q_NULLPTR));
- translate->setText(QApplication::translate("TranslateDialog", "Translate", Q_NULLPTR));
- translateAll->setText(QApplication::translate("TranslateDialog", "Translate All", Q_NULLPTR));
+ findNxt->setText(QApplication::translate("TranslateDialog", "Find Next", nullptr));
+ translate->setText(QApplication::translate("TranslateDialog", "Translate", nullptr));
+ translateAll->setText(QApplication::translate("TranslateDialog", "Translate All", nullptr));
#ifndef QT_NO_WHATSTHIS
- cancel->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to close this window.", Q_NULLPTR));
+ cancel->setWhatsThis(QApplication::translate("TranslateDialog", "Click here to close this window.", nullptr));
#endif // QT_NO_WHATSTHIS
- cancel->setText(QApplication::translate("TranslateDialog", "Cancel", Q_NULLPTR));
+ cancel->setText(QApplication::translate("TranslateDialog", "Cancel", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h
index 08c063cf6f..9251582ef8 100644
--- a/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h
+++ b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h
@@ -36,7 +36,7 @@ public:
void retranslateUi(QDialog *Dialog)
{
- Dialog->setWindowTitle(i18n("Dialog", Q_NULLPTR));
+ Dialog->setWindowTitle(i18n("Dialog", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/translationsettings.ui.h b/tests/auto/tools/uic/baseline/translationsettings.ui.h
index 628c42d42e..ef4e3ab819 100644
--- a/tests/auto/tools/uic/baseline/translationsettings.ui.h
+++ b/tests/auto/tools/uic/baseline/translationsettings.ui.h
@@ -102,10 +102,10 @@ public:
void retranslateUi(QDialog *TranslationSettings)
{
- TranslationSettings->setWindowTitle(QApplication::translate("TranslationSettings", "Qt Linguist - Translation file settings", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("TranslationSettings", "Target language", Q_NULLPTR));
- label->setText(QApplication::translate("TranslationSettings", "Language", Q_NULLPTR));
- lblCountry->setText(QApplication::translate("TranslationSettings", "Country/Region", Q_NULLPTR));
+ TranslationSettings->setWindowTitle(QApplication::translate("TranslationSettings", "Qt Linguist - Translation file settings", nullptr));
+ groupBox->setTitle(QApplication::translate("TranslationSettings", "Target language", nullptr));
+ label->setText(QApplication::translate("TranslationSettings", "Language", nullptr));
+ lblCountry->setText(QApplication::translate("TranslationSettings", "Country/Region", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h b/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h
index ce077c42f4..6257bb8245 100644
--- a/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h
+++ b/tests/auto/tools/uic/baseline/treewidgeteditor.ui.h
@@ -278,63 +278,63 @@ public:
void retranslateUi(QDialog *qdesigner_internal__TreeWidgetEditor)
{
- qdesigner_internal__TreeWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Edit Tree Widget", Q_NULLPTR));
- itemsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", Q_NULLPTR));
+ qdesigner_internal__TreeWidgetEditor->setWindowTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Edit Tree Widget", nullptr));
+ itemsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr));
QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("qdesigner_internal::TreeWidgetEditor", "1", Q_NULLPTR));
+ ___qtreewidgetitem->setText(0, QApplication::translate("qdesigner_internal::TreeWidgetEditor", "1", nullptr));
#ifndef QT_NO_TOOLTIP
- treeWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", Q_NULLPTR));
+ treeWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Items", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Item", Q_NULLPTR));
+ newItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Item", nullptr));
#endif // QT_NO_TOOLTIP
- newItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&New", Q_NULLPTR));
+ newItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&New", nullptr));
#ifndef QT_NO_TOOLTIP
- newSubItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Subitem", Q_NULLPTR));
+ newSubItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Subitem", nullptr));
#endif // QT_NO_TOOLTIP
- newSubItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New &Subitem", Q_NULLPTR));
+ newSubItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New &Subitem", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Item", Q_NULLPTR));
+ deleteItemButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Item", nullptr));
#endif // QT_NO_TOOLTIP
- deleteItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&Delete", Q_NULLPTR));
+ deleteItemButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "&Delete", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemLeftButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Left (before Parent Item)", Q_NULLPTR));
+ moveItemLeftButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Left (before Parent Item)", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemLeftButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "L", Q_NULLPTR));
+ moveItemLeftButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "L", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemRightButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Right (as a First Subitem of the Next Sibling Item)", Q_NULLPTR));
+ moveItemRightButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Right (as a First Subitem of the Next Sibling Item)", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemRightButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "R", Q_NULLPTR));
+ moveItemRightButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "R", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Up", Q_NULLPTR));
+ moveItemUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Up", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", Q_NULLPTR));
+ moveItemUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr));
#ifndef QT_NO_TOOLTIP
- moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Down", Q_NULLPTR));
+ moveItemDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Item Down", nullptr));
#endif // QT_NO_TOOLTIP
- moveItemDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", Q_NULLPTR));
- label_2->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", Q_NULLPTR));
- columnsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Columns", Q_NULLPTR));
+ moveItemDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr));
+ label_2->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr));
+ columnsBox->setTitle(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Columns", nullptr));
#ifndef QT_NO_TOOLTIP
- listWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Columns", Q_NULLPTR));
+ listWidget->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Tree Columns", nullptr));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
- newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Column", Q_NULLPTR));
+ newColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New Column", nullptr));
#endif // QT_NO_TOOLTIP
- newColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New", Q_NULLPTR));
+ newColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "New", nullptr));
#ifndef QT_NO_TOOLTIP
- deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Column", Q_NULLPTR));
+ deleteColumnButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete Column", nullptr));
#endif // QT_NO_TOOLTIP
- deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete", Q_NULLPTR));
+ deleteColumnButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Delete", nullptr));
#ifndef QT_NO_TOOLTIP
- moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Up", Q_NULLPTR));
+ moveColumnUpButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Up", nullptr));
#endif // QT_NO_TOOLTIP
- moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", Q_NULLPTR));
+ moveColumnUpButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "U", nullptr));
#ifndef QT_NO_TOOLTIP
- moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Down", Q_NULLPTR));
+ moveColumnDownButton->setToolTip(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Move Column Down", nullptr));
#endif // QT_NO_TOOLTIP
- moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", Q_NULLPTR));
- label->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", Q_NULLPTR));
+ moveColumnDownButton->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "D", nullptr));
+ label->setText(QApplication::translate("qdesigner_internal::TreeWidgetEditor", "Icon", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
index 7545b4c803..d23e8bae4c 100644
--- a/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
+++ b/tests/auto/tools/uic/baseline/trpreviewtool.ui.h
@@ -164,21 +164,21 @@ public:
void retranslateUi(QMainWindow *TrPreviewToolClass)
{
- TrPreviewToolClass->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Qt Translation Preview Tool", Q_NULLPTR));
- actionOpenForm->setText(QApplication::translate("TrPreviewToolClass", "&Open Form...", Q_NULLPTR));
- actionLoadTranslation->setText(QApplication::translate("TrPreviewToolClass", "&Load Translation...", Q_NULLPTR));
- actionReloadTranslations->setText(QApplication::translate("TrPreviewToolClass", "&Reload Translations", Q_NULLPTR));
+ TrPreviewToolClass->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Qt Translation Preview Tool", nullptr));
+ actionOpenForm->setText(QApplication::translate("TrPreviewToolClass", "&Open Form...", nullptr));
+ actionLoadTranslation->setText(QApplication::translate("TrPreviewToolClass", "&Load Translation...", nullptr));
+ actionReloadTranslations->setText(QApplication::translate("TrPreviewToolClass", "&Reload Translations", nullptr));
#ifndef QT_NO_SHORTCUT
- actionReloadTranslations->setShortcut(QApplication::translate("TrPreviewToolClass", "F5", Q_NULLPTR));
+ actionReloadTranslations->setShortcut(QApplication::translate("TrPreviewToolClass", "F5", nullptr));
#endif // QT_NO_SHORTCUT
- actionClose->setText(QApplication::translate("TrPreviewToolClass", "&Close", Q_NULLPTR));
- actionAbout->setText(QApplication::translate("TrPreviewToolClass", "About", Q_NULLPTR));
- actionAbout_Qt->setText(QApplication::translate("TrPreviewToolClass", "About Qt", Q_NULLPTR));
- menuView->setTitle(QApplication::translate("TrPreviewToolClass", "&View", Q_NULLPTR));
- menuViewViews->setTitle(QApplication::translate("TrPreviewToolClass", "&Views", Q_NULLPTR));
- menuHelp->setTitle(QApplication::translate("TrPreviewToolClass", "&Help", Q_NULLPTR));
- menuFile->setTitle(QApplication::translate("TrPreviewToolClass", "&File", Q_NULLPTR));
- dwForms->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Forms", Q_NULLPTR));
+ actionClose->setText(QApplication::translate("TrPreviewToolClass", "&Close", nullptr));
+ actionAbout->setText(QApplication::translate("TrPreviewToolClass", "About", nullptr));
+ actionAbout_Qt->setText(QApplication::translate("TrPreviewToolClass", "About Qt", nullptr));
+ menuView->setTitle(QApplication::translate("TrPreviewToolClass", "&View", nullptr));
+ menuViewViews->setTitle(QApplication::translate("TrPreviewToolClass", "&Views", nullptr));
+ menuHelp->setTitle(QApplication::translate("TrPreviewToolClass", "&Help", nullptr));
+ menuFile->setTitle(QApplication::translate("TrPreviewToolClass", "&File", nullptr));
+ dwForms->setWindowTitle(QApplication::translate("TrPreviewToolClass", "Forms", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/validators.ui.h b/tests/auto/tools/uic/baseline/validators.ui.h
index e8548f1454..546c050dd8 100644
--- a/tests/auto/tools/uic/baseline/validators.ui.h
+++ b/tests/auto/tools/uic/baseline/validators.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'validators.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -268,6 +268,8 @@ public:
gridLayout1->addWidget(label_5, 0, 2, 1, 1);
doubleFormat = new QComboBox(groupBox_2);
+ doubleFormat->addItem(QString());
+ doubleFormat->addItem(QString());
doubleFormat->setObjectName(QStringLiteral("doubleFormat"));
gridLayout1->addWidget(doubleFormat, 0, 3, 1, 1);
@@ -376,24 +378,22 @@ public:
void retranslateUi(QWidget *ValidatorsForm)
{
- ValidatorsForm->setWindowTitle(QApplication::translate("ValidatorsForm", "Form", Q_NULLPTR));
- groupBox->setTitle(QApplication::translate("ValidatorsForm", "QIntValidator", Q_NULLPTR));
- label->setText(QApplication::translate("ValidatorsForm", "Min:", Q_NULLPTR));
- label_2->setText(QApplication::translate("ValidatorsForm", "Max:", Q_NULLPTR));
- label_7->setText(QApplication::translate("ValidatorsForm", "editingFinished()", Q_NULLPTR));
- groupBox_2->setTitle(QApplication::translate("ValidatorsForm", "QDoubleValidator", Q_NULLPTR));
- label_3->setText(QApplication::translate("ValidatorsForm", "Min:", Q_NULLPTR));
- label_5->setText(QApplication::translate("ValidatorsForm", "Format:", Q_NULLPTR));
- doubleFormat->clear();
- doubleFormat->insertItems(0, QStringList()
- << QApplication::translate("ValidatorsForm", "Standard", Q_NULLPTR)
- << QApplication::translate("ValidatorsForm", "Scientific", Q_NULLPTR)
- );
- label_4->setText(QApplication::translate("ValidatorsForm", "Max:", Q_NULLPTR));
- label_6->setText(QApplication::translate("ValidatorsForm", "Decimals:", Q_NULLPTR));
+ ValidatorsForm->setWindowTitle(QApplication::translate("ValidatorsForm", "Form", nullptr));
+ groupBox->setTitle(QApplication::translate("ValidatorsForm", "QIntValidator", nullptr));
+ label->setText(QApplication::translate("ValidatorsForm", "Min:", nullptr));
+ label_2->setText(QApplication::translate("ValidatorsForm", "Max:", nullptr));
+ label_7->setText(QApplication::translate("ValidatorsForm", "editingFinished()", nullptr));
+ groupBox_2->setTitle(QApplication::translate("ValidatorsForm", "QDoubleValidator", nullptr));
+ label_3->setText(QApplication::translate("ValidatorsForm", "Min:", nullptr));
+ label_5->setText(QApplication::translate("ValidatorsForm", "Format:", nullptr));
+ doubleFormat->setItemText(0, QApplication::translate("ValidatorsForm", "Standard", nullptr));
+ doubleFormat->setItemText(1, QApplication::translate("ValidatorsForm", "Scientific", nullptr));
+
+ label_4->setText(QApplication::translate("ValidatorsForm", "Max:", nullptr));
+ label_6->setText(QApplication::translate("ValidatorsForm", "Decimals:", nullptr));
doubleLedWidget->setText(QString());
- label_8->setText(QApplication::translate("ValidatorsForm", "editingFinished()", Q_NULLPTR));
- pushButton->setText(QApplication::translate("ValidatorsForm", "Quit", Q_NULLPTR));
+ label_8->setText(QApplication::translate("ValidatorsForm", "editingFinished()", nullptr));
+ pushButton->setText(QApplication::translate("ValidatorsForm", "Quit", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h
index 348a83a8da..48820b14a0 100644
--- a/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h
+++ b/tests/auto/tools/uic/baseline/wateringconfigdialog.ui.h
@@ -1,7 +1,7 @@
/********************************************************************************
** Form generated from reading UI file 'wateringconfigdialog.ui'
**
-** Created by: Qt User Interface Compiler version 5.0.0
+** Created by: Qt User Interface Compiler version 5.10.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
@@ -79,6 +79,12 @@ public:
gridLayout->addWidget(label_3, 0, 0, 1, 1);
plantComboBox = new QComboBox(WateringConfigDialog);
+ plantComboBox->addItem(QString());
+ plantComboBox->addItem(QString());
+ plantComboBox->addItem(QString());
+ plantComboBox->addItem(QString());
+ plantComboBox->addItem(QString());
+ plantComboBox->addItem(QString());
plantComboBox->setObjectName(QStringLiteral("plantComboBox"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
@@ -173,6 +179,10 @@ public:
gridLayout->addWidget(label_5, 10, 0, 1, 1);
sourceComboBox = new QComboBox(WateringConfigDialog);
+ sourceComboBox->addItem(QString());
+ sourceComboBox->addItem(QString());
+ sourceComboBox->addItem(QString());
+ sourceComboBox->addItem(QString());
sourceComboBox->setObjectName(QStringLiteral("sourceComboBox"));
gridLayout->addWidget(sourceComboBox, 10, 1, 1, 3);
@@ -243,38 +253,34 @@ public:
void retranslateUi(QDialog *WateringConfigDialog)
{
- WateringConfigDialog->setWindowTitle(QApplication::translate("WateringConfigDialog", "Watering Configuration", Q_NULLPTR));
- label_3->setText(QApplication::translate("WateringConfigDialog", "Plant:", Q_NULLPTR));
- plantComboBox->clear();
- plantComboBox->insertItems(0, QStringList()
- << QApplication::translate("WateringConfigDialog", "Squash", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Bean", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Carrot", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Strawberry", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Raspberry", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Blueberry", Q_NULLPTR)
- );
- label_2->setText(QApplication::translate("WateringConfigDialog", "Water when:", Q_NULLPTR));
- temperatureCheckBox->setText(QApplication::translate("WateringConfigDialog", "Temperature is higher than:", Q_NULLPTR));
+ WateringConfigDialog->setWindowTitle(QApplication::translate("WateringConfigDialog", "Watering Configuration", nullptr));
+ label_3->setText(QApplication::translate("WateringConfigDialog", "Plant:", nullptr));
+ plantComboBox->setItemText(0, QApplication::translate("WateringConfigDialog", "Squash", nullptr));
+ plantComboBox->setItemText(1, QApplication::translate("WateringConfigDialog", "Bean", nullptr));
+ plantComboBox->setItemText(2, QApplication::translate("WateringConfigDialog", "Carrot", nullptr));
+ plantComboBox->setItemText(3, QApplication::translate("WateringConfigDialog", "Strawberry", nullptr));
+ plantComboBox->setItemText(4, QApplication::translate("WateringConfigDialog", "Raspberry", nullptr));
+ plantComboBox->setItemText(5, QApplication::translate("WateringConfigDialog", "Blueberry", nullptr));
+
+ label_2->setText(QApplication::translate("WateringConfigDialog", "Water when:", nullptr));
+ temperatureCheckBox->setText(QApplication::translate("WateringConfigDialog", "Temperature is higher than:", nullptr));
temperatureSpinBox->setSpecialValueText(QString());
- temperatureSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "C", Q_NULLPTR));
- rainCheckBox->setText(QApplication::translate("WateringConfigDialog", "Rain less than:", Q_NULLPTR));
+ temperatureSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "C", nullptr));
+ rainCheckBox->setText(QApplication::translate("WateringConfigDialog", "Rain less than:", nullptr));
rainSpinBox->setSpecialValueText(QString());
- rainSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "mm", Q_NULLPTR));
- label->setText(QApplication::translate("WateringConfigDialog", "Starting Time:", Q_NULLPTR));
- label_4->setText(QApplication::translate("WateringConfigDialog", "Amount:", Q_NULLPTR));
- amountSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "l", Q_NULLPTR));
- label_5->setText(QApplication::translate("WateringConfigDialog", "Source:", Q_NULLPTR));
- sourceComboBox->clear();
- sourceComboBox->insertItems(0, QStringList()
- << QApplication::translate("WateringConfigDialog", "Foundain", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "River", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Lake", Q_NULLPTR)
- << QApplication::translate("WateringConfigDialog", "Public Water System", Q_NULLPTR)
- );
- label_6->setText(QApplication::translate("WateringConfigDialog", "Filter:", Q_NULLPTR));
+ rainSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "mm", nullptr));
+ label->setText(QApplication::translate("WateringConfigDialog", "Starting Time:", nullptr));
+ label_4->setText(QApplication::translate("WateringConfigDialog", "Amount:", nullptr));
+ amountSpinBox->setSuffix(QApplication::translate("WateringConfigDialog", "l", nullptr));
+ label_5->setText(QApplication::translate("WateringConfigDialog", "Source:", nullptr));
+ sourceComboBox->setItemText(0, QApplication::translate("WateringConfigDialog", "Foundain", nullptr));
+ sourceComboBox->setItemText(1, QApplication::translate("WateringConfigDialog", "River", nullptr));
+ sourceComboBox->setItemText(2, QApplication::translate("WateringConfigDialog", "Lake", nullptr));
+ sourceComboBox->setItemText(3, QApplication::translate("WateringConfigDialog", "Public Water System", nullptr));
+
+ label_6->setText(QApplication::translate("WateringConfigDialog", "Filter:", nullptr));
filterCheckBox->setText(QString());
- helpLabel->setText(QApplication::translate("WateringConfigDialog", "<a href=\"test\">Show Details</a>", Q_NULLPTR));
+ helpLabel->setText(QApplication::translate("WateringConfigDialog", "<a href=\"test\">Show Details</a>", nullptr));
} // retranslateUi
};
diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp
index cf43cb02d3..85668c96d4 100644
--- a/tests/auto/tools/uic/tst_uic.cpp
+++ b/tests/auto/tools/uic/tst_uic.cpp
@@ -34,6 +34,7 @@
#include <QtCore/QByteArray>
#include <QtCore/QLibraryInfo>
#include <QtCore/QTemporaryDir>
+#include <QtCore/QRegularExpression>
#include <QtCore/QStandardPaths>
class tst_uic : public QObject
@@ -63,12 +64,12 @@ private:
const QString m_command;
QString m_baseline;
QTemporaryDir m_generated;
- QRegExp m_versionRegexp;
+ QRegularExpression m_versionRegexp;
};
tst_uic::tst_uic()
: m_command(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/uic"))
- , m_versionRegexp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}"))
+ , m_versionRegexp(QLatin1String("\\*\\* Created by: Qt User Interface Compiler version \\d{1,2}\\.\\d{1,2}\\.\\d{1,2}"))
{
}
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index b950bf3957..eafd4d7cea 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -48,6 +48,7 @@
#include <qlineedit.h>
#include <qlayout.h>
#include <qmenu.h>
+#include <qrandom.h>
#include "../../../../../src/widgets/dialogs/qsidebar_p.h"
#include "../../../../../src/widgets/dialogs/qfilesystemmodel_p.h"
#include "../../../../../src/widgets/dialogs/qfiledialog_p.h"
@@ -367,7 +368,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior()
fd.selectFile(ctx.file.fileName());
fd.show();
- QTest::qWaitForWindowActive(&fd);
+ QVERIFY(QTest::qWaitForWindowActive(&fd));
// grab some internals:
QAction *rm = fd.findChild<QAction*>("qt_delete_action");
@@ -1196,7 +1197,7 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly()
{
const QString tempPath = tempDir.path();
QDir dirTemp(tempPath);
- const QString tempName = QLatin1String("showDirsOnly.") + QString::number(qrand());
+ const QString tempName = QLatin1String("showDirsOnly.") + QString::number(QRandomGenerator::global()->generate());
dirTemp.mkdir(tempName);
dirTemp.cd(tempName);
QTRY_VERIFY(dirTemp.exists());
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index 8da6ef0363..62286d703f 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -47,6 +47,7 @@ class tst_QInputDialog : public QObject
static void testFuncGetDouble(QInputDialog *dialog);
static void testFuncGetText(QInputDialog *dialog);
static void testFuncGetItem(QInputDialog *dialog);
+ static void testFuncSingleStepDouble(QInputDialog *dialog);
void timerEvent(QTimerEvent *event);
private slots:
void getInt_data();
@@ -61,6 +62,8 @@ private slots:
void getItem();
void task256299_getTextReturnNullStringOnRejected();
void inputMethodHintsOfChildWidget();
+ void setDoubleStep_data();
+ void setDoubleStep();
};
QString stripFraction(const QString &s)
@@ -498,5 +501,45 @@ void tst_QInputDialog::inputMethodHintsOfChildWidget()
QCOMPARE(editWidget->inputMethodHints(), Qt::ImhDigitsOnly);
}
+void tst_QInputDialog::testFuncSingleStepDouble(QInputDialog *dialog)
+{
+ QDoubleSpinBox *sbox = dialog->findChild<QDoubleSpinBox *>();
+ QVERIFY(sbox);
+ QTest::keyClick(sbox, Qt::Key_Up);
+}
+
+void tst_QInputDialog::setDoubleStep_data()
+{
+ QTest::addColumn<double>("min");
+ QTest::addColumn<double>("max");
+ QTest::addColumn<int>("decimals");
+ QTest::addColumn<double>("doubleStep");
+ QTest::addColumn<double>("actualResult");
+ QTest::newRow("step 2.0") << 0.0 << 10.0 << 0 << 2.0 << 2.0;
+ QTest::newRow("step 2.5") << 0.5 << 10.5 << 1 << 2.5 << 3.0;
+ QTest::newRow("step 2.25") << 10.05 << 20.05 << 2 << 2.25 << 12.30;
+ QTest::newRow("step 2.25 fewer decimals") << 0.5 << 10.5 << 1 << 2.25 << 2.75;
+}
+
+void tst_QInputDialog::setDoubleStep()
+{
+ QFETCH(double, min);
+ QFETCH(double, max);
+ QFETCH(int, decimals);
+ QFETCH(double, doubleStep);
+ QFETCH(double, actualResult);
+ QWidget p;
+ parent = &p;
+ doneCode = QDialog::Accepted;
+ testFunc = &tst_QInputDialog::testFuncSingleStepDouble;
+ startTimer(0);
+ bool ok = false;
+ const double result = QInputDialog::getDouble(parent, QString(), QString(), min, min,
+ max, decimals, &ok, QFlags<Qt::WindowType>(),
+ doubleStep);
+ QVERIFY(ok);
+ QCOMPARE(result, actualResult);
+}
+
QTEST_MAIN(tst_QInputDialog)
#include "tst_qinputdialog.moc"
diff --git a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
new file mode 100644
index 0000000000..36e47830d0
--- /dev/null
+++ b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
@@ -0,0 +1,2 @@
+[defaultButton]
+osx ci
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index d6c4841b22..6a16e48394 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -185,6 +185,12 @@ void tst_QMessageBox::cleanup()
void tst_QMessageBox::sanityTest()
{
+#if defined(Q_OS_MACOS)
+ if (QSysInfo::productVersion() == QLatin1String("10.12")) {
+ QSKIP("Test hangs on macOS 10.12 -- QTQAINFRA-1362");
+ return;
+ }
+#endif
QMessageBox msgBox;
msgBox.setText("This is insane");
for (int i = 0; i < 10; i++)
@@ -588,7 +594,7 @@ void tst_QMessageBox::detailsText()
box.setDetailedText(text);
QCOMPARE(box.detailedText(), text);
box.show();
- QTest::qWaitForWindowExposed(&box);
+ QVERIFY(QTest::qWaitForWindowExposed(&box));
// QTBUG-39334, the box should now have the default "Ok" button as well as
// the "Show Details.." button.
QCOMPARE(box.findChildren<QAbstractButton *>().size(), 2);
@@ -641,7 +647,7 @@ void tst_QMessageBox::expandDetails_QTBUG_32473()
// that the window manager is also done manipulating the first QMessageBox.
QWidget fleece;
fleece.show();
- QTest::qWaitForWindowExposed(&fleece);
+ QVERIFY(QTest::qWaitForWindowExposed(&fleece));
if (geom.topLeft() == box.geometry().topLeft())
QTest::qWait(500);
QCOMPARE(geom.topLeft(), box.geometry().topLeft());
diff --git a/tests/auto/widgets/gestures/gestures.pro b/tests/auto/widgets/gestures/gestures.pro
deleted file mode 100644
index 5a87a01ee2..0000000000
--- a/tests/auto/widgets/gestures/gestures.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE=subdirs
-SUBDIRS=\
- qgesturerecognizer \
-
-mac: SUBDIRS -= \ # Uses native recognizers
- qgesturerecognizer \
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 0fc1a643b4..2220ef8d2f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -33,6 +33,7 @@
#include <private/qgraphicsitem_p.h>
#include <private/qgraphicsview_p.h>
#include <private/qgraphicsscene_p.h>
+#include <QRandomGenerator>
#include <QStyleOptionGraphicsItem>
#include <QAbstractTextDocumentLayout>
#include <QBitmap>
@@ -3585,12 +3586,12 @@ void tst_QGraphicsItem::group()
QList<QGraphicsItem *> newItems;
for (int i = 0; i < 100; ++i) {
QGraphicsItem *item = scene.addRect(QRectF(-25, -25, 50, 50), QPen(Qt::black, 0),
- QBrush(QColor(rand() % 255, rand() % 255,
- rand() % 255, rand() % 255)));
+ QBrush(QColor(QRandomGenerator::global()->bounded(255), QRandomGenerator::global()->bounded(255),
+ QRandomGenerator::global()->bounded(255), QRandomGenerator::global()->bounded(255))));
newItems << item;
- item->setPos(-1000 + rand() % 2000,
- -1000 + rand() % 2000);
- item->setTransform(QTransform().rotate(rand() % 90), true);
+ item->setPos(-1000 + QRandomGenerator::global()->bounded(2000),
+ -1000 + QRandomGenerator::global()->bounded(2000));
+ item->setTransform(QTransform().rotate(QRandomGenerator::global()->bounded(90)), true);
}
view.fitInView(scene.itemsBoundingRect());
@@ -4133,8 +4134,8 @@ void tst_QGraphicsItem::ensureVisible()
for (int x = -100; x < 100; x += 25) {
for (int y = -100; y < 100; y += 25) {
- int xmargin = rand() % 75;
- int ymargin = rand() % 75;
+ int xmargin = QRandomGenerator::global()->bounded(75);
+ int ymargin = QRandomGenerator::global()->bounded(75);
item->ensureVisible(x, y, 25, 25, xmargin, ymargin);
QApplication::processEvents();
@@ -7127,7 +7128,7 @@ public:
: QGraphicsRectItem(QRectF(-10, -10, 20, 20))
{
setPen(QPen(Qt::black, 0));
- setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
+ setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
}
QTransform x;
@@ -11409,7 +11410,7 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene()
item2->setParentItem(item);
scene.addItem(item);
view.show();
- QTest::qWaitForWindowActive(view.windowHandle());
+ QVERIFY(QTest::qWaitForWindowActive(view.windowHandle()));
view.activateWindow();
QTRY_VERIFY(view.isActiveWindow());
QTRY_VERIFY(view.repaints >= 1);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index e49cd87941..07d195b3e8 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -824,7 +824,7 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
QApplication::setActiveWindow(&view);
view.activateWindow();
view.setFocus();
- QTest::qWaitForWindowActive(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
QTRY_VERIFY(view.isVisible());
QTRY_COMPARE(QApplication::activeWindow(), (QWidget*)&view);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
index c6f69a51a5..70170d2822 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
@@ -1,3 +1,5 @@
[removeItem]
# QTBUG-60754, QTest::mouseMove is not always respected, or the CI moves the cursor
osx-10.11 ci
+[isActive]
+opensuse-42.3 ci
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 7615c5e821..968233438a 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1507,10 +1507,10 @@ void tst_QGraphicsScene::mouseGrabberItem()
QCOMPARE(scene.mouseGrabberItem(), topMostItem);
// Geometrical changes should not affect the mouse grabber.
- item->setZValue(rand() % 500);
- item2->setZValue(rand() % 500);
- item->setPos(rand() % 50000, rand() % 50000);
- item2->setPos(rand() % 50000, rand() % 50000);
+ item->setZValue(QRandomGenerator::global()->bounded(500));
+ item2->setZValue(QRandomGenerator::global()->bounded(500));
+ item->setPos(QRandomGenerator::global()->bounded(50000), QRandomGenerator::global()->bounded(50000));
+ item2->setPos(QRandomGenerator::global()->bounded(50000), QRandomGenerator::global()->bounded(50000));
}
QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
@@ -3424,7 +3424,7 @@ void tst_QGraphicsScene::task139710_bspTreeCrash()
// add 1000 more items - the BSP tree is now resized
for (int i = 0; i < 1000; ++i) {
QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 200, 200));
- item->setPos(qrand() % 10000, qrand() % 10000);
+ item->setPos(QRandomGenerator::global()->bounded(10000), QRandomGenerator::global()->bounded(10000));
}
// trigger delayed item indexing for the first 1000 items
@@ -3433,7 +3433,7 @@ void tst_QGraphicsScene::task139710_bspTreeCrash()
// add 1000 more items - the BSP tree is now resized
for (int i = 0; i < 1000; ++i) {
QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 200, 200));
- item->setPos(qrand() % 10000, qrand() % 10000);
+ item->setPos(QRandomGenerator::global()->bounded(10000), QRandomGenerator::global()->bounded(10000));
}
// get items from the BSP tree and use them. there was junk in the tree
@@ -3543,15 +3543,15 @@ void tst_QGraphicsScene::sorting()
QGraphicsRectItem *c_2_1 = new QGraphicsRectItem(0, 0, 30, 30, c_2);
QGraphicsRectItem *c_2_1_1 = new QGraphicsRectItem(0, 0, 20, 20, c_2_1);
QGraphicsRectItem *c_2_2 = new QGraphicsRectItem(0, 0, 30, 30, c_2);
- t_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_1_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_1_1_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_1_2->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_2->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_2_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_2_1_1->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
- c_2_2->setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256));
+ t_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_1_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_1_1_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_1_2->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_2->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_2_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_2_1_1->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
+ c_2_2->setBrush(QColor(QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256), QRandomGenerator::global()->bounded(256)));
c_1->setPos(23, 18);
c_1_1->setPos(24, 28);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 5b557dba58..f624bb6a5f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -684,7 +684,7 @@ void tst_QGraphicsView::openGLViewport()
view.setViewport(glw);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QTRY_VERIFY(spy1.count() > 0);
QTRY_VERIFY(spy2.count() >= spy1.count());
spy1.clear();
@@ -2899,7 +2899,7 @@ void tst_QGraphicsView::scrollBarRanges()
QFETCH(ExpectedValueDescription, vmax);
QFETCH(bool, useStyledPanel);
- if (useStyledPanel && style == "Macintosh" && platformName == QStringLiteral("cocoa"))
+ if (useStyledPanel && style == "macintosh" && platformName == QStringLiteral("cocoa"))
QSKIP("Insignificant on OSX");
QScopedPointer<QStyle> stylePtr;
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 165c4b079e..1ac66ed5cb 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -620,7 +620,9 @@ void tst_QAbstractItemView::rowDelegate()
QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(3, 0);
+ QVERIFY(!view.isPersistentEditorOpen(index));
view.openPersistentEditor(index);
+ QVERIFY(view.isPersistentEditorOpen(index));
QWidget *w = view.indexWidget(index);
QVERIFY(w);
QCOMPARE(w->metaObject()->className(), "QWidget");
@@ -640,7 +642,9 @@ void tst_QAbstractItemView::columnDelegate()
QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex index = model.index(0, 3);
+ QVERIFY(!view.isPersistentEditorOpen(index));
view.openPersistentEditor(index);
+ QVERIFY(view.isPersistentEditorOpen(index));
QWidget *w = view.indexWidget(index);
QVERIFY(w);
QCOMPARE(w->metaObject()->className(), "QWidget");
@@ -1228,8 +1232,8 @@ void tst_QAbstractItemView::task200665_itemEntered()
moveCursorAway(&view);
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
- QCursor::setPos( view.geometry().center() );
- QCoreApplication::processEvents();
+ QCursor::setPos(view.geometry().center());
+ QTRY_COMPARE(QCursor::pos(), view.geometry().center());
QSignalSpy spy(&view, SIGNAL(entered(QModelIndex)));
view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
@@ -1800,7 +1804,7 @@ void tst_QAbstractItemView::shiftSelectionAfterChangingModelContents()
view.setModel(&proxyModel);
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
// Click "C"
QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, view.visualRect(indexC).center());
@@ -1914,7 +1918,7 @@ void tst_QAbstractItemView::QTBUG48968_reentrant_updateEditorGeometries()
tree.setRootIsDecorated(false);
QObject::connect(&tree, SIGNAL(doubleClicked(QModelIndex)), &tree, SLOT(setRootIndex(QModelIndex)));
tree.show();
- QTest::qWaitForWindowActive(&tree);
+ QVERIFY(QTest::qWaitForWindowActive(&tree));
// Trigger editing idx
QModelIndex idx = m->index(1, 0);
@@ -2156,7 +2160,7 @@ void tst_QAbstractItemView::testClickToSelect()
SetSelectionTestView view;
view.setModel(&model);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QSignalSpy spy(&view, &SetSelectionTestView::setSelectionCalled);
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 5b353bb2ae..2a5895583d 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -1021,7 +1021,7 @@ void tst_QItemDelegate::decoration()
}
case QVariant::Image: {
QImage img(size, QImage::Format_Mono);
- memset(img.bits(), 0, img.byteCount());
+ memset(img.bits(), 0, img.sizeInBytes());
value = img;
break;
}
diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
index 1fd7b31e22..f1239b2e7c 100644
--- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
+++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp
@@ -30,16 +30,6 @@
#include <QtTest/QtTest>
#include <QtCore/QtCore>
#include "viewstotest.cpp"
-#include <stdlib.h>
-
-#if defined(Q_OS_UNIX) || defined(Q_OS_WIN)
-#include <time.h>
-#endif
-
-#if defined(Q_OS_WIN)
-# define random rand
-# define srandom srand
-#endif
/*!
See viewstotest.cpp for instructions on how to have your view tested with these tests.
@@ -410,13 +400,15 @@ void touch(QWidget *widget, Qt::KeyboardModifier modifier, Qt::Key keyPress){
int width = widget->width();
int height = widget->height();
for (int i = 0; i < 5; ++i) {
- QTest::mouseClick(widget, Qt::LeftButton, modifier, QPoint(random() % width, random() % height));
- QTest::mouseDClick(widget, Qt::LeftButton, modifier, QPoint(random() % width, random() % height));
- QPoint press(random() % width, random() % height);
- QPoint releasePoint(random() % width, random() % height);
+ QTest::mouseClick(widget, Qt::LeftButton, modifier,
+ QPoint(QRandomGenerator::global()->bounded(width), QRandomGenerator::global()->bounded(height)));
+ QTest::mouseDClick(widget, Qt::LeftButton, modifier,
+ QPoint(QRandomGenerator::global()->bounded(width), QRandomGenerator::global()->bounded(height)));
+ QPoint press(QRandomGenerator::global()->bounded(width), QRandomGenerator::global()->bounded(height));
+ QPoint releasePoint(QRandomGenerator::global()->bounded(width), QRandomGenerator::global()->bounded(height));
QTest::mousePress(widget, Qt::LeftButton, modifier, press);
QTest::mouseMove(widget, releasePoint);
- if (random() % 1 == 0)
+ if (QRandomGenerator::global()->bounded(1) == 0)
QTest::mouseRelease(widget, Qt::LeftButton, 0, releasePoint);
else
QTest::mouseRelease(widget, Qt::LeftButton, modifier, releasePoint);
@@ -443,7 +435,6 @@ void tst_QItemView::spider()
view->setModel(treeModel);
view->show();
QVERIFY(QTest::qWaitForWindowActive(view));
- srandom(time(0));
touch(view->viewport(), Qt::NoModifier, Qt::Key_Left);
touch(view->viewport(), Qt::ShiftModifier, Qt::Key_Enter);
touch(view->viewport(), Qt::ControlModifier, Qt::Key_Backspace);
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index d8b8546d86..5e0d99f25e 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -2157,7 +2157,7 @@ void tst_QListView::draggablePaintPairs()
view.setModel(&model);
view.show();
- QTest::qWaitForWindowExposed(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QModelIndex expectedIndex = model.index(row, 0);
QListViewPrivate *privateClass = static_cast<QListViewPrivate *>(QListViewPrivate::get(&view));
@@ -2201,7 +2201,7 @@ void tst_QListView::taskQTBUG_21804_hiddenItemsAndScrollingWithKeys()
lv.setSpacing(spacing);
lv.setModel(&model);
lv.show();
- QTest::qWaitForWindowExposed(&lv);
+ QVERIFY(QTest::qWaitForWindowExposed(&lv));
// hide every odd number row
for (int i = 1; i < model.rowCount(); i+=2)
@@ -2273,7 +2273,7 @@ void tst_QListView::spacing()
lv.setModel(&model);
lv.setSpacing(spacing);
lv.show();
- QTest::qWaitForWindowExposed(&lv);
+ QVERIFY(QTest::qWaitForWindowExposed(&lv));
// check size and position of first two items
QRect item1 = lv.visualRect(lv.model()->index(0, 0));
@@ -2304,7 +2304,7 @@ void tst_QListView::testScrollToWithHidden()
lv.setSpacing(5);
lv.showNormal();
- QTest::qWaitForWindowExposed(&lv);
+ QVERIFY(QTest::qWaitForWindowExposed(&lv));
QCOMPARE(lv.verticalScrollBar()->value(), 0);
@@ -2449,7 +2449,7 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents()
lv.resize(300, 300);
lv.show();
- QTest::qWaitForWindowExposed(&lv);
+ QVERIFY(QTest::qWaitForWindowExposed(&lv));
QPoint globalPos = lv.geometry().center();
QPoint pos = lv.viewport()->geometry().center();
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 6547bb8985..d4cb54b9ff 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1710,12 +1710,11 @@ void tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet()
list.setSelectionModel(new QItemSelectionModel(list.model()));
list.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&list));
QSignalSpy currentItemChangedSpy(&list, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)));
QSignalSpy itemSelectionChangedSpy(&list, SIGNAL(itemSelectionChanged()));
- QVERIFY(QTest::qWaitForWindowExposed(&list));
-
QCOMPARE(currentItemChangedSpy.count(), 0);
QCOMPARE(itemSelectionChangedSpy.count(), 0);
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index dfcaa9b5b9..b2e1a2d9b5 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -163,6 +163,9 @@ private slots:
void styleOptionViewItem();
void keyboardNavigationWithDisabled();
+ void statusTip_data();
+ void statusTip();
+
// task-specific tests:
void task174627_moveLeftToRoot();
void task171902_expandWith1stColHidden();
@@ -206,23 +209,23 @@ public:
QtTestModel(int _rows, int _cols, QObject *parent = 0): QAbstractItemModel(parent),
fetched(false), rows(_rows), cols(_cols), levels(INT_MAX), wrongIndex(false) { init(); }
- void init() {
+ void init()
+ {
decorationsEnabled = false;
+ statusTipsEnabled = false;
}
- inline qint32 level(const QModelIndex &index) const {
+ inline qint32 level(const QModelIndex &index) const
+ {
return index.isValid() ? qint32(index.internalId()) : qint32(-1);
}
- bool canFetchMore(const QModelIndex &) const {
- return !fetched;
- }
+ bool canFetchMore(const QModelIndex &) const override { return !fetched; }
- void fetchMore(const QModelIndex &) {
- fetched = true;
- }
+ void fetchMore(const QModelIndex &) override { fetched = true; }
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const {
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override
+ {
bool hasFetched = fetched;
fetched = true;
bool r = QAbstractItemModel::hasChildren(parent);
@@ -230,26 +233,29 @@ public:
return r;
}
- int rowCount(const QModelIndex& parent = QModelIndex()) const {
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override
+ {
if (!fetched)
qFatal("%s: rowCount should not be called before fetching", Q_FUNC_INFO);
if ((parent.column() > 0) || (level(parent) > levels))
return 0;
return rows;
}
- int columnCount(const QModelIndex& parent = QModelIndex()) const {
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override
+ {
if ((parent.column() > 0) || (level(parent) > levels))
return 0;
return cols;
}
- bool isEditable(const QModelIndex &index) const {
+ bool isEditable(const QModelIndex &index) const
+ {
if (index.isValid())
return true;
return false;
}
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override
{
if (row < 0 || column < 0 || (level(parent) > levels) || column >= cols || row >= rows) {
return QModelIndex();
@@ -259,14 +265,14 @@ public:
return i;
}
- QModelIndex parent(const QModelIndex &index) const
+ QModelIndex parent(const QModelIndex &index) const override
{
if (!parentHash.contains(index))
return QModelIndex();
return parentHash[index];
}
- QVariant data(const QModelIndex &idx, int role) const
+ QVariant data(const QModelIndex &idx, int role) const override
{
if (!idx.isValid())
return QVariant();
@@ -289,6 +295,19 @@ public:
pm.fill(QColor::fromHsv((idx.column() % 16)*8 + 64, 254, (idx.row() % 16)*8 + 32));
return pm;
}
+ if (statusTipsEnabled && role == Qt::StatusTipRole)
+ return QString("[%1,%2,%3] -- Status").arg(idx.row()).arg(idx.column()).arg(level(idx));
+ return QVariant();
+ }
+
+ QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const override
+ {
+ Q_UNUSED(orientation);
+ if (section < 0 || section >= columnCount())
+ return QVariant();
+ if (statusTipsEnabled && role == Qt::StatusTipRole)
+ return QString("Header %1 -- Status").arg(section);
return QVariant();
}
@@ -334,6 +353,7 @@ public:
mutable bool fetched;
bool decorationsEnabled;
+ bool statusTipsEnabled;
int rows, cols;
int levels;
mutable bool wrongIndex;
@@ -4312,7 +4332,7 @@ void tst_QTreeView::testInitialFocus()
treeWidget.header()->hideSection(0); // make sure we skip hidden section(s)
treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical)
treeWidget.show();
- QTest::qWaitForWindowExposed(&treeWidget);
+ QVERIFY(QTest::qWaitForWindowExposed(&treeWidget));
QApplication::processEvents();
QCOMPARE(treeWidget.currentIndex().column(), 2);
}
@@ -4335,7 +4355,7 @@ void tst_QTreeView::quickExpandCollapse()
QVERIFY(rootIndex.isValid());
tree.show();
- QTest::qWaitForWindowExposed(&tree);
+ QVERIFY(QTest::qWaitForWindowExposed(&tree));
const QAbstractItemView::State initialState = tree.state();
@@ -4497,6 +4517,54 @@ void tst_QTreeView::taskQTBUG_7232_AllowUserToControlSingleStep()
QCOMPARE(hStep1, t.horizontalScrollBar()->singleStep());
}
+void tst_QTreeView::statusTip_data()
+{
+ QTest::addColumn<bool>("intermediateParent");
+ QTest::newRow("noIntermediate") << false;
+ QTest::newRow("intermediate") << true;
+}
+
+void tst_QTreeView::statusTip()
+{
+ QFETCH(bool, intermediateParent);
+ QMainWindow mw;
+ QtTestModel model;
+ model.statusTipsEnabled = true;
+ model.rows = model.cols = 5;
+ QTreeView *view = new QTreeView;
+ view->setModel(&model);
+ view->viewport()->setMouseTracking(true);
+ view->header()->viewport()->setMouseTracking(true);
+ if (intermediateParent) {
+ QWidget *inter = new QWidget;
+ QVBoxLayout *vbox = new QVBoxLayout;
+ inter->setLayout(vbox);
+ vbox->addWidget(view);
+ mw.setCentralWidget(inter);
+ } else {
+ mw.setCentralWidget(view);
+ }
+ mw.statusBar();
+ mw.setGeometry(QRect(QPoint(QApplication::desktop()->geometry().center() - QPoint(250, 250)),
+ QSize(500, 500)));
+ mw.show();
+ qApp->setActiveWindow(&mw);
+ QVERIFY(QTest::qWaitForWindowActive(&mw));
+ // Ensure it is moved away first and then moved to the relevant section
+ QTest::mouseMove(mw.windowHandle(), view->mapTo(&mw, view->rect().bottomLeft() + QPoint(20, 20)));
+ QPoint centerPoint = view->viewport()->mapTo(&mw, view->visualRect(model.index(0, 0)).center());
+ QTest::mouseMove(mw.windowHandle(), centerPoint);
+ QTRY_COMPARE(mw.statusBar()->currentMessage(), QLatin1String("[0,0,0] -- Status"));
+ centerPoint = view->viewport()->mapTo(&mw, view->visualRect(model.index(0, 1)).center());
+ QTest::mouseMove(mw.windowHandle(), centerPoint);
+ QTRY_COMPARE(mw.statusBar()->currentMessage(), QLatin1String("[0,1,0] -- Status"));
+ centerPoint = view->header()->viewport()->mapTo(&mw,
+ QPoint(view->header()->sectionViewportPosition(0) + view->header()->sectionSize(0) / 2,
+ view->header()->height() / 2));
+ QTest::mouseMove(mw.windowHandle(), centerPoint);
+ QTRY_COMPARE(mw.statusBar()->currentMessage(), QLatin1String("Header 0 -- Status"));
+}
+
static void fillModeltaskQTBUG_8376(QAbstractItemModel &model)
{
model.insertRow(0);
@@ -4542,6 +4610,5 @@ void tst_QTreeView::taskQTBUG_8376()
QCOMPARE(rowHeightLvl1Visible, rowHeightLvl1Visible2);
}
-
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index 20720dc928..73fd934502 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -6,6 +6,7 @@ SUBDIRS=\
qboxlayout \
qdesktopwidget \
qformlayout \
+ qgesturerecognizer \
qgridlayout \
qlayout \
qstackedlayout \
@@ -19,4 +20,7 @@ SUBDIRS=\
qshortcut \
qsizepolicy
+darwin:SUBDIRS -= \ # Uses native recognizers
+ qgesturerecognizer \
+
SUBDIRS -= qsound
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 88ddb7c11d..ac0174d19a 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -64,6 +64,7 @@ private slots:
void task229128TriggeredSignalWhenInActiongroup();
void repeat();
void setData();
+ void keysequence(); // QTBUG-53381
void disableShortcutsWithBlockedWidgets_data();
void disableShortcutsWithBlockedWidgets();
@@ -280,6 +281,40 @@ void tst_QAction::alternateShortcuts()
QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
}
+void tst_QAction::keysequence()
+{
+ MyWidget testWidget(this);
+ testWidget.show();
+ QApplication::setActiveWindow(&testWidget);
+
+ {
+ QAction act(&testWidget);
+ testWidget.addAction(&act);
+
+ QKeySequence ks(QKeySequence::SelectAll);
+
+ act.setShortcut(ks);
+
+ QSignalSpy spy(&act, &QAction::triggered);
+
+ act.setAutoRepeat(true);
+ QTest::keySequence(&testWidget, ks);
+ QCoreApplication::processEvents();
+ QCOMPARE(spy.count(), 1); // act should have been triggered
+
+ act.setAutoRepeat(false);
+ QTest::keySequence(&testWidget, ks);
+ QCoreApplication::processEvents();
+ QCOMPARE(spy.count(), 2); //act should have been triggered a 2nd time
+
+ // end of the scope of the action, it will be destroyed and removed from widget
+ // This action should also unregister its shortcuts
+ }
+
+ // this tests a crash (if the action did not unregister its alternate shortcuts)
+ QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
+}
+
void tst_QAction::enabledVisibleInteraction()
{
MyWidget testWidget(this);
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index 1dac242114..7262817d23 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -156,7 +156,7 @@ void tst_QBoxLayout::sizeHint()
lay1->addLayout(lay2);
window.setLayout(lay1);
window.show();
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
label->setText("foooooooo baaaaaaar");
QSize sh = lay1->sizeHint();
QApplication::processEvents();
@@ -177,7 +177,7 @@ void tst_QBoxLayout::sizeConstraints()
lay->setSizeConstraint(QLayout::SetFixedSize);
window.setLayout(lay);
window.show();
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QSize sh = window.sizeHint();
delete lay->takeAt(1);
QVERIFY(sh.width() >= window.sizeHint().width() &&
@@ -224,7 +224,7 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
style1->hspacing = 6;
window.setStyle(style1.data());
window.show();
- QTest::qWaitForWindowExposed(&window);
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
int spacing = pb2->geometry().left() - pb1->geometry().right() - 1;
QCOMPARE(spacing, 6);
diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST b/tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST
index 7f55c2dae0..7f55c2dae0 100644
--- a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/BLACKLIST
diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/qgesturerecognizer.pro b/tests/auto/widgets/kernel/qgesturerecognizer/qgesturerecognizer.pro
index 7c9ddcfb03..7c9ddcfb03 100644
--- a/tests/auto/widgets/gestures/qgesturerecognizer/qgesturerecognizer.pro
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/qgesturerecognizer.pro
diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
index c3ebb838bb..c3ebb838bb 100644
--- a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index a04a67e4be..4cef2d57a4 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -74,10 +74,12 @@ osx
[setClearAndResizeMask]
osx
[setToolTip]
-osx-10.9
+osx
[moveInResizeEvent]
ubuntu-14.04
[moveChild:right]
osx
[activateWindow]
osx-10.12 ci
+[multipleToplevelFocusCheck]
+linux
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index 3e4e96760b..c1908af2a2 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -12,7 +12,7 @@ aix-g++*:QMAKE_CXXFLAGS+=-fpermissive
CONFIG += x11inc
mac {
- LIBS += -framework Security -framework AppKit -framework Carbon
+ LIBS += -framework Security -framework AppKit
OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index c1bff5b00a..cf2794903e 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -50,6 +50,7 @@
#include <qcalendarwidget.h>
#include <qmainwindow.h>
#include <qdockwidget.h>
+#include <qrandom.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <QtGui/qpaintengine.h>
@@ -183,7 +184,10 @@ private slots:
void mapFromAndTo();
void focusChainOnHide();
void focusChainOnReparent();
- void setTabOrder();
+ void defaultTabOrder();
+ void reverseTabOrder();
+ void tabOrderWithProxy();
+ void tabOrderWithCompoundWidgets();
#ifdef Q_OS_WIN
void activation();
#endif
@@ -1650,79 +1654,281 @@ public:
class Composite : public QFrame
{
public:
- Composite(QWidget* parent = 0, const char* name = 0)
+ Composite(QWidget* parent = 0, const QString &name = 0)
: QFrame(parent)
{
setObjectName(name);
- //QHBoxLayout* hbox = new QHBoxLayout(this, 2, 0);
- //hbox->setAutoAdd(true);
+
+ lineEdit1 = new QLineEdit;
+ lineEdit2 = new QLineEdit;
+ lineEdit3 = new QLineEdit;
+ lineEdit3->setEnabled(false);
+
QHBoxLayout* hbox = new QHBoxLayout(this);
+ hbox->addWidget(lineEdit1);
+ hbox->addWidget(lineEdit2);
+ hbox->addWidget(lineEdit3);
+ }
- lineEdit = new QLineEdit(this);
- hbox->addWidget(lineEdit);
+public:
+ QLineEdit *lineEdit1;
+ QLineEdit *lineEdit2;
+ QLineEdit *lineEdit3;
+};
- button = new QPushButton(this);
- hbox->addWidget(button);
- button->setFocusPolicy( Qt::NoFocus );
+void tst_QWidget::defaultTabOrder()
+{
+ const int compositeCount = 2;
+ Container container;
+ Composite *composite[compositeCount];
- setFocusProxy( lineEdit );
- setFocusPolicy( Qt::StrongFocus );
+ QLineEdit *firstEdit = new QLineEdit;
+ container.box->addWidget(firstEdit);
- setTabOrder(lineEdit, button);
+ for (int i = 0; i < compositeCount; i++) {
+ composite[i] = new Composite();
+ container.box->addWidget(composite[i]);
}
-private:
- QLineEdit* lineEdit;
- QPushButton* button;
-};
+ QLineEdit *lastEdit = new QLineEdit();
+ container.box->addWidget(lastEdit);
-#define NUM_WIDGETS 4
+ container.show();
+ container.activateWindow();
+ qApp->setActiveWindow(&container);
+ QVERIFY(QTest::qWaitForWindowActive(&container));
-void tst_QWidget::setTabOrder()
-{
- QTest::qWait(100);
+ QTRY_VERIFY(firstEdit->hasFocus());
+ // Check that focus moves between the line edits when we tab forward
+ for (int i = 0; i < compositeCount; ++i) {
+ container.tab();
+ QVERIFY(composite[i]->lineEdit1->hasFocus());
+ QVERIFY(!composite[i]->lineEdit2->hasFocus());
+ container.tab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
+ }
+
+ container.tab();
+ QVERIFY(lastEdit->hasFocus());
+
+ // Check that focus moves between the line edits in reverse
+ // order when we tab backwards
+ for (int i = compositeCount - 1; i >= 0; --i) {
+ container.backTab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
+
+ container.backTab();
+ QVERIFY(composite[i]->lineEdit1->hasFocus());
+ QVERIFY(!composite[i]->lineEdit2->hasFocus());
+ }
+
+ container.backTab();
+ QVERIFY(firstEdit->hasFocus());
+}
+
+void tst_QWidget::reverseTabOrder()
+{
+ const int compositeCount = 2;
Container container;
- container.setObjectName("setTabOrder");
- container.setWindowTitle(container.objectName());
+ Composite* composite[compositeCount];
+
+ QLineEdit *firstEdit = new QLineEdit();
+ container.box->addWidget(firstEdit);
+
+ for (int i = 0; i < compositeCount; i++) {
+ composite[i] = new Composite();
+ container.box->addWidget(composite[i]);
+ }
+
+ QLineEdit *lastEdit = new QLineEdit();
+ container.box->addWidget(lastEdit);
- Composite* comp[NUM_WIDGETS];
+ // Reverse tab order inside each composite
+ for (int i = 0; i < compositeCount; ++i)
+ QWidget::setTabOrder(composite[i]->lineEdit2, composite[i]->lineEdit1);
- QLineEdit *firstEdit = new QLineEdit(&container);
+ container.show();
+ container.activateWindow();
+ qApp->setActiveWindow(&container);
+ QVERIFY(QTest::qWaitForWindowActive(&container));
+
+ QTRY_VERIFY(firstEdit->hasFocus());
+
+ // Check that focus moves in reverse order when tabbing inside the composites
+ // (but in the correct order when tabbing between them)
+ for (int i = 0; i < compositeCount; ++i) {
+ container.tab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
+ container.tab();
+ QVERIFY(composite[i]->lineEdit1->hasFocus());
+ QVERIFY(!composite[i]->lineEdit2->hasFocus());
+ }
+
+ container.tab();
+ QVERIFY(lastEdit->hasFocus());
+
+ // Check that focus moves in "normal" order when tabbing backwards inside the
+ // composites (since backwards of reversed order cancels each other out),
+ // but in the reverse order when tabbing between them.
+ for (int i = compositeCount - 1; i >= 0; --i) {
+ container.backTab();
+ QVERIFY(composite[i]->lineEdit1->hasFocus());
+ QVERIFY(!composite[i]->lineEdit2->hasFocus());
+ container.backTab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
+ }
+
+ container.backTab();
+ QVERIFY(firstEdit->hasFocus());
+}
+
+void tst_QWidget::tabOrderWithProxy()
+{
+ const int compositeCount = 2;
+ Container container;
+ Composite* composite[compositeCount];
+
+ QLineEdit *firstEdit = new QLineEdit();
container.box->addWidget(firstEdit);
- int i = 0;
- for(i = 0; i < NUM_WIDGETS; i++) {
- comp[i] = new Composite(&container);
- container.box->addWidget(comp[i]);
+ for (int i = 0; i < compositeCount; i++) {
+ composite[i] = new Composite();
+ container.box->addWidget(composite[i]);
+
+ // Set second child as focus proxy
+ composite[i]->setFocusPolicy(Qt::StrongFocus);
+ composite[i]->setFocusProxy(composite[i]->lineEdit2);
}
- QLineEdit *lastEdit = new QLineEdit(&container);
+ QLineEdit *lastEdit = new QLineEdit();
container.box->addWidget(lastEdit);
- container.setTabOrder(lastEdit, comp[NUM_WIDGETS-1]);
- for(i = NUM_WIDGETS-1; i > 0; i--) {
- container.setTabOrder(comp[i], comp[i-1]);
+ container.show();
+ container.activateWindow();
+ qApp->setActiveWindow(&container);
+ QVERIFY(QTest::qWaitForWindowActive(&container));
+
+ QTRY_VERIFY(firstEdit->hasFocus());
+
+ // Check that focus moves between the second line edits
+ // (the focus proxies) when we tab forward
+ for (int i = 0; i < compositeCount; ++i) {
+ container.tab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
}
- container.setTabOrder(comp[0], firstEdit);
- int current = NUM_WIDGETS-1;
- lastEdit->setFocus();
+ container.tab();
+ QVERIFY(lastEdit->hasFocus());
+
+ // Check that focus moves between the line edits
+ // in reverse order when we tab backwards.
+ // Note that in this case, the focus proxies should not
+ // be taken into consideration, since they only take
+ // effect when tabbing forward
+ for (int i = compositeCount - 1; i >= 0; --i) {
+ container.backTab();
+ QVERIFY(!composite[i]->lineEdit1->hasFocus());
+ QVERIFY(composite[i]->lineEdit2->hasFocus());
+ container.backTab();
+ QVERIFY(composite[i]->lineEdit1->hasFocus());
+ QVERIFY(!composite[i]->lineEdit2->hasFocus());
+ }
+
+ container.backTab();
+ QVERIFY(firstEdit->hasFocus());
+}
+
+void tst_QWidget::tabOrderWithCompoundWidgets()
+{
+ const int compositeCount = 4;
+ Container container;
+ Composite *composite[compositeCount];
+
+ QLineEdit *firstEdit = new QLineEdit();
+ container.box->addWidget(firstEdit);
+
+ for (int i = 0; i < compositeCount; i++) {
+ composite[i] = new Composite(0, QStringLiteral("Composite: ") + QString::number(i));
+ container.box->addWidget(composite[i]);
+
+ // Let the composite handle focus, and set a child as focus proxy (use the second child, just
+ // to ensure that we don't just tab to the first child by coinsidence). This will make the
+ // composite "compound". Also enable the last line edit to have a bit more data to check when
+ // tabbing forwards.
+ composite[i]->setFocusPolicy(Qt::StrongFocus);
+ composite[i]->setFocusProxy(composite[i]->lineEdit2);
+ composite[i]->lineEdit3->setEnabled(true);
+ }
+
+ QLineEdit *lastEdit = new QLineEdit();
+ container.box->addWidget(lastEdit);
+
+ // Reverse tab order between each composite
+ // (but not inside them), including first and last line edit.
+ // The result should not affect local tab order inside each
+ // composite, only between them.
+ QWidget::setTabOrder(lastEdit, composite[compositeCount - 1]);
+ for (int i = compositeCount - 1; i >= 1; --i)
+ QWidget::setTabOrder(composite[i], composite[i-1]);
+ QWidget::setTabOrder(composite[0], firstEdit);
container.show();
container.activateWindow();
qApp->setActiveWindow(&container);
QVERIFY(QTest::qWaitForWindowActive(&container));
+ lastEdit->setFocus();
QTRY_VERIFY(lastEdit->hasFocus());
- container.tab();
- do {
- QVERIFY(comp[current]->focusProxy()->hasFocus());
+
+ // Check that focus moves between the line edits in the normal
+ // order when tabbing inside each compound, but in the reverse
+ // order when tabbing between them. Since the composites have
+ // lineEdit2 as focus proxy, lineEdit2 will be the first with focus
+ // when the compound gets focus, and lineEdit1 will therefore be skipped.
+ for (int i = compositeCount - 1; i >= 0; --i) {
+ container.tab();
+ Composite *c = composite[i];
+ QVERIFY(!c->lineEdit1->hasFocus());
+ QVERIFY(c->lineEdit2->hasFocus());
+ QVERIFY(!c->lineEdit3->hasFocus());
container.tab();
- current--;
- } while (current >= 0);
+ QVERIFY(!c->lineEdit1->hasFocus());
+ QVERIFY(!c->lineEdit2->hasFocus());
+ QVERIFY(c->lineEdit3->hasFocus());
+ }
+ container.tab();
QVERIFY(firstEdit->hasFocus());
+
+ // Check that focus moves in reverse order when backTab inside the composites, but
+ // in the 'correct' order when backTab between them (since the composites are in reverse tab
+ // order from before, which cancels it out). Note that when we backtab into a compound, we start
+ // at lineEdit3 rather than the focus proxy, since that is the reverse of what happens when we tab
+ // forward. And this time we will also backtab to lineEdit1, since there is no focus proxy that interferes.
+ for (int i = 0; i < compositeCount; ++i) {
+ container.backTab();
+ Composite *c = composite[i];
+ QVERIFY(!c->lineEdit1->hasFocus());
+ QVERIFY(!c->lineEdit2->hasFocus());
+ QVERIFY(c->lineEdit3->hasFocus());
+ container.backTab();
+ QVERIFY(!c->lineEdit1->hasFocus());
+ QVERIFY(c->lineEdit2->hasFocus());
+ QVERIFY(!c->lineEdit3->hasFocus());
+ container.backTab();
+ QVERIFY(c->lineEdit1->hasFocus());
+ QVERIFY(!c->lineEdit2->hasFocus());
+ QVERIFY(!c->lineEdit3->hasFocus());
+ }
+
+ container.backTab();
+ QVERIFY(lastEdit->hasFocus());
}
#ifdef Q_OS_WIN
@@ -1787,9 +1993,11 @@ void tst_QWidget::windowState()
QCOMPARE(widget1.pos(), pos);
QCOMPARE(widget1.size(), size);
-#define VERIFY_STATE(s) QCOMPARE(int(widget1.windowState() & stateMask), int(s))
+#define VERIFY_STATE(s) \
+ QCOMPARE(int(widget1.windowState() & stateMask), int(s)); \
+ QCOMPARE(int(widget1.windowHandle()->windowStates() & stateMask), int(s))
- const int stateMask = Qt::WindowMaximized|Qt::WindowMinimized|Qt::WindowFullScreen;
+ const auto stateMask = Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen;
widget1.setWindowState(Qt::WindowMaximized);
QTest::qWait(100);
@@ -2079,7 +2287,7 @@ void tst_QWidget::resizeEvent()
wParent.resize(200, 200);
ResizeWidget wChild(&wParent);
wParent.show();
- QTest::qWaitForWindowExposed(&wParent);
+ QVERIFY(QTest::qWaitForWindowExposed(&wParent));
QCOMPARE (wChild.m_resizeEventCount, 1); // initial resize event before paint
wParent.hide();
QSize safeSize(640,480);
@@ -2095,7 +2303,7 @@ void tst_QWidget::resizeEvent()
ResizeWidget wTopLevel;
wTopLevel.resize(200, 200);
wTopLevel.show();
- QTest::qWaitForWindowExposed(&wTopLevel);
+ QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels
wTopLevel.hide();
QSize safeSize(640,480);
@@ -2104,7 +2312,7 @@ void tst_QWidget::resizeEvent()
wTopLevel.resize(safeSize);
QCOMPARE (wTopLevel.m_resizeEventCount, 1);
wTopLevel.show();
- QTest::qWaitForWindowExposed(&wTopLevel);
+ QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
QCOMPARE (wTopLevel.m_resizeEventCount, 2);
}
}
@@ -8060,8 +8268,8 @@ void tst_QWidget::setMaskInResizeEvent()
QRegion expectedParentUpdate(0, 0, 100, 10); // Old testWidget area.
expectedParentUpdate += testWidget.geometry(); // New testWidget area.
- QCOMPARE(w.paintedRegion, expectedParentUpdate);
- QCOMPARE(testWidget.paintedRegion, testWidget.mask());
+ QTRY_COMPARE(w.paintedRegion, expectedParentUpdate);
+ QTRY_COMPARE(testWidget.paintedRegion, testWidget.mask());
testWidget.paintedRegion = QRegion();
// Now resize the widget again, but in the oposite direction
@@ -9609,7 +9817,7 @@ void tst_QWidget::grab()
for (int row = 0; row < image.height(); ++row) {
QRgb *line = reinterpret_cast<QRgb *>(image.scanLine(row));
for (int col = 0; col < image.width(); ++col)
- line[col] = qRgba(rand() & 255, row, col, opaque ? 255 : 127);
+ line[col] = qRgba(QRandomGenerator::global()->bounded(255), row, col, opaque ? 255 : 127);
}
QPalette pal = widget.palette();
@@ -10489,6 +10697,8 @@ void tst_QWidget::qmlSetParentHelper()
void tst_QWidget::testForOutsideWSRangeFlag()
{
+ QSKIP("Test assumes QWindows can have 0x0 size, see QTBUG-61953");
+
// QTBUG-49445
{
QWidget widget;
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index e4564a8640..b76c4d35a8 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -96,6 +96,11 @@ private slots:
void QTBUG_50561_QCocoaBackingStore_paintDevice_crash();
+ void setWindowState_data();
+ void setWindowState();
+
+ void nativeShow();
+
void QTBUG_56277_resize_on_showEvent();
};
@@ -842,7 +847,7 @@ void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash()
QMainWindow w;
w.addToolBar(new QToolBar(&w));
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
// Simulate window system close
QCloseEvent *e = new QCloseEvent;
@@ -859,6 +864,72 @@ void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash()
w.close();
}
+void tst_QWidget_window::setWindowState_data()
+{
+ QString platformName = QGuiApplication::platformName().toLower();
+
+ QTest::addColumn<Qt::WindowStates>("state");
+ QTest::newRow("0") << Qt::WindowStates();
+ QTest::newRow("Qt::WindowMaximized") << Qt::WindowStates(Qt::WindowMaximized);
+ QTest::newRow("Qt::WindowMinimized") << Qt::WindowStates(Qt::WindowMinimized);
+ QTest::newRow("Qt::WindowFullScreen") << Qt::WindowStates(Qt::WindowFullScreen);
+
+ if (platformName != "xcb" && platformName != "windows" && !platformName.startsWith("wayland")
+ && platformName != "offscreen")
+ return; // Combination of states is not preserved on all platforms.
+ if (platformName == "xcb" && qgetenv("XDG_CURRENT_DESKTOP") != "KDE"
+ && qgetenv("XDG_CURRENT_DESKTOP") != "Unity")
+ return; // Not all window managers support state combinations.
+
+ QTest::newRow("Qt::WindowMaximized|Qt::WindowMinimized")
+ << (Qt::WindowMaximized | Qt::WindowMinimized);
+ QTest::newRow("Qt::WindowFullScreen|Qt::WindowMinimized")
+ << (Qt::WindowFullScreen | Qt::WindowMinimized);
+ QTest::newRow("Qt::WindowMaximized|Qt::WindowFullScreen")
+ << (Qt::WindowMaximized | Qt::WindowFullScreen);
+ QTest::newRow("Qt::WindowMaximized|Qt::WindowFullScreen|Qt::WindowMinimized")
+ << (Qt::WindowMaximized | Qt::WindowFullScreen | Qt::WindowMinimized);
+}
+
+void tst_QWidget_window::setWindowState()
+{
+ QFETCH(Qt::WindowStates, state);
+
+ // This tests make sure that the states are preserved when the window is shown.
+
+ QWidget w;
+ w.setWindowState(state);
+ QCOMPARE(w.windowState(), state);
+ w.show();
+ QCOMPARE(w.windowState(), state);
+ QCOMPARE(w.windowHandle()->windowStates(), state);
+ if (!(state & Qt::WindowMinimized))
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QTRY_COMPARE(w.windowState(), state);
+ QCOMPARE(w.windowHandle()->windowStates(), state);
+
+ // Minimizing keeps other states
+ w.showMinimized();
+ QCOMPARE(w.windowState(), state | Qt::WindowMinimized);
+ QTest::qWait(100);
+ QCOMPARE(w.windowState(), state | Qt::WindowMinimized);
+ QCOMPARE(w.windowHandle()->windowStates(), state | Qt::WindowMinimized);
+}
+
+void tst_QWidget_window::nativeShow()
+{
+ // Verify that a native widget can be shown using the QWindow::setVisible() API
+ QWidget w;
+ w.winId();
+ w.windowHandle()->setVisible(true);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QVERIFY(w.isVisible());
+
+ // ... and that we can hide it
+ w.windowHandle()->setVisible(false);
+ QTRY_VERIFY(!w.isVisible());
+}
+
class ResizedOnShowEventWidget : public QWidget
{
public:
diff --git a/tests/auto/widgets/styles/qmacstyle/qmacstyle.pro b/tests/auto/widgets/styles/qmacstyle/qmacstyle.pro
index 4cd85ab7f2..90bf134ef1 100644
--- a/tests/auto/widgets/styles/qmacstyle/qmacstyle.pro
+++ b/tests/auto/widgets/styles/qmacstyle/qmacstyle.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_qmacstyle
-QT += widgets testlib
+QT += widgets-private testlib
SOURCES += tst_qmacstyle.cpp
diff --git a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
index fbd1505b30..2ab2fa4c86 100644
--- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
+++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
@@ -29,12 +29,11 @@
#include <QtTest/QtTest>
#include <QtWidgets>
+#include <private/qstylehelper_p.h>
const int N = 1;
-enum Size { Normal, Small, Mini };
-
-Q_DECLARE_METATYPE(Size);
+Q_DECLARE_METATYPE(QStyleHelper::WidgetSizePolicy);
#define CT(E) \
static const ControlType E = QSizePolicy::E;
@@ -63,7 +62,7 @@ class tst_QMacStyle : public QObject
Q_OBJECT
public:
- tst_QMacStyle() { qRegisterMetaType<Size>("Size"); }
+ tst_QMacStyle() { qRegisterMetaType<QStyleHelper::WidgetSizePolicy>("WidgetSizePolicy"); }
private slots:
void sizeHints_data();
@@ -85,27 +84,27 @@ private:
static QSize gap(QWidget *widget1, QWidget *widget2);
static int hgap(QWidget *widget1, QWidget *widget2) { return gap(widget1, widget2).width(); }
static int vgap(QWidget *widget1, QWidget *widget2) { return gap(widget1, widget2).height(); }
- static void setSize(QWidget *widget, Size size);
+ static void setSize(QWidget *widget, QStyleHelper::WidgetSizePolicy size);
static int spacing(ControlType control1, ControlType control2, Qt::Orientation orientation,
QStyleOption *option = 0, QWidget *widget = 0);
- static int hspacing(ControlType control1, ControlType control2, Size size = Normal);
- static int vspacing(ControlType control1, ControlType control2, Size size = Normal);
+ static int hspacing(ControlType control1, ControlType control2, QStyleHelper::WidgetSizePolicy size = QStyleHelper::SizeLarge);
+ static int vspacing(ControlType control1, ControlType control2, QStyleHelper::WidgetSizePolicy size = QStyleHelper::SizeLarge);
};
#define SIZE(x, y, z) \
- ((size == Normal) ? (x) : (size == Small) ? (y) : (z))
+ ((size == QStyleHelper::SizeLarge) ? (x) : (size == QStyleHelper::SizeSmall) ? (y) : (z))
void tst_QMacStyle::sizeHints_data()
{
- QTest::addColumn<Size>("size");
- QTest::newRow("normal") << Normal;
-// QTest::newRow("small") << Small;
-// QTest::newRow("mini") << Mini;
+ QTest::addColumn<QStyleHelper::WidgetSizePolicy>("size");
+ QTest::newRow("normal") << QStyleHelper::SizeLarge;
+// QTest::newRow("small") << QStyleHelper::SizeSmall;
+// QTest::newRow("mini") << QStyleHelper::SizeMini;
}
void tst_QMacStyle::sizeHints()
{
- QFETCH(Size, size);
+ QFETCH(QStyleHelper::WidgetSizePolicy, size);
QDialog w;
setSize(&w, size);
@@ -160,7 +159,7 @@ void tst_QMacStyle::sizeHints()
QPushButton cancel1("Cancel", &w);
QSize s1 = sh(&ok1);
- if (size == Normal) {
+ if (size == QStyleHelper::SizeLarge) {
// AHIG says 68, Builder does 70, and Qt seems to do 69
QVERIFY(s1.width() >= 68 && s1.width() <= 70);
}
@@ -222,7 +221,7 @@ void tst_QMacStyle::layoutMargins_data()
void tst_QMacStyle::layoutMargins()
{
- QFETCH(Size, size);
+ QFETCH(QStyleHelper::WidgetSizePolicy, size);
QWidget w;
setSize(&w, size);
@@ -235,7 +234,7 @@ void tst_QMacStyle::layoutSpacings_data()
void tst_QMacStyle::layoutSpacings()
{
- QFETCH(Size, size);
+ QFETCH(QStyleHelper::WidgetSizePolicy, size);
/*
Constraints specified by AHIG.
@@ -304,16 +303,16 @@ QSize tst_QMacStyle::gap(QWidget *widget1, QWidget *widget2)
return s + QSize(d.x(), d.y());
}
-void tst_QMacStyle::setSize(QWidget *widget, Size size)
+void tst_QMacStyle::setSize(QWidget *widget, QStyleHelper::WidgetSizePolicy size)
{
switch (size) {
- case Normal:
+ case QStyleHelper::SizeLarge:
widget->setAttribute(Qt::WA_MacNormalSize, true);
break;
- case Small:
+ case QStyleHelper::SizeSmall:
widget->setAttribute(Qt::WA_MacSmallSize, true);
break;
- case Mini:
+ case QStyleHelper::SizeMini:
widget->setAttribute(Qt::WA_MacMiniSize, true);
}
}
@@ -324,7 +323,7 @@ int tst_QMacStyle::spacing(ControlType control1, ControlType control2, Qt::Orien
return QApplication::style()->layoutSpacing(control1, control2, orientation, option, widget);
}
-int tst_QMacStyle::hspacing(ControlType control1, ControlType control2, Size size)
+int tst_QMacStyle::hspacing(ControlType control1, ControlType control2, QStyleHelper::WidgetSizePolicy size)
{
QWidget w;
setSize(&w, size);
@@ -335,7 +334,7 @@ int tst_QMacStyle::hspacing(ControlType control1, ControlType control2, Size siz
return spacing(control1, control2, Qt::Horizontal, &opt);
}
-int tst_QMacStyle::vspacing(ControlType control1, ControlType control2, Size size)
+int tst_QMacStyle::vspacing(ControlType control1, ControlType control2, QStyleHelper::WidgetSizePolicy size)
{
QWidget w;
setSize(&w, size);
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index 5369101dae..cd8ba95b06 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -82,9 +82,6 @@ private slots:
void testFusionStyle();
#endif
void testWindowsStyle();
-#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
- void testWindowsXPStyle();
-#endif
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA)
void testWindowsVistaStyle();
#endif
@@ -142,14 +139,6 @@ void tst_QStyle::testStyleFactory()
#ifndef QT_NO_STYLE_WINDOWS
QVERIFY(keys.contains("Windows"));
#endif
-#ifdef Q_OS_WIN
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP &&
- (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- QVERIFY(keys.contains("WindowsXP"));
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA &&
- (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- QVERIFY(keys.contains("WindowsVista"));
-#endif
foreach (QString styleName , keys) {
QStyle *style = QStyleFactory::create(styleName);
@@ -295,16 +284,22 @@ bool tst_QStyle::testAllFunctions(QStyle *style)
bool tst_QStyle::testScrollBarSubControls()
{
+ const auto *style = testWidget->style();
+ const bool isMacStyle = style->objectName().toLower() == "macintosh";
QScrollBar scrollBar;
setFrameless(&scrollBar);
scrollBar.show();
const QStyleOptionSlider opt = qt_qscrollbarStyleOption(&scrollBar);
- foreach (int subControl, QList<int>() << 1 << 2 << 4 << 8) {
- QRect sr = testWidget->style()->subControlRect(QStyle::CC_ScrollBar, &opt,
- QStyle::SubControl(subControl), &scrollBar);
+ foreach (int sc, QList<int>() << 1 << 2 << 4 << 8) {
+ const auto subControl = static_cast<QStyle::SubControl>(sc);
+ const QRect sr = style->subControlRect(QStyle::CC_ScrollBar, &opt, subControl, &scrollBar);
if (sr.isNull()) {
- qWarning("Null rect for subcontrol %d", subControl);
- return false;
+ // macOS scrollbars no longer have these, so there's no reason to fail
+ if (!(isMacStyle && (subControl == QStyle::SC_ScrollBarAddLine ||
+ subControl == QStyle::SC_ScrollBarSubLine))) {
+ qWarning() << "Unexpected null rect for subcontrol" << subControl;
+ return false;
+ }
}
}
return true;
@@ -335,17 +330,6 @@ void tst_QStyle::testWindowsStyle()
delete wstyle;
}
-#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
-// WindowsXP style
-void tst_QStyle::testWindowsXPStyle()
-{
- QStyle *xpstyle = QStyleFactory::create("WindowsXP");
- QVERIFY(testAllFunctions(xpstyle));
- lineUpLayoutTest(xpstyle);
- delete xpstyle;
-}
-#endif
-
void writeImage(const QString &fileName, QImage image)
{
QImageWriter imageWriter(fileName);
@@ -368,8 +352,6 @@ void tst_QStyle::testWindowsVistaStyle()
if (QSysInfo::WindowsVersion == QSysInfo::WV_VISTA)
testPainting(vistastyle, "vista");
- else if (QSysInfo::WindowsVersion == QSysInfo::WV_XP)
- testPainting(vistastyle, "xp");
delete vistastyle;
}
#endif
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index efcc47171d..8b6c4722be 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -8,4 +8,3 @@ SUBDIRS=\
styles \
util \
widgets \
- gestures \
diff --git a/tests/auto/widgets/widgets/qcombobox/BLACKLIST b/tests/auto/widgets/widgets/qcombobox/BLACKLIST
index 4a270c085b..c04351e5ca 100644
--- a/tests/auto/widgets/widgets/qcombobox/BLACKLIST
+++ b/tests/auto/widgets/widgets/qcombobox/BLACKLIST
@@ -1,3 +1,7 @@
QTBUG-45531
[task260974_menuItemRectangleForComboBoxPopup]
osx-10.10
+
+[task_QTBUG_56693_itemFontFromModel]
+# Counts draw calls, but we could have multiple expose events QTBUG-62080
+osx
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 2195f43ef1..b6007482ae 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -164,6 +164,7 @@ private slots:
void task_QTBUG_49831_scrollerNotActivated();
void task_QTBUG_56693_itemFontFromModel();
void inputMethodUpdate();
+ void task_QTBUG_52027_mapCompleterIndex();
private:
PlatformInputContext m_platformInputContext;
@@ -2256,7 +2257,7 @@ void tst_QComboBox::task190351_layout()
listCombo.setCurrentIndex(70);
listCombo.showPopup();
QTRY_VERIFY(listCombo.view());
- QTest::qWaitForWindowExposed(listCombo.view());
+ QVERIFY(QTest::qWaitForWindowExposed(listCombo.view()));
QTRY_VERIFY(listCombo.view()->isVisible());
QApplication::processEvents();
@@ -2403,7 +2404,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
QTRY_VERIFY(comboBox.isVisible());
comboBox.showPopup();
QTRY_VERIFY(comboBox.view());
- QTest::qWaitForWindowExposed(comboBox.view());
+ QVERIFY(QTest::qWaitForWindowExposed(comboBox.view()));
QTRY_VERIFY(comboBox.view()->isVisible());
#if defined QT_BUILD_INTERNAL
@@ -3249,12 +3250,12 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated()
box.setModel(&model);
box.setCurrentIndex(500);
box.show();
- QTest::qWaitForWindowExposed(&box);
+ QVERIFY(QTest::qWaitForWindowExposed(&box));
QTest::mouseMove(&box, QPoint(5, 5), 100);
box.showPopup();
QFrame *container = box.findChild<QComboBoxPrivateContainer *>();
QVERIFY(container);
- QTest::qWaitForWindowExposed(container);
+ QVERIFY(QTest::qWaitForWindowExposed(container));
QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>();
// Not all styles support scrollers. We rely only on those platforms that do to catch any regression.
@@ -3330,11 +3331,11 @@ void tst_QComboBox::task_QTBUG_56693_itemFontFromModel()
box.addItem(QLatin1String("Item ") + QString::number(i));
box.show();
- QTest::qWaitForWindowExposed(&box);
+ QVERIFY(QTest::qWaitForWindowExposed(&box));
box.showPopup();
QFrame *container = box.findChild<QComboBoxPrivateContainer *>();
QVERIFY(container);
- QTest::qWaitForWindowExposed(container);
+ QVERIFY(QTest::qWaitForWindowExposed(container));
QCOMPARE(proxyStyle->italicItemsNo, 5);
@@ -3395,5 +3396,62 @@ void tst_QComboBox::inputMethodUpdate()
QVERIFY(m_platformInputContext.m_updateCallCount >= 1);
}
+void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex()
+{
+ QStringList words;
+ words << "" << "foobar1" << "foobar2";
+
+ QStringList altWords;
+ altWords << "foobar2" << "hello" << "," << "world" << "" << "foobar0" << "foobar1";
+
+ QComboBox cbox;
+ setFrameless(&cbox);
+ cbox.setEditable(true);
+ cbox.setInsertPolicy(QComboBox::NoInsert);
+ cbox.addItems(words);
+
+ QCompleter *completer = new QCompleter(altWords);
+ completer->setCaseSensitivity(Qt::CaseInsensitive);
+ cbox.setCompleter(completer);
+
+ QSignalSpy spy(&cbox, SIGNAL(activated(int)));
+ QCOMPARE(spy.count(), 0);
+ cbox.move(200, 200);
+ cbox.show();
+ QApplication::setActiveWindow(&cbox);
+ QVERIFY(QTest::qWaitForWindowActive(&cbox));
+
+ QTest::keyClicks(&cbox, "foobar2");
+ QApplication::processEvents();
+ QTRY_VERIFY(completer->popup());
+ QTest::keyClick(completer->popup(), Qt::Key_Down);
+ QApplication::processEvents();
+ QTest::keyClick(completer->popup(), Qt::Key_Return);
+ QApplication::processEvents();
+ QList<QVariant> arguments = spy.takeLast();
+ QCOMPARE(arguments.at(0).toInt(), 2);
+
+ cbox.lineEdit()->selectAll();
+ cbox.lineEdit()->del();
+
+ QSortFilterProxyModel* model = new QSortFilterProxyModel();
+ model->setSourceModel(cbox.model());
+ model->setFilterFixedString("foobar1");
+ completer->setModel(model);
+
+ QApplication::setActiveWindow(&cbox);
+ QVERIFY(QTest::qWaitForWindowActive(&cbox));
+
+ QTest::keyClicks(&cbox, "foobar1");
+ QApplication::processEvents();
+ QTRY_VERIFY(completer->popup());
+ QTest::keyClick(completer->popup(), Qt::Key_Down);
+ QApplication::processEvents();
+ QTest::keyClick(completer->popup(), Qt::Key_Return);
+ QApplication::processEvents();
+ arguments = spy.takeLast();
+ QCOMPARE(arguments.at(0).toInt(), 1);
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 94e4fc005c..a3571cd9c5 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -239,6 +239,8 @@ private slots:
void deleteCalendarWidget();
+ void setLocaleOnCalendarWidget();
+
#ifdef QT_BUILD_INTERNAL
void dateEditCorrectSectionSize_data();
void dateEditCorrectSectionSize();
@@ -3409,6 +3411,25 @@ void tst_QDateTimeEdit::deleteCalendarWidget()
}
}
+void tst_QDateTimeEdit::setLocaleOnCalendarWidget()
+{
+ QDateEdit dateEdit;
+ QList<QLocale> allLocales = QLocale::matchingLocales(
+ QLocale::AnyLanguage,
+ QLocale::AnyScript,
+ QLocale::AnyCountry);
+ QLocale c = QLocale::c();
+ dateEdit.setCalendarPopup(true);
+ dateEdit.setLocale(c);
+ for (const QLocale& l : allLocales) {
+ dateEdit.setLocale(l);
+ const QLocale locCal = dateEdit.calendarWidget()->locale();
+ const QLocale locEdit = dateEdit.locale();
+ QCOMPARE(locCal.name(), locEdit.name());
+ QVERIFY(locCal == locEdit);
+ }
+}
+
#ifdef QT_BUILD_INTERNAL
typedef QPair<Qt::Key, Qt::KeyboardModifier> KeyPair;
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png
index 0cc9090e3b..84be445138 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png
index b2ab941d30..e35498674c 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png
index 21ebe53eff..b958b62259 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png
index 4f097cee48..879f6ddc31 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png
index 86f9ed6186..343caa06e4 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png
index 51a7899d05..377e1377f2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png
index 8c3769c32d..d59309bb3e 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png
index 81e0c2a152..36f6c0a9f3 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png
index 107272d0b9..c6bdab7eb4 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png
index f1d6392779..2647ac98b2 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png
index b2ab941d30..e35498674c 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png
index 21ebe53eff..b958b62259 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png
index 6905baa1fd..7e57872d19 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png
index 9d5440b3aa..8bf9170f89 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png
index 17eb7f59c0..bb34a4db29 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png
index a6ccd54a39..4aa344ad54 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png
index 3736bf6c99..da5f2ba6b9 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png
index 5750751c58..80ce6d846e 100644
--- a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png
index 61f683df52..8c29cd9965 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png
index 00447760ec..a28358ec55 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png
index 4c809a2c80..b5ea56f422 100644
--- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png
+++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png
Binary files differ
diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
index 62224217d6..420ef56106 100644
--- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
@@ -67,7 +67,7 @@ private slots:
void toggledVsClicked();
void childrenAreDisabled();
void propagateFocus();
- void task_QTBUG_19170_ignoreMouseReleseEvent();
+ void task_QTBUG_19170_ignoreMouseReleaseEvent();
void task_QTBUG_15519_propagateMouseEvents();
private:
@@ -477,7 +477,7 @@ void tst_QGroupBox::propagateFocus()
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit));
}
-void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleseEvent()
+void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleaseEvent()
{
QGroupBox box;
box.setCheckable(true);
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 2c6599631e..21669e42cd 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -44,10 +44,6 @@
#include <private/qapplication_p.h>
#include "qclipboard.h"
-#ifdef Q_OS_MAC
-#include <cstdlib> // For the random function.
-#endif
-
#include <qlineedit.h>
#include <private/qlineedit_p.h>
#include <private/qwidgetlinecontrol_p.h>
@@ -1922,7 +1918,7 @@ void tst_QLineEdit::noCursorBlinkWhenReadOnly()
centerOnScreen(&le);
le.show();
le.setFocus();
- QTest::qWaitForWindowActive(&le);
+ QVERIFY(QTest::qWaitForWindowActive(&le));
le.updates = 0;
QTest::qWait(cursorFlashTime);
QVERIFY(le.updates > 0);
@@ -1941,17 +1937,7 @@ void tst_QLineEdit::noCursorBlinkWhenReadOnly()
static void figureOutProperKey(Qt::Key &key, Qt::KeyboardModifiers &pressState)
{
#ifdef Q_OS_MAC
- static bool tst_lineedit_randomized = false;
- // Mac has 3 different ways of accomplishing this (same for moving to the back)
- // So I guess we should just randomly do this for now. Which may get people mad, but if
- // we fail at one point, it's just a matter of setting roll to the correct value
- // instead of random.
-
- if (!tst_lineedit_randomized) {
- tst_lineedit_randomized = true;
- ::srandom(ulong(time(0)));
- }
- long roll = ::random() % 3;
+ long roll = QRandomGenerator::global()->bounded(3);
switch (roll) {
case 0:
key = key == Qt::Key_Home ? Qt::Key_Up : Qt::Key_Down;
@@ -1963,9 +1949,8 @@ static void figureOutProperKey(Qt::Key &key, Qt::KeyboardModifiers &pressState)
break;
}
#else
- // Naively kill the warning.
- key = key;
- pressState = pressState;
+ Q_UNUSED(key);
+ Q_UNUSED(pressState);
#endif
}
@@ -3361,7 +3346,7 @@ void tst_QLineEdit::inlineCompletion()
completer->setCaseSensitivity(Qt::CaseInsensitive);
centerOnScreen(testWidget);
testWidget->show();
- QTest::qWaitForWindowExposed(testWidget);
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget));
testWidget->setFocus();
QTRY_COMPARE(qApp->activeWindow(), (QWidget*)testWidget);
testWidget->setCompleter(completer);
@@ -3689,7 +3674,7 @@ void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged()
QLineEdit lineEdit;
lineEdit.setMaxLength(5);
lineEdit.show();
- QTest::qWaitForWindowExposed(&lineEdit); // to be safe and avoid failing setFocus with window managers
+ QVERIFY(QTest::qWaitForWindowExposed(&lineEdit)); // to be safe and avoid failing setFocus with window managers
lineEdit.setFocus();
QSignalSpy changedSpy(&lineEdit, SIGNAL(textChanged(QString)));
QTest::qWait(200);
@@ -3979,6 +3964,8 @@ void tst_QLineEdit::QTBUG16850_setSelection()
le.setText(" 1");
le.setSelection(3, 1);
QCOMPARE(le.selectionStart(), 3);
+ QCOMPARE(le.selectionEnd(), 4);
+ QCOMPARE(le.selectionLength(), 1);
QCOMPARE(le.selectedText(), QString("1"));
}
@@ -4173,11 +4160,16 @@ void tst_QLineEdit::inputMethodSelection()
QCOMPARE(selectionSpy.count(), 0);
QCOMPARE(testWidget->selectionStart(), -1);
+ QCOMPARE(testWidget->selectionEnd(), -1);
+ QCOMPARE(testWidget->selectionLength(), 0);
testWidget->setSelection(0,5);
QCOMPARE(selectionSpy.count(), 1);
QCOMPARE(testWidget->selectionStart(), 0);
+ QCOMPARE(testWidget->selectionEnd(), 5);
+ QCOMPARE(testWidget->selectionLength(), 5);
+
// selection gained
{
@@ -4189,6 +4181,8 @@ void tst_QLineEdit::inputMethodSelection()
QCOMPARE(selectionSpy.count(), 2);
QCOMPARE(testWidget->selectionStart(), 12);
+ QCOMPARE(testWidget->selectionEnd(), 17);
+ QCOMPARE(testWidget->selectionLength(), 5);
// selection removed
{
@@ -4199,6 +4193,10 @@ void tst_QLineEdit::inputMethodSelection()
}
QCOMPARE(selectionSpy.count(), 3);
+ QCOMPARE(testWidget->selectionStart(), -1);
+ QCOMPARE(testWidget->selectionEnd(), -1);
+ QCOMPARE(testWidget->selectionLength(), 0);
+
}
Q_DECLARE_METATYPE(Qt::InputMethodHints)
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 292080c55f..30dc1e6043 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -2013,7 +2013,7 @@ void tst_QMainWindow::resizeDocks()
mw.setCentralWidget(new QTextEdit);
mw.show();
- QTest::qWaitForWindowExposed(&mw);
+ QVERIFY(QTest::qWaitForWindowExposed(&mw));
QFETCH(Qt::Orientation, orientation);
QFETCH(QStringList, docks);
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST
index cfd6bb1247..1c970c43b3 100644
--- a/tests/auto/widgets/widgets/qmenu/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST
@@ -3,3 +3,10 @@ osx
[submenuTearOffDontClose]
osx-10.11 ci
osx-10.12 ci
+[layoutDirection]
+# Fails when enabling synchronous expose events QTBUG-62092
+osx ci
+[pushButtonPopulateOnAboutToShow]
+osx
+[tearOff]
+osx
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 99d29d487d..91c12e292d 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -118,6 +118,8 @@ private slots:
#ifdef Q_OS_MAC
void QTBUG_37933_ampersands_data();
void QTBUG_37933_ampersands();
+#else
+ void click_while_dismissing_submenu();
#endif
void QTBUG_56917_wideMenuSize();
void QTBUG_56917_wideMenuScreenNumber();
@@ -1164,6 +1166,39 @@ void tst_QMenu::QTBUG20403_nested_popup_on_shortcut_trigger()
QVERIFY(!subsub1.isVisible());
}
+#ifndef Q_OS_MACOS
+void tst_QMenu::click_while_dismissing_submenu()
+{
+ QMenu menu("Test Menu");
+ QAction *action = menu.addAction("action");
+ QMenu sub("&sub");
+ sub.addAction("subaction");
+ menu.addMenu(&sub);
+ centerOnScreen(&menu, QSize(120, 100));
+ menu.show();
+ QSignalSpy spy(action, SIGNAL(triggered()));
+ QSignalSpy menuShownSpy(&sub, SIGNAL(aboutToShow()));
+ QSignalSpy menuHiddenSpy(&sub, SIGNAL(aboutToHide()));
+ QVERIFY(QTest::qWaitForWindowExposed(&menu));
+ //go over the submenu, press, move and release over the top level action
+ //this opens the submenu, move two times to emulate user interaction (d->motions > 0 in QMenu)
+ QTest::mouseMove(&menu, menu.rect().center() + QPoint(0,2));
+ QTest::mouseMove(&menu, menu.rect().center() + QPoint(1,3), 60);
+ QVERIFY(menuShownSpy.wait());
+ QVERIFY(sub.isVisible());
+ QVERIFY(QTest::qWaitForWindowExposed(&sub));
+ //press over the submenu entry
+ QTest::mousePress(&menu, Qt::LeftButton, 0, menu.rect().center() + QPoint(0,2), 300);
+ //move over the main action
+ QTest::mouseMove(&menu, menu.rect().center() - QPoint(0,2));
+ QVERIFY(menuHiddenSpy.wait());
+ //the submenu must have been hidden for the bug to be triggered
+ QVERIFY(!sub.isVisible());
+ QTest::mouseRelease(&menu, Qt::LeftButton, 0, menu.rect().center() - QPoint(0,2), 300);
+ QCOMPARE(spy.count(), 1);
+}
+#endif
+
class MyWidget : public QWidget
{
public:
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index 2a05900adc..49291cf5f9 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -62,6 +62,8 @@ private slots:
void showHide();
void nativeWindow();
void stackWidgetOpaqueChildIsVisible();
+ void offscreen();
+ void offscreenThenOnscreen();
};
void tst_QOpenGLWidget::initTestCase()
@@ -75,15 +77,17 @@ void tst_QOpenGLWidget::create()
{
QScopedPointer<QOpenGLWidget> w(new QOpenGLWidget);
QVERIFY(!w->isValid());
+ QVERIFY(w->textureFormat() == 0);
QSignalSpy frameSwappedSpy(w.data(), SIGNAL(frameSwapped()));
w->show();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
QVERIFY(frameSwappedSpy.count() > 0);
QVERIFY(w->isValid());
QVERIFY(w->context());
QCOMPARE(w->context()->format(), w->format());
QVERIFY(w->defaultFramebufferObject() != 0);
+ QVERIFY(w->textureFormat() != 0);
}
class ClearWidget : public QOpenGLWidget, protected QOpenGLFunctions
@@ -127,7 +131,7 @@ void tst_QOpenGLWidget::clearAndGrab()
QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
w->resize(800, 600);
w->show();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
QVERIFY(w->m_initCalled);
QVERIFY(w->m_resizeCalled);
QVERIFY(w->m_resizeOk);
@@ -145,7 +149,7 @@ void tst_QOpenGLWidget::clearAndResizeAndGrab()
QScopedPointer<QOpenGLWidget> w(new ClearWidget(0, 640, 480));
w->resize(640, 480);
w->show();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
QImage image = w->grabFramebuffer();
QVERIFY(!image.isNull());
@@ -168,7 +172,7 @@ void tst_QOpenGLWidget::createNonTopLevel()
QSignalSpy frameSwappedSpy(glw, SIGNAL(frameSwapped()));
w.resize(400, 400);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QVERIFY(frameSwappedSpy.count() > 0);
QVERIFY(glw->m_resizeCalled);
@@ -224,7 +228,7 @@ void tst_QOpenGLWidget::painter()
w.resize(640, 480);
glw->resize(320, 200);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
QImage image = glw->grabFramebuffer();
QCOMPARE(image.width(), glw->width());
@@ -245,11 +249,11 @@ void tst_QOpenGLWidget::reparentToAlreadyCreated()
w1.resize(640, 480);
glw->resize(320, 200);
w1.show();
- QTest::qWaitForWindowExposed(&w1);
+ QVERIFY(QTest::qWaitForWindowExposed(&w1));
QWidget w2;
w2.show();
- QTest::qWaitForWindowExposed(&w2);
+ QVERIFY(QTest::qWaitForWindowExposed(&w2));
glw->setParent(&w2);
glw->show();
@@ -267,12 +271,12 @@ void tst_QOpenGLWidget::reparentToNotYetCreated()
w1.resize(640, 480);
glw->resize(320, 200);
w1.show();
- QTest::qWaitForWindowExposed(&w1);
+ QVERIFY(QTest::qWaitForWindowExposed(&w1));
QWidget w2;
glw->setParent(&w2);
w2.show();
- QTest::qWaitForWindowExposed(&w2);
+ QVERIFY(QTest::qWaitForWindowExposed(&w2));
QImage image = glw->grabFramebuffer();
QCOMPARE(image.width(), 320);
@@ -293,12 +297,12 @@ void tst_QOpenGLWidget::reparentHidden()
glw->hide(); // Explicitly hidden
- QTest::qWaitForWindowExposed(&topLevel1);
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel1));
QWidget topLevel2;
topLevel2.resize(640, 480);
topLevel2.show();
- QTest::qWaitForWindowExposed(&topLevel2);
+ QVERIFY(QTest::qWaitForWindowExposed(&topLevel2));
QOpenGLContext *originalContext = glw->context();
QVERIFY(originalContext);
@@ -349,7 +353,7 @@ void tst_QOpenGLWidget::asViewport()
layout->addWidget(btn);
widget.setLayout(layout);
widget.show();
- QTest::qWaitForWindowExposed(&widget);
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
QVERIFY(view->paintCount() > 0);
view->resetPaintCount();
@@ -377,7 +381,7 @@ void tst_QOpenGLWidget::requestUpdate()
PaintCountWidget w;
w.resize(640, 480);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
w.reset();
QCOMPARE(w.m_count, 0);
@@ -401,7 +405,7 @@ void tst_QOpenGLWidget::fboRedirect()
FboCheckWidget w;
w.resize(640, 480);
w.show();
- QTest::qWaitForWindowExposed(&w);
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
// Unlike in paintGL(), the default fbo reported by the context is not affected by the widget,
// so we get the real default fbo: either 0 or (on iOS) the fbo associated with the window.
@@ -416,7 +420,7 @@ void tst_QOpenGLWidget::showHide()
QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
w->resize(800, 600);
w->show();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
w->hide();
@@ -428,7 +432,7 @@ void tst_QOpenGLWidget::showHide()
w->setClearColor(0, 0, 1);
w->show();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
image = w->grabFramebuffer();
QVERIFY(!image.isNull());
@@ -443,7 +447,7 @@ void tst_QOpenGLWidget::nativeWindow()
w->resize(800, 600);
w->show();
w->winId();
- QTest::qWaitForWindowExposed(w.data());
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
QImage image = w->grabFramebuffer();
QVERIFY(!image.isNull());
@@ -462,7 +466,7 @@ void tst_QOpenGLWidget::nativeWindow()
child->resize(400, 400);
child->move(23, 34);
nativeParent.show();
- QTest::qWaitForWindowExposed(&nativeParent);
+ QVERIFY(QTest::qWaitForWindowExposed(&nativeParent));
QVERIFY(nativeParent.internalWinId());
QVERIFY(!child->internalWinId());
@@ -582,8 +586,8 @@ void tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible()
stack.setCurrentIndex(0);
stack.resize(dimensionSize, dimensionSize);
stack.show();
- QTest::qWaitForWindowExposed(&stack);
- QTest::qWaitForWindowActive(&stack);
+ QVERIFY(QTest::qWaitForWindowExposed(&stack));
+ QVERIFY(QTest::qWaitForWindowActive(&stack));
// Switch to the QOpenGLWidget.
stack.setCurrentIndex(1);
@@ -603,6 +607,74 @@ void tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible()
#undef VERIFY_COLOR
}
+void tst_QOpenGLWidget::offscreen()
+{
+ {
+ QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
+ w->resize(800, 600);
+
+ w->setClearColor(0, 0, 1);
+ QImage image = w->grabFramebuffer();
+
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.width(), w->width());
+ QCOMPARE(image.height(), w->height());
+ QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
+ }
+
+ // QWidget::grab() should eventually end up in grabFramebuffer() as well
+ {
+ QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
+ w->resize(800, 600);
+
+ w->setClearColor(0, 0, 1);
+ QPixmap pm = w->grab();
+ QImage image = pm.toImage();
+
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.width(), w->width());
+ QCOMPARE(image.height(), w->height());
+ QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
+ }
+
+ // ditto for QWidget::render()
+ {
+ QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
+ w->resize(800, 600);
+
+ w->setClearColor(0, 0, 1);
+ QImage image(800, 600, QImage::Format_ARGB32);
+ w->render(&image);
+
+ QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
+ }
+}
+
+void tst_QOpenGLWidget::offscreenThenOnscreen()
+{
+ QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600));
+ w->resize(800, 600);
+
+ w->setClearColor(0, 0, 1);
+ QImage image = w->grabFramebuffer();
+
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.width(), w->width());
+ QCOMPARE(image.height(), w->height());
+ QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
+
+ // now let's make things more challenging: show. Internally this needs
+ // recreating the context.
+ w->show();
+ QVERIFY(QTest::qWaitForWindowExposed(w.data()));
+
+ image = w->grabFramebuffer();
+ QVERIFY(!image.isNull());
+ QCOMPARE(image.width(), w->width());
+ QCOMPARE(image.height(), w->height());
+ QVERIFY(image.pixel(30, 40) == qRgb(0, 0, 255));
+}
+
QTEST_MAIN(tst_QOpenGLWidget)
#include "tst_qopenglwidget.moc"
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 205ef34958..9f64335930 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -45,6 +45,7 @@ private slots:
void destroyIndeterminate();
void text();
void format();
+ void setValueRepaint_data();
void setValueRepaint();
#ifndef Q_OS_MAC
void setMinMaxRepaint();
@@ -191,21 +192,49 @@ void tst_QProgressBar::format()
QCOMPARE(bar.text(), QString());
}
+void tst_QProgressBar::setValueRepaint_data()
+{
+ QTest::addColumn<int>("min");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("increment");
+
+ auto add = [](int min, int max, int increment) {
+ QTest::addRow("%d-%d@%d", min, max, increment) << min << max << increment;
+ };
+
+ add(0, 10, 1);
+
+ auto add_set = [=](int min, int max, int increment) {
+ // check corner cases, and adjacent values (to circumvent explicit checks for corner cases)
+ add(min, max, increment);
+ add(min + 1, max, increment);
+ add(min, max - 1, increment);
+ add(min + 1, max - 1, increment);
+ };
+
+ add_set(INT_MIN, INT_MAX, INT_MAX / 50 + 1);
+ add_set(0, INT_MAX, INT_MAX / 100 + 1);
+ add_set(INT_MIN, 0, INT_MAX / 100 + 1);
+}
+
void tst_QProgressBar::setValueRepaint()
{
+ QFETCH(int, min);
+ QFETCH(int, max);
+ QFETCH(int, increment);
+
ProgressBar pbar;
- pbar.setMinimum(0);
- pbar.setMaximum(10);
+ pbar.setMinimum(min);
+ pbar.setMaximum(max);
pbar.setFormat("%v");
pbar.move(300, 300);
pbar.show();
QVERIFY(QTest::qWaitForWindowExposed(&pbar));
QApplication::processEvents();
- for (int i = pbar.minimum(); i < pbar.maximum(); ++i) {
+ for (qint64 i = min; i < max; i += increment) {
pbar.repainted = false;
- pbar.setValue(i);
- QTest::qWait(50);
+ pbar.setValue(int(i));
QTRY_VERIFY(pbar.repainted);
}
}
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index 7bbbc46b5a..2b54008de7 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -520,9 +520,6 @@ void tst_QPushButton::sizeHint_data()
#if !defined(QT_NO_STYLE_FUSION)
QTest::newRow("fusion") << QString::fromLatin1("fusion");
#endif
-#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP)
- QTest::newRow("windowsxp") << QString::fromLatin1("windowsxp");
-#endif
#if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA)
QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista");
#endif
@@ -597,7 +594,7 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer()
QDialog dialog;
dialog.setLayout(layout);
dialog.show();
- QTest::qWaitForWindowExposed(&dialog);
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
QApplication::setActiveWindow(&dialog);
// add shortcut '5' to button1 and test with keyboard and keypad '5' keys
@@ -642,7 +639,7 @@ void tst_QPushButton::emitReleasedAfterChange()
QDialog dialog;
dialog.setLayout(layout);
dialog.show();
- QTest::qWaitForWindowExposed(&dialog);
+ QVERIFY(QTest::qWaitForWindowExposed(&dialog));
QApplication::setActiveWindow(&dialog);
button1->setFocus();
diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
index f9a3e51977..278f5cdd68 100644
--- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
+++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
@@ -71,7 +71,7 @@ void tst_QScrollBar::scrollSingleStep()
testWidget.resize(100, testWidget.height());
centerOnScreen(&testWidget);
testWidget.show();
- QTest::qWaitForWindowExposed(&testWidget);
+ QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
testWidget.setValue(testWidget.minimum());
QCOMPARE(testWidget.value(), testWidget.minimum());
@@ -110,7 +110,7 @@ void tst_QScrollBar::task_209492()
verticalScrollBar->setRange(0, 1000);
centerOnScreen(&scrollArea);
scrollArea.show();
- QTest::qWaitForWindowExposed(&scrollArea);
+ QVERIFY(QTest::qWaitForWindowExposed(&scrollArea));
QSignalSpy spy(verticalScrollBar, SIGNAL(actionTriggered(int)));
QCOMPARE(scrollArea.scrollCount, 0);
@@ -147,7 +147,7 @@ void tst_QScrollBar::QTBUG_27308()
testWidget.resize(100, testWidget.height());
centerOnScreen(&testWidget);
testWidget.show();
- QTest::qWaitForWindowExposed(&testWidget);
+ QVERIFY(QTest::qWaitForWindowExposed(&testWidget));
testWidget.setValue(testWidget.minimum());
testWidget.setEnabled(false);
@@ -176,7 +176,7 @@ void tst_QScrollBar::QTBUG_42871()
scrollBarWidget.resize(100, scrollBarWidget.height());
centerOnScreen(&scrollBarWidget);
scrollBarWidget.show();
- QTest::qWaitForWindowExposed(&scrollBarWidget);
+ QVERIFY(QTest::qWaitForWindowExposed(&scrollBarWidget));
QSignalSpy spy(&scrollBarWidget, SIGNAL(actionTriggered(int)));
QVERIFY(spy.isValid());
QCOMPARE(myHandler.updatesCount, 0);
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index 72e6ffdeb5..aef4046afe 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -828,7 +828,7 @@ void tst_QSplitter::handleMinimumWidth()
split.addWidget(new QLabel("Number Too"));
split.show();
- QTest::qWaitForWindowExposed(&split);
+ QVERIFY(QTest::qWaitForWindowExposed(&split));
for (int i = 0; i < 10; i++) {
split.setHandleWidth(i);
QTest::qWait(100); // resizing
diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp
index 2df5f01627..59a334fab9 100644
--- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp
+++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp
@@ -180,7 +180,7 @@ void tst_QStackedWidget::dynamicPages()
sw->resize(200, 200);
sw->show();
qApp->setActiveWindow(sw);
- QTest::qWaitForWindowActive(sw);
+ QVERIFY(QTest::qWaitForWindowActive(sw));
QTRY_COMPARE(QApplication::focusWidget(), le11);
sw->setCurrentIndex(1);
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 55ef44f4e0..f383d430d6 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -2507,7 +2507,7 @@ void tst_QTextEdit::highlightLongLine()
};
NumHighlighter nh(edit.document());
edit.show();
- QTest::qWaitForWindowActive(edit.windowHandle());
+ QVERIFY(QTest::qWaitForWindowActive(edit.windowHandle()));
QCoreApplication::processEvents();
//If there is a quadratic behaviour, this would take forever.
QVERIFY(true);
@@ -2604,30 +2604,20 @@ namespace {
class MyPaintEngine : public QPaintEngine
{
public:
- bool begin(QPaintDevice *)
- {
- return true;
- }
+ bool begin(QPaintDevice *) override { return true; }
- bool end()
- {
- return true;
- }
+ bool end() override { return true; }
- void updateState(const QPaintEngineState &)
- {
- }
+ void updateState(const QPaintEngineState &) override { }
- void drawPixmap(const QRectF &, const QPixmap &, const QRectF &)
- {
- }
+ void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override { }
- void drawTextItem(const QPointF &, const QTextItem &textItem) Q_DECL_OVERRIDE
+ void drawTextItem(const QPointF &, const QTextItem &textItem) override
{
itemFonts.append(qMakePair(textItem.text(), textItem.font()));
}
- Type type() const { return User; }
+ Type type() const override { return User; }
QList<QPair<QString, QFont> > itemFonts;