diff options
Diffstat (limited to 'tests/auto')
81 files changed, 1014 insertions, 704 deletions
diff --git a/tests/auto/cmake/test_modules/CMakeLists.txt b/tests/auto/cmake/test_modules/CMakeLists.txt index d96db7d557..30a726b10f 100644 --- a/tests/auto/cmake/test_modules/CMakeLists.txt +++ b/tests/auto/cmake/test_modules/CMakeLists.txt @@ -13,6 +13,7 @@ set(qtbase_modules Sql Test Xml + PrintSupport ) if (UNIX AND NOT APPLE AND NOT QNXNTO) diff --git a/tests/auto/cmake/test_modules/main.cpp b/tests/auto/cmake/test_modules/main.cpp index 02fc4d2064..2bb885dd5c 100644 --- a/tests/auto/cmake/test_modules/main.cpp +++ b/tests/auto/cmake/test_modules/main.cpp @@ -48,6 +48,7 @@ #include <QtTest> #include <QWidget> #include <QDomDocument> +#include <QPrintDialog> #ifdef EXPECT_DBUS_AVAILABLE #include <QDBusMessage> @@ -71,6 +72,8 @@ int main(int argc, char **argv) QDomDocument domDocument; + QPrintDialog printDialog; + #ifdef EXPECT_DBUS_AVAILABLE QDBusMessage dBusMessage; #endif 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); } diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp index dd6d97043d..1918841d24 100644 --- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp @@ -109,7 +109,6 @@ private slots: void setGetMask(); void cacheKey(); void drawBitmap(); - void grabWindow(); void isNull(); void task_246446(); @@ -723,36 +722,6 @@ void tst_QPixmap::drawBitmap() QVERIFY(lenientCompare(pixmap, expected)); } -void tst_QPixmap::grabWindow() -{ -// ### fixme: Check platforms - QSKIP("QTBUG-20863 grabWindow is broken on most qpa backends"); -#ifndef QT_NO_WIDGETS -#ifdef Q_OS_WINCE - // We get out of memory, if the desktop itself is too big. - if (QApplication::desktop()->width() <= 480) -#endif - QVERIFY(QPixmap::grabWindow(QApplication::desktop()->winId()).isNull() == false); - QWidget w; - w.resize(640, 480); - w.show(); - QVERIFY(QTest::qWaitForWindowExposed(&w)); - QVERIFY(QPixmap::grabWindow(w.winId()).isNull() == false); - - QWidget child(&w); - child.setGeometry(50, 50, 100, 100); - child.setPalette(Qt::red); - child.setAutoFillBackground(true); - child.show(); - QTest::qWait(20); - const QPixmap grabWidgetPixmap = child.grab(); - const WId childWinId = child.winId(); // Create native child - QVERIFY(QTest::qWaitForWindowExposed(child.windowHandle())); - const QPixmap grabWindowPixmap = QPixmap::grabWindow(childWinId); - QVERIFY(lenientCompare(grabWindowPixmap, grabWidgetPixmap)); -#endif -} - void tst_QPixmap::isNull() { { diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index acb6ce8ef6..d28e4298b4 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -183,23 +183,23 @@ void tst_QStandardItemModel::init() qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); m_model = new QStandardItemModel(defaultSize, defaultSize); - connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeInserted(QModelIndex, int, int))); - connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(rowsInserted(QModelIndex, int, int))); - connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - connect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), - this, SLOT(rowsRemoved(QModelIndex, int, int))); - - connect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex, int, int)), - this, SLOT(columnsAboutToBeInserted(QModelIndex, int, int))); - connect(m_model, SIGNAL(columnsInserted(QModelIndex, int, int)), - this, SLOT(columnsInserted(QModelIndex, int, int))); - connect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(columnsAboutToBeRemoved(QModelIndex, int, int))); - connect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), - this, SLOT(columnsRemoved(QModelIndex, int, int))); + connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + + connect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(columnsInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeRemoved(QModelIndex,int,int))); + connect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(columnsRemoved(QModelIndex,int,int))); rcFirst.fill(-1); rcLast.fill(-1); @@ -207,23 +207,23 @@ void tst_QStandardItemModel::init() void tst_QStandardItemModel::cleanup() { - disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeInserted(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(rowsInserted(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), - this, SLOT(rowsRemoved(QModelIndex, int, int))); - - disconnect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex, int, int)), - this, SLOT(columnsAboutToBeInserted(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(columnsInserted(QModelIndex, int, int)), - this, SLOT(columnsInserted(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(columnsAboutToBeRemoved(QModelIndex, int, int))); - disconnect(m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)), - this, SLOT(columnsRemoved(QModelIndex, int, int))); + disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + + disconnect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(columnsInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(columnsRemoved(QModelIndex,int,int))); delete m_model; m_model = 0; } @@ -470,9 +470,9 @@ void tst_QStandardItemModel::setHeaderData() QCOMPARE(m_model->headerData(i, orient).toString(), QString::number(i + 1)); QSignalSpy headerDataChangedSpy( - m_model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); + m_model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QSignalSpy dataChangedSpy( - m_model, SIGNAL(dataChanged(QModelIndex, QModelIndex))); + m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); // insert custom values and check for (int i = 0; i < count; ++i) { QString customString = QString("custom") + QString::number(i); @@ -752,7 +752,7 @@ void tst_QStandardItemModel::clear() QSignalSpy modelResetSpy(&model, SIGNAL(modelReset())); QSignalSpy layoutChangedSpy(&model, SIGNAL(layoutChanged())); - QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex, int, int))); + QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); model.clear(); QCOMPARE(modelResetSpy.count(), 1); @@ -1135,7 +1135,7 @@ void tst_QStandardItemModel::getSetItemData() QModelIndex idx = model.index(0, 0, QModelIndex()); QSignalSpy modelDataChangedSpy( - &model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); + &model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); QVERIFY(model.setItemData(idx, roles)); QCOMPARE(modelDataChangedSpy.count(), 1); QVERIFY(model.setItemData(idx, roles)); @@ -1218,9 +1218,9 @@ void tst_QStandardItemModel::itemDataChanged() QStandardItemModel model(6, 4); QStandardItem item; QSignalSpy dataChangedSpy( - &model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); + &model, SIGNAL(dataChanged(QModelIndex,QModelIndex))); QSignalSpy itemChangedSpy( - &model, SIGNAL(itemChanged(QStandardItem *))); + &model, SIGNAL(itemChanged(QStandardItem*))); model.setItem(0, &item); QCOMPARE(dataChangedSpy.count(), 1); diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index f31d92751d..7ad292fd02 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -57,7 +57,9 @@ private slots: void cleanupTestCase(); #else void init(); +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX) void copy_exit_paste(); +#endif void capabilityFunctions(); void modes(); void testSignals(); @@ -191,6 +193,7 @@ void tst_QClipboard::testSignals() QCOMPARE(dataChangedSpy.count(), 1); } +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(Q_OS_QNX) static bool runHelper(const QString &program, const QStringList &arguments, QByteArray *errorMessage) { QProcess process; @@ -230,13 +233,11 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt } // Test that pasted text remains on the clipboard after a Qt application exits. +// This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits void tst_QClipboard::copy_exit_paste() { #ifndef QT_NO_PROCESS -#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) && !defined(Q_OS_QNX) - QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits "); // ### It's still possible to test copy/paste - just keep the apps running -#endif if (!PlatformClipboard::isAvailable()) QSKIP("Native clipboard not working in this setup"); const QStringList stringArgument(QStringLiteral("Test string.")); @@ -246,11 +247,12 @@ void tst_QClipboard::copy_exit_paste() #ifdef Q_OS_MAC // The Pasteboard needs a moment to breathe (at least on older Macs). QTest::qWait(100); -#endif +#endif // Q_OS_MAC QVERIFY2(runHelper(QStringLiteral("paster/paster"), stringArgument, &errorMessage), errorMessage.constData()); -#endif +#endif // QT_NO_PROCESS } +#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_QNX void tst_QClipboard::setMimeData() { diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index ccb54b52c9..cc291f72fa 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -107,7 +107,7 @@ void tst_QGuiApplication::focusObject() DummyWindow window2; window1.show(); - QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject *))); + QSignalSpy spy(&app, SIGNAL(focusObjectChanged(QObject*))); // verify active window focus propagates to qguiapplication diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index 24be319173..09180b3de9 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -1490,6 +1490,7 @@ void tst_QPainter::setWindow() pixmap.fill(QColor(Qt::white)); QPainter painter(&pixmap); + painter.setRenderHint(QPainter::Qt4CompatiblePainting); painter.setWindow(0, 0, 3, 3); painter.drawLine(1, 1, 2, 2); diff --git a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp index 2ccc6c4ad3..4172076f6a 100644 --- a/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/gui/painting/qpathclipper/tst_qpathclipper.cpp @@ -470,9 +470,9 @@ void tst_QPathClipper::clipTest(int subjectIndex, int clipIndex, QPathClipper::O p.setRenderHint(QPainter::Antialiasing); p.scale(scale, scale); p.translate(-bounds.topLeft()); - p.setPen(Qt::black); + p.setPen(QPen(Qt::black, 0)); p.drawPath(subject); - p.setPen(Qt::red); + p.setPen(QPen(Qt::red, 0)); p.drawPath(clip); p.end(); diff --git a/tests/auto/gui/painting/qpen/tst_qpen.cpp b/tests/auto/gui/painting/qpen/tst_qpen.cpp index 35a71ba0a9..1ef7a4d0c4 100644 --- a/tests/auto/gui/painting/qpen/tst_qpen.cpp +++ b/tests/auto/gui/painting/qpen/tst_qpen.cpp @@ -154,9 +154,9 @@ void tst_QPen::constructor_data() QTest::addColumn<int>("capStyle"); QTest::addColumn<int>("joinStyle"); - QTest::newRow("solid_black") << QPen() << QBrush(Qt::black) << 0. << (int)Qt::SolidLine + QTest::newRow("solid_black") << QPen() << QBrush(Qt::black) << 1. << (int)Qt::SolidLine << (int) Qt::SquareCap << (int)Qt::BevelJoin; - QTest::newRow("solid_red") << QPen(Qt::red) << QBrush(Qt::red) << 0. << (int)Qt::SolidLine + QTest::newRow("solid_red") << QPen(Qt::red) << QBrush(Qt::red) << 1. << (int)Qt::SolidLine << (int)Qt::SquareCap << (int)Qt::BevelJoin; QTest::newRow("full") << QPen(QBrush(QLinearGradient(0, 0, 100, 100)), 10, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin) diff --git a/tests/auto/gui/text/qfont/qfont.pro b/tests/auto/gui/text/qfont/qfont.pro index 86178f3fa6..562294dd66 100644 --- a/tests/auto/gui/text/qfont/qfont.pro +++ b/tests/auto/gui/text/qfont/qfont.pro @@ -2,6 +2,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qfont QT += testlib +QT += core-private gui-private !contains(QT_CONFIG, no-widgets): QT += widgets SOURCES += tst_qfont.cpp diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 287fd728ff..3fe23bf1ff 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -44,6 +44,7 @@ #include <qfont.h> +#include <private/qfont_p.h> #include <qfontdatabase.h> #include <qfontinfo.h> #include <qstringlist.h> @@ -81,6 +82,8 @@ private slots: void styleName(); void defaultFamily_data(); void defaultFamily(); + + void sharing(); }; // Testing get/set functions @@ -685,5 +688,45 @@ void tst_QFont::defaultFamily() QVERIFY2(isAcceptable, msgNotAcceptableFont(familyForHint, acceptableFamilies)); } +void tst_QFont::sharing() +{ + QFont f; + f.setStyleHint(QFont::Serif); + f.exactMatch(); // loads engine + QCOMPARE(QFontPrivate::get(f)->ref.load(), 1); + QVERIFY(QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f)->engineData->ref.load(), 1); + + QFont f2(f); + QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); + QVERIFY(QFontPrivate::get(f2)->engineData); + QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1); + + f2.setKerning(!f.kerning()); + QVERIFY(QFontPrivate::get(f2) != QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2)->ref.load(), 1); + QVERIFY(QFontPrivate::get(f2)->engineData); + QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 2); + + f2 = f; + QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2); + QVERIFY(QFontPrivate::get(f2)->engineData); + QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData); + QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1); + + if (f.pointSize() > 0) + f2.setPointSize(f.pointSize() * 2 / 3); + else + f2.setPixelSize(f.pixelSize() * 2 / 3); + QVERIFY(QFontPrivate::get(f2) != QFontPrivate::get(f)); + QCOMPARE(QFontPrivate::get(f2)->ref.load(), 1); + QVERIFY(!QFontPrivate::get(f2)->engineData); + QVERIFY(QFontPrivate::get(f2)->engineData != QFontPrivate::get(f)->engineData); +} + QTEST_MAIN(tst_QFont) #include "tst_qfont.moc" diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 04d994db07..cf3265d446 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -1927,8 +1927,8 @@ public: CursorPosSignalSpy(QTextDocument *doc) { calls = 0; - connect(doc, SIGNAL(cursorPositionChanged(const QTextCursor &)), - this, SLOT(cursorPositionChanged(const QTextCursor &))); + connect(doc, SIGNAL(cursorPositionChanged(QTextCursor)), + this, SLOT(cursorPositionChanged(QTextCursor))); } int calls; @@ -2054,17 +2054,17 @@ void tst_QTextDocument::markContentsDirty() QTestDocumentLayout *lout = new QTestDocumentLayout(doc); doc->setDocumentLayout(lout); TestSyntaxHighlighter *highlighter = new TestSyntaxHighlighter(doc); - connect(doc, SIGNAL(contentsChange(int, int, int)), - highlighter, SLOT(markBlockDirty(int, int, int))); + connect(doc, SIGNAL(contentsChange(int,int,int)), + highlighter, SLOT(markBlockDirty(int,int,int))); highlighter->ok = false; cursor.insertText("Some dummy text blah blah"); QVERIFY(highlighter->ok); - disconnect(doc, SIGNAL(contentsChange(int, int, int)), - highlighter, SLOT(markBlockDirty(int, int, int))); - connect(doc, SIGNAL(contentsChange(int, int, int)), - highlighter, SLOT(modifyBlockAgain(int, int, int))); + disconnect(doc, SIGNAL(contentsChange(int,int,int)), + highlighter, SLOT(markBlockDirty(int,int,int))); + connect(doc, SIGNAL(contentsChange(int,int,int)), + highlighter, SLOT(modifyBlockAgain(int,int,int))); highlighter->ok = false; cursor.insertText("FooBar"); QVERIFY(highlighter->ok); diff --git a/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp b/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp index b3631d2016..d09a8e566b 100644 --- a/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp +++ b/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp @@ -112,12 +112,19 @@ void tst_QRegExpValidator::validate() QFETCH( int, state ); QRegExpValidator rv( 0 ); - QSignalSpy spy(&rv, SIGNAL(regExpChanged(const QRegExp&))); + QSignalSpy spy(&rv, SIGNAL(regExpChanged(QRegExp))); QSignalSpy changedSpy(&rv, SIGNAL(changed())); rv.setRegExp( QRegExp( rx ) ); - int dummy; - QCOMPARE( (int)rv.validate( value, dummy ), state ); + int pos = -1; + + QCOMPARE( (int)rv.validate( value, pos ), state ); + + if (state == QValidator::Invalid) + QCOMPARE(pos, value.length()); + else + QCOMPARE(pos, -1); // untouched on Acceptable or Intermediate + QCOMPARE(spy.count(), 1); QCOMPARE(changedSpy.count(), 1); } diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index fe3ebee226..76c047a076 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -138,7 +138,8 @@ Q_DECLARE_METATYPE(QNetworkRequest::CacheLoadControl) void tst_QAbstractNetworkCache::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index dcd13bb125..4a1b79bd08 100644 --- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -87,7 +87,8 @@ tst_QNetworkInterface::~tst_QNetworkInterface() void tst_QNetworkInterface::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp index de78f9afe7..226a477ac4 100644 --- a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp +++ b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp @@ -41,13 +41,14 @@ #include <qcoreapplication.h> +#include <qelapsedtimer.h> +#include <qeventloop.h> #include <qlocalsocket.h> #include <qlocalserver.h> -#include <qsystemsemaphore.h> +#include <qtimer.h> const QString serverName = QStringLiteral("qlocalsocket_autotest"); const QByteArray testData("test"); -QSystemSemaphore *semaphore = 0; bool runServer(int numberOfConnections) { @@ -61,11 +62,9 @@ bool runServer(int numberOfConnections) fprintf(stderr, "server: listen failed: %s\n", qPrintable(server->errorString())); return false; } - semaphore->release(); for (int i = 1; i <= numberOfConnections; ++i) { printf("server: wait for connection %d\n", i); if (!server->waitForNewConnection(30000)) { - semaphore->acquire(); fprintf(stderr, "server: waitForNewConnection failed: %s\n", qPrintable(server->errorString())); return false; @@ -74,31 +73,40 @@ bool runServer(int numberOfConnections) printf("server: writing \"%s\"\n", testData.data()); socket->write(testData); if (!socket->waitForBytesWritten()) { - semaphore->acquire(); fprintf(stderr, "server: waitForBytesWritten failed: %s\n", qPrintable(socket->errorString())); return false; } printf("server: data written\n"); if (socket->error() != QLocalSocket::UnknownSocketError) { - semaphore->acquire(); fprintf(stderr, "server: socket error %d\n", socket->error()); return false; } } - semaphore->acquire(); return true; } bool runClient() { - semaphore->acquire(); // wait until the server is up and running - semaphore->release(); - QLocalSocket socket; printf("client: connecting to \"%s\"\n", qPrintable(serverName)); - socket.connectToServer(serverName, QLocalSocket::ReadWrite); - if (!socket.waitForConnected()) { + QElapsedTimer connectTimer; + connectTimer.start(); + forever { + socket.connectToServer(serverName, QLocalSocket::ReadWrite); + if (socket.waitForConnected()) + break; + if (socket.error() == QLocalSocket::ServerNotFoundError) { + if (connectTimer.elapsed() > 5000) { + fprintf(stderr, "client: server not found. Giving up.\n"); + return false; + } + printf("client: server not found. Trying again...\n"); + QEventLoop eventLoop; + QTimer::singleShot(500, &eventLoop, SLOT(quit())); + eventLoop.exec(); + continue; + } fprintf(stderr, "client: waitForConnected failed: %s\n", qPrintable(socket.errorString())); return false; @@ -122,8 +130,6 @@ bool runClient() int main(int argc, char **argv) { QCoreApplication app(argc, argv); - QSystemSemaphore s("tst_qlocalsocket_socketprocess"); - semaphore = &s; if (argc < 2) return EXIT_FAILURE; if (strcmp(argv[1], "--server") == 0) { diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index d8df0323ca..43271813e1 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -167,7 +167,8 @@ void tst_QTcpServer::initTestCase_data() void tst_QTcpServer::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); #ifndef QT_NO_BEARERMANAGEMENT QNetworkConfigurationManager man; networkSession = new QNetworkSession(man.defaultConfiguration(), this); diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 5efd7f8cc9..7c21701474 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -166,7 +166,8 @@ void tst_QUdpSocket::initTestCase_data() void tst_QUdpSocket::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); } void tst_QUdpSocket::init() diff --git a/tests/auto/other/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp index 46e22917d0..7297c7a4ac 100644 --- a/tests/auto/other/atwrapper/atWrapper.cpp +++ b/tests/auto/other/atwrapper/atWrapper.cpp @@ -89,7 +89,7 @@ void atWrapper::downloadBaseline() QFtp ftp; - QObject::connect( &ftp, SIGNAL( listInfo( const QUrlInfo & ) ), this, SLOT( ftpMgetAddToList(const QUrlInfo & ) ) ); + QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpMgetAddToList(QUrlInfo)) ); //Making sure that the needed local directories exist. @@ -268,8 +268,8 @@ void atWrapper::ftpRmDir( QString dir ) //Hack to remove a populated directory. (caveat: containing only files and empty dirs, not recursive!) qDebug() << "Now removing directory: " << dir; QFtp ftp; - QObject::connect( &ftp, SIGNAL( listInfo( const QUrlInfo & ) ), this, SLOT( ftpRmDirAddToList(const QUrlInfo & ) ) ); - QObject::connect( &ftp, SIGNAL( done( bool ) ), this, SLOT( ftpRmDirDone( bool ) ) ); + QObject::connect( &ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(ftpRmDirAddToList(QUrlInfo)) ); + QObject::connect( &ftp, SIGNAL(done(bool)), this, SLOT(ftpRmDirDone(bool)) ); ftp.connectToHost( ftpHost ); ftp.login( ftpUser, ftpPass ); @@ -308,7 +308,7 @@ bool atWrapper::ftpMkDir( QString dir ) // IE: conveniance. QFtp ftp; - QSignalSpy commandSpy(&ftp, SIGNAL(commandFinished(int, bool))); + QSignalSpy commandSpy(&ftp, SIGNAL(commandFinished(int,bool))); ftp.connectToHost( ftpHost ); ftp.login( ftpUser, ftpPass ); diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp index 25539b52b4..f8338dc6fa 100644 --- a/tests/auto/other/modeltest/modeltest.cpp +++ b/tests/auto/other/modeltest/modeltest.cpp @@ -56,48 +56,48 @@ ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( if (!model) qFatal("%s: model must not be null", Q_FUNC_INFO); - connect ( model, SIGNAL ( columnsAboutToBeInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( columnsAboutToBeRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( columnsInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( columnsRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( dataChanged ( const QModelIndex &, const QModelIndex & ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( headerDataChanged ( Qt::Orientation, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( layoutAboutToBeChanged () ), this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( layoutChanged () ), this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( modelReset () ), this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( rowsInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); - connect ( model, SIGNAL ( rowsRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( runAllTests() ) ); + connect(model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(runAllTests()) ); + connect(model, SIGNAL(layoutChanged()), this, SLOT(runAllTests()) ); + connect(model, SIGNAL(modelReset()), this, SLOT(runAllTests()) ); + connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(runAllTests()) ); // Special checks for changes - connect ( model, SIGNAL ( layoutAboutToBeChanged() ), - this, SLOT ( layoutAboutToBeChanged() ) ); - connect ( model, SIGNAL ( layoutChanged() ), - this, SLOT ( layoutChanged() ) ); - - connect ( model, SIGNAL ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( rowsAboutToBeInserted ( const QModelIndex &, int, int ) ) ); - connect ( model, SIGNAL ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( rowsAboutToBeRemoved ( const QModelIndex &, int, int ) ) ); - connect ( model, SIGNAL ( rowsInserted ( const QModelIndex &, int, int ) ), - this, SLOT ( rowsInserted ( const QModelIndex &, int, int ) ) ); - connect ( model, SIGNAL ( rowsRemoved ( const QModelIndex &, int, int ) ), - this, SLOT ( rowsRemoved ( const QModelIndex &, int, int ) ) ); - connect ( model, SIGNAL ( dataChanged ( const QModelIndex &, const QModelIndex & ) ), - this, SLOT ( dataChanged ( const QModelIndex &, const QModelIndex & ) ) ); - connect ( model, SIGNAL ( headerDataChanged ( Qt::Orientation, int, int ) ), - this, SLOT ( headerDataChanged ( Qt::Orientation, int, int ) ) ); + connect(model, SIGNAL(layoutAboutToBeChanged()), + this, SLOT(layoutAboutToBeChanged()) ); + connect(model, SIGNAL(layoutChanged()), + this, SLOT(layoutChanged()) ); + + connect(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)) ); + connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)) ); + connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int)) ); + connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int)) ); + connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT(dataChanged(QModelIndex,QModelIndex)) ); + connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)), + this, SLOT(headerDataChanged(Qt::Orientation,int,int)) ); runAllTests(); } diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 5f1a41c158..e9c07a9db2 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -362,7 +362,8 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress() void tst_NetworkSelfTest::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); networkConfiguration = netConfMan->defaultConfiguration(); diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index ea13af0d2d..783ffc7a41 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -164,8 +164,8 @@ QDBusInterface *tst_QtAtSpi::getInterface(const QString &path, const QString &in void tst_QtAtSpi::initTestCase() { // Oxygen style creates many extra items, it's simply unusable here - qDebug() << "Using plastique style..."; - qApp->setStyle("plastique"); + qDebug() << "Using fusion style..."; + qApp->setStyle("fusion"); qApp->setApplicationName("tst_QtAtSpi app"); dbus = DBusConnection(); diff --git a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp index 4d91d33450..2443137ba5 100644 --- a/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp +++ b/tests/auto/other/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp @@ -128,7 +128,8 @@ tst_QNetworkAccessManager_And_QProgressDialog::tst_QNetworkAccessManager_And_QPr void tst_QNetworkAccessManager_And_QProgressDialog::initTestCase() { - QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); + if (!QtNetworkSettings::verifyTestNetworkSettings()) + QSKIP("No network test server available"); } void tst_QNetworkAccessManager_And_QProgressDialog::downloadCheck_data() diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 768de20937..8fae3f73aa 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -2048,7 +2048,7 @@ void tst_QSqlDatabase::eventNotificationIBase() q.exec(QString("DROP PROCEDURE %1").arg(procedureName)); q.exec(QString("CREATE PROCEDURE %1\nAS BEGIN\nPOST_EVENT '%1';\nEND;").arg(procedureName)); q.exec(QString("EXECUTE PROCEDURE %1").arg(procedureName)); - QSignalSpy spy(driver, SIGNAL(notification(const QString&))); + QSignalSpy spy(driver, SIGNAL(notification(QString))); db.commit(); // No notifications are posted until the transaction is committed. QTest::qWait(300); // Interbase needs some time to post the notification and call the driver callback. // This happends from another thread, and we have to process events in order for the @@ -2072,7 +2072,7 @@ void tst_QSqlDatabase::eventNotificationPSQL() QString payload = "payload"; QSqlDriver &driver=*(db.driver()); QVERIFY_SQL(driver, subscribeToNotification(procedureName)); - QSignalSpy spy(db.driver(), SIGNAL(notification(const QString&,QSqlDriver::NotificationSource,const QVariant&))); + QSignalSpy spy(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant))); query.exec(QString("NOTIFY \"%1\", '%2'").arg(procedureName).arg(payload)); QCoreApplication::processEvents(); QCOMPARE(spy.count(), 1); diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index 5fedf0ddbb..194c0a94a0 100644 --- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -235,7 +235,7 @@ void tst_QSqlQueryModel::removeColumn() DBTestModel model; model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); model.fetchMore(); - QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int))); + QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int))); QCOMPARE(model.columnCount(), 3); QVERIFY(model.removeColumn(0)); @@ -323,7 +323,7 @@ void tst_QSqlQueryModel::insertColumn() const QString nameColumn(isToUpper ? "NAME" : "name"); const QString titleColumn(isToUpper ? "TITLE" : "title"); - QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex, int, int))); + QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex,int,int))); QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry")); @@ -455,7 +455,7 @@ void tst_QSqlQueryModel::setHeaderData() model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); - QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); + QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar")); QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar")); QCOMPARE(spy.count(), 1); @@ -491,7 +491,7 @@ void tst_QSqlQueryModel::fetchMore() // If the driver doesn't return the query size fetchMore() causes the // model to grow and new signals are emitted - QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex, int, int))); + QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int))); if (!db.driver()->hasFeature(QSqlDriver::QuerySize)) { model.fetchMore(); int newRowCount = model.rowCount(); @@ -524,7 +524,7 @@ void tst_QSqlQueryModel::withSortFilterProxyModel() QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset())); QSignalSpy modelResetSpy(&model, SIGNAL(modelReset())); - QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int))); + QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int))); model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__), db)); view.scrollToBottom(); @@ -576,8 +576,8 @@ void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet() CHECK_DATABASE(db); QSqlQueryModel model; - QSignalSpy modelRowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int))); - QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int))); + QSignalSpy modelRowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int))); + QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int))); // The query's result set will be empty so no signals should be emitted! QSqlQuery query(db); diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 843ef7be42..0e9420fcbe 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -941,7 +941,7 @@ void tst_QSqlTableModel::removeRow() // headerDataChanged must be emitted by the model since the row won't vanish until select qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); - QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); + QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.removeRow(1)); QCOMPARE(headerDataChangedSpy.count(), 1); @@ -1028,7 +1028,7 @@ void tst_QSqlTableModel::removeRows() QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); - QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); + QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int))); QVERIFY(model.removeRows(0, 2, QModelIndex())); QCOMPARE(headerDataChangedSpy.count(), 2); QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1); @@ -1677,7 +1677,7 @@ void tst_QSqlTableModel::insertRecordsInLoop() QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset())); QSignalSpy modelResetSpy(&model, SIGNAL(modelReset())); - QSignalSpy spyRowsInserted(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int))); + QSignalSpy spyRowsInserted(&model, SIGNAL(rowsInserted(QModelIndex,int,int))); for (int i = 0; i < 10; i++) { QVERIFY(model.insertRecord(model.rowCount(), record)); QCOMPARE(spyRowsInserted.at(i).at(1).toInt(), i+3); // The table already contains three rows diff --git a/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro b/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro new file mode 100644 index 0000000000..e324c3f25f --- /dev/null +++ b/tests/auto/tools/qmake/testdata/pro_file_cache/pro_file_cache.pro @@ -0,0 +1,19 @@ +TEMPLATE = app +CONFIG -= debug_and_release_target + +SOURCES = + +content = "" +write_file("include.pri", content) +include(include.pri) + +content = "SOURCES = main.cpp" +write_file("include.pri", content) +include(include.pri) + +# Make sure that including the .pri file a second time will reload it properly +# off disk with the new content. +isEmpty(SOURCES): error(No sources defined) + +# Empty it again to silence qmake about non-existance sources +SOURCES = diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 6e2eb316b9..fbecb7db96 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -92,6 +92,7 @@ private slots: void includefunction(); void substitutes(); void project(); + void proFileCache(); private: TestCompiler test_compiler; @@ -546,5 +547,11 @@ void tst_qmake::project() QVERIFY( test_compiler.removeProject( workDir, "project" )); } +void tst_qmake::proFileCache() +{ + QString workDir = base_path + "/testdata/pro_file_cache"; + QVERIFY( test_compiler.qmake( workDir, "pro_file_cache" )); +} + QTEST_MAIN(tst_qmake) #include "tst_qmake.moc" diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index b4985df8d4..6b0888f68a 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -121,7 +121,9 @@ private slots: void task178897_minimumSize(); void task180459_lastDirectory_data(); void task180459_lastDirectory(); +#ifndef Q_OS_MAC void task227930_correctNavigationKeyboardBehavior(); +#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void task226366_lowerCaseHardDriveWindows(); #endif @@ -319,10 +321,11 @@ void tst_QFileDialog2::emptyUncPath() } #if !defined(QT_NO_CONTEXTMENU) && !defined(QT_NO_MENU) -struct MenuCloser { +struct MenuCloser : public QObject { QWidget *w; explicit MenuCloser(QWidget *w) : w(w) {} - void operator()() const + + void close() { QMenu *menu = qFindChild<QMenu*>(w); if (!menu) { @@ -342,7 +345,8 @@ static bool openContextMenu(QFileDialog &fd) QTimer timer; timer.setInterval(300); timer.setSingleShot(true); - QObject::connect(&timer, &QTimer::timeout, MenuCloser(&fd)); + MenuCloser closer(&fd); + QObject::connect(&timer, &QTimer::timeout, &closer, &MenuCloser::close); timer.start(); QContextMenuEvent cme(QContextMenuEvent::Mouse, QPoint(10, 10)); qApp->sendEvent(list->viewport(), &cme); // blocks until menu is closed again. @@ -593,11 +597,12 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog() } #endif +#ifndef Q_OS_MAC +// The following test implies the folder created will appear first in +// the list. On Mac files sorting depends on the locale and the order +// displayed cannot be known for sure. void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() { -#if defined (Q_OS_MAC) || defined (Q_OS_LINUX) - QSKIP("This test currently fails on Mac OS X and linux CI, see QTBUG-23602"); -#endif QDir current = QDir::currentPath(); current.mkdir("test"); current.cd("test"); @@ -633,6 +638,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() current.rmdir("test"); current.rmdir("test2"); } +#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 2d39ddaa2c..958128d58e 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -76,6 +76,9 @@ private slots: void defaultOkButton(); void setFont(); void task256466_wrongStyle(); + +private: + void runSlotWithFailsafeTimer(const char *member); }; tst_QFontDialog::tst_QFontDialog() @@ -124,12 +127,24 @@ void tst_QFontDialog::testGetFont() QVERIFY(ok); } +void tst_QFontDialog::runSlotWithFailsafeTimer(const char *member) +{ + // FailSafeTimer quits the nested event loop if the dialog closing doesn't do it. + QTimer failSafeTimer; + failSafeTimer.setInterval(4000); + failSafeTimer.setSingleShot(true); + connect(&failSafeTimer, SIGNAL(timeout()), qApp, SLOT(quit())); + failSafeTimer.start(); + + QTimer::singleShot(0, this, member); + qApp->exec(); + + // FailSafeTimer stops once it goes out of scope. +} void tst_QFontDialog::defaultOkButton() { - QTimer::singleShot(4000, qApp, SLOT(quit())); - QTimer::singleShot(0, this, SLOT(testGetFont())); - qApp->exec(); + runSlotWithFailsafeTimer(SLOT(testGetFont())); } void tst_QFontDialog::testSetFont() @@ -158,9 +173,7 @@ void tst_QFontDialog::setFont() while the font dialog was open. Task #27662 */ - QTimer::singleShot(4000, qApp, SLOT(quit())); - QTimer::singleShot(0, this, SLOT(testSetFont())); - qApp->exec(); + runSlotWithFailsafeTimer(SLOT(testSetFont())); } diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 17b574fab7..cd52977d61 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -53,9 +53,6 @@ #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) #include <QMacStyle> #endif -#if !defined(QT_NO_STYLE_CLEANLOOKS) -#include <QCleanlooksStyle> -#endif #define CONVENIENCE_FUNC_SYMS(func) \ { \ diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 99404bc113..60163f5037 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -50,8 +50,7 @@ #include <QToolButton> #include <QVBoxLayout> #include <QWizard> -#include <QStyle> -#include <QPlastiqueStyle> +#include <QWindowsStyle> #include <QTreeWidget> static QImage grabWidget(QWidget *window) @@ -104,7 +103,6 @@ private slots: void sideWidget(); // task-specific tests below me: - void task161660_buttonSpacing(); void task177716_disableCommitButton(); void task183550_stretchFactor(); void task161658_alignments(); @@ -2400,23 +2398,6 @@ void tst_QWizard::sideWidget() QVERIFY(wizard.sideWidget() == 0); } -void tst_QWizard::task161660_buttonSpacing() -{ -#ifndef QT_NO_STYLE_PLASTIQUE - QString origStyle = QApplication::style()->objectName(); - QApplication::setStyle(new QPlastiqueStyle); - QWizard wizard; - wizard.addPage(new QWizardPage); - wizard.show(); - const QAbstractButton *finishButton = wizard.button(QWizard::FinishButton); - const QAbstractButton *cancelButton = wizard.button(QWizard::CancelButton); - const int spacing = cancelButton->geometry().left() - finishButton->geometry().right() - 1; - QCOMPARE(spacing, wizard.style()->layoutSpacing( - QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal)); - QApplication::setStyle(origStyle); -#endif -} - class task177716_CommitPage : public QWizardPage { Q_OBJECT diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index 1ddee7714a..a0646591e8 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -234,6 +234,7 @@ void tst_QGraphicsEffect::boundingRect() // Install effect on QGraphicsItem. QRectF itemRect(0, 0, 100, 100); QGraphicsRectItem *item = new QGraphicsRectItem; + item->setPen(QPen(Qt::black, 0)); item->setRect(itemRect); item->setGraphicsEffect(effect); int margin = effect->margin(); @@ -265,16 +266,19 @@ void tst_QGraphicsEffect::boundingRect2() { CustomEffect *effect = new CustomEffect; QGraphicsRectItem *root = new QGraphicsRectItem; + root->setPen(QPen(Qt::black, 0)); root->setGraphicsEffect(effect); QGraphicsRectItem *child = new QGraphicsRectItem; QRectF childRect(0, 0, 100, 100); + child->setPen(QPen(Qt::black, 0)); child->setFlag(QGraphicsItem::ItemClipsChildrenToShape); child->setRect(childRect); child->setParentItem(root); QGraphicsRectItem *grandChild = new QGraphicsRectItem; QRectF grandChildRect(0, 0, 200, 200); + grandChild->setPen(QPen(Qt::black, 0)); grandChild->setRect(grandChildRect); grandChild->setParentItem(child); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index f78b40bdf0..490d79b270 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -491,6 +491,7 @@ void tst_QGraphicsItem::construction() switch (i) { case 0: item = new QGraphicsEllipseItem; + ((QGraphicsEllipseItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsEllipseItem::Type)); QCOMPARE(qgraphicsitem_cast<QGraphicsEllipseItem *>(item), (QGraphicsEllipseItem *)item); QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0); @@ -498,6 +499,7 @@ void tst_QGraphicsItem::construction() break; case 1: item = new QGraphicsLineItem; + ((QGraphicsLineItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsLineItem::Type)); QCOMPARE(qgraphicsitem_cast<QGraphicsLineItem *>(item), (QGraphicsLineItem *)item); QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0); @@ -505,6 +507,7 @@ void tst_QGraphicsItem::construction() break; case 2: item = new QGraphicsPathItem; + ((QGraphicsPathItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsPathItem::Type)); QCOMPARE(qgraphicsitem_cast<QGraphicsPathItem *>(item), (QGraphicsPathItem *)item); QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0); @@ -519,6 +522,7 @@ void tst_QGraphicsItem::construction() break; case 4: item = new QGraphicsPolygonItem; + ((QGraphicsPolygonItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsPolygonItem::Type)); QCOMPARE(qgraphicsitem_cast<QGraphicsPolygonItem *>(item), (QGraphicsPolygonItem *)item); QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)0); @@ -526,6 +530,7 @@ void tst_QGraphicsItem::construction() break; case 5: item = new QGraphicsRectItem; + ((QGraphicsRectItem *)item)->setPen(QPen(Qt::black, 0)); QCOMPARE(int(item->type()), int(QGraphicsRectItem::Type)); QCOMPARE(qgraphicsitem_cast<QGraphicsRectItem *>(item), (QGraphicsRectItem *)item); QCOMPARE(qgraphicsitem_cast<QGraphicsLineItem *>(item), (QGraphicsLineItem *)0); @@ -579,7 +584,9 @@ public: BoundingRectItem(QGraphicsItem *parent = 0) : QGraphicsRectItem(0, 0, parent ? 200 : 100, parent ? 200 : 100, parent) - {} + { + setPen(QPen(Qt::black, 0)); + } QRectF boundingRect() const { @@ -2204,6 +2211,7 @@ void tst_QGraphicsItem::setMatrix() QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>))); QRectF unrotatedRect(-12, -34, 56, 78); QGraphicsRectItem item(unrotatedRect, 0); + item.setPen(QPen(Qt::black, 0)); scene.addItem(&item); scene.update(scene.sceneRect()); QApplication::instance()->processEvents(); @@ -2277,6 +2285,7 @@ void tst_QGraphicsItem::zValue() void tst_QGraphicsItem::shape() { QGraphicsLineItem line(QLineF(-10, -10, 20, 20)); + line.setPen(QPen(Qt::black, 0)); // We unfortunately need this hack as QPainterPathStroker will set a width of 1.0 // if we pass a value of 0.0 to QPainterPathStroker::setWidth() @@ -2317,6 +2326,7 @@ void tst_QGraphicsItem::shape() QCOMPARE(line.shape(), p); QGraphicsRectItem rect(QRectF(-10, -10, 20, 20)); + rect.setPen(QPen(Qt::black, 0)); QPainterPathStroker ps1; ps1.setWidth(penWidthZero); path = QPainterPath(); @@ -2326,6 +2336,7 @@ void tst_QGraphicsItem::shape() QCOMPARE(rect.shape(), p); QGraphicsEllipseItem ellipse(QRectF(-10, -10, 20, 20)); + ellipse.setPen(QPen(Qt::black, 0)); QPainterPathStroker ps2; ps2.setWidth(ellipse.pen().widthF() <= 0.0 ? penWidthZero : ellipse.pen().widthF()); path = QPainterPath(); @@ -2339,6 +2350,7 @@ void tst_QGraphicsItem::shape() p = ps3.createStroke(path); p.addPath(path); QGraphicsPathItem pathItem(path); + pathItem.setPen(QPen(Qt::black, 0)); QCOMPARE(pathItem.shape(), p); QRegion region(QRect(0, 0, 300, 200)); @@ -2377,6 +2389,7 @@ void tst_QGraphicsItem::shape() QPolygonF poly; poly << QPointF(0, 0) << QPointF(10, 0) << QPointF(0, 10); QGraphicsPolygonItem polygon(poly); + polygon.setPen(QPen(Qt::black, 0)); path = QPainterPath(); path.addPolygon(poly); @@ -3393,6 +3406,12 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed() rect4->setParentItem(rect3); rect5->setParentItem(rect4); + rect->setPen(QPen(Qt::black, 0)); + rect2->setPen(QPen(Qt::black, 0)); + rect3->setPen(QPen(Qt::black, 0)); + rect4->setPen(QPen(Qt::black, 0)); + rect5->setPen(QPen(Qt::black, 0)); + rect2->setTransform(QTransform().translate(50, 50).rotate(45)); rect2->setPos(25, 25); rect3->setTransform(QTransform().translate(50, 50).rotate(45)); @@ -3425,6 +3444,9 @@ void tst_QGraphicsItem::childrenBoundingRect2() QGraphicsLineItem l2(100, 0, 100, 100, &box); QGraphicsLineItem l3(0, 0, 0, 100, &box); // Make sure lines (zero with/height) are included in the childrenBoundingRect. + l1.setPen(QPen(Qt::black, 0)); + l2.setPen(QPen(Qt::black, 0)); + l3.setPen(QPen(Qt::black, 0)); QCOMPARE(box.childrenBoundingRect(), QRectF(0, 0, 100, 100)); } @@ -3442,6 +3464,12 @@ void tst_QGraphicsItem::childrenBoundingRect3() rect4->setParentItem(rect3); rect5->setParentItem(rect4); + rect->setPen(QPen(Qt::black, 0)); + rect2->setPen(QPen(Qt::black, 0)); + rect3->setPen(QPen(Qt::black, 0)); + rect4->setPen(QPen(Qt::black, 0)); + rect5->setPen(QPen(Qt::black, 0)); + rect2->setTransform(QTransform().translate(50, 50).rotate(45)); rect2->setPos(25, 25); rect3->setTransform(QTransform().translate(50, 50).rotate(45)); @@ -3495,6 +3523,9 @@ void tst_QGraphicsItem::childrenBoundingRect5() QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 100, 100)); child->setParentItem(parent); + parent->setPen(QPen(Qt::black, 0)); + child->setPen(QPen(Qt::black, 0)); + QGraphicsView view(&scene); view.show(); @@ -4382,6 +4413,7 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsTextItem() void tst_QGraphicsItem::defaultItemTest_QGraphicsEllipseItem() { QGraphicsEllipseItem item; + item.setPen(QPen(Qt::black, 0)); QVERIFY(item.rect().isNull()); QVERIFY(item.boundingRect().isNull()); QVERIFY(item.shape().isEmpty()); @@ -6517,6 +6549,7 @@ void tst_QGraphicsItem::boundingRegion() QFETCH(QRegion, expectedRegion); QGraphicsLineItem item(line); + item.setPen(QPen(Qt::black, 0)); QCOMPARE(item.boundingRegionGranularity(), qreal(0.0)); item.setBoundingRegionGranularity(granularity); QCOMPARE(item.boundingRegionGranularity(), granularity); @@ -6980,6 +7013,7 @@ public: TransformDebugItem() : QGraphicsRectItem(QRectF(-10, -10, 20, 20)) { + setPen(QPen(Qt::black, 0)); setBrush(QColor(qrand() % 256, qrand() % 256, qrand() % 256)); } @@ -7047,7 +7081,9 @@ void tst_QGraphicsItem::sceneTransformCache() // parent is transformed. QGraphicsScene scene; QGraphicsRectItem *rect = scene.addRect(0, 0, 100, 100); + rect->setPen(QPen(Qt::black, 0)); QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100); + rect2->setPen(QPen(Qt::black, 0)); rect2->setParentItem(rect); rect2->rotate(90); rect->translate(0, 50); @@ -7071,9 +7107,11 @@ void tst_QGraphicsItem::sceneTransformCache() QGraphicsRectItem *rect3 = scene.addRect(0, 0, 100, 100); QGraphicsRectItem *rect4 = scene.addRect(0, 0, 100, 100); rect3->setPos(QPointF(10,10)); + rect3->setPen(QPen(Qt::black, 0)); rect4->setParentItem(rect3); rect4->setPos(QPointF(10,10)); + rect4->setPen(QPen(Qt::black, 0)); QCOMPARE(rect4->mapToScene(rect4->boundingRect().topLeft()), QPointF(20,20)); @@ -7084,9 +7122,11 @@ void tst_QGraphicsItem::sceneTransformCache() QGraphicsRectItem *rect5 = scene.addRect(0, 0, 100, 100); QGraphicsRectItem *rect6 = scene.addRect(0, 0, 100, 100); rect5->setPos(QPointF(20,20)); + rect5->setPen(QPen(Qt::black, 0)); rect6->setParentItem(rect5); rect6->setPos(QPointF(10,10)); + rect6->setPen(QPen(Qt::black, 0)); //test if rect6 transform is ok QCOMPARE(rect6->mapToScene(rect6->boundingRect().topLeft()), QPointF(30,30)); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index d39c65ab53..d69ea1d9f1 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -47,7 +47,7 @@ #include <qgraphicsscene.h> #include <qgraphicsview.h> #include <qapplication.h> -#include <qplastiquestyle.h> +#include <qwindowsstyle.h> class tst_QGraphicsLinearLayout : public QObject { Q_OBJECT @@ -152,11 +152,7 @@ void tst_QGraphicsLinearLayout::initTestCase() { // since the style will influence the results, we have to ensure // that the tests are run using the same style on all platforms -#if defined (Q_OS_WINCE) QApplication::setStyle(new QWindowsStyle); -#else - QApplication::setStyle(new QPlastiqueStyle); -#endif } // This will be called after the last test function is executed. diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp index 79a3c61462..bc091a08be 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <qgraphicsitem.h> +#include <qpen.h> Q_DECLARE_METATYPE(QPolygonF) @@ -170,6 +171,7 @@ void tst_QGraphicsPolygonItem::boundingRect() QFETCH(QRectF, boundingRect); SubQGraphicsPolygonItem item(polygon); + item.setPen(QPen(Qt::black, 0)); QCOMPARE(item.boundingRect(), boundingRect); } diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 883c47b26a..7a256972f2 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -434,8 +434,8 @@ void tst_QGraphicsProxyWidget::setWidget() #endif widget->setPalette(QPalette(Qt::magenta)); widget->setLayoutDirection(Qt::RightToLeft); - QCleanlooksStyle cleanlooksStyle; - widget->setStyle(&cleanlooksStyle); + QFusionStyle fusionStyle; + widget->setStyle(&fusionStyle); widget->setFont(QFont("Times")); widget->setVisible(true); QApplication::setActiveWindow(widget); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 90d21d6d95..a4aa2a6e41 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -322,7 +322,8 @@ void tst_QGraphicsScene::sceneRect() QCOMPARE(scene.sceneRect(), QRectF()); QCOMPARE(sceneRectChanged.count(), 0); - QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); + QGraphicsRectItem *item = scene.addRect(QRectF(0, 0, 10, 10)); + item->setPen(QPen(Qt::black, 0)); item->setPos(-5, -5); QCOMPARE(sceneRectChanged.count(), 0); @@ -458,7 +459,9 @@ void tst_QGraphicsScene::items() { QGraphicsScene scene; QGraphicsLineItem *l1 = scene.addLine(-5, 0, 5, 0); + l1->setPen(QPen(Qt::black, 0)); QGraphicsLineItem *l2 = scene.addLine(0, -5, 0, 5); + l2->setPen(QPen(Qt::black, 0)); QVERIFY(!l1->sceneBoundingRect().intersects(l2->sceneBoundingRect())); QVERIFY(!l2->sceneBoundingRect().intersects(l1->sceneBoundingRect())); QList<QGraphicsItem *> items; @@ -533,7 +536,9 @@ void tst_QGraphicsScene::itemsBoundingRect() foreach (QRectF rect, rects) { QPainterPath path; path.addRect(rect); - scene.addPath(path)->setMatrix(matrix); + QGraphicsPathItem *item = scene.addPath(path); + item->setPen(QPen(Qt::black, 0)); + item->setMatrix(matrix); } QCOMPARE(scene.itemsBoundingRect(), boundingRect); @@ -597,7 +602,8 @@ void tst_QGraphicsScene::items_QPointF() QPainterPath path; path.addRect(0, 0, rect.width(), rect.height()); - QGraphicsItem *item = scene.addPath(path); + QGraphicsPathItem *item = scene.addPath(path); + item->setPen(QPen(Qt::black, 0)); item->setZValue(n++); item->setPos(rect.topLeft()); addedItems << item; @@ -1170,6 +1176,9 @@ void tst_QGraphicsScene::addPath() QCOMPARE(path->pen(), QPen(Qt::red)); QCOMPARE(path->path(), p); QCOMPARE(path->brush(), QBrush(Qt::blue)); + + path->setPen(QPen(Qt::red, 0)); + QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)path); QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)path); QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)path); @@ -1222,6 +1231,9 @@ void tst_QGraphicsScene::addRect() QCOMPARE(rect->pen(), QPen(Qt::red)); QCOMPARE(rect->brush(), QBrush(Qt::blue)); QCOMPARE(rect->rect(), QRectF(-10, -10, 20, 20)); + + rect->setPen(QPen(Qt::red, 0)); + QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)rect); QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)rect); QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)rect); @@ -1397,7 +1409,7 @@ void tst_QGraphicsScene::clear() QGraphicsScene scene; scene.clear(); QVERIFY(scene.items().isEmpty()); - scene.addRect(0, 0, 100, 100); + scene.addRect(0, 0, 100, 100)->setPen(QPen(Qt::black, 0)); QCOMPARE(scene.sceneRect(), QRectF(0, 0, 100, 100)); scene.clear(); QVERIFY(scene.items().isEmpty()); @@ -2610,8 +2622,8 @@ void tst_QGraphicsScene::render() QGraphicsView view; QGraphicsScene scene(&view); - scene.addEllipse(QRectF(-10, -10, 20, 20), QPen(Qt::black), QBrush(Qt::white)); - scene.addEllipse(QRectF(-2, -7, 4, 4), QPen(Qt::black), QBrush(Qt::yellow))->setZValue(1); + scene.addEllipse(QRectF(-10, -10, 20, 20), QPen(Qt::black, 0), QBrush(Qt::white)); + scene.addEllipse(QRectF(-2, -7, 4, 4), QPen(Qt::black, 0), QBrush(Qt::yellow))->setZValue(1); QGraphicsPixmapItem *item = scene.addPixmap(pix); item->setZValue(2); item->setOffset(QPointF(3, 3)); @@ -2808,6 +2820,7 @@ void tst_QGraphicsScene::update() QGraphicsScene scene; QGraphicsRectItem *rect = new QGraphicsRectItem(0, 0, 100, 100); + rect->setPen(QPen(Qt::black, 0)); scene.addItem(rect); qApp->processEvents(); rect->setPos(-100, -100); @@ -3484,6 +3497,7 @@ void tst_QGraphicsScene::task176178_itemIndexMethodBreaksSceneRect() QGraphicsScene scene; scene.setItemIndexMethod(QGraphicsScene::NoIndex); QGraphicsRectItem *rect = new QGraphicsRectItem; + rect->setPen(QPen(Qt::black, 0)); rect->setRect(0,0,100,100); scene.addItem(rect); QCOMPARE(scene.sceneRect(), rect->rect()); @@ -3513,11 +3527,11 @@ void tst_QGraphicsScene::task250680_childClip() { QGraphicsRectItem *clipper = new QGraphicsRectItem; clipper->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - clipper->setPen(QPen(Qt::green)); + clipper->setPen(QPen(Qt::green, 0)); clipper->setRect(200, 200, 640, 480); QGraphicsRectItem *rect = new QGraphicsRectItem(clipper); - rect->setPen(QPen(Qt::red)); + rect->setPen(QPen(Qt::red, 0)); rect->setBrush(QBrush(QColor(255, 0, 0, 75))); rect->setPos(320, 240); rect->setRect(-25, -25, 50, 50); @@ -3662,6 +3676,7 @@ void tst_QGraphicsScene::changedSignal() view = new QGraphicsView(&scene); QGraphicsRectItem *rect = new QGraphicsRectItem(0, 0, 10, 10); + rect->setPen(QPen(Qt::black, 0)); scene.addItem(rect); QCOMPARE(cl.changes.size(), 0); @@ -4246,13 +4261,13 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid() // first add the blue rect QGraphicsRectItem* const item1 = new QGraphicsRectItem(QRect( 10, 10, 10, 10 )); - item1->setPen(QColor(Qt::blue)); + item1->setPen(QPen(Qt::blue, 0)); item1->setBrush(Qt::blue); scene2.addItem(item1); // then add the red rect QGraphicsRectItem* const item2 = new QGraphicsRectItem(5, 5, 10, 10); - item2->setPen(QColor(Qt::red)); + item2->setPen(QPen(Qt::red, 0)); item2->setBrush(Qt::red); scene2.addItem(item2); diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index 70ebd3c8a7..593fa4e2ef 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp @@ -132,7 +132,7 @@ void tst_QGraphicsSceneIndex::overlappedItems() for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) - scene.addRect(i*50, j*50, 200, 200); + scene.addRect(i*50, j*50, 200, 200)->setPen(QPen(Qt::black, 0)); QCOMPARE(scene.items(QPointF(5, 5)).count(), 1); QCOMPARE(scene.items(QPointF(55, 55)).count(), 4); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 474ac47ea1..80de2da975 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -55,9 +55,6 @@ #if !defined(QT_NO_STYLE_WINDOWS) #include <QtWidgets/QWindowsStyle> #endif -#if !defined(QT_NO_STYLE_PLASTIQUE) -#include <QtWidgets/QPlastiqueStyle> -#endif #include <QtGui/QPainterPath> #include <QtWidgets/QRubberBand> #include <QtWidgets/QScrollBar> @@ -542,6 +539,7 @@ void tst_QGraphicsView::sceneRect() QCOMPARE(view.sceneRect(), QRectF()); QGraphicsScene scene; QGraphicsRectItem *item = scene.addRect(QRectF(-100, -100, 100, 100)); + item->setPen(QPen(Qt::black, 0)); view.setScene(&scene); @@ -1510,6 +1508,7 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust() QGraphicsScene scene(-100, -100, 200, 200); CountPaintItem *rect = new CountPaintItem(QRectF(-50, -50, 100, 100)); + rect->setPen(QPen(Qt::black, 0)); scene.addItem(rect); QGraphicsView view(&scene); @@ -2509,8 +2508,8 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - dirtyPainter = (painter->pen().width() != 0); - painter->setPen(QPen(Qt::black, 1.0)); + dirtyPainter = (painter->pen().color() != Qt::black); + painter->setPen(Qt::red); } }; @@ -2603,8 +2602,13 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() MyScene scene; // Add transformed dummy items to make sure the painter's worldTransform() is changed in drawItems. - scene.addRect(0, 0, 20, 20)->setTransform(QTransform::fromScale(2, 2)); - scene.addRect(50, 50, 20, 20)->setTransform(QTransform::fromTranslate(200, 200)); + QGraphicsRectItem *rectA = scene.addRect(0, 0, 20, 20); + QGraphicsRectItem *rectB = scene.addRect(50, 50, 20, 20); + + rectA->setTransform(QTransform::fromScale(2, 2)); + rectA->setPen(QPen(Qt::black, 0)); + rectB->setTransform(QTransform::fromTranslate(200, 200)); + rectB->setPen(QPen(Qt::black, 0)); foreach (QGraphicsItem *item, scene.items()) item->setOpacity(0.6); @@ -2763,16 +2767,10 @@ void tst_QGraphicsView::scrollBarRanges() view.setFrameStyle(useStyledPanel ? QFrame::StyledPanel : QFrame::NoFrame); if (useMotif) { -#if !defined(QT_NO_STYLE_WINDOWS) view.setStyle(new FauxMotifStyle); -#else - QSKIP("No Windows style compiled."); -#endif } else { -#if defined(Q_OS_WINCE) +#if !defined(QT_NO_STYLE_WINDOWS) view.setStyle(new QWindowsStyle); -#elif !defined(QT_NO_STYLE_PLASTIQUE) - view.setStyle(new QPlastiqueStyle); #endif } view.setStyleSheet(" "); // enables style propagation ;-) @@ -3284,9 +3282,7 @@ void tst_QGraphicsView::scrollAfterResize_data() QTest::addColumn<QTransform>("x2"); QTest::addColumn<QTransform>("x3"); -#if !defined(QT_NO_STYLE_PLASTIQUE) - QPlastiqueStyle style; -#elif !defined(QT_NO_STYLE_WINDOWS) +#if !defined(QT_NO_STYLE_WINDOWS) QWindowsStyle style; #else QCommonStyle style; @@ -3315,9 +3311,7 @@ void tst_QGraphicsView::scrollAfterResize() QFETCH(QTransform, x2); QFETCH(QTransform, x3); -#if !defined(QT_NO_STYLE_PLASTIQUE) - QPlastiqueStyle style; -#elif !defined(QT_NO_STYLE_WINDOWS) +#if !defined(QT_NO_STYLE_WINDOWS) QWindowsStyle style; #else QCommonStyle style; @@ -3367,10 +3361,11 @@ void tst_QGraphicsView::moveItemWhileScrolling() setScene(new QGraphicsScene(0, 0, 1000, 1000)); rect = scene()->addRect(0, 0, 10, 10); rect->setPos(50, 50); + rect->setPen(QPen(Qt::black, 0)); painted = false; } QRegion lastPaintedRegion; - QGraphicsItem *rect; + QGraphicsRectItem *rect; bool painted; void waitForPaintEvent() { @@ -4331,25 +4326,31 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() view.show(); qApp->setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - QPoint mouseViewPos(20, 20); - sendMouseMove(view.viewport(), mouseViewPos); + // This is highly unstable (observed to pass on Windows and some Linux configurations). +#ifndef Q_OS_MAC + for (int i = 0; i < 4; ++i) { + QPoint mouseViewPos(20, 20); + sendMouseMove(view.viewport(), mouseViewPos); - QPointF mouseScenePos = view.mapToScene(mouseViewPos); - view.setTransform(QTransform().scale(5, 5).rotate(5, Qt::ZAxis), true); + QPointF mouseScenePos = view.mapToScene(mouseViewPos); + view.setTransform(QTransform().scale(5, 5).rotate(5, Qt::ZAxis), true); - QPointF newMouseScenePos = view.mapToScene(mouseViewPos); + qreal slack = 1; - qreal slack = 1; + QPointF newMouseScenePos = view.mapToScene(mouseViewPos); - const qreal dx = qAbs(newMouseScenePos.x() - mouseScenePos.x()); - const qreal dy = qAbs(newMouseScenePos.y() - mouseScenePos.y()); - const QByteArray message = QString::fromLatin1("QTBUG-22455, distance: dx=%1, dy=%2 slack=%3 (%4)."). - arg(dx).arg(dy).arg(slack).arg(qApp->style()->metaObject()->className()).toLocal8Bit(); - // This is highly unstable (observed to pass on Windows and some Linux configurations). -#ifdef Q_OS_MAC - QEXPECT_FAIL("", message.constData(), Abort); + const qreal dx = qAbs(newMouseScenePos.x() - mouseScenePos.x()); + const qreal dy = qAbs(newMouseScenePos.y() - mouseScenePos.y()); + const QByteArray message = QString::fromLatin1("QTBUG-22455, distance: dx=%1, dy=%2 slack=%3 (%4)."). + arg(dx).arg(dy).arg(slack).arg(qApp->style()->metaObject()->className()).toLocal8Bit(); + if (i == 9 || (dx < slack && dy < slack)) { + QVERIFY2(dx < slack && dy < slack, message.constData()); + break; + } + + QTest::qWait(100); + } #endif - QVERIFY2(dx < slack && dy < slack, message.constData()); } void tst_QGraphicsView::task259503_scrollingArtifacts() diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 1987a37306..03814bcbf8 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -47,11 +47,13 @@ #include <qgraphicsview.h> #include <qstyleoption.h> #include <qgraphicslinearlayout.h> -#include <qcleanlooksstyle.h> #include <qlineedit.h> #include <qboxlayout.h> #include <qaction.h> #include <qwidgetaction.h> +#ifndef Q_NO_STYLE_FUSION +#include <qfusionstyle.h> +#endif #include "../../../qtest-config.h" @@ -1397,21 +1399,22 @@ void tst_QGraphicsWidget::setStyle_data() { QTest::addColumn<QString>("style"); QTest::newRow("null") << ""; - QTest::newRow("cleanlooks") << "QCleanlooksStyle"; + QTest::newRow("fusion") << "QFusionStyle"; } // void setStyle(QStyle* style) public void tst_QGraphicsWidget::setStyle() { +#ifndef Q_NO_STYLE_FUSION SubQGraphicsWidget widget; - QCleanlooksStyle cleanlooksStyle; + QFusionStyle fusionStyle; int oldEventCounts = widget.eventCount; QFETCH(QString, style); - if (style == "QCleanlooksStyle") { - widget.setStyle(&cleanlooksStyle); - QCOMPARE(widget.style(), static_cast<QStyle*>(&cleanlooksStyle)); + if (style == "QFusionStyle") { + widget.setStyle(&fusionStyle); + QCOMPARE(widget.style(), static_cast<QStyle*>(&fusionStyle)); } else { widget.setStyle(0); QVERIFY(widget.style() != (QStyle *)0); @@ -1421,6 +1424,7 @@ void tst_QGraphicsWidget::setStyle() // cleanup widget.setStyle(0); +#endif } void tst_QGraphicsWidget::setTabOrder_data() diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 7f3e2295b2..85ee7144c9 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -357,7 +357,7 @@ void tst_QDataWidgetMapper::comboBox() readWriteBox.addItem("read write item 1"); readWriteBox.addItem("read write item 2"); - // populat the combo boxes with data + // populate the combo boxes with data mapper.addMapping(&readOnlyBox, 0, "currentIndex"); mapper.addMapping(&readWriteBox, 1, "currentText"); mapper.toFirst(); diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 9f3cd0a3e1..8458ca78fb 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -55,6 +55,11 @@ #include <QtWidgets/QScrollBar> #include <QtWidgets/QDialog> #include <QtWidgets/QStyledItemDelegate> + +#if !defined(QT_NO_STYLE_WINDOWS) +#include <qwindowsstyle.h> +#endif // QT_NO_STYLE_WINDOWS + #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) # include <windows.h> # include <QtGui/QGuiApplication> @@ -2190,6 +2195,11 @@ void tst_QListView::taskQTBUG_21804_hiddenItemsAndScrollingWithKeys() // create listview QListView lv; +#if !defined(QT_NO_STYLE_WINDOWS) + // The test fails on Fusion style + // See https://bugreports.qt-project.org/browse/QTBUG-27675 + lv.setStyle(new QWindowsStyle()); +#endif lv.setFlow(static_cast<QListView::Flow>(flow)); lv.setSpacing(spacing); lv.setModel(&model); diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 2fbd90a3fe..2bccb03845 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -199,6 +199,7 @@ private slots: void task234926_setHeaderSorting(); void changeHeaderData(); + void viewOptions(); }; // Testing get/set functions @@ -477,6 +478,10 @@ public: return QTableView::sizeHintForRow(row); } + QStyleOptionViewItem viewOptions() const { + return QTableView::viewOptions(); + } + bool checkSignalOrder; public slots: void currentChanged(QModelIndex , QModelIndex ) { @@ -4074,5 +4079,12 @@ void tst_QTableView::taskQTBUG_10169_sizeHintForRow() QCOMPARE(orderedHeight, reorderedHeight); } +void tst_QTableView::viewOptions() +{ + QtTestTableView view; + QStyleOptionViewItem options = view.viewOptions(); + QVERIFY(options.showDecorationSelected); +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 6ebeea218f..ade2140b62 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -50,7 +50,6 @@ #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QPushButton> -#include <QtWidgets/QPlastiqueStyle> #include <QtWidgets/QWindowsStyle> #include <QStyleFactory> @@ -403,7 +402,7 @@ void tst_QFormLayout::setFormStyle() QFormLayout layout; widget.setLayout(&layout); -#ifndef QT_NO_STYLE_PLASTIQUE +#if 0 // QT_NO_STYLE_PLASTIQUE widget.setStyle(new QPlastiqueStyle()); QVERIFY(layout.labelAlignment() == Qt::AlignRight); diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 6bbcc4d1c1..1bb87b1f32 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -55,7 +55,6 @@ #include <qtoolbutton.h> #include <qtoolbar.h> -#include <qplastiquestyle.h> #include <qwindowsstyle.h> #include <qcommonstyle.h> #include <qproxystyle.h> @@ -72,7 +71,9 @@ #include <qmdiarea.h> #include <qscrollarea.h> -#include <QCleanlooksStyle> +#ifndef Q_NO_STYLE_FUSION +#include <qfusionstyle.h> +#endif #ifdef Q_OS_MAC #include <QMacStyle> @@ -116,27 +117,24 @@ private: private slots: void drawItemPixmap(); void initTestCase(); + void cleanup(); void cleanupTestCase(); void init(); - void cleanup(); -#ifndef QT_NO_STYLE_PLASTIQUE - void testPlastiqueStyle(); +#ifndef QT_NO_STYLE_FUSION + void testFusionStyle(); #endif void testWindowsStyle(); #ifndef QT_NO_STYLE_WINDOWSXP void testWindowsXPStyle(); #endif void testWindowsVistaStyle(); -#ifndef QT_NO_STYLE_CLEANLOOKS - void testCleanlooksStyle(); -#endif void testMacStyle(); void testWindowsCEStyle(); void testWindowsMobileStyle(); void testStyleFactory(); void testProxyStyle(); void pixelMetric(); -#if !defined(QT_NO_STYLE_PLASTIQUE) && !defined(QT_NO_STYLE_WINDOWS) +#if !defined(QT_NO_STYLE_WINDOWS) void progressBarChangeStyle(); #endif void defaultFont(); @@ -187,11 +185,8 @@ void tst_QStyle::cleanupTestCase() void tst_QStyle::testStyleFactory() { QStringList keys = QStyleFactory::keys(); -#ifndef QT_NO_STYLE_CLEANLOOKS - QVERIFY(keys.contains("Cleanlooks")); -#endif -#ifndef QT_NO_STYLE_PLASTIQUE - QVERIFY(keys.contains("Plastique")); +#ifndef QT_NO_STYLE_FUSION + QVERIFY(keys.contains("Fusion")); #endif #ifndef QT_NO_STYLE_WINDOWS QVERIFY(keys.contains("Windows")); @@ -366,21 +361,12 @@ bool tst_QStyle::testScrollBarSubControls(QStyle* style) return true; } -#ifndef QT_NO_STYLE_PLASTIQUE -void tst_QStyle::testPlastiqueStyle() +#ifndef QT_NO_STYLE_FUSION +void tst_QStyle::testFusionStyle() { - QPlastiqueStyle pstyle; - QVERIFY(testAllFunctions(&pstyle)); - lineUpLayoutTest(&pstyle); -} -#endif - -#ifndef QT_NO_STYLE_CLEANLOOKS -void tst_QStyle::testCleanlooksStyle() -{ - QCleanlooksStyle cstyle; - QVERIFY(testAllFunctions(&cstyle)); - lineUpLayoutTest(&cstyle); + QFusionStyle fstyle; + QVERIFY(testAllFunctions(&fstyle)); + lineUpLayoutTest(&fstyle); } #endif @@ -653,14 +639,14 @@ void tst_QStyle::pixelMetric() delete style; } -#if !defined(QT_NO_STYLE_PLASTIQUE) && !defined(QT_NO_STYLE_WINDOWS) +#if !defined(QT_NO_STYLE_WINDOWS) void tst_QStyle::progressBarChangeStyle() { //test a crashing situation (task 143530) //where changing the styles and deleting a progressbar would crash QWindowsStyle style1; - QPlastiqueStyle style2; + QFusionStyle style2; QProgressBar *progress=new QProgressBar; progress->setStyle(&style1); diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 4b2125ad6a..29846d619a 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -44,7 +44,7 @@ #include <QtTest/QtTest> #include <QtDebug> #include <QMetaObject> -#include <QPlastiqueStyle> +#include <QFusionStyle> #include <private/qstylesheetstyle_p.h> @@ -1589,7 +1589,7 @@ class ChangeEventWidget : public QWidget static bool recurse = false; if (!recurse) { recurse = true; - QStyle *style = new QPlastiqueStyle; + QStyle *style = new QFusionStyle style->setParent(this); setStyle(style); recurse = false; diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index bd16085639..11e9a9d82f 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -72,8 +72,8 @@ #include <qstringlist.h> #include <qvalidator.h> #include <qcompleter.h> -#ifndef QT_NO_STYLE_CLEANLOOKS -#include <qcleanlooksstyle.h> +#ifndef QT_NO_STYLE_FUSION +#include <qfusionstyle.h> #endif #include <qabstractitemview.h> #include <qstyleditemdelegate.h> @@ -133,7 +133,7 @@ private slots: void itemListPosition(); void separatorItem_data(); void separatorItem(); -#ifndef QT_NO_STYLE_CLEANLOOKS +#ifndef QT_NO_STYLE_FUSION void task190351_layout(); void task191329_size(); #endif @@ -1942,12 +1942,12 @@ void tst_QComboBox::separatorItem() } } -// This test requires the Cleanlooks style -#ifndef QT_NO_STYLE_CLEANLOOKS +// This test requires the Fusionstyle +#ifndef QT_NO_STYLE_FUSION void tst_QComboBox::task190351_layout() { const QString oldStyle = QApplication::style()->objectName(); - QApplication::setStyle(new QCleanlooksStyle); + QApplication::setStyle(new QFusionStyle); QComboBox listCombo; QListWidget *list = new QListWidget(); @@ -2007,12 +2007,12 @@ void tst_QComboBox::task166349_setEditableOnReturn() QCOMPARE(QLatin1String("two1"), comboBox.itemText(comboBox.count() - 1)); } -// This test requires the Cleanlooks style. -#ifndef QT_NO_STYLE_CLEANLOOKS +// This test requires the Fusion style. +#ifndef QT_NO_STYLE_FUSION void tst_QComboBox::task191329_size() { const QString oldStyle = QApplication::style()->objectName(); - QApplication::setStyle(new QCleanlooksStyle); + QApplication::setStyle(new QFusionStyle); QComboBox tableCombo; int rows; diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 898f566995..12cc4e2d10 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -1010,7 +1010,7 @@ void tst_QDoubleSpinBox::task221221() QDoubleSpinBox spin; QTest::keyClick(&spin, Qt::Key_1); spin.show(); - QVERIFY(spin.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&spin)); QCOMPARE(spin.text(), QLatin1String("1.00")); } @@ -1026,7 +1026,7 @@ void tst_QDoubleSpinBox::task255471_decimalsValidation() spinBox.setMaximum(12); spinBox.show(); - QTRY_VERIFY(spinBox.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&spinBox)); spinBox.setFocus(); QTRY_VERIFY(spinBox.hasFocus()); diff --git a/tests/auto/widgets/widgets/qgroupbox/qgroupbox.pro b/tests/auto/widgets/widgets/qgroupbox/qgroupbox.pro index 1da41197ca..7c5a4d30e5 100644 --- a/tests/auto/widgets/widgets/qgroupbox/qgroupbox.pro +++ b/tests/auto/widgets/widgets/qgroupbox/qgroupbox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qgroupbox QT += widgets testlib SOURCES += tst_qgroupbox.cpp diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 013d52253a..7024da9dd4 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -299,10 +299,8 @@ void tst_QProgressBar::task245201_testChangeStyleAndDelete_data() QTest::addColumn<QString>("style1_str"); QTest::addColumn<QString>("style2_str"); - QTest::newRow("plastique-windows") << QString::fromLatin1("plastique") << QString::fromLatin1("windows"); - QTest::newRow("mlotif-windows") << QString::fromLatin1("motif") << QString::fromLatin1("windows"); - QTest::newRow("cleanlooks-cde") << QString::fromLatin1("cleanlooks") << QString::fromLatin1("cde"); - QTest::newRow("gtk-plastique") << QString::fromLatin1("gtk") << QString::fromLatin1("plastique"); + QTest::newRow("fusion-windows") << QString::fromLatin1("fusion") << QString::fromLatin1("windows"); + QTest::newRow("gtk-fusion") << QString::fromLatin1("gtk") << QString::fromLatin1("fusion"); } void tst_QProgressBar::task245201_testChangeStyleAndDelete() diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 30cc6a4294..9d16393861 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -564,17 +564,14 @@ void tst_QPushButton::sizeHint_data() #if !defined(QT_NO_STYLE_WINDOWS) QTest::newRow("windows") << QString::fromLatin1("windows"); #endif -#if !defined(QT_NO_STYLE_CLEANLOOKS) - QTest::newRow("cleanlooks") << QString::fromLatin1("cleanlooks"); -#endif #if !defined(QT_NO_STYLE_GTK) QTest::newRow("gtk") << QString::fromLatin1("gtk"); #endif #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) QTest::newRow("mac") << QString::fromLatin1("mac"); #endif -#if !defined(QT_NO_STYLE_PLASTIQUE) - QTest::newRow("plastique") << QString::fromLatin1("plastique"); +#if !defined(QT_NO_STYLE_FUSION) + QTest::newRow("fusion") << QString::fromLatin1("fusion"); #endif #if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSXP) QTest::newRow("windowsxp") << QString::fromLatin1("windowsxp"); diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index beea5f3052..6e1abb9fa9 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -135,6 +135,8 @@ private slots: void sizeHint(); + void integerOverflow(); + void taskQTBUG_5008_textFromValueAndValidate(); public slots: @@ -1014,6 +1016,35 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); } +void tst_QSpinBox::integerOverflow() +{ + QSpinBox sb; + sb.setRange(INT_MIN, INT_MAX); + + sb.setValue(INT_MAX - 1); + sb.stepUp(); + QCOMPARE(sb.value(), INT_MAX); + sb.stepUp(); + QCOMPARE(sb.value(), INT_MAX); + + sb.setValue(INT_MIN + 1); + sb.stepDown(); + QCOMPARE(sb.value(), INT_MIN); + sb.stepDown(); + QCOMPARE(sb.value(), INT_MIN); + + sb.setValue(0); + QCOMPARE(sb.value(), 0); + sb.setSingleStep(INT_MAX); + sb.stepUp(); + QCOMPARE(sb.value(), INT_MAX); + sb.stepDown(); + QCOMPARE(sb.value(), 0); + sb.stepDown(); + QCOMPARE(sb.value(), INT_MIN + 1); + sb.stepDown(); + QCOMPARE(sb.value(), INT_MIN); +} QTEST_MAIN(tst_QSpinBox) #include "tst_qspinbox.moc" |