diff options
Diffstat (limited to 'tests/auto/corelib')
335 files changed, 2420 insertions, 1881 deletions
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 8a9ae0cd72..e56da51134 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; @@ -2082,7 +2082,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 64a63ce28a..b5b75be3a6 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..d63a7a213b 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -186,6 +186,11 @@ private slots: void floatingPointNaN(); + void transaction_data(); + void transaction(); + void nestedTransactionsResult_data(); + void nestedTransactionsResult(); + private: void writebool(QDataStream *s); void writeQBitArray(QDataStream *s); @@ -301,7 +306,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 +343,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 +534,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 +802,7 @@ void tst_QDataStream::readbool(QDataStream *s) bool d1; *s >> d1; - QVERIFY(d1 == expected); + QCOMPARE(d1, expected); } // ************************************ @@ -860,7 +865,7 @@ void tst_QDataStream::readQBitArray(QDataStream *s) QBitArray d1; *s >> d1; - QVERIFY(d1 == expected); + QCOMPARE(d1, expected); } // ************************************ @@ -919,7 +924,7 @@ void tst_QDataStream::readQBrush(QDataStream *s) *s >> d2; QBrush brush = qBrushData(dataIndex(QTest::currentDataTag())); - QVERIFY(d2 == brush); + QCOMPARE(d2, brush); } // ************************************ @@ -961,7 +966,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 +1062,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 +1125,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 +1219,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 +1269,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 +1420,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 +1523,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 +1573,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 +1644,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 +1696,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 +1809,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 +1873,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 +1921,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 +2077,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 +2101,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 +2116,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 +2181,8 @@ void tst_QDataStream::setVersion() } } } - QVERIFY(pal1 == inPal1); - QVERIFY(pal2 == inPal2); + QCOMPARE(pal1, inPal1); + QCOMPARE(pal2, inPal2); } } } @@ -3062,9 +3067,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 +3099,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() @@ -3190,6 +3195,165 @@ void tst_QDataStream::floatingPointPrecision() } +void tst_QDataStream::transaction_data() +{ + QTest::addColumn<qint8>("i8Data"); + QTest::addColumn<qint16>("i16Data"); + QTest::addColumn<qint32>("i32Data"); + QTest::addColumn<qint64>("i64Data"); + QTest::addColumn<bool>("bData"); + QTest::addColumn<float>("fData"); + QTest::addColumn<double>("dData"); + QTest::addColumn<QByteArray>("strData"); + QTest::addColumn<QByteArray>("rawData"); + + QTest::newRow("1") << qint8(1) << qint16(2) << qint32(3) << qint64(4) << true << 5.0f + << double(6.0) << QByteArray("Hello world!") << QByteArray("Qt rocks!"); + QTest::newRow("2") << qint8(1 << 6) << qint16(1 << 14) << qint32(1 << 30) << qint64Data(3) << false << 123.0f + << double(234.0) << stringData(5).toUtf8() << stringData(6).toUtf8(); + QTest::newRow("3") << qint8(-1) << qint16(-2) << qint32(-3) << qint64(-4) << true << -123.0f + << double(-234.0) << stringData(3).toUtf8() << stringData(4).toUtf8(); +} + +void tst_QDataStream::transaction() +{ + QByteArray testBuffer; + + QFETCH(qint8, i8Data); + QFETCH(qint16, i16Data); + QFETCH(qint32, i32Data); + QFETCH(qint64, i64Data); + QFETCH(bool, bData); + QFETCH(float, fData); + QFETCH(double, dData); + QFETCH(QByteArray, strData); + QFETCH(QByteArray, rawData); + + { + QDataStream stream(&testBuffer, QIODevice::WriteOnly); + + stream << i8Data << i16Data << i32Data << i64Data + << bData << fData << dData << strData.constData(); + stream.writeRawData(rawData.constData(), rawData.size()); + } + + for (int splitPos = 0; splitPos <= testBuffer.size(); ++splitPos) { + QByteArray readBuffer(testBuffer.left(splitPos)); + SequentialBuffer dev(&readBuffer); + dev.open(QIODevice::ReadOnly); + QDataStream stream(&dev); + + qint8 i8; + qint16 i16; + qint32 i32; + qint64 i64; + bool b; + float f; + double d; + char *str; + QByteArray raw(rawData.size(), 0); + + forever { + stream.startTransaction(); + stream >> i8 >> i16 >> i32 >> i64 >> b >> f >> d >> str; + stream.readRawData(raw.data(), raw.size()); + + if (stream.commitTransaction()) + break; + + QVERIFY(stream.status() == QDataStream::ReadPastEnd); + QVERIFY(splitPos == 0 || !stream.atEnd()); + QVERIFY(readBuffer.size() < testBuffer.size()); + delete [] str; + raw.fill(0); + readBuffer.append(testBuffer.right(testBuffer.size() - splitPos)); + } + + QVERIFY(stream.atEnd()); + QCOMPARE(i8, i8Data); + QCOMPARE(i16, i16Data); + QCOMPARE(i32, i32Data); + QCOMPARE(i64, i64Data); + QCOMPARE(b, bData); + QCOMPARE(f, fData); + QCOMPARE(d, dData); + QVERIFY(strData == str); + delete [] str; + QCOMPARE(raw, rawData); + } +} + +void tst_QDataStream::nestedTransactionsResult_data() +{ + QTest::addColumn<bool>("commitFirst"); + QTest::addColumn<bool>("rollbackFirst"); + QTest::addColumn<bool>("commitSecond"); + QTest::addColumn<bool>("rollbackSecond"); + QTest::addColumn<bool>("successExpected"); + QTest::addColumn<bool>("expectedAtEnd"); + QTest::addColumn<int>("expectedStatus"); + + QTest::newRow("1") << false << false << false << false + << false << true << int(QDataStream::ReadCorruptData); + QTest::newRow("2") << false << false << false << true + << false << true << int(QDataStream::ReadCorruptData); + QTest::newRow("3") << false << false << true << false + << false << true << int(QDataStream::ReadCorruptData); + + QTest::newRow("4") << false << true << false << false + << false << true << int(QDataStream::ReadCorruptData); + QTest::newRow("5") << false << true << false << true + << false << false << int(QDataStream::ReadPastEnd); + QTest::newRow("6") << false << true << true << false + << false << false << int(QDataStream::ReadPastEnd); + + QTest::newRow("7") << true << false << false << false + << false << true << int(QDataStream::ReadCorruptData); + QTest::newRow("8") << true << false << false << true + << false << false << int(QDataStream::ReadPastEnd); + QTest::newRow("9") << true << false << true << false + << true << true << int(QDataStream::Ok); +} + +void tst_QDataStream::nestedTransactionsResult() +{ + QByteArray testBuffer(1, 0); + QDataStream stream(&testBuffer, QIODevice::ReadOnly); + uchar c; + + QFETCH(bool, commitFirst); + QFETCH(bool, rollbackFirst); + QFETCH(bool, commitSecond); + QFETCH(bool, rollbackSecond); + QFETCH(bool, successExpected); + QFETCH(bool, expectedAtEnd); + QFETCH(int, expectedStatus); + + stream.startTransaction(); + stream.startTransaction(); + stream >> c; + + if (commitFirst) + QVERIFY(stream.commitTransaction()); + else if (rollbackFirst) + stream.rollbackTransaction(); + else + stream.abortTransaction(); + + stream.startTransaction(); + + if (commitSecond) + QCOMPARE(stream.commitTransaction(), commitFirst); + else if (rollbackSecond) + stream.rollbackTransaction(); + else + stream.abortTransaction(); + + QCOMPARE(stream.commitTransaction(), successExpected); + QCOMPARE(stream.atEnd(), expectedAtEnd); + QCOMPARE(int(stream.status()), expectedStatus); +} + QTEST_MAIN(tst_QDataStream) #include "tst_qdatastream.moc" 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/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index f637ffcfc5..231f37fa05 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -57,9 +57,11 @@ private slots: void readLine2_data(); void readLine2(); - void peekBug(); void readAllKeepPosition(); void writeInTextMode(); + + void transaction_data(); + void transaction(); }; void tst_QIODevice::initTestCase() @@ -527,77 +529,23 @@ void tst_QIODevice::readLine2() } } - -class PeekBug : public QIODevice { - Q_OBJECT -public: - char alphabet[27]; - qint64 counter; - PeekBug() : QIODevice(), counter(0) { - memcpy(alphabet,"abcdefghijklmnopqrstuvqxyz",27); - }; - qint64 readData(char *data, qint64 maxlen) { - qint64 pos = 0; - while (pos < maxlen) { - *(data + pos) = alphabet[counter]; - pos++; - counter++; - if (counter == 26) - counter = 0; - } - return maxlen; - } - qint64 writeData(const char * /* data */, qint64 /* maxlen */) { - return -1; - } - -}; - -// This is a regression test for an old bug where peeking at -// more than one character failed to put them back. -void tst_QIODevice::peekBug() -{ - PeekBug peekBug; - peekBug.open(QIODevice::ReadOnly | QIODevice::Unbuffered); - - char onetwo[2]; - peekBug.peek(onetwo, 2); - QCOMPARE(onetwo[0], 'a'); - QCOMPARE(onetwo[1], 'b'); - - peekBug.read(onetwo, 1); - QCOMPARE(onetwo[0], 'a'); - - peekBug.peek(onetwo, 2); - QCOMPARE(onetwo[0], 'b'); - QCOMPARE(onetwo[1], 'c'); - - peekBug.read(onetwo, 1); - QCOMPARE(onetwo[0], 'b'); - peekBug.read(onetwo, 1); - QCOMPARE(onetwo[0], 'c'); - peekBug.read(onetwo, 1); - QCOMPARE(onetwo[0], 'd'); - - peekBug.peek(onetwo, 2); - QCOMPARE(onetwo[0], 'e'); - QCOMPARE(onetwo[1], 'f'); - -} - class SequentialReadBuffer : public QIODevice { public: - SequentialReadBuffer(const char *data) : QIODevice(), buf(data), offset(0) { } + SequentialReadBuffer(const char *data) + : QIODevice(), buf(new QByteArray(data)), offset(0), ownbuf(true) { } + SequentialReadBuffer(QByteArray *byteArray) + : QIODevice(), buf(byteArray), offset(0), ownbuf(false) { } + virtual ~SequentialReadBuffer() { if (ownbuf) delete buf; } bool isSequential() const Q_DECL_OVERRIDE { return true; } - const QByteArray &buffer() const { return buf; } + const QByteArray &buffer() const { return *buf; } protected: qint64 readData(char *data, qint64 maxSize) Q_DECL_OVERRIDE { - maxSize = qMin(maxSize, qint64(buf.size() - offset)); - memcpy(data, buf.constData() + offset, maxSize); + maxSize = qMin(maxSize, qint64(buf->size() - offset)); + memcpy(data, buf->constData() + offset, maxSize); offset += maxSize; return maxSize; } @@ -607,8 +555,9 @@ protected: } private: - QByteArray buf; + QByteArray *buf; int offset; + bool ownbuf; }; // Test readAll() on position change for sequential device @@ -668,5 +617,117 @@ void tst_QIODevice::writeInTextMode() #endif } +void tst_QIODevice::transaction_data() +{ + QTest::addColumn<bool>("sequential"); + QTest::addColumn<qint8>("i8Data"); + QTest::addColumn<qint16>("i16Data"); + QTest::addColumn<qint32>("i32Data"); + QTest::addColumn<qint64>("i64Data"); + QTest::addColumn<bool>("bData"); + QTest::addColumn<float>("fData"); + QTest::addColumn<double>("dData"); + QTest::addColumn<QByteArray>("strData"); + + bool sequential = true; + do { + QByteArray devName(sequential ? "sequential" : "random-access"); + + QTest::newRow(qPrintable(devName + '1')) << sequential << qint8(1) << qint16(2) + << qint32(3) << qint64(4) << true + << 5.0f << double(6.0) + << QByteArray("Hello world!"); + QTest::newRow(qPrintable(devName + '2')) << sequential << qint8(1 << 6) << qint16(1 << 14) + << qint32(1 << 30) << (qint64(1) << 62) << false + << 123.0f << double(234.0) + << QByteArray("abcdefghijklmnopqrstuvwxyz"); + QTest::newRow(qPrintable(devName + '3')) << sequential << qint8(-1) << qint16(-2) + << qint32(-3) << qint64(-4) << true + << -123.0f << double(-234.0) + << QByteArray("Qt rocks!"); + sequential = !sequential; + } while (!sequential); +} + +// Test transaction integrity +void tst_QIODevice::transaction() +{ + QByteArray testBuffer; + + QFETCH(bool, sequential); + QFETCH(qint8, i8Data); + QFETCH(qint16, i16Data); + QFETCH(qint32, i32Data); + QFETCH(qint64, i64Data); + QFETCH(bool, bData); + QFETCH(float, fData); + QFETCH(double, dData); + QFETCH(QByteArray, strData); + + { + QDataStream stream(&testBuffer, QIODevice::WriteOnly); + + stream << i8Data << i16Data << i32Data << i64Data + << bData << fData << dData << strData.constData(); + } + + for (int splitPos = 0; splitPos <= testBuffer.size(); ++splitPos) { + QByteArray readBuffer(testBuffer.left(splitPos)); + QIODevice *dev = sequential ? (QIODevice *) new SequentialReadBuffer(&readBuffer) + : (QIODevice *) new QBuffer(&readBuffer); + dev->open(QIODevice::ReadOnly); + QDataStream stream(dev); + + qint8 i8; + qint16 i16; + qint32 i32; + qint64 i64; + bool b; + float f; + double d; + char *str; + + forever { + QVERIFY(!dev->isTransactionStarted()); + dev->startTransaction(); + QVERIFY(dev->isTransactionStarted()); + + // Try to read all data in one go. If the status of the data stream + // indicates an unsuccessful operation, restart a read transaction + // on the completed buffer. + stream >> i8 >> i16 >> i32 >> i64 >> b >> f >> d >> str; + + QVERIFY(stream.atEnd()); + if (stream.status() == QDataStream::Ok) { + dev->commitTransaction(); + break; + } + + dev->rollbackTransaction(); + QVERIFY(splitPos == 0 || !stream.atEnd()); + QCOMPARE(dev->pos(), Q_INT64_C(0)); + QCOMPARE(dev->bytesAvailable(), qint64(readBuffer.size())); + QVERIFY(readBuffer.size() < testBuffer.size()); + delete [] str; + readBuffer.append(testBuffer.right(testBuffer.size() - splitPos)); + stream.resetStatus(); + } + + QVERIFY(!dev->isTransactionStarted()); + QVERIFY(stream.atEnd()); + QCOMPARE(i8, i8Data); + QCOMPARE(i16, i16Data); + QCOMPARE(i32, i32Data); + QCOMPARE(i64, i64Data); + QCOMPARE(b, bData); + QCOMPARE(f, fData); + QCOMPARE(d, dData); + QVERIFY(strData == str); + delete [] str; + stream.setDevice(0); + delete dev; + } +} + QTEST_MAIN(tst_QIODevice) #include "tst_qiodevice.moc" 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..af0a1d5c37 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -138,7 +138,8 @@ private slots: void spaceArgsTest(); #if defined(Q_OS_WIN) void nativeArguments(); -#endif + void createProcessArgumentsModifier(); +#endif // Q_OS_WIN void exitCodeTest(); void systemEnvironment(); void lockupsInStartDetached(); @@ -840,11 +841,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 +854,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 +863,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 +1440,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 +1497,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. @@ -1512,7 +1513,26 @@ void tst_QProcess::nativeArguments() QCOMPARE(actual, expected); } -#endif +void tst_QProcess::createProcessArgumentsModifier() +{ + int calls = 0; + const QString reversedCommand = "lamroNssecorPtset/lamroNssecorPtset"; + QProcess process; + process.setCreateProcessArgumentsModifier([&calls] (QProcess::CreateProcessArguments *args) + { + calls++; + std::reverse(args->arguments, args->arguments + wcslen(args->arguments) - 1); + }); + process.start(reversedCommand); + QVERIFY2(process.waitForStarted(), qUtf8Printable(process.errorString())); + QVERIFY(process.waitForFinished()); + QCOMPARE(calls, 1); + + process.setCreateProcessArgumentsModifier(QProcess::CreateProcessArgumentModifier()); + QVERIFY(!process.waitForStarted()); + QCOMPARE(calls, 1); +} +#endif // Q_OS_WIN void tst_QProcess::exitCodeTest() { @@ -2300,6 +2320,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 50c5b938e9..3425c14cd4 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 3ab53848d8..7ebccbc252 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 519b05f492..390794d806 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -230,7 +230,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()); @@ -258,7 +258,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")); @@ -288,7 +288,7 @@ void tst_QUrl::assignment() QUrl copy; copy = url; - QVERIFY(url == copy); + QCOMPARE(url, copy); } void tst_QUrl::comparison() @@ -299,7 +299,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)); @@ -333,7 +333,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"); @@ -370,7 +370,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)); @@ -464,7 +464,7 @@ void tst_QUrl::copying() QUrl copy(url); - QVERIFY(url == copy); + QCOMPARE(url, copy); } void tst_QUrl::setUrl() @@ -1687,9 +1687,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); } @@ -2924,7 +2924,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 @@ -3015,7 +3016,8 @@ void tst_QUrl::fromUserInputWithCwd_data() if (it.fileName() == QLatin1String(".")) { url = QUrl::fromLocalFile(QDir::currentPath()); // fromUserInput cleans the path } - 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()); @@ -3224,7 +3226,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/test.bjson b/tests/auto/corelib/json/test.bjson Binary files differindex 9a0515f3ef..137b4dfeff 100644 --- a/tests/auto/corelib/json/test.bjson +++ b/tests/auto/corelib/json/test.bjson diff --git a/tests/auto/corelib/json/test.json b/tests/auto/corelib/json/test.json index 7c935fffc8..330756894a 100644 --- a/tests/auto/corelib/json/test.json +++ b/tests/auto/corelib/json/test.json @@ -32,7 +32,7 @@ "array":[ ], "object":{ }, "address": "50 St. James Street", - "url": "http://www.JSON.org/", + "url": "nix", "comment": "// /* <!-- --", "# -- --> */": " ", " s p a c e d " :[1,2 , 3 @@ -58,9 +58,9 @@ 2e-00, "rosebud", {"foo": "bar"}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, -{"classification":{"relevancyScore":1000,"searchUrl":{"value":"http://www.bizrate.com/iphone-cases/index__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone case for iPhone 3G/ 3GS","description":"Elite Horizontal Leather Pouch for Apple iPhone 3G/3Gs - Premium quality horizontal case for your Apple iPhone 3G/3Gs. This pouch is ideal for the style conscious on the go. This great looking case is made from high-quality leather with classic black...","manufacturer":"Apple","url":{"value":"http://www.bizrate.com/silicone-case-for-iphone-3g-3gs--pid1968262863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1968262863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1968262863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1968262863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1968262863","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Checkered Silicone Skin Soft Case for iPhone 4 4G","description":"Specification:Product Name Silicone Skin Case Model for Apple iPhone 4 Color Black Material Soft Silicone Skin Weight 26g Package 1 x Case for Apple iPhone 4 Description:This is a non-OEM product.Accessory Only, Phone is not included.","manufacturer":"H&B","url":{"value":"http://www.bizrate.com/nonslip-checkered-silicone-skin-soft-case-for-iphone-4-4g--pid2534935499/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2534935499","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2534935499","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2534935499","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2534935499","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Case for iPhone 4 - Black","description":"Description:Detachable Windmill Type Matte Hard Plastic Case Cover for iPhone 4 (Black / Magenta)Customised your iPhone with this wonderful Plastic Case which is a accessory for your iPhone 4 which is made of high quality and durable plastic, protect","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/plastic-case-for-iphone-4-black--pid2305624670/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2305624670","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2305624670","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2305624670","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2305624670","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective Silicone Case for iPhone 4","description":"Made of high quality PVC material Protects your iPhone 4 from any scratch and dirt Easy to install and remove, no any tool needed Cut-out design allows user can access all keypad / button and slot without having to remove the case","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/protective-silicone-case-for-iphone-4--pid2120981405/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2120981405","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2120981405","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2120981405","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2120981405","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"Iphone® 4 Aerosport Case","description":"Do more than just protect your iPhone 4 with this case bundle from rooCASE. This 3 in 1 bundle include a snap-on case, screen protector and a Nike+ sensor shoe pouch that can be use on most running shoes. Color: Purple Design: Love Provides protection...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/iphone-4-aerosport-case--pid2203798762/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2203798762","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2203798762","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2203798762","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2203798762","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Reflect For Iphone 3G","description":"NCAA iPhone 3G faceplate features the schools primary logo silk screened on the front of the case.","manufacturer":"Griffin","url":{"value":"http://www.bizrate.com/case-reflect-for-iphone-3g--pid1114627445/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=1114627445","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=1114627445","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=1114627445","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=1114627445","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Protector Case for iPhone 4 Black","description":"Protect and personalize your iPhone 4 with this front and back image design Protector Case. Form-fitting front and back hard plastic covers Protects your cell phone without adding a lot of bulk Smooth glossy finish Snaps on to the front edges, sides...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/infuse-protector-case-for-iphone-4-black--pid2557462717/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2557462717","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2557462717","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2557462717","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2557462717","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly iPhone 4 Kream Case - Black","description":"DF-0030219 - White, Kream Case for iPhone 4 by Dragon-Fly","url":{"value":"http://www.bizrate.com/dragonfly-iphone-4-kream-case-black--pid2442061740/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2442061740","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2442061740","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2442061740","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2442061740","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Apple iPhone 3G/3GS Silicone Case (Black)","description":"Snap on Apple iPhone 3G 3GS Synthetic Leather Hardshell Case! Premium Qualtiy Synthetic Leather cover provides style, comfort, and protection to your iPhone 3G & 3GS. It also adds a sophisticated elegance and cool to your fashion. The case allows Quick...","manufacturer":"Luxmo","url":{"value":"http://www.bizrate.com/apple-iphone-3g3gs-silicone-case-black--pid2004746863/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2004746863","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2004746863","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2004746863","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2004746863","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox iPhone 4 Defender Case - Black","description":"Your iPhone 4 has become a big part of your life. With FaceTime video, retina display, multitasking, HD video recording and more - you've got a lot to lose. You won't find a tougher case than the OtterBox Defender Series for iPhone 4. This three-layer...","manufacturer":"Universal","url":{"value":"http://www.bizrate.com/otterbox-iphone-4-defender-case-black--pid2584611575/compareprices__rf--af1__af_assettype_id--10__af_creative_id--6__af_id--50085__af_placement_id--1.html"},"images":{"image":[{"value":"http://image10.bizrate-images.com/resize?sq=60&uid=2584611575","xsize":60,"ysize":60},{"value":"http://image10.bizrate-images.com/resize?sq=100&uid=2584611575","xsize":100,"ysize":100},{"value":"http://image10.bizrate-images.com/resize?sq=160&uid=2584611575","xsize":160,"ysize":160},{"value":"http://image10.bizrate-images.com/resize?sq=400&uid=2584611575","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}} +{"classification":{"relevancyScore":1000,"searchUrl":{"value":"nix"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone c","description":"Elite Hori","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Ch","description":"Specificat","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Ca","description":"Descriptio","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective","description":"Made of hi","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"P® 4","description":"Do more th","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Refle","description":"NCAA iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Pro","description":"Protect an","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly ","description":"d","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Pho","description":"Snap on Ap","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox i","description":"Your iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, +{"classification":{"relevancyScore":1000,"searchUrl":{"value":"nix"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone c","description":"Elite Hori","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Ch","description":"Specificat","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Ca","description":"Descriptio","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective","description":"Made of hi","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"P® 4","description":"Do more th","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Refle","description":"NCAA iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Pro","description":"Protect an","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly ","description":"d","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Pho","description":"Snap on Ap","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox i","description":"Your iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, +{"classification":{"relevancyScore":1000,"searchUrl":{"value":"nix"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone c","description":"Elite Hori","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Ch","description":"Specificat","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Ca","description":"Descriptio","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective","description":"Made of hi","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"P® 4","description":"Do more th","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Refle","description":"NCAA iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Pro","description":"Protect an","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly ","description":"d","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Pho","description":"Snap on Ap","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox i","description":"Your iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}}, +{"classification":{"relevancyScore":1000,"searchUrl":{"value":"nix"}},"products":{"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$4,833.99","integral":483399}},"product":[{"type":"PRODUCT","title":"Silicone c","description":"Elite Hori","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":310711221747712.000000,"priceSet":{"minPrice":{"value":"$1.56","integral":156},"maxPrice":{"value":"$29.99","integral":2999},"stores":14},"id":1968262863,"categoryId":8515},{"type":"PRODUCT","title":"Nonslip Ch","description":"Specificat","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":175580930637824.000000,"priceSet":{"minPrice":{"value":"$0.45","integral":45},"maxPrice":{"value":"$194.95","integral":19495},"stores":34},"id":2534935499,"categoryId":8515},{"type":"PRODUCT","title":"Plastic Ca","description":"Descriptio","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":132488642953216.000000,"priceSet":{"minPrice":{"value":"$0.99","integral":99},"maxPrice":{"value":"$303.68","integral":30368},"stores":33},"id":2305624670,"categoryId":8515},{"type":"PRODUCT","title":"Protective","description":"Made of hi","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":108614681362432.000000,"priceSet":{"minPrice":{"value":"$1.70","integral":170},"maxPrice":{"value":"$99.99","integral":9999},"stores":11},"id":2120981405,"categoryId":8515},{"type":"PRODUCT","title":"P® 4","description":"Do more th","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":96203484168192.000000,"priceSet":{"minPrice":{"value":"$2.49","integral":249},"maxPrice":{"value":"$79.95","integral":7995},"stores":16},"id":2203798762,"categoryId":8515},{"type":"PRODUCT","title":"Case Refle","description":"NCAA iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":84727583211520.000000,"priceSet":{"minPrice":{"value":"$0.69","integral":69},"maxPrice":{"value":"$75.52","integral":7552},"stores":59},"id":1114627445,"categoryId":8515},{"type":"PRODUCT","title":"Infuse Pro","description":"Protect an","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":80831066406912.000000,"priceSet":{"minPrice":{"value":"$0.59","integral":59},"maxPrice":{"value":"$79.00","integral":7900},"stores":24},"id":2557462717,"categoryId":8515},{"type":"PRODUCT","title":"Dragonfly ","description":"d","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":70900229603328.000000,"priceSet":{"minPrice":{"value":"$1.05","integral":105},"maxPrice":{"value":"$94.49","integral":9449},"stores":30},"id":2442061740,"categoryId":8515},{"type":"PRODUCT","title":"Pho","description":"Snap on Ap","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":65194915004416.000000,"priceSet":{"minPrice":{"value":"$0.01","integral":1},"maxPrice":{"value":"$414.99","integral":41499},"stores":39},"id":2004746863,"categoryId":8515},{"type":"PRODUCT","title":"Otterbox i","description":"Your iPhon","manufacturer":"someone","url":{"value":"nix"},"images":{"image":[{"value":"nix","xsize":60,"ysize":60},{"value":"nix","xsize":100,"ysize":100},{"value":"nix","xsize":160,"ysize":160},{"value":"nix","xsize":400,"ysize":400}]},"relevancy":61515478597632.000000,"priceSet":{"minPrice":{"value":"$3.28","integral":328},"maxPrice":{"value":"$110.65","integral":11065},"stores":25},"id":2584611575,"categoryId":8515}],"includedResults":10,"totalResults":2000}} ] diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 1665ff696d..8b2cee5e2f 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -46,14 +46,9 @@ class tst_QtJson: public QObject { Q_OBJECT -public: - tst_QtJson(QObject *parent = 0); private Q_SLOTS: void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); void testValueSimple(); void testNumbers(); @@ -151,10 +146,6 @@ private: QString testDataDir; }; -tst_QtJson::tst_QtJson(QObject *parent) : QObject(parent) -{ -} - void tst_QtJson::initTestCase() { testDataDir = QFileInfo(QFINDTESTDATA("test.json")).absolutePath(); @@ -162,18 +153,6 @@ void tst_QtJson::initTestCase() testDataDir = QCoreApplication::applicationDirPath(); } -void tst_QtJson::cleanupTestCase() -{ -} - -void tst_QtJson::init() -{ -} - -void tst_QtJson::cleanup() -{ -} - void tst_QtJson::testValueSimple() { QJsonObject object; @@ -741,7 +720,7 @@ void tst_QtJson::testObjectIteration() { QJsonObject object2 = object; - QVERIFY(object == object2); + QCOMPARE(object, object2); QJsonValue val = *object2.begin(); object2.erase(object2.begin()); @@ -757,7 +736,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 +772,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 +793,7 @@ void tst_QtJson::testArrayIteration() { QJsonArray array2 = array; - QVERIFY(array == array2); + QCOMPARE(array, array2); QJsonValue val = *array2.begin(); array2.erase(array2.begin()); @@ -856,7 +835,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 +849,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 +877,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 +896,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); @@ -1414,9 +1393,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" @@ -1427,6 +1404,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" @@ -1746,7 +1735,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); @@ -1754,8 +1743,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() @@ -1776,7 +1765,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() @@ -2092,7 +2081,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 ] ]"; @@ -2104,7 +2093,7 @@ void tst_QtJson::assignToDocument() QJsonDocument innerDoc(inner.toArray()); QVERIFY(innerDoc != doc); - QVERIFY(innerDoc.array() == inner.toArray()); + QCOMPARE(innerDoc.array(), inner.toArray()); } } @@ -2135,7 +2124,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() @@ -2334,14 +2323,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()); @@ -2349,9 +2338,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()); @@ -2359,7 +2348,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()); @@ -2367,7 +2356,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); @@ -2377,7 +2366,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); @@ -2387,13 +2376,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() @@ -2527,7 +2516,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() @@ -2559,14 +2548,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 "); @@ -2578,14 +2567,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); } @@ -2595,7 +2584,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; @@ -2609,12 +2598,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; @@ -2628,7 +2617,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); } } @@ -2761,7 +2750,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); @@ -2775,12 +2764,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 c74a43b682..6ee57dba20 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 3ac728931d..f3bc045455 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 f7c1f03c0f..1f899d1630 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 c91bb21399..bbca60a80e 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -57,6 +57,7 @@ #include <QBuffer> #include "qnumeric.h" +#include <private/qlocale_p.h> #include "tst_qvariant_common.h" class CustomNonQObject; @@ -352,13 +353,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)); } } @@ -902,7 +903,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() @@ -1029,7 +1030,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" ); } @@ -1055,7 +1060,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" ); @@ -1324,9 +1333,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; } @@ -1412,12 +1421,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")); @@ -2123,7 +2148,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); @@ -2137,7 +2162,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); @@ -2152,7 +2177,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); @@ -2166,10 +2191,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); @@ -2454,7 +2479,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; @@ -2642,7 +2667,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); @@ -2651,7 +2676,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); @@ -2918,10 +2943,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); @@ -2938,10 +2963,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; } @@ -3113,8 +3138,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 @@ -3337,7 +3362,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 ) ); @@ -3422,10 +3447,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; } } @@ -3661,8 +3687,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); @@ -4167,7 +4202,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); @@ -4181,7 +4216,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 8c76809c48..17d3f5204a 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -238,6 +238,9 @@ private slots: void multiTargetTransitionInsideParallelStateGroup(); void signalTransitionNormalizeSignature(); +#ifdef Q_COMPILER_DELEGATING_CONSTRUCTORS + void createPointerToMemberSignalTransition(); +#endif void createSignalTransitionWhenRunning(); void createEventTransitionWhenRunning(); void signalTransitionSenderInDifferentThread(); @@ -3037,7 +3040,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); @@ -5877,6 +5880,31 @@ void tst_QStateMachine::signalTransitionNormalizeSignature() TEST_ACTIVE_CHANGED(s1, 1); } +#ifdef Q_COMPILER_DELEGATING_CONSTRUCTORS +void tst_QStateMachine::createPointerToMemberSignalTransition() +{ + QStateMachine machine; + QState *s1 = new QState(&machine); + DEFINE_ACTIVE_SPY(s1); + machine.setInitialState(s1); + machine.start(); + TEST_ACTIVE_CHANGED(s1, 1); + QTRY_VERIFY(machine.configuration().contains(s1)); + + QState *s2 = new QState(&machine); + DEFINE_ACTIVE_SPY(s2); + SignalEmitter emitter; + QSignalTransition *t1 = new QSignalTransition(&emitter, &SignalEmitter::signalWithNoArg, s1); + QCOMPARE(t1->sourceState(), s1); + t1->setTargetState(s2); + s1->addTransition(t1); + emitter.emitSignalWithNoArg(); + TEST_ACTIVE_CHANGED(s1, 2); + TEST_ACTIVE_CHANGED(s2, 1); + QTRY_VERIFY(machine.configuration().contains(s2)); +} +#endif + void tst_QStateMachine::createSignalTransitionWhenRunning() { QStateMachine machine; @@ -6159,26 +6187,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/gcc/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char/char.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char16_t/char16_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/char32_t/char32_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/int/int.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/long/long.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qlonglong/qlonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qptrdiff/qptrdiff.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/quintptr/quintptr.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/qulonglong/qulonglong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/schar/schar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/short/short.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uchar/uchar.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/uint/uint.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ulong/ulong.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/ushort/ushort.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro deleted file mode 100644 index 64401f0229..0000000000 --- a/tests/auto/corelib/thread/qatomicinteger/no-cxx11/wchar_t/wchar_t.pro +++ /dev/null @@ -1 +0,0 @@ -include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri index e80e71f238..f1030d41ef 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri @@ -2,18 +2,9 @@ TYPE = $$basename(_PRO_FILE_PWD_) dn = $$dirname(_PRO_FILE_PWD_) FORCE = $$basename(dn) +suffix = $$TYPE -equals(FORCE, no-cxx11) { - suffix = NoCxx11_$$TYPE - DEFINES += QT_ATOMIC_FORCE_NO_CXX11 -} else: equals(FORCE, gcc) { - suffix = Gcc_$$TYPE - DEFINES += QT_ATOMIC_FORCE_GCC -} else { - 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/qatomicinteger/qatomicinteger.pro b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro index 9d929e649e..09458bd9c3 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro @@ -16,43 +16,3 @@ SUBDIRS=\ ulong \ ushort \ wchar_t \ - - -contains(QT_CONFIG, c++11)|msvc: SUBDIRS +=\ - no-cxx11/char \ - no-cxx11/char16_t \ - no-cxx11/char32_t \ - no-cxx11/int \ - no-cxx11/long \ - no-cxx11/qlonglong \ - no-cxx11/qptrdiff \ - no-cxx11/quintptr \ - no-cxx11/qulonglong \ - no-cxx11/schar \ - no-cxx11/short \ - no-cxx11/uchar \ - no-cxx11/uint \ - no-cxx11/ulong \ - no-cxx11/ushort \ - no-cxx11/wchar_t \ - - -# The GCC-style atomics only support 32-bit and pointer-sized but add -# them all anyway so we ensure the macros are properly defined -gcc: SUBDIRS +=\ - gcc/char \ - gcc/char16_t \ - gcc/char32_t \ - gcc/int \ - gcc/long \ - gcc/qlonglong \ - gcc/qptrdiff \ - gcc/quintptr \ - gcc/qulonglong \ - gcc/schar \ - gcc/short \ - gcc/uchar \ - gcc/uint \ - gcc/ulong \ - gcc/ushort \ - gcc/wchar_t \ 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 e81038a4be..b9bc456dcf 100644 --- a/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -4,4 +4,4 @@ SUBDIRS = \ !winrt: SUBDIRS += crashonexit -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 d97d474e51..b9d661a9af 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 !winrt: 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 b9487cee33..09052c05f5 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -98,13 +98,6 @@ class tst_Collections : public QObject { Q_OBJECT -public: - tst_Collections(); - ~tst_Collections(); - -public slots: - void init(); - void cleanup(); private slots: void typeinfo(); void qstring(); @@ -176,23 +169,6 @@ struct Pod { int i1, i2; }; -tst_Collections::tst_Collections() -{ -} - -tst_Collections::~tst_Collections() -{ - -} - -void tst_Collections::init() -{ -} - -void tst_Collections::cleanup() -{ -} - void tst_Collections::typeinfo() { QVERIFY(QTypeInfo<int*>::isPointer); @@ -519,11 +495,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")); } @@ -535,15 +511,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")); } { @@ -577,10 +553,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 @@ -956,15 +932,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")); } { @@ -972,10 +948,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")); } { @@ -1056,8 +1032,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; { @@ -1072,10 +1048,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; @@ -1596,15 +1572,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")); } { @@ -1917,15 +1893,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")); } { @@ -2007,17 +1983,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); @@ -2025,16 +2001,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 = ""; @@ -2050,7 +2026,7 @@ void tst_Collections::qstring() QString fill = "123"; fill.fill('a'); - QVERIFY(fill == "aaa"); + QCOMPARE(fill, QLatin1String("aaa")); s.clear(); s = hello; @@ -2062,15 +2038,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"); @@ -2127,25 +2103,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'); @@ -2154,17 +2130,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"); @@ -2180,10 +2156,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()); { @@ -2330,7 +2306,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); @@ -3484,7 +3460,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..29e48a1cc8 100644 --- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp @@ -43,10 +43,8 @@ class tst_QChar : public QObject { Q_OBJECT -public slots: - void init(); - void cleanup(); private slots: + void operator_eqeq_int(); void operators_data(); void operators(); void toUpper(); @@ -80,25 +78,30 @@ 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() +void tst_QChar::operator_eqeq_int() { -#if defined(Q_OS_WINCE) - delete app; -#endif + { + const QChar ch = QLatin1Char(' '); + QVERIFY(ch != 0); + QVERIFY(!(ch == 0)); + + QVERIFY(ch == 0x20); + QVERIFY(!(ch != 0x20)); + QVERIFY(0x20 == ch); + QVERIFY(!(0x20 != ch)); + } + { + const QChar ch = QLatin1Char('\0'); + QVERIFY(ch == 0); + QVERIFY(!(ch != 0)); + + QVERIFY(ch != 0x20); + QVERIFY(!(ch == 0x20)); + QVERIFY(0x20 != ch); + QVERIFY(!(0x20 == ch)); + } } void tst_QChar::operators_data() @@ -239,8 +242,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 +269,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 +291,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 +406,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 +763,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 +800,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 937a490da2..ba7586c3db 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -1068,7 +1068,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 6d88b24eda..4f82ce9c08 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -1826,13 +1826,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; } } @@ -2231,11 +2233,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/qhashfunctions/tst_qhashfunctions.cpp b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp index bde9433a24..6cd8c3d29d 100644 --- a/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp +++ b/tests/auto/corelib/tools/qhashfunctions/tst_qhashfunctions.cpp @@ -115,6 +115,22 @@ void tst_QHashFunctions::qhash() QVERIFY(qHash(pA) != qHash(pB)); } + + { + std::pair<int, int> p12(1, 2); + std::pair<int, int> p21(2, 1); + + using QT_PREPEND_NAMESPACE(qHash); + + QVERIFY(qHash(p12) == qHash(p12)); + QVERIFY(qHash(p21) == qHash(p21)); + QVERIFY(qHash(p12) != qHash(p21)); + + std::pair<int, int> pA(0x12345678, 0x12345678); + std::pair<int, int> pB(0x12345675, 0x12345675); + + QVERIFY(qHash(pA) != qHash(pB)); + } } void tst_QHashFunctions::fp_qhash_of_zero_is_zero() 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 60afb29233..d9004d1eb6 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 { } !winrt: 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 5f046575c4..bab267f4ec 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -42,9 +42,11 @@ #include <qdatetime.h> #include <qprocess.h> #include <float.h> +#include <locale.h> #include <qlocale.h> #include <private/qlocale_p.h> +#include <private/qlocale_tools_p.h> #include <qnumeric.h> #if defined(Q_OS_LINUX) && !defined(__UCLIBC__) @@ -68,52 +70,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 +96,12 @@ 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 strtod_data(); + void strtod(); void long_long_conversion_data(); void long_long_conversion(); void long_long_conversion_extra(); @@ -194,10 +154,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 +180,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 +317,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 +378,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 +479,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 +516,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 +547,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) @@ -665,7 +606,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"); @@ -787,7 +728,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) @@ -804,6 +745,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) @@ -822,6 +768,178 @@ 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::strtod_data() +{ + QTest::addColumn<QString>("num_str"); + QTest::addColumn<double>("num"); + QTest::addColumn<int>("processed"); + QTest::addColumn<bool>("ok"); + + QTest::newRow("3.4") << QString("3.4") << 3.4 << 3 << true; + QTest::newRow("0.035003945") << QString("0.035003945") << 0.035003945 << 11 << true; + QTest::newRow("3.5003945e-2") << QString("3.5003945e-2") << 0.035003945 << 12 << true; + QTest::newRow("0.000003945") << QString("0.000003945") << 0.000003945 << 11 << true; + QTest::newRow("3.945e-6") << QString("3.945e-6") << 0.000003945 << 8 << true; + QTest::newRow("12456789012") << QString("12456789012") << 12456789012.0 << 11 << true; + QTest::newRow("1.2456789012e10") << QString("1.2456789012e10") << 12456789012.0 << 15 << true; + + QTest::newRow("a3.4") << QString("a3.4") << 0.0 << 0 << false; + QTest::newRow("b0.035003945") << QString("b0.035003945") << 0.0 << 0 << false; + QTest::newRow("c3.5003945e-2") << QString("c3.5003945e-2") << 0.0 << 0 << false; + QTest::newRow("d0.000003945") << QString("d0.000003945") << 0.0 << 0 << false; + QTest::newRow("e3.945e-6") << QString("e3.945e-6") << 0.0 << 0 << false; + QTest::newRow("f12456789012") << QString("f12456789012") << 0.0 << 0 << false; + QTest::newRow("g1.2456789012e10") << QString("g1.2456789012e10") << 0.0 << 0 << false; + + QTest::newRow("3.4a") << QString("3.4a") << 3.4 << 3 << true; + QTest::newRow("0.035003945b") << QString("0.035003945b") << 0.035003945 << 11 << true; + QTest::newRow("3.5003945e-2c") << QString("3.5003945e-2c") << 0.035003945 << 12 << true; + QTest::newRow("0.000003945d") << QString("0.000003945d") << 0.000003945 << 11 << true; + QTest::newRow("3.945e-6e") << QString("3.945e-6e") << 0.000003945 << 8 << true; + QTest::newRow("12456789012f") << QString("12456789012f") << 12456789012.0 << 11 << true; + QTest::newRow("1.2456789012e10g") << QString("1.2456789012e10g") << 12456789012.0 << 15 << true; + + QTest::newRow("0x3.4") << QString("0x3.4") << 0.0 << 1 << true; + QTest::newRow("0x0.035003945") << QString("0x0.035003945") << 0.0 << 1 << true; + QTest::newRow("0x3.5003945e-2") << QString("0x3.5003945e-2") << 0.0 << 1 << true; + QTest::newRow("0x0.000003945") << QString("0x0.000003945") << 0.0 << 1 << true; + QTest::newRow("0x3.945e-6") << QString("0x3.945e-6") << 0.0 << 1 << true; + QTest::newRow("0x12456789012") << QString("0x12456789012") << 0.0 << 1 << true; + QTest::newRow("0x1.2456789012e10") << QString("0x1.2456789012e10") << 0.0 << 1 << true; +} + +void tst_QLocale::strtod() +{ + QFETCH(QString, num_str); + QFETCH(double, num); + QFETCH(int, processed); + QFETCH(bool, ok); + + QByteArray numData = num_str.toLatin1(); + const char *end = 0; + bool actualOk = false; + double result = qstrtod(numData.constData(), &end, &actualOk); + + QCOMPARE(result, num); + QCOMPARE(actualOk, ok); + QCOMPARE(static_cast<int>(end - numData.constData()), processed); +} + void tst_QLocale::long_long_conversion_data() { QTest::addColumn<QString>("locale_name"); @@ -953,7 +1071,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 ); @@ -1279,13 +1398,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) { @@ -1294,14 +1413,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"); } @@ -1310,13 +1429,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"), @@ -1462,9 +1581,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)); @@ -1640,6 +1759,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() @@ -1699,9 +1832,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; } } @@ -1829,13 +1964,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); @@ -2039,12 +2188,18 @@ void tst_QLocale::currency() QCOMPARE(c.toCurrencyString(qlonglong(-1234)), QString("-1234")); QCOMPARE(c.toCurrencyString(double(1234.56)), QString("1234.56")); QCOMPARE(c.toCurrencyString(double(-1234.56)), QString("-1234.56")); + QCOMPARE(c.toCurrencyString(double(-1234.5678)), QString("-1234.57")); + QCOMPARE(c.toCurrencyString(double(-1234.5678), NULL, 4), QString("-1234.5678")); + QCOMPARE(c.toCurrencyString(double(-1234.56), NULL, 4), QString("-1234.5600")); const QLocale en_US("en_US"); QCOMPARE(en_US.toCurrencyString(qulonglong(1234)), QString("$1,234")); QCOMPARE(en_US.toCurrencyString(qlonglong(-1234)), QString("$-1,234")); QCOMPARE(en_US.toCurrencyString(double(1234.56)), QString("$1,234.56")); QCOMPARE(en_US.toCurrencyString(double(-1234.56)), QString("$-1,234.56")); + QCOMPARE(en_US.toCurrencyString(double(-1234.5678)), QString("$-1,234.57")); + QCOMPARE(en_US.toCurrencyString(double(-1234.5678), NULL, 4), QString("$-1,234.5678")); + QCOMPARE(en_US.toCurrencyString(double(-1234.56), NULL, 4), QString("$-1,234.5600")); const QLocale ru_RU("ru_RU"); QCOMPARE(ru_RU.toCurrencyString(qulonglong(1234)), QString::fromUtf8("1" "\xc2\xa0" "234\xc2\xa0\xd1\x80\xd1\x83\xd0\xb1.")); 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..9cc66cd5e2 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -34,16 +34,18 @@ #include <QtTest/QtTest> #include <private/qringbuffer_p.h> +#include <qvector.h> class tst_QRingBuffer : public QObject { Q_OBJECT private slots: + void constructing(); + void usingInVector(); void readPointerAtPositionWriteRead(); void readPointerAtPositionEmptyRead(); void readPointerAtPositionWithHead(); void readPointerAtPositionReadTooMuch(); - void sizeWhenEmpty(); void sizeWhenReservedAndChopped(); void sizeWhenReserved(); void free(); @@ -57,6 +59,33 @@ 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::usingInVector() +{ + QRingBuffer ringBuffer; + QVector<QRingBuffer> buffers; + + ringBuffer.reserve(5); + buffers.append(ringBuffer); + QCOMPARE(buffers[0].size(), Q_INT64_C(5)); +} + void tst_QRingBuffer::sizeWhenReserved() { QRingBuffer ringBuffer; @@ -74,13 +103,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 +162,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 +306,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 ab5bc410f6..69752ca1e9 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(); @@ -421,6 +422,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 a922e3ad27..544d0e9a73 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(); @@ -555,6 +556,7 @@ private slots: void nanAndInf(); void compare_data(); void compare(); + void resize(); void resizeAfterFromRawData(); void resizeAfterReserve(); void resizeWithNegative() const; @@ -970,61 +972,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 @@ -1046,11 +1048,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'); @@ -1116,7 +1118,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() ); @@ -1211,11 +1213,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()); @@ -1225,25 +1227,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")); @@ -1259,14 +1261,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")); @@ -1275,12 +1281,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")); + } } /* @@ -1369,7 +1393,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'); @@ -1816,9 +1840,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()); @@ -1834,10 +1858,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()); @@ -1853,8 +1877,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()); @@ -1869,8 +1893,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()); @@ -1886,8 +1910,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()); @@ -1965,8 +1989,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()); @@ -2090,44 +2114,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() @@ -2325,21 +2349,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() @@ -2465,12 +2489,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) @@ -3610,12 +3635,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 @@ -3872,7 +3897,7 @@ void tst_QString::check_QDataStream() { QDataStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"COMPARE Text"); + QCOMPARE(a, QLatin1String("COMPARE Text")); } } @@ -3887,7 +3912,7 @@ void tst_QString::check_QTextStream() { QTextStream in(&ar,QIODevice::ReadOnly); in >> a; - QCOMPARE(a,(QString)"This"); + QCOMPARE(a, QLatin1String("This")); } } @@ -4580,100 +4605,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"); @@ -4683,36 +4708,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')), @@ -4725,13 +4750,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() @@ -6019,6 +6049,22 @@ void tst_QString::compare() } } +void tst_QString::resize() +{ + QString s = QLatin1String("hello world"); + + s.resize(5); + QCOMPARE(s, QLatin1String("hello")); + s.resize(8); + QCOMPARE(s.size(), 8); + QVERIFY(s.startsWith(QLatin1String("hello"))); + + s.resize(10, QLatin1Char('n')); + QCOMPARE(s.size(), 10); + QVERIFY(s.startsWith(QLatin1String("hello"))); + QCOMPARE(s.right(2), QLatin1String("nn")); +} + void tst_QString::resizeAfterFromRawData() { QString buffer("hello world"); @@ -6157,9 +6203,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; @@ -6188,7 +6231,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(); } |