summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp2
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp32
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp32
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp36
-rw-r--r--tests/auto/corelib/global/global.pro2
-rw-r--r--tests/auto/corelib/global/qhooks/qhooks.pro4
-rw-r--r--tests/auto/corelib/global/qhooks/tst_qhooks.cpp90
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp4
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp16
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp12
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp56
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp139
-rw-r--r--tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp20
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp48
-rw-r--r--tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp40
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp86
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp36
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp30
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp21
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp83
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp10
-rw-r--r--tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp4
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp8
-rw-r--r--tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp6
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp99
-rw-r--r--tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp6
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp162
-rw-r--r--tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp38
-rw-r--r--tests/auto/corelib/tools/collections/.gitignore (renamed from tests/auto/other/collections/.gitignore)0
-rw-r--r--tests/auto/corelib/tools/collections/collections.pro (renamed from tests/auto/other/collections/collections.pro)0
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp (renamed from tests/auto/other/collections/tst_collections.cpp)156
-rw-r--r--tests/auto/corelib/tools/qregularexpression/.gitignore1
-rw-r--r--tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro8
-rw-r--r--tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp52
-rw-r--r--tests/auto/corelib/tools/qregularexpression/qregularexpression.pro2
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp71
-rw-r--r--tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp6
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp62
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp30
-rw-r--r--tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp24
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp113
-rw-r--r--tests/auto/corelib/tools/tools.pro1
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/009.ref2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/010.ref2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/011.ref2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/012.ref2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/035.ref2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/data/036.ref2
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp44
-rw-r--r--tests/auto/gui/image/qpicture/tst_qpicture.cpp107
-rw-r--r--tests/auto/gui/kernel/kernel.pro1
-rw-r--r--tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp46
-rw-r--r--tests/auto/gui/kernel/qguiapplication/icons/appicon.pngbin0 -> 175 bytes
-rw-r--r--tests/auto/gui/kernel/qguiapplication/icons/usericon.pngbin0 -> 14743 bytes
-rw-r--r--tests/auto/gui/kernel/qguiapplication/qguiapplication.pro2
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp19
-rw-r--r--tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc6
-rw-r--r--tests/auto/gui/kernel/qpixelformat/qpixelformat.pro6
-rw-r--r--tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp243
-rw-r--r--tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp35
-rw-r--r--tests/auto/gui/painting/qcolor/tst_qcolor.cpp13
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp22
-rw-r--r--tests/auto/gui/painting/qpen/tst_qpen.cpp53
-rw-r--r--tests/auto/gui/qopengl/qopengl.pro2
-rw-r--r--tests/auto/gui/qopengl/tst_qopengl.cpp66
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp124
-rw-r--r--tests/auto/gui/text/qrawfont/tst_qrawfont.cpp39
-rw-r--r--tests/auto/network/ssl/qsslcertificate/pkcs12/README8
-rw-r--r--tests/auto/network/ssl/qsslcertificate/pkcs12/inter.crt22
-rw-r--r--tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.crt23
-rw-r--r--tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.key32
-rw-r--r--tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.p12bin0 -> 3821 bytes
-rw-r--r--tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro3
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp51
-rw-r--r--tests/auto/opengl/qgl/tst_qgl.cpp35
-rw-r--r--tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp20
-rw-r--r--tests/auto/opengl/qglthreads/tst_qglthreads.cpp53
-rw-r--r--tests/auto/other/lancelot/scripts/text.qps12
-rw-r--r--tests/auto/other/other.pro1
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp21
-rw-r--r--tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp168
-rw-r--r--tests/auto/testlib/selftests/expected_assert.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_assert.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_assert.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibeventcounter.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibtickcounter.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibwalltime.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_cmptest.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_commandlinedata.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_commandlinedata.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_commandlinedata.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_counting.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_counting.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_counting.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_datatable.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_datatable.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_datatable.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_exceptionthrow.lightxml3
-rw-r--r--tests/auto/testlib/selftests/expected_exceptionthrow.xml3
-rw-r--r--tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_expectfail.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_expectfail.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_expectfail.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failcleanup.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failcleanup.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_failcleanup.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinit.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinit.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinit.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinitdata.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinitdata.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_failinitdata.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_fetchbogus.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_fetchbogus.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_fetchbogus.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_findtestdata.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_findtestdata.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_findtestdata.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_globaldata.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_globaldata.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_globaldata.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_longstring.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_longstring.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_longstring.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_maxwarnings.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_maxwarnings.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_maxwarnings.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_singleskip.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_singleskip.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_singleskip.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skip.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skip.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_skip.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipcleanup.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipcleanup.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipcleanup.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinit.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinit.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinit.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinitdata.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinitdata.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_skipinitdata.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_strcmp.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_strcmp.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_strcmp.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_subtest.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_warnings.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_warnings.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_warnings.xunitxml1
-rw-r--r--tests/auto/testlib/selftests/expected_xunit.lightxml1
-rw-r--r--tests/auto/testlib/selftests/expected_xunit.xml1
-rw-r--r--tests/auto/testlib/selftests/expected_xunit.xunitxml1
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py3
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp28
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp11
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp124
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp73
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp3
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp15
-rw-r--r--tests/manual/cocoa/qt_on_cocoa/main.mm2
-rw-r--r--tests/manual/manual.pro5
-rw-r--r--tests/manual/qopenglcontext/main.cpp54
-rw-r--r--tests/manual/qopenglcontext/qopenglcontext.pro9
-rw-r--r--tests/manual/qopenglcontext/qopenglcontextwindow.cpp173
-rw-r--r--tests/manual/qopenglcontext/qopenglcontextwindow.h76
-rw-r--r--tests/manual/qopenglcontext/qticon64.pngbin0 -> 6474 bytes
-rw-r--r--tests/manual/widgets/itemviews/qheaderview/qheaderview.pro (renamed from tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro)0
-rw-r--r--tests/manual/widgets/itemviews/qtreeview/qtreeview.pro (renamed from tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro)0
-rw-r--r--tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro (renamed from tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro)0
-rw-r--r--tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro (renamed from tests/manual/widgets/kernel/layoutreplace/main.pro)0
-rw-r--r--tests/manual/widgets/kernel/qtooltip/qtooltip.pro (renamed from tests/manual/widgets/kernel/qtooltip/main.pro)0
-rw-r--r--tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro (renamed from tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro)0
201 files changed, 2958 insertions, 660 deletions
diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
index f6d9d2c14f..c0a3ae6114 100644
--- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
@@ -137,7 +137,7 @@ private:
void tst_QAnimationGroup::emptyGroup()
{
QSequentialAnimationGroup group;
- QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QCOMPARE(group.state(), QAnimationGroup::Stopped);
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 2021eefd8f..bbe9e1a816 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -256,10 +256,10 @@ void tst_QParallelAnimationGroup::stateChanged()
group.addAnimation(anim3);
group.addAnimation(anim4);
- QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy spy1(anim1, &TestAnimation::stateChanged);
+ QSignalSpy spy2(anim2, &TestAnimation::stateChanged);
+ QSignalSpy spy3(anim3, &TestAnimation::stateChanged);
+ QSignalSpy spy4(anim4, &TestAnimation::stateChanged);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
@@ -434,8 +434,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
anim.setEndValue(100);
anim.setDuration(200);
- QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy groupStateChangedSpy(&group, &QParallelAnimationGroup::stateChanged);
+ QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
@@ -601,8 +601,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
anim2.setEndValue(100);
anim2.setDuration(200);
- QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
+ QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
@@ -669,20 +669,20 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
anim3.setEndValue(100);
anim3.setDuration(10);
- QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy1(&anim1, SIGNAL(finished()));
+ QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
+ QSignalSpy finishedSpy1(&anim1, &TestAnimation::finished);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(finishedSpy1.isValid());
- QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy2(&anim2, SIGNAL(finished()));
+ QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
+ QSignalSpy finishedSpy2(&anim2, &TestAnimation::finished);
QVERIFY(stateChangedSpy2.isValid());
QVERIFY(finishedSpy2.isValid());
- QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy3(&anim3, SIGNAL(finished()));
+ QSignalSpy stateChangedSpy3(&anim3, &TestAnimation::stateChanged);
+ QSignalSpy finishedSpy3(&anim3, &TestAnimation::finished);
QVERIFY(stateChangedSpy3.isValid());
QVERIFY(finishedSpy3.isValid());
@@ -760,7 +760,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
loopsForever.setDuration(100);
loopsForever.setLoopCount(-1);
- QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy stateChangedSpy(&anim1, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy.isValid());
group.addAnimation(&anim1);
@@ -968,7 +968,7 @@ void tst_QParallelAnimationGroup::pauseResume()
{
QParallelAnimationGroup group;
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
- QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy spy(anim, &TestAnimation::stateChanged);
QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index dc731ee765..0dab56a9cc 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -230,9 +230,9 @@ void tst_QPropertyAnimation::statesAndSignals()
anim = new DummyPropertyAnimation;
anim->setDuration(100);
- QSignalSpy finishedSpy(anim, SIGNAL(finished()));
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int)));
+ QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
+ QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
+ QSignalSpy currentLoopSpy(anim, &QPropertyAnimation::currentLoopChanged);
QVERIFY(finishedSpy.isValid());
QVERIFY(runningSpy.isValid());
@@ -311,8 +311,8 @@ void tst_QPropertyAnimation::deletion1()
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth");
//test that the animation is deleted correctly depending of the deletion flag passed in start()
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QSignalSpy runningSpy(anim.data(), &QPropertyAnimation::stateChanged);
+ QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
anim->setStartValue(10);
@@ -355,8 +355,8 @@ void tst_QPropertyAnimation::deletion2()
anim->setEndValue(20);
anim->setDuration(200);
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QSignalSpy runningSpy(anim.data(), &QPropertyAnimation::stateChanged);
+ QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -389,8 +389,8 @@ void tst_QPropertyAnimation::deletion3()
anim->setEndValue(20);
anim->setDuration(200);
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
+ QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -490,7 +490,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
//normal case: the animation finishes and is deleted
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration() + 100);
@@ -501,7 +501,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
{
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration()/2);
@@ -850,7 +850,7 @@ void tst_QPropertyAnimation::setStartEndValues()
void tst_QPropertyAnimation::zeroDurationStart()
{
DummyPropertyAnimation anim;
- QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy spy(&anim, &DummyPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
anim.setDuration(0);
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
@@ -972,7 +972,7 @@ void tst_QPropertyAnimation::operationsInStates()
o.setProperty("ole", 42);
QPropertyAnimation anim(&o, "ole");
anim.setEndValue(100);
- QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy spy(&anim, &QPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
anim.stop();
@@ -1132,7 +1132,7 @@ void tst_QPropertyAnimation::valueChanged()
QPropertyAnimation anim(&o, "ole");
anim.setEndValue(5);
anim.setDuration(1000);
- QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
+ QSignalSpy spy(&anim, &QPropertyAnimation::valueChanged);
QVERIFY(spy.isValid());
anim.start();
@@ -1263,8 +1263,8 @@ void tst_QPropertyAnimation::zeroLoopCount()
anim->setDuration(20);
anim->setLoopCount(0);
- QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
+ QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
QVERIFY(runningSpy.isValid());
QVERIFY(finishedSpy.isValid());
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index 51f07993cd..cbd484c016 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -637,8 +637,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
sequence->addAnimation(a3_s_o1);
sequence->setLoopCount(2);
- QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy a1StateChangedSpy(a1_s_o1, &QVariantAnimation::stateChanged);
+ QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
QVERIFY(a1StateChangedSpy.isValid());
QVERIFY(seqStateChangedSpy.isValid());
@@ -744,8 +744,8 @@ void tst_QSequentialAnimationGroup::restart()
{
// sequence operating on same object/property
QAnimationGroup *sequence = new QSequentialAnimationGroup();
- QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimation*)));
- QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy seqCurrentAnimChangedSpy(static_cast<QSequentialAnimationGroup*>(sequence), &QSequentialAnimationGroup::currentAnimationChanged);
+ QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
QVERIFY(seqCurrentAnimChangedSpy.isValid());
QVERIFY(seqStateChangedSpy.isValid());
@@ -756,7 +756,7 @@ void tst_QSequentialAnimationGroup::restart()
for (int i = 0; i < 3; i++) {
anims[i] = new DummyPropertyAnimation;
anims[i]->setDuration(100);
- animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ animsStateChanged[i] = new QSignalSpy(anims[i], &QVariantAnimation::stateChanged);
QVERIFY(animsStateChanged[i]->isValid());
}
@@ -816,10 +816,10 @@ void tst_QSequentialAnimationGroup::looping()
QAbstractAnimation *a2_s_o1 = new DummyPropertyAnimation;
QAbstractAnimation *a3_s_o1 = new DummyPropertyAnimation;
- QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy a1Spy(a1_s_o1, &QAbstractAnimation::stateChanged);
+ QSignalSpy a2Spy(a2_s_o1, &QAbstractAnimation::stateChanged);
+ QSignalSpy a3Spy(a3_s_o1, &QAbstractAnimation::stateChanged);
+ QSignalSpy seqSpy(sequence, &QSequentialAnimationGroup::stateChanged);
QVERIFY(a1Spy.isValid());
QVERIFY(a2Spy.isValid());
@@ -833,7 +833,7 @@ void tst_QSequentialAnimationGroup::looping()
sequence->setLoopCount(2);
QSequentialAnimationGroup group;
- QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy groupSpy(&group, &QSequentialAnimationGroup::stateChanged);
QVERIFY(groupSpy.isValid());
group.addAnimation(sequence);
@@ -1101,8 +1101,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
anim.setEndValue(100);
anim.setDuration(200);
- QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
+ QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
@@ -1268,8 +1268,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
anim2->setEndValue(100);
anim2->setDuration(200);
- QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
- QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy stateChangedSpy1(anim1, &TestAnimation::stateChanged);
+ QSignalSpy stateChangedSpy2(anim2, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
@@ -1345,7 +1345,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation()
anim3->setEndValue(100);
anim3->setDuration(0);
- QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy stateChangedSpy(anim1, &TestAnimation::stateChanged);
QVERIFY(stateChangedSpy.isValid());
group.addAnimation(anim1);
@@ -1417,7 +1417,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
//first we test a group with one uncontrolled animation
QSequentialAnimationGroup group;
UncontrolledAnimation notTimeDriven(&o1, &group);
- QSignalSpy spy(&group, SIGNAL(finished()));
+ QSignalSpy spy(&group, &QSequentialAnimationGroup::finished);
QVERIFY(spy.isValid());
group.start();
@@ -1437,7 +1437,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
// lets make sure the seeking will work again
spy.clear();
DummyPropertyAnimation anim(&group);
- QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy animStateChangedSpy(&anim, &DummyPropertyAnimation::stateChanged);
QVERIFY(animStateChangedSpy.isValid());
group.setCurrentTime(300);
@@ -1639,7 +1639,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
anim->setDuration(250);
anim->setEndValue(250);
- QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
+ QSignalSpy spy(anim, &QPropertyAnimation::stateChanged);
QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();
diff --git a/tests/auto/corelib/global/global.pro b/tests/auto/corelib/global/global.pro
index c05905bd15..219e9de818 100644
--- a/tests/auto/corelib/global/global.pro
+++ b/tests/auto/corelib/global/global.pro
@@ -9,4 +9,4 @@ SUBDIRS=\
qlogging \
qtendian \
qglobalstatic \
-
+ qhooks
diff --git a/tests/auto/corelib/global/qhooks/qhooks.pro b/tests/auto/corelib/global/qhooks/qhooks.pro
new file mode 100644
index 0000000000..f886e7d49a
--- /dev/null
+++ b/tests/auto/corelib/global/qhooks/qhooks.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qhooks
+QT = core-private testlib
+SOURCES = tst_qhooks.cpp
diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp
new file mode 100644
index 0000000000..817c0b8173
--- /dev/null
+++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Volker Krause <volker.krause@kdab.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtCore/private/qhooks_p.h>
+
+class tst_QHooks: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testVersion();
+ void testAddRemoveObject();
+};
+
+void tst_QHooks::testVersion()
+{
+ QVERIFY(qtHookData[QHooks::HookDataVersion] >= 1);
+ QCOMPARE(qtHookData[QHooks::HookDataSize], (quintptr)QHooks::LastHookIndex);
+ QCOMPARE(qtHookData[QHooks::QtVersion], (quintptr)QT_VERSION);
+}
+
+static int objectCount = 0;
+
+static void objectAddHook(QObject*)
+{
+ ++objectCount;
+}
+
+static void objectRemoveHook(QObject*)
+{
+ --objectCount;
+}
+
+void tst_QHooks::testAddRemoveObject()
+{
+ QCOMPARE(qtHookData[QHooks::AddQObject], (quintptr)0);
+ QCOMPARE(qtHookData[QHooks::RemoveQObject], (quintptr)0);
+
+ qtHookData[QHooks::AddQObject] = (quintptr)&objectAddHook;
+ qtHookData[QHooks::RemoveQObject] = (quintptr)&objectRemoveHook;
+
+ QCOMPARE(objectCount, 0);
+ QObject *obj = new QObject;
+ QVERIFY(objectCount > 0);
+ delete obj;
+ QCOMPARE(objectCount, 0);
+}
+
+QTEST_APPLESS_MAIN(tst_QHooks)
+#include "tst_qhooks.moc"
diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
index a6d76ea7b6..a477d6bc6c 100644
--- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp
@@ -270,7 +270,9 @@ static int NColorRoles[] = {
QPalette::ToolTipText + 1, // Qt_5_0
QPalette::ToolTipText + 1, // Qt_5_1
QPalette::ToolTipText + 1, // Qt_5_2
- 0 // add the correct value for Qt_5_3 here later
+ QPalette::ToolTipText + 1, // Qt_5_3
+ QPalette::ToolTipText + 1, // Qt_5_4
+ 0 // add the correct value for Qt_5_5 here later
};
// Testing get/set functions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index 80144dba20..07e011f449 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -163,7 +163,8 @@ public:
QDebug operator<< (QDebug s, const MyPoint& point)
{
const QDebugStateSaver saver(s);
- return s.nospace() << "MyPoint(" << point.v1 << ", " << point.v2 << ")";
+ s.nospace() << "MyPoint(" << point.v1 << ", " << point.v2 << ")";
+ return s;
}
class MyLine
@@ -199,10 +200,19 @@ void tst_QDebug::debugSpaceHandling() const
d << 1 << 2;
MyLine line(MyPoint(10, 11), MyPoint (12, 13));
d << line;
+ d << "bar";
// With the old implementation of MyPoint doing dbg.nospace() << ...; dbg.space() we ended up with
// MyLine(MyPoint(10, 11) , MyPoint(12, 13) )
}
- QCOMPARE(s_msg, QString::fromLatin1(" foo key=value 1 2 MyLine(MyPoint(10, 11), MyPoint(12, 13))"));
+ QCOMPARE(s_msg, QString::fromLatin1(" foo key=value 1 2 MyLine(MyPoint(10, 11), MyPoint(12, 13)) bar"));
+
+ QVERIFY(qDebug().autoInsertSpaces());
+ qDebug() << QPoint(21, 22) << QRect(23, 24, 25, 26) << QLine(27, 28, 29, 30);
+ QCOMPARE(s_msg, QString::fromLatin1("QPoint(21,22) QRect(23,24 25x26) QLine(QPoint(27,28),QPoint(29,30))"));
+ qDebug() << QPointF(21, 22) << QRectF(23, 24, 25, 26) << QLineF(27, 28, 29, 30);
+ QCOMPARE(s_msg, QString::fromLatin1("QPointF(21,22) QRectF(23,24 25x26) QLineF(QPointF(27,28),QPointF(29,30))"));
+ qDebug() << QMimeType() << QMimeDatabase().mimeTypeForName("application/pdf") << "foo";
+ QCOMPARE(s_msg, QString::fromLatin1("QMimeType(invalid) QMimeType(\"application/pdf\") foo"));
}
void tst_QDebug::stateSaver() const
@@ -214,7 +224,7 @@ void tst_QDebug::stateSaver() const
QDebugStateSaver saver(d);
d.nospace() << hex << right << qSetFieldWidth(3) << qSetPadChar('0') << 42;
}
- d.space() << 42;
+ d << 42;
}
QCOMPARE(s_msg, QString::fromLatin1("02a 42"));
}
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index e06af5a799..7e04fa5957 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -140,7 +140,7 @@ void tst_QFileSystemWatcher::basicTest()
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
QVERIFY(watcher.addPath(testFile.fileName()));
- QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
+ QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
@@ -278,7 +278,7 @@ void tst_QFileSystemWatcher::watchDirectory()
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
QVERIFY(watcher.addPath(testDir.absolutePath()));
- QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
+ QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
@@ -441,8 +441,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
QVERIFY(watcher.addPath(testDir.absolutePath()));
QVERIFY(watcher.addPath(testFileName));
- QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(QString)));
- QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(QString)));
+ QSignalSpy fileChangedSpy(&watcher, &QFileSystemWatcher::fileChanged);
+ QSignalSpy dirChangedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(fileChangedSpy.isValid());
QVERIFY(dirChangedSpy.isValid());
QEventLoop eventLoop;
@@ -601,7 +601,7 @@ void tst_QFileSystemWatcher::QTBUG2331()
QVERIFY(watcher.addPath(temporaryDirectory.path()));
// watch signal
- QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
+ QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
QVERIFY(changedSpy.isValid());
// remove directory, we should get one change signal, and we should no longer
@@ -680,7 +680,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
connect(&watcher, SIGNAL(fileChanged(QString)), &signalReceiver, SLOT(fileChanged(QString)));
// watch signals
- QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
+ QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
QVERIFY(changedSpy.isValid());
// move files to second directory
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index b67166272b..67cf954f98 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -259,7 +259,7 @@ void tst_QProcess::simpleStart()
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
process = new QProcess;
- QSignalSpy spy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
+ QSignalSpy spy(process, &QProcess::stateChanged);
QVERIFY(spy.isValid());
connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
@@ -351,7 +351,7 @@ void tst_QProcess::crashTest()
{
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
process = new QProcess;
- QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
+ QSignalSpy stateSpy(process, &QProcess::stateChanged);
QVERIFY(stateSpy.isValid());
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
@@ -359,8 +359,8 @@ void tst_QProcess::crashTest()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
- QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@@ -394,8 +394,8 @@ void tst_QProcess::crashTest2()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
- QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
@@ -503,8 +503,8 @@ void tst_QProcess::echoTest2()
QCOMPARE(process->error(), QProcess::Timedout);
process->write("Hello");
- QSignalSpy spy1(process, SIGNAL(readyReadStandardOutput()));
- QSignalSpy spy2(process, SIGNAL(readyReadStandardError()));
+ QSignalSpy spy1(process, &QProcess::readyReadStandardOutput);
+ QSignalSpy spy2(process, &QProcess::readyReadStandardError);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
@@ -685,7 +685,7 @@ void tst_QProcess::readTimeoutAndThenCrash()
QCOMPARE(process->error(), QProcess::Timedout);
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
- QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
+ QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QVERIFY(spy.isValid());
process->kill();
@@ -887,7 +887,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
- QSignalSpy spy(&proc, SIGNAL(readyRead()));
+ QSignalSpy spy(&proc, &QProcess::readyRead);
QVERIFY(spy.isValid());
proc.start("testProcessEcho/testProcessEcho");
@@ -1283,7 +1283,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
process->start("testProcessEcho/testProcessEcho");
QVERIFY(process->waitForStarted(5000));
- QSignalSpy spy(process, SIGNAL(readyRead()));
+ QSignalSpy spy(process, &QProcess::readyRead);
QVERIFY(spy.isValid());
process->write("foo");
QTestEventLoop::instance().enterLoop(30);
@@ -1323,7 +1323,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
process->start("testProcessEcho/testProcessEcho");
QVERIFY(process->waitForStarted(5000));
- QSignalSpy spy(process, SIGNAL(bytesWritten(qint64)));
+ QSignalSpy spy(process, &QProcess::bytesWritten);
QVERIFY(spy.isValid());
process->write("f");
QTestEventLoop::instance().enterLoop(30);
@@ -1538,10 +1538,10 @@ void tst_QProcess::failToStart()
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
QProcess process;
- QSignalSpy stateSpy(&process, SIGNAL(stateChanged(QProcess::ProcessState)));
- QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
- QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy stateSpy(&process, &QProcess::stateChanged);
+ QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(stateSpy.isValid());
QVERIFY(errorSpy.isValid());
@@ -1605,9 +1605,9 @@ void tst_QProcess::failToStartWithWait()
QProcess process;
QEventLoop loop;
- QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
- QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1632,9 +1632,9 @@ void tst_QProcess::failToStartWithEventLoop()
QProcess process;
QEventLoop loop;
- QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
- QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -1864,9 +1864,9 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QProcess process;
- QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
- QSignalSpy finishedSpy1(&process, SIGNAL(finished(int)));
- QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
+ QSignalSpy finishedSpy1(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
+ QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy1.isValid());
@@ -2202,7 +2202,7 @@ void tst_QProcess::invalidProgramString()
QProcess process;
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
- QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError)));
+ QSignalSpy spy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
QVERIFY(spy.isValid());
process.start(programString);
@@ -2218,8 +2218,8 @@ void tst_QProcess::onlyOneStartedSignal()
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QProcess process;
- QSignalSpy spyStarted(&process, SIGNAL(started()));
- QSignalSpy spyFinished(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
+ QSignalSpy spyStarted(&process, &QProcess::started);
+ QSignalSpy spyFinished(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
QVERIFY(spyStarted.isValid());
QVERIFY(spyFinished.isValid());
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index 87bcfe572d..08b943ba72 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -93,6 +93,8 @@ private slots:
void transactionalWriteNoPermissionsOnFile();
void transactionalWriteCanceled();
void transactionalWriteErrorRenaming();
+ void symlink();
+ void directory();
};
static inline QByteArray msgCannotOpen(const QFileDevice &f)
@@ -340,5 +342,142 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
QCOMPARE(file.error(), QFile::RenameError);
}
+void tst_QSaveFile::symlink()
+{
+#ifdef Q_OS_UNIX
+ QByteArray someData = "some data";
+ QTemporaryDir dir;
+ QVERIFY(dir.isValid());
+
+ const QString targetFile = dir.path() + QLatin1String("/outfile");
+ const QString linkFile = dir.path() + QLatin1String("/linkfile");
+ {
+ QFile file(targetFile);
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.write("Hello"), Q_INT64_C(5));
+ file.close();
+ }
+
+ QVERIFY(QFile::link(targetFile, linkFile));
+
+ QString canonical = QFileInfo(linkFile).canonicalFilePath();
+ QCOMPARE(canonical, QFileInfo(targetFile).canonicalFilePath());
+
+ // Try saving into it
+ {
+ QSaveFile saveFile(linkFile);
+ QVERIFY(saveFile.open(QIODevice::WriteOnly));
+ QCOMPARE(saveFile.write(someData), someData.size());
+ saveFile.commit();
+
+ //Check that the linkFile is still a link and still has the same canonical path
+ QFileInfo info(linkFile);
+ QVERIFY(info.isSymLink());
+ QCOMPARE(QFileInfo(linkFile).canonicalFilePath(), canonical);
+
+ QFile file(targetFile);
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.readAll(), someData);
+ file.remove();
+ }
+
+ // Save into a symbolic link that point to a removed file
+ someData = "more stuff";
+ {
+ QSaveFile saveFile(linkFile);
+ QVERIFY(saveFile.open(QIODevice::WriteOnly));
+ QCOMPARE(saveFile.write(someData), someData.size());
+ saveFile.commit();
+
+ QFileInfo info(linkFile);
+ QVERIFY(info.isSymLink());
+ QCOMPARE(QFileInfo(linkFile).canonicalFilePath(), canonical);
+
+ QFile file(targetFile);
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.readAll(), someData);
+ }
+
+ // link to a link in another directory
+ QTemporaryDir dir2;
+ QVERIFY(dir2.isValid());
+
+ const QString linkFile2 = dir2.path() + QLatin1String("/linkfile");
+ QVERIFY(QFile::link(linkFile, linkFile2));
+ QCOMPARE(QFileInfo(linkFile2).canonicalFilePath(), canonical);
+
+
+ someData = "hello everyone";
+
+ {
+ QSaveFile saveFile(linkFile2);
+ QVERIFY(saveFile.open(QIODevice::WriteOnly));
+ QCOMPARE(saveFile.write(someData), someData.size());
+ saveFile.commit();
+
+ QFile file(targetFile);
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.readAll(), someData);
+ }
+
+ //cyclic link
+ const QString cyclicLink = dir.path() + QLatin1String("/cyclic");
+ QVERIFY(QFile::link(cyclicLink, cyclicLink));
+ {
+ QSaveFile saveFile(cyclicLink);
+ QVERIFY(saveFile.open(QIODevice::WriteOnly));
+ QCOMPARE(saveFile.write(someData), someData.size());
+ saveFile.commit();
+
+ QFile file(cyclicLink);
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.readAll(), someData);
+ }
+
+ //cyclic link2
+ QVERIFY(QFile::link(cyclicLink + QLatin1Char('1'), cyclicLink + QLatin1Char('2')));
+ QVERIFY(QFile::link(cyclicLink + QLatin1Char('2'), cyclicLink + QLatin1Char('1')));
+
+ {
+ QSaveFile saveFile(cyclicLink + QLatin1Char('1'));
+ QVERIFY(saveFile.open(QIODevice::WriteOnly));
+ QCOMPARE(saveFile.write(someData), someData.size());
+ saveFile.commit();
+
+ // the explicit file becomes a file instead of a link
+ QVERIFY(!QFileInfo(cyclicLink + QLatin1Char('1')).isSymLink());
+ QVERIFY(QFileInfo(cyclicLink + QLatin1Char('2')).isSymLink());
+
+ QFile file(cyclicLink + QLatin1Char('1'));
+ QVERIFY2(file.open(QIODevice::ReadOnly), msgCannotOpen(file).constData());
+ QCOMPARE(file.readAll(), someData);
+ }
+#endif
+}
+
+void tst_QSaveFile::directory()
+{
+ QTemporaryDir dir;
+ QVERIFY(dir.isValid());
+
+ const QString subdir = dir.path() + QLatin1String("/subdir");
+ QVERIFY(QDir(dir.path()).mkdir(QStringLiteral("subdir")));
+ {
+ QFile sf(subdir);
+ QVERIFY(!sf.open(QIODevice::WriteOnly));
+ }
+
+#ifdef Q_OS_UNIX
+ //link to a directory
+ const QString linkToDir = dir.path() + QLatin1String("/linkToDir");
+ QVERIFY(QFile::link(subdir, linkToDir));
+
+ {
+ QFile sf(linkToDir);
+ QVERIFY(!sf.open(QIODevice::WriteOnly));
+ }
+#endif
+}
+
QTEST_MAIN(tst_QSaveFile)
#include "tst_qsavefile.moc"
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
index 7247b02498..c373e80408 100644
--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
+++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp
@@ -56,7 +56,7 @@
#define Q_XDG_PLATFORM
#endif
-static const int MaxStandardLocation = QStandardPaths::GenericConfigLocation;
+static const int MaxStandardLocation = QStandardPaths::AppDataLocation;
class tst_qstandardpaths : public QObject
{
@@ -129,7 +129,8 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
"ConfigLocation",
"DownloadLocation",
"GenericCacheLocation",
- "GenericConfigLocation"
+ "GenericConfigLocation",
+ "AppDataLocation"
};
void tst_qstandardpaths::dump()
@@ -238,7 +239,8 @@ void tst_qstandardpaths::enableTestMode()
// Check this for locations where test programs typically write. Not desktop, download, music etc...
typedef QHash<QStandardPaths::StandardLocation, QString> LocationHash;
LocationHash testLocations;
- testLocations.insert(QStandardPaths::DataLocation, QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+ testLocations.insert(QStandardPaths::AppDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ testLocations.insert(QStandardPaths::AppLocalDataLocation, QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
testLocations.insert(QStandardPaths::GenericDataLocation, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
testLocations.insert(QStandardPaths::ConfigLocation, QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
testLocations.insert(QStandardPaths::GenericConfigLocation, QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
@@ -294,18 +296,18 @@ void tst_qstandardpaths::testDataLocation()
// applications are sandboxed.
#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT)
const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
- QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths");
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/tst_qstandardpaths");
QCoreApplication::instance()->setOrganizationName("Qt");
- QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/tst_qstandardpaths");
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/tst_qstandardpaths");
QCoreApplication::instance()->setApplicationName("QtTest");
- QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/Qt/QtTest");
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/Qt/QtTest");
#endif
#ifdef Q_XDG_PLATFORM
setDefaultLocations();
const QString expectedAppDataDir = QDir::homePath() + QString::fromLatin1("/.local/share/Qt/QtTest");
- QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), expectedAppDataDir);
- const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
+ QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), expectedAppDataDir);
+ const QStringList appDataDirs = QStandardPaths::standardLocations(QStandardPaths::AppLocalDataLocation);
QCOMPARE(appDataDirs.count(), 3);
QCOMPARE(appDataDirs.at(0), expectedAppDataDir);
QCOMPARE(appDataDirs.at(1), QString::fromLatin1("/usr/local/share/Qt/QtTest"));
@@ -463,7 +465,7 @@ void tst_qstandardpaths::testAllWritableLocations_data()
QTest::newRow("PicturesLocation") << QStandardPaths::PicturesLocation;
QTest::newRow("TempLocation") << QStandardPaths::TempLocation;
QTest::newRow("HomeLocation") << QStandardPaths::HomeLocation;
- QTest::newRow("DataLocation") << QStandardPaths::DataLocation;
+ QTest::newRow("AppLocalDataLocation") << QStandardPaths::AppLocalDataLocation;
QTest::newRow("DownloadLocation") << QStandardPaths::DownloadLocation;
}
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 92dbb96817..df090c3de9 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -165,6 +165,8 @@ private slots:
void binaryData();
void fromUserInput_data();
void fromUserInput();
+ void fromUserInputWithCwd_data();
+ void fromUserInputWithCwd();
void fileName_data();
void fileName();
void isEmptyForEncodedUrl();
@@ -2913,6 +2915,52 @@ void tst_QUrl::fromUserInput()
QCOMPARE(url, guessUrlFromString);
}
+void tst_QUrl::fromUserInputWithCwd_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("directory");
+ QTest::addColumn<QUrl>("guessedUrlDefault");
+ QTest::addColumn<QUrl>("guessedUrlAssumeLocalFile");
+
+ // Null
+ QTest::newRow("null") << QString() << QString() << QUrl() << QUrl();
+
+ // Existing file
+ QDirIterator it(QDir::currentPath(), QDir::NoDotDot | QDir::AllEntries);
+ int c = 0;
+ while (it.hasNext()) {
+ it.next();
+ QUrl url = QUrl::fromLocalFile(it.filePath());
+ QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.fileName() << QDir::currentPath() << url << url;
+ }
+ QDir parent = QDir::current();
+ QVERIFY(parent.cdUp());
+ QUrl parentUrl = QUrl::fromLocalFile(parent.path());
+ QTest::newRow("dotdot") << ".." << QDir::currentPath() << parentUrl << parentUrl;
+
+ QTest::newRow("nonexisting") << "nonexisting" << QDir::currentPath() << QUrl("http://nonexisting") << QUrl::fromLocalFile(QDir::currentPath() + "/nonexisting");
+ QTest::newRow("short-url") << "example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl::fromLocalFile(QDir::currentPath() + "/example.org");
+ QTest::newRow("full-url") << "http://example.org" << QDir::currentPath() << QUrl("http://example.org") << QUrl("http://example.org");
+ QTest::newRow("absolute") << "/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///doesnotexist.txt") << QUrl("file:///doesnotexist.txt");
+#ifdef Q_OS_WIN
+ QTest::newRow("windows-absolute") << "c:/doesnotexist.txt" << QDir::currentPath() << QUrl("file:///c:/doesnotexist.txt") << QUrl("file:///c:/doesnotexist.txt");
+#endif
+}
+
+void tst_QUrl::fromUserInputWithCwd()
+{
+ QFETCH(QString, string);
+ QFETCH(QString, directory);
+ QFETCH(QUrl, guessedUrlDefault);
+ QFETCH(QUrl, guessedUrlAssumeLocalFile);
+
+ QUrl url = QUrl::fromUserInput(string, directory);
+ QCOMPARE(url, guessedUrlDefault);
+
+ url = QUrl::fromUserInput(string, directory, QUrl::AssumeLocalFile);
+ QCOMPARE(url, guessedUrlAssumeLocalFile);
+}
+
void tst_QUrl::fileName_data()
{
QTest::addColumn<QString>("urlStr");
diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
index 8321f76bec..16f94e7c5d 100644
--- a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
+++ b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp
@@ -58,6 +58,7 @@ private slots:
void readFile();
void waitForNotified_data();
void waitForNotified();
+ void waitForAnyNotified();
void brokenPipe();
void multipleOperations();
@@ -195,6 +196,45 @@ void tst_QWinOverlappedIoNotifier::waitForNotified()
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) == 0);
+
+ 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) == 0);
+}
+
void tst_QWinOverlappedIoNotifier::brokenPipe()
{
QWinOverlappedIoNotifier notifier;
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
index 2d2ae14fb8..0503371714 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -158,6 +158,8 @@ public:
QVector<QVector<QString> > table;
};
+Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint);
+
QtTestModel::QtTestModel(int rows, int columns, QObject *parent)
: QAbstractItemModel(parent), cCount(columns), rCount(rows), wrongIndex(false)
{
@@ -353,6 +355,8 @@ void tst_QAbstractItemModel::init()
insertCommand->setStartRow(0);
insertCommand->setEndRow(9);
insertCommand->doCommand();
+
+ qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
}
void tst_QAbstractItemModel::cleanup()
@@ -807,8 +811,8 @@ void tst_QAbstractItemModel::removeRows()
{
QtTestModel model(10, 10);
- QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy rowsAboutToBeRemovedSpy(&model, &QtTestModel::rowsAboutToBeRemoved);
+ QSignalSpy rowsRemovedSpy(&model, &QtTestModel::rowsRemoved);
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
QVERIFY(rowsRemovedSpy.isValid());
@@ -822,8 +826,8 @@ void tst_QAbstractItemModel::removeColumns()
{
QtTestModel model(10, 10);
- QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved(QModelIndex,int,int)));
+ QSignalSpy columnsAboutToBeRemovedSpy(&model, &QtTestModel::columnsAboutToBeRemoved);
+ QSignalSpy columnsRemovedSpy(&model, &QtTestModel::columnsRemoved);
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
QVERIFY(columnsRemovedSpy.isValid());
@@ -837,8 +841,8 @@ void tst_QAbstractItemModel::insertRows()
{
QtTestModel model(10, 10);
- QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy rowsAboutToBeInsertedSpy(&model, &QtTestModel::rowsAboutToBeInserted);
+ QSignalSpy rowsInsertedSpy(&model, &QtTestModel::rowsInserted);
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
QVERIFY(rowsInsertedSpy.isValid());
@@ -852,8 +856,8 @@ void tst_QAbstractItemModel::insertColumns()
{
QtTestModel model(10, 10);
- QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted(QModelIndex,int,int)));
+ QSignalSpy columnsAboutToBeInsertedSpy(&model, &QtTestModel::columnsAboutToBeInserted);
+ QSignalSpy columnsInsertedSpy(&model, &QtTestModel::columnsInserted);
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
QVERIFY(columnsInsertedSpy.isValid());
@@ -867,8 +871,8 @@ void tst_QAbstractItemModel::moveRows()
{
QtTestModel model(10, 10);
- QSignalSpy rowsAboutToBeMovedSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy rowsMovedSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy rowsAboutToBeMovedSpy(&model, &QtTestModel::rowsAboutToBeMoved);
+ QSignalSpy rowsMovedSpy(&model, &QtTestModel::rowsMoved);
QVERIFY(rowsAboutToBeMovedSpy.isValid());
QVERIFY(rowsMovedSpy.isValid());
@@ -882,8 +886,8 @@ void tst_QAbstractItemModel::moveColumns()
{
QtTestModel model(10, 10);
- QSignalSpy columnsAboutToBeMovedSpy(&model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy columnsMovedSpy(&model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy columnsAboutToBeMovedSpy(&model, &QtTestModel::columnsAboutToBeMoved);
+ QSignalSpy columnsMovedSpy(&model, &QtTestModel::columnsMoved);
QVERIFY(columnsAboutToBeMovedSpy.isValid());
QVERIFY(columnsMovedSpy.isValid());
@@ -901,7 +905,7 @@ void tst_QAbstractItemModel::reset()
{
QtTestModel model(10, 10);
- QSignalSpy resetSpy(&model, SIGNAL(modelReset()));
+ QSignalSpy resetSpy(&model, &QtTestModel::modelReset);
QVERIFY(resetSpy.isValid());
model.reset();
QCOMPARE(resetSpy.count(), 1);
@@ -1023,8 +1027,8 @@ void tst_QAbstractItemModel::testMoveSameParentDown()
}
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1138,8 +1142,8 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
}
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1287,8 +1291,8 @@ void tst_QAbstractItemModel::testMoveToGrandParent()
}
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1427,8 +1431,8 @@ void tst_QAbstractItemModel::testMoveToSibling()
persistentList << QPersistentModelIndex(idx);
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1577,8 +1581,8 @@ void tst_QAbstractItemModel::testMoveToUncle()
persistentList << QPersistentModelIndex(idx);
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1684,8 +1688,8 @@ void tst_QAbstractItemModel::testMoveToDescendants()
persistentList << QPersistentModelIndex(idx);
}
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1748,8 +1752,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange()
QFETCH(int, endRow);
QFETCH(int, destRow);
- QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -1841,8 +1845,8 @@ void ListenerObject::slotReset()
void tst_QAbstractItemModel::testReset()
{
- QSignalSpy beforeResetSpy(m_model, SIGNAL(modelAboutToBeReset()));
- QSignalSpy afterResetSpy(m_model, SIGNAL(modelReset()));
+ QSignalSpy beforeResetSpy(m_model, &DynamicTreeModel::modelAboutToBeReset);
+ QSignalSpy afterResetSpy(m_model, &DynamicTreeModel::modelReset);
QVERIFY(beforeResetSpy.isValid());
QVERIFY(afterResetSpy.isValid());
@@ -1874,8 +1878,8 @@ void tst_QAbstractItemModel::testReset()
// Delete it because its slots test things which are not true after this point.
delete listener;
- QSignalSpy proxyBeforeResetSpy(nullProxy, SIGNAL(modelAboutToBeReset()));
- QSignalSpy proxyAfterResetSpy(nullProxy, SIGNAL(modelReset()));
+ QSignalSpy proxyBeforeResetSpy(nullProxy, &QSortFilterProxyModel::modelAboutToBeReset);
+ QSignalSpy proxyAfterResetSpy(nullProxy, &QSortFilterProxyModel::modelReset);
// Before setting it, it does not have custom roles.
QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray());
@@ -1925,8 +1929,8 @@ void tst_QAbstractItemModel::testDataChanged()
{
CustomRoleModel model;
- QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
- QSignalSpy withoutRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QSignalSpy withRoles(&model, &CustomRoleModel::dataChanged);
+ QSignalSpy withoutRoles(&model, &CustomRoleModel::dataChanged);
QVERIFY(withRoles.isValid());
QVERIFY(withoutRoles.isValid());
@@ -2027,8 +2031,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
QCOMPARE(model.rowCount(p1), 10);
QCOMPARE(model.rowCount(p2), 10);
- QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
+ QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -2043,8 +2047,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QVariantList beforeSignal = beforeSpy.first();
const QVariantList afterSignal = afterSpy.first();
- QCOMPARE(beforeSignal.size(), 1);
- QCOMPARE(afterSignal.size(), 1);
+ QCOMPARE(beforeSignal.size(), 2);
+ QCOMPARE(afterSignal.size(), 2);
const QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
QCOMPARE(beforeParents.size(), 2);
@@ -2093,8 +2097,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QPersistentModelIndex p2FirstPersistent = model.index(0, 0, p2);
const QPersistentModelIndex p2LastPersistent = model.index(9, 0, p2);
- QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
+ QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
QVERIFY(beforeSpy.isValid());
QVERIFY(afterSpy.isValid());
@@ -2116,8 +2120,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
const QVariantList beforeSignal = beforeSpy.first();
const QVariantList afterSignal = afterSpy.first();
- QCOMPARE(beforeSignal.size(), 1);
- QCOMPARE(afterSignal.size(), 1);
+ QCOMPARE(beforeSignal.size(), 2);
+ QCOMPARE(afterSignal.size(), 2);
QVERIFY(p1FirstPersistent.row() == 1);
QVERIFY(p1LastPersistent.row() == 0);
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index ea0a14c18c..5d21509c86 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -163,10 +163,10 @@ void tst_QIdentityProxyModel::insertRows()
verifyIdentity(m_model);
- QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)));
- QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeInserted);
+ QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsInserted);
+ QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeInserted);
+ QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsInserted);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@@ -203,10 +203,10 @@ void tst_QIdentityProxyModel::removeRows()
verifyIdentity(m_model);
- QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeRemoved);
+ QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsRemoved);
+ QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeRemoved);
+ QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsRemoved);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@@ -257,10 +257,10 @@ void tst_QIdentityProxyModel::moveRows()
verifyIdentity(&model);
- QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
+ QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::rowsAboutToBeMoved);
+ QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::rowsMoved);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@@ -318,10 +318,10 @@ void tst_QIdentityProxyModel::reset()
verifyIdentity(&model);
- QSignalSpy modelBeforeSpy(&model, SIGNAL(modelAboutToBeReset()));
- QSignalSpy modelAfterSpy(&model, SIGNAL(modelReset()));
- QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(modelAboutToBeReset()));
- QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(modelReset()));
+ QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::modelAboutToBeReset);
+ QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::modelReset);
+ QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::modelAboutToBeReset);
+ QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::modelReset);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
@@ -351,8 +351,8 @@ void tst_QIdentityProxyModel::dataChanged()
verifyIdentity(&model);
- QSignalSpy modelSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
- QSignalSpy proxySpy(m_proxy, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
+ QSignalSpy modelSpy(&model, &DataChangedModel::dataChanged);
+ QSignalSpy proxySpy(m_proxy, &QIdentityProxyModel::dataChanged);
QVERIFY(modelSpy.isValid());
QVERIFY(proxySpy.isValid());
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
index 30434bfd56..df4d8d0916 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
@@ -608,7 +608,7 @@ void tst_QItemModel::setData()
QFETCH(QString, modelType);
currentModel = testModels->createModel(modelType);
QVERIFY(currentModel);
- QSignalSpy spy(currentModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged);
QVERIFY(spy.isValid());
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
QCOMPARE(spy.count(), 0);
@@ -670,7 +670,7 @@ void tst_QItemModel::setHeaderData()
QVERIFY(index.isValid());
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
- QSignalSpy spy(currentModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
+ QSignalSpy spy(currentModel, &QAbstractItemModel::headerDataChanged);
QVERIFY(spy.isValid());
QString text = "Index private pointers should always be the same";
@@ -711,7 +711,7 @@ void tst_QItemModel::sort()
QVERIFY(currentModel->hasChildren(topIndex));
QModelIndex index = currentModel->index(0, 0, topIndex);
QVERIFY(index.isValid());
- QSignalSpy spy(currentModel, SIGNAL(layoutChanged()));
+ QSignalSpy spy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(spy.isValid());
for (int i=-1; i < 10; ++i){
currentModel->sort(i);
@@ -849,12 +849,12 @@ void tst_QItemModel::remove()
// When a row or column is removed there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
- QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)));
- QSignalSpy rowsRemovedSpy(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
- QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
+ QSignalSpy columnsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeRemoved);
+ QSignalSpy rowsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeRemoved);
+ QSignalSpy columnsRemovedSpy(currentModel, &QAbstractItemModel::columnsRemoved);
+ QSignalSpy rowsRemovedSpy(currentModel, &QAbstractItemModel::rowsRemoved);
+ QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
+ QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
@@ -1191,12 +1191,12 @@ void tst_QItemModel::insert()
// When a row or column is inserted there should be two signals.
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
- QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
- QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)));
- QSignalSpy rowsInsertedSpy(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
- QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
- QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
+ QSignalSpy columnsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeInserted);
+ QSignalSpy rowsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeInserted);
+ QSignalSpy columnsInsertedSpy(currentModel, &QAbstractItemModel::columnsInserted);
+ QSignalSpy rowsInsertedSpy(currentModel, &QAbstractItemModel::rowsInserted);
+ QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
+ QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 9e3457a25a..a4e219a040 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -1529,7 +1529,7 @@ void tst_QItemSelectionModel::resetModel()
MyStandardItemModel model(20, 20);
QItemSelectionModel *selectionModel = new QItemSelectionModel(&model);
- QSignalSpy spy(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QSignalSpy spy(selectionModel, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select);
@@ -1592,7 +1592,7 @@ void tst_QItemSelectionModel::removeRows()
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
- QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
@@ -1655,7 +1655,7 @@ void tst_QItemSelectionModel::removeColumns()
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
- QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
@@ -1914,12 +1914,9 @@ void tst_QItemSelectionModel::setCurrentIndex()
treemodel->index(0, 0, treemodel->index(0, 0)),
QItemSelectionModel::SelectCurrent);
- QSignalSpy currentSpy(&selectionModel,
- SIGNAL(currentChanged(QModelIndex,QModelIndex)));
- QSignalSpy rowSpy(&selectionModel,
- SIGNAL(currentRowChanged(QModelIndex,QModelIndex)));
- QSignalSpy columnSpy(&selectionModel,
- SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)));
+ QSignalSpy currentSpy(&selectionModel, &QItemSelectionModel::currentChanged);
+ QSignalSpy rowSpy(&selectionModel, &QItemSelectionModel::currentRowChanged);
+ QSignalSpy columnSpy(&selectionModel, &QItemSelectionModel::currentColumnChanged);
QVERIFY(currentSpy.isValid());
QVERIFY(rowSpy.isValid());
@@ -2223,7 +2220,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
QItemSelectionModel selectionModel(&model);
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
- QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged);
QVERIFY(deselectSpy.isValid());
model.removeRows(0, 1, root);
QVERIFY(deselectSpy.count() == 1);
@@ -2406,7 +2403,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange()
RemovalObserver ro(&selModel);
- QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QSignalSpy spy(&selModel, &QItemSelectionModel::selectionChanged);
QVERIFY(spy.isValid());
bool ok = model.removeRows(4, 2);
@@ -2738,7 +2735,7 @@ void tst_QItemSelectionModel::testClearCurrentIndex()
QItemSelectionModel selectionModel(&model, 0);
- QSignalSpy currentIndexSpy(&selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)));
+ QSignalSpy currentIndexSpy(&selectionModel, &QItemSelectionModel::currentChanged);
QVERIFY(currentIndexSpy.isValid());
QModelIndex firstIndex = model.index(0, 0);
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 0f72b419a0..72c7246ca9 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -159,6 +159,8 @@ private:
QSortFilterProxyModel *m_proxy;
};
+Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint)
+
// Testing get/set functions
void tst_QSortFilterProxyModel::getSetCheck()
{
@@ -177,6 +179,7 @@ void tst_QSortFilterProxyModel::getSetCheck()
tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
: m_model(0), m_proxy(0)
{
+ qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
}
void tst_QSortFilterProxyModel::initTestCase()
@@ -1472,7 +1475,7 @@ void tst_QSortFilterProxyModel::filterCurrent()
view.show();
view.setModel(&proxy);
- QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
+ QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
@@ -1620,10 +1623,10 @@ void tst_QSortFilterProxyModel::removeSourceRows()
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
(void)proxy.rowCount(QModelIndex()); // force mapping
- QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
- QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
- QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
+ QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
+ QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
+ QSignalSpy aboutToRemoveSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeRemoved);
+ QSignalSpy aboutToInsertSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeInserted);
QVERIFY(removeSpy.isValid());
QVERIFY(insertSpy.isValid());
@@ -1801,8 +1804,8 @@ void tst_QSortFilterProxyModel::changeFilter()
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
(void)proxy.rowCount(QModelIndex()); // force mapping
- QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy initialRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
+ QSignalSpy initialInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(initialRemoveSpy.isValid());
QVERIFY(initialInsertSpy.isValid());
@@ -1825,8 +1828,8 @@ void tst_QSortFilterProxyModel::changeFilter()
QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i));
}
- QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy finalRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
+ QSignalSpy finalInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(finalRemoveSpy.isValid());
QVERIFY(finalInsertSpy.isValid());
@@ -1976,8 +1979,8 @@ void tst_QSortFilterProxyModel::changeSourceData()
proxy.setFilterRegExp(filter);
- QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
+ QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(removeSpy.isValid());
QVERIFY(insertSpy.isValid());
@@ -2075,7 +2078,7 @@ void tst_QSortFilterProxyModel::selectionFilteredOut()
view.show();
view.setModel(&proxy);
- QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
+ QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
@@ -2190,8 +2193,8 @@ void tst_QSortFilterProxyModel::insertIntoChildrenlessItem()
QSortFilterProxyModel proxy;
proxy.setSourceModel(&model);
- QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(QModelIndex,int,int)));
- QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy colsInsertedSpy(&proxy, &QSortFilterProxyModel::columnsInserted);
+ QSignalSpy rowsInsertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(colsInsertedSpy.isValid());
QVERIFY(rowsInsertedSpy.isValid());
@@ -2270,7 +2273,7 @@ void tst_QSortFilterProxyModel::insertRowIntoFilteredParent()
EvenOddFilterModel proxy;
proxy.setSourceModel(&model);
- QSignalSpy spy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy spy(&proxy, &EvenOddFilterModel::rowsInserted);
QVERIFY(spy.isValid());
QStandardItem *itemA = new QStandardItem();
@@ -2299,8 +2302,8 @@ void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild()
QStandardItem *itemC = new QStandardItem("C");
itemA->appendRow(itemC); // filtered
- QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QSignalSpy removedSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
+ QSignalSpy insertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
QVERIFY(removedSpy.isValid());
QVERIFY(insertedSpy.isValid());
@@ -2903,8 +2906,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
QCOMPARE(sourceModel.rowCount(), 3);
QCOMPARE(proxyModel.rowCount(), 0); //all rows are hidden at first;
- QSignalSpy spyAbout1(&proxyModel, SIGNAL(layoutAboutToBeChanged()));
- QSignalSpy spyChanged1(&proxyModel, SIGNAL(layoutChanged()));
+ QSignalSpy spyAbout1(&proxyModel, &PModel::layoutAboutToBeChanged);
+ QSignalSpy spyChanged1(&proxyModel, &PModel::layoutChanged);
QVERIFY(spyAbout1.isValid());
QVERIFY(spyChanged1.isValid());
@@ -2915,8 +2918,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
secondProxyModel.setDynamicSortFilter(true);
secondProxyModel.sort(0, Qt::DescendingOrder);
QCOMPARE(secondProxyModel.rowCount(), 0); //all rows are hidden at first;
- QSignalSpy spyAbout2(&secondProxyModel, SIGNAL(layoutAboutToBeChanged()));
- QSignalSpy spyChanged2(&secondProxyModel, SIGNAL(layoutChanged()));
+ QSignalSpy spyAbout2(&secondProxyModel, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy spyChanged2(&secondProxyModel, &QSortFilterProxyModel::layoutChanged);
QVERIFY(spyAbout2.isValid());
QVERIFY(spyChanged2.isValid());
@@ -3443,25 +3446,25 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
proxy2.setSourceModel(&proxy);
proxy2.setObjectName("proxy2");
- QSignalSpy dataChangedSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QSignalSpy dataChangedSpy(&model, &QSortFilterProxyModel::dataChanged);
QVERIFY(dataChangedSpy.isValid());
// Verify that the no-arg signal is still emitted.
- QSignalSpy layoutAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged()));
- QSignalSpy layoutChangedSpy(&proxy, SIGNAL(layoutChanged()));
+ QSignalSpy layoutAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy layoutChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(layoutAboutToBeChangedSpy.isValid());
QVERIFY(layoutChangedSpy.isValid());
- QSignalSpy parentsAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy parentsChangedSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QSignalSpy parentsAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy parentsChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(parentsAboutToBeChangedSpy.isValid());
QVERIFY(parentsChangedSpy.isValid());
- QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy proxy2ParentsChangedSpy(&proxy2, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy proxy2ParentsChangedSpy(&proxy2, &QSortFilterProxyModel::layoutChanged);
QVERIFY(proxy2ParentsAboutToBeChangedSpy.isValid());
QVERIFY(proxy2ParentsChangedSpy.isValid());
@@ -3484,8 +3487,8 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
QVariantList beforeSignal = parentsAboutToBeChangedSpy.first();
QVariantList afterSignal = parentsChangedSpy.first();
- QCOMPARE(beforeSignal.size(), 1);
- QCOMPARE(afterSignal.size(), 1);
+ QCOMPARE(beforeSignal.size(), 2);
+ QCOMPARE(afterSignal.size(), 2);
QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
QList<QPersistentModelIndex> afterParents = afterSignal.first().value<QList<QPersistentModelIndex> >();
@@ -3620,16 +3623,16 @@ void tst_QSortFilterProxyModel::moveSourceRows()
filterBothProxy.setSourceModel(&proxy);
filterBothProxy.setFilterRegExp("5"); // The parents are 6 and 3. This filters both out.
- QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy proxyBeforeMoveSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy proxyAfterMoveSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
- QSignalSpy proxyBeforeParentLayoutSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy proxyAfterParentLayoutSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
- QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy filterAfterParentLayoutSpy(&filterProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
- QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
- QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
+ QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
+ QSignalSpy proxyBeforeMoveSpy(m_proxy, &QSortFilterProxyModel::rowsAboutToBeMoved);
+ QSignalSpy proxyAfterMoveSpy(m_proxy, &QSortFilterProxyModel::rowsMoved);
+ QSignalSpy proxyBeforeParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy proxyAfterParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
+ QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy filterAfterParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutChanged);
+ QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
+ QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutChanged);
QVERIFY(modelBeforeSpy.isValid());
QVERIFY(modelAfterSpy.isValid());
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index a7833aa835..ce9577e0ed 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -195,8 +195,8 @@ protected:
void tst_QEventLoop::processEvents()
{
- QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()));
- QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), SIGNAL(awake()));
+ QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock);
+ QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::awake);
QVERIFY(aboutToBlockSpy.isValid());
QVERIFY(awakeSpy.isValid());
@@ -282,7 +282,7 @@ void tst_QEventLoop::exec()
thread.cond.wait(&thread.mutex);
// make sure the eventloop runs
- QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
+ QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
QVERIFY(spy.isValid());
thread.cond.wakeOne();
thread.cond.wait(&thread.mutex);
@@ -345,7 +345,7 @@ void tst_QEventLoop::wakeUp()
thread.start();
(void) eventLoop.exec();
- QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
+ QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
QVERIFY(spy.isValid());
thread.eventLoop->wakeUp();
@@ -633,7 +633,7 @@ void tst_QEventLoop::testQuitLock()
QTimer timer;
timer.setInterval(100);
- QSignalSpy timerSpy(&timer, SIGNAL(timeout()));
+ QSignalSpy timerSpy(&timer, &QTimer::timeout);
timer.start();
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));
diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
index 3afc2bc574..09084578ab 100644
--- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp
@@ -857,7 +857,7 @@ void tst_QMetaObject::invokeTypedefTypes()
{
qRegisterMetaType<CustomString>("CustomString");
QtTestCustomObject obj;
- QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString)));
+ QSignalSpy spy(&obj, &QtTestCustomObject::sig_custom);
QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 0);
diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 0e7005799e..62e41a96c5 100644
--- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -1593,7 +1593,7 @@ void tst_QMetaObjectBuilder::usage_signal()
{
QScopedPointer<TestObject> testObject(new TestObject);
- QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
+ QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
testObject->emitIntPropChanged();
QCOMPARE(propChangedSpy.count(), 1);
QCOMPARE(propChangedSpy.at(0).count(), 1);
@@ -1608,7 +1608,7 @@ void tst_QMetaObjectBuilder::usage_property()
QCOMPARE(prop.type(), QVariant::Int);
QCOMPARE(prop.toInt(), testObject->intProp());
- QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
+ QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
QVERIFY(testObject->intProp() != 123);
testObject->setProperty("intProp", 123);
QCOMPARE(propChangedSpy.count(), 1);
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 959c79ed60..b65bddbf65 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1341,6 +1341,8 @@ static QByteArray createTypeName(const char *begin, const char *va)
}
#endif
+Q_DECLARE_METATYPE(const void*)
+
void tst_QMetaType::automaticTemplateRegistration()
{
#define TEST_SEQUENTIAL_CONTAINER(CONTAINER, VALUE_TYPE) \
@@ -1577,6 +1579,12 @@ void tst_QMetaType::automaticTemplateRegistration()
)
CREATE_AND_VERIFY_CONTAINER(QList, QList<QMap<int, QHash<char, QVariantList> > >)
+ CREATE_AND_VERIFY_CONTAINER(QVector, void*)
+ CREATE_AND_VERIFY_CONTAINER(QVector, const void*)
+ CREATE_AND_VERIFY_CONTAINER(QList, void*)
+ CREATE_AND_VERIFY_CONTAINER(QPair, void*, void*)
+ CREATE_AND_VERIFY_CONTAINER(QHash, void*, void*)
+ CREATE_AND_VERIFY_CONTAINER(QHash, const void*, const void*)
#endif // Q_COMPILER_VARIADIC_MACROS
diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
index 5632bcacc4..c650041e1e 100644
--- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
+++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp
@@ -267,12 +267,12 @@ void tst_QSocketNotifier::posixSockets()
{
QSocketNotifier rn(posixSocket, QSocketNotifier::Read);
connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy readSpy(&rn, SIGNAL(activated(int)));
+ QSignalSpy readSpy(&rn, &QSocketNotifier::activated);
QVERIFY(readSpy.isValid());
// No write notifier, some systems trigger write notification on socket creation, but not all
QSocketNotifier en(posixSocket, QSocketNotifier::Exception);
connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy errorSpy(&en, SIGNAL(activated(int)));
+ QSignalSpy errorSpy(&en, &QSocketNotifier::activated);
QVERIFY(errorSpy.isValid());
passive->write("hello",6);
@@ -289,7 +289,7 @@ void tst_QSocketNotifier::posixSockets()
QSocketNotifier wn(posixSocket, QSocketNotifier::Write);
connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- QSignalSpy writeSpy(&wn, SIGNAL(activated(int)));
+ QSignalSpy writeSpy(&wn, &QSocketNotifier::activated);
QVERIFY(writeSpy.isValid());
qt_safe_write(posixSocket, "goodbye", 8);
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 27ea3faf81..31c627afcb 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -77,6 +77,7 @@ private slots:
void cancelLongTimer();
void singleShotStaticFunctionZeroTimeout();
void recurseOnTimeoutAndStopTimer();
+ void singleShotToFunctors();
void dontBlockEvents();
void postedEventsShouldNotStarveTimers();
@@ -586,6 +587,14 @@ void tst_QTimer::singleShotStaticFunctionZeroTimeout()
QCOMPARE(helper.count, 1);
QTest::qWait(500);
QCOMPARE(helper.count, 1);
+
+ TimerHelper nhelper;
+
+ QTimer::singleShot(0, &nhelper, &TimerHelper::timeout);
+ QCoreApplication::processEvents();
+ QCOMPARE(nhelper.count, 1);
+ QCoreApplication::processEvents();
+ QCOMPARE(nhelper.count, 1);
}
class RecursOnTimeoutAndStopTimerTimer : public QObject
@@ -631,6 +640,96 @@ void tst_QTimer::recurseOnTimeoutAndStopTimer()
QVERIFY(!t.two->isActive());
}
+struct CountedStruct
+{
+ CountedStruct(int *count, QThread *t = Q_NULLPTR) : count(count), thread(t) { }
+ ~CountedStruct() { }
+ void operator()() const { ++(*count); if (thread) QCOMPARE(QThread::currentThread(), thread); }
+
+ int *count;
+ QThread *thread;
+};
+
+static QEventLoop _e;
+static QThread *_t = Q_NULLPTR;
+
+class StaticEventLoop
+{
+public:
+ static void quitEventLoop() { _e.quit(); if (_t) QCOMPARE(QThread::currentThread(), _t); }
+};
+
+void tst_QTimer::singleShotToFunctors()
+{
+ int count = 0;
+ QEventLoop e;
+
+ QTimer::singleShot(0, CountedStruct(&count));
+ QCoreApplication::processEvents();
+ QCOMPARE(count, 1);
+
+ QTimer::singleShot(0, &StaticEventLoop::quitEventLoop);
+ QCOMPARE(_e.exec(), 0);
+
+ QThread t1;
+ QObject c1;
+ c1.moveToThread(&t1);
+
+ QObject::connect(&t1, SIGNAL(started()), &e, SLOT(quit()));
+ t1.start();
+ QCOMPARE(e.exec(), 0);
+
+ QTimer::singleShot(0, &c1, CountedStruct(&count, &t1));
+ QTest::qWait(500);
+ QCOMPARE(count, 2);
+
+ t1.quit();
+ t1.wait();
+
+ _t = new QThread;
+ QObject c2;
+ c2.moveToThread(_t);
+
+ QObject::connect(_t, SIGNAL(started()), &e, SLOT(quit()));
+ _t->start();
+ QCOMPARE(e.exec(), 0);
+
+ QTimer::singleShot(0, &c2, &StaticEventLoop::quitEventLoop);
+ QCOMPARE(_e.exec(), 0);
+
+ _t->quit();
+ _t->wait();
+ _t->deleteLater();
+ _t = Q_NULLPTR;
+
+ {
+ QObject c3;
+ QTimer::singleShot(500, &c3, CountedStruct(&count));
+ }
+ QTest::qWait(800);
+ QCOMPARE(count, 2);
+
+#if defined(Q_COMPILER_LAMBDA)
+ QTimer::singleShot(0, [&count] { ++count; });
+ QCoreApplication::processEvents();
+ QCOMPARE(count, 3);
+
+ QObject context;
+ QThread thread;
+
+ context.moveToThread(&thread);
+ QObject::connect(&thread, SIGNAL(started()), &e, SLOT(quit()));
+ thread.start();
+ QCOMPARE(e.exec(), 0);
+
+ QTimer::singleShot(0, &context, [&count, &thread] { ++count; QCOMPARE(QThread::currentThread(), &thread); });
+ QTest::qWait(500);
+ QCOMPARE(count, 4);
+
+ thread.quit();
+ thread.wait();
+#endif
+}
class DontBlockEvents : public QObject
diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
index 351e3a23e0..4447eb7a0b 100644
--- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
+++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
@@ -264,8 +264,8 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance());
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
- QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
- QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
+ QSignalSpy spy1(loader1.instance(), &QObject::destroyed);
+ QSignalSpy spy2(loader2.instance(), &QObject::destroyed);
QVERIFY(spy1.isValid());
QVERIFY(spy2.isValid());
if (pass == 0) {
@@ -423,7 +423,7 @@ void tst_QPluginLoader::reloadPlugin()
QVERIFY(instance);
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
- QSignalSpy spy(loader.instance(), SIGNAL(destroyed()));
+ QSignalSpy spy(loader.instance(), &QObject::destroyed);
QVERIFY(spy.isValid());
QVERIFY(loader.unload()); // refcount reached 0, did really unload
QCOMPARE(spy.count(), 1);
diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
index 2d7beaa7c8..331e586106 100644
--- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
@@ -916,7 +916,7 @@ void tst_QStateMachine::historyStateAfterRestart()
s2->addTransition(new EventTransition(QEvent::User, s1));
for (int x = 0; x < 2; ++x) {
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -952,7 +952,7 @@ void tst_QStateMachine::historyStateAfterRestart()
QVERIFY(machine.configuration().contains(s2));
QVERIFY(machine.configuration().contains(s22));
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
@@ -1232,9 +1232,9 @@ void tst_QStateMachine::stateEntryAndExit()
QCOMPARE(trans->sourceState(), (QState*)s2);
}
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@@ -1252,11 +1252,11 @@ void tst_QStateMachine::stateEntryAndExit()
QVERIFY(machine.configuration().isEmpty());
globalTick = 0;
QVERIFY(!machine.isRunning());
- QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
- QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
- QSignalSpy tTriggeredSpy(t, SIGNAL(triggered()));
- QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
- QSignalSpy s2ExitedSpy(s2, SIGNAL(exited()));
+ QSignalSpy s1EnteredSpy(s1, &TestState::entered);
+ QSignalSpy s1ExitedSpy(s1, &TestState::exited);
+ QSignalSpy tTriggeredSpy(t, &TestTransition::triggered);
+ QSignalSpy s2EnteredSpy(s2, &TestState::entered);
+ QSignalSpy s2ExitedSpy(s2, &TestState::exited);
QVERIFY(s1EnteredSpy.isValid());
QVERIFY(s1ExitedSpy.isValid());
@@ -1312,8 +1312,8 @@ void tst_QStateMachine::stateEntryAndExit()
s12->addTransition(t2);
s2->addTransition(s3);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s1);
@@ -1388,7 +1388,7 @@ void tst_QStateMachine::assignProperty()
QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
{
- QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned()));
+ QSignalSpy propertiesAssignedSpy(s1, &QState::propertiesAssigned);
QVERIFY(propertiesAssignedSpy.isValid());
machine.start();
QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
@@ -1444,7 +1444,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1473,7 +1473,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1502,7 +1502,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1552,7 +1552,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1587,7 +1587,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
machine.setInitialState(group);
machine.start();
QTRY_COMPARE(machine.configuration().contains(s1), true);
- QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned()));
+ QSignalSpy propertiesAssignedSpy(s2, &QState::propertiesAssigned);
QVERIFY(propertiesAssignedSpy.isValid());
emitter.emitSignalWithNoArg();
QTRY_COMPARE(machine.configuration().contains(s2), true);
@@ -1675,7 +1675,7 @@ void tst_QStateMachine::postEvent()
machine.addState(s1);
machine.addState(s2);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1705,7 +1705,7 @@ void tst_QStateMachine::cancelDelayedEvent()
s1->addTransition(new StringTransition("a", s2));
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -1725,7 +1725,7 @@ void tst_QStateMachine::cancelDelayedEvent()
QVERIFY(machine.cancelDelayedEvent(id2));
QVERIFY(!machine.cancelDelayedEvent(id2));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
@@ -1740,7 +1740,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
s1->addTransition(new StringTransition("a", s2));
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -1749,7 +1749,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
QVERIFY(id1 != -1);
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
@@ -1813,7 +1813,7 @@ void tst_QStateMachine::postDelayedEventFromThread()
DelayedEventPosterThread poster(&machine);
poster.start();
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1826,11 +1826,11 @@ void tst_QStateMachine::stopAndPostEvent()
QStateMachine machine;
QState *s1 = new QState(&machine);
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
QVERIFY(stoppedSpy.isValid());
machine.stop();
QCOMPARE(stoppedSpy.count(), 0);
@@ -1850,7 +1850,7 @@ void tst_QStateMachine::stateFinished()
QFinalState *s2 = new QFinalState(&machine);
s1->addTransition(s1, SIGNAL(finished()), s2);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -1888,7 +1888,7 @@ void tst_QStateMachine::parallelStates()
s1->addTransition(s1, SIGNAL(finished()), s2);
machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
globalTick = 0;
machine.start();
@@ -1933,9 +1933,9 @@ void tst_QStateMachine::parallelRootState()
QFinalState *s2_f = new QFinalState(s2);
s2->setInitialState(s2_f);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -1984,7 +1984,7 @@ void tst_QStateMachine::allSourceToTargetConfigurations()
s2->addTransition(new StringTransition("f", s11));
s0->addTransition(new StringTransition("e", s211));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2094,7 +2094,7 @@ void tst_QStateMachine::signalTransitions()
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2145,7 +2145,7 @@ void tst_QStateMachine::signalTransitions()
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2170,7 +2170,7 @@ void tst_QStateMachine::signalTransitions()
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithIntArg(int)), s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2196,7 +2196,7 @@ void tst_QStateMachine::signalTransitions()
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2232,7 +2232,7 @@ void tst_QStateMachine::signalTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2251,7 +2251,7 @@ void tst_QStateMachine::signalTransitions()
QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2300,8 +2300,8 @@ void tst_QStateMachine::signalTransitions()
QFinalState *s3 = new QFinalState(&machine);
s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s3);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@@ -2341,8 +2341,8 @@ void tst_QStateMachine::signalTransitions()
QVERIFY(t1 != 0);
QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString))));
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@@ -2406,7 +2406,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2459,7 +2459,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2485,7 +2485,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2508,7 +2508,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2534,7 +2534,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2557,7 +2557,7 @@ void tst_QStateMachine::eventTransitions()
t1->setTargetState(s0);
s1->addTransition(t1);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2607,8 +2607,8 @@ void tst_QStateMachine::eventTransitions()
t1->setTargetState(s2);
s0->addTransition(t1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
@@ -2637,7 +2637,7 @@ void tst_QStateMachine::eventTransitions()
trans->setTargetState(s1);
s0->addTransition(trans);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2655,7 +2655,7 @@ void tst_QStateMachine::eventTransitions()
QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
QCOMPARE(trans->eventTypeReceived(), QEvent::None);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
@@ -2684,8 +2684,8 @@ void tst_QStateMachine::graphicsSceneEventTransitions()
s1->addTransition(t);
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.start();
@@ -2734,7 +2734,7 @@ void tst_QStateMachine::historyStates()
root->setInitialState(s0);
s0->setInitialState(s00);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QCoreApplication::processEvents();
@@ -2771,9 +2771,9 @@ void tst_QStateMachine::historyStates()
void tst_QStateMachine::startAndStop()
{
QStateMachine machine;
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@@ -2827,9 +2827,9 @@ void tst_QStateMachine::targetStateWithNoParent()
QState s2;
s1->addTransition(&s2);
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(stoppedSpy.isValid());
@@ -3263,14 +3263,14 @@ void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup()
QParallelAnimationGroup animationGroup;
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
- QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
+ QSignalSpy animationFinishedSpy(&animationGroup, &QParallelAnimationGroup::finished);
QVERIFY(animationFinishedSpy.isValid());
s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
machine.setInitialState(s1);
- QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy machineFinishedSpy(&machine, &QStateMachine::finished);
QVERIFY(machineFinishedSpy.isValid());
machine.start();
QTRY_COMPARE(machineFinishedSpy.count(), 1);
@@ -3770,8 +3770,8 @@ void tst_QStateMachine::nestedStateMachines()
group->addTransition(group, SIGNAL(finished()), final);
machine.setInitialState(group);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.start();
@@ -3795,7 +3795,7 @@ void tst_QStateMachine::goToState()
QState *s1 = new QState(&machine);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -3838,7 +3838,7 @@ void tst_QStateMachine::goToStateFromSourceWithTransition()
s1->addTransition(new QSignalTransition);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
@@ -3928,7 +3928,7 @@ void tst_QStateMachine::postEventFromOtherThread()
poster.start();
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -3984,9 +3984,9 @@ void tst_QStateMachine::stopInTransitionToFinalState()
machine.setInitialState(s1);
QObject::connect(t1, SIGNAL(triggered()), &machine, SLOT(stop()));
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
- QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
+ QSignalSpy s2EnteredSpy(s2, &QFinalState::entered);
QVERIFY(stoppedSpy.isValid());
QVERIFY(finishedSpy.isValid());
QVERIFY(s2EnteredSpy.isValid());
@@ -4029,13 +4029,13 @@ void tst_QStateMachine::stopInEventTest()
s1->addTransition(new StopInEventTestTransition());
machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
- QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
QVERIFY(stoppedSpy.isValid());
QVERIFY(finishedSpy.isValid());
machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
@@ -4070,7 +4070,7 @@ void tst_QStateMachine::testIncrementReceivers()
IncrementReceiversTest testObject;
s1->addTransition(&testObject, SIGNAL(mySignal()), s2);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QMetaObject::invokeMethod(&testObject, "mySignal", Qt::QueuedConnection);
@@ -4091,7 +4091,7 @@ void tst_QStateMachine::initialStateIsEnteredBeforeStartedEmitted()
// transition should trigger.
s1->addTransition(&machine, SIGNAL(started()), s2);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
}
@@ -4226,9 +4226,9 @@ void tst_QStateMachine::transitionWithNoTarget()
EventTransition *t1 = new EventTransition(QEvent::User, /*target=*/0);
s1->addTransition(t1);
- QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
- QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
- QSignalSpy t1TriggeredSpy(t1, SIGNAL(triggered()));
+ QSignalSpy s1EnteredSpy(s1, &QState::entered);
+ QSignalSpy s1ExitedSpy(s1, &QState::exited);
+ QSignalSpy t1TriggeredSpy(t1, &EventTransition::triggered);
machine.start();
QTRY_VERIFY(machine.configuration().contains(s1));
@@ -4261,7 +4261,7 @@ void tst_QStateMachine::initialStateIsFinal()
QStateMachine machine;
QFinalState *f = new QFinalState(&machine);
machine.setInitialState(f);
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_VERIFY(machine.configuration().contains(f));
QTRY_COMPARE(finishedSpy.count(), 1);
@@ -4921,8 +4921,8 @@ void tst_QStateMachine::signalTransitionSenderInDifferentThread2()
thread.start();
QTRY_VERIFY(thread.isRunning());
- QSignalSpy startedSpy(&machine, SIGNAL(started()));
- QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QSignalSpy startedSpy(&machine, &QStateMachine::started);
+ QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
index b2b0eace34..5c9f26b70e 100644
--- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -87,8 +87,8 @@ void tst_QFutureWatcher::startFinish()
{
QFutureWatcher<void> futureWatcher;
- QSignalSpy startedSpy(&futureWatcher, SIGNAL(started()));
- QSignalSpy finishedSpy(&futureWatcher, SIGNAL(finished()));
+ QSignalSpy startedSpy(&futureWatcher, &QFutureWatcher<void>::started);
+ QSignalSpy finishedSpy(&futureWatcher, &QFutureWatcher<void>::finished);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -322,7 +322,7 @@ void tst_QFutureWatcher::futureSignals()
a.reportStarted();
f.setFuture(a.future());
- QSignalSpy progressSpy(&f, SIGNAL(progressValueChanged(int)));
+ QSignalSpy progressSpy(&f, &QFutureWatcher<void>::progressValueChanged);
QVERIFY(progressSpy.isValid());
const int progress = 1;
a.setProgressValue(progress);
@@ -331,8 +331,8 @@ void tst_QFutureWatcher::futureSignals()
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 0);
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 1);
- QSignalSpy finishedSpy(&f, SIGNAL(finished()));
- QSignalSpy resultReadySpy(&f, SIGNAL(resultReadyAt(int)));
+ QSignalSpy finishedSpy(&f, &QFutureWatcher<void>::finished);
+ QSignalSpy resultReadySpy(&f, &QFutureWatcher<void>::resultReadyAt);
QVERIFY(finishedSpy.isValid());
QVERIFY(resultReadySpy.isValid());
@@ -374,10 +374,10 @@ void tst_QFutureWatcher::watchFinishedFuture()
#endif
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy startedSpy(&watcher, SIGNAL(started()));
- QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
- QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
+ QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
+ QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
+ QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -408,10 +408,10 @@ void tst_QFutureWatcher::watchCanceledFuture()
#endif
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy startedSpy(&watcher, SIGNAL(started()));
- QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
- QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
+ QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
+ QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
+ QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
QVERIFY(startedSpy.isValid());
QVERIFY(finishedSpy.isValid());
@@ -439,8 +439,8 @@ void tst_QFutureWatcher::disconnectRunningFuture()
SignalSlotObject object;
connect(watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy finishedSpy(watcher, SIGNAL(finished()));
- QSignalSpy resultReadySpy(watcher, SIGNAL(resultReadyAt(int)));
+ QSignalSpy finishedSpy(watcher, &QFutureWatcher<int>::finished);
+ QSignalSpy resultReadySpy(watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(finishedSpy.isValid());
QVERIFY(resultReadySpy.isValid());
@@ -634,7 +634,7 @@ void tst_QFutureWatcher::changeFuture()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a); // Watch 'a' which will genere a resultReady event.
@@ -666,7 +666,7 @@ void tst_QFutureWatcher::cancelEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
@@ -694,7 +694,7 @@ void tst_QFutureWatcher::pauseEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
@@ -720,7 +720,7 @@ void tst_QFutureWatcher::pauseEvents()
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
- QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
diff --git a/tests/auto/other/collections/.gitignore b/tests/auto/corelib/tools/collections/.gitignore
index dcd9d49ec0..dcd9d49ec0 100644
--- a/tests/auto/other/collections/.gitignore
+++ b/tests/auto/corelib/tools/collections/.gitignore
diff --git a/tests/auto/other/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro
index 51ea667f58..51ea667f58 100644
--- a/tests/auto/other/collections/collections.pro
+++ b/tests/auto/corelib/tools/collections/collections.pro
diff --git a/tests/auto/other/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index 17ed9c8a45..33aa1c4888 100644
--- a/tests/auto/other/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -1238,8 +1238,6 @@ void tst_Collections::byteArray()
QVERIFY(hello + "World" == helloWorld);
QVERIFY("hello" + World == helloWorld);
-
- QByteArray l;
QVERIFY('h' + ello == hello);
QVERIFY(Wor + 'l' + 'd' == "World");
QVERIFY(hello + World == "helloWorld");
@@ -1969,8 +1967,6 @@ void tst_Collections::qstring()
QVERIFY(hello + "World" == helloWorld);
QVERIFY("hello" + World == helloWorld);
-
- QString l;
QVERIFY('h' + ello == hello);
QVERIFY(Wor + 'l' + 'd' == "World");
QVERIFY(hello + World == "helloWorld");
@@ -2441,8 +2437,7 @@ void testContainer()
}
/*
- Verify that the 'sharable' flag is true while no mutable
- iterator is active.
+ Verify that the 'sharable' flag is true in populated containers.
*/
{
Container c1;
@@ -2457,95 +2452,6 @@ void testContainer()
QVERIFY(!c2.isDetached());
}
- /*
- Verify that the 'sharable' flag is set to false by the
- mutable iterator.
- */
- {
- Container c1;
- populate(c1);
- QVERIFY(c1.size() == 4);
- QVERIFY(c1.isDetached());
-
- ContainerMutableIterator i(c1);
- i.next();
-
- Container c2 = c1;
- QVERIFY(c1.size() == 4);
- QVERIFY(c2.size() == 4);
- QVERIFY(c1.isDetached());
- QVERIFY(c2.isDetached());
-
- i.remove();
- QVERIFY(c1.size() == 3);
- QVERIFY(c2.size() == 4);
- }
-
- /*
- Verify that the 'sharable' flag is reset to true by the
- mutable iterator's destructor.
- */
- {
- Container c1;
- populate(c1);
- QVERIFY(c1.size() == 4);
- QVERIFY(c1.isDetached());
-
- {
- ContainerMutableIterator i(c1);
- i.next();
- }
-
- Container c2 = c1;
- QVERIFY(c1.size() == 4);
- QVERIFY(c2.size() == 4);
- QVERIFY(!c1.isDetached());
- QVERIFY(!c2.isDetached());
- }
-
- /*
- Verify that the 'sharable' flag only affects the original
- object, not the copies.
- */
- {
- Container c1;
- populate(c1);
- QVERIFY(c1.size() == 4);
- QVERIFY(c1.isDetached());
-
- Container c2 = c1;
- QVERIFY(isSharable(c2));
-
- ContainerMutableIterator i(c1);
- QVERIFY(!isSharable(c1));
- QVERIFY(isSharable(c2));
-
- Container c3 = c1;
- QVERIFY(!isSharable(c1));
- QVERIFY(isSharable(c2));
- QVERIFY(isSharable(c3));
- QVERIFY(c1.isDetached());
- QVERIFY(c2.isDetached());
- QVERIFY(c3.isDetached());
-
- Container c4;
- c4 = c1;
- QVERIFY(!isSharable(c1));
- QVERIFY(isSharable(c2));
- QVERIFY(isSharable(c4));
- QVERIFY(c1.isDetached());
- QVERIFY(c2.isDetached());
- QVERIFY(c4.isDetached());
-
- c3 = c2;
- QVERIFY(!isSharable(c1));
- QVERIFY(isSharable(c2));
- QVERIFY(isSharable(c3));
- QVERIFY(c1.isDetached());
- QVERIFY(!c2.isDetached());
- QVERIFY(!c3.isDetached());
- }
-
/* test that the move operators work properly */
{
Container c1 = Container(newInstance<Container>());
@@ -3231,18 +3137,20 @@ void tst_Collections::qtimerList()
QFAIL("QList preallocates too much memory");
}
+#define QVERIFY_TYPE(Type) QVERIFY(sizeof(Type))
+
template <typename Container>
void testContainerTypedefs(Container container)
{
Q_UNUSED(container)
- { typedef typename Container::value_type Foo; }
- { typedef typename Container::iterator Foo; }
- { typedef typename Container::const_iterator Foo; }
- { typedef typename Container::reference Foo; }
- { typedef typename Container::const_reference Foo; }
- { typedef typename Container::pointer Foo; }
- { typedef typename Container::difference_type Foo; }
- { typedef typename Container::size_type Foo; }
+ { QVERIFY_TYPE(typename Container::value_type); }
+ { QVERIFY_TYPE(typename Container::iterator); }
+ { QVERIFY_TYPE(typename Container::const_iterator); }
+ { QVERIFY_TYPE(typename Container::reference); }
+ { QVERIFY_TYPE(typename Container::const_reference); }
+ { QVERIFY_TYPE(typename Container::pointer); }
+ { QVERIFY_TYPE(typename Container::difference_type); }
+ { QVERIFY_TYPE(typename Container::size_type); }
}
template <typename Container>
@@ -3251,34 +3159,34 @@ void testPairAssociativeContainerTypedefs(Container container)
Q_UNUSED(container)
// TODO: Not sure how to define value_type for our associative containers
-// { typedef typename Container::value_type Foo; }
-// { typedef typename Container::const_iterator Foo; }
-// { typedef typename Container::reference Foo; }
-// { typedef typename Container::const_reference Foo; }
-// { typedef typename Container::pointer Foo; }
-
- { typedef typename Container::difference_type Foo; }
- { typedef typename Container::size_type Foo; }
- { typedef typename Container::iterator Foo; }
- { typedef typename Container::key_type Foo; }
- { typedef typename Container::mapped_type Foo; }
+// { QVERIFY_TYPE(typename Container::value_type); }
+// { QVERIFY_TYPE(typename Container::const_iterator); }
+// { QVERIFY_TYPE(typename Container::reference); }
+// { QVERIFY_TYPE(typename Container::const_reference); }
+// { QVERIFY_TYPE(typename Container::pointer); }
+
+ { QVERIFY_TYPE(typename Container::difference_type); }
+ { QVERIFY_TYPE(typename Container::size_type); }
+ { QVERIFY_TYPE(typename Container::iterator); }
+ { QVERIFY_TYPE(typename Container::key_type); }
+ { QVERIFY_TYPE(typename Container::mapped_type); }
// TODO
-// { typedef typename Container::key_compare Foo; }
-// { typedef typename Container::value_comare Foo; }
+// { QVERIFY_TYPE(typename Container::key_compare); }
+// { QVERIFY_TYPE(typename Container::value_comare); }
}
template <typename Container>
void testSetContainerTypedefs(Container container)
{
Q_UNUSED(container)
- { typedef typename Container::iterator Foo; }
- { typedef typename Container::const_iterator Foo; }
- { typedef typename Container::reference Foo; }
- { typedef typename Container::const_reference Foo; }
- { typedef typename Container::pointer Foo; }
- { typedef typename Container::difference_type Foo; }
- { typedef typename Container::size_type Foo; }
- { typedef typename Container::key_type Foo; }
+ { QVERIFY_TYPE(typename Container::iterator); }
+ { QVERIFY_TYPE(typename Container::const_iterator); }
+ { QVERIFY_TYPE(typename Container::reference); }
+ { QVERIFY_TYPE(typename Container::const_reference); }
+ { QVERIFY_TYPE(typename Container::pointer); }
+ { QVERIFY_TYPE(typename Container::difference_type); }
+ { QVERIFY_TYPE(typename Container::size_type); }
+ { QVERIFY_TYPE(typename Container::key_type); }
}
/*
diff --git a/tests/auto/corelib/tools/qregularexpression/.gitignore b/tests/auto/corelib/tools/qregularexpression/.gitignore
index c9249e090e..4650b4454e 100644
--- a/tests/auto/corelib/tools/qregularexpression/.gitignore
+++ b/tests/auto/corelib/tools/qregularexpression/.gitignore
@@ -1,2 +1,3 @@
tst_qregularexpression_alwaysoptimize
tst_qregularexpression_defaultoptimize
+tst_qregularexpression_forceoptimize
diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro
new file mode 100644
index 0000000000..d34bc9b93d
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qregularexpression_forceoptimize
+QT = core testlib
+HEADERS = ../tst_qregularexpression.h
+SOURCES = \
+ tst_qregularexpression_forceoptimize.cpp \
+ ../tst_qregularexpression.cpp
+DEFINES += forceOptimize=true
diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp
new file mode 100644
index 0000000000..6244aacedf
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/tst_qregularexpression_forceoptimize.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../tst_qregularexpression.h"
+
+class tst_QRegularExpression_ForceOptimize : public tst_QRegularExpression
+{
+ Q_OBJECT
+};
+
+QTEST_APPLESS_MAIN(tst_QRegularExpression_ForceOptimize)
+
+#include "tst_qregularexpression_forceoptimize.moc"
diff --git a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
index 0cae10112f..c030f04a27 100644
--- a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
+++ b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS = defaultoptimize
+SUBDIRS = defaultoptimize forceoptimize
contains(QT_CONFIG,private_tests):SUBDIRS += alwaysoptimize
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
index 909725f4b8..5fad1bb738 100644
--- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -48,6 +48,10 @@
#include "tst_qregularexpression.h"
+#ifndef forceOptimize
+#define forceOptimize false
+#endif
+
struct Match
{
Match()
@@ -329,22 +333,30 @@ void tst_QRegularExpression::gettersSetters()
{
QRegularExpression re;
re.setPattern(pattern);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.pattern(), pattern);
QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption);
}
{
QRegularExpression re;
re.setPatternOptions(patternOptions);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.pattern(), QString());
QCOMPARE(re.patternOptions(), patternOptions);
}
{
QRegularExpression re(pattern);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.pattern(), pattern);
QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption);
}
{
QRegularExpression re(pattern, patternOptions);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.pattern(), pattern);
QCOMPARE(re.patternOptions(), patternOptions);
}
@@ -385,6 +397,8 @@ void tst_QRegularExpression::escape()
QFETCH(QString, escaped);
QCOMPARE(QRegularExpression::escape(string), escaped);
QRegularExpression re(escaped);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.isValid(), true);
}
@@ -415,6 +429,8 @@ void tst_QRegularExpression::validity()
QFETCH(QString, pattern);
QFETCH(bool, validity);
QRegularExpression re(pattern);
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.isValid(), validity);
if (!validity)
QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object");
@@ -501,6 +517,9 @@ void tst_QRegularExpression::patternOptions()
QFETCH(QString, subject);
QFETCH(Match, match);
+ if (forceOptimize)
+ regexp.optimize();
+
QRegularExpressionMatch m = regexp.match(subject);
consistencyCheck(m);
QVERIFY(m == match);
@@ -717,6 +736,9 @@ void tst_QRegularExpression::normalMatch()
QFETCH(QRegularExpression::MatchOptions, matchOptions);
QFETCH(Match, match);
+ if (forceOptimize)
+ regexp.optimize();
+
{
QRegularExpressionMatch m = regexp.match(subject, offset, QRegularExpression::NormalMatch, matchOptions);
consistencyCheck(m);
@@ -995,6 +1017,9 @@ void tst_QRegularExpression::partialMatch()
QFETCH(QRegularExpression::MatchOptions, matchOptions);
QFETCH(Match, match);
+ if (forceOptimize)
+ regexp.optimize();
+
{
QRegularExpressionMatch m = regexp.match(subject, offset, matchType, matchOptions);
consistencyCheck(m);
@@ -1286,6 +1311,10 @@ void tst_QRegularExpression::globalMatch()
QFETCH(QRegularExpression::MatchType, matchType);
QFETCH(QRegularExpression::MatchOptions, matchOptions);
QFETCH(QList<Match>, matchList);
+
+ if (forceOptimize)
+ regexp.optimize();
+
{
QRegularExpressionMatchIterator iterator = regexp.globalMatch(subject, offset, matchType, matchOptions);
consistencyCheck(iterator);
@@ -1320,6 +1349,10 @@ void tst_QRegularExpression::serialize()
QFETCH(QString, pattern);
QFETCH(QRegularExpression::PatternOptions, patternOptions);
QRegularExpression outRe(pattern, patternOptions);
+
+ if (forceOptimize)
+ outRe.optimize();
+
QByteArray buffer;
{
QDataStream out(&buffer, QIODevice::WriteOnly);
@@ -1376,16 +1409,34 @@ void tst_QRegularExpression::operatoreq()
{
QRegularExpression re1(pattern);
QRegularExpression re2(pattern);
+
+ if (forceOptimize)
+ re1.optimize();
+ if (forceOptimize)
+ re2.optimize();
+
verifyEquality(re1, re2);
}
{
QRegularExpression re1(QString(), patternOptions);
QRegularExpression re2(QString(), patternOptions);
+
+ if (forceOptimize)
+ re1.optimize();
+ if (forceOptimize)
+ re2.optimize();
+
verifyEquality(re1, re2);
}
{
QRegularExpression re1(pattern, patternOptions);
QRegularExpression re2(pattern, patternOptions);
+
+ if (forceOptimize)
+ re1.optimize();
+ if (forceOptimize)
+ re2.optimize();
+
verifyEquality(re1, re2);
}
}
@@ -1414,6 +1465,10 @@ void tst_QRegularExpression::captureCount()
{
QFETCH(QString, pattern);
QRegularExpression re(pattern);
+
+ if (forceOptimize)
+ re.optimize();
+
QTEST(re.captureCount(), "captureCount");
if (!re.isValid())
QCOMPARE(re.captureCount(), -1);
@@ -1480,7 +1535,11 @@ void tst_QRegularExpression::captureNames()
QFETCH(QString, pattern);
QFETCH(StringToIntMap, namedCapturesIndexMap);
- const QRegularExpression re(pattern);
+ QRegularExpression re(pattern);
+
+ if (forceOptimize)
+ re.optimize();
+
QStringList namedCaptureGroups = re.namedCaptureGroups();
int namedCaptureGroupsCount = namedCaptureGroups.size();
@@ -1515,6 +1574,10 @@ void tst_QRegularExpression::pcreJitStackUsage()
QFETCH(QString, subject);
QRegularExpression re(pattern);
+
+ if (forceOptimize)
+ re.optimize();
+
QVERIFY(re.isValid());
QRegularExpressionMatch match = re.match(subject);
consistencyCheck(match);
@@ -1541,6 +1604,10 @@ void tst_QRegularExpression::regularExpressionMatch()
QFETCH(QString, subject);
QRegularExpression re(pattern);
+
+ if (forceOptimize)
+ re.optimize();
+
QVERIFY(re.isValid());
QRegularExpressionMatch match = re.match(subject);
consistencyCheck(match);
@@ -1580,5 +1647,7 @@ void tst_QRegularExpression::JOptionUsage()
QRegularExpression re(pattern);
if (isValid && JOptionUsed)
QTest::ignoreMessage(QtWarningMsg, qPrintable(warningMessage.arg(pattern)));
+ if (forceOptimize)
+ re.optimize();
QCOMPARE(re.isValid(), isValid);
}
diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
index af82897179..86438caed6 100644
--- a/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
+++ b/tests/auto/corelib/tools/qscopedvaluerollback/tst_qscopedvaluerollback.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -67,14 +67,17 @@ void tst_QScopedValueRollback::leavingScope()
{
int i = 0;
bool b = false;
+ bool b2 = false;
QString s("This is useful");
//test rollback on going out of scope
{
QScopedValueRollback<int> ri(i);
QScopedValueRollback<bool> rb(b);
+ QScopedValueRollback<bool> rb2(b2, true);
QScopedValueRollback<QString> rs(s);
QCOMPARE(b, false);
+ QCOMPARE(b2, true);
QCOMPARE(i, 0);
QCOMPARE(s, QString("This is useful"));
b = true;
@@ -85,6 +88,7 @@ void tst_QScopedValueRollback::leavingScope()
QCOMPARE(s, QString("Useless"));
}
QCOMPARE(b, false);
+ QCOMPARE(b2, false);
QCOMPARE(i, 0);
QCOMPARE(s, QString("This is useful"));
}
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 5b1a2cf076..9bcce60e93 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -74,6 +74,7 @@ private slots:
void useOfForwardDeclared();
void memoryManagement();
void dropLastReferenceOfForwardDeclared();
+ void lock();
void downCast();
void functionCallDownCast();
void upCast();
@@ -391,12 +392,56 @@ void tst_QSharedPointer::swap()
QVERIFY(p2 != control);
QVERIFY(p2.isNull());
QVERIFY(*p1 == 42);
+
+ QWeakPointer<int> w1, w2 = control;
+
+ QVERIFY(w1.isNull());
+ QVERIFY(!w2.isNull());
+ QVERIFY(w2.lock() == control);
+ QVERIFY(!w1.lock());
+
+ w1.swap(w2);
+ QVERIFY(w2.isNull());
+ QVERIFY(!w1.isNull());
+ QVERIFY(w1.lock() == control);
+ QVERIFY(!w2.lock());
+
+ qSwap(w1, w2);
+ QVERIFY(w1.isNull());
+ QVERIFY(w2.lock() == control);
+
+ p1.reset();
+ p2.reset();
+ control.reset();
+
+ QVERIFY(w1.isNull());
+ QVERIFY(w2.isNull());
}
void tst_QSharedPointer::useOfForwardDeclared()
{
// this just a compile test: use the forward-declared class
QSharedPointer<ForwardDeclared> sp;
+
+ // copying should work, too:
+ QSharedPointer<ForwardDeclared> sp2 = sp;
+
+ // and assignment:
+ QSharedPointer<ForwardDeclared> sp3;
+ sp3 = sp;
+
+ // move assignment:
+ QSharedPointer<ForwardDeclared> sp4;
+ sp4 = qMove(sp);
+
+ // and move constuction:
+ QSharedPointer<ForwardDeclared> sp5 = qMove(sp2);
+
+ // swapping:
+ sp4.swap(sp3);
+ qSwap(sp4, sp3);
+
+ // and, of course, destruction
}
@@ -474,6 +519,22 @@ void tst_QSharedPointer::dropLastReferenceOfForwardDeclared()
QCOMPARE(forwardDeclaredDestructorRunCount, 1);
}
+void tst_QSharedPointer::lock()
+{
+ QSharedPointer<int> sp = QSharedPointer<int>::create();
+ QVERIFY(sp);
+ QWeakPointer<int> wp = sp;
+ QVERIFY(sp == wp);
+ QVERIFY(sp == wp.lock());
+ QVERIFY(sp == wp.toStrongRef());
+
+ sp.reset();
+ QVERIFY(!wp);
+ QVERIFY(sp != wp); // this is why op(shared_ptr, weak_ptr) is a bad idea (apart from MT races)...
+ QVERIFY(sp == wp.lock());
+ QVERIFY(sp == wp.toStrongRef());
+}
+
class DerivedData: public Data
{
public:
@@ -846,6 +907,7 @@ void tst_QSharedPointer::objectCast()
ptr.clear();
QVERIFY(ptr.isNull());
QVERIFY(weakptr.toStrongRef().isNull());
+ QVERIFY(weakptr.lock().isNull());
// verify that the object casts fail without crash
QSharedPointer<OtherObject> otherptr = qSharedPointerObjectCast<OtherObject>(weakptr);
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 246560e47f..91501a0106 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -66,6 +66,7 @@ private slots:
void lastIndexOf_regExp();
void streamingOperator();
+ void assignmentOperator();
void join() const;
void join_data() const;
void joinEmptiness() const;
@@ -296,9 +297,11 @@ void tst_QStringList::removeDuplicates_data()
QTest::addColumn<QString>("before");
QTest::addColumn<QString>("after");
QTest::addColumn<int>("count");
+ QTest::addColumn<bool>("detached");
- QTest::newRow("empty-1") << "Hello,Hello" << "Hello" << 1;
- QTest::newRow("empty-2") << "Hello,World" << "Hello,World" << 0;
+ QTest::newRow("empty-1") << "Hello,Hello" << "Hello" << 1 << true;
+ QTest::newRow("empty-2") << "Hello,World" << "Hello,World" << 0 << false;
+ QTest::newRow("middle") << "Hello,World,Hello" << "Hello,World" << 1 << true;
}
void tst_QStringList::removeDuplicates()
@@ -306,13 +309,16 @@ void tst_QStringList::removeDuplicates()
QFETCH(QString, before);
QFETCH(QString, after);
QFETCH(int, count);
+ QFETCH(bool, detached);
QStringList lbefore = before.split(',');
+ const QStringList oldlbefore = lbefore;
QStringList lafter = after.split(',');
int removed = lbefore.removeDuplicates();
QCOMPARE(removed, count);
QCOMPARE(lbefore, lafter);
+ QCOMPARE(detached, !oldlbefore.isSharedWith(lbefore));
}
void tst_QStringList::streamingOperator()
@@ -321,8 +327,13 @@ void tst_QStringList::streamingOperator()
list << "hei";
list << list << "hopp" << list;
+ QList<QString> slist = list;
+ list << slist;
+
QCOMPARE(list, QStringList()
<< "hei" << "hei" << "hopp"
+ << "hei" << "hei" << "hopp"
+ << "hei" << "hei" << "hopp"
<< "hei" << "hei" << "hopp");
QStringList list2;
@@ -334,6 +345,21 @@ void tst_QStringList::streamingOperator()
QCOMPARE(list2 << list3, QStringList() << "adam" << "eva");
}
+void tst_QStringList::assignmentOperator()
+{
+ // compile-only test
+
+ QStringList adam;
+ adam << "adam";
+ QList<QString> eva;
+ eva << "eva";
+ QStringList result;
+ QStringList &ref1 = (result = adam);
+ QStringList &ref2 = (result = eva);
+ Q_UNUSED(ref1);
+ Q_UNUSED(ref2);
+}
+
void tst_QStringList::join() const
{
QFETCH(QStringList, input);
diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
index e6629301f9..6b833681d6 100644
--- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
@@ -102,7 +102,7 @@ void tst_QTimeLine::range()
// Verify that you can change the range in the timeLine
timeLine.setFrameRange(10, 20);
- QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
#ifdef Q_OS_WINCE
@@ -131,7 +131,7 @@ void tst_QTimeLine::currentTime()
{
QTimeLine timeLine(2000);
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
- QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
+ QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
QVERIFY(spy.isValid());
timeLine.setFrameRange(10, 20);
QCOMPARE(timeLine.currentTime(), 0);
@@ -202,7 +202,7 @@ void tst_QTimeLine::frameRate()
// Default speed
timeLine.setUpdateInterval(1000 / 33);
- QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@@ -225,7 +225,7 @@ void tst_QTimeLine::value()
QVERIFY(timeLine.currentValue() == 0.0);
// Default speed
- QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
+ QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
@@ -256,7 +256,7 @@ void tst_QTimeLine::currentFrame()
QCOMPARE(timeLine.currentFrame(), 10);
// Default speed
- QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
@@ -288,7 +288,7 @@ void tst_QTimeLine::loopCount()
QCOMPARE(timeLine.loopCount(), 0);
// Default speed infiniti looping
- QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration());
@@ -306,8 +306,8 @@ void tst_QTimeLine::loopCount()
timeLine.setFrameRange(0, 2);
timeLine.setLoopCount(4);
- QSignalSpy finishedSpy(&timeLine, SIGNAL(finished()));
- QSignalSpy frameChangedSpy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy finishedSpy(&timeLine, &QTimeLine::finished);
+ QSignalSpy frameChangedSpy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(finishedSpy.isValid());
QVERIFY(frameChangedSpy.isValid());
QEventLoop loop;
@@ -461,7 +461,7 @@ void tst_QTimeLine::frameChanged()
timeLine.setCurveShape(QTimeLine::LinearCurve);
timeLine.setFrameRange(0,9);
timeLine.setUpdateInterval(800);
- QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
QVERIFY(spy.isValid());
// Test what happens when duration expires before all frames are emitted.
@@ -492,7 +492,7 @@ void tst_QTimeLine::stopped()
QTimeLine timeLine;
timeLine.setFrameRange(0, 9);
qRegisterMetaType<QTimeLine::State>("QTimeLine::State");
- QSignalSpy spy(&timeLine, SIGNAL(stateChanged(QTimeLine::State)));
+ QSignalSpy spy(&timeLine, &QTimeLine::stateChanged);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@@ -510,7 +510,7 @@ void tst_QTimeLine::finished()
{
QTimeLine timeLine;
timeLine.setFrameRange(0,9);
- QSignalSpy spy(&timeLine, SIGNAL(finished()));
+ QSignalSpy spy(&timeLine, &QTimeLine::finished);
QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
@@ -543,7 +543,7 @@ void tst_QTimeLine::multipleTimeLines()
// Stopping a timer shouldn't affect the other timers
QTimeLine timeLine(200);
timeLine.setFrameRange(0,99);
- QSignalSpy spy(&timeLine, SIGNAL(finished()));
+ QSignalSpy spy(&timeLine, &QTimeLine::finished);
QVERIFY(spy.isValid());
QTimeLine timeLineKiller;
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index f1efbf0812..97f370f146 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -225,7 +225,9 @@ private slots:
void fromListCustom() const;
void fromStdVector() const;
void indexOf() const;
- void insert() const;
+ void insertInt() const;
+ void insertMovable() const;
+ void insertCustom() const;
void isEmpty() const;
void last() const;
void lastIndexOf() const;
@@ -296,6 +298,7 @@ private:
template<typename T> void eraseReserved() const;
template<typename T> void fill() const;
template<typename T> void fromList() const;
+ template<typename T> void insert() const;
template<typename T> void prepend() const;
template<typename T> void remove() const;
template<typename T> void size() const;
@@ -1231,32 +1234,87 @@ void tst_QVector::indexOf() const
QVERIFY(myvec.indexOf("A", 4) == -1);
}
+template <typename T>
void tst_QVector::insert() const
{
- QVector<QString> myvec;
- myvec << "A" << "B" << "C";
+ QVector<T> myvec;
+ const T
+ tA = SimpleValue<T>::at(0),
+ tB = SimpleValue<T>::at(1),
+ tC = SimpleValue<T>::at(2),
+ tX = SimpleValue<T>::at(3),
+ tZ = SimpleValue<T>::at(4),
+ tT = SimpleValue<T>::at(5),
+ ti = SimpleValue<T>::at(6);
+ myvec << tA << tB << tC;
+ QVector<T> myvec2 = myvec;
// first position
- QCOMPARE(myvec.at(0), QLatin1String("A"));
- myvec.insert(0, QLatin1String("X"));
- QCOMPARE(myvec.at(0), QLatin1String("X"));
- QCOMPARE(myvec.at(1), QLatin1String("A"));
+ QCOMPARE(myvec.at(0), tA);
+ myvec.insert(0, tX);
+ QCOMPARE(myvec.at(0), tX);
+ QCOMPARE(myvec.at(1), tA);
+
+ QCOMPARE(myvec2.at(0), tA);
+ myvec2.insert(myvec2.begin(), tX);
+ QCOMPARE(myvec2.at(0), tX);
+ QCOMPARE(myvec2.at(1), tA);
// middle
- myvec.insert(1, QLatin1String("Z"));
- QCOMPARE(myvec.at(0), QLatin1String("X"));
- QCOMPARE(myvec.at(1), QLatin1String("Z"));
- QCOMPARE(myvec.at(2), QLatin1String("A"));
+ myvec.insert(1, tZ);
+ QCOMPARE(myvec.at(0), tX);
+ QCOMPARE(myvec.at(1), tZ);
+ QCOMPARE(myvec.at(2), tA);
+
+ myvec2.insert(myvec2.begin() + 1, tZ);
+ QCOMPARE(myvec2.at(0), tX);
+ QCOMPARE(myvec2.at(1), tZ);
+ QCOMPARE(myvec2.at(2), tA);
// end
- myvec.insert(5, QLatin1String("T"));
- QCOMPARE(myvec.at(5), QLatin1String("T"));
- QCOMPARE(myvec.at(4), QLatin1String("C"));
+ myvec.insert(5, tT);
+ QCOMPARE(myvec.at(5), tT);
+ QCOMPARE(myvec.at(4), tC);
+
+ myvec2.insert(myvec2.end(), tT);
+ QCOMPARE(myvec2.at(5), tT);
+ QCOMPARE(myvec2.at(4), tC);
// insert a lot of garbage in the middle
- myvec.insert(2, 2, QLatin1String("infinity"));
- QCOMPARE(myvec, QVector<QString>() << "X" << "Z" << "infinity" << "infinity"
- << "A" << "B" << "C" << "T");
+ myvec.insert(2, 2, ti);
+ QCOMPARE(myvec, QVector<T>() << tX << tZ << ti << ti
+ << tA << tB << tC << tT);
+
+ myvec2.insert(myvec2.begin() + 2, 2, ti);
+ QCOMPARE(myvec2, myvec);
+
+ // insert from references to the same container:
+ myvec.insert(0, 1, myvec[5]); // inserts tB
+ myvec2.insert(0, 1, myvec2[5]); // inserts tB
+ QCOMPARE(myvec, QVector<T>() << tB << tX << tZ << ti << ti
+ << tA << tB << tC << tT);
+ QCOMPARE(myvec2, myvec);
+
+ myvec.insert(0, 1, const_cast<const QVector<T>&>(myvec)[0]); // inserts tB
+ myvec2.insert(0, 1, const_cast<const QVector<T>&>(myvec2)[0]); // inserts tB
+ QCOMPARE(myvec, QVector<T>() << tB << tB << tX << tZ << ti << ti
+ << tA << tB << tC << tT);
+ QCOMPARE(myvec2, myvec);
+}
+
+void tst_QVector::insertInt() const
+{
+ insert<int>();
+}
+
+void tst_QVector::insertMovable() const
+{
+ insert<Movable>();
+}
+
+void tst_QVector::insertCustom() const
+{
+ insert<Custom>();
}
void tst_QVector::isEmpty() const
@@ -1321,6 +1379,8 @@ void tst_QVector::mid() const
list << "foo" << "bar" << "baz" << "bak" << "buck" << "hello" << "kitty";
QCOMPARE(list.mid(3, 3), QVector<QString>() << "bak" << "buck" << "hello");
+ QCOMPARE(list.mid(6, 10), QVector<QString>() << "kitty");
+ QCOMPARE(list.mid(-1, 20), list);
QCOMPARE(list.mid(4), QVector<QString>() << "buck" << "hello" << "kitty");
}
@@ -1386,13 +1446,28 @@ void tst_QVector::remove() const
T val1 = SimpleValue<T>::at(1);
T val2 = SimpleValue<T>::at(2);
T val3 = SimpleValue<T>::at(3);
+ T val4 = SimpleValue<T>::at(4);
+ myvec << val1 << val2 << val3;
+ myvec << val1 << val2 << val3;
myvec << val1 << val2 << val3;
// remove middle
myvec.remove(1);
- QCOMPARE(myvec, QVector<T>() << val1 << val3);
+ QCOMPARE(myvec, QVector<T>() << val1 << val3 << val1 << val2 << val3 << val1 << val2 << val3);
+
+ // removeOne()
+ QVERIFY(!myvec.removeOne(val4));
+ QVERIFY(myvec.removeOne(val2));
+ QCOMPARE(myvec, QVector<T>() << val1 << val3 << val1 << val3 << val1 << val2 << val3);
+
+ // removeAll()
+ QCOMPARE(myvec.removeAll(val4), 0);
+ QCOMPARE(myvec.removeAll(val1), 3);
+ QCOMPARE(myvec, QVector<T>() << val3 << val3 << val2 << val3);
+ QCOMPARE(myvec.removeAll(val2), 1);
+ QCOMPARE(myvec, QVector<T>() << val3 << val3 << val3);
// remove rest
- myvec.remove(0, 2);
+ myvec.remove(0, 3);
QCOMPARE(myvec, QVector<T>());
}
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index 1ef8e77071..352cf88d44 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -1,5 +1,6 @@
TEMPLATE=subdirs
SUBDIRS=\
+ collections \
qalgorithms \
qarraydata \
qarraydata_strictiterators \
diff --git a/tests/auto/corelib/xml/qxmlstream/data/009.ref b/tests/auto/corelib/xml/qxmlstream/data/009.ref
index 1de530df1c..12b994eac4 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/009.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/009.ref
@@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'b:attr' redefined.
diff --git a/tests/auto/corelib/xml/qxmlstream/data/010.ref b/tests/auto/corelib/xml/qxmlstream/data/010.ref
index 217f4963a1..07def503a5 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/010.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/010.ref
@@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'b:attr' redefined.
diff --git a/tests/auto/corelib/xml/qxmlstream/data/011.ref b/tests/auto/corelib/xml/qxmlstream/data/011.ref
index e3945324eb..faa6e75429 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/011.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/011.ref
@@ -27,4 +27,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'b:attr' redefined.
diff --git a/tests/auto/corelib/xml/qxmlstream/data/012.ref b/tests/auto/corelib/xml/qxmlstream/data/012.ref
index 7a688b103d..834db97ba6 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/012.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/012.ref
@@ -24,4 +24,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="urn:xyzzy" qualifiedName="b:attr" prefix="b" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'b:attr' redefined.
diff --git a/tests/auto/corelib/xml/qxmlstream/data/035.ref b/tests/auto/corelib/xml/qxmlstream/data/035.ref
index e172fc90e1..cab0158a51 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/035.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/035.ref
@@ -13,4 +13,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="a:attr" prefix="a" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'a:attr' redefined.
diff --git a/tests/auto/corelib/xml/qxmlstream/data/036.ref b/tests/auto/corelib/xml/qxmlstream/data/036.ref
index 158e7361f9..50939ed7e7 100644
--- a/tests/auto/corelib/xml/qxmlstream/data/036.ref
+++ b/tests/auto/corelib/xml/qxmlstream/data/036.ref
@@ -13,4 +13,4 @@ Invalid( name="bar" qualifiedName="bar"
Attribute( name="attr" namespaceUri="http://example.org/~wilbur" qualifiedName="b:attr" prefix="b" value="2" )
)
-ERROR: Attribute redefined.
+ERROR: Attribute 'b:attr' redefined.
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 95a9b142ec..d2072e0e56 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -170,6 +170,10 @@ private slots:
void scaled_QTBUG35972();
+ void convertToPixelFormat();
+ void convertToImageFormat_data();
+ void convertToImageFormat();
+
void cleanupFunctions();
};
@@ -2460,6 +2464,46 @@ void tst_QImage::scaled_QTBUG35972()
QCOMPARE(pixels[i], 0xffffffff);
}
+void tst_QImage::convertToPixelFormat()
+{
+ QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha, QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied, QPixelFormat::UnsignedShort);
+ QPixelFormat rgb565ImageFormat = QImage::toPixelFormat(QImage::Format_RGB16);
+ QCOMPARE(rgb565, rgb565ImageFormat);
+}
+
+void tst_QImage::convertToImageFormat_data()
+{
+ QTest::addColumn<QImage::Format>("image_format");
+ QTest::newRow("Convert Format_Invalid") << QImage::Format_Invalid;
+ QTest::newRow("Convert Format_Mono") << QImage::Format_Mono;
+ //This ends up being a QImage::Format_Mono since we cant specify LSB in QPixelFormat
+ //QTest::newRow("Convert Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Convert Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Convert Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Convert Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Convert Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Convert Format_RGB16") << QImage::Format_RGB16;
+ QTest::newRow("Convert Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("Convert Format_RGB666") << QImage::Format_RGB666;
+ QTest::newRow("Convert Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied;
+ QTest::newRow("Convert Format_RGB555") << QImage::Format_RGB555;
+ QTest::newRow("Convert Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
+ QTest::newRow("Convert Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Convert Format_RGB444") << QImage::Format_RGB444;
+ QTest::newRow("Convert Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied;
+ QTest::newRow("Convert Format_RGBX8888") << QImage::Format_RGBX8888;
+ QTest::newRow("Convert Format_RGBA8888") << QImage::Format_RGBA8888;
+ QTest::newRow("Convert Format_RGBA8888_Premultiplied") << QImage::Format_RGBA8888_Premultiplied;
+}
+void tst_QImage::convertToImageFormat()
+{
+ QFETCH(QImage::Format, image_format);
+
+ QPixelFormat pixel_format = QImage::toPixelFormat(image_format);
+ QImage::Format format = QImage::toImageFormat(pixel_format);
+ QCOMPARE(format, image_format);
+}
+
static void cleanupFunction(void* info)
{
bool *called = static_cast<bool*>(info);
diff --git a/tests/auto/gui/image/qpicture/tst_qpicture.cpp b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
index 2e766c5bf5..986431941f 100644
--- a/tests/auto/gui/image/qpicture/tst_qpicture.cpp
+++ b/tests/auto/gui/image/qpicture/tst_qpicture.cpp
@@ -45,6 +45,7 @@
#include <qpicture.h>
#include <qpainter.h>
#include <qimage.h>
+#include <qpaintengine.h>
#ifndef QT_NO_WIDGETS
#include <qdesktopwidget.h>
#include <qapplication.h>
@@ -64,7 +65,7 @@ private slots:
void paintingActive();
void boundingRect();
void swap();
- void operator_lt_lt();
+ void serialization();
#ifndef QT_NO_WIDGETS
void save_restore();
@@ -169,36 +170,94 @@ void tst_QPicture::swap()
QCOMPARE(p2.boundingRect(), QRect(0,0,5,5));
}
-// operator<< and operator>>
-void tst_QPicture::operator_lt_lt()
+Q_DECLARE_METATYPE(QDataStream::Version)
+Q_DECLARE_METATYPE(QPicture)
+
+void ensureSerializesCorrectly(const QPicture &picture, QDataStream::Version version)
+ {
+ QDataStream stream;
+
+ QBuffer buffer;
+ buffer.open(QIODevice::WriteOnly);
+ stream.setDevice(&buffer);
+ stream.setVersion(version);
+ stream << picture;
+ buffer.close();
+
+ buffer.open(QIODevice::ReadOnly);
+ QPicture readpicture;
+ stream >> readpicture;
+ QVERIFY2(memcmp(picture.data(), readpicture.data(), picture.size()) == 0,
+ qPrintable(QString::fromLatin1("Picture data does not compare equal for QDataStream version %1").arg(version)));
+}
+
+class PaintEngine : public QPaintEngine
{
- // streaming of null pictures
- {
- QPicture pic1, pic2;
- QByteArray ba( 100, 0 );
- QDataStream str1( &ba, QIODevice::WriteOnly );
- str1 << pic1;
- QDataStream str2( &ba, QIODevice::ReadOnly );
- str2 >> pic2;
- QVERIFY( pic2.isNull() );
+public:
+ PaintEngine() : QPaintEngine() {}
+ bool begin(QPaintDevice *) { return true; }
+ bool end() { return true; }
+ void updateState(const QPaintEngineState &) {}
+ void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) {}
+ Type type() const { return Raster; }
+
+ QFont font() { return state->font(); }
+};
+
+class Picture : public QPicture
+{
+public:
+ Picture() : QPicture() {}
+ QPaintEngine *paintEngine() const { return (QPaintEngine*)&mPaintEngine; }
+private:
+ PaintEngine mPaintEngine;
+};
+
+void tst_QPicture::serialization()
+{
+ QDataStream stream;
+ const int thisVersion = stream.version();
+
+ for (int version = QDataStream::Qt_1_0; version <= thisVersion; ++version) {
+ const QDataStream::Version versionEnum = static_cast<QDataStream::Version>(version);
+
+ {
+ // streaming of null pictures
+ ensureSerializesCorrectly(QPicture(), versionEnum);
+ }
+ {
+ // picture with a simple line, checking bitwise equality
+ QPicture picture;
+ QPainter painter(&picture);
+ painter.drawLine(10, 20, 30, 40);
+ ensureSerializesCorrectly(picture, versionEnum);
+ }
}
- // picture with a simple line, checking bitwise equality
{
- QPicture pic1, pic2;
- QPainter p( &pic1 );
- p.drawLine( 10, 20, 30, 40 );
- p.end();
- QByteArray ba( 10 * pic1.size(), 0 );
- QDataStream str1( &ba, QIODevice::WriteOnly );
- str1 << pic1;
- QDataStream str2( &ba, QIODevice::ReadOnly );
- str2 >> pic2;
- QCOMPARE( pic1.size(), pic2.size() );
- QVERIFY( memcmp( pic1.data(), pic2.data(), pic1.size() ) == 0 );
+ // Test features that were added after Qt 4.5, as that was hard-coded as the major
+ // version for a while, which was incorrect. In this case, we'll test font hints.
+ QPicture picture;
+ QPainter painter;
+ QFont font;
+ font.setStyleName("Blah");
+ font.setHintingPreference(QFont::PreferFullHinting);
+ painter.begin(&picture);
+ painter.setFont(font);
+ painter.drawText(20, 20, "Hello");
+ painter.end();
+
+ Picture customPicture;
+ painter.begin(&customPicture);
+ picture.play(&painter);
+ const QFont actualFont = ((PaintEngine*)customPicture.paintEngine())->font();
+ painter.end();
+ QCOMPARE(actualFont.styleName(), QStringLiteral("Blah"));
+ QCOMPARE(actualFont.hintingPreference(), QFont::PreferFullHinting);
}
}
+
#ifndef QT_NO_WIDGETS
static QPointF scalePoint(const QPointF &point, QPaintDevice *sourceDevice, QPaintDevice *destDevice)
{
diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro
index e4d9ce9d27..bbcdd91ea3 100644
--- a/tests/auto/gui/kernel/kernel.pro
+++ b/tests/auto/gui/kernel/kernel.pro
@@ -20,6 +20,7 @@ SUBDIRS=\
qtouchevent \
qwindow \
qguiapplication \
+ qpixelformat \
!qtHaveModule(widgets): SUBDIRS -= \
qmouseevent_modal \
diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
index cf786c1dca..8a2009a601 100644
--- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -134,6 +134,29 @@ void tst_QClipboard::modes()
}
}
+// A predicate to be used with a QSignalSpy / QTRY_VERIFY to ensure all delayed
+// notifications are eaten. It waits at least one cycle and returns true when
+// no new signals arrive.
+class EatSignalSpyNotificationsPredicate
+{
+public:
+ explicit EatSignalSpyNotificationsPredicate(QSignalSpy &spy) : m_spy(spy) { reset(); }
+
+ operator bool() const
+ {
+ if (m_timer.elapsed() && !m_spy.count())
+ return true;
+ m_spy.clear();
+ return false;
+ }
+
+ inline void reset() { m_timer.start(); }
+
+private:
+ QSignalSpy &m_spy;
+ QElapsedTimer m_timer;
+};
+
/*
Test that the appropriate signals are emitted when the clipboard
contents is changed by calling the qt functions.
@@ -149,6 +172,13 @@ void tst_QClipboard::testSignals()
QSignalSpy changedSpy(clipboard, SIGNAL(changed(QClipboard::Mode)));
QSignalSpy dataChangedSpy(clipboard, SIGNAL(dataChanged()));
+ // Clipboard notifications are asynchronous with the new AddClipboardFormatListener
+ // in Windows Vista (5.4). Eat away all signals to ensure they don't interfere
+ // with the QTRY_COMPARE below.
+ EatSignalSpyNotificationsPredicate noLeftOverDataChanges(dataChangedSpy);
+ EatSignalSpyNotificationsPredicate noLeftOverChanges(changedSpy);
+ QTRY_VERIFY(noLeftOverChanges && noLeftOverDataChanges);
+
QSignalSpy searchChangedSpy(clipboard, SIGNAL(findBufferChanged()));
QSignalSpy selectionChangedSpy(clipboard, SIGNAL(selectionChanged()));
@@ -156,7 +186,7 @@ void tst_QClipboard::testSignals()
// Test the default mode signal.
clipboard->setText(text);
- QCOMPARE(dataChangedSpy.count(), 1);
+ QTRY_COMPARE(dataChangedSpy.count(), 1);
QCOMPARE(searchChangedSpy.count(), 0);
QCOMPARE(selectionChangedSpy.count(), 0);
QCOMPARE(changedSpy.count(), 1);
@@ -296,6 +326,11 @@ void tst_QClipboard::setMimeData()
QSignalSpy spySelection(QGuiApplication::clipboard(), SIGNAL(selectionChanged()));
QSignalSpy spyData(QGuiApplication::clipboard(), SIGNAL(dataChanged()));
+ // Clipboard notifications are asynchronous with the new AddClipboardFormatListener
+ // in Windows Vista (5.4). Eat away all signals to ensure they don't interfere
+ // with the QTRY_COMPARE below.
+ EatSignalSpyNotificationsPredicate noLeftOverDataChanges(spyData);
+ QTRY_VERIFY(noLeftOverDataChanges);
QSignalSpy spyFindBuffer(QGuiApplication::clipboard(), SIGNAL(findBufferChanged()));
QGuiApplication::clipboard()->clear(QClipboard::Clipboard);
@@ -312,7 +347,7 @@ void tst_QClipboard::setMimeData()
else
QCOMPARE(spyFindBuffer.count(), 0);
- QCOMPARE(spyData.count(), 1);
+ QTRY_COMPARE(spyData.count(), 1);
// an other crash test
data = new QMimeData;
@@ -326,7 +361,8 @@ void tst_QClipboard::setMimeData()
newData->setText("bar");
spySelection.clear();
- spyData.clear();
+ noLeftOverDataChanges.reset();
+ QTRY_VERIFY(noLeftOverDataChanges);
spyFindBuffer.clear();
QGuiApplication::clipboard()->setMimeData(newData, QClipboard::Clipboard);
@@ -343,7 +379,7 @@ void tst_QClipboard::setMimeData()
else
QCOMPARE(spyFindBuffer.count(), 0);
- QCOMPARE(spyData.count(), 1);
+ QTRY_COMPARE(spyData.count(), 1);
}
void tst_QClipboard::clearBeforeSetText()
diff --git a/tests/auto/gui/kernel/qguiapplication/icons/appicon.png b/tests/auto/gui/kernel/qguiapplication/icons/appicon.png
new file mode 100644
index 0000000000..b5d3ecbddf
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/icons/appicon.png
Binary files differ
diff --git a/tests/auto/gui/kernel/qguiapplication/icons/usericon.png b/tests/auto/gui/kernel/qguiapplication/icons/usericon.png
new file mode 100644
index 0000000000..8d703640c1
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/icons/usericon.png
Binary files differ
diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
index cd363bab31..895c2a0307 100644
--- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
+++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro
@@ -7,3 +7,5 @@ INCLUDEPATH += $$CORE_TEST_PATH
TARGET = tst_qguiapplication
QT += gui-private
SOURCES += tst_qguiapplication.cpp
+
+RESOURCES = tst_qguiapplication.qrc
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
index e551d99959..e1cdb8db45 100644
--- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp
@@ -65,6 +65,7 @@ class tst_QGuiApplication: public tst_QCoreApplication
private slots:
void displayName();
void firstWindowTitle();
+ void windowIcon();
void focusObject();
void allWindows();
void topLevelWindows();
@@ -99,6 +100,24 @@ void tst_QGuiApplication::firstWindowTitle()
QCOMPARE(window.title(), QString("User Title"));
}
+void tst_QGuiApplication::windowIcon()
+{
+ int argc = 3;
+ char *argv[] = { const_cast<char*>("tst_qguiapplication"), const_cast<char*>("-qwindowicon"), const_cast<char*>(":/icons/usericon.png") };
+ QGuiApplication app(argc, argv);
+ QIcon appIcon(":/icons/appicon.png");
+ app.setWindowIcon(appIcon);
+
+ QWindow window;
+ window.show();
+
+ QIcon userIcon(":/icons/usericon.png");
+ // Comparing icons is hard. cacheKey() differs because the icon was independently loaded.
+ // So we use availableSizes, after making sure that the app and user icons do have different sizes.
+ QVERIFY(userIcon.availableSizes() != appIcon.availableSizes());
+ QCOMPARE(window.icon().availableSizes(), userIcon.availableSizes());
+}
+
class DummyWindow : public QWindow
{
public:
diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc
new file mode 100644
index 0000000000..b26fba37b9
--- /dev/null
+++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>icons/usericon.png</file>
+ <file>icons/appicon.png</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro b/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro
new file mode 100644
index 0000000000..970e5c7c2d
--- /dev/null
+++ b/tests/auto/gui/kernel/qpixelformat/qpixelformat.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+TARGET = tst_qpixelformat
+
+QT += gui testlib
+
+SOURCES += tst_qpixelformat.cpp
diff --git a/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp
new file mode 100644
index 0000000000..c3b19a3b44
--- /dev/null
+++ b/tests/auto/gui/kernel/qpixelformat/tst_qpixelformat.cpp
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+
+#include <QtGui/qpixelformat.h>
+
+class tst_QPixelFormat : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testOperators();
+ void testQVectorOfFormats();
+ void testRGB();
+ void testCMYK();
+ void testHSLandHSV();
+ void testYUV_data();
+ void testYUV();
+ void testEnums();
+};
+
+void tst_QPixelFormat::testOperators()
+{
+ QPixelFormat first = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
+ QPixelFormat second = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
+ QVERIFY(first == second);
+
+ QPixelFormat third = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied);
+ QVERIFY(first != third);
+}
+
+void tst_QPixelFormat::testQVectorOfFormats()
+{
+ QVector<QPixelFormat> reallocedVector;
+ QVector<QPixelFormat> reservedVector;
+ reservedVector.reserve(QImage::NImageFormats);
+ for (int i = 0; i < QImage::NImageFormats; i++) {
+ if (i == 0 || i == 2) // skip invalid and monolsb
+ continue;
+ QImage::Format image_format = static_cast<QImage::Format>(i);
+ QPixelFormat format = QImage::toPixelFormat(image_format);
+ reallocedVector.append(format);
+ reservedVector.append(format);
+ }
+
+ for (int i = 0; i < reallocedVector.size(); i++) {
+ QCOMPARE(reallocedVector.at(i), reservedVector.at(i));
+ }
+}
+
+void tst_QPixelFormat::testRGB()
+{
+ QPixelFormat argb8888 = QPixelFormatRgb(8,8,8,8,QPixelFormat::UsesAlpha,QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
+ QCOMPARE(argb8888.redSize(), uchar(8));
+ QCOMPARE(argb8888.greenSize(), uchar(8));
+ QCOMPARE(argb8888.blueSize(), uchar(8));
+ QCOMPARE(argb8888.alphaSize(), uchar(8));
+
+ QPixelFormat rgb565 = QPixelFormatRgb(5,6,5,0,QPixelFormat::IgnoresAlpha,QPixelFormat::AtBeginning, QPixelFormat::NotPremultiplied);
+ QCOMPARE(rgb565.redSize(), uchar(5));
+ QCOMPARE(rgb565.greenSize(), uchar(6));
+ QCOMPARE(rgb565.blueSize(), uchar(5));
+ QCOMPARE(rgb565.alphaSize(), uchar(0));
+ QCOMPARE(rgb565.bitsPerPixel(), uchar(16));
+
+ QPixelFormat rgba1235 = QPixelFormatRgb(1,2,3,5,QPixelFormat::IgnoresAlpha, QPixelFormat::AtEnd, QPixelFormat::Premultiplied);
+ QCOMPARE(rgba1235.redSize(), uchar(1));
+ QCOMPARE(rgba1235.greenSize(), uchar(2));
+ QCOMPARE(rgba1235.blueSize(), uchar(3));
+ QCOMPARE(rgba1235.alphaSize(), uchar(5));
+ QCOMPARE(rgba1235.bitsPerPixel(), uchar(1 + 2 + 3 + 5));
+}
+
+void tst_QPixelFormat::testCMYK()
+{
+ QPixelFormat cmyk6 = QPixelFormatCmyk(6);
+ QCOMPARE(cmyk6.cyanSize(), uchar(6));
+ QCOMPARE(cmyk6.magentaSize(), uchar(6));
+ QCOMPARE(cmyk6.yellowSize(), uchar(6));
+ QCOMPARE(cmyk6.blackSize(), uchar(6));
+ QCOMPARE(cmyk6.bitsPerPixel(), uchar(6*4));
+
+ QPixelFormat cmykWithAlpha = QPixelFormatCmyk(8,8);
+ QCOMPARE(cmykWithAlpha.bitsPerPixel(), uchar(8*5));
+}
+void tst_QPixelFormat::testHSLandHSV()
+{
+ QPixelFormat hsl = QPixelFormatHsl(3,5);
+
+ QCOMPARE(hsl.hueSize(), uchar(3));
+ QCOMPARE(hsl.saturationSize(), uchar(3));
+ QCOMPARE(hsl.lightnessSize(), uchar(3));
+ QCOMPARE(hsl.bitsPerPixel(), uchar(3 * 3 + 5));
+
+ QPixelFormat hsv = QPixelFormatHsv(5,7);
+
+ QCOMPARE(hsv.hueSize(), uchar(5));
+ QCOMPARE(hsv.saturationSize(), uchar(5));
+ QCOMPARE(hsv.brightnessSize(), uchar(5));
+ QCOMPARE(hsv.bitsPerPixel(), uchar(5 * 3 + 7));
+}
+
+Q_DECLARE_METATYPE(QPixelFormat::YUVLayout)
+void tst_QPixelFormat::testYUV_data()
+{
+ QTest::addColumn<QPixelFormat::YUVLayout>("yuv_layout");
+ QTest::newRow("YUV Layout YUV444") << QPixelFormat::YUV444;
+ QTest::newRow("YUV Layout YUV422") << QPixelFormat::YUV422;
+ QTest::newRow("YUV Layout YUV411") << QPixelFormat::YUV411;
+ QTest::newRow("YUV Layout YUV420P") << QPixelFormat::YUV420P;
+ QTest::newRow("YUV Layout YUV420SP") << QPixelFormat::YUV420SP;
+ QTest::newRow("YUV Layout YV12") << QPixelFormat::YV12;
+ QTest::newRow("YUV Layout UYVY") << QPixelFormat::UYVY;
+ QTest::newRow("YUV Layout YUYV") << QPixelFormat::YUYV;
+ QTest::newRow("YUV Layout NV12") << QPixelFormat::NV12;
+ QTest::newRow("YUV Layout NV21") << QPixelFormat::NV21;
+ QTest::newRow("YUV Layout IMC1") << QPixelFormat::IMC1;
+ QTest::newRow("YUV Layout IMC2") << QPixelFormat::IMC2;
+ QTest::newRow("YUV Layout IMC3") << QPixelFormat::IMC3;
+ QTest::newRow("YUV Layout IMC4") << QPixelFormat::IMC4;
+ QTest::newRow("YUV Layout Y8") << QPixelFormat::Y8;
+ QTest::newRow("YUV Layout Y16") << QPixelFormat::Y16;
+}
+
+void tst_QPixelFormat::testYUV()
+{
+ QFETCH(QPixelFormat::YUVLayout, yuv_layout);
+
+ QPixelFormat format = QPixelFormatYuv(yuv_layout, 0);
+
+ switch (yuv_layout) {
+ case QPixelFormat::YUV444:
+ QCOMPARE(format.bitsPerPixel(), uchar(24));
+ break;
+ case QPixelFormat::YUV422:
+ QCOMPARE(format.bitsPerPixel(), uchar(16));
+ break;
+ case QPixelFormat::YUV411:
+ case QPixelFormat::YUV420P:
+ case QPixelFormat::YUV420SP:
+ case QPixelFormat::YV12:
+ QCOMPARE(format.bitsPerPixel(), uchar(12));
+ break;
+ case QPixelFormat::UYVY:
+ case QPixelFormat::YUYV:
+ QCOMPARE(format.bitsPerPixel(), uchar(16));
+ break;
+ case QPixelFormat::NV12:
+ case QPixelFormat::NV21:
+ QCOMPARE(format.bitsPerPixel(), uchar(12));
+ break;
+ case QPixelFormat::IMC1:
+ case QPixelFormat::IMC2:
+ case QPixelFormat::IMC3:
+ case QPixelFormat::IMC4:
+ QCOMPARE(format.bitsPerPixel(), uchar(12));
+ break;
+ case QPixelFormat::Y8:
+ QCOMPARE(format.bitsPerPixel(), uchar(8));
+ break;
+ case QPixelFormat::Y16:
+ QCOMPARE(format.bitsPerPixel(), uchar(16));
+ break;
+ default:
+ QVERIFY(!"the value stored for the yuvLayout is wrong!");
+ }
+
+}
+
+void tst_QPixelFormat::testEnums()
+{
+ QPixelFormat allSet = QPixelFormat(QPixelFormat::BGR,1,2,3,4,5,6,
+ QPixelFormat::UsesAlpha,
+ QPixelFormat::AtEnd,
+ QPixelFormat::Premultiplied,
+ QPixelFormat::FloatingPoint,
+ QPixelFormat::BigEndian,
+ (1 << 6) - 1);
+
+ QCOMPARE(allSet.alphaUsage(), QPixelFormat::UsesAlpha);
+ QCOMPARE(allSet.alphaPosition(), QPixelFormat::AtEnd);
+ QCOMPARE(allSet.premultiplied(), QPixelFormat::Premultiplied);
+ QCOMPARE(allSet.byteOrder(), QPixelFormat::BigEndian);
+ QCOMPARE(allSet.typeInterpretation(), QPixelFormat::FloatingPoint);
+ QCOMPARE(allSet.byteOrder(), QPixelFormat::BigEndian);
+ QCOMPARE(allSet.subEnum(), uchar(63));
+
+ QPixelFormat nonSet = QPixelFormat(QPixelFormat::RGB,6,5,4,3,2,1,
+ QPixelFormat::IgnoresAlpha,
+ QPixelFormat::AtBeginning,
+ QPixelFormat::NotPremultiplied,
+ QPixelFormat::UnsignedInteger,
+ QPixelFormat::LittleEndian);
+
+ QCOMPARE(nonSet.alphaUsage(), QPixelFormat::IgnoresAlpha);
+ QCOMPARE(nonSet.alphaPosition(), QPixelFormat::AtBeginning);
+ QCOMPARE(nonSet.premultiplied(), QPixelFormat::NotPremultiplied);
+ QCOMPARE(nonSet.byteOrder(), QPixelFormat::LittleEndian);
+ QCOMPARE(nonSet.typeInterpretation(), QPixelFormat::UnsignedInteger);
+ QCOMPARE(nonSet.byteOrder(), QPixelFormat::LittleEndian);
+ QCOMPARE(nonSet.subEnum(), uchar(0));
+}
+
+#include <tst_qpixelformat.moc>
+QTEST_MAIN(tst_QPixelFormat);
diff --git a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
index 98f1c1c8f9..e492a8f7bf 100644
--- a/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/gui/math3d/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -147,6 +147,7 @@ private slots:
void ortho();
void frustum();
void perspective();
+ void viewport();
void flipCoordinates();
void convertGeneric();
@@ -2794,6 +2795,40 @@ void tst_QMatrixNxN::perspective()
QVERIFY(m5.isIdentity());
}
+// Test viewport transformations
+void tst_QMatrixNxN::viewport()
+{
+ // Uses default depth range of 0->1
+ QMatrix4x4 m1;
+ m1.viewport(0.0f, 0.0f, 1024.0f, 768.0f);
+
+ // Lower left
+ QVector4D p1 = m1 * QVector4D(-1.0f, -1.0f, 0.0f, 1.0f);
+ QVERIFY(qFuzzyIsNull(p1.x()));
+ QVERIFY(qFuzzyIsNull(p1.y()));
+ QVERIFY(qFuzzyCompare(p1.z(), 0.5f));
+
+ // Lower right
+ QVector4D p2 = m1 * QVector4D(1.0f, -1.0f, 0.0f, 1.0f);
+ QVERIFY(qFuzzyCompare(p2.x(), 1024.0f));
+ QVERIFY(qFuzzyIsNull(p2.y()));
+
+ // Upper right
+ QVector4D p3 = m1 * QVector4D(1.0f, 1.0f, 0.0f, 1.0f);
+ QVERIFY(qFuzzyCompare(p3.x(), 1024.0f));
+ QVERIFY(qFuzzyCompare(p3.y(), 768.0f));
+
+ // Upper left
+ QVector4D p4 = m1 * QVector4D(-1.0f, 1.0f, 0.0f, 1.0f);
+ QVERIFY(qFuzzyIsNull(p4.x()));
+ QVERIFY(qFuzzyCompare(p4.y(), 768.0f));
+
+ // Center
+ QVector4D p5 = m1 * QVector4D(0.0f, 0.0f, 0.0f, 1.0f);
+ QVERIFY(qFuzzyCompare(p5.x(), 1024.0f / 2.0f));
+ QVERIFY(qFuzzyCompare(p5.y(), 768.0f / 2.0f));
+}
+
// Test left-handed vs right-handed coordinate flipping.
void tst_QMatrixNxN::flipCoordinates()
{
diff --git a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
index 1b1f5575b1..2e1d55ced4 100644
--- a/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
+++ b/tests/auto/gui/painting/qcolor/tst_qcolor.cpp
@@ -530,10 +530,19 @@ static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
void tst_QColor::setNamedColor()
{
for (int i = 0; i < rgbTblSize; ++i) {
- QColor color;
- color.setNamedColor(QLatin1String(rgbTbl[i].name));
QColor expected;
expected.setRgba(rgbTbl[i].value);
+
+ QColor color;
+ color.setNamedColor(QLatin1String(rgbTbl[i].name));
+ QCOMPARE(color, expected);
+
+ // name should be case insensitive
+ color.setNamedColor(QString(rgbTbl[i].name).toUpper());
+ QCOMPARE(color, expected);
+
+ // spaces should be ignored
+ color.setNamedColor(QString(rgbTbl[i].name).insert(1, ' '));
QCOMPARE(color, expected);
}
}
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index e4340451ce..4604f840da 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -282,6 +282,8 @@ private slots:
void QTBUG17053_zeroDashPattern();
+ void QTBUG38781_NoBrushAndQBitmap();
+
void drawTextOutsideGuiThread();
void drawTextWithComplexBrush();
@@ -4473,6 +4475,26 @@ void tst_QPainter::QTBUG17053_zeroDashPattern()
QCOMPARE(image, original);
}
+void tst_QPainter::QTBUG38781_NoBrushAndQBitmap()
+{
+ QBitmap bitmap(10, 10);
+ bitmap.fill(Qt::color0);
+ QPainter p(&bitmap);
+ p.setPen(Qt::color1);
+ p.drawLine(0, 1, 9, 1); // at horizontal line at y=1
+ p.setBrush(Qt::NoBrush);
+ p.drawRect(0, 0, 9, 9); // a rect all around
+
+ QRgb white = qRgb(0xff, 0xff, 0xff);
+ QRgb black = qRgb(0, 0, 0);
+ QImage image = bitmap.toImage();
+ QCOMPARE(image.pixel(0, 0), black);
+ QCOMPARE(image.pixel(5, 5), white);
+
+ // Check that the rect didn't overwrite the line
+ QCOMPARE(image.pixel(5, 1), black);
+}
+
class TextDrawerThread : public QThread
{
public:
diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp
index 07c996d026..a373c51710 100644
--- a/tests/auto/gui/painting/qpen/tst_qpen.cpp
+++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp
@@ -57,6 +57,8 @@ public:
private slots:
void getSetCheck();
void swap();
+ void move();
+ void move_assign();
void operator_eq_eq();
void operator_eq_eq_data();
@@ -101,6 +103,57 @@ void tst_QPen::swap()
QCOMPARE(p2.color(), QColor(Qt::black));
}
+void tst_QPen::move()
+{
+ QPen p1(Qt::black);
+
+ // check that moving does the right thing:
+ QPen p2 = qMove(p1); // could be move or copy construction, so don't check p1's state
+ QCOMPARE(p2.color(), QColor(Qt::black));
+
+ // this, executed ehre, would crash:
+ // QVERIFY(p1.style() != Qt::NoPen);
+
+ // check that moved-from QPen p1 can still be safely copied:
+ const QPen p3 = p1;
+
+ // check that moved-from QPen p1 can still be safely assigned to:
+ const QPen p4(Qt::yellow);
+ p1 = p4;
+ QCOMPARE(p1.color(), QColor(Qt::yellow));
+
+ // check that moved-from QPens p2, p3 can still be safely destroyed:
+ QPen p5 = qMove(p2);
+
+ // intentionally no more statements beyond this point
+}
+
+void tst_QPen::move_assign()
+{
+ QPen p1(Qt::black), p2(Qt::white);
+
+ // check that moving does the right thing:
+ p2 = qMove(p1); // could be move or copy assignment, so don't check p1's state
+ QCOMPARE(p2.color(), QColor(Qt::black));
+
+ // check that move-assigned-from QPen p1 can still be used, albeit
+ // with undocumented state (it's p2's original state):
+ QVERIFY(p1.style() != Qt::NoPen);
+
+ // check that moved-from QPen p1 can still be safely copied:
+ const QPen p3 = p1;
+
+ // check that moved-from QPen p1 can still be safely assigned to:
+ const QPen p4(Qt::yellow);
+ p1 = p4;
+ QCOMPARE(p1.color(), QColor(Qt::yellow));
+
+ // check that moved-from QPens p2, p3 can still be safely destroyed:
+ QPen p5;
+ p5 = qMove(p2);
+
+ // intentionally no more statements beyond this point
+}
tst_QPen::tst_QPen()
diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro
index 12429bbeed..fcf457fec4 100644
--- a/tests/auto/gui/qopengl/qopengl.pro
+++ b/tests/auto/gui/qopengl/qopengl.pro
@@ -10,3 +10,5 @@ QT += gui-private core-private testlib
SOURCES += tst_qopengl.cpp
win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-31611
+
+linux:contains(QT_CONFIG, xcb-glx):contains(QT_CONFIG, xcb-xlib): DEFINES += USE_GLX
diff --git a/tests/auto/gui/qopengl/tst_qopengl.cpp b/tests/auto/gui/qopengl/tst_qopengl.cpp
index 63fe8b9693..c32edd3f71 100644
--- a/tests/auto/gui/qopengl/tst_qopengl.cpp
+++ b/tests/auto/gui/qopengl/tst_qopengl.cpp
@@ -51,12 +51,19 @@
#include <QtGui/QGenericMatrix>
#include <QtGui/QMatrix4x4>
#include <QtGui/private/qopengltextureblitter_p.h>
-
+#include <QtGui/private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformnativeinterface.h>
#include <QtTest/QtTest>
#include <QSignalSpy>
+#ifdef USE_GLX
+// Must be included last due to the X11 types
+#include <QtPlatformHeaders/QGLXNativeContext>
+#endif
+
class tst_QOpenGL : public QObject
{
Q_OBJECT
@@ -85,6 +92,10 @@ private slots:
void textureblitterPartOriginTopLeftSourceRectTransform();
void textureblitterFullTargetRectTransform();
void textureblitterPartTargetRectTransform();
+
+#ifdef USE_GLX
+ void glxContextWrap();
+#endif
};
struct SharedResourceTracker
@@ -448,9 +459,9 @@ void tst_QOpenGL::fboSimpleRendering()
QVERIFY(fbo->bind());
- glClearColor(1.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glFinish();
+ ctx.functions()->glClearColor(1.0, 0.0, 0.0, 1.0);
+ ctx.functions()->glClear(GL_COLOR_BUFFER_BIT);
+ ctx.functions()->glFinish();
const QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
QCOMPARE(fb.size(), size);
@@ -494,9 +505,9 @@ void tst_QOpenGL::fboTextureOwnership()
fbo->bind();
QVERIFY(fbo->texture() != 0 && fbo->texture() != texture);
- glClearColor(1.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glFinish();
+ ctx.functions()->glClearColor(1.0, 0.0, 0.0, 1.0);
+ ctx.functions()->glClear(GL_COLOR_BUFFER_BIT);
+ ctx.functions()->glFinish();
QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
QImage reference(fb.size(), QImage::Format_RGB32);
@@ -504,7 +515,7 @@ void tst_QOpenGL::fboTextureOwnership()
QFUZZY_COMPARE_IMAGES(fb, reference);
- glDeleteTextures(1, &texture);
+ ctx.functions()->glDeleteTextures(1, &texture);
delete fbo;
}
@@ -970,6 +981,45 @@ void tst_QOpenGL::textureblitterPartTargetRectTransform()
QCOMPARE(targetBottomRight, expectedBottomRight);
}
+#ifdef USE_GLX
+void tst_QOpenGL::glxContextWrap()
+{
+ QWindow *window = new QWindow;
+ window->setSurfaceType(QWindow::OpenGLSurface);
+ window->setGeometry(0, 0, 10, 10);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ QPlatformNativeInterface *nativeIf = QGuiApplicationPrivate::instance()->platformIntegration()->nativeInterface();
+ QVERIFY(nativeIf);
+
+ // Fetch a GLXContext.
+ QOpenGLContext *ctx0 = new QOpenGLContext;
+ ctx0->setFormat(window->format());
+ QVERIFY(ctx0->create());
+ QVariant v = ctx0->nativeHandle();
+ QVERIFY(!v.isNull());
+ QVERIFY(v.canConvert<QGLXNativeContext>());
+ GLXContext context = v.value<QGLXNativeContext>().context();
+ QVERIFY(context);
+
+ // Then create another QOpenGLContext wrapping it.
+ QOpenGLContext *ctx = new QOpenGLContext;
+ ctx->setNativeHandle(QVariant::fromValue<QGLXNativeContext>(QGLXNativeContext(context)));
+ QVERIFY(ctx->create());
+ QVERIFY(ctx->nativeHandle().value<QGLXNativeContext>().context() == context);
+ QVERIFY(nativeIf->nativeResourceForContext(QByteArrayLiteral("glxcontext"), ctx) == (void *) context);
+
+ QVERIFY(ctx->makeCurrent(window));
+ ctx->doneCurrent();
+
+ delete ctx;
+ delete ctx0;
+
+ delete window;
+}
+#endif // USE_GLX
+
QTEST_MAIN(tst_QOpenGL)
#include "tst_qopengl.moc"
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 4c88212c72..6f75a1f8bb 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -76,7 +76,8 @@ private slots:
void isCopyOf();
void italicOblique();
void insertAndRemoveSubstitutions();
- void serializeSpacing();
+ void serialize_data();
+ void serialize();
void lastResortFont();
void styleName();
void defaultFamily_data();
@@ -534,7 +535,6 @@ void tst_QFont::insertAndRemoveSubstitutions()
QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty());
}
-
static QFont copyFont(const QFont &font1) // copy using a QDataStream
{
QBuffer buffer;
@@ -549,29 +549,115 @@ static QFont copyFont(const QFont &font1) // copy using a QDataStream
return font2;
}
-void tst_QFont::serializeSpacing()
+Q_DECLARE_METATYPE(QDataStream::Version)
+
+void tst_QFont::serialize_data()
{
- QFont font;
- QCOMPARE(font.letterSpacing(), 0.);
- QCOMPARE(font.wordSpacing(), 0.);
+ QTest::addColumn<QFont>("font");
+ // The version in which the tested feature was added.
+ QTest::addColumn<QDataStream::Version>("minimumStreamVersion");
+
+ QFont basicFont;
+ // Versions <= Qt 2.1 had broken point size serialization,
+ // so we set an integer point size.
+ basicFont.setPointSize(9);
+
+ QFont font = basicFont;
+ QTest::newRow("defaultConstructed") << font << QDataStream::Qt_1_0;
font.setLetterSpacing(QFont::AbsoluteSpacing, 105);
- QCOMPARE(font.letterSpacing(), 105.);
- QCOMPARE(font.letterSpacingType(), QFont::AbsoluteSpacing);
- QCOMPARE(font.wordSpacing(), 0.);
- QFont font2 = copyFont(font);
- QCOMPARE(font2.letterSpacing(), 105.);
- QCOMPARE(font2.letterSpacingType(), QFont::AbsoluteSpacing);
- QCOMPARE(font2.wordSpacing(), 0.);
+ QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5;
+ font = basicFont;
font.setWordSpacing(50.0);
- QCOMPARE(font.letterSpacing(), 105.);
- QCOMPARE(font.wordSpacing(), 50.);
+ QTest::newRow("wordSpacing") << font << QDataStream::Qt_4_5;
+
+ font = basicFont;
+ font.setPointSize(20);
+ QTest::newRow("pointSize") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setPixelSize(32);
+ QTest::newRow("pixelSize") << font << QDataStream::Qt_3_0;
+
+ font = basicFont;
+ font.setStyleHint(QFont::Monospace);
+ QTest::newRow("styleHint") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setStretch(4000);
+ QTest::newRow("stretch") << font << QDataStream::Qt_4_3;
+
+ font = basicFont;
+ font.setWeight(99);
+ QTest::newRow("weight") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setUnderline(true);
+ QTest::newRow("underline") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setStrikeOut(true);
+ QTest::newRow("strikeOut") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setFixedPitch(true);
+ // This fails for versions less than this, as ignorePitch is set to false
+ // whenever setFixedPitch() is called, but ignorePitch is considered an
+ // extended bit, which were apparently not available until 4.4.
+ QTest::newRow("fixedPitch") << font << QDataStream::Qt_4_4;
+
+ font = basicFont;
+ font.setLetterSpacing(QFont::AbsoluteSpacing, 10);
+ // Fails for 4.4 because letterSpacing wasn't read until 4.5.
+ QTest::newRow("letterSpacing") << font << QDataStream::Qt_4_5;
+
+ font = basicFont;
+ font.setRawMode(true);
+ QTest::newRow("rawMode") << font << QDataStream::Qt_1_0;
+
+ font = basicFont;
+ font.setKerning(false);
+ QTest::newRow("kerning") << font << QDataStream::Qt_4_0;
+
+ font = basicFont;
+ font.setStyleStrategy(QFont::NoFontMerging);
+ // This wasn't read properly until 5.4.
+ QTest::newRow("styleStrategy") << font << QDataStream::Qt_5_4;
+
+ font = basicFont;
+ font.setHintingPreference(QFont::PreferFullHinting);
+ // This wasn't read until 5.4.
+ QTest::newRow("hintingPreference") << font << QDataStream::Qt_5_4;
+
+ font = basicFont;
+ font.setStyleName("Regular Black Condensed");
+ // This wasn't read until 5.4.
+ QTest::newRow("styleName") << font << QDataStream::Qt_5_4;
+}
- QFont font3 = copyFont(font);
- QCOMPARE(font3.letterSpacing(), 105.);
- QCOMPARE(font3.letterSpacingType(), QFont::AbsoluteSpacing);
- QCOMPARE(font3.wordSpacing(), 50.);
+void tst_QFont::serialize()
+{
+ QFETCH(QFont, font);
+ QFETCH(QDataStream::Version, minimumStreamVersion);
+
+ QDataStream stream;
+ const int thisVersion = stream.version();
+
+ for (int version = minimumStreamVersion; version <= thisVersion; ++version) {
+ QBuffer buffer;
+ buffer.open(QIODevice::WriteOnly);
+ stream.setDevice(&buffer);
+ stream.setVersion(version);
+ stream << font;
+ buffer.close();
+
+ buffer.open(QIODevice::ReadOnly);
+ QFont readFont;
+ stream >> readFont;
+ QVERIFY2(readFont == font, qPrintable(QString::fromLatin1("Fonts do not compare equal for QDataStream version ") +
+ QString::fromLatin1("%1:\nactual: %2\nexpected: %3").arg(version).arg(readFont.toString()).arg(font.toString())));
+ }
}
// QFont::lastResortFont() may abort with qFatal() on QWS/QPA
diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
index a39277b093..a4e1490b01 100644
--- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp
@@ -314,16 +314,24 @@ void tst_QRawFont::advances()
bool supportsSubPixelPositions = font_d->fontEngine->supportsSubPixelPositions();
QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndices);
- for (int i=0; i<glyphIndices.size(); ++i) {
-#ifdef Q_OS_WIN
- // In Windows, freetype engine returns advance of 9 when full hinting is used (default) for
- // some of the glyphs.
- if (font_d->fontEngine->type() == QFontEngine::Freetype
- && (hintingPreference == QFont::PreferFullHinting || hintingPreference == QFont::PreferDefaultHinting)
- && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "Advance for some glyphs is not the expected with Windows Freetype engine (9 instead of 8)", Continue);
- }
+
+ // On Windows and QNX, freetype engine returns advance of 9 for some of the glyphs
+ // when full hinting is used (default on Windows).
+ bool mayFail = false;
+#if defined (Q_OS_WIN)
+ mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
+ && (hintingPreference == QFont::PreferFullHinting
+ || hintingPreference == QFont::PreferDefaultHinting);
+#elif defined(Q_OS_QNX)
+ mayFail = font_d->fontEngine->type() == QFontEngine::Freetype
+ && hintingPreference == QFont::PreferFullHinting;
#endif
+
+ for (int i = 0; i < glyphIndices.size(); ++i) {
+ if (mayFail && (i == 0 || i == 5)) {
+ QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
+ "for some glyphs (9 instead of 8)", Continue);
+ }
QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
@@ -341,16 +349,11 @@ void tst_QRawFont::advances()
QVERIFY(font.advancesForGlyphIndexes(glyphIndices.constData(), advances.data(), numGlyphs));
- for (int i=0; i<glyphIndices.size(); ++i) {
-#ifdef Q_OS_WIN
- // In Windows, freetype engine returns advance of 9 when full hinting is used (default) for
- // some of the glyphs.
- if (font_d->fontEngine->type() == QFontEngine::Freetype
- && (hintingPreference == QFont::PreferFullHinting || hintingPreference == QFont::PreferDefaultHinting)
- && (i == 0 || i == 5)) {
- QEXPECT_FAIL("", "Advance for some glyphs is not the expected with Windows Freetype engine (9 instead of 8)", Continue);
+ for (int i = 0; i < glyphIndices.size(); ++i) {
+ if (mayFail && (i == 0 || i == 5)) {
+ QEXPECT_FAIL("", "FreeType engine reports unexpected advance "
+ "for some glyphs (9 instead of 8)", Continue);
}
-#endif
QVERIFY(qFuzzyCompare(qRound(advances.at(i).x()), 8.0));
if (supportsSubPixelPositions)
QVERIFY(advances.at(i).x() > 8.0);
diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/README b/tests/auto/network/ssl/qsslcertificate/pkcs12/README
new file mode 100644
index 0000000000..1828d089c1
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/README
@@ -0,0 +1,8 @@
+The PKCS#12 bundle was created by running the following on
+in the qsslsocket/certs directory:
+
+openssl pkcs12 -export -in leaf.crt -inkey leaf.key \
+ -out leaf.p12 \
+ -certfile inter.crt -CAfile ca.crt
+
+No password was provided.
diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/inter.crt b/tests/auto/network/ssl/qsslcertificate/pkcs12/inter.crt
new file mode 100644
index 0000000000..4e1d67c3e0
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/inter.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDvDCCAnSgAwIBAgIQO+uZxerYC10Ll11PBnVL4TANBgkqhkiG9w0BAQUFADA8
+MQswCQYDVQQGEwJHQjEZMBcGA1UEChMQV2VzdHBvaW50IENBIEtleTESMBAGA1UE
+ChMJV2VzdHBvaW50MB4XDTEzMDIxNjE2NTMwOFoXDTIzMDIxNjE2NTMwOFowMjEL
+MAkGA1UEBhMCR0IxIzAhBgNVBAoTGldlc3Rwb2ludCBJbnRlcm1lZGlhdGUgS2V5
+MIIBUjANBgkqhkiG9w0BAQEFAAOCAT8AMIIBOgKCATEAsR4tRskg2IFfQFMfGBJ1
+eqlrNejANw0oM6k5HlEB8uFA9qeyAzmflwQUPoJ55KRQ/gVHTOBdWrtgGgPMiekF
+1Q36Ry1elwbAl4a+LZ6qsc9ASipvk8HirKpt1v5L9hG+aI4yDxyvjNztFtg5R4P5
+zqsh/WwhCgsYmEVfcSDbhUjqoqxGRLaZxPKO+IMCNFrjZqi0yxc8f6Un4G5SQzHA
+4szi/ezcITnAFYWxHG2yaed4hawpxNS1WXabk2rzCi0pWeIcHuIczaCfZ7ElRcqV
+VNNXbGTtUDlfIsh6FAVI5kTUDcPV27uf6BmHuFOu/R9Tjni25+vBFvohwQh7ZwCX
+5COXnfkJLPkJQQEFVQv8nS27ht/vmyoKjERUeiuMd+hFcN5zl7bS5A2JCgi7erlP
+ZQIDAQABo2QwYjAPBgNVHRMBAf8EBTADAQH/MA8GA1UdDwEB/wQFAwMHBgAwHQYD
+VR0OBBYEFGn5shQ0SeTcc3x/cNu6TkoV0bPmMB8GA1UdIwQYMBaAFJQnOLW5hBTG
+pvc2vfcs4sJpRRPJMA0GCSqGSIb3DQEBBQUAA4IBMQAVDS0enQQ1FL0d92xOFfwx
+mjcNPz9oO7jMyEVxAs2eR2QD+xZ3Xj4gAiUEp40aGieDcLv+dg+cmuBFWF61IYSR
+UyuoakVm08VDcLAwUzU+xtSvJiSSROb0GsAnVsYZj4TYlvKDplqfapOYaiIkwF+c
+iE4n7G0hQW9fzqO+n3FGtBD8YUjghRqLggeRVJ2+8S3Bm8cfx8xPpRIO3ksA6opn
+CORRGuzetDHihbks59mkoY3GqKFgBOyrC3kG07nv5wtKjdKDtmD/kS/SAc4fIXKy
+Uruq2uXNf/1BUgF5gFGRyj22yB2D0763fJJpl5nqcLrL5RmnVObQKZGhE2VsRTV0
+untj+AmiJivhiAjjkHfw3XDf8tuL7D4pTmEkGgl5xl23fyeTIuygDCLT8fRD3ZqQ
+-----END CERTIFICATE-----
diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.crt b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.crt
new file mode 100644
index 0000000000..4a7dc40540
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.crt
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIID3zCCApegAwIBAgIQEKCtd1j2bq5Gk6ND+VmKnjANBgkqhkiG9w0BAQUFADAy
+MQswCQYDVQQGEwJHQjEjMCEGA1UEChMaV2VzdHBvaW50IEludGVybWVkaWF0ZSBL
+ZXkwHhcNMTMwMjE2MTY1MzA4WhcNMjMwMjE2MTY1MzA4WjA1MQswCQYDVQQGEwJH
+QjESMBAGA1UEChMJV2VzdHBvaW50MRIwEAYDVQQDEwkxMjcuMC4wLjEwggFSMA0G
+CSqGSIb3DQEBAQUAA4IBPwAwggE6AoIBMQC7EIWIzb7XCfmQQ1KFdZ5E9f49eNK/
+KvsXYfq/iV29K1cz2hUyvfdKgyU5F/+BOPQKQ5zdWn1CraZosFv/ibuO3mhRpMfB
+SfNn3rfdrE7WtA0wgT2YNIN0L4aCe+C15j2ESdmyMaFLUaUIS47JS66UtaYxp5ia
+mJFO1hSNaoI0pGHyPFTTtfOza9z/01qkBbHB4htzauqs/fX5ZrnyCDSrfpVipXke
+zkPKg4MkkytEkjRKw6tSXLpWIgF3ee2N/jBdefqlw8YPW08K0wmwF5qGuX6PZ8vB
+sOZeWeCfVr136BopkbfP3TkGWw2BrD8xSzOUez9HVc0v4SZ/7pe5w3L4V/mzYQLt
+O+1AHevCjX8+M58HYGBaWCAjxYUPGcGKcj0LLtgZgL6wY88N7RtfeOY3AgMBAAGj
+gY0wgYowFAYDVR0RBA0wC4IJMTI3LjAuMC4xMAwGA1UdEwEB/wQCMAAwEwYDVR0l
+BAwwCgYIKwYBBQUHAwEwDwYDVR0PAQH/BAUDAwcoADAdBgNVHQ4EFgQUKKuyJSrT
+Y+dnm1do7l0sVMX96SYwHwYDVR0jBBgwFoAUafmyFDRJ5NxzfH9w27pOShXRs+Yw
+DQYJKoZIhvcNAQEFBQADggExAHELijlIFdcncP3B+vxEp0SGKl0arIaCXahivb2F
+VxeM3WajN6O+oDRLFltzMeDKA9RVkao7fgITzXQgCGzeNhKv0vc9iDyvR9/67vuS
+W8xEEJrYowtw3VK5H1y0ewqZaxJhvKUjm4TBRWe8FGKD3s64lEsfbjOaI5VPidVc
+DXmdAlXsj0Hk+v4Ej8mshPQAnVSyJ3D0ZMgTjk8Di28N0qROFIYJaTObK1rCb1nQ
+GaCcmbZU6JnkYvVZ+iUe5U0GXFbb+LRNTUT8/fw1zADeHnv/G+WWVrfND+sov5Oc
+33fkNE6z+n6ayABVnGLuCYhbzD38sv0dnxeh8vbykNBPzYdzPg6nw3Czv2vlhKpJ
+8Yj/maoXuAyTXVf30K1/fAWyU45noq57MjQpU6UxIX1D7qw=
+-----END CERTIFICATE-----
diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.key b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.key
new file mode 100644
index 0000000000..54327925d8
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.key
@@ -0,0 +1,32 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIFfAIBAAKCATEAuxCFiM2+1wn5kENShXWeRPX+PXjSvyr7F2H6v4ldvStXM9oV
+Mr33SoMlORf/gTj0CkOc3Vp9Qq2maLBb/4m7jt5oUaTHwUnzZ9633axO1rQNMIE9
+mDSDdC+GgnvgteY9hEnZsjGhS1GlCEuOyUuulLWmMaeYmpiRTtYUjWqCNKRh8jxU
+07Xzs2vc/9NapAWxweIbc2rqrP31+Wa58gg0q36VYqV5Hs5DyoODJJMrRJI0SsOr
+Uly6ViIBd3ntjf4wXXn6pcPGD1tPCtMJsBeahrl+j2fLwbDmXlngn1a9d+gaKZG3
+z905BlsNgaw/MUszlHs/R1XNL+Emf+6XucNy+Ff5s2EC7TvtQB3rwo1/PjOfB2Bg
+WlggI8WFDxnBinI9Cy7YGYC+sGPPDe0bX3jmNwIDAQABAoIBMQCczBNyAStGqjjC
+oHuKHHWmTh9mPWFBFfDTv6/jXmvxRWPZtaHxH2Qp09Wejqv/D9MWy2ev7spx2oZS
+2Ai1ICjTbz83uAwryyW4Wen6aBTJSLCJiLstWk8ZU0DHHLjVH4FO4mwUPh95t5zC
+YDr2JXbXdY8xrc5vPxUFZNJjWvR61ZK37bQYpTn5mZ7r3KfsNk2yOylRTDwa9XFo
+ZZ+B82NKdrrz0UvGOnXZa5qd1ap7V+67FIAS2Mt8AMzSCG8TW0JXRUk89ISgAd8r
+NQTPtX9XCnMZSbBzDKdznXfHS9ZlJcSrpsbQCPcvMVNrdBfCF0eNnsRJffJGdaXI
+MsN6PvbcXWD08lXNGyeLjon03RdJnTAamNM3YQEIcjFmu5Y0o0CCJkZSCJPKJGMG
+0d/1tN/5AoGZANOcOgQZ9Wiu0ej3YoQ3aSHu3y8ZBJH4B3ViX8i+2x/6UnG7KNaa
+4Ygid1upnX6hk4CW5WZcoxGFacrFRpInKh5Ng8lEIHGp0VSzOBVDR0L5sAxutFuX
+6N9C0CuH80vD101mOloNnfT5KHZMI5RXqP6sDGUFlwak2XybDL1qOAza3gZAy25H
+vS/ll1BneBavikR5j+zxoTztAoGZAOJOJ5RyOrqpNuhiWZylah5LIFT9N1lCF4Hl
+ZbFIjUZ4jcApJ7JxkMXNQ4RU/3AiKCC1xr5ib7dd/qyjKXhdMo4SnLoKhapx5R9G
+3XOsQMahiCD/Zcymv9tmk8MxxzbLxhZYhEPzIP/NFkua3CHiX+d1e6fkzFLF/EiX
+ZGQOgRcFKrlzUeBputRQRXAkKJH+kMClgAWvy28zAoGYKyaMXhG9DV+4xjzMBhIW
+iijfsgbz+6AMRU+OIK1qmZa+ARsdNMXYf54noLVxvETOg0ZB+SGizwvZitO3lE4Q
+NKWx3fTaeNMcMJ1rLkrN2UZ5M8/PT24muoAxWu8aGbURzmKuO3bTYwT7z0OvbayC
+dYw36tG8/knXX6Vub6GdVGG9LKFB2nceiQnUVT0EK/wXwebYBoUvT/ECgZgF9qdG
+Wyg/CPyAbS8NWLKOL86fTrjpqjsyWhgu7smCROT/XlZEdoepHrqbvx2oF85U5lVh
+aPimrVxrsjUCjfoqEkV9BY/2KOAvzc9CIBTo5xLOQ8yr8uz1XCOiriogwIfsyNJb
+dAm3k/D1dxQ79FowoEDs8LONrtfyFcM4e8VdFO7GSkqrDj41IBRkWx+SkVHBMdtI
+yxQiTwKBmQCWym2iDCJg1ZZq4/lVwRudMhVmHoD0yoCAwADYHjjAi8QBplM0vfdd
+CESKsnBhlcrPGB279BKVJyZHehKZG+/dfnFs+to14l6A3IqU2d6+pu3EyFNX34HS
+xo+64QxMeF0akWnSaIPfUJfk36phjCvLBr4eLXN1i4jW3RdGFwF1THXt29VSSGmU
+q/hM51H0bsQ13AIVUSdNHA==
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.p12 b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.p12
new file mode 100644
index 0000000000..cb89aadb73
--- /dev/null
+++ b/tests/auto/network/ssl/qsslcertificate/pkcs12/leaf.p12
Binary files differ
diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
index 09cb22defe..69cd241f84 100644
--- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
+++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
@@ -6,5 +6,6 @@ SOURCES += tst_qsslcertificate.cpp
QT = core network testlib
TARGET = tst_qsslcertificate
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
-TESTDATA += certificates/* more-certificates/* verify-certs/*
+TESTDATA += certificates/* more-certificates/* verify-certs/* pkcs12/*
diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
index 4f62076870..83462568f5 100644
--- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
@@ -105,6 +105,7 @@ private slots:
void largeSerialNumber();
void largeExpirationDate();
void blacklistedCertificates();
+ void selfsignedCertificates();
void toText();
void multipleCommonNames();
void subjectAndIssuerAttributes();
@@ -113,6 +114,7 @@ private slots:
void threadSafeConstMethods();
void version_data();
void version();
+ void pkcs12();
// helper for verbose test failure messages
QString toString(const QList<QSslError>&);
@@ -890,6 +892,13 @@ void tst_QSslCertificate::blacklistedCertificates()
}
}
+void tst_QSslCertificate::selfsignedCertificates()
+{
+ QVERIFY(QSslCertificate::fromPath(testDataDir + "/certificates/cert-ss.pem").first().isSelfSigned());
+ QVERIFY(!QSslCertificate::fromPath(testDataDir + "/certificates/cert.pem").first().isSelfSigned());
+ QVERIFY(!QSslCertificate().isSelfSigned());
+}
+
void tst_QSslCertificate::toText()
{
QList<QSslCertificate> certList =
@@ -1221,6 +1230,48 @@ void tst_QSslCertificate::version()
QCOMPARE(certificate.version(), result);
}
+void tst_QSslCertificate::pkcs12()
+{
+ if (!QSslSocket::supportsSsl()) {
+ qWarning("SSL not supported, skipping test");
+ return;
+ }
+
+ QFile f(QLatin1String(SRCDIR "pkcs12/leaf.p12"));
+ bool ok = f.open(QIODevice::ReadOnly);
+ QVERIFY(ok);
+
+ QSslKey key;
+ QSslCertificate cert;
+ QList<QSslCertificate> caCerts;
+
+ ok = QSslCertificate::importPKCS12(&f, &key, &cert, &caCerts);
+ QVERIFY(ok);
+ f.close();
+
+ QList<QSslCertificate> leafCert = QSslCertificate::fromPath(QLatin1String( SRCDIR "pkcs12/leaf.crt"));
+ QVERIFY(!leafCert.isEmpty());
+
+ QCOMPARE(cert, leafCert.first());
+
+ QFile f2(QLatin1String(SRCDIR "pkcs12/leaf.key"));
+ ok = f2.open(QIODevice::ReadOnly);
+ QVERIFY(ok);
+
+ QSslKey leafKey(&f2, QSsl::Rsa);
+ f2.close();
+
+ QVERIFY(!leafKey.isNull());
+ QCOMPARE(key, leafKey);
+
+ QList<QSslCertificate> caCert = QSslCertificate::fromPath(QLatin1String(SRCDIR "pkcs12/inter.crt"));
+ QVERIFY(!caCert.isEmpty());
+
+ QVERIFY(!caCerts.isEmpty());
+ QCOMPARE(caCerts.first(), caCert.first());
+ QCOMPARE(caCerts, caCert);
+}
+
#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslCertificate)
diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp
index ba2528d3cf..71243339aa 100644
--- a/tests/auto/opengl/qgl/tst_qgl.cpp
+++ b/tests/auto/opengl/qgl/tst_qgl.cpp
@@ -1090,9 +1090,10 @@ void tst_QGL::glFBOSimpleRendering()
fbo->bind();
- glClearColor(1.0, 0.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glFinish();
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glClearColor(1.0, 0.0, 0.0, 1.0);
+ funcs->glClear(GL_COLOR_BUFFER_BIT);
+ funcs->glFinish();
QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
QImage reference(fb.size(), QImage::Format_RGB32);
@@ -1390,11 +1391,11 @@ class RenderPixmapWidget : public QGLWidget
protected:
void initializeGL() {
// Set some gl state:
- glClearColor(1.0, 0.0, 0.0, 1.0);
+ QOpenGLContext::currentContext()->functions()->glClearColor(1.0, 0.0, 0.0, 1.0);
}
void paintGL() {
- glClear(GL_COLOR_BUFFER_BIT);
+ QOpenGLContext::currentContext()->functions()->glClear(GL_COLOR_BUFFER_BIT);
}
};
@@ -1683,11 +1684,12 @@ protected:
void paintEvent(QPaintEvent*)
{
// clear the stencil with junk
- glStencilMask(0xFFFF);
- glClearStencil(0xFFFF);
- glDisable(GL_STENCIL_TEST);
- glDisable(GL_SCISSOR_TEST);
- glClear(GL_STENCIL_BUFFER_BIT);
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+ funcs->glStencilMask(0xFFFF);
+ funcs->glClearStencil(0xFFFF);
+ funcs->glDisable(GL_STENCIL_TEST);
+ funcs->glDisable(GL_SCISSOR_TEST);
+ funcs->glClear(GL_STENCIL_BUFFER_BIT);
QPainter painter(this);
paint(&painter);
@@ -2029,26 +2031,27 @@ void tst_QGL::qglContextDefaultBindTexture()
QVERIFY(QImagePixmapCleanupHooks::isImageCached(*boundImage));
QVERIFY(QImagePixmapCleanupHooks::isPixmapCached(*boundPixmap));
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
// Make sure the texture IDs returned are valid:
- QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE);
- QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE);
+ QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE);
+ QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE);
// Make sure the textures are still valid after we delete the image/pixmap:
// Also check that although the textures are left intact, the cache entries are removed:
delete boundImage;
boundImage = 0;
- QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_TRUE);
+ QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_TRUE);
QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount+1);
delete boundPixmap;
boundPixmap = 0;
- QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_TRUE);
+ QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_TRUE);
QCOMPARE(QGLTextureCache::instance()->size(), startCacheItemCount);
// Finally, make sure QGLContext::deleteTexture deletes the texture IDs:
ctx->deleteTexture(boundImageTextureId);
ctx->deleteTexture(boundPixmapTextureId);
- QCOMPARE((bool)glIsTexture(boundImageTextureId), GL_FALSE);
- QCOMPARE((bool)glIsTexture(boundPixmapTextureId), GL_FALSE);
+ QCOMPARE((bool)funcs->glIsTexture(boundImageTextureId), GL_FALSE);
+ QCOMPARE((bool)funcs->glIsTexture(boundPixmapTextureId), GL_FALSE);
}
#endif
diff --git a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
index 2f09d84772..a465afef21 100644
--- a/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
+++ b/tests/auto/opengl/qglfunctions/tst_qglfunctions.cpp
@@ -62,7 +62,7 @@ bool tst_QGLFunctions::hasExtension(const char *name)
{
QString extensions =
QString::fromLatin1
- (reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
+ (reinterpret_cast<const char *>(QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS)));
return extensions.split(QLatin1Char(' ')).contains
(QString::fromLatin1(name));
}
@@ -194,46 +194,46 @@ void tst_QGLFunctions::features()
// Verify that the multitexture functions appear to resolve and work.
void tst_QGLFunctions::multitexture()
{
- QGLFunctions funcs;
+ QOpenGLFunctions funcs;
QGLWidget glw;
if (!glw.isValid())
QSKIP("Could not create a GL context");
glw.makeCurrent();
- funcs.initializeGLFunctions();
+ funcs.initializeOpenGLFunctions();
- if (!funcs.hasOpenGLFeature(QGLFunctions::Multitexture))
+ if (!funcs.hasOpenGLFeature(QOpenGLFunctions::Multitexture))
QSKIP("Multitexture functions are not supported");
funcs.glActiveTexture(GL_TEXTURE1);
GLint active = 0;
- glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+ funcs.glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
QVERIFY(active == GL_TEXTURE1);
funcs.glActiveTexture(GL_TEXTURE0);
active = 0;
- glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
+ funcs.glGetIntegerv(GL_ACTIVE_TEXTURE, &active);
QVERIFY(active == GL_TEXTURE0);
}
// Verify that the glBlendColor() function appears to resolve and work.
void tst_QGLFunctions::blendColor()
{
- QGLFunctions funcs;
+ QOpenGLFunctions funcs;
QGLWidget glw;
if (!glw.isValid())
QSKIP("Could not create a GL context");
glw.makeCurrent();
- funcs.initializeGLFunctions();
+ funcs.initializeOpenGLFunctions();
- if (!funcs.hasOpenGLFeature(QGLFunctions::BlendColor))
+ if (!funcs.hasOpenGLFeature(QOpenGLFunctions::BlendColor))
QSKIP("glBlendColor() is not supported");
funcs.glBlendColor(0.0f, 1.0f, 0.0f, 1.0f);
GLfloat colors[4] = {0.5f, 0.5f, 0.5f, 0.5f};
- glGetFloatv(GL_BLEND_COLOR, colors);
+ funcs.glGetFloatv(GL_BLEND_COLOR, colors);
QCOMPARE(colors[0], 0.0f);
QCOMPARE(colors[1], 1.0f);
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
index 70e3a3b62a..25057ba2a0 100644
--- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
+++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp
@@ -48,6 +48,10 @@
#include <QtOpenGL/QtOpenGL>
#include "tst_qglthreads.h"
+#ifndef QT_OPENGL_ES_2
+#include <QtGui/QOpenGLFunctions_1_0>
+#endif
+
#define RUNNING_TIME 5000
tst_QGLThreads::tst_QGLThreads(QObject *parent)
@@ -339,8 +343,9 @@ static inline float qrandom() { return (rand() % 100) / 100.f; }
void renderAScene(int w, int h)
{
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
+
if (QOpenGLContext::currentContext()->isOpenGLES()) {
- QGLFunctions funcs(QGLContext::currentContext());
Q_UNUSED(w);
Q_UNUSED(h);
QGLShaderProgram program;
@@ -349,7 +354,7 @@ void renderAScene(int w, int h)
program.bindAttributeLocation("pos", 0);
program.bind();
- funcs.glEnableVertexAttribArray(0);
+ funcs->glEnableVertexAttribArray(0);
for (int i=0; i<1000; ++i) {
GLfloat pos[] = {
@@ -361,30 +366,33 @@ void renderAScene(int w, int h)
(rand() % 100) / 100.f
};
- funcs.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos);
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
+ funcs->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos);
+ funcs->glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
}
} else {
#ifndef QT_OPENGL_ES_2
- glViewport(0, 0, w, h);
+ QOpenGLFunctions_1_0 *gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
+ gl1funcs->initializeOpenGLFunctions();
+
+ gl1funcs->glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(0, w, h, 0, 1, 100);
- glTranslated(0, 0, -1);
+ gl1funcs->glMatrixMode(GL_PROJECTION);
+ gl1funcs->glLoadIdentity();
+ gl1funcs->glFrustum(0, w, h, 0, 1, 100);
+ gl1funcs->glTranslated(0, 0, -1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ gl1funcs->glMatrixMode(GL_MODELVIEW);
+ gl1funcs->glLoadIdentity();
for (int i=0;i<1000; ++i) {
- glBegin(GL_TRIANGLES);
- glColor3f(qrandom(), qrandom(), qrandom());
- glVertex2f(qrandom() * w, qrandom() * h);
- glColor3f(qrandom(), qrandom(), qrandom());
- glVertex2f(qrandom() * w, qrandom() * h);
- glColor3f(qrandom(), qrandom(), qrandom());
- glVertex2f(qrandom() * w, qrandom() * h);
- glEnd();
+ gl1funcs->glBegin(GL_TRIANGLES);
+ gl1funcs->glColor3f(qrandom(), qrandom(), qrandom());
+ gl1funcs->glVertex2f(qrandom() * w, qrandom() * h);
+ gl1funcs->glColor3f(qrandom(), qrandom(), qrandom());
+ gl1funcs->glVertex2f(qrandom() * w, qrandom() * h);
+ gl1funcs->glColor3f(qrandom(), qrandom(), qrandom());
+ gl1funcs->glVertex2f(qrandom() * w, qrandom() * h);
+ gl1funcs->glEnd();
}
#endif
}
@@ -434,8 +442,9 @@ public:
QSize s = m_widget->newSize;
m_widget->mutex.unlock();
+ QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
if (s != m_size) {
- glViewport(0, 0, s.width(), s.height());
+ funcs->glViewport(0, 0, s.width(), s.height());
}
if (QGLContext::currentContext() != m_widget->context()) {
@@ -443,7 +452,7 @@ public:
break;
}
- glClear(GL_COLOR_BUFFER_BIT);
+ funcs->glClear(GL_COLOR_BUFFER_BIT);
int w = m_widget->width();
int h = m_widget->height();
@@ -451,7 +460,7 @@ public:
renderAScene(w, h);
int color;
- glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color);
+ funcs->glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color);
m_widget->swapBuffers();
}
diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps
index e7d47448ea..b3d8475411 100644
--- a/tests/auto/other/lancelot/scripts/text.qps
+++ b/tests/auto/other/lancelot/scripts/text.qps
@@ -11,7 +11,7 @@ save
setFont "sansserif" 12 normal
drawText 0 40 "sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawText 0 60 "sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
@@ -27,7 +27,7 @@ save
setFont "sansserif" 12 normal
drawText 0 40 "alpha sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawText 0 60 "alpha sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
@@ -45,7 +45,7 @@ save
setFont "sansserif" 12 normal
drawText 0 40 "scaled sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawText 0 60 "scaled sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
@@ -63,7 +63,7 @@ save
setFont "sansserif" 12 normal
drawStaticText 0 40 "flipped sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawStaticText 0 60 "flipped sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
@@ -82,7 +82,7 @@ save
setFont "sansserif" 12 normal
drawText 0 40 "scaled sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawText 0 60 "scaled sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
@@ -102,7 +102,7 @@ save
setFont "sansserif" 12 normal
drawText 0 20 "gradient sansserif 12pt, normal"
- setFont "sansserif" 10 bold
+ setFont "sansserif" 12 bold
drawText 0 40 "gradient sansserif 12pt, bold"
setFont "sansserif" 10 bold italic
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index e6017168d0..0ae94fe415 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -2,7 +2,6 @@ TEMPLATE=subdirs
SUBDIRS=\
# atwrapper \ # QTBUG-19452
baselineexample \
- collections \
compiler \
d3dcompiler \
gestures \
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 8b033efa4a..d6b193a288 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -1191,8 +1191,11 @@ void tst_QAccessibility::tabTest()
QVERIFY(leftButton->state().invisible);
const int lots = 5;
- for (int i = 0; i < lots; ++i)
+ for (int i = 0; i < lots; ++i) {
tabBar->addTab("Foo");
+ tabBar->setTabToolTip(i, QLatin1String("Cool tool tip"));
+ tabBar->setTabWhatsThis(i, QLatin1String("I don't know"));
+ }
QAccessibleInterface *child1 = interface->child(0);
QAccessibleInterface *child2 = interface->child(1);
@@ -1201,6 +1204,10 @@ void tst_QAccessibility::tabTest()
QVERIFY(child2);
QCOMPARE(child2->role(), QAccessible::PageTab);
+ QCOMPARE(child1->text(QAccessible::Name), QLatin1String("Foo"));
+ QCOMPARE(child1->text(QAccessible::Description), QLatin1String("Cool tool tip"));
+ QCOMPARE(child1->text(QAccessible::Help), QLatin1String("I don't know"));
+
QVERIFY((child1->state().invisible) == false);
tabBar->hide();
@@ -1652,6 +1659,11 @@ void tst_QAccessibility::textEditTest()
QTest::qWaitForWindowShown(&edit);
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit);
QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText());
+ QVERIFY(iface->state().focusable);
+ QVERIFY(!iface->state().selectable);
+ QVERIFY(!iface->state().selected);
+ QVERIFY(iface->state().selectableText);
+
QAccessibleTextInterface *textIface = iface->textInterface();
QVERIFY(textIface);
@@ -1929,7 +1941,8 @@ void tst_QAccessibility::lineEditTest()
QVERIFY(iface->state().sizeable);
QVERIFY(iface->state().movable);
QVERIFY(iface->state().focusable);
- QVERIFY(iface->state().selectable);
+ QVERIFY(!iface->state().selectable);
+ QVERIFY(iface->state().selectableText);
QVERIFY(!iface->state().hasPopup);
QCOMPARE(bool(iface->state().focused), le->hasFocus());
@@ -1957,7 +1970,9 @@ void tst_QAccessibility::lineEditTest()
QVERIFY(!(iface->state().sizeable));
QVERIFY(!(iface->state().movable));
QVERIFY(iface->state().focusable);
- QVERIFY(iface->state().selectable);
+ QVERIFY(!iface->state().selectable);
+ QVERIFY(!iface->state().selected);
+ QVERIFY(iface->state().selectableText);
QVERIFY(!iface->state().hasPopup);
QCOMPARE(bool(iface->state().focused), le->hasFocus());
diff --git a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp
index 47d6789327..40e1070fcc 100644
--- a/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp
+++ b/tests/auto/testlib/qsignalspy/tst_qsignalspy.cpp
@@ -65,6 +65,19 @@ private slots:
void wait_signalEmittedLater();
void wait_signalEmittedTooLate();
void wait_signalEmittedMultipleTimes();
+
+ void spyFunctionPointerWithoutArgs();
+ void spyFunctionPointerWithBasicArgs();
+ void spyFunctionPointerWithPointers();
+ void spyFunctionPointerWithQtClasses();
+ void spyFunctionPointerWithBasicQtClasses();
+ void spyFunctionPointerWithQtTypedefs();
+
+ void waitFunctionPointer_signalEmitted();
+ void waitFunctionPointer_timeout();
+ void waitFunctionPointer_signalEmittedLater();
+ void waitFunctionPointer_signalEmittedTooLate();
+ void waitFunctionPointer_signalEmittedMultipleTimes();
};
class QtTestObject: public QObject
@@ -278,5 +291,160 @@ void tst_QSignalSpy::wait_signalEmittedMultipleTimes()
QCOMPARE(spy.count(), 3);
}
+void tst_QSignalSpy::spyFunctionPointerWithoutArgs()
+{
+ QtTestObject obj;
+
+ QSignalSpy spy(&obj, &QtTestObject::sig0);
+ QCOMPARE(spy.count(), 0);
+
+ emit obj.sig0();
+ QCOMPARE(spy.count(), 1);
+ emit obj.sig0();
+ QCOMPARE(spy.count(), 2);
+
+ QList<QVariant> args = spy.takeFirst();
+ QCOMPARE(args.count(), 0);
+}
+
+void tst_QSignalSpy::spyFunctionPointerWithBasicArgs()
+{
+ QtTestObject obj;
+ QSignalSpy spy(&obj, &QtTestObject::sig1);
+
+ emit obj.sig1(1, 2);
+ QCOMPARE(spy.count(), 1);
+
+ QList<QVariant> args = spy.takeFirst();
+ QCOMPARE(args.count(), 2);
+ QCOMPARE(args.at(0).toInt(), 1);
+ QCOMPARE(args.at(1).toInt(), 2);
+
+ QSignalSpy spyl(&obj, &QtTestObject::sigLong);
+
+ emit obj.sigLong(1l, 2l);
+ args = spyl.takeFirst();
+ QCOMPARE(args.count(), 2);
+ QCOMPARE(qvariant_cast<long>(args.at(0)), 1l);
+ QCOMPARE(qvariant_cast<long>(args.at(1)), 2l);
+}
+
+
+void tst_QSignalSpy::spyFunctionPointerWithPointers()
+{
+ qRegisterMetaType<int *>("int*");
+
+ QtTestObject obj;
+ QSignalSpy spy(&obj, &QtTestObject::sig2);
+
+ int i1 = 1;
+ int i2 = 2;
+
+ emit obj.sig2(&i1, &i2);
+ QCOMPARE(spy.count(), 1);
+
+ QList<QVariant> args = spy.takeFirst();
+ QCOMPARE(args.count(), 2);
+ QCOMPARE(*static_cast<int * const *>(args.at(0).constData()), &i1);
+ QCOMPARE(*static_cast<int * const *>(args.at(1).constData()), &i2);
+}
+
+void tst_QSignalSpy::spyFunctionPointerWithBasicQtClasses()
+{
+ QtTestObject2 obj;
+
+ QSignalSpy spy(&obj, &QtTestObject2::sig);
+ emit obj.sig(QString("bubu"));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).count(), 1);
+ QCOMPARE(spy.at(0).at(0).toString(), QString("bubu"));
+
+ QSignalSpy spy2(&obj, &QtTestObject2::sig5);
+ QVariant val(45);
+ emit obj.sig5(val);
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.at(0).count(), 1);
+ QCOMPARE(spy2.at(0).at(0), val);
+ QCOMPARE(qvariant_cast<QVariant>(spy2.at(0).at(0)), val);
+}
+
+void tst_QSignalSpy::spyFunctionPointerWithQtClasses()
+{
+ QtTestObject2 obj;
+
+ QSignalSpy spy(&obj, &QtTestObject2::sig2);
+ QDateTime dt = QDateTime::currentDateTime();
+ emit obj.sig2(dt);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).count(), 1);
+ QCOMPARE(spy.at(0).at(0).typeName(), "QDateTime");
+ QCOMPARE(*static_cast<const QDateTime *>(spy.at(0).at(0).constData()), dt);
+ QCOMPARE(spy.at(0).at(0).toDateTime(), dt);
+
+ QSignalSpy spy2(&obj, &QtTestObject2::sig3);
+ emit obj.sig3(this);
+ QCOMPARE(*static_cast<QObject * const *>(spy2.value(0).value(0).constData()),
+ (QObject *)this);
+ QCOMPARE(qvariant_cast<QObject *>(spy2.value(0).value(0)), (QObject*)this);
+
+ QSignalSpy spy3(&obj, &QtTestObject2::sig4);
+ emit obj.sig4(QChar('A'));
+ QCOMPARE(qvariant_cast<QChar>(spy3.value(0).value(0)), QChar('A'));
+}
+
+void tst_QSignalSpy::spyFunctionPointerWithQtTypedefs()
+{
+ QtTestObject3 obj;
+
+ QSignalSpy spy2(&obj, &QtTestObject3::sig2);
+ emit obj.sig2(42, 43);
+ QCOMPARE(spy2.value(0).value(0).toInt(), 42);
+ QCOMPARE(spy2.value(0).value(1).toInt(), 43);
+}
+
+void tst_QSignalSpy::waitFunctionPointer_signalEmitted()
+{
+ QTimer::singleShot(0, this, SIGNAL(sigFoo()));
+ QSignalSpy spy(this, &tst_QSignalSpy::sigFoo);
+ QVERIFY(spy.wait(1));
+}
+
+void tst_QSignalSpy::waitFunctionPointer_timeout()
+{
+ QSignalSpy spy(this, &tst_QSignalSpy::sigFoo);
+ QVERIFY(!spy.wait(1));
+}
+
+void tst_QSignalSpy::waitFunctionPointer_signalEmittedLater()
+{
+ QTimer::singleShot(500, this, SIGNAL(sigFoo()));
+ QSignalSpy spy(this, &tst_QSignalSpy::sigFoo);
+ QVERIFY(spy.wait(1000));
+}
+
+void tst_QSignalSpy::waitFunctionPointer_signalEmittedTooLate()
+{
+ QTimer::singleShot(500, this, SIGNAL(sigFoo()));
+ QSignalSpy spy(this, &tst_QSignalSpy::sigFoo);
+ QVERIFY(!spy.wait(200));
+ QTest::qWait(400);
+ QCOMPARE(spy.count(), 1);
+}
+
+void tst_QSignalSpy::waitFunctionPointer_signalEmittedMultipleTimes()
+{
+ QTimer::singleShot(100, this, SIGNAL(sigFoo()));
+ QTimer::singleShot(800, this, SIGNAL(sigFoo()));
+ QSignalSpy spy(this, &tst_QSignalSpy::sigFoo);
+ QVERIFY(spy.wait());
+ QCOMPARE(spy.count(), 1); // we don't wait for the second signal...
+ QVERIFY(spy.wait());
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(!spy.wait(1));
+ QTimer::singleShot(10, this, SIGNAL(sigFoo()));
+ QVERIFY(spy.wait());
+ QCOMPARE(spy.count(), 3);
+}
+
QTEST_MAIN(tst_QSignalSpy)
#include "tst_qsignalspy.moc"
diff --git a/tests/auto/testlib/selftests/expected_assert.lightxml b/tests/auto/testlib/selftests/expected_assert.lightxml
index d2d4ae5153..b40ff41da3 100644
--- a/tests/auto/testlib/selftests/expected_assert.lightxml
+++ b/tests/auto/testlib/selftests/expected_assert.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_assert.xml b/tests/auto/testlib/selftests/expected_assert.xml
index 9e5ea760ae..9770b3cd57 100644
--- a/tests/auto/testlib/selftests/expected_assert.xml
+++ b/tests/auto/testlib/selftests/expected_assert.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Assert">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_assert.xunitxml b/tests/auto/testlib/selftests/expected_assert.xunitxml
index 0aebe72745..96daa33dcf 100644
--- a/tests/auto/testlib/selftests/expected_assert.xunitxml
+++ b/tests/auto/testlib/selftests/expected_assert.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testNumber1"/>
diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml
index e4c79e3bb0..94f479a79a 100644
--- a/tests/auto/testlib/selftests/expected_badxml.lightxml
+++ b/tests/auto/testlib/selftests/expected_badxml.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml
index 0811db0f3a..c1266bfeed 100644
--- a/tests/auto/testlib/selftests/expected_badxml.xml
+++ b/tests/auto/testlib/selftests/expected_badxml.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_BadXml">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml
index a696da58c9..49048fdad6 100644
--- a/tests/auto/testlib/selftests/expected_badxml.xunitxml
+++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml
@@ -3,6 +3,7 @@
<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="badDataTag">
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml
index 08872be733..6fe511462c 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xml b/tests/auto/testlib/selftests/expected_benchlibcounting.xml
index ee6fd98ef2..d945511eec 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcounting.xml
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_BenchlibCounting">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml
index 83e429aa3a..05d1da9874 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="passingBenchmark">
diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml
index cba91a374f..0bc00569e9 100644
--- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml
+++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml
index 7d28975ead..f543e2775c 100644
--- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml
+++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_BenchlibEventCounter">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml
index 60dca28d4f..ce0a81110d 100644
--- a/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml
+++ b/tests/auto/testlib/selftests/expected_benchlibeventcounter.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="events">
diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml
index 97422240d9..11296ad9c2 100644
--- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml
+++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml
index 24c2e51084..3dd56b4af7 100644
--- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml
+++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_BenchlibTickCounter">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml
index 28c8f11143..779d3bdcbc 100644
--- a/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml
+++ b/tests/auto/testlib/selftests/expected_benchlibtickcounter.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="threeBillionTicks">
diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml
index b2e819b26d..c75a6c944d 100644
--- a/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml
+++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.xml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xml
index 6ae355783a..a2f0edecc6 100644
--- a/tests/auto/testlib/selftests/expected_benchlibwalltime.xml
+++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_BenchlibWalltime">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml b/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml
index e4ffca4d09..6a0510c4c9 100644
--- a/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml
+++ b/tests/auto/testlib/selftests/expected_benchlibwalltime.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="waitForOneThousand">
diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml
index 3a776ea7cb..4a376b5c8b 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.lightxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml
index 970544e4b6..aefb1b5f4c 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Cmptest">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
index 7874c6c52e..7502d3cc54 100644
--- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="compare_boolfuncs"/>
diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.lightxml b/tests/auto/testlib/selftests/expected_commandlinedata.lightxml
index c11017f022..894ae7ae23 100644
--- a/tests/auto/testlib/selftests/expected_commandlinedata.lightxml
+++ b/tests/auto/testlib/selftests/expected_commandlinedata.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.xml b/tests/auto/testlib/selftests/expected_commandlinedata.xml
index 20dc0c6a7c..b2aa98f6a7 100644
--- a/tests/auto/testlib/selftests/expected_commandlinedata.xml
+++ b/tests/auto/testlib/selftests/expected_commandlinedata.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_DataTable">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml b/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml
index 45b833cf19..5072a7e6f4 100644
--- a/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml
+++ b/tests/auto/testlib/selftests/expected_commandlinedata.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="fiveTablePasses">
diff --git a/tests/auto/testlib/selftests/expected_counting.lightxml b/tests/auto/testlib/selftests/expected_counting.lightxml
index e5fe1ee3cf..836c35fb85 100644
--- a/tests/auto/testlib/selftests/expected_counting.lightxml
+++ b/tests/auto/testlib/selftests/expected_counting.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_counting.xml b/tests/auto/testlib/selftests/expected_counting.xml
index e015dddcc6..892fd762c6 100644
--- a/tests/auto/testlib/selftests/expected_counting.xml
+++ b/tests/auto/testlib/selftests/expected_counting.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Counting">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_counting.xunitxml b/tests/auto/testlib/selftests/expected_counting.xunitxml
index 72bf047ba8..cb3a7815af 100644
--- a/tests/auto/testlib/selftests/expected_counting.xunitxml
+++ b/tests/auto/testlib/selftests/expected_counting.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testPassPass"/>
diff --git a/tests/auto/testlib/selftests/expected_datatable.lightxml b/tests/auto/testlib/selftests/expected_datatable.lightxml
index 6cc2d1c46f..c14a6a1940 100644
--- a/tests/auto/testlib/selftests/expected_datatable.lightxml
+++ b/tests/auto/testlib/selftests/expected_datatable.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_datatable.xml b/tests/auto/testlib/selftests/expected_datatable.xml
index 79963db0a4..297cb0d5de 100644
--- a/tests/auto/testlib/selftests/expected_datatable.xml
+++ b/tests/auto/testlib/selftests/expected_datatable.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_DataTable">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_datatable.xunitxml b/tests/auto/testlib/selftests/expected_datatable.xunitxml
index 6bac80e0a2..89fc7ee819 100644
--- a/tests/auto/testlib/selftests/expected_datatable.xunitxml
+++ b/tests/auto/testlib/selftests/expected_datatable.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="singleTestFunction1"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml
index 02c60d04f9..48ad0933f7 100644
--- a/tests/auto/testlib/selftests/expected_datetime.lightxml
+++ b/tests/auto/testlib/selftests/expected_datetime.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml
index 03aec4430e..30afde60ec 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xml
+++ b/tests/auto/testlib/selftests/expected_datetime.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_DateTime">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml
index 00bd43f904..901462b6bf 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xunitxml
+++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml
@@ -3,6 +3,7 @@
<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="dateTime">
diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml b/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml
index 6c9675a2aa..2b802aabaf 100644
--- a/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml
+++ b/tests/auto/testlib/selftests/expected_exceptionthrow.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
@@ -7,7 +8,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="throwException">
-<Incident type="fail" file="/home/frederik/dev/qt/qt&#x002D;src&#x002D;dev/qtbase/src/testlib/qtestcase.cpp" line="2229">
+<Incident type="fail" file="qtestcase.cpp" line="2235">
<Description><![CDATA[Caught unhandled exception]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.xml b/tests/auto/testlib/selftests/expected_exceptionthrow.xml
index 87d9d2d431..a265d5ba5f 100644
--- a/tests/auto/testlib/selftests/expected_exceptionthrow.xml
+++ b/tests/auto/testlib/selftests/expected_exceptionthrow.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Exception">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
@@ -9,7 +10,7 @@
<Duration msecs="0"/>
</TestFunction>
<TestFunction name="throwException">
-<Incident type="fail" file="/home/frederik/dev/qt/qt&#x002D;src&#x002D;dev/qtbase/src/testlib/qtestcase.cpp" line="2229">
+<Incident type="fail" file="qtestcase.cpp" line="2235">
<Description><![CDATA[Caught unhandled exception]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml b/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml
index ab0d379255..7d10bf6f04 100644
--- a/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml
+++ b/tests/auto/testlib/selftests/expected_exceptionthrow.xunitxml
@@ -3,6 +3,7 @@
<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="throwException">
diff --git a/tests/auto/testlib/selftests/expected_expectfail.lightxml b/tests/auto/testlib/selftests/expected_expectfail.lightxml
index e5fcca5875..cd5ab78fbe 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.lightxml
+++ b/tests/auto/testlib/selftests/expected_expectfail.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_expectfail.xml b/tests/auto/testlib/selftests/expected_expectfail.xml
index 14fee2129e..a98b97810c 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.xml
+++ b/tests/auto/testlib/selftests/expected_expectfail.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_ExpectFail">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_expectfail.xunitxml b/tests/auto/testlib/selftests/expected_expectfail.xunitxml
index 45c260c77f..47483d71bf 100644
--- a/tests/auto/testlib/selftests/expected_expectfail.xunitxml
+++ b/tests/auto/testlib/selftests/expected_expectfail.xunitxml
@@ -3,6 +3,7 @@
<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="xfail" name="xfailAndContinue">
diff --git a/tests/auto/testlib/selftests/expected_failcleanup.lightxml b/tests/auto/testlib/selftests/expected_failcleanup.lightxml
index cfc18ef5da..b2db64c4e2 100644
--- a/tests/auto/testlib/selftests/expected_failcleanup.lightxml
+++ b/tests/auto/testlib/selftests/expected_failcleanup.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failcleanup.xml b/tests/auto/testlib/selftests/expected_failcleanup.xml
index 3aa7aa265d..476e56c4f4 100644
--- a/tests/auto/testlib/selftests/expected_failcleanup.xml
+++ b/tests/auto/testlib/selftests/expected_failcleanup.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_FailCleanup">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failcleanup.xunitxml b/tests/auto/testlib/selftests/expected_failcleanup.xunitxml
index 6e35566be8..813e284ee0 100644
--- a/tests/auto/testlib/selftests/expected_failcleanup.xunitxml
+++ b/tests/auto/testlib/selftests/expected_failcleanup.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="aTestFunction"/>
diff --git a/tests/auto/testlib/selftests/expected_failinit.lightxml b/tests/auto/testlib/selftests/expected_failinit.lightxml
index c0d193998d..5a940fc36b 100644
--- a/tests/auto/testlib/selftests/expected_failinit.lightxml
+++ b/tests/auto/testlib/selftests/expected_failinit.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failinit.xml b/tests/auto/testlib/selftests/expected_failinit.xml
index 70ad613f3f..51e1a7fce4 100644
--- a/tests/auto/testlib/selftests/expected_failinit.xml
+++ b/tests/auto/testlib/selftests/expected_failinit.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_FailInit">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failinit.xunitxml b/tests/auto/testlib/selftests/expected_failinit.xunitxml
index 3c2e31be29..3715725ea5 100644
--- a/tests/auto/testlib/selftests/expected_failinit.xunitxml
+++ b/tests/auto/testlib/selftests/expected_failinit.xunitxml
@@ -3,6 +3,7 @@
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ <property value="" name="QtBuild"/>
</properties>
<testcase result="fail" name="initTestCase">
<failure message="&apos;false&apos; returned FALSE. ()" result="fail"/>
diff --git a/tests/auto/testlib/selftests/expected_failinitdata.lightxml b/tests/auto/testlib/selftests/expected_failinitdata.lightxml
index 285471470f..f9da42c060 100644
--- a/tests/auto/testlib/selftests/expected_failinitdata.lightxml
+++ b/tests/auto/testlib/selftests/expected_failinitdata.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failinitdata.xml b/tests/auto/testlib/selftests/expected_failinitdata.xml
index e86e102202..e843863bfc 100644
--- a/tests/auto/testlib/selftests/expected_failinitdata.xml
+++ b/tests/auto/testlib/selftests/expected_failinitdata.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_FailInitData">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_failinitdata.xunitxml b/tests/auto/testlib/selftests/expected_failinitdata.xunitxml
index f32ccd5e81..d245bc0dff 100644
--- a/tests/auto/testlib/selftests/expected_failinitdata.xunitxml
+++ b/tests/auto/testlib/selftests/expected_failinitdata.xunitxml
@@ -3,6 +3,7 @@
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ <property value="" name="QtBuild"/>
</properties>
<testcase result="fail" name="initTestCase">
<failure message="&apos;false&apos; returned FALSE. ()" result="fail"/>
diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.lightxml b/tests/auto/testlib/selftests/expected_fetchbogus.lightxml
index c5587cf031..c62a93eb49 100644
--- a/tests/auto/testlib/selftests/expected_fetchbogus.lightxml
+++ b/tests/auto/testlib/selftests/expected_fetchbogus.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.xml b/tests/auto/testlib/selftests/expected_fetchbogus.xml
index 40295bdebc..c20de137a2 100644
--- a/tests/auto/testlib/selftests/expected_fetchbogus.xml
+++ b/tests/auto/testlib/selftests/expected_fetchbogus.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_FetchBogus">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml b/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml
index fe31b4b600..77ccbd896a 100644
--- a/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml
+++ b/tests/auto/testlib/selftests/expected_fetchbogus.xunitxml
@@ -3,6 +3,7 @@
<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="fetchBogus">
diff --git a/tests/auto/testlib/selftests/expected_findtestdata.lightxml b/tests/auto/testlib/selftests/expected_findtestdata.lightxml
index 4c1c7298ed..e3c3cea7bc 100644
--- a/tests/auto/testlib/selftests/expected_findtestdata.lightxml
+++ b/tests/auto/testlib/selftests/expected_findtestdata.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_findtestdata.xml b/tests/auto/testlib/selftests/expected_findtestdata.xml
index b1f33abaf6..6abaa15103 100644
--- a/tests/auto/testlib/selftests/expected_findtestdata.xml
+++ b/tests/auto/testlib/selftests/expected_findtestdata.xml
@@ -2,6 +2,7 @@
<TestCase name="FindTestData">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_findtestdata.xunitxml b/tests/auto/testlib/selftests/expected_findtestdata.xunitxml
index 60283a1064..c1138da6cb 100644
--- a/tests/auto/testlib/selftests/expected_findtestdata.xunitxml
+++ b/tests/auto/testlib/selftests/expected_findtestdata.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="paths">
diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml
index fd128d2c61..7d4c43905c 100644
--- a/tests/auto/testlib/selftests/expected_globaldata.lightxml
+++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml
index 0867619fde..5e5d4d8922 100644
--- a/tests/auto/testlib/selftests/expected_globaldata.xml
+++ b/tests/auto/testlib/selftests/expected_globaldata.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_globaldata">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml
index e8cd03a59c..bdd7e3f00a 100644
--- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml
+++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml
@@ -3,6 +3,7 @@
<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">
<!-- message="initTestCase initTestCase (null)" type="qdebug" -->
diff --git a/tests/auto/testlib/selftests/expected_longstring.lightxml b/tests/auto/testlib/selftests/expected_longstring.lightxml
index 45c6d3f78d..f8796bed4a 100644
--- a/tests/auto/testlib/selftests/expected_longstring.lightxml
+++ b/tests/auto/testlib/selftests/expected_longstring.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_longstring.xml b/tests/auto/testlib/selftests/expected_longstring.xml
index efc29d6def..6623b7cd88 100644
--- a/tests/auto/testlib/selftests/expected_longstring.xml
+++ b/tests/auto/testlib/selftests/expected_longstring.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_LongString">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_longstring.xunitxml b/tests/auto/testlib/selftests/expected_longstring.xunitxml
index 6486817dbb..269c06fe08 100644
--- a/tests/auto/testlib/selftests/expected_longstring.xunitxml
+++ b/tests/auto/testlib/selftests/expected_longstring.xunitxml
@@ -3,6 +3,7 @@
<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="failWithLongString">
diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.lightxml b/tests/auto/testlib/selftests/expected_maxwarnings.lightxml
index ce6d828eb2..49db189352 100644
--- a/tests/auto/testlib/selftests/expected_maxwarnings.lightxml
+++ b/tests/auto/testlib/selftests/expected_maxwarnings.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.xml b/tests/auto/testlib/selftests/expected_maxwarnings.xml
index 758af9d6d5..614b054fad 100644
--- a/tests/auto/testlib/selftests/expected_maxwarnings.xml
+++ b/tests/auto/testlib/selftests/expected_maxwarnings.xml
@@ -2,6 +2,7 @@
<TestCase name="MaxWarnings">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml b/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml
index b1b0215cef..329fae5f1d 100644
--- a/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml
+++ b/tests/auto/testlib/selftests/expected_maxwarnings.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="warn">
diff --git a/tests/auto/testlib/selftests/expected_singleskip.lightxml b/tests/auto/testlib/selftests/expected_singleskip.lightxml
index 685396a243..ce09c0a9ad 100644
--- a/tests/auto/testlib/selftests/expected_singleskip.lightxml
+++ b/tests/auto/testlib/selftests/expected_singleskip.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_singleskip.xml b/tests/auto/testlib/selftests/expected_singleskip.xml
index c10626ca41..0c5cdade3d 100644
--- a/tests/auto/testlib/selftests/expected_singleskip.xml
+++ b/tests/auto/testlib/selftests/expected_singleskip.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_SingleSkip">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_singleskip.xunitxml b/tests/auto/testlib/selftests/expected_singleskip.xunitxml
index 70968fa1c4..2b2da2f504 100644
--- a/tests/auto/testlib/selftests/expected_singleskip.xunitxml
+++ b/tests/auto/testlib/selftests/expected_singleskip.xunitxml
@@ -3,6 +3,7 @@
<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 name="myTest">
diff --git a/tests/auto/testlib/selftests/expected_skip.lightxml b/tests/auto/testlib/selftests/expected_skip.lightxml
index 408bc44871..ee83d263b5 100644
--- a/tests/auto/testlib/selftests/expected_skip.lightxml
+++ b/tests/auto/testlib/selftests/expected_skip.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skip.xml b/tests/auto/testlib/selftests/expected_skip.xml
index b220722b6c..2c830bc9fb 100644
--- a/tests/auto/testlib/selftests/expected_skip.xml
+++ b/tests/auto/testlib/selftests/expected_skip.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Skip">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skip.xunitxml b/tests/auto/testlib/selftests/expected_skip.xunitxml
index 956d51f531..63e582f96a 100644
--- a/tests/auto/testlib/selftests/expected_skip.xunitxml
+++ b/tests/auto/testlib/selftests/expected_skip.xunitxml
@@ -3,6 +3,7 @@
<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 name="test">
diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.lightxml b/tests/auto/testlib/selftests/expected_skipcleanup.lightxml
index 49c9d148f5..dbbc30c0db 100644
--- a/tests/auto/testlib/selftests/expected_skipcleanup.lightxml
+++ b/tests/auto/testlib/selftests/expected_skipcleanup.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.xml b/tests/auto/testlib/selftests/expected_skipcleanup.xml
index 0bf1fe53a3..7b787ebb3d 100644
--- a/tests/auto/testlib/selftests/expected_skipcleanup.xml
+++ b/tests/auto/testlib/selftests/expected_skipcleanup.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_SkipCleanup">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml b/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml
index b8f67e2d07..9934584ec5 100644
--- a/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml
+++ b/tests/auto/testlib/selftests/expected_skipcleanup.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="aTestFunction"/>
diff --git a/tests/auto/testlib/selftests/expected_skipinit.lightxml b/tests/auto/testlib/selftests/expected_skipinit.lightxml
index e06c745205..3682068825 100644
--- a/tests/auto/testlib/selftests/expected_skipinit.lightxml
+++ b/tests/auto/testlib/selftests/expected_skipinit.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipinit.xml b/tests/auto/testlib/selftests/expected_skipinit.xml
index 6a62b93614..9d6a38b82f 100644
--- a/tests/auto/testlib/selftests/expected_skipinit.xml
+++ b/tests/auto/testlib/selftests/expected_skipinit.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_SkipInit">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipinit.xunitxml b/tests/auto/testlib/selftests/expected_skipinit.xunitxml
index f62df71d96..bab08c375c 100644
--- a/tests/auto/testlib/selftests/expected_skipinit.xunitxml
+++ b/tests/auto/testlib/selftests/expected_skipinit.xunitxml
@@ -3,6 +3,7 @@
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ <property value="" name="QtBuild"/>
</properties>
<testcase name="initTestCase">
<!-- message="Skip inside initTestCase. This should skip all tests in the class." type="skip" -->
diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.lightxml b/tests/auto/testlib/selftests/expected_skipinitdata.lightxml
index 41abd5dccd..26afcb4ab1 100644
--- a/tests/auto/testlib/selftests/expected_skipinitdata.lightxml
+++ b/tests/auto/testlib/selftests/expected_skipinitdata.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.xml b/tests/auto/testlib/selftests/expected_skipinitdata.xml
index 8efe12195e..9ab84f21a1 100644
--- a/tests/auto/testlib/selftests/expected_skipinitdata.xml
+++ b/tests/auto/testlib/selftests/expected_skipinitdata.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_SkipInitData">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml b/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml
index 699d50f7a7..e61d50b06b 100644
--- a/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml
+++ b/tests/auto/testlib/selftests/expected_skipinitdata.xunitxml
@@ -3,6 +3,7 @@
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ <property value="" name="QtBuild"/>
</properties>
<testcase name="initTestCase">
<!-- message="Skip inside initTestCase_data. This should skip all tests in the class." type="skip" -->
diff --git a/tests/auto/testlib/selftests/expected_strcmp.lightxml b/tests/auto/testlib/selftests/expected_strcmp.lightxml
index f0d266d400..298e910be8 100644
--- a/tests/auto/testlib/selftests/expected_strcmp.lightxml
+++ b/tests/auto/testlib/selftests/expected_strcmp.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_strcmp.xml b/tests/auto/testlib/selftests/expected_strcmp.xml
index 20ffee0611..29208f9a87 100644
--- a/tests/auto/testlib/selftests/expected_strcmp.xml
+++ b/tests/auto/testlib/selftests/expected_strcmp.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_StrCmp">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_strcmp.xunitxml b/tests/auto/testlib/selftests/expected_strcmp.xunitxml
index dde9ff5299..14bef9ec47 100644
--- a/tests/auto/testlib/selftests/expected_strcmp.xunitxml
+++ b/tests/auto/testlib/selftests/expected_strcmp.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="compareCharStars"/>
diff --git a/tests/auto/testlib/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml
index 467fabb7ac..2e484aafef 100644
--- a/tests/auto/testlib/selftests/expected_subtest.lightxml
+++ b/tests/auto/testlib/selftests/expected_subtest.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml
index 1107bcb070..f011489ec8 100644
--- a/tests/auto/testlib/selftests/expected_subtest.xml
+++ b/tests/auto/testlib/selftests/expected_subtest.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Subtest">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml
index 753711f837..b49c006940 100644
--- a/tests/auto/testlib/selftests/expected_subtest.xunitxml
+++ b/tests/auto/testlib/selftests/expected_subtest.xunitxml
@@ -3,6 +3,7 @@
<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">
<!-- message="initTestCase initTestCase (null)" type="qdebug" -->
diff --git a/tests/auto/testlib/selftests/expected_verbose1.lightxml b/tests/auto/testlib/selftests/expected_verbose1.lightxml
index 45dca139fa..6d7ce13ea0 100644
--- a/tests/auto/testlib/selftests/expected_verbose1.lightxml
+++ b/tests/auto/testlib/selftests/expected_verbose1.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verbose1.xml b/tests/auto/testlib/selftests/expected_verbose1.xml
index 7a182183c1..b5ae1286cb 100644
--- a/tests/auto/testlib/selftests/expected_verbose1.xml
+++ b/tests/auto/testlib/selftests/expected_verbose1.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Counting">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verbose1.xunitxml b/tests/auto/testlib/selftests/expected_verbose1.xunitxml
index 72bf047ba8..cb3a7815af 100644
--- a/tests/auto/testlib/selftests/expected_verbose1.xunitxml
+++ b/tests/auto/testlib/selftests/expected_verbose1.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testPassPass"/>
diff --git a/tests/auto/testlib/selftests/expected_verbose2.lightxml b/tests/auto/testlib/selftests/expected_verbose2.lightxml
index 0ead76884c..85f9ec45af 100644
--- a/tests/auto/testlib/selftests/expected_verbose2.lightxml
+++ b/tests/auto/testlib/selftests/expected_verbose2.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verbose2.xml b/tests/auto/testlib/selftests/expected_verbose2.xml
index 6d592f4a52..94fef3eed7 100644
--- a/tests/auto/testlib/selftests/expected_verbose2.xml
+++ b/tests/auto/testlib/selftests/expected_verbose2.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Counting">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verbose2.xunitxml b/tests/auto/testlib/selftests/expected_verbose2.xunitxml
index 6dabbd34fc..6764a5564f 100644
--- a/tests/auto/testlib/selftests/expected_verbose2.xunitxml
+++ b/tests/auto/testlib/selftests/expected_verbose2.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testPassPass">
diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml
index fb8f61503e..d38363fb6e 100644
--- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml
+++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml
index a89528cfb8..8c57fe5c0f 100644
--- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml
+++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_VerifyExceptionThrown">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml
index f49746a9af..003a31a1cc 100644
--- a/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml
+++ b/tests/auto/testlib/selftests/expected_verifyexceptionthrown.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testCorrectStdTypes"/>
diff --git a/tests/auto/testlib/selftests/expected_warnings.lightxml b/tests/auto/testlib/selftests/expected_warnings.lightxml
index bbc96b7010..31b3d842aa 100644
--- a/tests/auto/testlib/selftests/expected_warnings.lightxml
+++ b/tests/auto/testlib/selftests/expected_warnings.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_warnings.xml b/tests/auto/testlib/selftests/expected_warnings.xml
index acb80e4f2a..a3821f84df 100644
--- a/tests/auto/testlib/selftests/expected_warnings.xml
+++ b/tests/auto/testlib/selftests/expected_warnings.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Warnings">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_warnings.xunitxml b/tests/auto/testlib/selftests/expected_warnings.xunitxml
index 7be47174c6..7ea66522c6 100644
--- a/tests/auto/testlib/selftests/expected_warnings.xunitxml
+++ b/tests/auto/testlib/selftests/expected_warnings.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testWarnings">
diff --git a/tests/auto/testlib/selftests/expected_xunit.lightxml b/tests/auto/testlib/selftests/expected_xunit.lightxml
index 6660cf4e7a..95ab8f03f0 100644
--- a/tests/auto/testlib/selftests/expected_xunit.lightxml
+++ b/tests/auto/testlib/selftests/expected_xunit.lightxml
@@ -1,5 +1,6 @@
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_xunit.xml b/tests/auto/testlib/selftests/expected_xunit.xml
index af9fe1f502..f56ca947be 100644
--- a/tests/auto/testlib/selftests/expected_xunit.xml
+++ b/tests/auto/testlib/selftests/expected_xunit.xml
@@ -2,6 +2,7 @@
<TestCase name="tst_Xunit">
<Environment>
<QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QtBuild/>
<QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
</Environment>
<TestFunction name="initTestCase">
diff --git a/tests/auto/testlib/selftests/expected_xunit.xunitxml b/tests/auto/testlib/selftests/expected_xunit.xunitxml
index 7d133da7a5..395b6efdd9 100644
--- a/tests/auto/testlib/selftests/expected_xunit.xunitxml
+++ b/tests/auto/testlib/selftests/expected_xunit.xunitxml
@@ -3,6 +3,7 @@
<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="pass" name="testFunc1">
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index 1c09faf4db..8c1de0d8b4 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -56,8 +56,11 @@ isWindows = sys.platform == 'win32'
replacements = [
(qtver, r'@INSERT_QT_VERSION_HERE@'),
+ (r'Config: Using QtTest library.*', r'Config: Using QtTest library'), # Build string in text logs
(rootPath.encode('unicode-escape').decode('utf-8'), r''),
(r'( *)<Duration msecs="[\d\.]+"/>', r'\1<Duration msecs="0"/>'),
+ (r'( *)<QtBuild>[^<]+</QtBuild>', r'\1<QtBuild/>'), # Build element in xml, lightxml
+ (r'<property value="[^"]+" name="QtBuild"/>', r'<property value="" name="QtBuild"/>') # Build in xunitxml
]
extraArgs = {
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 9082561dc9..3e7262a7a0 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -169,12 +169,17 @@ QString tst_Selftests::logName(const QString &logger) const
return (logger.startsWith("stdout") ? "" : QString(tempDir.path() + "/test_output." + logger));
}
+static QString expectedFileNameFromTest(const QString &subdir, const QString &logger)
+{
+ return QStringLiteral("expected_") + subdir + QLatin1Char('.') + logFormat(logger);
+}
+
// Load the expected test output for the nominated test (subdir) and logger
// as an array of lines. If there is no expected output file, return an
// empty array.
-static QList<QByteArray> expectedResult(const QString &subdir, const QString &logger)
+static QList<QByteArray> expectedResult(const QString &fileName)
{
- QFile file(":/expected_" + subdir + "." + logFormat(logger));
+ QFile file(QStringLiteral(":/") + fileName);
if (!file.open(QIODevice::ReadOnly))
return QList<QByteArray>();
return splitLines(file.readAll());
@@ -621,7 +626,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
for (int n = 0; n < loggers.count(); ++n) {
QString logger = loggers[n];
QList<QByteArray> res = splitLines(actualOutputs[n]);
- QList<QByteArray> exp = expectedResult(subdir, logger);
+ const QString expectedFileName = expectedFileNameFromTest(subdir, logger);
+ QList<QByteArray> exp = expectedResult(expectedFileName);
#if defined (Q_CC_MSVC) || defined(Q_CC_MINGW)
// MSVC, MinGW format double numbers differently
if (n == 0 && subdir == QStringLiteral("float")) {
@@ -640,7 +646,7 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
QList<QByteArray> tmp;
int i = 1;
do {
- tmp = expectedResult(subdir + QString("_%1").arg(i++), logger);
+ tmp = expectedResult(expectedFileNameFromTest(subdir + QLatin1Char('_') + QString::number(i++), logger));
if (tmp.count())
expArr += tmp;
} while (tmp.count());
@@ -669,8 +675,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
qDebug() << ">>>>>>";
QVERIFY2(res.count() == exp.count(),
- qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3).")
- .arg(res.count()).arg(exp.count()).arg(loggers.at(n))));
+ qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3, %4).")
+ .arg(res.count()).arg(exp.count()).arg(loggers.at(n), expectedFileName)));
}
}
@@ -713,6 +719,12 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
if (line.endsWith(" : failure location"))
continue;
+ if (line.startsWith("Config: Using QtTest library") // Text build string
+ || line.startsWith(" <QtBuild") // XML, Light XML build string
+ || (line.startsWith(" <property value=") && line.endsWith("name=\"QtBuild\"/>"))) { // XUNIT-XML build string
+ continue;
+ }
+
const QString output(QString::fromLatin1(line));
const QString expected(QString::fromLatin1(exp.at(i)).replace("@INSERT_QT_VERSION_HERE@", QT_VERSION_STR));
@@ -742,8 +754,8 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
.arg(i).arg(loggers.at(n), output)));
} else {
QVERIFY2(output == expected,
- qPrintable(QString::fromLatin1("Mismatch at line %1 (%2): '%3' != '%4'")
- .arg(i).arg(loggers.at(n), output, expected)));
+ qPrintable(QString::fromLatin1("Mismatch at line %1 (%2, %3): '%4' != '%5'")
+ .arg(i + 1).arg(loggers.at(n), expectedFileName, output, expected)));
}
benchmark = line.startsWith("RESULT : ");
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 04140fa4a1..c5469bd33a 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -174,6 +174,9 @@ class TestClassinfoWithEscapes: public QObject
Q_OBJECT
Q_CLASSINFO("escaped", "\"bar\"")
Q_CLASSINFO("\"escaped\"", "foo")
+ Q_CLASSINFO("cpp c*/omment", "f/*oo")
+ Q_CLASSINFO("endswith\\", "Or?\?/")
+ Q_CLASSINFO("newline\n inside\n", "Or \r")
public slots:
void slotWithAReallyLongName(int)
{ }
@@ -800,6 +803,14 @@ void tst_Moc::classinfoWithEscapes()
const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject;
QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
+ QCOMPARE(mobj->classInfoCount(), 5);
+ QCOMPARE(mobj->classInfo(2).name(), "cpp c*/omment");
+ QCOMPARE(mobj->classInfo(2).value(), "f/*oo");
+ QCOMPARE(mobj->classInfo(3).name(), "endswith\\");
+ QCOMPARE(mobj->classInfo(3).value(), "Or?\?/");
+ QCOMPARE(mobj->classInfo(4).name(), "newline\n inside\n");
+ QCOMPARE(mobj->classInfo(4).value(), "Or \r");
+
QMetaMethod mm = mobj->method(mobj->methodOffset());
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index e9aae1ec59..c89b05616d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -389,6 +389,8 @@ private slots:
void itemClipsChildrenToShape5();
void itemClipsTextChildToShape();
void itemClippingDiscovery();
+ void itemContainsChildrenInShape();
+ void itemContainsChildrenInShape2();
void ancestorFlags();
void untransformable();
void contextMenuEventPropagation();
@@ -5855,6 +5857,102 @@ void tst_QGraphicsItem::itemClippingDiscovery()
QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0);
}
+class ItemCountsBoundingRectCalls : public QGraphicsRectItem
+{
+public:
+ ItemCountsBoundingRectCalls(const QRectF & rect, QGraphicsItem *parent = 0)
+ : QGraphicsRectItem(rect, parent), boundingRectCalls(0) {}
+ QRectF boundingRect () const {
+ ++boundingRectCalls;
+ return QGraphicsRectItem::boundingRect();
+ }
+ mutable int boundingRectCalls;
+};
+
+void tst_QGraphicsItem::itemContainsChildrenInShape()
+{
+ ItemCountsBoundingRectCalls *parent = new ItemCountsBoundingRectCalls(QRectF(0,0, 10, 10));
+ ItemCountsBoundingRectCalls *childOutsideShape = new ItemCountsBoundingRectCalls(QRectF(0,0, 10, 10), parent);
+ childOutsideShape->setPos(20,0);
+
+ QGraphicsScene scene;
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+ scene.addItem(parent);
+
+ QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
+
+ int oldParentBoundingRectCalls = parent->boundingRectCalls;
+ int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
+
+ // First test that both items are searched if no optimization flags are set
+ QGraphicsItem* item = scene.itemAt(25,5);
+
+ QVERIFY(item == childOutsideShape);
+ QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
+ QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls);
+ QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
+
+ oldParentBoundingRectCalls = parent->boundingRectCalls;
+ oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
+
+ // Repeat the test to make sure that no caching/indexing is in effect
+ item = scene.itemAt(25,5);
+
+ QVERIFY(item == childOutsideShape);
+ QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
+ QVERIFY(childOutsideShape->boundingRectCalls > oldChildBoundingRectCalls);
+ QVERIFY(parent->boundingRectCalls == childOutsideShape->boundingRectCalls);
+
+ oldParentBoundingRectCalls = parent->boundingRectCalls;
+ oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
+
+ // Set the optimization flag and make sure that the child is not returned
+ // and that the child's boundingRect() method is never called.
+ parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
+ item = scene.itemAt(25,5);
+
+ QVERIFY(!(item));
+ QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
+ QVERIFY(childOutsideShape->boundingRectCalls == oldChildBoundingRectCalls);
+ QVERIFY(parent->boundingRectCalls > childOutsideShape->boundingRectCalls);
+}
+
+void tst_QGraphicsItem::itemContainsChildrenInShape2()
+{
+ //The tested flag behaves almost identically to ItemClipsChildrenToShape
+ //in terms of optimizations but does not enforce the clip.
+ //This test makes sure there is no clip.
+ QGraphicsScene scene;
+ QGraphicsItem *rect = scene.addRect(0, 0, 50, 50, QPen(Qt::NoPen), QBrush(Qt::yellow));
+
+ QGraphicsItem *ellipse = scene.addEllipse(0, 0, 100, 100, QPen(Qt::NoPen), QBrush(Qt::green));
+ ellipse->setParentItem(rect);
+
+ QGraphicsItem *clippedEllipse = scene.addEllipse(0, 0, 50, 50, QPen(Qt::NoPen), QBrush(Qt::blue));
+ clippedEllipse->setParentItem(ellipse);
+
+ QGraphicsItem *clippedEllipse2 = scene.addEllipse(0, 0, 25, 25, QPen(Qt::NoPen), QBrush(Qt::red));
+ clippedEllipse2->setParentItem(clippedEllipse);
+
+ QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemClipsChildrenToShape));
+ QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemContainsChildrenInShape));
+ ellipse->setFlags(QGraphicsItem::ItemContainsChildrenInShape);
+ QVERIFY(!(ellipse->flags() & QGraphicsItem::ItemClipsChildrenToShape));
+ QVERIFY((ellipse->flags() & QGraphicsItem::ItemContainsChildrenInShape));
+
+ QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
+ image.fill(0);
+ QPainter painter(&image);
+ painter.setRenderHint(QPainter::Antialiasing);
+ scene.render(&painter);
+ painter.end();
+
+ QCOMPARE(image.pixel(2, 2), QColor(Qt::yellow).rgba());
+ QCOMPARE(image.pixel(12, 12), QColor(Qt::red).rgba());
+ QCOMPARE(image.pixel(2, 25), QColor(Qt::blue).rgba());
+ QCOMPARE(image.pixel(2, 50), QColor(Qt::green).rgba());
+}
+
void tst_QGraphicsItem::ancestorFlags()
{
QGraphicsItem *level1 = new QGraphicsRectItem;
@@ -5975,11 +6073,27 @@ void tst_QGraphicsItem::ancestorFlags()
// Nobody handles child events
level21->setHandlesChildEvents(false);
- for (int i = 0; i < 2; ++i) {
- QGraphicsItem::GraphicsItemFlag flag = !i ? QGraphicsItem::ItemClipsChildrenToShape
- : QGraphicsItem::ItemIgnoresTransformations;
- int ancestorFlag = !i ? QGraphicsItemPrivate::AncestorClipsChildren
- : QGraphicsItemPrivate::AncestorIgnoresTransformations;
+ for (int i = 0; i < 3; ++i) {
+ QGraphicsItem::GraphicsItemFlag flag;
+ int ancestorFlag;
+
+ switch (i) {
+ case(0):
+ flag = QGraphicsItem::ItemClipsChildrenToShape;
+ ancestorFlag = QGraphicsItemPrivate::AncestorClipsChildren;
+ break;
+ case(1):
+ flag = QGraphicsItem::ItemIgnoresTransformations;
+ ancestorFlag = QGraphicsItemPrivate::AncestorIgnoresTransformations;
+ break;
+ case(2):
+ flag = QGraphicsItem::ItemContainsChildrenInShape;
+ ancestorFlag = QGraphicsItemPrivate::AncestorContainsChildren;
+ break;
+ default:
+ qFatal("Unknown ancestor flag, please fix!");
+ break;
+ }
QCOMPARE(int(level1->d_ptr->ancestorFlags), 0);
QCOMPARE(int(level21->d_ptr->ancestorFlags), 0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index dfc8465210..a4752126bc 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -267,6 +267,7 @@ private slots:
void removeFullyTransparentItem();
void zeroScale();
void focusItemChangedSignal();
+ void minimumRenderSize();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -4678,6 +4679,78 @@ void tst_QGraphicsScene::focusItemChangedSignal()
}
+class ItemCountsPaintCalls : public QGraphicsRectItem
+{
+public:
+ ItemCountsPaintCalls(const QRectF & rect, QGraphicsItem *parent = 0)
+ : QGraphicsRectItem(rect, parent), repaints(0) {}
+ void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )
+ {
+ QGraphicsRectItem::paint(painter, option, widget);
+ ++repaints;
+ }
+ int repaints;
+};
+
+void tst_QGraphicsScene::minimumRenderSize()
+{
+ Q_CHECK_PAINTEVENTS
+
+ ItemCountsPaintCalls *bigParent = new ItemCountsPaintCalls(QRectF(0,0,100,100));
+ ItemCountsPaintCalls *smallChild = new ItemCountsPaintCalls(QRectF(0,0,10,10), bigParent);
+ ItemCountsPaintCalls *smallerGrandChild = new ItemCountsPaintCalls(QRectF(0,0,1,1), smallChild);
+ QGraphicsScene scene;
+ scene.addItem(bigParent);
+
+ CustomView view;
+ view.setScene(&scene);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ qApp->processEvents();
+
+ // Initially, everything should be repainted the same number of times
+ int viewRepaints = 0;
+ QTRY_VERIFY(view.repaints > viewRepaints);
+ viewRepaints = view.repaints;
+
+ QVERIFY(viewRepaints == bigParent->repaints);
+ QVERIFY(viewRepaints == smallChild->repaints);
+ QVERIFY(viewRepaints == smallerGrandChild->repaints);
+
+ // Setting a minimum render size should cause a repaint
+ scene.setMinimumRenderSize(0.5);
+ qApp->processEvents();
+
+ QTRY_VERIFY(view.repaints > viewRepaints);
+ viewRepaints = view.repaints;
+
+ QVERIFY(viewRepaints == bigParent->repaints);
+ QVERIFY(viewRepaints == smallChild->repaints);
+ QVERIFY(viewRepaints == smallerGrandChild->repaints);
+
+ // Scaling should cause a repaint of big items only.
+ view.scale(0.1, 0.1);
+ qApp->processEvents();
+
+ QTRY_VERIFY(view.repaints > viewRepaints);
+ viewRepaints = view.repaints;
+
+ QVERIFY(viewRepaints == bigParent->repaints);
+ QVERIFY(viewRepaints == smallChild->repaints);
+ QVERIFY(smallChild->repaints > smallerGrandChild->repaints);
+
+ // Scaling further should cause even fewer items to be repainted
+ view.scale(0.1, 0.1); // Stacks with previous scale
+ qApp->processEvents();
+
+ QTRY_VERIFY(view.repaints > viewRepaints);
+ viewRepaints = view.repaints;
+
+ QVERIFY(viewRepaints == bigParent->repaints);
+ QVERIFY(bigParent->repaints > smallChild->repaints);
+ QVERIFY(smallChild->repaints > smallerGrandChild->repaints);
+}
+
void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache()
{
QGraphicsScene scene;
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 d6b7fc20ed..1809cdc16a 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -107,8 +107,7 @@ void tst_QWidget_window::cleanupTestCase()
}
/* Test if the maximum/minimum size constraints
- * are propagated from the wid src/widgets/kernel/qwidgetwindow_qpa_p.h
-get to the QWidgetWindow
+ * are propagated from the widget to the QWidgetWindow
* independently of whether they were set before or after
* window creation (QTBUG-26745). */
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 21034e8f1b..350ae23d8a 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -393,18 +393,31 @@ void tst_QSpinBox::valueChangedHelper(int value)
actualValues << value;
}
+class MySpinBox: public QSpinBox
+{
+public:
+ MySpinBox(QWidget *parent = 0) : QSpinBox(parent) {}
+
+ void changeEvent(QEvent *ev) {
+ eventsReceived.append(ev->type());
+ }
+ QList<QEvent::Type> eventsReceived;
+};
+
void tst_QSpinBox::setReadOnly()
{
- QSpinBox spin(0);
+ MySpinBox spin(0);
spin.show();
QTest::keyClick(&spin, Qt::Key_Up);
QCOMPARE(spin.value(), 1);
spin.setReadOnly(true);
+ QCOMPARE(spin.eventsReceived, QList<QEvent::Type>() << QEvent::ReadOnlyChange);
QTest::keyClick(&spin, Qt::Key_Up);
QCOMPARE(spin.value(), 1);
spin.stepBy(1);
QCOMPARE(spin.value(), 2);
spin.setReadOnly(false);
+ QCOMPARE(spin.eventsReceived, QList<QEvent::Type>() << QEvent::ReadOnlyChange << QEvent::ReadOnlyChange);
QTest::keyClick(&spin, Qt::Key_Up);
QCOMPARE(spin.value(), 3);
}
diff --git a/tests/manual/cocoa/qt_on_cocoa/main.mm b/tests/manual/cocoa/qt_on_cocoa/main.mm
index 9a39788b02..7b4d4dd8d5 100644
--- a/tests/manual/cocoa/qt_on_cocoa/main.mm
+++ b/tests/manual/cocoa/qt_on_cocoa/main.mm
@@ -43,7 +43,7 @@
#include <QtDeclarative>
#include <QtWidgets/QtWidgets>
-#include <private/qwidgetwindow_qpa_p.h>
+#include <private/qwidgetwindow_p.h>
#include <QtGui/qpa/qplatformnativeinterface.h>
#include <QtGui/QPixmap>
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 9318824e6d..e593756a7d 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -47,7 +47,10 @@ unc
!contains(QT_CONFIG, openssl):!contains(QT_CONFIG, openssl-linked):SUBDIRS -= qssloptions
-contains(QT_CONFIG, opengl):SUBDIRS += qopengltextureblitter
+contains(QT_CONFIG, opengl) {
+ SUBDIRS += qopengltextureblitter
+ contains(QT_CONFIG, egl): SUBDIRS += qopenglcontext
+}
win32 {
SUBDIRS -= network_remote_stresstest network_stresstest
diff --git a/tests/manual/qopenglcontext/main.cpp b/tests/manual/qopenglcontext/main.cpp
new file mode 100644
index 0000000000..dd3178f466
--- /dev/null
+++ b/tests/manual/qopenglcontext/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include "qopenglcontextwindow.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QOpenGLContextWindow window;
+ window.resize(300, 300);
+ window.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/qopenglcontext/qopenglcontext.pro b/tests/manual/qopenglcontext/qopenglcontext.pro
new file mode 100644
index 0000000000..c5943809c6
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontext.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+TARGET = qopenglcontext
+
+QT += gui-private platformsupport-private
+
+HEADERS += $$PWD/qopenglcontextwindow.h
+
+SOURCES += $$PWD/main.cpp \
+ $$PWD/qopenglcontextwindow.cpp
diff --git a/tests/manual/qopenglcontext/qopenglcontextwindow.cpp b/tests/manual/qopenglcontext/qopenglcontextwindow.cpp
new file mode 100644
index 0000000000..bf6fe30c00
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontextwindow.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qopenglcontextwindow.h"
+#include <QtGui/QOpenGLFunctions>
+#include <QtGui/QOffscreenSurface>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QMatrix4x4>
+#include <qpa/qplatformnativeinterface.h>
+
+#include <QtPlatformSupport/private/qeglconvenience_p.h>
+#include <QtPlatformHeaders/QEGLNativeContext>
+
+QOpenGLContextWindow::QOpenGLContextWindow()
+ : m_blitter(0)
+{
+ setSurfaceType(OpenGLSurface);
+
+ m_context = new QOpenGLContext(this);
+ m_context->setFormat(requestedFormat());
+ m_context->create();
+
+ m_image = QImage(QStringLiteral("qticon64.png")).convertToFormat(QImage::Format_RGBA8888);
+ Q_ASSERT(!m_image.isNull());
+
+ create(); // to make sure format() returns something real
+ createForeignContext();
+}
+
+QOpenGLContextWindow::~QOpenGLContextWindow()
+{
+ if (m_blitter) {
+ m_blitter->destroy(); // the dtor does not call this for some reason
+ delete m_blitter;
+ }
+}
+
+void QOpenGLContextWindow::render()
+{
+ if (!m_context->makeCurrent(this))
+ qFatal("makeCurrent() failed");
+
+ QOpenGLFunctions *f = m_context->functions();
+ f->glViewport(0, 0, dWidth(), dHeight());
+ f->glClearColor(0, 0, 0, 1);
+ f->glClear(GL_COLOR_BUFFER_BIT);
+
+ if (!m_blitter) {
+ m_blitter = new QOpenGLTextureBlitter;
+ m_blitter->create();
+ }
+
+ // Draw the image. If nothing gets shown, then something went wrong with the context
+ // adoption or sharing was not successfully enabled.
+ m_blitter->bind();
+ QRectF r(0, 0, dWidth(), dHeight());
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(QRectF(100, 100, 100, 100), r.toRect());
+ m_blitter->blit(m_textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
+ m_blitter->release();
+
+ m_context->swapBuffers(this);
+}
+
+void QOpenGLContextWindow::exposeEvent(QExposeEvent *)
+{
+ if (isExposed())
+ render();
+}
+
+void QOpenGLContextWindow::createForeignContext()
+{
+ // Here a context will be created manually. This context will share with m_context's
+ // underlying native context. This way the texture, that belongs to the context
+ // created here, will be accessible from m_context too.
+
+ EGLContext shareCtx = m_context->nativeHandle().value<QEGLNativeContext>().context();
+ Q_ASSERT(shareCtx != EGL_NO_CONTEXT);
+
+ EGLDisplay dpy = (EGLDisplay) qGuiApp->platformNativeInterface()->nativeResourceForWindow(
+ QByteArrayLiteral("egldisplay"), this);
+ Q_ASSERT(dpy != EGL_NO_DISPLAY);
+
+ QSurfaceFormat fmt = format();
+ EGLConfig config = q_configFromGLFormat(dpy, fmt);
+
+ QVector<EGLint> contextAttrs;
+ contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
+ contextAttrs.append(fmt.majorVersion());
+ contextAttrs.append(EGL_NONE);
+ switch (fmt.renderableType()) {
+#ifdef EGL_VERSION_1_4
+ case QSurfaceFormat::OpenGL:
+ eglBindAPI(EGL_OPENGL_API);
+ break;
+#endif // EGL_VERSION_1_4
+ default:
+ eglBindAPI(EGL_OPENGL_ES_API);
+ break;
+ }
+
+ EGLContext ctx = eglCreateContext(dpy, config, shareCtx, contextAttrs.constData());
+ Q_ASSERT(ctx != EGL_NO_CONTEXT);
+
+ // Wrap ctx into a QOpenGLContext.
+ QOpenGLContext *ctxWrap = new QOpenGLContext;
+ ctxWrap->setNativeHandle(QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx, dpy)));
+ ctxWrap->setShareContext(m_context); // only needed for correct bookkeeping
+ if (!ctxWrap->create())
+ qFatal("Failed to created wrapping context");
+ Q_ASSERT(ctxWrap->nativeHandle().value<QEGLNativeContext>().context() == ctx);
+
+ QOffscreenSurface surface;
+ surface.setFormat(fmt);
+ surface.create();
+
+ if (!ctxWrap->makeCurrent(&surface))
+ qFatal("Failed to make pbuffer surface current");
+
+ // Create the texture.
+ QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
+ GLuint textureId = 0;
+ f->glGenTextures(1, &textureId);
+ f->glBindTexture(GL_TEXTURE_2D, textureId);
+ f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_image.width(), m_image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ m_image.constBits());
+ Q_ASSERT(f->glGetError() == GL_NO_ERROR);
+
+ ctxWrap->doneCurrent();
+ delete ctxWrap; // ctx is not destroyed
+ eglDestroyContext(dpy, ctx); // resources like the texture stay alive until any context on the share list is alive
+ Q_ASSERT(eglGetError() == EGL_SUCCESS);
+
+ m_textureId = textureId;
+}
diff --git a/tests/manual/qopenglcontext/qopenglcontextwindow.h b/tests/manual/qopenglcontext/qopenglcontextwindow.h
new file mode 100644
index 0000000000..6fcb3633bf
--- /dev/null
+++ b/tests/manual/qopenglcontext/qopenglcontextwindow.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/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 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QOPENGLCONTEXTWINDOW_H
+#define QOPENGLCONTEXTWINDOW_H
+
+#include <QtGui/QWindow>
+#include <QtGui/QOpenGLContext>
+#include <QtGui/QImage>
+#include <QtCore/QVariant>
+#include <QtGui/private/qopengltextureblitter_p.h>
+
+class QOpenGLContextWindow : public QWindow
+{
+ Q_OBJECT
+
+public:
+ QOpenGLContextWindow();
+ ~QOpenGLContextWindow();
+
+ void render();
+
+protected:
+ void exposeEvent(QExposeEvent *event);
+
+private:
+ qreal dWidth() const { return width() * devicePixelRatio(); }
+ qreal dHeight() const { return height() * devicePixelRatio(); }
+ void createForeignContext();
+
+ QOpenGLContext *m_context;
+ QImage m_image;
+ QVariant m_nativeHandle;
+ uint m_textureId;
+ QOpenGLTextureBlitter *m_blitter;
+};
+
+#endif
diff --git a/tests/manual/qopenglcontext/qticon64.png b/tests/manual/qopenglcontext/qticon64.png
new file mode 100644
index 0000000000..76f02c6c96
--- /dev/null
+++ b/tests/manual/qopenglcontext/qticon64.png
Binary files differ
diff --git a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro
index f83136266d..f83136266d 100644
--- a/tests/manual/widgets/itemviews/qheaderview/qheaderviewtest.pro
+++ b/tests/manual/widgets/itemviews/qheaderview/qheaderview.pro
diff --git a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro
index c241ee1045..c241ee1045 100644
--- a/tests/manual/widgets/itemviews/qtreeview/qtreeviewtest.pro
+++ b/tests/manual/widgets/itemviews/qtreeview/qtreeview.pro
diff --git a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro
index 4b1da9be38..4b1da9be38 100644
--- a/tests/manual/widgets/itemviews/qtreewidget/qtreewidgettest.pro
+++ b/tests/manual/widgets/itemviews/qtreewidget/qtreewidget.pro
diff --git a/tests/manual/widgets/kernel/layoutreplace/main.pro b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro
index 54c6a4a9fc..54c6a4a9fc 100644
--- a/tests/manual/widgets/kernel/layoutreplace/main.pro
+++ b/tests/manual/widgets/kernel/layoutreplace/layoutreplace.pro
diff --git a/tests/manual/widgets/kernel/qtooltip/main.pro b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro
index dac880a10e..dac880a10e 100644
--- a/tests/manual/widgets/kernel/qtooltip/main.pro
+++ b/tests/manual/widgets/kernel/qtooltip/qtooltip.pro
diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro
index 805b0cc119..805b0cc119 100644
--- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.pro
+++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberband.pro