diff options
Diffstat (limited to 'tests/auto')
667 files changed, 4023 insertions, 3126 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 9cab3c9e42..e905a416a6 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -22,7 +22,7 @@ installed_cmake.depends = cmake ios: SUBDIRS = corelib gui wince: SUBDIRS -= printsupport -cross_compile: SUBDIRS -= tools +cross_compile: SUBDIRS -= tools cmake installed_cmake !qtHaveModule(opengl): SUBDIRS -= opengl !qtHaveModule(gui): SUBDIRS -= gui cmake !qtHaveModule(widgets): SUBDIRS -= widgets diff --git a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro index e82d101de0..f3684faa61 100644 --- a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro +++ b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentfilter QT = core testlib concurrent SOURCES = tst_qtconcurrentfilter.cpp diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro b/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro index 4cfebc0e3d..f599372c6f 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/qtconcurrentiteratekernel.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentiteratekernel QT = core testlib concurrent SOURCES = tst_qtconcurrentiteratekernel.cpp diff --git a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro index 199e5ad4d6..3af207ae5a 100644 --- a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro +++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentmap QT = core testlib concurrent SOURCES = tst_qtconcurrentmap.cpp diff --git a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro index 1eb27d825a..0d07642028 100644 --- a/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro +++ b/tests/auto/concurrent/qtconcurrentmedian/qtconcurrentmedian.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentmedian QT = core testlib concurrent SOURCES = tst_qtconcurrentmedian.cpp diff --git a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro index 03d77b33a2..f60462f9ed 100644 --- a/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro +++ b/tests/auto/concurrent/qtconcurrentrun/qtconcurrentrun.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentrun QT = core testlib concurrent SOURCES = tst_qtconcurrentrun.cpp diff --git a/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro b/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro index f6ddd33504..b98b8f56e8 100644 --- a/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro +++ b/tests/auto/concurrent/qtconcurrentthreadengine/qtconcurrentthreadengine.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtconcurrentthreadengine QT = core testlib concurrent SOURCES = tst_qtconcurrentthreadengine.cpp diff --git a/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro b/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro index 7ec9c5f574..32701c2c9c 100644 --- a/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro +++ b/tests/auto/corelib/animation/qabstractanimation/qabstractanimation.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qabstractanimation QT = core testlib SOURCES = tst_qabstractanimation.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro b/tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro index a5e898b395..f4b5747216 100644 --- a/tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro +++ b/tests/auto/corelib/animation/qanimationgroup/qanimationgroup.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qanimationgroup QT = core testlib SOURCES = tst_qanimationgroup.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro index 23343f27f5..5b4c6ab90a 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro +++ b/tests/auto/corelib/animation/qparallelanimationgroup/qparallelanimationgroup.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qparallelanimationgroup QT = core testlib SOURCES = tst_qparallelanimationgroup.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index d963c5173e..640f58c532 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -491,7 +491,7 @@ void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup() QVERIFY(group.currentLoopTime() > 0); delete anim1; - QVERIFY(group.animationCount() == 0); + QCOMPARE(group.animationCount(), 0); QCOMPARE(group.duration(), 0); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(group.currentLoopTime(), 0); //that's the invariant diff --git a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro index 4c2dd02951..7f19bc7545 100644 --- a/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro +++ b/tests/auto/corelib/animation/qpauseanimation/qpauseanimation.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpauseanimation QT = core-private testlib SOURCES = tst_qpauseanimation.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp index db58c797d3..06667df489 100644 --- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp @@ -114,10 +114,10 @@ void tst_QPauseAnimation::changeDirectionWhileRunning() animation.setDuration(400); animation.start(); QTest::qWait(100); - QVERIFY(animation.state() == QAbstractAnimation::Running); + QCOMPARE(animation.state(), QAbstractAnimation::Running); animation.setDirection(QAbstractAnimation::Backward); QTest::qWait(animation.totalDuration() + 50); - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); } void tst_QPauseAnimation::noTimerUpdates_data() @@ -149,7 +149,7 @@ void tst_QPauseAnimation::noTimerUpdates() QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); const int expectedLoopCount = 1 + loopCount; #ifdef BAD_TIMER_RESOLUTION @@ -177,13 +177,13 @@ void tst_QPauseAnimation::multiplePauseAnimations() if (animation.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (animation2.state() != QAbstractAnimation::Running) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(animation2.state() == QAbstractAnimation::Running); + QCOMPARE(animation2.state(), QAbstractAnimation::Running); #ifdef BAD_TIMER_RESOLUTION if (animation.m_updateCurrentTimeCount != 2) @@ -203,7 +203,7 @@ void tst_QPauseAnimation::multiplePauseAnimations() if (animation2.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(animation2.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation2.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (animation2.m_updateCurrentTimeCount != 3) @@ -230,8 +230,8 @@ void tst_QPauseAnimation::pauseAndPropertyAnimations() QTest::qWait(100); animation.start(); - QVERIFY(animation.state() == QAbstractAnimation::Running); - QVERIFY(pause.state() == QAbstractAnimation::Running); + QCOMPARE(animation.state(), QAbstractAnimation::Running); + QCOMPARE(pause.state(), QAbstractAnimation::Running); QCOMPARE(pause.m_updateCurrentTimeCount, 2); QTest::qWait(animation.totalDuration() + 100); @@ -240,8 +240,8 @@ void tst_QPauseAnimation::pauseAndPropertyAnimations() if (animation.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(animation.state() == QAbstractAnimation::Stopped); - QVERIFY(pause.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); + QCOMPARE(pause.state(), QAbstractAnimation::Stopped); QVERIFY(pause.m_updateCurrentTimeCount > 3); } @@ -250,10 +250,10 @@ void tst_QPauseAnimation::pauseResume() TestablePauseAnimation animation; animation.setDuration(400); animation.start(); - QVERIFY(animation.state() == QAbstractAnimation::Running); + QCOMPARE(animation.state(), QAbstractAnimation::Running); QTest::qWait(200); animation.pause(); - QVERIFY(animation.state() == QAbstractAnimation::Paused); + QCOMPARE(animation.state(), QAbstractAnimation::Paused); animation.start(); QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped); @@ -281,39 +281,39 @@ void tst_QPauseAnimation::sequentialPauseGroup() QCOMPARE(animation2.m_updateCurrentTimeCount, 0); QCOMPARE(animation3.m_updateCurrentTimeCount, 0); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(animation1.state() == QAbstractAnimation::Running); - QVERIFY(animation2.state() == QAbstractAnimation::Stopped); - QVERIFY(animation3.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(animation1.state(), QAbstractAnimation::Running); + QCOMPARE(animation2.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation3.state(), QAbstractAnimation::Stopped); group.setCurrentTime(250); QCOMPARE(animation1.m_updateCurrentTimeCount, 2); QCOMPARE(animation2.m_updateCurrentTimeCount, 1); QCOMPARE(animation3.m_updateCurrentTimeCount, 0); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(animation1.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(animation1.state(), QAbstractAnimation::Stopped); QCOMPARE((QAbstractAnimation*)&animation2, group.currentAnimation()); - QVERIFY(animation2.state() == QAbstractAnimation::Running); - QVERIFY(animation3.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation2.state(), QAbstractAnimation::Running); + QCOMPARE(animation3.state(), QAbstractAnimation::Stopped); group.setCurrentTime(500); QCOMPARE(animation1.m_updateCurrentTimeCount, 2); QCOMPARE(animation2.m_updateCurrentTimeCount, 2); QCOMPARE(animation3.m_updateCurrentTimeCount, 1); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(animation1.state() == QAbstractAnimation::Stopped); - QVERIFY(animation2.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(animation1.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation2.state(), QAbstractAnimation::Stopped); QCOMPARE((QAbstractAnimation*)&animation3, group.currentAnimation()); - QVERIFY(animation3.state() == QAbstractAnimation::Running); + QCOMPARE(animation3.state(), QAbstractAnimation::Running); group.setCurrentTime(750); - QVERIFY(group.state() == QAbstractAnimation::Stopped); - QVERIFY(animation1.state() == QAbstractAnimation::Stopped); - QVERIFY(animation2.state() == QAbstractAnimation::Stopped); - QVERIFY(animation3.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation1.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation2.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation3.state(), QAbstractAnimation::Stopped); QCOMPARE(animation1.m_updateCurrentTimeCount, 2); QCOMPARE(animation2.m_updateCurrentTimeCount, 2); @@ -334,22 +334,22 @@ void tst_QPauseAnimation::sequentialGroupWithPause() group.start(); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(animation.state() == QAbstractAnimation::Running); - QVERIFY(pause.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(animation.state(), QAbstractAnimation::Running); + QCOMPARE(pause.state(), QAbstractAnimation::Stopped); group.setCurrentTime(300); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); QCOMPARE((QAbstractAnimation*)&pause, group.currentAnimation()); - QVERIFY(pause.state() == QAbstractAnimation::Running); + QCOMPARE(pause.state(), QAbstractAnimation::Running); group.setCurrentTime(600); - QVERIFY(group.state() == QAbstractAnimation::Stopped); - QVERIFY(animation.state() == QAbstractAnimation::Stopped); - QVERIFY(pause.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); + QCOMPARE(pause.state(), QAbstractAnimation::Stopped); QCOMPARE(pause.m_updateCurrentTimeCount, 2); } @@ -401,11 +401,11 @@ void tst_QPauseAnimation::multipleSequentialGroups() group.start(); - QVERIFY(group.state() == QAbstractAnimation::Running); - QVERIFY(subgroup1.state() == QAbstractAnimation::Running); - QVERIFY(subgroup2.state() == QAbstractAnimation::Running); - QVERIFY(subgroup3.state() == QAbstractAnimation::Running); - QVERIFY(subgroup4.state() == QAbstractAnimation::Running); + QCOMPARE(group.state(), QAbstractAnimation::Running); + QCOMPARE(subgroup1.state(), QAbstractAnimation::Running); + QCOMPARE(subgroup2.state(), QAbstractAnimation::Running); + QCOMPARE(subgroup3.state(), QAbstractAnimation::Running); + QCOMPARE(subgroup4.state(), QAbstractAnimation::Running); // This is a pretty long animation so it tends to get rather out of sync // when using the consistent timer, so run for an extra half second for good @@ -416,31 +416,31 @@ void tst_QPauseAnimation::multipleSequentialGroups() if (group.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(group.state() == QAbstractAnimation::Stopped); + QCOMPARE(group.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (subgroup1.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(subgroup1.state() == QAbstractAnimation::Stopped); + QCOMPARE(subgroup1.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (subgroup2.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(subgroup2.state() == QAbstractAnimation::Stopped); + QCOMPARE(subgroup2.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (subgroup3.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(subgroup3.state() == QAbstractAnimation::Stopped); + QCOMPARE(subgroup3.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (subgroup4.state() != QAbstractAnimation::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif - QVERIFY(subgroup4.state() == QAbstractAnimation::Stopped); + QCOMPARE(subgroup4.state(), QAbstractAnimation::Stopped); #ifdef BAD_TIMER_RESOLUTION if (pause5.m_updateCurrentTimeCount != 4) @@ -455,7 +455,7 @@ void tst_QPauseAnimation::zeroDuration() animation.setDuration(0); animation.start(); QTest::qWait(animation.totalDuration() + 100); - QVERIFY(animation.state() == QAbstractAnimation::Stopped); + QCOMPARE(animation.state(), QAbstractAnimation::Stopped); QCOMPARE(animation.m_updateCurrentTimeCount, 1); } diff --git a/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro b/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro index 502e5aa428..bfeb183abf 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro +++ b/tests/auto/corelib/animation/qpropertyanimation/qpropertyanimation.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpropertyanimation QT = core gui widgets testlib SOURCES = tst_qpropertyanimation.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index 530d7777d8..d4a1a6db11 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -34,6 +34,7 @@ #include <QtTest/QtTest> #include <QtCore/qpropertyanimation.h> #include <QtCore/qvariantanimation.h> +#include <QtGui/qtouchdevice.h> #include <QtWidgets/qwidget.h> Q_DECLARE_METATYPE(QAbstractAnimation::State) @@ -369,7 +370,7 @@ void tst_QPropertyAnimation::deletion2() QTimer::singleShot(0, object, SLOT(deleteLater())); QTest::qWait(50); - QVERIFY(anim->targetObject() == 0); + QVERIFY(!anim->targetObject()); } void tst_QPropertyAnimation::deletion3() diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro b/tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro index e53cde48f3..b0271e8ea2 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/qsequentialanimationgroup.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsequentialanimationgroup QT = core testlib SOURCES = tst_qsequentialanimationgroup.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index c0fcb70ff3..067dcd705a 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -916,7 +916,7 @@ void tst_QSequentialAnimationGroup::startDelay() QTest::qWait(500); QTRY_COMPARE(group.state(), QAnimationGroup::Stopped); - QVERIFY(group.currentLoopTime() == 375); + QCOMPARE(group.currentLoopTime(), 375); } void tst_QSequentialAnimationGroup::clearGroup() @@ -1518,7 +1518,7 @@ void tst_QSequentialAnimationGroup::addRemoveAnimation() void tst_QSequentialAnimationGroup::currentAnimation() { QSequentialAnimationGroup group; - QVERIFY(group.currentAnimation() == 0); + QVERIFY(!group.currentAnimation()); QPropertyAnimation anim; anim.setDuration(0); @@ -1529,7 +1529,7 @@ void tst_QSequentialAnimationGroup::currentAnimation() void tst_QSequentialAnimationGroup::currentAnimationWithZeroDuration() { QSequentialAnimationGroup group; - QVERIFY(group.currentAnimation() == 0); + QVERIFY(!group.currentAnimation()); QPropertyAnimation zero1; zero1.setDuration(0); diff --git a/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro b/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro index 1c882833fc..b82d3bc6e0 100644 --- a/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro +++ b/tests/auto/corelib/animation/qvariantanimation/qvariantanimation.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qvariantanimation QT = core testlib SOURCES = tst_qvariantanimation.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp index bd539296c2..5e223969e3 100644 --- a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp +++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp @@ -77,9 +77,9 @@ void tst_QVariantAnimation::currentValue() void tst_QVariantAnimation::easingCurve() { TestableQVariantAnimation anim; - QVERIFY(anim.easingCurve() == QEasingCurve::Linear); + QCOMPARE(anim.easingCurve().type(), QEasingCurve::Linear); anim.setEasingCurve(QEasingCurve::InQuad); - QVERIFY(anim.easingCurve() == QEasingCurve::InQuad); + QCOMPARE(anim.easingCurve().type(), QEasingCurve::InQuad); } void tst_QVariantAnimation::endValue() diff --git a/tests/auto/corelib/codecs/qtextcodec/echo/echo.pro b/tests/auto/corelib/codecs/qtextcodec/echo/echo.pro index 500f123f61..bf791ffc61 100644 --- a/tests/auto/corelib/codecs/qtextcodec/echo/echo.pro +++ b/tests/auto/corelib/codecs/qtextcodec/echo/echo.pro @@ -4,4 +4,3 @@ CONFIG -= app_bundle debug_and_release_target CONFIG += console -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/codecs/qtextcodec/test/test.pro b/tests/auto/corelib/codecs/qtextcodec/test/test.pro index 35b2b34690..e0a1bbd88e 100644 --- a/tests/auto/corelib/codecs/qtextcodec/test/test.pro +++ b/tests/auto/corelib/codecs/qtextcodec/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test QT = core testlib SOURCES = ../tst_qtextcodec.cpp @@ -12,4 +11,3 @@ win32 { } } TESTDATA += ../*.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index 3aa06d237d..82ed655390 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -156,7 +156,7 @@ void tst_QTextCodec::codecForName() QTextCodec *codec = QTextCodec::codecForName(hint.toLatin1()); if (actualCodecName.isEmpty()) { - QVERIFY(codec == 0); + QVERIFY(!codec); } else { QVERIFY(codec != 0); QCOMPARE(QString(codec->name()), actualCodecName); @@ -265,7 +265,7 @@ void tst_QTextCodec::fromUnicode() array is correct (no off by one, no trailing '\0'). */ QByteArray result = codec->fromUnicode(QString("abc")); - if (result.startsWith("a")) { + if (result.startsWith('a')) { QCOMPARE(result.size(), 3); QCOMPARE(result, QByteArray("abc")); } else { @@ -573,7 +573,7 @@ void tst_QTextCodec::utf8Codec_data() str = "Prohl"; str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter; - str += "e"; + str += QLatin1Char('e'); str += QChar::ReplacementCharacter; str += " plugin"; str += QChar::ReplacementCharacter; @@ -2075,7 +2075,7 @@ void tst_QTextCodec::codecForUtfText() if (detected) QCOMPARE(codec->mibEnum(), mib); else - QVERIFY(codec == 0); + QVERIFY(!codec); } #if defined(Q_OS_UNIX) diff --git a/tests/auto/corelib/codecs/utf8/utf8.pro b/tests/auto/corelib/codecs/utf8/utf8.pro index 23f8b8894e..355d890824 100644 --- a/tests/auto/corelib/codecs/utf8/utf8.pro +++ b/tests/auto/corelib/codecs/utf8/utf8.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_utf8 QT = core testlib SOURCES += tst_utf8.cpp utf8data.cpp -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/q_func_info/q_func_info.pro b/tests/auto/corelib/global/q_func_info/q_func_info.pro index aad0edf4ed..7663a880eb 100644 --- a/tests/auto/corelib/global/q_func_info/q_func_info.pro +++ b/tests/auto/corelib/global/q_func_info/q_func_info.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_q_func_info QT = core testlib SOURCES = tst_q_func_info.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qflags/qflags.pro b/tests/auto/corelib/global/qflags/qflags.pro index 7602008e22..29dfb0684c 100644 --- a/tests/auto/corelib/global/qflags/qflags.pro +++ b/tests/auto/corelib/global/qflags/qflags.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qflags QT = core testlib SOURCES = tst_qflags.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro index 34fb1a702b..c6d1100335 100644 --- a/tests/auto/corelib/global/qgetputenv/qgetputenv.pro +++ b/tests/auto/corelib/global/qgetputenv/qgetputenv.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qgetputenv QT = core testlib SOURCES = tst_qgetputenv.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp index 71a3419963..adf8172a68 100644 --- a/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp +++ b/tests/auto/corelib/global/qgetputenv/tst_qgetputenv.cpp @@ -80,7 +80,7 @@ void tst_QGetPutEnv::getSetCheck() QCOMPARE(qEnvironmentVariableIntValue(varName, &ok), 0); QVERIFY(!ok); result = qgetenv(varName); - QVERIFY(result == "supervalue"); + QCOMPARE(result, QByteArrayLiteral("supervalue")); qputenv(varName,QByteArray()); diff --git a/tests/auto/corelib/global/qglobal/qglobal.pro b/tests/auto/corelib/global/qglobal/qglobal.pro index d1c02f80e9..b8ed7761f5 100644 --- a/tests/auto/corelib/global/qglobal/qglobal.pro +++ b/tests/auto/corelib/global/qglobal/qglobal.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qglobal QT = core testlib SOURCES = tst_qglobal.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro index 7b374505ce..056d940da7 100644 --- a/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro +++ b/tests/auto/corelib/global/qglobalstatic/qglobalstatic.pro @@ -10,4 +10,3 @@ CONFIG += exceptions SOURCES += tst_qglobalstatic.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qhooks/qhooks.pro b/tests/auto/corelib/global/qhooks/qhooks.pro index f886e7d49a..a5c0d63cb9 100644 --- a/tests/auto/corelib/global/qhooks/qhooks.pro +++ b/tests/auto/corelib/global/qhooks/qhooks.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase 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 index b5930790e4..a38a396a5d 100644 --- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -46,7 +46,7 @@ private slots: void tst_QHooks::testVersion() { - QVERIFY(qtHookData[QHooks::HookDataVersion] >= 1); + QVERIFY(qtHookData[QHooks::HookDataVersion] >= 3); QCOMPARE(qtHookData[QHooks::HookDataSize], (quintptr)QHooks::LastHookIndex); QCOMPARE(qtHookData[QHooks::QtVersion], (quintptr)QT_VERSION); } diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro index 4789efc478..8ada04acdc 100644 --- a/tests/auto/corelib/global/qlogging/app/app.pro +++ b/tests/auto/corelib/global/qlogging/app/app.pro @@ -9,7 +9,6 @@ CONFIG -= app_bundle CONFIG += console SOURCES += main.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DEFINES += QT_MESSAGELOGCONTEXT gcc:!mingw:!haiku: QMAKE_LFLAGS += -rdynamic diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro index fdebf45281..df002c5728 100644 --- a/tests/auto/corelib/global/qlogging/test/test.pro +++ b/tests/auto/corelib/global/qlogging/test/test.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase CONFIG -= app_bundle debug_and_release_target contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index a65a72313f..e2370665d8 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -821,7 +821,7 @@ void tst_qmessagehandler::qMessagePattern() // test QT_MESSAGE_PATTERN // QStringList environment = m_baseEnvironment; - environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + "\""); + environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"')); process.setEnvironment(environment); process.start(appExe); diff --git a/tests/auto/corelib/global/qnumeric/qnumeric.pro b/tests/auto/corelib/global/qnumeric/qnumeric.pro index 0772ce6aab..188bb5b463 100644 --- a/tests/auto/corelib/global/qnumeric/qnumeric.pro +++ b/tests/auto/corelib/global/qnumeric/qnumeric.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qnumeric QT = core-private testlib SOURCES = tst_qnumeric.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 intel_icc: QMAKE_CXXFLAGS += -fp-model strict intel_icl: QMAKE_CXXFLAGS += /fp:strict diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 6be8ff81cf..1847056de5 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp @@ -55,6 +55,7 @@ private slots: void addOverflow(); void mulOverflow_data(); void mulOverflow(); + void signedOverflow(); }; void tst_QNumeric::fuzzyCompare_data() @@ -105,6 +106,18 @@ void tst_QNumeric::qNan() QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); QVERIFY(qIsNaN(-nan)); + + Q_STATIC_ASSERT(sizeof(double) == 8); +#ifdef Q_LITTLE_ENDIAN + const uchar bytes[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f }; +#else + const uchar bytes[] = { 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; +#endif + memcpy(&nan, bytes, 8); + QVERIFY(!qIsFinite(nan)); + QVERIFY(!qIsInf(nan)); + QVERIFY(qIsNaN(nan)); + double inf = qInf(); QVERIFY(inf > 0); QVERIFY(-inf < 0); @@ -366,5 +379,35 @@ void tst_QNumeric::mulOverflow() MulOverflowDispatch<quint64>()(); } +void tst_QNumeric::signedOverflow() +{ + const int minInt = std::numeric_limits<int>::min(); + const int maxInt = std::numeric_limits<int>::max(); + int r; + + QCOMPARE(add_overflow(minInt + 1, int(-1), &r), false); + QCOMPARE(add_overflow(minInt, int(-1), &r), true); + QCOMPARE(add_overflow(minInt, minInt, &r), true); + QCOMPARE(add_overflow(maxInt - 1, int(1), &r), false); + QCOMPARE(add_overflow(maxInt, int(1), &r), true); + QCOMPARE(add_overflow(maxInt, maxInt, &r), true); + + QCOMPARE(sub_overflow(minInt + 1, int(1), &r), false); + QCOMPARE(sub_overflow(minInt, int(1), &r), true); + QCOMPARE(sub_overflow(minInt, maxInt, &r), true); + QCOMPARE(sub_overflow(maxInt - 1, int(-1), &r), false); + QCOMPARE(sub_overflow(maxInt, int(-1), &r), true); + QCOMPARE(sub_overflow(maxInt, minInt, &r), true); + + QCOMPARE(mul_overflow(minInt, int(1), &r), false); + QCOMPARE(mul_overflow(minInt, int(-1), &r), true); + QCOMPARE(mul_overflow(minInt, int(2), &r), true); + QCOMPARE(mul_overflow(minInt, minInt, &r), true); + QCOMPARE(mul_overflow(maxInt, int(1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(-1), &r), false); + QCOMPARE(mul_overflow(maxInt, int(2), &r), true); + QCOMPARE(mul_overflow(maxInt, maxInt, &r), true); +} + QTEST_APPLESS_MAIN(tst_QNumeric) #include "tst_qnumeric.moc" diff --git a/tests/auto/corelib/global/qrand/qrand.pro b/tests/auto/corelib/global/qrand/qrand.pro index 7761b6721a..ee1430aea5 100644 --- a/tests/auto/corelib/global/qrand/qrand.pro +++ b/tests/auto/corelib/global/qrand/qrand.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qrand QT = core testlib SOURCES = tst_qrand.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/global/qtendian/qtendian.pro b/tests/auto/corelib/global/qtendian/qtendian.pro index 363b86988d..2b0af4fa4c 100644 --- a/tests/auto/corelib/global/qtendian/qtendian.pro +++ b/tests/auto/corelib/global/qtendian/qtendian.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtendian QT = core testlib SOURCES = tst_qtendian.cpp @@ -6,4 +6,3 @@ wince* { # QTBUG-37194 , internal compiler errors with MSVC2008 for Windows CE QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE -= -O2 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/largefile/largefile.pro b/tests/auto/corelib/io/largefile/largefile.pro index d9938d07d5..caef116684 100644 --- a/tests/auto/corelib/io/largefile/largefile.pro +++ b/tests/auto/corelib/io/largefile/largefile.pro @@ -4,4 +4,3 @@ QT = core testlib SOURCES = tst_largefile.cpp wince: SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro b/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro index b950f8c062..641bb7341b 100644 --- a/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro +++ b/tests/auto/corelib/io/qabstractfileengine/qabstractfileengine.pro @@ -3,4 +3,3 @@ TARGET = tst_qabstractfileengine QT = core-private core testlib SOURCES = tst_qabstractfileengine.cpp RESOURCES += qabstractfileengine.qrc -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qbuffer/qbuffer.pro b/tests/auto/corelib/io/qbuffer/qbuffer.pro index 55d91f3cde..76b1088595 100644 --- a/tests/auto/corelib/io/qbuffer/qbuffer.pro +++ b/tests/auto/corelib/io/qbuffer/qbuffer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbuffer QT = core testlib SOURCES = tst_qbuffer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp index 3b730d97f9..c4800b4e10 100644 --- a/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/corelib/io/qbuffer/tst_qbuffer.cpp @@ -378,7 +378,7 @@ void tst_QBuffer::read_rawdata() for (int i = 0; i < (int)sizeof(mydata); ++i) { QVERIFY(!buffer.atEnd()); in >> ch; - QVERIFY(ch == (quint8)mydata[i]); + QCOMPARE(ch, (quint8)mydata[i]); } QVERIFY(buffer.atEnd()); } diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 9ab2b0948d..961e1933de 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -4,7 +4,6 @@ QT += testlib SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index d9d3f55d4a..729cf6547e 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -301,7 +301,7 @@ void tst_QDataStream::cleanupTestCase() static int dataIndex(const QString &tag) { - int pos = tag.lastIndexOf("_"); + int pos = tag.lastIndexOf(QLatin1Char('_')); if (pos >= 0) { int ret = 0; QString count = tag.mid(pos + 1); @@ -338,9 +338,9 @@ void tst_QDataStream::stream_data(int noOfElements) for (int b=0; b<2; b++) { QString byte_order = b == 0 ? "BigEndian" : "LittleEndian"; - QString tag = device + "_" + byte_order; + QString tag = device + QLatin1Char('_') + byte_order; for (int e=0; e<noOfElements; e++) { - QTest::newRow(qPrintable(tag + QString("_%1").arg(e))) << device << QString(byte_order); + QTest::newRow(qPrintable(tag + QLatin1Char('_') + QString::number(e))) << device << byte_order; } } } @@ -529,7 +529,7 @@ void tst_QDataStream::readQRegExp(QDataStream *s) *s >> R; QCOMPARE(R, test); *s >> V; - QVERIFY(V.type() == QVariant::RegExp); + QCOMPARE(V.type(), QVariant::RegExp); QCOMPARE(V.toRegExp(), test); } @@ -797,7 +797,7 @@ void tst_QDataStream::readbool(QDataStream *s) bool d1; *s >> d1; - QVERIFY(d1 == expected); + QCOMPARE(d1, expected); } // ************************************ @@ -860,7 +860,7 @@ void tst_QDataStream::readQBitArray(QDataStream *s) QBitArray d1; *s >> d1; - QVERIFY(d1 == expected); + QCOMPARE(d1, expected); } // ************************************ @@ -919,7 +919,7 @@ void tst_QDataStream::readQBrush(QDataStream *s) *s >> d2; QBrush brush = qBrushData(dataIndex(QTest::currentDataTag())); - QVERIFY(d2 == brush); + QCOMPARE(d2, brush); } // ************************************ @@ -961,7 +961,7 @@ void tst_QDataStream::readQColor(QDataStream *s) QColor test(QColorData(dataIndex(QTest::currentDataTag()))); QColor d3; *s >> d3; - QVERIFY(d3 == test); + QCOMPARE(d3, test); } @@ -1057,7 +1057,7 @@ void tst_QDataStream::readQCursor(QDataStream *s) *s >> d5; QVERIFY(d5.shape() == test.shape()); //## lacks operator== - QVERIFY(d5.hotSpot() == test.hotSpot()); + QCOMPARE(d5.hotSpot(), test.hotSpot()); QVERIFY((d5.bitmap() != 0 && test.bitmap() != 0) || (d5.bitmap() == 0 && test.bitmap() == 0)); if (d5.bitmap() != 0) { QPixmap actual = *(d5.bitmap()); @@ -1120,7 +1120,7 @@ void tst_QDataStream::readQDate(QDataStream *s) QDate test(qDateData(dataIndex(QTest::currentDataTag()))); QDate d6; *s >> d6; - QVERIFY(d6 == test); + QCOMPARE(d6, test); } // ************************************ @@ -1214,7 +1214,7 @@ void tst_QDataStream::readQTime(QDataStream *s) QTime test = qTimeData(dataIndex(QTest::currentDataTag())); QTime d7; *s >> d7; - QVERIFY(d7 == test); + QCOMPARE(d7, test); } // ************************************ @@ -1264,7 +1264,7 @@ void tst_QDataStream::readQDateTime(QDataStream *s) QDateTime test(qDateTimeData(dataIndex(QTest::currentDataTag()))); QDateTime d8; *s >> d8; - QVERIFY(d8 == test); + QCOMPARE(d8, test); } // ************************************ @@ -1415,16 +1415,16 @@ void tst_QDataStream::readQImage(QDataStream *s) QImage d12; *s >> d12; - QVERIFY(d12 == ref); + QCOMPARE(d12, ref); // do some extra neurotic tests - QVERIFY(d12.size() == ref.size()); - QVERIFY(d12.isNull() == ref.isNull()); - QVERIFY(d12.width() == ref.width()); - QVERIFY(d12.height() == ref.height()); - QVERIFY(d12.depth() == ref.depth()); - QVERIFY(d12.colorCount() == ref.colorCount()); - QVERIFY(d12.hasAlphaChannel() == ref.hasAlphaChannel()); + QCOMPARE(d12.size(), ref.size()); + QCOMPARE(d12.isNull(), ref.isNull()); + QCOMPARE(d12.width(), ref.width()); + QCOMPARE(d12.height(), ref.height()); + QCOMPARE(d12.depth(), ref.depth()); + QCOMPARE(d12.colorCount(), ref.colorCount()); + QCOMPARE(d12.hasAlphaChannel(), ref.hasAlphaChannel()); } // ************************************ @@ -1518,9 +1518,9 @@ void tst_QDataStream::readQPen(QDataStream *s) QCOMPARE(d15.style(), origPen.style()); QCOMPARE(d15.width(), origPen.width()); QCOMPARE(d15.color(), origPen.color()); - QVERIFY(d15.capStyle() == origPen.capStyle()); - QVERIFY(d15.joinStyle() == origPen.joinStyle()); - QVERIFY(d15 == origPen); + QCOMPARE(d15.capStyle(), origPen.capStyle()); + QCOMPARE(d15.joinStyle(), origPen.joinStyle()); + QCOMPARE(d15, origPen); } // ************************************ @@ -1568,11 +1568,11 @@ void tst_QDataStream::readQPixmap(QDataStream *s) QPixmap d16; *s >> d16; QVERIFY(!d16.isNull() && !pm.isNull()); - QVERIFY(d16.width() == pm.width()); - QVERIFY(d16.height() == pm.height()); - QVERIFY(d16.size() == pm.size()); - QVERIFY(d16.rect() == pm.rect()); - QVERIFY(d16.depth() == pm.depth()); + QCOMPARE(d16.width(), pm.width()); + QCOMPARE(d16.height(), pm.height()); + QCOMPARE(d16.size(), pm.size()); + QCOMPARE(d16.rect(), pm.rect()); + QCOMPARE(d16.depth(), pm.depth()); } void tst_QDataStream::writeQIcon(QDataStream *s) @@ -1639,11 +1639,11 @@ void tst_QDataStream::readQPoint(QDataStream *s) QPoint ref(qPointData(dataIndex(QTest::currentDataTag()))); QPoint d17; *s >> d17; - QVERIFY(d17 == ref); + QCOMPARE(d17, ref); QPointF d17f; *s >> d17f; - QVERIFY(d17f == QPointF(ref)); + QCOMPARE(d17f, QPointF(ref)); } // ************************************ @@ -1691,11 +1691,11 @@ void tst_QDataStream::readQRect(QDataStream *s) QRect ref(qRectData(dataIndex(QTest::currentDataTag()))); QRect d18; *s >> d18; - QVERIFY(d18 == ref); + QCOMPARE(d18, ref); QRectF d18f; *s >> d18f; - QVERIFY(d18f == QRectF(ref)); + QCOMPARE(d18f, QRectF(ref)); } // ************************************ @@ -1804,11 +1804,11 @@ void tst_QDataStream::readQPolygon(QDataStream *s) QPolygon ref(qPolygonData(dataIndex(QTest::currentDataTag()))); QPolygon d19; *s >> d19; - QVERIFY(d19 == ref); + QCOMPARE(d19, ref); QPolygonF d19f; *s >> d19f; - QVERIFY(d19f == QPolygonF(ref)); + QCOMPARE(d19f, QPolygonF(ref)); } // ************************************ @@ -1868,7 +1868,7 @@ void tst_QDataStream::readQRegion(QDataStream *s) QRegion ref(qRegionData(dataIndex(QTest::currentDataTag()))); QRegion r; *s >> r; - QVERIFY(r == ref); + QCOMPARE(r, ref); } // ************************************ @@ -1916,11 +1916,11 @@ void tst_QDataStream::readQSize(QDataStream *s) QSize ref(qSizeData(dataIndex(QTest::currentDataTag()))); QSize d21; *s >> d21; - QVERIFY(d21 == ref); + QCOMPARE(d21, ref); QSizeF d21f; *s >> d21f; - QVERIFY(d21f == QSizeF(ref)); + QCOMPARE(d21f, QSizeF(ref)); } // *********************** atEnd ****************************** @@ -2072,7 +2072,7 @@ void tst_QDataStream::setVersion_data() QDataStream latest; for (int vers = 1; vers <= latest.version(); ++vers) - QTest::newRow(qPrintable(QString("v_%1").arg(vers))) << vers; + QTest::newRow(("v_" + QByteArray::number(vers)).constData()) << vers; } void tst_QDataStream::setVersion() @@ -2096,13 +2096,13 @@ void tst_QDataStream::setVersion() QDataStream in(&ba1, QIODevice::ReadOnly); in.setVersion(vers); in >> keyseq1 >> keyseq2 >> deadbeef; - QVERIFY(keyseq1 == QKeySequence(Qt::Key_A)); + QCOMPARE(keyseq1, QKeySequence(Qt::Key_A)); if (vers >= 5) { QVERIFY(keyseq2 == QKeySequence(Qt::Key_B, Qt::Key_C)); } else { - QVERIFY(keyseq2 == QKeySequence(Qt::Key_B)); + QCOMPARE(keyseq2, QKeySequence(Qt::Key_B)); } - QVERIFY(deadbeef == 0xDEADBEEF); + QCOMPARE(deadbeef, 0xDEADBEEF); } /* @@ -2111,7 +2111,7 @@ void tst_QDataStream::setVersion() // revise the test if new color roles or color groups are added QVERIFY(QPalette::NColorRoles == QPalette::ToolTipText + 1); - QVERIFY(QPalette::NColorGroups == 3); + QCOMPARE(int(QPalette::NColorGroups), 3); QByteArray ba2; QPalette pal1, pal2; @@ -2176,8 +2176,8 @@ void tst_QDataStream::setVersion() } } } - QVERIFY(pal1 == inPal1); - QVERIFY(pal2 == inPal2); + QCOMPARE(pal1, inPal1); + QCOMPARE(pal2, inPal2); } } } @@ -3062,9 +3062,9 @@ void tst_QDataStream::compatibility_Qt3() in >> in_palette; in >> in_brush; } - QVERIFY(in_brush.style() == Qt::NoBrush); - QVERIFY(in_palette.brush(QPalette::Button).style() == Qt::NoBrush); - QVERIFY(in_palette.color(QPalette::Light) == Qt::green); + QCOMPARE(in_brush.style(), Qt::NoBrush); + QCOMPARE(in_palette.brush(QPalette::Button).style(), Qt::NoBrush); + QCOMPARE(in_palette.color(QPalette::Light), QColor(Qt::green)); } } @@ -3094,9 +3094,9 @@ void tst_QDataStream::compatibility_Qt2() in >> in_palette; in >> in_brush; } - QVERIFY(in_brush.style() == Qt::NoBrush); - QVERIFY(in_palette.brush(QPalette::Button).style() == Qt::NoBrush); - QVERIFY(in_palette.color(QPalette::Light) == Qt::green); + QCOMPARE(in_brush.style(), Qt::NoBrush); + QCOMPARE(in_palette.brush(QPalette::Button).style(), Qt::NoBrush); + QCOMPARE(in_palette.color(QPalette::Light), QColor(Qt::green)); } void tst_QDataStream::floatingPointNaN() diff --git a/tests/auto/corelib/io/qdataurl/qdataurl.pro b/tests/auto/corelib/io/qdataurl/qdataurl.pro index d21fc4ed15..7085c9d881 100644 --- a/tests/auto/corelib/io/qdataurl/qdataurl.pro +++ b/tests/auto/corelib/io/qdataurl/qdataurl.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdataurl QT = core core-private testlib SOURCES = tst_qdataurl.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qdebug/qdebug.pro b/tests/auto/corelib/io/qdebug/qdebug.pro index 5e902bb105..45c0aa4061 100644 --- a/tests/auto/corelib/io/qdebug/qdebug.pro +++ b/tests/auto/corelib/io/qdebug/qdebug.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdebug QT = core testlib concurrent SOURCES = tst_qdebug.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index 0adc7e0450..26bc60a731 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -5,7 +5,6 @@ SOURCES = tst_qdir.cpp RESOURCES += qdir.qrc TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android:!android-no-sdk { RESOURCES += android_testdata.qrc diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index ae6fe7eaef..008293a15e 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -556,7 +556,7 @@ void tst_QDir::exists_data() char drive = 'Z'; QString driv; do { - driv = QString::fromLatin1("%1:/").arg(drive); + driv = drive + QLatin1String(":/"); if (!driveLetters.contains(driv)) break; --drive; } while (drive >= 'A'); @@ -621,7 +621,7 @@ void tst_QDir::compare() dir.makeAbsolute(); QVERIFY(dir == QDir::currentPath()); - QVERIFY(QDir() == QDir(QDir::currentPath())); + QCOMPARE(QDir(), QDir(QDir::currentPath())); QVERIFY(QDir("../") == QDir(QDir::currentPath() + "/..")); } @@ -1058,7 +1058,7 @@ void tst_QDir::current() if (!path.isEmpty()) { bool b = QDir::setCurrent(path); // If path is non existent, then setCurrent should be false (currentDir is empty in testData) - QVERIFY(b == !currentDir.isEmpty()); + QCOMPARE(b, !currentDir.isEmpty()); } if (!currentDir.isEmpty()) { QDir newCurrent = QDir::current(); @@ -1080,7 +1080,7 @@ void tst_QDir::cd_data() QTest::addColumn<bool>("successExpected"); QTest::addColumn<QString>("newDir"); - int index = m_dataPath.lastIndexOf("/"); + int index = m_dataPath.lastIndexOf(QLatin1Char('/')); QTest::newRow("cdUp") << m_dataPath << ".." << true << m_dataPath.left(index==0?1:index); QTest::newRow("cdUp non existent (relative dir)") << "anonexistingDir" << ".." << true << m_dataPath; @@ -1124,11 +1124,11 @@ void tst_QDir::setNameFilters_data() QTest::newRow("spaces2") << m_dataPath + "/testdir/spaces" << QStringList("*.bar") << QStringList("foo.bar"); QTest::newRow("spaces3") << m_dataPath + "/testdir/spaces" << QStringList("foo.*") - << QString("foo. bar,foo.bar").split(","); - QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(" ") - << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(","); + << QString("foo. bar,foo.bar").split(QLatin1Char(',')); + QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(QLatin1Char(' ')) + << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(QLatin1Char(',')); QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data") - << QString("file1.data,file2.data,file3.data").split(','); + << QString("file1.data,file2.data,file3.data").split(QLatin1Char(',')); } void tst_QDir::setNameFilters() @@ -1695,7 +1695,7 @@ void tst_QDir::searchPaths() QDir::setSearchPaths(searchPathPrefixList.at(i), searchPathsList.at(i).split(",")); } for (int i = 0; i < searchPathPrefixList.count(); ++i) { - QVERIFY(QDir::searchPaths(searchPathPrefixList.at(i)) == searchPathsList.at(i).split(",")); + QCOMPARE(QDir::searchPaths(searchPathPrefixList.at(i)), searchPathsList.at(i).split(",")); } QCOMPARE(QFile(filename).exists(), exists); @@ -1718,7 +1718,7 @@ void tst_QDir::searchPaths() } } for (int i = 0; i < searchPathPrefixList.count(); ++i) { - QVERIFY(QDir::searchPaths(searchPathPrefixList.at(i)) == searchPathsList.at(i).split(",")); + QCOMPARE(QDir::searchPaths(searchPathPrefixList.at(i)), searchPathsList.at(i).split(",")); } QCOMPARE(QFile(filename).exists(), exists); diff --git a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro index a2429bf2f0..2b50f97ac5 100644 --- a/tests/auto/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/auto/corelib/io/qdiriterator/qdiriterator.pro @@ -7,6 +7,5 @@ RESOURCES += qdiriterator.qrc TESTDATA += entrylist wince*mips*|wincewm50smart-msvc200*: DEFINES += WINCE_BROKEN_ITERATE=1 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 6b1719ad53..9e368515e4 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -538,7 +538,7 @@ void tst_QDirIterator::recurseWithFilters() const QVERIFY(it.hasNext()); it.next(); actualEntries.insert(it.fileInfo().filePath()); - QVERIFY(actualEntries == expectedEntries); + QCOMPARE(actualEntries, expectedEntries); QVERIFY(!it.hasNext()); } diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro index e2c714c67f..10c8d918f7 100644 --- a/tests/auto/corelib/io/qfile/qfile.pro +++ b/tests/auto/corelib/io/qfile/qfile.pro @@ -5,4 +5,3 @@ wince* { SUBDIRS = test stdinprocess } -CONFIG += parallel_test diff --git a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro index 51badce898..8e463e4cef 100644 --- a/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro +++ b/tests/auto/corelib/io/qfile/stdinprocess/stdinprocess.pro @@ -6,4 +6,3 @@ CONFIG += console # This app is testdata for tst_qfile target.path = $$[QT_INSTALL_TESTS]/tst_qfile/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index 9aa4119795..c9ba96cc1b 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle debug_and_release_target QT = core-private core testlib qtHaveModule(network): QT += network @@ -17,4 +16,3 @@ TESTDATA += ../dosfile.txt ../noendofline.txt ../testfile.txt \ ../resources/file1.ext1 win32:!winrt: LIBS+=-lole32 -luuid -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 1c695a1113..b4140e1115 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -849,7 +849,7 @@ void tst_QFile::readAll() QByteArray a = file.readAll(); file.reset(); - QVERIFY(file.pos() == 0); + QCOMPARE(file.pos(), 0); QVERIFY(file.bytesAvailable() > 7); QByteArray b = file.read(1); @@ -1195,7 +1195,7 @@ void tst_QFile::append() f.close(); QVERIFY2(f.open(QIODevice::Append), msgOpenFailed(f).constData()); - QVERIFY(f.pos() == 1); + QCOMPARE(f.pos(), 1); f.putChar('a'); f.close(); QCOMPARE(int(f.size()), 2); @@ -2047,7 +2047,7 @@ void tst_QFile::longFileName() QString line = ts.readLine(); QCOMPARE(line, fileName); } - QString newName = fileName + QLatin1String("1"); + QString newName = fileName + QLatin1Char('1'); { QVERIFY(QFile::copy(fileName, newName)); QFile file(newName); @@ -2224,7 +2224,7 @@ void tst_QFile::removeOpenFile() QVERIFY(removed); QVERIFY(!f.isOpen()); QVERIFY(!f.exists()); - QVERIFY(f.error() == QFile::NoError); + QCOMPARE(f.error(), QFile::NoError); } { @@ -2251,7 +2251,7 @@ void tst_QFile::removeOpenFile() QVERIFY(removed); QVERIFY(!f.isOpen()); QVERIFY(!f.exists()); - QVERIFY(f.error() == QFile::NoError); + QCOMPARE(f.error(), QFile::NoError); } } @@ -2819,13 +2819,13 @@ void tst_QFile::readEof() char buf[10]; int ret = file.read(buf, sizeof buf); QCOMPARE(ret, 0); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); // Do it again to ensure that we get the same result ret = file.read(buf, sizeof buf); QCOMPARE(ret, 0); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); } @@ -2840,13 +2840,13 @@ void tst_QFile::readEof() QByteArray ret = file.read(10); QVERIFY(ret.isEmpty()); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); // Do it again to ensure that we get the same result ret = file.read(10); QVERIFY(ret.isEmpty()); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); } @@ -2862,13 +2862,13 @@ void tst_QFile::readEof() char buf[10]; int ret = file.readLine(buf, sizeof buf); QCOMPARE(ret, -1); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); // Do it again to ensure that we get the same result ret = file.readLine(buf, sizeof buf); QCOMPARE(ret, -1); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); } @@ -2883,13 +2883,13 @@ void tst_QFile::readEof() QByteArray ret = file.readLine(); QVERIFY(ret.isNull()); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); // Do it again to ensure that we get the same result ret = file.readLine(); QVERIFY(ret.isNull()); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); } @@ -2904,12 +2904,12 @@ void tst_QFile::readEof() char c; QVERIFY(!file.getChar(&c)); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); // Do it again to ensure that we get the same result QVERIFY(!file.getChar(&c)); - QVERIFY(file.error() == QFile::NoError); + QCOMPARE(file.error(), QFile::NoError); QVERIFY(file.atEnd()); } } @@ -2997,7 +2997,7 @@ void tst_QFile::map() memory = file.map(offset, size); QCOMPARE(file.error(), QFile::NoError); QVERIFY(memory); - QVERIFY(memory[0] == 'Q'); + QCOMPARE(memory[0], uchar('Q')); QVERIFY(file.unmap(memory)); QCOMPARE(file.error(), QFile::NoError); diff --git a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro index 571637be37..8aa81896cc 100644 --- a/tests/auto/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/auto/corelib/io/qfileinfo/qfileinfo.pro @@ -6,6 +6,5 @@ RESOURCES += qfileinfo.qrc \ testdata.qrc win32:!wince:!winrt:LIBS += -ladvapi32 -lnetapi32 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 win32: CONFIG += insignificant_test # Crashes on Windows in release builds diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 210fdb5a12..1d49c8e3b9 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1097,7 +1097,7 @@ void tst_QFileInfo::consistent() QFileInfo fi(file); QCOMPARE(fi.filePath(), expected); - QCOMPARE(fi.dir().path() + "/" + fi.fileName(), expected); + QCOMPARE(fi.dir().path() + QLatin1Char('/') + fi.fileName(), expected); } @@ -1429,7 +1429,7 @@ void tst_QFileInfo::refresh() QCOMPARE(file.write("JOJOJO"), qint64(6)); file.flush(); - QVERIFY(info.lastModified() == lastModified); + QCOMPARE(info.lastModified(), lastModified); QCOMPARE(info.size(), qint64(7)); #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) diff --git a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.pro b/tests/auto/corelib/io/qfileselector/qfileselector.pro index ded3d6502e..edcc91e8ed 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.pro +++ b/tests/auto/corelib/io/qfileselector/qfileselector.pro @@ -1,4 +1,3 @@ -CONFIG += parallel_test CONFIG += testcase TARGET = tst_qfileselectors QT = core-private testlib diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index 6e2699774d..47ace78528 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -14,7 +14,6 @@ <!-- platforms/test: deepest possible selection --> <file>platforms/test</file> <file>platforms/+unix/+android/test</file> - <file>platforms/+unix/+blackberry/test</file> <file>platforms/+unix/+darwin/+mac/+ios/test</file> <file>platforms/+unix/+darwin/+mac/+osx/test</file> <file>platforms/+unix/+darwin/+mac/test</file> @@ -26,7 +25,6 @@ <file>platforms/+windows/+winnt/test</file> <file>platforms/+windows/test</file> <file>platforms/+android/test</file> - <file>platforms/+blackberry/test</file> <file>platforms/+ios/test</file> <file>platforms/+osx/test</file> <file>platforms/+darwin/test</file> @@ -38,7 +36,6 @@ <!-- platforms/test2: shallow selection for the deepest selector --> <file>platforms/test2</file> <file>platforms/+android/test2</file> - <file>platforms/+blackberry/test2</file> <file>platforms/+ios/test2</file> <file>platforms/+osx/test2</file> <file>platforms/+haiku/test2</file> diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index 87381f4c4e..4da3419741 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -88,7 +88,7 @@ void tst_QFileSelector::basicTest_data() QString expectedPlatform1File(":/platforms"); QString expectedPlatform2File(""); //Only the last selector QString expectedPlatform3File; // Only the first selector (the family) -#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && \ +#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && \ !defined(Q_OS_DARWIN) && !defined(Q_OS_LINUX) && !defined(Q_OS_HAIKU) /* We are only aware of specific unixes, and do not have test files for any of the others. However those unixes can get a selector added from the result of a uname call, so this will diff --git a/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro b/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro index 99d3af1848..474836fba2 100644 --- a/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro +++ b/tests/auto/corelib/io/qfilesystementry/qfilesystementry.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qfilesystementry QT = core-private testlib SOURCES = tst_qfilesystementry.cpp \ $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry.cpp HEADERS = $$QT_SOURCE_TREE/src/corelib/io/qfilesystementry_p.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro b/tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro index 1faa089c6e..46dd70289b 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro +++ b/tests/auto/corelib/io/qfilesystemwatcher/qfilesystemwatcher.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qfilesystemwatcher QT = core testlib SOURCES = tst_qfilesystemwatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 026743257c..e8bbaa1b25 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -731,9 +731,10 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved() QString movePath = testDir.filePath("movehere"); for (int i = 0; i < fileCount; ++i) { - QFile f(testDir.filePath(QString("test%1.txt").arg(i))); + const QByteArray iB = QByteArray::number(i); + QFile f(testDir.filePath(QLatin1String("test") + QString::fromLatin1(iB) + QLatin1String(".txt"))); QVERIFY(f.open(QIODevice::WriteOnly)); - f.write(QByteArray("i am ") + QByteArray::number(i)); + f.write(QByteArray("i am ") + iB); f.close(); } diff --git a/tests/auto/corelib/io/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro index 9fd70fb177..78f5b5e75d 100644 --- a/tests/auto/corelib/io/qiodevice/qiodevice.pro +++ b/tests/auto/corelib/io/qiodevice/qiodevice.pro @@ -5,7 +5,6 @@ SOURCES = tst_qiodevice.cpp TESTDATA += tst_qiodevice.cpp MOC_DIR=tmp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android:!android-no-sdk: { RESOURCES += \ diff --git a/tests/auto/corelib/io/qipaddress/qipaddress.pro b/tests/auto/corelib/io/qipaddress/qipaddress.pro index ff569aa3d5..9c769052ed 100644 --- a/tests/auto/corelib/io/qipaddress/qipaddress.pro +++ b/tests/auto/corelib/io/qipaddress/qipaddress.pro @@ -1,5 +1,4 @@ SOURCES += tst_qipaddress.cpp TARGET = tst_qipaddress QT = core core-private testlib -CONFIG += testcase parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +CONFIG += testcase diff --git a/tests/auto/corelib/io/qnodebug/qnodebug.pro b/tests/auto/corelib/io/qnodebug/qnodebug.pro index ff8e09b84b..7e35f92474 100644 --- a/tests/auto/corelib/io/qnodebug/qnodebug.pro +++ b/tests/auto/corelib/io/qnodebug/qnodebug.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qnodebug QT = core testlib SOURCES = tst_qnodebug.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index 5ece9190a5..304cf7b551 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -69,8 +69,9 @@ void tst_QNoDebug::noDebugOutput() const void tst_QNoDebug::streaming() const { QDateTime dt(QDate(1,2,3),QTime(4,5,6)); - const QString debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")); - QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(%1 Qt::TimeSpec(LocalTime))").arg(debugString))); + const QByteArray debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")).toLatin1(); + const QByteArray message = "QDateTime(" + debugString + " Qt::TimeSpec(LocalTime))"; + QTest::ignoreMessage(QtWarningMsg, message.constData()); qWarning() << dt; } diff --git a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro index 2f409ebdbc..e46e7e1100 100644 --- a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro +++ b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle debug_and_release_target QT = core testlib SOURCES = tst_qprocessnoapplication.cpp diff --git a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro index 55e9b05d1a..947dc916f2 100644 --- a/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro +++ b/tests/auto/corelib/io/qprocess/fileWriterProcess/fileWriterProcess.pro @@ -3,4 +3,3 @@ CONFIG += console CONFIG -= app_bundle QT = core DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/test/test.pro b/tests/auto/corelib/io/qprocess/test/test.pro index f77dacc87b..96d105a4b4 100644 --- a/tests/auto/corelib/io/qprocess/test/test.pro +++ b/tests/auto/corelib/io/qprocess/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle debug_and_release_target QT = core-private testlib network SOURCES = ../tst_qprocess.cpp @@ -19,4 +18,3 @@ TEST_HELPER_INSTALLS += \ "../testProcessSpacesArgs/one space" \ "../testProcessSpacesArgs/two space s" \ "../test Space In Name/testSpaceInName" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro index 961b28ec7d..8d1fcba624 100644 --- a/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro +++ b/tests/auto/corelib/io/qprocess/testDetached/testDetached.pro @@ -4,4 +4,3 @@ CONFIG += console CONFIG -= app_bundle INSTALLS = DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro index 049454abe2..b08371804f 100644 --- a/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro +++ b/tests/auto/corelib/io/qprocess/testExitCodes/testExitCodes.pro @@ -3,4 +3,3 @@ CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro index d3439072bb..8778da7ffe 100644 --- a/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro +++ b/tests/auto/corelib/io/qprocess/testGuiProcess/testGuiProcess.pro @@ -3,4 +3,3 @@ QT += widgets CONFIG += console CONFIG -= app_bundle DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro index f7c57abc37..7ccc976efc 100644 --- a/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro +++ b/tests/auto/corelib/io/qprocess/testProcessCrash/testProcessCrash.pro @@ -3,4 +3,3 @@ CONFIG += console CONFIG -= qt app_bundle DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro index 56b4642bed..fbb3411d47 100644 --- a/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro +++ b/tests/auto/corelib/io/qprocess/testProcessDeadWhileReading/testProcessDeadWhileReading.pro @@ -3,4 +3,3 @@ CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro index 8f77e46f74..98fe78c8b9 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro @@ -4,4 +4,3 @@ CONFIG += console win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS- DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro index 3940ddbf98..e236e05c7d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho/testProcessEcho.pro @@ -2,4 +2,3 @@ SOURCES = main.cpp CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro index 3940ddbf98..e236e05c7d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho2/testProcessEcho2.pro @@ -2,4 +2,3 @@ SOURCES = main.cpp CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro index 3940ddbf98..e236e05c7d 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEcho3/testProcessEcho3.pro @@ -2,4 +2,3 @@ SOURCES = main.cpp CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro index 962c1122c1..a07ae00605 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEnvironment/testProcessEnvironment.pro @@ -6,4 +6,3 @@ DESTDIR = ./ mac { CONFIG -= app_bundle } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro index f7bb0985a3..c6db9d1bac 100644 --- a/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro +++ b/tests/auto/corelib/io/qprocess/testProcessNormal/testProcessNormal.pro @@ -3,5 +3,4 @@ CONFIG += console CONFIG -= qt app_bundle DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT = core diff --git a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro index 2de4534896..95191098bd 100644 --- a/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro +++ b/tests/auto/corelib/io/qprocess/testProcessOutput/testProcessOutput.pro @@ -2,5 +2,4 @@ SOURCES = main.cpp CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT = core diff --git a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro index d425d5569e..21a115b536 100644 --- a/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro +++ b/tests/auto/corelib/io/qprocess/testSetWorkingDirectory/testSetWorkingDirectory.pro @@ -2,5 +2,4 @@ SOURCES = main.cpp CONFIG += console CONFIG -= app_bundle DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT = core diff --git a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro index b59241851f..d19a631cae 100644 --- a/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro +++ b/tests/auto/corelib/io/qprocess/testSoftExit/testSoftExit.pro @@ -9,5 +9,4 @@ unix { CONFIG -= qt app_bundle CONFIG += console DESTDIR = ./ -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT = core diff --git a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro index b7213ae507..afa4f32a85 100644 --- a/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro +++ b/tests/auto/corelib/io/qprocess/testSpaceInName/testSpaceInName.pro @@ -6,5 +6,4 @@ DESTDIR = "../test Space In Name" mac { CONFIG -= app_bundle } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 QT = core diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 712e3440d8..1c639c94a8 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -840,11 +840,11 @@ void tst_QProcess::openModes() { QProcess proc; QVERIFY(!proc.isOpen()); - QVERIFY(proc.openMode() == QProcess::NotOpen); + QCOMPARE(proc.openMode(), QProcess::NotOpen); proc.start("testProcessEcho3/testProcessEcho3"); QVERIFY(proc.waitForStarted(5000)); QVERIFY(proc.isOpen()); - QVERIFY(proc.openMode() == QProcess::ReadWrite); + QCOMPARE(proc.openMode(), QProcess::ReadWrite); QVERIFY(proc.isReadable()); QVERIFY(proc.isWritable()); @@ -853,7 +853,7 @@ void tst_QProcess::openModes() proc.closeWriteChannel(); QVERIFY(proc.isWritable()); - QVERIFY(proc.openMode() == QProcess::ReadWrite); + QCOMPARE(proc.openMode(), QProcess::ReadWrite); while (proc.bytesAvailable() < 4 && proc.waitForReadyRead(5000)) { } @@ -862,12 +862,12 @@ void tst_QProcess::openModes() proc.closeReadChannel(QProcess::StandardOutput); - QVERIFY(proc.openMode() == QProcess::ReadWrite); + QCOMPARE(proc.openMode(), QProcess::ReadWrite); QVERIFY(proc.isReadable()); proc.closeReadChannel(QProcess::StandardError); - QVERIFY(proc.openMode() == QProcess::ReadWrite); + QCOMPARE(proc.openMode(), QProcess::ReadWrite); QVERIFY(proc.isReadable()); proc.close(); @@ -1439,11 +1439,11 @@ void tst_QProcess::spaceArgsTest() QCOMPARE(actual, args); #endif - if (program.contains(" ")) - program = "\"" + program + "\""; + if (program.contains(QLatin1Char(' '))) + program = QLatin1Char('"') + program + QLatin1Char('"'); if (!stringArgs.isEmpty()) - program += QString::fromLatin1(" ") + stringArgs; + program += QLatin1Char(' ') + stringArgs; errorMessage.clear(); process.start(program); @@ -1496,9 +1496,9 @@ void tst_QProcess::nativeArguments() char buf[256]; fgets(buf, 256, file); fclose(file); - QStringList actual = QString::fromLatin1(buf).split("|"); + QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|')); #else - QStringList actual = QString::fromLatin1(proc.readAll()).split("|"); + QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|')); #endif QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. @@ -2300,6 +2300,13 @@ void tst_QProcess::setNonExistentWorkingDirectory() QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); #endif QCOMPARE(int(process.error()), int(QProcess::FailedToStart)); + +#ifdef Q_OS_UNIX +# ifdef QPROCESS_USE_SPAWN + QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); +# endif + QVERIFY2(process.errorString().startsWith("chdir:"), process.errorString().toLocal8Bit()); +#endif } #endif diff --git a/tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro b/tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro index 760fa11b9e..04cef29a64 100644 --- a/tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro +++ b/tests/auto/corelib/io/qprocessenvironment/qprocessenvironment.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qprocessenvironment QT = core testlib SOURCES = tst_qprocessenvironment.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index 2099101a91..2bf2696639 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -57,25 +57,25 @@ private slots: void tst_QProcessEnvironment::operator_eq() { QProcessEnvironment e1; - QVERIFY(e1 == e1); + QCOMPARE(e1, e1); e1.clear(); - QVERIFY(e1 == e1); + QCOMPARE(e1, e1); e1 = QProcessEnvironment(); QProcessEnvironment e2; - QVERIFY(e1 == e2); + QCOMPARE(e1, e2); e1.clear(); - QVERIFY(e1 == e2); + QCOMPARE(e1, e2); e2.clear(); - QVERIFY(e1 == e2); + QCOMPARE(e1, e2); e1.insert("FOO", "bar"); QVERIFY(e1 != e2); e2.insert("FOO", "bar"); - QVERIFY(e1 == e2); + QCOMPARE(e1, e2); e2.insert("FOO", "baz"); QVERIFY(e1 != e2); @@ -212,7 +212,7 @@ void tst_QProcessEnvironment::insertEnv() e3.insert(e3); // mustn't deadlock - QVERIFY(e3 == e2); + QCOMPARE(e3, e2); } void tst_QProcessEnvironment::caseSensitivity() diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index 64f5cb46e0..e8b82b4df7 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qresourceengine load(resources) QT = core testlib @@ -16,7 +16,6 @@ TESTDATA += \ parentdir.txt \ testqrc/* GENERATED_TESTDATA = $${runtime_resource.target} -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android:!android-no-sdk { RESOURCES += android_testdata.qrc diff --git a/tests/auto/corelib/io/qsavefile/qsavefile.pro b/tests/auto/corelib/io/qsavefile/qsavefile.pro index 36db000fa7..dd22d69ce6 100644 --- a/tests/auto/corelib/io/qsavefile/qsavefile.pro +++ b/tests/auto/corelib/io/qsavefile/qsavefile.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsavefile QT = core testlib SOURCES = tst_qsavefile.cpp diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 19155cc3ad..602fad5a5f 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -121,6 +121,7 @@ private slots: void testEmptyKey(); void testResourceFiles(); void testRegistryShortRootNames(); + void testRegistry32And64Bit(); void trailingWhitespace(); #ifdef Q_OS_MAC void fileName(); @@ -276,8 +277,8 @@ void tst_QSettings::initTestCase() , Qt::CaseInsensitive #endif ); - QVERIFY(custom1 == QSettings::CustomFormat1); - QVERIFY(custom2 == QSettings::CustomFormat2); + QCOMPARE(custom1, QSettings::CustomFormat1); + QCOMPARE(custom2, QSettings::CustomFormat2); cleanupTestFiles(); } @@ -357,30 +358,29 @@ void tst_QSettings::ctor() QSettings settings8(format, QSettings::SystemScope, "software.org"); // test QSettings::format() while we're at it - QVERIFY(settings1.format() == format); - QVERIFY(settings2.format() == format); - QVERIFY(settings3.format() == format); - QVERIFY(settings4.format() == format); + QCOMPARE(settings1.format(), format); + QCOMPARE(settings2.format(), format); + QCOMPARE(settings3.format(), format); + QCOMPARE(settings4.format(), format); // test QSettings::scope() while we're at it - QVERIFY(settings1.scope() == QSettings::UserScope); - QVERIFY(settings2.scope() == QSettings::UserScope); - QVERIFY(settings3.scope() == QSettings::SystemScope); - QVERIFY(settings4.scope() == QSettings::SystemScope); + QCOMPARE(settings1.scope(), QSettings::UserScope); + QCOMPARE(settings2.scope(), QSettings::UserScope); + QCOMPARE(settings3.scope(), QSettings::SystemScope); + QCOMPARE(settings4.scope(), QSettings::SystemScope); // test QSettings::organizationName() while we're at it - QVERIFY(settings1.organizationName() == "software.org"); - QVERIFY(settings2.organizationName() == "software.org"); - QVERIFY(settings3.organizationName() == "software.org"); - QVERIFY(settings4.organizationName() == "software.org"); + QCOMPARE(settings1.organizationName(), QLatin1String("software.org")); + QCOMPARE(settings2.organizationName(), QLatin1String("software.org")); + QCOMPARE(settings3.organizationName(), QLatin1String("software.org")); + QCOMPARE(settings4.organizationName(), QLatin1String("software.org")); // test QSettings::applicationName() while we're at it QCOMPARE(settings1.applicationName(), QString("KillerAPP")); QVERIFY(settings2.applicationName().isEmpty()); - QVERIFY(settings3.applicationName() == "KillerAPP"); + QCOMPARE(settings3.applicationName(), QLatin1String("KillerAPP")); QVERIFY(settings4.applicationName().isEmpty()); -#if !defined(Q_OS_BLACKBERRY) /* Go forwards. */ @@ -437,22 +437,6 @@ void tst_QSettings::ctor() QCOMPARE(settings2.value("key 1").toString(), QString("bilboh")); QCOMPARE(settings3.value("key 1").toString(), QString("catha")); QCOMPARE(settings4.value("key 1").toString(), QString("quirko")); -#else - /* - No fallback mechanism and a single scope on Blackberry OS - */ - settings2.setValue("key 1", QString("whoa")); - QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); - QCOMPARE(settings4.value("key 1").toString(), QString("whoa")); - QVERIFY(!settings1.contains("key 1")); - QVERIFY(!settings3.contains("key 1")); - - settings1.setValue("key 1", QString("blah")); - QCOMPARE(settings1.value("key 1").toString(), QString("blah")); - QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); - QCOMPARE(settings3.value("key 1").toString(), QString("blah")); - QCOMPARE(settings4.value("key 1").toString(), QString("whoa")); -#endif /* Test the copies again. @@ -489,17 +473,10 @@ void tst_QSettings::ctor() QSettings settings3(format, QSettings::SystemScope, "software.org", "KillerAPP"); QSettings settings4(format, QSettings::SystemScope, "software.org"); -#if !defined(Q_OS_BLACKBERRY) QCOMPARE(settings1.value("key 1").toString(), QString("gurgle")); QCOMPARE(settings2.value("key 1").toString(), QString("bilboh")); QCOMPARE(settings3.value("key 1").toString(), QString("catha")); QCOMPARE(settings4.value("key 1").toString(), QString("quirko")); -#else - QCOMPARE(settings1.value("key 1").toString(), QString("blah")); - QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); - QCOMPARE(settings3.value("key 1").toString(), QString("blah")); - QCOMPARE(settings4.value("key 1").toString(), QString("whoa")); -#endif /* Test problem keys. @@ -553,7 +530,7 @@ void tst_QSettings::ctor() settings1.endGroup(); // test QSettings::scope() while we're at it - QVERIFY(settings1.scope() == QSettings::UserScope); + QCOMPARE(settings1.scope(), QSettings::UserScope); // test QSettings::organizationName() while we're at it QVERIFY(settings1.organizationName().isEmpty()); @@ -628,20 +605,20 @@ void tst_QSettings::ctor() QCOMPARE(settings2.status(), QSettings::NoError); // test QSettings::format() while we're at it - QVERIFY(settings.format() == format); - QVERIFY(settings2.format() == format); + QCOMPARE(settings.format(), format); + QCOMPARE(settings2.format(), format); // test QSettings::scope() while we're at it - QVERIFY(settings.scope() == QSettings::UserScope); - QVERIFY(settings2.scope() == QSettings::UserScope); + QCOMPARE(settings.scope(), QSettings::UserScope); + QCOMPARE(settings2.scope(), QSettings::UserScope); // test QSettings::organizationName() while we're at it QVERIFY(settings.organizationName().isEmpty()); - QVERIFY(settings2.organizationName() == "software.org"); + QCOMPARE(settings2.organizationName(), QLatin1String("software.org")); // test QSettings::applicationName() while we're at it QVERIFY(settings.applicationName().isEmpty()); - QVERIFY(settings2.applicationName() == "KillerAPP"); + QCOMPARE(settings2.applicationName(), QLatin1String("KillerAPP")); } } @@ -1187,16 +1164,16 @@ void tst_QSettings::remove() { QSettings settings0(QSettings::UserScope, "software.org", "KillerAPP"); int initialNumKeys = settings0.allKeys().size(); - QCOMPARE(settings0.value("key 1", "123").toString(), QString("123")); + QCOMPARE(settings0.value("key 1", "123").toString(), QLatin1String("123")); settings0.remove("key 1"); - QCOMPARE(settings0.value("key 1", "456").toString(), QString("456")); + QCOMPARE(settings0.value("key 1", "456").toString(), QLatin1String("456")); settings0.setValue("key 1", "bubloo"); - QCOMPARE(settings0.value("key 1").toString(), QString("bubloo")); + QCOMPARE(settings0.value("key 1").toString(), QLatin1String("bubloo")); settings0.remove("key 2"); - QCOMPARE(settings0.value("key 1").toString(), QString("bubloo")); + QCOMPARE(settings0.value("key 1").toString(), QLatin1String("bubloo")); settings0.remove("key 1"); - QCOMPARE(settings0.value("key 1", "789").toString(), QString("789")); + QCOMPARE(settings0.value("key 1", "789").toString(), QLatin1String("789")); /* Make sure that removing a key removes all the subkeys. @@ -1324,7 +1301,6 @@ void tst_QSettings::remove() QCOMPARE(settings1.value("key 1").toString(), QString("gurgle")); QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); -#if !defined(Q_OS_BLACKBERRY) if (m_canWriteNativeSystemSettings) { QCOMPARE(settings3->value("key 1").toString(), QString("blah")); QCOMPARE(settings4->value("key 1").toString(), QString("doodah")); @@ -1357,14 +1333,6 @@ void tst_QSettings::remove() QVERIFY(!settings3->contains("key 1")); QVERIFY(!settings4->contains("key 1")); } -#else - settings1.remove("key 1"); - QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); - - settings2.remove("key 1"); - QVERIFY(!settings1.contains("key 1")); - QVERIFY(!settings2.contains("key 1")); -#endif /* Get ready for the next part of the test. @@ -1502,7 +1470,7 @@ void tst_QSettings::contains() } settings1.endGroup(); - QVERIFY(settings1.group() == "alpha"); + QCOMPARE(settings1.group(), QLatin1String("alpha")); keys = settings1.allKeys(); QCOMPARE(keys.size(), expectedResult.size() + 3); for (i = 0; i < keys.size(); ++i) { @@ -1667,7 +1635,6 @@ void tst_QSettings::setFallbacksEnabled() main associated file when fallbacks are turned off. */ -#if !defined(Q_OS_BLACKBERRY) QCOMPARE(settings1.value("key 1").toString(), QString("alpha")); QCOMPARE(settings2.value("key 1").toString(), QString("beta")); QCOMPARE(settings3.value("key 1").toString(), QString("gamma")); @@ -1697,22 +1664,6 @@ void tst_QSettings::setFallbacksEnabled() QCOMPARE(settings1.value("key 5").toString(), QString("")); QVERIFY(settings1.contains("key 1")); QVERIFY(!settings1.contains("key 5")); -#else - QCOMPARE(settings1.value("key 1").toString(), QString("gamma")); - QCOMPARE(settings2.value("key 1").toString(), QString("delta")); - QCOMPARE(settings3.value("key 1").toString(), QString("gamma")); - QCOMPARE(settings4.value("key 1").toString(), QString("delta")); - - QCOMPARE(settings1.value("key 2").toString(), QString("gamma")); - QCOMPARE(settings2.value("key 2").toString(), QString("beta")); - QCOMPARE(settings3.value("key 2").toString(), QString("gamma")); - QCOMPARE(settings4.value("key 2").toString(), QString("beta")); - - QCOMPARE(settings1.value("key 3").toString(), QString("gamma")); - QCOMPARE(settings2.value("key 3").toString(), QString("delta")); - QCOMPARE(settings3.value("key 3").toString(), QString("gamma")); - QCOMPARE(settings4.value("key 3").toString(), QString("delta")); -#endif } void tst_QSettings::testChildKeysAndGroups_data() @@ -1794,26 +1745,26 @@ void tst_QSettings::testUpdateRequestEvent() QSettings settings1("foo", QSettings::IniFormat); QVERIFY(!QFile::exists("foo")); - QVERIFY(QFileInfo("foo").size() == 0); + QCOMPARE(QFileInfo("foo").size(), qint64(0)); settings1.setValue("key1", 1); - QVERIFY(QFileInfo("foo").size() == 0); + QCOMPARE(QFileInfo("foo").size(), qint64(0)); QTRY_VERIFY(QFileInfo("foo").size() > 0); settings1.remove("key1"); QVERIFY(QFileInfo("foo").size() > 0); - QTRY_VERIFY(QFileInfo("foo").size() == 0); + QTRY_COMPARE(QFileInfo("foo").size(), qint64(0)); settings1.setValue("key2", 2); - QVERIFY(QFileInfo("foo").size() == 0); + QCOMPARE(QFileInfo("foo").size(), qint64(0)); QTRY_VERIFY(QFileInfo("foo").size() > 0); settings1.clear(); QVERIFY(QFileInfo("foo").size() > 0); - QTRY_VERIFY(QFileInfo("foo").size() == 0); + QTRY_COMPARE(QFileInfo("foo").size(), qint64(0)); #ifdef Q_OS_WINRT QDir::setCurrent(oldCur); @@ -1960,7 +1911,7 @@ void tst_QSettings::testEmptyData() settings.setValue("vList", vList); settings.setValue("vList2", vList2); settings.setValue("vList3", vList3); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); } { QSettings settings(filename, QSettings::IniFormat); @@ -1973,7 +1924,7 @@ void tst_QSettings::testEmptyData() QCOMPARE(settings.value("vList").toList(), vList); QCOMPARE(settings.value("vList2").toList(), vList2); QCOMPARE(settings.value("vList3").toList(), vList3); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); } { @@ -1987,7 +1938,7 @@ void tst_QSettings::testEmptyData() settings.setValue("vList", vList); settings.setValue("vList2", vList2); settings.setValue("vList3", vList3); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); } { QSettings settings("QtProject", "tst_qsettings"); @@ -2000,7 +1951,7 @@ void tst_QSettings::testEmptyData() QCOMPARE(settings.value("vList").toList(), vList); QCOMPARE(settings.value("vList2").toList(), vList2); QCOMPARE(settings.value("vList3").toList(), vList3); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); } QFile::remove(filename); } @@ -2018,17 +1969,17 @@ void tst_QSettings::testEmptyKey() void tst_QSettings::testResourceFiles() { QSettings settings(":/resourcefile.ini", QSettings::IniFormat); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); QVERIFY(!settings.isWritable()); QCOMPARE(settings.value("Field 1/Bottom").toInt(), 89); settings.setValue("Field 1/Bottom", 90); // the next two lines check the statu quo; another behavior would be possible - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); QCOMPARE(settings.value("Field 1/Bottom").toInt(), 90); settings.sync(); - QVERIFY(settings.status() == QSettings::AccessError); + QCOMPARE(settings.status(), QSettings::AccessError); QCOMPARE(settings.value("Field 1/Bottom").toInt(), 90); } @@ -2044,6 +1995,52 @@ void tst_QSettings::testRegistryShortRootNames() #endif } +void tst_QSettings::testRegistry32And64Bit() +{ +#if !defined (Q_OS_WIN) || defined(Q_OS_WINRT) + QSKIP("This test is specific to the Windows registry.", SkipAll); +#else + + const QString key("HKEY_LOCAL_MACHINE\\Software"); + const QString keyWow("HKEY_LOCAL_MACHINE\\Software\\Wow6432Node"); + +#ifndef Q_OS_WIN64 + // This branch is taken at compile time if targeting 32-bit; it does not + // necessarily mean that the OS running the test is 32-bit (it could be + // e.g. 64-bit). + QCOMPARE(QSettings(key, QSettings::NativeFormat).childGroups(), + QSettings(key, QSettings::Registry32Format).childGroups()); + + // Detect whether we are running under 64-bit Windows. + typedef BOOL (WINAPI *IsWow64ProcessPtr)(HANDLE hProcess, PBOOL Wow64Process); + IsWow64ProcessPtr IsWow64Process = (IsWow64ProcessPtr)QLibrary::resolve( + "kernel32.dll", "IsWow64Process"); + + if (IsWow64Process) { + BOOL IsWow64 = FALSE; + if (IsWow64Process(GetCurrentProcess(), &IsWow64) && IsWow64) { + // The 64-bit registry's "Wow6432Node" key should match the 32-bit registry. + // If we are not on 32-bit Windows, these should never be the same, + // because the 64-bit registry has a "Wow6432Node" key. + QCOMPARE(QSettings(keyWow, QSettings::Registry64Format).childGroups(), + QSettings(key, QSettings::Registry32Format).childGroups()); + } + } +#else + // This branch is taken at compile time if targeting 64-bit; it does not + // necessarily mean that the OS running the test is 64-bit (it could be + // e.g. 128-bit). + QCOMPARE(QSettings(key, QSettings::NativeFormat).childGroups(), + QSettings(key, QSettings::Registry64Format).childGroups()); + + // The 64-bit registry's "Wow6432Node" key should match the 32-bit registry. + QCOMPARE(QSettings(keyWow, QSettings::Registry64Format).childGroups(), + QSettings(key, QSettings::Registry32Format).childGroups()); +#endif + +#endif +} + void tst_QSettings::trailingWhitespace() { { @@ -2469,7 +2466,6 @@ void tst_QSettings::testArrays() } settings2.endArray(); -#if !defined (Q_OS_BLACKBERRY) size1 = settings1.beginReadArray("strings"); QCOMPARE(size1, 3); @@ -2480,7 +2476,6 @@ void tst_QSettings::testArrays() QCOMPARE(str, fiveStrings.at(i)); } settings1.endArray(); -#endif } #ifdef QT_BUILD_INTERNAL @@ -2539,7 +2534,7 @@ QString escapeWeirdChars(const QString &s) QChar c = s.at(i); if (c.unicode() < ' ' || c.unicode() > '~' || (escapeNextDigit && c.unicode() >= '0' && c.unicode() <= 'f')) { - result += QString("\\x%1").arg(c.unicode(), 0, 16); + result += QLatin1String("\\x") + QString::number(c.unicode(), 16); escapeNextDigit = true; } else { result += c; @@ -3133,7 +3128,7 @@ void tst_QSettings::registerFormat() // so we can test error handling QSettings::Format custom3 = QSettings::registerFormat("custom3", readCustom3File, writeCustom3File); - QVERIFY(custom3 == QSettings::CustomFormat3); + QCOMPARE(custom3, QSettings::CustomFormat3); QDir dir(settingsPath()); QVERIFY(dir.mkpath("someDir")); @@ -3203,7 +3198,6 @@ void tst_QSettings::setPath() path checks that it has no bad side effects. */ for (int i = 0; i < 2; ++i) { -#if !defined(Q_OS_BLACKBERRY) #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) TEST_PATH(i == 0, "conf", NativeFormat, UserScope, "alpha") TEST_PATH(i == 0, "conf", NativeFormat, SystemScope, "beta") @@ -3214,34 +3208,28 @@ void tst_QSettings::setPath() TEST_PATH(i == 0, "custom1", CustomFormat1, SystemScope, "zeta") TEST_PATH(i == 0, "custom2", CustomFormat2, UserScope, "eta") TEST_PATH(i == 0, "custom2", CustomFormat2, SystemScope, "iota") -#else // Q_OS_BLACKBERRY: no system scope - TEST_PATH(i == 0, "conf", NativeFormat, UserScope, "alpha") - TEST_PATH(i == 0, "ini", IniFormat, UserScope, "gamma") - TEST_PATH(i == 0, "custom1", CustomFormat1, UserScope, "epsilon") - TEST_PATH(i == 0, "custom2", CustomFormat2, UserScope, "eta") -#endif } } void tst_QSettings::setDefaultFormat() { - QVERIFY(QSettings::defaultFormat() == QSettings::NativeFormat); + QCOMPARE(QSettings::defaultFormat(), QSettings::NativeFormat); QSettings::setDefaultFormat(QSettings::CustomFormat1); QSettings settings1("org", "app"); QSettings settings2(QSettings::SystemScope, "org", "app"); QSettings settings3; - QVERIFY(settings1.format() == QSettings::NativeFormat); - QVERIFY(settings2.format() == QSettings::NativeFormat); - QVERIFY(settings3.format() == QSettings::CustomFormat1); + QCOMPARE(settings1.format(), QSettings::NativeFormat); + QCOMPARE(settings2.format(), QSettings::NativeFormat); + QCOMPARE(settings3.format(), QSettings::CustomFormat1); QSettings::setDefaultFormat(QSettings::NativeFormat); - QVERIFY(QSettings::defaultFormat() == QSettings::NativeFormat); + QCOMPARE(QSettings::defaultFormat(), QSettings::NativeFormat); - QVERIFY(settings1.format() == QSettings::NativeFormat); - QVERIFY(settings2.format() == QSettings::NativeFormat); - QVERIFY(settings3.format() == QSettings::CustomFormat1); + QCOMPARE(settings1.format(), QSettings::NativeFormat); + QCOMPARE(settings2.format(), QSettings::NativeFormat); + QCOMPARE(settings3.format(), QSettings::CustomFormat1); } void tst_QSettings::dontCreateNeedlessPaths() @@ -3302,7 +3290,7 @@ void tst_QSettings::dontReorderIniKeysNeedlessly() outFile.close(); QSettings settings(outFileName, QSettings::IniFormat); - QVERIFY(settings.status() == QSettings::NoError); + QCOMPARE(settings.status(), QSettings::NoError); QVERIFY(settings.isWritable()); settings.setValue("Field 1/Bottom", 90); diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro index 9fb6f9b31f..c72d9e4fad 100644 --- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro @@ -3,4 +3,3 @@ TARGET = tst_qstandardpaths QT = core testlib SOURCES = tst_qstandardpaths.cpp TESTDATA += tst_qstandardpaths.cpp qstandardpaths.pro -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 24ff2f237f..8a7ca8429f 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -44,7 +44,7 @@ #include <sys/types.h> #endif -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID) #define Q_XDG_PLATFORM #endif @@ -296,9 +296,9 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. - // Blackberry OS, Android and WinRT are an exception to this case, owing to the fact that + // Android and WinRT are an exception to this case, owing to the fact that // applications are sandboxed. -#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); @@ -327,7 +327,7 @@ void tst_qstandardpaths::testAppConfigLocation() { // On all platforms where applications are not sandboxed, // AppConfigLocation should be GenericConfigLocation / organization name / app name -#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation), base + "/tst_qstandardpaths"); QCoreApplication::setOrganizationName("Qt"); diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index efbcdc78e0..aaaa0d4949 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -61,9 +61,9 @@ void tst_QStorageInfo::defaultValues() QVERIFY(!storage.isRoot()); QVERIFY(storage.device().isEmpty()); QVERIFY(storage.fileSystemType().isEmpty()); - QVERIFY(storage.bytesTotal() == -1); - QVERIFY(storage.bytesFree() == -1); - QVERIFY(storage.bytesAvailable() == -1); + QCOMPARE(storage.bytesTotal(), -1); + QCOMPARE(storage.bytesFree(), -1); + QCOMPARE(storage.bytesAvailable(), -1); } void tst_QStorageInfo::operatorEqual() @@ -71,19 +71,19 @@ void tst_QStorageInfo::operatorEqual() { QStorageInfo storage1 = QStorageInfo::root(); QStorageInfo storage2(QDir::rootPath()); - QVERIFY(storage1 == storage2); + QCOMPARE(storage1, storage2); } { QStorageInfo storage1(QCoreApplication::applicationDirPath()); QStorageInfo storage2(QCoreApplication::applicationFilePath()); - QVERIFY(storage1 == storage2); + QCOMPARE(storage1, storage2); } { QStorageInfo storage1; QStorageInfo storage2; - QVERIFY(storage1 == storage2); + QCOMPARE(storage1, storage2); } } @@ -184,15 +184,15 @@ void tst_QStorageInfo::caching() qint64 free = storage1.bytesFree(); QStorageInfo storage2(storage1); - QVERIFY(free == storage2.bytesFree()); + QCOMPARE(free, storage2.bytesFree()); file.write(QByteArray(1024*1024, '\0')); file.flush(); - QVERIFY(free == storage1.bytesFree()); - QVERIFY(free == storage2.bytesFree()); + QCOMPARE(free, storage1.bytesFree()); + QCOMPARE(free, storage2.bytesFree()); storage2.refresh(); - QVERIFY(storage1 == storage2); + QCOMPARE(storage1, storage2); QVERIFY(free != storage2.bytesFree()); } #endif diff --git a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro index 0908878514..4a69971f78 100644 --- a/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro +++ b/tests/auto/corelib/io/qtemporarydir/qtemporarydir.pro @@ -3,4 +3,3 @@ TARGET = tst_qtemporarydir SOURCES += tst_qtemporarydir.cpp QT = core testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index c16a729ad0..8f250e4568 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -1,10 +1,8 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtemporaryfile QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 RESOURCES += qtemporaryfile.qrc android:!android-no-sdk { diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 94e6bbaade..1a586af569 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -697,7 +697,7 @@ void tst_QTemporaryFile::createNativeFile() f.seek(currentPos); } QTemporaryFile *tempFile = QTemporaryFile::createNativeFile(f); - QVERIFY(valid == (bool)tempFile); + QCOMPARE(valid, (bool)tempFile); if (currentPos != -1) QCOMPARE(currentPos, f.pos()); if (valid) { diff --git a/tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro index 578fa86f5c..4a4c091dcb 100644 --- a/tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro +++ b/tests/auto/corelib/io/qtextstream/readAllStdinProcess/readAllStdinProcess.pro @@ -7,4 +7,3 @@ DESTDIR = ./ # This app is testdata for tst_qtextstream target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro index 578fa86f5c..4a4c091dcb 100644 --- a/tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro +++ b/tests/auto/corelib/io/qtextstream/readLineStdinProcess/readLineStdinProcess.pro @@ -7,4 +7,3 @@ DESTDIR = ./ # This app is testdata for tst_qtextstream target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro b/tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro index 578fa86f5c..4a4c091dcb 100644 --- a/tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro +++ b/tests/auto/corelib/io/qtextstream/stdinProcess/stdinProcess.pro @@ -7,4 +7,3 @@ DESTDIR = ./ # This app is testdata for tst_qtextstream target.path = $$[QT_INSTALL_TESTS]/tst_qtextstream/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtextstream/test/test.pro b/tests/auto/corelib/io/qtextstream/test/test.pro index 39d181344f..93fb6d232f 100644 --- a/tests/auto/corelib/io/qtextstream/test/test.pro +++ b/tests/auto/corelib/io/qtextstream/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = ../tst_qtextstream QT = core network testlib SOURCES = ../tst_qtextstream.cpp @@ -20,4 +19,3 @@ TESTDATA += \ ../qtextstream.qrc \ ../tst_qtextstream.cpp \ ../resources -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 6e58642eb6..24cde14459 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -1617,18 +1617,18 @@ void tst_QTextStream::forcePoint() { QString str; QTextStream stream(&str); - stream << fixed << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << fixed << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000 1 0 -1.000000 -1")); str.clear(); stream.seek(0); - stream << scientific << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << scientific << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000e+00 1 0 -1.000000e+00 -1")); str.clear(); stream.seek(0); stream.setRealNumberNotation(QTextStream::SmartNotation); - stream << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.00000 1 0 -1.00000 -1")); } @@ -1638,7 +1638,7 @@ void tst_QTextStream::forceSign() { QString str; QTextStream stream(&str); - stream << forcesign << 1.2 << " " << -1.2 << " " << 0; + stream << forcesign << 1.2 << ' ' << -1.2 << ' ' << 0; QCOMPARE(str, QString("+1.2 -1.2 +0")); } @@ -1775,9 +1775,9 @@ void tst_QTextStream::nanInf() QString s; QTextStream out(&s); - out << qInf() << " " << -qInf() << " " << qQNaN() - << uppercasedigits << " " - << qInf() << " " << -qInf() << " " << qQNaN() + out << qInf() << ' ' << -qInf() << ' ' << qQNaN() + << uppercasedigits << ' ' + << qInf() << ' ' << -qInf() << ' ' << qQNaN() << flush; QCOMPARE(s, QString("inf -inf nan INF -INF NAN")); @@ -2583,7 +2583,7 @@ void tst_QTextStream::useCase1() stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setAutoDetectUnicode(true); - stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); + stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole"); } file.seek(0); @@ -2619,7 +2619,7 @@ void tst_QTextStream::useCase2() stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setAutoDetectUnicode(true); - stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); + stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole"); file.close(); QVERIFY(file.open(QFile::ReadWrite)); diff --git a/tests/auto/corelib/io/qurl/qurl.pro b/tests/auto/corelib/io/qurl/qurl.pro index f65a9c688c..c046c75522 100644 --- a/tests/auto/corelib/io/qurl/qurl.pro +++ b/tests/auto/corelib/io/qurl/qurl.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qurl QT = core testlib concurrent SOURCES = tst_qurl.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac: OBJECTIVE_SOURCES += tst_qurl_mac.mm diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 7579c6713d..97dfac3062 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -226,7 +226,7 @@ void tst_QUrl::constructing() QVERIFY(url.isEmpty()); QCOMPARE(url.port(), -1); QCOMPARE(url.toString(), QString()); - QVERIFY(url == url); + QCOMPARE(url, url); QVERIFY(!(url < url)); QUrl fromLocal = QUrl::fromLocalFile(QString()); @@ -254,7 +254,7 @@ void tst_QUrl::hashInPath() QCOMPARE(withHashInPath.toDisplayString(QUrl::PreferLocalFile), QString("hi%23mum.txt")); QUrl fromHashInPath = QUrl::fromEncoded(withHashInPath.toEncoded()); - QVERIFY(withHashInPath == fromHashInPath); + QCOMPARE(withHashInPath, fromHashInPath); const QUrl localWithHash = QUrl::fromLocalFile("/hi#mum.txt"); QCOMPARE(localWithHash.path(), QString::fromLatin1("/hi#mum.txt")); @@ -284,7 +284,7 @@ void tst_QUrl::assignment() QUrl copy; copy = url; - QVERIFY(url == copy); + QCOMPARE(url, copy); } void tst_QUrl::comparison() @@ -295,7 +295,7 @@ void tst_QUrl::comparison() QUrl url2("http://qt-project.org/"); QVERIFY(url2.isValid()); - QVERIFY(url1 == url2); + QCOMPARE(url1, url2); QVERIFY(!(url1 < url2)); QVERIFY(!(url2 < url1)); QVERIFY(url1.matches(url2, QUrl::None)); @@ -329,7 +329,7 @@ void tst_QUrl::comparison() url5.setEncodedQuery("a=%2a"); QUrl url6; url6.setEncodedQuery("a=%2A"); - QVERIFY(url5 == url6); + QCOMPARE(url5, url6); QUrl url7; url7.setEncodedQuery("a=C"); @@ -366,7 +366,7 @@ void tst_QUrl::comparison() QUrl hostUrl1("file:/foo"); QUrl hostUrl2("file:///foo"); - QVERIFY(hostUrl1 == hostUrl2); + QCOMPARE(hostUrl1, hostUrl2); QVERIFY(hostUrl1.matches(hostUrl2, QUrl::None)); QVERIFY(hostUrl1.matches(hostUrl2, QUrl::RemoveAuthority)); @@ -460,7 +460,7 @@ void tst_QUrl::copying() QUrl copy(url); - QVERIFY(url == copy); + QCOMPARE(url, copy); } void tst_QUrl::setUrl() @@ -1635,9 +1635,9 @@ void tst_QUrl::percentEncoding() QFETCH(QByteArray, encoded); QCOMPARE(QUrl(original).toEncoded().constData(), encoded.constData()); - QVERIFY(QUrl::fromEncoded(QUrl(original).toEncoded()) == QUrl(original)); + QCOMPARE(QUrl::fromEncoded(QUrl(original).toEncoded()), QUrl(original)); QCOMPARE(QUrl::fromEncoded(QUrl(original).toEncoded()).toString(), original); - QVERIFY(QUrl::fromEncoded(encoded) == QUrl(original)); + QCOMPARE(QUrl::fromEncoded(encoded), QUrl(original)); QCOMPARE(QUrl(QUrl(original).toString()).toString(), original); } @@ -2872,7 +2872,8 @@ void tst_QUrl::fromUserInput_data() int c = 0; while (it.hasNext()) { it.next(); - QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.filePath() << QUrl::fromLocalFile(it.filePath()); + QTest::newRow(("file-" + QByteArray::number(c++)).constData()) + << it.filePath() << QUrl::fromLocalFile(it.filePath()); } // basic latin1 @@ -2960,7 +2961,8 @@ void tst_QUrl::fromUserInputWithCwd_data() 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; + QTest::newRow(("file-" + QByteArray::number(c++)).constData()) + << it.fileName() << QDir::currentPath() << url << url; } QDir parent = QDir::current(); QVERIFY(parent.cdUp()); @@ -3167,7 +3169,7 @@ void tst_QUrl::acceptEmptyAuthoritySegments() // However, file:/bar is the same as file:///bar QString file_triple_bar("file:///bar"), file_uni_bar("file:/bar"); - QVERIFY(QUrl(file_triple_bar) == QUrl(file_uni_bar)); + QCOMPARE(QUrl(file_triple_bar), QUrl(file_uni_bar)); QCOMPARE(QUrl(file_uni_bar).toString(), file_triple_bar); QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar); diff --git a/tests/auto/corelib/io/qurlinternal/qurlinternal.pro b/tests/auto/corelib/io/qurlinternal/qurlinternal.pro index c62cd045f3..ae5e023446 100644 --- a/tests/auto/corelib/io/qurlinternal/qurlinternal.pro +++ b/tests/auto/corelib/io/qurlinternal/qurlinternal.pro @@ -3,5 +3,3 @@ requires(contains(QT_CONFIG,private_tests)) TARGET = tst_qurlinternal SOURCES += tst_qurlinternal.cpp ../../codecs/utf8/utf8data.cpp QT = core core-private testlib -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qurlquery/qurlquery.pro b/tests/auto/corelib/io/qurlquery/qurlquery.pro index 3284903d5b..68129f356f 100644 --- a/tests/auto/corelib/io/qurlquery/qurlquery.pro +++ b/tests/auto/corelib/io/qurlquery/qurlquery.pro @@ -1,6 +1,5 @@ QT = core core-private testlib TARGET = tst_qurlquery -CONFIG += parallel_test testcase +CONFIG += testcase SOURCES += tst_qurlquery.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index 769a96ac64..7df085df7c 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -103,7 +103,7 @@ static QByteArray prettyList(const T &items) first = false; result += prettyPair(it); } - result += ")"; + result += QLatin1Char(')'); return result.toLocal8Bit(); } @@ -176,20 +176,20 @@ void tst_QUrlQuery::constructing() QUrlQuery copy(empty); QVERIFY(copy.isEmpty()); QVERIFY(!copy.isDetached()); - QVERIFY(copy == empty); + QCOMPARE(copy, empty); QCOMPARE(qHash(copy), qHash(empty)); QVERIFY(!(copy != empty)); copy = empty; - QVERIFY(copy == empty); + QCOMPARE(copy, empty); copy = QUrlQuery(); - QVERIFY(copy == empty); + QCOMPARE(copy, empty); QCOMPARE(qHash(copy), qHash(empty)); } { QUrlQuery copy(emptyQuery()); - QVERIFY(copy == empty); + QCOMPARE(copy, empty); } QVERIFY(!empty.hasQueryItem("a")); @@ -214,7 +214,7 @@ void tst_QUrlQuery::constructing() QVERIFY(!(other == empty)); QUrlQuery copy(other); - QVERIFY(copy == other); + QCOMPARE(copy, other); copy.clear(); QVERIFY(copy.isEmpty()); @@ -222,7 +222,7 @@ void tst_QUrlQuery::constructing() copy = other; QVERIFY(!copy.isEmpty()); - QVERIFY(copy == other); + QCOMPARE(copy, other); copy = QUrlQuery(); QVERIFY(copy.isEmpty()); @@ -298,7 +298,7 @@ void tst_QUrlQuery::addRemove() QCOMPARE(allItems.at(0).first, QString("a")); QCOMPARE(allItems.at(0).second, QString("b")); - QVERIFY(query == original); + QCOMPARE(query, original); QVERIFY(!(query != original)); QCOMPARE(qHash(query), qHash(original)); } @@ -346,7 +346,7 @@ void tst_QUrlQuery::multiAddRemove() QVERIFY(query.hasQueryItem("a")); // returns the first one - QVERIFY(query.queryItemValue("a") == "b"); + QCOMPARE(query.queryItemValue("a"), QLatin1String("b")); // order is the order we set them in QVERIFY(query.allQueryItemValues("a") == QStringList() << "b" << "c"); @@ -359,9 +359,9 @@ void tst_QUrlQuery::multiAddRemove() QVERIFY(query.hasQueryItem("A")); QVERIFY(query.hasQueryItem("a")); - QVERIFY(query.queryItemValue("a") == "b"); + QCOMPARE(query.queryItemValue("a"), QLatin1String("b")); QVERIFY(query.allQueryItemValues("a") == QStringList() << "b" << "c"); - QVERIFY(query.queryItemValue("A") == "B"); + QCOMPARE(query.queryItemValue("A"), QLatin1String("B")); QVERIFY(query.allQueryItemValues("A") == QStringList() << "B" << "C"); } @@ -371,7 +371,7 @@ void tst_QUrlQuery::multiAddRemove() QVERIFY(query.hasQueryItem("a")); // it must have removed the first one - QVERIFY(query.queryItemValue("a") == "c"); + QCOMPARE(query.queryItemValue("a"), QLatin1String("c")); } { @@ -720,7 +720,7 @@ void tst_QUrlQuery::old_queryItems() QVERIFY(!url.isEmpty()); QList<QPair<QString, QString> > setItems = url.queryItems(); - QVERIFY(newItems == setItems); + QCOMPARE(newItems, setItems); url.addQueryItem("1", "z"); @@ -746,18 +746,18 @@ void tst_QUrlQuery::old_queryItems() url.removeAllQueryItems("1"); QVERIFY(!url.hasQueryItem("1")); - QCOMPARE(url.queryItemValue("4").toLatin1().constData(), "a b"); - QCOMPARE(url.queryItemValue("5").toLatin1().constData(), "&"); - QCOMPARE(url.queryItemValue("tex").toLatin1().constData(), "a + b = c"); - QCOMPARE(url.queryItemValue("foo bar").toLatin1().constData(), "hello world"); + QCOMPARE(url.queryItemValue("4"), QLatin1String("a b")); + QCOMPARE(url.queryItemValue("5"), QLatin1String("&")); + QCOMPARE(url.queryItemValue("tex"), QLatin1String("a + b = c")); + QCOMPARE(url.queryItemValue("foo bar"), QLatin1String("hello world")); //url.setUrl("http://www.google.com/search?q=a+b"); url.setQuery("q=a+b"); - QCOMPARE(url.queryItemValue("q"), QString("a+b")); + QCOMPARE(url.queryItemValue("q"), QLatin1String("a+b")); //url.setUrl("http://www.google.com/search?q=a=b"); // invalid, but should be tolerated url.setQuery("q=a=b"); - QCOMPARE(url.queryItemValue("q"), QString("a=b")); + QCOMPARE(url.queryItemValue("q"), QLatin1String("a=b")); } void tst_QUrlQuery::old_hasQueryItem_data() diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro b/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro index b7a36459f8..4f0e9da3c2 100644 --- a/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro +++ b/tests/auto/corelib/io/qwinoverlappedionotifier/qwinoverlappedionotifier.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qwinoverlappedionotifier QT = core-private testlib SOURCES = tst_qwinoverlappedionotifier.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp index 57a01e0a79..ad2aa0dfd3 100644 --- a/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp +++ b/tests/auto/corelib/io/qwinoverlappedionotifier/tst_qwinoverlappedionotifier.cpp @@ -199,7 +199,7 @@ void tst_QWinOverlappedIoNotifier::waitForAnyNotified() NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); notifier.setHandle(hFile); notifier.setEnabled(true); - QVERIFY(notifier.waitForAnyNotified(100) == 0); + QVERIFY(!notifier.waitForAnyNotified(100)); OVERLAPPED overlapped1; ZeroMemory(&overlapped1, sizeof(OVERLAPPED)); @@ -224,7 +224,7 @@ void tst_QWinOverlappedIoNotifier::waitForAnyNotified() CloseHandle(hFile); QVERIFY(overlappedObjects.isEmpty()); - QVERIFY(notifier.waitForAnyNotified(100) == 0); + QVERIFY(!notifier.waitForAnyNotified(100)); } void tst_QWinOverlappedIoNotifier::brokenPipe() diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro index ef571de192..7480bd45f6 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/qabstractitemmodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractitemmodel QT = core testlib diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index c4d2df7c3e..2570beb6c2 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -157,9 +157,10 @@ QtTestModel::QtTestModel(int rows, int columns, QObject *parent) { table.resize(rows); for (int r = 0; r < rows; ++r) { + const QString prefix = QString::number(r) + QLatin1Char('/'); table[r].resize(columns); for (int c = 0; c < columns; ++c) - table[r][c] = QString("%1/%2").arg(r).arg(c); + table[r][c] = prefix + QString::number(c); } } @@ -1699,8 +1700,8 @@ void tst_QAbstractItemModel::testMoveToDescendants() moveCommand->setDestRow(row); moveCommand->doCommand(); - QVERIFY(beforeSpy.size() == 0); - QVERIFY(afterSpy.size() == 0); + QCOMPARE(beforeSpy.size(), 0); + QCOMPARE(afterSpy.size(), 0); } } } @@ -1757,8 +1758,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange() moveCommand->setDestRow(destRow); moveCommand->doCommand(); - QVERIFY(beforeSpy.size() == 0); - QVERIFY(afterSpy.size() == 0); + QCOMPARE(beforeSpy.size(), 0); + QCOMPARE(afterSpy.size(), 0); } class ListenerObject : public QObject @@ -1823,7 +1824,7 @@ void ListenerObject::slotAboutToBeReset() // Nothing has been changed yet. All indexes should be the same. for (int i = 0; i < m_persistentIndexes.size(); ++i) { QModelIndex idx = m_persistentIndexes.at(i); - QVERIFY(idx == m_nonPersistentIndexes.at(i)); + QCOMPARE(idx, m_nonPersistentIndexes.at(i)); QVERIFY(m_model->mapToSource(idx).isValid()); } } @@ -1859,13 +1860,13 @@ void tst_QAbstractItemModel::testReset() resetCommand->doCommand(); // Verify that the correct signals were emitted - QVERIFY(beforeResetSpy.size() == 1); - QVERIFY(afterResetSpy.size() == 1); + QCOMPARE(beforeResetSpy.size(), 1); + QCOMPARE(afterResetSpy.size(), 1); // Verify that the move actually happened. - QVERIFY(m_model->rowCount() == 9); + QCOMPARE(m_model->rowCount(), 9); QModelIndex destIndex = m_model->index(4, 0); - QVERIFY(m_model->rowCount(destIndex) == 11); + QCOMPARE(m_model->rowCount(destIndex), 11); // Delete it because its slots test things which are not true after this point. delete listener; @@ -1877,14 +1878,14 @@ void tst_QAbstractItemModel::testReset() QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray()); nullProxy->setSourceModel(new ModelWithCustomRole(this)); - QVERIFY(proxyBeforeResetSpy.size() == 1); - QVERIFY(proxyAfterResetSpy.size() == 1); + QCOMPARE(proxyBeforeResetSpy.size(), 1); + QCOMPARE(proxyAfterResetSpy.size(), 1); QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray("custom")); nullProxy->setSourceModel(m_model); - QVERIFY(proxyBeforeResetSpy.size() == 2); - QVERIFY(proxyAfterResetSpy.size() == 2); + QCOMPARE(proxyBeforeResetSpy.size(), 2); + QCOMPARE(proxyAfterResetSpy.size(), 2); // After being reset the proxy must be queried again. QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray()); @@ -2055,10 +2056,10 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged() QVERIFY(afterParents.contains(p2)); // The first will be the last, and the lest will be the first. - QVERIFY(p1FirstPersistent.row() == 1); - QVERIFY(p1LastPersistent.row() == 0); - QVERIFY(p2FirstPersistent.row() == 9); - QVERIFY(p2LastPersistent.row() == 8); + QCOMPARE(p1FirstPersistent.row(), 1); + QCOMPARE(p1LastPersistent.row(), 0); + QCOMPARE(p2FirstPersistent.row(), 9); + QCOMPARE(p2LastPersistent.row(), 8); } insertCommand = new ModelInsertCommand(&model, this); @@ -2115,8 +2116,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged() QCOMPARE(beforeSignal.size(), 2); QCOMPARE(afterSignal.size(), 2); - QVERIFY(p1FirstPersistent.row() == 1); - QVERIFY(p1LastPersistent.row() == 0); + QCOMPARE(p1FirstPersistent.row(), 1); + QCOMPARE(p1LastPersistent.row(), 0); QCOMPARE(p2FirstPersistent.row(), 9); QCOMPARE(p2LastPersistent.row(), 8); } diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/qabstractproxymodel.pro b/tests/auto/corelib/itemmodels/qabstractproxymodel/qabstractproxymodel.pro index 7209620b91..19aec43072 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/qabstractproxymodel.pro +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/qabstractproxymodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractproxymodel QT += testlib SOURCES += tst_qabstractproxymodel.cpp diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index fb9d118d60..fbe123bca0 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -351,7 +351,7 @@ static void verifySubSetOf(const QHash<int, QByteArray> &superSet, const QHash<i const QHash<int, QByteArray>::const_iterator end = subSet.constEnd(); for ( ; it != end; ++it ) { QVERIFY(superSet.contains(it.key())); - QVERIFY(it.value() == superSet.value(it.key())); + QCOMPARE(it.value(), superSet.value(it.key())); } } diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/qidentityproxymodel.pro b/tests/auto/corelib/itemmodels/qidentityproxymodel/qidentityproxymodel.pro index f57b419ae5..ba32f02962 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/qidentityproxymodel.pro +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/qidentityproxymodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qidentityproxymodel mtdir = ../../../other/modeltest @@ -7,4 +6,3 @@ INCLUDEPATH += $$PWD/$${mtdir} QT += testlib SOURCES += tst_qidentityproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index 9eb3bc5113..fbab95c975 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -111,25 +111,25 @@ void tst_QIdentityProxyModel::verifyIdentity(QAbstractItemModel *model, const QM const int columns = model->columnCount(parent); const QModelIndex proxyParent = m_proxy->mapFromSource(parent); - QVERIFY(m_proxy->mapToSource(proxyParent) == parent); - QVERIFY(rows == m_proxy->rowCount(proxyParent)); - QVERIFY(columns == m_proxy->columnCount(proxyParent)); + QCOMPARE(m_proxy->mapToSource(proxyParent), parent); + QCOMPARE(rows, m_proxy->rowCount(proxyParent)); + QCOMPARE(columns, m_proxy->columnCount(proxyParent)); for (int row = 0; row < rows; ++row) { for (int column = 0; column < columns; ++column) { const QModelIndex idx = model->index(row, column, parent); const QModelIndex proxyIdx = m_proxy->mapFromSource(idx); - QVERIFY(proxyIdx.model() == m_proxy); - QVERIFY(m_proxy->mapToSource(proxyIdx) == idx); + QCOMPARE(proxyIdx.model(), m_proxy); + QCOMPARE(m_proxy->mapToSource(proxyIdx), idx); QVERIFY(proxyIdx.isValid()); - QVERIFY(proxyIdx.row() == row); - QVERIFY(proxyIdx.column() == column); - QVERIFY(proxyIdx.parent() == proxyParent); - QVERIFY(proxyIdx.data() == idx.data()); - QVERIFY(proxyIdx.flags() == idx.flags()); + QCOMPARE(proxyIdx.row(), row); + QCOMPARE(proxyIdx.column(), column); + QCOMPARE(proxyIdx.parent(), proxyParent); + QCOMPARE(proxyIdx.data(), idx.data()); + QCOMPARE(proxyIdx.flags(), idx.flags()); const int childCount = m_proxy->rowCount(proxyIdx); const bool hasChildren = m_proxy->hasChildren(proxyIdx); - QVERIFY(model->hasChildren(idx) == hasChildren); + QCOMPARE(model->hasChildren(idx), hasChildren); QVERIFY((childCount > 0) == hasChildren); if (hasChildren) @@ -146,7 +146,7 @@ void tst_QIdentityProxyModel::insertRows() { QStandardItem *parentItem = m_model->invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -171,13 +171,13 @@ void tst_QIdentityProxyModel::insertRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); verifyIdentity(m_model); } @@ -186,7 +186,7 @@ void tst_QIdentityProxyModel::removeRows() { QStandardItem *parentItem = m_model->invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -216,13 +216,13 @@ void tst_QIdentityProxyModel::removeRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); verifyIdentity(m_model); } @@ -271,17 +271,17 @@ void tst_QIdentityProxyModel::moveRows() QVERIFY(modelBeforeSpy.size() == 1 && 1 == proxyBeforeSpy.size()); QVERIFY(modelAfterSpy.size() == 1 && 1 == proxyAfterSpy.size()); - QVERIFY(modelBeforeSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(1) == proxyBeforeSpy.first().at(1)); - QVERIFY(modelBeforeSpy.first().at(2) == proxyBeforeSpy.first().at(2)); - QVERIFY(modelBeforeSpy.first().at(3).value<QModelIndex>() == m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value<QModelIndex>())); - QVERIFY(modelBeforeSpy.first().at(4) == proxyBeforeSpy.first().at(4)); + QCOMPARE(modelBeforeSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(1), proxyBeforeSpy.first().at(1)); + QCOMPARE(modelBeforeSpy.first().at(2), proxyBeforeSpy.first().at(2)); + QCOMPARE(modelBeforeSpy.first().at(3).value<QModelIndex>(), m_proxy->mapToSource(proxyBeforeSpy.first().at(3).value<QModelIndex>())); + QCOMPARE(modelBeforeSpy.first().at(4), proxyBeforeSpy.first().at(4)); - QVERIFY(modelAfterSpy.first().first().value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(1) == proxyAfterSpy.first().at(1)); - QVERIFY(modelAfterSpy.first().at(2) == proxyAfterSpy.first().at(2)); - QVERIFY(modelAfterSpy.first().at(3).value<QModelIndex>() == m_proxy->mapToSource(proxyAfterSpy.first().at(3).value<QModelIndex>())); - QVERIFY(modelAfterSpy.first().at(4) == proxyAfterSpy.first().at(4)); + QCOMPARE(modelAfterSpy.first().first().value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().first().value<QModelIndex>())); + QCOMPARE(modelAfterSpy.first().at(1), proxyAfterSpy.first().at(1)); + QCOMPARE(modelAfterSpy.first().at(2), proxyAfterSpy.first().at(2)); + QCOMPARE(modelAfterSpy.first().at(3).value<QModelIndex>(), m_proxy->mapToSource(proxyAfterSpy.first().at(3).value<QModelIndex>())); + QCOMPARE(modelAfterSpy.first().at(4), proxyAfterSpy.first().at(4)); verifyIdentity(&model); @@ -352,7 +352,7 @@ void tst_QIdentityProxyModel::dataChanged() model.changeData(); QCOMPARE(modelSpy.first().at(2).value<QVector<int> >(), QVector<int>() << 1); - QVERIFY(modelSpy.first().at(2) == proxySpy.first().at(2)); + QCOMPARE(modelSpy.first().at(2), proxySpy.first().at(2)); verifyIdentity(&model); m_proxy->setSourceModel(0); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index e0e688cc3a..24765a82a8 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -236,7 +236,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) { if (QStringListModel *stringListModel = qobject_cast<QStringListModel *>(model)) { QString alphabet = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; - stringListModel->setStringList( alphabet.split(",") ); + stringListModel->setStringList( alphabet.split(QLatin1Char(',')) ); return QModelIndex(); } @@ -317,7 +317,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) QDir tempDir(m_dirModelTempDir->path()); for (int i = 0; i < 26; ++i) { - const QString subdir = QString("foo_") + QString::number(i); + const QString subdir = QLatin1String("foo_") + QString::number(i); if (!tempDir.mkdir(subdir)) qFatal("Cannot create directory %s", qPrintable(QDir::toNativeSeparators(tempDir.path() + QLatin1Char('/') +subdir))); @@ -355,7 +355,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) int items = 50; #endif while (items--) - listWidget->addItem(QString("item %1").arg(items)); + listWidget->addItem(QLatin1String("item ") + QString::number(items)); return QModelIndex(); } @@ -370,9 +370,10 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) treeWidget->setColumnCount(1); QTreeWidgetItem *parent; while (topItems--){ - parent = new QTreeWidgetItem(treeWidget, QStringList(QString("top %1").arg(topItems))); + const QString tS = QString::number(topItems); + parent = new QTreeWidgetItem(treeWidget, QStringList(QLatin1String("top ") + tS)); for (int i = 0; i < 20; ++i) - new QTreeWidgetItem(parent, QStringList(QString("child %1").arg(topItems))); + new QTreeWidgetItem(parent, QStringList(QLatin1String("child ") + tS)); } return QModelIndex(); } diff --git a/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro b/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro index 42c9c8f9fb..ff21d6afa5 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro +++ b/tests/auto/corelib/itemmodels/qitemmodel/qitemmodel.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qitemmodel QT += widgets sql testlib SOURCES = tst_qitemmodel.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 6971f7ef78..20ff670835 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -359,7 +359,7 @@ void tst_QItemModel::index() // Make sure that the same index is always returned QModelIndex a = currentModel->index(0,0); QModelIndex b = currentModel->index(0,0); - QVERIFY(a == b); + QCOMPARE(a, b); // index is tested more extensivly more later in checkChildren(), // but this catches the big mistakes @@ -423,7 +423,7 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent, // Make sure we get the same index if we request it twice in a row QModelIndex a = currentModel->index(r, c, parent); QModelIndex b = currentModel->index(r, c, parent); - QVERIFY(a == b); + QCOMPARE(a, b); { const QModelIndex sibling = currentModel->sibling( r, c, topLeftChild ); @@ -435,7 +435,7 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent, } // Some basic checking on the index that is returned - QVERIFY(index.model() == currentModel); + QCOMPARE(index.model(), currentModel); QCOMPARE(index.row(), r); QCOMPARE(index.column(), c); QCOMPARE(currentModel->data(index, Qt::DisplayRole).isValid(), true); diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro b/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro index 1b6279ba1b..4dcddc8feb 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qitemselectionmodel QT += testlib SOURCES += tst_qitemselectionmodel.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 38e2900c25..7d5c30dfb5 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -1515,7 +1515,7 @@ class MyStandardItemModel: public QStandardItemModel Q_OBJECT public: inline MyStandardItemModel(int i1, int i2): QStandardItemModel(i1, i2) {} - inline void reset() { QStandardItemModel::reset(); } + inline void reset() { beginResetModel(); endResetModel(); } }; void tst_QItemSelectionModel::resetModel() @@ -1760,7 +1760,7 @@ void tst_QItemSelectionModel::modelLayoutChanged() // verify that selection is as expected QItemSelection selection = selectionModel.selection(); QCOMPARE(selection.count(), expectedSelectedRanges.count()); - QVERIFY(selectionModel.hasSelection() == !expectedSelectedRanges.isEmpty()); + QCOMPARE(selectionModel.hasSelection(), !expectedSelectedRanges.isEmpty()); for (int i = 0; i < expectedSelectedRanges.count(); ++i) { IntPairPair expectedRange = expectedSelectedRanges.at(i); @@ -1974,8 +1974,9 @@ void tst_QItemSelectionModel::rowIntersectsSelection2() { QStandardItemModel m; for (int i=0; i<8; ++i) { + const QString text = QLatin1String("Item number ") + QString::number(i); for (int j=0; j<8; ++j) { - QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + QStandardItem *item = new QStandardItem(text); if ((i % 2 == 0 && j == 0) || (j % 2 == 0 && i == 0) || j == 5 || i == 5 ) { @@ -2021,7 +2022,7 @@ void tst_QItemSelectionModel::rowIntersectsSelection3() QStandardItemModel model; QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -2046,7 +2047,7 @@ void tst_QItemSelectionModel::unselectable() QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 10; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); } QItemSelectionModel selectionModel(&model); @@ -2093,7 +2094,8 @@ public: QVariant data(const QModelIndex &idx, int role) const { if (role == Qt::DisplayRole || role == Qt::EditRole) - return QString("[%1,%2]").arg(idx.row()).arg(idx.column()); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(']'); return QVariant(); } @@ -2202,7 +2204,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -2217,7 +2219,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged); QVERIFY(deselectSpy.isValid()); model.removeRows(0, 1, root); - QVERIFY(deselectSpy.count() == 1); + QCOMPARE(deselectSpy.count(), 1); // More testing stress for the patch. model.clear(); @@ -2225,13 +2227,14 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() parentItem = model.invisibleRootItem(); for (int i = 0; i < 2; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); } for (int i = 0; i < 2; ++i) { parentItem = model.invisibleRootItem()->child(i, 0); + const QString prefix = QLatin1String("item ") + QString::number(i) + QLatin1Char('.'); for (int j = 0; j < 2; ++j) { - QStandardItem *item = new QStandardItem(QString("item %0.%1").arg(i).arg(j)); + QStandardItem *item = new QStandardItem(prefix + QString::number(j)); parentItem->appendRow(item); } } @@ -2245,7 +2248,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QVERIFY(selectionModel.selection().contains(sel2)); deselectSpy.clear(); model.removeRow(0, model.index(0, 0)); - QVERIFY(deselectSpy.count() == 1); + QCOMPARE(deselectSpy.count(), 1); QVERIFY(!selectionModel.selection().contains(sel)); QVERIFY(selectionModel.selection().contains(sel2)); } @@ -2304,13 +2307,12 @@ void tst_QItemSelectionModel::layoutChangedWithAllSelected2() // Populate the tree view. for (unsigned int i = 0; i < cNumCols; i++) - model.setHeaderData( i, Qt::Horizontal, QString::fromLatin1("Column %1").arg(i)); + model.setHeaderData( i, Qt::Horizontal, QLatin1String("Column ") + QString::number(i)); for (unsigned int r = 0; r < cNumRows; r++) { - for (unsigned int c = 0; c < cNumCols; c++) { - model.setData(model.index(r, c, QModelIndex()), - QString::fromLatin1("r:%1/c:%2").arg(r, c)); - } + const QString prefix = QLatin1String("r:") + QString::number(r) + QLatin1String("/c:"); + for (unsigned int c = 0; c < cNumCols; c++) + model.setData(model.index(r, c, QModelIndex()), prefix + QString::number(c)); } QCOMPARE(model.rowCount(), int(cNumRows)); @@ -2375,7 +2377,7 @@ public slots: foreach(const QModelIndex &index, deselected.indexes()) { QVERIFY(!m_itemSelectionModel->selection().contains(index)); } - QVERIFY(m_itemSelectionModel->selection().size() == 2); + QCOMPARE(m_itemSelectionModel->selection().size(), 2); } }; @@ -2393,7 +2395,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange() selModel.select(QItemSelection(model.index(3, 0), model.index(6, 0)), QItemSelectionModel::Select); - QVERIFY(selModel.selection().size() == 1); + QCOMPARE(selModel.selection().size(), 1); RemovalObserver ro(&selModel); @@ -2402,7 +2404,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange() bool ok = model.removeRows(4, 2); QVERIFY(ok); - QVERIFY(spy.size() == 1); + QCOMPARE(spy.size(), 1); } static QStandardItemModel* getModel(QObject *parent) @@ -2412,15 +2414,16 @@ static QStandardItemModel* getModel(QObject *parent) for (int i = 0; i < 4; ++i) { QStandardItem *parentItem = model->invisibleRootItem(); QList<QStandardItem*> list; + const QString prefix = QLatin1String("item ") + QString::number(i) + QLatin1String(", "); for (int j = 0; j < 4; ++j) { - list.append(new QStandardItem(QString("item %1, %2").arg(i).arg(j))); + list.append(new QStandardItem(prefix + QString::number(j))); } parentItem->appendRow(list); parentItem = list.first(); for (int j = 0; j < 4; ++j) { QList<QStandardItem*> list; for (int k = 0; k < 4; ++k) { - list.append(new QStandardItem(QString("item %1, %2").arg(i).arg(j))); + list.append(new QStandardItem(prefix + QString::number(j))); } parentItem->appendRow(list); } @@ -2713,8 +2716,8 @@ void tst_QItemSelectionModel::testChainedSelectionClear() QModelIndexList selectedIndexes = selectionModel.selection().indexes(); QModelIndexList duplicatedIndexes = duplicate.selection().indexes(); - QVERIFY(selectedIndexes.size() == duplicatedIndexes.size()); - QVERIFY(selectedIndexes.size() == 1); + QCOMPARE(selectedIndexes.size(), duplicatedIndexes.size()); + QCOMPARE(selectedIndexes.size(), 1); QVERIFY(selectedIndexes.first() == model.index(0, 0)); } @@ -2724,18 +2727,18 @@ void tst_QItemSelectionModel::testChainedSelectionClear() QModelIndexList selectedIndexes = selectionModel.selection().indexes(); QModelIndexList duplicatedIndexes = duplicate.selection().indexes(); - QVERIFY(selectedIndexes.size() == duplicatedIndexes.size()); - QVERIFY(selectedIndexes.size() == 0); + QCOMPARE(selectedIndexes.size(), duplicatedIndexes.size()); + QCOMPARE(selectedIndexes.size(), 0); } duplicate.setCurrentIndex(model.index(0, 0), QItemSelectionModel::NoUpdate); - QVERIFY(selectionModel.currentIndex() == duplicate.currentIndex()); + QCOMPARE(selectionModel.currentIndex(), duplicate.currentIndex()); duplicate.clearCurrentIndex(); QVERIFY(!duplicate.currentIndex().isValid()); - QVERIFY(selectionModel.currentIndex() == duplicate.currentIndex()); + QCOMPARE(selectionModel.currentIndex(), duplicate.currentIndex()); } void tst_QItemSelectionModel::testClearCurrentIndex() @@ -2750,13 +2753,13 @@ void tst_QItemSelectionModel::testClearCurrentIndex() QModelIndex firstIndex = model.index(0, 0); QVERIFY(firstIndex.isValid()); selectionModel.setCurrentIndex(firstIndex, QItemSelectionModel::NoUpdate); - QVERIFY(selectionModel.currentIndex() == firstIndex); - QVERIFY(currentIndexSpy.size() == 1); + QCOMPARE(selectionModel.currentIndex(), firstIndex); + QCOMPARE(currentIndexSpy.size(), 1); selectionModel.clearCurrentIndex(); - QVERIFY(selectionModel.currentIndex() == QModelIndex()); - QVERIFY(currentIndexSpy.size() == 2); + QCOMPARE(selectionModel.currentIndex(), QModelIndex()); + QCOMPARE(currentIndexSpy.size(), 2); } void tst_QItemSelectionModel::QTBUG48402_data() diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro index 25947990a7..099f666def 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsortfilterproxymodel QT += widgets testlib @@ -8,4 +7,3 @@ mtdir = ../../../other/modeltest INCLUDEPATH += $$PWD/$${mtdir} SOURCES += tst_qsortfilterproxymodel.cpp $${mtdir}/dynamictreemodel.cpp $${mtdir}/modeltest.cpp HEADERS += $${mtdir}/dynamictreemodel.h $${mtdir}/modeltest.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 0302ae5cbf..7d93818797 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -341,7 +341,7 @@ void tst_QSortFilterProxyModel::sort_data() QStringList list; for (int i = 10000; i < 20000; ++i) - list.append(QString("Number: %1").arg(i)); + list.append(QStringLiteral("Number: ") + QString::number(i)); QTest::newRow("large set ascending") << static_cast<int>(Qt::AscendingOrder) << int(Qt::CaseSensitive) << list << list; } @@ -1346,14 +1346,14 @@ void tst_QSortFilterProxyModel::buildHierarchy(const QStringList &l, QAbstractIt QStack<QModelIndex> parent_stack; for (int i = 0; i < l.count(); ++i) { QString token = l.at(i); - if (token == "<") { // start table + if (token == QLatin1String("<")) { // start table ++ind; parent_stack.push(parent); row_stack.push(row); parent = m->index(row - 1, 0, parent); row = 0; QVERIFY(m->insertColumns(0, 1, parent)); // add column - } else if (token == ">") { // end table + } else if (token == QLatin1String(">")) { // end table --ind; parent = parent_stack.pop(); row = row_stack.pop(); @@ -1376,14 +1376,14 @@ void tst_QSortFilterProxyModel::checkHierarchy(const QStringList &l, const QAbst QStack<QModelIndex> parent_stack; for (int i = 0; i < l.count(); ++i) { QString token = l.at(i); - if (token == "<") { // start table + if (token == QLatin1String("<")) { // start table ++indent; parent_stack.push(parent); row_stack.push(row); parent = m->index(row - 1, 0, parent); QVERIFY(parent.isValid()); row = 0; - } else if (token == ">") { // end table + } else if (token == QLatin1String(">")) { // end table --indent; parent = parent_stack.pop(); row = row_stack.pop(); @@ -1418,7 +1418,7 @@ void tst_QSortFilterProxyModel::filterTable() filter.setFilterRegExp("9"); for (int i = 0; i < filter.rowCount(); ++i) - QVERIFY(filter.data(filter.index(i, 0)).toString().contains("9")); + QVERIFY(filter.data(filter.index(i, 0)).toString().contains(QLatin1Char('9'))); } void tst_QSortFilterProxyModel::insertAfterSelect() @@ -1663,16 +1663,16 @@ void tst_QSortFilterProxyModel::removeSourceRows() QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count()); for (int i = 0; i < aboutToRemoveSpy.count(); ++i) { QList<QVariant> args = aboutToRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } QCOMPARE(removeSpy.count(), expectedRemovedProxyIntervals.count()); for (int i = 0; i < removeSpy.count(); ++i) { QList<QVariant> args = removeSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), expectedRemovedProxyIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), expectedRemovedProxyIntervals.at(i).second); } @@ -1841,8 +1841,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(initialInsertSpy.count(), 0); for (int i = 0; i < initialRemoveSpy.count(); ++i) { QList<QVariant> args = initialRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), initialRemoveIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), initialRemoveIntervals.at(i).second); } @@ -1864,8 +1864,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(finalRemoveSpy.count(), finalRemoveIntervals.count()); for (int i = 0; i < finalRemoveSpy.count(); ++i) { QList<QVariant> args = finalRemoveSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), finalRemoveIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), finalRemoveIntervals.at(i).second); } @@ -1876,8 +1876,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(finalInsertSpy.count(), insertIntervals.count()); for (int i = 0; i < finalInsertSpy.count(); ++i) { QList<QVariant> args = finalInsertSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), insertIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } @@ -2018,8 +2018,8 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(removeSpy.count(), removeIntervals.count()); for (int i = 0; i < removeSpy.count(); ++i) { QList<QVariant> args = removeSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), removeIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), removeIntervals.at(i).second); } @@ -2027,8 +2027,8 @@ void tst_QSortFilterProxyModel::changeSourceData() QCOMPARE(insertSpy.count(), insertIntervals.count()); for (int i = 0; i < insertSpy.count(); ++i) { QList<QVariant> args = insertSpy.at(i); - QVERIFY(args.at(1).type() == QVariant::Int); - QVERIFY(args.at(2).type() == QVariant::Int); + QCOMPARE(args.at(1).type(), QVariant::Int); + QCOMPARE(args.at(2).type(), QVariant::Int); QCOMPARE(args.at(1).toInt(), insertIntervals.at(i).first); QCOMPARE(args.at(2).toInt(), insertIntervals.at(i).second); } @@ -2545,12 +2545,11 @@ void tst_QSortFilterProxyModel::sortStable() { QStandardItemModel* model = new QStandardItemModel(5, 2); for (int r = 0; r < 5; r++) { + const QString prefix = QLatin1String("Row:") + QString::number(r) + QLatin1String(", Column:"); for (int c = 0; c < 2; c++) { - QStandardItem* item = new QStandardItem( - QString("Row:%0, Column:%1").arg(r).arg(c) ); + QStandardItem* item = new QStandardItem(prefix + QString::number(c)); for (int i = 0; i < 3; i++) { - QStandardItem* child = new QStandardItem( - QString("Item %0").arg(i) ); + QStandardItem* child = new QStandardItem(QLatin1String("Item ") + QString::number(i)); item->appendRow( child ); } model->setItem(r, c, item); @@ -2581,7 +2580,7 @@ void tst_QSortFilterProxyModel::hiddenColumns() public: MyStandardItemModel() : QStandardItemModel(0,5) {} void reset() - { QStandardItemModel::reset(); } + { beginResetModel(); endResetModel(); } friend class tst_QSortFilterProxyModel; } model; QSortFilterProxyModel proxy; @@ -2625,7 +2624,7 @@ void tst_QSortFilterProxyModel::staticSorting() QSortFilterProxyModel proxy; proxy.setSourceModel(&model); proxy.setDynamicSortFilter(false); - QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' ')); // prepare model QStandardItem *root = model.invisibleRootItem (); @@ -2680,7 +2679,7 @@ void tst_QSortFilterProxyModel::staticSorting() void tst_QSortFilterProxyModel::dynamicSorting() { QStringListModel model1; - const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' ')); model1.setStringList(initial); QSortFilterProxyModel proxy1; proxy1.setDynamicSortFilter(false); @@ -2806,7 +2805,8 @@ public: qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); } - return QString("[%1,%2]").arg(idx.row()).arg(idx.column()); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(']'); } return QVariant(); } @@ -2971,7 +2971,7 @@ void tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel() QStandardItemModel *model1 = new QStandardItemModel; QStandardItem *parentItem = model1->invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("model1 item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("model1 item ") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -2979,7 +2979,7 @@ void tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel() QStandardItemModel *model2 = new QStandardItemModel; QStandardItem *parentItem2 = model2->invisibleRootItem(); for (int i = 0; i < 4; ++i) { - QStandardItem *item = new QStandardItem(QString("model2 item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("model2 item ") + QString::number(i)); parentItem2->appendRow(item); parentItem2 = item; } @@ -3078,7 +3078,7 @@ void tst_QSortFilterProxyModel::appearsAndSort() void tst_QSortFilterProxyModel::unnecessaryDynamicSorting() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; proxy.setDynamicSortFilter(false); @@ -3162,7 +3162,7 @@ private: void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; @@ -3196,7 +3196,7 @@ static bool isValid(const QItemSelection &selection) void tst_QSortFilterProxyModel::mapSelectionFromSource() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; @@ -3205,7 +3205,7 @@ void tst_QSortFilterProxyModel::mapSelectionFromSource() proxy.setSourceModel(&model); // Only "delta" remains. - QVERIFY(proxy.rowCount() == 1); + QCOMPARE(proxy.rowCount(), 1); QItemSelection selection; QModelIndex charlie = model.index(1, 0); @@ -3220,7 +3220,7 @@ void tst_QSortFilterProxyModel::mapSelectionFromSource() QItemSelection proxiedSelection = proxy.mapSelectionFromSource(selection); // Only "delta" is in the mapped result. - QVERIFY(proxiedSelection.size() == 1); + QCOMPARE(proxiedSelection.size(), 1); QVERIFY(isValid(proxiedSelection)); } @@ -3377,7 +3377,10 @@ void tst_QSortFilterProxyModel::resetInvalidate() { switch (test) { case 0: break; - case 1: reset(); break; + case 1: + beginResetModel(); + endResetModel(); + break; case 2: invalidate(); break; case 3: invalidateFilter(); break; } @@ -3551,11 +3554,11 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged() QStandardItem *parentItem = model.invisibleRootItem(); for (int i = 0; i < 4; ++i) { { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item ") + QString::number(i)); parentItem->appendRow(item); } { - QStandardItem *item = new QStandardItem(QString("item 1%0").arg(i)); + QStandardItem *item = new QStandardItem(QLatin1String("item 1") + QString::number(i)); parentItem->appendRow(item); parentItem = item; } @@ -3852,9 +3855,10 @@ void tst_QSortFilterProxyModel::hierarchyFilterInvalidation() { QStandardItemModel model; for (int i = 0; i < 10; ++i) { - QStandardItem *child = new QStandardItem(QString("Row %1").arg(i)); + const QString rowText = QLatin1String("Row ") + QString::number(i); + QStandardItem *child = new QStandardItem(rowText); for (int j = 0; j < 1; ++j) { - child->appendRow(new QStandardItem(QString("Row %1/%2").arg(i).arg(j))); + child->appendRow(new QStandardItem(rowText + QLatin1Char('/') + QString::number(j))); } model.appendRow(child); } @@ -3913,7 +3917,7 @@ void tst_QSortFilterProxyModel::simpleFilterInvalidation() { QStandardItemModel model; for (int i = 0; i < 2; ++i) { - QStandardItem *child = new QStandardItem(QString("Row %1").arg(i)); + QStandardItem *child = new QStandardItem(QLatin1String("Row ") + QString::number(i)); child->appendRow(new QStandardItem("child")); model.appendRow(child); } diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/qstringlistmodel.pro b/tests/auto/corelib/itemmodels/qstringlistmodel/qstringlistmodel.pro index e11e16b203..91a4cf306c 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/qstringlistmodel.pro +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/qstringlistmodel.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstringlistmodel QT = core testlib HEADERS += qmodellistener.h SOURCES += tst_qstringlistmodel.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/json/json.pro b/tests/auto/corelib/json/json.pro index 237e20685a..b3038d7ca1 100644 --- a/tests/auto/corelib/json/json.pro +++ b/tests/auto/corelib/json/json.pro @@ -2,10 +2,12 @@ TARGET = tst_json QT = core testlib CONFIG -= app_bundle CONFIG += testcase -CONFIG += parallel_test -!android:TESTDATA += test.json test.bjson test3.json test2.json +!android:TESTDATA += bom.json test.json test.bjson test3.json test2.json else:RESOURCES += json.qrc +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + SOURCES += tst_qtjson.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 884c4b3850..aebf332fe3 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -741,7 +741,7 @@ void tst_QtJson::testObjectIteration() { QJsonObject object2 = object; - QVERIFY(object == object2); + QCOMPARE(object, object2); QJsonValue val = *object2.begin(); object2.erase(object2.begin()); @@ -757,7 +757,7 @@ void tst_QtJson::testObjectIteration() { QJsonObject object2 = object; - QVERIFY(object == object2); + QCOMPARE(object, object2); QJsonObject::iterator it = object2.find(QString::number(5)); object2.erase(it); @@ -793,7 +793,7 @@ void tst_QtJson::testObjectIteration() while (!object.isEmpty()) it = object.erase(it); QCOMPARE(object.size() , 0); - QVERIFY(it == object.end()); + QCOMPARE(it, object.end()); } void tst_QtJson::testArrayIteration() @@ -814,7 +814,7 @@ void tst_QtJson::testArrayIteration() { QJsonArray array2 = array; - QVERIFY(array == array2); + QCOMPARE(array, array2); QJsonValue val = *array2.begin(); array2.erase(array2.begin()); @@ -856,7 +856,7 @@ void tst_QtJson::testArrayIteration() while (!array.isEmpty()) it = array.erase(it); QCOMPARE(array.size() , 0); - QVERIFY(it == array.end()); + QCOMPARE(it, array.end()); } void tst_QtJson::testObjectFind() @@ -870,14 +870,14 @@ void tst_QtJson::testObjectFind() QJsonObject::iterator it = object.find(QLatin1String("1")); QCOMPARE((*it).toDouble(), 1.); it = object.find(QLatin1String("11")); - QVERIFY((*it).type() == QJsonValue::Undefined); - QVERIFY(it == object.end()); + QCOMPARE((*it).type(), QJsonValue::Undefined); + QCOMPARE(it, object.end()); QJsonObject::const_iterator cit = object.constFind(QLatin1String("1")); QCOMPARE((*cit).toDouble(), 1.); cit = object.constFind(QLatin1String("11")); - QVERIFY((*it).type() == QJsonValue::Undefined); - QVERIFY(it == object.end()); + QCOMPARE((*it).type(), QJsonValue::Undefined); + QCOMPARE(it, object.end()); } void tst_QtJson::testDocument() @@ -898,8 +898,8 @@ void tst_QtJson::testDocument() QCOMPARE(doc.isEmpty(), false); QCOMPARE(doc.isArray(), false); QCOMPARE(doc.isObject(), true); - QVERIFY(doc.object() == object); - QVERIFY(doc.array() == QJsonArray()); + QCOMPARE(doc.object(), object); + QCOMPARE(doc.array(), QJsonArray()); doc = QJsonDocument(); QCOMPARE(doc.isEmpty(), true); @@ -917,8 +917,8 @@ void tst_QtJson::testDocument() QCOMPARE(doc.isEmpty(), false); QCOMPARE(doc.isArray(), true); QCOMPARE(doc.isObject(), false); - QVERIFY(doc.array() == array); - QVERIFY(doc.object() == QJsonObject()); + QCOMPARE(doc.array(), array); + QCOMPARE(doc.object(), QJsonObject()); QJsonObject outer; outer.insert(QLatin1String("outerKey"), 22); @@ -1408,9 +1408,7 @@ void tst_QtJson::toJsonLargeNumericValues() " \"Array\": [\n" " 1.234567,\n" " 1.7976931348623157e+308,\n" - // ((4.9406564584124654e-324 == 5e-324) == true) - // I can only think JavaScript has a special formatter to - // emit this value for this IEEE754 bit pattern. +#ifdef QT_NO_DOUBLECONVERSION // "shortest" double conversion is not very short then " 4.9406564584124654e-324,\n" " 2.2250738585072014e-308,\n" " 1.7976931348623157e+308,\n" @@ -1421,6 +1419,18 @@ void tst_QtJson::toJsonLargeNumericValues() " -1.7976931348623157e+308,\n" " -2.2204460492503131e-16,\n" " -4.9406564584124654e-324,\n" +#else + " 5e-324,\n" + " 2.2250738585072014e-308,\n" + " 1.7976931348623157e+308,\n" + " 2.220446049250313e-16,\n" + " 5e-324,\n" + " 0,\n" + " -2.2250738585072014e-308,\n" + " -1.7976931348623157e+308,\n" + " -2.220446049250313e-16,\n" + " -5e-324,\n" +#endif " 0,\n" " 9007199254740992,\n" " -9007199254740992\n" @@ -1740,7 +1750,7 @@ void tst_QtJson::fromBinary() QJsonDocument doc = QJsonDocument::fromJson(testJson); QJsonDocument outdoc = QJsonDocument::fromBinaryData(doc.toBinaryData()); QVERIFY(!outdoc.isNull()); - QVERIFY(doc == outdoc); + QCOMPARE(doc, outdoc); QFile bfile(testDataDir + "/test.bjson"); bfile.open(QFile::ReadOnly); @@ -1748,8 +1758,8 @@ void tst_QtJson::fromBinary() QJsonDocument bdoc = QJsonDocument::fromBinaryData(binary); QVERIFY(!bdoc.isNull()); - QVERIFY(doc.toVariant() == bdoc.toVariant()); - QVERIFY(doc == bdoc); + QCOMPARE(doc.toVariant(), bdoc.toVariant()); + QCOMPARE(doc, bdoc); } void tst_QtJson::toAndFromBinary_data() @@ -1770,7 +1780,7 @@ void tst_QtJson::toAndFromBinary() QVERIFY(!doc.isNull()); QJsonDocument outdoc = QJsonDocument::fromBinaryData(doc.toBinaryData()); QVERIFY(!outdoc.isNull()); - QVERIFY(doc == outdoc); + QCOMPARE(doc, outdoc); } void tst_QtJson::parseNumbers() @@ -2086,7 +2096,7 @@ void tst_QtJson::assignToDocument() QJsonDocument innerDoc(inner.toObject()); QVERIFY(innerDoc != doc); - QVERIFY(innerDoc.object() == inner.toObject()); + QCOMPARE(innerDoc.object(), inner.toObject()); } { const char *json = "[ [ true ] ]"; @@ -2098,7 +2108,7 @@ void tst_QtJson::assignToDocument() QJsonDocument innerDoc(inner.toArray()); QVERIFY(innerDoc != doc); - QVERIFY(innerDoc.array() == inner.toArray()); + QCOMPARE(innerDoc.array(), inner.toArray()); } } @@ -2129,7 +2139,7 @@ void tst_QtJson::testCompaction() QVERIFY(!doc.isEmpty()); QCOMPARE(doc.isArray(), false); QCOMPARE(doc.isObject(), true); - QVERIFY(doc.object() == obj); + QCOMPARE(doc.object(), obj); } void tst_QtJson::testDebugStream() @@ -2328,14 +2338,14 @@ void tst_QtJson::testDetachBug() void tst_QtJson::valueEquals() { - QVERIFY(QJsonValue() == QJsonValue()); + QCOMPARE(QJsonValue(), QJsonValue()); QVERIFY(QJsonValue() != QJsonValue(QJsonValue::Undefined)); QVERIFY(QJsonValue() != QJsonValue(true)); QVERIFY(QJsonValue() != QJsonValue(1.)); QVERIFY(QJsonValue() != QJsonValue(QJsonArray())); QVERIFY(QJsonValue() != QJsonValue(QJsonObject())); - QVERIFY(QJsonValue(true) == QJsonValue(true)); + QCOMPARE(QJsonValue(true), QJsonValue(true)); QVERIFY(QJsonValue(true) != QJsonValue(false)); QVERIFY(QJsonValue(true) != QJsonValue(QJsonValue::Undefined)); QVERIFY(QJsonValue(true) != QJsonValue()); @@ -2343,9 +2353,9 @@ void tst_QtJson::valueEquals() QVERIFY(QJsonValue(true) != QJsonValue(QJsonArray())); QVERIFY(QJsonValue(true) != QJsonValue(QJsonObject())); - QVERIFY(QJsonValue(1) == QJsonValue(1)); + QCOMPARE(QJsonValue(1), QJsonValue(1)); QVERIFY(QJsonValue(1) != QJsonValue(2)); - QVERIFY(QJsonValue(1) == QJsonValue(1.)); + QCOMPARE(QJsonValue(1), QJsonValue(1.)); QVERIFY(QJsonValue(1) != QJsonValue(1.1)); QVERIFY(QJsonValue(1) != QJsonValue(QJsonValue::Undefined)); QVERIFY(QJsonValue(1) != QJsonValue()); @@ -2353,7 +2363,7 @@ void tst_QtJson::valueEquals() QVERIFY(QJsonValue(1) != QJsonValue(QJsonArray())); QVERIFY(QJsonValue(1) != QJsonValue(QJsonObject())); - QVERIFY(QJsonValue(1.) == QJsonValue(1.)); + QCOMPARE(QJsonValue(1.), QJsonValue(1.)); QVERIFY(QJsonValue(1.) != QJsonValue(2.)); QVERIFY(QJsonValue(1.) != QJsonValue(QJsonValue::Undefined)); QVERIFY(QJsonValue(1.) != QJsonValue()); @@ -2361,7 +2371,7 @@ void tst_QtJson::valueEquals() QVERIFY(QJsonValue(1.) != QJsonValue(QJsonArray())); QVERIFY(QJsonValue(1.) != QJsonValue(QJsonObject())); - QVERIFY(QJsonValue(QJsonArray()) == QJsonValue(QJsonArray())); + QCOMPARE(QJsonValue(QJsonArray()), QJsonValue(QJsonArray())); QJsonArray nonEmptyArray; nonEmptyArray.append(true); QVERIFY(QJsonValue(QJsonArray()) != nonEmptyArray); @@ -2371,7 +2381,7 @@ void tst_QtJson::valueEquals() QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(1.)); QVERIFY(QJsonValue(QJsonArray()) != QJsonValue(QJsonObject())); - QVERIFY(QJsonValue(QJsonObject()) == QJsonValue(QJsonObject())); + QCOMPARE(QJsonValue(QJsonObject()), QJsonValue(QJsonObject())); QJsonObject nonEmptyObject; nonEmptyObject.insert("Key", true); QVERIFY(QJsonValue(QJsonObject()) != nonEmptyObject); @@ -2381,13 +2391,13 @@ void tst_QtJson::valueEquals() QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(1.)); QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(QJsonArray())); - QVERIFY(QJsonValue("foo") == QJsonValue(QLatin1String("foo"))); - QVERIFY(QJsonValue("foo") == QJsonValue(QString("foo"))); - QVERIFY(QJsonValue("\x66\x6f\x6f") == QJsonValue(QString("foo"))); - QVERIFY(QJsonValue("\x62\x61\x72") == QJsonValue("bar")); - QVERIFY(QJsonValue(UNICODE_NON_CHARACTER) == QJsonValue(QString(UNICODE_NON_CHARACTER))); - QVERIFY(QJsonValue(UNICODE_DJE) == QJsonValue(QString(UNICODE_DJE))); - QVERIFY(QJsonValue("\xc3\xa9") == QJsonValue(QString("\xc3\xa9"))); + QCOMPARE(QJsonValue("foo"), QJsonValue(QLatin1String("foo"))); + QCOMPARE(QJsonValue("foo"), QJsonValue(QString("foo"))); + QCOMPARE(QJsonValue("\x66\x6f\x6f"), QJsonValue(QString("foo"))); + QCOMPARE(QJsonValue("\x62\x61\x72"), QJsonValue("bar")); + QCOMPARE(QJsonValue(UNICODE_NON_CHARACTER), QJsonValue(QString(UNICODE_NON_CHARACTER))); + QCOMPARE(QJsonValue(UNICODE_DJE), QJsonValue(QString(UNICODE_DJE))); + QCOMPARE(QJsonValue("\xc3\xa9"), QJsonValue(QString("\xc3\xa9"))); } void tst_QtJson::objectEquals_data() @@ -2521,7 +2531,7 @@ void tst_QtJson::bom() QJsonDocument doc = QJsonDocument::fromJson(json, &error); QVERIFY(!doc.isNull()); - QVERIFY(error.error == QJsonParseError::NoError); + QCOMPARE(error.error, QJsonParseError::NoError); } void tst_QtJson::nesting() @@ -2553,14 +2563,14 @@ void tst_QtJson::nesting() QJsonDocument doc = QJsonDocument::fromJson(json, &error); QVERIFY(!doc.isNull()); - QVERIFY(error.error == QJsonParseError::NoError); + QCOMPARE(error.error, QJsonParseError::NoError); - json.prepend("["); - json.append("]"); + json.prepend('['); + json.append(']'); doc = QJsonDocument::fromJson(json, &error); QVERIFY(doc.isNull()); - QVERIFY(error.error == QJsonParseError::DeepNesting); + QCOMPARE(error.error, QJsonParseError::DeepNesting); json = QByteArray("true "); @@ -2572,14 +2582,14 @@ void tst_QtJson::nesting() doc = QJsonDocument::fromJson(json, &error); QVERIFY(!doc.isNull()); - QVERIFY(error.error == QJsonParseError::NoError); + QCOMPARE(error.error, QJsonParseError::NoError); - json.prepend("["); - json.append("]"); + json.prepend('['); + json.append(']'); doc = QJsonDocument::fromJson(json, &error); QVERIFY(doc.isNull()); - QVERIFY(error.error == QJsonParseError::DeepNesting); + QCOMPARE(error.error, QJsonParseError::DeepNesting); } @@ -2589,7 +2599,7 @@ void tst_QtJson::longStrings() // in the data structures (for Latin1String in qjson_p.h) QString s(0x7ff0, 'a'); for (int i = 0x7ff0; i < 0x8010; i++) { - s.append("c"); + s.append(QLatin1Char('c')); QMap <QString, QVariant> map; map["key"] = s; @@ -2603,12 +2613,12 @@ void tst_QtJson::longStrings() QJsonDocument d2 = QJsonDocument::fromJson(a1); /* ... and a QByteArray from the QJsonDocument */ QByteArray a2 = d2.toJson(); - QVERIFY(a1 == a2); + QCOMPARE(a1, a2); } s = QString(0xfff0, 'a'); for (int i = 0xfff0; i < 0x10010; i++) { - s.append("c"); + s.append(QLatin1Char('c')); QMap <QString, QVariant> map; map["key"] = s; @@ -2622,7 +2632,7 @@ void tst_QtJson::longStrings() QJsonDocument d2 = QJsonDocument::fromJson(a1); /* ... and a QByteArray from the QJsonDocument */ QByteArray a2 = d2.toJson(); - QVERIFY(a1 == a2); + QCOMPARE(a1, a2); } } @@ -2755,7 +2765,7 @@ void tst_QtJson::unicodeKeys() QJsonParseError error; QJsonDocument doc = QJsonDocument::fromJson(json, &error); - QVERIFY(error.error == QJsonParseError::NoError); + QCOMPARE(error.error, QJsonParseError::NoError); QJsonObject o = doc.object(); QCOMPARE(o.keys().size(), 5); @@ -2769,12 +2779,12 @@ void tst_QtJson::garbageAtEnd() { QJsonParseError error; QJsonDocument doc = QJsonDocument::fromJson("{},", &error); - QVERIFY(error.error == QJsonParseError::GarbageAtEnd); - QVERIFY(error.offset == 2); + QCOMPARE(error.error, QJsonParseError::GarbageAtEnd); + QCOMPARE(error.offset, 2); QVERIFY(doc.isEmpty()); doc = QJsonDocument::fromJson("{} ", &error); - QVERIFY(error.error == QJsonParseError::NoError); + QCOMPARE(error.error, QJsonParseError::NoError); QVERIFY(!doc.isEmpty()); } diff --git a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro index 1039f2c08d..a49bb9ae1f 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro +++ b/tests/auto/corelib/kernel/qcoreapplication/qcoreapplication.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcoreapplication QT = core testlib core-private SOURCES = tst_qcoreapplication.cpp diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 655719cffc..b889d61786 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -442,14 +442,14 @@ public slots: void threadProgress(int v) { ++count; - QVERIFY(v == count); + QCOMPARE(v, count); QCoreApplication::postEvent(this, new QEvent(QEvent::MaxUser), -1); } void threadFinished() { - QVERIFY(count == 7); + QCOMPARE(count, 7); count = 0; thread->deleteLater(); @@ -898,6 +898,7 @@ void tst_QCoreApplication::threadedEventDelivery() QCOMPARE(receiver.recordedEvents.contains(QEvent::User + 1), eventsReceived); } +#ifndef QT_NO_LIBRARY void tst_QCoreApplication::addRemoveLibPaths() { QStringList paths = QCoreApplication::libraryPaths(); @@ -922,8 +923,9 @@ void tst_QCoreApplication::addRemoveLibPaths() QStringList replace; replace << currentDir << paths[0]; QCoreApplication::setLibraryPaths(replace); - QVERIFY(QCoreApplication::libraryPaths() == replace); + QCOMPARE(QCoreApplication::libraryPaths(), replace); } +#endif static void createQObjectOnDestruction() { diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index d9296b3846..6c24ab56f8 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -63,7 +63,9 @@ private slots: void applicationEventFilters_auxThread(); void threadedEventDelivery_data(); void threadedEventDelivery(); +#ifndef QT_NO_LIBRARY void addRemoveLibPaths(); +#endif }; #endif // TST_QCOREAPPLICATION_H diff --git a/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro b/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro index c3019467ce..ff048d0429 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro +++ b/tests/auto/corelib/kernel/qeventdispatcher/qeventdispatcher.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qeventdispatcher QT = core testlib SOURCES += tst_qeventdispatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index ea4792fc1c..5cd043b584 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -1,10 +1,8 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qeventloop QT = core network testlib core-private SOURCES = $$PWD/tst_qeventloop.cpp win32:!wince:!winrt: LIBS += -luser32 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qmath/qmath.pro b/tests/auto/corelib/kernel/qmath/qmath.pro index 5b8cba4104..703c530e35 100644 --- a/tests/auto/corelib/kernel/qmath/qmath.pro +++ b/tests/auto/corelib/kernel/qmath/qmath.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmath QT = core testlib SOURCES = tst_qmath.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro b/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro index f045fc5d88..718f2b51de 100644 --- a/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro +++ b/tests/auto/corelib/kernel/qmetaenum/qmetaenum.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaenum QT = core testlib SOURCES = tst_qmetaenum.cpp diff --git a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro index 8340bc06e3..a42cd60236 100644 --- a/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro +++ b/tests/auto/corelib/kernel/qmetamethod/qmetamethod.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetamethod QT = core testlib SOURCES = tst_qmetamethod.cpp mac:CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index cf3ff04aa4..8d5d34d10d 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -599,8 +599,8 @@ void tst_QMetaMethod::method() QFETCH(QMetaMethod::MethodType, methodType); QFETCH(QMetaMethod::Access, access); - QVERIFY(parameterTypes.size() == parameterTypeNames.size()); - QVERIFY(parameterTypes.size() == parameterNames.size()); + QCOMPARE(parameterTypes.size(), parameterTypeNames.size()); + QCOMPARE(parameterTypes.size(), parameterNames.size()); const QMetaObject *mo = &MethodTestObject::staticMetaObject; int index = (methodType == QMetaMethod::Constructor) diff --git a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro index 509ade6e2a..e7e5a03a86 100644 --- a/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro +++ b/tests/auto/corelib/kernel/qmetaobject/qmetaobject.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaobject QT = core-private testlib SOURCES = tst_qmetaobject.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index 7c19bfb89c..0a84a019d0 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -811,7 +811,7 @@ void tst_QMetaObject::invokeBlockingQueuedMetaMember() void tst_QMetaObject::qtMetaObjectInheritance() { - QVERIFY(QObject::staticMetaObject.superClass() == 0); + QVERIFY(!QObject::staticMetaObject.superClass()); QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("Qt::CaseSensitivity"), -1); QCOMPARE(QSortFilterProxyModel::staticMetaObject.indexOfEnumerator("CaseSensitivity"), -1); int indexOfSortCaseSensitivity = QSortFilterProxyModel::staticMetaObject.indexOfProperty("sortCaseSensitivity"); @@ -878,7 +878,7 @@ void tst_QMetaObject::invokeMetaConstructor() const QMetaObject *mo = &QtTestObject::staticMetaObject; { QObject *obj = mo->newInstance(); - QVERIFY(obj == 0); + QVERIFY(!obj); } { QtTestObject obj; diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro index 68d3b48086..f3153b3fd4 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/qmetaobjectbuilder.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmetaobjectbuilder QT = core-private testlib SOURCES = tst_qmetaobjectbuilder.cpp mac:CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 74fcde2e71..6cf45bed1e 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -138,14 +138,14 @@ void tst_QMetaObjectBuilder::create() { QMetaObjectBuilder builder; QVERIFY(builder.className().isEmpty()); - QVERIFY(builder.superClass() == &QObject::staticMetaObject); + QCOMPARE(builder.superClass(), &QObject::staticMetaObject); QCOMPARE(builder.methodCount(), 0); QCOMPARE(builder.constructorCount(), 0); QCOMPARE(builder.propertyCount(), 0); QCOMPARE(builder.enumeratorCount(), 0); QCOMPARE(builder.classInfoCount(), 0); QCOMPARE(builder.relatedMetaObjectCount(), 0); - QVERIFY(builder.staticMetacallFunction() == 0); + QVERIFY(!builder.staticMetacallFunction()); } void tst_QMetaObjectBuilder::className() @@ -174,17 +174,17 @@ void tst_QMetaObjectBuilder::superClass() // Change the super class. builder.setSuperClass(&QObject::staticMetaObject); - QVERIFY(builder.superClass() == &QObject::staticMetaObject); + QCOMPARE(builder.superClass(), &QObject::staticMetaObject); // Change it again. builder.setSuperClass(&staticMetaObject); - QVERIFY(builder.superClass() == &staticMetaObject); + QCOMPARE(builder.superClass(), &staticMetaObject); // Clone the super class off a static QMetaObject. builder.addMetaObject(&QObject::staticMetaObject, QMetaObjectBuilder::SuperClass); - QVERIFY(builder.superClass() == 0); + QVERIFY(!builder.superClass()); builder.addMetaObject(&staticMetaObject, QMetaObjectBuilder::SuperClass); - QVERIFY(builder.superClass() == staticMetaObject.superClass()); + QCOMPARE(builder.superClass(), staticMetaObject.superClass()); // Check that nothing else changed. QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::SuperClass)); @@ -195,11 +195,11 @@ void tst_QMetaObjectBuilder::flags() QMetaObjectBuilder builder; // Check default - QVERIFY(builder.flags() == 0); + QCOMPARE(builder.flags(), 0); // Set flags builder.setFlags(QMetaObjectBuilder::DynamicMetaObject); - QVERIFY(builder.flags() == QMetaObjectBuilder::DynamicMetaObject); + QCOMPARE(builder.flags(), QMetaObjectBuilder::DynamicMetaObject); } void tst_QMetaObjectBuilder::method() @@ -209,12 +209,12 @@ void tst_QMetaObjectBuilder::method() // Check null method QMetaMethodBuilder nullMethod; QCOMPARE(nullMethod.signature(), QByteArray()); - QVERIFY(nullMethod.methodType() == QMetaMethod::Method); + QCOMPARE(nullMethod.methodType(), QMetaMethod::Method); QVERIFY(nullMethod.returnType().isEmpty()); QVERIFY(nullMethod.parameterTypes().isEmpty()); QVERIFY(nullMethod.parameterNames().isEmpty()); QVERIFY(nullMethod.tag().isEmpty()); - QVERIFY(nullMethod.access() == QMetaMethod::Public); + QCOMPARE(nullMethod.access(), QMetaMethod::Public); QCOMPARE(nullMethod.attributes(), 0); QCOMPARE(nullMethod.revision(), 0); QCOMPARE(nullMethod.index(), 0); @@ -222,12 +222,12 @@ void tst_QMetaObjectBuilder::method() // Add a method and check its attributes. QMetaMethodBuilder method1 = builder.addMethod("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.revision(), 0); QCOMPARE(method1.index(), 0); @@ -236,12 +236,12 @@ void tst_QMetaObjectBuilder::method() // Add another method and check again. QMetaMethodBuilder method2 = builder.addMethod("bar(QString)", "int"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("int")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.revision(), 0); QCOMPARE(method2.index(), 1); @@ -262,22 +262,22 @@ void tst_QMetaObjectBuilder::method() // Check that method1 is changed, but method2 is not. QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("int")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(method1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(method1.tag(), QByteArray("tag")); - QVERIFY(method1.access() == QMetaMethod::Private); + QCOMPARE(method1.access(), QMetaMethod::Private); QCOMPARE(method1.attributes(), 42); QCOMPARE(method1.revision(), 123); QCOMPARE(method1.index(), 0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("int")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.revision(), 0); QCOMPARE(method2.index(), 1); @@ -293,22 +293,22 @@ void tst_QMetaObjectBuilder::method() // This time check that only method2 changed. QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Method); + QCOMPARE(method1.methodType(), QMetaMethod::Method); QCOMPARE(method1.returnType(), QByteArray("int")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(method1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(method1.tag(), QByteArray("tag")); - QVERIFY(method1.access() == QMetaMethod::Private); + QCOMPARE(method1.access(), QMetaMethod::Private); QCOMPARE(method1.attributes(), 42); QCOMPARE(method1.revision(), 123); QCOMPARE(method1.index(), 0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("QString")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(method2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(method2.tag(), QByteArray("Q_FOO")); - QVERIFY(method2.access() == QMetaMethod::Protected); + QCOMPARE(method2.access(), QMetaMethod::Protected); QCOMPARE(method2.attributes(), 24); QCOMPARE(method2.revision(), 321); QCOMPARE(method2.index(), 1); @@ -319,12 +319,12 @@ void tst_QMetaObjectBuilder::method() QCOMPARE(builder.methodCount(), 1); method2 = builder.method(0); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Method); + QCOMPARE(method2.methodType(), QMetaMethod::Method); QCOMPARE(method2.returnType(), QByteArray("QString")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(method2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(method2.tag(), QByteArray("Q_FOO")); - QVERIFY(method2.access() == QMetaMethod::Protected); + QCOMPARE(method2.access(), QMetaMethod::Protected); QCOMPARE(method2.attributes(), 24); QCOMPARE(method2.revision(), 321); QCOMPARE(method2.index(), 0); @@ -347,12 +347,12 @@ void tst_QMetaObjectBuilder::slot() // Add a slot and check its attributes. QMetaMethodBuilder method1 = builder.addSlot("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Slot); + QCOMPARE(method1.methodType(), QMetaMethod::Slot); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.index(), 0); QCOMPARE(builder.methodCount(), 1); @@ -360,12 +360,12 @@ void tst_QMetaObjectBuilder::slot() // Add another slot and check again. QMetaMethodBuilder method2 = builder.addSlot("bar(QString)"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Slot); + QCOMPARE(method2.methodType(), QMetaMethod::Slot); QCOMPARE(method2.returnType(), QByteArray("void")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.index(), 1); QCOMPARE(builder.methodCount(), 2); @@ -386,12 +386,12 @@ void tst_QMetaObjectBuilder::signal() // Add a signal and check its attributes. QMetaMethodBuilder method1 = builder.addSignal("foo(const QString&, int)"); QCOMPARE(method1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(method1.methodType() == QMetaMethod::Signal); + QCOMPARE(method1.methodType(), QMetaMethod::Signal); QCOMPARE(method1.returnType(), QByteArray("void")); QCOMPARE(method1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(method1.parameterNames().isEmpty()); QVERIFY(method1.tag().isEmpty()); - QVERIFY(method1.access() == QMetaMethod::Public); + QCOMPARE(method1.access(), QMetaMethod::Public); QCOMPARE(method1.attributes(), 0); QCOMPARE(method1.index(), 0); QCOMPARE(builder.methodCount(), 1); @@ -399,12 +399,12 @@ void tst_QMetaObjectBuilder::signal() // Add another signal and check again. QMetaMethodBuilder method2 = builder.addSignal("bar(QString)"); QCOMPARE(method2.signature(), QByteArray("bar(QString)")); - QVERIFY(method2.methodType() == QMetaMethod::Signal); + QCOMPARE(method2.methodType(), QMetaMethod::Signal); QCOMPARE(method2.returnType(), QByteArray("void")); QCOMPARE(method2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(method2.parameterNames().isEmpty()); QVERIFY(method2.tag().isEmpty()); - QVERIFY(method2.access() == QMetaMethod::Public); + QCOMPARE(method2.access(), QMetaMethod::Public); QCOMPARE(method2.attributes(), 0); QCOMPARE(method2.index(), 1); QCOMPARE(builder.methodCount(), 2); @@ -425,12 +425,12 @@ void tst_QMetaObjectBuilder::constructor() // Add a constructor and check its attributes. QMetaMethodBuilder ctor1 = builder.addConstructor("foo(const QString&, int)"); QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QVERIFY(ctor1.returnType().isEmpty()); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QVERIFY(ctor1.parameterNames().isEmpty()); QVERIFY(ctor1.tag().isEmpty()); - QVERIFY(ctor1.access() == QMetaMethod::Public); + QCOMPARE(ctor1.access(), QMetaMethod::Public); QCOMPARE(ctor1.attributes(), 0); QCOMPARE(ctor1.index(), 0); QCOMPARE(builder.constructorCount(), 1); @@ -438,12 +438,12 @@ void tst_QMetaObjectBuilder::constructor() // Add another constructor and check again. QMetaMethodBuilder ctor2 = builder.addConstructor("bar(QString)"); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QVERIFY(ctor2.returnType().isEmpty()); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(ctor2.parameterNames().isEmpty()); QVERIFY(ctor2.tag().isEmpty()); - QVERIFY(ctor2.access() == QMetaMethod::Public); + QCOMPARE(ctor2.access(), QMetaMethod::Public); QCOMPARE(ctor2.attributes(), 0); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -464,21 +464,21 @@ void tst_QMetaObjectBuilder::constructor() // Check that ctor1 is changed, but ctor2 is not. QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor1.returnType(), QByteArray("int")); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(ctor1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(ctor1.tag(), QByteArray("tag")); - QVERIFY(ctor1.access() == QMetaMethod::Private); + QCOMPARE(ctor1.access(), QMetaMethod::Private); QCOMPARE(ctor1.attributes(), 42); QCOMPARE(ctor1.index(), 0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QVERIFY(ctor2.returnType().isEmpty()); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QVERIFY(ctor2.parameterNames().isEmpty()); QVERIFY(ctor2.tag().isEmpty()); - QVERIFY(ctor2.access() == QMetaMethod::Public); + QCOMPARE(ctor2.access(), QMetaMethod::Public); QCOMPARE(ctor2.attributes(), 0); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -492,21 +492,21 @@ void tst_QMetaObjectBuilder::constructor() // This time check that only ctor2 changed. QCOMPARE(ctor1.signature(), QByteArray("foo(QString,int)")); - QVERIFY(ctor1.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor1.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor1.returnType(), QByteArray("int")); QCOMPARE(ctor1.parameterTypes(), QList<QByteArray>() << "QString" << "int"); QCOMPARE(ctor1.parameterNames(), QList<QByteArray>() << "a" << "b"); QCOMPARE(ctor1.tag(), QByteArray("tag")); - QVERIFY(ctor1.access() == QMetaMethod::Private); + QCOMPARE(ctor1.access(), QMetaMethod::Private); QCOMPARE(ctor1.attributes(), 42); QCOMPARE(ctor1.index(), 0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor2.returnType(), QByteArray("QString")); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(ctor2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(ctor2.tag(), QByteArray("Q_FOO")); - QVERIFY(ctor2.access() == QMetaMethod::Protected); + QCOMPARE(ctor2.access(), QMetaMethod::Protected); QCOMPARE(ctor2.attributes(), 24); QCOMPARE(ctor2.index(), 1); QCOMPARE(builder.constructorCount(), 2); @@ -516,12 +516,12 @@ void tst_QMetaObjectBuilder::constructor() QCOMPARE(builder.constructorCount(), 1); ctor2 = builder.constructor(0); QCOMPARE(ctor2.signature(), QByteArray("bar(QString)")); - QVERIFY(ctor2.methodType() == QMetaMethod::Constructor); + QCOMPARE(ctor2.methodType(), QMetaMethod::Constructor); QCOMPARE(ctor2.returnType(), QByteArray("QString")); QCOMPARE(ctor2.parameterTypes(), QList<QByteArray>() << "QString"); QCOMPARE(ctor2.parameterNames(), QList<QByteArray>() << "c"); QCOMPARE(ctor2.tag(), QByteArray("Q_FOO")); - QVERIFY(ctor2.access() == QMetaMethod::Protected); + QCOMPARE(ctor2.access(), QMetaMethod::Protected); QCOMPARE(ctor2.attributes(), 24); QCOMPARE(ctor2.index(), 0); @@ -536,10 +536,10 @@ void tst_QMetaObjectBuilder::constructor() QCOMPARE(builder.constructorCount(), 2); QCOMPARE(prototypeConstructor.signature(), QByteArray("SomethingOfEverything()")); - QVERIFY(prototypeConstructor.methodType() == QMetaMethod::Constructor); + QCOMPARE(prototypeConstructor.methodType(), QMetaMethod::Constructor); QCOMPARE(prototypeConstructor.returnType(), QByteArray()); QVERIFY(prototypeConstructor.parameterTypes().isEmpty()); - QVERIFY(prototypeConstructor.access() == QMetaMethod::Public); + QCOMPARE(prototypeConstructor.access(), QMetaMethod::Public); QCOMPARE(prototypeConstructor.index(), 1); // Check that nothing else changed. @@ -967,13 +967,13 @@ void tst_QMetaObjectBuilder::relatedMetaObject() // Add two related meta objects and check their attributes. QCOMPARE(builder.addRelatedMetaObject(&QObject::staticMetaObject), 0); QCOMPARE(builder.addRelatedMetaObject(&staticMetaObject), 1); - QVERIFY(builder.relatedMetaObject(0) == &QObject::staticMetaObject); - QVERIFY(builder.relatedMetaObject(1) == &staticMetaObject); + QCOMPARE(builder.relatedMetaObject(0), &QObject::staticMetaObject); + QCOMPARE(builder.relatedMetaObject(1), &staticMetaObject); QCOMPARE(builder.relatedMetaObjectCount(), 2); // Remove the first one and check again. builder.removeRelatedMetaObject(0); - QVERIFY(builder.relatedMetaObject(0) == &staticMetaObject); + QCOMPARE(builder.relatedMetaObject(0), &staticMetaObject); QCOMPARE(builder.relatedMetaObjectCount(), 1); // Check that nothing else changed. @@ -1617,7 +1617,7 @@ void tst_QMetaObjectBuilder::usage_slot() QVERIFY(index != -1); QMetaMethod voidSlotInt = testObject->metaObject()->method(index); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); QVERIFY(voidSlotInt.invoke(testObject.data(), Q_ARG(int, 123))); QCOMPARE(testObject->voidSlotIntArgument(), 123); } @@ -1658,7 +1658,7 @@ void tst_QMetaObjectBuilder::usage_connect() QVERIFY(QObject::connect(testObject.data(), SIGNAL(intPropChanged(int)), testObject.data(), SLOT(voidSlotInt(int)))); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); testObject->setProperty("intProp", 123); QCOMPARE(testObject->voidSlotIntArgument(), 123); @@ -1674,7 +1674,7 @@ void tst_QMetaObjectBuilder::usage_templateConnect() testObject.data(), &TestObject::voidSlotInt); QVERIFY(con); - QVERIFY(testObject->voidSlotIntArgument() == -1); + QCOMPARE(testObject->voidSlotIntArgument(), -1); testObject->setProperty("intProp", 123); QCOMPARE(testObject->voidSlotIntArgument(), 123); diff --git a/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro index f103abdd2b..1f338a909b 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro +++ b/tests/auto/corelib/kernel/qmetaproperty/qmetaproperty.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmetaproperty QT = core testlib SOURCES = tst_qmetaproperty.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro index fc262b8fc7..1d4e647a4b 100644 --- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro +++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmetatype QT = core testlib INCLUDEPATH += $$PWD/../../../other/qvariant_common diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 10ffa06245..1fde3d4cff 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -193,8 +193,11 @@ protected: Bar space[1]; space[0].~Bar(); + const QByteArray postFix = '_' + + QByteArray::number(reinterpret_cast<quintptr>(QThread::currentThreadId())); + for (int i = 0; i < 1000; ++i) { - const QByteArray name = QString("Bar%1_%2").arg(i).arg((size_t)QThread::currentThreadId()).toLatin1(); + const QByteArray name = "Bar" + QByteArray::number(i) + postFix; const char *nm = name.constData(); int tp = qRegisterMetaType<Bar>(nm); #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) @@ -2394,8 +2397,8 @@ void tst_QMetaType::compareCustomEqualOnlyType() QVERIFY(variant50 != variant100x); QVERIFY(variant100 != variant50); QVERIFY(variant100x != variant50); - QVERIFY(variant100 == variant100x); - QVERIFY(variant100 == variant100); + QCOMPARE(variant100, variant100x); + QCOMPARE(variant100, variant100); // compare always fails QVERIFY(!(variant50 < variant50)); diff --git a/tests/auto/corelib/kernel/qmimedata/qmimedata.pro b/tests/auto/corelib/kernel/qmimedata/qmimedata.pro index 51389da6ee..502ec78024 100644 --- a/tests/auto/corelib/kernel/qmimedata/qmimedata.pro +++ b/tests/auto/corelib/kernel/qmimedata/qmimedata.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmimedata QT += testlib SOURCES = tst_qmimedata.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp index d368d9961b..4f88dc2a76 100644 --- a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp +++ b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp @@ -101,7 +101,7 @@ void tst_QMimeData::data() const // set text, verify mimeData.setData("text/plain", "pirates"); QCOMPARE(mimeData.data("text/plain"), QByteArray("pirates")); - QVERIFY(mimeData.data("text/html").length() == 0); + QCOMPARE(mimeData.data("text/html").length(), 0); // html time mimeData.setData("text/html", "ninjas"); diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro index b08dfb1838..125915047a 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.pro @@ -12,4 +12,3 @@ SOURCES += signalbug.cpp # This app is testdata for tst_qobject target.path = $$[QT_INSTALL_TESTS]/tst_qobject/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qobject/test/test.pro b/tests/auto/corelib/kernel/qobject/test/test.pro index 0a15ae384e..e9c1537fa7 100644 --- a/tests/auto/corelib/kernel/qobject/test/test.pro +++ b/tests/auto/corelib/kernel/qobject/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase console -CONFIG += parallel_test TARGET = ../tst_qobject QT = core-private network testlib SOURCES = ../tst_qobject.cpp diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index a3c6d8e9df..90f7780344 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -2038,57 +2038,57 @@ void tst_QObject::metamethod() m = mobj->method(mobj->indexOfMethod("invoke1()")); QVERIFY(m.methodSignature() == "invoke1()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke1()")); QVERIFY(m.methodSignature() == "sinvoke1()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("invoke2()")); QVERIFY(m.methodSignature() == "invoke2()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Protected); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Protected); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke2()")); QVERIFY(m.methodSignature() == "sinvoke2()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Protected); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Protected); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("invoke3()")); QVERIFY(m.methodSignature() == "invoke3()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Private); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Private); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("sinvoke3()")); QVERIFY(m.methodSignature() == "sinvoke3()"); - QVERIFY(m.methodType() == QMetaMethod::Method); - QVERIFY(m.access() == QMetaMethod::Private); + QCOMPARE(m.methodType(), QMetaMethod::Method); + QCOMPARE(m.access(), QMetaMethod::Private); QVERIFY((m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("signal5()")); QVERIFY(m.methodSignature() == "signal5()"); - QVERIFY(m.methodType() == QMetaMethod::Signal); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Signal); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY((m.attributes() & QMetaMethod::Compatibility)); m = mobj->method(mobj->indexOfMethod("aPublicSlot()")); QVERIFY(m.methodSignature() == "aPublicSlot()"); - QVERIFY(m.methodType() == QMetaMethod::Slot); - QVERIFY(m.access() == QMetaMethod::Public); + QCOMPARE(m.methodType(), QMetaMethod::Slot); + QCOMPARE(m.access(), QMetaMethod::Public); QVERIFY(!(m.attributes() & QMetaMethod::Scriptable)); QVERIFY(!(m.attributes() & QMetaMethod::Compatibility)); @@ -2360,7 +2360,7 @@ void tst_QObject::testUserData() int id = user_data_ids[i]; CustomData *data = static_cast<CustomData *>(my_test_object.userData(id)); QVERIFY(data != 0); - QVERIFY(data->id == id); + QCOMPARE(data->id, id); } } @@ -2902,12 +2902,12 @@ void tst_QObject::floatProperty() QVERIFY(idx > 0); QMetaProperty prop = obj.metaObject()->property(idx); QVERIFY(prop.isValid()); - QVERIFY(prop.type() == uint(QMetaType::type("float"))); + QCOMPARE(int(prop.type()), QMetaType::type("float")); QVERIFY(!prop.write(&obj, QVariant("Hello"))); QVERIFY(prop.write(&obj, QVariant::fromValue(128.0f))); QVariant v = prop.read(&obj); - QVERIFY(int(v.userType()) == QMetaType::Float); - QVERIFY(qvariant_cast<float>(v) == 128.0f); + QCOMPARE(v.userType(), int(QMetaType::Float)); + QCOMPARE(qvariant_cast<float>(v), 128.0f); } void tst_QObject::qrealProperty() @@ -2917,18 +2917,18 @@ void tst_QObject::qrealProperty() QVERIFY(idx > 0); QMetaProperty prop = obj.metaObject()->property(idx); QVERIFY(prop.isValid()); - QVERIFY(prop.type() == uint(QMetaType::type("qreal"))); + QCOMPARE(int(prop.type()), QMetaType::type("qreal")); QVERIFY(!prop.write(&obj, QVariant("Hello"))); QVERIFY(prop.write(&obj, QVariant::fromValue(128.0f))); QVariant v = prop.read(&obj); QCOMPARE(v.userType(), qMetaTypeId<qreal>()); - QVERIFY(qvariant_cast<qreal>(v) == 128.0); + QCOMPARE(qvariant_cast<qreal>(v), 128.0); QVERIFY(prop.write(&obj, QVariant::fromValue(double(127)))); v = prop.read(&obj); QCOMPARE(v.userType(), qMetaTypeId<qreal>()); - QVERIFY(qvariant_cast<qreal>(v) == 127.0); + QCOMPARE(qvariant_cast<qreal>(v), 127.0); } class DynamicPropertyObject : public PropertyObject @@ -2994,7 +2994,7 @@ void tst_QObject::recursiveSignalEmission() proc.start(path); QVERIFY2(proc.waitForStarted(), qPrintable(QString::fromLatin1("Cannot start '%1': %2").arg(path, proc.errorString()))); QVERIFY(proc.waitForFinished()); - QVERIFY(proc.exitStatus() == QProcess::NormalExit); + QCOMPARE(proc.exitStatus(), QProcess::NormalExit); QCOMPARE(proc.exitCode(), 0); #endif } diff --git a/tests/auto/corelib/kernel/qpointer/qpointer.pro b/tests/auto/corelib/kernel/qpointer/qpointer.pro index 4b573cb6a5..02765efdbd 100644 --- a/tests/auto/corelib/kernel/qpointer/qpointer.pro +++ b/tests/auto/corelib/kernel/qpointer/qpointer.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpointer QT = core testlib qtHaveModule(widgets): QT += widgets SOURCES = tst_qpointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 26bb70fc66..2cba521b61 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -145,7 +145,7 @@ void tst_QSharedMemory::init() { existingSharedMemory = new QSharedMemory(EXISTING_SHARE); if (!existingSharedMemory->create(EXISTING_SIZE)) { - QVERIFY(existingSharedMemory->error() == QSharedMemory::AlreadyExists); + QCOMPARE(existingSharedMemory->error(), QSharedMemory::AlreadyExists); } } @@ -244,10 +244,10 @@ void tst_QSharedMemory::constructor() QSharedMemory sm; QCOMPARE(sm.key(), QString()); QVERIFY(!sm.isAttached()); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); } void tst_QSharedMemory::key_data() @@ -288,8 +288,8 @@ void tst_QSharedMemory::key() QCOMPARE(sm.isAttached(), false); QCOMPARE(sm.error(), QSharedMemory::NoError); - QVERIFY(sm.errorString() == QString()); - QVERIFY(sm.data() == 0); + QCOMPARE(sm.errorString(), QString()); + QVERIFY(!sm.data()); QCOMPARE(sm.size(), 0); QCOMPARE(sm.detach(), false); @@ -328,11 +328,11 @@ void tst_QSharedMemory::create() qDebug() << sm.errorString(); QCOMPARE(sm.key(), key); if (canCreate) { - QVERIFY(sm.errorString() == QString()); + QCOMPARE(sm.errorString(), QString()); QVERIFY(sm.data() != 0); QVERIFY(sm.size() != 0); } else { - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); QVERIFY(sm.errorString() != QString()); } } @@ -377,10 +377,10 @@ void tst_QSharedMemory::attach() QVERIFY(sm.size() != 0); QVERIFY(sm.detach()); QCOMPARE(sm.size(), 0); - QVERIFY(sm.data() == 0); + QVERIFY(!sm.data()); } else { - QVERIFY(sm.data() == 0); - QVERIFY(sm.size() == 0); + QVERIFY(!sm.data()); + QCOMPARE(sm.size(), 0); QVERIFY(sm.errorString() != QString()); QVERIFY(!sm.detach()); } @@ -481,7 +481,7 @@ void tst_QSharedMemory::useTooMuchMemory() bool success = true; int count = 0; while (success) { - QString key = QString("maxmemorytest_%1").arg(count++); + QString key = QLatin1String("maxmemorytest_") + QString::number(count++); QSharedMemory *sm = new QSharedMemory(rememberKey(key)); QVERIFY(sm); jail.append(sm); @@ -498,7 +498,7 @@ void tst_QSharedMemory::useTooMuchMemory() QVERIFY(!sm->isAttached()); QCOMPARE(sm->key(), key); QCOMPARE(sm->size(), 0); - QVERIFY(sm->data() == 0); + QVERIFY(!sm->data()); if (sm->error() != QSharedMemory::OutOfResources) qDebug() << sm->error() << sm->errorString(); // ### Linux won't return OutOfResources if there are not enough semaphores to use. @@ -535,7 +535,7 @@ void tst_QSharedMemory::attachTooMuch() QVERIFY(!war->isAttached()); QCOMPARE(war->key(), government.key()); QCOMPARE(war->size(), 0); - QVERIFY(war->data() == 0); + QVERIFY(!war->data()); QCOMPARE(war->error(), QSharedMemory::OutOfResources); QVERIFY(war->errorString() != QString()); QVERIFY(!war->detach()); diff --git a/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro index c6c6f379eb..6e4913db5d 100644 --- a/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro +++ b/tests/auto/corelib/kernel/qsignalblocker/qsignalblocker.pro @@ -1,7 +1,5 @@ CONFIG += testcase console -CONFIG += parallel_test TARGET = tst_qsignalblocker QT = core testlib SOURCES = tst_qsignalblocker.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro index 526db5eef3..418d6dce62 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro +++ b/tests/auto/corelib/kernel/qsignalmapper/qsignalmapper.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsignalmapper QT = core testlib SOURCES = tst_qsignalmapper.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp index 579aa78ac4..8a5275e032 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp +++ b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp @@ -97,16 +97,16 @@ void tst_QSignalMapper::mapped() connect(&mapper, SIGNAL(mapped(QString)), &target, SLOT(myslot(QString))); src1.emit_mysignal(20); - QVERIFY(target.id == 1); + QCOMPARE(target.id, 1); QVERIFY(target.str.isEmpty()); src2.emit_mysignal(20); - QVERIFY(target.id == 2); - QVERIFY(target.str == "two"); + QCOMPARE(target.id, 2); + QCOMPARE(target.str, QLatin1String("two")); src3.emit_mysignal(20); - QVERIFY(target.id == 2); - QVERIFY(target.str == "three"); + QCOMPARE(target.id, 2); + QCOMPARE(target.str, QLatin1String("three")); } QTEST_MAIN(tst_QSignalMapper) diff --git a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro index 303a96c68f..58e4b98af7 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/corelib/kernel/qsocketnotifier/qsocketnotifier.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsocketnotifier QT = core-private network-private testlib SOURCES = tst_qsocketnotifier.cpp @@ -7,4 +6,3 @@ SOURCES = tst_qsocketnotifier.cpp requires(contains(QT_CONFIG,private_tests)) include(../../../network/socket/platformsocketengine/platformsocketengine.pri) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp index f49da1f5a8..30ce65849d 100644 --- a/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/corelib/kernel/qsocketnotifier/tst_qsocketnotifier.cpp @@ -151,7 +151,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() readEnd1.initialize(QAbstractSocket::TcpSocket); readEnd1.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd1.waitForWrite()); - QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd1.state(), QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd1 = server.nextPendingConnection(); QVERIFY(writeEnd1 != 0); @@ -160,7 +160,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() readEnd2.initialize(QAbstractSocket::TcpSocket); readEnd2.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd2.waitForWrite()); - QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd2.state(), QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd2 = server.nextPendingConnection(); QVERIFY(writeEnd2 != 0); @@ -186,8 +186,8 @@ void tst_QSocketNotifier::unexpectedDisconnection() QVERIFY(timer.isActive()); //escape if test would hang } while(tester.sequence <= 0); - QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); - QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); + QCOMPARE(readEnd1.state(), QAbstractSocket::ConnectedState); + QCOMPARE(readEnd2.state(), QAbstractSocket::ConnectedState); QCOMPARE(tester.sequence, 2); diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index 169a13aff2..0c0fdb8067 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -191,13 +191,13 @@ void tst_QSystemSemaphore::basicProcesses() acquire.start(m_helperBinary, QStringList("acquire")); QVERIFY2(acquire.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); - QVERIFY(acquire.state() == QProcess::Running); + QCOMPARE(acquire.state(), QProcess::Running); acquire.kill(); release.start(m_helperBinary, QStringList("release")); QVERIFY2(release.waitForStarted(), "Could not start helper binary"); acquire.waitForFinished(HELPERWAITTIME); release.waitForFinished(HELPERWAITTIME); - QVERIFY(acquire.state() == QProcess::NotRunning); + QCOMPARE(acquire.state(), QProcess::NotRunning); #endif } diff --git a/tests/auto/corelib/kernel/qtimer/qtimer.pro b/tests/auto/corelib/kernel/qtimer/qtimer.pro index 48adf07f64..8afdbb148e 100644 --- a/tests/auto/corelib/kernel/qtimer/qtimer.pro +++ b/tests/auto/corelib/kernel/qtimer/qtimer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimer QT = core testlib SOURCES = tst_qtimer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index b34a3a6beb..c17d81ea9e 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -529,7 +529,7 @@ void tst_QTimer::restartedTimerFiresTooSoon() { RestartedTimerFiresTooSoonObject object; object.timerFired(); - QVERIFY(object.eventLoop.exec() == 0); + QCOMPARE(object.eventLoop.exec(), 0); } class LongLastingSlotClass : public QObject diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index e588f44370..b7a5a85e09 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtranslator QT = core testlib SOURCES = tst_qtranslator.cpp diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 2707b6df41..5e967207d4 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -107,7 +107,7 @@ void tst_QTranslator::load() QTranslator tor( 0 ); tor.load("hellotr_la"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } void tst_QTranslator::load2() @@ -118,7 +118,7 @@ void tst_QTranslator::load2() QByteArray data = file.readAll(); tor.load((const uchar *)data.constData(), data.length()); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } class TranslatorThread : public QThread @@ -129,7 +129,7 @@ class TranslatorThread : public QThread if (tor.isEmpty()) qFatal("Could not load translation"); - if (tor.translate("QPushButton", "Hello world!") != QString::fromLatin1("Hallo Welt!")) + if (tor.translate("QPushButton", "Hello world!") != QLatin1String("Hallo Welt!")) qFatal("Test string was not translated correctlys"); } }; @@ -212,9 +212,9 @@ void tst_QTranslator::plural() tor.load("hellotr_la"); QVERIFY(!tor.isEmpty()); QCoreApplication::installTranslator(&tor); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QLatin1String("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QLatin1String("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QLatin1String("Hallo 2 Welten!")); } void tst_QTranslator::translate_qm_file_generated_with_msgfmt() @@ -240,7 +240,7 @@ void tst_QTranslator::loadFromResource() QTranslator tor; tor.load(":/tst_qtranslator/hellotr_la.qm"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } void tst_QTranslator::loadDirectory() @@ -260,16 +260,16 @@ void tst_QTranslator::dependencies() QTranslator tor; tor.load("dependencies_la"); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); // plural QCoreApplication::installTranslator(&tor); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QString::fromLatin1("Hallo 0 Welten!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QString::fromLatin1("Hallo 1 Welt!")); - QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QString::fromLatin1("Hallo 2 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QLatin1String("Hallo 0 Welten!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 1), QLatin1String("Hallo 1 Welt!")); + QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 2), QLatin1String("Hallo 2 Welten!")); // pick up translation from the file with dependencies - QCOMPARE(tor.translate("QPushButton", "It's a small world"), QString::fromLatin1("Es ist eine kleine Welt")); + QCOMPARE(tor.translate("QPushButton", "It's a small world"), QLatin1String("Es ist eine kleine Welt")); } { @@ -279,7 +279,7 @@ void tst_QTranslator::dependencies() QByteArray data = file.readAll(); tor.load((const uchar *)data.constData(), data.length()); QVERIFY(!tor.isEmpty()); - QCOMPARE(tor.translate("QPushButton", "Hello world!"), QString::fromLatin1("Hallo Welt!")); + QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!")); } } diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro index 39178ba9e6..33e8b6e2ad 100644 --- a/tests/auto/corelib/kernel/qvariant/qvariant.pro +++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro @@ -1,9 +1,11 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qvariant -QT = core testlib +QT = core-private testlib INCLUDEPATH += $$PWD/../../../other/qvariant_common SOURCES = tst_qvariant.cpp RESOURCES += qvariant.qrc DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG, c++11): CONFIG += c++11 +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 6da8f55e61..0c4efcd0c2 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -56,6 +56,7 @@ #include <QBuffer> #include "qnumeric.h" +#include <private/qlocale_p.h> #include "tst_qvariant_common.h" class CustomNonQObject; @@ -351,13 +352,13 @@ void tst_QVariant::constructor_invalid() QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(static_cast<QVariant::Type>(typeId)); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } { QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:")); QVariant variant(typeId, /* copy */ 0); QVERIFY(!variant.isValid()); - QVERIFY(variant.userType() == QMetaType::UnknownType); + QCOMPARE(variant.userType(), int(QMetaType::UnknownType)); } } @@ -901,7 +902,7 @@ void tst_QVariant::toFloat() bool ok; float d = value.toFloat(&ok); QCOMPARE(d, result); - QVERIFY(ok == valueOK); + QCOMPARE(ok, valueOK); } void tst_QVariant::toLongLong_data() @@ -1028,7 +1029,11 @@ void tst_QVariant::toByteArray_data() QTest::newRow( "int" ) << QVariant( -123 ) << QByteArray( "-123" ); QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QByteArray( "123" ); QTest::newRow( "double" ) << QVariant( 123.456 ) << QByteArray( "123.456" ); - QTest::newRow( "float" ) << QVariant( 123.456f ) << QByteArray( "123.456001" ); + + // Conversion from float to double adds bits of which the double-to-string converter doesn't + // know they're insignificant + QTest::newRow( "float" ) << QVariant( 123.456f ) << QByteArray( "123.45600128173828" ); + QTest::newRow( "longlong" ) << QVariant( (qlonglong)34 ) << QByteArray( "34" ); QTest::newRow( "ulonglong" ) << QVariant( (qulonglong)34 ) << QByteArray( "34" ); } @@ -1054,7 +1059,11 @@ void tst_QVariant::toString_data() QTest::newRow( "int" ) << QVariant( -123 ) << QString( "-123" ); QTest::newRow( "uint" ) << QVariant( (uint)123 ) << QString( "123" ); QTest::newRow( "double" ) << QVariant( 123.456 ) << QString( "123.456" ); - QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.456001" ); + + // Conversion from float to double adds bits of which the double-to-string converter doesn't + // know they're insignificant + QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.45600128173828" ); + QTest::newRow( "bool" ) << QVariant( true ) << QString( "true" ); QTest::newRow( "qdate" ) << QVariant( QDate( 2002, 1, 1 ) ) << QString( "2002-01-01" ); QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56" ); @@ -1323,9 +1332,9 @@ void tst_QVariant::writeToReadFromDataStream() // the uninitialized float can be NaN (observed on Windows Mobile 5 ARMv4i) float readFloat = qvariant_cast<float>(readVariant); float writtenFloat = qvariant_cast<float>(writeVariant); - QVERIFY(qIsNaN(readFloat) == qIsNaN(writtenFloat)); + QCOMPARE(qIsNaN(readFloat), qIsNaN(writtenFloat)); if (!qIsNaN(readFloat)) - QVERIFY(readFloat == writtenFloat); + QCOMPARE(readFloat, writtenFloat); } break; } @@ -1411,12 +1420,28 @@ void tst_QVariant::operator_eq_eq_data() QVariant mUIntQString(QString("42")); QVariant mDouble(42.11); +#ifdef QT_NO_DOUBLECONVERSION + // Without libdouble-conversion we don't get the shortest possible representation. QVariant mDoubleString(QByteArray("42.109999999999999")); - QVariant mDoubleQString(QString("42.109999999999999")); + QVariant mDoubleQString(QByteArray("42.109999999999999")); +#else + // You cannot fool the double-to-string conversion into producing insignificant digits with + // libdouble-conversion. You can, of course, add insignificant digits to the string and fool + // the double-to-double comparison after converting the string to a double. + QVariant mDoubleString(QByteArray("42.11")); + QVariant mDoubleQString(QString("42.11")); +#endif + // Float-to-double conversion produces insignificant extra bits. QVariant mFloat(42.11f); - QVariant mFloatString(QByteArray("42.1100006")); - QVariant mFloatQString(QString("42.1100006")); +#ifdef QT_NO_DOUBLECONVERSION + // The trailing '2' is not significant, but snprintf doesn't know this. + QVariant mFloatString(QByteArray("42.110000610351562")); + QVariant mFloatQString(QString("42.110000610351562")); +#else + QVariant mFloatString(QByteArray("42.11000061035156")); + QVariant mFloatQString(QString("42.11000061035156")); +#endif QVariant mLongLong((qlonglong)-42); QVariant mLongLongString(QByteArray("-42")); @@ -2115,7 +2140,7 @@ void tst_QVariant::userType() QVERIFY(!userVar.canConvert(QVariant::String)); QVariant userVar2(userVar); - QVERIFY(userVar == userVar2); + QCOMPARE(userVar, userVar2); userVar2.setValue(data2); QVERIFY(userVar != userVar2); @@ -2129,7 +2154,7 @@ void tst_QVariant::userType() userVar3.setValue(data2); userVar3 = userVar2; - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); } // At this point all QVariants got destroyed but we have 2 MyType instances. QCOMPARE(instanceCount, 2); @@ -2144,7 +2169,7 @@ void tst_QVariant::userType() QVERIFY(!userVar.canConvert(QVariant::String)); QVariant userVar2(userVar); - QVERIFY(userVar == userVar2); + QCOMPARE(userVar, userVar2); userVar2.setValue(&data2); QVERIFY(userVar != userVar2); @@ -2158,10 +2183,10 @@ void tst_QVariant::userType() /* This check is correct now. userVar2 contains a pointer to data2 and so * does userVar3. */ - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); userVar3 = userVar2; - QVERIFY(userVar2 == userVar3); + QCOMPARE(userVar2, userVar3); } QCOMPARE(instanceCount, 2); @@ -2446,7 +2471,7 @@ void tst_QVariant::saveLoadCustomTypes() qRegisterMetaTypeStreamOperators<Blah>("Blah"); QCOMPARE(v.userType(), tp); - QVERIFY(v.type() == QVariant::UserType); + QCOMPARE(v.type(), QVariant::UserType); { QDataStream stream(&data, QIODevice::WriteOnly); stream << v; @@ -2610,7 +2635,7 @@ void tst_QVariant::qvariant_cast_QObject_derived() { CustomQObjectDerivedNoMetaType *object = new CustomQObjectDerivedNoMetaType(this); QVariant data = QVariant::fromValue(object); - QVERIFY(data.userType() == qMetaTypeId<CustomQObjectDerivedNoMetaType*>()); + QCOMPARE(data.userType(), qMetaTypeId<CustomQObjectDerivedNoMetaType*>()); QCOMPARE(data.value<QObject *>(), object); QCOMPARE(data.value<CustomQObjectDerivedNoMetaType *>(), object); QCOMPARE(data.value<CustomQObject *>(), object); @@ -2619,7 +2644,7 @@ void tst_QVariant::qvariant_cast_QObject_derived() CustomQObjectDerived *object = new CustomQObjectDerived(this); QVariant data = QVariant::fromValue(object); - QVERIFY(data.userType() == qMetaTypeId<CustomQObjectDerived*>()); + QCOMPARE(data.userType(), qMetaTypeId<CustomQObjectDerived*>()); QCOMPARE(data.value<QObject *>(), object); QCOMPARE(data.value<CustomQObjectDerived *>(), object); @@ -2886,10 +2911,10 @@ void tst_QVariant::voidStar() const QVariant v1, v2; v1 = QVariant::fromValue(p1); v2 = v1; - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); v2 = QVariant::fromValue(p2); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); p2 = 0; v2 = QVariant::fromValue(p2); @@ -2906,10 +2931,10 @@ void tst_QVariant::dataStar() const QCOMPARE(qvariant_cast<Data*>(v1), p1); QVariant v2 = v1; - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); v2 = QVariant::fromValue(p1); - QVERIFY(v1 == v2); + QCOMPARE(v1, v2); delete p1; } @@ -3081,8 +3106,8 @@ void tst_QVariant::compareCustomTypes() const /* We compare pointers. */ QVERIFY(variant1 != variant2); - QVERIFY(variant1 == variant1); - QVERIFY(variant2 == variant2); + QCOMPARE(variant1, variant1); + QCOMPARE(variant2, variant2); } void tst_QVariant::timeToDateTime() const @@ -3289,7 +3314,7 @@ void tst_QVariant::toIntFromQString() const void tst_QVariant::toIntFromDouble() const { double d = 2147483630; // max int 2147483647 - QVERIFY((int)d == 2147483630); + QCOMPARE((int)d, 2147483630); QVariant var(d); QVERIFY( var.canConvert( QVariant::Int ) ); @@ -3374,10 +3399,11 @@ void tst_QVariant::numericalConvert() switch (v.userType()) { case QVariant::Double: - QCOMPARE(v.toString() , QString::number(num, 'g', DBL_MANT_DIG * std::log10(2.) + 2)); + QCOMPARE(v.toString() , QString::number(num, 'g', QLocale::FloatingPointShortest)); break; case QMetaType::Float: - QCOMPARE(v.toString() , QString::number(float(num), 'g', FLT_MANT_DIG * std::log10(2.) + 2)); + QCOMPARE(v.toString() , + QString::number(float(num), 'g', QLocale::FloatingPointShortest)); break; } } @@ -3613,8 +3639,17 @@ void tst_QVariant::moreCustomTypes() QCOMPARE(MyNotMovable::count, 0); { +#ifdef QT_NO_DOUBLECONVERSION + // snprintf cannot do "shortest" conversion and always adds noise. PLAY_WITH_VARIANT(12.12, false, "12.119999999999999", 12.12, true); - PLAY_WITH_VARIANT(12.12f, false, "12.1199999", 12.12f, true); +#else + // Double can be printed exactly with libdouble-conversion + PLAY_WITH_VARIANT(12.12, false, "12.12", 12.12, true); +#endif + + // Float is converted to double, adding insignificant bits + PLAY_WITH_VARIANT(12.12f, false, "12.119999885559082", 12.12f, true); + PLAY_WITH_VARIANT('a', false, "a", 'a', true); PLAY_WITH_VARIANT((unsigned char)('a'), false, "a", 'a', true); PLAY_WITH_VARIANT( quint8(12), false, "\xc", 12, true); @@ -4119,7 +4154,7 @@ void tst_QVariant::saveInvalid() QDataStream stream(&data, QIODevice::WriteOnly); stream.setVersion(version); stream << QVariant(); - QVERIFY(stream.status() == QDataStream::Ok); + QCOMPARE(stream.status(), QDataStream::Ok); QVERIFY(data.size() >= 4); QCOMPARE(int(data.constData()[0]), 0); QCOMPARE(int(data.constData()[1]), 0); @@ -4133,7 +4168,7 @@ void tst_QVariant::saveNewBuiltinWithOldStream() QDataStream stream(&data, QIODevice::WriteOnly); stream.setVersion(QDataStream::Qt_3_1); stream << QVariant::fromValue<QJsonValue>(123); // QJsonValue class was introduced in Qt5 - QVERIFY(stream.status() == QDataStream::Ok); + QCOMPARE(stream.status(), QDataStream::Ok); QVERIFY(data.size() >= 4); QCOMPARE(int(data.constData()[0]), 0); QCOMPARE(int(data.constData()[1]), 0); diff --git a/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro index f0ac7c621f..20ec7572fb 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro +++ b/tests/auto/corelib/kernel/qwineventnotifier/qwineventnotifier.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qwineventnotifier QT = core-private testlib SOURCES = tst_qwineventnotifier.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro index d0b834824a..e661ff8412 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro @@ -10,6 +10,5 @@ RESOURCES += $$QT_SOURCE_TREE/src/corelib/mimetypes/mimetypes.qrc RESOURCES += ../testdata.qrc *-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Wshadow -Wno-long-long -Wnon-virtual-dtor -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 unix:!mac:!qnx: DEFINES += USE_XDG_DATA_DIRS diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro index 4add6c2bcd..160f359116 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmimedatabase-xml @@ -11,6 +11,5 @@ RESOURCES += $$QT_SOURCE_TREE/src/corelib/mimetypes/mimetypes.qrc RESOURCES += ../testdata.qrc *-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Wshadow -Wno-long-long -Wnon-virtual-dtor -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 unix:!mac:!qnx: DEFINES += USE_XDG_DATA_DIRS diff --git a/tests/auto/corelib/mimetypes/qmimetype/qmimetype.pro b/tests/auto/corelib/mimetypes/qmimetype/qmimetype.pro index f76a4ab951..1540e75c28 100644 --- a/tests/auto/corelib/mimetypes/qmimetype/qmimetype.pro +++ b/tests/auto/corelib/mimetypes/qmimetype/qmimetype.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmimetype QT = core-private testlib SOURCES = tst_qmimetype.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/plugin.pro b/tests/auto/corelib/plugin/plugin.pro index 506f6abaeb..e6b748e4f4 100644 --- a/tests/auto/corelib/plugin/plugin.pro +++ b/tests/auto/corelib/plugin/plugin.pro @@ -1,7 +1,10 @@ TEMPLATE=subdirs SUBDIRS=\ qfactoryloader \ - qlibrary \ - qplugin \ - qpluginloader \ quuid + +load(qfeatures) +!contains(QT_DISABLED_FEATURES, library): SUBDIRS += \ + qpluginloader \ + qplugin \ + qlibrary diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro index 2496cd2f1e..b7a641959a 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin1/plugin1.pro @@ -9,4 +9,3 @@ DESTDIR = ../bin # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro index e70ed4fb25..b536aff486 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/plugin2/plugin2.pro @@ -9,4 +9,3 @@ DESTDIR = ../bin # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro b/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro index 42bc01e2ed..ace9fe8fd0 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/qfactoryloader.pro @@ -12,4 +12,3 @@ TARGET = tst_qpluginloader INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro index d8dfaac29e..f1e76c31bf 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/test/test.pro +++ b/tests/auto/corelib/plugin/qfactoryloader/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = ../tst_qfactoryloader QT = core-private testlib @@ -19,4 +18,8 @@ win32 { } mac: CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +load(qfeatures) +contains(QT_DISABLED_FEATURES, library) { + LIBS += -L ../bin/ -lplugin1 -lplugin2 +} diff --git a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp index 474f4e9868..92a4dda252 100644 --- a/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp +++ b/tests/auto/corelib/plugin/qfactoryloader/tst_qfactoryloader.cpp @@ -38,6 +38,11 @@ #include "plugin1/plugininterface1.h" #include "plugin2/plugininterface2.h" +#ifdef QT_NO_LIBRARY +Q_IMPORT_PLUGIN(Plugin1) +Q_IMPORT_PLUGIN(Plugin2) +#endif + class tst_QFactoryLoader : public QObject { Q_OBJECT @@ -54,8 +59,9 @@ void tst_QFactoryLoader::initTestCase() { const QString binFolder = QFINDTESTDATA(binFolderC); QVERIFY2(!binFolder.isEmpty(), "Unable to locate 'bin' folder"); - +#ifndef QT_NO_LIBRARY QCoreApplication::setLibraryPaths(QStringList(QFileInfo(binFolder).absolutePath())); +#endif } void tst_QFactoryLoader::usingTwoFactoriesFromSameDir() diff --git a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro index 195e48da93..44bd0be14e 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib/lib.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib/lib.pro @@ -20,4 +20,3 @@ win32 { DESTDIR = ../release/ } } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro index 52dd8b9679..d55747501c 100644 --- a/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro +++ b/tests/auto/corelib/plugin/qlibrary/lib2/lib2.pro @@ -46,4 +46,3 @@ renamed_target.extra = $$member(renamed_target.extra, 0, -2) QMAKE_POST_LINK = $$member(QMAKE_POST_LINK, 0, -2) INSTALLS += target renamed_target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro index 5bdf780fc0..ec58838e71 100644 --- a/tests/auto/corelib/plugin/qlibrary/qlibrary.pro +++ b/tests/auto/corelib/plugin/qlibrary/qlibrary.pro @@ -9,4 +9,3 @@ TARGET = tst_qlibrary # no special install rule for subdir INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro index 27433d59c0..d59cd738bf 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst/tst.pro +++ b/tests/auto/corelib/plugin/qlibrary/tst/tst.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle TARGET = ../tst_qlibrary QT = core testlib @@ -14,4 +13,3 @@ win32 { } TESTDATA += ../library_path/invalid.so -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index f31a7af6dd..8ac4125145 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -96,7 +96,7 @@ static QString sys_qualifiedLibraryName(const QString &fileName) { QString appDir = QCoreApplication::applicationDirPath(); - return appDir + "/" + PREFIX + fileName + SUFFIX; + return appDir + QLatin1Char('/') + PREFIX + fileName + SUFFIX; } QT_FORWARD_DECLARE_CLASS(QLibrary) diff --git a/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro b/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro index a4db0eccf6..ca47df22bd 100644 --- a/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/debugplugin/debugplugin.pro @@ -4,4 +4,3 @@ CONFIG -= release debug_and_release SOURCES = main.cpp QT = core DESTDIR = ../plugins -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qplugin/qplugin.pro b/tests/auto/corelib/plugin/qplugin/qplugin.pro index e8840a0fb2..918ffb44bd 100644 --- a/tests/auto/corelib/plugin/qplugin/qplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/qplugin.pro @@ -25,4 +25,3 @@ mac { SUBDIRS += tst_qplugin.pro -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro b/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro index 0f698312bd..b7dea67894 100644 --- a/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/releaseplugin/releaseplugin.pro @@ -4,4 +4,3 @@ CONFIG -= debug debug_and_release SOURCES = main.cpp QT = core DESTDIR = ../plugins -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro b/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro index d1ffff9c4e..8c6540fe87 100644 --- a/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro +++ b/tests/auto/corelib/plugin/qplugin/tst_qplugin.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qplugin QT = core testlib SOURCES = tst_qplugin.cpp TESTDATA += plugins/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro index 70ab54a964..abfc70883e 100644 --- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.pro @@ -10,4 +10,3 @@ QT = core # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro index c74a00e9a6..bd6f19cb4f 100644 --- a/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro +++ b/tests/auto/corelib/plugin/qpluginloader/lib/lib.pro @@ -11,4 +11,3 @@ win32-msvc: DEFINES += WIN32_MSVC # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro index 5c6c56e389..83d00f7cd8 100644 --- a/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro +++ b/tests/auto/corelib/plugin/qpluginloader/qpluginloader.pro @@ -12,4 +12,3 @@ TARGET = tst_qpluginloader INSTALLS = -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro index 2ea9c27cc9..6ec4a8de05 100644 --- a/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro +++ b/tests/auto/corelib/plugin/qpluginloader/theplugin/theplugin.pro @@ -11,4 +11,3 @@ QT = core # This is testdata for the tst_qpluginloader test. target.path = $$[QT_INSTALL_TESTS]/tst_qpluginloader/bin INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro index 3894c90ae3..101392927c 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro +++ b/tests/auto/corelib/plugin/qpluginloader/tst/tst.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = ../tst_qpluginloader QT = core testlib contains(QT_CONFIG, private_tests): QT += core-private @@ -16,4 +15,3 @@ win32 { } TESTDATA += ../elftest ../machtest -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 72bd38d116..9640c52623 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -95,7 +95,8 @@ static QString sys_qualifiedLibraryName(const QString &fileName) { - QString libname = QFINDTESTDATA(QString("bin/%1%2%3").arg(PREFIX).arg(fileName).arg(SUFFIX)); + QString name = QLatin1String("bin/") + QLatin1String(PREFIX) + fileName + QLatin1String(SUFFIX); + const QString libname = QFINDTESTDATA(name); QFileInfo fi(libname); if (fi.exists()) return fi.canonicalFilePath(); @@ -386,7 +387,8 @@ void tst_QPluginLoader::loadMachO() void tst_QPluginLoader::loadGarbage() { for (int i=0; i<5; i++) { - QPluginLoader lib(QFINDTESTDATA(QString("elftest/garbage%1.so").arg(i+1))); + const QString name = QLatin1String("elftest/garbage") + QString::number(i + 1) + QLatin1String(".so"); + QPluginLoader lib(QFINDTESTDATA(name)); QCOMPARE(lib.load(), false); QVERIFY(lib.errorString() != QString("Unknown error")); } diff --git a/tests/auto/corelib/plugin/quuid/quuid.pro b/tests/auto/corelib/plugin/quuid/quuid.pro index 461956f313..25e24561ae 100644 --- a/tests/auto/corelib/plugin/quuid/quuid.pro +++ b/tests/auto/corelib/plugin/quuid/quuid.pro @@ -4,4 +4,3 @@ SUBDIRS = testProcessUniqueness SUBDIRS += test -CONFIG += parallel_test diff --git a/tests/auto/corelib/plugin/quuid/test/test.pro b/tests/auto/corelib/plugin/quuid/test/test.pro index c8312c0985..562bfbdc25 100644 --- a/tests/auto/corelib/plugin/quuid/test/test.pro +++ b/tests/auto/corelib/plugin/quuid/test/test.pro @@ -1,9 +1,13 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_quuid QT = core testlib SOURCES = ../tst_quuid.cpp +darwin { + OBJECTIVE_SOURCES = ../tst_quuid_darwin.mm + LIBS += -framework Foundation +} + CONFIG(debug_and_release_target) { CONFIG(debug, debug|release) { DESTDIR = ../debug @@ -13,4 +17,3 @@ CONFIG(debug_and_release_target) { } else { DESTDIR = .. } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro index b2f7aaf2d3..5ee7b1a21f 100644 --- a/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro +++ b/tests/auto/corelib/plugin/quuid/testProcessUniqueness/testProcessUniqueness.pro @@ -7,4 +7,3 @@ DESTDIR = ./ # This app is testdata for tst_quuid target.path = $$[QT_INSTALL_TESTS]/tst_quuid/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index f31aed6976..ed549907d2 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -73,6 +73,8 @@ private slots: void qvariant(); void qvariant_conversion(); + void darwinTypes(); + public: // Variables QUuid uuidNS; @@ -223,11 +225,11 @@ void tst_QUuid::equal() QVERIFY( !(uuidA == uuidB) ); QUuid copy(uuidA); - QVERIFY(uuidA == copy); + QCOMPARE(uuidA, copy); QUuid assigned; assigned = uuidA; - QVERIFY(uuidA == assigned); + QCOMPARE(uuidA, assigned); } @@ -406,5 +408,15 @@ void tst_QUuid::qvariant_conversion() QCOMPARE(sv.value<QUuid>(), uuid); } +void tst_QUuid::darwinTypes() +{ +#ifndef Q_OS_DARWIN + QSKIP("This is a Darwin-only test"); +#else + extern void tst_QUuid_darwinTypes(); // in tst_quuid_darwin.mm + tst_QUuid_darwinTypes(); +#endif +} + QTEST_MAIN(tst_QUuid) #include "tst_quuid.moc" diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm new file mode 100644 index 0000000000..251250d4ce --- /dev/null +++ b/tests/auto/corelib/plugin/quuid/tst_quuid_darwin.mm @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore/QUuid> +#include <QtTest/QtTest> + +#include <CoreFoundation/CoreFoundation.h> +#include <Foundation/Foundation.h> + +void tst_QUuid_darwinTypes() +{ + // QUuid <-> CFUUID + { + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const CFUUIDRef cfuuid = qtUuid.toCFUUID(); + QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuid); + CFStringRef cfstring = CFUUIDCreateString(0, cfuuid); + QCOMPARE(QString::fromCFString(cfstring), qtUuid.toString().mid(1, 36).toUpper()); + CFRelease(cfstring); + CFRelease(cfuuid); + } + { + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const CFUUIDRef cfuuid = qtUuid.toCFUUID(); + QUuid qtUuidCopy(qtUuid); + qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify + QCOMPARE(QUuid::fromCFUUID(cfuuid), qtUuidCopy); + CFStringRef cfstring = CFUUIDCreateString(0, cfuuid); + QCOMPARE(QString::fromCFString(cfstring), qtUuidCopy.toString().mid(1, 36).toUpper()); + CFRelease(cfstring); + CFRelease(cfuuid); + } + // QUuid <-> NSUUID + { + QMacAutoReleasePool pool; + + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const NSUUID *nsuuid = qtUuid.toNSUUID(); + QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuid); + QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuid.toString().mid(1, 36).toUpper()); + } + { + QMacAutoReleasePool pool; + + QUuid qtUuid(QByteArrayLiteral("0f7169cc-5711-4af9-99d9-fecb2329fdef")); + const NSUUID *nsuuid = qtUuid.toNSUUID(); + QUuid qtUuidCopy(qtUuid); + qtUuid = QUuid(QByteArrayLiteral("93eec131-13c5-4d13-aaea-e456b4c57efa")); // modify + QCOMPARE(QUuid::fromNSUUID(nsuuid), qtUuidCopy); + QCOMPARE(QString::fromNSString([nsuuid UUIDString]), qtUuidCopy.toString().mid(1, 36).toUpper()); + } +} diff --git a/tests/auto/corelib/statemachine/qstate/qstate.pro b/tests/auto/corelib/statemachine/qstate/qstate.pro index 22e57d5615..e2251ded9d 100644 --- a/tests/auto/corelib/statemachine/qstate/qstate.pro +++ b/tests/auto/corelib/statemachine/qstate/qstate.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstate QT = core testlib SOURCES = tst_qstate.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro index f6fbbc83c6..4f16b2a9ca 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro +++ b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstatemachine QT = core-private testlib qtHaveModule(widgets): QT += widgets SOURCES = tst_qstatemachine.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index cfbb88a123..1ae4057049 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -3036,7 +3036,7 @@ void tst_QStateMachine::graphicsSceneEventTransitions() QVERIFY(runningSpy.isValid()); machine.start(); QTRY_COMPARE(startedSpy.count(), 1); - QVERIFY(finishedSpy.count() == 0); + QCOMPARE(finishedSpy.count(), 0); TEST_RUNNING_CHANGED(true); QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove); scene.sendEvent(textItem, &mouseEvent); @@ -6158,26 +6158,26 @@ void tst_QStateMachine::childModeConstructor() { QStateMachine machine(QState::ExclusiveStates); QCOMPARE(machine.childMode(), QState::ExclusiveStates); - QVERIFY(machine.parent() == 0); - QVERIFY(machine.parentState() == 0); + QVERIFY(!machine.parent()); + QVERIFY(!machine.parentState()); } { QStateMachine machine(QState::ParallelStates); QCOMPARE(machine.childMode(), QState::ParallelStates); - QVERIFY(machine.parent() == 0); - QVERIFY(machine.parentState() == 0); + QVERIFY(!machine.parent()); + QVERIFY(!machine.parentState()); } { QStateMachine machine(QState::ExclusiveStates, this); QCOMPARE(machine.childMode(), QState::ExclusiveStates); QCOMPARE(machine.parent(), static_cast<QObject *>(this)); - QVERIFY(machine.parentState() == 0); + QVERIFY(!machine.parentState()); } { QStateMachine machine(QState::ParallelStates, this); QCOMPARE(machine.childMode(), QState::ParallelStates); QCOMPARE(machine.parent(), static_cast<QObject *>(this)); - QVERIFY(machine.parentState() == 0); + QVERIFY(!machine.parentState()); } QState state; { diff --git a/tests/auto/corelib/thread/qatomicint/qatomicint.pro b/tests/auto/corelib/thread/qatomicint/qatomicint.pro index 1a3f7cc926..89ac465e81 100644 --- a/tests/auto/corelib/thread/qatomicint/qatomicint.pro +++ b/tests/auto/corelib/thread/qatomicint/qatomicint.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qatomicint QT = core testlib SOURCES = tst_qatomicint.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri index e80e71f238..29e9464a4d 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri @@ -13,7 +13,7 @@ equals(FORCE, no-cxx11) { suffix = $$TYPE } -CONFIG += testcase parallel_test +CONFIG += testcase QT = core testlib TARGET = tst_qatomicinteger_$$lower($$suffix) SOURCES = $$PWD/tst_qatomicinteger.cpp diff --git a/tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro b/tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro index 8468496d9c..cce822da6e 100644 --- a/tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro +++ b/tests/auto/corelib/thread/qatomicpointer/qatomicpointer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qatomicpointer QT = core testlib SOURCES = tst_qatomicpointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp index dbc239a3f9..392c4be1c6 100644 --- a/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp +++ b/tests/auto/corelib/thread/qatomicpointer/tst_qatomicpointer.cpp @@ -123,15 +123,15 @@ void tst_QAtomicPointer::constructor() { void *one = this; QAtomicPointer<void> atomic1 = one; - QVERIFY(atomic1.load() == one); + QCOMPARE(atomic1.load(), one); void *two = &one; QAtomicPointer<void> atomic2 = two; - QVERIFY(atomic2.load() == two); + QCOMPARE(atomic2.load(), two); void *three = &two; QAtomicPointer<void> atomic3 = three; - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); } void tst_QAtomicPointer::copy_constructor() @@ -139,19 +139,19 @@ void tst_QAtomicPointer::copy_constructor() void *one = this; QAtomicPointer<void> atomic1 = one; QAtomicPointer<void> atomic1_copy = atomic1; - QVERIFY(atomic1_copy.load() == one); + QCOMPARE(atomic1_copy.load(), one); QCOMPARE(atomic1_copy.load(), atomic1.load()); void *two = &one; QAtomicPointer<void> atomic2 = two; QAtomicPointer<void> atomic2_copy = atomic2; - QVERIFY(atomic2_copy.load() == two); + QCOMPARE(atomic2_copy.load(), two); QCOMPARE(atomic2_copy.load(), atomic2.load()); void *three = &two; QAtomicPointer<void> atomic3 = three; QAtomicPointer<void> atomic3_copy = atomic3; - QVERIFY(atomic3_copy.load() == three); + QCOMPARE(atomic3_copy.load(), three); QCOMPARE(atomic3_copy.load(), atomic3.load()); } @@ -165,17 +165,17 @@ void tst_QAtomicPointer::assignment_operator() QAtomicPointer<void> atomic2 = two; QAtomicPointer<void> atomic3 = three; - QVERIFY(atomic1.load() == one); - QVERIFY(atomic2.load() == two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic1.load(), one); + QCOMPARE(atomic2.load(), two); + QCOMPARE(atomic3.load(), three); atomic1 = two; atomic2 = three; atomic3 = one; - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } void tst_QAtomicPointer::isTestAndSetNative() @@ -240,15 +240,15 @@ void tst_QAtomicPointer::testAndSet() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QVERIFY(atomic1.testAndSetRelaxed(one, two)); QVERIFY(atomic2.testAndSetRelaxed(two, three)); QVERIFY(atomic3.testAndSetRelaxed(three, one)); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -258,15 +258,15 @@ void tst_QAtomicPointer::testAndSet() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QVERIFY(atomic1.testAndSetAcquire(one, two)); QVERIFY(atomic2.testAndSetAcquire(two, three)); QVERIFY(atomic3.testAndSetAcquire(three, one)); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -276,15 +276,15 @@ void tst_QAtomicPointer::testAndSet() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QVERIFY(atomic1.testAndSetRelease(one, two)); QVERIFY(atomic2.testAndSetRelease(two, three)); QVERIFY(atomic3.testAndSetRelease(three, one)); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -294,15 +294,15 @@ void tst_QAtomicPointer::testAndSet() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QVERIFY(atomic1.testAndSetOrdered(one, two)); QVERIFY(atomic2.testAndSetOrdered(two, three)); QVERIFY(atomic3.testAndSetOrdered(three, one)); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } } @@ -368,15 +368,15 @@ void tst_QAtomicPointer::fetchAndStore() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QCOMPARE(atomic1.fetchAndStoreRelaxed(two), one); QCOMPARE(atomic2.fetchAndStoreRelaxed(three), two); QCOMPARE(atomic3.fetchAndStoreRelaxed(one), three); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -386,15 +386,15 @@ void tst_QAtomicPointer::fetchAndStore() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QCOMPARE(atomic1.fetchAndStoreAcquire(two), one); QCOMPARE(atomic2.fetchAndStoreAcquire(three), two); QCOMPARE(atomic3.fetchAndStoreAcquire(one), three); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -404,15 +404,15 @@ void tst_QAtomicPointer::fetchAndStore() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QCOMPARE(atomic1.fetchAndStoreRelease(two), one); QCOMPARE(atomic2.fetchAndStoreRelease(three), two); QCOMPARE(atomic3.fetchAndStoreRelease(one), three); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } { @@ -422,15 +422,15 @@ void tst_QAtomicPointer::fetchAndStore() QCOMPARE(atomic1.load(), one); QCOMPARE(atomic2.load(), two); - QVERIFY(atomic3.load() == three); + QCOMPARE(atomic3.load(), three); QCOMPARE(atomic1.fetchAndStoreOrdered(two), one); QCOMPARE(atomic2.fetchAndStoreOrdered(three), two); QCOMPARE(atomic3.fetchAndStoreOrdered(one), three); - QVERIFY(atomic1.load() == two); - QVERIFY(atomic2.load() == three); - QVERIFY(atomic3.load() == one); + QCOMPARE(atomic1.load(), two); + QCOMPARE(atomic2.load(), three); + QCOMPARE(atomic3.load(), one); } } diff --git a/tests/auto/corelib/thread/qfuture/qfuture.pro b/tests/auto/corelib/thread/qfuture/qfuture.pro index 36853de2f0..ed9e189668 100644 --- a/tests/auto/corelib/thread/qfuture/qfuture.pro +++ b/tests/auto/corelib/thread/qfuture/qfuture.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qfuture QT = core core-private testlib concurrent SOURCES = tst_qfuture.cpp DEFINES += QT_STRICT_ITERATORS -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index ad690a094b..e9db99f3cd 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -84,9 +84,9 @@ void tst_QFuture::resultStore() { QtPrivate::ResultStore<int> store; - QVERIFY(store.begin() == store.end()); - QVERIFY(store.resultAt(0) == store.end()); - QVERIFY(store.resultAt(1) == store.end()); + QCOMPARE(store.begin(), store.end()); + QCOMPARE(store.resultAt(0), store.end()); + QCOMPARE(store.resultAt(1), store.end()); } @@ -118,7 +118,7 @@ void tst_QFuture::resultStore() store.addResults(-1, &vec1, 2, 2); QtPrivate::ResultIteratorBase it = store.begin(); QCOMPARE(it.resultIndex(), 0); - QVERIFY(it == store.begin()); + QCOMPARE(it, store.begin()); QVERIFY(it != store.end()); ++it; @@ -133,7 +133,7 @@ void tst_QFuture::resultStore() QCOMPARE(it.resultIndex(), 3); ++it; - QVERIFY(it == store.end()); + QCOMPARE(it, store.end()); } { QtPrivate::ResultStoreBase store; @@ -1012,14 +1012,14 @@ void tst_QFuture::iterators() QFuture<int>::const_iterator i1 = f.begin(), i2 = i1 + 1; QFuture<int>::const_iterator c1 = i1, c2 = c1 + 1; - QVERIFY(i1 == i1); - QVERIFY(i1 == c1); - QVERIFY(c1 == i1); - QVERIFY(c1 == c1); - QVERIFY(i2 == i2); - QVERIFY(i2 == c2); - QVERIFY(c2 == i2); - QVERIFY(c2 == c2); + QCOMPARE(i1, i1); + QCOMPARE(i1, c1); + QCOMPARE(c1, i1); + QCOMPARE(c1, c1); + QCOMPARE(i2, i2); + QCOMPARE(i2, c2); + QCOMPARE(c2, i2); + QCOMPARE(c2, c2); QVERIFY(i1 != i2); QVERIFY(i1 != c2); @@ -1061,14 +1061,14 @@ void tst_QFuture::iterators() QFuture<QString>::const_iterator i1 = f.begin(), i2 = i1 + 1; QFuture<QString>::const_iterator c1 = i1, c2 = c1 + 1; - QVERIFY(i1 == i1); - QVERIFY(i1 == c1); - QVERIFY(c1 == i1); - QVERIFY(c1 == c1); - QVERIFY(i2 == i2); - QVERIFY(i2 == c2); - QVERIFY(c2 == i2); - QVERIFY(c2 == c2); + QCOMPARE(i1, i1); + QCOMPARE(i1, c1); + QCOMPARE(c1, i1); + QCOMPARE(c1, c1); + QCOMPARE(i2, i2); + QCOMPARE(i2, c2); + QCOMPARE(c2, i2); + QCOMPARE(c2, c2); QVERIFY(i1 != i2); QVERIFY(i1 != c2); @@ -1438,6 +1438,8 @@ void tst_QFuture::nestedExceptions() QVERIFY(MyClass::caught); } +#endif // QT_NO_EXCEPTIONS + void tst_QFuture::nonGlobalThreadPool() { static Q_CONSTEXPR int Answer = 42; @@ -1485,7 +1487,5 @@ void tst_QFuture::nonGlobalThreadPool() } } -#endif // QT_NO_EXCEPTIONS - QTEST_MAIN(tst_QFuture) #include "tst_qfuture.moc" diff --git a/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro b/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro index a828213ade..5eebd12deb 100644 --- a/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro +++ b/tests/auto/corelib/thread/qfuturesynchronizer/qfuturesynchronizer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qfuturesynchronizer QT = core testlib concurrent SOURCES = tst_qfuturesynchronizer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qfuturewatcher/qfuturewatcher.pro b/tests/auto/corelib/thread/qfuturewatcher/qfuturewatcher.pro index 17c0363ce4..d0e8b4c982 100644 --- a/tests/auto/corelib/thread/qfuturewatcher/qfuturewatcher.pro +++ b/tests/auto/corelib/thread/qfuturewatcher/qfuturewatcher.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qfuturewatcher QT = core core-private testlib concurrent SOURCES = tst_qfuturewatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qmutex/qmutex.pro b/tests/auto/corelib/thread/qmutex/qmutex.pro index dde0a7f88f..229e57eb89 100644 --- a/tests/auto/corelib/thread/qmutex/qmutex.pro +++ b/tests/auto/corelib/thread/qmutex/qmutex.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmutex QT = core testlib SOURCES = tst_qmutex.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro b/tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro index d35eca1009..76ec0471ca 100644 --- a/tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro +++ b/tests/auto/corelib/thread/qmutexlocker/qmutexlocker.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmutexlocker QT = core testlib SOURCES = tst_qmutexlocker.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qreadlocker/qreadlocker.pro b/tests/auto/corelib/thread/qreadlocker/qreadlocker.pro index d391768102..ba46786750 100644 --- a/tests/auto/corelib/thread/qreadlocker/qreadlocker.pro +++ b/tests/auto/corelib/thread/qreadlocker/qreadlocker.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qreadlocker QT = core testlib SOURCES = tst_qreadlocker.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro b/tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro index b38d731049..c108c3d8af 100644 --- a/tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro +++ b/tests/auto/corelib/thread/qreadwritelock/qreadwritelock.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qreadwritelock QT = core testlib SOURCES = tst_qreadwritelock.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qresultstore/qresultstore.pro b/tests/auto/corelib/thread/qresultstore/qresultstore.pro index 5e9e83c503..2f6c18f64c 100644 --- a/tests/auto/corelib/thread/qresultstore/qresultstore.pro +++ b/tests/auto/corelib/thread/qresultstore/qresultstore.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qresultstore QT = core-private testlib concurrent SOURCES = tst_qresultstore.cpp DEFINES += QT_STRICT_ITERATORS -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp b/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp index ff850683ac..821077de18 100644 --- a/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp +++ b/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp @@ -80,9 +80,9 @@ void tst_QtConcurrentResultStore::iterators() { { ResultStore<int> store; - QVERIFY(store.begin() == store.end()); - QVERIFY(store.resultAt(0) == store.end()); - QVERIFY(store.resultAt(1) == store.end()); + QCOMPARE(store.begin(), store.end()); + QCOMPARE(store.resultAt(0), store.end()); + QCOMPARE(store.resultAt(1), store.end()); } { ResultStoreBase storebase; @@ -90,7 +90,7 @@ void tst_QtConcurrentResultStore::iterators() storebase.addResult(1, &int1); // ResultStoreBase does not take ownership, only ResultStore<> does. ResultIteratorBase it = storebase.begin(); QCOMPARE(it.resultIndex(), 0); - QVERIFY(it == storebase.begin()); + QCOMPARE(it, storebase.begin()); QVERIFY(it != storebase.end()); ++it; @@ -100,7 +100,7 @@ void tst_QtConcurrentResultStore::iterators() ++it; QVERIFY(it != storebase.begin()); - QVERIFY(it == storebase.end()); + QCOMPARE(it, storebase.end()); } } @@ -160,7 +160,7 @@ void tst_QtConcurrentResultStore::addResults() store.addResults(-1, &vec1, 2, 2); ResultIteratorBase it = store.begin(); QCOMPARE(it.resultIndex(), 0); - QVERIFY(it == store.begin()); + QCOMPARE(it, store.begin()); QVERIFY(it != store.end()); ++it; @@ -175,7 +175,7 @@ void tst_QtConcurrentResultStore::addResults() QCOMPARE(it.resultIndex(), 3); ++it; - QVERIFY(it == store.end()); + QCOMPARE(it, store.end()); } void tst_QtConcurrentResultStore::resultIndex() diff --git a/tests/auto/corelib/thread/qsemaphore/qsemaphore.pro b/tests/auto/corelib/thread/qsemaphore/qsemaphore.pro index 56e9fd5da6..5a0f0337e6 100644 --- a/tests/auto/corelib/thread/qsemaphore/qsemaphore.pro +++ b/tests/auto/corelib/thread/qsemaphore/qsemaphore.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qsemaphore QT = core testlib SOURCES = tst_qsemaphore.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qthread/qthread.pro b/tests/auto/corelib/thread/qthread/qthread.pro index 9efce4e7ed..18d867ecef 100644 --- a/tests/auto/corelib/thread/qthread/qthread.pro +++ b/tests/auto/corelib/thread/qthread/qthread.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qthread QT = core testlib SOURCES = tst_qthread.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qthreadonce/qthreadonce.pro b/tests/auto/corelib/thread/qthreadonce/qthreadonce.pro index 2c189e7422..e8b95a06a7 100644 --- a/tests/auto/corelib/thread/qthreadonce/qthreadonce.pro +++ b/tests/auto/corelib/thread/qthreadonce/qthreadonce.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qthreadonce QT = core testlib SOURCES = tst_qthreadonce.cpp @@ -10,4 +10,3 @@ SOURCES = tst_qthreadonce.cpp # Temporary: SOURCES += qthreadonce.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp index 0699c50464..7a3054abb0 100644 --- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp @@ -163,7 +163,7 @@ void tst_QThreadOnce::nesting() } } - QVERIFY(variable == 1); + QCOMPARE(variable, 1); } static void reentrant(int control, int &counter) diff --git a/tests/auto/corelib/thread/qthreadpool/qthreadpool.pro b/tests/auto/corelib/thread/qthreadpool/qthreadpool.pro index 387b79b012..eac4ef9365 100644 --- a/tests/auto/corelib/thread/qthreadpool/qthreadpool.pro +++ b/tests/auto/corelib/thread/qthreadpool/qthreadpool.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qthreadpool QT = core testlib SOURCES = tst_qthreadpool.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro index eb8d06d094..94a0a01e94 100644 --- a/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro +++ b/tests/auto/corelib/thread/qthreadstorage/crashonexit/crashonexit.pro @@ -7,4 +7,3 @@ CONFIG += console # This app is testdata for tst_qthreadstorage target.path = $$[QT_INSTALL_TESTS]/tst_qthreadstorage/$$TARGET INSTALLS += target -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro index 2fa973d2f7..d821e56366 100644 --- a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -2,4 +2,4 @@ TEMPLATE = subdirs SUBDIRS = \ crashonexit \ test -CONFIG += ordered parallel_test +CONFIG += ordered diff --git a/tests/auto/corelib/thread/qthreadstorage/test/test.pro b/tests/auto/corelib/thread/qthreadstorage/test/test.pro index 8b7caf1e24..729241f891 100644 --- a/tests/auto/corelib/thread/qthreadstorage/test/test.pro +++ b/tests/auto/corelib/thread/qthreadstorage/test/test.pro @@ -7,4 +7,3 @@ SOURCES = ../tst_qthreadstorage.cpp TEST_HELPER_INSTALLS = ../crashonexit/crashonexit -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro b/tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro index 7383997e67..2098d9dd2f 100644 --- a/tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro +++ b/tests/auto/corelib/thread/qwaitcondition/qwaitcondition.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qwaitcondition QT = core testlib SOURCES = tst_qwaitcondition.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/thread/qwritelocker/qwritelocker.pro b/tests/auto/corelib/thread/qwritelocker/qwritelocker.pro index 4a797975ab..a6c4f70b8d 100644 --- a/tests/auto/corelib/thread/qwritelocker/qwritelocker.pro +++ b/tests/auto/corelib/thread/qwritelocker/qwritelocker.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qwritelocker QT = core testlib SOURCES = tst_qwritelocker.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro index 51ea667f58..5c04515fa0 100644 --- a/tests/auto/corelib/tools/collections/collections.pro +++ b/tests/auto/corelib/tools/collections/collections.pro @@ -2,8 +2,6 @@ CONFIG += testcase TARGET = tst_collections SOURCES += tst_collections.cpp QT = core testlib -CONFIG += parallel_test # This test does not work with strict iterators DEFINES -= QT_STRICT_ITERATORS -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index ae8ffe48be..22a282457b 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -517,11 +517,11 @@ void tst_Collections::list() QList<QString> list = vector.toList(); QVERIFY(list.size() == 5); - QVERIFY(list.at(0) == "99"); - QVERIFY(list.at(4) == "100"); + QCOMPARE(list.at(0), QLatin1String("99")); + QCOMPARE(list.at(4), QLatin1String("100")); list[0] = "10"; - QVERIFY(list.at(0) == "10"); - QVERIFY(vector.at(0) == "99"); + QCOMPARE(list.at(0), QLatin1String("10")); + QCOMPARE(vector.at(0), QLatin1String("99")); } @@ -533,15 +533,15 @@ void tst_Collections::list() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(list.first() == "Xello"); + QCOMPARE(list.first(), QLatin1String("Xello")); QList<QString>::const_iterator cit = list.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = list.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(),QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -575,10 +575,10 @@ void tst_Collections::list() list << "alpha" << "beta"; list += list; QVERIFY(list.size() == 4); - QVERIFY(list.at(0) == "alpha"); - QVERIFY(list.at(1) == "beta"); - QVERIFY(list.at(2) == "alpha"); - QVERIFY(list.at(3) == "beta"); + QCOMPARE(list.at(0), QLatin1String("alpha")); + QCOMPARE(list.at(1), QLatin1String("beta")); + QCOMPARE(list.at(2), QLatin1String("alpha")); + QCOMPARE(list.at(3), QLatin1String("beta")); } // test endcases for inserting into a qlist @@ -954,15 +954,15 @@ void tst_Collections::linkedList() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(list.first() == "Xello"); + QCOMPARE(list.first(), QLatin1String("Xello")); QLinkedList<QString>::const_iterator cit = list.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = list.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -970,10 +970,10 @@ void tst_Collections::linkedList() list << "alpha" << "beta"; list += list; QVERIFY(list.size() == 4); - QVERIFY(*list.begin() == "alpha"); - QVERIFY(*(list.begin() + 1) == "beta"); - QVERIFY(*(list.begin() + 2) == "alpha"); - QVERIFY(*(list.begin() + 3) == "beta"); + QCOMPARE(*list.begin(), QLatin1String("alpha")); + QCOMPARE(*(list.begin() + 1), QLatin1String("beta")); + QCOMPARE(*(list.begin() + 2), QLatin1String("alpha")); + QCOMPARE(*(list.begin() + 3), QLatin1String("beta")); } { @@ -1054,8 +1054,8 @@ void tst_Collections::vector() QVector<QString> vec; vec << "foo" << "bar"; vec.reserve( 512 ); - QVERIFY(vec[0] == "foo"); - QVERIFY(vec[1] == "bar"); + QCOMPARE(vec[0], QLatin1String("foo")); + QCOMPARE(vec[1], QLatin1String("bar")); int initialLargeStaticCount = LargeStatic::count; { @@ -1070,10 +1070,10 @@ void tst_Collections::vector() vector << "alpha" << "beta"; vector += vector; QVERIFY(vector.size() == 4); - QVERIFY(vector.at(0) == "alpha"); - QVERIFY(vector.at(1) == "beta"); - QVERIFY(vector.at(2) == "alpha"); - QVERIFY(vector.at(3) == "beta"); + QCOMPARE(vector.at(0), QLatin1String("alpha")); + QCOMPARE(vector.at(1), QLatin1String("beta")); + QCOMPARE(vector.at(2), QLatin1String("alpha")); + QCOMPARE(vector.at(3), QLatin1String("beta")); } int originalLargeStaticCount = LargeStatic::count; @@ -1594,15 +1594,15 @@ void tst_Collections::hash() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(*hash.begin() == "Xello"); + QCOMPARE(*hash.begin(), QLatin1String("Xello")); QHash<int, QString>::const_iterator cit = hash.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = hash.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -1915,15 +1915,15 @@ void tst_Collections::map() QVERIFY((*it)[0] == QChar('H')); QVERIFY(it->constData()[0] == QChar('H')); it->replace(QChar('H'), QChar('X')); - QVERIFY(*map.begin() == "Xello"); + QCOMPARE(*map.begin(), QLatin1String("Xello")); QMap<int, QString>::const_iterator cit = map.constBegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); cit = map.cbegin(); - QVERIFY((*cit).toLower() == "xello"); - QVERIFY(cit->toUpper() == "XELLO"); + QCOMPARE((*cit).toLower(), QLatin1String("xello")); + QCOMPARE(cit->toUpper(), QLatin1String("XELLO")); } { @@ -2005,17 +2005,17 @@ void tst_Collections::qstring() QVERIFY(hello.left(0) == ""); QVERIFY(!hello.left(0).isNull()); - QVERIFY(hello.left(1) == "h"); - QVERIFY(hello.left(2) == "he"); - QVERIFY(hello.left(200) == "hello"); + QCOMPARE(hello.left(1), QLatin1String("h")); + QCOMPARE(hello.left(2), QLatin1String("he")); + QCOMPARE(hello.left(200), QLatin1String("hello")); QVERIFY(hello.left(hello.size()) == hello); QVERIFY(hello.left(hello.size()+1) == hello); QVERIFY(hello.right(0) == ""); QVERIFY(!hello.right(0).isNull()); - QVERIFY(hello.right(1) == "o"); - QVERIFY(hello.right(2) == "lo"); - QVERIFY(hello.right(200) == "hello"); + QCOMPARE(hello.right(1), QLatin1String("o")); + QCOMPARE(hello.right(2), QLatin1String("lo")); + QCOMPARE(hello.right(200), QLatin1String("hello")); QVERIFY(hello.right(hello.size()) == hello); QVERIFY(hello.right(hello.size()+1) == hello); @@ -2023,16 +2023,16 @@ void tst_Collections::qstring() QVERIFY(hello.mid(0, 1) == "h"); QVERIFY(hello.mid(0, 2) == "he"); QVERIFY(hello.mid(0, 200) == "hello"); - QVERIFY(hello.mid(0) == "hello"); + QCOMPARE(hello.mid(0), QLatin1String("hello")); QVERIFY(hello.mid(0, hello.size()) == hello); QVERIFY(hello.mid(0, hello.size()+1) == hello); QVERIFY(hello.mid(hello.size()-0) == ""); QVERIFY(hello.mid(hello.size()-0).isEmpty()); QVERIFY(!hello.mid(hello.size()-0).isNull()); - QVERIFY(hello.mid(hello.size()-1) == "o"); - QVERIFY(hello.mid(hello.size()-2) == "lo"); - QVERIFY(hello.mid(hello.size()-200) == "hello"); + QCOMPARE(hello.mid(hello.size()-1), QLatin1String("o")); + QCOMPARE(hello.mid(hello.size()-2), QLatin1String("lo")); + QCOMPARE(hello.mid(hello.size()-200), QLatin1String("hello")); QString null; QString nonNull = ""; @@ -2048,7 +2048,7 @@ void tst_Collections::qstring() QString fill = "123"; fill.fill('a'); - QVERIFY(fill == "aaa"); + QCOMPARE(fill, QLatin1String("aaa")); s.clear(); s = hello; @@ -2060,15 +2060,15 @@ void tst_Collections::qstring() QVERIFY(s == helloWorld); s = "012345"; s.insert(3, 'E'); - QVERIFY(s == "012E345"); + QCOMPARE(s, QLatin1String("012E345")); s.insert(3, "INSID"); - QVERIFY(s == "012INSIDE345"); + QCOMPARE(s, QLatin1String("012INSIDE345")); s = "short"; s.insert(7, 'E'); - QVERIFY(s == "short E"); + QCOMPARE(s, QLatin1String("short E")); s = "short"; s.insert(7, "END"); - QVERIFY(s == "short END"); + QCOMPARE(s, QLatin1String("short END")); QVERIFY(QString::fromLatin1("hello") == "hello"); @@ -2125,25 +2125,25 @@ void tst_Collections::qstring() s += QChar((uchar) 0xb0); QVERIFY(s.toUtf8() != s.toLatin1()); QCOMPARE(s[s.length()-1].unicode(), (ushort)0xb0); - QVERIFY(s.left(s.length()-1) == "ascii"); + QCOMPARE(s.left(s.length()-1), QLatin1String("ascii")); QVERIFY(s == QString::fromUtf8(s.toUtf8().constData())); s = "12"; s.append('3'); s += '4'; - QVERIFY(s == "1234"); + QCOMPARE(s, QLatin1String("1234")); s = "repend"; s.prepend('p'); - QVERIFY(s == "prepend"); + QCOMPARE(s, QLatin1String("prepend")); s.prepend("abc "); - QVERIFY(s == "abc prepend"); + QCOMPARE(s, QLatin1String("abc prepend")); s = " whitespace "; - QVERIFY(s.trimmed() == "whitespace"); + QCOMPARE(s.trimmed(), QLatin1String("whitespace")); s = " lots of stuff "; - QVERIFY(s.simplified() == "lots of stuff"); + QCOMPARE(s.simplified(), QLatin1String("lots of stuff")); s = "a hat, a stick, a ski"; QVERIFY(s[2] == 'h'); @@ -2152,17 +2152,17 @@ void tst_Collections::qstring() s = "12223"; s.remove(1, 2); - QVERIFY(s == "123"); + QCOMPARE(s, QLatin1String("123")); s = "(%1)(%2)"; s = s.arg("foo").arg(7); - QVERIFY(s == "(foo)(7)"); + QCOMPARE(s, QLatin1String("(foo)(7)")); s = "stl rocks"; std::string stl_string = s.toStdString(); // TODO: std::string stl_string = s does not work. - QVERIFY(s == "stl rocks"); + QCOMPARE(s, QLatin1String("stl rocks")); s = QString::fromStdString(stl_string); // TODO: s = stl_string does not work. - QVERIFY(s == "stl rocks"); + QCOMPARE(s, QLatin1String("stl rocks")); { QString str("Bananas"); @@ -2178,10 +2178,10 @@ void tst_Collections::qstring() QString str = "Hello"; QString cstr = QString::fromRawData(str.unicode(), str.length()); - QVERIFY(str == "Hello"); - QVERIFY(cstr == "Hello"); + QCOMPARE(str, QLatin1String("Hello")); + QCOMPARE(cstr, QLatin1String("Hello")); cstr.clear(); - QVERIFY(str == "Hello"); + QCOMPARE(str, QLatin1String("Hello")); QVERIFY(cstr.isEmpty()); { @@ -2328,7 +2328,7 @@ void tst_Collections::pair() QPair<int, QString> a(1, "Zebra"), b(2, "Ying"), c(3, "Yang"), d(3, "Ying"), e(5, "Alabama"); QVERIFY(a.first == 1); - QVERIFY(a.second == "Zebra"); + QCOMPARE(a.second, QLatin1String("Zebra")); QVERIFY(a == qMakePair(1, QString("Zebra"))); QVERIFY(a == a && b == b && c == c && d == d && e == e); @@ -3482,7 +3482,7 @@ template<class Container> void foreach_test_arrays(const Container &container) void tst_Collections::foreach_2() { - QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(","); + QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(QLatin1Char(',')); foreach_test_arrays(strlist); foreach_test_arrays(QList<QString>(strlist)); foreach_test_arrays(strlist.toVector()); diff --git a/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro b/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro index cb6f6595b4..0e6e830185 100644 --- a/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro +++ b/tests/auto/corelib/tools/qalgorithms/qalgorithms.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qalgorithms QT = core testlib SOURCES = tst_qalgorithms.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 99e5c4c85d..105b8b45d8 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -312,24 +312,24 @@ void tst_QAlgorithms::swap() { QString a = "1", b = "2"; qSwap(a, b); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(a, a); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(b, b); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); qSwap(a, b); - QVERIFY(a == "1"); - QVERIFY(b == "2"); + QCOMPARE(a, QLatin1String("1")); + QCOMPARE(b, QLatin1String("2")); qSwap(b, a); - QVERIFY(a == "2"); - QVERIFY(b == "1"); + QCOMPARE(a, QLatin1String("2")); + QCOMPARE(b, QLatin1String("1")); } { diff --git a/tests/auto/corelib/tools/qarraydata/qarraydata.pro b/tests/auto/corelib/tools/qarraydata/qarraydata.pro index d5fe08c009..ee3faa9ad7 100644 --- a/tests/auto/corelib/tools/qarraydata/qarraydata.pro +++ b/tests/auto/corelib/tools/qarraydata/qarraydata.pro @@ -2,5 +2,4 @@ TARGET = tst_qarraydata SOURCES += $$PWD/tst_qarraydata.cpp HEADERS += $$PWD/simplevector.h QT = core testlib -CONFIG += testcase parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +CONFIG += testcase diff --git a/tests/auto/corelib/tools/qbitarray/qbitarray.pro b/tests/auto/corelib/tools/qbitarray/qbitarray.pro index 22f62faaca..1e7185b600 100644 --- a/tests/auto/corelib/tools/qbitarray/qbitarray.pro +++ b/tests/auto/corelib/tools/qbitarray/qbitarray.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbitarray QT = core testlib SOURCES = tst_qbitarray.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index d3bbfa338b..5e6459c58b 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -126,9 +126,9 @@ void tst_QBitArray::size() for (int j=0; j<len; j++) { bool b = a[j]; if (b) - S+= "1"; + S+= QLatin1Char('1'); else - S+= "0"; + S+= QLatin1Char('0'); } QTEST(S,"res"); } diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 22104f817f..a4501611d6 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearray QT = core-private testlib SOURCES = tst_qbytearray.cpp TESTDATA += rfc3252.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac { OBJECTIVE_SOURCES += tst_qbytearray_mac.mm diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp index f942eab800..4a8190da6d 100644 --- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp @@ -212,12 +212,12 @@ QByteArray verifyZeroTermination(const QByteArray &ba) const_cast<char *>(baData)[baSize] = 'x'; if ('x' != ba.constData()[baSize]) { - return QString::fromLatin1("*** Failed to replace null-terminator in " - "result ('%1') ***").arg(QString::fromLatin1(ba)).toLatin1(); + return "*** Failed to replace null-terminator in " + "result ('" + ba + "') ***"; } if (ba != baCopy) { - return QString::fromLatin1( "*** Result ('%1') differs from its copy " - "after null-terminator was replaced ***").arg(QString::fromLatin1(ba)).toLatin1(); + return "*** Result ('" + ba + "') differs from its copy " + "after null-terminator was replaced ***"; } const_cast<char *>(baData)[baSize] = '\0'; // Restore sanity @@ -896,7 +896,9 @@ void tst_QByteArray::prepend() QCOMPARE(ba.prepend("1"), QByteArray("1foo")); QCOMPARE(ba.prepend(QByteArray("2")), QByteArray("21foo")); QCOMPARE(ba.prepend('3'), QByteArray("321foo")); - QCOMPARE(ba.prepend("\0 ", 2), QByteArray::fromRawData("\0 321foo", 8)); + QCOMPARE(ba.prepend(-1, 'x'), QByteArray("321foo")); + QCOMPARE(ba.prepend(3, 'x'), QByteArray("xxx321foo")); + QCOMPARE(ba.prepend("\0 ", 2), QByteArray::fromRawData("\0 xxx321foo", 11)); } void tst_QByteArray::prependExtended_data() @@ -924,8 +926,10 @@ void tst_QByteArray::prependExtended() QCOMPARE(array.prepend("1"), QByteArray("1data")); QCOMPARE(array.prepend(QByteArray("2")), QByteArray("21data")); QCOMPARE(array.prepend('3'), QByteArray("321data")); - QCOMPARE(array.prepend("\0 ", 2), QByteArray::fromRawData("\0 321data", 9)); - QCOMPARE(array.size(), 9); + QCOMPARE(array.prepend(-1, 'x'), QByteArray("321data")); + QCOMPARE(array.prepend(3, 'x'), QByteArray("xxx321data")); + QCOMPARE(array.prepend("\0 ", 2), QByteArray::fromRawData("\0 xxx321data", 12)); + QCOMPARE(array.size(), 12); } void tst_QByteArray::append() @@ -936,9 +940,11 @@ void tst_QByteArray::append() QCOMPARE(ba.append("1"), QByteArray("foo1")); QCOMPARE(ba.append(QByteArray("2")), QByteArray("foo12")); QCOMPARE(ba.append('3'), QByteArray("foo123")); - QCOMPARE(ba.append("\0"), QByteArray("foo123")); - QCOMPARE(ba.append("\0", 1), QByteArray::fromRawData("foo123\0", 7)); - QCOMPARE(ba.size(), 7); + QCOMPARE(ba.append(-1, 'x'), QByteArray("foo123")); + QCOMPARE(ba.append(3, 'x'), QByteArray("foo123xxx")); + QCOMPARE(ba.append("\0"), QByteArray("foo123xxx")); + QCOMPARE(ba.append("\0", 1), QByteArray::fromRawData("foo123xxx\0", 10)); + QCOMPARE(ba.size(), 10); } void tst_QByteArray::appendExtended_data() @@ -958,9 +964,11 @@ void tst_QByteArray::appendExtended() QCOMPARE(array.append("1"), QByteArray("data1")); QCOMPARE(array.append(QByteArray("2")), QByteArray("data12")); QCOMPARE(array.append('3'), QByteArray("data123")); - QCOMPARE(array.append("\0"), QByteArray("data123")); - QCOMPARE(array.append("\0", 1), QByteArray::fromRawData("data123\0", 8)); - QCOMPARE(array.size(), 8); + QCOMPARE(array.append(-1, 'x'), QByteArray("data123")); + QCOMPARE(array.append(3, 'x'), QByteArray("data123xxx")); + QCOMPARE(array.append("\0"), QByteArray("data123xxx")); + QCOMPARE(array.append("\0", 1), QByteArray::fromRawData("data123xxx\0", 11)); + QCOMPARE(array.size(), 11); } void tst_QByteArray::insert() @@ -976,6 +984,12 @@ void tst_QByteArray::insert() QCOMPARE(ba.insert(1, 'b'), QByteArray("abc")); QCOMPARE(ba.size(), 3); + ba = "ac"; + QCOMPARE(ba.insert(-1, 3, 'x'), QByteArray("ac")); + QCOMPARE(ba.insert(1, 3, 'x'), QByteArray("axxxc")); + QCOMPARE(ba.insert(6, 3, 'x'), QByteArray("axxxc xxx")); + QCOMPARE(ba.size(), 9); + ba = "ikl"; QCOMPARE(ba.insert(1, "j"), QByteArray("ijkl")); QCOMPARE(ba.size(), 4); @@ -994,7 +1008,8 @@ void tst_QByteArray::insertExtended() { QFETCH(QByteArray, array); QCOMPARE(array.insert(1, "i"), QByteArray("diata")); - QCOMPARE(array.size(), 5); + QCOMPARE(array.insert(1, 3, 'x'), QByteArray("dxxxiata")); + QCOMPARE(array.size(), 8); } void tst_QByteArray::remove_data() @@ -1969,15 +1984,15 @@ void tst_QByteArray::movablity() QCOMPARE(array.isEmpty(), newIsEmpty); QCOMPARE(array.isNull(), newIsNull); QCOMPARE(array.capacity(), newCapacity); - QVERIFY(array.startsWith("a")); - QVERIFY(array.endsWith("b")); + QVERIFY(array.startsWith('a')); + QVERIFY(array.endsWith('b')); QCOMPARE(copy.size(), newSize); QCOMPARE(copy.isEmpty(), newIsEmpty); QCOMPARE(copy.isNull(), newIsNull); QCOMPARE(copy.capacity(), newCapacity); - QVERIFY(copy.startsWith("a")); - QVERIFY(copy.endsWith("b")); + QVERIFY(copy.startsWith('a')); + QVERIFY(copy.endsWith('b')); // try to not crash array.squeeze(); diff --git a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro index 2cd4522f67..6c05c288cf 100644 --- a/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro +++ b/tests/auto/corelib/tools/qbytearraylist/qbytearraylist.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearraylist QT = core testlib SOURCES = tst_qbytearraylist.cpp diff --git a/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro index 7da193d01a..0624e1886c 100644 --- a/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro +++ b/tests/auto/corelib/tools/qbytearraymatcher/qbytearraymatcher.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qbytearraymatcher QT = core testlib SOURCES = tst_qbytearraymatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcache/qcache.pro b/tests/auto/corelib/tools/qcache/qcache.pro index 80a616ce38..07488ef40f 100644 --- a/tests/auto/corelib/tools/qcache/qcache.pro +++ b/tests/auto/corelib/tools/qcache/qcache.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcache QT = core testlib SOURCES = tst_qcache.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index a72f16fa49..771e4290b8 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qchar QT = core-private testlib SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp index 22fbce9f8e..32002fe7ed 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -43,9 +43,6 @@ class tst_QChar : public QObject { Q_OBJECT -public slots: - void init(); - void cleanup(); private slots: void operators_data(); void operators(); @@ -80,27 +77,8 @@ private slots: void normalization_manual(); void normalizationCorrections(); void unicodeVersion(); -#if defined(Q_OS_WINCE) -private: - QCoreApplication* app; -#endif }; -void tst_QChar::init() -{ -#if defined(Q_OS_WINCE) - int argc = 0; - app = new QCoreApplication(argc, NULL); -#endif -} - -void tst_QChar::cleanup() -{ -#if defined(Q_OS_WINCE) - delete app; -#endif -} - void tst_QChar::operators_data() { QTest::addColumn<QChar>("lhs"); @@ -239,8 +217,8 @@ void tst_QChar::isDigit_data() for (ushort ucs = 0; ucs < 256; ++ucs) { bool isDigit = (ucs <= '9' && ucs >= '0'); - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isDigit; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isDigit; } } @@ -266,8 +244,8 @@ void tst_QChar::isLetter_data() QTest::addColumn<bool>("expected"); for (ushort ucs = 0; ucs < 256; ++ucs) { - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isExpectedLetter(ucs); + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isExpectedLetter(ucs); } } @@ -288,8 +266,8 @@ void tst_QChar::isLetterOrNumber_data() || (ucs >= '0' && ucs <= '9') || ucs == 0xB2 || ucs == 0xB3 || ucs == 0xB9 || (ucs >= 0xBC && ucs <= 0xBE); - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isLetterOrNumber; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isLetterOrNumber; } } @@ -403,8 +381,8 @@ void tst_QChar::isSpace_data() for (ushort ucs = 0; ucs < 256; ++ucs) { bool isSpace = (ucs <= 0x0D && ucs >= 0x09) || ucs == 0x20 || ucs == 0xA0 || ucs == 0x85; - QString tag = QString::fromLatin1("0x%0").arg(QString::number(ucs, 16)); - QTest::newRow(tag.toLatin1()) << ucs << isSpace; + const QByteArray tag = "0x" + QByteArray::number(ucs, 16); + QTest::newRow(tag.constData()) << ucs << isSpace; } } @@ -760,7 +738,7 @@ void tst_QChar::normalization_data() if (comment >= 0) line = line.left(comment); - if (line.startsWith("@")) { + if (line.startsWith('@')) { if (line.startsWith("@Part") && line.size() > 5 && QChar(line.at(5)).isDigit()) part = QChar(line.at(5)).digitValue(); continue; @@ -797,8 +775,10 @@ void tst_QChar::normalization_data() } } - QString nm = QString("line #%1 (part %2").arg(linenum).arg(part); - QTest::newRow(nm.toLatin1()) << columns << part; + + const QByteArray nm = "line #" + QByteArray::number(linenum) + " (part " + + QByteArray::number(part); + QTest::newRow(nm.constData()) << columns << part; } } diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro index 3c5987ffa0..ed879ee70e 100644 --- a/tests/auto/corelib/tools/qcollator/qcollator.pro +++ b/tests/auto/corelib/tools/qcollator/qcollator.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcollator QT = core testlib SOURCES = tst_qcollator.cpp DEFINES += QT_NO_CAST_TO_ASCII contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro index 6d3e6d677f..75b74bbf4d 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcommandlineparser QT = core testlib SOURCES = tst_qcommandlineparser.cpp diff --git a/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro b/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro index db4412ed59..d79bd16c76 100644 --- a/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro +++ b/tests/auto/corelib/tools/qcontiguouscache/qcontiguouscache.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcontiguouscache QT = core testlib SOURCES = tst_qcontiguouscache.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index 941a068f8e..15a57c692e 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qcryptographichash QT = core testlib SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qdate/qdate.pro b/tests/auto/corelib/tools/qdate/qdate.pro index 6be3164fd7..dd7c6cb888 100644 --- a/tests/auto/corelib/tools/qdate/qdate.pro +++ b/tests/auto/corelib/tools/qdate/qdate.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdate QT = core testlib SOURCES = tst_qdate.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index e515fcf5b9..27988e5b5b 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -1047,7 +1047,7 @@ void tst_QDate::fromStringFormat_data() QTest::newRow("data14") << QString("132") << QString("Md") << invalidDate(); QTest::newRow("data15") << february << QString("MMMM") << QDate(defDate().year(), 2, 1); - QString date = mon + " " + august + " 8 2005"; + QString date = mon + QLatin1Char(' ') + august + " 8 2005"; QTest::newRow("data16") << date << QString("ddd MMMM d yyyy") << QDate(2005, 8, 8); QTest::newRow("data17") << QString("2000:00") << QString("yyyy:yy") << QDate(2000, 1, 1); QTest::newRow("data18") << QString("1999:99") << QString("yyyy:yy") << QDate(1999, 1, 1); diff --git a/tests/auto/corelib/tools/qdatetime/qdatetime.pro b/tests/auto/corelib/tools/qdatetime/qdatetime.pro index 25d11443e4..ba36621cf1 100644 --- a/tests/auto/corelib/tools/qdatetime/qdatetime.pro +++ b/tests/auto/corelib/tools/qdatetime/qdatetime.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qdatetime QT = core-private testlib SOURCES = tst_qdatetime.cpp @@ -10,7 +10,6 @@ win32-msvc|win32-msvc9x { QMAKE_CFLAGS_RELEASE -= -O1 QMAKE_CXXFLAGS_RELEASE -= -O1 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac { OBJECTIVE_SOURCES += tst_qdatetime_mac.mm diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 833dfe87d7..906129d1af 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -1735,13 +1735,15 @@ void tst_QDateTime::operator_insert_extract_data() const int thisVersion = tmpDataStream.version(); for (int version = QDataStream::Qt_1_0; version <= thisVersion; ++version) { const QDataStream::Version dataStreamVersion = static_cast<QDataStream::Version>(version); - QTest::newRow(QString::fromLatin1("v%1 WA => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + const QByteArray vN = QByteArray::number(dataStreamVersion); + const QByteArray pY = positiveYear.toString().toLatin1(); + QTest::newRow(('v' + vN + " WA => HAWAII " + pY).constData()) << positiveYear << westernAustralia << hawaii << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 WA => WA %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " WA => WA " + pY).constData()) << positiveYear << westernAustralia << westernAustralia << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 HAWAII => WA %2").arg(dataStreamVersion).arg(negativeYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " HAWAII => WA " + negativeYear.toString().toLatin1()).constData()) << negativeYear << hawaii << westernAustralia << dataStreamVersion; - QTest::newRow(QString::fromLatin1("v%1 HAWAII => HAWAII %2").arg(dataStreamVersion).arg(positiveYear.toString()).toLocal8Bit().constData()) + QTest::newRow(('v' + vN + " HAWAII => HAWAII " + pY).constData()) << positiveYear << hawaii << hawaii << dataStreamVersion; } } @@ -2140,11 +2142,11 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); - date = fri + " " + december + " 3 2004"; + date = fri + QLatin1Char(' ') + december + " 3 2004"; QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); - date = thu + " " + january + " 2004"; + date = thu + QLatin1Char(' ') + january + " 2004"; QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") << QString("yyyy-MM-ddThh:mm:ss.zZ") diff --git a/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro index 679f9bbda4..80c5a94a83 100644 --- a/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro +++ b/tests/auto/corelib/tools/qeasingcurve/qeasingcurve.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qeasingcurve QT = core testlib SOURCES = tst_qeasingcurve.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro index 7e9f907915..657a63a5d7 100644 --- a/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro +++ b/tests/auto/corelib/tools/qelapsedtimer/qelapsedtimer.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qelapsedtimer QT = core testlib SOURCES = tst_qelapsedtimer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro index 2ee091c139..45fe1f60fe 100644 --- a/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro +++ b/tests/auto/corelib/tools/qexplicitlyshareddatapointer/qexplicitlyshareddatapointer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qexplicitlyshareddatapointer QT = core testlib SOURCES = tst_qexplicitlyshareddatapointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qfreelist/qfreelist.pro b/tests/auto/corelib/tools/qfreelist/qfreelist.pro index 60ae819f87..fb108338bd 100644 --- a/tests/auto/corelib/tools/qfreelist/qfreelist.pro +++ b/tests/auto/corelib/tools/qfreelist/qfreelist.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfreelist QT = core-private testlib SOURCES = tst_qfreelist.cpp !contains(QT_CONFIG,private_tests): SOURCES += $$QT_SOURCE_TREE/src/corelib/tools/qfreelist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qhash/qhash.pro b/tests/auto/corelib/tools/qhash/qhash.pro index 1ed062ca91..79ffd4e9d1 100644 --- a/tests/auto/corelib/tools/qhash/qhash.pro +++ b/tests/auto/corelib/tools/qhash/qhash.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhash QT = core testlib SOURCES = $$PWD/tst_qhash.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 6a5c6b5670..340453fb3e 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -510,24 +510,24 @@ void tst_QHash::key() QCOMPARE(hash1.key(1, def), def); hash1.insert("one", 1); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); QCOMPARE(hash1.key(2), QString()); QCOMPARE(hash1.key(2, def), def); hash1.insert("two", 2); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); - QCOMPARE(hash1.key(2), QString("two")); - QCOMPARE(hash1.key(2, def), QString("two")); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); + QCOMPARE(hash1.key(2), QLatin1String("two")); + QCOMPARE(hash1.key(2, def), QLatin1String("two")); QCOMPARE(hash1.key(3), QString()); QCOMPARE(hash1.key(3, def), def); hash1.insert("deux", 2); - QCOMPARE(hash1.key(1), QString("one")); - QCOMPARE(hash1.key(1, def), QString("one")); - QVERIFY(hash1.key(2) == "deux" || hash1.key(2) == "two"); - QVERIFY(hash1.key(2, def) == "deux" || hash1.key(2, def) == "two"); + QCOMPARE(hash1.key(1), QLatin1String("one")); + QCOMPARE(hash1.key(1, def), QLatin1String("one")); + QVERIFY(hash1.key(2) == QLatin1String("deux") || hash1.key(2) == QLatin1String("two")); + QVERIFY(hash1.key(2, def) == QLatin1String("deux") || hash1.key(2, def) == QLatin1String("two")); QCOMPARE(hash1.key(3), QString()); QCOMPARE(hash1.key(3, def), def); } @@ -628,8 +628,8 @@ void tst_QHash::find() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.find(1).value() == "Mayer"); - QVERIFY(map1.find(2).value() == "Hej"); + QCOMPARE(map1.find(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.find(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -661,8 +661,8 @@ void tst_QHash::constFind() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.constFind(1).value() == "Mayer"); - QVERIFY(map1.constFind(2).value() == "Hej"); + QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -706,7 +706,7 @@ void tst_QHash::take() map.insert(2, "zwei"); map.insert(3, "drei"); - QVERIFY(map.take(3) == "drei"); + QCOMPARE(map.take(3), QLatin1String("drei")); QVERIFY(!map.contains(3)); } diff --git a/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro b/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro index 21426a4f55..853e9f30e5 100644 --- a/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro +++ b/tests/auto/corelib/tools/qhashfunctions/qhashfunctions.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qhashfunctions QT = core testlib SOURCES = $$PWD/tst_qhashfunctions.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qline/qline.pro b/tests/auto/corelib/tools/qline/qline.pro index 56f852ac52..c66df2cd68 100644 --- a/tests/auto/corelib/tools/qline/qline.pro +++ b/tests/auto/corelib/tools/qline/qline.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qline QT = core testlib SOURCES = tst_qline.cpp unix:!mac:!vxworks:!haiku:LIBS+=-lm -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qline/tst_qline.cpp b/tests/auto/corelib/tools/qline/tst_qline.cpp index 20373bfb15..a215464d8a 100644 --- a/tests/auto/corelib/tools/qline/tst_qline.cpp +++ b/tests/auto/corelib/tools/qline/tst_qline.cpp @@ -179,7 +179,7 @@ void tst_QLine::testIntersection_data() a = a.translated(1, 1); b = b.translated(1, 1); - QTest::newRow(qPrintable(QString::fromLatin1("rotation-%0").arg(i))) + QTest::newRow(("rotation-" + QByteArray::number(i)).constData()) << (double)a.x1() << (double)a.y1() << (double)a.x2() << (double)a.y2() << (double)b.x1() << (double)b.y1() << (double)b.x2() << (double)b.y2() << int(QLineF::BoundedIntersection) @@ -332,7 +332,7 @@ void tst_QLine::testAngle_data() << 135.0; for (int i=0; i<180; ++i) { - QTest::newRow(QString("angle:%1").arg(i).toLatin1()) + QTest::newRow(("angle:" + QByteArray::number(i)).constData()) << 0.0 << 0.0 << double(cos(i*M_2PI/360)) << double(sin(i*M_2PI/360)) << 0.0 << 0.0 << 1.0 << 0.0 << double(i); @@ -460,7 +460,7 @@ void tst_QLine::testAngleTo_data() for (int i = 0; i < 360; ++i) { const QLineF l = QLineF::fromPolar(1, i); - QTest::newRow(QString("angle:%1").arg(i).toLatin1()) + QTest::newRow(("angle:" + QByteArray::number(i)).constData()) << qreal(0.0) << qreal(0.0) << qreal(1.0) << qreal(0.0) << qreal(0.0) << qreal(0.0) << l.p2().x() << l.p2().y() << qreal(i); diff --git a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro index 439bf03707..80630f78ad 100644 --- a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro +++ b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qlinkedlist QT = core testlib SOURCES = tst_qlinkedlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlist/qlist.pro b/tests/auto/corelib/tools/qlist/qlist.pro index 43c06e0ee1..47f0140abb 100644 --- a/tests/auto/corelib/tools/qlist/qlist.pro +++ b/tests/auto/corelib/tools/qlist/qlist.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlist QT = core testlib SOURCES = $$PWD/tst_qlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro index 8995fce52c..b61f51d53a 100644 --- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro +++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro @@ -6,4 +6,3 @@ CONFIG -= app_bundle QT = core -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro index df12d35a09..4777030dd7 100644 --- a/tests/auto/corelib/tools/qlocale/test/test.pro +++ b/tests/auto/corelib/tools/qlocale/test/test.pro @@ -1,10 +1,13 @@ CONFIG += console testcase -CONFIG += parallel_test CONFIG -= app_bundle QT = core testlib core-private embedded: QT += gui SOURCES = ../tst_qlocale.cpp +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + TARGET = ../tst_qlocale win32 { CONFIG(debug, debug|release) { @@ -15,6 +18,3 @@ win32 { } TEST_HELPER_INSTALLS = ../syslocaleapp/syslocaleapp - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -blackberry:LIBS += -lpps diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 0466ced10a..ee45f95d83 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -42,6 +42,7 @@ #include <qdatetime.h> #include <qprocess.h> #include <float.h> +#include <locale.h> #include <qlocale.h> #include <private/qlocale_p.h> @@ -68,52 +69,6 @@ extern "C" DWORD GetThreadLocale(void) { # include <stdlib.h> #endif -#ifdef Q_OS_BLACKBERRY -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/pps.h> - -static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; -static const size_t ppsBufferSize = 256; - -static QByteArray readPpsValue(const char *ppsObject, int ppsFd) -{ - QByteArray result; - if (!ppsObject || ppsFd == -1) - return result; - - char buffer[ppsBufferSize]; - - int bytes = read(ppsFd, buffer, ppsBufferSize - 1); - if (bytes == -1) { - qFatal("Failed to read Locale pps, errno=%d", errno); - return result; - } - // ensure data is null terminated - buffer[bytes] = '\0'; - - pps_decoder_t ppsDecoder; - pps_decoder_initialize(&ppsDecoder, 0); - if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { - pps_decoder_push(&ppsDecoder, 0); - const char *ppsBuff; - if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { - result = ppsBuff; - } else { - int val; - if (pps_decoder_get_int(&ppsDecoder, ppsObject, &val) == PPS_DECODER_OK) - result = QByteArray::number(val); - } - } - - pps_decoder_cleanup(&ppsDecoder); - - return result; -} -#endif // Q_OS_BLACKBERRY - Q_DECLARE_METATYPE(QLocale::FormatType) class tst_QLocale : public QObject @@ -140,8 +95,10 @@ private slots: void legacyNames(); void unixLocaleName(); void matchingLocales(); - void double_conversion_data(); - void double_conversion(); + void stringToDouble_data(); + void stringToDouble(); + void doubleToString_data(); + void doubleToString(); void long_long_conversion_data(); void long_long_conversion(); void long_long_conversion_extra(); @@ -194,10 +151,6 @@ private: QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; QString m_sysapp; bool europeanTimeZone; - -#ifdef Q_OS_BLACKBERRY - int m_languageFd; -#endif }; tst_QLocale::tst_QLocale() @@ -224,19 +177,10 @@ void tst_QLocale::initTestCase() QVERIFY2(fi.exists() && fi.isExecutable(), qPrintable(QDir::toNativeSeparators(m_sysapp) + QStringLiteral(" does not exist or is not executable."))); - -#ifdef Q_OS_BLACKBERRY - if ((m_languageFd = open(ppsLanguageLocalePath, O_RDONLY)) == -1) - QFAIL("Failed to open language pps."); -#endif } void tst_QLocale::cleanupTestCase() -{ -#ifdef Q_OS_BLACKBERRY - close(m_languageFd); -#endif -} +{} void tst_QLocale::ctor() { @@ -370,7 +314,7 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \ QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \ } @@ -431,8 +375,8 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::scriptToString(l.script()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::scriptToString(l.script()) \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China) @@ -532,11 +476,6 @@ void tst_QLocale::emptyCtor() QVERIFY2(runSysApp(m_sysapp, env, &defaultLoc, &errorMessage), qPrintable(errorMessage)); -#ifdef Q_OS_BLACKBERRY - QString locale = readPpsValue("_CS_LOCALE", m_languageFd); - QVERIFY2(runSysApp(m_sysapp, env, &locale, &errorMessage), - qPrintable(errorMessage)); -#else TEST_CTOR("C", "C") TEST_CTOR("bla", "C") TEST_CTOR("zz", "C") @@ -574,7 +513,6 @@ void tst_QLocale::emptyCtor() TEST_CTOR("en/", defaultLoc.toLatin1()) TEST_CTOR("asdfghj", defaultLoc.toLatin1()); TEST_CTOR("123456", defaultLoc.toLatin1()); -#endif // Q_OS_BLACKBERRY #undef TEST_CTOR #endif @@ -606,7 +544,7 @@ void tst_QLocale::legacyNames() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("mo_MD", Romanian, Moldova) @@ -664,7 +602,7 @@ void tst_QLocale::unixLocaleName() #undef TEST_NAME } -void tst_QLocale::double_conversion_data() +void tst_QLocale::stringToDouble_data() { QTest::addColumn<QString>("locale_name"); QTest::addColumn<QString>("num_str"); @@ -786,7 +724,7 @@ void tst_QLocale::double_conversion_data() QTest::newRow("de_DE 9.876543,0e--2") << QString("de_DE") << QString("9.876543,0e")+QChar(8722)+QString("2") << false << 0.0; } -void tst_QLocale::double_conversion() +void tst_QLocale::stringToDouble() { #define MY_DOUBLE_EPSILON (2.22045e-16) @@ -803,6 +741,11 @@ void tst_QLocale::double_conversion() double d = locale.toDouble(num_str, &ok); QCOMPARE(ok, good); + char *currentLocale = setlocale(LC_ALL, "de_DE"); + QCOMPARE(locale.toDouble(num_str, &ok), d); // make sure result is independent of locale + QCOMPARE(ok, good); + setlocale(LC_ALL, currentLocale); + if (ok) { double diff = d - num; if (diff < 0) @@ -821,6 +764,121 @@ void tst_QLocale::double_conversion() } } +void tst_QLocale::doubleToString_data() +{ + QTest::addColumn<QString>("locale_name"); + QTest::addColumn<QString>("num_str"); + QTest::addColumn<double>("num"); + QTest::addColumn<char>("mode"); + QTest::addColumn<int>("precision"); + + int shortest = QLocale::FloatingPointShortest; + + QTest::newRow("C 3.4 f 5") << QString("C") << QString("3.40000") << 3.4 << 'f' << 5; + QTest::newRow("C 3.4 f 0") << QString("C") << QString("3") << 3.4 << 'f' << 0; + QTest::newRow("C 3.4 e 5") << QString("C") << QString("3.40000e+00") << 3.4 << 'e' << 5; + QTest::newRow("C 3.4 e 0") << QString("C") << QString("3e+00") << 3.4 << 'e' << 0; + QTest::newRow("C 3.4 g 5") << QString("C") << QString("3.4") << 3.4 << 'g' << 5; + QTest::newRow("C 3.4 g 1") << QString("C") << QString("3") << 3.4 << 'g' << 1; + + QTest::newRow("C 3.4 f 1") << QString("C") << QString("3.4") << 3.4 << 'f' << 1; + QTest::newRow("C 3.4 f -") << QString("C") << QString("3.4") << 3.4 << 'f' << shortest; + QTest::newRow("C 3.4 e 1") << QString("C") << QString("3.4e+00") << 3.4 << 'e' << 1; + QTest::newRow("C 3.4 e -") << QString("C") << QString("3.4e+00") << 3.4 << 'e' << shortest; + QTest::newRow("C 3.4 g 2") << QString("C") << QString("3.4") << 3.4 << 'g' << 2; + QTest::newRow("C 3.4 g -") << QString("C") << QString("3.4") << 3.4 << 'g' << shortest; + + QTest::newRow("de_DE 3,4 f 1") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << 1; + QTest::newRow("de_DE 3,4 f -") << QString("de_DE") << QString("3,4") << 3.4 << 'f' << shortest; + QTest::newRow("de_DE 3,4 e 1") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << 1; + QTest::newRow("de_DE 3,4 e -") << QString("de_DE") << QString("3,4e+00") << 3.4 << 'e' << shortest; + QTest::newRow("de_DE 3,4 g 2") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << 2; + QTest::newRow("de_DE 3,4 g -") << QString("de_DE") << QString("3,4") << 3.4 << 'g' << shortest; + + QTest::newRow("C 0.035003945 f 12") << QString("C") << QString("0.035003945000") << 0.035003945 << 'f' << 12; + QTest::newRow("C 0.035003945 f 6") << QString("C") << QString("0.035004") << 0.035003945 << 'f' << 6; + QTest::newRow("C 0.035003945 e 10") << QString("C") << QString("3.5003945000e-02") << 0.035003945 << 'e' << 10; + QTest::newRow("C 0.035003945 e 4") << QString("C") << QString("3.5004e-02") << 0.035003945 << 'e' << 4; + QTest::newRow("C 0.035003945 g 11") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << 11; + QTest::newRow("C 0.035003945 g 5") << QString("C") << QString("0.035004") << 0.035003945 << 'g' << 5; + + QTest::newRow("C 0.035003945 f 9") << QString("C") << QString("0.035003945") << 0.035003945 << 'f' << 9; + QTest::newRow("C 0.035003945 f -") << QString("C") << QString("0.035003945") << 0.035003945 << 'f' << shortest; + QTest::newRow("C 0.035003945 e 7") << QString("C") << QString("3.5003945e-02") << 0.035003945 << 'e' << 7; + QTest::newRow("C 0.035003945 e -") << QString("C") << QString("3.5003945e-02") << 0.035003945 << 'e' << shortest; + QTest::newRow("C 0.035003945 g 8") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << 8; + QTest::newRow("C 0.035003945 g -") << QString("C") << QString("0.035003945") << 0.035003945 << 'g' << shortest; + + QTest::newRow("de_DE 0,035003945 f 9") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << 9; + QTest::newRow("de_DE 0,035003945 f -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'f' << shortest; + QTest::newRow("de_DE 0,035003945 e 7") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << 7; + QTest::newRow("de_DE 0,035003945 e -") << QString("de_DE") << QString("3,5003945e-02") << 0.035003945 << 'e' << shortest; + QTest::newRow("de_DE 0,035003945 g 8") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << 8; + QTest::newRow("de_DE 0,035003945 g -") << QString("de_DE") << QString("0,035003945") << 0.035003945 << 'g' << shortest; + + QTest::newRow("C 0.000003945 f 12") << QString("C") << QString("0.000003945000") << 0.000003945 << 'f' << 12; + QTest::newRow("C 0.000003945 f 6") << QString("C") << QString("0.000004") << 0.000003945 << 'f' << 6; + QTest::newRow("C 0.000003945 e 6") << QString("C") << QString("3.945000e-06") << 0.000003945 << 'e' << 6; + QTest::newRow("C 0.000003945 e 0") << QString("C") << QString("4e-06") << 0.000003945 << 'e' << 0; + QTest::newRow("C 0.000003945 g 7") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << 7; + QTest::newRow("C 0.000003945 g 1") << QString("C") << QString("4e-06") << 0.000003945 << 'g' << 1; + + QTest::newRow("C 0.000003945 f 9") << QString("C") << QString("0.000003945") << 0.000003945 << 'f' << 9; + QTest::newRow("C 0.000003945 f -") << QString("C") << QString("0.000003945") << 0.000003945 << 'f' << shortest; + QTest::newRow("C 0.000003945 e 3") << QString("C") << QString("3.945e-06") << 0.000003945 << 'e' << 3; + QTest::newRow("C 0.000003945 e -") << QString("C") << QString("3.945e-06") << 0.000003945 << 'e' << shortest; + QTest::newRow("C 0.000003945 g 4") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << 4; + QTest::newRow("C 0.000003945 g -") << QString("C") << QString("3.945e-06") << 0.000003945 << 'g' << shortest; + + QTest::newRow("de_DE 0,000003945 f 9") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << 9; + QTest::newRow("de_DE 0,000003945 f -") << QString("de_DE") << QString("0,000003945") << 0.000003945 << 'f' << shortest; + QTest::newRow("de_DE 0,000003945 e 3") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << 3; + QTest::newRow("de_DE 0,000003945 e -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'e' << shortest; + QTest::newRow("de_DE 0,000003945 g 4") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << 4; + QTest::newRow("de_DE 0,000003945 g -") << QString("de_DE") << QString("3,945e-06") << 0.000003945 << 'g' << shortest; + + QTest::newRow("C 12456789012 f 3") << QString("C") << QString("12456789012.000") << 12456789012.0 << 'f' << 3; + QTest::newRow("C 12456789012 e 13") << QString("C") << QString("1.2456789012000e+10") << 12456789012.0 << 'e' << 13; + QTest::newRow("C 12456789012 e 7") << QString("C") << QString("1.2456789e+10") << 12456789012.0 << 'e' << 7; + QTest::newRow("C 12456789012 g 14") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << 14; + QTest::newRow("C 12456789012 g 8") << QString("C") << QString("1.2456789e+10") << 12456789012.0 << 'g' << 8; + + QTest::newRow("C 12456789012 f 0") << QString("C") << QString("12456789012") << 12456789012.0 << 'f' << 0; + QTest::newRow("C 12456789012 f -") << QString("C") << QString("12456789012") << 12456789012.0 << 'f' << shortest; + QTest::newRow("C 12456789012 e 10") << QString("C") << QString("1.2456789012e+10") << 12456789012.0 << 'e' << 10; + QTest::newRow("C 12456789012 e -") << QString("C") << QString("1.2456789012e+10") << 12456789012.0 << 'e' << shortest; + QTest::newRow("C 12456789012 g 11") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << 11; + QTest::newRow("C 12456789012 g -") << QString("C") << QString("12456789012") << 12456789012.0 << 'g' << shortest; + + QTest::newRow("de_DE 12456789012 f 0") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << 0; + QTest::newRow("de_DE 12456789012 f -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'f' << shortest; + QTest::newRow("de_DE 12456789012 e 10") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << 10; + QTest::newRow("de_DE 12456789012 e -") << QString("de_DE") << QString("1,2456789012e+10") << 12456789012.0 << 'e' << shortest; + QTest::newRow("de_DE 12456789012 g 11") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << 11; + QTest::newRow("de_DE 12456789012 g -") << QString("de_DE") << QString("12.456.789.012") << 12456789012.0 << 'g' << shortest; +} + +void tst_QLocale::doubleToString() +{ + QFETCH(QString, locale_name); + QFETCH(QString, num_str); + QFETCH(double, num); + QFETCH(char, mode); + QFETCH(int, precision); + +#ifdef QT_NO_DOUBLECONVERSION + if (precision == QLocale::FloatingPointShortest) + QSKIP("'Shortest' double conversion is not that short without libdouble-conversion"); +#endif + + const QLocale locale(locale_name); + QCOMPARE(locale.toString(num, mode, precision), num_str); + + char *currentLocale = setlocale(LC_ALL, "de_DE"); + QCOMPARE(locale.toString(num, mode, precision), num_str); + setlocale(LC_ALL, currentLocale); +} + void tst_QLocale::long_long_conversion_data() { QTest::addColumn<QString>("locale_name"); @@ -952,7 +1010,8 @@ void tst_QLocale::fpExceptions() #define _EM_INEXACT 0x00000001 #endif - // check that qdtoa doesn't throw floating point exceptions when they are enabled + // check that double-to-string conversion doesn't throw floating point exceptions when they are + // enabled #ifdef Q_OS_WIN unsigned int oldbits = _control87(0, 0); _control87( 0 | _EM_INEXACT, _MCW_EM ); @@ -1278,13 +1337,13 @@ void tst_QLocale::formatTimeZone() QLocale enUS("en_US"); QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60); - QCOMPARE(enUS.toString(dt1, "t"), QString("UTC+01:00")); + QCOMPARE(enUS.toString(dt1, "t"), QLatin1String("UTC+01:00")); QDateTime dt2(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, -60 * 60); - QCOMPARE(enUS.toString(dt2, "t"), QString("UTC-01:00")); + QCOMPARE(enUS.toString(dt2, "t"), QLatin1String("UTC-01:00")); QDateTime dt3(QDate(2013, 1, 1), QTime(0, 0, 0), Qt::UTC); - QCOMPARE(enUS.toString(dt3, "t"), QString("UTC")); + QCOMPARE(enUS.toString(dt3, "t"), QLatin1String("UTC")); // LocalTime should vary if (europeanTimeZone) { @@ -1293,14 +1352,14 @@ void tst_QLocale::formatTimeZone() #ifdef Q_OS_WIN QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); #endif // Q_OS_WIN - QCOMPARE(enUS.toString(dt4, "t"), QString("CET")); + QCOMPARE(enUS.toString(dt4, "t"), QLatin1String("CET")); // Time definitely in Daylight Time QDateTime dt5(QDate(2013, 6, 1), QTime(0, 0, 0), Qt::LocalTime); #ifdef Q_OS_WIN QEXPECT_FAIL("", "Windows only returns long name (QTBUG-32759)", Continue); #endif // Q_OS_WIN - QCOMPARE(enUS.toString(dt5, "t"), QString("CEST")); + QCOMPARE(enUS.toString(dt5, "t"), QLatin1String("CEST")); } else { QSKIP("You must test using Central European (CET/CEST) time zone, e.g. TZ=Europe/Oslo"); } @@ -1309,13 +1368,13 @@ void tst_QLocale::formatTimeZone() #ifdef Q_OS_WIN QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); #endif - QCOMPARE(enUS.toString(dt6, "t"), QString("CET")); + QCOMPARE(enUS.toString(dt6, "t"), QLatin1String("CET")); QDateTime dt7(QDate(2013, 6, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); #ifdef Q_OS_WIN QEXPECT_FAIL("", "QTimeZone windows backend only returns long name", Continue); #endif - QCOMPARE(enUS.toString(dt7, "t"), QString("CEST")); + QCOMPARE(enUS.toString(dt7, "t"), QLatin1String("CEST")); // Current datetime should return current abbreviation QCOMPARE(enUS.toString(QDateTime::currentDateTime(), "t"), @@ -1461,9 +1520,9 @@ void tst_QLocale::macDefaultLocale() if (timeString.contains(QString("GMT"))) { QString expectedGMTSpecifierBase("GMT"); if (diff >= 0) - expectedGMTSpecifierBase.append("+"); + expectedGMTSpecifierBase.append(QLatin1Char('+')); else - expectedGMTSpecifierBase.append("-"); + expectedGMTSpecifierBase.append(QLatin1Char('-')); QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); @@ -1639,6 +1698,20 @@ void tst_QLocale::numberOptions() QLocale locale2 = locale; QCOMPARE(locale2.numberOptions(), QLocale::RejectGroupSeparator); + + QCOMPARE(locale.toString(12.4, 'e', 2), QString("1.24e+01")); + locale.setNumberOptions(QLocale::OmitLeadingZeroInExponent); + QCOMPARE(locale.numberOptions(), QLocale::OmitLeadingZeroInExponent); + QCOMPARE(locale.toString(12.4, 'e', 2), QString("1.24e+1")); + + locale.toDouble(QString("1.24e+01"), &ok); + QVERIFY(ok); + locale.setNumberOptions(QLocale::RejectLeadingZeroInExponent); + QCOMPARE(locale.numberOptions(), QLocale::RejectLeadingZeroInExponent); + locale.toDouble(QString("1.24e+1"), &ok); + QVERIFY(ok); + locale.toDouble(QString("1.24e+01"), &ok); + QVERIFY(!ok); } void tst_QLocale::negativeNumbers() @@ -1698,9 +1771,11 @@ void tst_QLocale::testNames_data() for (int i = 0; i < locale_data_count; ++i) { const QLocaleData &item = locale_data[i]; - const QString testName = QString::fromLatin1("data_%1 (%2/%3)").arg(i) - .arg(QLocale::languageToString((QLocale::Language)item.m_language_id)) - .arg(QLocale::countryToString((QLocale::Country)item.m_country_id)); + + const QString testName = QLatin1String("data_") + QString::number(i) + QLatin1String(" (") + + QLocale::languageToString((QLocale::Language)item.m_language_id) + + QLatin1Char('/') + QLocale::countryToString((QLocale::Country)item.m_country_id) + + QLatin1Char(')'); QTest::newRow(testName.toLatin1().constData()) << (int)item.m_language_id << (int)item.m_country_id; } } @@ -1828,13 +1903,27 @@ void tst_QLocale::underflowOverflow() a(QLatin1String("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e10")); bool ok = false; - a.toDouble(&ok); + double d = a.toDouble(&ok); QVERIFY(!ok); + QCOMPARE(d, 0.0); a = QLatin1String("1e600"); ok = false; - a.toDouble(&ok); + d = a.toDouble(&ok); + QVERIFY(!ok); // detectable overflow + QVERIFY(qIsInf(d)); + + a = QLatin1String("-1e600"); + ok = false; + d = a.toDouble(&ok); + QVERIFY(!ok); // detectable underflow + QVERIFY(qIsInf(-d)); + + a = QLatin1String("1e-600"); + ok = false; + d = a.toDouble(&ok); QVERIFY(!ok); + QCOMPARE(d, 0.0); a = QLatin1String("-9223372036854775809"); a.toLongLong(&ok); diff --git a/tests/auto/corelib/tools/qmap/qmap.pro b/tests/auto/corelib/tools/qmap/qmap.pro index 460b6654fb..27820a76c8 100644 --- a/tests/auto/corelib/tools/qmap/qmap.pro +++ b/tests/auto/corelib/tools/qmap/qmap.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmap QT = core testlib SOURCES = $$PWD/tst_qmap.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp index bb6535b635..daaabbb523 100644 --- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp +++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp @@ -413,24 +413,24 @@ void tst_QMap::key() QCOMPARE(map1.key(1, def), def); map1.insert("one", 1); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); QCOMPARE(map1.key(2), QString()); QCOMPARE(map1.key(2, def), def); map1.insert("two", 2); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); - QCOMPARE(map1.key(2), QString("two")); - QCOMPARE(map1.key(2, def), QString("two")); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); + QCOMPARE(map1.key(2), QLatin1String("two")); + QCOMPARE(map1.key(2, def), QLatin1String("two")); QCOMPARE(map1.key(3), QString()); QCOMPARE(map1.key(3, def), def); map1.insert("deux", 2); - QCOMPARE(map1.key(1), QString("one")); - QCOMPARE(map1.key(1, def), QString("one")); - QVERIFY(map1.key(2) == "deux" || map1.key(2) == "two"); - QVERIFY(map1.key(2, def) == "deux" || map1.key(2, def) == "two"); + QCOMPARE(map1.key(1), QLatin1String("one")); + QCOMPARE(map1.key(1, def), QLatin1String("one")); + QVERIFY(map1.key(2) == QLatin1String("deux") || map1.key(2) == QLatin1String("two")); + QVERIFY(map1.key(2, def) == QLatin1String("deux") || map1.key(2, def) == QLatin1String("two")); QCOMPARE(map1.key(3), QString()); QCOMPARE(map1.key(3, def), def); } @@ -608,8 +608,8 @@ void tst_QMap::find() map1.insert(1,"Mayer"); map1.insert(2,"Hej"); - QVERIFY(map1.find(1).value() == "Mayer"); - QVERIFY(map1.find(2).value() == "Hej"); + QCOMPARE(map1.find(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.find(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -643,8 +643,8 @@ void tst_QMap::constFind() QVERIFY(map1.constFind(4) == map1.constEnd()); - QVERIFY(map1.constFind(1).value() == "Mayer"); - QVERIFY(map1.constFind(2).value() == "Hej"); + QCOMPARE(map1.constFind(1).value(), QLatin1String("Mayer")); + QCOMPARE(map1.constFind(2).value(), QLatin1String("Hej")); for(i = 3; i < 10; ++i) { compareString = testString.arg(i); @@ -705,10 +705,10 @@ void tst_QMap::lowerUpperBound() QCOMPARE(map1.lowerBound(5).key(), 5); QCOMPARE(map1.lowerBound(6).key(), 7); QCOMPARE(map1.lowerBound(7).key(), 7); - QCOMPARE(map1.lowerBound(6).value(), QString("seven_2")); - QCOMPARE(map1.lowerBound(7).value(), QString("seven_2")); - QCOMPARE((++map1.lowerBound(6)).value(), QString("seven")); - QCOMPARE((++map1.lowerBound(7)).value(), QString("seven")); + QCOMPARE(map1.lowerBound(6).value(), QLatin1String("seven_2")); + QCOMPARE(map1.lowerBound(7).value(), QLatin1String("seven_2")); + QCOMPARE((++map1.lowerBound(6)).value(), QLatin1String("seven")); + QCOMPARE((++map1.lowerBound(7)).value(), QLatin1String("seven")); QCOMPARE(map1.lowerBound(10).key(), 10); QVERIFY(map1.lowerBound(999) == map1.end()); } @@ -733,11 +733,11 @@ void tst_QMap::mergeCompare() map1b.unite(map2b); sanityCheckTree(map1b, __LINE__); - QVERIFY(map1.value(1) == "ett"); - QVERIFY(map1.value(2) == "tvo"); - QVERIFY(map1.value(3) == "tre"); - QVERIFY(map1.value(4) == "fyra"); - QVERIFY(map1.value(5) == "fem"); + QCOMPARE(map1.value(1), QLatin1String("ett")); + QCOMPARE(map1.value(2), QLatin1String("tvo")); + QCOMPARE(map1.value(3), QLatin1String("tre")); + QCOMPARE(map1.value(4), QLatin1String("fyra")); + QCOMPARE(map1.value(5), QLatin1String("fem")); map3.insert(1, "ett"); map3.insert(2, "tvo"); @@ -755,7 +755,7 @@ void tst_QMap::take() map.insert(2, "zwei"); map.insert(3, "drei"); - QVERIFY(map.take(3) == "drei"); + QCOMPARE(map.take(3), QLatin1String("drei")); QVERIFY(!map.contains(3)); } @@ -771,19 +771,19 @@ void tst_QMap::iterators() //STL-Style iterators QMap<int, QString>::iterator stlIt = map.begin(); - QVERIFY(stlIt.value() == "Teststring 1"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 1")); stlIt+=5; - QVERIFY(stlIt.value() == "Teststring 6"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 6")); stlIt++; - QVERIFY(stlIt.value() == "Teststring 7"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 7")); stlIt-=3; - QVERIFY(stlIt.value() == "Teststring 4"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 4")); stlIt--; - QVERIFY(stlIt.value() == "Teststring 3"); + QCOMPARE(stlIt.value(), QLatin1String("Teststring 3")); for(stlIt = map.begin(), i = 1; stlIt != map.end(); ++stlIt, ++i) QVERIFY(stlIt.value() == testString.arg(i)); @@ -792,19 +792,19 @@ void tst_QMap::iterators() //STL-Style const-iterators QMap<int, QString>::const_iterator cstlIt = map.constBegin(); - QVERIFY(cstlIt.value() == "Teststring 1"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 1")); cstlIt+=5; - QVERIFY(cstlIt.value() == "Teststring 6"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 6")); cstlIt++; - QVERIFY(cstlIt.value() == "Teststring 7"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 7")); cstlIt-=3; - QVERIFY(cstlIt.value() == "Teststring 4"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 4")); cstlIt--; - QVERIFY(cstlIt.value() == "Teststring 3"); + QCOMPARE(cstlIt.value(), QLatin1String("Teststring 3")); for(cstlIt = map.constBegin(), i = 1; cstlIt != map.constEnd(); ++cstlIt, ++i) QVERIFY(cstlIt.value() == testString.arg(i)); @@ -1062,7 +1062,7 @@ void tst_QMap::equal_range() QCOMPARE(cresult.second, cmap.cend()); for (int i = -10; i < 10; i += 2) - map.insert(i, QString("%1").arg(i)); + map.insert(i, QString::number(i)); result = map.equal_range(0); QCOMPARE(result.first, map.find(0)); diff --git a/tests/auto/corelib/tools/qmargins/qmargins.pro b/tests/auto/corelib/tools/qmargins/qmargins.pro index 25fe715edf..696f9374a2 100644 --- a/tests/auto/corelib/tools/qmargins/qmargins.pro +++ b/tests/auto/corelib/tools/qmargins/qmargins.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmargins QT = core testlib SOURCES = tst_qmargins.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro index afd0c1176d..a62b702f22 100644 --- a/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro +++ b/tests/auto/corelib/tools/qmessageauthenticationcode/qmessageauthenticationcode.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qmessageauthenticationcode QT = core testlib SOURCES = tst_qmessageauthenticationcode.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpair/qpair.pro b/tests/auto/corelib/tools/qpair/qpair.pro index c49215cb1c..659be887d3 100644 --- a/tests/auto/corelib/tools/qpair/qpair.pro +++ b/tests/auto/corelib/tools/qpair/qpair.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpair QT = core testlib SOURCES = tst_qpair.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp index 076efc5428..bce02d1a42 100644 --- a/tests/auto/corelib/tools/qpair/tst_qpair.cpp +++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp @@ -41,6 +41,8 @@ class tst_QPair : public QObject Q_OBJECT private Q_SLOTS: void testConstexpr(); + void testConversions(); + void taskQTBUG_48780_pairContainingCArray(); }; class C { char _[4]; }; @@ -108,5 +110,72 @@ void tst_QPair::testConstexpr() Q_UNUSED(pSI); } +void tst_QPair::testConversions() +{ + // construction from lvalue: + { + const QPair<int, double> rhs(42, 4.5); + const QPair<int, int> pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + const QPair<int, float> pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); + } + + // assignment from lvalue: + { + const QPair<int, double> rhs(42, 4.5); + QPair<int, int> pii; + pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + QPair<int, float> pif; + pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); + } + + // construction from rvalue: + { +#define rhs qMakePair(42, 4.5) + const QPair<int, int> pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + const QPair<int, float> pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); +#undef rhs + } + + // assignment from rvalue: + { +#define rhs qMakePair(42, 4.5) + QPair<int, int> pii; + pii = rhs; + QCOMPARE(pii.first, 42); + QCOMPARE(pii.second, 4); + + QPair<int, float> pif; + pif = rhs; + QCOMPARE(pif.first, 42); + QCOMPARE(pif.second, 4.5f); +#undef rhs + } +} + +void tst_QPair::taskQTBUG_48780_pairContainingCArray() +{ + // compile-only: + QPair<int[2], int> pair; + pair.first[0] = 0; + pair.first[1] = 1; + pair.second = 2; + Q_UNUSED(pair); +} + QTEST_APPLESS_MAIN(tst_QPair) #include "tst_qpair.moc" diff --git a/tests/auto/corelib/tools/qpoint/qpoint.pro b/tests/auto/corelib/tools/qpoint/qpoint.pro index 0923abbc88..8321d08fe0 100644 --- a/tests/auto/corelib/tools/qpoint/qpoint.pro +++ b/tests/auto/corelib/tools/qpoint/qpoint.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpoint QT = core testlib SOURCES = tst_qpoint.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qpointf/qpointf.pro b/tests/auto/corelib/tools/qpointf/qpointf.pro index 1c594cd47c..5715b95d96 100644 --- a/tests/auto/corelib/tools/qpointf/qpointf.pro +++ b/tests/auto/corelib/tools/qpointf/qpointf.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qpointf QT = core testlib SOURCES = tst_qpointf.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qqueue/qqueue.pro b/tests/auto/corelib/tools/qqueue/qqueue.pro index 7b1e28baf3..55ceb65fbd 100644 --- a/tests/auto/corelib/tools/qqueue/qqueue.pro +++ b/tests/auto/corelib/tools/qqueue/qqueue.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qqueue QT = core testlib SOURCES = tst_qqueue.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qrect/qrect.pro b/tests/auto/corelib/tools/qrect/qrect.pro index 06fe15b0d6..8ec31db215 100644 --- a/tests/auto/corelib/tools/qrect/qrect.pro +++ b/tests/auto/corelib/tools/qrect/qrect.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qrect QT = core testlib SOURCES = tst_qrect.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregexp/qregexp.pro b/tests/auto/corelib/tools/qregexp/qregexp.pro index d8f67eed25..5f6ff0a71c 100644 --- a/tests/auto/corelib/tools/qregexp/qregexp.pro +++ b/tests/auto/corelib/tools/qregexp/qregexp.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregexp QT = core testlib SOURCES = tst_qregexp.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index b9a3fc13c5..1d8b719d16 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp @@ -880,19 +880,19 @@ void tst_QRegExp::caretAnchoredOptimization() { QString s = "---babnana----"; s.replace( QRegExp("^-*|(-*)$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-{0,})$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-{1,})$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); s = "---babnana----"; s.replace( QRegExp("^-*|(-+)$"), "" ); - QVERIFY(s == "babnana"); + QCOMPARE(s, QLatin1String("babnana")); } void tst_QRegExp::isEmpty() @@ -1370,12 +1370,14 @@ void tst_QRegExp::escapeSequences() { QString perlSyntaxSpecialChars("0123456789afnrtvbBdDwWsSx\\|[]{}()^$?+*"); QString w3cXmlSchema11SyntaxSpecialChars("cCiIpP"); // as well as the perl ones + QString pattern = QLatin1String("\\?"); for (int i = ' '; i <= 127; ++i) { QLatin1Char c(i); if (perlSyntaxSpecialChars.indexOf(c) == -1) { - QRegExp rx(QString("\\%1").arg(c), Qt::CaseSensitive, QRegExp::RegExp); + pattern[1] = c; + QRegExp rx(pattern, Qt::CaseSensitive, QRegExp::RegExp); // we'll never have c == 'a' since it's a special character - QString s = QString("aaa%1aaa").arg(c); + const QString s = QLatin1String("aaa") + c + QLatin1String("aaa"); QCOMPARE(rx.indexIn(s), 3); rx.setPatternSyntax(QRegExp::RegExp2); diff --git a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro index 3ecf16918c..a27286ff20 100644 --- a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_alwaysoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h SOURCES = \ tst_qregularexpression_alwaysoptimize.cpp \ ../tst_qregularexpression.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro index 9e366c0f48..0b36c79c1b 100644 --- a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_defaultoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h SOURCES = \ tst_qregularexpression_defaultoptimize.cpp \ ../tst_qregularexpression.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro index d34bc9b93d..1db77781dd 100644 --- a/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro +++ b/tests/auto/corelib/tools/qregularexpression/forceoptimize/forceoptimize.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpression_forceoptimize QT = core testlib HEADERS = ../tst_qregularexpression.h diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp index 8ddd4979b6..6be4e69eb7 100644 --- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp @@ -656,7 +656,7 @@ void tst_QRegularExpression::normalMatch_data() m.captured << "c123def" << "c12" << "3" << "def"; offset = 2; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("match06-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("match06-offset" + QByteArray::number(i)).constData()) << QRegularExpression("(\\w*)(\\d+)(\\w*)") << QStringLiteral("abc123def").mid(offset - i) << i @@ -669,7 +669,7 @@ void tst_QRegularExpression::normalMatch_data() m.captured << QString(""); offset = 9; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("match07-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("match07-offset" + QByteArray::number(i)).constData()) << QRegularExpression("\\w*") << QStringLiteral("abc123def").mid(offset - i) << i @@ -747,7 +747,7 @@ void tst_QRegularExpression::normalMatch_data() m.isValid = true; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("nomatch02-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("nomatch02-offset" + QByteArray::number(i)).constData()) << QRegularExpression("(\\w+) (\\w+)") << QStringLiteral("a string").mid(offset - i) << i @@ -759,7 +759,7 @@ void tst_QRegularExpression::normalMatch_data() m.isValid = true; offset = 9; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("nomatch03-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("nomatch03-offset" + QByteArray::number(i)).constData()) << QRegularExpression("\\w+") << QStringLiteral("abc123def").mid(offset - i) << i @@ -930,7 +930,7 @@ void tst_QRegularExpression::partialMatch_data() m.captured << "def"; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("softmatch08-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("softmatch08-offset" + QByteArray::number(i)).constData()) << QRegularExpression("abc\\w+X|defY") << QStringLiteral("abcdef").mid(offset - i) << i @@ -1016,7 +1016,7 @@ void tst_QRegularExpression::partialMatch_data() m.captured << "def"; offset = 1; for (int i = 0; i <= offset; ++i) { - QTest::newRow(QStringLiteral("hardmatch08-offset%1").arg(i).toUtf8().constData()) + QTest::newRow(("hardmatch08-offset" + QByteArray::number(i)).constData()) << QRegularExpression("abc\\w+X|defY") << QStringLiteral("abcdef").mid(offset - i) << i diff --git a/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro b/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro index 0618b03309..c63544035a 100644 --- a/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro +++ b/tests/auto/corelib/tools/qringbuffer/qringbuffer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qringbuffer QT = core-private testlib SOURCES = tst_qringbuffer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index 77fc6ad6ae..b77fe23bd6 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -39,11 +39,11 @@ class tst_QRingBuffer : public QObject { Q_OBJECT private slots: + void constructing(); void readPointerAtPositionWriteRead(); void readPointerAtPositionEmptyRead(); void readPointerAtPositionWithHead(); void readPointerAtPositionReadTooMuch(); - void sizeWhenEmpty(); void sizeWhenReservedAndChopped(); void sizeWhenReserved(); void free(); @@ -57,6 +57,23 @@ private slots: void readLine(); }; +void tst_QRingBuffer::constructing() +{ + QRingBuffer ringBuffer; + + QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); + QVERIFY(ringBuffer.isEmpty()); + QCOMPARE(ringBuffer.nextDataBlockSize(), Q_INT64_C(0)); + QVERIFY(ringBuffer.readPointer() == Q_NULLPTR); + QCOMPARE(ringBuffer.skip(5), Q_INT64_C(0)); + QCOMPARE(ringBuffer.read(), QByteArray()); + QCOMPARE(ringBuffer.getChar(), -1); + QVERIFY(!ringBuffer.canReadLine()); + + char buf[5]; + QCOMPARE(ringBuffer.peek(buf, sizeof(buf)), Q_INT64_C(0)); +} + void tst_QRingBuffer::sizeWhenReserved() { QRingBuffer ringBuffer; @@ -74,13 +91,6 @@ void tst_QRingBuffer::sizeWhenReservedAndChopped() QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); } -void tst_QRingBuffer::sizeWhenEmpty() -{ - QRingBuffer ringBuffer; - - QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); -} - void tst_QRingBuffer::readPointerAtPositionReadTooMuch() { QRingBuffer ringBuffer; @@ -140,7 +150,7 @@ void tst_QRingBuffer::readPointerAtPositionWriteRead() inData.putChar(0x23); inData.write("Qt rocks!"); for (int i = 0; i < 5000; i++) - inData.write(QString("Number %1").arg(i).toUtf8()); + inData.write("Number " + QByteArray::number(i)); inData.reset(); QVERIFY(inData.size() > 0); @@ -284,7 +294,8 @@ void tst_QRingBuffer::indexOf() for (int i = 1; i < 256; ++i) { qint64 index = ringBuffer.indexOf(char(i)); QCOMPARE(index, qint64(i - 1)); - QCOMPARE(ringBuffer.indexOf(char(i), i), index); + QCOMPARE(ringBuffer.indexOf(char(i), i, i >> 1), index); + QCOMPARE(ringBuffer.indexOf(char(i), 256, i), Q_INT64_C(-1)); QCOMPARE(ringBuffer.indexOf(char(i), i - 1), -1); // test for absent char } } diff --git a/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro b/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro index 5fa529e175..5248ad5528 100644 --- a/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro +++ b/tests/auto/corelib/tools/qscopedpointer/qscopedpointer.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qscopedpointer QT = core testlib SOURCES = tst_qscopedpointer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro b/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro index f823e6284b..c9c0a029d3 100644 --- a/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro +++ b/tests/auto/corelib/tools/qscopedvaluerollback/qscopedvaluerollback.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qscopedvaluerollback QT = core testlib SOURCES = tst_qscopedvaluerollback.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qset/qset.pro b/tests/auto/corelib/tools/qset/qset.pro index 8b5cdbc3f0..10ae3307d1 100644 --- a/tests/auto/corelib/tools/qset/qset.pro +++ b/tests/auto/corelib/tools/qset/qset.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qset QT = core testlib SOURCES = tst_qset.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qset/tst_qset.cpp b/tests/auto/corelib/tools/qset/tst_qset.cpp index fe4d81085c..f8f368f51c 100644 --- a/tests/auto/corelib/tools/qset/tst_qset.cpp +++ b/tests/auto/corelib/tools/qset/tst_qset.cpp @@ -753,7 +753,7 @@ void tst_QSet::stlMutableIterator() QSet<QString>::const_iterator k = set2.insert("foo"); i = reinterpret_cast<QSet<QString>::iterator &>(k); // #endif - QVERIFY(*i == "foo"); + QCOMPARE(*i, QLatin1String("foo")); } } diff --git a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro index 2e8e335472..240137d563 100644 --- a/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro +++ b/tests/auto/corelib/tools/qsharedpointer/qsharedpointer.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsharedpointer QT = core testlib diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 7741803224..d88a70c1e5 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -63,6 +63,7 @@ private slots: void basics(); void operators(); void swap(); + void moveSemantics(); void useOfForwardDeclared(); void memoryManagement(); void dropLastReferenceOfForwardDeclared(); @@ -411,6 +412,66 @@ void tst_QSharedPointer::swap() QVERIFY(w2.isNull()); } +void tst_QSharedPointer::moveSemantics() +{ +#ifdef Q_COMPILER_RVALUE_REFS + QSharedPointer<int> p1, p2(new int(42)), control = p2; + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p2 == control); + QVERIFY(!p2.isNull()); + QVERIFY(*p2 == 42); + + // move assignment + p1 = std::move(p2); + QVERIFY(p1 == control); + QVERIFY(!p1.isNull()); + QVERIFY(p2 != control); + QVERIFY(p2.isNull()); + QVERIFY(*p1 == 42); + + // move construction + QSharedPointer<int> p3 = std::move(p1); + QVERIFY(p1 != control); + QVERIFY(p1.isNull()); + QVERIFY(p3 == control); + QVERIFY(!p3.isNull()); + QVERIFY(*p3 == 42); + + QWeakPointer<int> w1, w2 = control; + + QVERIFY(w1.isNull()); + QVERIFY(!w2.isNull()); + QVERIFY(w2.lock() == control); + QVERIFY(!w1.lock()); + + // move assignment + w1 = std::move(w2); + QVERIFY(w2.isNull()); + QVERIFY(!w1.isNull()); + QVERIFY(w1.lock() == control); + QVERIFY(!w2.lock()); + + // move construction + QWeakPointer<int> w3 = std::move(w1); + QVERIFY(w1.isNull()); + QVERIFY(!w3.isNull()); + QVERIFY(w3.lock() == control); + QVERIFY(!w1.lock()); + + p1.reset(); + p2.reset(); + p3.reset(); + control.reset(); + + QVERIFY(w1.isNull()); + QVERIFY(w2.isNull()); + QVERIFY(w3.isNull()); +#else + QSKIP("This test requires C++11 rvalue/move semantics support in the compiler."); +#endif +} + void tst_QSharedPointer::useOfForwardDeclared() { // this just a compile test: use the forward-declared class diff --git a/tests/auto/corelib/tools/qsize/qsize.pro b/tests/auto/corelib/tools/qsize/qsize.pro index 310194ad12..9462e98e49 100644 --- a/tests/auto/corelib/tools/qsize/qsize.pro +++ b/tests/auto/corelib/tools/qsize/qsize.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsize QT = core testlib SOURCES = tst_qsize.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qsizef/qsizef.pro b/tests/auto/corelib/tools/qsizef/qsizef.pro index c456e450fd..f5ba220b06 100644 --- a/tests/auto/corelib/tools/qsizef/qsizef.pro +++ b/tests/auto/corelib/tools/qsizef/qsizef.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qsizef QT = core testlib SOURCES = tst_qsizef.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstl/qstl.pro b/tests/auto/corelib/tools/qstl/qstl.pro index 88fb53c6c6..e57e62b828 100644 --- a/tests/auto/corelib/tools/qstl/qstl.pro +++ b/tests/auto/corelib/tools/qstl/qstl.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstl QT = core testlib SOURCES = tst_qstl.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstring/qstring.pro b/tests/auto/corelib/tools/qstring/qstring.pro index 1eda27e1ff..1ff9a4fc9e 100644 --- a/tests/auto/corelib/tools/qstring/qstring.pro +++ b/tests/auto/corelib/tools/qstring/qstring.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstring QT = core testlib SOURCES = tst_qstring.cpp @@ -7,6 +7,10 @@ contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU contains(QT_CONFIG,c++11): CONFIG += c++11 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +!contains(QT_CONFIG, doubleconversion):!contains(QT_CONFIG, system-doubleconversion) { + DEFINES += QT_NO_DOUBLECONVERSION +} + mac { OBJECTIVE_SOURCES += tst_qstring_mac.mm LIBS += -framework Foundation diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index cc9f250be9..9556dfbd51 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -63,7 +63,7 @@ #include <algorithm> #define CREATE_REF(string) \ - const QString padded = QString::fromLatin1(" %1 ").arg(string); \ + const QString padded = QLatin1Char(' ') + string + QLatin1Char(' '); \ QStringRef ref = padded.midRef(1, padded.size() - 2); namespace { @@ -480,6 +480,7 @@ private slots: void indexOf3_data(); // void indexOf3(); void sprintf(); + void sprintfS(); void fill(); void truncate(); void constructor(); @@ -969,61 +970,61 @@ void tst_QString::acc_01() QString f; f = e; f[7]='F'; - QCOMPARE(e,(QString)"String E"); + QCOMPARE(e, QLatin1String("String E")); char text[]="String f"; f = text; text[7]='!'; - QCOMPARE(f,(QString)"String f"); + QCOMPARE(f, QLatin1String("String f")); f[7]='F'; QCOMPARE(text[7],'!'); a=""; a[0]='A'; - QCOMPARE(a,(QString)"A"); + QCOMPARE(a, QLatin1String("A")); QCOMPARE(a.length(),1); a[1]='B'; - QCOMPARE(a,(QString)"AB"); + QCOMPARE(a, QLatin1String("AB")); QCOMPARE(a.length(),2); a[2]='C'; - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a, QLatin1String("ABC")); QCOMPARE(a.length(),3); a = QString(); QVERIFY(a.isNull()); a[0]='A'; - QCOMPARE(a,(QString)"A"); + QCOMPARE(a, QLatin1String("A")); QCOMPARE(a.length(),1); a[1]='B'; - QCOMPARE(a,(QString)"AB"); + QCOMPARE(a, QLatin1String("AB")); QCOMPARE(a.length(),2); a[2]='C'; - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a, QLatin1String("ABC")); QCOMPARE(a.length(),3); a="123"; b="456"; a[0]=a[1]; - QCOMPARE(a,(QString)"223"); + QCOMPARE(a, QLatin1String("223")); a[1]=b[1]; - QCOMPARE(b,(QString)"456"); - QCOMPARE(a,(QString)"253"); + QCOMPARE(b, QLatin1String("456")); + QCOMPARE(a, QLatin1String("253")); char t[]="TEXT"; a="A"; a=t; - QCOMPARE(a,(QString)"TEXT"); + QCOMPARE(a, QLatin1String("TEXT")); QCOMPARE(a,(QString)t); a[0]='X'; - QCOMPARE(a,(QString)"XEXT"); + QCOMPARE(a, QLatin1String("XEXT")); QCOMPARE(t[0],'T'); t[0]='Z'; - QCOMPARE(a,(QString)"XEXT"); + QCOMPARE(a, QLatin1String("XEXT")); a="ABC"; QCOMPARE(char(a.toLatin1()[1]),'B'); - QCOMPARE(strcmp(a.toLatin1(),((QString)"ABC").toLatin1()),0); - QCOMPARE(a+="DEF",(QString)"ABCDEF"); - QCOMPARE(a+='G',(QString)"ABCDEFG"); - QCOMPARE(a+=((const char*)(0)),(QString)"ABCDEFG"); + QCOMPARE(strcmp(a.toLatin1(), QByteArrayLiteral("ABC")), 0); + QCOMPARE(a+="DEF", QLatin1String("ABCDEF")); + QCOMPARE(a+='G', QLatin1String("ABCDEFG")); + QCOMPARE(a+=((const char*)(0)), QLatin1String("ABCDEFG")); // non-member operators @@ -1045,11 +1046,11 @@ void tst_QString::acc_01() QVERIFY(a<=c); QVERIFY(!(c<=a)); QVERIFY(!(d<=a)); - QCOMPARE(QString(a+b),(QString)"ABCABC"); - QCOMPARE(QString(a+"XXXX"),(QString)"ABCXXXX"); - QCOMPARE(QString(a+'X'),(QString)"ABCX"); - QCOMPARE(QString("XXXX"+a),(QString)"XXXXABC"); - QCOMPARE(QString('X'+a),(QString)"XABC"); + QCOMPARE(QString(a+b), QLatin1String("ABCABC")); + QCOMPARE(QString(a+"XXXX"), QLatin1String("ABCXXXX")); + QCOMPARE(QString(a+'X'), QLatin1String("ABCX")); + QCOMPARE(QString("XXXX"+a), QLatin1String("XXXXABC")); + QCOMPARE(QString('X'+a), QLatin1String("XABC")); a = (const char*)0; QVERIFY(a.isNull()); QVERIFY(*a.toLatin1().constData() == '\0'); @@ -1115,7 +1116,7 @@ void tst_QString::constructor() QVERIFY(a == (QString)""); QCOMPARE(b,cb); QCOMPARE(c,cc); - QCOMPARE(d,(QString)"String D"); + QCOMPARE(d, QLatin1String("String D")); QString nullStr; QVERIFY( nullStr.isNull() ); @@ -1204,11 +1205,11 @@ void tst_QString::truncate() { QString e("String E"); e.truncate(4); - QCOMPARE(e,(QString)"Stri"); + QCOMPARE(e, QLatin1String("Stri")); e = "String E"; e.truncate(0); - QCOMPARE(e,(QString)""); + QCOMPARE(e, QLatin1String("")); QVERIFY(e.isEmpty()); QVERIFY(!e.isNull()); @@ -1218,25 +1219,25 @@ void tst_QString::fill() { QString e; e.fill('e',1); - QCOMPARE(e,(QString)"e"); + QCOMPARE(e, QLatin1String("e")); QString f; f.fill('f',3); - QCOMPARE(f,(QString)"fff"); + QCOMPARE(f, QLatin1String("fff")); f.fill('F'); - QCOMPARE(f,(QString)"FFF"); + QCOMPARE(f, QLatin1String("FFF")); } void tst_QString::sprintf() { QString a; a.sprintf("COMPARE"); - QCOMPARE(a,(QString)"COMPARE"); + QCOMPARE(a, QLatin1String("COMPARE")); a.sprintf("%%%d",1); - QCOMPARE(a,(QString)"%1"); - QCOMPARE(a.sprintf("X%dY",2),(QString)"X2Y"); - QCOMPARE(a.sprintf("X%9iY", 50000 ),(QString)"X 50000Y"); - QCOMPARE(a.sprintf("X%-9sY","hello"),(QString)"Xhello Y"); - QCOMPARE(a.sprintf("X%-9iY", 50000 ),(QString)"X50000 Y"); + QCOMPARE(a, QLatin1String("%1")); + QCOMPARE(a.sprintf("X%dY",2), QLatin1String("X2Y")); + QCOMPARE(a.sprintf("X%9iY", 50000 ), QLatin1String("X 50000Y")); + QCOMPARE(a.sprintf("X%-9sY","hello"), QLatin1String("Xhello Y")); + QCOMPARE(a.sprintf("X%-9iY", 50000 ), QLatin1String("X50000 Y")); QCOMPARE(a.sprintf("%lf", 1.23), QString("1.230000")); QCOMPARE(a.sprintf("%lf", 1.23456789), QString("1.234568")); QCOMPARE(a.sprintf("%p", (void *)0xbfffd350), QString("0xbfffd350")); @@ -1252,14 +1253,18 @@ void tst_QString::sprintf() double d = -514.25683; S1.sprintf("%f",d); QCOMPARE(S1, QString("-514.256830")); +} - QCOMPARE(a.sprintf("%.3s", "Hello" ),(QString)"Hel"); - QCOMPARE(a.sprintf("%10.3s", "Hello" ),(QString)" Hel"); - QCOMPARE(a.sprintf("%.10s", "Hello" ),(QString)"Hello"); - QCOMPARE(a.sprintf("%10.10s", "Hello" ),(QString)" Hello"); - QCOMPARE(a.sprintf("%-10.10s", "Hello" ),(QString)"Hello "); - QCOMPARE(a.sprintf("%-10.3s", "Hello" ),(QString)"Hel "); - QCOMPARE(a.sprintf("%-5.5s", "Hello" ),(QString)"Hello"); +void tst_QString::sprintfS() +{ + QString a; + QCOMPARE(a.sprintf("%.3s", "Hello" ), QLatin1String("Hel")); + QCOMPARE(a.sprintf("%10.3s", "Hello" ), QLatin1String(" Hel")); + QCOMPARE(a.sprintf("%.10s", "Hello" ), QLatin1String("Hello")); + QCOMPARE(a.sprintf("%10.10s", "Hello" ), QLatin1String(" Hello")); + QCOMPARE(a.sprintf("%-10.10s", "Hello" ), QLatin1String("Hello ")); + QCOMPARE(a.sprintf("%-10.3s", "Hello" ), QLatin1String("Hel ")); + QCOMPARE(a.sprintf("%-5.5s", "Hello" ), QLatin1String("Hello")); // Check utf8 conversion for %s QCOMPARE(a.sprintf("%s", "\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205"), QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305")); @@ -1268,12 +1273,30 @@ void tst_QString::sprintf() a.sprintf("%s%n%s", "hello", &n1, "goodbye"); QCOMPARE(n1, 5); QCOMPARE(a, QString("hellogoodbye")); -#ifndef Q_CC_MINGW // does not know %ll qlonglong n2; a.sprintf("%s%s%lln%s", "foo", "bar", &n2, "whiz"); QCOMPARE((int)n2, 6); QCOMPARE(a, QString("foobarwhiz")); -#endif + + { // %ls + QCOMPARE(a.sprintf("%.3ls", qUtf16Printable("Hello")), QLatin1String("Hel")); + QCOMPARE(a.sprintf("%10.3ls", qUtf16Printable("Hello")), QLatin1String(" Hel")); + QCOMPARE(a.sprintf("%.10ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + QCOMPARE(a.sprintf("%10.10ls", qUtf16Printable("Hello")), QLatin1String(" Hello")); + QCOMPARE(a.sprintf("%-10.10ls", qUtf16Printable("Hello")), QLatin1String("Hello ")); + QCOMPARE(a.sprintf("%-10.3ls", qUtf16Printable("Hello")), QLatin1String("Hel ")); + QCOMPARE(a.sprintf("%-5.5ls", qUtf16Printable("Hello")), QLatin1String("Hello")); + + // Check utf16 is preserved for %ls + QCOMPARE(a.sprintf("%ls", + qUtf16Printable("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")), + QLatin1String("\366\344\374\326\304\334\370\346\345\330\306\305")); + + int n; + a.sprintf("%ls%n%s", qUtf16Printable("hello"), &n, "goodbye"); + QCOMPARE(n, 5); + QCOMPARE(a, QLatin1String("hellogoodbye")); + } } /* @@ -1362,7 +1385,7 @@ void tst_QString::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow( "data59" ) << s1 << s2 << 0 << false << 2; QString veryBigHaystack(500, 'a'); @@ -1809,9 +1832,9 @@ void tst_QString::left() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.left(3),(QString)"ABC"); + QCOMPARE(a.left(3), QLatin1String("ABC")); QVERIFY(!a.left(0).isNull()); - QCOMPARE(a.left(0),(QString)""); + QCOMPARE(a.left(0), QLatin1String("")); QString n; QVERIFY(n.left(3).isNull()); @@ -1827,10 +1850,10 @@ void tst_QString::leftRef() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.leftRef(3).toString(),(QString)"ABC"); + QCOMPARE(a.leftRef(3).toString(), QLatin1String("ABC")); QVERIFY(a.leftRef(0).toString().isEmpty()); - QCOMPARE(a.leftRef(0).toString(),(QString)""); + QCOMPARE(a.leftRef(0).toString(), QLatin1String("")); QString n; QVERIFY(n.leftRef(3).toString().isEmpty()); @@ -1846,8 +1869,8 @@ void tst_QString::right() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.right(3),(QString)"EFG"); - QCOMPARE(a.right(0),(QString)""); + QCOMPARE(a.right(3), QLatin1String("EFG")); + QCOMPARE(a.right(0), QLatin1String("")); QString n; QVERIFY(n.right(3).isNull()); @@ -1862,8 +1885,8 @@ void tst_QString::rightRef() { QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.rightRef(3).toString(),(QString)"EFG"); - QCOMPARE(a.rightRef(0).toString(),(QString)""); + QCOMPARE(a.rightRef(3).toString(), QLatin1String("EFG")); + QCOMPARE(a.rightRef(0).toString(), QLatin1String("")); QString n; QVERIFY(n.rightRef(3).toString().isEmpty()); @@ -1879,8 +1902,8 @@ void tst_QString::mid() QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.mid(3,3),(QString)"DEF"); - QCOMPARE(a.mid(0,0),(QString)""); + QCOMPARE(a.mid(3,3), QLatin1String("DEF")); + QCOMPARE(a.mid(0,0), QLatin1String("")); QVERIFY(!a.mid(15,0).isNull()); QVERIFY(a.mid(15,0).isEmpty()); QVERIFY(!a.mid(15,1).isNull()); @@ -1958,8 +1981,8 @@ void tst_QString::midRef() QString a; a="ABCDEFGHIEfGEFG"; // 15 chars - QCOMPARE(a.midRef(3,3).toString(),(QString)"DEF"); - QCOMPARE(a.midRef(0,0).toString(),(QString)""); + QCOMPARE(a.midRef(3,3).toString(), QLatin1String("DEF")); + QCOMPARE(a.midRef(0,0).toString(), QLatin1String("")); QVERIFY(!a.midRef(15,0).toString().isNull()); QVERIFY(a.midRef(15,0).toString().isEmpty()); QVERIFY(!a.midRef(15,1).toString().isNull()); @@ -2083,44 +2106,44 @@ void tst_QString::leftJustified() { QString a; a="ABC"; - QCOMPARE(a.leftJustified(5,'-'),(QString)"ABC--"); - QCOMPARE(a.leftJustified(4,'-'),(QString)"ABC-"); - QCOMPARE(a.leftJustified(4),(QString)"ABC "); - QCOMPARE(a.leftJustified(3),(QString)"ABC"); - QCOMPARE(a.leftJustified(2),(QString)"ABC"); - QCOMPARE(a.leftJustified(1),(QString)"ABC"); - QCOMPARE(a.leftJustified(0),(QString)"ABC"); + QCOMPARE(a.leftJustified(5,'-'), QLatin1String("ABC--")); + QCOMPARE(a.leftJustified(4,'-'), QLatin1String("ABC-")); + QCOMPARE(a.leftJustified(4), QLatin1String("ABC ")); + QCOMPARE(a.leftJustified(3), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(2), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(1), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(0), QLatin1String("ABC")); QString n; QVERIFY(!n.leftJustified(3).isNull()); - QCOMPARE(a.leftJustified(4,' ',true),(QString)"ABC "); - QCOMPARE(a.leftJustified(3,' ',true),(QString)"ABC"); - QCOMPARE(a.leftJustified(2,' ',true),(QString)"AB"); - QCOMPARE(a.leftJustified(1,' ',true),(QString)"A"); - QCOMPARE(a.leftJustified(0,' ',true),(QString)""); + QCOMPARE(a.leftJustified(4,' ',true), QLatin1String("ABC ")); + QCOMPARE(a.leftJustified(3,' ',true), QLatin1String("ABC")); + QCOMPARE(a.leftJustified(2,' ',true), QLatin1String("AB")); + QCOMPARE(a.leftJustified(1,' ',true), QLatin1String("A")); + QCOMPARE(a.leftJustified(0,' ',true), QLatin1String("")); } void tst_QString::rightJustified() { QString a; a="ABC"; - QCOMPARE(a.rightJustified(5,'-'),(QString)"--ABC"); - QCOMPARE(a.rightJustified(4,'-'),(QString)"-ABC"); - QCOMPARE(a.rightJustified(4),(QString)" ABC"); - QCOMPARE(a.rightJustified(3),(QString)"ABC"); - QCOMPARE(a.rightJustified(2),(QString)"ABC"); - QCOMPARE(a.rightJustified(1),(QString)"ABC"); - QCOMPARE(a.rightJustified(0),(QString)"ABC"); + QCOMPARE(a.rightJustified(5,'-'), QLatin1String("--ABC")); + QCOMPARE(a.rightJustified(4,'-'), QLatin1String("-ABC")); + QCOMPARE(a.rightJustified(4), QLatin1String(" ABC")); + QCOMPARE(a.rightJustified(3), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(2), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(1), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(0), QLatin1String("ABC")); QString n; QVERIFY(!n.rightJustified(3).isNull()); - QCOMPARE(a.rightJustified(4,'-',true),(QString)"-ABC"); - QCOMPARE(a.rightJustified(4,' ',true),(QString)" ABC"); - QCOMPARE(a.rightJustified(3,' ',true),(QString)"ABC"); - QCOMPARE(a.rightJustified(2,' ',true),(QString)"AB"); - QCOMPARE(a.rightJustified(1,' ',true),(QString)"A"); - QCOMPARE(a.rightJustified(0,' ',true),(QString)""); - QCOMPARE(a,(QString)"ABC"); + QCOMPARE(a.rightJustified(4,'-',true), QLatin1String("-ABC")); + QCOMPARE(a.rightJustified(4,' ',true), QLatin1String(" ABC")); + QCOMPARE(a.rightJustified(3,' ',true), QLatin1String("ABC")); + QCOMPARE(a.rightJustified(2,' ',true), QLatin1String("AB")); + QCOMPARE(a.rightJustified(1,' ',true), QLatin1String("A")); + QCOMPARE(a.rightJustified(0,' ',true), QLatin1String("")); + QCOMPARE(a, QLatin1String("ABC")); } void tst_QString::toUpper() @@ -2318,21 +2341,21 @@ void tst_QString::trimmed() { QString a; a="Text"; - QCOMPARE(a,(QString)"Text"); - QCOMPARE(a.trimmed(),(QString)"Text"); - QCOMPARE(a,(QString)"Text"); + QCOMPARE(a, QLatin1String("Text")); + QCOMPARE(a.trimmed(), QLatin1String("Text")); + QCOMPARE(a, QLatin1String("Text")); a=" "; - QCOMPARE(a.trimmed(),(QString)""); - QCOMPARE(a,(QString)" "); + QCOMPARE(a.trimmed(), QLatin1String("")); + QCOMPARE(a, QLatin1String(" ")); a=" a "; - QCOMPARE(a.trimmed(),(QString)"a"); + QCOMPARE(a.trimmed(), QLatin1String("a")); a="Text"; - QCOMPARE(qMove(a).trimmed(),(QString)"Text"); + QCOMPARE(qMove(a).trimmed(), QLatin1String("Text")); a=" "; - QCOMPARE(qMove(a).trimmed(),(QString)""); + QCOMPARE(qMove(a).trimmed(), QLatin1String("")); a=" a "; - QCOMPARE(qMove(a).trimmed(),(QString)"a"); + QCOMPARE(qMove(a).trimmed(), QLatin1String("a")); } void tst_QString::simplified_data() @@ -2458,12 +2481,13 @@ void tst_QString::insert_special_cases() QCOMPARE(a.insert(1,'>'), QString("<>ABCABCABCABC")); a = "Meal"; - QCOMPARE(a.insert(1, QLatin1String("ontr")), QString("Montreal")); - QCOMPARE(a.insert(4, ""), QString("Montreal")); - QCOMPARE(a.insert(3, QLatin1String("")), QString("Montreal")); - QCOMPARE(a.insert(3, QLatin1String(0)), QString("Montreal")); - QCOMPARE(a.insert(3, static_cast<const char *>(0)), QString("Montreal")); - QCOMPARE(a.insert(0, QLatin1String("a")), QString("aMontreal")); + const QString montreal = QStringLiteral("Montreal"); + QCOMPARE(a.insert(1, QLatin1String("ontr")), montreal); + QCOMPARE(a.insert(4, ""), montreal); + QCOMPARE(a.insert(3, QLatin1String("")), montreal); + QCOMPARE(a.insert(3, QLatin1String(0)), montreal); + QCOMPARE(a.insert(3, static_cast<const char *>(0)), montreal); + QCOMPARE(a.insert(0, QLatin1String("a")), QLatin1String("aMontreal")); } void tst_QString::append_data(bool emptyIsNoop) @@ -3574,12 +3598,12 @@ void tst_QString::toDouble() void tst_QString::setNum() { QString a; - QCOMPARE(a.setNum(123),(QString)"123"); - QCOMPARE(a.setNum(-123),(QString)"-123"); - QCOMPARE(a.setNum(0x123,16),(QString)"123"); - QCOMPARE(a.setNum((short)123),(QString)"123"); - QCOMPARE(a.setNum(123L),(QString)"123"); - QCOMPARE(a.setNum(123UL),(QString)"123"); + QCOMPARE(a.setNum(123), QLatin1String("123")); + QCOMPARE(a.setNum(-123), QLatin1String("-123")); + QCOMPARE(a.setNum(0x123,16), QLatin1String("123")); + QCOMPARE(a.setNum((short)123), QLatin1String("123")); + QCOMPARE(a.setNum(123L), QLatin1String("123")); + QCOMPARE(a.setNum(123UL), QLatin1String("123")); QCOMPARE(a.setNum(2147483647L), QString("2147483647")); // 32 bit LONG_MAX QCOMPARE(a.setNum(-2147483647L), QString("-2147483647")); // LONG_MIN + 1 QCOMPARE(a.setNum(-2147483647L-1L), QString("-2147483648")); // LONG_MIN @@ -3836,7 +3860,7 @@ void tst_QString::check_QDataStream() { QDataStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"COMPARE Text"); + QCOMPARE(a, QLatin1String("COMPARE Text")); } } @@ -3851,7 +3875,7 @@ void tst_QString::check_QTextStream() { QTextStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"This"); + QCOMPARE(a, QLatin1String("This")); } } @@ -4544,100 +4568,100 @@ void tst_QString::arg() QString s13( "%1% %x%c%2 %d%2-%" ); QString s14( "%1%2%3" ); - QCOMPARE( s4.arg("foo"), QString("[foo]") ); - QCOMPARE( s5.arg("foo"), QString("[foo]") ); - QCOMPARE( s6.arg("foo"), QString("[foo]") ); - QCOMPARE( s7.arg("foo"), QString("[foo]") ); - QCOMPARE( s8.arg("foo"), QString("[foo %1]") ); - QCOMPARE( s8.arg("foo").arg("bar"), QString("[foo bar]") ); - QCOMPARE( s8.arg("foo", "bar"), QString("[foo bar]") ); - QCOMPARE( s9.arg("foo"), QString("[foo %3]") ); - QCOMPARE( s9.arg("foo").arg("bar"), QString("[foo bar]") ); - QCOMPARE( s9.arg("foo", "bar"), QString("[foo bar]") ); - QCOMPARE( s10.arg("foo"), QString("[foo %2 %3]") ); - QCOMPARE( s10.arg("foo").arg("bar"), QString("[foo bar %3]") ); - QCOMPARE( s10.arg("foo", "bar"), QString("[foo bar %3]") ); - QCOMPARE( s10.arg("foo").arg("bar").arg("baz"), QString("[foo bar baz]") ); - QCOMPARE( s10.arg("foo", "bar", "baz"), QString("[foo bar baz]") ); - QCOMPARE( s11.arg("foo"), QString("[%9 %3 foo]") ); - QCOMPARE( s11.arg("foo").arg("bar"), QString("[%9 bar foo]") ); - QCOMPARE( s11.arg("foo", "bar"), QString("[%9 bar foo]") ); - QCOMPARE( s11.arg("foo").arg("bar").arg("baz"), QString("[baz bar foo]") ); - QCOMPARE( s11.arg("foo", "bar", "baz"), QString("[baz bar foo]") ); + QCOMPARE( s4.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s5.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s6.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s7.arg("foo"), QLatin1String("[foo]") ); + QCOMPARE( s8.arg("foo"), QLatin1String("[foo %1]") ); + QCOMPARE( s8.arg("foo").arg("bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s8.arg("foo", "bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s9.arg("foo"), QLatin1String("[foo %3]") ); + QCOMPARE( s9.arg("foo").arg("bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s9.arg("foo", "bar"), QLatin1String("[foo bar]") ); + QCOMPARE( s10.arg("foo"), QLatin1String("[foo %2 %3]") ); + QCOMPARE( s10.arg("foo").arg("bar"), QLatin1String("[foo bar %3]") ); + QCOMPARE( s10.arg("foo", "bar"), QLatin1String("[foo bar %3]") ); + QCOMPARE( s10.arg("foo").arg("bar").arg("baz"), QLatin1String("[foo bar baz]") ); + QCOMPARE( s10.arg("foo", "bar", "baz"), QLatin1String("[foo bar baz]") ); + QCOMPARE( s11.arg("foo"), QLatin1String("[%9 %3 foo]") ); + QCOMPARE( s11.arg("foo").arg("bar"), QLatin1String("[%9 bar foo]") ); + QCOMPARE( s11.arg("foo", "bar"), QLatin1String("[%9 bar foo]") ); + QCOMPARE( s11.arg("foo").arg("bar").arg("baz"), QLatin1String("[baz bar foo]") ); + QCOMPARE( s11.arg("foo", "bar", "baz"), QLatin1String("[baz bar foo]") ); QCOMPARE( s12.arg("a").arg("b").arg("c").arg("d").arg("e"), - QString("[e b c e a d]") ); - QCOMPARE( s12.arg("a", "b", "c", "d").arg("e"), QString("[e b c e a d]") ); - QCOMPARE( s12.arg("a").arg("b", "c", "d", "e"), QString("[e b c e a d]") ); + QLatin1String("[e b c e a d]") ); + QCOMPARE( s12.arg("a", "b", "c", "d").arg("e"), QLatin1String("[e b c e a d]") ); + QCOMPARE( s12.arg("a").arg("b", "c", "d", "e"), QLatin1String("[e b c e a d]") ); QCOMPARE( s13.arg("alpha").arg("beta"), - QString("alpha% %x%cbeta %dbeta-%") ); - QCOMPARE( s13.arg("alpha", "beta"), QString("alpha% %x%cbeta %dbeta-%") ); - QCOMPARE( s14.arg("a", "b", "c"), QString("abc") ); - QCOMPARE( s8.arg("%1").arg("foo"), QString("[foo foo]") ); - QCOMPARE( s8.arg("%1", "foo"), QString("[%1 foo]") ); - QCOMPARE( s4.arg("foo", 2), QString("[foo]") ); - QCOMPARE( s4.arg("foo", -2), QString("[foo]") ); - QCOMPARE( s4.arg("foo", 10), QString("[ foo]") ); - QCOMPARE( s4.arg("foo", -10), QString("[foo ]") ); + QLatin1String("alpha% %x%cbeta %dbeta-%") ); + QCOMPARE( s13.arg("alpha", "beta"), QLatin1String("alpha% %x%cbeta %dbeta-%") ); + QCOMPARE( s14.arg("a", "b", "c"), QLatin1String("abc") ); + QCOMPARE( s8.arg("%1").arg("foo"), QLatin1String("[foo foo]") ); + QCOMPARE( s8.arg("%1", "foo"), QLatin1String("[%1 foo]") ); + QCOMPARE( s4.arg("foo", 2), QLatin1String("[foo]") ); + QCOMPARE( s4.arg("foo", -2), QLatin1String("[foo]") ); + QCOMPARE( s4.arg("foo", 10), QLatin1String("[ foo]") ); + QCOMPARE( s4.arg("foo", -10), QLatin1String("[foo ]") ); QString firstName( "James" ); QString lastName( "Bond" ); QString fullName = QString( "My name is %2, %1 %2" ) .arg( firstName ).arg( lastName ); - QCOMPARE( fullName, QString("My name is Bond, James Bond") ); + QCOMPARE( fullName, QLatin1String("My name is Bond, James Bond") ); // number overloads - QCOMPARE( s4.arg(0), QString("[0]") ); - QCOMPARE( s4.arg(-1), QString("[-1]") ); - QCOMPARE( s4.arg(4294967295UL), QString("[4294967295]") ); // ULONG_MAX 32 + QCOMPARE( s4.arg(0), QLatin1String("[0]") ); + QCOMPARE( s4.arg(-1), QLatin1String("[-1]") ); + QCOMPARE( s4.arg(4294967295UL), QLatin1String("[4294967295]") ); // ULONG_MAX 32 QCOMPARE( s4.arg(Q_INT64_C(9223372036854775807)), // LLONG_MAX - QString("[9223372036854775807]") ); + QLatin1String("[9223372036854775807]") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0"); QCOMPARE( QString().arg(0), QString() ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"\" , 0"); QCOMPARE( QString("").arg(0), QString("") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \" \" , 0"); - QCOMPARE( QString(" ").arg(0), QString(" ") ); + QCOMPARE( QString(" ").arg(0), QLatin1String(" ") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%\" , 0"); - QCOMPARE( QString("%").arg(0), QString("%") ); + QCOMPARE( QString("%").arg(0), QLatin1String("%") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%\" , 0"); - QCOMPARE( QString("%%").arg(0), QString("%%") ); + QCOMPARE( QString("%%").arg(0), QLatin1String("%%") ); QTest::ignoreMessage(QtWarningMsg, "QString::arg: Argument missing: \"%%%\" , 0"); - QCOMPARE( QString("%%%").arg(0), QString("%%%") ); - QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QString("%%foo%%bar") ); - - QCOMPARE( QString("%1").arg("hello", -10), QString("hello ") ); - QCOMPARE( QString("%1").arg("hello", -5), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", -2), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 0), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 2), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 5), QString("hello") ); - QCOMPARE( QString("%1").arg("hello", 10), QString(" hello") ); - QCOMPARE( QString("%1%1").arg("hello"), QString("hellohello") ); - QCOMPARE( QString("%2%1").arg("hello"), QString("%2hello") ); - QCOMPARE( QString("%1%1").arg(QString::null), QString("") ); - QCOMPARE( QString("%2%1").arg(""), QString("%2") ); + QCOMPARE( QString("%%%").arg(0), QLatin1String("%%%") ); + QCOMPARE( QString("%%%1%%%2").arg("foo").arg("bar"), QLatin1String("%%foo%%bar") ); + + QCOMPARE( QString("%1").arg("hello", -10), QLatin1String("hello ") ); + QCOMPARE( QString("%1").arg("hello", -5), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", -2), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 0), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 2), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 5), QLatin1String("hello") ); + QCOMPARE( QString("%1").arg("hello", 10), QLatin1String(" hello") ); + QCOMPARE( QString("%1%1").arg("hello"), QLatin1String("hellohello") ); + QCOMPARE( QString("%2%1").arg("hello"), QLatin1String("%2hello") ); + QCOMPARE( QString("%1%1").arg(QString::null), QLatin1String("") ); + QCOMPARE( QString("%2%1").arg(""), QLatin1String("%2") ); QCOMPARE( QString("%2 %L1").arg(12345.6789).arg(12345.6789), - QString("12345.7 12.345,7") ); + QLatin1String("12345.7 12.345,7") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9).arg(12345.6789, 9), - QString("[ 12345.7] [ 12.345,7]") ); + QLatin1String("[ 12345.7] [ 12.345,7]") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 9, 'g', 7).arg(12345.6789, 9, 'g', 7), - QString("[ 12345.68] [12.345,68]") ); + QLatin1String("[ 12345.68] [12.345,68]") ); QCOMPARE( QString("[%2] [%L1]").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')).arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), - QString("[0012345.68] [012.345,68]") ); + QLatin1String("[0012345.68] [012.345,68]") ); QCOMPARE( QString("%2 %L1").arg(123456789).arg(123456789), - QString("123456789 123.456.789") ); + QLatin1String("123456789 123.456.789") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 12).arg(123456789, 12), - QString("[ 123456789] [ 123.456.789]") ); + QLatin1String("[ 123456789] [ 123.456.789]") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 10, QLatin1Char('0')).arg(123456789, 12, 10, QLatin1Char('0')), - QString("[000123456789] [00123.456.789]") ); + QLatin1String("[000123456789] [00123.456.789]") ); QCOMPARE( QString("[%2] [%L1]").arg(123456789, 13, 16, QLatin1Char('0')).arg(123456789, 12, 16, QLatin1Char('0')), - QString("[0000075bcd15] [00000075bcd15]") ); + QLatin1String("[0000075bcd15] [00000075bcd15]") ); QCOMPARE( QString("%L2 %L1 %3").arg(12345.7).arg(123456789).arg('c'), - QString("123.456.789 12.345,7 c") ); + QLatin1String("123.456.789 12.345,7 c") ); // multi-digit replacement QString input("%%%L0 %1 %02 %3 %4 %5 %L6 %7 %8 %%% %090 %10 %11 %L12 %14 %L9888 %9999 %%%%%%%L"); @@ -4647,36 +4671,36 @@ void tst_QString::arg() .arg("k").arg("l").arg("m") .arg("n").arg("o").arg("p"); - QCOMPARE(input, QString("%%A B C D E f g h i %%% j0 k l m n o88 p99 %%%%%%%L")); + QCOMPARE(input, QLatin1String("%%A B C D E f g h i %%% j0 k l m n o88 p99 %%%%%%%L")); QString str("%1 %2 %3 %4 %5 %6 %7 %8 %9 foo %10 %11 bar"); str = str.arg("one", "2", "3", "4", "5", "6", "7", "8", "9"); str = str.arg("ahoy", "there"); - QCOMPARE(str, QString("one 2 3 4 5 6 7 8 9 foo ahoy there bar")); + QCOMPARE(str, QLatin1String("one 2 3 4 5 6 7 8 9 foo ahoy there bar")); QString str2("%123 %234 %345 %456 %567 %999 %1000 %1230"); str2 = str2.arg("A", "B", "C", "D", "E", "F"); - QCOMPARE(str2, QString("A B C D E F %1000 %1230")); - - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('0')), QString("-01")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('0')), QString("-100")); - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar(' ')), QString(" -1")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar(' ')), QString("-100")); - QCOMPARE(QString("%1").arg(1U, 3, 10, QChar(' ')), QString(" 1")); - QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar(' ')), QString("1000")); - QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('x')), QString("x-1")); - QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('x')), QString("-100")); - QCOMPARE(QString("%1").arg(1U, 3, 10, QChar('x')), QString("xx1")); - QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar('x')), QString("1000")); - - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('0')), QString("-01")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('0')), QString("-100")); - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar(' ')), QString(" -1")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar(' ')), QString("-100")); - QCOMPARE(QString("%1").arg(1., 3, 'g', -1, QChar('x')), QString("xx1")); - QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QString("1000")); - QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QString("x-1")); - QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QString("-100")); + QCOMPARE(str2, QLatin1String("A B C D E F %1000 %1230")); + + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('0')), QLatin1String("-01")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('0')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar(' ')), QLatin1String(" -1")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar(' ')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1U, 3, 10, QChar(' ')), QLatin1String(" 1")); + QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar(' ')), QLatin1String("1000")); + QCOMPARE(QString("%1").arg(-1, 3, 10, QChar('x')), QLatin1String("x-1")); + QCOMPARE(QString("%1").arg(-100, 3, 10, QChar('x')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1U, 3, 10, QChar('x')), QLatin1String("xx1")); + QCOMPARE(QString("%1").arg(1000U, 3, 10, QChar('x')), QLatin1String("1000")); + + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('0')), QLatin1String("-01")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('0')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar(' ')), QLatin1String(" -1")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar(' ')), QLatin1String("-100")); + QCOMPARE(QString("%1").arg(1., 3, 'g', -1, QChar('x')), QLatin1String("xx1")); + QCOMPARE(QString("%1").arg(1000., 3, 'g', -1, QChar('x')), QLatin1String("1000")); + QCOMPARE(QString("%1").arg(-1., 3, 'g', -1, QChar('x')), QLatin1String("x-1")); + QCOMPARE(QString("%1").arg(-100., 3, 'g', -1, QChar('x')), QLatin1String("-100")); QLocale::setDefault(QString("ar")); QCOMPARE( QString("%L1").arg(12345.6789, 10, 'g', 7, QLatin1Char('0')), @@ -4689,13 +4713,18 @@ void tst_QString::arg() void tst_QString::number() { - QCOMPARE( QString::number(int(0)), QString("0") ); - QCOMPARE( QString::number((unsigned int)(11)), QString("11") ); - QCOMPARE( QString::number(-22L), QString("-22") ); - QCOMPARE( QString::number(333UL), QString("333") ); - QCOMPARE( QString::number(4.4), QString("4.4") ); - QCOMPARE( QString::number(Q_INT64_C(-555)), QString("-555") ); - QCOMPARE( QString::number(Q_UINT64_C(6666)), QString("6666") ); + QCOMPARE( QString::number(int(0)), QLatin1String("0") ); + QCOMPARE( QString::number((unsigned int)(11)), QLatin1String("11") ); + QCOMPARE( QString::number(-22L), QLatin1String("-22") ); + QCOMPARE( QString::number(333UL), QLatin1String("333") ); + QCOMPARE( QString::number(4.4), QLatin1String("4.4") ); + QCOMPARE( QString::number(Q_INT64_C(-555)), QLatin1String("-555") ); + QCOMPARE( QString::number(Q_UINT64_C(6666)), QLatin1String("6666") ); + +#ifndef QT_NO_DOUBLECONVERSION // snprintf_l is too stupid for this + QCOMPARE( QString::number(12.05, 'f', 1), QString("12.1") ); + QCOMPARE( QString::number(12.5, 'f', 0), QString("13") ); +#endif } void tst_QString::capacity_data() @@ -6121,9 +6150,6 @@ void tst_QString::QCharRefDetaching() const void tst_QString::sprintfZU() const { -#ifdef Q_CC_MINGW - QSKIP("MinGW does not support '%zu'."); -#else { QString string; size_t s = 6; @@ -6152,7 +6178,6 @@ void tst_QString::sprintfZU() const string.sprintf("%zu %s\n", s, "foo"); QCOMPARE(string, QString::fromLatin1("6 foo\n")); } -#endif // !Q_CC_MINGW } void tst_QString::repeatedSignature() const diff --git a/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro index 1719af631d..14dbe779db 100644 --- a/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro +++ b/tests/auto/corelib/tools/qstring_no_cast_from_bytearray/qstring_no_cast_from_bytearray.pro @@ -1,7 +1,6 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstring_no_cast_from_bytearray QT = core testlib SOURCES = tst_qstring_no_cast_from_bytearray.cpp DEFINES += QT_NO_CAST_FROM_BYTEARRAY -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro index 64ce377c29..d9cdad1bf5 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/qstringbuilder1.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder1 QT = core testlib SOURCES = tst_qstringbuilder1.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro index 56ed7707d0..e134c5d934 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder2/qstringbuilder2.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder2 QT = core testlib SOURCES = tst_qstringbuilder2.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro index 2be2c24de4..29607551c3 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder3/qstringbuilder3.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder3 QT = core testlib SOURCES = tst_qstringbuilder3.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro index 3a97d49483..e55848e4bd 100644 --- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro +++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder4/qstringbuilder4.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringbuilder4 QT = core testlib SOURCES = tst_qstringbuilder4.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro b/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro index e5e625d520..3a1678b5f3 100644 --- a/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro +++ b/tests/auto/corelib/tools/qstringiterator/qstringiterator.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringiterator QT = core core-private testlib SOURCES = tst_qstringiterator.cpp diff --git a/tests/auto/corelib/tools/qstringlist/qstringlist.pro b/tests/auto/corelib/tools/qstringlist/qstringlist.pro index c3b2fe07c0..a87257decb 100644 --- a/tests/auto/corelib/tools/qstringlist/qstringlist.pro +++ b/tests/auto/corelib/tools/qstringlist/qstringlist.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringlist QT = core testlib SOURCES = tst_qstringlist.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro b/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro index 3a6e22b469..e34928776f 100644 --- a/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro +++ b/tests/auto/corelib/tools/qstringmatcher/qstringmatcher.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringmatcher QT = core testlib SOURCES = tst_qstringmatcher.cpp DEFINES += QT_NO_CAST_TO_ASCII -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringref/qstringref.pro b/tests/auto/corelib/tools/qstringref/qstringref.pro index edb5ef995c..04f3ba6a92 100644 --- a/tests/auto/corelib/tools/qstringref/qstringref.pro +++ b/tests/auto/corelib/tools/qstringref/qstringref.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qstringref QT = core testlib SOURCES = tst_qstringref.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index 82d103c460..b3599b6a5c 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -97,7 +97,7 @@ static QStringRef emptyRef() } #define CREATE_REF(string) \ - const QString padded = QString::fromLatin1(" %1 ").arg(string); \ + const QString padded = QLatin1Char(' ') + string + QLatin1Char(' '); \ QStringRef ref = padded.midRef(1, padded.size() - 2); typedef QList<int> IntList; @@ -292,7 +292,7 @@ void tst_QStringRef::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2; QString veryBigHaystack(500, 'a'); @@ -317,8 +317,8 @@ void tst_QStringRef::indexOf() QFETCH(bool, bcs); QFETCH(int, resultpos); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); @@ -407,8 +407,8 @@ void tst_QStringRef::indexOf2() QFETCH(QString, needle); QFETCH(int, resultpos); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); @@ -490,8 +490,8 @@ void tst_QStringRef::lastIndexOf() QFETCH(int, expected); QFETCH(bool, caseSensitive); - const QString haystackPadded = QString::fromLatin1(" %1 ").arg(haystack); - const QString needlePadded = QString::fromLatin1(" %1 ").arg(needle); + const QString haystackPadded = QLatin1Char(' ') + haystack + QLatin1Char(' '); + const QString needlePadded = QLatin1Char(' ') + needle + QLatin1Char(' '); const QStringRef haystackRef(&haystackPadded, 1, haystack.size()); const QStringRef needleRef(&needlePadded, 1, needle.size()); diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 29b9854ebb..9d26ec1fd5 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -1,10 +1,9 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtextboundaryfinder QT = core testlib SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index 753d61f02c..927c07f9e6 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -166,8 +166,8 @@ static void generateDataFromFile(const QString &fname) } } - QString nm = QString("line #%1: %2").arg(linenum).arg(comments); - QTest::newRow(nm.toLatin1()) << testString << expectedBreakPositions; + const QByteArray nm = "line #" + QByteArray::number(linenum) + ": " + comments.toLatin1(); + QTest::newRow(nm.constData()) << testString << expectedBreakPositions; } } #endif diff --git a/tests/auto/corelib/tools/qtime/qtime.pro b/tests/auto/corelib/tools/qtime/qtime.pro index 48db4c6664..0973b7a9ef 100644 --- a/tests/auto/corelib/tools/qtime/qtime.pro +++ b/tests/auto/corelib/tools/qtime/qtime.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtime QT = core testlib SOURCES = tst_qtime.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qtimeline/qtimeline.pro b/tests/auto/corelib/tools/qtimeline/qtimeline.pro index ca8eba41fb..9424cf8fd2 100644 --- a/tests/auto/corelib/tools/qtimeline/qtimeline.pro +++ b/tests/auto/corelib/tools/qtimeline/qtimeline.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimeline QT = core testlib SOURCES = tst_qtimeline.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/tools/qtimezone/qtimezone.pro index fa2397a6bb..4459ed6020 100644 --- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro +++ b/tests/auto/corelib/tools/qtimezone/qtimezone.pro @@ -1,8 +1,7 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qtimezone QT = core-private testlib SOURCES = tst_qtimezone.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 contains(QT_CONFIG,icu) { DEFINES += QT_USE_ICU } diff --git a/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro b/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro index 4fb8a1cf30..108fb33db5 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro +++ b/tests/auto/corelib/tools/qvarlengtharray/qvarlengtharray.pro @@ -1,5 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qvarlengtharray QT = core testlib SOURCES = tst_qvarlengtharray.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 82f78b2b0b..1c736fba65 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -148,14 +148,14 @@ void tst_QVarLengthArray::oldTests() QVarLengthArray<QString> sa(10); sa[0] = "Hello"; sa[9] = "World"; - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); sa.reserve(512); - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); sa.resize(512); - QVERIFY(*sa.data() == "Hello"); - QVERIFY(sa[9] == "World"); + QCOMPARE(*sa.data(), QLatin1String("Hello")); + QCOMPARE(sa[9], QLatin1String("World")); } { int arr[2] = {1, 2}; diff --git a/tests/auto/corelib/tools/qvector/qvector.pro b/tests/auto/corelib/tools/qvector/qvector.pro index c1e0564915..d49516923f 100644 --- a/tests/auto/corelib/tools/qvector/qvector.pro +++ b/tests/auto/corelib/tools/qvector/qvector.pro @@ -1,6 +1,5 @@ -CONFIG += testcase parallel_test +CONFIG += testcase contains(QT_CONFIG, c++11):CONFIG += c++11 TARGET = tst_qvector QT = core testlib SOURCES = $$PWD/tst_qvector.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 87822bca6f..bdfb567331 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -2391,6 +2391,7 @@ void tst_QVector::reallocAfterCopy_data() int result1, result2, result3, result4; int fill_size; for (int i = 70; i <= 100; i += 10) { + const QByteArray prefix = "reallocAfterCopy:" + QByteArray::number(i) + ','; fill_size = i - 20; for (int j = 0; j <= 3; j++) { if (j == 0) { // append @@ -2414,7 +2415,8 @@ void tst_QVector::reallocAfterCopy_data() result3 = i - 10; result4 = i - 20; } - QTest::newRow(qPrintable(QString("reallocAfterCopy:%1,%2").arg(i).arg(j))) << i << fill_size << j << result1 << result2 << result3 << result4; + QTest::newRow((prefix + QByteArray::number(j)).constData()) + << i << fill_size << j << result1 << result2 << result3 << result4; } } } diff --git a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro index e83a2b507c..834fc85a29 100644 --- a/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro +++ b/tests/auto/corelib/tools/qversionnumber/qversionnumber.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase contains(QT_CONFIG, c++11):CONFIG += c++11 contains(QT_CONFIG, c++14):CONFIG += c++14 TARGET = tst_qversionnumber diff --git a/tests/auto/corelib/xml/qxmlstream/qxmlstream.pro b/tests/auto/corelib/xml/qxmlstream/qxmlstream.pro index 0a9580da62..0a739f0a0e 100644 --- a/tests/auto/corelib/xml/qxmlstream/qxmlstream.pro +++ b/tests/auto/corelib/xml/qxmlstream/qxmlstream.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qxmlstream QT = core xml network testlib SOURCES = tst_qxmlstream.cpp TESTDATA += data XML-Test-Suite -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp index 341b169113..c87595c3c9 100644 --- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp @@ -119,7 +119,7 @@ static QByteArray makeCanonical(const QString &filename, if (notation.publicId().isEmpty()) { writeDtd << " SYSTEM \'"; writeDtd << notation.systemId().toString(); - writeDtd << "\'"; + writeDtd << '\''; } else { writeDtd << " PUBLIC \'"; writeDtd << notation.publicId().toString(); @@ -127,10 +127,10 @@ static QByteArray makeCanonical(const QString &filename, if (!notation.systemId().isEmpty() ) { writeDtd << " \'"; writeDtd << notation.systemId().toString(); - writeDtd << "\'"; + writeDtd << '\''; } } - writeDtd << ">"; + writeDtd << '>'; writeDtd << endl; } @@ -157,7 +157,7 @@ static QByteArray makeCanonical(const QString &filename, text.indexOf(QLatin1Char(13), p), text.indexOf(QLatin1Char(9), p))) >= 0) { writer.writeCharacters(text.mid(p, i - p)); - writer.writeEntityReference(QString("#%1").arg(text.at(i).unicode())); + writer.writeEntityReference(QLatin1Char('#') + QString::number(text.at(i).unicode())); p = i + 1; } writer.writeCharacters(text.mid(p)); @@ -357,7 +357,7 @@ public: QFile inputFile(inputFilePath); if(!inputFile.open(QIODevice::ReadOnly)) { - failures.append(qMakePair(id, QString::fromLatin1("Failed to open input file %1").arg(inputFilePath))); + failures.append(qMakePair(id, QLatin1String("Failed to open input file ") + inputFilePath)); return true; } @@ -365,8 +365,8 @@ public: { if(isWellformed(&inputFile, ParseSinglePass)) { - failures.append(qMakePair(id, QString::fromLatin1("Failed to flag %1 as not well-formed.") - .arg(inputFilePath))); + failures.append(qMakePair(id, QLatin1String("Failed to flag ") + inputFilePath + + QLatin1String(" as not well-formed."))); /* Exit, the incremental test will fail as well, no need to flood the output. */ return true; @@ -376,8 +376,8 @@ public: if(isWellformed(&inputFile, ParseIncrementally)) { - failures.append(qMakePair(id, QString::fromLatin1("Failed to flag %1 as not well-formed with incremental parsing.") - .arg(inputFilePath))); + failures.append(qMakePair(id, QLatin1String("Failed to flag ") + inputFilePath + + QLatin1String(" as not well-formed with incremental parsing."))); } else successes.append(id); @@ -402,7 +402,7 @@ public: if(!expectedFile.open(QIODevice::ReadOnly)) { - failures.append(qMakePair(id, QString::fromLatin1("Failed to open baseline %1").arg(expectedFilePath))); + failures.append(qMakePair(id, QLatin1String("Failed to open baseline ") + expectedFilePath)); return true; } @@ -665,8 +665,10 @@ void tst_QXmlStream::reportSuccess_data() const const int len = m_handler.successes.count(); - for(int i = 0; i < len; ++i) - QTest::newRow(qPrintable(QString("%1. %2").arg(i).arg(m_handler.successes.at(i)))) << false; + for (int i = 0; i < len; ++i) { + const QByteArray testName = QByteArray::number(i) + ". " + m_handler.successes.at(i).toLatin1(); + QTest::newRow(testName.constData()) << false; + } if(len == 0) QTest::newRow("No test cases succeeded.") << true; @@ -687,7 +689,7 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) while (!reader.atEnd()) { reader.readNext(); - writer << reader.tokenString() << "("; + writer << reader.tokenString() << '('; if (reader.isWhitespace()) writer << " whitespace"; if (reader.isCDATA()) @@ -695,42 +697,42 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) if (reader.isStartDocument() && reader.isStandaloneDocument()) writer << " standalone"; if (!reader.text().isEmpty()) - writer << " text=\"" << reader.text().toString() << "\""; + writer << " text=\"" << reader.text().toString() << '"'; if (!reader.processingInstructionTarget().isEmpty()) - writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << "\""; + writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << '"'; if (!reader.processingInstructionData().isEmpty()) - writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << "\""; + writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << '"'; if (!reader.dtdName().isEmpty()) - writer << " dtdName=\"" << reader.dtdName().toString() << "\""; + writer << " dtdName=\"" << reader.dtdName().toString() << '"'; if (!reader.dtdPublicId().isEmpty()) - writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << "\""; + writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << '"'; if (!reader.dtdSystemId().isEmpty()) - writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << "\""; + writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << '"'; if (!reader.documentVersion().isEmpty()) - writer << " documentVersion=\"" << reader.documentVersion().toString() << "\""; + writer << " documentVersion=\"" << reader.documentVersion().toString() << '"'; if (!reader.documentEncoding().isEmpty()) - writer << " documentEncoding=\"" << reader.documentEncoding().toString() << "\""; + writer << " documentEncoding=\"" << reader.documentEncoding().toString() << '"'; if (!reader.name().isEmpty()) - writer << " name=\"" << reader.name().toString() << "\""; + writer << " name=\"" << reader.name().toString() << '"'; if (!reader.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << reader.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << reader.namespaceUri().toString() << '"'; if (!reader.qualifiedName().isEmpty()) - writer << " qualifiedName=\"" << reader.qualifiedName().toString() << "\""; + writer << " qualifiedName=\"" << reader.qualifiedName().toString() << '"'; if (!reader.prefix().isEmpty()) - writer << " prefix=\"" << reader.prefix().toString() << "\""; + writer << " prefix=\"" << reader.prefix().toString() << '"'; if (reader.attributes().size()) { foreach(QXmlStreamAttribute attribute, reader.attributes()) { writer << endl << " Attribute("; if (!attribute.name().isEmpty()) - writer << " name=\"" << attribute.name().toString() << "\""; + writer << " name=\"" << attribute.name().toString() << '"'; if (!attribute.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << '"'; if (!attribute.qualifiedName().isEmpty()) - writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << "\""; + writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << '"'; if (!attribute.prefix().isEmpty()) - writer << " prefix=\"" << attribute.prefix().toString() << "\""; + writer << " prefix=\"" << attribute.prefix().toString() << '"'; if (!attribute.value().isEmpty()) - writer << " value=\"" << attribute.value().toString() << "\""; + writer << " value=\"" << attribute.value().toString() << '"'; writer << " )" << endl; } } @@ -738,9 +740,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamNamespaceDeclaration namespaceDeclaration, reader.namespaceDeclarations()) { writer << endl << " NamespaceDeclaration("; if (!namespaceDeclaration.prefix().isEmpty()) - writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << "\""; + writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << '"'; if (!namespaceDeclaration.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << '"'; writer << " )" << endl; } } @@ -748,11 +750,11 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamNotationDeclaration notationDeclaration, reader.notationDeclarations()) { writer << endl << " NotationDeclaration("; if (!notationDeclaration.name().isEmpty()) - writer << " name=\"" << notationDeclaration.name().toString() << "\""; + writer << " name=\"" << notationDeclaration.name().toString() << '"'; if (!notationDeclaration.systemId().isEmpty()) - writer << " systemId=\"" << notationDeclaration.systemId().toString() << "\""; + writer << " systemId=\"" << notationDeclaration.systemId().toString() << '"'; if (!notationDeclaration.publicId().isEmpty()) - writer << " publicId=\"" << notationDeclaration.publicId().toString() << "\""; + writer << " publicId=\"" << notationDeclaration.publicId().toString() << '"'; writer << " )" << endl; } } @@ -760,15 +762,15 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamEntityDeclaration entityDeclaration, reader.entityDeclarations()) { writer << endl << " EntityDeclaration("; if (!entityDeclaration.name().isEmpty()) - writer << " name=\"" << entityDeclaration.name().toString() << "\""; + writer << " name=\"" << entityDeclaration.name().toString() << '"'; if (!entityDeclaration.notationName().isEmpty()) - writer << " notationName=\"" << entityDeclaration.notationName().toString() << "\""; + writer << " notationName=\"" << entityDeclaration.notationName().toString() << '"'; if (!entityDeclaration.systemId().isEmpty()) - writer << " systemId=\"" << entityDeclaration.systemId().toString() << "\""; + writer << " systemId=\"" << entityDeclaration.systemId().toString() << '"'; if (!entityDeclaration.publicId().isEmpty()) - writer << " publicId=\"" << entityDeclaration.publicId().toString() << "\""; + writer << " publicId=\"" << entityDeclaration.publicId().toString() << '"'; if (!entityDeclaration.value().isEmpty()) - writer << " value=\"" << entityDeclaration.value().toString() << "\""; + writer << " value=\"" << entityDeclaration.value().toString() << '"'; writer << " )" << endl; } } @@ -877,13 +879,13 @@ void tst_QXmlStream::testFalsePrematureError() const while (!xml.atEnd()) { xml.readNext(); } - QVERIFY(xml.error() == QXmlStreamReader::PrematureEndOfDocumentError); + QCOMPARE(xml.error(), QXmlStreamReader::PrematureEndOfDocumentError); QCOMPARE(xml.errorString(), QLatin1String("Premature end of document.")); xml.addData(legal_start); while (!xml.atEnd()) { xml.readNext(); } - QVERIFY(xml.error() == QXmlStreamReader::PrematureEndOfDocumentError); + QCOMPARE(xml.error(), QXmlStreamReader::PrematureEndOfDocumentError); QCOMPARE(xml.errorString(), QLatin1String("Premature end of document.")); xml.addData(end); while (!xml.atEnd()) { @@ -898,7 +900,7 @@ void tst_QXmlStream::testFalsePrematureError() const } QVERIFY(xml.hasError()); QCOMPARE(xml.errorString(), QLatin1String("Start tag expected.")); - QVERIFY(xml.error() == QXmlStreamReader::NotWellFormedError); + QCOMPARE(xml.error(), QXmlStreamReader::NotWellFormedError); } } @@ -978,7 +980,8 @@ void tst_QXmlStream::writeAttributesWithSpace() const writer.writeEmptyElement("A"); writer.writeAttribute("attribute", QStringLiteral("value") + QChar(QChar::Nbsp)); writer.writeEndDocument(); - QString s = QString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><A attribute=\"value%1\"/>\n").arg(QChar(QChar::Nbsp)); + QString s = QLatin1String("<?xml version=\"1.0\" encoding=\"UTF-8\"?><A attribute=\"value") + + QChar(QChar::Nbsp) + QLatin1String("\"/>\n"); QCOMPARE(buffer.buffer().data(), s.toUtf8().data()); } @@ -1051,11 +1054,11 @@ void tst_QXmlStream::readNextStartElement() const QXmlStreamReader reader(in); QVERIFY(reader.readNextStartElement()); - QVERIFY(reader.isStartElement() && reader.name() == "A"); + QVERIFY(reader.isStartElement() && reader.name() == QLatin1String("A")); int amountOfB = 0; while (reader.readNextStartElement()) { - QVERIFY(reader.isStartElement() && reader.name() == "B"); + QVERIFY(reader.isStartElement() && reader.name() == QLatin1String("B")); ++amountOfB; reader.skipCurrentElement(); } diff --git a/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro index d95fa941f0..c05a575acf 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro +++ b/tests/auto/dbus/qdbusabstractadaptor/qdbusabstractadaptor/qdbusabstractadaptor.pro @@ -5,4 +5,3 @@ TARGET = ../tst_qdbusabstractadaptor DESTDIR = ./ QT = core core-private dbus testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro index ddafd528ee..8f2d261899 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro +++ b/tests/auto/dbus/qdbusabstractadaptor/qmyserver/qmyserver.pro @@ -4,4 +4,3 @@ TARGET = qmyserver DESTDIR = ./ QT = core dbus CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index d26af847cf..7a73dddfe3 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -507,7 +507,7 @@ void tst_QDBusAbstractAdaptor::initTestCase() // get peer server address QDBusMessage req = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "address"); QDBusMessage rpl = QDBusConnection::sessionBus().call(req); - QVERIFY(rpl.type() == QDBusMessage::ReplyMessage); + QCOMPARE(rpl.type(), QDBusMessage::ReplyMessage); QString address = rpl.arguments().at(0).toString(); // connect to peer server @@ -1870,7 +1870,7 @@ void tst_QDBusAbstractAdaptor::methodWithMoreThanOneReturnValue() QDBusInterface remote(con.baseService(), "/", "local.Interface3", con); QDBusMessage reply = remote.call(QDBus::BlockWithGui, "methodStringString", testString); - QVERIFY(reply.arguments().count() == 2); + QCOMPARE(reply.arguments().count(), 2); QDBusReply<int> intreply = reply; QVERIFY(intreply.isValid()); @@ -1892,7 +1892,7 @@ void tst_QDBusAbstractAdaptor::methodWithMoreThanOneReturnValuePeer() QDBusInterface remote(QString(), "/", "local.Interface3", con); QDBusMessage reply = remote.call(QDBus::BlockWithGui, "methodStringString", testString); - QVERIFY(reply.arguments().count() == 2); + QCOMPARE(reply.arguments().count(), 2); QDBusReply<int> intreply = reply; QVERIFY(intreply.isValid()); diff --git a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro index a8cc4c2b38..702c81ff54 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro +++ b/tests/auto/dbus/qdbusabstractinterface/qdbusabstractinterface/qdbusabstractinterface.pro @@ -7,7 +7,6 @@ DESTDIR = ./ QT = core testlib QT += dbus -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 DBUS_INTERFACES = ../org.qtproject.QtDBus.Pinger.xml QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += -i ../interface.h diff --git a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro index 957b47e413..206522b557 100644 --- a/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro +++ b/tests/auto/dbus/qdbusabstractinterface/qpinger/qpinger.pro @@ -5,4 +5,3 @@ DESTDIR = ./ CONFIG -= app_bundle CONFIG += console QT = core dbus -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index cd23f2cb47..2db687e21b 100644 --- a/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -247,7 +247,7 @@ void tst_QDBusAbstractInterface::initTestCase() // get peer server address QDBusMessage req = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "address"); QDBusMessage rpl = con.call(req); - QVERIFY(rpl.type() == QDBusMessage::ReplyMessage); + QCOMPARE(rpl.type(), QDBusMessage::ReplyMessage); peerAddress = rpl.arguments().at(0).toString(); } @@ -283,7 +283,7 @@ void tst_QDBusAbstractInterface::cleanup() targetObj.m_complexProp = RegisteredType(); QDBusMessage resetCall = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "reset"); - QVERIFY(QDBusConnection::sessionBus().call(resetCall).type() == QDBusMessage::ReplyMessage); + QCOMPARE(QDBusConnection::sessionBus().call(resetCall).type(), QDBusMessage::ReplyMessage); } void tst_QDBusAbstractInterface::makeVoidCall() @@ -441,7 +441,7 @@ void tst_QDBusAbstractInterface::makeAsyncStringCallPeer() QVERIFY2(p, "Not connected to D-Bus"); QDBusMessage reply = p->call(QDBus::BlockWithGui, QLatin1String("voidMethod")); - QVERIFY(reply.type() == QDBusMessage::ReplyMessage); + QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); QDBusPendingReply<QString> r = p->stringMethod(); r.waitForFinished(); @@ -622,7 +622,7 @@ void tst_QDBusAbstractInterface::complexPropRead() RegisteredType expectedValue = targetObj.m_complexProp = RegisteredType("This is a test"); QVariant v = p->property("complexProp"); - QVERIFY(v.userType() == qMetaTypeId<RegisteredType>()); + QCOMPARE(v.userType(), qMetaTypeId<RegisteredType>()); QCOMPARE(v.value<RegisteredType>(), targetObj.m_complexProp); } @@ -694,7 +694,7 @@ void tst_QDBusAbstractInterface::complexPropReadPeer() RegisteredType expectedValue = RegisteredType("This is a test"); QVariant v = p->property("complexProp"); - QVERIFY(v.userType() == qMetaTypeId<RegisteredType>()); + QCOMPARE(v.userType(), qMetaTypeId<RegisteredType>()); QCOMPARE(v.value<RegisteredType>(), expectedValue); } @@ -861,8 +861,8 @@ void tst_QDBusAbstractInterface::getVoidSignal() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s.at(0).size() == 0); + QCOMPARE(s.size(), 1); + QCOMPARE(s.at(0).size(), 0); } void tst_QDBusAbstractInterface::getStringSignal_data() @@ -886,8 +886,8 @@ void tst_QDBusAbstractInterface::getStringSignal() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s[0].size() == 1); + QCOMPARE(s.size(), 1); + QCOMPARE(s[0].size(), 1); QCOMPARE(s[0][0].userType(), int(QVariant::String)); QCOMPARE(s[0][0].toString(), expectedValue); } @@ -913,8 +913,8 @@ void tst_QDBusAbstractInterface::getComplexSignal() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s[0].size() == 1); + QCOMPARE(s.size(), 1); + QCOMPARE(s[0].size(), 1); QCOMPARE(s[0][0].userType(), qMetaTypeId<RegisteredType>()); QCOMPARE(s[0][0].value<RegisteredType>(), expectedValue); } @@ -942,8 +942,8 @@ void tst_QDBusAbstractInterface::getVoidSignalPeer() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s.at(0).size() == 0); + QCOMPARE(s.size(), 1); + QCOMPARE(s.at(0).size(), 0); } void tst_QDBusAbstractInterface::getStringSignalPeer_data() @@ -968,8 +968,8 @@ void tst_QDBusAbstractInterface::getStringSignalPeer() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s[0].size() == 1); + QCOMPARE(s.size(), 1); + QCOMPARE(s[0].size(), 1); QCOMPARE(s[0][0].userType(), int(QVariant::String)); QCOMPARE(s[0][0].toString(), expectedValue); } @@ -996,8 +996,8 @@ void tst_QDBusAbstractInterface::getComplexSignalPeer() QTestEventLoop::instance().enterLoop(2); QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(s.size() == 1); - QVERIFY(s[0].size() == 1); + QCOMPARE(s.size(), 1); + QCOMPARE(s[0].size(), 1); QCOMPARE(s[0][0].userType(), qMetaTypeId<RegisteredType>()); QCOMPARE(s[0][0].value<RegisteredType>(), expectedValue); } @@ -1045,7 +1045,7 @@ void tst_QDBusAbstractInterface::followSignal() // now the signal must have been received: QCOMPARE(s.size(), 1); - QVERIFY(s.at(0).size() == 0); + QCOMPARE(s.at(0).size(), 0); // cleanup: con.interface()->unregisterService(serviceToFollow); diff --git a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro index 83ae29de0a..3fcf3e076b 100644 --- a/tests/auto/dbus/qdbusconnection/qdbusconnection.pro +++ b/tests/auto/dbus/qdbusconnection/qdbusconnection.pro @@ -3,4 +3,3 @@ TARGET = tst_qdbusconnection QT = core dbus testlib SOURCES += tst_qdbusconnection.cpp HEADERS += tst_qdbusconnection.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index e91f87d6c8..7cd8c875ec 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -71,7 +71,7 @@ void tst_QDBusConnection::noConnection() QVERIFY(con.callWithCallback(msg, &spy, SLOT(asyncReply)) == 0); QDBusMessage reply = con.call(msg); - QVERIFY(reply.type() == QDBusMessage::ErrorMessage); + QCOMPARE(reply.type(), QDBusMessage::ErrorMessage); QDBusReply<void> voidreply(reply); QVERIFY(!voidreply.isValid()); @@ -877,14 +877,14 @@ void tst_QDBusConnection::callSelfByAnotherName() break; case 1: - QVERIFY(con.interface()->registerService(sname).value() == QDBusConnectionInterface::ServiceRegistered); + QCOMPARE(con.interface()->registerService(sname).value(), QDBusConnectionInterface::ServiceRegistered); break; case 2: { // flag is DBUS_NAME_FLAG_DO_NOT_QUEUE = 0x04 // reply is DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1 QDBusReply<uint> reply = con.interface()->call("RequestName", sname, 4u); - QVERIFY(reply.value() == 1); + QCOMPARE(reply.value(), uint(1)); } } @@ -907,7 +907,7 @@ void tst_QDBusConnection::callSelfByAnotherName() QString(), "test0"); QDBusMessage reply = con.call(msg, QDBus::Block, 1000); - QVERIFY(reply.type() == QDBusMessage::ReplyMessage); + QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); } void tst_QDBusConnection::multipleInterfacesInQObject() @@ -923,7 +923,7 @@ void tst_QDBusConnection::multipleInterfacesInQObject() "local.BaseObject", "anotherMethod"); QDBusMessage reply = con.call(msg, QDBus::Block); QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); - QVERIFY(reply.arguments().count() == 0); + QCOMPARE(reply.arguments().count(), 0); } void tst_QDBusConnection::slotsWithLessParameters() diff --git a/tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro b/tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro index 7b15a4fb81..97d3c0ebf4 100644 --- a/tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro +++ b/tests/auto/dbus/qdbusconnection_no_bus/qdbusconnection_no_bus.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusconnection_no_bus QT = core dbus testlib SOURCES += tst_qdbusconnection_no_bus.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro index a426c4cfd1..42cf425d52 100644 --- a/tests/auto/dbus/qdbuscontext/qdbuscontext.pro +++ b/tests/auto/dbus/qdbuscontext/qdbuscontext.pro @@ -2,5 +2,4 @@ CONFIG += testcase TARGET = tst_qdbuscontext QT = core dbus testlib SOURCES += tst_qdbuscontext.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro b/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro index 170b555ee7..b7dedad133 100644 --- a/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro +++ b/tests/auto/dbus/qdbusinterface/qdbusinterface/qdbusinterface.pro @@ -5,4 +5,3 @@ TARGET = ../tst_qdbusinterface DESTDIR = ./ QT = core core-private dbus testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro index ddafd528ee..8f2d261899 100644 --- a/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro +++ b/tests/auto/dbus/qdbusinterface/qmyserver/qmyserver.pro @@ -4,4 +4,3 @@ TARGET = qmyserver DESTDIR = ./ QT = core dbus CONFIG -= app_bundle -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp index 93d3eacb08..47364e9217 100644 --- a/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp +++ b/tests/auto/dbus/qdbusinterface/tst_qdbusinterface.cpp @@ -283,7 +283,7 @@ void tst_QDBusInterface::initTestCase() // get peer server address QDBusMessage req = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "address"); QDBusMessage rpl = con.call(req); - QVERIFY(rpl.type() == QDBusMessage::ReplyMessage); + QCOMPARE(rpl.type(), QDBusMessage::ReplyMessage); QString address = rpl.arguments().at(0).toString(); // connect to peer server @@ -292,7 +292,7 @@ void tst_QDBusInterface::initTestCase() QDBusMessage req2 = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "waitForConnected"); QDBusMessage rpl2 = con.call(req2); - QVERIFY(rpl2.type() == QDBusMessage::ReplyMessage); + QCOMPARE(rpl2.type(), QDBusMessage::ReplyMessage); QVERIFY2(rpl2.type() == QDBusMessage::ReplyMessage, rpl2.errorMessage().toLatin1()); } @@ -348,7 +348,7 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged() QTestEventLoop::instance().connect(connIface, SIGNAL(serviceOwnerChanged(QString,QString,QString)), SLOT(exitLoop())); - QVERIFY(connIface->registerService("com.example.Test") == QDBusConnectionInterface::ServiceRegistered); + QCOMPARE(connIface->registerService("com.example.Test").value(), QDBusConnectionInterface::ServiceRegistered); QTestEventLoop::instance().enterLoop(5); diff --git a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro index cbe3e89a16..3577210b86 100644 --- a/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro +++ b/tests/auto/dbus/qdbuslocalcalls/qdbuslocalcalls.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbuslocalcalls QT = core dbus testlib SOURCES += tst_qdbuslocalcalls.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro index b0656231d2..b0442a0ee4 100644 --- a/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro +++ b/tests/auto/dbus/qdbusmarshall/qdbusmarshall/qdbusmarshall.pro @@ -12,4 +12,3 @@ contains(QT_CONFIG, dbus-linked) { } else { SOURCES += ../../../../../src/dbus/qdbus_symbols.cpp } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro b/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro index a4c5efba85..57f8b2a598 100644 --- a/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro +++ b/tests/auto/dbus/qdbusmarshall/qpong/qpong.pro @@ -5,4 +5,3 @@ QT = core dbus CONFIG -= app_bundle CONFIG += console -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro index c0b38cf478..12f801613d 100644 --- a/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro +++ b/tests/auto/dbus/qdbusmetaobject/qdbusmetaobject.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusmetaobject QT = core dbus-private testlib SOURCES += tst_qdbusmetaobject.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro index aef9bc73cb..38d7370667 100644 --- a/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro +++ b/tests/auto/dbus/qdbusmetatype/qdbusmetatype.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusmetatype QT = core dbus testlib SOURCES += tst_qdbusmetatype.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro index 7b5f867798..ddfe3008a5 100644 --- a/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro +++ b/tests/auto/dbus/qdbuspendingcall/qdbuspendingcall.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbuspendingcall QT = core dbus testlib SOURCES += tst_qdbuspendingcall.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp index cc12ef8bcc..8cb9aa70e9 100644 --- a/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp +++ b/tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp @@ -178,7 +178,7 @@ void tst_QDBusPendingCall::waitForFinished() QVERIFY(!ac.isError()); const QDBusMessage reply = ac.reply(); - QVERIFY(reply.type() == QDBusMessage::ReplyMessage); + QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); QCOMPARE(reply.signature(), QString("as")); const QVariantList args = ac.reply().arguments(); @@ -334,7 +334,7 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded() QDBusPendingCall ac = tst->sendMessage(); // QVERIFY(!ac.isFinished()); // QVERIFY(!ac.isError()); -// QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); +// QCOMPARE(ac.reply().type(), QDBusMessage::InvalidMessage); QDBusPendingCallWatcher watch(ac); tst->connect(&watch, SIGNAL(finished(QDBusPendingCallWatcher*)), @@ -344,7 +344,7 @@ void tst_QDBusPendingCall::watcher_waitForFinished_threaded() // QVERIFY(!ac.isFinished()); // QVERIFY(!ac.isError()); -// QVERIFY(ac.reply().type() == QDBusMessage::InvalidMessage); +// QCOMPARE(ac.reply().type(), QDBusMessage::InvalidMessage); QCOMPARE(tst->callCount, 0); QCOMPARE(tst->slotCalled, 0); diff --git a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro index d6b9e71084..814e40decc 100644 --- a/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro +++ b/tests/auto/dbus/qdbuspendingreply/qdbuspendingreply.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbuspendingreply QT = core dbus testlib SOURCES += tst_qdbuspendingreply.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusreply/qdbusreply.pro b/tests/auto/dbus/qdbusreply/qdbusreply.pro index 0ffb35e461..42e9e6dddc 100644 --- a/tests/auto/dbus/qdbusreply/qdbusreply.pro +++ b/tests/auto/dbus/qdbusreply/qdbusreply.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusreply QT = core dbus testlib SOURCES += tst_qdbusreply.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro index 82a0f3bb7e..e689a5cfa3 100644 --- a/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro +++ b/tests/auto/dbus/qdbusservicewatcher/qdbusservicewatcher.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusservicewatcher QT = core dbus testlib SOURCES += tst_qdbusservicewatcher.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro index e50804336b..95358b2003 100644 --- a/tests/auto/dbus/qdbusthreading/qdbusthreading.pro +++ b/tests/auto/dbus/qdbusthreading/qdbusthreading.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusthreading QT = core dbus testlib SOURCES += tst_qdbusthreading.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbustype/qdbustype.pro b/tests/auto/dbus/qdbustype/qdbustype.pro index 21df33d2c7..1b3e0f8008 100644 --- a/tests/auto/dbus/qdbustype/qdbustype.pro +++ b/tests/auto/dbus/qdbustype/qdbustype.pro @@ -9,4 +9,3 @@ contains(QT_CONFIG, dbus-linked) { } else { SOURCES += ../../../../src/dbus/qdbus_symbols.cpp } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp index 4408729e7c..5634bc20f8 100644 --- a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp +++ b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp @@ -260,11 +260,11 @@ void tst_QDBusType::isValidArray() QFETCH(QString, data); QFETCH(bool, result); - data.prepend("a"); + data.prepend(QLatin1Char('a')); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); - data.prepend("a"); + data.prepend(QLatin1Char('a')); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); } diff --git a/tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro b/tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro index a7186c341b..3e47b00814 100644 --- a/tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro +++ b/tests/auto/dbus/qdbusxmlparser/qdbusxmlparser.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qdbusxmlparser QT = core-private dbus-private xml testlib SOURCES += tst_qdbusxmlparser.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro index 7ed69ce1d1..485472c70c 100644 --- a/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/gui/image/qicoimageformat/qicoimageformat.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qicoimageformat SOURCES+= tst_qicoimageformat.cpp QT += testlib diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index bff762fd04..ffe3dcfb75 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -141,7 +141,7 @@ void tst_QIcoImageFormat::canRead() QFETCH(QString, fileName); QFETCH(int, isValid); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.canRead(), (isValid == 0 ? false : true)); } @@ -175,7 +175,7 @@ void tst_QIcoImageFormat::SequentialFile() QFETCH(QString, fileName); QFETCH(int, isValid); - QSequentialFile *file = new QSequentialFile(m_IconPath + "/" + fileName); + QSequentialFile *file = new QSequentialFile(m_IconPath + QLatin1Char('/') + fileName); QVERIFY(file); QVERIFY(file->open(QFile::ReadOnly)); QImageReader reader(file); @@ -212,7 +212,7 @@ void tst_QIcoImageFormat::imageCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.imageCount(), count); } @@ -240,7 +240,7 @@ void tst_QIcoImageFormat::jumpToNextImage() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); bool bJumped = reader.jumpToImage(0); while (bJumped) { count--; @@ -263,7 +263,7 @@ void tst_QIcoImageFormat::loopCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.loopCount(), count); } @@ -291,7 +291,7 @@ void tst_QIcoImageFormat::nextImageDelay() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); if (count == -1) { QCOMPARE(reader.nextImageDelay(), 0); } else { @@ -320,7 +320,7 @@ void tst_QIcoImageFormat::pngCompression() QFETCH(int, width); QFETCH(int, height); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QImage image; reader.jumpToImage(index); diff --git a/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache b/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache Binary files differnew file mode 100644 index 0000000000..a323875989 --- /dev/null +++ b/tests/auto/gui/image/qicon/icons/themeparent/icon-theme.cache diff --git a/tests/auto/gui/image/qicon/qicon.pro b/tests/auto/gui/image/qicon/qicon.pro index 6ff20ec8fa..f5570c2497 100644 --- a/tests/auto/gui/image/qicon/qicon.pro +++ b/tests/auto/gui/image/qicon/qicon.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qicon QT += testlib diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 7333dd739f..329c3ae66d 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -64,6 +64,7 @@ private slots: void streamAvailableSizes_data(); void streamAvailableSizes(); void fromTheme(); + void fromThemeCache(); #ifndef QT_NO_WIDGETS void task184901_badCache(); @@ -648,6 +649,69 @@ void tst_QIcon::fromTheme() QVERIFY(abIcon.isNull()); } +void tst_QIcon::fromThemeCache() +{ + QTemporaryDir dir; + QVERIFY(QDir().mkpath(dir.path() + QLatin1String("/testcache/16x16/actions"))); + QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-open-16.png")) + .copy( dir.path() + QLatin1String("/testcache/16x16/actions/button-open.png"))); + + { + QFile index(dir.path() + QLatin1String("/testcache/index.theme")); + QVERIFY(index.open(QFile::WriteOnly)); + index.write("[Icon Theme]\nDirectories=16x16/actions\n[16x16/actions]\nSize=16\nContext=Actions\nType=Fixed\n"); + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); + QIcon::setThemeName("testcache"); + + // We just created a theme with that icon, it must exist + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + QString cacheName = dir.path() + QLatin1String("/testcache/icon-theme.cache"); + + // An invalid cache should not prevent lookup + { + QFile cacheFile(cacheName); + QVERIFY(cacheFile.open(QFile::WriteOnly)); + QDataStream(&cacheFile) << quint16(1) << quint16(0) << "invalid corrupted stuff in there\n"; + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + // An empty cache should prevent the lookup + { + QFile cacheFile(cacheName); + QVERIFY(cacheFile.open(QFile::WriteOnly)); + QDataStream ds(&cacheFile); + ds << quint16(1) << quint16(0); // 0: version + ds << quint32(12) << quint32(20); // 4: hash offset / dir list offset + ds << quint32(1) << quint32(0xffffffff); // 12: one empty bucket + ds << quint32(1) << quint32(28); // 20: list with one element + ds.writeRawData("16x16/actions", sizeof("16x16/actions")); // 28 + } + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(QIcon::fromTheme("button-open").isNull()); // The icon was not in the cache, it should not be found + + // Adding an icon should be changing the modification date of one sub directory which should make the cache ignored + QTest::qWait(1000); // wait enough to have a different modification time in seconds + QVERIFY(QFile(QStringLiteral(":/styles/commonstyle/images/standardbutton-save-16.png")) + .copy(dir.path() + QLatin1String("/testcache/16x16/actions/button-save.png"))); + QVERIFY(QFileInfo(cacheName).lastModified() < QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified()); + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + + // Try to run the actual gtk-update-icon-cache and make sure that icons are still found + QProcess process; + process.start(QStringLiteral("gtk-update-icon-cache"), + QStringList() << QStringLiteral("-f") << QStringLiteral("-t") << (dir.path() + QLatin1String("/testcache"))); + if (!process.waitForFinished()) + QSKIP("gtk-update-icon-cache not run"); + QVERIFY(QFileInfo(cacheName).lastModified() >= QFileInfo(dir.path() + QLatin1String("/testcache/16x16/actions")).lastModified()); + QIcon::setThemeSearchPaths(QStringList() << dir.path()); // reload themes + QVERIFY(!QIcon::fromTheme("button-open").isNull()); + QVERIFY(!QIcon::fromTheme("button-open-fallback").isNull()); + QVERIFY(QIcon::fromTheme("notexist-fallback").isNull()); +} void tst_QIcon::task223279_inconsistentAddFile() { diff --git a/tests/auto/gui/image/qicon/tst_qicon.qrc b/tests/auto/gui/image/qicon/tst_qicon.qrc index 1505ca925b..3c8fbba7c2 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.qrc +++ b/tests/auto/gui/image/qicon/tst_qicon.qrc @@ -15,6 +15,7 @@ <file>./icons/themeparent/32x32/actions/address-book-new.png</file> <file>./icons/themeparent/32x32/actions/appointment-new.png</file> <file>./icons/themeparent/index.theme</file> +<file>./icons/themeparent/icon-theme.cache</file> <file>./icons/themeparent/scalable/actions/address-book-new.svg</file> <file>./icons/themeparent/scalable/actions/appointment-new.svg</file> <file>./styles/commonstyle/images/standardbutton-open-16.png</file> diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index 42280d3bd4..d32e84c0d7 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qimage SOURCES += tst_qimage.cpp diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 23ddfbdd58..26b812715d 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -972,13 +972,17 @@ void tst_QImage::createAlphaMask_data() int alphas[] = { 0, 127, 255 }; for (unsigned a1 = 0; a1 < sizeof(alphas) / sizeof(int); ++a1) { + const QByteArray a1B = QByteArray::number(alphas[a1]); for (unsigned a2 = 0; a2 < sizeof(alphas) / sizeof(int); ++a2) { if (a1 == a2) continue; + const QByteArray a2B = QByteArray::number(alphas[a2]); for (int x=10; x<18; x+=3) { + const QByteArray xB = QByteArray::number(x); for (int y=100; y<108; y+=3) { - QTest::newRow(qPrintable(QString::fromLatin1("x=%1, y=%2, a1=%3, a2=%4").arg(x).arg(y).arg(alphas[a1]).arg(alphas[a2]))) - << x << y << alphas[a1] << alphas[a2]; + const QByteArray testName = "x=" + xB + ", y=" + QByteArray::number(y) + + ", a1=" + a1B + ", a2=" + a2B; + QTest::newRow(testName.constData()) << x << y << alphas[a1] << alphas[a2]; } } } @@ -1075,34 +1079,34 @@ void tst_QImage::rotate_data() degrees << 0 << 90 << 180 << 270; foreach (int d, degrees) { - QString title = QString("%1 %2").arg(d); - QTest::newRow(qPrintable(title.arg("Format_RGB32"))) + const QByteArray dB = QByteArray::number(d); + QTest::newRow((dB + " Format_RGB32").constData()) << QImage::Format_RGB32 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB32"))) + QTest::newRow((dB + " Format_ARGB32").constData()) << QImage::Format_ARGB32 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB32_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB32_Premultiplied").constData()) << QImage::Format_ARGB32_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB16"))) + QTest::newRow((dB + " Format_RGB16").constData()) << QImage::Format_RGB16 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB8565_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB8565_Premultiplied").constData()) << QImage::Format_ARGB8565_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB666"))) + QTest::newRow((dB + " Format_RGB666").constData()) << QImage::Format_RGB666 << d; - QTest::newRow(qPrintable(title.arg("Format_RGB555"))) + QTest::newRow((dB + " Format_RGB555").constData()) << QImage::Format_RGB555 << d; - QTest::newRow(qPrintable(title.arg("Format_ARGB8555_Premultiplied"))) + QTest::newRow((dB + " Format_ARGB8555_Premultiplied").constData()) << QImage::Format_ARGB8555_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_RGB888"))) + QTest::newRow((dB + " Format_RGB888").constData()) << QImage::Format_RGB888 << d; - QTest::newRow(qPrintable(title.arg("Format_Indexed8"))) + QTest::newRow((dB + " Format_Indexed8").constData()) << QImage::Format_Indexed8 << d; - QTest::newRow(qPrintable(title.arg("Format_RGBX8888"))) + QTest::newRow((dB + " Format_RGBX8888").constData()) << QImage::Format_RGBX8888 << d; - QTest::newRow(qPrintable(title.arg("Format_RGBA8888_Premultiplied"))) + QTest::newRow((dB + " Format_RGBA8888_Premultiplied").constData()) << QImage::Format_RGBA8888_Premultiplied << d; - QTest::newRow(qPrintable(title.arg("Format_Alpha8"))) + QTest::newRow((dB + " Format_Alpha8").constData()) << QImage::Format_Alpha8 << d; - QTest::newRow(qPrintable(title.arg("Format_Grayscale8"))) + QTest::newRow((dB + " Format_Grayscale8").constData()) << QImage::Format_Grayscale8 << d; } } @@ -1626,9 +1630,11 @@ void tst_QImage::smoothScale2_data() int sizes[] = { 2, 3, 4, 6, 7, 8, 10, 16, 20, 32, 40, 64, 100, 101, 128, 0 }; QImage::Format formats[] = { QImage::Format_RGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_Invalid }; for (int j = 0; formats[j] != QImage::Format_Invalid; ++j) { - QString formatstr = formats[j] == QImage::Format_RGB32 ? QStringLiteral("rgb32") : QStringLiteral("argb32pm"); + QByteArray formatstr = formats[j] == QImage::Format_RGB32 ? QByteArrayLiteral("rgb32") : QByteArrayLiteral("argb32pm"); for (int i = 0; sizes[i] != 0; ++i) { - QTest::newRow(QString("%1 %2x%2").arg(formatstr).arg(sizes[i]).toUtf8()) << (int)formats[j] << sizes[i]; + const QByteArray sizeB = QByteArray::number(sizes[i]); + QTest::newRow((formatstr + ' ' + sizeB + 'x' + sizeB).constData()) + << (int)formats[j] << sizes[i]; } } } @@ -2600,10 +2606,11 @@ void tst_QImage::genericRgbConversion_data() QTest::addColumn<QImage::Format>("dest_format"); for (int i = QImage::Format_RGB32; i < QImage::Format_Alpha8; ++i) { + const QString formatI = formatToString(QImage::Format(i)); for (int j = QImage::Format_RGB32; j < QImage::Format_Alpha8; ++j) { if (i == j) continue; - QString test = QString::fromLatin1("%1 -> %2").arg(formatToString(QImage::Format(i))).arg(formatToString(QImage::Format(j))); + const QString test = formatI + QLatin1String(" -> ") + formatToString(QImage::Format(j)); QTest::newRow(qPrintable(test)) << QImage::Format(i) << QImage::Format(j); } } diff --git a/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro b/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro index bbcf8d23c9..428ff62959 100644 --- a/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro +++ b/tests/auto/gui/image/qimageiohandler/qimageiohandler.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qimageiohandler QT += testlib diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 86dd8c4daf..68b92e1851 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -174,7 +174,7 @@ private: // helper to skip an autotest when the given image format is not supported #define SKIP_IF_UNSUPPORTED(format) do { \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ - QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) // Testing get/set functions @@ -802,7 +802,7 @@ void tst_QImageReader::animatedGif() QVERIFY(!image.isNull()); int i = 0; while(!image.isNull()){ - QString frameName = QString(":images/qt%1.gif").arg(++i); + QString frameName = QLatin1String(":images/qt") + QString::number(++i) + QLatin1String(".gif"); QCOMPARE(image, QImage(frameName)); image = io.read(); } @@ -1653,14 +1653,14 @@ void tst_QImageReader::pixelCompareWithBaseline() // least one file succeeded we know that the plugin was built. // The other failures are then real failures. QImage icoImg; - const QString inputFileName(QString::fromLatin1("images/%1").arg(fileName)); + const QString inputFileName(QLatin1String("images/") + fileName); QFileInfo fi(inputFileName); ++enteredCount; // might fail if the plugin does not exist, which is ok. if (icoImg.load(inputFileName)) { icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied); - const QString baselineFileName(QString::fromLatin1("baseline/%1.png").arg(fi.baseName())); + const QString baselineFileName(QLatin1String("baseline/") + fi.baseName() + QLatin1String(".png")); #if 0 icoImg.save(baselineFileName); #else diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 1dd4d69ea8..c49c9c9129 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -97,7 +97,7 @@ private: // helper to skip an autotest when the given image format is not supported #define SKIP_IF_UNSUPPORTED(format) do { \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ - QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) static void initializePadding(QImage *image) @@ -269,8 +269,8 @@ void tst_QImageWriter::writeImage2_data() QImage image = image0.convertToFormat(imgFormat); initializePadding(&image); foreach (const QString format, formats) { - const QString fileName = QString("solidcolor_%1.%2").arg(imgFormat) - .arg(format); + const QString fileName = QLatin1String("solidcolor_") + + QString::number(imgFormat) + QLatin1Char('.') + format; QTest::newRow(fileName.toLatin1()) << fileName << format.toLatin1() << image; diff --git a/tests/auto/gui/image/qmovie/qmovie.pro b/tests/auto/gui/image/qmovie/qmovie.pro index 4e7030b1f7..a04ad73b80 100644 --- a/tests/auto/gui/image/qmovie/qmovie.pro +++ b/tests/auto/gui/image/qmovie/qmovie.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmovie QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/image/qpicture/qpicture.pro b/tests/auto/gui/image/qpicture/qpicture.pro index a24b8ec481..0fc851ce11 100644 --- a/tests/auto/gui/image/qpicture/qpicture.pro +++ b/tests/auto/gui/image/qpicture/qpicture.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpicture QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index 67d7e57fd4..b4252031e6 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -445,7 +445,8 @@ void tst_QPixmap::scroll() else QVERIFY(pixmap.cacheKey() != oldKey); - QString fileName = QString(":/images/%1.png").arg(QTest::currentDataTag()); + const QString fileName = QLatin1String(":/images/") + QLatin1String(QTest::currentDataTag()) + + QLatin1String(".png"); QPixmap output(fileName); QCOMPARE(input.isNull(), output.isNull()); QVERIFY(lenientCompare(pixmap, output)); @@ -458,7 +459,7 @@ void tst_QPixmap::fill_data() QTest::addColumn<bool>("syscolor"); QTest::addColumn<bool>("bitmap"); for (int color = Qt::black; color < Qt::darkYellow; ++color) - QTest::newRow(QString("syscolor_%1").arg(color).toLatin1()) + QTest::newRow(("syscolor_" + QByteArray::number(color)).constData()) << uint(color) << true << false; #if defined (Q_OS_WINCE) @@ -1000,7 +1001,9 @@ void tst_QPixmap::toWinHICON() HBITMAP bitmap = qt_pixmapToWinHBITMAP(empty, Alpha); SelectObject(bitmap_dc, bitmap); - QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height)); + const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x') + + QString::number(height) + QLatin1String(".png"); + QImage imageFromFile(fileName); imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied); HICON icon = qt_pixmapToWinHICON(QPixmap::fromImage(imageFromFile)); @@ -1036,7 +1039,9 @@ void tst_QPixmap::fromWinHICON() QImage imageFromHICON = qt_pixmapFromWinHICON(icon).toImage(); DestroyIcon(icon); - QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height)); + const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x') + + QString::number(height) + QLatin1String(".png"); + QImage imageFromFile(fileName); imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied); // fuzzy comparison must be used, as the pixel values change slightly during conversion diff --git a/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro b/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro index a81712ba23..fe3b5a2db3 100644 --- a/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro +++ b/tests/auto/gui/image/qpixmapcache/qpixmapcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpixmapcache QT += gui-private testlib SOURCES += tst_qpixmapcache.cpp diff --git a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp index a3cf66da18..d1f76e8742 100644 --- a/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/gui/image/qpixmapcache/tst_qpixmapcache.cpp @@ -147,7 +147,7 @@ void tst_QPixmapCache::setCacheLimit() QVERIFY(QPixmapCache::find(key, p1) == 0); QPixmapCache::setCacheLimit(1000); key = QPixmapCache::insert(*p1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QCOMPARE(getPrivate(key)->key, 1); delete p1; @@ -189,7 +189,7 @@ void tst_QPixmapCache::setCacheLimit() key2 = QPixmapCache::insert(*p1); QCOMPARE(getPrivate(key2)->key, 1); //This old key is not valid anymore after the flush - QCOMPARE(getPrivate(key)->isValid, false); + QVERIFY(!key.isValid()); QVERIFY(QPixmapCache::find(key, &p2) == 0); delete p1; } @@ -233,7 +233,7 @@ void tst_QPixmapCache::find() //at that time the first key has been erase because no more place in the cache QVERIFY(QPixmapCache::find(key, &p1) == 0); - QCOMPARE(getPrivate(key)->isValid, false); + QVERIFY(!key.isValid()); } void tst_QPixmapCache::insert() @@ -313,7 +313,7 @@ void tst_QPixmapCache::replace() p2.fill(Qt::yellow); QPixmapCache::Key key = QPixmapCache::insert(p1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QPixmap p3; QVERIFY(QPixmapCache::find(key, &p3) == 1); @@ -321,7 +321,7 @@ void tst_QPixmapCache::replace() QPixmapCache::replace(key, p2); QVERIFY(QPixmapCache::find(key, &p3) == 1); - QCOMPARE(getPrivate(key)->isValid, true); + QVERIFY(key.isValid()); QCOMPARE(getPrivate(key)->key, 1); QCOMPARE(p3.width(), 10); @@ -438,7 +438,7 @@ void tst_QPixmapCache::clear() for (int k = 0; k < numberOfKeys; ++k) { QVERIFY(QPixmapCache::find(keys.at(k), &p1) == 0); - QCOMPARE(getPrivate(keys[k])->isValid, false); + QVERIFY(!keys[k].isValid()); } } diff --git a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro index b85d475e97..50426612dc 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro +++ b/tests/auto/gui/itemmodels/qstandarditem/qstandarditem.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstandarditem QT += testlib SOURCES += tst_qstandarditem.cpp diff --git a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp index ff263c166a..06f7793ace 100644 --- a/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp +++ b/tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem.cpp @@ -140,7 +140,8 @@ void tst_QStandardItem::getSetData() QStandardItem item; for (int x = 0; x < 2; ++x) { for (int i = 1; i <= 2; ++i) { - QString text = QString("text %0").arg(i); + const QString iS = QString::number(i); + QString text = QLatin1String("text ") + iS; item.setText(text); QCOMPARE(item.text(), text); @@ -150,15 +151,15 @@ void tst_QStandardItem::getSetData() item.setIcon(icon); QCOMPARE(item.icon(), icon); - QString toolTip = QString("toolTip %0").arg(i); + QString toolTip = QLatin1String("toolTip ") + iS; item.setToolTip(toolTip); QCOMPARE(item.toolTip(), toolTip); - QString statusTip = QString("statusTip %0").arg(i); + QString statusTip = QLatin1String("statusTip ") + iS; item.setStatusTip(statusTip); QCOMPARE(item.statusTip(), statusTip); - QString whatsThis = QString("whatsThis %0").arg(i); + QString whatsThis = QLatin1String("whatsThis ") + iS; item.setWhatsThis(whatsThis); QCOMPARE(item.whatsThis(), whatsThis); @@ -188,11 +189,11 @@ void tst_QStandardItem::getSetData() item.setCheckState(checkState); QCOMPARE(item.checkState(), checkState); - QString accessibleText = QString("accessibleText %0").arg(i); + QString accessibleText = QLatin1String("accessibleText ") + iS; item.setAccessibleText(accessibleText); QCOMPARE(item.accessibleText(), accessibleText); - QString accessibleDescription = QString("accessibleDescription %0").arg(i); + QString accessibleDescription = QLatin1String("accessibleDescription ") + iS; item.setAccessibleDescription(accessibleDescription); QCOMPARE(item.accessibleDescription(), accessibleDescription); diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/qstandarditemmodel.pro b/tests/auto/gui/itemmodels/qstandarditemmodel/qstandarditemmodel.pro index 71ef4acb88..eef165d9f7 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/qstandarditemmodel.pro +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/qstandarditemmodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstandarditemmodel QT += widgets widgets-private testlib diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index ae47b2053b..7fc234670d 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -256,7 +256,7 @@ void tst_QStandardItemModel::insertRow() QCOMPARE(rcLast[RowsInserted], expectedRow); //check that the inserted item has different DisplayRole than initial items - QVERIFY(m_model->data(m_model->index(expectedRow, 0), Qt::DisplayRole).toString() != "initialitem"); + QVERIFY(m_model->data(m_model->index(expectedRow, 0), Qt::DisplayRole).toString() != QLatin1String("initialitem")); } else { // We inserted something outside the bounds, do nothing QCOMPARE(m_model->rowCount(), defaultSize); @@ -300,7 +300,7 @@ void tst_QStandardItemModel::insertRowsItems() QStandardItemModel *m = qobject_cast<QStandardItemModel*>(m_model); QStandardItem *hiddenRoot = m->invisibleRootItem(); for (int i = 0; i < 3; ++i) - items.append(new QStandardItem(QString("%1").arg(i + 10))); + items.append(new QStandardItem(QString::number(i + 10))); hiddenRoot->appendRows(items); QCOMPARE(m_model->rowCount(), rowCount + 3); QCOMPARE(m_model->index(rowCount + 0, 0).data().toInt(), 10); @@ -365,7 +365,7 @@ void tst_QStandardItemModel::insertColumn() QCOMPARE(rcLast[ColumnsInserted], expectedColumn); //check that the inserted item has different DisplayRole than initial items - QVERIFY(m_model->data(m_model->index(0, expectedColumn), Qt::DisplayRole).toString() != "initialitem"); + QVERIFY(m_model->data(m_model->index(0, expectedColumn), Qt::DisplayRole).toString() != QLatin1String("initialitem")); } else { // We inserted something outside the bounds, do nothing QCOMPARE(m_model->columnCount(), defaultSize); @@ -729,8 +729,8 @@ void tst_QStandardItemModel::data() } } - QVERIFY(m_model->data(m_model->index(0, 0), Qt::DisplayRole).toString() == "initialitem"); - QVERIFY(m_model->data(m_model->index(0, 0), Qt::ToolTipRole).toString() == "tooltip"); + QCOMPARE(m_model->data(m_model->index(0, 0), Qt::DisplayRole).toString(), QLatin1String("initialitem")); + QCOMPARE(m_model->data(m_model->index(0, 0), Qt::ToolTipRole).toString(), QLatin1String("tooltip")); } @@ -874,7 +874,7 @@ void tst_QStandardItemModel::sort_data() << "zulu"); QStringList list; for (int i=1000; i < 2000; ++i) - list.append(QString("Number: %1").arg(i)); + list.append(QStringLiteral("Number: ") + QString::number(i)); QTest::newRow("large set ascending") << static_cast<int>(Qt::AscendingOrder) << list << list; } @@ -1336,7 +1336,7 @@ void tst_QStandardItemModel::useCase3() // create the tree structure first QStandardItem *childItem = 0; for (int i = 0; i < 100; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item = new QStandardItem(QStringLiteral("item ") + QString::number(i)); if (childItem) item->appendRow(childItem); childItem = item; @@ -1466,55 +1466,48 @@ struct FriendlyTreeView : public QTreeView #endif #ifdef QT_BUILD_INTERNAL -void tst_QStandardItemModel::treeDragAndDrop() -{ - const int nRow = 5; - const int nCol = 3; - - QStandardItemModel model; - QStandardItemModel checkModel; +static void populateDragAndDropModel(QStandardItemModel &model, int nRow, int nCol) +{ + const QString item = QStringLiteral("item "); + const QString dash = QStringLiteral(" - "); for (int i = 0; i < nRow; ++i) { + const QString iS = QString::number(i); QList<QStandardItem *> colItems1; for (int c = 0 ; c < nCol; c ++) - colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i)); + colItems1 << new QStandardItem(item + iS + dash + QString::number(c)); model.appendRow(colItems1); for (int j = 0; j < nRow; ++j) { + const QString jS = QString::number(j); QList<QStandardItem *> colItems2; for (int c = 0 ; c < nCol; c ++) - colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j)); + colItems2 << new QStandardItem(item + iS + QLatin1Char('/') + jS + dash + QString::number(c)); colItems1.at(0)->appendRow(colItems2); for (int k = 0; k < nRow; ++k) { QList<QStandardItem *> colItems3; + const QString kS = QString::number(k); for (int c = 0 ; c < nCol; c ++) - colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k)); + colItems3 << new QStandardItem(item + iS + QLatin1Char('/') + jS + + QLatin1Char('/') + kS + + dash + QString::number(c)); colItems2.at(0)->appendRow(colItems3); } } } +} - for (int i = 0; i < nRow; ++i) { - QList<QStandardItem *> colItems1; - for (int c = 0 ; c < nCol; c ++) - colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i)); - checkModel.appendRow(colItems1); +void tst_QStandardItemModel::treeDragAndDrop() +{ + const int nRow = 5; + const int nCol = 3; - for (int j = 0; j < nRow; ++j) { - QList<QStandardItem *> colItems2; - for (int c = 0 ; c < nCol; c ++) - colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j)); - colItems1.at(0)->appendRow(colItems2); + QStandardItemModel model; + QStandardItemModel checkModel; - for (int k = 0; k < nRow; ++k) { - QList<QStandardItem *> colItems3; - for (int c = 0 ; c < nCol; c ++) - colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k)); - colItems2.at(0)->appendRow(colItems3); - } - } - } + populateDragAndDropModel(model, nRow, nCol); + populateDragAndDropModel(checkModel, nRow, nCol); QVERIFY(compareModels(&model, &checkModel)); @@ -1613,14 +1606,14 @@ void tst_QStandardItemModel::removeRowsAndColumns() #define VERIFY_MODEL \ for (int c = 0; c < col_list.count(); c++) \ for (int r = 0; r < row_list.count(); r++) \ - QCOMPARE(model.item(r,c)->text() , row_list[r] + "x" + col_list[c]); + QCOMPARE(model.item(r,c)->text() , row_list[r] + QLatin1Char('x') + col_list[c]); QVector<QString> row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector(); QVector<QString> col_list = row_list; QStandardItemModel model; for (int c = 0; c < col_list.count(); c++) for (int r = 0; r < row_list.count(); r++) - model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); + model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL row_list.remove(3); @@ -1642,14 +1635,14 @@ void tst_QStandardItemModel::removeRowsAndColumns() QList<QStandardItem *> row_taken = model.takeRow(6); QCOMPARE(row_taken.count(), col_list.count()); for (int c = 0; c < col_list.count(); c++) - QCOMPARE(row_taken[c]->text() , row_list[6] + "x" + col_list[c]); + QCOMPARE(row_taken[c]->text() , row_list[6] + QLatin1Char('x') + col_list[c]); row_list.remove(6); VERIFY_MODEL QList<QStandardItem *> col_taken = model.takeColumn(10); QCOMPARE(col_taken.count(), row_list.count()); for (int r = 0; r < row_list.count(); r++) - QCOMPARE(col_taken[r]->text() , row_list[r] + "x" + col_list[10]); + QCOMPARE(col_taken[r]->text() , row_list[r] + QLatin1Char('x') + col_list[10]); col_list.remove(10); VERIFY_MODEL } @@ -1661,7 +1654,7 @@ void tst_QStandardItemModel::itemRoleNames() QStandardItemModel model; for (int c = 0; c < col_list.count(); c++) for (int r = 0; r < row_list.count(); r++) - model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); + model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL QHash<int, QByteArray> newRoleNames; diff --git a/tests/auto/gui/kernel/qdrag/qdrag.pro b/tests/auto/gui/kernel/qdrag/qdrag.pro index d4a7bc2705..ac3fde8028 100644 --- a/tests/auto/gui/kernel/qdrag/qdrag.pro +++ b/tests/auto/gui/kernel/qdrag/qdrag.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdrag QT += testlib SOURCES += tst_qdrag.cpp diff --git a/tests/auto/gui/kernel/qevent/qevent.pro b/tests/auto/gui/kernel/qevent/qevent.pro index 09d4395f4d..2959089ce3 100644 --- a/tests/auto/gui/kernel/qevent/qevent.pro +++ b/tests/auto/gui/kernel/qevent/qevent.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qevent SOURCES += tst_qevent.cpp QT = core testlib -CONFIG += parallel_test diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index d18f9664fc..ea8f594f9c 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -63,6 +63,7 @@ private slots: void initTestCase(); void cleanup(); void displayName(); + void desktopFileName(); void firstWindowTitle(); void windowIcon(); void focusObject(); @@ -117,6 +118,21 @@ void tst_QGuiApplication::displayName() QCOMPARE(QGuiApplication::applicationDisplayName(), QString::fromLatin1("The GUI Application")); } +void tst_QGuiApplication::desktopFileName() +{ + int argc = 1; + char *argv[] = { const_cast<char*>("tst_qguiapplication") }; + QGuiApplication app(argc, argv); + + QCOMPARE(QGuiApplication::desktopFileName(), QString()); + + QGuiApplication::setDesktopFileName("io.qt.QGuiApplication.desktop"); + QCOMPARE(QGuiApplication::desktopFileName(), QString::fromLatin1("io.qt.QGuiApplication.desktop")); + + QGuiApplication::setDesktopFileName(QString()); + QCOMPARE(QGuiApplication::desktopFileName(), QString()); +} + void tst_QGuiApplication::firstWindowTitle() { int argc = 3; diff --git a/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro b/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro index 914142404b..331295bab9 100644 --- a/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro +++ b/tests/auto/gui/kernel/qguimetatype/qguimetatype.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qguimetatype SOURCES += tst_qguimetatype.cpp QT = core gui testlib -CONFIG += parallel_test diff --git a/tests/auto/gui/kernel/qguitimer/qguitimer.pro b/tests/auto/gui/kernel/qguitimer/qguitimer.pro index 15793d6e70..8a71e48007 100644 --- a/tests/auto/gui/kernel/qguitimer/qguitimer.pro +++ b/tests/auto/gui/kernel/qguitimer/qguitimer.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qguitimer QT = core gui testlib SOURCES += ../../../corelib/kernel/qtimer/tst_qtimer.cpp diff --git a/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro b/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro index cc72c225a3..ada3817e55 100644 --- a/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro +++ b/tests/auto/gui/kernel/qguivariant/no_application/no_application.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = no_application SOURCES += main.cpp QT += testlib diff --git a/tests/auto/gui/kernel/qguivariant/test/test.pro b/tests/auto/gui/kernel/qguivariant/test/test.pro index c4123797d2..39e4b3b71f 100644 --- a/tests/auto/gui/kernel/qguivariant/test/test.pro +++ b/tests/auto/gui/kernel/qguivariant/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qguivariant SOURCES += tst_qguivariant.cpp RESOURCES = tst_qguivariant.qrc diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 0a704b9f64..c45342cc06 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -390,7 +390,7 @@ void tst_QGuiVariant::toString_data() #ifndef Q_OS_MAC << QString( "Ctrl+A" ); #else - << QString(QChar(0x2318)) + "A"; + << QString(QChar(0x2318)) + QLatin1Char('A'); #endif QFont font( "times", 12 ); diff --git a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro index 7c1e8d52de..9f79fe9ab7 100644 --- a/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro +++ b/tests/auto/gui/kernel/qkeysequence/qkeysequence.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qkeysequence QT += testlib @@ -8,4 +7,3 @@ QT += core-private gui-private SOURCES += tst_qkeysequence.cpp RESOURCES += qkeysequence.qrc -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 3fcbd0a16f..84680fb7a6 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -250,7 +250,7 @@ void tst_QKeySequence::operatorQString() seq = QKeySequence( modifiers | keycode ); - QCOMPARE( (QString)seq, keystring ); + QCOMPARE( seq.toString(QKeySequence::NativeText), keystring ); } // this verifies that the constructors can handle the same strings in and out @@ -260,7 +260,7 @@ void tst_QKeySequence::symetricConstructors() QFETCH( int, keycode ); QKeySequence seq1( modifiers | keycode ); - QKeySequence seq2( (QString)seq1 ); + QKeySequence seq2( seq1.toString(QKeySequence::NativeText) ); QVERIFY( seq1 == seq2 ); } diff --git a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro index 43a62b4811..d09af5084b 100644 --- a/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro +++ b/tests/auto/gui/kernel/qopenglwindow/qopenglwindow.pro @@ -5,4 +5,4 @@ QT += core-private gui-private testlib SOURCES += tst_qopenglwindow.cpp -win32:CONFIG+=insignificant_test # QTBUG-28264 +win32:CONFIG+=insignificant_test # QTBUG-46452, QTBUG-49630 diff --git a/tests/auto/gui/kernel/qpalette/qpalette.pro b/tests/auto/gui/kernel/qpalette/qpalette.pro index de87e8fafe..9dd3f3e715 100644 --- a/tests/auto/gui/kernel/qpalette/qpalette.pro +++ b/tests/auto/gui/kernel/qpalette/qpalette.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpalette QT += testlib SOURCES += tst_qpalette.cpp diff --git a/tests/auto/gui/kernel/qscreen/qscreen.pro b/tests/auto/gui/kernel/qscreen/qscreen.pro index b2c98a9dfd..b631f4cf37 100644 --- a/tests/auto/gui/kernel/qscreen/qscreen.pro +++ b/tests/auto/gui/kernel/qscreen/qscreen.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscreen QT += core-private gui-private testlib diff --git a/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro b/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro index 9a705f443e..97d9d69fb7 100644 --- a/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro +++ b/tests/auto/gui/kernel/qsurfaceformat/qsurfaceformat.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsurfaceformat QT += core-private gui-private testlib diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index ee9709e68b..774c22a8e9 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -4,3 +4,5 @@ ubuntu-14.04 ubuntu-14.04 [modalWithChildWindow] ubuntu-14.04 +[setVisible] +ubuntu-14.04 diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 2219306b81..aa7dced0ab 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -58,12 +58,17 @@ class tst_QWindow: public QObject Q_OBJECT private slots: + void create(); + void setParent(); + void setVisible(); void eventOrderOnShow(); void resizeEventAfterResize(); void mapGlobal(); void positioning_data(); void positioning(); void positioningDuringMinimized(); + void childWindowPositioning_data(); + void childWindowPositioning(); void platformSurface(); void isExposed(); void isActive(); @@ -124,6 +129,111 @@ void tst_QWindow::cleanup() QVERIFY(QGuiApplication::allWindows().isEmpty()); } +void tst_QWindow::create() +{ + QWindow a; + QVERIFY2(!a.handle(), "QWindow should lazy init the platform window"); + + a.create(); + QVERIFY2(a.handle(), "Explicitly creating a platform window should never fail"); + + QWindow b; + QWindow c(&b); + b.create(); + QVERIFY(b.handle()); + QVERIFY2(!c.handle(), "Creating a parent window should not automatically create children"); + + QWindow d; + QWindow e(&d); + e.create(); + QVERIFY(e.handle()); + QVERIFY2(d.handle(), "Creating a child window should automatically create parents"); + + QWindow f; + QWindow g(&f); + f.create(); + QVERIFY(f.handle()); + QPlatformWindow *platformWindow = f.handle(); + g.create(); + QVERIFY(g.handle()); + QVERIFY2(f.handle() == platformWindow, "Creating a child window should not affect parent if already created"); +} + +void tst_QWindow::setParent() +{ + QWindow a; + QWindow b(&a); + QVERIFY2(b.parent() == &a, "Setting parent at construction time should work"); + QVERIFY2(a.children().contains(&b), "Parent should have child in list of children"); + + QWindow c; + QWindow d; + d.setParent(&c); + QVERIFY2(d.parent() == &c, "Setting parent after construction should work"); + QVERIFY2(c.children().contains(&d), "Parent should have child in list of children"); + + a.create(); + b.setParent(0); + QVERIFY2(!b.handle(), "Making window top level shouild not automatically create it"); + + QWindow e; + c.create(); + e.setParent(&c); + QVERIFY2(!e.handle(), "Making window a child of a created window should not automatically create it"); + + QWindow f; + QWindow g; + g.create(); + QVERIFY(g.handle()); + g.setParent(&f); + QVERIFY2(f.handle(), "Making a created window a child of a non-created window should automatically create it"); +} + +void tst_QWindow::setVisible() +{ + QWindow a; + QWindow b(&a); + a.setVisible(true); + QVERIFY2(!b.handle(), "Making a top level window visible doesn't create its children"); + QVERIFY2(!b.isVisible(), "Making a top level window visible doesn't make its children visible"); + QVERIFY(QTest::qWaitForWindowExposed(&a)); + + QWindow c; + QWindow d(&c); + d.setVisible(true); + QVERIFY2(!c.handle(), "Making a child window visible doesn't create parent window if parent is hidden"); + QVERIFY2(!c.isVisible(), "Making a child window visible doesn't make its parent visible"); + + QVERIFY2(!d.handle(), "Making a child window visible doesn't create platform window if parent is hidden"); + + c.create(); + QVERIFY(c.handle()); + QVERIFY2(d.handle(), "Creating a parent window should automatically create children if they are visible"); + QVERIFY2(!c.isVisible(), "Creating a parent window should not make it visible just because it has visible children"); + + QWindow e; + QWindow f(&e); + f.setVisible(true); + QVERIFY(!f.handle()); + QVERIFY(!e.handle()); + f.setParent(0); + QVERIFY2(f.handle(), "Making a visible but not created child window top level should create it"); + QVERIFY(QTest::qWaitForWindowExposed(&f)); + + QWindow g; + QWindow h; + QWindow i(&g); + i.setVisible(true); + h.setVisible(true); + QVERIFY(QTest::qWaitForWindowExposed(&h)); + QVERIFY(!i.handle()); + QVERIFY(!g.handle()); + QVERIFY(h.handle()); + i.setParent(&h); + QVERIFY2(i.handle(), "Making a visible but not created child window child of a created window should create it"); + QVERIFY(QTest::qWaitForWindowExposed(&i)); +} + void tst_QWindow::mapGlobal() { QWindow a; @@ -212,6 +322,19 @@ private: QPlatformSurfaceEvent::SurfaceEventType m_surfaceventType; }; +class ColoredWindow : public QRasterWindow { +public: + explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {} + void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE + { + QPainter p(this); + p.fillRect(QRect(QPoint(0, 0), size()), m_color); + } + +private: + const QColor m_color; +}; + void tst_QWindow::eventOrderOnShow() { // Some platforms enforce minimum widths for windows, which can cause extra resize @@ -247,12 +370,7 @@ void tst_QWindow::resizeEventAfterResize() // Make sure we get a resizeEvent after calling resize window.resize(m_testWindowSize); -#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen - // so we only expect one resize event - QTRY_COMPARE(window.received(QEvent::Resize), 1); -#else QTRY_COMPARE(window.received(QEvent::Resize), 2); -#endif } void tst_QWindow::positioning_data() @@ -317,21 +435,15 @@ void tst_QWindow::positioning() window.reset(); window.setWindowState(Qt::WindowFullScreen); QCoreApplication::processEvents(); - // On BB10 the window is the root window and fullscreen, so nothing is resized. -#if !defined(Q_OS_BLACKBERRY) - QTRY_VERIFY(window.received(QEvent::Resize) > 0); -#endif + QTRY_VERIFY(window.received(QEvent::Resize) > 0); QTest::qWait(2000); window.reset(); window.setWindowState(Qt::WindowNoState); QCoreApplication::processEvents(); - // On BB10 the window is the root window and fullscreen, so nothing is resized. -#if !defined(Q_OS_BLACKBERRY) - QTRY_VERIFY(window.received(QEvent::Resize) > 0); -#endif + QTRY_VERIFY(window.received(QEvent::Resize) > 0); QTest::qWait(2000); QTRY_COMPARE(originalPos, window.position()); @@ -394,6 +506,61 @@ void tst_QWindow::positioningDuringMinimized() QTRY_COMPARE(window.geometry(), newGeometry); } +void tst_QWindow::childWindowPositioning_data() +{ + QTest::addColumn<bool>("showInsteadOfCreate"); + + QTest::newRow("create") << false; + QTest::newRow("show") << true; +} + +void tst_QWindow::childWindowPositioning() +{ + const QPoint topLeftOrigin(0, 0); + + ColoredWindow topLevelWindowFirst(Qt::green); + topLevelWindowFirst.setObjectName("topLevelWindowFirst"); + ColoredWindow childWindowAfter(Qt::yellow, &topLevelWindowFirst); + childWindowAfter.setObjectName("childWindowAfter"); + + topLevelWindowFirst.setFramePosition(m_availableTopLeft); + childWindowAfter.setFramePosition(topLeftOrigin); + + ColoredWindow topLevelWindowAfter(Qt::green); + topLevelWindowAfter.setObjectName("topLevelWindowAfter"); + ColoredWindow childWindowFirst(Qt::yellow, &topLevelWindowAfter); + childWindowFirst.setObjectName("childWindowFirst"); + + topLevelWindowAfter.setFramePosition(m_availableTopLeft); + childWindowFirst.setFramePosition(topLeftOrigin); + + QFETCH(bool, showInsteadOfCreate); + + QWindow* windows[] = { &topLevelWindowFirst, &childWindowAfter, &childWindowFirst, &topLevelWindowAfter, 0 }; + for (int i = 0; windows[i]; ++i) { + QWindow *window = windows[i]; + if (showInsteadOfCreate) { + window->showNormal(); + } else { + window->create(); + } + } + + if (showInsteadOfCreate) { + QVERIFY(QTest::qWaitForWindowExposed(&topLevelWindowFirst)); + QVERIFY(QTest::qWaitForWindowExposed(&topLevelWindowAfter)); + } + + // Creation order shouldn't affect the geometry + // Use try compare since on X11 the window manager may still re-position the window after expose + QTRY_COMPARE(topLevelWindowFirst.geometry(), topLevelWindowAfter.geometry()); + QTRY_COMPARE(childWindowAfter.geometry(), childWindowFirst.geometry()); + + // Creation order shouldn't affect the child ending up at 0,0 + QCOMPARE(childWindowFirst.framePosition(), topLeftOrigin); + QCOMPARE(childWindowAfter.framePosition(), topLeftOrigin); +} + class PlatformWindowFilter : public QObject { Q_OBJECT @@ -1498,12 +1665,7 @@ void tst_QWindow::initialSize() Window w; w.setWidth(m_testWindowSize.width()); w.showNormal(); -#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen - // so we only expect one resize event - QTRY_COMPARE(w.width(), qGuiApp->primaryScreen()->availableGeometry().width()); -#else QTRY_COMPARE(w.width(), m_testWindowSize.width()); -#endif QTRY_VERIFY(w.height() > 0); } { @@ -1512,12 +1674,7 @@ void tst_QWindow::initialSize() w.resize(testSize); w.showNormal(); -#if defined(Q_OS_BLACKBERRY) // "window" is the "root" window and will always be shown fullscreen - // so we only expect one resize event - const QSize expectedSize = QGuiApplication::primaryScreen()->availableGeometry().size(); -#else const QSize expectedSize = testSize; -#endif QTRY_COMPARE(w.size(), expectedSize); } } @@ -1665,19 +1822,6 @@ void tst_QWindow::modalWindowPosition() QCOMPARE(window.geometry(), origGeo); } -class ColoredWindow : public QRasterWindow { -public: - explicit ColoredWindow(const QColor &color, QWindow *parent = 0) : QRasterWindow(parent), m_color(color) {} - void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE - { - QPainter p(this); - p.fillRect(QRect(QPoint(0, 0), size()), m_color); - } - -private: - const QColor m_color; -}; - static bool isNativeWindowVisible(const QWindow *window) { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) diff --git a/tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro b/tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro index 3302535dda..1401619cd0 100644 --- a/tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro +++ b/tests/auto/gui/math3d/qmatrixnxn/qmatrixnxn.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmatrixnxn SOURCES += tst_qmatrixnxn.cpp QT += testlib diff --git a/tests/auto/gui/math3d/qquaternion/qquaternion.pro b/tests/auto/gui/math3d/qquaternion/qquaternion.pro index d20719fd11..f578a38580 100644 --- a/tests/auto/gui/math3d/qquaternion/qquaternion.pro +++ b/tests/auto/gui/math3d/qquaternion/qquaternion.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qquaternion SOURCES += tst_qquaternion.cpp QT += testlib diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 1fbad5b829..53d9a987a6 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -999,16 +999,16 @@ static QByteArray testnameForAxis(const QVector3D &axis) testname = "null"; } else { if (axis.x()) { - testname += axis.x() < 0 ? "-" : "+"; - testname += "X"; + testname += axis.x() < 0 ? '-' : '+'; + testname += 'X'; } if (axis.y()) { - testname += axis.y() < 0 ? "-" : "+"; - testname += "Y"; + testname += axis.y() < 0 ? '-' : '+'; + testname += 'Y'; } if (axis.z()) { - testname += axis.z() < 0 ? "-" : "+"; - testname += "Z"; + testname += axis.z() < 0 ? '-' : '+'; + testname += 'Z'; } } return testname; diff --git a/tests/auto/gui/math3d/qvectornd/qvectornd.pro b/tests/auto/gui/math3d/qvectornd/qvectornd.pro index 9504b4a02b..9e5155aa6f 100644 --- a/tests/auto/gui/math3d/qvectornd/qvectornd.pro +++ b/tests/auto/gui/math3d/qvectornd/qvectornd.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qvectornd SOURCES += tst_qvectornd.cpp QT += testlib diff --git a/tests/auto/gui/painting/qbrush/qbrush.pro b/tests/auto/gui/painting/qbrush/qbrush.pro index 0cb11398dc..5016267e66 100644 --- a/tests/auto/gui/painting/qbrush/qbrush.pro +++ b/tests/auto/gui/painting/qbrush/qbrush.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qbrush QT += testlib gui-private SOURCES += tst_qbrush.cpp diff --git a/tests/auto/gui/painting/qcolor/qcolor.pro b/tests/auto/gui/painting/qcolor/qcolor.pro index 44d65bb50b..c8aab4ab75 100644 --- a/tests/auto/gui/painting/qcolor/qcolor.pro +++ b/tests/auto/gui/painting/qcolor/qcolor.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qcolor SOURCES += tst_qcolor.cpp QT += testlib gui-private core-private diff --git a/tests/auto/gui/painting/qpagelayout/qpagelayout.pro b/tests/auto/gui/painting/qpagelayout/qpagelayout.pro index 38a1064357..21fc8e0bb7 100644 --- a/tests/auto/gui/painting/qpagelayout/qpagelayout.pro +++ b/tests/auto/gui/painting/qpagelayout/qpagelayout.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpagelayout SOURCES += tst_qpagelayout.cpp QT += gui-private testlib DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/painting/qpagesize/qpagesize.pro b/tests/auto/gui/painting/qpagesize/qpagesize.pro index 5836dc9ba0..5e1cdb64eb 100644 --- a/tests/auto/gui/painting/qpagesize/qpagesize.pro +++ b/tests/auto/gui/painting/qpagesize/qpagesize.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpagesize SOURCES += tst_qpagesize.cpp QT += testlib DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/painting/qpaintengine/qpaintengine.pro b/tests/auto/gui/painting/qpaintengine/qpaintengine.pro index 1cf79af0a7..810dd81311 100644 --- a/tests/auto/gui/painting/qpaintengine/qpaintengine.pro +++ b/tests/auto/gui/painting/qpaintengine/qpaintengine.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpaintengine SOURCES += tst_qpaintengine.cpp QT += testlib diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index e90b516ef2..d4f1d43a74 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpainter QT += testlib gui-private core-private @@ -9,7 +8,6 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 android: !android-no-sdk { RESOURCES += \ diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 1ed78fa0ef..1571053d7e 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -663,7 +663,7 @@ QColor tst_QPainter::baseColor( int k, int intensity ) QImage tst_QPainter::getResImage( const QString &dir, const QString &addition, const QString &extension ) { QImage res; - QString resFilename = dir + QString( "/res_%1." ).arg( addition ) + extension; + QString resFilename = dir + QLatin1String("/res_") + addition + QLatin1Char('.') + extension; if ( !res.load( resFilename ) ) { QWARN(QString("Could not load result data %s %1").arg(resFilename).toLatin1()); return QImage(); @@ -674,14 +674,14 @@ QImage tst_QPainter::getResImage( const QString &dir, const QString &addition, c QBitmap tst_QPainter::getBitmap( const QString &dir, const QString &filename, bool mask ) { QBitmap bm; - QString bmFilename = dir + QString( "/%1.xbm" ).arg( filename ); + QString bmFilename = dir + QLatin1Char('/') + filename + QLatin1String(".xbm"); if ( !bm.load( bmFilename ) ) { QWARN(QString("Could not load bitmap '%1'").arg(bmFilename).toLatin1()); return QBitmap(); } if ( mask ) { QBitmap mask; - QString maskFilename = dir + QString( "/%1-mask.xbm" ).arg( filename ); + QString maskFilename = dir + QLatin1Char('/') + filename + QLatin1String("-mask.xbm"); if (!mask.load(maskFilename)) { QWARN(QString("Could not load mask '%1'").arg(maskFilename).toLatin1()); return QBitmap(); @@ -1521,10 +1521,11 @@ void tst_QPainter::drawEllipse_data() // ratio between width and hight is too large/small (task 114874). Those // ratios are therefore currently avoided. for (int w = 10; w < 128; w += 7) { + const QByteArray wB = QByteArray::number(w); for (int h = w/2; h < qMin(2*w, 128); h += 13) { - QString s = QString("%1x%2").arg(w).arg(h); - QTest::newRow(QString("%1 with pen").arg(s).toLatin1()) << QSize(w, h) << true; - QTest::newRow(QString("%1 no pen").arg(s).toLatin1()) << QSize(w, h) << false; + const QByteArray sB = wB + 'x' + QByteArray::number(h); + QTest::newRow((sB + " with pen").constData()) << QSize(w, h) << true; + QTest::newRow((sB + " no pen").constData()) << QSize(w, h) << false; } } } @@ -1562,16 +1563,17 @@ void tst_QPainter::drawClippedEllipse_data() QTest::addColumn<QRect>("rect"); for (int w = 20; w < 128; w += 7) { + const QByteArray wB = QByteArray::number(w); for (int h = w/2; h < qMin(2*w, 128); h += 13) { - QString s = QString("%1x%2").arg(w).arg(h); - QTest::newRow(QString("%1 top").arg(s).toLatin1()) << QRect(0, -h/2, w, h); - QTest::newRow(QString("%1 topright").arg(s).toLatin1()) << QRect(w/2, -h/2, w, h); - QTest::newRow(QString("%1 right").arg(s).toLatin1()) << QRect(w/2, 0, w, h); - QTest::newRow(QString("%1 bottomright").arg(s).toLatin1()) << QRect(w/2, h/2, w, h); - QTest::newRow(QString("%1 bottom").arg(s).toLatin1()) << QRect(0, h/2, w, h); - QTest::newRow(QString("%1 bottomleft").arg(s).toLatin1()) << QRect(-w/2, h/2, w, h); - QTest::newRow(QString("%1 left").arg(s).toLatin1()) << QRect(-w/2, 0, w, h); - QTest::newRow(QString("%1 topleft").arg(s).toLatin1()) << QRect(-w/2, -h/2, w, h); + const QByteArray sB = wB + 'x' + QByteArray::number(h); + QTest::newRow((sB + " top").constData()) << QRect(0, -h/2, w, h); + QTest::newRow((sB + " topright").constData()) << QRect(w/2, -h/2, w, h); + QTest::newRow((sB + " right").constData()) << QRect(w/2, 0, w, h); + QTest::newRow((sB + " bottomright").constData()) << QRect(w/2, h/2, w, h); + QTest::newRow((sB + " bottom").constData()) << QRect(0, h/2, w, h); + QTest::newRow((sB + " bottomleft").constData()) << QRect(-w/2, h/2, w, h); + QTest::newRow((sB + " left").constData()) << QRect(-w/2, 0, w, h); + QTest::newRow((sB + " topleft").constData()) << QRect(-w/2, -h/2, w, h); } } } @@ -1678,13 +1680,14 @@ void tst_QPainter::fillData() QTest::addColumn<bool>("usePen"); for (int w = 3; w < 50; w += 7) { + const QByteArray wB = QByteArray::number(w); for (int h = 3; h < 50; h += 11) { int x = w/2 + 5; int y = h/2 + 5; - QTest::newRow(QString("rect(%1, %2, %3, %4) with pen").arg(x).arg(y).arg(w).arg(h).toLatin1()) - << QRect(x, y, w, h) << true; - QTest::newRow(QString("rect(%1, %2, %3, %4) no pen").arg(x).arg(y).arg(w).arg(h).toLatin1()) - << QRect(x, y, w, h) << false; + const QByteArray rB = "rect(" + QByteArray::number(x) + ", " + QByteArray::number(y) + + ", " + QByteArray::number(w) + ", " + QByteArray::number(h) + ')'; + QTest::newRow((rB + " with pen").constData()) << QRect(x, y, w, h) << true; + QTest::newRow((rB + " no pen").constData()) << QRect(x, y, w, h) << false; } } } @@ -2167,21 +2170,23 @@ void tst_QPainter::clippedLines_data() << QLineF(15, 50, 66, 50); foreach (QLineF line, lines) { - QString desc = QString("line (%1, %2, %3, %4) %5").arg(line.x1()) - .arg(line.y1()).arg(line.x2()).arg(line.y2()); - QTest::newRow(qPrintable(desc.arg(0))) << QSize(100, 100) << line + const QByteArray desc = "line (" + QByteArray::number(line.x1()) + + ", " + QByteArray::number(line.y1()) + ", " + + QByteArray::number(line.x2()) + ", " + QByteArray::number(line.y2()) + + ") "; + QTest::newRow((desc + '0').constData()) << QSize(100, 100) << line << QRect(15, 15, 49, 49) << QPen(Qt::black); - QTest::newRow(qPrintable(desc.arg(1))) << QSize(100, 100) << line + QTest::newRow((desc + '1').constData()) << QSize(100, 100) << line << QRect(15, 15, 50, 50) << QPen(Qt::black); - QTest::newRow(qPrintable(desc.arg(2))) << QSize(100, 100) << line + QTest::newRow((desc + '2').constData()) << QSize(100, 100) << line << QRect(15, 15, 51, 51) << QPen(Qt::black); - QTest::newRow(qPrintable(desc.arg(3))) << QSize(100, 100) << line + QTest::newRow((desc + '3').constData()) << QSize(100, 100) << line << QRect(15, 15, 51, 51) << QPen(Qt::NoPen); - QTest::newRow(qPrintable(desc.arg(4))) << QSize(100, 100) << line + QTest::newRow((desc + '4').constData()) << QSize(100, 100) << line << QRect(15, 15, 51, 51) << pen2; } @@ -4487,7 +4492,7 @@ void tst_QPainter::QTBUG5939_attachPainterPrivate() TestWidget *widget = new TestWidget(); proxy->setWidget(widget); scene->addItem(proxy); - proxy->rotate(45); + proxy->setTransform(QTransform().rotate(45)); w->resize(scene->sceneRect().size().toSize()); w->show(); diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index ae30719ee7..b5e2ef96d1 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -270,13 +270,13 @@ void tst_QPainterPath::contains_QPointF_data() inside.addEllipse(base_rect.adjusted(5, 5, -5, -5)); QPolygonF inside_poly = inside.toFillPolygon(); for (int i=0; i<inside_poly.size(); ++i) - QTest::newRow(qPrintable(QString("inside_ellipse %1").arg(i))) << path << inside_poly.at(i) << true; + QTest::newRow(("inside_ellipse " + QByteArray::number(i)).constData()) << path << inside_poly.at(i) << true; QPainterPath outside; outside.addEllipse(base_rect.adjusted(-5, -5, 5, 5)); QPolygonF outside_poly = outside.toFillPolygon(); for (int i=0; i<outside_poly.size(); ++i) - QTest::newRow(qPrintable(QString("outside_ellipse %1").arg(i))) << path << outside_poly.at(i) << false; + QTest::newRow(("outside_ellipse " + QByteArray::number(i)).constData()) << path << outside_poly.at(i) << false; path = QPainterPath(); base_rect = QRectF(50, 50, 200, 200); @@ -852,8 +852,10 @@ void tst_QPainterPath::testArcMoveTo_data() << QRectF(100, 100, -100, -100); for (int domain=0; domain<rects.size(); ++domain) { + const QByteArray dB = QByteArray::number(domain); for (int i=-360; i<=360; ++i) { - QTest::newRow(qPrintable(QString("test %1 %2").arg(domain).arg(i))) << rects.at(domain) << (qreal) i; + QTest::newRow(("test " + dB + ' ' + QByteArray::number(i)).constData()) + << rects.at(domain) << (qreal) i; } // test low angles diff --git a/tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro b/tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro index 8ad476b498..218183da3d 100644 --- a/tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro +++ b/tests/auto/gui/painting/qpainterpathstroker/qpainterpathstroker.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpainterpathstroker SOURCES += tst_qpainterpathstroker.cpp QT += testlib diff --git a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro index b90bca8df3..2536cb24c0 100644 --- a/tests/auto/gui/painting/qpathclipper/qpathclipper.pro +++ b/tests/auto/gui/painting/qpathclipper/qpathclipper.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpathclipper INCLUDEPATH += . HEADERS += paths.h diff --git a/tests/auto/gui/painting/qpdfwriter/qpdfwriter.pro b/tests/auto/gui/painting/qpdfwriter/qpdfwriter.pro index fda0fad3b5..4d2dd70e26 100644 --- a/tests/auto/gui/painting/qpdfwriter/qpdfwriter.pro +++ b/tests/auto/gui/painting/qpdfwriter/qpdfwriter.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpdfwriter SOURCES += tst_qpdfwriter.cpp QT += gui-private testlib DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/painting/qpen/qpen.pro b/tests/auto/gui/painting/qpen/qpen.pro index cafec29947..762b8f47d4 100644 --- a/tests/auto/gui/painting/qpen/qpen.pro +++ b/tests/auto/gui/painting/qpen/qpen.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpen SOURCES += tst_qpen.cpp QT += testlib diff --git a/tests/auto/gui/painting/qpolygon/qpolygon.pro b/tests/auto/gui/painting/qpolygon/qpolygon.pro index 4783e4b5d4..9385b6458d 100644 --- a/tests/auto/gui/painting/qpolygon/qpolygon.pro +++ b/tests/auto/gui/painting/qpolygon/qpolygon.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpolygon QT += testlib SOURCES += tst_qpolygon.cpp diff --git a/tests/auto/gui/painting/qregion/qregion.pro b/tests/auto/gui/painting/qregion/qregion.pro index 01eb9dd937..e9dff9a32e 100644 --- a/tests/auto/gui/painting/qregion/qregion.pro +++ b/tests/auto/gui/painting/qregion/qregion.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qregion QT += gui-private testlib diff --git a/tests/auto/gui/painting/qtransform/qtransform.pro b/tests/auto/gui/painting/qtransform/qtransform.pro index d59c040fb8..62c7518da0 100644 --- a/tests/auto/gui/painting/qtransform/qtransform.pro +++ b/tests/auto/gui/painting/qtransform/qtransform.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtransform SOURCES += tst_qtransform.cpp QT += testlib diff --git a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro index b3bec3d4ff..efa2963091 100644 --- a/tests/auto/gui/painting/qwmatrix/qwmatrix.pro +++ b/tests/auto/gui/painting/qwmatrix/qwmatrix.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwmatrix SOURCES += tst_qwmatrix.cpp QT += testlib diff --git a/tests/auto/gui/qopengl/qopengl.pro b/tests/auto/gui/qopengl/qopengl.pro index bddccac747..a4ef016e39 100644 --- a/tests/auto/gui/qopengl/qopengl.pro +++ b/tests/auto/gui/qopengl/qopengl.pro @@ -3,12 +3,9 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qopengl 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):!contains(QT_CONFIG, egl): DEFINES += USE_GLX diff --git a/tests/auto/gui/qopenglconfig/qopenglconfig.pro b/tests/auto/gui/qopenglconfig/qopenglconfig.pro index bcf7215eea..9b0175acea 100644 --- a/tests/auto/gui/qopenglconfig/qopenglconfig.pro +++ b/tests/auto/gui/qopenglconfig/qopenglconfig.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qopenglconfig QT += gui-private core-private testlib diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro b/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro index 866638f154..ec71130350 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/qabstracttextdocumentlayout.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstracttextdocumentlayout QT += testlib SOURCES += tst_qabstracttextdocumentlayout.cpp diff --git a/tests/auto/gui/text/qcssparser/qcssparser.pro b/tests/auto/gui/text/qcssparser/qcssparser.pro index bb0c8c4f40..88d1fcfd2d 100644 --- a/tests/auto/gui/text/qcssparser/qcssparser.pro +++ b/tests/auto/gui/text/qcssparser/qcssparser.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qcssparser SOURCES += tst_qcssparser.cpp QT += xml gui-private testlib diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index b1beb0ffd0..2308f4f215 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -185,7 +185,7 @@ static void debug(const QVector<QCss::Symbol> &symbols, int index = -1) { qDebug() << "all symbols:"; for (int i = 0; i < symbols.count(); ++i) - qDebug() << "(" << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem(); + qDebug() << '(' << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem(); if (index != -1) qDebug() << "failure at index" << index; } @@ -916,21 +916,37 @@ void tst_QCssParser::marginValue_data() int ex = QFontMetrics(f).xHeight(); int em = QFontMetrics(f).height(); + const QString ex1234 = QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex); + const QString em2ex4 = QLatin1String("1 ") + QString::number(2*em) + QLatin1String(" 3 ") + + QString::number(4 * ex); + QTest::newRow("one value") << "margin: 1px" << "1 1 1 1"; QTest::newRow("two values") << "margin: 1px 2px" << "1 2 1 2"; QTest::newRow("three value") << "margin: 1px 2px 3px" << "1 2 3 2"; QTest::newRow("four values") << "margin: 1px 2px 3px 4px" << "1 2 3 4"; QTest::newRow("default px") << "margin: 1 2 3 4" << "1 2 3 4"; QTest::newRow("no unit") << "margin: 1 2 3 4" << "1 2 3 4"; - QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex); - QTest::newRow("ex") << "margin: 1 2em 3px 4ex" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex); + QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex" + << (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex)); + QTest::newRow("ex") << "margin: 1 2em 3px 4ex" + << (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ") + + QString::number(4 * ex)); f.setPointSize(20); f.setBold(true); ex = QFontMetrics(f).xHeight(); em = QFontMetrics(f).height(); - QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex); - QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex); + QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex" + << (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex) + + QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ') + + QString::number(4 * ex)); + QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;" + << (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ") + + QString::number(4 * ex)); QTest::newRow("crap") << "margin: crap" << "0 0 0 0"; } @@ -963,7 +979,8 @@ void tst_QCssParser::marginValue() int p[4]; int spacing; v.extractBox(m, p, &spacing); - QString str = QString("%1 %2 %3 %4").arg(m[0]).arg(m[1]).arg(m[2]).arg(m[3]); + QString str = QString::number(m[0]) + QLatin1Char(' ') + QString::number(m[1]) + + QLatin1Char(' ') + QString::number(m[2]) + QLatin1Char(' ') + QString::number(m[3]); QCOMPARE(str, expectedMargin); } } @@ -1090,7 +1107,7 @@ void tst_QCssParser::styleSelector() QFETCH(QString, xml); QFETCH(QString, elementToCheck); - QString css = QString("%1 { background-color: green }").arg(selector); + const QString css = selector + QLatin1String(" { background-color: green }"); QCss::Parser parser(css); QCss::StyleSheet sheet; QVERIFY(parser.parse(&sheet)); @@ -1154,7 +1171,7 @@ void tst_QCssParser::specificity() { QFETCH(QString, selector); - QString css = QString("%1 { }").arg(selector); + QString css = selector + QLatin1String(" { }"); QCss::Parser parser(css); QCss::StyleSheet sheet; QVERIFY(parser.parse(&sheet)); @@ -1340,7 +1357,7 @@ void tst_QCssParser::shorthandBackgroundProperty() QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>"))); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1500,7 +1517,7 @@ void tst_QCssParser::gradient() QVERIFY(doc.setContent(QLatin1String("<!DOCTYPE test><test> <dummy/> </test>"))); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1560,7 +1577,7 @@ void tst_QCssParser::extractFontFamily() { QFETCH(QString, css); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1618,7 +1635,7 @@ void tst_QCssParser::extractBorder() QFETCH(QColor, expectedTopColor); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; diff --git a/tests/auto/gui/text/qfont/qfont.pro b/tests/auto/gui/text/qfont/qfont.pro index ced66c226c..048d952faf 100644 --- a/tests/auto/gui/text/qfont/qfont.pro +++ b/tests/auto/gui/text/qfont/qfont.pro @@ -1,10 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfont QT += testlib QT += core-private gui-private qtHaveModule(widgets): QT += widgets SOURCES += tst_qfont.cpp - - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 93e308b96a..844a091495 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -504,7 +504,7 @@ void tst_QFont::isCopyOf() void tst_QFont::insertAndRemoveSubstitutions() { - QFont::removeSubstitution("BogusFontFamily"); + QFont::removeSubstitutions("BogusFontFamily"); // make sure it is empty before we start QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty()); QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty()); @@ -521,7 +521,7 @@ void tst_QFont::insertAndRemoveSubstitutions() QCOMPARE(QFont::substitutes("BogusFontFamily").count(), 3); QCOMPARE(QFont::substitutes("bogusfontfamily").count(), 3); - QFont::removeSubstitution("BogusFontFamily"); + QFont::removeSubstitutions("BogusFontFamily"); // make sure it is empty again QVERIFY(QFont::substitutes("BogusFontFamily").isEmpty()); QVERIFY(QFont::substitutes("bogusfontfamily").isEmpty()); @@ -679,7 +679,7 @@ static inline QByteArray msgNotAcceptableFont(const QString &defaultFamily, cons { QString res = QString::fromLatin1("Font family '%1' is not one of the following acceptable results: ").arg(defaultFamily); Q_FOREACH (const QString &family, acceptableFamilies) - res += QString::fromLatin1("\n %1").arg(family); + res += QLatin1String("\n ") + family; return res.toLocal8Bit(); } diff --git a/tests/auto/gui/text/qfontcache/qfontcache.pro b/tests/auto/gui/text/qfontcache/qfontcache.pro index 5068c12cd6..bc1042a91b 100644 --- a/tests/auto/gui/text/qfontcache/qfontcache.pro +++ b/tests/auto/gui/text/qfontcache/qfontcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontcache QT += testlib QT += core-private gui-private diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro index 831ed1f572..5dba2fc06a 100644 --- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro +++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontdatabase SOURCES += tst_qfontdatabase.cpp QT += testlib core-private gui-private diff --git a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro index 7286c53d74..5dfabadd1a 100644 --- a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro +++ b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontmetrics QT += testlib core-private gui-private SOURCES += tst_qfontmetrics.cpp diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro index b7d9f164c9..39f641a3b2 100644 --- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro +++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qglyphrun QT = core gui testlib diff --git a/tests/auto/gui/text/qrawfont/qrawfont.pro b/tests/auto/gui/text/qrawfont/qrawfont.pro index 20da2e9a22..47e760e1da 100644 --- a/tests/auto/gui/text/qrawfont/qrawfont.pro +++ b/tests/auto/gui/text/qrawfont/qrawfont.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qrawfont QT = core core-private gui gui-private testlib diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index c12acf65cc..b1e292f094 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -93,6 +93,8 @@ private slots: void multipleRawFontsFromData(); void rawFontFromInvalidData(); + + void kernedAdvances(); private: QString testFont; QString testFontBoldItalic; @@ -954,6 +956,38 @@ void tst_QRawFont::rawFontFromInvalidData() QVERIFY(!font.isValid()); } +#define FUZZY_LTEQ(X, Y) (X < Y || qFuzzyCompare(X, Y)) + +void tst_QRawFont::kernedAdvances() +{ + const int emSquareSize = 1000; + const qreal pixelSize = 16.0; + const int underScoreAW = 500; + const int underscoreTwoKerning = -500; + const qreal errorMargin = 1.0 / 16.0; // Fixed point error margin + + QRawFont font(testFont, pixelSize); + QVERIFY(font.isValid()); + + QVector<quint32> glyphIndexes = font.glyphIndexesForString(QStringLiteral("__")); + QCOMPARE(glyphIndexes.size(), 2); + + QVector<QPointF> advances = font.advancesForGlyphIndexes(glyphIndexes, QRawFont::KernedAdvances); + QCOMPARE(advances.size(), 2); + + qreal expectedAdvanceWidth = pixelSize * underScoreAW / emSquareSize; + QVERIFY(FUZZY_LTEQ(qAbs(advances.at(0).x() - expectedAdvanceWidth), errorMargin)); + + glyphIndexes = font.glyphIndexesForString(QStringLiteral("_2")); + QCOMPARE(glyphIndexes.size(), 2); + + advances = font.advancesForGlyphIndexes(glyphIndexes, QRawFont::KernedAdvances); + QCOMPARE(advances.size(), 2); + + expectedAdvanceWidth = pixelSize * (underScoreAW + underscoreTwoKerning) / emSquareSize; + QVERIFY(FUZZY_LTEQ(qAbs(advances.at(0).x() - expectedAdvanceWidth), errorMargin)); +} + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QRawFont) diff --git a/tests/auto/gui/text/qstatictext/qstatictext.pro b/tests/auto/gui/text/qstatictext/qstatictext.pro index 435b132ffd..002cead51d 100644 --- a/tests/auto/gui/text/qstatictext/qstatictext.pro +++ b/tests/auto/gui/text/qstatictext/qstatictext.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test -linux: CONFIG += insignificant_test TARGET = tst_qstatictext QT += testlib QT += core-private gui-private diff --git a/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro b/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro index a8dd6437ba..a78c429433 100644 --- a/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro +++ b/tests/auto/gui/text/qsyntaxhighlighter/qsyntaxhighlighter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsyntaxhighlighter SOURCES += tst_qsyntaxhighlighter.cpp QT += testlib diff --git a/tests/auto/gui/text/qtextblock/qtextblock.pro b/tests/auto/gui/text/qtextblock/qtextblock.pro index 6048361f7a..cf3456bbf6 100644 --- a/tests/auto/gui/text/qtextblock/qtextblock.pro +++ b/tests/auto/gui/text/qtextblock/qtextblock.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextblock QT += testlib diff --git a/tests/auto/gui/text/qtextcursor/qtextcursor.pro b/tests/auto/gui/text/qtextcursor/qtextcursor.pro index 5e045404f1..bae85d9c37 100644 --- a/tests/auto/gui/text/qtextcursor/qtextcursor.pro +++ b/tests/auto/gui/text/qtextcursor/qtextcursor.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextcursor SOURCES += tst_qtextcursor.cpp QT += testlib diff --git a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp index 9396cd678b..1ecc3f2eae 100644 --- a/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/gui/text/qtextcursor/tst_qtextcursor.cpp @@ -175,7 +175,7 @@ void tst_QTextCursor::navigation1() { cursor.insertText("Hello World"); - QVERIFY(doc->toPlainText() == "Hello World"); + QCOMPARE(doc->toPlainText(), QLatin1String("Hello World")); cursor.movePosition(QTextCursor::End); QCOMPARE(cursor.position(), 11); @@ -205,7 +205,7 @@ void tst_QTextCursor::navigation1() doc->undo(); doc->undo(); - QVERIFY(doc->toPlainText() == "Hello World"); + QCOMPARE(doc->toPlainText(), QLatin1String("Hello World")); cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 6); diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 7378ca85ee..ef96cda97d 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -216,8 +216,8 @@ public: QString tst_QTextDocument::cssFontSizeString(const QFont &font) { return font.pointSize() >= 0 - ? QStringLiteral("%1pt").arg(font.pointSizeF()) - : QStringLiteral("%1px").arg(font.pixelSize()); + ? QString::number(font.pointSizeF()) + QStringLiteral("pt") + : QString::number(font.pixelSize()) + QStringLiteral("px"); } // Testing get/set functions @@ -3082,7 +3082,7 @@ void tst_QTextDocument::baseUrl() document.setBaseUrl(base); QCOMPARE(document.baseUrl(), base); - document.setHtml(QString("<img src='%1'/>").arg(resource.toString())); + document.setHtml(QLatin1String("<img src='") + resource.toString() + QLatin1String("'/>")); document.resource(QTextDocument::ImageResource, resource); QCOMPARE(document.loadedResource(), loaded); } diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 1cd9d9bcbe..2ec64e5acc 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -1177,9 +1177,11 @@ void tst_QTextDocumentFragment::copySubTable() fmt.setColumnWidthConstraints(constraints); QTextTable *table = cursor.insertTable(4, 4, fmt); - for (int row = 0; row < 4; ++row) + for (int row = 0; row < 4; ++row) { + const QString rowS = QString::number(row) + QLatin1Char('/'); for (int col = 0; col < 4; ++col) - table->cellAt(row, col).firstCursorPosition().insertText(QString("%1/%2").arg(row).arg(col)); + table->cellAt(row, col).firstCursorPosition().insertText(rowS + QString::number(col)); + } QCOMPARE(table->format().columnWidthConstraints().count(), table->columns()); diff --git a/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro b/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro index 42c6406fdb..5d31ee3930 100644 --- a/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro +++ b/tests/auto/gui/text/qtextdocumentlayout/qtextdocumentlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextdocumentlayout QT += testlib qtHaveModule(widgets) QT += widgets diff --git a/tests/auto/gui/text/qtextformat/qtextformat.pro b/tests/auto/gui/text/qtextformat/qtextformat.pro index c64d266916..bf909bafd2 100644 --- a/tests/auto/gui/text/qtextformat/qtextformat.pro +++ b/tests/auto/gui/text/qtextformat/qtextformat.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextformat QT += testlib core-private gui-private SOURCES += tst_qtextformat.cpp diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index de0c2d6dbe..60ad5d32f5 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1123,10 +1123,10 @@ void tst_QTextLayout::boundingRectTopLeft() void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() { QString txt; - txt.append("a"); + txt.append(QLatin1Char('a')); txt.append(0xd87e); txt.append(0xdc25); - txt.append("b"); + txt.append(QLatin1Char('b')); QTextLayout layout(txt); QTextEngine *engine = layout.engine(); const QCharAttributes *attrs = engine->attributes(); diff --git a/tests/auto/gui/text/qtextlist/qtextlist.pro b/tests/auto/gui/text/qtextlist/qtextlist.pro index b837f1f81b..e9ca3ad0a0 100644 --- a/tests/auto/gui/text/qtextlist/qtextlist.pro +++ b/tests/auto/gui/text/qtextlist/qtextlist.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextlist QT += core-private gui-private testlib diff --git a/tests/auto/gui/text/qtextobject/qtextobject.pro b/tests/auto/gui/text/qtextobject/qtextobject.pro index b2bf793e8e..3c69757410 100644 --- a/tests/auto/gui/text/qtextobject/qtextobject.pro +++ b/tests/auto/gui/text/qtextobject/qtextobject.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextobject QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp index f12bbbdd7e..17541912ce 100644 --- a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp @@ -135,7 +135,7 @@ void tst_QTextOdfWriter::testWriteParagraph_data() "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">foobar <text:s text:c=\"2\"/>word<text:tab/>tab x</text:span></text:p>"; QTest::newRow("misc2") << "\t \tFoo" << "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\"><text:tab/> <text:s text:c=\"4\"/><text:tab/>Foo</text:span></text:p>"; - QTest::newRow("linefeed") << QString("line1%1line2").arg(QChar(0x2028)) << + QTest::newRow("linefeed") << (QStringLiteral("line1") + QChar(0x2028) + QStringLiteral("line2")) << "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">line1<text:line-break/>line2</text:span></text:p>"; QTest::newRow("spaces") << "The quick brown fox jumped over the lazy dog" << "<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">The quick brown fox jumped over the lazy dog</text:span></text:p>"; diff --git a/tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro b/tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro index 2179fcbdf8..756073e171 100644 --- a/tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro +++ b/tests/auto/gui/text/qtextscriptengine/qtextscriptengine.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtextscriptengine QT += core-private gui-private testlib diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 2595bba2a9..37b815c2e3 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -130,7 +130,7 @@ struct ShapeTable { static void prepareShapingTest(const QFont &font, const ShapeTable *shape_table) { for (const ShapeTable *s = shape_table; s->unicode[0]; ++s) { - QByteArray testName = font.family().toLatin1() + ":"; + QByteArray testName = font.family().toLatin1() + ':'; QString string; for (const ushort *u = s->unicode; *u; ++u) { string.append(QChar(*u)); diff --git a/tests/auto/gui/text/qtexttable/qtexttable.pro b/tests/auto/gui/text/qtexttable/qtexttable.pro index 1e7249090a..2faadfcb0d 100644 --- a/tests/auto/gui/text/qtexttable/qtexttable.pro +++ b/tests/auto/gui/text/qtexttable/qtexttable.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtexttable QT += testlib qtHaveModule(widgets): QT += widgets diff --git a/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro b/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro index 162cc796e5..f5fb11effd 100644 --- a/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/gui/util/qdesktopservices/qdesktopservices.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test QT += testlib SOURCES += tst_qdesktopservices.cpp diff --git a/tests/auto/gui/util/qdoublevalidator/qdoublevalidator.pro b/tests/auto/gui/util/qdoublevalidator/qdoublevalidator.pro index 9f04bdbb60..955369527f 100644 --- a/tests/auto/gui/util/qdoublevalidator/qdoublevalidator.pro +++ b/tests/auto/gui/util/qdoublevalidator/qdoublevalidator.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdoublevalidator QT += testlib SOURCES += tst_qdoublevalidator.cpp diff --git a/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp b/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp index 78ab769137..f810a92dc5 100644 --- a/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp +++ b/tests/auto/gui/util/qdoublevalidator/tst_qdoublevalidator.cpp @@ -43,6 +43,8 @@ class tst_QDoubleValidator : public QObject private slots: void validate_data(); void validate(); + void zeroPaddedExponent_data(); + void zeroPaddedExponent(); void validateThouSep_data(); void validateThouSep(); void validateIntEquiv_data(); @@ -240,6 +242,61 @@ void tst_QDoubleValidator::validate() dv.setNotation(QDoubleValidator::StandardNotation); QCOMPARE((int)dv.validate(value, dummy), (int)standard_state); } + +void tst_QDoubleValidator::zeroPaddedExponent_data() +{ + QTest::addColumn<double>("minimum"); + QTest::addColumn<double>("maximum"); + QTest::addColumn<int>("decimals"); + QTest::addColumn<QString>("value"); + QTest::addColumn<bool>("rejectZeroPaddedExponent"); + QTest::addColumn<QValidator::State>("state"); + + QTest::newRow("data01") << 1229.0 << 1231.0 << 0 << QString("123e+1") << false << ACC; + QTest::newRow("data02") << 12290.0 << 12310.0 << 0 << QString("123e2") << false << ACC; + QTest::newRow("data03") << 12.290 << 12.310 << 2 << QString("123e-") << false << ITM; + QTest::newRow("data04") << 12.290 << 12.310 << 2 << QString("123e-1") << false << ACC; + QTest::newRow("data05") << 1.2290 << 1.2310 << 3 << QString("123e-2") << false << ACC; + + QTest::newRow("data11") << 1229.0 << 1231.0 << 0 << QString("123e+1") << true << ACC; + QTest::newRow("data12") << 12290.0 << 12310.0 << 0 << QString("123e2") << true << ACC; + QTest::newRow("data13") << 12.290 << 12.310 << 2 << QString("123e-") << true << ITM; + QTest::newRow("data14") << 12.290 << 12.310 << 2 << QString("123e-1") << true << ACC; + QTest::newRow("data15") << 1.2290 << 1.2310 << 3 << QString("123e-2") << true << ACC; + + QTest::newRow("data21") << 1229.0 << 1231.0 << 0 << QString("123e+01") << false << ACC; + QTest::newRow("data22") << 12290.0 << 12310.0 << 0 << QString("123e02") << false << ACC; + QTest::newRow("data23") << 12.290 << 12.310 << 2 << QString("123e-0") << false << ITM; + QTest::newRow("data24") << 12.290 << 12.310 << 2 << QString("123e-01") << false << ACC; + QTest::newRow("data25") << 1.2290 << 1.2310 << 3 << QString("123e-02") << false << ACC; + + QTest::newRow("data31") << 1229.0 << 1231.0 << 0 << QString("123e+01") << true << INV; + QTest::newRow("data32") << 12290.0 << 12310.0 << 0 << QString("123e02") << true << INV; + QTest::newRow("data33") << 12.290 << 12.310 << 2 << QString("123e-0") << true << INV; + QTest::newRow("data34") << 12.290 << 12.310 << 2 << QString("123e-01") << true << INV; + QTest::newRow("data35") << 1.2290 << 1.2310 << 3 << QString("123e-02") << true << INV; + +} + +void tst_QDoubleValidator::zeroPaddedExponent() +{ + QFETCH(double, minimum); + QFETCH(double, maximum); + QFETCH(int, decimals); + QFETCH(QString, value); + QFETCH(bool, rejectZeroPaddedExponent); + QFETCH(QValidator::State, state); + + QLocale locale(QLocale::C); + if (rejectZeroPaddedExponent) + locale.setNumberOptions(QLocale::RejectLeadingZeroInExponent); + + QDoubleValidator dv(minimum, maximum, decimals, 0); + dv.setLocale(locale); + int dummy; + QCOMPARE((int)dv.validate(value, dummy), (int)state); +} + void tst_QDoubleValidator::notifySignals() { QLocale::setDefault(QLocale("C")); diff --git a/tests/auto/gui/util/qintvalidator/qintvalidator.pro b/tests/auto/gui/util/qintvalidator/qintvalidator.pro index 4bc35416b5..52e0b85735 100644 --- a/tests/auto/gui/util/qintvalidator/qintvalidator.pro +++ b/tests/auto/gui/util/qintvalidator/qintvalidator.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qintvalidator SOURCES += tst_qintvalidator.cpp QT += testlib diff --git a/tests/auto/gui/util/qregexpvalidator/qregexpvalidator.pro b/tests/auto/gui/util/qregexpvalidator/qregexpvalidator.pro index 5b70d7b11d..8f1de5b747 100644 --- a/tests/auto/gui/util/qregexpvalidator/qregexpvalidator.pro +++ b/tests/auto/gui/util/qregexpvalidator/qregexpvalidator.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qregexpvalidator SOURCES += tst_qregexpvalidator.cpp QT += testlib diff --git a/tests/auto/gui/util/qregularexpressionvalidator/qregularexpressionvalidator.pro b/tests/auto/gui/util/qregularexpressionvalidator/qregularexpressionvalidator.pro index 1e8e50563e..ab76cef3d1 100644 --- a/tests/auto/gui/util/qregularexpressionvalidator/qregularexpressionvalidator.pro +++ b/tests/auto/gui/util/qregularexpressionvalidator/qregularexpressionvalidator.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_qregularexpressionvalidator SOURCES += tst_qregularexpressionvalidator.cpp QT += testlib diff --git a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro index 4772af9af9..1874f001ab 100644 --- a/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/network/access/qabstractnetworkcache/qabstractnetworkcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractnetworkcache QT = core network testlib SOURCES += tst_qabstractnetworkcache.cpp diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index fd48ec3253..62f87db6df 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -44,7 +44,7 @@ #include <algorithm> -#define TESTFILE QString("http://%1/qtest/cgi-bin/").arg(QtNetworkSettings::serverName()) +#define TESTFILE QLatin1String("http://") + QtNetworkSettings::serverName() + QLatin1String("/qtest/cgi-bin/") class tst_QAbstractNetworkCache : public QObject { diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 795548ccc8..25e324c9f3 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -290,10 +290,11 @@ void tst_QFtp::init() #if !defined(Q_OS_WINCE) srand(time(0)); - uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)time(0)); + uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + + QString::number((qulonglong)time(0)); #else srand(0); - uniqueExtension = QString("%1%2%3").arg((qulonglong)this).arg(rand()).arg((qulonglong)(0)); + uniqueExtension = QString::number((quintptr)this) + QString::number(rand()) + QLatin1Char('0'); #endif } @@ -643,19 +644,20 @@ void tst_QFtp::get_data() // test the two get() overloads in one routine for ( int i=0; i<2; i++ ) { - QTest::newRow( QString("relPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("relPath01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << "qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("relPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") + QTest::newRow(("relPath02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") << "qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("absPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("absPath01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << "/qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("absPath02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") + QTest::newRow(("absPath02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString("ftptest") << QString("password") << "/var/ftp/qtest/rfc3252" << 1 << rfc3252 << (bool)(i==1); - QTest::newRow( QString("nonExist01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("nonExist01_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("foo") << 0 << QByteArray() << (bool)(i==1); - QTest::newRow( QString("nonExist02_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("nonExist02_" + iB).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("/foo") << 0 << QByteArray() << (bool)(i==1); } } @@ -734,7 +736,7 @@ void tst_QFtp::put_data() // test the two put() overloads in one routine for ( int i=0; i<2; i++ ) { - QTest::newRow( QString("relPath01_%1").arg(i).toLatin1().constData() ) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() + QTest::newRow(("relPath01_" + QByteArray::number(i)).constData()) << QtNetworkSettings::serverName() << (uint)21 << QString() << QString() << QString("qtest/upload/rel01_%1") << rfc3252 << (bool)(i==1) << 1; /* @@ -2048,10 +2050,10 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) ); addCommand( QFtp::Login, ftp->login( user, password ) ); - if ( dirToCreate.startsWith( "/" ) ) + if ( dirToCreate.startsWith( QLatin1Char('/') ) ) addCommand( QFtp::Cd, ftp->cd( dirToCreate ) ); else - addCommand( QFtp::Cd, ftp->cd( cdDir + "/" + dirToCreate ) ); + addCommand( QFtp::Cd, ftp->cd( cdDir + QLatin1Char('/') + dirToCreate ) ); addCommand( QFtp::Close, ftp->close() ); inFileDirExistsFunction = true; diff --git a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro index fa19fa7ac9..bd20fd33dd 100644 --- a/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/network/access/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qhttpnetworkconnection SOURCES += tst_qhttpnetworkconnection.cpp requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro index f5dbc7f010..1810a38f6e 100644 --- a/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro +++ b/tests/auto/network/access/qhttpnetworkreply/qhttpnetworkreply.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qhttpnetworkreply SOURCES += tst_qhttpnetworkreply.cpp requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro b/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro index 8b3de90f54..e84f9f7dba 100644 --- a/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro +++ b/tests/auto/network/access/qnetworkaccessmanager/qnetworkaccessmanager.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkaccessmanager SOURCES += tst_qnetworkaccessmanager.cpp QT = core network testlib diff --git a/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro b/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro index d308c286fb..0e942cd4f4 100644 --- a/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro +++ b/tests/auto/network/access/qnetworkcachemetadata/qnetworkcachemetadata.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcachemetadata QT = core network testlib SOURCES += tst_qnetworkcachemetadata.cpp diff --git a/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro b/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro index ba3ece8576..320e3a81c5 100644 --- a/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro +++ b/tests/auto/network/access/qnetworkcookie/qnetworkcookie.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcookie SOURCES += tst_qnetworkcookie.cpp diff --git a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp index be3e839725..9738cf157e 100644 --- a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp @@ -63,16 +63,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro b/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro index bb39f83af6..e679f8a930 100644 --- a/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro +++ b/tests/auto/network/access/qnetworkcookiejar/qnetworkcookiejar.pro @@ -1,6 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkcookiejar SOURCES += tst_qnetworkcookiejar.cpp QT = core core-private network network-private testlib +TESTDATA = parser.json diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index 12ac1e519d..f1ac7bc386 100644 --- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -72,16 +72,17 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro index 7e26abbe08..4a78544bf8 100644 --- a/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro +++ b/tests/auto/network/access/qnetworkdiskcache/qnetworkdiskcache.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkdiskcache QT = core network testlib SOURCES += tst_qnetworkdiskcache.cpp diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 1685838e9e..399c9a733a 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -540,7 +540,7 @@ void tst_QNetworkDiskCache::expire() std::sort(cacheList.begin(), cacheList.end()); for (int i = 0; i < cacheList.count(); ++i) { QString fileName = cacheList[i]; - QCOMPARE(fileName, QString("http://localhost:4/%1").arg(i + 6)); + QCOMPARE(fileName, QLatin1String("http://localhost:4/") + QString::number(i + 6)); } } @@ -782,7 +782,10 @@ void tst_QNetworkDiskCache::crashWhenParentingCache() QNetworkAccessManager *manager = new QNetworkAccessManager(); QNetworkDiskCache *diskCache = new QNetworkDiskCache(manager); // parent to qnam! // we expect the temp dir to be cleaned at some point anyway - diskCache->setCacheDirectory(QString("%1/cacheDir_%2").arg(QDir::tempPath()).arg(QCoreApplication::applicationPid())); + + const QString diskCachePath = QDir::tempPath() + QLatin1String("/cacheDir_") + + QString::number(QCoreApplication::applicationPid()); + diskCache->setCacheDirectory(diskCachePath); manager->setCache(diskCache); QUrl url("http://127.0.0.1:" + QString::number(server.serverPort())); diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index ce56dcacba..66aa26ccea 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -125,9 +125,10 @@ class tst_QNetworkReply: public QObject qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()) + QCoreApplication::applicationPid()); seedCreated = true; // not thread-safe, but who cares } - QString s = QString("%1-%2-%3").arg(QTime(0,0,0).msecsTo(QTime::currentTime())).arg(QCoreApplication::applicationPid()).arg(qrand()); - return s; - }; + return QString::number(QTime(0, 0, 0).msecsTo(QTime::currentTime())) + + QLatin1Char('-') + QString::number(QCoreApplication::applicationPid()) + + QLatin1Char('-') + QString::number(qrand()); + } static QString tempRedirectReplyStr() { QString s = "HTTP/1.1 307 Temporary Redirect\r\n" @@ -198,6 +199,7 @@ public Q_SLOTS: protected Q_SLOTS: void nestedEventLoops_slot(); + void notEnoughData(); private Q_SLOTS: void cleanup() { cleanupTestData(); } @@ -487,6 +489,7 @@ private: void cleanupTestData(); QString testDataDir; + bool notEnoughDataForFastSender; }; bool tst_QNetworkReply::seedCreated = false; @@ -515,16 +518,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } @@ -991,11 +994,13 @@ public: } // a server that sends the data provided at construction time, useful for HTTP - FastSender(const QByteArray& data, bool https, bool fillBuffer) + FastSender(const QByteArray& data, bool https, bool fillBuffer, tst_QNetworkReply *listener = 0) : wantedSize(data.size()), port(-1), protocol(ProvidedData), doSsl(https), fillKernelBuffer(fillBuffer), transferRate(-1), dataToTransmit(data), dataIndex(0) { + if (listener) + connect(this, SIGNAL(notEnoughData()), listener, SLOT(notEnoughData())); start(); ready.acquire(); } @@ -1058,6 +1063,7 @@ protected: do { if (writeNextData(client, BlockSize) < BlockSize) { qDebug() << "ERROR: FastSender: not enough data to write in order to fill buffers; or client is reading too fast"; + emit notEnoughData(); return; } while (client->bytesToWrite() > 0) { @@ -1118,6 +1124,7 @@ protected: } signals: void dataReady(); + void notEnoughData(); }; class RateControlledReader: public QObject @@ -2778,7 +2785,7 @@ void tst_QNetworkReply::postToHttpsMultipart() // hack for testing the setting of the content-type header by hand: if (contentType == "custom") { - QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + "\""); + QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + '"'); request.setHeader(QNetworkRequest::ContentTypeHeader, contentType); } @@ -2930,7 +2937,7 @@ void tst_QNetworkReply::connectToIPv6Address() QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); QByteArray content = reply->readAll(); //qDebug() << server.receivedData; - QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QByteArray hostinfo = "\r\nHost: " + hostfield + ':' + QByteArray::number(server.serverPort()) + "\r\n"; QVERIFY(server.receivedData.contains(hostinfo)); QCOMPARE(content, dataToSend); QCOMPARE(reply->url(), request.url()); @@ -4814,7 +4821,7 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress() server.listen(QHostAddress(QHostAddress::LocalHost), 0); // create the request - QUrl url = QUrl(QString("https://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("https://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest request(url); request.setRawHeader("Content-Type", "application/octet-stream"); @@ -4898,7 +4905,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() << testData.size() << "bytes of data"; const bool fillKernelBuffer = bufferSize > 0; - FastSender server(httpResponse, https, fillKernelBuffer); + notEnoughDataForFastSender = false; + FastSender server(httpResponse, https, fillKernelBuffer, this); QUrl url(QString("%1://127.0.0.1:%2/qtest/rfc3252.txt") .arg(https?"https":"http") @@ -4913,7 +4921,13 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() QTime loopTime; loopTime.start(); - QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); + const int result = waitForFinish(reply); + if (notEnoughDataForFastSender) { + server.wait(); + QSKIP("kernel socket buffers are too big for this test to work"); + } + + QVERIFY2(result == Success, msgWaitForFinished(reply)); const int elapsedTime = loopTime.elapsed(); server.wait(); @@ -4941,7 +4955,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int allowedDeviation = 16; // TODO find out why the send rate is 13% faster currently const int minRate = rate * 1024 * (100-allowedDeviation) / 100; const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; - qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; + qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << '?'; // The test takes too long to run if sending enough data to overwhelm the // reciever's kernel buffers. //QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue); @@ -5030,7 +5044,7 @@ void tst_QNetworkReply::emitAllUploadProgressSignals() server.listen(QHostAddress(QHostAddress::LocalHost), 0); connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("http://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest normalRequest(url); normalRequest.setRawHeader("Content-Type", "application/octet-stream"); @@ -5085,7 +5099,7 @@ void tst_QNetworkReply::ioPostToHttpEmptyUploadProgress() server.listen(QHostAddress(QHostAddress::LocalHost), 0); // create the request - QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); + QUrl url = QUrl(QLatin1String("http://127.0.0.1:") + QString::number(server.serverPort()) + QLatin1Char('/')); QNetworkRequest request(url); request.setRawHeader("Content-Type", "application/octet-stream"); QNetworkReplyPtr reply(manager.post(request, &buffer)); @@ -5517,7 +5531,7 @@ void tst_QNetworkReply::sendCookies_data() list.clear(); cookie = QNetworkCookie("a", "b"); cookie.setPath("/"); - cookie.setDomain("." + QtNetworkSettings::serverDomainName()); + cookie.setDomain(QLatin1Char('.') + QtNetworkSettings::serverDomainName()); list << cookie; QTest::newRow("domain-match") << list << "a=b"; @@ -5586,6 +5600,11 @@ void tst_QNetworkReply::nestedEventLoops_slot() QTestEventLoop::instance().exitLoop(); } +void tst_QNetworkReply::notEnoughData() +{ + notEnoughDataForFastSender = true; +} + void tst_QNetworkReply::nestedEventLoops() { // Slightly fragile test, it may not be testing anything @@ -5850,7 +5869,7 @@ void tst_QNetworkReply::httpConnectionCount() QCoreApplication::instance()->processEvents(); for (int i = 0; i < 10; i++) { - QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); + QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + QLatin1Char('/') + QString::number(i))); QNetworkReply* reply = manager.get(request); reply->setParent(&server); } @@ -6463,9 +6482,10 @@ public slots: QByteArray data(amount, '@'); if (chunkedEncoding) { - client->write(QString(QString("%1").arg(amount,0,16).toUpper() + "\r\n").toLatin1()); + client->write(QByteArray::number(amount, 16).toUpper()); + client->write("\r\n"); client->write(data.constData(), amount); - client->write(QString("\r\n").toLatin1()); + client->write("\r\n"); } else { client->write(data.constData(), amount); } @@ -7734,6 +7754,7 @@ void tst_QNetworkReply::emitErrorForAllReplies() // QTBUG-36890 #ifdef QT_BUILD_INTERNAL void tst_QNetworkReply::backgroundRequest_data() { +#ifndef QT_NO_BEARERMANAGEMENT QTest::addColumn<QUrl>("url"); QTest::addColumn<bool>("background"); QTest::addColumn<int>("policy"); @@ -7759,7 +7780,7 @@ void tst_QNetworkReply::backgroundRequest_data() QTest::newRow("ftp, bg, normal") << ftpurl << true << (int)QNetworkSession::NoPolicy << QNetworkReply::NoError; QTest::newRow("ftp, fg, nobg") << ftpurl << false << (int)QNetworkSession::NoBackgroundTrafficPolicy << QNetworkReply::NoError; QTest::newRow("ftp, bg, nobg") << ftpurl << true << (int)QNetworkSession::NoBackgroundTrafficPolicy << QNetworkReply::BackgroundRequestNotAllowedError; - +#endif // !QT_NO_BEARERMANAGEMENT } #endif @@ -8296,10 +8317,15 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() server.m_expectedReplies = numUploads; server.listen(QHostAddress(QHostAddress::LocalHost), 0); + QString urlPrefix = QLatin1String("http"); + if (withSsl) + urlPrefix += QLatin1Char('s'); + urlPrefix += QLatin1String("://127.0.0.1:"); + urlPrefix += QString::number(server.serverPort()); + urlPrefix += QLatin1String("/file="); for (int i = 0; i < numUploads; i++) { // create the request - QUrl url = QUrl(QString("http%1://127.0.0.1:%2/file=%3").arg(withSsl ? "s" : "").arg(server.serverPort()).arg(i)); - QNetworkRequest request(url); + QNetworkRequest request(QUrl(urlPrefix + QString::number(i))); QNetworkReply *reply = manager.put(request, sourceFile); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply, SLOT(ignoreSslErrors())); connect(reply, SIGNAL(finished()), &server, SLOT(replyFinished())); diff --git a/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro b/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro index 0470d96b8c..c00c2c30a2 100644 --- a/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro +++ b/tests/auto/network/access/qnetworkrequest/qnetworkrequest.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkrequest SOURCES += tst_qnetworkrequest.cpp diff --git a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp index 7370339b2b..7136a136b0 100644 --- a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp +++ b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp @@ -73,16 +73,16 @@ namespace QTest { template<> char *toString(const QList<QNetworkCookie> &list) { - QString result = "QList("; + QByteArray result = "QList("; bool first = true; foreach (QNetworkCookie cookie, list) { if (!first) result += ", "; first = false; - result += QString::fromLatin1("QNetworkCookie(%1)").arg(QLatin1String(cookie.toRawForm())); + result += "QNetworkCookie(" + cookie.toRawForm() + ')'; } - - return qstrdup(result.append(')').toLocal8Bit()); + result.append(')'); + return qstrdup(result.constData()); } } diff --git a/tests/auto/network/access/spdy/spdy.pro b/tests/auto/network/access/spdy/spdy.pro index 23efa85b47..cdbe60a19b 100644 --- a/tests/auto/network/access/spdy/spdy.pro +++ b/tests/auto/network/access/spdy/spdy.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_spdy SOURCES += tst_spdy.cpp QT = core core-private network network-private testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 win32:CONFIG += insignificant_test # QTBUG-47128 diff --git a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp index 74b26107bc..a7ff336382 100644 --- a/tests/auto/network/bearer/qnetworksession/lackey/main.cpp +++ b/tests/auto/network/bearer/qnetworksession/lackey/main.cpp @@ -132,8 +132,9 @@ int main(int argc, char** argv) return SESSION_OPEN_ERROR; } - QString output = QString("Started session for %1\n").arg(session->configuration().identifier()); - oopSocket.write(output.toLatin1()); + QByteArray output = "Started session for " + + session->configuration().identifier().toLatin1() + '\n'; + oopSocket.write(output); oopSocket.waitForBytesWritten(); oopSocket.waitForReadyRead(); diff --git a/tests/auto/network/kernel/qdnslookup/qdnslookup.pro b/tests/auto/network/kernel/qdnslookup/qdnslookup.pro index 3727736fad..f14ffd003e 100644 --- a/tests/auto/network/kernel/qdnslookup/qdnslookup.pro +++ b/tests/auto/network/kernel/qdnslookup/qdnslookup.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdnslookup diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 301a915dd6..976b895b53 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -275,7 +275,7 @@ void tst_QDnsLookup::lookup() QStringList mailExchanges; foreach (const QDnsMailExchangeRecord &record, lookup.mailExchangeRecords()) { QCOMPARE(record.name(), domain); - mailExchanges << QString("%1 %2").arg(QString::number(record.preference()), record.exchange()); + mailExchanges << QString::number(record.preference()) + QLatin1Char(' ') + record.exchange(); } QVERIFY2(mx_alternatives.contains(mailExchanges.join(';')), qPrintable("Actual: " + mailExchanges.join(';') + "\nExpected one of:\n" + mx_alternatives.join('\n'))); @@ -304,11 +304,9 @@ void tst_QDnsLookup::lookup() QStringList services; foreach (const QDnsServiceRecord &record, lookup.serviceRecords()) { QCOMPARE(record.name(), domain); - services << QString("%1 %2 %3 %4").arg( - QString::number(record.priority()), - QString::number(record.weight()), - QString::number(record.port()), - record.target()); + services << (QString::number(record.priority()) + QLatin1Char(' ') + + QString::number(record.weight()) + QLatin1Char(' ') + + QString::number(record.port()) + QLatin1Char(' ') + record.target()); } QVERIFY2(srv_alternatives.contains(services.join(';')), qPrintable("Actual: " + services.join(';') + "\nExpected one of:\n" + srv_alternatives.join('\n'))); diff --git a/tests/auto/network/kernel/qdnslookup_appless/qdnslookup_appless.pro b/tests/auto/network/kernel/qdnslookup_appless/qdnslookup_appless.pro index 0515bbad3b..25d76b5739 100644 --- a/tests/auto/network/kernel/qdnslookup_appless/qdnslookup_appless.pro +++ b/tests/auto/network/kernel/qdnslookup_appless/qdnslookup_appless.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdnslookup_appless diff --git a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro index f349cab976..19d74dfd9b 100644 --- a/tests/auto/network/kernel/qhostaddress/qhostaddress.pro +++ b/tests/auto/network/kernel/qhostaddress/qhostaddress.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qhostaddress SOURCES += tst_qhostaddress.cpp diff --git a/tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro b/tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro index ae207e9c79..427f2e0f19 100644 --- a/tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro +++ b/tests/auto/network/kernel/qnetworkaddressentry/qnetworkaddressentry.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkaddressentry SOURCES += tst_qnetworkaddressentry.cpp diff --git a/tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro b/tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro index 79279514d1..694dec2ed7 100644 --- a/tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro +++ b/tests/auto/network/kernel/qnetworkinterface/qnetworkinterface.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkinterface SOURCES += tst_qnetworkinterface.cpp diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index f7798bbb70..2a0552b770 100644 --- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -141,7 +141,7 @@ void tst_QNetworkInterface::dump() s.nospace() << ": " << qPrintable(e.ip().toString()); if (!e.netmask().isNull()) s.nospace() << '/' << e.prefixLength() - << " (" << qPrintable(e.netmask().toString()) << ")"; + << " (" << qPrintable(e.netmask().toString()) << ')'; if (!e.broadcast().isNull()) s.nospace() << " broadcast " << qPrintable(e.broadcast().toString()); } @@ -203,6 +203,11 @@ void tst_QNetworkInterface::interfaceFromXXX() QFETCH(QNetworkInterface, iface); QVERIFY(QNetworkInterface::interfaceFromName(iface.name()).isValid()); + if (int idx = iface.index()) { + QVERIFY(QNetworkInterface::interfaceFromIndex(idx).isValid()); + QCOMPARE(QNetworkInterface::interfaceNameFromIndex(idx), iface.name()); + QCOMPARE(QNetworkInterface::interfaceIndexFromName(iface.name()), idx); + } foreach (QNetworkAddressEntry entry, iface.addressEntries()) { QVERIFY(!entry.ip().isNull()); diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro b/tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro index c63c7742a1..ed73e3e10e 100644 --- a/tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro +++ b/tests/auto/network/kernel/qnetworkproxyfactory/qnetworkproxyfactory.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkproxyfactory QT = core network testlib diff --git a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index d67813b954..457ddfa1a0 100644 --- a/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/network/kernel/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -372,7 +372,7 @@ void tst_QNetworkProxyFactory::genericSystemProxy() QFETCH(int, port); // The generic system proxy is only available on the following platforms -#if (!defined Q_OS_BLACKBERRY) && (!defined Q_OS_WIN) && (!defined Q_OS_OSX) +#if (!defined Q_OS_WIN) && (!defined Q_OS_OSX) qputenv(envVar, url); const QList<QNetworkProxy> systemProxy = QNetworkProxyFactory::systemProxyForQuery(); QCOMPARE(systemProxy.size(), 1); diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d7480a4109..0a112e3e07 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -190,7 +190,7 @@ private slots: } void slotError(QLocalSocket::LocalSocketError newError) { - QVERIFY(errorString() != "Unknown error"); + QVERIFY(errorString() != QLatin1String("Unknown error")); QCOMPARE(error(), newError); } void slotStateChanged(QLocalSocket::LocalSocketState newState) @@ -328,8 +328,9 @@ void tst_QLocalSocket::listenAndConnect_data() int connections = i; if (i == 2) connections = 5; - QTest::newRow(QString("null %1").arg(i).toLatin1()) << QString() << false << connections; - QTest::newRow(QString("tst_localsocket %1").arg(i).toLatin1()) << "tst_localsocket" << true << connections; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("null " + iB).constData()) << QString() << false << connections; + QTest::newRow(("tst_localsocket " + iB).constData()) << "tst_localsocket" << true << connections; } } @@ -535,7 +536,7 @@ void tst_QLocalSocket::sendData() if (server.hasPendingConnections()) { QString testLine = "test"; for (int i = 0; i < 50000; ++i) - testLine += "a"; + testLine += QLatin1Char('a'); QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState); @@ -1237,7 +1238,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor() QVERIFY2(server.fullServerName().at(0) == at, "abstract sockets should start with a '@'"); } else { QCOMPARE(server.fullServerName(), path); - if (path.contains(QLatin1String("/"))) { + if (path.contains(QLatin1Char('/'))) { QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name"); } else { QVERIFY2(server.serverName() == path, "servier name doesn't match the path provided"); diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp index 8da656aab7..bd43961ea2 100644 --- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -613,8 +613,8 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read greeting QVERIFY(socket.waitForReadyRead(5000)); - QString s = socket.readLine(); - QVERIFY2(QtNetworkSettings::compareReplyIMAP(s.toLatin1()), s.toLatin1().constData()); + QByteArray s = socket.readLine(); + QVERIFY2(QtNetworkSettings::compareReplyIMAP(s), s.constData()); // Write NOOP QCOMPARE((int) socket.write("1 NOOP\r\n", 8), 8); @@ -624,7 +624,7 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read response s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "1 OK Completed\r\n"); + QCOMPARE(s, QByteArrayLiteral("1 OK Completed\r\n")); // Write LOGOUT QCOMPARE((int) socket.write("2 LOGOUT\r\n", 10), 10); @@ -634,13 +634,13 @@ void tst_QSocks5SocketEngine::tcpSocketBlockingTest() // Read two lines of respose s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "* BYE LOGOUT received\r\n"); + QCOMPARE(s, QByteArrayLiteral("* BYE LOGOUT received\r\n")); if (!socket.canReadLine()) QVERIFY(socket.waitForReadyRead(5000)); s = socket.readLine(); - QCOMPARE(s.toLatin1().constData(), "2 OK Completed\r\n"); + QCOMPARE(s, QByteArrayLiteral("2 OK Completed\r\n")); // Close the socket socket.close(); @@ -715,7 +715,7 @@ void tst_QSocks5SocketEngine::tcpSocketNonBlockingTest() // Read response QVERIFY(!tcpSocketNonBlocking_data.isEmpty()); - QCOMPARE(tcpSocketNonBlocking_data.at(0).toLatin1().constData(), "1 OK Completed\r\n"); + QCOMPARE(tcpSocketNonBlocking_data.at(0), QLatin1String("1 OK Completed\r\n")); tcpSocketNonBlocking_data.clear(); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index abbc560414..a5ba405dd4 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -201,6 +201,7 @@ private slots: void setSocketOption(); void clientSendDataOnDelayedDisconnect(); void serverDisconnectWithBuffered(); + void socketDiscardDataInWriteMode(); protected slots: void nonBlockingIMAP_hostFound(); @@ -1775,7 +1776,7 @@ void tst_QTcpSocket::atEnd() // Test server must use some vsFTPd 2.x.x version QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting)); QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting)); - QVERIFY2(greeting.endsWith(")"), qPrintable(greeting)); + QVERIFY2(greeting.endsWith(QLatin1Char(')')), qPrintable(greeting)); delete socket; } @@ -3028,5 +3029,36 @@ void tst_QTcpSocket::serverDisconnectWithBuffered() delete socket; } +// Test buffered sockets discard input when opened in WriteOnly mode +void tst_QTcpSocket::socketDiscardDataInWriteMode() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + QTcpServer tcpServer; + QTcpSocket *socket = newSocket(); + + QVERIFY(tcpServer.listen(QHostAddress::LocalHost)); + socket->connectToHost(tcpServer.serverAddress(), tcpServer.serverPort(), + QIODevice::WriteOnly); + QVERIFY(socket->waitForConnected(5000)); // ready for write + QCOMPARE(socket->state(), QAbstractSocket::ConnectedState); + + // Accept connection on server side + QVERIFY2(tcpServer.waitForNewConnection(5000), "Network timeout"); + QTcpSocket *newConnection = tcpServer.nextPendingConnection(); + // Send one char and drop link + QVERIFY(newConnection != NULL); + QVERIFY(newConnection->putChar(0)); + QVERIFY(newConnection->flush()); + delete newConnection; + + QVERIFY(socket->waitForReadyRead(5000)); // discard input + QVERIFY(socket->atEnd()); + + delete socket; +} + QTEST_MAIN(tst_QTcpSocket) #include "tst_qtcpsocket.moc" diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 0ee3255502..cad81d870c 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -1119,12 +1119,13 @@ void tst_QUdpSocket::multicastTtlOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 2; - QTest::newRow(QString("%1 128").arg(address.toString()).toLatin1()) << address << 128 << 128; - QTest::newRow(QString("%1 255").arg(address.toString()).toLatin1()) << address << 255 << 255; - QTest::newRow(QString("%1 1024").arg(address.toString()).toLatin1()) << address << 1024 << 1; + const QByteArray addressB = address.toString().toLatin1(); + QTest::newRow((addressB + " 0").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1").constData()) << address << 1 << 1; + QTest::newRow((addressB + " 2").constData()) << address << 2 << 2; + QTest::newRow((addressB + " 128").constData()) << address << 128 << 128; + QTest::newRow((addressB + " 255").constData()) << address << 255 << 255; + QTest::newRow((addressB + " 1024").constData()) << address << 1024 << 1; } } @@ -1163,13 +1164,14 @@ void tst_QUdpSocket::multicastLoopbackOption_data() addresses += QHostAddress(QHostAddress::AnyIPv6); foreach (const QHostAddress &address, addresses) { - QTest::newRow(QString("%1 0").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1").arg(address.toString()).toLatin1()) << address << 1 << 1; - QTest::newRow(QString("%1 2").arg(address.toString()).toLatin1()) << address << 2 << 1; - QTest::newRow(QString("%1 0 again").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 2 again").arg(address.toString()).toLatin1()) << address << 2 << 1; - QTest::newRow(QString("%1 0 last time").arg(address.toString()).toLatin1()) << address << 0 << 0; - QTest::newRow(QString("%1 1 again").arg(address.toString()).toLatin1()) << address << 1 << 1; + const QByteArray addressB = address.toString().toLatin1(); + QTest::newRow((addressB + " 0").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1").constData()) << address << 1 << 1; + QTest::newRow((addressB + " 2").constData()) << address << 2 << 1; + QTest::newRow((addressB + " 0 again").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 2 again").constData()) << address << 2 << 1; + QTest::newRow((addressB + " 0 last time").constData()) << address << 0 << 0; + QTest::newRow((addressB + " 1 again").constData()) << address << 1 << 1; } } @@ -1266,9 +1268,8 @@ void tst_QUdpSocket::setMulticastInterface_data() if ((iface.flags() & QNetworkInterface::IsUp) == 0) continue; foreach (const QNetworkAddressEntry &entry, iface.addressEntries()) { - QTest::newRow(QString("%1:%2").arg(iface.name()).arg(entry.ip().toString()).toLatin1()) - << iface - << entry.ip(); + const QByteArray testName = iface.name().toLatin1() + ':' + entry.ip().toString().toLatin1(); + QTest::newRow(testName.constData()) << iface << entry.ip(); } } } diff --git a/tests/auto/network/ssl/qasn1element/qasn1element.pro b/tests/auto/network/ssl/qasn1element/qasn1element.pro index 524c772443..006ac3428c 100644 --- a/tests/auto/network/ssl/qasn1element/qasn1element.pro +++ b/tests/auto/network/ssl/qasn1element/qasn1element.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qasn1element.cpp QT = core network network-private testlib diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro index 26d6424a97..87a210c051 100644 --- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslcertificate.cpp !wince:win32:LIBS += -lws2_32 diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 4c288fffaf..4ebaedd8de 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -423,15 +423,15 @@ void tst_QSslCertificate::subjectAlternativeNames() QMapIterator<QSsl::AlternativeNameEntryType, QString> it(altSubjectNames); while (it.hasNext()) { it.next(); - QString type; + QByteArray type; if (it.key() == QSsl::EmailEntry) - type = QLatin1String("email"); + type = "email"; else if (it.key() == QSsl::DnsEntry) - type = QLatin1String("DNS"); + type = "DNS"; else QFAIL("unsupported alternative name type"); - QString entry = QString("%1:%2").arg(type).arg(it.value()); - QVERIFY(fileContents.contains(entry.toLatin1())); + const QByteArray entry = type + ':' + it.value().toLatin1(); + QVERIFY(fileContents.contains(entry)); } // verify that each entry in fileContents is present in subjAltNames @@ -844,7 +844,7 @@ void tst_QSslCertificate::nulInCN() QVERIFY(!cert.isNull()); QString cn = cert.subjectInfo(QSslCertificate::CommonName)[0]; - QVERIFY(cn != "www.bank.com"); + QVERIFY(cn != QLatin1String("www.bank.com")); static const char realCN[] = "www.bank.com\0.badguy.com"; QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1)); @@ -1064,7 +1064,7 @@ QString tst_QSslCertificate::toString(const QList<QSslError>& errors) QStringList errorStrings; foreach (const QSslError& error, errors) { - errorStrings.append(QLatin1String("\"") + error.errorString() + QLatin1String("\"")); + errorStrings.append(QLatin1Char('"') + error.errorString() + QLatin1Char('"')); } return QLatin1String("[ ") + errorStrings.join(QLatin1String(", ")) + QLatin1String(" ]"); diff --git a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro index 36e3c29b31..4cb2dfebab 100644 --- a/tests/auto/network/ssl/qsslcipher/qsslcipher.pro +++ b/tests/auto/network/ssl/qsslcipher/qsslcipher.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslcipher.cpp win32:!wince: LIBS += -lws2_32 diff --git a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro index 747bb55ade..e67b64b2b7 100644 --- a/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro +++ b/tests/auto/network/ssl/qsslellipticcurve/qsslellipticcurve.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslellipticcurve.cpp win32:!wince: LIBS += -lws2_32 diff --git a/tests/auto/network/ssl/qsslerror/qsslerror.pro b/tests/auto/network/ssl/qsslerror/qsslerror.pro index 6b7090db99..7737aae3f1 100644 --- a/tests/auto/network/ssl/qsslerror/qsslerror.pro +++ b/tests/auto/network/ssl/qsslerror/qsslerror.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslerror.cpp win32:!wince: LIBS += -lws2_32 diff --git a/tests/auto/network/ssl/qsslkey/qsslkey.pro b/tests/auto/network/ssl/qsslkey/qsslkey.pro index a74f432890..7eb04793f3 100644 --- a/tests/auto/network/ssl/qsslkey/qsslkey.pro +++ b/tests/auto/network/ssl/qsslkey/qsslkey.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslkey.cpp win32:!wince: LIBS += -lws2_32 diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index a7957d3288..81257a460f 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -279,13 +279,13 @@ void tst_QSslKey::toEncryptedPemOrDer_data() << "aAzZ`1234567890-=~!@#$%^&*()_+[]{}\\|;:'\",.<>/?"; // ### add more (?) foreach (KeyInfo keyInfo, keyInfoList) { foreach (QString password, passwords) { - QString testName = QString("%1-%2-%3-%4-%5").arg(keyInfo.fileInfo.fileName()) - .arg(keyInfo.algorithm == QSsl::Rsa ? "RSA" : - (keyInfo.algorithm == QSsl::Dsa ? "DSA" : "EC")) - .arg(keyInfo.type == QSsl::PrivateKey ? "PrivateKey" : "PublicKey") - .arg(keyInfo.format == QSsl::Pem ? "PEM" : "DER") - .arg(password); - QTest::newRow(testName.toLatin1()) + const QByteArray testName = keyInfo.fileInfo.fileName().toLatin1() + + '-' + (keyInfo.algorithm == QSsl::Rsa ? "RSA" : + (keyInfo.algorithm == QSsl::Dsa ? "DSA" : "EC")) + + '-' + (keyInfo.type == QSsl::PrivateKey ? "PrivateKey" : "PublicKey") + + '-' + (keyInfo.format == QSsl::Pem ? "PEM" : "DER") + + password.toLatin1(); + QTest::newRow(testName.constData()) << keyInfo.fileInfo.absoluteFilePath() << keyInfo.algorithm << keyInfo.type << keyInfo.format << password; } diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro index 4f216ebb37..ae911e43ed 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test testcase.timeout = 300 # this test is slow SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp index 3a31241b77..0608461e74 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -215,7 +215,7 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe socket4->connectToHostEncrypted(host, 443); #ifdef QT_BUILD_INTERNAL bool rootCertLoadingAllowed = QSslSocketPrivate::rootCertOnDemandLoadingSupported(); -#if defined(Q_OS_LINUX) || defined (Q_OS_BLACKBERRY) +#if defined(Q_OS_LINUX) QCOMPARE(rootCertLoadingAllowed, true); #elif defined(Q_OS_MAC) QCOMPARE(rootCertLoadingAllowed, false); diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro index 96a6162ce6..25e5a5d5c7 100644 --- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro +++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp win32:!wince: LIBS += -lws2_32 diff --git a/tests/auto/opengl/qgl/qgl.pro b/tests/auto/opengl/qgl/qgl.pro index 35b5c6888b..af930c5be7 100644 --- a/tests/auto/opengl/qgl/qgl.pro +++ b/tests/auto/opengl/qgl/qgl.pro @@ -9,7 +9,3 @@ QT += widgets widgets-private opengl-private gui-private core-private testlib SOURCES += tst_qgl.cpp RESOURCES = qgl.qrc - -linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = lucid ]"): CONFIG+=insignificant_test # QTBUG-25293 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTQAINFRA-711 diff --git a/tests/auto/opengl/qglbuffer/qglbuffer.pro b/tests/auto/opengl/qglbuffer/qglbuffer.pro index 72117322da..f12a191f79 100644 --- a/tests/auto/opengl/qglbuffer/qglbuffer.pro +++ b/tests/auto/opengl/qglbuffer/qglbuffer.pro @@ -3,10 +3,8 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qglbuffer requires(qtHaveModule(opengl)) QT += opengl widgets testlib SOURCES += tst_qglbuffer.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/opengl/qglfunctions/qglfunctions.pro b/tests/auto/opengl/qglfunctions/qglfunctions.pro index a512ea0dd9..9b349eaf34 100644 --- a/tests/auto/opengl/qglfunctions/qglfunctions.pro +++ b/tests/auto/opengl/qglfunctions/qglfunctions.pro @@ -1,10 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qglfunctions requires(qtHaveModule(opengl)) QT += opengl widgets testlib SOURCES += tst_qglfunctions.cpp - -win32:CONFIG+=insignificant_test # QTBUG-26390 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/opengl/qglthreads/qglthreads.pro b/tests/auto/opengl/qglthreads/qglthreads.pro index 3502c41c87..ab8bda741e 100644 --- a/tests/auto/opengl/qglthreads/qglthreads.pro +++ b/tests/auto/opengl/qglthreads/qglthreads.pro @@ -10,6 +10,5 @@ x11 { LIBS += $$QMAKE_LIBS_X11 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -win32:CONFIG+=insignificant_test # QTBUG-28264 + diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index ff5a18dedb..7b7064529f 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -702,6 +702,9 @@ private: */ void tst_QGLThreads::painterOnGLWidgetInThread() { + //QTBUG-46446 tst_qglthreads is unstable on windows 7 + if (QGuiApplication::platformName().compare("windows 7", Qt::CaseInsensitive)) + QSKIP("Doesn't work on this platform. QTBUG-46446"); if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) QSKIP("No platformsupport for ThreadedOpenGL"); if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) || @@ -746,6 +749,9 @@ void tst_QGLThreads::painterOnPixmapInThread() */ void tst_QGLThreads::painterOnPboInThread() { + //QTBUG-46446 tst_qglthreads is unstable on windows 7 + if (QGuiApplication::platformName().compare("windows 7", Qt::CaseInsensitive)) + QSKIP("Doesn't work on this platform. QTBUG-46446"); if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) QSKIP("No platformsupport for ThreadedOpenGL"); if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) || @@ -773,6 +779,9 @@ void tst_QGLThreads::painterOnPboInThread() */ void tst_QGLThreads::painterOnFboInThread() { + //QTBUG-46446 tst_qglthreads is unstable on windows 7 + if (QGuiApplication::platformName().compare("windows 7", Qt::CaseInsensitive)) + QSKIP("Doesn't work on this platform. QTBUG-46446"); if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL)) QSKIP("No platformsupport for ThreadedOpenGL"); if (!((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) || diff --git a/tests/auto/other/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp index 4260ca18b8..a75a7b91bf 100644 --- a/tests/auto/other/atwrapper/atWrapper.cpp +++ b/tests/auto/other/atwrapper/atWrapper.cpp @@ -149,9 +149,10 @@ void atWrapper::ftpMgetDone( bool error) if ( mgetDirList.size() > 1 ) for ( int i = 1; i < mgetDirList.size(); ++i ) { - file = new QFile( QString( output ) + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ) ); + file = new QFile( QString( output ) + QLatin1Char('/') + mgetDirList.at( 0 ) + + QLatin1Char('/') + mgetDirList.at( i ) ); if (file->open(QIODevice::WriteOnly)) { - ftp.get( ftpBaseDir + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ), file ); + ftp.get( ftpBaseDir + QLatin1Char('/') + mgetDirList.at( 0 ) + QLatin1Char('/') + mgetDirList.at( i ), file ); ftp.list(); //Only there to fill up a slot in the pendingCommands queue. while ( ftp.hasPendingCommands() ) QCoreApplication::instance()->processEvents(); @@ -192,11 +193,11 @@ bool atWrapper::setupFTP() QString dir = ""; ftpMkDir( ftpBaseDir ); - ftpBaseDir += "/" + QLibraryInfo::buildKey(); + ftpBaseDir += QLatin1Char('/') + QLibraryInfo::buildKey(); ftpMkDir( ftpBaseDir ); - ftpBaseDir += "/" + QString( qVersion() ); + ftpBaseDir += QLatin1Char('/') + QString( qVersion() ); ftpMkDir( ftpBaseDir ); @@ -209,9 +210,9 @@ bool atWrapper::setupFTP() { i.next(); //qDebug() << "Creating dir with key:" << i.key(); - ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".failed" ); - ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".diff" ); - if (!ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".baseline" )) + ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".failed" ); + ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".diff" ); + if (!ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".baseline" )) haveBaseline = false; } @@ -226,7 +227,7 @@ bool atWrapper::setupFTP() { j.next(); rmDirList.clear(); - rmDirList << ftpBaseDir + "/" + j.key() + ".failed" + "/"; + rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".failed/"; ftpRmDir( j.key() + ".failed" ); ftp.rmdir( j.key() + ".failed" ); ftp.mkdir( j.key() + ".failed" ); @@ -236,7 +237,7 @@ bool atWrapper::setupFTP() QCoreApplication::instance()->processEvents(); rmDirList.clear(); - rmDirList << ftpBaseDir + "/" + j.key() + ".diff" + "/"; + rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".diff/"; ftpRmDir( j.key() + ".diff" ); ftp.rmdir( j.key() + ".diff" ); ftp.mkdir( j.key() + ".diff" ); @@ -396,7 +397,7 @@ void atWrapper::createBaseline() for (int n = 0; n < list.size(); n++) { QFileInfo fileInfo = list.at( n ); - QFile file( QString( output ) + "/" + i.key() + "/" + fileInfo.fileName() ); + QFile file( QString( output ) + QLatin1Char('/') + i.key() + QLatin1Char('/') + fileInfo.fileName() ); file.open( QIODevice::ReadOnly ); QByteArray fileData = file.readAll(); //qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size(); @@ -470,9 +471,9 @@ bool atWrapper::diff( QString basedir, QString dir, QString target ) //Comparing the two specified files, and then uploading them to //the ftp server if they differ - basedir += "/" + dir; + basedir += QLatin1Char('/') + dir; QString one = basedir + ".baseline/" + target; - QString two = basedir + "/" + target; + QString two = basedir + QLatin1Char('/') + target; QFile file( one ); @@ -517,7 +518,7 @@ void atWrapper::uploadDiff( QString basedir, QString dir, QString filename ) qDebug() << basedir; QImage im1( basedir + ".baseline/" + filename ); - QImage im2( basedir + "/" + filename ); + QImage im2( basedir + QLatin1Char('/') + filename ); QImage im3(im1.size(), QImage::Format_ARGB32); @@ -591,16 +592,16 @@ bool atWrapper::loadConfig( QString path ) QDir::current().mkdir( output ); - output += "/" + QLibraryInfo::buildKey(); + output += QLatin1Char('/') + QLibraryInfo::buildKey(); QDir::current().mkdir( output ); - output += "/" + QString( qVersion() ); + output += QLatin1Char('/') + QString( qVersion() ); QDir::current().mkdir( output ); - ftpBaseDir += "/" + QHostInfo::localHostName().split( "." ).first(); + ftpBaseDir += QLatin1Char('/') + QHostInfo::localHostName().split( QLatin1Char('.') ).first(); /* diff --git a/tests/auto/other/compiler/compiler.pro b/tests/auto/other/compiler/compiler.pro index 356013c8f1..19f86582e9 100644 --- a/tests/auto/other/compiler/compiler.pro +++ b/tests/auto/other/compiler/compiler.pro @@ -7,4 +7,3 @@ contains(QT_CONFIG, c++11): CONFIG += c++11 contains(QT_CONFIG, c++14): CONFIG += c++14 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/gestures/gestures.pro b/tests/auto/other/gestures/gestures.pro index fa87dbddfb..3d0ef7c745 100644 --- a/tests/auto/other/gestures/gestures.pro +++ b/tests/auto/other/gestures/gestures.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_gestures QT += widgets testlib gui-private SOURCES += tst_gestures.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index 2a4f88c627..851edaeb19 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -36,6 +36,7 @@ #include <QtTest/qtesttouch.h> #include <qevent.h> +#include <qtouchdevice.h> #include <qwidget.h> #include <qlayout.h> #include <qgesture.h> diff --git a/tests/auto/other/lancelot/lancelot.pro b/tests/auto/other/lancelot/lancelot.pro index ef557691e3..6e79566649 100644 --- a/tests/auto/other/lancelot/lancelot.pro +++ b/tests/auto/other/lancelot/lancelot.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test CONFIG -= app_bundle TARGET = tst_lancelot QT += xml widgets testlib @@ -12,4 +11,3 @@ RESOURCES += images.qrc include($$PWD/../../../baselineserver/shared/qbaselinetest.pri) TESTDATA += scripts/* -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 4fc41fd649..15454b59d2 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -650,7 +650,7 @@ template <typename T> T PaintCommands::image_load(const QString &filepath) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(fi.fileName()); + QString fileName = dir.absolutePath() + QLatin1Char('/') + fi.fileName(); t = T(fileName); if (t.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -841,10 +841,11 @@ void PaintCommands::command_import(QRegExp re) qPrintable(fi.fileName())); QFileInfo fileinfo(*file); - m_commands[m_currentCommandIndex] = QString("# import file (%1) start").arg(fileinfo.fileName()); + m_commands[m_currentCommandIndex] = QLatin1String("# import file (") + fileinfo.fileName() + + QLatin1String(") start"); QString rawContent = QString::fromUtf8(file->readAll()); QStringList importedData = rawContent.split('\n', QString::SkipEmptyParts); - importedData.append(QString("# import file (%1) end ---").arg(fileinfo.fileName())); + importedData.append(QLatin1String("# import file (") + fileinfo.fileName() + QLatin1String(") end ---")); insertAt(m_currentCommandIndex, importedData); if (m_verboseMode) { @@ -862,13 +863,13 @@ void PaintCommands::command_begin_block(QRegExp re) if (m_verboseMode) printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); - m_commands[m_currentCommandIndex] = QString("# begin block (%1)").arg(blockName); + m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); QStringList newBlock; int i = m_currentCommandIndex + 1; for (; i < m_commands.count(); ++i) { const QString &nextCmd = m_commands.at(i); if (nextCmd.startsWith("end_block")) { - m_commands[i] = QString("# end block (%1)").arg(blockName); + m_commands[i] = QLatin1String("# end block (") + blockName + QLatin1Char(')'); break; } newBlock += nextCmd; @@ -905,7 +906,7 @@ void PaintCommands::command_repeat_block(QRegExp re) return; } - m_commands[m_currentCommandIndex] = QString("# repeated block (%1)").arg(blockName); + m_commands[m_currentCommandIndex] = QLatin1String("# repeated block (") + blockName + QLatin1Char(')'); insertAt(m_currentCommandIndex, block); } @@ -946,7 +947,7 @@ void PaintCommands::command_drawPixmap(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -995,7 +996,7 @@ void PaintCommands::command_drawImage(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); im = QImage(fileName); if (im.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -1041,7 +1042,7 @@ void PaintCommands::command_drawTiledPixmap(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); diff --git a/tests/auto/other/languagechange/languagechange.pro b/tests/auto/other/languagechange/languagechange.pro index 0b9c04d2ed..7dbd47f63d 100644 --- a/tests/auto/other/languagechange/languagechange.pro +++ b/tests/auto/other/languagechange/languagechange.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test win32:testcase.timeout = 1800 # test runtime varies greatly on Windows, QTBUG-26006 TARGET = tst_languagechange QT += widgets core-private gui-private testlib SOURCES += tst_languagechange.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp index 68d604547d..493e279e18 100644 --- a/tests/auto/other/languagechange/tst_languagechange.cpp +++ b/tests/auto/other/languagechange/tst_languagechange.cpp @@ -253,7 +253,7 @@ void tst_languageChange::retranslatability() switch (dialogType) { case InputDialog: stateMachine.start(); - QInputDialog::getInteger(0, QLatin1String("title"), QLatin1String("label")); + QInputDialog::getInt(0, QLatin1String("title"), QLatin1String("label")); break; case ColorDialog: diff --git a/tests/auto/other/macgui/macgui.pro b/tests/auto/other/macgui/macgui.pro index bf805ccd75..b557806555 100644 --- a/tests/auto/other/macgui/macgui.pro +++ b/tests/auto/other/macgui/macgui.pro @@ -7,4 +7,3 @@ HEADERS += guitest.h QT = core-private widgets-private testlib requires(mac) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/macnativeevents/qnativeevents.cpp b/tests/auto/other/macnativeevents/qnativeevents.cpp index 1402182042..db8f2bd193 100644 --- a/tests/auto/other/macnativeevents/qnativeevents.cpp +++ b/tests/auto/other/macnativeevents/qnativeevents.cpp @@ -222,46 +222,46 @@ QDebug operator<<(QDebug d, const QNativeEvent &e) QTextStream &operator<<(QTextStream &s, QNativeEvent *e) { - return s << e->eventId << " " << e->modifiers << " QNativeEvent"; + return s << e->eventId << ' ' << e->modifiers << " QNativeEvent"; } QTextStream &operator<<(QTextStream &s, QNativeMouseEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseMoveEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseButtonEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button - << " " << e->clickCount << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button + << ' ' << e->clickCount << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseDragEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button << " " << e->clickCount - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button << ' ' << e->clickCount + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseWheelEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->delta - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->delta + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeKeyEvent *e) { - return s << e->eventId << " " << e->press << " " << e->nativeKeyCode << " " << e->character - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->press << ' ' << e->nativeKeyCode << ' ' << e->character + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeModifierEvent *e) { - return s << e->eventId << " " << e->modifiers << " " << e->nativeKeyCode << " " << e->toString(); + return s << e->eventId << ' ' << e->modifiers << ' ' << e->nativeKeyCode << ' ' << e->toString(); } diff --git a/tests/auto/other/macplist/app/app.pro b/tests/auto/other/macplist/app/app.pro index c4dfedb104..9ccac831d0 100644 --- a/tests/auto/other/macplist/app/app.pro +++ b/tests/auto/other/macplist/app/app.pro @@ -1,4 +1,3 @@ QT += widgets SOURCES += main.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/macplist/test/test.pro b/tests/auto/other/macplist/test/test.pro index 6dad17ab67..5018abeca9 100644 --- a/tests/auto/other/macplist/test/test.pro +++ b/tests/auto/other/macplist/test/test.pro @@ -10,4 +10,3 @@ win32 { TARGET = ../../release/tst_macplist } } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/modeltest/dynamictreemodel.cpp b/tests/auto/other/modeltest/dynamictreemodel.cpp index c7cf04231f..bdf2b604fd 100644 --- a/tests/auto/other/modeltest/dynamictreemodel.cpp +++ b/tests/auto/other/modeltest/dynamictreemodel.cpp @@ -299,7 +299,8 @@ bool ModelResetCommand::emitPreSignal(const QModelIndex &srcParent, int srcStart void ModelResetCommand::emitPostSignal() { - m_model->reset(); + m_model->beginResetModel(); + m_model->endResetModel(); } ModelResetCommandFixed::ModelResetCommandFixed(DynamicTreeModel* model, QObject* parent) diff --git a/tests/auto/other/modeltest/modeltest.pro b/tests/auto/other/modeltest/modeltest.pro index 045299e095..8e96058449 100644 --- a/tests/auto/other/modeltest/modeltest.pro +++ b/tests/auto/other/modeltest/modeltest.pro @@ -3,7 +3,3 @@ TARGET = tst_modeltest QT += widgets testlib SOURCES += tst_modeltest.cpp modeltest.cpp dynamictreemodel.cpp HEADERS += modeltest.h dynamictreemodel.h - - - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/networkselftest/networkselftest.pro b/tests/auto/other/networkselftest/networkselftest.pro index 60b45e6b5e..7c307a097b 100644 --- a/tests/auto/other/networkselftest/networkselftest.pro +++ b/tests/auto/other/networkselftest/networkselftest.pro @@ -3,5 +3,3 @@ TARGET = tst_networkselftest SOURCES += tst_networkselftest.cpp QT = core core-private network testlib - -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 7ce385121c..257a7fc03d 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -986,8 +986,8 @@ void tst_NetworkSelfTest::smbServer() static const char contents[] = "This is 34 bytes. Do not change..."; #ifdef Q_OS_WIN // use Windows's native UNC support to try and open a file on the server - QString filepath = QString("\\\\%1\\testshare\\test.pri").arg(QtNetworkSettings::winServerName()); - FILE *f = fopen(filepath.toLatin1(), "rb"); + QByteArray filepath = "\\\\" + QtNetworkSettings::winServerName().toLatin1() + "\\testshare\\test.pri"; + FILE *f = fopen(filepath.constData(), "rb"); QVERIFY2(f, qt_error_string().toLocal8Bit()); char buf[128]; diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 1d6fc6bcd1..ef3b469ba1 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -21,4 +21,3 @@ win32 { LIBS += -luuid !winphone: LIBS += -loleacc -loleaut32 -lole32 } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 62c2c0a916..8fe4d976b3 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -573,7 +573,7 @@ static QWidget *createWidgets() int i = 0; box->addWidget(new QComboBox(w)); - box->addWidget(new QPushButton(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QPushButton(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QHeaderView(Qt::Vertical, w)); box->addWidget(new QTreeView(w)); box->addWidget(new QTreeWidget(w)); @@ -583,25 +583,25 @@ static QWidget *createWidgets() box->addWidget(new QTableWidget(w)); box->addWidget(new QCalendarWidget(w)); box->addWidget(new QDialogButtonBox(w)); - box->addWidget(new QGroupBox(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QGroupBox(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QFrame(w)); - box->addWidget(new QLineEdit(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLineEdit(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QProgressBar(w)); box->addWidget(new QTabWidget(w)); - box->addWidget(new QCheckBox(QString::fromLatin1("widget text %1").arg(i++), w)); - box->addWidget(new QRadioButton(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QCheckBox(QLatin1String("widget text ") + QString::number(i++), w)); + box->addWidget(new QRadioButton(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QDial(w)); box->addWidget(new QScrollBar(w)); box->addWidget(new QSlider(w)); box->addWidget(new QDateTimeEdit(w)); box->addWidget(new QDoubleSpinBox(w)); box->addWidget(new QSpinBox(w)); - box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLabel(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QLCDNumber(w)); box->addWidget(new QStackedWidget(w)); box->addWidget(new QToolBox(w)); - box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w)); - box->addWidget(new QTextEdit(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLabel(QLatin1String("widget text ") + QString::number(i++), w)); + box->addWidget(new QTextEdit(QLatin1String("widget text ") + QString::number(i++), w)); /* Not in the list * QAbstractItemView, QGraphicsView, QScrollArea, @@ -1763,7 +1763,7 @@ void tst_QAccessibility::textEditTest() } edit.show(); - QTest::qWaitForWindowShown(&edit); + QTest::qWaitForWindowExposed(&edit); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&edit); QCOMPARE(iface->text(QAccessible::Value), edit.toPlainText()); QVERIFY(iface->state().focusable); @@ -2175,7 +2175,7 @@ void tst_QAccessibility::lineEditTest() QLineEdit le(QStringLiteral("My characters have geometries."), toplevel); // characterRect() le.show(); - QTest::qWaitForWindowShown(&le); + QTest::qWaitForWindowExposed(&le); QAccessibleInterface *iface(QAccessible::queryAccessibleInterface(&le)); QAccessibleTextInterface* textIface = iface->textInterface(); QVERIFY(textIface); @@ -2322,9 +2322,13 @@ void tst_QAccessibility::lineEditTextFunctions_data() QTest::newRow("char after 6") << "hello" << 2 << (int) QAccessible::CharBoundary << 3 << 6 << -1 << -1 << ""; for (int i = -2; i < 6; ++i) { - QTest::newRow(QString::fromLatin1("line before %1").arg(i).toLocal8Bit().constData()) << "hello" << 0 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; - QTest::newRow(QString::fromLatin1("line at %1").arg(i).toLocal8Bit().constData()) << "hello" << 1 << (int) QAccessible::LineBoundary << 3 << i << 0 << 5 << "hello"; - QTest::newRow(QString::fromLatin1("line after %1").arg(i).toLocal8Bit().constData()) << "hello" << 2 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("line before " + iB).constData()) + << "hello" << 0 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; + QTest::newRow(("line at " + iB).constData()) + << "hello" << 1 << (int) QAccessible::LineBoundary << 3 << i << 0 << 5 << "hello"; + QTest::newRow(("line after " + iB).constData()) + << "hello" << 2 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; } } @@ -3576,7 +3580,7 @@ void tst_QAccessibility::comboBoxTest() // Fully decorated windows have a minimum width of 160 on Windows. combo.setMinimumWidth(200); combo.show(); - QVERIFY(QTest::qWaitForWindowShown(&combo)); + QVERIFY(QTest::qWaitForWindowExposed(&combo)); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&combo); QCOMPARE(verifyHierarchy(iface), 0); diff --git a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro index 5d81567f45..ceed81c914 100644 --- a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro +++ b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro @@ -13,4 +13,3 @@ mac { requires(mac) -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm index 65dbff4f92..b16c4c0d9c 100644 --- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm +++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm @@ -42,7 +42,7 @@ #include <QtTest> #include <unistd.h> -#import <Cocoa/Cocoa.h> +#import <AppKit/AppKit.h> #import <ApplicationServices/ApplicationServices.h> QT_USE_NAMESPACE diff --git a/tests/auto/other/qcomplextext/qcomplextext.pro b/tests/auto/other/qcomplextext/qcomplextext.pro index 28acc397bf..98dbd3b214 100644 --- a/tests/auto/other/qcomplextext/qcomplextext.pro +++ b/tests/auto/other/qcomplextext/qcomplextext.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qcomplextext QT += testlib QT += core-private gui-private SOURCES += tst_qcomplextext.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qfocusevent/qfocusevent.pro b/tests/auto/other/qfocusevent/qfocusevent.pro index c6e31d2e50..5f799291c6 100644 --- a/tests/auto/other/qfocusevent/qfocusevent.pro +++ b/tests/auto/other/qfocusevent/qfocusevent.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qfocusevent QT += widgets testlib SOURCES += tst_qfocusevent.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro index e34990d513..b03a448dfb 100644 --- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro +++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro @@ -1,6 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qnetworkaccessmanager_and_qprogressdialog SOURCES += tst_qnetworkaccessmanager_and_qprogressdialog.cpp QT += network widgets testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qobjectperformance/qobjectperformance.pro b/tests/auto/other/qobjectperformance/qobjectperformance.pro index 78423bee9c..189f8eeb2a 100644 --- a/tests/auto/other/qobjectperformance/qobjectperformance.pro +++ b/tests/auto/other/qobjectperformance/qobjectperformance.pro @@ -5,4 +5,3 @@ SOURCES += tst_qobjectperformance.cpp QT = core network testlib -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qobjectrace/qobjectrace.pro b/tests/auto/other/qobjectrace/qobjectrace.pro index b5848edb01..94e7928585 100644 --- a/tests/auto/other/qobjectrace/qobjectrace.pro +++ b/tests/auto/other/qobjectrace/qobjectrace.pro @@ -2,6 +2,3 @@ CONFIG += testcase SOURCES += tst_qobjectrace.cpp QT = core testlib -TARGET.EPOCHEAPSIZE = 20000000 40000000 -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qprocess_and_guieventloop/test.pro b/tests/auto/other/qprocess_and_guieventloop/test.pro index 54d6f194b0..50c4e1d72b 100644 --- a/tests/auto/other/qprocess_and_guieventloop/test.pro +++ b/tests/auto/other/qprocess_and_guieventloop/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test QT = core gui testlib SOURCES = tst_qprocess_and_guieventloop.cpp TARGET = tst_qprocess_and_guieventloop diff --git a/tests/auto/other/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro b/tests/auto/other/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro index c7a4f3e216..722f575f80 100644 --- a/tests/auto/other/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro +++ b/tests/auto/other/qsharedpointer_and_qwidget/qsharedpointer_and_qwidget.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsharedpointer_and_qwidget QT += widgets testlib SOURCES += tst_qsharedpointer_and_qwidget.cpp DEFINES += SRCDIR=\\\"$$PWD/\\\" -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qtokenautomaton/qtokenautomaton.pro b/tests/auto/other/qtokenautomaton/qtokenautomaton.pro index 2c0b3dae9b..e4d0160f80 100644 --- a/tests/auto/other/qtokenautomaton/qtokenautomaton.pro +++ b/tests/auto/other/qtokenautomaton/qtokenautomaton.pro @@ -16,5 +16,3 @@ HEADERS += tokenizers/basic/basic.h \ tokenizers/withNamespace/withNamespace.h QT = core testlib -CONFIG += parallel_test -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/qvariant_common/tst_qvariant_common.h b/tests/auto/other/qvariant_common/tst_qvariant_common.h index 79a5707de8..6a7c125089 100644 --- a/tests/auto/other/qvariant_common/tst_qvariant_common.h +++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h @@ -72,7 +72,7 @@ protected: currentName.chop(1); ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0")); } - ok &= msg.endsWith(")"); + ok &= msg.endsWith(QLatin1Char(')')); QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData()); } diff --git a/tests/auto/other/toolsupport/toolsupport.pro b/tests/auto/other/toolsupport/toolsupport.pro index 274ead2c35..7603dea79e 100644 --- a/tests/auto/other/toolsupport/toolsupport.pro +++ b/tests/auto/other/toolsupport/toolsupport.pro @@ -1,4 +1,4 @@ -CONFIG += testcase parallel_test +CONFIG += testcase TARGET = tst_toolsupport QT = testlib core-private SOURCES = $$PWD/tst_toolsupport.cpp diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp index bbd787bf38..a5b85ef221 100644 --- a/tests/auto/other/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp @@ -29,6 +29,16 @@ #include <QtTest> +// +// Note: +// +// When this test here fails and the change leading to the failure +// intentionally changed a private class, adjust the test here and bump +// the TypeInformationVersion field in src/corelib/global/qhooks.cpp +// in the same commit as the modification to the private class. +// + + // Don't do this at home. This is test code, not production. #define protected public #define private public diff --git a/tests/auto/other/windowsmobile/test/test.pro b/tests/auto/other/windowsmobile/test/test.pro index 5f744c2acb..36dd15f60e 100644 --- a/tests/auto/other/windowsmobile/test/test.pro +++ b/tests/auto/other/windowsmobile/test/test.pro @@ -1,6 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib HEADERS += ddhelper.h SOURCES += tst_windowsmobile.cpp ddhelper.cpp @@ -22,4 +21,3 @@ wincewm*: { -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro b/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro index 2e9ae33592..b867610009 100644 --- a/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro +++ b/tests/auto/printsupport/dialogs/qabstractprintdialog/qabstractprintdialog.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractprintdialog QT += widgets printsupport testlib SOURCES += tst_qabstractprintdialog.cpp diff --git a/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro b/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro index fb11b0361e..56c1b60d94 100644 --- a/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro +++ b/tests/auto/printsupport/kernel/qprintdevice/qprintdevice.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qprintdevice SOURCES += tst_qprintdevice.cpp QT += printsupport-private network testlib DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/printsupport/kernel/qprinter/qprinter.pro b/tests/auto/printsupport/kernel/qprinter/qprinter.pro index 9fc6ed13fc..462929c153 100644 --- a/tests/auto/printsupport/kernel/qprinter/qprinter.pro +++ b/tests/auto/printsupport/kernel/qprinter/qprinter.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qprinter QT += printsupport widgets testlib SOURCES += tst_qprinter.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro b/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro index 6dcf50a838..f397f48bb8 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro +++ b/tests/auto/printsupport/kernel/qprinterinfo/qprinterinfo.pro @@ -1,9 +1,7 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qprinterinfo SOURCES += tst_qprinterinfo.cpp QT += printsupport network testlib DEFINES += QT_USE_USING_NAMESPACE -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/shared/resources/testfont.ttf b/tests/auto/shared/resources/testfont.ttf Binary files differindex d6042d2e58..93b728c776 100644 --- a/tests/auto/shared/resources/testfont.ttf +++ b/tests/auto/shared/resources/testfont.ttf diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro index 03918f5d3d..71e2989572 100644 --- a/tests/auto/sql/kernel/qsql/qsql.pro +++ b/tests/auto/sql/kernel/qsql/qsql.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsql SOURCES += tst_qsql.cpp diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index fe8a3689b0..3ba4833dd5 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -119,7 +119,7 @@ inline static QString qTableName(const QString& prefix, QSqlDatabase db) QString tableStr; if (db.driverName().toLower().contains("ODBC")) tableStr += QLatin1String("_odbc"); - return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + "_" + + return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + QLatin1Char('_') + qGetHostName(), QSqlDriver::TableName)),db); } @@ -219,12 +219,12 @@ public: } // construct a stupid unique name - QString cName = QString::number( counter++ ) + "_" + driver + "@"; + QString cName = QString::number( counter++ ) + QLatin1Char('_') + driver + QLatin1Char('@'); cName += host.isEmpty() ? dbName : host; if ( port > 0 ) - cName += ":" + QString::number( port ); + cName += QLatin1Char(':') + QString::number( port ); db = QSqlDatabase::addDatabase( driver, cName ); @@ -364,7 +364,7 @@ public: // for debugging only: outputs the connection as string static QString dbToString( const QSqlDatabase db ) { - QString res = db.driverName() + "@"; + QString res = db.driverName() + QLatin1Char('@'); if ( db.driverName().startsWith( "QODBC" ) || db.driverName().startsWith( "QOCI" ) ) { res += db.databaseName(); @@ -373,7 +373,7 @@ public: } if ( db.port() > 0 ) { - res += ":" + QString::number( db.port() ); + res += QLatin1Char(':') + QString::number( db.port() ); } return res; @@ -522,7 +522,7 @@ public: result += '\''; if(!err.driverText().isEmpty()) result += err.driverText() + "' || '"; - result += err.databaseText() + "'"; + result += err.databaseText() + QLatin1Char('\''); return result.toLocal8Bit(); } @@ -534,7 +534,7 @@ public: result += '\''; if(!err.driverText().isEmpty()) result += err.driverText() + "' || '"; - result += err.databaseText() + "'"; + result += err.databaseText() + QLatin1Char('\''); return result.toLocal8Bit(); } diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 83cf0394f9..5738f20f15 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -217,7 +217,7 @@ struct FieldDef { { QString rt = typeName; rt.replace(QRegExp("\\s"), QString("_")); - int i = rt.indexOf("("); + int i = rt.indexOf(QLatin1Char('(')); if (i == -1) i = rt.length(); if (i > 20) diff --git a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro index 5633840635..8bfe1da1ce 100644 --- a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro +++ b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqldriver SOURCES += tst_qsqldriver.cpp diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 2f48b65e74..5273632138 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -79,7 +79,7 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) tst_Databases::safeDropTable( db, relTEST1 ); QString doubleField = (dbType == QSqlDriver::SQLite) ? "more_data double" : "more_data double(8,7)"; QVERIFY_SQL( q, exec("create table " + relTEST1 + - " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + ")")); + " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + QLatin1Char(')'))); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2, 1.234567)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1, 8.901234)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2, 5.678901)")); diff --git a/tests/auto/sql/kernel/qsqlerror/qsqlerror.pro b/tests/auto/sql/kernel/qsqlerror/qsqlerror.pro index c217e27645..ef0d213dba 100644 --- a/tests/auto/sql/kernel/qsqlerror/qsqlerror.pro +++ b/tests/auto/sql/kernel/qsqlerror/qsqlerror.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqlerror QT = core sql testlib diff --git a/tests/auto/sql/kernel/qsqlfield/qsqlfield.pro b/tests/auto/sql/kernel/qsqlfield/qsqlfield.pro index 6b74041a17..5e0f4afe4c 100644 --- a/tests/auto/sql/kernel/qsqlfield/qsqlfield.pro +++ b/tests/auto/sql/kernel/qsqlfield/qsqlfield.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqlfield SOURCES += tst_qsqlfield.cpp diff --git a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp index b77e1fe9ef..1d31f921f0 100644 --- a/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp +++ b/tests/auto/sql/kernel/qsqlfield/tst_qsqlfield.cpp @@ -201,9 +201,9 @@ void tst_QSqlField::name() { QSqlField field( "test", QVariant::String ); QFETCH( QString, val ); - QVERIFY( field.name() == "test" ); + QCOMPARE(field.name(), QLatin1String("test")); field.setName( val ); - QVERIFY( field.name() == val ); + QCOMPARE(field.name(), val); } void tst_QSqlField::operator_Assign() @@ -253,9 +253,9 @@ void tst_QSqlField::setName() { QSqlField field( "test", QVariant::String ); QFETCH( QString, val ); - QVERIFY( field.name() == "test" ); + QCOMPARE(field.name(), QLatin1String("test")); field.setName( val ); - QVERIFY( field.name() == val ); + QCOMPARE(field.name(), val); } void tst_QSqlField::setNull() @@ -273,16 +273,16 @@ void tst_QSqlField::setReadOnly() field.setValue( "test" ); field.setReadOnly( true ); field.setValue( "Harry" ); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); field.clear(); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); QVERIFY( !field.isNull() ); field.clear(); - QVERIFY( field.value() == "test" ); + QCOMPARE(field.value().toString(), QLatin1String("test")); QVERIFY( !field.isNull() ); field.setReadOnly( false ); field.setValue( "Harry" ); - QVERIFY( field.value() == "Harry" ); + QCOMPARE(field.value().toString(), QLatin1String("Harry")); field.clear(); QVERIFY( field.value() == QVariant().toString() ); QVERIFY( field.isNull() ); diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index b98ab68ae9..6311e4c480 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -959,14 +959,14 @@ void tst_QSqlQuery::value() if (dbType == QSqlDriver::Interbase) QVERIFY( q.value( 1 ).toString().startsWith( "VarChar" + QString::number( i ) ) ); - else if ( q.value( 1 ).toString().right( 1 ) == " " ) + else if ( q.value( 1 ).toString().endsWith(QLatin1Char(' '))) QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) + " " ) ); else QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) ) ); if (dbType == QSqlDriver::Interbase) QVERIFY( q.value( 2 ).toString().startsWith( "Char" + QString::number( i ) ) ); - else if ( q.value( 2 ).toString().right( 1 ) != " " ) + else if (!q.value( 2 ).toString().endsWith(QLatin1Char(' '))) QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) ) ); else QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) + " " ) ); @@ -3145,7 +3145,7 @@ void tst_QSqlQuery::sqlServerReturn0() "SELECT * FROM "+tableName+" WHERE ID = 2 " "RETURN 0")); - QVERIFY_SQL(q, exec("{CALL "+procName+"}")); + QVERIFY_SQL(q, exec("{CALL " + procName + QLatin1Char('}'))); QVERIFY_SQL(q, next()); } @@ -3162,7 +3162,7 @@ void tst_QSqlQuery::QTBUG_551() TYPE IntType IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;\n\ TYPE VCType IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType);\n\ - END "+pkgname+";")); + END "+ pkgname + QLatin1Char(';'))); QVERIFY_SQL(q, exec("CREATE OR REPLACE PACKAGE BODY "+pkgname+" IS\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType)\n\ @@ -3172,7 +3172,7 @@ void tst_QSqlQuery::QTBUG_551() Outp(2) := '2. Value is ' ||TO_CHAR(Inp(2));\n\ Outp(3) := '3. Value is ' ||TO_CHAR(Inp(3));\n\ END p;\n\ - END "+pkgname+";")); + END " + pkgname + QLatin1Char(';'))); QVariantList inLst, outLst, res_outLst; @@ -3310,7 +3310,7 @@ void tst_QSqlQuery::QTBUG_6421() QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)")); QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)")); q.setForwardOnly(true); - QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='"+tableName+"'")); + QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='" + tableName + QLatin1Char('\''))); QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\"")); QVERIFY_SQL(q, next()); @@ -3338,7 +3338,7 @@ void tst_QSqlQuery::QTBUG_6618() "begin\n" " raiserror('" + errorString + "', 16, 1)\n" "end\n" )); - q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + "}"); + q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + QLatin1Char('}')); QVERIFY(q.lastError().text().contains(errorString)); } @@ -3430,7 +3430,7 @@ void tst_QSqlQuery::QTBUG_21884() QStringList stList; QString tableName(qTableName("bug21884", __FILE__, db)); stList << "create table " + tableName + "(id integer primary key, note string)"; - stList << "select * from " + tableName + ";"; + stList << "select * from " + tableName + QLatin1Char(';'); stList << "select * from " + tableName + "; \t\n\r"; stList << "drop table " + tableName; @@ -3984,7 +3984,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const { QSqlQuery q(db); QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName)); - QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ")")); + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ')')); const int steps = 20; const T increment = max / steps - min / steps; @@ -4001,7 +4001,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const q.bindValue(0, v); QVERIFY_SQL(q, exec()); } else { - QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + ")")); + QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + QLatin1Char(')'))); } values[i] = v; v += increment; diff --git a/tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro b/tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro index 0e92797bb0..ee17b5f249 100644 --- a/tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/sql/kernel/qsqlrecord/qsqlrecord.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqlrecord SOURCES += tst_qsqlrecord.cpp diff --git a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp index 8a90f16dce..722a391c13 100644 --- a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp +++ b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp @@ -484,7 +484,7 @@ void tst_QSqlRecord::setValue() QVERIFY( rec2.value( 3 ) == QVariant(bval) ); rec2.setValue( "string", "__Harry__" ); - QVERIFY( rec2.value( 0 ) == "__Harry__" ); + QCOMPARE(rec2.value(0).toString(), QLatin1String("__Harry__")); for ( i = 0; i < 4; ++i ) QVERIFY( !rec2.isNull( i ) ); @@ -501,7 +501,7 @@ void tst_QSqlRecord::value() QSqlRecord rec2; rec2.append( QSqlField( "string", QVariant::String ) ); rec2.setValue( "string", "Harry" ); - QVERIFY( rec2.value( "string" ) == "Harry" ); + QCOMPARE(rec2.value("string").toString(), QLatin1String("Harry")); } QTEST_MAIN(tst_QSqlRecord) diff --git a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro index bc627e0724..2576fbad71 100644 --- a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqlquerymodel SOURCES += tst_qsqlquerymodel.cpp diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index 5ce1b5694c..cade7c171d 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqlrelationaltablemodel SOURCES += tst_qsqlrelationaltablemodel.cpp diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 3702631275..fbc583f341 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -1115,7 +1115,7 @@ void tst_QSqlRelationalTableModel::casing() QCOMPARE( rec.count(), 0); //try an owner that does exist - rec = db.driver()->record(db.userName() + "." + qTableName("CASETEST1", db).toUpper()); + rec = db.driver()->record(db.userName() + QLatin1Char('.') + qTableName("CASETEST1", db).toUpper()); QCOMPARE( rec.count(), 4); } QSqlRecord rec = db.driver()->record(qTableName("CASETEST1", db).toUpper()); @@ -1464,13 +1464,13 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() QSqlQuery q(db); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373", __FILE__, db))); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373_s2", __FILE__, db))); - QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db) + + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db) + "(document_id int primary key, relatingid int, userid int)")); - QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db) + + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db) + "(userid int primary key, username char(40))")); - model.setTable(qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db)); - model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); - model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); + model.setTable(qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db)); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username")); + model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username")); QVERIFY_SQL(model, select()); model.setJoinMode(QSqlRelationalTableModel::LeftJoin); @@ -1515,14 +1515,14 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn() //prepare test1 table QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + testTable1 + " (val1 INTEGER, id1 INTEGER PRIMARY KEY);")); - QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + ";")); + QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + QLatin1Char(';'))); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(1, 10);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(2, 20);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(3, 30);")); //prepare test2 table QVERIFY_SQL(q, exec("CREATE TABLE " + testTable2 + " (id INTEGER PRIMARY KEY, name TEXT);")); - QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + ";")); + QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + QLatin1Char(';'))); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (10, 'Hervanta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (20, 'Keskusta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (30, 'Annala');")); diff --git a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro index fedb41ba1d..2af39b341f 100644 --- a/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/sql/models/qsqltablemodel/qsqltablemodel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsqltablemodel SOURCES += tst_qsqltablemodel.cpp diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 2ace79973b..fff9811e60 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -1987,7 +1987,7 @@ void tst_QSqlTableModel::tableModifyWithBlank() //set a filter on the table so the only record we get is the one we just made //I could just do another setData command, but I want to make sure the TableModel //matches exactly what is stored in the database - model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row + model.setFilter("column1='" + timeString + QLatin1Char('\'')); //filter to get just the newly entered row QVERIFY_SQL(model, select()); //Make sure we only get one record, and that it is the one we just made diff --git a/tests/auto/testlib/qsignalspy/qsignalspy.pro b/tests/auto/testlib/qsignalspy/qsignalspy.pro index 72ae3a5009..1578802bf8 100644 --- a/tests/auto/testlib/qsignalspy/qsignalspy.pro +++ b/tests/auto/testlib/qsignalspy/qsignalspy.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qsignalspy SOURCES += tst_qsignalspy.cpp QT = core testlib -CONFIG += parallel_test diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 6446fec510..8b95771c1d 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -123,9 +123,14 @@ class tst_Cmptest: public QObject { Q_OBJECT +public: + enum class MyClassEnum { MyClassEnumValue1, MyClassEnumValue2 }; + Q_ENUM(MyClassEnum) + private slots: void compare_unregistered_enums(); void compare_registered_enums(); + void compare_class_enums(); void compare_boolfuncs(); void compare_pointerfuncs(); void compare_tostring(); @@ -160,6 +165,12 @@ void tst_Cmptest::compare_registered_enums() QCOMPARE(Qt::ArrowCursor, Qt::BusyCursor); } +void tst_Cmptest::compare_class_enums() +{ + QCOMPARE(MyClassEnum::MyClassEnumValue1, MyClassEnum::MyClassEnumValue1); + QCOMPARE(MyClassEnum::MyClassEnumValue1, MyClassEnum::MyClassEnumValue2); +} + static bool boolfunc() { return true; } static bool boolfunc2() { return true; } diff --git a/tests/auto/testlib/selftests/expected_cmptest.lightxml b/tests/auto/testlib/selftests/expected_cmptest.lightxml index 36929cec6b..1719d2a79d 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.lightxml +++ b/tests/auto/testlib/selftests/expected_cmptest.lightxml @@ -8,19 +8,27 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_unregistered_enums"> -<Incident type="fail" file="tst_cmptest.cpp" line="154"> +<Incident type="fail" file="tst_cmptest.cpp" line="159"> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_registered_enums"> -<Incident type="fail" file="tst_cmptest.cpp" line="160"> +<Incident type="fail" file="tst_cmptest.cpp" line="165"> <Description><![CDATA[Compared values are not the same Actual (Qt::ArrowCursor): ArrowCursor Expected (Qt::BusyCursor) : BusyCursor]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> +<TestFunction name="compare_class_enums"> +<Incident type="fail" file="tst_cmptest.cpp" line="171"> + <Description><![CDATA[Compared values are not the same + Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 + Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compare_boolfuncs"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> @@ -30,7 +38,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_tostring"> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[int, string]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(int,123) @@ -39,19 +47,19 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both invalid]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[null hash, invalid]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(QVariantHash) Expected (expected): QVariant()]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[string, null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass)]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[both non-null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(PhonyClass,<value not representable as string>) @@ -66,31 +74,31 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal lists]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[last item different]]></DataTag> <Description><![CDATA[Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS"]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[second-last item different]]></DataTag> <Description><![CDATA[Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS"]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[prefix]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[short list second]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[short list first]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 1 @@ -99,7 +107,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compareQListInt"> -<Incident type="fail" file="tst_cmptest.cpp" line="332"> +<Incident type="fail" file="tst_cmptest.cpp" line="343"> <Description><![CDATA[Compared lists differ at index 2. Actual (int1): 3 Expected (int2): 4]]></Description> @@ -107,7 +115,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compareQListDouble"> -<Incident type="fail" file="tst_cmptest.cpp" line="339"> +<Incident type="fail" file="tst_cmptest.cpp" line="350"> <Description><![CDATA[Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1]]></Description> @@ -118,13 +126,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both null]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[one null]]></DataTag> <Description><![CDATA[Compared QPixmaps differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[other null]]></DataTag> <Description><![CDATA[Compared QPixmaps differ. Actual (opA).isNull(): 0 @@ -133,13 +141,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[different size]]></DataTag> <Description><![CDATA[Compared QPixmaps differ in size. Actual (opA): 11x20 Expected (opB): 20x20]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[different pixels]]></DataTag> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> @@ -149,13 +157,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both null]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[one null]]></DataTag> <Description><![CDATA[Compared QImages differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[other null]]></DataTag> <Description><![CDATA[Compared QImages differ. Actual (opA).isNull(): 0 @@ -164,44 +172,44 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different size]]></DataTag> <Description><![CDATA[Compared QImages differ in size. Actual (opA): 11x20 Expected (opB): 20x20]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different format]]></DataTag> <Description><![CDATA[Compared QImages differ in format. Actual (opA): 6 Expected (opB): 3]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different pixels]]></DataTag> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="verify"> -<Incident type="fail" file="tst_cmptest.cpp" line="404"> +<Incident type="fail" file="tst_cmptest.cpp" line="415"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="verify2"> -<Incident type="fail" file="tst_cmptest.cpp" line="410"> +<Incident type="fail" file="tst_cmptest.cpp" line="421"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="tryVerify"> -<Incident type="fail" file="tst_cmptest.cpp" line="416"> +<Incident type="fail" file="tst_cmptest.cpp" line="427"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="tryVerify2"> -<Incident type="fail" file="tst_cmptest.cpp" line="422"> +<Incident type="fail" file="tst_cmptest.cpp" line="433"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description> </Incident> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_cmptest.txt b/tests/auto/testlib/selftests/expected_cmptest.txt index 70c54704f9..d4e50faaf0 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.txt +++ b/tests/auto/testlib/selftests/expected_cmptest.txt @@ -2,104 +2,108 @@ Config: Using QtTest library PASS : tst_Cmptest::initTestCase() FAIL! : tst_Cmptest::compare_unregistered_enums() Compared values are not the same - Loc: [tst_cmptest.cpp(154)] + Loc: [tst_cmptest.cpp(159)] FAIL! : tst_Cmptest::compare_registered_enums() Compared values are not the same Actual (Qt::ArrowCursor): ArrowCursor Expected (Qt::BusyCursor) : BusyCursor - Loc: [tst_cmptest.cpp(160)] + Loc: [tst_cmptest.cpp(165)] +FAIL! : tst_Cmptest::compare_class_enums() Compared values are not the same + Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 + Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2 + Loc: [tst_cmptest.cpp(171)] PASS : tst_Cmptest::compare_boolfuncs() PASS : tst_Cmptest::compare_pointerfuncs() FAIL! : tst_Cmptest::compare_tostring(int, string) Compared values are not the same Actual (actual) : QVariant(int,123) Expected (expected): QVariant(QString,hi) - Loc: [tst_cmptest.cpp(231)] + Loc: [tst_cmptest.cpp(242)] PASS : tst_Cmptest::compare_tostring(both invalid) FAIL! : tst_Cmptest::compare_tostring(null hash, invalid) Compared values are not the same Actual (actual) : QVariant(QVariantHash) Expected (expected): QVariant() - Loc: [tst_cmptest.cpp(231)] + Loc: [tst_cmptest.cpp(242)] FAIL! : tst_Cmptest::compare_tostring(string, null user type) Compared values are not the same Actual (actual) : QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass) - Loc: [tst_cmptest.cpp(231)] + Loc: [tst_cmptest.cpp(242)] FAIL! : tst_Cmptest::compare_tostring(both non-null user type) Compared values are not the same Actual (actual) : QVariant(PhonyClass,<value not representable as string>) Expected (expected): QVariant(PhonyClass,<value not representable as string>) - Loc: [tst_cmptest.cpp(231)] + Loc: [tst_cmptest.cpp(242)] PASS : tst_Cmptest::compareQStringLists(empty lists) PASS : tst_Cmptest::compareQStringLists(equal lists) FAIL! : tst_Cmptest::compareQStringLists(last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(325)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(second-last item different) Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS" - Loc: [tst_cmptest.cpp(325)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(prefix) Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(325)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(short list second) Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1 - Loc: [tst_cmptest.cpp(325)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQStringLists(short list first) Compared lists have different sizes. Actual (opA) size: 1 Expected (opB) size: 12 - Loc: [tst_cmptest.cpp(325)] + Loc: [tst_cmptest.cpp(336)] FAIL! : tst_Cmptest::compareQListInt() Compared lists differ at index 2. Actual (int1): 3 Expected (int2): 4 - Loc: [tst_cmptest.cpp(332)] + Loc: [tst_cmptest.cpp(343)] FAIL! : tst_Cmptest::compareQListDouble() Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1 - Loc: [tst_cmptest.cpp(339)] + Loc: [tst_cmptest.cpp(350)] PASS : tst_Cmptest::compareQPixmaps(both null) FAIL! : tst_Cmptest::compareQPixmaps(one null) Compared QPixmaps differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(365)] + Loc: [tst_cmptest.cpp(376)] FAIL! : tst_Cmptest::compareQPixmaps(other null) Compared QPixmaps differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(365)] + Loc: [tst_cmptest.cpp(376)] PASS : tst_Cmptest::compareQPixmaps(equal) FAIL! : tst_Cmptest::compareQPixmaps(different size) Compared QPixmaps differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(365)] + Loc: [tst_cmptest.cpp(376)] FAIL! : tst_Cmptest::compareQPixmaps(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(365)] + Loc: [tst_cmptest.cpp(376)] PASS : tst_Cmptest::compareQImages(both null) FAIL! : tst_Cmptest::compareQImages(one null) Compared QImages differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0 - Loc: [tst_cmptest.cpp(392)] + Loc: [tst_cmptest.cpp(403)] FAIL! : tst_Cmptest::compareQImages(other null) Compared QImages differ. Actual (opA).isNull(): 0 Expected (opB).isNull(): 1 - Loc: [tst_cmptest.cpp(392)] + Loc: [tst_cmptest.cpp(403)] PASS : tst_Cmptest::compareQImages(equal) FAIL! : tst_Cmptest::compareQImages(different size) Compared QImages differ in size. Actual (opA): 11x20 Expected (opB): 20x20 - Loc: [tst_cmptest.cpp(392)] + Loc: [tst_cmptest.cpp(403)] FAIL! : tst_Cmptest::compareQImages(different format) Compared QImages differ in format. Actual (opA): 6 Expected (opB): 3 - Loc: [tst_cmptest.cpp(392)] + Loc: [tst_cmptest.cpp(403)] FAIL! : tst_Cmptest::compareQImages(different pixels) Compared values are not the same - Loc: [tst_cmptest.cpp(392)] + Loc: [tst_cmptest.cpp(403)] FAIL! : tst_Cmptest::verify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(404)] + Loc: [tst_cmptest.cpp(415)] FAIL! : tst_Cmptest::verify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(410)] + Loc: [tst_cmptest.cpp(421)] FAIL! : tst_Cmptest::tryVerify() 'opaqueFunc() < 2' returned FALSE. () - Loc: [tst_cmptest.cpp(416)] + Loc: [tst_cmptest.cpp(427)] FAIL! : tst_Cmptest::tryVerify2() 'opaqueFunc() < 2' returned FALSE. (42) - Loc: [tst_cmptest.cpp(422)] + Loc: [tst_cmptest.cpp(433)] PASS : tst_Cmptest::cleanupTestCase() -Totals: 11 passed, 26 failed, 0 skipped, 0 blacklisted +Totals: 11 passed, 27 failed, 0 skipped, 0 blacklisted ********* Finished testing of tst_Cmptest ********* diff --git a/tests/auto/testlib/selftests/expected_cmptest.xml b/tests/auto/testlib/selftests/expected_cmptest.xml index 9437e8e4b7..d9a68e0bd1 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xml +++ b/tests/auto/testlib/selftests/expected_cmptest.xml @@ -10,19 +10,27 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_unregistered_enums"> -<Incident type="fail" file="tst_cmptest.cpp" line="154"> +<Incident type="fail" file="tst_cmptest.cpp" line="159"> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_registered_enums"> -<Incident type="fail" file="tst_cmptest.cpp" line="160"> +<Incident type="fail" file="tst_cmptest.cpp" line="165"> <Description><![CDATA[Compared values are not the same Actual (Qt::ArrowCursor): ArrowCursor Expected (Qt::BusyCursor) : BusyCursor]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> +<TestFunction name="compare_class_enums"> +<Incident type="fail" file="tst_cmptest.cpp" line="171"> + <Description><![CDATA[Compared values are not the same + Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 + Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2]]></Description> +</Incident> + <Duration msecs="0"/> +</TestFunction> <TestFunction name="compare_boolfuncs"> <Incident type="pass" file="" line="0" /> <Duration msecs="0"/> @@ -32,7 +40,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compare_tostring"> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[int, string]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(int,123) @@ -41,19 +49,19 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both invalid]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[null hash, invalid]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(QVariantHash) Expected (expected): QVariant()]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[string, null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(QString,A simple string) Expected (expected): QVariant(PhonyClass)]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="231"> +<Incident type="fail" file="tst_cmptest.cpp" line="242"> <DataTag><![CDATA[both non-null user type]]></DataTag> <Description><![CDATA[Compared values are not the same Actual (actual) : QVariant(PhonyClass,<value not representable as string>) @@ -68,31 +76,31 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal lists]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[last item different]]></DataTag> <Description><![CDATA[Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS"]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[second-last item different]]></DataTag> <Description><![CDATA[Compared lists differ at index 2. Actual (opA): "string3" Expected (opB): "DIFFERS"]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[prefix]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 2 Expected (opB) size: 1]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[short list second]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 12 Expected (opB) size: 1]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="325"> +<Incident type="fail" file="tst_cmptest.cpp" line="336"> <DataTag><![CDATA[short list first]]></DataTag> <Description><![CDATA[Compared lists have different sizes. Actual (opA) size: 1 @@ -101,7 +109,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compareQListInt"> -<Incident type="fail" file="tst_cmptest.cpp" line="332"> +<Incident type="fail" file="tst_cmptest.cpp" line="343"> <Description><![CDATA[Compared lists differ at index 2. Actual (int1): 3 Expected (int2): 4]]></Description> @@ -109,7 +117,7 @@ <Duration msecs="0"/> </TestFunction> <TestFunction name="compareQListDouble"> -<Incident type="fail" file="tst_cmptest.cpp" line="339"> +<Incident type="fail" file="tst_cmptest.cpp" line="350"> <Description><![CDATA[Compared lists differ at index 0. Actual (double1): 1.5 Expected (double2): 1]]></Description> @@ -120,13 +128,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both null]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[one null]]></DataTag> <Description><![CDATA[Compared QPixmaps differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[other null]]></DataTag> <Description><![CDATA[Compared QPixmaps differ. Actual (opA).isNull(): 0 @@ -135,13 +143,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[different size]]></DataTag> <Description><![CDATA[Compared QPixmaps differ in size. Actual (opA): 11x20 Expected (opB): 20x20]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="365"> +<Incident type="fail" file="tst_cmptest.cpp" line="376"> <DataTag><![CDATA[different pixels]]></DataTag> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> @@ -151,13 +159,13 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[both null]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[one null]]></DataTag> <Description><![CDATA[Compared QImages differ. Actual (opA).isNull(): 1 Expected (opB).isNull(): 0]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[other null]]></DataTag> <Description><![CDATA[Compared QImages differ. Actual (opA).isNull(): 0 @@ -166,44 +174,44 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[equal]]></DataTag> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different size]]></DataTag> <Description><![CDATA[Compared QImages differ in size. Actual (opA): 11x20 Expected (opB): 20x20]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different format]]></DataTag> <Description><![CDATA[Compared QImages differ in format. Actual (opA): 6 Expected (opB): 3]]></Description> </Incident> -<Incident type="fail" file="tst_cmptest.cpp" line="392"> +<Incident type="fail" file="tst_cmptest.cpp" line="403"> <DataTag><![CDATA[different pixels]]></DataTag> <Description><![CDATA[Compared values are not the same]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="verify"> -<Incident type="fail" file="tst_cmptest.cpp" line="404"> +<Incident type="fail" file="tst_cmptest.cpp" line="415"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="verify2"> -<Incident type="fail" file="tst_cmptest.cpp" line="410"> +<Incident type="fail" file="tst_cmptest.cpp" line="421"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="tryVerify"> -<Incident type="fail" file="tst_cmptest.cpp" line="416"> +<Incident type="fail" file="tst_cmptest.cpp" line="427"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. ()]]></Description> </Incident> <Duration msecs="0"/> </TestFunction> <TestFunction name="tryVerify2"> -<Incident type="fail" file="tst_cmptest.cpp" line="422"> +<Incident type="fail" file="tst_cmptest.cpp" line="433"> <Description><![CDATA['opaqueFunc() < 2' returned FALSE. (42)]]></Description> </Incident> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_cmptest.xunitxml b/tests/auto/testlib/selftests/expected_cmptest.xunitxml index fa970d4172..10918ce921 100644 --- a/tests/auto/testlib/selftests/expected_cmptest.xunitxml +++ b/tests/auto/testlib/selftests/expected_cmptest.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="0" failures="26" tests="16" name="tst_Cmptest"> +<testsuite errors="0" failures="27" tests="17" name="tst_Cmptest"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -14,6 +14,11 @@ Actual (Qt::ArrowCursor): ArrowCursor Expected (Qt::BusyCursor) : BusyCursor" result="fail"/> </testcase> + <testcase result="fail" name="compare_class_enums"> + <failure message="Compared values are not the same + Actual (MyClassEnum::MyClassEnumValue1): MyClassEnumValue1 + Expected (MyClassEnum::MyClassEnumValue2): MyClassEnumValue2" result="fail"/> + </testcase> <testcase result="pass" name="compare_boolfuncs"/> <testcase result="pass" name="compare_pointerfuncs"/> <testcase result="fail" name="compare_tostring"> diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 83c617fee5..1152f965ef 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -99,7 +99,7 @@ def generateTestData(testname): cmd = [getTestForPath(testname) + ' -' + format + ' ' + extraArgs.get(testname, '')] result = 'expected_' + testname + '.' + format data = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True).communicate()[0] - out = open(result, 'w') + out = open(result, 'wb') out.write(data) out.close() replaceInFile(result) diff --git a/tests/auto/testlib/selftests/selftests.pro b/tests/auto/testlib/selftests/selftests.pro index 1d39e6a899..32d66c019d 100644 --- a/tests/auto/testlib/selftests/selftests.pro +++ b/tests/auto/testlib/selftests/selftests.pro @@ -9,4 +9,3 @@ INSTALLS = QT = core -CONFIG += parallel_test diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro index 0a31810105..106787b64d 100644 --- a/tests/auto/testlib/selftests/test/test.pro +++ b/tests/auto/testlib/selftests/test/test.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test SOURCES += ../tst_selftests.cpp QT = core xml testlib-private diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 63c48fc809..389cb65c0b 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -775,6 +775,10 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QRegularExpressionMatch match = durationRegExp.match(line); QVERIFY2(match.hasMatch(), qPrintable(QString::fromLatin1("Invalid Duration tag at line %1 (%2): '%3'") .arg(i).arg(loggers.at(n), output))); + } else if (line.startsWith("Totals:")) { + const int lastCommaPos = line.lastIndexOf(','); + if (lastCommaPos > 0) + line.truncate(lastCommaPos); // Plain text logger: strip time (", 2323dms"). } else { QVERIFY2(output == expected, qPrintable(QString::fromLatin1("Mismatch at line %1 (%2, %3):\n'%4'\n !=\n'%5'") diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index 99e226c5f4..688799048f 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_moc #exists(/usr/include/boost/spirit.hpp) { @@ -41,7 +40,6 @@ qtHaveModule(dbus) { DEFINES += WITH_DBUS QT += dbus } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 # tst_Moc::specifyMetaTagsFromCmdline() # Ensure that plugin_metadata.h are moc-ed with some extra -M arguments: diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index c113b7cd60..876d15eef0 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -701,7 +701,7 @@ void tst_Moc::oldStyleCasts() QStringList args; args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "." - << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); @@ -771,7 +771,7 @@ void tst_Moc::inputFileNameWithDotsButNoExtension() QStringList args; args << "-c" << "-x" << "c++" << "-I" << ".." - << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-"; + << "-I" << qtIncludePath << "-o" << "/dev/null" << "-fPIC" << "-std=c++11" << "-"; proc.start("gcc", args); QVERIFY(proc.waitForStarted()); proc.write(mocOut); @@ -1050,7 +1050,8 @@ void tst_Moc::ignoreOptionClashes() // If -pthread wasn't ignored, it was parsed as a prefix of "thread/", which breaks compilation. QStringList gccArgs; gccArgs << "-c" << "-x" << "c++" << "-I" << ".." - << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" << "-fPIC" << "-"; + << "-I" << qtIncludePath << "-I" << includeDir << "-o" << "/dev/null" + << "-fPIC" << "-std=c++11" << "-"; proc.start("gcc", gccArgs); QVERIFY(proc.waitForStarted()); proc.write(mocOut); diff --git a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro index d568e7107d..4bfa89a44e 100644 --- a/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro +++ b/tests/auto/tools/qdbuscpp2xml/qdbuscpp2xml.pro @@ -9,4 +9,3 @@ SOURCES += tst_qdbuscpp2xml.cpp \ RESOURCES += qdbuscpp2xml.qrc HEADERS += test1.h -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro index d2e2e19a36..8c29ff47c4 100644 --- a/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro +++ b/tests/auto/tools/qdbusxml2cpp/qdbusxml2cpp.pro @@ -3,4 +3,3 @@ QT = core testlib TARGET = tst_qdbusxml2cpp SOURCES += tst_qdbusxml2cpp.cpp QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/tools/qmake/qmake.pro b/tests/auto/tools/qmake/qmake.pro index d0817247db..ac52fb81fa 100644 --- a/tests/auto/tools/qmake/qmake.pro +++ b/tests/auto/tools/qmake/qmake.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test # Allow more time since examples are compiled, which may take longer on Windows. win32:testcase.timeout=900 TARGET = tst_qmake diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp index 601d626b5c..23a7012af7 100644 --- a/tests/auto/tools/qmake/testcompiler.cpp +++ b/tests/auto/tools/qmake/testcompiler.cpp @@ -296,7 +296,7 @@ bool TestCompiler::make( const QString &workPath, const QString &target, bool ex bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ) { - QFileInfo f(destDir + "/" + targetName(buildType, exeName, version)); + QFileInfo f(destDir + QLatin1Char('/') + targetName(buildType, exeName, version)); return f.exists(); } diff --git a/tests/auto/tools/qmakelib/qmakelib.pro b/tests/auto/tools/qmakelib/qmakelib.pro index f1b8dfef3d..140bece708 100644 --- a/tests/auto/tools/qmakelib/qmakelib.pro +++ b/tests/auto/tools/qmakelib/qmakelib.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmakelib QT = core testlib diff --git a/tests/auto/tools/rcc/rcc.pro b/tests/auto/tools/rcc/rcc.pro index 160697b06c..264b8ecc66 100644 --- a/tests/auto/tools/rcc/rcc.pro +++ b/tests/auto/tools/rcc/rcc.pro @@ -3,4 +3,3 @@ QT = core testlib TARGET = tst_rcc SOURCES += tst_rcc.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro index c379e67ec5..c8ddedb401 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro +++ b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qcolordialog QT += widgets testlib SOURCES += tst_qcolordialog.cpp diff --git a/tests/auto/widgets/dialogs/qdialog/qdialog.pro b/tests/auto/widgets/dialogs/qdialog/qdialog.pro index c7917e8ff6..0a065b1a87 100644 --- a/tests/auto/widgets/dialogs/qdialog/qdialog.pro +++ b/tests/auto/widgets/dialogs/qdialog/qdialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdialog QT += widgets testlib gui-private core-private SOURCES += tst_qdialog.cpp diff --git a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro index a88f449494..b4cf05e347 100644 --- a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro +++ b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TEMPLATE = app TARGET = tst_qerrormessage diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 42e2bd09a5..32253674d8 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -943,7 +943,7 @@ void tst_QFiledialog::selectFiles() QString filesPath = fd.directory().absolutePath(); for (int i=0; i < 5; ++i) { - QFile file(filesPath + QString::fromLatin1("/qfiledialog_auto_test_not_pres_%1").arg(i)); + QFile file(filesPath + QLatin1String("/qfiledialog_auto_test_not_pres_") + QString::number(i)); file.open(QIODevice::WriteOnly); file.resize(1024); file.flush(); @@ -957,7 +957,7 @@ void tst_QFiledialog::selectFiles() QListView* listView = fd.findChild<QListView*>("listView"); QVERIFY(listView); for (int i = 0; i < list.count(); ++i) { - fd.selectFile(fd.directory().path() + "/" + list.at(i)); + fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i)); QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); toSelect.append(listView->selectionModel()->selectedRows().last()); } diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index d48c718d4d..5e5affed28 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -520,7 +520,7 @@ protected: path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString(); do { - path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path; + path = parentIndex.data(Qt::DisplayRole).toString() + QLatin1Char('/') + path; parentIndex = parentIndex.parent(); } while(parentIndex.isValid()); @@ -903,7 +903,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() #else QTest::qWait(500); #endif - QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g")); + QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g")); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); @@ -1149,7 +1149,7 @@ void tst_QFileDialog2::task257579_sideBarWithNonCleanUrls() QLatin1String dirname("autotest_task257579"); dir.rmdir(dirname); //makes sure it doesn't exist any more QVERIFY(dir.mkdir(dirname)); - QString url = QString::fromLatin1("%1/%2/..").arg(dir.absolutePath()).arg(dirname); + QString url = dir.absolutePath() + QLatin1Char('/') + dirname + QLatin1String("/.."); QNonNativeFileDialog fd; fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url)); QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar"); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 3252650d12..260aa25512 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -394,8 +394,9 @@ void tst_QFileSystemModel::rowsInserted_data() QTest::addColumn<int>("count"); QTest::addColumn<int>("ascending"); for (int i = 0; i < 4; ++i) { - QTest::newRow(QString("Qt::AscendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::AscendingOrder; - QTest::newRow(QString("Qt::DescendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::DescendingOrder; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("Qt::AscendingOrder " + iB).constData()) << i << (int)Qt::AscendingOrder; + QTest::newRow(("Qt::DescendingOrder " + iB).constData()) << i << (int)Qt::DescendingOrder; } } @@ -423,7 +424,7 @@ void tst_QFileSystemModel::rowsInserted() int oldCount = model->rowCount(root); QStringList files; for (int i = 0; i < count; ++i) - files.append(QString("c%1").arg(i)); + files.append(QLatin1Char('c') + QString::number(i)); QVERIFY(createFiles(tmp, files, 5)); TRY_WAIT(model->rowCount(root) == oldCount + count); QTRY_COMPARE(model->rowCount(root), oldCount + count); @@ -943,8 +944,8 @@ void tst_QFileSystemModel::dirsBeforeFiles() for (int i = 0; i < 3; ++i) { QLatin1Char c('a' + i); - dir.mkdir(QString("%1-dir").arg(c)); - QFile file(flatDirTestPath + QString("/%1-file").arg(c)); + dir.mkdir(c + QLatin1String("-dir")); + QFile file(flatDirTestPath + QLatin1Char('/') + c + QLatin1String("-file")); file.open(QIODevice::ReadWrite); file.close(); } @@ -1021,7 +1022,7 @@ void tst_QFileSystemModel::permissions() // checks QTBUG-20503 QFETCH(bool, readOnly); const QString tmp = flatDirTestPath; - const QString file = tmp + '/' + "f"; + const QString file = tmp + QLatin1String("/f"); QVERIFY(createFiles(tmp, QStringList() << "f")); QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions))); diff --git a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro index dc1702971e..320d6ee3b5 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro +++ b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontdialog QT += widgets widgets-private testlib @@ -9,9 +8,9 @@ SOURCES += tst_qfontdialog.cpp RESOURCES += testfonts.qrc -mac { +osx { # ### fixme # OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm -# LIBS += -framework Cocoa +# LIBS += -framework AppKit } diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index c3b80304a2..2590f31608 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -168,10 +168,10 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0) const ValueType origValue = sbox->value(); testInvalidateAndRestore<SpinBoxType, ValueType>(sbox, okButton, ledit); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->minimum())); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->maximum())); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->minimum() - 1)); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->maximum() + 1)); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->minimum())); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->maximum())); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->minimum() - 1)); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->maximum() + 1)); testTypingValue<SpinBoxType>(sbox, okButton, "0"); testTypingValue<SpinBoxType>(sbox, okButton, "0.0"); testTypingValue<SpinBoxType>(sbox, okButton, "foobar"); diff --git a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro index e9f220101b..91848fee24 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro +++ b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro @@ -2,6 +2,5 @@ TEMPLATE = app TARGET = tst_qmessagebox QT += gui-private core-private widgets testlib CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qmessagebox.cpp diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 1a4f9077d9..d0d7a95c7e 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -616,7 +616,7 @@ void tst_QMessageBox::detailsButtonText() QAbstractButton* btn = NULL; foreach(btn, list) { if (btn && (btn->inherits("QPushButton"))) { - if (btn->text().remove("&") != QMessageBox::tr("OK") + if (btn->text().remove(QLatin1Char('&')) != QMessageBox::tr("OK") && btn->text() != QMessageBox::tr("Show Details...")) { QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text()))); } diff --git a/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro b/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro index 290374f825..10aeaace71 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro +++ b/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qprogressdialog QT += widgets testlib SOURCES += tst_qprogressdialog.cpp diff --git a/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro b/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro index ce485504e2..18e637199a 100644 --- a/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro +++ b/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test QT += core-private QT += widgets widgets-private testlib SOURCES += tst_qsidebar.cpp TARGET = tst_qsidebar -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/dialogs/qwizard/qwizard.pro b/tests/auto/widgets/dialogs/qwizard/qwizard.pro index a1d72e854a..c6e5bcea7a 100644 --- a/tests/auto/widgets/dialogs/qwizard/qwizard.pro +++ b/tests/auto/widgets/dialogs/qwizard/qwizard.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwizard QT += widgets testlib SOURCES += tst_qwizard.cpp tst_qwizard_2.cpp diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index b2bdbac79a..3ff672f288 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -547,8 +547,8 @@ void tst_QWizard::setDefaultProperty() // make sure the data structure is reasonable for (int i = 0; i < 200000; ++i) { - wizard.setDefaultProperty("QLineEdit", QByteArray("x" + QByteArray::number(i)).constData(), 0); - wizard.setDefaultProperty("QLabel", QByteArray("y" + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLineEdit", QByteArray('x' + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLabel", QByteArray('y' + QByteArray::number(i)).constData(), 0); } } @@ -1625,7 +1625,7 @@ class SetPage : public Operation for (int j = 0; j < page; ++j) wizard->next(); } - QString describe() const { return QString("set page %1").arg(page); } + QString describe() const { return QLatin1String("set page ") + QString::number(page); } const int page; public: SetPage(int page) : page(page) {} @@ -1634,7 +1634,7 @@ public: class SetStyle : public Operation { void apply(QWizard *wizard) const { wizard->setWizardStyle(style); } - QString describe() const { return QString("set style %1").arg(style); } + QString describe() const { return QLatin1String("set style ") + QString::number(style); } const QWizard::WizardStyle style; public: SetStyle(QWizard::WizardStyle style) : style(style) {} @@ -1697,7 +1697,8 @@ public: QString SetOption::describe() const { - return QString("set opt %1 %2").arg(OptionInfo::instance().tag(option)).arg(on); + return QLatin1String("set opt ") + OptionInfo::instance().tag(option) + + QLatin1Char(on ? '1' : '0'); } Q_DECLARE_METATYPE(Operation *) @@ -1726,7 +1727,7 @@ public: void createTestRows() { for (int i = 0; i < combinations.count(); ++i) { - QTest::newRow((name + QString(", row %1").arg(i)).toLatin1().data()) + QTest::newRow((name.toLatin1() + ", row " + QByteArray::number(i)).constData()) << (i == 0) << (type == Equality) << *(combinations.at(i)); ++nRows_; } @@ -1827,7 +1828,7 @@ public: foreach (Operation * op, operations) { if (op) { op->apply(this); - opsDescr += QString("(%1) ").arg(op->describe()); + opsDescr += QLatin1Char('(') + op->describe() + QLatin1String(") "); } } } @@ -2115,7 +2116,7 @@ void tst_QWizard::combinations() } if (minSizeTest) - qDebug() << "minimum sizes" << reason.latin1() << ";" << wizard.minimumSizeHint() + qDebug() << "minimum sizes" << reason.latin1() << ';' << wizard.minimumSizeHint() << otor.latin1() << refMinSize; if (imageTest) @@ -2612,9 +2613,6 @@ void tst_QWizard::task161658_alignments() void tst_QWizard::task177022_setFixedSize() { -#ifdef Q_OS_BLACKBERRY - QSKIP("Window is forced fullscreen"); -#endif int width = 300; int height = 200; QWizard wiz; diff --git a/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro b/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro index 9f6b0455e2..177d1a7c42 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro +++ b/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro @@ -5,4 +5,3 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicseffect.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index c7d1dd0aa1..ceeea77dc2 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -549,7 +549,7 @@ void tst_QGraphicsEffect::drawPixmapItem() QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(effect->repaints >= 1); - item->rotate(180); + item->setTransform(QTransform().rotate(180), true); QTRY_VERIFY(effect->repaints >= 2); } @@ -593,7 +593,7 @@ void tst_QGraphicsEffect::deviceCoordinateTranslateCaching() QTRY_VERIFY(item->numRepaints >= 1); int numRepaints = item->numRepaints; - item->translate(10, 0); + item->setTransform(QTransform::fromTranslate(10, 0), true); QTRY_COMPARE(item->numRepaints, numRepaints); } diff --git a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro index b6693eeb5f..bf0f99598b 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpixmapfilter QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro index 6e8717c86d..a1064d1c73 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro @@ -3,4 +3,3 @@ TARGET = tst_qgraphicsanchorlayout1 QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout1.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a58f295575..15987a094e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -159,7 +159,7 @@ public: { setContentsMargins( 0,0,0,0 ); if (name.isEmpty()) - setData(0, QString::fromLatin1("w%1").arg(quintptr(this))); + setData(0, QLatin1Char('w') + QString::number(quintptr(this))); else setData(0, name); } @@ -1702,10 +1702,8 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Create dummy widgets QList<QGraphicsWidget *> widgets; - for (int i = 0; i < widgetCount; ++i) { - TestWidget *w = new TestWidget(0, QString::fromLatin1("W%1").arg(i)); - widgets << w; - } + for (int i = 0; i < widgetCount; ++i) + widgets << new TestWidget(0, QLatin1Char('W') + QString::number(i)); // Setup anchor layout TheAnchorLayout *layout = new TheAnchorLayout; diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 8c27bebf3a..2d1efab4d1 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -451,9 +451,10 @@ void tst_QGraphicsGridLayout::addItem_data() int column = b; int rowSpan = c; int columnSpan = d; - QString name = QString::fromLatin1("(%1,%2,%3,%4").arg(a).arg(b).arg(c).arg(d); + const QByteArray name = '(' + QByteArray::number(a) + ',' + QByteArray::number(b) + + ',' + QByteArray::number(c) + ',' + QByteArray::number(d); Qt::Alignment alignment = Qt::AlignLeft; - QTest::newRow(name.toLatin1()) << row << column << rowSpan << columnSpan << alignment; + QTest::newRow(name.constData()) << row << column << rowSpan << columnSpan << alignment; }}}} } @@ -1107,7 +1108,8 @@ void tst_QGraphicsGridLayout::itemAt() if (i >= 0 && i < layout->count()) { QVERIFY(layout->itemAt(i)); } else { - QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::itemAt: invalid index %1").arg(i).toLatin1().constData()); + const QByteArray message = "QGraphicsGridLayout::itemAt: invalid index " + QByteArray::number(i); + QTest::ignoreMessage(QtWarningMsg, message.constData()); QCOMPARE(layout->itemAt(i), static_cast<QGraphicsLayoutItem*>(0)); } } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 66e39869bb..5bfa15db16 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -6,4 +6,3 @@ SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII win32:!wince:!winrt: LIBS += -luser32 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 835aeaa4df..28ce831889 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -310,7 +310,7 @@ private slots: void selected_textItem(); void selected_multi(); void acceptedMouseButtons(); - void acceptsHoverEvents(); + void acceptHoverEvents(); void childAcceptsHoverEvents(); void hasFocus(); void pos(); @@ -385,7 +385,9 @@ private slots: void itemContainsChildrenInShape2(); void ancestorFlags(); void untransformable(); +#ifndef QT_NO_CONTEXTMENU void contextMenuEventPropagation(); +#endif // QT_NO_CONTEXTMENU void itemIsMovable(); void boundingRegion_data(); void boundingRegion(); @@ -564,9 +566,9 @@ void tst_QGraphicsItem::construction() QVERIFY(!item->isSelected()); QCOMPARE(item->acceptedMouseButtons(), Qt::MouseButtons(0x1f)); if (item->type() == QGraphicsTextItem::Type) - QVERIFY(item->acceptsHoverEvents()); + QVERIFY(item->acceptHoverEvents()); else - QVERIFY(!item->acceptsHoverEvents()); + QVERIFY(!item->acceptHoverEvents()); QVERIFY(!item->hasFocus()); QCOMPARE(item->pos(), QPointF()); QCOMPARE(item->matrix(), QMatrix()); @@ -1125,11 +1127,11 @@ void tst_QGraphicsItem::visible() scene.addItem(item); QVERIFY(item->isVisible()); - QCOMPARE(scene.itemAt(0, 0), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); item->setVisible(false); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(0, 0)).isEmpty()); item->setVisible(true); - QCOMPARE(scene.itemAt(0, 0), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setButton(Qt::LeftButton); @@ -1930,7 +1932,7 @@ protected: { ++hoverOutCount; } }; -void tst_QGraphicsItem::acceptsHoverEvents() +void tst_QGraphicsItem::acceptHoverEvents() { QGraphicsScene scene; HoverItem *item1 = new HoverItem(QRectF(-10, -10, 20, 20)); @@ -1939,10 +1941,10 @@ void tst_QGraphicsItem::acceptsHoverEvents() scene.addItem(item2); item2->setZValue(1); - QVERIFY(!item1->acceptsHoverEvents()); - QVERIFY(!item2->acceptsHoverEvents()); - item1->setAcceptsHoverEvents(true); - item2->setAcceptsHoverEvents(true); + QVERIFY(!item1->acceptHoverEvents()); + QVERIFY(!item2->acceptHoverEvents()); + item1->setAcceptHoverEvents(true); + item2->setAcceptHoverEvents(true); QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove); event.setScenePos(QPointF(-100, -100)); @@ -1953,8 +1955,8 @@ void tst_QGraphicsItem::acceptsHoverEvents() QCOMPARE(item1->hoverInCount, 0); QCOMPARE(item2->hoverInCount, 1); - item1->setAcceptsHoverEvents(false); - item2->setAcceptsHoverEvents(false); + item1->setAcceptHoverEvents(false); + item2->setAcceptHoverEvents(false); event.setScenePos(QPointF(-100, -100)); QApplication::sendEvent(&scene, &event); @@ -1964,8 +1966,8 @@ void tst_QGraphicsItem::acceptsHoverEvents() QCOMPARE(item1->hoverInCount, 0); QCOMPARE(item2->hoverInCount, 1); - item1->setAcceptsHoverEvents(true); - item2->setAcceptsHoverEvents(false); + item1->setAcceptHoverEvents(true); + item2->setAcceptHoverEvents(false); event.setScenePos(QPointF(-100, -100)); QApplication::sendEvent(&scene, &event); @@ -2168,27 +2170,27 @@ void tst_QGraphicsItem::matrix() line.resetMatrix(); QCOMPARE(line.matrix(), QMatrix()); - line.rotate(90); + line.setTransform(QTransform().rotate(90), true); QCOMPARE(line.matrix(), QMatrix().rotate(90)); - line.rotate(90); + line.setTransform(QTransform().rotate(90), true); QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90)); line.resetMatrix(); - line.scale(2, 4); + line.setTransform(QTransform::fromScale(2, 4), true); QCOMPARE(line.matrix(), QMatrix().scale(2, 4)); - line.scale(2, 4); + line.setTransform(QTransform::fromScale(2, 4), true); QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4)); line.resetMatrix(); - line.shear(2, 4); + line.setTransform(QTransform().shear(2, 4), true); QCOMPARE(line.matrix(), QMatrix().shear(2, 4)); - line.shear(2, 4); + line.setTransform(QTransform().shear(2, 4), true); QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4)); line.resetMatrix(); - line.translate(10, 10); + line.setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(line.matrix(), QMatrix().translate(10, 10)); - line.translate(10, 10); + line.setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10)); line.resetMatrix(); } @@ -2201,15 +2203,15 @@ void tst_QGraphicsItem::sceneMatrix() QCOMPARE(parent->sceneMatrix(), QMatrix()); QCOMPARE(child->sceneMatrix(), QMatrix()); - parent->translate(10, 10); + parent->setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10)); - child->translate(10, 10); + child->setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20)); - parent->rotate(90); + parent->setTransform(QTransform().rotate(90), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10)); @@ -2645,7 +2647,7 @@ void tst_QGraphicsItem::isObscuredBy() MyItem myitem1, myitem2; myitem1.setRect(QRectF(50, 50, 40, 200)); - myitem1.rotate(67); + myitem1.setTransform(QTransform().rotate(67), true); myitem2.setRect(QRectF(25, 25, 20, 20)); myitem2.setZValue(-1.0); @@ -3271,7 +3273,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints() EventTester *tester = new EventTester; scene.addItem(tester); - tester->setAcceptsHoverEvents(true); + tester->setAcceptHoverEvents(true); QTRY_COMPARE(tester->repaints, 1); @@ -3363,7 +3365,7 @@ void tst_QGraphicsItem::sceneBoundingRect() QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100)); QCOMPARE(item->sceneBoundingRect(), QRectF(100, 100, 100, 100)); - item->rotate(90); + item->setTransform(QTransform().rotate(90), true); QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100)); QCOMPARE(item->sceneBoundingRect(), QRectF(0, 100, 100, 100)); @@ -3391,7 +3393,7 @@ void tst_QGraphicsItem::childrenBoundingRect() QGraphicsRectItem *childChild = scene.addRect(QRectF(0, 0, 100, 100), QPen(Qt::black, 0)); childChild->setParentItem(child); childChild->setPos(500, 500); - child->rotate(90); + child->setTransform(QTransform().rotate(90), true); scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));; @@ -3439,11 +3441,11 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed() QCOMPARE(subTreeRect.width(), qreal(351.7766952966369)); QCOMPARE(subTreeRect.height(), qreal(251.7766952966369)); - rect->rotate(45); - rect2->rotate(-45); - rect3->rotate(45); - rect4->rotate(-45); - rect5->rotate(45); + rect->setTransform(QTransform().rotate(45), true); + rect2->setTransform(QTransform().rotate(-45), true); + rect3->setTransform(QTransform().rotate(45), true); + rect4->setTransform(QTransform().rotate(-45), true); + rect5->setTransform(QTransform().rotate(45), true); subTreeRect = rect->childrenBoundingRect(); QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250)); @@ -3565,7 +3567,7 @@ void tst_QGraphicsItem::group() QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::blue)); QGraphicsRectItem *parent2 = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::red)); parent2->setPos(-50, 50); - child->rotate(45); + child->setTransform(QTransform().rotate(45), true); child->setParentItem(parent); parent->setPos(25, 25); child->setPos(25, 25); @@ -3614,7 +3616,7 @@ void tst_QGraphicsItem::group() newItems << item; item->setPos(-1000 + rand() % 2000, -1000 + rand() % 2000); - item->rotate(rand() % 90); + item->setTransform(QTransform().rotate(rand() % 90), true); } view.fitInView(scene.itemsBoundingRect()); @@ -3657,8 +3659,8 @@ void tst_QGraphicsItem::setGroup2() rect->setTransformOriginPoint(50,50); rect->setRotation(45); rect->setScale(1.5); - rect->translate(20,20); - group.translate(-30,-40); + rect->setTransform(QTransform::fromTranslate(20,20), true); + group.setTransform(QTransform::fromTranslate(-30, -40), true); group.setRotation(180); group.setScale(0.5); @@ -3711,7 +3713,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup() QGraphicsScene scene; QGraphicsRectItem *parentRectItem = scene.addRect(QRectF(0, 0, 100, 100)); QGraphicsRectItem *childRectItem = scene.addRect(QRectF(0, 0, 100, 100)); - parentRectItem->rotate(90); + parentRectItem->setTransform(QTransform().rotate(90), true); childRectItem->setPos(-50, -25); childRectItem->setParentItem(parentRectItem); @@ -3720,7 +3722,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup() QGraphicsRectItem *parentOfGroup = scene.addRect(QRectF(0, 0, 100, 100)); parentOfGroup->setPos(-200, -200); - parentOfGroup->scale(2, 2); + parentOfGroup->setTransform(QTransform::fromScale(2, 2), true); QGraphicsItemGroup *group = new QGraphicsItemGroup; group->setPos(50, 50); @@ -4128,9 +4130,9 @@ public: font.setPointSize(4); painter->setFont(font); for (int x = -100; x < 100; x += 25) { - for (int y = -100; y < 100; y += 25) { - painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, QString("%1x%2").arg(x).arg(y)); - } + const QString prefix = QString::number(x) + QLatin1Char('x'); + for (int y = -100; y < 100; y += 25) + painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, prefix + QString::number(y)); } } }; @@ -4633,7 +4635,7 @@ void tst_QGraphicsItem::itemChange() // ItemTransformChange / ItemTransformHasChanged tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90)); - tester.translate(50, 0); + tester.setTransform(QTransform::fromTranslate(50, 0), true); ++changeCount; // notification sent too ++changeCount; QCOMPARE(tester.changes.size(), changeCount); @@ -5193,6 +5195,7 @@ public: } protected: +#ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QGraphicsSceneContextMenuEvent *) { if (harakiri == 3) { @@ -5200,6 +5203,7 @@ protected: delete this; } } +#endif // QT_NO_CONTEXTMENU void dragEnterEvent(QGraphicsSceneDragDropEvent *event) { @@ -5362,7 +5366,7 @@ void tst_QGraphicsItem::deleteItemInEventHandlers() for (int i = 0; i < 17; ++i) { QGraphicsScene scene; HarakiriItem *item = new HarakiriItem(i); - item->setAcceptsHoverEvents(true); + item->setAcceptHoverEvents(true); item->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(item); @@ -5378,11 +5382,13 @@ void tst_QGraphicsItem::deleteItemInEventHandlers() if (!item->dead) scene.advance(); +#ifndef QT_NO_CONTEXTMENU if (!item->dead) { QContextMenuEvent event(QContextMenuEvent::Other, view.mapFromScene(item->scenePos())); QCoreApplication::sendEvent(view.viewport(), &event); } +#endif // QT_NO_CONTEXTMENU if (!item->dead) QTest::mouseMove(view.viewport(), view.mapFromScene(item->scenePos())); if (!item->dead) @@ -5514,16 +5520,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2() QGraphicsScene scene; scene.addItem(parent); - QCOMPARE(scene.itemAt(5, 5), (QGraphicsItem *)parent); - QCOMPARE(scene.itemAt(15, 5), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(5, 15), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(60, 60), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(140, 60), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(60, 140), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(140, 140), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(75, 75), (QGraphicsItem *)child2); - QCOMPARE(scene.itemAt(75, 100), (QGraphicsItem *)child1); - QCOMPARE(scene.itemAt(100, 75), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); + QVERIFY(scene.items(QPointF(15, 5)).isEmpty()); + QVERIFY(scene.items(QPointF(5, 15)).isEmpty()); + QVERIFY(scene.items(QPointF(60, 60)).isEmpty()); + QVERIFY(scene.items(QPointF(140, 60)).isEmpty()); + QVERIFY(scene.items(QPointF(60, 140)).isEmpty()); + QVERIFY(scene.items(QPointF(140, 140)).isEmpty()); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2); + QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); image.fill(0); @@ -5558,20 +5564,20 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3() grandchild->setPos( 50, 50 ); parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); // Move child to fully overlap the parent. The grandchild should // now occupy two-thirds of the scene child->prepareGeometryChange(); child->setPos( 0, 0 ); - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); } class MyProxyWidget : public QGraphicsProxyWidget @@ -5843,17 +5849,17 @@ void tst_QGraphicsItem::itemClippingDiscovery() rightRectItem->setParentItem(clipItem); // The rects item are both visible at these points. - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)leftRectItem); - QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)rightRectItem); + QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem); + QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem); // The ellipse clips the rects now. clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); // The rect items are no longer visible at these points. - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); if (sizeof(qreal) != sizeof(double)) QSKIP("This fails due to internal rounding errors"); - QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(90, 90)).isEmpty()); } class ItemCountsBoundingRectCalls : public QGraphicsRectItem @@ -5884,7 +5890,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // First test that both items are searched if no optimization flags are set - QGraphicsItem* item = scene.itemAt(25,5); + QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5895,7 +5901,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // Repeat the test to make sure that no caching/indexing is in effect - item = scene.itemAt(25,5); + item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5908,7 +5914,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() // 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); + item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QVERIFY(!(item)); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -6216,12 +6222,12 @@ void tst_QGraphicsItem::untransformable() QGraphicsItem *item1 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100)); item1->setZValue(1); item1->setFlag(QGraphicsItem::ItemIgnoresTransformations); - item1->rotate(45); + item1->setTransform(QTransform().rotate(45), true); ((QGraphicsEllipseItem *)item1)->setBrush(Qt::red); QGraphicsItem *item2 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100)); item2->setParentItem(item1); - item2->rotate(45); + item2->setTransform(QTransform().rotate(45), true); item2->setPos(100, 0); ((QGraphicsEllipseItem *)item2)->setBrush(Qt::green); @@ -6276,6 +6282,7 @@ void tst_QGraphicsItem::untransformable() } } +#ifndef QT_NO_CONTEXTMENU class ContextMenuItem : public QGraphicsRectItem { public: @@ -6339,6 +6346,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation() QCOMPARE(bottomItem->gotEvent, false); QCOMPARE(topItem->eventWasAccepted, true); } +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsItem::itemIsMovable() { @@ -6460,10 +6468,11 @@ void tst_QGraphicsItem::task177918_lineItemUndetected() QGraphicsLineItem *line = scene.addLine(10, 10, 10, 10); QCOMPARE(line->boundingRect(), QRectF(10, 10, 0, 0)); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemShape).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemShape).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemBoundingRect).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemBoundingRect).isEmpty()); + const QRectF rect(9, 9, 2, 2); + QVERIFY(!scene.items(rect, Qt::IntersectsItemShape).isEmpty()); + QVERIFY(!scene.items(rect, Qt::ContainsItemShape).isEmpty()); + QVERIFY(!scene.items(rect, Qt::IntersectsItemBoundingRect).isEmpty()); + QVERIFY(!scene.items(rect, Qt::ContainsItemBoundingRect).isEmpty()); } void tst_QGraphicsItem::task240400_clickOnTextItem_data() @@ -6699,8 +6708,8 @@ void tst_QGraphicsItem::itemTransform_parentChild() QGraphicsItem *child = scene.addRect(0, 0, 100, 100); child->setParentItem(parent); child->setPos(10, 10); - child->scale(2, 2); - child->rotate(90); + child->setTransform(QTransform::fromScale(2, 2), true); + child->setTransform(QTransform().rotate(90), true); QCOMPARE(child->itemTransform(parent).map(QPointF(10, 10)), QPointF(-10, 30)); QCOMPARE(parent->itemTransform(child).map(QPointF(-10, 30)), QPointF(10, 10)); @@ -6712,19 +6721,19 @@ void tst_QGraphicsItem::itemTransform_siblings() QGraphicsItem *parent = scene.addRect(0, 0, 100, 100); QGraphicsItem *brother = scene.addRect(0, 0, 100, 100); QGraphicsItem *sister = scene.addRect(0, 0, 100, 100); - parent->scale(10, 5); - parent->rotate(-180); - parent->shear(2, 3); + parent->setTransform(QTransform::fromScale(10, 5), true); + parent->setTransform(QTransform().rotate(-180), true); + parent->setTransform(QTransform().shear(2, 3), true); brother->setParentItem(parent); sister->setParentItem(parent); brother->setPos(10, 10); - brother->scale(2, 2); - brother->rotate(90); + brother->setTransform(QTransform::fromScale(2, 2), true); + brother->setTransform(QTransform().rotate(90), true); sister->setPos(10, 10); - sister->scale(2, 2); - sister->rotate(90); + sister->setTransform(QTransform::fromScale(2, 2), true); + sister->setTransform(QTransform().rotate(90), true); QCOMPARE(brother->itemTransform(sister).map(QPointF(10, 10)), QPointF(10, 10)); QCOMPARE(sister->itemTransform(brother).map(QPointF(10, 10)), QPointF(10, 10)); @@ -6736,11 +6745,11 @@ void tst_QGraphicsItem::itemTransform_unrelated() QGraphicsItem *stranger1 = scene.addRect(0, 0, 100, 100); QGraphicsItem *stranger2 = scene.addRect(0, 0, 100, 100); stranger1->setPos(10, 10); - stranger1->scale(2, 2); - stranger1->rotate(90); + stranger1->setTransform(QTransform::fromScale(2, 2), true); + stranger1->setTransform(QTransform().rotate(90), true); stranger2->setPos(10, 10); - stranger2->scale(2, 2); - stranger2->rotate(90); + stranger2->setTransform(QTransform::fromScale(2, 2), true); + stranger2->setTransform(QTransform().rotate(90), true); QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10)); QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10)); @@ -7022,7 +7031,8 @@ void tst_QGraphicsItem::itemStacksBehindParent() paintedItems.clear(); view.viewport()->update(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QRectF rect(0, 0, 100, 100); + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << grandChild111 << child11 << grandChild121 << child12 << parent1 << grandChild211 << child21 @@ -7038,7 +7048,7 @@ void tst_QGraphicsItem::itemStacksBehindParent() paintedItems.clear(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << grandChild121 << child12 << parent1 << grandChild111 << child11 << grandChild211 << child21 @@ -7054,7 +7064,7 @@ void tst_QGraphicsItem::itemStacksBehindParent() scene.update(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << parent1 << grandChild111 << child11 << grandChild121 << child12 << grandChild211 << child21 @@ -7221,12 +7231,12 @@ void tst_QGraphicsItem::sceneTransformCache() QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100); rect2->setPen(QPen(Qt::black, 0)); rect2->setParentItem(rect); - rect2->rotate(90); - rect->translate(0, 50); + rect2->setTransform(QTransform().rotate(90), true); + rect->setTransform(QTransform::fromTranslate(0, 50), true); QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - rect->translate(0, 100); + rect->setTransform(QTransform::fromTranslate(0, 100), true); QTransform x; x.translate(0, 150); x.rotate(90); @@ -7390,14 +7400,14 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(testerChild2->repaints, 2); // Translating does not result in a repaint. - tester->translate(10, 10); + tester->setTransform(QTransform::fromTranslate(10, 10), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 2); QCOMPARE(testerChild->repaints, 2); QCOMPARE(testerChild2->repaints, 2); // Rotating results in a repaint. - tester->rotate(45); + tester->setTransform(QTransform().rotate(45), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 3); QCOMPARE(testerChild->repaints, 3); @@ -7413,9 +7423,9 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(testerChild2->repaints, 3); // Rotating items with ItemCoordinateCache doesn't cause a repaint. - tester->rotate(22); - testerChild->rotate(22); - testerChild2->rotate(22); + tester->setTransform(QTransform().rotate(22), true); + testerChild->setTransform(QTransform().rotate(22), true); + testerChild2->setTransform(QTransform().rotate(22), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 4); QTRY_COMPARE(testerChild->repaints, 4); @@ -7648,7 +7658,9 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) { QGraphicsRectItem::paint(painter, option, widget); - painter->drawText(boundingRect(), Qt::AlignCenter, QString("%1x%2\n%3x%4").arg(p.x()).arg(p.y()).arg(sp.x()).arg(sp.y())); + const QString text = QString::number(p.x()) + QLatin1Char('x') + QString::number(p.y()) + + QLatin1Char('\n') + QString::number(sp.x()) + QLatin1Char('x') + QString::number(sp.y()); + painter->drawText(boundingRect(), Qt::AlignCenter, text); } protected: @@ -7728,9 +7740,9 @@ void tst_QGraphicsItem::deviceTransform() rect1->setPos(100, 100); rect2->setPos(100, 100); rect3->setPos(100, 100); - rect1->rotate(rotation1); - rect2->rotate(rotation2); - rect3->rotate(rotation3); + rect1->setTransform(QTransform().rotate(rotation1), true); + rect2->setTransform(QTransform().rotate(rotation2), true); + rect3->setTransform(QTransform().rotate(rotation3), true); rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1); rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2); rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3); @@ -7863,14 +7875,14 @@ void tst_QGraphicsItem::update() expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); view.reset(); item->repaints = 0; - parent->translate(-400, 0); + parent->setTransform(QTransform::fromTranslate(-400, 0), true); qApp->processEvents(); QCOMPARE(item->repaints, 0); QCOMPARE(view.repaints, 1); QCOMPARE(view.paintedRegion, expectedRegion); view.reset(); item->repaints = 0; - parent->translate(400, 0); + parent->setTransform(QTransform::fromTranslate(400, 0), true); qApp->processEvents(); QCOMPARE(item->repaints, 1); QCOMPARE(view.repaints, 1); @@ -8170,7 +8182,7 @@ void tst_QGraphicsItem::moveItem() RESET_COUNTERS - parent->translate(20, 20); + parent->setTransform(QTransform::fromTranslate(20, 20), true); qApp->processEvents(); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 1); @@ -8236,10 +8248,11 @@ void tst_QGraphicsItem::sorting() QGraphicsScene scene; QGraphicsItem *grid[100][100]; for (int x = 0; x < 100; ++x) { + const QString prefix = QString::number(x) + QLatin1Char('x'); for (int y = 0; y < 100; ++y) { PainterItem *item = new PainterItem; item->setPos(x * 25, y * 25); - item->setData(0, QString("%1x%2").arg(x).arg(y)); + item->setData(0, prefix + QString::number(y)); grid[x][y] = item; scene.addItem(item); } @@ -11641,12 +11654,12 @@ void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform() QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red); item1->setPos(50, 50); - item1->translate(50, 50); - item1->rotate(90); + item1->setTransform(QTransform::fromTranslate(50, 50), true); + item1->setTransform(QTransform().rotate(90), true); QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green); item2->setPos(50, 50); - item2->translate(50, 50); - item2->rotate(90); + item2->setTransform(QTransform::fromTranslate(50, 50), true); + item2->setTransform(QTransform().rotate(90), true); item2->setFlags(QGraphicsItem::ItemIgnoresTransformations); QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro index 484f4ba5f8..3515d259d0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro @@ -3,5 +3,4 @@ TARGET = tst_qgraphicsitemanimation QT += widgets testlib SOURCES += tst_qgraphicsitemanimation.cpp DEFINES += QT_NO_CAST_TO_ASCII -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro index 254a91ef6a..1be43692d5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro +++ b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro @@ -7,4 +7,3 @@ TARGET = tst_qgraphicslayout QT += widgets testlib SOURCES += tst_qgraphicslayout.cpp DEFINES += QT_USE_USING_NAMESPACE -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro index ef5cc36d05..e4a970201a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro @@ -2,5 +2,4 @@ CONFIG += testcase TARGET = tst_qgraphicslayoutitem QT += widgets testlib SOURCES += tst_qgraphicslayoutitem.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp index c291f09def..43993f6dbc 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp @@ -146,7 +146,7 @@ void tst_QGraphicsLayoutItem::effectiveSizeHint_data() QTest::addColumn<Qt::SizeHint>("sizeHint"); QTest::addColumn<QSizeF>("constraint"); for (int i = 0; i < 15; ++i) { - QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1()); + QTestData &data = QTest::newRow(QByteArray::number(i).constData()); switch(i % 5) { case 0: data << Qt::MinimumSize; break; case 1: data << Qt::PreferredSize; break; diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 8bebd4eddd..d0aacf5dad 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -425,10 +425,11 @@ void tst_QGraphicsLinearLayout::dump_data() QTest::addColumn<int>("itemCount"); QTest::addColumn<int>("layoutCount"); for (int i = -1; i < 3; ++i) { - QTest::newRow(QString("%1, 0, 0").arg(i).toLatin1()) << 0 << 0; - QTest::newRow(QString("%1, 0, 5").arg(i).toLatin1()) << 5 << 5; - QTest::newRow(QString("%1, 5, 0").arg(i).toLatin1()) << 5 << 5; - QTest::newRow(QString("%1, 5, 5").arg(i).toLatin1()) << 5 << 5; + const QByteArray iB = QByteArray::number(i); + QTest::newRow((iB + ", 0, 0").constData()) << 0 << 0; + QTest::newRow((iB + ", 0, 5").constData()) << 5 << 5; + QTest::newRow((iB + ", 5, 0").constData()) << 5 << 5; + QTest::newRow((iB + ", 5, 5").constData()) << 5 << 5; } } @@ -511,11 +512,13 @@ void tst_QGraphicsLinearLayout::insertItem_data() QTest::addColumn<int>("insertItemAt"); QTest::addColumn<bool>("isWidget"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int j = 0; j < 2; ++j) { - QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << (bool)j; - QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << (bool)j; - QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << (bool)j; - QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << (bool)j; + const QByteArray postFix = iB + ' ' + QByteArray::number(j); + QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << (bool)j; + QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << (bool)j; + QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << (bool)j; + QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << (bool)j; } } } @@ -565,11 +568,13 @@ void tst_QGraphicsLinearLayout::insertStretch_data() QTest::addColumn<int>("insertItemAt"); QTest::addColumn<int>("stretch"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int j = 0; j < 2; ++j) { - QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << j; - QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << j; - QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << j; - QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << j; + const QByteArray postFix = iB + ' ' + QByteArray::number(j); + QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << j; + QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << j; + QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << j; + QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << j; } } } @@ -786,12 +791,13 @@ void tst_QGraphicsLinearLayout::removeAt_data() QTest::addColumn<int>("removeItemAt"); QTest::addColumn<Qt::Orientation>("orientation"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int k = 0; k < 2; ++k) { Qt::Orientation orientation = (k == 0) ? Qt::Vertical : Qt::Horizontal; - QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i << orientation; - QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i << orientation; - QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i << orientation; - QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i << orientation; + QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i << orientation; + QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i << orientation; + QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i << orientation; + QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i << orientation; } } } @@ -840,10 +846,11 @@ void tst_QGraphicsLinearLayout::removeItem_data() QTest::addColumn<int>("layoutCount"); QTest::addColumn<int>("removeItemAt"); for (int i = -1; i < 4; ++i) { - QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i; - QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i; - QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i; - QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i; + QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i; + QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i; + QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i; } } diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro index 60f09c2228..483f123fa7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro @@ -5,4 +5,3 @@ QT += widgets testlib QT += core-private SOURCES += tst_qgraphicsobject.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro index 6452e39c56..123f1050ec 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro @@ -2,5 +2,4 @@ CONFIG += testcase TARGET = tst_qgraphicspixmapitem QT += widgets testlib SOURCES += tst_qgraphicspixmapitem.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro index bca0ecc20c..89847e9ed2 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qgraphicspolygonitem QT += widgets testlib SOURCES += tst_qgraphicspolygonitem.cpp -CONFIG += parallel_test - diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro index 38fef51394..e7bcccb495 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro @@ -6,4 +6,3 @@ QT += core-private gui-private SOURCES += tst_qgraphicsproxywidget.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 8760dc176c..10708c0dd7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -162,7 +162,9 @@ private slots: void fontPropagation(); void dontCrashWhenDie(); void createProxyForChildWidget(); +#ifndef QT_NO_CONTEXTMENU void actionsContextMenu(); +#endif // QT_NO_CONTEXTMENU void actionsContextMenu_data(); void deleteProxyForChildWidget(); void bypassGraphicsProxyWidget_data(); @@ -492,7 +494,7 @@ void tst_QGraphicsProxyWidget::setWidget() QCOMPARE(proxy->rect().toRect(), widget->rect()); QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus); QVERIFY(proxy->acceptDrops()); - QCOMPARE(proxy->acceptsHoverEvents(), true); // to get widget enter events + QCOMPARE(proxy->acceptHoverEvents(), true); // to get widget enter events int left, top, right, bottom; widget->getContentsMargins(&left, &top, &right, &bottom); qreal rleft, rtop, rright, rbottom; @@ -541,14 +543,15 @@ void tst_QGraphicsProxyWidget::testEventFilter_data() QTest::newRow("none") << QEvent::None << false; for (int i = 0; i < 2; ++i) { bool fromObject = (i == 0); - QTest::newRow(QString("resize %1").arg(fromObject).toLatin1()) << QEvent::Resize << fromObject; - QTest::newRow(QString("move %1").arg(fromObject).toLatin1()) << QEvent::Move << fromObject; - QTest::newRow(QString("hide %1").arg(fromObject).toLatin1()) << QEvent::Hide << fromObject; - QTest::newRow(QString("show %1").arg(fromObject).toLatin1()) << QEvent::Show << fromObject; - QTest::newRow(QString("enabled %1").arg(fromObject).toLatin1()) << QEvent::EnabledChange << fromObject; - QTest::newRow(QString("focusIn %1").arg(fromObject).toLatin1()) << QEvent::FocusIn << fromObject; - QTest::newRow(QString("focusOut %1").arg(fromObject).toLatin1()) << QEvent::FocusOut << fromObject; - QTest::newRow(QString("keyPress %1").arg(fromObject).toLatin1()) << QEvent::KeyPress << fromObject; + const char fromObjectC = fromObject ? '1' : '0'; + QTest::newRow((QByteArrayLiteral("resize ") + fromObjectC).constData()) << QEvent::Resize << fromObject; + QTest::newRow((QByteArrayLiteral("move ") + fromObjectC).constData()) << QEvent::Move << fromObject; + QTest::newRow((QByteArrayLiteral("hide ") + fromObjectC).constData()) << QEvent::Hide << fromObject; + QTest::newRow((QByteArrayLiteral("show ") + fromObjectC).constData()) << QEvent::Show << fromObject; + QTest::newRow((QByteArrayLiteral("enabled ") + fromObjectC).constData()) << QEvent::EnabledChange << fromObject; + QTest::newRow((QByteArrayLiteral("focusIn ") + fromObjectC).constData()) << QEvent::FocusIn << fromObject; + QTest::newRow((QByteArrayLiteral("focusOut ") + fromObjectC).constData()) << QEvent::FocusOut << fromObject; + QTest::newRow((QByteArrayLiteral("keyPress ") + fromObjectC).constData()) << QEvent::KeyPress << fromObject; } } @@ -760,8 +763,10 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild_data() bool hasWidget = (j == 0); bool hasScene = (k == 0); bool result = hasScene && hasWidget; - QString name = QString("Forward: %1, hasWidget: %2, hasScene: %3, result: %4").arg(next).arg(hasWidget).arg(hasScene).arg(result); - QTest::newRow(name.toLatin1()) << hasWidget << hasScene << next << result; + QByteArray name = QByteArrayLiteral("Forward: ") + (next ? '1' : '0') + + ", hasWidget: " + (hasWidget ? '1' : '0') + ", hasScene: " + + (hasScene ? '1' : '0') + ", result: " + (result ? '1' : '0'); + QTest::newRow(name.constData()) << hasWidget << hasScene << next << result; } } } @@ -1026,8 +1031,10 @@ void tst_QGraphicsProxyWidget::hoverMoveEvent_data() bool hoverEnabled = (j == 0); bool mouseTracking = (k == 0); bool mouseDown = (l == 0); - QString name = QString("hasWidget:%1, hover:%2, mouseTracking:%3, mouseDown: %4").arg(hasWidget).arg(hoverEnabled).arg(mouseTracking).arg(mouseDown); - QTest::newRow(name.toLatin1()) << hasWidget << hoverEnabled << mouseTracking << mouseDown; + QByteArray name = QByteArrayLiteral("hasWidget:") + (hasWidget ? '1' : '0') + ", hover:" + + (hoverEnabled ? '1' : '0') + ", mouseTracking:" + + (mouseTracking ? '1' : '0') + ", mouseDown: " + (mouseDown ? '1' : '0'); + QTest::newRow(name.constData()) << hasWidget << hoverEnabled << mouseTracking << mouseDown; } } } @@ -3072,6 +3079,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() delete boxProxy; } +#ifndef QT_NO_CONTEXTMENU class ContextMenuWidget : public QLabel { Q_OBJECT @@ -3120,6 +3128,7 @@ private: bool m_embeddedPopupSet; QTimer *m_timer; }; +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::actionsContextMenu_data() { @@ -3132,6 +3141,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu_data() QTest::newRow("with actionsContextMenu without focus") << true << false; } +#ifndef QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::actionsContextMenu() { QFETCH(bool, hasFocus); @@ -3186,7 +3196,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu() } } - +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::deleteProxyForChildWidget() { diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 25a43d6821..1a775d8b16 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -17,4 +17,3 @@ wince* { DEPLOYMENT += rootFiles renderFiles DEFINES += SRCDIR=\\\".\\\" } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index ae71b0412f..f494e4474c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -108,7 +108,7 @@ class HoverItem : public QGraphicsRectItem public: HoverItem() : QGraphicsRectItem(QRectF(-10, -10, 20, 20)), isHovered(false) - { setAcceptsHoverEvents(true); } + { setAcceptHoverEvents(true); } bool isHovered; @@ -227,8 +227,10 @@ private slots: void render_data(); void render(); void renderItemsWithNegativeWidthOrHeight(); +#ifndef QT_NO_CONTEXTMENU void contextMenuEvent(); void contextMenuEvent_ItemIgnoresTransformations(); +#endif void update(); void update2(); void views(); @@ -301,11 +303,16 @@ void tst_QGraphicsScene::construction() QVERIFY(scene.items(QPainterPath()).isEmpty()); QTest::ignoreMessage(QtWarningMsg, "QGraphicsScene::collidingItems: cannot find collisions for null item"); QVERIFY(scene.collidingItems(0).isEmpty()); - QVERIFY(!scene.itemAt(QPointF())); + QVERIFY(scene.items(QPointF()).isEmpty()); QVERIFY(scene.selectedItems().isEmpty()); QVERIFY(!scene.focusItem()); } +static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y) +{ + return scene.items(QPointF(x, y)).value(0, Q_NULLPTR); +} + void tst_QGraphicsScene::sceneRect() { QGraphicsScene scene; @@ -318,8 +325,8 @@ void tst_QGraphicsScene::sceneRect() item->setPos(-5, -5); QCOMPARE(sceneRectChanged.count(), 0); - QCOMPARE(scene.itemAt(0, 0), item); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), item); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); QCOMPARE(sceneRectChanged.count(), 0); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10)); QCOMPARE(sceneRectChanged.count(), 1); @@ -334,8 +341,8 @@ void tst_QGraphicsScene::sceneRect() QCOMPARE(sceneRectChanged.count(), 3); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); - QCOMPARE(scene.itemAt(0, 0), item); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), item); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); item->setPos(10, 10); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); @@ -344,8 +351,8 @@ void tst_QGraphicsScene::sceneRect() scene.setSceneRect(QRectF()); - QCOMPARE(scene.itemAt(10, 10), item); - QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 10, 10), item); + QVERIFY(scene.items(QPointF(20, 20)).isEmpty()); QCOMPARE(sceneRectChanged.count(), 4); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25)); QCOMPARE(sceneRectChanged.count(), 5); @@ -374,7 +381,7 @@ void tst_QGraphicsScene::itemIndexMethod() for (int x = minX; x < maxX; x += 100) { QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); item->setPos(x, y); - QCOMPARE(scene.itemAt(x, y), item); + QCOMPARE(itemAt(scene, x, y), item); items << item; } } @@ -382,7 +389,7 @@ void tst_QGraphicsScene::itemIndexMethod() int n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } scene.setItemIndexMethod(QGraphicsScene::NoIndex); @@ -391,7 +398,7 @@ void tst_QGraphicsScene::itemIndexMethod() n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } scene.setItemIndexMethod(QGraphicsScene::BspTreeIndex); @@ -400,7 +407,7 @@ void tst_QGraphicsScene::itemIndexMethod() n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } } @@ -439,7 +446,7 @@ void tst_QGraphicsScene::items() items << scene.addRect(QRectF(0, 0, 10, 10)); } QCOMPARE(scene.items().size(), items.size()); - scene.itemAt(0, 0); // trigger indexing + itemAt(scene, 0, 0); // trigger indexing scene.removeItem(items.at(5)); delete items.at(5); @@ -458,8 +465,8 @@ void tst_QGraphicsScene::items() QList<QGraphicsItem *> items; items<<l1<<l2; QCOMPARE(scene.items().size(), items.size()); - QVERIFY(scene.items(-1, -1, 2, 2).contains(l1)); - QVERIFY(scene.items(-1, -1, 2, 2).contains(l2)); + QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l1)); + QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l2)); } } @@ -722,7 +729,7 @@ void tst_QGraphicsScene::items_QRectF_2() QGraphicsItem *item = scene.addEllipse(ellipseRect); QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), contained); - item->rotate(45); + item->setTransform(QTransform().rotate(45), true); QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), containedRotated); } @@ -1085,19 +1092,19 @@ void tst_QGraphicsScene::addItem() QTRY_VERIFY(view.repaints > 0); view.repaints = 0; - QCOMPARE(scene.itemAt(0, 0), path); + QCOMPARE(itemAt(scene, 0, 0), path); QGraphicsItem *path2 = new QGraphicsEllipseItem(QRectF(-10, -10, 20, 20)); path2->setPos(100, 100); - QCOMPARE(scene.itemAt(0, 0), path); - QCOMPARE(scene.itemAt(100, 100), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), path); + QVERIFY(scene.items(QPointF(100, 100)).isEmpty()); scene.addItem(path2); // Adding an item should always issue a repaint. QTRY_VERIFY(view.repaints > 0); - QCOMPARE(scene.itemAt(100, 100), path2); + QCOMPARE(itemAt(scene, 100, 100), path2); } { // 2) Create scene, then item, then add item @@ -1109,8 +1116,8 @@ void tst_QGraphicsScene::addItem() path2->setPos(100, 100); scene.addItem(path2); - QCOMPARE(scene.itemAt(0, 0), path); - QCOMPARE(scene.itemAt(100, 100), path2); + QCOMPARE(itemAt(scene, 0, 0), path); + QCOMPARE(itemAt(scene, 100, 100), path2); } } @@ -1123,15 +1130,15 @@ void tst_QGraphicsScene::addEllipse() QCOMPARE(ellipse->pen(), QPen(Qt::red)); QCOMPARE(ellipse->brush(), QBrush(Qt::blue)); QCOMPARE(ellipse->rect(), QRectF(-10, -10, 20, 20)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(-10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)ellipse); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); } void tst_QGraphicsScene::addLine() @@ -1144,15 +1151,15 @@ void tst_QGraphicsScene::addLine() QCOMPARE(line->pos(), QPointF()); QCOMPARE(line->pen(), pen); QCOMPARE(line->line(), QLineF(-10, -10, 20, 20)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)line); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)line); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)line); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)line); + QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)line); + QVERIFY(scene.items(QPointF(-9.9, 0)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(0, -9.9)).isEmpty()); + QVERIFY(scene.items(QPointF(0, 9.9)).isEmpty()); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(9.9, 0)).isEmpty()); + QCOMPARE(itemAt(scene, 10, 10), (QGraphicsItem *)line); } void tst_QGraphicsScene::addPath() @@ -1170,27 +1177,27 @@ void tst_QGraphicsScene::addPath() path->setPen(QPen(Qt::red, 0)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-9.9, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(9.9, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 20.1), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 39.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 20), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 20), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, -9.9, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 9.9, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 20.1), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 39.9), (QGraphicsItem *)path); + QVERIFY(scene.items(QPointF(-10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 20)).isEmpty()); + QVERIFY(scene.items(QPointF(10, 20)).isEmpty()); if (sizeof(qreal) != sizeof(double)) QWARN("Skipping test because of rounding errors when qreal != double"); else - QCOMPARE(scene.itemAt(-10, 30), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10.1, 30), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(-10, 30)).isEmpty()); + QVERIFY(scene.items(QPointF(10.1, 30)).isEmpty()); } void tst_QGraphicsScene::addPixmap() @@ -1201,16 +1208,17 @@ void tst_QGraphicsScene::addPixmap() QCOMPARE(pixmap->pos(), QPointF()); QCOMPARE(pixmap->pixmap(), pix); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(pix.width() - 1, 0), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(0, pix.height() - 1), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(-1, -1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width() - 1, -1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-1, pix.height() - 1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width(), pix.height()), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, pix.height()), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width(), 0), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, pix.width() - 1, 0), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, 0, pix.height() - 1), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap); + + QVERIFY(scene.items(QPointF(-1, -1)).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width() - 1, -1)).isEmpty()); + QVERIFY(scene.items(QPointF(-1, pix.height() - 1)).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width(), pix.height())).isEmpty()); + QVERIFY(scene.items(QPointF(0, pix.height())).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width(), 0)).isEmpty()); } void tst_QGraphicsScene::addRect() @@ -1225,15 +1233,15 @@ void tst_QGraphicsScene::addRect() rect->setPen(QPen(Qt::red, 0)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); } void tst_QGraphicsScene::addText() @@ -1252,14 +1260,14 @@ void tst_QGraphicsScene::removeItem() #endif QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); - QCOMPARE(scene.itemAt(0, 0), item); // forces indexing + QCOMPARE(itemAt(scene, 0, 0), item); // forces indexing scene.removeItem(item); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(0, 0)).isEmpty()); delete item; QGraphicsItem *item2 = scene.addRect(QRectF(0, 0, 10, 10)); item2->setFlag(QGraphicsItem::ItemIsSelectable); - QCOMPARE(scene.itemAt(0, 0), item2); + QCOMPARE(itemAt(scene, 0, 0), item2); // Removing a selected item QVERIFY(scene.selectedItems().isEmpty()); @@ -1289,7 +1297,7 @@ void tst_QGraphicsScene::removeItem() QTRY_VERIFY(hoverItem->isHovered); scene.removeItem(hoverItem); - hoverItem->setAcceptsHoverEvents(false); + hoverItem->setAcceptHoverEvents(false); scene.addItem(hoverItem); QTRY_VERIFY(!hoverItem->isHovered); } @@ -1801,7 +1809,7 @@ void tst_QGraphicsScene::createItemGroup() scene.destroyItemGroup(group); QGraphicsItemGroup *emptyGroup = scene.createItemGroup(QList<QGraphicsItem *>()); - QCOMPARE(emptyGroup->children(), QList<QGraphicsItem *>()); + QVERIFY(emptyGroup->childItems().isEmpty()); QVERIFY(!emptyGroup->parentItem()); QCOMPARE(emptyGroup->scene(), &scene); } @@ -2140,7 +2148,7 @@ void tst_QGraphicsScene::mouseEventPropagation_mouseMove() { Scene scene; scene.addRect(QRectF(5, 0, 12, 12)); - scene.addRect(QRectF(15, 0, 12, 12))->setAcceptsHoverEvents(true); + scene.addRect(QRectF(15, 0, 12, 12))->setAcceptHoverEvents(true); for (int i = 0; i < 30; ++i) { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove); event.setScenePos(QPointF(i, 5)); @@ -2622,7 +2630,8 @@ void tst_QGraphicsScene::render() painter.end(); const QString renderPath = QLatin1String(SRCDIR) + "/testData/render"; - QString fileName = renderPath + QString("/%1.png").arg(QTest::currentDataTag()); + QString fileName = renderPath + QLatin1Char('/') + QLatin1String(QTest::currentDataTag()) + + QLatin1String(".png"); QImage original(fileName); QVERIFY(!original.isNull()); @@ -2706,6 +2715,7 @@ void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() QCOMPARE(actual, expected); } +#ifndef QT_NO_CONTEXTMENU void tst_QGraphicsScene::contextMenuEvent() { QGraphicsScene scene; @@ -2788,6 +2798,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() QVERIFY(!event.isAccepted()); } } +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsScene::update() { @@ -2800,7 +2811,7 @@ void tst_QGraphicsScene::update() rect->setPos(-100, -100); // This function forces indexing - scene.itemAt(0, 0); + itemAt(scene, 0, 0); qRegisterMetaType<QList<QRectF> >("QList<QRectF>"); QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>))); @@ -2809,7 +2820,7 @@ void tst_QGraphicsScene::update() scene.update(); // This function forces a purge, which will post an update signal - scene.itemAt(0, 0); + itemAt(scene, 0, 0); // This will process the pending update QApplication::instance()->processEvents(); @@ -3257,10 +3268,11 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets() FocusWidget *widget1_1 = new FocusWidget; FocusWidget *widget1_2 = new FocusWidget; widget1_1->setParentItem(widget1); - widget1_1->scale(0.5, 0.5); + const QTransform scale(QTransform::fromScale(0.5, 0.5)); + widget1_1->setTransform(scale, true); widget1_1->setPos(0, widget1->boundingRect().height() / 2); widget1_2->setParentItem(widget1); - widget1_2->scale(0.5, 0.5); + widget1_2->setTransform(scale, true); widget1_2->setPos(widget1->boundingRect().width() / 2, widget1->boundingRect().height() / 2); FocusWidget *widget2 = new FocusWidget; @@ -3520,7 +3532,7 @@ void tst_QGraphicsScene::task250680_childClip() QVERIFY(QPathCompare::comparePaths(rect->clipPath().simplified(), path)); QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); - rect->rotate(45); + rect->setTransform(QTransform().rotate(45), true); QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); } @@ -3599,20 +3611,20 @@ void tst_QGraphicsScene::sorting() // view.show(); qDebug() << "items: {"; - foreach (QGraphicsItem *item, scene.items(32, 31, 4, 55)) + foreach (QGraphicsItem *item, scene.items(QRectF(32, 31, 4, 55))) qDebug() << "\t" << item->data(0).toString(); qDebug() << "}"; - QCOMPARE(scene.items(32, 31, 4, 55), + QCOMPARE(scene.items(QRectF(32, 31, 4, 55)), QList<QGraphicsItem *>() << c_1_2 << c_1_1_1 << c_1 << t_1); - QCOMPARE(scene.items(-53, 47, 136, 3), + QCOMPARE(scene.items(QRectF(-53, 47, 136, 3)), QList<QGraphicsItem *>() << c_2_2 << c_2_1 << c_2 << c_1_2 << c_1_1 << c_1 << t_1); - QCOMPARE(scene.items(-23, 79, 104, 3), + QCOMPARE(scene.items(QRectF(-23, 79, 104, 3)), QList<QGraphicsItem *>() << c_2_1_1 << c_1_1_1); - QCOMPARE(scene.items(-26, -3, 92, 79), + QCOMPARE(scene.items(QRectF(-26, -3, 92, 79)), QList<QGraphicsItem *>() << c_2_2 << c_2_1_1 << c_2_1 << c_2 << c_1_2 << c_1_1_1 << c_1_1 << c_1 @@ -4376,7 +4388,7 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() QGraphicsProxyWidget *proxy = scene->addWidget(w); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - proxy->rotate(15); + proxy->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4422,7 +4434,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(backItem); rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - backItem->rotate(15); + backItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4464,7 +4476,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(rectItem); rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); - rectItem->rotate(15); + rectItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4505,7 +4517,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(rectItem); rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); - rectItem->rotate(15); + rectItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4609,41 +4621,41 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); QVERIFY(topLevelItem2->hasFocus()); scene.clearFocus(); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); scene.setFocus(Qt::MenuBarFocusReason); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason); for (int i = 0; i < 3; ++i) { topLevelItem1->setFocus(Qt::TabFocusReason); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); topLevelItem2->setFocus(Qt::TabFocusReason); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); } // The following two are unexpected, but fixing this (i.e., losing and gaining focus @@ -4664,9 +4676,9 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); QGraphicsRectItem *panel2 = new QGraphicsRectItem; panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable); @@ -4678,17 +4690,17 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); scene.setActivePanel(panel1); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); } } diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro index 3d0d73566e..3b74ab0c75 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro @@ -4,4 +4,3 @@ requires(contains(QT_CONFIG,private_tests)) QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicssceneindex.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index b2d6eef9b1..88c081bcfb 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -327,7 +327,7 @@ void tst_QGraphicsSceneIndex::removeItems() delete widgetChild1; //We move the parent - scene.items(295, 295, 50, 50); + scene.items(QRectF(295, 295, 50, 50)); //This should not crash } diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro index a46c803e41..68ee58d0d7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro +++ b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qgraphicstransform QT += widgets testlib SOURCES += tst_qgraphicstransform.cpp -CONFIG += parallel_test - diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro index d1f9bede0b..258b5e0e14 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro @@ -9,4 +9,3 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp HEADERS += tst_qgraphicsview.h DEFINES += QT_NO_CAST_TO_ASCII -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 98473fb5cc..9f70736436 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -275,9 +275,6 @@ public slots: void dummySlot() {} private: -#if defined Q_OS_BLACKBERRY - QScopedPointer<QWidget> rootWindow; -#endif QString platformName; }; @@ -286,13 +283,6 @@ void tst_QGraphicsView::initTestCase() #ifdef Q_OS_WINCE_WM qApp->setAutoMaximizeThreshold(-1); #endif - -#if defined Q_OS_BLACKBERRY - // On BlackBerry first window is always shown full screen. However, many tests rely on specific - // window sizes. Create a dummy full screen window, so subsequent windows have correct size. - rootWindow.reset(new QWidget); - rootWindow->show(); -#endif } void tst_QGraphicsView::cleanup() @@ -468,10 +458,12 @@ void tst_QGraphicsView::interactive() QCOMPARE(item->events.size(), i * 5 + 5); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse); +#ifndef QT_NO_CONTEXTMENU QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); QCOMPARE(item->events.size(), i * 5 + 6); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#endif // QT_NO_CONTEXTMENU } view.setInteractive(false); @@ -483,10 +475,12 @@ void tst_QGraphicsView::interactive() sendMouseRelease(view.viewport(), itemPoint); QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#ifndef QT_NO_CONTEXTMENU QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#endif // QT_NO_CONTEXTMENU } } @@ -583,7 +577,7 @@ void tst_QGraphicsView::sceneRect_growing() QGraphicsScene scene; for (int i = 0; i < 100; ++i) - scene.addText(QString("(0, %1)").arg((i - 50) * 20))->setPos(0, (i - 50) * 20); + scene.addText(QLatin1String("(0, ") + QString::number((i - 50) * 20))->setPos(0, (i - 50) * 20); QGraphicsView view(&scene, &toplevel); view.setFixedSize(200, 200); @@ -1391,8 +1385,8 @@ void tst_QGraphicsView::fitInView() items[2]->setPos(-100, 100); items[3]->setPos(100, 100); - items[0]->rotate(30); - items[1]->rotate(-30); + items[0]->setTransform(QTransform().rotate(30), true); + items[1]->setTransform(QTransform().rotate(-30), true); #if defined(Q_OS_WINCE) //Is the standard scrollbar size @@ -2888,9 +2882,6 @@ void tst_QGraphicsView::scrollBarRanges() QFETCH(ExpectedValueDescription, vmax); QFETCH(bool, useStyledPanel); - if (style == QLatin1String("GTK+") && useStyledPanel) - QSKIP("GTK + style test skipped, see QTBUG-29002"); - if (useStyledPanel && style == QStringLiteral("Macintosh") && platformName == QStringLiteral("cocoa")) QSKIP("Insignificant on OSX"); QGraphicsScene scene; @@ -3506,7 +3497,7 @@ void tst_QGraphicsView::embeddedViews() SpyItem *item = new SpyItem; v2->scene()->addItem(item); - proxy->translate(5, 5); + proxy->setTransform(QTransform::fromTranslate(5, 5), true); QImage actual(64, 64, QImage::Format_ARGB32_Premultiplied); actual.fill(0); diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro index 481bc96d96..042c42f63f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -6,4 +6,3 @@ QT += core-private gui-private SOURCES += tst_qgraphicswidget.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index ec2203e615..b61610dee3 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -588,7 +588,7 @@ void tst_QGraphicsWidget::focusPolicy_data() QTest::addColumn<Qt::FocusPolicy>("focusPolicy2"); for (int i = 0; i < 25; ++i) { - QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1()); + QTestData &data = QTest::newRow(QByteArray::number(i).constData()); switch(i % 5) { case 0: data << Qt::TabFocus; break; case 1: data << Qt::ClickFocus; break; @@ -1108,7 +1108,7 @@ void tst_QGraphicsWidget::initStyleOption() view.setAlignment(Qt::AlignTop | Qt::AlignLeft); SubQGraphicsWidget *widget = new SubQGraphicsWidget; - widget->setAcceptsHoverEvents(true); + widget->setAcceptHoverEvents(true); QStyleOption option; scene.addItem(widget); @@ -1499,7 +1499,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent() for (i = 1; i < 4; ++i) { QGraphicsWidget *wid = new QGraphicsWidget; wid->setFocusPolicy(Qt::StrongFocus); - wid->setData(0, QString::fromLatin1("w%1").arg(i)); + wid->setData(0, QLatin1Char('w') + QString::number(i)); scene.addItem(wid); if (i == 1) w1 = wid; @@ -1539,7 +1539,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent() for (i = 1; i < 5; ++i) { QGraphicsWidget *wid = new QGraphicsWidget; wid->setFocusPolicy(Qt::StrongFocus); - wid->setData(0, QString::fromLatin1("w%1").arg(i)); + wid->setData(0, QLatin1Char('w') + QString::number(i)); scene.addItem(wid); if (i == 1) w1 = wid; @@ -2090,12 +2090,12 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(!scene.itemAt(25, 25)); + QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty()); widget->setGeometry(0, 112, 360, 528); - QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); widget2->setGeometry(0, 573, 360, 67); - QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); - QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2); } void tst_QGraphicsWidget::defaultSize() diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 3a17f7c690..fa184b1ba5 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -872,7 +872,7 @@ class DnDTestModel : public QStandardItemModel public: DnDTestModel() : QStandardItemModel(20, 20), dropAction_result(Qt::IgnoreAction) { for (int i = 0; i < rowCount(); ++i) - setData(index(i, 0), QString("%1").arg(i)); + setData(index(i, 0), QString::number(i)); } Qt::DropAction dropAction() const { return dropAction_result; } }; @@ -1277,9 +1277,9 @@ void tst_QAbstractItemView::task250754_fontChange() QStandardItemModel *m = new QStandardItemModel(this); for (int i=0; i<20; ++i) { - QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + QStandardItem *item = new QStandardItem(QStringLiteral("Item number ") + QString::number(i)); for (int j=0; j<5; ++j) { - QStandardItem *child = new QStandardItem(QString("Child Item number %1").arg(j)); + QStandardItem *child = new QStandardItem(QStringLiteral("Child Item number ") + QString::number(j)); item->setChild(j, 0, child); } m->setItem(i, 0, item); @@ -1369,7 +1369,7 @@ void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling() { QStandardItemModel model; for (int i=0; i<10; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1406,7 +1406,7 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection() { QStandardItemModel model; for (int i=0; i<3; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1483,7 +1483,7 @@ void tst_QAbstractItemView::ctrlRubberbandSelection() { QStandardItemModel model; for (int i=0; i<3; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1609,11 +1609,6 @@ void tst_QAbstractItemView::testDelegateDestroyEditor() void tst_QAbstractItemView::testClickedSignal() { -#if defined Q_OS_BLACKBERRY - QWidget rootWindow; - rootWindow.show(); - QTest::qWaitForWindowExposed(&rootWindow); -#endif QTableWidget view(5, 5); centerOnScreen(&view); diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 6645da727c..894058b41a 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -112,12 +112,14 @@ public: for (int j = 0; j < 10; ++j) { QStandardItem *parentItem = invisibleRootItem(); for (int i = 0; i < 10; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + const QString iS = QString::number(i); + const QString itemText = QLatin1String("item ") + iS; + QStandardItem *item = new QStandardItem(itemText); parentItem->appendRow(item); - QStandardItem *item2 = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item2 = new QStandardItem(itemText); parentItem->appendRow(item2); - item2->appendRow(new QStandardItem(QString("item %0").arg(i))); - parentItem->appendRow(new QStandardItem(QString("file %0").arg(i))); + item2->appendRow(new QStandardItem(itemText)); + parentItem->appendRow(new QStandardItem(QLatin1String("file ") + iS)); parentItem = item; } } diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro b/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro index 3f4cb491f4..53b23b5ef2 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdatawidgetmapper QT += widgets testlib SOURCES += tst_qdatawidgetmapper.cpp diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 8b80d52a5f..5b7a2a46ad 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -66,8 +66,10 @@ static QStandardItemModel *testModel(QObject *parent = 0) QStandardItemModel *model = new QStandardItemModel(10, 10, parent); for (int row = 0; row < 10; ++row) { + const QString prefix = QLatin1String("item ") + QString::number(row) + + QLatin1Char(' '); for (int col = 0; col < 10; ++col) - model->setData(model->index(row, col), QString("item %1 %2").arg(row).arg(col)); + model->setData(model->index(row, col), prefix + QString::number(col)); } return model; diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index f12876f745..63cf7b2751 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -416,14 +416,14 @@ void tst_QDirModel::rowsAboutToBeRemoved_data() bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QStringList &initial_files) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; if (!QDir::current().mkdir(test_path) && false) { // FIXME qDebug() << "failed to create dir" << path; return false; } for (int i = 0; i < initial_files.count(); ++i) { - QFile file(path + "/" + initial_files.at(i)); + QFile file(path + QLatin1Char('/') + initial_files.at(i)); if (!file.open(QIODevice::WriteOnly)) { qDebug() << "failed to open file" << initial_files.at(i); return false; @@ -443,7 +443,7 @@ bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QS bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files); QStringList files = dir.entryList(); @@ -584,8 +584,8 @@ void tst_QDirModel::filePath() QString path = SRCDIR; #else QString path = QFileInfo(SRCDIR).absoluteFilePath(); - if (!path.endsWith("/")) - path += "/"; + if (!path.endsWith(QLatin1Char('/'))) + path += QLatin1Char('/'); #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro b/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro index 0c3a780405..37173a175e 100644 --- a/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro +++ b/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfileiconprovider QT += widgets testlib SOURCES += tst_qfileiconprovider.cpp diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 55fcf04846..34cd9a55fc 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -272,7 +272,8 @@ public: wrongIndex = true; qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); } - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0);//idx.data()); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1String(",0]"); } void insertOneColumn(int col) @@ -1569,7 +1570,7 @@ public: return QVariant(); } if (role == Qt::DisplayRole) { - return QString::fromLatin1("%1,%2").arg(index.row()).arg(index.column()); + return QString::number(index.row()) + QLatin1Char(',') + QString::number(index.column()); } return QVariant(); } @@ -2242,13 +2243,21 @@ void tst_QHeaderView::QTBUG8650_crashOnInsertSections() model.insertColumn(0, items); } +static void setModelTexts(QStandardItemModel *model) +{ + const int columnCount = model->columnCount(); + for (int i = 0, rowCount = model->rowCount(); i < rowCount; ++i) { + const QString prefix = QLatin1String("item [") + QString::number(i) + QLatin1Char(','); + for (int j = 0; j < columnCount; ++j) + model->setData(model->index(i, j), prefix + QString::number(j) + QLatin1Char(']')); + } +} + void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting() { QTableView view; // ### this test fails on QTableView &view = *m_tableview; !? + shadowing view member QStandardItemModel *model = new QStandardItemModel(4,3, &view); - for (int i = 0; i< model->rowCount(); ++i) - for (int j = 0; j< model->columnCount(); ++j) - model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j)); + setModelTexts(model); view.setModel(model); view.horizontalHeader()->setSectionsMovable(true); view.setSortingEnabled(true); @@ -2324,9 +2333,7 @@ void tst_QHeaderView::initialSortOrderRole() { QTableView view; // ### Shadowing member view (of type QHeaderView) QStandardItemModel *model = new QStandardItemModel(4, 3, &view); - for (int i = 0; i< model->rowCount(); ++i) - for (int j = 0; j< model->columnCount(); ++j) - model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j)); + setModelTexts(model); QStandardItem *ascendingItem = new QStandardItem(); QStandardItem *descendingItem = new QStandardItem(); ascendingItem->setData(Qt::AscendingOrder, Qt::InitialSortOrderRole); @@ -2494,7 +2501,7 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare QString msg = "semantic problem at " + QString(__FILE__) + " (" + sline + ")"; msg += "\nThe *expected* result was : {" + istr(x[0]) + istr(x[1]) + istr(x[2]) + istr(x[3]) - + istr(x[4]) + istr(x[5]) + istr(x[6], false) + "}"; + + istr(x[4]) + istr(x[5]) + istr(x[6], false) + QLatin1Char('}'); msg += "\nThe calculated result was : {"; msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; @@ -2572,7 +2579,7 @@ void tst_QHeaderView::additionalInit() for (int i = 0; i < model->rowCount(); ++i) { model->setData(model->index(i, 0), QVariant(i)); s.setNum(i); - s += "."; + s += QLatin1Char('.'); s += 'a' + (i % 25); model->setData(model->index(i, 1), QVariant(s)); } diff --git a/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro b/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro index 55df1d83f1..5ff7771585 100644 --- a/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro +++ b/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qitemeditorfactory QT += widgets testlib SOURCES += tst_qitemeditorfactory.cpp diff --git a/tests/auto/widgets/itemviews/qitemview/qitemview.pro b/tests/auto/widgets/itemviews/qitemview/qitemview.pro index 6e1697f790..079953d60d 100644 --- a/tests/auto/widgets/itemviews/qitemview/qitemview.pro +++ b/tests/auto/widgets/itemviews/qitemview/qitemview.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qitemview QT += widgets testlib SOURCES += tst_qitemview.cpp diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index 8fd86ea467..64919581c3 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -288,14 +288,16 @@ void tst_QItemView::populate() const int baseInsert = 26; #endif for (int i = 0; i < 40; ++i) { + const QString iS = QString::number(i); parent = treeModel->index(0, 0, parent); treeModel->insertRows(0, baseInsert + i, parent); treeModel->insertColumns(0, baseInsert + i, parent); // Fill in some values to make it easier to debug for (int x = 0; x < treeModel->rowCount(); ++x) { + const QString xS = QString::number(x); for (int y = 0; y < treeModel->columnCount(); ++y) { QModelIndex index = treeModel->index(x, y, parent); - treeModel->setData(index, QString("%1_%2_%3").arg(x).arg(y).arg(i)); + treeModel->setData(index, xS + QLatin1Char('_') + QString::number(y) + QLatin1Char('_') + iS); treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::TextColorRole); } } diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 5b206af357..13b953c48b 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -74,6 +74,15 @@ static inline void setFrameless(QWidget *w) w->setWindowFlags(flags); } +static QStringList generateList(const QString &prefix, int size) +{ + QStringList result; + result.reserve(size); + for (int i = 0; i < size; ++i) + result.append(prefix + QString::number(i)); + return result; +} + class tst_QListView : public QObject { Q_OBJECT @@ -255,7 +264,7 @@ public: wrongIndex = true; qWarning("got invalid modelIndex %d/%d", idx.row(), idx.column()); } - return QString("%1/%2").arg(idx.row()).arg(idx.column()); + return QString::number(idx.row()) + QLatin1Char('/') + QString::number(idx.column()); } void removeLastRow() @@ -364,10 +373,11 @@ void tst_QListView::cursorMove() view.setModel(&model); for (int j = 0; j < columns; ++j) { + const QString postfix = QLatin1Char(',') + QString::number(j) + QLatin1Char(']'); view.setModelColumn(j); for (int i = 0; i < rows; ++i) { QModelIndex index = model.index(i, j); - model.setData(index, QString("[%1,%2]").arg(i).arg(j)); + model.setData(index, QLatin1Char('[') + QString::number(i) + postfix); view.setCurrentIndex(index); QApplication::processEvents(); QCOMPARE(view.currentIndex(), index); @@ -468,7 +478,7 @@ void tst_QListView::hideRows() QStandardItemModel sim(0); QStandardItem *root = new QStandardItem("Root row"); for (int i=0;i<5;i++) - root->appendRow(new QStandardItem(QString("Row %1").arg(i))); + root->appendRow(new QStandardItem(QLatin1String("Row ") + QString::number(i))); sim.appendRow(root); view.setModel(&sim); view.setRootIndex(root->index()); @@ -702,9 +712,11 @@ void tst_QListView::singleSelectionRemoveColumn() int numCols = 3; int numRows = 3; QStandardItemModel model(numCols, numRows); - for (int r = 0; r < numRows; ++r) + for (int r = 0; r < numRows; ++r) { + const QString prefix = QString::number(r) + QLatin1Char(','); for (int c = 0; c < numCols; ++c) - model.setData(model.index(r, c), QString("%1,%2").arg(r).arg(c)); + model.setData(model.index(r, c), prefix + QString::number(c)); + } QListView view; view.setModel(&model); @@ -729,10 +741,11 @@ void tst_QListView::modelColumn() int numCols = 3; int numRows = 3; QStandardItemModel model(numCols, numRows); - for (int r = 0; r < numRows; ++r) + for (int r = 0; r < numRows; ++r) { + const QString prefix = QString::number(r) + QLatin1Char(','); for (int c = 0; c < numCols; ++c) - model.setData(model.index(r, c), QString("%1,%2").arg(r).arg(c)); - + model.setData(model.index(r, c), prefix + QString::number(c)); + } QListView view; view.setModel(&model); @@ -811,10 +824,7 @@ void tst_QListView::batchedMode() { const int rowCount = 3; - QStringList items; - for (int i = 0; i < rowCount; ++i) - items << QLatin1String("item ") + QString::number(i); - QStringListModel model(items); + QStringListModel model(generateList(QLatin1String("item "), rowCount)); QListView view; view.setWindowTitle(QTest::currentTestFunction()); @@ -840,11 +850,7 @@ void tst_QListView::batchedMode() void tst_QListView::setCurrentIndex() { - QStringList items; - int i; - for (i=0; i <20; ++i) - items << QString("item %1").arg(i); - QStringListModel model(items); + QStringListModel model(generateList(QLatin1String("item "), 20)); QListView view; view.setModel(&model); @@ -866,7 +872,7 @@ void tst_QListView::setCurrentIndex() int offset = sb->value(); // first "scroll" down, verify that we scroll one step at a time - i = 0; + int i = 0; for (i = 0; i < 20; ++i) { QModelIndex idx = model.index(i,0); view.setCurrentIndex(idx); @@ -1289,7 +1295,7 @@ void tst_QListView::scrollBarRanges() QStringListModel model(&lv); QStringList list; for (int i = 0; i < rowCount; ++i) - list << QString::fromLatin1("Item %1").arg(i); + list << QLatin1String("Item ") + QString::number(i); model.setStringList(list); lv.setModel(&model); @@ -1387,17 +1393,13 @@ void tst_QListView::scrollBarAsNeeded() QStringList list; int i; for (i = 0; i < rowCounts[r]; ++i) - list << QString::fromLatin1("Item %1").arg(i); + list << QLatin1String("Item ") + QString::number(i); model.setStringList(list); QApplication::processEvents(); QTest::qWait(50); - QStringList replacement; - for (i = 0; i < itemCount; ++i) { - replacement << QString::fromLatin1("Item %1").arg(i); - } - model.setStringList(replacement); + model.setStringList(generateList(QLatin1String("Item "), itemCount)); QApplication::processEvents(); @@ -1410,10 +1412,9 @@ void tst_QListView::moveItems() { QStandardItemModel model; for (int r = 0; r < 4; ++r) { - for (int c = 0; c < 4; ++c) { - QStandardItem* item = new QStandardItem(QString("standard item (%1,%2)").arg(r).arg(c)); - model.setItem(r, c, item); - } + const QString prefix = QLatin1String("standard item (") + QString::number(r) + QLatin1Char(','); + for (int c = 0; c < 4; ++c) + model.setItem(r, c, new QStandardItem(prefix + QString::number(c) + QLatin1Char(')'))); } PublicListView view; @@ -1455,15 +1456,6 @@ void tst_QListView::wordWrap() lv.setModel(&model); lv.setWordWrap(true); lv.setFixedSize(400, 150); - -#if defined Q_OS_BLACKBERRY - QFont font = lv.font(); - // On BB10 the root window is stretched over the whole screen - // This makes sure that the text will be long enough to produce - // a vertical scrollbar - font.setPixelSize(50); - lv.setFont(font); -#endif lv.showNormal(); QApplication::processEvents(); @@ -1525,9 +1517,10 @@ void tst_QListView::emptyItemSize() { QStandardItemModel model; for (int r = 0; r < 4; ++r) { - QStandardItem* item = new QStandardItem(QString("standard item (%1)").arg(r)); - model.setItem(r, 0, item); + const QString text = QLatin1String("standard item (") + QString::number(r) + QLatin1Char(')'); + model.setItem(r, new QStandardItem(text)); } + model.setItem(4, 0, new QStandardItem()); PublicListView view; @@ -1994,12 +1987,7 @@ public: void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges() { - QStringList list; - const int nrItems = 8; - for (int i = 0; i < nrItems; i++) - list << QString::asprintf("item %d", i); - - QStringListModel model(list); + QStringListModel model(generateList("item ", 8)); ListView_9455 w; setFrameless(&w); w.setModel(&model); @@ -2083,7 +2071,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout() QListWidgetItem *item = new QListWidgetItem(); item->setText(QString("Item %L1").arg(i)); lw.addItem(item); - if (!item->text().contains(QString::fromLatin1("1"))) + if (!item->text().contains(QLatin1Char('1'))) item->setHidden(true); } lw.show(); @@ -2099,12 +2087,6 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems_data() void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems() { -#if defined Q_OS_BLACKBERRY - // On BB10 we need to create a root window which is automatically stretched - // over the whole screen - QWindow rootWindow; - rootWindow.show(); -#endif QFETCH(int, flow); QListView lv; @@ -2173,9 +2155,9 @@ void tst_QListView::draggablePaintPairs() view.scrollTo(expectedIndex); QItemViewPaintPairs pairs = privateClass->draggablePaintPairs(indexList, &rect); QCOMPARE(indexList.size(), pairs.size()); - foreach (const QItemViewPaintPair pair, pairs) { - QCOMPARE(rect, pair.first); - QCOMPARE(expectedIndex, pair.second); + foreach (const QItemViewPaintPair &pair, pairs) { + QCOMPARE(rect, pair.rect); + QCOMPARE(expectedIndex, pair.index); } } @@ -2297,12 +2279,6 @@ void tst_QListView::spacing() void tst_QListView::testScrollToWithHidden() { -#if defined Q_OS_BLACKBERRY - // On BB10 we need to create a root window which is automatically stretched - // over the whole screen - QWindow rootWindow; - rootWindow.show(); -#endif QListView lv; QStringListModel model; diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index ecf72613da..7b5fd34f44 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -230,7 +230,7 @@ void tst_QListWidget::populate() void tst_QListWidget::addItem() { int count = testWidget->count(); - QString label = QString("%1").arg(count); + const QString label = QString::number(count); testWidget->addItem(label); QCOMPARE(testWidget->count(), ++count); QCOMPARE(testWidget->item(testWidget->count()-1)->text(), label); @@ -244,7 +244,7 @@ void tst_QListWidget::addItem2() testWidget->addItem(0); QCOMPARE(testWidget->count(), count); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(count)); + QListWidgetItem *item = new QListWidgetItem(QString::number(count)); item->setFlags(item->flags() | Qt::ItemIsEditable); testWidget->addItem(item); QCOMPARE(testWidget->count(), ++count); @@ -261,10 +261,10 @@ void tst_QListWidget::addItems() QCOMPARE(testWidget->count(), count); QStringList stringList; - QString label = QString("%1").arg(count); - stringList << QString("%1").arg(testWidget->count() + 1) - << QString("%1").arg(testWidget->count() + 2) - << QString("%1").arg(testWidget->count() + 3) + QString label = QString::number(count); + stringList << QString::number(testWidget->count() + 1) + << QString::number(testWidget->count() + 2) + << QString::number(testWidget->count() + 3) << label; testWidget->addItems(stringList); QCOMPARE(testWidget->count(), count + stringList.count()); @@ -276,7 +276,7 @@ void tst_QListWidget::openPersistentEditor() { // Boundary checking testWidget->openPersistentEditor(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->openPersistentEditor(item); int childCount = testWidget->viewport()->children().count(); @@ -290,7 +290,7 @@ void tst_QListWidget::closePersistentEditor() // Boundary checking int childCount = testWidget->viewport()->children().count(); testWidget->closePersistentEditor(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->closePersistentEditor(item); QCOMPARE(childCount, testWidget->viewport()->children().count()); @@ -316,7 +316,7 @@ void tst_QListWidget::setItemHidden() if (testWidget->isItemHidden(testWidget->item(i))) totalHidden++; - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->addItem(item); // Check that nothing else changed @@ -362,7 +362,7 @@ void tst_QListWidget::setCurrentItem() { QFETCH(int, fill); for (int i = 0; i < fill; ++i) - testWidget->addItem(QString("%1").arg(i)); + testWidget->addItem(QString::number(i)); // Boundary checking testWidget->setCurrentItem((QListWidgetItem *)0); @@ -394,7 +394,7 @@ void tst_QListWidget::setCurrentRow() { QFETCH(int, fill); for (int i = 0; i < fill; ++i) - testWidget->addItem(QString("%1").arg(i)); + testWidget->addItem(QString::number(i)); // Boundary checking testWidget->setCurrentRow(-1); @@ -455,7 +455,7 @@ void tst_QListWidget::editItem() { // Boundary checking testWidget->editItem(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->editItem(item); QFETCH(bool, editable); @@ -650,7 +650,7 @@ void tst_QListWidget::item() QCOMPARE(item, static_cast<QListWidgetItem*>(0)); QCOMPARE(testWidget->count(), 3); } else { - QCOMPARE(item->text(), QString("item%1").arg(row)); + QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); QCOMPARE(testWidget->count(), 3); } } @@ -683,7 +683,7 @@ void tst_QListWidget::takeItem() QCOMPARE(item, static_cast<QListWidgetItem*>(0)); QCOMPARE(testWidget->count(), 3); } else { - QCOMPARE(item->text(), QString("item%1").arg(row)); + QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); QCOMPARE(testWidget->count(), 2); } @@ -746,7 +746,7 @@ void tst_QListWidget::selectedItems() //insert items for (int i=0; i<itemCount; ++i) - new QListWidgetItem(QString("Item%1").arg(i), testWidget); + new QListWidgetItem(QStringLiteral("Item") + QString::number(i), testWidget); //test the selection testWidget->setSelectionMode(QListWidget::SingleSelection); @@ -1245,8 +1245,8 @@ void tst_QListWidget::insertItemsWithSorting_data() QStringList ascendingItems; QStringList reverseItems; for (int i = 'a'; i <= 'z'; ++i) { - ascendingItems << QString("%0").arg(QLatin1Char(i)); - reverseItems << QString("%0").arg(QLatin1Char('z' - i + 'a')); + ascendingItems << QString(1, QLatin1Char(i)); + reverseItems << QString(1, QLatin1Char('z' - i + 'a')); ascendingRows << i - 'a'; reverseRows << 'z' - i + 'a'; } @@ -1490,7 +1490,7 @@ void tst_QListWidget::fastScroll() QWidget topLevel; MyListWidget widget(&topLevel); for (int i = 0; i < 50; ++i) - widget.addItem(QString("Item %1").arg(i)); + widget.addItem(QStringLiteral("Item ") + QString::number(i)); topLevel.resize(300, 300); // toplevel needs to be wide enough for the item topLevel.show(); diff --git a/tests/auto/widgets/itemviews/qtableview/qtableview.pro b/tests/auto/widgets/itemviews/qtableview/qtableview.pro index 0814af77fb..e02da95ab9 100644 --- a/tests/auto/widgets/itemviews/qtableview/qtableview.pro +++ b/tests/auto/widgets/itemviews/qtableview/qtableview.pro @@ -3,6 +3,4 @@ TARGET = tst_qtableview QT += widgets widgets-private testlib QT += core-private gui-private -TARGET.EPOCHEAPSIZE = 0x200000 0x800000 SOURCES += tst_qtableview.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index e5abd6bc46..45dab3f2c1 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -325,8 +325,10 @@ public: return QVariant(); } - if (role == Qt::DisplayRole || role == Qt::EditRole) - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0); + if (role == Qt::DisplayRole || role == Qt::EditRole) { + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1String(",0]"); + } return QVariant(); } @@ -415,7 +417,8 @@ public: void reset() { - QAbstractTableModel::reset(); + beginResetModel(); + endResetModel(); } int row_count; @@ -3606,7 +3609,11 @@ public: { return QVariant(); } - void res() { reset(); } + void res() + { + beginResetModel(); + endResetModel(); + } int rows; int columns; @@ -3797,7 +3804,7 @@ public: int role = Qt::DisplayRole) const { if (role == Qt::DisplayRole) - return QString("%1 - %2").arg(index.column()).arg(index.row()); + return QString::number(index.column()) + QLatin1String(" - ") + QString::number(index.row()); return QVariant(); } @@ -3919,12 +3926,12 @@ void tst_QTableView::task227953_setRootIndex() //setup the first table as a child of the first item for ( int row = 0; row < 40; ++row ) { - item1.appendRow(QList<QStandardItem*>() << new QStandardItem(QString("row %0").arg(row))); + item1.appendRow(QList<QStandardItem*>() << new QStandardItem(QLatin1String("row ") + QString::number(row))); } //setup the second table as a child of the second item for ( int row = 0; row < 10; ++row ) { - item2.appendRow(QList<QStandardItem*>() << new QStandardItem(QString("row %0").arg(row))); + item2.appendRow(QList<QStandardItem*>() << new QStandardItem(QLatin1String("row ") + QString::number(row))); } tableView.setModel(&model); diff --git a/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro b/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro index d2c962b4de..114ce115eb 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro +++ b/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtablewidget QT += widgets testlib SOURCES += tst_qtablewidget.cpp diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index ea31fd19dd..db3cf8082d 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -1473,7 +1473,7 @@ void tst_QTableWidget::task262056_sortDuplicate() for (int i = 0; i<8; i++ ) { QTableWidgetItem *twi = new QTableWidgetItem(items.at(i)); testWidget->setItem(i,0,twi); - testWidget->setItem(i,1,new QTableWidgetItem(QString("item %1").arg(i))); + testWidget->setItem(i,1,new QTableWidgetItem(QLatin1String("item ") + QString::number(i))); } testWidget->sortItems(0, Qt::AscendingOrder); QSignalSpy layoutChangedSpy(testWidget->model(), SIGNAL(layoutChanged())); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 033464c9db..dec6a66a7f 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -338,9 +338,12 @@ public: qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); } + QString result = QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(',') + QString::number(level(idx)) + + QLatin1Char(']'); if (idx.row() & 1) - return QString("[%1,%2,%3] - this item is extra wide").arg(idx.row()).arg(idx.column()).arg(level(idx)); - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(level(idx)); + result += QLatin1String(" - this item is extra wide"); + return result; } if (decorationsEnabled && role == Qt::DecorationRole) { QPixmap pm(16,16); @@ -2084,13 +2087,14 @@ void tst_QTreeView::rowsAboutToBeRemoved() { QStandardItemModel model(3, 1); for (int i = 0; i < model.rowCount(); i++) { + const QString iS = QString::number(i); QModelIndex index = model.index(i, 0, QModelIndex()); - model.setData(index, QString("%1").arg(i)); + model.setData(index, iS); model.insertRows(0, 4, index); model.insertColumns(0,1,index); for (int i1 = 0; i1 < model.rowCount(index); i1++) { QModelIndex index2 = model.index(i1, 0, index); - model.setData(index2, QString("%1%2").arg(i).arg(i1)); + model.setData(index2, iS + QString::number(i1)); } } @@ -2228,14 +2232,16 @@ void tst_QTreeView::resizeColumnToContents() { QStandardItemModel model(50,2); for (int r = 0; r < model.rowCount(); ++r) { + const QString rS = QString::number(r); for (int c = 0; c < model.columnCount(); ++c) { QModelIndex idx = model.index(r, c); - model.setData(idx, QString::fromLatin1("%1,%2").arg(r).arg(c) ); + model.setData(idx, rS + QLatin1Char(',') + QString::number(c)); model.insertColumns(0, 2, idx); model.insertRows(0, 6, idx); for (int i = 0; i < 6; ++i) { + const QString iS = QString::number(i); for (int j = 0; j < 2 ; ++j) { - model.setData(model.index(i, j, idx), QString::fromLatin1("child%1%2").arg(i).arg(j)); + model.setData(model.index(i, j, idx), QLatin1String("child") + iS + QString::number(j)); } } } @@ -2390,7 +2396,7 @@ void tst_QTreeView::selectionWithHiddenItems() { QStandardItemModel model; for (int i = 0; i < model.rowCount(); ++i) - model.setData(model.index(i,0), QString("row %1").arg(i)); + model.setData(model.index(i,0), QLatin1String("row ") + QString::number(i)); QStandardItem item0("row 0"); QStandardItem item1("row 1"); @@ -2464,7 +2470,7 @@ void tst_QTreeView::selectAll() QCOMPARE(view2.selectedIndexes().count(), model.rowCount() * model.columnCount()); for (int i = 0; i < model.rowCount(); ++i) - model.setData(model.index(i,0), QString("row %1").arg(i)); + model.setData(model.index(i,0), QLatin1String("row ") + QString::number(i)); PublicView view; view.setModel(&model); int selectedCount = view.selectedIndexes().count(); @@ -2818,8 +2824,9 @@ public: if (parentNode->isDead) qFatal("%s: grandparentNode is dead!", Q_FUNC_INFO); } - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()) - .arg(parentNode->isDead ? "dead" : "alive"); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(',') + + QLatin1String(parentNode->isDead ? "dead" : "alive") + QLatin1Char(']'); } return QVariant(); } @@ -3022,7 +3029,7 @@ void tst_QTreeView::filterProxyModelCrash() QStandardItemModel model; QList<QStandardItem *> items; for (int i = 0; i < 100; i++) - items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + items << new QStandardItem(QLatin1String("item ") + QString::number(i)); model.appendColumn(items); QSortFilterProxyModel proxy; @@ -3388,11 +3395,11 @@ void tst_QTreeView::task203696_hidingColumnsAndRowsn() { QTreeView view; QStandardItemModel *model = new QStandardItemModel(0, 3, &view); - for (int i = 0; i < 3; ++i) - { + for (int i = 0; i < 3; ++i) { + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); model->insertRow(model->rowCount()); for (int j = 0; j < model->columnCount(); ++j) - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } view.setModel(model); view.show(); @@ -3414,8 +3421,9 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() for (i = 0; i < 3; ++i) { model->insertRow(model->rowCount()); + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); for (int j = 0; j < model->columnCount(); ++j) { - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } } int col; @@ -3424,8 +3432,9 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() for (i = 3; i < 6; ++i) { model->insertRow(model->rowCount()); + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); for (int j = 0; j < model->columnCount(); ++j) { - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } } for (col = 0; col < pass; ++col) @@ -3479,8 +3488,10 @@ void tst_QTreeView::task220298_selectColumns() virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const { - if(role == Qt::DisplayRole) - return QVariant(QString("%1-%2").arg(index.column()).arg(index.row())); + if (role == Qt::DisplayRole) { + return QVariant(QString::number(index.column()) + QLatin1Char('-') + + QString::number(index.row())); + } return QVariant(); } @@ -3518,7 +3529,7 @@ void tst_QTreeView::task224091_appendColumns() QList<QStandardItem *> projlist; for (int k = 0; k < 10; ++k) - projlist.append(new QStandardItem(QString("Top Level %0").arg(k))); + projlist.append(new QStandardItem(QLatin1String("Top Level ") + QString::number(k))); model->appendColumn(projlist); model->invisibleRootItem()->appendRow(new QStandardItem("end")); @@ -3745,7 +3756,7 @@ void tst_QTreeView::task246536_scrollbarsNotWorking() QVERIFY(QTest::qWaitForWindowExposed(&tree)); QList<QStandardItem *> items; for(int i=0; i<100; ++i){ - items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + items << new QStandardItem(QLatin1String("item ") + QString::number(i)); } model.invisibleRootItem()->appendColumn(items); QTest::qWait(100); @@ -3933,7 +3944,8 @@ void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() QList<QTreeWidgetItem *> items; const int nrRows = 10; for (int i = 0; i < nrRows; ++i) { - items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + const QString text = QLatin1String("item: ") + QString::number(i); + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(text))); items.last()->setText(1, QString("is an item")); } tree.insertTopLevelItems(0, items); @@ -3964,9 +3976,11 @@ public: void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() { QStandardItemModel model(10, 10, this); - for (int row = 0; row < 10; row++) + for (int row = 0; row < 10; row++) { + const QString prefix = QLatin1String("row ") + QString::number(row) + QLatin1String(", col "); for (int col = 0; col < 10; col++) - model.setItem(row, col, new QStandardItem(QString("row %0, col %1").arg(row).arg(col))); + model.setItem(row, col, new QStandardItem(prefix + QString::number(col))); + } TreeViewQTBUG_9216 view; view.setUniformRowHeights(true); view.setModel(&model); @@ -4285,7 +4299,7 @@ void tst_QTreeView::testInitialFocus() { QTreeWidget treeWidget; treeWidget.setColumnCount(5); - new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(";"))); + new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(QLatin1Char(';')))); treeWidget.setTreePosition(2); treeWidget.header()->hideSection(0); // make sure we skip hidden section(s) treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical) @@ -4339,9 +4353,10 @@ void tst_QTreeView::taskQTBUG_37813_crash() treeWidget.setColumnCount(2); QList<QTreeWidgetItem *> items; for (int r = 0; r < 2; ++r) { + const QString prefix = QLatin1String("Row ") + QString::number(r) + QLatin1String(" Column "); QTreeWidgetItem *item = new QTreeWidgetItem(); for (int c = 0; c < treeWidget.columnCount(); ++c) - item->setText(c, QString::fromLatin1("Row %1 Column %2").arg(r).arg(c)); + item->setText(c, prefix + QString::number(c)); items.append(item); } treeWidget.addTopLevelItems(items); diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 117c53a2bb..1acdc103bd 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -320,7 +320,7 @@ void tst_QTreeWidget::addTopLevelItem() for (int i = 0; i < 100; i += count) { tops.clear(); for (int j = 0; j < count; ++j) - tops << new TreeItem(QStringList() << QString("%0").arg(j)); + tops << new TreeItem(QStringList(QString::number(j))); tree.addTopLevelItems(tops); QCOMPARE(tree.topLevelItemCount(), count + i); for (int j = 0; j < count; ++j) @@ -511,10 +511,10 @@ void tst_QTreeWidget::takeItem() for (int i=0; i<3; ++i) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(i)); + top->setText(0, QStringLiteral("top") + QString::number(i)); for (int j=0; j<3; ++j) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("child%1").arg(j)); + child->setText(0, QStringLiteral("child") + QString::number(j)); } } @@ -528,7 +528,7 @@ void tst_QTreeWidget::takeItem() QCOMPARE(item, (QTreeWidgetItem *)0); QCOMPARE(count, testWidget->topLevelItemCount()); } else { - QCOMPARE(item->text(0), QString("top%1").arg(index)); + QCOMPARE(item->text(0), QStringLiteral("top") + QString::number(index)); QCOMPARE(count-1, testWidget->topLevelItemCount()); delete item; } @@ -539,7 +539,7 @@ void tst_QTreeWidget::takeItem() QCOMPARE(item, (QTreeWidgetItem *)0); QCOMPARE(count, testWidget->topLevelItem(0)->childCount()); } else { - QCOMPARE(item->text(0), QString("child%1").arg(index)); + QCOMPARE(item->text(0), QStringLiteral("child") + QString::number(index)); QCOMPARE(count-1, testWidget->topLevelItem(0)->childCount()); delete item; } @@ -794,10 +794,11 @@ void tst_QTreeWidget::selectedItems() // create items for (int t=0; t<topLevel; ++t) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(t)); + const QString topS = QLatin1String("top") + QString::number(t); + top->setText(0, topS); for (int c=0; c<children; ++c) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1child%2").arg(t).arg(c)); + child->setText(0, topS + QLatin1String("child") + QString::number(c)); } } @@ -1442,11 +1443,10 @@ static void fillTreeWidget(QTreeWidgetItem *parent, int rows) { const int columns = parent->treeWidget()->columnCount(); for (int r = 0; r < rows; ++r) { + const QString prefix = QLatin1String("[r:") + QString::number(r) + QLatin1String(",c:"); QTreeWidgetItem *w = new QTreeWidgetItem(parent); - for ( int c = 0; c < columns; ++c ) { - QString s = QString("[r:%1,c:%2]").arg(r).arg(c); - w->setText(c, s); - } + for (int c = 0; c < columns; ++c) + w->setText(c, prefix + QString::number(c) + QLatin1Char(']')); fillTreeWidget(w, rows - r - 1); } } @@ -1455,10 +1455,9 @@ static void fillTreeWidget(QTreeWidget *tree, int rows) { for (int r = 0; r < rows; ++r) { QTreeWidgetItem *w = new QTreeWidgetItem(); - for ( int c = 0; c < tree->columnCount(); ++c ) { - QString s = QString("[r:%1,c:%2]").arg(r).arg(c); - w->setText(c, s); - } + const QString prefix = QLatin1String("[r:") + QString::number(r) + QLatin1String(",c:"); + for (int c = 0; c < tree->columnCount(); ++c) + w->setText(c, prefix + QString::number(c) + QLatin1Char(']')); tree->insertTopLevelItem(r, w); fillTreeWidget(w, rows - r - 1); } @@ -1555,7 +1554,7 @@ void tst_QTreeWidget::keyboardNavigation() } QTreeWidgetItem *current = testWidget->currentItem(); - QCOMPARE(current->text(0), QString("[r:%1,c:0]").arg(row)); + QCOMPARE(current->text(0), QLatin1String("[r:") + QString::number(row) + QLatin1String(",c:0]")); if (current->parent()) QCOMPARE(current->parent()->indexOfChild(current), row); else @@ -1696,7 +1695,7 @@ void tst_QTreeWidget::addChild() for (int i = 0; i < 100; i += count) { QList<QTreeWidgetItem*> list; for (int j = 0; j < count; ++j) - list << new QTreeWidgetItem(QStringList() << QString("%0").arg(j)); + list << new QTreeWidgetItem(QStringList(QString::number(j))); item->addChildren(list); QCOMPARE(item->childCount(), count + i); for (int j = 0; j < count; ++j) { @@ -1743,7 +1742,8 @@ void tst_QTreeWidget::setData() for (int i = 1; i <= 2; ++i) { for (int j = 0; j < 5; ++j) { QVariantList args; - QString text = QString("text %0").arg(i); + const QString iS = QString::number(i); + const QString text = QLatin1String("text ") + iS; item->setText(j, text); QCOMPARE(item->text(j), text); QCOMPARE(itemChangedSpy.count(), 1); @@ -1765,7 +1765,7 @@ void tst_QTreeWidget::setData() item->setIcon(j, icon); QCOMPARE(itemChangedSpy.count(), 0); - QString toolTip = QString("toolTip %0").arg(i); + const QString toolTip = QLatin1String("toolTip ") + iS; item->setToolTip(j, toolTip); QCOMPARE(item->toolTip(j), toolTip); QCOMPARE(itemChangedSpy.count(), 1); @@ -1775,7 +1775,7 @@ void tst_QTreeWidget::setData() item->setToolTip(j, toolTip); QCOMPARE(itemChangedSpy.count(), 0); - QString statusTip = QString("statusTip %0").arg(i); + const QString statusTip = QLatin1String("statusTip ") + iS; item->setStatusTip(j, statusTip); QCOMPARE(item->statusTip(j), statusTip); QCOMPARE(itemChangedSpy.count(), 1); @@ -1785,7 +1785,7 @@ void tst_QTreeWidget::setData() item->setStatusTip(j, statusTip); QCOMPARE(itemChangedSpy.count(), 0); - QString whatsThis = QString("whatsThis %0").arg(i); + const QString whatsThis = QLatin1String("whatsThis ") + iS; item->setWhatsThis(j, whatsThis); QCOMPARE(item->whatsThis(j), whatsThis); QCOMPARE(itemChangedSpy.count(), 1); @@ -2007,7 +2007,7 @@ void tst_QTreeWidget::columnCount() void tst_QTreeWidget::setHeaderLabels() { - QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(","); + QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(QLatin1Char(',')); testWidget->setHeaderLabels(list); QCOMPARE(testWidget->header()->count(), list.count()); } @@ -2147,8 +2147,8 @@ void tst_QTreeWidget::insertItemsWithSorting_data() QStringList ascendingItems; QStringList reverseItems; for (int i = 'a'; i <= 'z'; ++i) { - ascendingItems << QString("%0").arg(QLatin1Char(i)); - reverseItems << QString("%0").arg(QLatin1Char('z' - i + 'a')); + ascendingItems << QString(1, QLatin1Char(i)); + reverseItems << QString(1, QLatin1Char('z' - i + 'a')); ascendingRows << i - 'a'; reverseRows << 'z' - i + 'a'; } @@ -2671,9 +2671,9 @@ void tst_QTreeWidget::expandAndCallapse() QTreeWidgetItem *top = new QTreeWidgetItem(&tw, QStringList() << "top"); QTreeWidgetItem *p; for (int i = 0; i < 10; ++i) { - p = new QTreeWidgetItem(top, QStringList() << QString("%1").arg(i)); + p = new QTreeWidgetItem(top, QStringList(QString::number(i))); for (int j = 0; j < 10; ++j) - new QTreeWidgetItem(p, QStringList() << QString("%1").arg(j)); + new QTreeWidgetItem(p, QStringList(QString::number(j))); } QSignalSpy spy0(&tw, SIGNAL(itemExpanded(QTreeWidgetItem*))); QSignalSpy spy1(&tw, SIGNAL(itemCollapsed(QTreeWidgetItem*))); @@ -3133,7 +3133,7 @@ void tst_QTreeWidget::selectionOrder() testWidget->setColumnCount(1); QList<QTreeWidgetItem *> items; for (int i = 0; i < 10; ++i) - items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QLatin1String("item: ") + QString::number(i)))); testWidget->insertTopLevelItems(0, items); QModelIndex idx = testWidget->indexFromItem(items[0]); diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro index 5fa6762617..42a00618a2 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtreewidgetitemiterator QT += widgets testlib SOURCES += tst_qtreewidgetitemiterator.cpp diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index c52198fa2c..2ea78f8154 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp @@ -105,7 +105,8 @@ void tst_QTreeWidgetItemIterator::initTestCase() */ for (int i=0; i <= 16; ++i) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(i)); + const QString topS = QLatin1String("top") + QString::number(i); + top->setText(0, topS); switch (i) { case 0: testWidget->setItemHidden(top, true);break; case 1: testWidget->setItemHidden(top, false);break; @@ -136,7 +137,7 @@ void tst_QTreeWidgetItemIterator::initTestCase() } for (int j=0; j <= 16; ++j) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i).arg(j)); + child->setText(0, topS + QLatin1String(",child") + QString::number(j)); switch (j) { case 0: testWidget->setItemHidden(child, true);break; case 1: testWidget->setItemHidden(child, false);break; @@ -1074,6 +1075,24 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget_data() << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All << 1 << 3 << QString("top0,child1") << QString("top0,child1") << 0; } +static void populate3Levels(QTreeWidget &tw, int topLevelItems, int childItems, int grandChildItems) +{ + for (int i1 = 0; i1 < topLevelItems; ++i1) { + QTreeWidgetItem *top = new QTreeWidgetItem(&tw); + const QString top1S = QLatin1String("top") + QString::number(i1); + top->setText(0, top1S); + for (int i2 = 0; i2 < childItems; ++i2) { + QTreeWidgetItem *child = new QTreeWidgetItem(top); + const QString childS = top1S + QLatin1String(",child") + QString::number(i2); + child->setText(0, childS); + for (int i3 = 0; i3 < grandChildItems; ++i3) { + QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); + grandChild->setText(0, childS + QLatin1String(",grandchild") + QString::number(i3)); + } + } + } +} + void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() { QFETCH(int, topLevelItems); @@ -1089,18 +1108,7 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() QTreeWidget tw; tw.clear(); tw.setColumnCount(2); - for (int i1=0; i1 < topLevelItems; ++i1) { - QTreeWidgetItem *top = new QTreeWidgetItem(&tw); - top->setText(0, QString("top%1").arg(i1)); - for (int i2=0; i2 < childItems; ++i2) { - QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); - for (int i3=0; i3 < grandChildItems; ++i3) { - QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); - grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); - } - } - } + populate3Levels(tw, topLevelItems, childItems, grandChildItems); QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); it+=expecteditemindex; @@ -1161,18 +1169,7 @@ void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIte QTreeWidget tw; tw.clear(); tw.setColumnCount(2); - for (int i1=0; i1 < topLevelItems; ++i1) { - QTreeWidgetItem *top = new QTreeWidgetItem(&tw); - top->setText(0, QString("top%1").arg(i1)); - for (int i2=0; i2 < childItems; ++i2) { - QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); - for (int i3=0; i3 < grandChildItems; ++i3) { - QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); - grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); - } - } - } + populate3Levels(tw, topLevelItems, childItems, grandChildItems); QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::All); it += iterator_initial_index; diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 71b55d71ea..02276e7651 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -334,9 +334,9 @@ void tst_QAction::task200823_tooltip() action->setShortcut(shortcut); // we want a non-standard tooltip that shows the shortcut - action->setToolTip(QString("%1 (%2)").arg(action->text()).arg(action->shortcut().toString())); + action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')')); - QString ref = QString("foo (%1)").arg(QKeySequence(shortcut).toString()); + QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')'); QCOMPARE(action->toolTip(), ref); } diff --git a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro index 82c0204aa8..87521edfe9 100644 --- a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro +++ b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qactiongroup QT += widgets testlib SOURCES += tst_qactiongroup.cpp diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 878136b4a0..1257a3f420 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -133,9 +133,11 @@ private slots: void testDeleteLater(); void testDeleteLaterProcessEvents(); +#ifndef QT_NO_LIBRARY void libraryPaths(); void libraryPaths_qt_plugin_path(); void libraryPaths_qt_plugin_path_2(); +#endif void sendPostedEvents(); @@ -398,11 +400,12 @@ void tst_QApplication::setFont_data() if (!sizes.size()) sizes = fdb.standardSizes(); if (sizes.size() > 0) { - QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData()) + const QByteArray cntB = QByteArray::number(cnt); + QTest::newRow(("data" + cntB + "a").constData()) << family << sizes.first() << false; - QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData()) + QTest::newRow(("data" + cntB + "b").constData()) << family << sizes.first() << true; @@ -500,7 +503,7 @@ static QString cstrings2QString( char **args ) while ( args[i] ) { string += args[i]; if ( args[i+1] ) - string += " "; + string += QLatin1Char(' '); ++i; } return string; @@ -909,6 +912,7 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r) return j == r.count(); } +#ifndef QT_NO_LIBRARY #define QT_TST_QAPP_DEBUG void tst_QApplication::libraryPaths() { @@ -1057,16 +1061,16 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() #ifdef Q_OS_UNIX QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1(); QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ":" + nonExistentPath; + QByteArray pluginPath = validPath + ':' + nonExistentPath; #elif defined(Q_OS_WIN) # ifdef Q_OS_WINCE QByteArray validPath = "/Temp"; QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # else QByteArray validPath = "C:\\windows"; QByteArray nonExistentPath = "Z:\\nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # endif #endif @@ -1114,6 +1118,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() qputenv("QT_PLUGIN_PATH", QByteArray()); } } +#endif class SendPostedEventsTester : public QObject { diff --git a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro index e30a4b57b1..90e83f5285 100644 --- a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro +++ b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qboxlayout QT += widgets testlib SOURCES += tst_qboxlayout.cpp diff --git a/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro index 77709df5da..1ab155f22e 100644 --- a/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro +++ b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdesktopwidget QT += widgets testlib SOURCES += tst_qdesktopwidget.cpp diff --git a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro index 668b890c97..be944605a3 100644 --- a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro +++ b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qformlayout QT += widgets testlib SOURCES += tst_qformlayout.cpp diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index e1b494c9f1..dc3be524f8 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -184,7 +184,7 @@ void tst_QFormLayout::getItemPosition() QList<QLabel*> labels; QList<QLineEdit*> fields; for (int i = 0; i < 5; ++i) { - labels.append(new QLabel(QString("Label %1").arg(i+1))); + labels.append(new QLabel(QLatin1String("Label " ) + QString::number(i + 1))); fields.append(new QLineEdit); fl->addRow(labels[i], fields[i]); } @@ -493,8 +493,8 @@ void tst_QFormLayout::addRow() QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); - QVERIFY(layout->itemAt(2, QFormLayout::LabelRole)->widget()->property("text") == "Foo:"); - QVERIFY(layout->itemAt(3, QFormLayout::LabelRole)->widget()->property("text") == "Bar:"); + QCOMPARE(layout->itemAt(2, QFormLayout::LabelRole)->widget()->property("text").toString(), QLatin1String("Foo:")); + QCOMPARE(layout->itemAt(3, QFormLayout::LabelRole)->widget()->property("text").toString(), QLatin1String("Bar:")); QVERIFY(layout->itemAt(4, QFormLayout::LabelRole) == 0); QVERIFY(layout->itemAt(5, QFormLayout::LabelRole) == 0); diff --git a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro index febcee6c55..ee64f8538f 100644 --- a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro +++ b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qgridlayout QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 1e67c675ef..0ad8e30351 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -538,7 +538,8 @@ public: } private: void init(int numPixels = -1){ - setText(QString::fromLatin1("(%1,%2)").arg(sh.width()).arg(sh.height())); + setText(QLatin1Char('(') + QString::number(sh.width()) + + QLatin1Char(',') + QString::number(sh.height()) + QLatin1Char(')')); setFrameStyle(QFrame::Box | QFrame::Plain); setNumberOfPixels(numPixels); } @@ -1432,8 +1433,9 @@ void tst_QGridLayout::layoutSpacing_data() w->setLayout(layout); int pw = up->sizeHint().width(); int ph = up->sizeHint().height(); - QByteArray testName = QString::fromLatin1("arrowpad with %1 empty rows, %2 empty columns").arg(yoff).arg(xoff).toLatin1(); - QTest::newRow(testName.data()) + QByteArray testName = "arrowpad with " + QByteArray::number(yoff) + + " empty rows, " + QByteArray::number(xoff) + " empty columns"; + QTest::newRow(testName.constData()) << w << (PointList() << QPoint(0 + pw + 5, 3) << QPoint(0, 3 + ph + 10) @@ -1686,7 +1688,7 @@ void tst_QGridLayout::replaceWidget() for (int n = 0; n < itemCount; ++n) { int x = n % 3; int y = n / 3; - labels[n] = new QLabel(QString("label %1").arg(n)); + labels[n] = new QLabel(QLatin1String("label ") + QString::number(n)); Qt::Alignment align = (n % 3 ? Qt::AlignLeft : Qt::AlignRight); l->addWidget(labels[n], x * 3, y * 3, (n % 2) + 1, (n + 1) % 2 + 1, align); } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index 4d15ac9a93..5413b274d4 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -195,7 +195,7 @@ void tst_QLayout::smartMaxSize() int width = sz.width(); int expectedWidth = expectedWidths[expectedIndex]; if (width != expectedWidth) { - qDebug() << "error at index" << expectedIndex << ":" << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; + qDebug() << "error at index" << expectedIndex << ':' << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; ++regressionCount; } ++expectedIndex; diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index f206a5fe9a..5641e60078 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -180,12 +180,13 @@ protected: QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (ke->modifiers() && ke->key() > Qt::Key_Any && ke->key() < Qt::Key_ydiaeresis) { + const QChar c = QLatin1Char(char(ke->key())); if (ke->modifiers() == Qt::ControlModifier) - insertPlainText(QString("<Ctrl+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Ctrl+") + c + QLatin1Char('>')); else if (ke->modifiers() == Qt::AltModifier) - insertPlainText(QString("<Alt+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Alt+") + c + QLatin1Char('>')); else if (ke->modifiers() == Qt::ShiftModifier) - insertPlainText(QString("<Shift+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Shift+") + c + QLatin1Char('>')); return true; } } diff --git a/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro index cd80253e12..1f94c1b386 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro +++ b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstackedlayout QT += widgets testlib SOURCES += tst_qstackedlayout.cpp diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index ddbb4e6d75..95e4d92cd2 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -1513,7 +1513,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) || defined(Q_OS_BLACKBERRY) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -5655,7 +5655,7 @@ void tst_QWidget::setToolTip() for (int pass = 0; pass < 2; ++pass) { QCursor::setPos(0, 0); QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup)); - popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass)); + popup->setObjectName(QLatin1String("tst_qwidget setToolTip #") + QString::number(pass)); popup->setWindowTitle(popup->objectName()); popup->setGeometry(50, 50, 150, 50); QFrame *frame = new QFrame(popup.data()); @@ -7361,7 +7361,7 @@ void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); -#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_QNX) QSKIP("Platform does not support showMinimized()"); #endif UpdateWidget widget; @@ -7913,7 +7913,7 @@ void tst_QWidget::doubleRepaint() // Minmize: Should not trigger a repaint. widget.showMinimized(); QTest::qWait(10); -#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_QNX) QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue); #endif QCOMPARE(widget.numPaintEvents, 0); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm index c67682fd85..293b3387ee 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm @@ -39,7 +39,7 @@ #include <qpa/qplatformnativeinterface.h> #include <private/qcore_mac_p.h> -#include <Cocoa/Cocoa.h> +#include <AppKit/AppKit.h> QString nativeWindowTitle(QWidget *window, Qt::WindowState state) { diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro index d61681d5cb..8672c363a2 100644 --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidget_window QT += widgets testlib core-private gui-private SOURCES += tst_qwidget_window.cpp diff --git a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro index 0029ebd51e..e4158559a9 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro +++ b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidgetaction QT += widgets testlib SOURCES += tst_qwidgetaction.cpp diff --git a/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro index e3f2da96bd..7979e92087 100644 --- a/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro +++ b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidgetsvariant INCLUDEPATH += $$PWD/../../../other/qvariant_common SOURCES += tst_qwidgetsvariant.cpp diff --git a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro index 4ff05eb04a..17fc1d28b5 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro +++ b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro @@ -1,6 +1,5 @@ CONFIG += testcase mac:CONFIG -= app_bundle -# CONFIG += parallel_test // Cannot be parallel due to the activation test TARGET = tst_qwindowcontainer QT += widgets testlib SOURCES += tst_qwindowcontainer.cpp diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index b4546aa760..4d7473f068 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstyle -TARGET.EPOCHEAPSIZE = 0x200000 0x800000 QT += widgets testlib SOURCES += tst_qstyle.cpp diff --git a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro index 2ca24c4f43..bf12a6b30f 100644 --- a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro +++ b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro @@ -2,7 +2,6 @@ TEMPLATE = app TARGET = tst_qstyleoption CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib SOURCES += tst_qstyleoption.cpp diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index a360803c50..3d42ee98a8 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -55,6 +55,7 @@ public: ~tst_QStyleSheetStyle(); private slots: + void init(); void repolish(); void numinstances(); void widgetsBeforeAppStyleSheet(); @@ -71,8 +72,12 @@ private slots: void layoutSpacing(); #endif void qproperty(); + void palettePropagation_data(); void palettePropagation(); + void fontPropagation_data(); void fontPropagation(); + void widgetStylePropagation_data(); + void widgetStylePropagation(); void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); @@ -137,6 +142,12 @@ tst_QStyleSheetStyle::~tst_QStyleSheetStyle() { } +void tst_QStyleSheetStyle::init() +{ + qApp->setStyleSheet(QString()); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, false); +} + void tst_QStyleSheetStyle::numinstances() { QWidget w; @@ -627,31 +638,80 @@ void tst_QStyleSheetStyle::namespaces() QCOMPARE(BACKGROUND(pb2), red); } +void tst_QStyleSheetStyle::palettePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; +} + void tst_QStyleSheetStyle::palettePropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QGroupBox gb; - QPushButton *push = new QPushButton(&gb); - QPushButton &pb = *push; - push->setText("AsdF"); + QLabel *label = new QLabel(&gb); + QLabel &lb = *label; + label->setText("AsdF"); gb.setStyleSheet("QGroupBox { color: red }"); - QVERIFY(COLOR(gb) == Qt::red); - QVERIFY(COLOR(pb) == APPCOLOR(pb)); // palette shouldn't propagate - gb.setStyleSheet("QGroupBox * { color: red }"); + QCOMPARE(COLOR(gb), QColor(Qt::red)); - QVERIFY(COLOR(pb) == Qt::red); - QVERIFY(COLOR(gb) == APPCOLOR(gb)); + if (widgetStylePropagation) { + QCOMPARE(COLOR(lb), QColor(Qt::red)); // palette should propagate in standard mode + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); // palette shouldn't propagate + } QWidget window; + lb.setParent(&window); + if (widgetStylePropagation) { + // In standard propagation mode, widgets that are not explicitly + // targeted do not have their propagated palette unset when they are + // unpolished by changing parents. This is consistent with regular Qt + // widgets, who also maintain their propagated palette when changing + // parents + QCOMPARE(COLOR(lb), QColor(Qt::red)); + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); + } + lb.setParent(&gb); + + gb.setStyleSheet("QGroupBox * { color: red }"); + + QCOMPARE(COLOR(lb), QColor(Qt::red)); + QCOMPARE(COLOR(gb), APPCOLOR(gb)); + window.setStyleSheet("* { color: white; }"); - pb.setParent(&window); - QVERIFY(COLOR(pb) == Qt::white); + lb.setParent(&window); + QCOMPARE(COLOR(lb), QColor(Qt::white)); +} + +void tst_QStyleSheetStyle::fontPropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; } void tst_QStyleSheetStyle::fontPropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QComboBox cb; cb.addItem("item1"); cb.addItem("item2"); @@ -661,7 +721,11 @@ void tst_QStyleSheetStyle::fontPropagation() cb.setStyleSheet("QComboBox { font-size: 20pt; }"); QCOMPARE(FONTSIZE(cb), 20); - QCOMPARE(FONTSIZE(*popup), viewFontSize); + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(*popup), 20); + } else { + QCOMPARE(FONTSIZE(*popup), viewFontSize); + } QGroupBox gb; QPushButton *push = new QPushButton(&gb); QPushButton &pb = *push; @@ -670,7 +734,11 @@ void tst_QStyleSheetStyle::fontPropagation() gb.setStyleSheet("QGroupBox { font-size: 20pt }"); QCOMPARE(FONTSIZE(gb), 20); - QVERIFY(FONTSIZE(pb) == buttonFontSize); // font does not propagate + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(pb), 20); + } else { + QCOMPARE(FONTSIZE(pb), buttonFontSize); // font does not propagate + } gb.setStyleSheet("QGroupBox * { font-size: 20pt; }"); QCOMPARE(FONTSIZE(gb), gbFontSize); QCOMPARE(FONTSIZE(pb), 20); @@ -1471,12 +1539,14 @@ void tst_QStyleSheetStyle::embeddedFonts() QCOMPARE(spin.font().pixelSize(), 32); QCOMPARE(embedded->font().pixelSize(), 32); +#ifndef QT_NO_CONTEXTMENU QMenu *menu = embedded->createStandardContextMenu(); menu->show(); QTest::qWait(20); QVERIFY(menu); QVERIFY(menu->font().pixelSize() != 32); QCOMPARE(menu->font().pixelSize(), qApp->font(menu).pixelSize()); +#endif // QT_NO_CONTEXTMENU //task 242556 QComboBox box; @@ -1744,8 +1814,11 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup() QTableWidget widget(rowCount, columnCount); for (int row = 0; row < rowCount; ++row) { - for (int column = 0; column < columnCount; ++column) - widget.setItem(row, column, new QTableWidgetItem(QStringLiteral("row %1 column %2").arg(row + 1).arg(column + 1))); + for (int column = 0; column < columnCount; ++column) { + const QString t = QLatin1String("row ") + QString::number(row + 1) + + QLatin1String(" column ") + QString::number(column + 1); + widget.setItem(row, column, new QTableWidgetItem(t)); + } // put no visible text for the vertical headers, but still put some text or they will collapse widget.setVerticalHeaderItem(row, new QTableWidgetItem(QStringLiteral(" "))); @@ -1794,6 +1867,138 @@ void tst_QStyleSheetStyle::styleSheetChangeBeforePolish() QVERIFY(testForColors(image2, QColor(0x00, 0xFF, 0x00))); } +void tst_QStyleSheetStyle::widgetStylePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<QString>("parentStyleSheet"); + QTest::addColumn<QString>("childStyleSheet"); + QTest::addColumn<QFont>("parentFont"); + QTest::addColumn<QFont>("childFont"); + QTest::addColumn<QPalette>("parentPalette"); + QTest::addColumn<QPalette>("childPalette"); + QTest::addColumn<int>("parentExpectedSize"); + QTest::addColumn<int>("childExpectedSize"); + QTest::addColumn<QColor>("parentExpectedColor"); + QTest::addColumn<QColor>("childExpectedColor"); + + QFont noFont; + QFont font45; font45.setPointSize(45); + QFont font32; font32.setPointSize(32); + + QPalette noPalette; + QPalette redPalette; redPalette.setColor(QPalette::WindowText, QColor("red")); + QPalette greenPalette; greenPalette.setColor(QPalette::WindowText, QColor("green")); + + QLabel defaultLabel; + + int defaultSize = defaultLabel.font().pointSize(); + QColor defaultColor = defaultLabel.palette().color(defaultLabel.foregroundRole()); + QColor redColor("red"); + QColor greenColor("green"); + + // Check regular Qt propagation works as expected, with and without a + // non-interfering application stylesheet + QTest::newRow("defaults") + << QString() << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << defaultColor << defaultColor; + QTest::newRow("parent font propagation, no application style sheet") + << QString() << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent font propagation, dummy application style sheet") + << "QGroupBox { font-size: 64pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent color propagation, no application style sheet") + << QString() << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent color propagation, dummy application style sheet") + << "QGroupBox { color: blue }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + + // Parent style sheet propagates to child if child has not explicitly + // set a value + QTest::newRow("parent style sheet color propagation") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent style sheet font propagation") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + + // Parent style sheet does not propagate to child if child has explicitly + // set a value + QTest::newRow("parent style sheet color propagation, child explicitly set") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << greenPalette + << defaultSize << defaultSize << redColor << greenColor; + QTest::newRow("parent style sheet font propagation, child explicitly set") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << font32 << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + + // Parent does not propagate to child when child is target of style sheet + QTest::newRow("parent style sheet font propagation, child application style sheet") + << "#childLabel { font-size: 32pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + QTest::newRow("parent style sheet color propagation, child application style sheet") + << "#childLabel { color: green }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << greenColor; +} + +void tst_QStyleSheetStyle::widgetStylePropagation() +{ + QFETCH(QString, applicationStyleSheet); + QFETCH(QString, parentStyleSheet); + QFETCH(QString, childStyleSheet); + + QFETCH(QFont, parentFont); + QFETCH(QFont, childFont); + QFETCH(QPalette, parentPalette); + QFETCH(QPalette, childPalette); + + QFETCH(int, parentExpectedSize); + QFETCH(int, childExpectedSize); + QFETCH(QColor, parentExpectedColor); + QFETCH(QColor, childExpectedColor); + + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true); + + qApp->setStyleSheet(applicationStyleSheet); + + QLabel parentLabel; + parentLabel.setObjectName("parentLabel"); + QLabel childLabel(&parentLabel); + childLabel.setObjectName("childLabel"); + + if (parentFont.resolve()) + parentLabel.setFont(parentFont); + if (childFont.resolve()) + childLabel.setFont(childFont); + if (parentPalette.resolve()) + parentLabel.setPalette(parentPalette); + if (childPalette.resolve()) + childLabel.setPalette(childPalette); + if (!parentStyleSheet.isEmpty()) + parentLabel.setStyleSheet(parentStyleSheet); + if (!childStyleSheet.isEmpty()) + childLabel.setStyleSheet(childStyleSheet); + + parentLabel.ensurePolished(); + childLabel.ensurePolished(); + + QCOMPARE(FONTSIZE(parentLabel), parentExpectedSize); + QCOMPARE(FONTSIZE(childLabel), childExpectedSize); + QCOMPARE(COLOR(parentLabel), parentExpectedColor); + QCOMPARE(COLOR(childLabel), childExpectedColor); +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index e8ac9aa5d2..fdeb6d100d 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -61,7 +61,7 @@ public: protected: QStringList splitPath(const QString &path) const { - return csv ? path.split(",") : QCompleter::splitPath(path); + return csv ? path.split(QLatin1Char(',')) : QCompleter::splitPath(path); } private: @@ -367,7 +367,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() QTest::addColumn<QString>("completion"); QTest::addColumn<QString>("completionText"); -#define ROWNAME(name) (qPrintable(QString("%1 %2").arg(name).arg(i))) +#define ROWNAME(name) ((QByteArray(name) + ' ' + QByteArray::number(i)).constData()) for (int i = 0; i < 2; i++) { if (i == 1) @@ -1164,7 +1164,7 @@ void tst_QCompleter::dynamicSortOrder() completer.setModelSorting(QCompleter::CaseSensitivelySortedModel); QStandardItem *root = model.invisibleRootItem(); for (int i = 0; i < 20; i++) { - root->appendRow(new QStandardItem(QString("%1").arg(i))); + root->appendRow(new QStandardItem(QString::number(i))); } root->appendRow(new QStandardItem("13")); root->sortChildren(0, Qt::AscendingOrder); @@ -1256,7 +1256,7 @@ void tst_QCompleter::task189564_omitNonSelectableItems() QStringList strings; for (int i = 0; i < n; ++i) - strings << QString("%1%2").arg(prefix).arg(i); + strings << prefix + QString::number(i); const QString omitString(strings.at(n / 2)); task189564_StringListModel model(omitString); model.setStringList(strings); @@ -1553,9 +1553,9 @@ void tst_QCompleter::task247560_keyboardNavigation() QStandardItemModel model; for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - model.setItem(i, j, new QStandardItem(QString("row %1 column %2").arg(i).arg(j))); - } + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" column "); + for (int j = 0; j < 5; j++) + model.setItem(i, j, new QStandardItem(prefix + QString::number(j))); } diff --git a/tests/auto/widgets/util/qscroller/qscroller.pro b/tests/auto/widgets/util/qscroller/qscroller.pro index 55f57f5ed1..29e8378f2b 100644 --- a/tests/auto/widgets/util/qscroller/qscroller.pro +++ b/tests/auto/widgets/util/qscroller/qscroller.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscroller QT += widgets testlib gui-private diff --git a/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro b/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro index d409d23650..e9310fc234 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro +++ b/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsystemtrayicon QT += widgets testlib SOURCES += tst_qsystemtrayicon.cpp diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro b/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro index 911898407b..2d9aa52e3a 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro +++ b/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractscrollarea QT += widgets testlib SOURCES += tst_qabstractscrollarea.cpp diff --git a/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro index 020be08867..6453999786 100644 --- a/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro +++ b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractslider QT += widgets testlib SOURCES += tst_qabstractslider.cpp diff --git a/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro index 8fa1c0fcac..f9b601228e 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro +++ b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractspinbox QT += widgets testlib SOURCES += tst_qabstractspinbox.cpp diff --git a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro index 03e8ed75ed..88b9d08557 100644 --- a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro +++ b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qcombobox QT += widgets widgets-private gui-private core-private testlib SOURCES += tst_qcombobox.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 0b22dc7893..25fc37487d 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2314,9 +2314,10 @@ void tst_QComboBox::task191329_size() QStandardItemModel model(rows, 2); for (int row = 0; row < model.rowCount(); ++row) { + const QString rowS = QLatin1String("row ") + QString::number(row); for (int column = 0; column < model.columnCount(); ++column) { - QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column)); - model.setItem(row, column, item); + const QString text = rowS + QLatin1String(", column ") + QString::number(column); + model.setItem(row, column, new QStandardItem(text)); } } QTableView *table = new QTableView(); @@ -2399,7 +2400,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QTest::qWaitForWindowExposed(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); -#if defined QT_BUILD_INTERNAL && !defined Q_OS_BLACKBERRY +#if defined QT_BUILD_INTERNAL QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); @@ -2693,7 +2694,8 @@ void tst_QComboBox::resetModel() void reset() { - QStringListModel::reset(); + QStringListModel::beginResetModel(); + QStringListModel::endResetModel(); } }; QComboBox cb; @@ -2865,10 +2867,11 @@ void tst_QComboBox::task_QTBUG_10491_currentIndexAndModelColumn() QStandardItemModel model(4, 4, &comboBox); for (int i = 0; i < 4; i++){ - model.setItem(i, 0, new QStandardItem(QString("Employee Nr %1").arg(i))); - model.setItem(i, 1, new QStandardItem(QString("Street Nr %1").arg(i))); - model.setItem(i, 2, new QStandardItem(QString("Town Nr %1").arg(i))); - model.setItem(i, 3, new QStandardItem(QString("Phone Nr %1").arg(i))); + const QString iS = QString::number(i); + model.setItem(i, 0, new QStandardItem(QLatin1String("Employee Nr ") + iS)); + model.setItem(i, 1, new QStandardItem(QLatin1String("Street Nr ") + iS)); + model.setItem(i, 2, new QStandardItem(QLatin1String("Town Nr ") + iS)); + model.setItem(i, 3, new QStandardItem(QLatin1String("Phone Nr ") + iS)); } comboBox.setModel(&model); comboBox.setModelColumn(0); @@ -2914,12 +2917,12 @@ void tst_QComboBox::itemData() // ensure that the currentText(), the DisplayRole and the EditRole // stay in sync when using QComboBox's default model for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); + QString itemText = QLatin1String("item text ") + QString::number(i); comboBox.addItem(itemText); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); + QString itemText = QLatin1String("item text ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2931,14 +2934,11 @@ void tst_QComboBox::itemData() QCOMPARE(comboBox.currentData(Qt::EditRole).toString(), itemText); } - for (int i = 0; i < itemCount; ++i) { - // now change by using setItemText - QString itemText = QString("setItemText %1").arg(i); - comboBox.setItemText(i, itemText); - } + for (int i = 0; i < itemCount; ++i) // now change by using setItemText + comboBox.setItemText(i, QLatin1String("setItemText ") + QString::number(i)); for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemText %1").arg(i); + QString itemText = QLatin1String("setItemText ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2952,12 +2952,12 @@ void tst_QComboBox::itemData() for (int i = 0; i < itemCount; ++i) { // now change by changing the DisplayRole's data - QString itemText = QString("setItemData(DisplayRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(DisplayRole) ") + QString::number(i); comboBox.setItemData(i, QVariant(itemText), Qt::DisplayRole); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemData(DisplayRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(DisplayRole) ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2971,12 +2971,12 @@ void tst_QComboBox::itemData() for (int i = 0; i < itemCount; ++i) { // now change by changing the EditRole's data - QString itemText = QString("setItemData(EditRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(EditRole) ") + QString::number(i); comboBox.setItemData(i, QVariant(itemText), Qt::EditRole); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemData(EditRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(EditRole) ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2993,14 +2993,14 @@ void tst_QComboBox::itemData() // set additional user data in the addItem call for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); - comboBox.addItem(itemText, QVariant(itemDataText)); + const QString iS = QString::number(i); + comboBox.addItem(QLatin1String("item text ") + iS, QVariant(QLatin1String("item data ") + iS)); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); QCOMPARE(comboBox.itemData(i).toString(), itemDataText); @@ -3023,8 +3023,9 @@ void tst_QComboBox::itemData() QString qtlogoPath = QFINDTESTDATA("qtlogo.png"); QIcon icon = QIcon(QPixmap(qtlogoPath)); for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; double d = i; comboBox.addItem(itemText); comboBox.setItemData(i, QVariant(itemDataText), Qt::UserRole); @@ -3033,8 +3034,9 @@ void tst_QComboBox::itemData() } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; double d = i; QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro index 690edd5c9e..411185ae2a 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdatetimeedit QT += widgets testlib core-private widgets-private SOURCES += tst_qdatetimeedit.cpp diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index d41398046f..d496386773 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -3436,7 +3436,7 @@ void tst_QDateTimeEdit::deleteCalendarWidget() // it should create a new widget QVERIFY(edit.calendarWidget()); - QVERIFY(edit.calendarWidget()->objectName() != "cw1"); + QVERIFY(edit.calendarWidget()->objectName() != QLatin1String("cw1")); } } diff --git a/tests/auto/widgets/widgets/qdial/qdial.pro b/tests/auto/widgets/widgets/qdial/qdial.pro index 0af9633236..9bdd61f9d5 100644 --- a/tests/auto/widgets/widgets/qdial/qdial.pro +++ b/tests/auto/widgets/widgets/qdial/qdial.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdial QT += widgets testlib SOURCES += tst_qdial.cpp diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro b/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro index 9892c48e0c..7f2ad59581 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib SOURCES += tst_qdialogbuttonbox.cpp diff --git a/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro b/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro index eca396f1a8..5c1ef52036 100644 --- a/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro +++ b/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdockwidget QT += widgets widgets-private testlib QT += core-private gui-private diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 70df31ed69..4819f621ea 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -894,9 +894,6 @@ void tst_QDockWidget::task237438_setFloatingCrash() void tst_QDockWidget::task248604_infiniteResize() { -#if defined Q_OS_BLACKBERRY - QSKIP("Top level window is stretched to fullscreen"); -#endif QDockWidget d; QTabWidget *t = new QTabWidget; t->addTab(new QWidget, "Foo"); diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 6a1ce17aab..378bedbe84 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -214,12 +214,15 @@ void tst_QDoubleSpinBox::setPrefixSuffix_data() QTest::newRow("data0") << QString() << QString() << 10.5 << 1 << "10.5" << "10.5" << false; QTest::newRow("data1") << QString() << "cm" << 10.5 << 2 << "10.50cm" << "10.50" << false; - QTest::newRow("data2") << "cm: " << QString() << 10.5 << 0 << "cm: 10" << "10" << false; + + // 10.5 is rounded correctly to 11 when using libdouble-conversion, or incorrectly to 10 when + // using snprintf. This is not the point of this test, though. + QTest::newRow("data2") << "cm: " << QString() << 10.4 << 0 << "cm: 10" << "10" << false; QTest::newRow("data3") << "length: " << "cm" << 10.5 << 3 << "length: 10.500cm" << "10.500" << false; QTest::newRow("data4") << QString() << QString() << 10.5 << 1 << "10.5" << "10.5" << true; QTest::newRow("data5") << QString() << "cm" << 10.5 << 2 << "10.50cm" << "10.50" << true; - QTest::newRow("data6") << "cm: " << QString() << 10.5 << 0 << "cm: 10" << "10" << true; + QTest::newRow("data6") << "cm: " << QString() << 10.4 << 0 << "cm: 10" << "10" << true; QTest::newRow("data7") << "length: " << "cm" << 10.5 << 3 << "length: 10.500cm" << "10.500" << true; } @@ -817,8 +820,10 @@ void tst_QDoubleSpinBox::editingFinished() QCOMPARE(editingFinishedSpy1.count(), 4); QCOMPARE(editingFinishedSpy2.count(), 4); - testFocusWidget->show(); // On BlackBerry this is our root window we need to show it again - // otherwise subsequent tests will fail + // On some platforms this is our root window + // we need to show it again otherwise subsequent + // tests will fail + testFocusWidget->show(); } void tst_QDoubleSpinBox::removeAll() diff --git a/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro b/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro index 6fa0589f95..404edcd075 100644 --- a/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro +++ b/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfocusframe QT += widgets testlib SOURCES += tst_qfocusframe.cpp diff --git a/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro b/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro index b21729bb9b..418789ac0f 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro +++ b/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontcombobox QT += widgets testlib SOURCES += tst_qfontcombobox.cpp diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index 5d6fdf2851..09de0e6dc9 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp @@ -248,7 +248,7 @@ void tst_QFontComboBox::writingSystem_data() QTest::newRow("Runic") << QFontDatabase::Runic; for (int i = 0; i < 31; ++i) - QTest::newRow(qPrintable(QString("enum %1").arg(i))) << (QFontDatabase::WritingSystem)i; + QTest::newRow(("enum " + QByteArray::number(i)).constData()) << (QFontDatabase::WritingSystem)i; } // public QFontDatabase::WritingSystem writingSystem() const diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp index 81a6ba2ee3..03bd79683f 100644 --- a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp +++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp @@ -73,22 +73,24 @@ static void provideFrameData() for (int lineWidth = 0; lineWidth < 3; ++lineWidth) { for (int midLineWidth = 0; midLineWidth < 3; ++midLineWidth) { - QTest::newRow(qPrintable(QStringLiteral("box_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) - << "box_noshadow" << lineWidth << midLineWidth << QFrame::Box << (QFrame::Shadow)0; - QTest::newRow(qPrintable(QStringLiteral("box_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + const QByteArray postFix = '_' + QByteArray::number(lineWidth) + '_' + + QByteArray::number(midLineWidth); + QTest::newRow(("box_noshadow" + postFix).constData()) + << "box_noshadow" << lineWidth << midLineWidth << QFrame::Box << (QFrame::Shadow)0; + QTest::newRow(("box_plain" + postFix).constData()) << "box_plain" << lineWidth << midLineWidth << QFrame::Box << QFrame::Plain; - QTest::newRow(qPrintable(QStringLiteral("box_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("box_raised" + postFix).constData()) << "box_raised" << lineWidth << midLineWidth << QFrame::Box << QFrame::Raised; - QTest::newRow(qPrintable(QStringLiteral("box_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("box_sunken" + postFix).constData()) << "box_sunken" << lineWidth << midLineWidth << QFrame::Box << QFrame::Sunken; - QTest::newRow(qPrintable(QStringLiteral("winpanel_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_noshadow" + postFix).constData()) << "winpanel_noshadow" << lineWidth << midLineWidth << QFrame::WinPanel << (QFrame::Shadow)0; - QTest::newRow(qPrintable(QStringLiteral("winpanel_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_plain" + postFix).constData()) << "winpanel_plain" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Plain; - QTest::newRow(qPrintable(QStringLiteral("winpanel_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_raised" + postFix).constData()) << "winpanel_raised" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Raised; - QTest::newRow(qPrintable(QStringLiteral("winpanel_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_sunken" + postFix).constData()) << "winpanel_sunken" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Sunken; } } @@ -174,7 +176,10 @@ void tst_QFrame::testPainting() const QPixmap pixmap = frame.grab(); - const QString referenceFilePath = QFINDTESTDATA(QStringLiteral("images/%1_%2_%3.png").arg(basename).arg(lineWidth).arg(midLineWidth)); + const QString fileName = QLatin1String("images/") + basename + QLatin1Char('_') + + QString::number(lineWidth) + QLatin1Char('_') + QString::number(midLineWidth) + + QLatin1String(".png"); + const QString referenceFilePath = QFINDTESTDATA(fileName); const QPixmap referencePixmap(referenceFilePath); QVERIFY2(!referencePixmap.isNull(), qPrintable(QStringLiteral("Could not load reference pixmap %1").arg(referenceFilePath))); QCOMPARE(pixmap, referencePixmap); diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 53eec99258..d7a03deb45 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp @@ -73,6 +73,7 @@ private slots: void childrenAreDisabled(); void propagateFocus(); void task_QTBUG_19170_ignoreMouseReleseEvent(); + void task_QTBUG_15519_propagateMouseEvents(); private: bool checked; @@ -80,6 +81,7 @@ private: qint64 clickTimeStamp; qint64 toggleTimeStamp; + static void sendMouseMoveEvent(QWidget *widget, const QPoint &localPos); }; tst_QGroupBox::tst_QGroupBox() @@ -502,5 +504,114 @@ void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleseEvent() QCOMPARE(box.isChecked(), false); } +class MouseEventTestWidget : public QWidget +{ +public: + bool mousePressed; + bool mouseReleased; + bool mouseMoved; + + void reset() + { + mousePressed = false; + mouseReleased = false; + mouseMoved = false; + } + +protected: + void mousePressEvent(QMouseEvent*) + { + mousePressed = true; + } + + void mouseReleaseEvent(QMouseEvent*) + { + mouseReleased = true; + } + + void mouseMoveEvent(QMouseEvent*) + { + mouseMoved = true; + } +}; + +void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents() +{ + MouseEventTestWidget parent; + QGroupBox box(&parent); + parent.setMouseTracking(true); + box.setMouseTracking(true); + box.resize(100, 100); + box.setTitle("This is a test for QTBUG-15519"); + box.show(); + + QStyleOptionGroupBox option; + option.initFrom(&box); + option.subControls = QStyle::SubControls(QStyle::SC_All); + QRect checkBoxRect = box.style()->subControlRect(QStyle::CC_GroupBox, &option, + QStyle::SC_GroupBoxCheckBox, &box); + + // Without a checkbox, all mouse events should propagate + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + sendMouseMoveEvent(&box, checkBoxRect.center()); + QCOMPARE(parent.mouseMoved, true); + + parent.reset(); + sendMouseMoveEvent(&box, box.rect().center()); + QCOMPARE(parent.mouseMoved, true); + + // With a checkbox, presses and releases to the checkbox should not propagate + + box.setCheckable(true); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mousePressed, false); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mouseReleased, false); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + sendMouseMoveEvent(&box, checkBoxRect.center()); + QCOMPARE(parent.mouseMoved, true); + + parent.reset(); + sendMouseMoveEvent(&box, box.rect().center()); + QCOMPARE(parent.mouseMoved, true); +} + +void tst_QGroupBox::sendMouseMoveEvent(QWidget *widget, const QPoint &localPos) +{ + // Send a MouseMove event without actually moving the pointer + QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); + QApplication::sendEvent(widget, &event); +} + QTEST_MAIN(tst_QGroupBox) #include "tst_qgroupbox.moc" diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro b/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro index 097cb00d11..c660b398ce 100644 --- a/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro +++ b/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qkeysequenceedit QT += widgets testlib SOURCES += tst_qkeysequenceedit.cpp diff --git a/tests/auto/widgets/widgets/qlabel/qlabel.pro b/tests/auto/widgets/widgets/qlabel/qlabel.pro index 6c259bc5a3..6a5757fb5c 100644 --- a/tests/auto/widgets/widgets/qlabel/qlabel.pro +++ b/tests/auto/widgets/widgets/qlabel/qlabel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlabel QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro b/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro index 220380b1d5..1508806fb0 100644 --- a/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro +++ b/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlcdnumber QT += widgets testlib SOURCES += tst_qlcdnumber.cpp diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 666960d98e..ba700ed58d 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -2244,6 +2244,7 @@ void tst_QLineEdit::deleteSelectedText() edit.setText(text); edit.selectAll(); +#ifndef QT_NO_CONTEXTMENU QMenu *menu = edit.createStandardContextMenu(); for (int i = 0; i < menu->actions().count(); ++i) { QAction *current = menu->actions().at(i); @@ -2252,6 +2253,7 @@ void tst_QLineEdit::deleteSelectedText() QVERIFY(edit.text().isEmpty()); } } +#endif // QT_NO_CONTEXTMENU } @@ -2864,6 +2866,11 @@ void tst_QLineEdit::insert() QCOMPARE(testWidget->text(), QString("No Crash! This is a nice test")); } +static inline QByteArray selectionTestName(int start, int length) +{ + return "selection start: " + QByteArray::number(start) + " length: " + QByteArray::number(length); +} + void tst_QLineEdit::setSelection_data() { QTest::addColumn<QString>("text"); @@ -2877,39 +2884,39 @@ void tst_QLineEdit::setSelection_data() int start, length, pos; start = 0; length = 1; pos = 1; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("A") << true; start = 0; length = 2; pos = 2; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("Ab") << true; start = 0; length = 4; pos = 4; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("Abc ") << true; start = -1; length = 0; pos = text.length(); - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString() << false; start = 34; length = 1; pos = 35; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("z") << true; start = 34; length = 2; pos = 35; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("z") << true; start = 34; length = -1; pos = 33; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("y") << true; start = 1; length = -2; pos = 0; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("A") << true; start = -1; length = -1; pos = text.length(); - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString() << false; } @@ -3290,7 +3297,7 @@ void tst_QLineEdit::inlineCompletion() QStandardItem *root = model->invisibleRootItem(); QStandardItem *items[5]; for (int i = 0; i < 5; i++) { - items[i] = new QStandardItem(QString("item%1").arg(i)); + items[i] = new QStandardItem(QLatin1String("item") + QString::number(i)); if ((i+2)%2 == 0) { // disable 0,2,4 items[i]->setFlags(items[i]->flags() & ~Qt::ItemIsEnabled); } diff --git a/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro b/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro index bd4fc6ba97..7e0a5320b0 100644 --- a/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro +++ b/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmainwindow QT += widgets widgets-private testlib SOURCES += tst_qmainwindow.cpp diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 6282028746..ebf05ca300 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1369,7 +1369,7 @@ void tst_QMainWindow::restoreStateFromPreviousVersion() QVector<QDockWidget*> docks; for(int i = 0; i < 16; ++i) { - const QString name = QString::fromLatin1("dock %1").arg(i); + const QString name = QStringLiteral("dock ") + QString::number(i); QDockWidget *dock = new QDockWidget(name); docks += dock; dock->setObjectName(name); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index e23634c515..83a4e3bb59 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -621,6 +621,11 @@ void tst_QMdiArea::showWindows() //#define USE_SHOW +static inline QString windowTitle(const QString &t, const QString &f) +{ + return t + QLatin1String(" - [") + f + QLatin1Char(']'); +} + void tst_QMdiArea::changeWindowTitle() { const QString mwc = QString::fromLatin1("MainWindow's Caption"); @@ -648,7 +653,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif mw->hide(); @@ -657,7 +662,7 @@ void tst_QMdiArea::changeWindowTitle() QVERIFY(QTest::qWaitForWindowExposed(mw)); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif #ifdef USE_SHOW @@ -675,11 +680,11 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); widget->setWindowTitle( wc2 ); - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) ); mw->setWindowTitle( mwc2 ); - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif mw->show(); @@ -693,7 +698,7 @@ void tst_QMdiArea::changeWindowTitle() qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW widget->showNormal(); @@ -714,7 +719,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW @@ -2321,7 +2326,7 @@ void tst_QMdiArea::setViewMode() iconPixmap.fill(Qt::red); for (int i = 0; i < 5; ++i) { QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); - subWindow->setWindowTitle(QString(QLatin1String("Title %1")).arg(i)); + subWindow->setWindowTitle(QLatin1String("Title ") + QString::number(i)); subWindow->setWindowIcon(iconPixmap); } diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index db252347ac..51176d8195 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -202,6 +202,7 @@ private slots: void task_226929(); void styleChange(); void testFullScreenState(); + void testRemoveBaseWidget(); }; void tst_QMdiSubWindow::initTestCase() @@ -396,7 +397,7 @@ void tst_QMdiSubWindow::mainWindowSupport() QMdiArea *nestedWorkspace = new QMdiArea; // :-) window->setWidget(nestedWorkspace); - window->widget()->setWindowTitle(QString::fromLatin1("Window %1").arg(i)); + window->widget()->setWindowTitle(QLatin1String("Window ") + QString::number(i)); workspace->addSubWindow(window); QVERIFY(!window->maximizedButtonsWidget()); @@ -423,8 +424,9 @@ void tst_QMdiSubWindow::mainWindowSupport() QVERIFY(window->maximizedSystemMenuIconWidget()); QCOMPARE(window->maximizedSystemMenuIconWidget(), qobject_cast<QWidget *>(mainWindow.menuBar() ->cornerWidget(Qt::TopLeftCorner))); - QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") - .arg(originalWindowTitle, window->widget()->windowTitle())); + const QString expectedTitle = originalWindowTitle + QLatin1String(" - [") + + window->widget()->windowTitle() + QLatin1Char(']'); + QCOMPARE(mainWindow.windowTitle(), expectedTitle); #endif // Check that nested child windows don't set window title @@ -432,7 +434,7 @@ void tst_QMdiSubWindow::mainWindowSupport() QMdiSubWindow *nestedWindow = new QMdiSubWindow; nestedWindow->setWidget(new QWidget); nestedWorkspace->addSubWindow(nestedWindow); - nestedWindow->widget()->setWindowTitle(QString::fromLatin1("NestedWindow %1").arg(i)); + nestedWindow->widget()->setWindowTitle(QLatin1String("NestedWindow ") + QString::number(i)); nestedWindow->showMaximized(); qApp->processEvents(); QVERIFY(nestedWindow->isMaximized()); @@ -2080,6 +2082,27 @@ void tst_QMdiSubWindow::testFullScreenState() QCOMPARE(subWindow->size(), QSize(300, 300)); } +void tst_QMdiSubWindow::testRemoveBaseWidget() +{ + QMdiArea mdiArea; + mdiArea.show(); + + QWidget *widget1 = new QWidget; + mdiArea.addSubWindow(widget1); + + QWidget *widget2 = new QWidget; + mdiArea.addSubWindow(widget2); + + mdiArea.removeSubWindow(widget1); + QVERIFY(!widget1->parent()); + + widget2->setParent(widget1); + mdiArea.removeSubWindow(widget2); + QCOMPARE(widget2->parent(), widget1); + + delete widget1; +} + QTEST_MAIN(tst_QMdiSubWindow) #include "tst_qmdisubwindow.moc" diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index b3f9c54f24..ec46d7e625 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -555,7 +555,7 @@ void tst_QMenu::widgetActionFocus() QMenu m; QListWidget *l = new QListWidget(&m); for (int i = 1; i<3 ; i++) - l->addItem(QString("item%1").arg(i)); + l->addItem(QStringLiteral("item" ) + QString::number(i)); QWidgetAction *wa = new QWidgetAction(&m); wa->setDefaultWidget(l); m.addAction(wa); @@ -803,7 +803,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() uint i = 2; while (main.columnCount() < 2) { - main.addAction(QString("Item %1").arg(i)); + main.addAction(QLatin1String("Item ") + QString::number(i)); ++i; QVERIFY(i<1000); } @@ -1077,7 +1077,7 @@ public: MyMenu() : m_currentIndex(0) { for (int i = 0; i < 2; ++i) - dialogActions[i] = addAction( QString("dialog %1").arg(i), dialogs + i, SLOT(exec())); + dialogActions[i] = addAction(QLatin1String("dialog ") + QString::number(i), dialogs + i, SLOT(exec())); } void activateAction(int index) diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm index b1708d8669..7130e79276 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm @@ -31,7 +31,7 @@ ** ****************************************************************************/ -#import <Cocoa/Cocoa.h> +#import <AppKit/AppKit.h> #include <QMenu> #include <QTest> diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST index 725b8e93b4..86c7141268 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -1,2 +1,14 @@ [clearAndGrab] opensuse-13.1 + +#QTBUG-31611 +[painter] +windows msvc-2010 32bit developer-build + +#QTBUG-31611 +[reparentToAlreadyCreated] +windows msvc-2010 32bit developer-build + +#QTBUG-31611 +[reparentToNotYetCreated] +windows msvc-2010 32bit developer-build diff --git a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro index bbc6e987af..2d4cff9e10 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro +++ b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro @@ -1,8 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qopenglwidget QT += gui-private core-private testlib widgets SOURCES += tst_qopenglwidget.cpp - -win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-31611 diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 44a554ad82..1657751605 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -537,9 +537,6 @@ void tst_QPushButton::sizeHint_data() #if !defined(QT_NO_STYLE_WINDOWS) QTest::newRow("windows") << QString::fromLatin1("windows"); #endif -#if !defined(QT_NO_STYLE_GTK) - QTest::newRow("gtk") << QString::fromLatin1("gtk"); -#endif #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) QTest::newRow("macintosh") << QString::fromLatin1("macintosh"); #endif diff --git a/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro b/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro index 0cd706420e..bdf18a0252 100644 --- a/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro +++ b/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscrollarea QT += widgets testlib SOURCES += tst_qscrollarea.cpp diff --git a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro index 8c6ea6e1d4..2863dd2034 100644 --- a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro +++ b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscrollbar QT += widgets testlib SOURCES += tst_qscrollbar.cpp diff --git a/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro b/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro index ceb897c612..1149b50feb 100644 --- a/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro +++ b/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsizegrip INCLUDEPATH += . QT += widgets testlib diff --git a/tests/auto/widgets/widgets/qslider/qslider.pro b/tests/auto/widgets/widgets/qslider/qslider.pro index d0a61e5a95..4c8b061459 100644 --- a/tests/auto/widgets/widgets/qslider/qslider.pro +++ b/tests/auto/widgets/widgets/qslider/qslider.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qslider QT += widgets testlib SOURCES += tst_qslider.cpp diff --git a/tests/auto/widgets/widgets/qsplitter/qsplitter.pro b/tests/auto/widgets/widgets/qsplitter/qsplitter.pro index c43847b11f..8ae745ea9d 100644 --- a/tests/auto/widgets/widgets/qsplitter/qsplitter.pro +++ b/tests/auto/widgets/widgets/qsplitter/qsplitter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsplitter QT += widgets testlib SOURCES += tst_qsplitter.cpp diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index a54ad6ecd0..9e854ff3ea 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -678,9 +678,9 @@ void tst_QSplitter::task187373_addAbstractScrollAreas_data() classNames << QLatin1String("QTreeView"); foreach (QString className, classNames) { - QTest::newRow(qPrintable(QString("%1 1").arg(className))) << className << false << true; - QTest::newRow(qPrintable(QString("%1 2").arg(className))) << className << true << false; - QTest::newRow(qPrintable(QString("%1 3").arg(className))) << className << true << true; + QTest::newRow(qPrintable(className + QLatin1String(" 1"))) << className << false << true; + QTest::newRow(qPrintable(className + QLatin1String(" 2"))) << className << true << false; + QTest::newRow(qPrintable(className + QLatin1String(" 3"))) << className << true << true; } } diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp index d060c4ceae..2a2bc1edf8 100644 --- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp +++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp @@ -149,7 +149,7 @@ private: void createWidgets() { for (int i = 0; i < m_n; ++i) { QLineEdit *le = new QLineEdit(this); - le->setObjectName(QString::fromLatin1("lineEdit%1").arg(i)); + le->setObjectName(QLatin1String("lineEdit") + QString::number(i)); layout ()->addWidget(le); m_les << le; } diff --git a/tests/auto/widgets/widgets/qtabbar/qtabbar.pro b/tests/auto/widgets/widgets/qtabbar/qtabbar.pro index 8772005bef..01b3c4a404 100644 --- a/tests/auto/widgets/widgets/qtabbar/qtabbar.pro +++ b/tests/auto/widgets/widgets/qtabbar/qtabbar.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtabbar QT += widgets testlib SOURCES += tst_qtabbar.cpp diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp index ced2253a74..b983e6954a 100644 --- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp @@ -606,7 +606,7 @@ public slots: void updateTabText() { count++; - setTabText(0, QString("%1").arg(count)); + setTabText(0, QString::number(count)); } }; diff --git a/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro b/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro index a8c62ec54a..19b3a03443 100644 --- a/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro +++ b/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtoolbox QT += widgets testlib SOURCES += tst_qtoolbox.cpp diff --git a/tests/auto/xml/sax/qxml/qxml.pro b/tests/auto/xml/sax/qxml/qxml.pro index e5fd4eafe3..e0b48ad9f5 100644 --- a/tests/auto/xml/sax/qxml/qxml.pro +++ b/tests/auto/xml/sax/qxml/qxml.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qxml SOURCES += tst_qxml.cpp |