diff options
Diffstat (limited to 'tests/auto/corelib')
28 files changed, 537 insertions, 383 deletions
diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp index c3e368a813..33f9f0df48 100644 --- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp @@ -137,7 +137,7 @@ private: void tst_QAnimationGroup::emptyGroup() { QSequentialAnimationGroup group; - QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(groupStateChangedSpy.isValid()); QCOMPARE(group.state(), QAnimationGroup::Stopped); diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 7cb7bd024c..954a2ee983 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -256,10 +256,10 @@ void tst_QParallelAnimationGroup::stateChanged() group.addAnimation(anim3); group.addAnimation(anim4); - QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(spy1.isValid()); QVERIFY(spy2.isValid()); @@ -434,8 +434,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup() anim.setEndValue(100); anim.setDuration(200); - QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(groupStateChangedSpy.isValid()); QVERIFY(childStateChangedSpy.isValid()); @@ -601,8 +601,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild() anim2.setEndValue(100); anim2.setDuration(200); - QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(stateChangedSpy1.isValid()); QVERIFY(stateChangedSpy2.isValid()); @@ -669,19 +669,19 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() anim3.setEndValue(100); anim3.setDuration(10); - QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy1(&anim1, SIGNAL(finished())); QVERIFY(stateChangedSpy1.isValid()); QVERIFY(finishedSpy1.isValid()); - QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy2(&anim2, SIGNAL(finished())); QVERIFY(stateChangedSpy2.isValid()); QVERIFY(finishedSpy2.isValid()); - QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy3(&anim3, SIGNAL(finished())); QVERIFY(stateChangedSpy3.isValid()); @@ -760,7 +760,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations() loopsForever.setDuration(100); loopsForever.setLoopCount(-1); - QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(stateChangedSpy.isValid()); group.addAnimation(&anim1); @@ -968,7 +968,7 @@ void tst_QParallelAnimationGroup::pauseResume() { QParallelAnimationGroup group; TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250; - QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(spy.isValid()); QCOMPARE(group.duration(), 250); group.start(); diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index 8b7bd74130..bc08be530c 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -228,7 +228,7 @@ void tst_QPropertyAnimation::statesAndSignals() anim->setDuration(100); QSignalSpy finishedSpy(anim, SIGNAL(finished())); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int))); QVERIFY(finishedSpy.isValid()); @@ -308,7 +308,7 @@ void tst_QPropertyAnimation::deletion1() QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth"); //test that the animation is deleted correctly depending of the deletion flag passed in start() - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy(anim, SIGNAL(finished())); QVERIFY(runningSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -352,7 +352,7 @@ void tst_QPropertyAnimation::deletion2() anim->setEndValue(20); anim->setDuration(200); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy(anim, SIGNAL(finished())); QVERIFY(runningSpy.isValid()); @@ -386,7 +386,7 @@ void tst_QPropertyAnimation::deletion3() anim->setEndValue(20); anim->setDuration(200); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy(anim, SIGNAL(finished())); QVERIFY(runningSpy.isValid()); @@ -487,7 +487,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() //normal case: the animation finishes and is deleted QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole"); anim->setEndValue(100); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(runningSpy.isValid()); anim->start(QVariantAnimation::DeleteWhenStopped); QTest::qWait(anim->duration() + 100); @@ -498,7 +498,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() { QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole"); anim->setEndValue(100); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(runningSpy.isValid()); anim->start(QVariantAnimation::DeleteWhenStopped); QTest::qWait(anim->duration()/2); @@ -849,7 +849,7 @@ void tst_QPropertyAnimation::setStartEndValues() void tst_QPropertyAnimation::zeroDurationStart() { DummyPropertyAnimation anim; - QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(spy.isValid()); anim.setDuration(0); QCOMPARE(anim.state(), QAbstractAnimation::Stopped); @@ -927,7 +927,7 @@ void tst_QPropertyAnimation::operationsInStates() o.setProperty("ole", 42); QPropertyAnimation anim(&o, "ole"); anim.setEndValue(100); - QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(spy.isValid()); anim.stop(); @@ -1219,7 +1219,7 @@ void tst_QPropertyAnimation::zeroLoopCount() anim->setDuration(20); anim->setLoopCount(0); - QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QSignalSpy finishedSpy(anim, SIGNAL(finished())); QVERIFY(runningSpy.isValid()); diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 64751fd8d0..970d6a995b 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -639,8 +639,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume() sequence->addAnimation(a3_s_o1); sequence->setLoopCount(2); - QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(a1StateChangedSpy.isValid()); QVERIFY(seqStateChangedSpy.isValid()); @@ -747,7 +747,7 @@ void tst_QSequentialAnimationGroup::restart() // sequence operating on same object/property QAnimationGroup *sequence = new QSequentialAnimationGroup(); QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimation*))); - QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(seqCurrentAnimChangedSpy.isValid()); QVERIFY(seqStateChangedSpy.isValid()); @@ -758,7 +758,7 @@ void tst_QSequentialAnimationGroup::restart() for (int i = 0; i < 3; i++) { anims[i] = new DummyPropertyAnimation; anims[i]->setDuration(100); - animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(animsStateChanged[i]->isValid()); } @@ -818,10 +818,10 @@ void tst_QSequentialAnimationGroup::looping() QAbstractAnimation *a2_s_o1 = new DummyPropertyAnimation; QAbstractAnimation *a3_s_o1 = new DummyPropertyAnimation; - QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(a1Spy.isValid()); QVERIFY(a2Spy.isValid()); @@ -835,7 +835,7 @@ void tst_QSequentialAnimationGroup::looping() sequence->setLoopCount(2); QSequentialAnimationGroup group; - QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(groupSpy.isValid()); group.addAnimation(sequence); @@ -1103,8 +1103,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup() anim.setEndValue(100); anim.setDuration(200); - QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(groupStateChangedSpy.isValid()); QVERIFY(childStateChangedSpy.isValid()); @@ -1270,8 +1270,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild() anim2->setEndValue(100); anim2->setDuration(200); - QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); + QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(stateChangedSpy1.isValid()); QVERIFY(stateChangedSpy2.isValid()); @@ -1347,7 +1347,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation() anim3->setEndValue(100); anim3->setDuration(0); - QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(stateChangedSpy.isValid()); group.addAnimation(anim1); @@ -1439,7 +1439,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() // lets make sure the seeking will work again spy.clear(); DummyPropertyAnimation anim(&group); - QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(animStateChangedSpy.isValid()); group.setCurrentTime(300); @@ -1641,7 +1641,7 @@ void tst_QSequentialAnimationGroup::pauseResume() QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group); anim->setDuration(250); anim->setEndValue(250); - QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State))); QVERIFY(spy.isValid()); QCOMPARE(group.duration(), 250); group.start(); diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 9cc3f29e49..a63e140ef8 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1869,7 +1869,7 @@ void tst_QDir::equalityOperator_data() #if defined (Q_OS_WIN) QString pathinroot("c:/windows/.."); #else - QString pathinroot("/sbin/.."); + QString pathinroot("/usr/.."); #endif QTest::newRow("QTBUG-20495-root") << pathinroot << "*.cpp" << int(QDir::Name) << int(QDir::Files) << QDir::rootPath() << "*.cpp" << int(QDir::Name) << int(QDir::Files) diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a302e40574..76fa6022ba 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -120,7 +120,7 @@ void tst_QFileSystemWatcher::basicTest() watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend); QVERIFY(watcher.addPath(testFile.fileName())); - QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(const QString &))); + QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString))); QVERIFY(changedSpy.isValid()); QEventLoop eventLoop; QTimer timer; @@ -253,7 +253,7 @@ void tst_QFileSystemWatcher::watchDirectory() watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend); QVERIFY(watcher.addPath(testDir.absolutePath())); - QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(const QString &))); + QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString))); QVERIFY(changedSpy.isValid()); QEventLoop eventLoop; QTimer timer; @@ -410,8 +410,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() QVERIFY(watcher.addPath(testDir.absolutePath())); QVERIFY(watcher.addPath(testFileName)); - QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(const QString &))); - QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(const QString &))); + QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(QString))); + QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(QString))); QVERIFY(fileChangedSpy.isValid()); QVERIFY(dirChangedSpy.isValid()); QEventLoop eventLoop; diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 9ec5eb489e..22c88ca1fa 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -312,7 +312,7 @@ void tst_QProcess::crashTest() qRegisterMetaType<QProcess::ProcessError>("QProcess::ExitStatus"); QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError))); - QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); @@ -350,7 +350,7 @@ void tst_QProcess::crashTest2() qRegisterMetaType<QProcess::ProcessError>("QProcess::ExitStatus"); QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError))); - QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(spy.isValid()); QVERIFY(spy2.isValid()); @@ -922,8 +922,8 @@ public: SoftExitProcess(int n) : waitedForFinished(false), n(n), killing(false) { - connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(finishedSlot(int, QProcess::ExitStatus))); + connect(this, SIGNAL(finished(int,QProcess::ExitStatus)), + this, SLOT(finishedSlot(int,QProcess::ExitStatus))); switch (n) { case 0: @@ -1488,7 +1488,7 @@ void tst_QProcess::failToStart() QSignalSpy stateSpy(&process, SIGNAL(stateChanged(QProcess::ProcessState))); QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError))); QSignalSpy finishedSpy(&process, SIGNAL(finished(int))); - QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(stateSpy.isValid()); QVERIFY(errorSpy.isValid()); @@ -1554,7 +1554,7 @@ void tst_QProcess::failToStartWithWait() QEventLoop loop; QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError))); QSignalSpy finishedSpy(&process, SIGNAL(finished(int))); - QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1581,7 +1581,7 @@ void tst_QProcess::failToStartWithEventLoop() QEventLoop loop; QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError))); QSignalSpy finishedSpy(&process, SIGNAL(finished(int))); - QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy.isValid()); @@ -1819,7 +1819,7 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QProcess process; QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError))); QSignalSpy finishedSpy1(&process, SIGNAL(finished(int))); - QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(errorSpy.isValid()); QVERIFY(finishedSpy1.isValid()); @@ -2153,7 +2153,7 @@ void tst_QProcess::onlyOneStartedSignal() QProcess process; QSignalSpy spyStarted(&process, SIGNAL(started())); - QSignalSpy spyFinished(&process, SIGNAL(finished(int, QProcess::ExitStatus))); + QSignalSpy spyFinished(&process, SIGNAL(finished(int,QProcess::ExitStatus))); QVERIFY(spyStarted.isValid()); QVERIFY(spyFinished.isValid()); diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 914f88ecda..84fbfb4131 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -106,7 +106,9 @@ private slots: void testThreadSafety(); void testEmptyData(); void testResourceFiles(); +#ifdef Q_OS_MAC void fileName(); +#endif void isWritable_data(); void isWritable(); void registerFormat(); @@ -2576,9 +2578,10 @@ void tst_QSettings::testCaseSensitivity() } } +#ifdef Q_OS_MAC +// Please write a fileName() test for the other platforms void tst_QSettings::fileName() { -#ifdef Q_OS_MAC QSettings s1(QSettings::UserScope, "Apple", "Console"); QSettings s2(QSettings::UserScope, "Apple"); QSettings s3(QSettings::SystemScope, "Apple", "Console"); @@ -2642,10 +2645,8 @@ void tst_QSettings::fileName() QSettings s21(QSettings::SystemScope, QLatin1String(" ") + QChar(0xbd) + QLatin1String("Foo//:/Bar,,, Baz!()#"), "Console"); QCOMPARE(s21.fileName(), QString("/Library/Preferences/com.foo-bar-baz.Console.plist")); -#else - QSKIP("Please write a fileName() test for the other platforms"); -#endif } +#endif void tst_QSettings::isWritable_data() { diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index e0c024e39f..b987fb6835 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -810,8 +810,8 @@ void tst_QAbstractItemModel::removeRows() { QtTestModel model(10, 10); - QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int ))); - QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved( const QModelIndex &, int, int ))); + QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); QVERIFY(rowsAboutToBeRemovedSpy.isValid()); QVERIFY(rowsRemovedSpy.isValid()); @@ -825,8 +825,8 @@ void tst_QAbstractItemModel::removeColumns() { QtTestModel model(10, 10); - QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int ))); - QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved( const QModelIndex &, int, int ))); + QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved(QModelIndex,int,int))); QVERIFY(columnsAboutToBeRemovedSpy.isValid()); QVERIFY(columnsRemovedSpy.isValid()); @@ -840,8 +840,8 @@ void tst_QAbstractItemModel::insertRows() { QtTestModel model(10, 10); - QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int ))); - QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted( const QModelIndex &, int, int ))); + QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(rowsAboutToBeInsertedSpy.isValid()); QVERIFY(rowsInsertedSpy.isValid()); @@ -855,8 +855,8 @@ void tst_QAbstractItemModel::insertColumns() { QtTestModel model(10, 10); - QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int ))); - QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted( const QModelIndex &, int, int ))); + QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted(QModelIndex,int,int))); QVERIFY(columnsAboutToBeInsertedSpy.isValid()); QVERIFY(columnsInsertedSpy.isValid()); @@ -870,8 +870,8 @@ void tst_QAbstractItemModel::moveRows() { QtTestModel model(10, 10); - QSignalSpy rowsAboutToBeMovedSpy(&model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int , int, const QModelIndex &, int))); - QSignalSpy rowsMovedSpy(&model, SIGNAL(rowsMoved(const QModelIndex &, int , int, const QModelIndex &, int))); + QSignalSpy rowsAboutToBeMovedSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy rowsMovedSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(rowsAboutToBeMovedSpy.isValid()); QVERIFY(rowsMovedSpy.isValid()); @@ -885,8 +885,8 @@ void tst_QAbstractItemModel::moveColumns() { QtTestModel model(10, 10); - QSignalSpy columnsAboutToBeMovedSpy(&model, SIGNAL(columnsAboutToBeMoved(const QModelIndex &, int , int, const QModelIndex &, int))); - QSignalSpy columnsMovedSpy(&model, SIGNAL(columnsMoved(const QModelIndex &, int , int, const QModelIndex &, int))); + QSignalSpy columnsAboutToBeMovedSpy(&model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy columnsMovedSpy(&model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(columnsAboutToBeMovedSpy.isValid()); QVERIFY(columnsMovedSpy.isValid()); @@ -1022,8 +1022,8 @@ void tst_QAbstractItemModel::testMoveSameParentDown() } } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1137,8 +1137,8 @@ void tst_QAbstractItemModel::testMoveSameParentUp() } } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1286,8 +1286,8 @@ void tst_QAbstractItemModel::testMoveToGrandParent() } } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1426,8 +1426,8 @@ void tst_QAbstractItemModel::testMoveToSibling() persistentList << QPersistentModelIndex(idx); } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1576,8 +1576,8 @@ void tst_QAbstractItemModel::testMoveToUncle() persistentList << QPersistentModelIndex(idx); } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1683,8 +1683,8 @@ void tst_QAbstractItemModel::testMoveToDescendants() persistentList << QPersistentModelIndex(idx); } - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); @@ -1747,8 +1747,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange() QFETCH(int, endRow); QFETCH(int, destRow); - QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); - QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); + QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int))); QVERIFY(beforeSpy.isValid()); QVERIFY(afterSpy.isValid()); diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp index 4bec2f5c0c..72a5c4a57b 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp @@ -597,7 +597,7 @@ void tst_QItemModel::setData() QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); QVERIFY(currentModel); - QSignalSpy spy(currentModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); + QSignalSpy spy(currentModel, SIGNAL(dataChanged(QModelIndex,QModelIndex))); QVERIFY(spy.isValid()); QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false); QCOMPARE(spy.count(), 0); @@ -659,7 +659,7 @@ void tst_QItemModel::setHeaderData() QVERIFY(index.isValid()); qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); - QSignalSpy spy(currentModel, SIGNAL(headerDataChanged( Qt::Orientation, int , int ))); + QSignalSpy spy(currentModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(spy.isValid()); QString text = "Index private pointers should always be the same"; @@ -838,10 +838,10 @@ void tst_QItemModel::remove() // When a row or column is removed there should be two signals. // Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot - QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int ))); - QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int ))); - QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved( const QModelIndex &, int, int ))); - QSignalSpy rowsRemovedSpy(currentModel, SIGNAL(rowsRemoved( const QModelIndex &, int, int ))); + QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int))); + QSignalSpy rowsRemovedSpy(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int))); QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset())); QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged())); @@ -860,10 +860,10 @@ void tst_QItemModel::remove() // // test removeRow() // - connect(currentModel, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_rowsAboutToRemove(const QModelIndex &))); - connect(currentModel, SIGNAL(rowsRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_rowsRemoved(const QModelIndex &))); + connect(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slot_rowsAboutToRemove(QModelIndex))); + connect(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(slot_rowsRemoved(QModelIndex))); int beforeRemoveRowCount = currentModel->rowCount(parentOfRemoved); QPersistentModelIndex dyingIndex = currentModel->index(start + count + 1, 0, parentOfRemoved); QCOMPARE(currentModel->removeRows(start, count, parentOfRemoved), shouldSucceed); @@ -921,20 +921,20 @@ void tst_QItemModel::remove() QCOMPARE(currentModel->rowCount(parentOfRemoved), beforeRemoveRowCount); } - disconnect(currentModel, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_rowsAboutToRemove(const QModelIndex &))); - disconnect(currentModel, SIGNAL(rowsRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_rowsRemoved(const QModelIndex &))); + disconnect(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slot_rowsAboutToRemove(QModelIndex))); + disconnect(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(slot_rowsRemoved(QModelIndex))); modelResetSpy.clear(); QCOMPARE(modelResetSpy.count(), 0); // // Test remove column // - connect(currentModel, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_columnsAboutToRemove(const QModelIndex &))); - connect(currentModel, SIGNAL(columnsRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_columnsRemoved(const QModelIndex &))); + connect(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slot_columnsAboutToRemove(QModelIndex))); + connect(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(slot_columnsRemoved(QModelIndex))); int beforeRemoveColumnCount = currentModel->columnCount(parentOfRemoved); // Some models don't let you remove the column, only row @@ -966,10 +966,10 @@ void tst_QItemModel::remove() else QCOMPARE(currentModel->rowCount(parentOfRemoved), beforeRemoveRowCount); } - disconnect(currentModel, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_columnsAboutToRemove(const QModelIndex &))); - disconnect(currentModel, SIGNAL(columnsRemoved( const QModelIndex &, int , int )), - this, SLOT(slot_columnsRemoved(const QModelIndex &))); + disconnect(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(slot_columnsAboutToRemove(QModelIndex))); + disconnect(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(slot_columnsRemoved(QModelIndex))); if (columnsAboutToBeRemovedSpy.count() > 0){ QList<QVariant> arguments = columnsAboutToBeRemovedSpy.at(0); @@ -1180,10 +1180,10 @@ void tst_QItemModel::insert() // When a row or column is inserted there should be two signals. // Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot - QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int ))); - QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int ))); - QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted( const QModelIndex &, int, int ))); - QSignalSpy rowsInsertedSpy(currentModel, SIGNAL(rowsInserted( const QModelIndex &, int, int ))); + QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int))); + QSignalSpy rowsInsertedSpy(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int))); QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset())); QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged())); @@ -1202,10 +1202,10 @@ void tst_QItemModel::insert() // // test insertRow() // - connect(currentModel, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int )), - this, SLOT(slot_rowsAboutToInserted(const QModelIndex &))); - connect(currentModel, SIGNAL(rowsInserted( const QModelIndex &, int , int )), - this, SLOT(slot_rowsInserted(const QModelIndex &))); + connect(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slot_rowsAboutToInserted(QModelIndex))); + connect(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(slot_rowsInserted(QModelIndex))); int beforeInsertRowCount = currentModel->rowCount(parentOfInserted); QCOMPARE(currentModel->insertRows(start, count, parentOfInserted), shouldSucceed); currentModel->submit(); @@ -1259,19 +1259,19 @@ void tst_QItemModel::insert() QCOMPARE(currentModel->rowCount(parentOfInserted), beforeInsertRowCount); } - disconnect(currentModel, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int )), - this, SLOT(slot_rowsAboutToInserted(const QModelIndex &))); - disconnect(currentModel, SIGNAL(rowsInserted( const QModelIndex &, int , int )), - this, SLOT(slot_rowsInserted(const QModelIndex &))); + disconnect(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slot_rowsAboutToInserted(QModelIndex))); + disconnect(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(slot_rowsInserted(QModelIndex))); modelResetSpy.clear(); // // Test insertColumn() // - connect(currentModel, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int )), - this, SLOT(slot_columnsAboutToInserted(const QModelIndex &))); - connect(currentModel, SIGNAL(columnsInserted( const QModelIndex &, int , int )), - this, SLOT(slot_columnsInserted(const QModelIndex &))); + connect(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slot_columnsAboutToInserted(QModelIndex))); + connect(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(slot_columnsInserted(QModelIndex))); int beforeInsertColumnCount = currentModel->columnCount(parentOfInserted); // Some models don't let you insert the column, only row @@ -1303,10 +1303,10 @@ void tst_QItemModel::insert() else QCOMPARE(currentModel->rowCount(parentOfInserted), beforeInsertRowCount); } - disconnect(currentModel, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int )), - this, SLOT(slot_columnsAboutToInserted(const QModelIndex &))); - disconnect(currentModel, SIGNAL(columnsInserted( const QModelIndex &, int , int )), - this, SLOT(slot_columnsInserted(const QModelIndex &))); + disconnect(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(slot_columnsAboutToInserted(QModelIndex))); + disconnect(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(slot_columnsInserted(QModelIndex))); if (columnsAboutToBeInsertedSpy.count() > 0){ QList<QVariant> arguments = columnsAboutToBeInsertedSpy.at(0); diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 43d2ba496e..a58a0ad945 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -2231,7 +2231,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal() QItemSelectionModel selectionModel(&model); selectionModel.select(sel, QItemSelectionModel::SelectCurrent); - QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(const QItemSelection& , const QItemSelection&))); + QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection))); QVERIFY(deselectSpy.isValid()); model.removeRows(0, 1, root); QVERIFY(deselectSpy.count() == 1); @@ -2383,7 +2383,7 @@ public: RemovalObserver(QItemSelectionModel *selectionModel) : m_itemSelectionModel(selectionModel) { - connect(m_itemSelectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(selectionChanged(QItemSelection, QItemSelection))); + connect(m_itemSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(selectionChanged(QItemSelection,QItemSelection))); } public slots: @@ -2414,7 +2414,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange() RemovalObserver ro(&selModel); - QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection))); + QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection))); QVERIFY(spy.isValid()); bool ok = model.removeRows(4, 2); diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index baedcf71b4..e3dc0d3e14 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -1473,7 +1473,7 @@ void tst_QSortFilterProxyModel::filterCurrent() view.show(); view.setModel(&proxy); - QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex))); + QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex))); QVERIFY(spy.isValid()); view.setCurrentIndex(proxy.index(0, 0)); @@ -1594,10 +1594,10 @@ void tst_QSortFilterProxyModel::removeSourceRows() proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder)); (void)proxy.rowCount(QModelIndex()); // force mapping - QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int))); - QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int))); - QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int))); - QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int))); + QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); + QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int))); + QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); QVERIFY(removeSpy.isValid()); QVERIFY(insertSpy.isValid()); @@ -1775,8 +1775,8 @@ void tst_QSortFilterProxyModel::changeFilter() proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder)); (void)proxy.rowCount(QModelIndex()); // force mapping - QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int))); - QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int))); + QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(initialRemoveSpy.isValid()); QVERIFY(initialInsertSpy.isValid()); @@ -1799,8 +1799,8 @@ void tst_QSortFilterProxyModel::changeFilter() QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i)); } - QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int))); - QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int))); + QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(finalRemoveSpy.isValid()); QVERIFY(finalInsertSpy.isValid()); @@ -1950,8 +1950,8 @@ void tst_QSortFilterProxyModel::changeSourceData() proxy.setFilterRegExp(filter); - QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int))); - QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int))); + QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(removeSpy.isValid()); QVERIFY(insertSpy.isValid()); @@ -2049,7 +2049,7 @@ void tst_QSortFilterProxyModel::selectionFilteredOut() view.show(); view.setModel(&proxy); - QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex))); + QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex))); QVERIFY(spy.isValid()); view.setCurrentIndex(proxy.index(0, 0)); @@ -2164,8 +2164,8 @@ void tst_QSortFilterProxyModel::insertIntoChildrenlessItem() QSortFilterProxyModel proxy; proxy.setSourceModel(&model); - QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(const QModelIndex&, int, int))); - QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int))); + QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(QModelIndex,int,int))); + QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(colsInsertedSpy.isValid()); QVERIFY(rowsInsertedSpy.isValid()); @@ -2244,7 +2244,7 @@ void tst_QSortFilterProxyModel::insertRowIntoFilteredParent() EvenOddFilterModel proxy; proxy.setSourceModel(&model); - QSignalSpy spy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int))); + QSignalSpy spy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(spy.isValid()); QStandardItem *itemA = new QStandardItem(); @@ -2273,8 +2273,8 @@ void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild() QStandardItem *itemC = new QStandardItem("C"); itemA->appendRow(itemC); // filtered - QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); - QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int))); + QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int))); + QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int))); QVERIFY(removedSpy.isValid()); QVERIFY(insertedSpy.isValid()); diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index a99941aa7f..0e0e869f69 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -144,11 +144,11 @@ void tst_QStringListModel::rowsAboutToBeRemoved_rowsRemoved() QStringListModel *model = new QStringListModel(input); QModelListener *pListener = new QModelListener(&aboutto, &res, model); - pListener->connect(model, SIGNAL( rowsAboutToBeRemoved(const QModelIndex & , int , int )), - pListener, SLOT( rowsAboutToBeRemovedOrInserted(const QModelIndex & , int , int )) ); + pListener->connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + pListener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int)) ); - pListener->connect(model, SIGNAL( rowsRemoved(const QModelIndex & , int , int )), - pListener, SLOT( rowsRemovedOrInserted(const QModelIndex & , int , int )) ); + pListener->connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + pListener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int)) ); model->removeRows(row,count); // At this point, control goes to our connected slots inn this order: @@ -208,11 +208,11 @@ void tst_QStringListModel::rowsAboutToBeInserted_rowsInserted() QStringListModel *model = new QStringListModel(input); QModelListener *pListener = new QModelListener(&aboutto, &res, model); - connect(model, SIGNAL( rowsAboutToBeInserted(const QModelIndex & , int , int )), - pListener, SLOT( rowsAboutToBeRemovedOrInserted(const QModelIndex & , int , int )) ); + connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + pListener, SLOT(rowsAboutToBeRemovedOrInserted(QModelIndex,int,int)) ); - connect(model, SIGNAL( rowsInserted(const QModelIndex & , int , int )), - pListener, SLOT( rowsRemovedOrInserted(const QModelIndex & , int , int )) ); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + pListener, SLOT(rowsRemovedOrInserted(QModelIndex,int,int)) ); model->insertRows(row,count); // At this point, control goes to our connected slots inn this order: diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 3cb4989d4b..82656d6309 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -48,11 +48,11 @@ #define INVALID_UNICODE "\357\277\277" // "\uffff" #define UNICODE_DJE "\320\202" // Character from the Serbian Cyrillic alphabet -class TestQtJson: public QObject +class tst_QtJson: public QObject { Q_OBJECT public: - TestQtJson(QObject *parent = 0); + tst_QtJson(QObject *parent = 0); private Q_SLOTS: void initTestCase(); @@ -132,30 +132,30 @@ private: QString testDataDir; }; -TestQtJson::TestQtJson(QObject *parent) : QObject(parent) +tst_QtJson::tst_QtJson(QObject *parent) : QObject(parent) { } -void TestQtJson::initTestCase() +void tst_QtJson::initTestCase() { testDataDir = QFileInfo(QFINDTESTDATA("test.json")).absolutePath(); if (testDataDir.isEmpty()) testDataDir = QCoreApplication::applicationDirPath(); } -void TestQtJson::cleanupTestCase() +void tst_QtJson::cleanupTestCase() { } -void TestQtJson::init() +void tst_QtJson::init() { } -void TestQtJson::cleanup() +void tst_QtJson::cleanup() { } -void TestQtJson::testValueSimple() +void tst_QtJson::testValueSimple() { QJsonObject object; object.insert("number", 999.); @@ -206,7 +206,7 @@ void TestQtJson::testValueSimple() QCOMPARE(value.toArray(), QJsonArray()); } -void TestQtJson::testNumbers() +void tst_QtJson::testNumbers() { { int numbers[] = { @@ -274,7 +274,7 @@ void TestQtJson::testNumbers() } -void TestQtJson::testObjectSimple() +void tst_QtJson::testObjectSimple() { QJsonObject object; object.insert("number", 999.); @@ -311,7 +311,7 @@ void TestQtJson::testObjectSimple() QVERIFY2(object.value("string").toString() != before, "value should have been updated"); } -void TestQtJson::testObjectSmallKeys() +void tst_QtJson::testObjectSmallKeys() { QJsonObject data1; data1.insert(QStringLiteral("1"), 123); @@ -327,7 +327,7 @@ void TestQtJson::testObjectSmallKeys() QCOMPARE(data1.value(QStringLiteral("123")).toDouble(), (double)323); } -void TestQtJson::testArraySimple() +void tst_QtJson::testArraySimple() { QJsonArray array; array.append(999.); @@ -380,7 +380,7 @@ void TestQtJson::testArraySimple() QCOMPARE(array.at(1), QJsonValue(QLatin1String("test"))); } -void TestQtJson::testValueObject() +void tst_QtJson::testValueObject() { QJsonObject object; object.insert("number", 999.); @@ -398,7 +398,7 @@ void TestQtJson::testValueObject() QVERIFY2(value.toObject() != object, "object should have detached"); } -void TestQtJson::testValueArray() +void tst_QtJson::testValueArray() { QJsonArray array; array.append(999.); @@ -416,7 +416,7 @@ void TestQtJson::testValueArray() QVERIFY2(value.toArray() != array, "array should have detached"); } -void TestQtJson::testObjectNested() +void tst_QtJson::testObjectNested() { QJsonObject inner, outer; inner.insert("number", 999.); @@ -453,7 +453,7 @@ void TestQtJson::testObjectNested() true); } -void TestQtJson::testArrayNested() +void tst_QtJson::testArrayNested() { QJsonArray inner, outer; inner.append(999.); @@ -487,7 +487,7 @@ void TestQtJson::testArrayNested() QCOMPARE(outer.last().toArray().last().toArray().at(0).toString(), QString("nested")); } -void TestQtJson::testArrayNestedEmpty() +void tst_QtJson::testArrayNestedEmpty() { QJsonObject object; QJsonArray inner; @@ -504,7 +504,7 @@ void TestQtJson::testArrayNestedEmpty() QCOMPARE(object.value("inner").toArray().size(), 0); } -void TestQtJson::testObjectNestedEmpty() +void tst_QtJson::testObjectNestedEmpty() { QJsonObject object; QJsonObject inner; @@ -529,7 +529,7 @@ void TestQtJson::testObjectNestedEmpty() QCOMPARE(reconstituted.value("inner2").type(), QJsonValue::Object); } -void TestQtJson::testValueRef() +void tst_QtJson::testValueRef() { QJsonArray array; array.append(1.); @@ -560,7 +560,7 @@ void TestQtJson::testValueRef() QCOMPARE(object.value(QLatin1String("key")), QJsonValue(42)); } -void TestQtJson::testObjectIteration() +void tst_QtJson::testObjectIteration() { QJsonObject object; for (int i = 0; i < 10; ++i) @@ -630,7 +630,7 @@ void TestQtJson::testObjectIteration() QVERIFY(it == object.end()); } -void TestQtJson::testArrayIteration() +void tst_QtJson::testArrayIteration() { QJsonArray array; for (int i = 0; i < 10; ++i) @@ -691,7 +691,7 @@ void TestQtJson::testArrayIteration() QVERIFY(it == array.end()); } -void TestQtJson::testObjectFind() +void tst_QtJson::testObjectFind() { QJsonObject object; for (int i = 0; i < 10; ++i) @@ -712,7 +712,7 @@ void TestQtJson::testObjectFind() QVERIFY(it == object.end()); } -void TestQtJson::testDocument() +void tst_QtJson::testDocument() { QJsonDocument doc; QCOMPARE(doc.isEmpty(), true); @@ -786,7 +786,7 @@ void TestQtJson::testDocument() QCOMPARE(doc5.array().at(0), QJsonValue(23)); } -void TestQtJson::nullValues() +void tst_QtJson::nullValues() { QJsonArray array; array.append(QJsonValue()); @@ -801,7 +801,7 @@ void TestQtJson::nullValues() QCOMPARE(object.value("key"), QJsonValue()); } -void TestQtJson::nullArrays() +void tst_QtJson::nullArrays() { QJsonArray nullArray; QJsonArray nonNull; @@ -829,7 +829,7 @@ void TestQtJson::nullArrays() nullArray.removeAt(-1); } -void TestQtJson::nullObject() +void tst_QtJson::nullObject() { QJsonObject nullObject; QJsonObject nonNull; @@ -857,7 +857,7 @@ void TestQtJson::nullObject() QCOMPARE(nullObject.contains("foo"), false); } -void TestQtJson::keySorting() +void tst_QtJson::keySorting() { const char *json = "{ \"B\": true, \"A\": false }"; QJsonDocument doc = QJsonDocument::fromJson(json); @@ -872,7 +872,7 @@ void TestQtJson::keySorting() QCOMPARE(it.key(), QLatin1String("B")); } -void TestQtJson::undefinedValues() +void tst_QtJson::undefinedValues() { QJsonObject object; object.insert("Key", QJsonValue(QJsonValue::Undefined)); @@ -896,7 +896,7 @@ void TestQtJson::undefinedValues() } -void TestQtJson::fromVariantMap() +void tst_QtJson::fromVariantMap() { QVariantMap map; map.insert(QLatin1String("key1"), QLatin1String("value1")); @@ -928,7 +928,7 @@ void TestQtJson::fromVariantMap() QCOMPARE(array.at(3).toString(), QLatin1String("foo")); } -void TestQtJson::toVariantMap() +void tst_QtJson::toVariantMap() { QJsonObject object; QVariantMap map = object.toVariantMap(); @@ -957,7 +957,7 @@ void TestQtJson::toVariantMap() QCOMPARE(list.at(3), QVariant()); } -void TestQtJson::toVariantList() +void tst_QtJson::toVariantList() { QJsonArray array; QVariantList list = array.toVariantList(); @@ -986,7 +986,7 @@ void TestQtJson::toVariantList() QCOMPARE(vlist.at(3), QVariant()); } -void TestQtJson::toJson() +void tst_QtJson::toJson() { QJsonObject object; object.insert("\\Key\n", QString("Value")); @@ -1033,7 +1033,7 @@ void TestQtJson::toJson() QCOMPARE(json, expected); } -void TestQtJson::fromJson() +void tst_QtJson::fromJson() { { QByteArray json = "[\n true\n]\n"; @@ -1122,7 +1122,7 @@ void TestQtJson::fromJson() } } -void TestQtJson::fromJsonErrors() +void tst_QtJson::fromJsonErrors() { { QJsonParseError error; @@ -1286,7 +1286,7 @@ void TestQtJson::fromJsonErrors() } } -void TestQtJson::fromBinary() +void tst_QtJson::fromBinary() { QFile file(testDataDir + "/test.json"); file.open(QFile::ReadOnly); @@ -1307,14 +1307,14 @@ void TestQtJson::fromBinary() QVERIFY(doc == bdoc); } -void TestQtJson::toAndFromBinary_data() +void tst_QtJson::toAndFromBinary_data() { QTest::addColumn<QString>("filename"); QTest::newRow("test.json") << (testDataDir + "/test.json"); QTest::newRow("test2.json") << (testDataDir + "/test2.json"); } -void TestQtJson::toAndFromBinary() +void tst_QtJson::toAndFromBinary() { QFETCH(QString, filename); QFile file(filename); @@ -1328,7 +1328,7 @@ void TestQtJson::toAndFromBinary() QVERIFY(doc == outdoc); } -void TestQtJson::parseNumbers() +void tst_QtJson::parseNumbers() { { // test number parsing @@ -1406,7 +1406,7 @@ void TestQtJson::parseNumbers() } } -void TestQtJson::parseStrings() +void tst_QtJson::parseStrings() { const char *strings [] = { @@ -1471,7 +1471,7 @@ void TestQtJson::parseStrings() } -void TestQtJson::parseDuplicateKeys() +void tst_QtJson::parseDuplicateKeys() { const char *json = "{ \"B\": true, \"A\": null, \"B\": false }"; @@ -1488,7 +1488,7 @@ void TestQtJson::parseDuplicateKeys() QCOMPARE(it.value(), QJsonValue(false)); } -void TestQtJson::testParser() +void tst_QtJson::testParser() { QFile file(testDataDir + "/test.json"); file.open(QFile::ReadOnly); @@ -1498,7 +1498,7 @@ void TestQtJson::testParser() QVERIFY(!doc.isEmpty()); } -void TestQtJson::compactArray() +void tst_QtJson::compactArray() { QJsonArray array; array.append(QLatin1String("First Entry")); @@ -1535,7 +1535,7 @@ void TestQtJson::compactArray() } -void TestQtJson::compactObject() +void tst_QtJson::compactObject() { QJsonObject object; object.insert(QLatin1String("Key1"), QLatin1String("First Entry")); @@ -1572,7 +1572,7 @@ void TestQtJson::compactObject() } -void TestQtJson::validation() +void tst_QtJson::validation() { // this basically tests that we don't crash on corrupt data QFile file(testDataDir + "/test.json"); @@ -1623,7 +1623,7 @@ void TestQtJson::validation() } } -void TestQtJson::assignToDocument() +void tst_QtJson::assignToDocument() { { const char *json = "{ \"inner\": { \"key\": true } }"; @@ -1652,7 +1652,7 @@ void TestQtJson::assignToDocument() } -void TestQtJson::testDuplicateKeys() +void tst_QtJson::testDuplicateKeys() { QJsonObject obj; obj.insert(QLatin1String("foo"), QLatin1String("bar")); @@ -1661,7 +1661,7 @@ void TestQtJson::testDuplicateKeys() QCOMPARE(obj.value(QLatin1String("foo")).toString(), QLatin1String("zap")); } -void TestQtJson::testCompaction() +void tst_QtJson::testCompaction() { // modify object enough times to trigger compactionCounter // and make sure the data is still valid @@ -1681,7 +1681,7 @@ void TestQtJson::testCompaction() QVERIFY(doc.object() == obj); } -void TestQtJson::testDebugStream() +void tst_QtJson::testDebugStream() { { // QJsonObject @@ -1768,7 +1768,7 @@ void TestQtJson::testDebugStream() } } -void TestQtJson::testCompactionError() +void tst_QtJson::testCompactionError() { QJsonObject schemaObject; schemaObject.insert("_Type", QLatin1String("_SchemaType")); @@ -1796,7 +1796,7 @@ void TestQtJson::testCompactionError() } } -void TestQtJson::parseUnicodeEscapes() +void tst_QtJson::parseUnicodeEscapes() { const QByteArray json = "[ \"A\\u00e4\\u00C4\" ]"; @@ -1810,7 +1810,7 @@ void TestQtJson::parseUnicodeEscapes() QCOMPARE(array.first().toString(), result); } -void TestQtJson::assignObjects() +void tst_QtJson::assignObjects() { const char *json = "[ { \"Key\": 1 }, { \"Key\": 2 } ]"; @@ -1825,7 +1825,7 @@ void TestQtJson::assignObjects() QCOMPARE(object.value("Key").toDouble(), 2.); } -void TestQtJson::assignArrays() +void tst_QtJson::assignArrays() { const char *json = "[ [ 1 ], [ 2 ] ]"; @@ -1840,7 +1840,7 @@ void TestQtJson::assignArrays() QCOMPARE(inner.at(0).toDouble(), 2.); } -void TestQtJson::testTrailingComma() +void tst_QtJson::testTrailingComma() { const char *jsons[] = { "{ \"Key\": 1, }", "[ { \"Key\": 1 }, ]" }; @@ -1851,7 +1851,7 @@ void TestQtJson::testTrailingComma() } } -void TestQtJson::testDetachBug() +void tst_QtJson::testDetachBug() { QJsonObject dynamic; QJsonObject embedded; @@ -1875,7 +1875,7 @@ void TestQtJson::testDetachBug() QCOMPARE(local.keys().size(), 1); } -void TestQtJson::valueEquals() +void tst_QtJson::valueEquals() { QVERIFY(QJsonValue() == QJsonValue()); QVERIFY(QJsonValue() != QJsonValue(QJsonValue::Undefined)); @@ -1921,7 +1921,7 @@ void TestQtJson::valueEquals() QVERIFY(QJsonValue(QJsonObject()) != QJsonValue(QJsonArray())); } -void TestQtJson::bom() +void tst_QtJson::bom() { QFile file(testDataDir + "/bom.json"); file.open(QFile::ReadOnly); @@ -1935,7 +1935,7 @@ void TestQtJson::bom() QVERIFY(error.error == QJsonParseError::NoError); } -void TestQtJson::nesting() +void tst_QtJson::nesting() { // check that we abort parsing too deeply nested json documents. // this is to make sure we don't crash because the parser exhausts the @@ -1994,5 +1994,5 @@ void TestQtJson::nesting() } -QTEST_MAIN(TestQtJson) +QTEST_MAIN(tst_QtJson) #include "tst_qtjson.moc" diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index 1ef2cf8e3f..526a5039b0 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -714,9 +714,8 @@ void tst_QMetaMethod::comparisonOperators() void tst_QMetaMethod::fromSignal() { #define FROMSIGNAL_HELPER(ObjectType, Name, Arguments) { \ - void (ObjectType::*signal)Arguments = &ObjectType::Name; \ const QMetaObject *signalMeta = &ObjectType::staticMetaObject; \ - QCOMPARE(QMetaMethod::fromSignal(signal), \ + QCOMPARE(QMetaMethod::fromSignal(&ObjectType::Name), \ signalMeta->method(signalMeta->indexOfSignal(QMetaObject::normalizedSignature(#Name #Arguments)))); \ } diff --git a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp index 86c810fe15..964f5cd26b 100644 --- a/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp +++ b/tests/auto/corelib/kernel/qobject/signalbug/signalbug.cpp @@ -99,9 +99,9 @@ void Disconnector::received () if (::Step == 5) { - disconnect (s, SIGNAL (fired ()), s->d, SLOT (received ())); + disconnect (s, SIGNAL(fired()), s->d, SLOT(received())); - connect (&RandomSender, SIGNAL (fired ()), s->d, SLOT (received ())); + connect (&RandomSender, SIGNAL(fired()), s->d, SLOT(received())); } TRACE (stepCopy, "ends Disconnector::received()"); @@ -113,9 +113,9 @@ Sender::Sender (Receiver *r, Disconnector *d) { this->r = r; this->d = d; if (r) - connect (this, SIGNAL (fired ()), r, SLOT (received ())); + connect (this, SIGNAL(fired()), r, SLOT(received())); if (d) - connect (this, SIGNAL (fired ()), d, SLOT (received ())); + connect (this, SIGNAL(fired()), d, SLOT(received())); }; void Sender::fire () diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 4ae28d1210..0cabc46390 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -257,11 +257,11 @@ void tst_QObject::disconnect() ReceiverObject *r1 = new ReceiverObject; ReceiverObject *r2 = new ReceiverObject; - connect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); + connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); - connect( s, SIGNAL( signal2() ), r1, SLOT( slot2() ) ); - connect( s, SIGNAL( signal3() ), r1, SLOT( slot3() ) ); - connect( s, SIGNAL( signal4() ), r1, SLOT( slot4() ) ); + connect( s, SIGNAL(signal2()), r1, SLOT(slot2()) ); + connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) ); + connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) ); s->emitSignal1(); s->emitSignal2(); @@ -275,7 +275,7 @@ void tst_QObject::disconnect() r1->reset(); // usual disconnect with all parameters given - bool ret = QObject::disconnect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); + bool ret = QObject::disconnect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); s->emitSignal1(); @@ -283,7 +283,7 @@ void tst_QObject::disconnect() r1->reset(); QVERIFY(ret); - ret = QObject::disconnect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); + ret = QObject::disconnect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); QVERIFY(!ret); // disconnect all signals from s from all slots from r1 @@ -298,13 +298,13 @@ void tst_QObject::disconnect() QVERIFY(!r1->called(4)); r1->reset(); - connect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); - connect( s, SIGNAL( signal1() ), r1, SLOT( slot2() ) ); - connect( s, SIGNAL( signal1() ), r1, SLOT( slot3() ) ); - connect( s, SIGNAL( signal2() ), r1, SLOT( slot4() ) ); + connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); + connect( s, SIGNAL(signal1()), r1, SLOT(slot2()) ); + connect( s, SIGNAL(signal1()), r1, SLOT(slot3()) ); + connect( s, SIGNAL(signal2()), r1, SLOT(slot4()) ); // disconnect s's signal1() from all slots of r1 - QObject::disconnect( s, SIGNAL( signal1() ), r1, 0 ); + QObject::disconnect( s, SIGNAL(signal1()), r1, 0 ); s->emitSignal1(); s->emitSignal2(); @@ -317,15 +317,15 @@ void tst_QObject::disconnect() // make sure all is disconnected again QObject::disconnect( s, 0, r1, 0 ); - connect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) ); - connect( s, SIGNAL( signal1() ), r2, SLOT( slot1() ) ); - connect( s, SIGNAL( signal2() ), r1, SLOT( slot2() ) ); - connect( s, SIGNAL( signal2() ), r2, SLOT( slot2() ) ); - connect( s, SIGNAL( signal3() ), r1, SLOT( slot3() ) ); - connect( s, SIGNAL( signal3() ), r2, SLOT( slot3() ) ); + connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) ); + connect( s, SIGNAL(signal1()), r2, SLOT(slot1()) ); + connect( s, SIGNAL(signal2()), r1, SLOT(slot2()) ); + connect( s, SIGNAL(signal2()), r2, SLOT(slot2()) ); + connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) ); + connect( s, SIGNAL(signal3()), r2, SLOT(slot3()) ); // disconnect signal1() from all receivers - QObject::disconnect( s, SIGNAL( signal1() ), 0, 0 ); + QObject::disconnect( s, SIGNAL(signal1()), 0, 0 ); s->emitSignal1(); s->emitSignal2(); s->emitSignal3(); @@ -3378,7 +3378,7 @@ void tst_QObject::disconnectSelfInSlotAndDeleteAfterEmit() void tst_QObject::dumpObjectInfo() { QObject a, b; - QObject::connect(&a, SIGNAL(destroyed(QObject *)), &b, SLOT(deleteLater())); + QObject::connect(&a, SIGNAL(destroyed(QObject*)), &b, SLOT(deleteLater())); a.disconnect(&b); #ifdef QT_DEBUG QTest::ignoreMessage(QtDebugMsg, "OBJECT QObject::unnamed"); @@ -3442,10 +3442,10 @@ void tst_QObject::uniqConnection() r2->reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, SIGNAL( signal1() ), r1, SLOT( slot1() ) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL( signal1() ), r2, SLOT( slot1() ) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL( signal1() ), r1, SLOT( slot3() ) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL( signal3() ), r1, SLOT( slot3() ) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal1()), r1, SLOT(slot1()) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal1()), r2, SLOT(slot1()) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal1()), r1, SLOT(slot3()) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal3()), r1, SLOT(slot3()) , Qt::UniqueConnection) ); s->emitSignal1(); s->emitSignal2(); @@ -3468,11 +3468,11 @@ void tst_QObject::uniqConnection() r2->reset(); ReceiverObject::sequence = 0; - QVERIFY( connect( s, SIGNAL( signal4() ), r1, SLOT( slot4() ) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL( signal4() ), r2, SLOT( slot4() ) , Qt::UniqueConnection) ); - QVERIFY(!connect( s, SIGNAL( signal4() ), r2, SLOT( slot4() ) , Qt::UniqueConnection) ); - QVERIFY( connect( s, SIGNAL( signal1() ), r2, SLOT( slot4() ) , Qt::UniqueConnection) ); - QVERIFY(!connect( s, SIGNAL( signal4() ), r1, SLOT( slot4() ) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal4()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); + QVERIFY(!connect( s, SIGNAL(signal4()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); + QVERIFY( connect( s, SIGNAL(signal1()), r2, SLOT(slot4()) , Qt::UniqueConnection) ); + QVERIFY(!connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) , Qt::UniqueConnection) ); s->emitSignal4(); QCOMPARE( r1->count_slot4, 1 ); @@ -3484,7 +3484,7 @@ void tst_QObject::uniqConnection() r2->reset(); ReceiverObject::sequence = 0; - connect( s, SIGNAL( signal4() ), r1, SLOT( slot4() ) ); + connect( s, SIGNAL(signal4()), r1, SLOT(slot4()) ); s->emitSignal4(); QCOMPARE( r1->count_slot4, 2 ); @@ -3637,11 +3637,11 @@ void tst_QObject::overloads() obj2.s_num = 0; connect (&obj1, SIGNAL(sig(int)) , &obj1, SLOT(slo(int))); - connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *)) , &obj1, SLOT(slo(QObject * , QObject *, QObject *))); + connect (&obj1, SIGNAL(sig(QObject*,QObject*,QObject*)) , &obj1, SLOT(slo(QObject*,QObject*,QObject*))); - connect (&obj1, SIGNAL(sig(QObject *, QObject *, QObject *, QObject *)) , &obj2, SLOT(slo(QObject * , QObject *, QObject *))); - connect (&obj1, SIGNAL(sig(QObject *)) , &obj2, SLOT(slo())); - connect (&obj1, SIGNAL(sig(int, int)) , &obj2, SLOT(slo(int, int))); + connect (&obj1, SIGNAL(sig(QObject*,QObject*,QObject*,QObject*)) , &obj2, SLOT(slo(QObject*,QObject*,QObject*))); + connect (&obj1, SIGNAL(sig(QObject*)) , &obj2, SLOT(slo())); + connect (&obj1, SIGNAL(sig(int,int)) , &obj2, SLOT(slo(int,int))); emit obj1.sig(0.5); //connected to nothing emit obj1.sig(1, 'a'); //connected to nothing diff --git a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp index 472be15512..4b188368ee 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp +++ b/tests/auto/corelib/kernel/qsignalmapper/tst_qsignalmapper.cpp @@ -102,7 +102,7 @@ void tst_QSignalMapper::mapped() mapper.setMapping(&src3, "three"); connect(&mapper, SIGNAL(mapped(int)), &target, SLOT(myslot(int))); - connect(&mapper, SIGNAL(mapped(const QString &)), &target, SLOT(myslot(const QString &))); + connect(&mapper, SIGNAL(mapped(QString)), &target, SLOT(myslot(QString))); src1.emit_mysignal(20); QVERIFY(target.id == 1); diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index 6fe9fe11bc..d059a8bf1d 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -2333,13 +2333,13 @@ void tst_QStateMachine::signalTransitions() SignalEmitter emitter; QState *s0 = new QState(&machine); QFinalState *s1 = new QFinalState(&machine); - QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL( signalWithNoArg( ) ), s1); + QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1); QVERIFY(t0 != 0); - QCOMPARE(t0->signal(), QByteArray(SIGNAL( signalWithNoArg( ) ))); + QCOMPARE(t0->signal(), QByteArray(SIGNAL(signalWithNoArg()))); - QSignalTransition *t1 = s0->addTransition(&emitter, SIGNAL( signalWithStringArg( const QString & ) ), s1); + QSignalTransition *t1 = s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1); QVERIFY(t1 != 0); - QCOMPARE(t1->signal(), QByteArray(SIGNAL( signalWithStringArg( const QString & ) ))); + QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString)))); QSignalSpy startedSpy(&machine, SIGNAL(started())); QSignalSpy finishedSpy(&machine, SIGNAL(finished())); @@ -3503,11 +3503,11 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific() s1->addTransition(at); QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo"); - connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); + connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), &counter, SLOT(slot())); QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo"); s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3); - connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot())); + connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), &counter, SLOT(slot())); machine.addDefaultAnimation(defaultAnimation); at->addAnimation(moreSpecificAnimation); @@ -4742,7 +4742,7 @@ void tst_QStateMachine::signalTransitionNormalizeSignature() machine.setInitialState(s0); QState *s1 = new QState(&machine); SignalEmitter emitter; - TestSignalTransition *t0 = new TestSignalTransition(&emitter, SIGNAL( signalWithNoArg( ) ), s1); + TestSignalTransition *t0 = new TestSignalTransition(&emitter, SIGNAL(signalWithNoArg()), s1); s0->addTransition(t0); machine.start(); diff --git a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp index c68a33279c..949bcc5074 100644 --- a/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp +++ b/tests/auto/corelib/thread/qfuturewatcher/tst_qfuturewatcher.cpp @@ -370,7 +370,7 @@ void tst_QFutureWatcher::watchFinishedFuture() connect(&watcher, SIGNAL(canceled()), &object, SLOT(canceled())); connect(&watcher, SIGNAL(finished()), &object, SLOT(finished())); connect(&watcher, SIGNAL(progressValueChanged(int)), &object, SLOT(progressValueChanged(int))); - connect(&watcher, SIGNAL(progressRangeChanged(int, int)), &object, SLOT(progressRangeChanged(int, int))); + connect(&watcher, SIGNAL(progressRangeChanged(int,int)), &object, SLOT(progressRangeChanged(int,int))); #endif connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int))); @@ -404,7 +404,7 @@ void tst_QFutureWatcher::watchCanceledFuture() connect(&watcher, SIGNAL(canceled()), &object, SLOT(canceled())); connect(&watcher, SIGNAL(finished()), &object, SLOT(finished())); connect(&watcher, SIGNAL(progressValueChanged(int)), &object, SLOT(progressValueChanged(int))); - connect(&watcher, SIGNAL(progressRangeChanged(int, int)), &object, SLOT(progressRangeChanged(int, int))); + connect(&watcher, SIGNAL(progressRangeChanged(int,int)), &object, SLOT(progressRangeChanged(int,int))); #endif connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int))); @@ -528,10 +528,10 @@ void tst_QFutureWatcher::progressText() QObject::connect(&watcher, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); #ifdef PRINT QObject::connect(&watcher, SIGNAL(progressValueChanged(int)), &o, SLOT(printProgress(int))); - QObject::connect(&watcher, SIGNAL(progressTextChanged(const QString &)), &o, SLOT(printText(const QString &))); + QObject::connect(&watcher, SIGNAL(progressTextChanged(QString)), &o, SLOT(printText(QString))); #endif QObject::connect(&watcher, SIGNAL(progressValueChanged(int)), &o, SLOT(registerProgress(int))); - QObject::connect(&watcher, SIGNAL(progressTextChanged(const QString &)), &o, SLOT(registerText(const QString &))); + QObject::connect(&watcher, SIGNAL(progressTextChanged(QString)), &o, SLOT(registerText(QString))); watcher.setFuture(f); QTestEventLoop::instance().enterLoop(5); diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index d7b810858d..bdfb980357 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -77,7 +77,7 @@ private slots: void quit(); void started(); void finished(); - void terminated(); + void terminated(); // Named after a signal that was removed in Qt 5.0 void exec(); void sleep(); void msleep(); @@ -535,7 +535,7 @@ void tst_QThread::terminated() { SignalRecorder recorder; Terminate_Thread thread; - connect(&thread, SIGNAL(terminated()), &recorder, SLOT(slot()), Qt::DirectConnection); + connect(&thread, SIGNAL(finished()), &recorder, SLOT(slot()), Qt::DirectConnection); { QMutexLocker locker(&thread.mutex); thread.start(); diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index 04393cebcb..01805e1271 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -59,6 +59,7 @@ private slots: void dayOfYear(); void daysInMonth_data(); void daysInMonth(); + void daysInYear_data(); void daysInYear(); void getDate(); void weekNumber_invalid_data(); @@ -342,6 +343,7 @@ void tst_QDate::daysInMonth_data() QTest::newRow("data11") << 2000 << 11 << 1 << 30; QTest::newRow("data12") << 2000 << 12 << 1 << 31; QTest::newRow("data13") << 2001 << 2 << 1 << 28; + QTest::newRow("data14") << 2000 << 0 << 1 << 0; } void tst_QDate::daysInMonth() @@ -355,16 +357,24 @@ void tst_QDate::daysInMonth() QCOMPARE(dt.daysInMonth(), daysInMonth); } +void tst_QDate::daysInYear_data() +{ + QTest::addColumn<QDate>("date"); + QTest::addColumn<int>("expectedDaysInYear"); + + QTest::newRow("2000, 1, 1") << QDate(2000, 1, 1) << 366; + QTest::newRow("2001, 1, 1") << QDate(2001, 1, 1) << 365; + QTest::newRow("4, 1, 1") << QDate(4, 1, 1) << 366; + QTest::newRow("5, 1, 1") << QDate(5, 1, 1) << 365; + QTest::newRow("0, 0, 0") << QDate(0, 0, 0) << 0; +} + void tst_QDate::daysInYear() { - QDate dt(2000, 1, 1); - QCOMPARE(dt.daysInYear(), 366); - dt.setDate(2001, 1, 1); - QCOMPARE(dt.daysInYear(), 365); - dt.setDate(4, 1, 1); - QCOMPARE(dt.daysInYear(), 366); - dt.setDate(5, 1, 1); - QCOMPARE(dt.daysInYear(), 365); + QFETCH(QDate, date); + QFETCH(int, expectedDaysInYear); + + QCOMPARE(date.daysInYear(), expectedDaysInYear); } void tst_QDate::getDate() @@ -399,6 +409,7 @@ void tst_QDate::weekNumber_data() QTest::newRow( "data5" ) << 53 << 1998 << 1998 << 12 << 31; QTest::newRow( "data6" ) << 1 << 1985 << 1984 << 12 << 31; QTest::newRow( "data7" ) << 52 << 2006 << 2006 << 12 << 31; + QTest::newRow( "data8" ) << 53 << 2004 << 2005 << 1 << 1; } void tst_QDate::weekNumber() @@ -539,6 +550,8 @@ void tst_QDate::addDays_data() QTest::newRow( "data12" ) << -4713 << 1 << 2 << -2 << -4714 << 12 << 31; QTest::newRow( "data13" ) << -4713 << 1 << 2 << 2 << -4713 << 1 << 4; + + QTest::newRow( "invalid" ) << 0 << 0 << 0 << 1 << 0 << 0 << 0; } void tst_QDate::addMonths() @@ -591,6 +604,9 @@ void tst_QDate::addMonths_data() QTest::newRow( "data16" ) << 1 << 1 << 1 << -12 << -1 << 1 << 1; QTest::newRow( "data17" ) << -1 << 12 << 1 << 1 << 1 << 1 << 1; QTest::newRow( "data18" ) << -1 << 1 << 1 << 12 << 1 << 1 << 1; + QTest::newRow( "data19" ) << -2 << 1 << 1 << 12 << -1 << 1 << 1; + + QTest::newRow( "invalid" ) << 0 << 0 << 0 << 1 << 0 << 0 << 0; } void tst_QDate::addYears() @@ -642,6 +658,8 @@ void tst_QDate::addYears_data() QTest::newRow( "data17" ) << -2000 << 1 << 1 << 1999 << -1 << 1 << 1; QTest::newRow( "data18" ) << -2000 << 1 << 1 << 2000 << 1 << 1 << 1; QTest::newRow( "data19" ) << -2000 << 1 << 1 << 2001 << 2 << 1 << 1; + + QTest::newRow( "invalid" ) << 0 << 0 << 0 << 1 << 0 << 0 << 0; } void tst_QDate::daysTo() @@ -903,36 +921,39 @@ void tst_QDate::operator_insert_extract() void tst_QDate::fromStringDateFormat_data() { - // Since we can't define an element of Qt::DateFormat, d1 will be the date - // expected when we have a TextDate, and d2 will be the date expected when - // we have an ISODate. - - QTest::addColumn<QString>("str1"); - QTest::addColumn<QString>("str2"); - QTest::addColumn<QDate>("d1"); - - QTest::newRow( "data0" ) << QString("Sat May 20 1995") << QString("1995-05-20") << QDate(1995,5,20); - QTest::newRow( "data1" ) << QString("Tue Dec 17 2002") << QString("2002-12-17") << QDate(2002,12,17); - QDate d( 1999, 11, 14 ); - QTest::newRow( "data2" ) << d.toString( Qt::TextDate ) << d.toString( Qt::ISODate ) << d; - - QTest::newRow( "data3" ) << QString("xxx Jan 1 0999") << QString("0999-01-01") << QDate(999, 1, 1); - QTest::newRow( "data3b" ) << QString("xxx Jan 1 999") << QString("0999-01-01") << QDate(999, 1, 1); - QTest::newRow( "data4" ) << QString("xxx Jan 1 12345") << QString() << QDate(12345, 1, 1); - QTest::newRow( "data5" ) << QString("xxx Jan 1 -0001") << QString() << QDate(-1, 1, 1); - QTest::newRow( "data6" ) << QString("xxx Jan 1 -4712") << QString() << QDate(-4712, 1, 1); - QTest::newRow( "data7" ) << QString("xxx Nov 25 -4713") << QString() << QDate(-4713, 11, 25); + QTest::addColumn<QString>("dateStr"); + QTest::addColumn<Qt::DateFormat>("dateFormat"); + QTest::addColumn<QDate>("expectedDate"); + + QTest::newRow("text0") << QString("Sat May 20 1995") << Qt::TextDate << QDate(1995, 5, 20); + QTest::newRow("text1") << QString("Tue Dec 17 2002") << Qt::TextDate << QDate(2002, 12, 17); + QTest::newRow("text2") << QDate(1999, 11, 14).toString(Qt::TextDate) << Qt::TextDate << QDate(1999, 11, 14); + QTest::newRow("text3") << QString("xxx Jan 1 0999") << Qt::TextDate << QDate(999, 1, 1); + QTest::newRow("text3b") << QString("xxx Jan 1 999") << Qt::TextDate << QDate(999, 1, 1); + QTest::newRow("text4") << QString("xxx Jan 1 12345") << Qt::TextDate << QDate(12345, 1, 1); + QTest::newRow("text5") << QString("xxx Jan 1 -0001") << Qt::TextDate << QDate(-1, 1, 1); + QTest::newRow("text6") << QString("xxx Jan 1 -4712") << Qt::TextDate << QDate(-4712, 1, 1); + QTest::newRow("text7") << QString("xxx Nov 25 -4713") << Qt::TextDate << QDate(-4713, 11, 25); + QTest::newRow("text, empty") << QString() << Qt::TextDate << QDate(); + QTest::newRow("text, 3 part") << QString("part1 part2 part3") << Qt::TextDate << QDate(); + QTest::newRow("text, invalid month name") << QString("Wed BabytownFrolics 8 2012") << Qt::TextDate << QDate(); + QTest::newRow("text, invalid day") << QString("Wed May Wilhelm 2012") << Qt::TextDate << QDate(); + QTest::newRow("text, invalid year") << QString("Wed May 8 Cats") << Qt::TextDate << QDate(); + + QTest::newRow("iso0") << QString("1995-05-20") << Qt::ISODate << QDate(1995, 5, 20); + QTest::newRow("iso1") << QString("2002-12-17") << Qt::ISODate << QDate(2002, 12, 17); + QTest::newRow("iso2") << QDate(1999, 11, 14).toString(Qt::ISODate) << Qt::ISODate << QDate(1999, 11, 14); + QTest::newRow("iso3") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1); + QTest::newRow("iso3b") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1); } void tst_QDate::fromStringDateFormat() { - QFETCH( QString, str1 ); - QFETCH( QString, str2 ); - QFETCH( QDate, d1 ); + QFETCH(QString, dateStr); + QFETCH(Qt::DateFormat, dateFormat); + QFETCH(QDate, expectedDate); - QCOMPARE( QDate::fromString( str1, Qt::TextDate ), d1 ); - if (!str2.isEmpty()) - QCOMPARE( QDate::fromString( str2, Qt::ISODate ), d1 ); + QCOMPARE(QDate::fromString(dateStr, dateFormat), expectedDate); } void tst_QDate::fromStringFormat_data() @@ -1050,6 +1071,8 @@ void tst_QDate::toStringDateFormat_data() QTest::newRow("data1") << QDate(11,1,1) << Qt::ISODate << QString("0011-01-01"); QTest::newRow("data2") << QDate(111,1,1) << Qt::ISODate << QString("0111-01-01"); QTest::newRow("data3") << QDate(1974,12,1) << Qt::ISODate << QString("1974-12-01"); + QTest::newRow("year < 0") << QDate(-1,1,1) << Qt::ISODate << QString(); + QTest::newRow("year > 9999") << QDate(-1,1,1) << Qt::ISODate << QString(); } void tst_QDate::toStringDateFormat() @@ -1202,6 +1225,7 @@ void tst_QDate::roundtripGermanLocale() const void tst_QDate::shortDayName() const { QCOMPARE(QDate::shortDayName(0), QString()); + QCOMPARE(QDate::shortDayName(8), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::shortDayName(1), QLatin1String("Mon")); @@ -1217,6 +1241,7 @@ void tst_QDate::shortDayName() const void tst_QDate::standaloneShortDayName() const { QCOMPARE(QDate::shortDayName(0, QDate::StandaloneFormat), QString()); + QCOMPARE(QDate::shortDayName(8, QDate::StandaloneFormat), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::shortDayName(1, QDate::StandaloneFormat), QLatin1String("Mon")); @@ -1232,6 +1257,7 @@ void tst_QDate::standaloneShortDayName() const void tst_QDate::longDayName() const { QCOMPARE(QDate::longDayName(0), QString()); + QCOMPARE(QDate::longDayName(8), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::longDayName(1), QLatin1String("Monday")); @@ -1247,6 +1273,7 @@ void tst_QDate::longDayName() const void tst_QDate::standaloneLongDayName() const { QCOMPARE(QDate::longDayName(0, QDate::StandaloneFormat), QString()); + QCOMPARE(QDate::longDayName(8, QDate::StandaloneFormat), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::longDayName(1, QDate::StandaloneFormat), QLatin1String("Monday")); @@ -1262,6 +1289,7 @@ void tst_QDate::standaloneLongDayName() const void tst_QDate::shortMonthName() const { QCOMPARE(QDate::shortMonthName(0), QString()); + QCOMPARE(QDate::shortMonthName(13), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::shortMonthName(1), QLatin1String("Jan")); @@ -1277,6 +1305,7 @@ void tst_QDate::shortMonthName() const void tst_QDate::standaloneShortMonthName() const { QCOMPARE(QDate::shortMonthName(0, QDate::StandaloneFormat), QString()); + QCOMPARE(QDate::shortMonthName(13, QDate::StandaloneFormat), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::shortMonthName(1, QDate::StandaloneFormat), QLatin1String("Jan")); @@ -1292,6 +1321,7 @@ void tst_QDate::standaloneShortMonthName() const void tst_QDate::longMonthName() const { QCOMPARE(QDate::longMonthName(0), QString()); + QCOMPARE(QDate::longMonthName(13), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::longMonthName(1), QLatin1String("January")); @@ -1307,6 +1337,7 @@ void tst_QDate::longMonthName() const void tst_QDate::standaloneLongMonthName() const { QCOMPARE(QDate::longMonthName(0, QDate::StandaloneFormat), QString()); + QCOMPARE(QDate::longMonthName(13, QDate::StandaloneFormat), QString()); if (QLocale::system().language() == QLocale::C) { QCOMPARE(QDate::longMonthName(1, QDate::StandaloneFormat), QLatin1String("January")); diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 0189306a1b..9e71a32f87 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -728,6 +728,8 @@ void tst_QDateTime::addSecs_data() QTest::newRow("toPositive") << QDateTime(QDate(-1, 12, 31), QTime(23, 59, 59), Qt::UTC) << 1 << QDateTime(QDate(1, 1, 1), QTime(0, 0, 0), Qt::UTC); + + QTest::newRow("invalid") << invalidDateTime() << 1 << invalidDateTime(); } void tst_QDateTime::addSecs() @@ -915,17 +917,22 @@ void tst_QDateTime::secsTo() QFETCH(int, nsecs); QFETCH(QDateTime, result); -#ifdef Q_OS_IRIX - QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort); -#endif - QCOMPARE(dt.secsTo(result), (qint64)nsecs); - QCOMPARE(result.secsTo(dt), (qint64)-nsecs); - QVERIFY((dt == result) == (0 == nsecs)); - QVERIFY((dt != result) == (0 != nsecs)); - QVERIFY((dt < result) == (0 < nsecs)); - QVERIFY((dt <= result) == (0 <= nsecs)); - QVERIFY((dt > result) == (0 > nsecs)); - QVERIFY((dt >= result) == (0 >= nsecs)); + if (dt.isValid()) { + #ifdef Q_OS_IRIX + QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort); + #endif + QCOMPARE(dt.secsTo(result), (qint64)nsecs); + QCOMPARE(result.secsTo(dt), (qint64)-nsecs); + QVERIFY((dt == result) == (0 == nsecs)); + QVERIFY((dt != result) == (0 != nsecs)); + QVERIFY((dt < result) == (0 < nsecs)); + QVERIFY((dt <= result) == (0 <= nsecs)); + QVERIFY((dt > result) == (0 > nsecs)); + QVERIFY((dt >= result) == (0 >= nsecs)); + } else { + QVERIFY(dt.secsTo(result) == 0); + QVERIFY(result.secsTo(dt) == 0); + } } void tst_QDateTime::msecsTo_data() @@ -939,17 +946,22 @@ void tst_QDateTime::msecsTo() QFETCH(int, nsecs); QFETCH(QDateTime, result); -#ifdef Q_OS_IRIX - QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort); -#endif - QCOMPARE(dt.msecsTo(result), qint64(nsecs) * 1000); - QCOMPARE(result.msecsTo(dt), -qint64(nsecs) * 1000); - QVERIFY((dt == result) == (0 == (qint64(nsecs) * 1000))); - QVERIFY((dt != result) == (0 != (qint64(nsecs) * 1000))); - QVERIFY((dt < result) == (0 < (qint64(nsecs) * 1000))); - QVERIFY((dt <= result) == (0 <= (qint64(nsecs) * 1000))); - QVERIFY((dt > result) == (0 > (qint64(nsecs) * 1000))); - QVERIFY((dt >= result) == (0 >= (qint64(nsecs) * 1000))); + if (dt.isValid()) { + #ifdef Q_OS_IRIX + QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort); + #endif + QCOMPARE(dt.msecsTo(result), qint64(nsecs) * 1000); + QCOMPARE(result.msecsTo(dt), -qint64(nsecs) * 1000); + QVERIFY((dt == result) == (0 == (qint64(nsecs) * 1000))); + QVERIFY((dt != result) == (0 != (qint64(nsecs) * 1000))); + QVERIFY((dt < result) == (0 < (qint64(nsecs) * 1000))); + QVERIFY((dt <= result) == (0 <= (qint64(nsecs) * 1000))); + QVERIFY((dt > result) == (0 > (qint64(nsecs) * 1000))); + QVERIFY((dt >= result) == (0 >= (qint64(nsecs) * 1000))); + } else { + QVERIFY(dt.msecsTo(result) == 0); + QVERIFY(result.msecsTo(dt) == 0); + } } void tst_QDateTime::currentDateTime() @@ -1579,6 +1591,13 @@ void tst_QDateTime::fromStringToStringLocale() QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::SystemLocaleDate), Qt::SystemLocaleDate), dateTime); QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::LocaleDate), Qt::LocaleDate), dateTime); + QEXPECT_FAIL("data0", "This format is apparently failing because of a bug in the datetime parser. (QTBUG-22833)", Continue); + QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::DefaultLocaleLongDate), Qt::DefaultLocaleLongDate), dateTime); +#ifndef Q_OS_WIN + QEXPECT_FAIL("data0", "This format is apparently failing because of a bug in the datetime parser. (QTBUG-22833)", Continue); +#endif + QCOMPARE(QDateTime::fromString(dateTime.toString(Qt::SystemLocaleLongDate), Qt::SystemLocaleLongDate), dateTime); + QLocale::setDefault(def); } diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index af9f03c551..299ae104f1 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -95,7 +95,9 @@ private slots: #endif void ctor(); +#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) void emptyCtor(); +#endif void unixLocaleName(); void double_conversion_data(); void double_conversion(); @@ -374,6 +376,10 @@ void tst_QLocale::ctor() #undef TEST_CTOR } +#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS) +// Not when Q_OS_WINCE is defined because the test uses unsupported +// Windows CE QProcess functionality (std streams, env) +// Also Qt needs to be compiled without QT_NO_PROCESS static inline bool runSysApp(const QString &binary, const QStringList &env, QString *output, @@ -424,12 +430,6 @@ static inline bool runSysAppTest(const QString &binary, void tst_QLocale::emptyCtor() { -#if defined(Q_OS_WINCE) - QSKIP("Uses unsupported Windows CE QProcess functionality (std streams, env)"); -#endif -#if defined(QT_NO_PROCESS) - QSKIP("Qt was compiled with QT_NO_PROCESS"); -#else #define TEST_CTOR(req_lc, exp_str) \ { \ /* Test constructor without arguments. Needs separate process */ \ @@ -492,8 +492,8 @@ void tst_QLocale::emptyCtor() TEST_CTOR("123456", defaultLoc.toLatin1()); #undef TEST_CTOR -#endif } +#endif void tst_QLocale::unixLocaleName() { @@ -875,6 +875,7 @@ void tst_QLocale::formatDate_data() QTest::newRow("28") << QDate() << "'\"yy\"'" << ""; QTest::newRow("29") << QDate(1974, 12, 1) << "hh:mm:ss.zzz ap d'd'dd/M/yy" << "hh:mm:ss.zzz ap 1d01/12/74"; + QTest::newRow("dd MMMM yyyy") << QDate(1, 1, 1) << "dd MMMM yyyy" << "01 January 0001"; } void tst_QLocale::formatDate() @@ -974,6 +975,9 @@ void tst_QLocale::formatDateTime_data() QTest::newRow("12C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(15, 14, 13)) << "d'd'dd/M/yyh" << "1d01/12/7415"; + QTest::newRow("dd MMMM yyyy, hh:mm:ss") << "C" << QDateTime(QDate(1, 1, 1), QTime(12, 00, 00)) + << "dd MMMM yyyy, hh:mm:ss" << "01 January 0001, 12:00:00"; + QTest::newRow("20C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(15, 14, 13)) << "foo" << "foo"; QTest::newRow("21C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(15, 14, 13)) diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 2bf8119b9e..bc6bc585f2 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -49,6 +49,10 @@ # undef QT_ASCII_CAST_WARNINGS #endif +#if defined(Q_OS_WIN) && defined(Q_OS_WINCE) +#define Q_OS_WIN_AND_WINCE +#endif + #include <QtTest/QtTest> #include <qregexp.h> #include <qregularexpression.h> @@ -78,8 +82,10 @@ public: public slots: void cleanup(); private slots: +#ifndef Q_CC_HPACC void fromStdString(); void toStdString(); +#endif void check_QTextIOStream(); void check_QTextStream(); void check_QDataStream(); @@ -204,8 +210,10 @@ private slots: void integer_conversion(); void tortureSprintfDouble(); void toNum(); +#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) void localeAwareCompare_data(); void localeAwareCompare(); +#endif void split_data(); void split(); void split_regexp_data(); @@ -228,8 +236,12 @@ private slots: void repeated_data() const; void compareRef(); void arg_locale(); +#ifdef QT_USE_ICU void toUpperLower_icu(); +#endif +#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)) void literals(); +#endif void eightBitLiterals_data(); void eightBitLiterals(); void reserve(); @@ -3444,11 +3456,10 @@ void tst_QString::setRawData() QVERIFY(cstr.data_ptr() != csd); } +#ifndef Q_CC_HPACC +// This test crashes on HP-UX with aCC (not supported) void tst_QString::fromStdString() { -#ifdef Q_CC_HPACC - QSKIP("This test crashes on HP-UX with aCC"); -#endif std::string stroustrup = "foo"; QString eng = QString::fromStdString( stroustrup ); QCOMPARE( eng, QString("foo") ); @@ -3457,12 +3468,12 @@ void tst_QString::fromStdString() QString qtnull = QString::fromStdString( stdnull ); QCOMPARE( qtnull.size(), int(stdnull.size()) ); } +#endif +#ifndef Q_CC_HPACC +// This test crashes on HP-UX with aCC (not supported) void tst_QString::toStdString() { -#ifdef Q_CC_HPACC - QSKIP("This test crashes on HP-UX with aCC"); -#endif QString nord = "foo"; std::string stroustrup1 = nord.toStdString(); QVERIFY( qstrcmp(stroustrup1.c_str(), "foo") == 0 ); @@ -3477,6 +3488,7 @@ void tst_QString::toStdString() std::string stdnull = qtnull.toStdString(); QCOMPARE( int(stdnull.size()), qtnull.size() ); } +#endif void tst_QString::utf8() { @@ -4463,9 +4475,11 @@ void tst_QString::tortureSprintfDouble() #include <locale.h> +#if !defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) +// On Q_OS_WIN others than Win CE, we cannot set the system or user locale void tst_QString::localeAwareCompare_data() { -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN_AND_WINCE QTest::addColumn<ulong>("locale"); #else QTest::addColumn<QString>("locale"); @@ -4479,7 +4493,7 @@ void tst_QString::localeAwareCompare_data() Latin-1-specific characters (I think). Compare with Swedish below. */ -#ifdef Q_OS_WIN // assume c locale to be english +#ifdef Q_OS_WIN_AND_WINCE // assume c locale to be english QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1; QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; @@ -4497,7 +4511,7 @@ void tst_QString::localeAwareCompare_data() comparison of Latin-1 values, although I'm not sure. So I just test digits to make sure that it's not totally broken. */ -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN_AND_WINCE QTest::newRow("english1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("4") << 1; QTest::newRow("english2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("4") << QString("6") << -1; QTest::newRow("english3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("5") << QString("6") << -1; @@ -4516,7 +4530,7 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1; -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN_AND_WINCE) QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1; QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1; @@ -4546,7 +4560,7 @@ void tst_QString::localeAwareCompare_data() QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN_AND_WINCE) QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1; QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1; QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1; @@ -4559,10 +4573,7 @@ void tst_QString::localeAwareCompare_data() void tst_QString::localeAwareCompare() { -#ifdef Q_OS_WIN -# ifndef Q_OS_WINCE - QSKIP("On others than Win CE, we cannot set the system or user locale."); -# endif +#ifdef Q_OS_WIN_AND_WINCE QFETCH(ulong, locale); #else QFETCH(QString, locale); @@ -4574,19 +4585,10 @@ void tst_QString::localeAwareCompare() QStringRef r1(&s1, 0, s1.length()); QStringRef r2(&s2, 0, s2.length()); -#ifdef Q_OS_WIN -# if defined(Q_OS_WINCE) +#ifdef Q_OS_WIN_AND_WINCE DWORD oldLcid = GetUserDefaultLCID(); SetUserDefaultLCID(locale); - QCOMPARE(locale, GetUserDefaultLCID()); -# else - DWORD oldLcid = GetThreadLocale(); - SetThreadLocale(locale); - - QCOMPARE(locale, GetThreadLocale()); -# endif - #elif defined (Q_OS_MAC) QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)"); #elif defined(QT_USE_ICU) @@ -4651,18 +4653,14 @@ void tst_QString::localeAwareCompare() QVERIFY(testres == 0); } -#ifdef Q_OS_WIN -# if defined(Q_OS_WINCE) +#ifdef Q_OS_WIN_AND_WINCE SetUserDefaultLCID(oldLcid); -# else - SetThreadLocale(oldLcid); -# endif - #else if (!locale.isEmpty()) setlocale(LC_ALL, ""); #endif } +#endif //!defined(Q_OS_WIN) || defined(Q_OS_WIN_AND_WINCE) void tst_QString::split_data() { @@ -5349,12 +5347,11 @@ void tst_QString::arg_locale() QLocale::setDefault(QLocale::C); } + +#ifdef QT_USE_ICU +// Qt has to be built with ICU support void tst_QString::toUpperLower_icu() { -#ifndef QT_USE_ICU - QSKIP("Qt was built without ICU support"); -#endif - QString s = QString::fromLatin1("i"); QCOMPARE(s.toUpper(), QString::fromLatin1("I")); @@ -5387,10 +5384,12 @@ void tst_QString::toUpperLower_icu() // the cleanup function will restore the default locale } +#endif +#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)) +// Only tested on c++0x compliant compiler or gcc void tst_QString::literals() { -#if defined(QT_UNICODE_LITERAL) && (defined(Q_COMPILER_LAMBDA) || defined(Q_CC_GNU)) QString str(QStringLiteral("abcd")); QVERIFY(str.length() == 4); @@ -5407,11 +5406,8 @@ void tst_QString::literals() QVERIFY(str2.constData() == s); QVERIFY(str2.data() != s); - -#else - QSKIP("Only tested on c++0x compliant compiler or gcc"); -#endif } +#endif void tst_QString::eightBitLiterals_data() { diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp index 2c4ec62936..ef549bc660 100644 --- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp @@ -72,7 +72,9 @@ private slots: void joinChar() const; void joinChar_data() const; +#ifdef Q_COMPILER_INITIALIZER_LISTS void initializeList() const; +#endif }; extern const char email[]; @@ -422,16 +424,16 @@ void tst_QStringList::joinEmptiness() const QVERIFY(string.isNull()); } +#ifdef Q_COMPILER_INITIALIZER_LISTS +// C++0x support is required void tst_QStringList::initializeList() const { -#ifdef Q_COMPILER_INITIALIZER_LISTS + QStringList v1{QLatin1String("hello"),"world",QString::fromLatin1("plop")}; QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop")); QCOMPARE(v1, (QStringList{"hello","world","plop"})); -#else - QSKIP("Require C++0x support, pass the right flag to the compiler"); -#endif } +#endif QTEST_APPLESS_MAIN(tst_QStringList) #include "tst_qstringlist.moc" diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index a1a31d754f..bfb8b4c42d 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -192,6 +192,8 @@ void tst_QTime::addMSecs_data() QTest::newRow( "Data17_2") << QTime(0,0,0,0) << -5 << QTime(23,59,59,995); QTest::newRow( "Data17_3") << QTime(0,0,0,1) << -6 << QTime(23,59,59,995); QTest::newRow( "Data17_4") << QTime(0,0,0,2) << -7 << QTime(23,59,59,995); + + QTest::newRow( "Data18_0" ) << invalidTime() << 1 << invalidTime(); } void tst_QTime::addMSecs() @@ -574,6 +576,9 @@ void tst_QTime::fromStringDateFormat_data() QTest::newRow("TextDate - data1") << QString("10:12:34") << Qt::TextDate << QTime(10,12,34,0); QTest::newRow("TextDate - data2") << QString("19:03:54.998601") << Qt::TextDate << QTime(19, 3, 54, 999); QTest::newRow("TextDate - data3") << QString("19:03:54.999601") << Qt::TextDate << QTime(19, 3, 54, 999); + QTest::newRow("TextDate - invalid, minutes") << QString::fromLatin1("23:XX:00") << Qt::TextDate << invalidTime(); + QTest::newRow("TextDate - invalid, seconds") << QString::fromLatin1("23:00:XX") << Qt::TextDate << invalidTime(); + QTest::newRow("TextDate - invalid, milliseconds") << QString::fromLatin1("23:01:01:XXXX") << Qt::TextDate << QTime(23, 1, 1, 0); QTest::newRow("IsoDate - valid, start of day, omit seconds") << QString::fromLatin1("00:00") << Qt::ISODate << QTime(0, 0, 0); QTest::newRow("IsoDate - valid, omit seconds") << QString::fromLatin1("22:21") << Qt::ISODate << QTime(22, 21, 0); @@ -585,11 +590,17 @@ void tst_QTime::fromStringDateFormat_data() QTest::newRow("IsoDate - invalid, too many minutes") << QString::fromLatin1("10:70") << Qt::ISODate << invalidTime(); // This is a valid time if it happens on June 30 or December 31 (leap seconds). QTest::newRow("IsoDate - invalid, too many seconds") << QString::fromLatin1("23:59:60") << Qt::ISODate << invalidTime(); + QTest::newRow("IsoDate - invalid, minutes") << QString::fromLatin1("23:XX:00") << Qt::ISODate << invalidTime(); + QTest::newRow("IsoDate - invalid, not enough minutes") << QString::fromLatin1("23:0") << Qt::ISODate << invalidTime(); + QTest::newRow("IsoDate - invalid, minute fraction") << QString::fromLatin1("23:00,XX") << Qt::ISODate << invalidTime(); + QTest::newRow("IsoDate - invalid, seconds") << QString::fromLatin1("23:00:XX") << Qt::ISODate << invalidTime(); + QTest::newRow("IsoDate - invalid, milliseconds") << QString::fromLatin1("23:01:01:XXXX") << Qt::ISODate << QTime(23, 1, 1, 0); QTest::newRow("IsoDate - data0") << QString("00:00:00") << Qt::ISODate << QTime(0,0,0,0); QTest::newRow("IsoDate - data1") << QString("10:12:34") << Qt::ISODate << QTime(10,12,34,0); QTest::newRow("IsoDate - data2") << QString("19:03:54.998601") << Qt::ISODate << QTime(19, 3, 54, 999); QTest::newRow("IsoDate - data3") << QString("19:03:54.999601") << Qt::ISODate << QTime(19, 3, 54, 999); + QTest::newRow("IsoDate - minute fraction midnight") << QString("24:00,0") << Qt::ISODate << QTime(0, 0, 0, 0); } void tst_QTime::fromStringDateFormat() diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 6304477ba3..0eda837644 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -205,8 +205,11 @@ private slots: void eraseEmptyReservedMovable() const; void eraseEmptyReservedCustom() const; void eraseInt() const; + void eraseIntShared() const; void eraseMovable() const; + void eraseMovableShared() const; void eraseCustom() const; + void eraseCustomShared() const; void eraseReservedInt() const; void eraseReservedMovable() const; void eraseReservedCustom() const; @@ -268,6 +271,7 @@ private slots: void detachInt() const; void detachMovable() const; void detachCustom() const; + private: template<typename T> void copyConstructor() const; template<typename T> void add() const; @@ -278,7 +282,7 @@ private: template<typename T> void empty() const; template<typename T> void eraseEmpty() const; template<typename T> void eraseEmptyReserved() const; - template<typename T> void erase() const; + template<typename T> void erase(bool shared) const; template<typename T> void eraseReserved() const; template<typename T> void fill() const; template<typename T> void fromList() const; @@ -300,6 +304,15 @@ template<typename T> struct SimpleValue { return Values[index % MaxIndex]; } + + static QVector<T> vector(int size) + { + QVector<T> ret; + for (int i = 0; i < size; i++) + ret.append(at(i)); + return ret; + } + static const uint MaxIndex = 6; static const T Values[MaxIndex]; }; @@ -565,7 +578,6 @@ void tst_QVector::capacity() const // make sure it grows ok myvec << SimpleValue<T>::at(0) << SimpleValue<T>::at(1) << SimpleValue<T>::at(2); QVERIFY(myvec.capacity() >= 6); - // let's try squeeze a bit myvec.remove(3); myvec.remove(3); @@ -865,60 +877,139 @@ void tst_QVector::eraseEmptyReservedCustom() const } template<typename T> -void tst_QVector::erase() const +struct SharedVectorChecker { + SharedVectorChecker(const QVector<T> &original, bool doCopyVector) + : originalSize(-1), + copy(0) { - QVector<T> v(12); + if (doCopyVector) { + originalSize = original.size(); + copy = new QVector<T>(original); + // this is unlikely to fail, but if the check in the destructor fails it's good to know that + // we were still alright here. + QCOMPARE(originalSize, copy->size()); + } + } + + ~SharedVectorChecker() + { + if (copy) + QCOMPARE(copy->size(), originalSize); + delete copy; + } + + int originalSize; + QVector<T> *copy; +}; + +template<typename T> +void tst_QVector::erase(bool shared) const +{ + // note: remove() is actually more efficient, and more dangerous, because it uses the non-detaching + // begin() / end() internally. you can also use constBegin() and constEnd() with erase(), but only + // using reinterpret_cast... because both iterator types are really just pointers. + // so we use a mix of erase() and remove() to cover more cases. + { + QVector<T> v = SimpleValue<T>::vector(12); + SharedVectorChecker<T> svc(v, shared); v.erase(v.begin()); QCOMPARE(v.size(), 11); + for (int i = 0; i < 11; i++) + QCOMPARE(v.at(i), SimpleValue<T>::at(i + 1)); v.erase(v.begin(), v.end()); QCOMPARE(v.size(), 0); + if (shared) + QCOMPARE(SimpleValue<T>::vector(12), *svc.copy); } { - QVector<T> v(12); - v.erase(v.begin() + 1); + QVector<T> v = SimpleValue<T>::vector(12); + SharedVectorChecker<T> svc(v, shared); + v.remove(1); QCOMPARE(v.size(), 11); + QCOMPARE(v.at(0), SimpleValue<T>::at(0)); + for (int i = 1; i < 11; i++) + QCOMPARE(v.at(i), SimpleValue<T>::at(i + 1)); v.erase(v.begin() + 1, v.end()); QCOMPARE(v.size(), 1); + QCOMPARE(v.at(0), SimpleValue<T>::at(0)); + if (shared) + QCOMPARE(SimpleValue<T>::vector(12), *svc.copy); } { - QVector<T> v(12); + QVector<T> v = SimpleValue<T>::vector(12); + SharedVectorChecker<T> svc(v, shared); v.erase(v.begin(), v.end() - 1); QCOMPARE(v.size(), 1); + QCOMPARE(v.at(0), SimpleValue<T>::at(11)); + if (shared) + QCOMPARE(SimpleValue<T>::vector(12), *svc.copy); } { - QVector<T> v(12); - v.erase(v.begin() + 5); + QVector<T> v = SimpleValue<T>::vector(12); + SharedVectorChecker<T> svc(v, shared); + v.remove(5); QCOMPARE(v.size(), 11); + for (int i = 0; i < 5; i++) + QCOMPARE(v.at(i), SimpleValue<T>::at(i)); + for (int i = 5; i < 11; i++) + QCOMPARE(v.at(i), SimpleValue<T>::at(i + 1)); v.erase(v.begin() + 1, v.end() - 1); + QCOMPARE(v.at(0), SimpleValue<T>::at(0)); + QCOMPARE(v.at(1), SimpleValue<T>::at(11)); QCOMPARE(v.size(), 2); + if (shared) + QCOMPARE(SimpleValue<T>::vector(12), *svc.copy); } { - QVector<T> v(10); + QVector<T> v = SimpleValue<T>::vector(10); + SharedVectorChecker<T> svc(v, shared); v.setSharable(false); + SharedVectorChecker<T> svc2(v, shared); v.erase(v.begin() + 3); QCOMPARE(v.size(), 9); v.erase(v.begin(), v.end() - 1); QCOMPARE(v.size(), 1); + if (shared) + QCOMPARE(SimpleValue<T>::vector(10), *svc.copy); } } void tst_QVector::eraseInt() const { - erase<int>(); + erase<int>(false); +} + +void tst_QVector::eraseIntShared() const +{ + erase<int>(true); } void tst_QVector::eraseMovable() const { const int instancesCount = Movable::counter; - erase<Movable>(); + erase<Movable>(false); + QCOMPARE(instancesCount, Movable::counter); +} + +void tst_QVector::eraseMovableShared() const +{ + const int instancesCount = Movable::counter; + erase<Movable>(true); QCOMPARE(instancesCount, Movable::counter); } void tst_QVector::eraseCustom() const { const int instancesCount = Custom::counter; - erase<Custom>(); + erase<Custom>(false); + QCOMPARE(instancesCount, Custom::counter); +} + +void tst_QVector::eraseCustomShared() const +{ + const int instancesCount = Custom::counter; + erase<Custom>(true); QCOMPARE(instancesCount, Custom::counter); } |