Updated corelib's unit tests to use QSignalSpy's functor constructor
The intent is to provide compile time validation of signals and to help detect signal overloading in the future. Change-Id: I9d5d46ed4b70c5d0cd407deb5928b1e76d37e007 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
fe70367fe0
commit
43f52f93b5
@ -137,7 +137,7 @@ private:
|
|||||||
void tst_QAnimationGroup::emptyGroup()
|
void tst_QAnimationGroup::emptyGroup()
|
||||||
{
|
{
|
||||||
QSequentialAnimationGroup group;
|
QSequentialAnimationGroup group;
|
||||||
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
|
||||||
QVERIFY(groupStateChangedSpy.isValid());
|
QVERIFY(groupStateChangedSpy.isValid());
|
||||||
|
|
||||||
QCOMPARE(group.state(), QAnimationGroup::Stopped);
|
QCOMPARE(group.state(), QAnimationGroup::Stopped);
|
||||||
|
@ -256,10 +256,10 @@ void tst_QParallelAnimationGroup::stateChanged()
|
|||||||
group.addAnimation(anim3);
|
group.addAnimation(anim3);
|
||||||
group.addAnimation(anim4);
|
group.addAnimation(anim4);
|
||||||
|
|
||||||
QSignalSpy spy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy1(anim1, &TestAnimation::stateChanged);
|
||||||
QSignalSpy spy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy2(anim2, &TestAnimation::stateChanged);
|
||||||
QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy3(anim3, &TestAnimation::stateChanged);
|
||||||
QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy4(anim4, &TestAnimation::stateChanged);
|
||||||
|
|
||||||
QVERIFY(spy1.isValid());
|
QVERIFY(spy1.isValid());
|
||||||
QVERIFY(spy2.isValid());
|
QVERIFY(spy2.isValid());
|
||||||
@ -434,8 +434,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
|
|||||||
anim.setEndValue(100);
|
anim.setEndValue(100);
|
||||||
anim.setDuration(200);
|
anim.setDuration(200);
|
||||||
|
|
||||||
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy groupStateChangedSpy(&group, &QParallelAnimationGroup::stateChanged);
|
||||||
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
|
||||||
|
|
||||||
QVERIFY(groupStateChangedSpy.isValid());
|
QVERIFY(groupStateChangedSpy.isValid());
|
||||||
QVERIFY(childStateChangedSpy.isValid());
|
QVERIFY(childStateChangedSpy.isValid());
|
||||||
@ -601,8 +601,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
|
|||||||
anim2.setEndValue(100);
|
anim2.setEndValue(100);
|
||||||
anim2.setDuration(200);
|
anim2.setDuration(200);
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
|
||||||
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
|
||||||
|
|
||||||
QVERIFY(stateChangedSpy1.isValid());
|
QVERIFY(stateChangedSpy1.isValid());
|
||||||
QVERIFY(stateChangedSpy2.isValid());
|
QVERIFY(stateChangedSpy2.isValid());
|
||||||
@ -669,20 +669,20 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
|
|||||||
anim3.setEndValue(100);
|
anim3.setEndValue(100);
|
||||||
anim3.setDuration(10);
|
anim3.setDuration(10);
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy1(&anim1, &TestAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy1(&anim1, SIGNAL(finished()));
|
QSignalSpy finishedSpy1(&anim1, &TestAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(stateChangedSpy1.isValid());
|
QVERIFY(stateChangedSpy1.isValid());
|
||||||
QVERIFY(finishedSpy1.isValid());
|
QVERIFY(finishedSpy1.isValid());
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy2(&anim2, &TestAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy2(&anim2, SIGNAL(finished()));
|
QSignalSpy finishedSpy2(&anim2, &TestAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(stateChangedSpy2.isValid());
|
QVERIFY(stateChangedSpy2.isValid());
|
||||||
QVERIFY(finishedSpy2.isValid());
|
QVERIFY(finishedSpy2.isValid());
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy3(&anim3, &TestAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy3(&anim3, SIGNAL(finished()));
|
QSignalSpy finishedSpy3(&anim3, &TestAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(stateChangedSpy3.isValid());
|
QVERIFY(stateChangedSpy3.isValid());
|
||||||
QVERIFY(finishedSpy3.isValid());
|
QVERIFY(finishedSpy3.isValid());
|
||||||
@ -760,7 +760,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
|
|||||||
loopsForever.setDuration(100);
|
loopsForever.setDuration(100);
|
||||||
loopsForever.setLoopCount(-1);
|
loopsForever.setLoopCount(-1);
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy(&anim1, &TestAnimation::stateChanged);
|
||||||
QVERIFY(stateChangedSpy.isValid());
|
QVERIFY(stateChangedSpy.isValid());
|
||||||
|
|
||||||
group.addAnimation(&anim1);
|
group.addAnimation(&anim1);
|
||||||
@ -968,7 +968,7 @@ void tst_QParallelAnimationGroup::pauseResume()
|
|||||||
{
|
{
|
||||||
QParallelAnimationGroup group;
|
QParallelAnimationGroup group;
|
||||||
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
|
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
|
||||||
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy(anim, &TestAnimation::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QCOMPARE(group.duration(), 250);
|
QCOMPARE(group.duration(), 250);
|
||||||
group.start();
|
group.start();
|
||||||
|
@ -230,9 +230,9 @@ void tst_QPropertyAnimation::statesAndSignals()
|
|||||||
anim = new DummyPropertyAnimation;
|
anim = new DummyPropertyAnimation;
|
||||||
anim->setDuration(100);
|
anim->setDuration(100);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
|
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
|
||||||
QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int)));
|
QSignalSpy currentLoopSpy(anim, &QPropertyAnimation::currentLoopChanged);
|
||||||
|
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
@ -311,8 +311,8 @@ void tst_QPropertyAnimation::deletion1()
|
|||||||
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth");
|
QPointer<QPropertyAnimation> anim = new QPropertyAnimation(object, "minimumWidth");
|
||||||
|
|
||||||
//test that the animation is deleted correctly depending of the deletion flag passed in start()
|
//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.data(), &QPropertyAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
|
QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
anim->setStartValue(10);
|
anim->setStartValue(10);
|
||||||
@ -355,8 +355,8 @@ void tst_QPropertyAnimation::deletion2()
|
|||||||
anim->setEndValue(20);
|
anim->setEndValue(20);
|
||||||
anim->setDuration(200);
|
anim->setDuration(200);
|
||||||
|
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim.data(), &QPropertyAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
|
QSignalSpy finishedSpy(anim.data(), &QPropertyAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -389,8 +389,8 @@ void tst_QPropertyAnimation::deletion3()
|
|||||||
anim->setEndValue(20);
|
anim->setEndValue(20);
|
||||||
anim->setDuration(200);
|
anim->setDuration(200);
|
||||||
|
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
|
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -490,7 +490,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
|
|||||||
//normal case: the animation finishes and is deleted
|
//normal case: the animation finishes and is deleted
|
||||||
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
|
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
|
||||||
anim->setEndValue(100);
|
anim->setEndValue(100);
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
anim->start(QVariantAnimation::DeleteWhenStopped);
|
anim->start(QVariantAnimation::DeleteWhenStopped);
|
||||||
QTest::qWait(anim->duration() + 100);
|
QTest::qWait(anim->duration() + 100);
|
||||||
@ -501,7 +501,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
|
|||||||
{
|
{
|
||||||
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
|
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
|
||||||
anim->setEndValue(100);
|
anim->setEndValue(100);
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim.data(), &QVariantAnimation::stateChanged);
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
anim->start(QVariantAnimation::DeleteWhenStopped);
|
anim->start(QVariantAnimation::DeleteWhenStopped);
|
||||||
QTest::qWait(anim->duration()/2);
|
QTest::qWait(anim->duration()/2);
|
||||||
@ -850,7 +850,7 @@ void tst_QPropertyAnimation::setStartEndValues()
|
|||||||
void tst_QPropertyAnimation::zeroDurationStart()
|
void tst_QPropertyAnimation::zeroDurationStart()
|
||||||
{
|
{
|
||||||
DummyPropertyAnimation anim;
|
DummyPropertyAnimation anim;
|
||||||
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy(&anim, &DummyPropertyAnimation::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
anim.setDuration(0);
|
anim.setDuration(0);
|
||||||
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
|
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
|
||||||
@ -972,7 +972,7 @@ void tst_QPropertyAnimation::operationsInStates()
|
|||||||
o.setProperty("ole", 42);
|
o.setProperty("ole", 42);
|
||||||
QPropertyAnimation anim(&o, "ole");
|
QPropertyAnimation anim(&o, "ole");
|
||||||
anim.setEndValue(100);
|
anim.setEndValue(100);
|
||||||
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy(&anim, &QPropertyAnimation::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
anim.stop();
|
anim.stop();
|
||||||
@ -1132,7 +1132,7 @@ void tst_QPropertyAnimation::valueChanged()
|
|||||||
QPropertyAnimation anim(&o, "ole");
|
QPropertyAnimation anim(&o, "ole");
|
||||||
anim.setEndValue(5);
|
anim.setEndValue(5);
|
||||||
anim.setDuration(1000);
|
anim.setDuration(1000);
|
||||||
QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
|
QSignalSpy spy(&anim, &QPropertyAnimation::valueChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
anim.start();
|
anim.start();
|
||||||
|
|
||||||
@ -1263,8 +1263,8 @@ void tst_QPropertyAnimation::zeroLoopCount()
|
|||||||
anim->setDuration(20);
|
anim->setDuration(20);
|
||||||
anim->setLoopCount(0);
|
anim->setLoopCount(0);
|
||||||
|
|
||||||
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy runningSpy(anim, &QPropertyAnimation::stateChanged);
|
||||||
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
|
QSignalSpy finishedSpy(anim, &QPropertyAnimation::finished);
|
||||||
|
|
||||||
QVERIFY(runningSpy.isValid());
|
QVERIFY(runningSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
|
@ -637,8 +637,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
|
|||||||
sequence->addAnimation(a3_s_o1);
|
sequence->addAnimation(a3_s_o1);
|
||||||
sequence->setLoopCount(2);
|
sequence->setLoopCount(2);
|
||||||
|
|
||||||
QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy a1StateChangedSpy(a1_s_o1, &QVariantAnimation::stateChanged);
|
||||||
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
|
||||||
|
|
||||||
QVERIFY(a1StateChangedSpy.isValid());
|
QVERIFY(a1StateChangedSpy.isValid());
|
||||||
QVERIFY(seqStateChangedSpy.isValid());
|
QVERIFY(seqStateChangedSpy.isValid());
|
||||||
@ -744,8 +744,8 @@ void tst_QSequentialAnimationGroup::restart()
|
|||||||
{
|
{
|
||||||
// sequence operating on same object/property
|
// sequence operating on same object/property
|
||||||
QAnimationGroup *sequence = new QSequentialAnimationGroup();
|
QAnimationGroup *sequence = new QSequentialAnimationGroup();
|
||||||
QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimation*)));
|
QSignalSpy seqCurrentAnimChangedSpy(static_cast<QSequentialAnimationGroup*>(sequence), &QSequentialAnimationGroup::currentAnimationChanged);
|
||||||
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy seqStateChangedSpy(sequence, &QAnimationGroup::stateChanged);
|
||||||
|
|
||||||
QVERIFY(seqCurrentAnimChangedSpy.isValid());
|
QVERIFY(seqCurrentAnimChangedSpy.isValid());
|
||||||
QVERIFY(seqStateChangedSpy.isValid());
|
QVERIFY(seqStateChangedSpy.isValid());
|
||||||
@ -756,7 +756,7 @@ void tst_QSequentialAnimationGroup::restart()
|
|||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
anims[i] = new DummyPropertyAnimation;
|
anims[i] = new DummyPropertyAnimation;
|
||||||
anims[i]->setDuration(100);
|
anims[i]->setDuration(100);
|
||||||
animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
animsStateChanged[i] = new QSignalSpy(anims[i], &QVariantAnimation::stateChanged);
|
||||||
QVERIFY(animsStateChanged[i]->isValid());
|
QVERIFY(animsStateChanged[i]->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -816,10 +816,10 @@ void tst_QSequentialAnimationGroup::looping()
|
|||||||
QAbstractAnimation *a2_s_o1 = new DummyPropertyAnimation;
|
QAbstractAnimation *a2_s_o1 = new DummyPropertyAnimation;
|
||||||
QAbstractAnimation *a3_s_o1 = new DummyPropertyAnimation;
|
QAbstractAnimation *a3_s_o1 = new DummyPropertyAnimation;
|
||||||
|
|
||||||
QSignalSpy a1Spy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy a1Spy(a1_s_o1, &QAbstractAnimation::stateChanged);
|
||||||
QSignalSpy a2Spy(a2_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy a2Spy(a2_s_o1, &QAbstractAnimation::stateChanged);
|
||||||
QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy a3Spy(a3_s_o1, &QAbstractAnimation::stateChanged);
|
||||||
QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy seqSpy(sequence, &QSequentialAnimationGroup::stateChanged);
|
||||||
|
|
||||||
QVERIFY(a1Spy.isValid());
|
QVERIFY(a1Spy.isValid());
|
||||||
QVERIFY(a2Spy.isValid());
|
QVERIFY(a2Spy.isValid());
|
||||||
@ -833,7 +833,7 @@ void tst_QSequentialAnimationGroup::looping()
|
|||||||
sequence->setLoopCount(2);
|
sequence->setLoopCount(2);
|
||||||
|
|
||||||
QSequentialAnimationGroup group;
|
QSequentialAnimationGroup group;
|
||||||
QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy groupSpy(&group, &QSequentialAnimationGroup::stateChanged);
|
||||||
QVERIFY(groupSpy.isValid());
|
QVERIFY(groupSpy.isValid());
|
||||||
|
|
||||||
group.addAnimation(sequence);
|
group.addAnimation(sequence);
|
||||||
@ -1101,8 +1101,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
|
|||||||
anim.setEndValue(100);
|
anim.setEndValue(100);
|
||||||
anim.setDuration(200);
|
anim.setDuration(200);
|
||||||
|
|
||||||
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy groupStateChangedSpy(&group, &QSequentialAnimationGroup::stateChanged);
|
||||||
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy childStateChangedSpy(&anim, &TestAnimation::stateChanged);
|
||||||
|
|
||||||
QVERIFY(groupStateChangedSpy.isValid());
|
QVERIFY(groupStateChangedSpy.isValid());
|
||||||
QVERIFY(childStateChangedSpy.isValid());
|
QVERIFY(childStateChangedSpy.isValid());
|
||||||
@ -1268,8 +1268,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
|
|||||||
anim2->setEndValue(100);
|
anim2->setEndValue(100);
|
||||||
anim2->setDuration(200);
|
anim2->setDuration(200);
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy1(anim1, &TestAnimation::stateChanged);
|
||||||
QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy2(anim2, &TestAnimation::stateChanged);
|
||||||
|
|
||||||
QVERIFY(stateChangedSpy1.isValid());
|
QVERIFY(stateChangedSpy1.isValid());
|
||||||
QVERIFY(stateChangedSpy2.isValid());
|
QVERIFY(stateChangedSpy2.isValid());
|
||||||
@ -1345,7 +1345,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation()
|
|||||||
anim3->setEndValue(100);
|
anim3->setEndValue(100);
|
||||||
anim3->setDuration(0);
|
anim3->setDuration(0);
|
||||||
|
|
||||||
QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy stateChangedSpy(anim1, &TestAnimation::stateChanged);
|
||||||
QVERIFY(stateChangedSpy.isValid());
|
QVERIFY(stateChangedSpy.isValid());
|
||||||
|
|
||||||
group.addAnimation(anim1);
|
group.addAnimation(anim1);
|
||||||
@ -1417,7 +1417,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
|
|||||||
//first we test a group with one uncontrolled animation
|
//first we test a group with one uncontrolled animation
|
||||||
QSequentialAnimationGroup group;
|
QSequentialAnimationGroup group;
|
||||||
UncontrolledAnimation notTimeDriven(&o1, &group);
|
UncontrolledAnimation notTimeDriven(&o1, &group);
|
||||||
QSignalSpy spy(&group, SIGNAL(finished()));
|
QSignalSpy spy(&group, &QSequentialAnimationGroup::finished);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
group.start();
|
group.start();
|
||||||
@ -1437,7 +1437,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
|
|||||||
// lets make sure the seeking will work again
|
// lets make sure the seeking will work again
|
||||||
spy.clear();
|
spy.clear();
|
||||||
DummyPropertyAnimation anim(&group);
|
DummyPropertyAnimation anim(&group);
|
||||||
QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy animStateChangedSpy(&anim, &DummyPropertyAnimation::stateChanged);
|
||||||
QVERIFY(animStateChangedSpy.isValid());
|
QVERIFY(animStateChangedSpy.isValid());
|
||||||
|
|
||||||
group.setCurrentTime(300);
|
group.setCurrentTime(300);
|
||||||
@ -1639,7 +1639,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
|
|||||||
QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
|
QPropertyAnimation *anim = new QPropertyAnimation(&dummy, "foo", &group);
|
||||||
anim->setDuration(250);
|
anim->setDuration(250);
|
||||||
anim->setEndValue(250);
|
anim->setEndValue(250);
|
||||||
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)));
|
QSignalSpy spy(anim, &QPropertyAnimation::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QCOMPARE(group.duration(), 250);
|
QCOMPARE(group.duration(), 250);
|
||||||
group.start();
|
group.start();
|
||||||
|
@ -138,7 +138,7 @@ void tst_QFileSystemWatcher::basicTest()
|
|||||||
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
|
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
|
||||||
QVERIFY(watcher.addPath(testFile.fileName()));
|
QVERIFY(watcher.addPath(testFile.fileName()));
|
||||||
|
|
||||||
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
|
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
|
||||||
QVERIFY(changedSpy.isValid());
|
QVERIFY(changedSpy.isValid());
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
@ -276,7 +276,7 @@ void tst_QFileSystemWatcher::watchDirectory()
|
|||||||
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
|
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
|
||||||
QVERIFY(watcher.addPath(testDir.absolutePath()));
|
QVERIFY(watcher.addPath(testDir.absolutePath()));
|
||||||
|
|
||||||
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
|
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
|
||||||
QVERIFY(changedSpy.isValid());
|
QVERIFY(changedSpy.isValid());
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
@ -436,8 +436,8 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
|
|||||||
QVERIFY(watcher.addPath(testDir.absolutePath()));
|
QVERIFY(watcher.addPath(testDir.absolutePath()));
|
||||||
QVERIFY(watcher.addPath(testFileName));
|
QVERIFY(watcher.addPath(testFileName));
|
||||||
|
|
||||||
QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(QString)));
|
QSignalSpy fileChangedSpy(&watcher, &QFileSystemWatcher::fileChanged);
|
||||||
QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(QString)));
|
QSignalSpy dirChangedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
|
||||||
QVERIFY(fileChangedSpy.isValid());
|
QVERIFY(fileChangedSpy.isValid());
|
||||||
QVERIFY(dirChangedSpy.isValid());
|
QVERIFY(dirChangedSpy.isValid());
|
||||||
QEventLoop eventLoop;
|
QEventLoop eventLoop;
|
||||||
@ -596,7 +596,7 @@ void tst_QFileSystemWatcher::QTBUG2331()
|
|||||||
QVERIFY(watcher.addPath(temporaryDirectory.path()));
|
QVERIFY(watcher.addPath(temporaryDirectory.path()));
|
||||||
|
|
||||||
// watch signal
|
// watch signal
|
||||||
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(QString)));
|
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::directoryChanged);
|
||||||
QVERIFY(changedSpy.isValid());
|
QVERIFY(changedSpy.isValid());
|
||||||
|
|
||||||
// remove directory, we should get one change signal, and we should no longer
|
// remove directory, we should get one change signal, and we should no longer
|
||||||
@ -675,7 +675,7 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
|
|||||||
connect(&watcher, SIGNAL(fileChanged(QString)), &signalReceiver, SLOT(fileChanged(QString)));
|
connect(&watcher, SIGNAL(fileChanged(QString)), &signalReceiver, SLOT(fileChanged(QString)));
|
||||||
|
|
||||||
// watch signals
|
// watch signals
|
||||||
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(QString)));
|
QSignalSpy changedSpy(&watcher, &QFileSystemWatcher::fileChanged);
|
||||||
QVERIFY(changedSpy.isValid());
|
QVERIFY(changedSpy.isValid());
|
||||||
|
|
||||||
// move files to second directory
|
// move files to second directory
|
||||||
|
@ -259,7 +259,7 @@ void tst_QProcess::simpleStart()
|
|||||||
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
||||||
|
|
||||||
process = new QProcess;
|
process = new QProcess;
|
||||||
QSignalSpy spy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
|
QSignalSpy spy(process, &QProcess::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
|
connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ void tst_QProcess::crashTest()
|
|||||||
{
|
{
|
||||||
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
||||||
process = new QProcess;
|
process = new QProcess;
|
||||||
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
|
QSignalSpy stateSpy(process, &QProcess::stateChanged);
|
||||||
QVERIFY(stateSpy.isValid());
|
QVERIFY(stateSpy.isValid());
|
||||||
process->start("testProcessCrash/testProcessCrash");
|
process->start("testProcessCrash/testProcessCrash");
|
||||||
QVERIFY(process->waitForStarted(5000));
|
QVERIFY(process->waitForStarted(5000));
|
||||||
@ -359,8 +359,8 @@ void tst_QProcess::crashTest()
|
|||||||
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
||||||
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
||||||
|
|
||||||
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QVERIFY(spy2.isValid());
|
QVERIFY(spy2.isValid());
|
||||||
@ -394,8 +394,8 @@ void tst_QProcess::crashTest2()
|
|||||||
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
||||||
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
||||||
|
|
||||||
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy spy2(process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy spy2(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QVERIFY(spy2.isValid());
|
QVERIFY(spy2.isValid());
|
||||||
@ -503,8 +503,8 @@ void tst_QProcess::echoTest2()
|
|||||||
QCOMPARE(process->error(), QProcess::Timedout);
|
QCOMPARE(process->error(), QProcess::Timedout);
|
||||||
|
|
||||||
process->write("Hello");
|
process->write("Hello");
|
||||||
QSignalSpy spy1(process, SIGNAL(readyReadStandardOutput()));
|
QSignalSpy spy1(process, &QProcess::readyReadStandardOutput);
|
||||||
QSignalSpy spy2(process, SIGNAL(readyReadStandardError()));
|
QSignalSpy spy2(process, &QProcess::readyReadStandardError);
|
||||||
|
|
||||||
QVERIFY(spy1.isValid());
|
QVERIFY(spy1.isValid());
|
||||||
QVERIFY(spy2.isValid());
|
QVERIFY(spy2.isValid());
|
||||||
@ -685,7 +685,7 @@ void tst_QProcess::readTimeoutAndThenCrash()
|
|||||||
QCOMPARE(process->error(), QProcess::Timedout);
|
QCOMPARE(process->error(), QProcess::Timedout);
|
||||||
|
|
||||||
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
||||||
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy spy(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
process->kill();
|
process->kill();
|
||||||
@ -887,7 +887,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives()
|
|||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
|
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
|
||||||
QSignalSpy spy(&proc, SIGNAL(readyRead()));
|
QSignalSpy spy(&proc, &QProcess::readyRead);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
proc.start("testProcessEcho/testProcessEcho");
|
proc.start("testProcessEcho/testProcessEcho");
|
||||||
@ -1283,7 +1283,7 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot()
|
|||||||
process->start("testProcessEcho/testProcessEcho");
|
process->start("testProcessEcho/testProcessEcho");
|
||||||
QVERIFY(process->waitForStarted(5000));
|
QVERIFY(process->waitForStarted(5000));
|
||||||
|
|
||||||
QSignalSpy spy(process, SIGNAL(readyRead()));
|
QSignalSpy spy(process, &QProcess::readyRead);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
process->write("foo");
|
process->write("foo");
|
||||||
QTestEventLoop::instance().enterLoop(30);
|
QTestEventLoop::instance().enterLoop(30);
|
||||||
@ -1323,7 +1323,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot()
|
|||||||
process->start("testProcessEcho/testProcessEcho");
|
process->start("testProcessEcho/testProcessEcho");
|
||||||
QVERIFY(process->waitForStarted(5000));
|
QVERIFY(process->waitForStarted(5000));
|
||||||
|
|
||||||
QSignalSpy spy(process, SIGNAL(bytesWritten(qint64)));
|
QSignalSpy spy(process, &QProcess::bytesWritten);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
process->write("f");
|
process->write("f");
|
||||||
QTestEventLoop::instance().enterLoop(30);
|
QTestEventLoop::instance().enterLoop(30);
|
||||||
@ -1538,10 +1538,10 @@ void tst_QProcess::failToStart()
|
|||||||
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
QSignalSpy stateSpy(&process, SIGNAL(stateChanged(QProcess::ProcessState)));
|
QSignalSpy stateSpy(&process, &QProcess::stateChanged);
|
||||||
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
|
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
|
||||||
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(stateSpy.isValid());
|
QVERIFY(stateSpy.isValid());
|
||||||
QVERIFY(errorSpy.isValid());
|
QVERIFY(errorSpy.isValid());
|
||||||
@ -1605,9 +1605,9 @@ void tst_QProcess::failToStartWithWait()
|
|||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
|
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
|
||||||
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(errorSpy.isValid());
|
QVERIFY(errorSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -1632,9 +1632,9 @@ void tst_QProcess::failToStartWithEventLoop()
|
|||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
|
QSignalSpy finishedSpy(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
|
||||||
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(errorSpy.isValid());
|
QVERIFY(errorSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -1864,9 +1864,9 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
|
|||||||
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
||||||
|
|
||||||
QProcess process;
|
QProcess process;
|
||||||
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy errorSpy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QSignalSpy finishedSpy1(&process, SIGNAL(finished(int)));
|
QSignalSpy finishedSpy1(&process, static_cast<void (QProcess::*)(int)>(&QProcess::finished));
|
||||||
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy finishedSpy2(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(errorSpy.isValid());
|
QVERIFY(errorSpy.isValid());
|
||||||
QVERIFY(finishedSpy1.isValid());
|
QVERIFY(finishedSpy1.isValid());
|
||||||
@ -2202,7 +2202,7 @@ void tst_QProcess::invalidProgramString()
|
|||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
||||||
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
|
||||||
QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError)));
|
QSignalSpy spy(&process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error));
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
process.start(programString);
|
process.start(programString);
|
||||||
@ -2218,8 +2218,8 @@ void tst_QProcess::onlyOneStartedSignal()
|
|||||||
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
|
||||||
QProcess process;
|
QProcess process;
|
||||||
|
|
||||||
QSignalSpy spyStarted(&process, SIGNAL(started()));
|
QSignalSpy spyStarted(&process, &QProcess::started);
|
||||||
QSignalSpy spyFinished(&process, SIGNAL(finished(int,QProcess::ExitStatus)));
|
QSignalSpy spyFinished(&process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished));
|
||||||
|
|
||||||
QVERIFY(spyStarted.isValid());
|
QVERIFY(spyStarted.isValid());
|
||||||
QVERIFY(spyFinished.isValid());
|
QVERIFY(spyFinished.isValid());
|
||||||
|
@ -158,6 +158,8 @@ public:
|
|||||||
QVector<QVector<QString> > table;
|
QVector<QVector<QString> > table;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint);
|
||||||
|
|
||||||
QtTestModel::QtTestModel(int rows, int columns, QObject *parent)
|
QtTestModel::QtTestModel(int rows, int columns, QObject *parent)
|
||||||
: QAbstractItemModel(parent), cCount(columns), rCount(rows), wrongIndex(false)
|
: QAbstractItemModel(parent), cCount(columns), rCount(rows), wrongIndex(false)
|
||||||
{
|
{
|
||||||
@ -353,6 +355,8 @@ void tst_QAbstractItemModel::init()
|
|||||||
insertCommand->setStartRow(0);
|
insertCommand->setStartRow(0);
|
||||||
insertCommand->setEndRow(9);
|
insertCommand->setEndRow(9);
|
||||||
insertCommand->doCommand();
|
insertCommand->doCommand();
|
||||||
|
|
||||||
|
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QAbstractItemModel::cleanup()
|
void tst_QAbstractItemModel::cleanup()
|
||||||
@ -807,8 +811,8 @@ void tst_QAbstractItemModel::removeRows()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy rowsAboutToBeRemovedSpy(&model, &QtTestModel::rowsAboutToBeRemoved);
|
||||||
QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy rowsRemovedSpy(&model, &QtTestModel::rowsRemoved);
|
||||||
|
|
||||||
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
|
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
|
||||||
QVERIFY(rowsRemovedSpy.isValid());
|
QVERIFY(rowsRemovedSpy.isValid());
|
||||||
@ -822,8 +826,8 @@ void tst_QAbstractItemModel::removeColumns()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy columnsAboutToBeRemovedSpy(&model, &QtTestModel::columnsAboutToBeRemoved);
|
||||||
QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved(QModelIndex,int,int)));
|
QSignalSpy columnsRemovedSpy(&model, &QtTestModel::columnsRemoved);
|
||||||
|
|
||||||
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
|
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
|
||||||
QVERIFY(columnsRemovedSpy.isValid());
|
QVERIFY(columnsRemovedSpy.isValid());
|
||||||
@ -837,8 +841,8 @@ void tst_QAbstractItemModel::insertRows()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy rowsAboutToBeInsertedSpy(&model, &QtTestModel::rowsAboutToBeInserted);
|
||||||
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy rowsInsertedSpy(&model, &QtTestModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
|
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
|
||||||
QVERIFY(rowsInsertedSpy.isValid());
|
QVERIFY(rowsInsertedSpy.isValid());
|
||||||
@ -852,8 +856,8 @@ void tst_QAbstractItemModel::insertColumns()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy columnsAboutToBeInsertedSpy(&model, &QtTestModel::columnsAboutToBeInserted);
|
||||||
QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted(QModelIndex,int,int)));
|
QSignalSpy columnsInsertedSpy(&model, &QtTestModel::columnsInserted);
|
||||||
|
|
||||||
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
|
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
|
||||||
QVERIFY(columnsInsertedSpy.isValid());
|
QVERIFY(columnsInsertedSpy.isValid());
|
||||||
@ -867,8 +871,8 @@ void tst_QAbstractItemModel::moveRows()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy rowsAboutToBeMovedSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy rowsAboutToBeMovedSpy(&model, &QtTestModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy rowsMovedSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy rowsMovedSpy(&model, &QtTestModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(rowsAboutToBeMovedSpy.isValid());
|
QVERIFY(rowsAboutToBeMovedSpy.isValid());
|
||||||
QVERIFY(rowsMovedSpy.isValid());
|
QVERIFY(rowsMovedSpy.isValid());
|
||||||
@ -882,8 +886,8 @@ void tst_QAbstractItemModel::moveColumns()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy columnsAboutToBeMovedSpy(&model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy columnsAboutToBeMovedSpy(&model, &QtTestModel::columnsAboutToBeMoved);
|
||||||
QSignalSpy columnsMovedSpy(&model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy columnsMovedSpy(&model, &QtTestModel::columnsMoved);
|
||||||
|
|
||||||
QVERIFY(columnsAboutToBeMovedSpy.isValid());
|
QVERIFY(columnsAboutToBeMovedSpy.isValid());
|
||||||
QVERIFY(columnsMovedSpy.isValid());
|
QVERIFY(columnsMovedSpy.isValid());
|
||||||
@ -901,7 +905,7 @@ void tst_QAbstractItemModel::reset()
|
|||||||
{
|
{
|
||||||
QtTestModel model(10, 10);
|
QtTestModel model(10, 10);
|
||||||
|
|
||||||
QSignalSpy resetSpy(&model, SIGNAL(modelReset()));
|
QSignalSpy resetSpy(&model, &QtTestModel::modelReset);
|
||||||
QVERIFY(resetSpy.isValid());
|
QVERIFY(resetSpy.isValid());
|
||||||
model.reset();
|
model.reset();
|
||||||
QCOMPARE(resetSpy.count(), 1);
|
QCOMPARE(resetSpy.count(), 1);
|
||||||
@ -1023,8 +1027,8 @@ void tst_QAbstractItemModel::testMoveSameParentDown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1138,8 +1142,8 @@ void tst_QAbstractItemModel::testMoveSameParentUp()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1287,8 +1291,8 @@ void tst_QAbstractItemModel::testMoveToGrandParent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1427,8 +1431,8 @@ void tst_QAbstractItemModel::testMoveToSibling()
|
|||||||
persistentList << QPersistentModelIndex(idx);
|
persistentList << QPersistentModelIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1577,8 +1581,8 @@ void tst_QAbstractItemModel::testMoveToUncle()
|
|||||||
persistentList << QPersistentModelIndex(idx);
|
persistentList << QPersistentModelIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1684,8 +1688,8 @@ void tst_QAbstractItemModel::testMoveToDescendants()
|
|||||||
persistentList << QPersistentModelIndex(idx);
|
persistentList << QPersistentModelIndex(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1748,8 +1752,8 @@ void tst_QAbstractItemModel::testMoveWithinOwnRange()
|
|||||||
QFETCH(int, endRow);
|
QFETCH(int, endRow);
|
||||||
QFETCH(int, destRow);
|
QFETCH(int, destRow);
|
||||||
|
|
||||||
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy beforeSpy(m_model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy afterSpy(m_model, &DynamicTreeModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -1841,8 +1845,8 @@ void ListenerObject::slotReset()
|
|||||||
|
|
||||||
void tst_QAbstractItemModel::testReset()
|
void tst_QAbstractItemModel::testReset()
|
||||||
{
|
{
|
||||||
QSignalSpy beforeResetSpy(m_model, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy beforeResetSpy(m_model, &DynamicTreeModel::modelAboutToBeReset);
|
||||||
QSignalSpy afterResetSpy(m_model, SIGNAL(modelReset()));
|
QSignalSpy afterResetSpy(m_model, &DynamicTreeModel::modelReset);
|
||||||
|
|
||||||
QVERIFY(beforeResetSpy.isValid());
|
QVERIFY(beforeResetSpy.isValid());
|
||||||
QVERIFY(afterResetSpy.isValid());
|
QVERIFY(afterResetSpy.isValid());
|
||||||
@ -1874,8 +1878,8 @@ void tst_QAbstractItemModel::testReset()
|
|||||||
// Delete it because its slots test things which are not true after this point.
|
// Delete it because its slots test things which are not true after this point.
|
||||||
delete listener;
|
delete listener;
|
||||||
|
|
||||||
QSignalSpy proxyBeforeResetSpy(nullProxy, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy proxyBeforeResetSpy(nullProxy, &QSortFilterProxyModel::modelAboutToBeReset);
|
||||||
QSignalSpy proxyAfterResetSpy(nullProxy, SIGNAL(modelReset()));
|
QSignalSpy proxyAfterResetSpy(nullProxy, &QSortFilterProxyModel::modelReset);
|
||||||
|
|
||||||
// Before setting it, it does not have custom roles.
|
// Before setting it, it does not have custom roles.
|
||||||
QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray());
|
QCOMPARE(nullProxy->roleNames().value(Qt::UserRole + 1), QByteArray());
|
||||||
@ -1925,8 +1929,8 @@ void tst_QAbstractItemModel::testDataChanged()
|
|||||||
{
|
{
|
||||||
CustomRoleModel model;
|
CustomRoleModel model;
|
||||||
|
|
||||||
QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
|
QSignalSpy withRoles(&model, &CustomRoleModel::dataChanged);
|
||||||
QSignalSpy withoutRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
QSignalSpy withoutRoles(&model, &CustomRoleModel::dataChanged);
|
||||||
|
|
||||||
QVERIFY(withRoles.isValid());
|
QVERIFY(withRoles.isValid());
|
||||||
QVERIFY(withoutRoles.isValid());
|
QVERIFY(withoutRoles.isValid());
|
||||||
@ -2027,8 +2031,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
|
|||||||
QCOMPARE(model.rowCount(p1), 10);
|
QCOMPARE(model.rowCount(p1), 10);
|
||||||
QCOMPARE(model.rowCount(p2), 10);
|
QCOMPARE(model.rowCount(p2), 10);
|
||||||
|
|
||||||
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -2043,8 +2047,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
|
|||||||
|
|
||||||
const QVariantList beforeSignal = beforeSpy.first();
|
const QVariantList beforeSignal = beforeSpy.first();
|
||||||
const QVariantList afterSignal = afterSpy.first();
|
const QVariantList afterSignal = afterSpy.first();
|
||||||
QCOMPARE(beforeSignal.size(), 1);
|
QCOMPARE(beforeSignal.size(), 2);
|
||||||
QCOMPARE(afterSignal.size(), 1);
|
QCOMPARE(afterSignal.size(), 2);
|
||||||
|
|
||||||
const QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
|
const QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
|
||||||
QCOMPARE(beforeParents.size(), 2);
|
QCOMPARE(beforeParents.size(), 2);
|
||||||
@ -2093,8 +2097,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
|
|||||||
const QPersistentModelIndex p2FirstPersistent = model.index(0, 0, p2);
|
const QPersistentModelIndex p2FirstPersistent = model.index(0, 0, p2);
|
||||||
const QPersistentModelIndex p2LastPersistent = model.index(9, 0, p2);
|
const QPersistentModelIndex p2LastPersistent = model.index(9, 0, p2);
|
||||||
|
|
||||||
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy beforeSpy(&model, &DynamicTreeModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy afterSpy(&model, &DynamicTreeModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(beforeSpy.isValid());
|
QVERIFY(beforeSpy.isValid());
|
||||||
QVERIFY(afterSpy.isValid());
|
QVERIFY(afterSpy.isValid());
|
||||||
@ -2116,8 +2120,8 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged()
|
|||||||
|
|
||||||
const QVariantList beforeSignal = beforeSpy.first();
|
const QVariantList beforeSignal = beforeSpy.first();
|
||||||
const QVariantList afterSignal = afterSpy.first();
|
const QVariantList afterSignal = afterSpy.first();
|
||||||
QCOMPARE(beforeSignal.size(), 1);
|
QCOMPARE(beforeSignal.size(), 2);
|
||||||
QCOMPARE(afterSignal.size(), 1);
|
QCOMPARE(afterSignal.size(), 2);
|
||||||
|
|
||||||
QVERIFY(p1FirstPersistent.row() == 1);
|
QVERIFY(p1FirstPersistent.row() == 1);
|
||||||
QVERIFY(p1LastPersistent.row() == 0);
|
QVERIFY(p1LastPersistent.row() == 0);
|
||||||
|
@ -163,10 +163,10 @@ void tst_QIdentityProxyModel::insertRows()
|
|||||||
|
|
||||||
verifyIdentity(m_model);
|
verifyIdentity(m_model);
|
||||||
|
|
||||||
QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeInserted);
|
||||||
QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsInserted);
|
||||||
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeInserted);
|
||||||
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(modelBeforeSpy.isValid());
|
QVERIFY(modelBeforeSpy.isValid());
|
||||||
QVERIFY(modelAfterSpy.isValid());
|
QVERIFY(modelAfterSpy.isValid());
|
||||||
@ -203,10 +203,10 @@ void tst_QIdentityProxyModel::removeRows()
|
|||||||
|
|
||||||
verifyIdentity(m_model);
|
verifyIdentity(m_model);
|
||||||
|
|
||||||
QSignalSpy modelBeforeSpy(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy modelBeforeSpy(m_model, &QStandardItemModel::rowsAboutToBeRemoved);
|
||||||
QSignalSpy modelAfterSpy(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy modelAfterSpy(m_model, &QStandardItemModel::rowsRemoved);
|
||||||
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy proxyBeforeSpy(m_proxy, &QStandardItemModel::rowsAboutToBeRemoved);
|
||||||
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy proxyAfterSpy(m_proxy, &QStandardItemModel::rowsRemoved);
|
||||||
|
|
||||||
QVERIFY(modelBeforeSpy.isValid());
|
QVERIFY(modelBeforeSpy.isValid());
|
||||||
QVERIFY(modelAfterSpy.isValid());
|
QVERIFY(modelAfterSpy.isValid());
|
||||||
@ -257,10 +257,10 @@ void tst_QIdentityProxyModel::moveRows()
|
|||||||
|
|
||||||
verifyIdentity(&model);
|
verifyIdentity(&model);
|
||||||
|
|
||||||
QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
|
||||||
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::rowsMoved);
|
||||||
|
|
||||||
QVERIFY(modelBeforeSpy.isValid());
|
QVERIFY(modelBeforeSpy.isValid());
|
||||||
QVERIFY(modelAfterSpy.isValid());
|
QVERIFY(modelAfterSpy.isValid());
|
||||||
@ -318,10 +318,10 @@ void tst_QIdentityProxyModel::reset()
|
|||||||
|
|
||||||
verifyIdentity(&model);
|
verifyIdentity(&model);
|
||||||
|
|
||||||
QSignalSpy modelBeforeSpy(&model, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::modelAboutToBeReset);
|
||||||
QSignalSpy modelAfterSpy(&model, SIGNAL(modelReset()));
|
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::modelReset);
|
||||||
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy proxyBeforeSpy(m_proxy, &QIdentityProxyModel::modelAboutToBeReset);
|
||||||
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(modelReset()));
|
QSignalSpy proxyAfterSpy(m_proxy, &QIdentityProxyModel::modelReset);
|
||||||
|
|
||||||
QVERIFY(modelBeforeSpy.isValid());
|
QVERIFY(modelBeforeSpy.isValid());
|
||||||
QVERIFY(modelAfterSpy.isValid());
|
QVERIFY(modelAfterSpy.isValid());
|
||||||
@ -351,8 +351,8 @@ void tst_QIdentityProxyModel::dataChanged()
|
|||||||
|
|
||||||
verifyIdentity(&model);
|
verifyIdentity(&model);
|
||||||
|
|
||||||
QSignalSpy modelSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
|
QSignalSpy modelSpy(&model, &DataChangedModel::dataChanged);
|
||||||
QSignalSpy proxySpy(m_proxy, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
|
QSignalSpy proxySpy(m_proxy, &QIdentityProxyModel::dataChanged);
|
||||||
|
|
||||||
QVERIFY(modelSpy.isValid());
|
QVERIFY(modelSpy.isValid());
|
||||||
QVERIFY(proxySpy.isValid());
|
QVERIFY(proxySpy.isValid());
|
||||||
|
@ -608,7 +608,7 @@ void tst_QItemModel::setData()
|
|||||||
QFETCH(QString, modelType);
|
QFETCH(QString, modelType);
|
||||||
currentModel = testModels->createModel(modelType);
|
currentModel = testModels->createModel(modelType);
|
||||||
QVERIFY(currentModel);
|
QVERIFY(currentModel);
|
||||||
QSignalSpy spy(currentModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
QSignalSpy spy(currentModel, &QAbstractItemModel::dataChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
|
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
|
||||||
QCOMPARE(spy.count(), 0);
|
QCOMPARE(spy.count(), 0);
|
||||||
@ -670,7 +670,7 @@ void tst_QItemModel::setHeaderData()
|
|||||||
QVERIFY(index.isValid());
|
QVERIFY(index.isValid());
|
||||||
|
|
||||||
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
||||||
QSignalSpy spy(currentModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
|
QSignalSpy spy(currentModel, &QAbstractItemModel::headerDataChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QString text = "Index private pointers should always be the same";
|
QString text = "Index private pointers should always be the same";
|
||||||
@ -711,7 +711,7 @@ void tst_QItemModel::sort()
|
|||||||
QVERIFY(currentModel->hasChildren(topIndex));
|
QVERIFY(currentModel->hasChildren(topIndex));
|
||||||
QModelIndex index = currentModel->index(0, 0, topIndex);
|
QModelIndex index = currentModel->index(0, 0, topIndex);
|
||||||
QVERIFY(index.isValid());
|
QVERIFY(index.isValid());
|
||||||
QSignalSpy spy(currentModel, SIGNAL(layoutChanged()));
|
QSignalSpy spy(currentModel, &QAbstractItemModel::layoutChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
for (int i=-1; i < 10; ++i){
|
for (int i=-1; i < 10; ++i){
|
||||||
currentModel->sort(i);
|
currentModel->sort(i);
|
||||||
@ -849,12 +849,12 @@ void tst_QItemModel::remove()
|
|||||||
|
|
||||||
// When a row or column is removed there should be two signals.
|
// 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
|
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
|
||||||
QSignalSpy columnsAboutToBeRemovedSpy(currentModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy columnsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeRemoved);
|
||||||
QSignalSpy rowsAboutToBeRemovedSpy(currentModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy rowsAboutToBeRemovedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeRemoved);
|
||||||
QSignalSpy columnsRemovedSpy(currentModel, SIGNAL(columnsRemoved(QModelIndex,int,int)));
|
QSignalSpy columnsRemovedSpy(currentModel, &QAbstractItemModel::columnsRemoved);
|
||||||
QSignalSpy rowsRemovedSpy(currentModel, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy rowsRemovedSpy(currentModel, &QAbstractItemModel::rowsRemoved);
|
||||||
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
|
QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
|
||||||
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
|
QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
|
QVERIFY(columnsAboutToBeRemovedSpy.isValid());
|
||||||
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
|
QVERIFY(rowsAboutToBeRemovedSpy.isValid());
|
||||||
@ -1191,12 +1191,12 @@ void tst_QItemModel::insert()
|
|||||||
|
|
||||||
// When a row or column is inserted there should be two signals.
|
// 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
|
// Watch to make sure they are emitted and get the row/column count when they do get emitted by connecting them to a slot
|
||||||
QSignalSpy columnsAboutToBeInsertedSpy(currentModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy columnsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::columnsAboutToBeInserted);
|
||||||
QSignalSpy rowsAboutToBeInsertedSpy(currentModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy rowsAboutToBeInsertedSpy(currentModel, &QAbstractItemModel::rowsAboutToBeInserted);
|
||||||
QSignalSpy columnsInsertedSpy(currentModel, SIGNAL(columnsInserted(QModelIndex,int,int)));
|
QSignalSpy columnsInsertedSpy(currentModel, &QAbstractItemModel::columnsInserted);
|
||||||
QSignalSpy rowsInsertedSpy(currentModel, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy rowsInsertedSpy(currentModel, &QAbstractItemModel::rowsInserted);
|
||||||
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
|
QSignalSpy modelResetSpy(currentModel, &QAbstractItemModel::modelReset);
|
||||||
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
|
QSignalSpy modelLayoutChangedSpy(currentModel, &QAbstractItemModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
|
QVERIFY(columnsAboutToBeInsertedSpy.isValid());
|
||||||
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
|
QVERIFY(rowsAboutToBeInsertedSpy.isValid());
|
||||||
|
@ -1529,7 +1529,7 @@ void tst_QItemSelectionModel::resetModel()
|
|||||||
MyStandardItemModel model(20, 20);
|
MyStandardItemModel model(20, 20);
|
||||||
QItemSelectionModel *selectionModel = new QItemSelectionModel(&model);
|
QItemSelectionModel *selectionModel = new QItemSelectionModel(&model);
|
||||||
|
|
||||||
QSignalSpy spy(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
|
QSignalSpy spy(selectionModel, &QItemSelectionModel::selectionChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select);
|
selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select);
|
||||||
@ -1592,7 +1592,7 @@ void tst_QItemSelectionModel::removeRows()
|
|||||||
|
|
||||||
MyStandardItemModel model(rowCount, columnCount);
|
MyStandardItemModel model(rowCount, columnCount);
|
||||||
QItemSelectionModel selections(&model);
|
QItemSelectionModel selections(&model);
|
||||||
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
|
QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QModelIndex tl = model.index(selectTop, selectLeft);
|
QModelIndex tl = model.index(selectTop, selectLeft);
|
||||||
@ -1655,7 +1655,7 @@ void tst_QItemSelectionModel::removeColumns()
|
|||||||
|
|
||||||
MyStandardItemModel model(rowCount, columnCount);
|
MyStandardItemModel model(rowCount, columnCount);
|
||||||
QItemSelectionModel selections(&model);
|
QItemSelectionModel selections(&model);
|
||||||
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
|
QSignalSpy spy(&selections, &QItemSelectionModel::selectionChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QModelIndex tl = model.index(selectTop, selectLeft);
|
QModelIndex tl = model.index(selectTop, selectLeft);
|
||||||
@ -1914,12 +1914,9 @@ void tst_QItemSelectionModel::setCurrentIndex()
|
|||||||
treemodel->index(0, 0, treemodel->index(0, 0)),
|
treemodel->index(0, 0, treemodel->index(0, 0)),
|
||||||
QItemSelectionModel::SelectCurrent);
|
QItemSelectionModel::SelectCurrent);
|
||||||
|
|
||||||
QSignalSpy currentSpy(&selectionModel,
|
QSignalSpy currentSpy(&selectionModel, &QItemSelectionModel::currentChanged);
|
||||||
SIGNAL(currentChanged(QModelIndex,QModelIndex)));
|
QSignalSpy rowSpy(&selectionModel, &QItemSelectionModel::currentRowChanged);
|
||||||
QSignalSpy rowSpy(&selectionModel,
|
QSignalSpy columnSpy(&selectionModel, &QItemSelectionModel::currentColumnChanged);
|
||||||
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)));
|
|
||||||
QSignalSpy columnSpy(&selectionModel,
|
|
||||||
SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)));
|
|
||||||
|
|
||||||
QVERIFY(currentSpy.isValid());
|
QVERIFY(currentSpy.isValid());
|
||||||
QVERIFY(rowSpy.isValid());
|
QVERIFY(rowSpy.isValid());
|
||||||
@ -2223,7 +2220,7 @@ void tst_QItemSelectionModel::childrenDeselectionSignal()
|
|||||||
QItemSelectionModel selectionModel(&model);
|
QItemSelectionModel selectionModel(&model);
|
||||||
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
|
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
|
||||||
|
|
||||||
QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
|
QSignalSpy deselectSpy(&selectionModel, &QItemSelectionModel::selectionChanged);
|
||||||
QVERIFY(deselectSpy.isValid());
|
QVERIFY(deselectSpy.isValid());
|
||||||
model.removeRows(0, 1, root);
|
model.removeRows(0, 1, root);
|
||||||
QVERIFY(deselectSpy.count() == 1);
|
QVERIFY(deselectSpy.count() == 1);
|
||||||
@ -2406,7 +2403,7 @@ void tst_QItemSelectionModel::deselectRemovedMiddleRange()
|
|||||||
|
|
||||||
RemovalObserver ro(&selModel);
|
RemovalObserver ro(&selModel);
|
||||||
|
|
||||||
QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
|
QSignalSpy spy(&selModel, &QItemSelectionModel::selectionChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
bool ok = model.removeRows(4, 2);
|
bool ok = model.removeRows(4, 2);
|
||||||
|
|
||||||
@ -2738,7 +2735,7 @@ void tst_QItemSelectionModel::testClearCurrentIndex()
|
|||||||
|
|
||||||
QItemSelectionModel selectionModel(&model, 0);
|
QItemSelectionModel selectionModel(&model, 0);
|
||||||
|
|
||||||
QSignalSpy currentIndexSpy(&selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)));
|
QSignalSpy currentIndexSpy(&selectionModel, &QItemSelectionModel::currentChanged);
|
||||||
QVERIFY(currentIndexSpy.isValid());
|
QVERIFY(currentIndexSpy.isValid());
|
||||||
|
|
||||||
QModelIndex firstIndex = model.index(0, 0);
|
QModelIndex firstIndex = model.index(0, 0);
|
||||||
|
@ -159,6 +159,8 @@ private:
|
|||||||
QSortFilterProxyModel *m_proxy;
|
QSortFilterProxyModel *m_proxy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint)
|
||||||
|
|
||||||
// Testing get/set functions
|
// Testing get/set functions
|
||||||
void tst_QSortFilterProxyModel::getSetCheck()
|
void tst_QSortFilterProxyModel::getSetCheck()
|
||||||
{
|
{
|
||||||
@ -177,6 +179,7 @@ void tst_QSortFilterProxyModel::getSetCheck()
|
|||||||
tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
|
tst_QSortFilterProxyModel::tst_QSortFilterProxyModel()
|
||||||
: m_model(0), m_proxy(0)
|
: m_model(0), m_proxy(0)
|
||||||
{
|
{
|
||||||
|
qRegisterMetaType<QAbstractItemModel::LayoutChangeHint>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QSortFilterProxyModel::initTestCase()
|
void tst_QSortFilterProxyModel::initTestCase()
|
||||||
@ -1472,7 +1475,7 @@ void tst_QSortFilterProxyModel::filterCurrent()
|
|||||||
|
|
||||||
view.show();
|
view.show();
|
||||||
view.setModel(&proxy);
|
view.setModel(&proxy);
|
||||||
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
|
QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
view.setCurrentIndex(proxy.index(0, 0));
|
view.setCurrentIndex(proxy.index(0, 0));
|
||||||
@ -1620,10 +1623,10 @@ void tst_QSortFilterProxyModel::removeSourceRows()
|
|||||||
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
|
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
|
||||||
(void)proxy.rowCount(QModelIndex()); // force mapping
|
(void)proxy.rowCount(QModelIndex()); // force mapping
|
||||||
|
|
||||||
QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
|
||||||
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
|
QSignalSpy aboutToRemoveSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeRemoved);
|
||||||
QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
QSignalSpy aboutToInsertSpy(&proxy, &QSortFilterProxyModel::rowsAboutToBeInserted);
|
||||||
|
|
||||||
QVERIFY(removeSpy.isValid());
|
QVERIFY(removeSpy.isValid());
|
||||||
QVERIFY(insertSpy.isValid());
|
QVERIFY(insertSpy.isValid());
|
||||||
@ -1801,8 +1804,8 @@ void tst_QSortFilterProxyModel::changeFilter()
|
|||||||
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
|
proxy.sort(0, static_cast<Qt::SortOrder>(sortOrder));
|
||||||
(void)proxy.rowCount(QModelIndex()); // force mapping
|
(void)proxy.rowCount(QModelIndex()); // force mapping
|
||||||
|
|
||||||
QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy initialRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
|
||||||
QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy initialInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(initialRemoveSpy.isValid());
|
QVERIFY(initialRemoveSpy.isValid());
|
||||||
QVERIFY(initialInsertSpy.isValid());
|
QVERIFY(initialInsertSpy.isValid());
|
||||||
@ -1825,8 +1828,8 @@ void tst_QSortFilterProxyModel::changeFilter()
|
|||||||
QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i));
|
QCOMPARE(proxy.data(index, Qt::DisplayRole).toString(), initialProxyItems.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy finalRemoveSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
|
||||||
QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy finalInsertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(finalRemoveSpy.isValid());
|
QVERIFY(finalRemoveSpy.isValid());
|
||||||
QVERIFY(finalInsertSpy.isValid());
|
QVERIFY(finalInsertSpy.isValid());
|
||||||
@ -1976,8 +1979,8 @@ void tst_QSortFilterProxyModel::changeSourceData()
|
|||||||
|
|
||||||
proxy.setFilterRegExp(filter);
|
proxy.setFilterRegExp(filter);
|
||||||
|
|
||||||
QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy removeSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
|
||||||
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy insertSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(removeSpy.isValid());
|
QVERIFY(removeSpy.isValid());
|
||||||
QVERIFY(insertSpy.isValid());
|
QVERIFY(insertSpy.isValid());
|
||||||
@ -2075,7 +2078,7 @@ void tst_QSortFilterProxyModel::selectionFilteredOut()
|
|||||||
|
|
||||||
view.show();
|
view.show();
|
||||||
view.setModel(&proxy);
|
view.setModel(&proxy);
|
||||||
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)));
|
QSignalSpy spy(view.selectionModel(), &QItemSelectionModel::currentChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
view.setCurrentIndex(proxy.index(0, 0));
|
view.setCurrentIndex(proxy.index(0, 0));
|
||||||
@ -2190,8 +2193,8 @@ void tst_QSortFilterProxyModel::insertIntoChildrenlessItem()
|
|||||||
QSortFilterProxyModel proxy;
|
QSortFilterProxyModel proxy;
|
||||||
proxy.setSourceModel(&model);
|
proxy.setSourceModel(&model);
|
||||||
|
|
||||||
QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(QModelIndex,int,int)));
|
QSignalSpy colsInsertedSpy(&proxy, &QSortFilterProxyModel::columnsInserted);
|
||||||
QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy rowsInsertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(colsInsertedSpy.isValid());
|
QVERIFY(colsInsertedSpy.isValid());
|
||||||
QVERIFY(rowsInsertedSpy.isValid());
|
QVERIFY(rowsInsertedSpy.isValid());
|
||||||
@ -2270,7 +2273,7 @@ void tst_QSortFilterProxyModel::insertRowIntoFilteredParent()
|
|||||||
EvenOddFilterModel proxy;
|
EvenOddFilterModel proxy;
|
||||||
proxy.setSourceModel(&model);
|
proxy.setSourceModel(&model);
|
||||||
|
|
||||||
QSignalSpy spy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy spy(&proxy, &EvenOddFilterModel::rowsInserted);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QStandardItem *itemA = new QStandardItem();
|
QStandardItem *itemA = new QStandardItem();
|
||||||
@ -2299,8 +2302,8 @@ void tst_QSortFilterProxyModel::filterOutParentAndFilterInChild()
|
|||||||
QStandardItem *itemC = new QStandardItem("C");
|
QStandardItem *itemC = new QStandardItem("C");
|
||||||
itemA->appendRow(itemC); // filtered
|
itemA->appendRow(itemC); // filtered
|
||||||
|
|
||||||
QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
|
QSignalSpy removedSpy(&proxy, &QSortFilterProxyModel::rowsRemoved);
|
||||||
QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
QSignalSpy insertedSpy(&proxy, &QSortFilterProxyModel::rowsInserted);
|
||||||
|
|
||||||
QVERIFY(removedSpy.isValid());
|
QVERIFY(removedSpy.isValid());
|
||||||
QVERIFY(insertedSpy.isValid());
|
QVERIFY(insertedSpy.isValid());
|
||||||
@ -2903,8 +2906,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
|
|||||||
QCOMPARE(sourceModel.rowCount(), 3);
|
QCOMPARE(sourceModel.rowCount(), 3);
|
||||||
QCOMPARE(proxyModel.rowCount(), 0); //all rows are hidden at first;
|
QCOMPARE(proxyModel.rowCount(), 0); //all rows are hidden at first;
|
||||||
|
|
||||||
QSignalSpy spyAbout1(&proxyModel, SIGNAL(layoutAboutToBeChanged()));
|
QSignalSpy spyAbout1(&proxyModel, &PModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy spyChanged1(&proxyModel, SIGNAL(layoutChanged()));
|
QSignalSpy spyChanged1(&proxyModel, &PModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(spyAbout1.isValid());
|
QVERIFY(spyAbout1.isValid());
|
||||||
QVERIFY(spyChanged1.isValid());
|
QVERIFY(spyChanged1.isValid());
|
||||||
@ -2915,8 +2918,8 @@ void tst_QSortFilterProxyModel::appearsAndSort()
|
|||||||
secondProxyModel.setDynamicSortFilter(true);
|
secondProxyModel.setDynamicSortFilter(true);
|
||||||
secondProxyModel.sort(0, Qt::DescendingOrder);
|
secondProxyModel.sort(0, Qt::DescendingOrder);
|
||||||
QCOMPARE(secondProxyModel.rowCount(), 0); //all rows are hidden at first;
|
QCOMPARE(secondProxyModel.rowCount(), 0); //all rows are hidden at first;
|
||||||
QSignalSpy spyAbout2(&secondProxyModel, SIGNAL(layoutAboutToBeChanged()));
|
QSignalSpy spyAbout2(&secondProxyModel, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy spyChanged2(&secondProxyModel, SIGNAL(layoutChanged()));
|
QSignalSpy spyChanged2(&secondProxyModel, &QSortFilterProxyModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(spyAbout2.isValid());
|
QVERIFY(spyAbout2.isValid());
|
||||||
QVERIFY(spyChanged2.isValid());
|
QVERIFY(spyChanged2.isValid());
|
||||||
@ -3443,25 +3446,25 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
|
|||||||
proxy2.setSourceModel(&proxy);
|
proxy2.setSourceModel(&proxy);
|
||||||
proxy2.setObjectName("proxy2");
|
proxy2.setObjectName("proxy2");
|
||||||
|
|
||||||
QSignalSpy dataChangedSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
QSignalSpy dataChangedSpy(&model, &QSortFilterProxyModel::dataChanged);
|
||||||
|
|
||||||
QVERIFY(dataChangedSpy.isValid());
|
QVERIFY(dataChangedSpy.isValid());
|
||||||
|
|
||||||
// Verify that the no-arg signal is still emitted.
|
// Verify that the no-arg signal is still emitted.
|
||||||
QSignalSpy layoutAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged()));
|
QSignalSpy layoutAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy layoutChangedSpy(&proxy, SIGNAL(layoutChanged()));
|
QSignalSpy layoutChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(layoutAboutToBeChangedSpy.isValid());
|
QVERIFY(layoutAboutToBeChangedSpy.isValid());
|
||||||
QVERIFY(layoutChangedSpy.isValid());
|
QVERIFY(layoutChangedSpy.isValid());
|
||||||
|
|
||||||
QSignalSpy parentsAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy parentsAboutToBeChangedSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy parentsChangedSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy parentsChangedSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(parentsAboutToBeChangedSpy.isValid());
|
QVERIFY(parentsAboutToBeChangedSpy.isValid());
|
||||||
QVERIFY(parentsChangedSpy.isValid());
|
QVERIFY(parentsChangedSpy.isValid());
|
||||||
|
|
||||||
QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy proxy2ParentsChangedSpy(&proxy2, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy proxy2ParentsChangedSpy(&proxy2, &QSortFilterProxyModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(proxy2ParentsAboutToBeChangedSpy.isValid());
|
QVERIFY(proxy2ParentsAboutToBeChangedSpy.isValid());
|
||||||
QVERIFY(proxy2ParentsChangedSpy.isValid());
|
QVERIFY(proxy2ParentsChangedSpy.isValid());
|
||||||
@ -3484,8 +3487,8 @@ void tst_QSortFilterProxyModel::testParentLayoutChanged()
|
|||||||
QVariantList beforeSignal = parentsAboutToBeChangedSpy.first();
|
QVariantList beforeSignal = parentsAboutToBeChangedSpy.first();
|
||||||
QVariantList afterSignal = parentsChangedSpy.first();
|
QVariantList afterSignal = parentsChangedSpy.first();
|
||||||
|
|
||||||
QCOMPARE(beforeSignal.size(), 1);
|
QCOMPARE(beforeSignal.size(), 2);
|
||||||
QCOMPARE(afterSignal.size(), 1);
|
QCOMPARE(afterSignal.size(), 2);
|
||||||
|
|
||||||
QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
|
QList<QPersistentModelIndex> beforeParents = beforeSignal.first().value<QList<QPersistentModelIndex> >();
|
||||||
QList<QPersistentModelIndex> afterParents = afterSignal.first().value<QList<QPersistentModelIndex> >();
|
QList<QPersistentModelIndex> afterParents = afterSignal.first().value<QList<QPersistentModelIndex> >();
|
||||||
@ -3620,16 +3623,16 @@ void tst_QSortFilterProxyModel::moveSourceRows()
|
|||||||
filterBothProxy.setSourceModel(&proxy);
|
filterBothProxy.setSourceModel(&proxy);
|
||||||
filterBothProxy.setFilterRegExp("5"); // The parents are 6 and 3. This filters both out.
|
filterBothProxy.setFilterRegExp("5"); // The parents are 6 and 3. This filters both out.
|
||||||
|
|
||||||
QSignalSpy modelBeforeSpy(&model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy modelBeforeSpy(&model, &DynamicTreeModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy modelAfterSpy(&model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy modelAfterSpy(&model, &DynamicTreeModel::rowsMoved);
|
||||||
QSignalSpy proxyBeforeMoveSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy proxyBeforeMoveSpy(m_proxy, &QSortFilterProxyModel::rowsAboutToBeMoved);
|
||||||
QSignalSpy proxyAfterMoveSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
|
QSignalSpy proxyAfterMoveSpy(m_proxy, &QSortFilterProxyModel::rowsMoved);
|
||||||
QSignalSpy proxyBeforeParentLayoutSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy proxyBeforeParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy proxyAfterParentLayoutSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy proxyAfterParentLayoutSpy(&proxy, &QSortFilterProxyModel::layoutChanged);
|
||||||
QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy filterBeforeParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy filterAfterParentLayoutSpy(&filterProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy filterAfterParentLayoutSpy(&filterProxy, &QSortFilterProxyModel::layoutChanged);
|
||||||
QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutAboutToBeChanged);
|
||||||
QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
|
QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, &QSortFilterProxyModel::layoutChanged);
|
||||||
|
|
||||||
QVERIFY(modelBeforeSpy.isValid());
|
QVERIFY(modelBeforeSpy.isValid());
|
||||||
QVERIFY(modelAfterSpy.isValid());
|
QVERIFY(modelAfterSpy.isValid());
|
||||||
|
@ -195,8 +195,8 @@ protected:
|
|||||||
|
|
||||||
void tst_QEventLoop::processEvents()
|
void tst_QEventLoop::processEvents()
|
||||||
{
|
{
|
||||||
QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()));
|
QSignalSpy aboutToBlockSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock);
|
||||||
QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), SIGNAL(awake()));
|
QSignalSpy awakeSpy(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::awake);
|
||||||
|
|
||||||
QVERIFY(aboutToBlockSpy.isValid());
|
QVERIFY(aboutToBlockSpy.isValid());
|
||||||
QVERIFY(awakeSpy.isValid());
|
QVERIFY(awakeSpy.isValid());
|
||||||
@ -282,7 +282,7 @@ void tst_QEventLoop::exec()
|
|||||||
thread.cond.wait(&thread.mutex);
|
thread.cond.wait(&thread.mutex);
|
||||||
|
|
||||||
// make sure the eventloop runs
|
// make sure the eventloop runs
|
||||||
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
|
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
thread.cond.wakeOne();
|
thread.cond.wakeOne();
|
||||||
thread.cond.wait(&thread.mutex);
|
thread.cond.wait(&thread.mutex);
|
||||||
@ -345,7 +345,7 @@ void tst_QEventLoop::wakeUp()
|
|||||||
thread.start();
|
thread.start();
|
||||||
(void) eventLoop.exec();
|
(void) eventLoop.exec();
|
||||||
|
|
||||||
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
|
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), &QAbstractEventDispatcher::awake);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
thread.eventLoop->wakeUp();
|
thread.eventLoop->wakeUp();
|
||||||
|
|
||||||
@ -633,7 +633,7 @@ void tst_QEventLoop::testQuitLock()
|
|||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
timer.setInterval(100);
|
timer.setInterval(100);
|
||||||
QSignalSpy timerSpy(&timer, SIGNAL(timeout()));
|
QSignalSpy timerSpy(&timer, &QTimer::timeout);
|
||||||
timer.start();
|
timer.start();
|
||||||
|
|
||||||
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));
|
QEventLoopPrivate* privateClass = static_cast<QEventLoopPrivate*>(QObjectPrivate::get(&eventLoop));
|
||||||
|
@ -857,7 +857,7 @@ void tst_QMetaObject::invokeTypedefTypes()
|
|||||||
{
|
{
|
||||||
qRegisterMetaType<CustomString>("CustomString");
|
qRegisterMetaType<CustomString>("CustomString");
|
||||||
QtTestCustomObject obj;
|
QtTestCustomObject obj;
|
||||||
QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString)));
|
QSignalSpy spy(&obj, &QtTestCustomObject::sig_custom);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QCOMPARE(spy.count(), 0);
|
QCOMPARE(spy.count(), 0);
|
||||||
|
@ -1593,7 +1593,7 @@ void tst_QMetaObjectBuilder::usage_signal()
|
|||||||
{
|
{
|
||||||
QScopedPointer<TestObject> testObject(new TestObject);
|
QScopedPointer<TestObject> testObject(new TestObject);
|
||||||
|
|
||||||
QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
|
QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
|
||||||
testObject->emitIntPropChanged();
|
testObject->emitIntPropChanged();
|
||||||
QCOMPARE(propChangedSpy.count(), 1);
|
QCOMPARE(propChangedSpy.count(), 1);
|
||||||
QCOMPARE(propChangedSpy.at(0).count(), 1);
|
QCOMPARE(propChangedSpy.at(0).count(), 1);
|
||||||
@ -1608,7 +1608,7 @@ void tst_QMetaObjectBuilder::usage_property()
|
|||||||
QCOMPARE(prop.type(), QVariant::Int);
|
QCOMPARE(prop.type(), QVariant::Int);
|
||||||
QCOMPARE(prop.toInt(), testObject->intProp());
|
QCOMPARE(prop.toInt(), testObject->intProp());
|
||||||
|
|
||||||
QSignalSpy propChangedSpy(testObject.data(), SIGNAL(intPropChanged(int)));
|
QSignalSpy propChangedSpy(testObject.data(), &TestObject::intPropChanged);
|
||||||
QVERIFY(testObject->intProp() != 123);
|
QVERIFY(testObject->intProp() != 123);
|
||||||
testObject->setProperty("intProp", 123);
|
testObject->setProperty("intProp", 123);
|
||||||
QCOMPARE(propChangedSpy.count(), 1);
|
QCOMPARE(propChangedSpy.count(), 1);
|
||||||
|
@ -267,12 +267,12 @@ void tst_QSocketNotifier::posixSockets()
|
|||||||
{
|
{
|
||||||
QSocketNotifier rn(posixSocket, QSocketNotifier::Read);
|
QSocketNotifier rn(posixSocket, QSocketNotifier::Read);
|
||||||
connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
QSignalSpy readSpy(&rn, SIGNAL(activated(int)));
|
QSignalSpy readSpy(&rn, &QSocketNotifier::activated);
|
||||||
QVERIFY(readSpy.isValid());
|
QVERIFY(readSpy.isValid());
|
||||||
// No write notifier, some systems trigger write notification on socket creation, but not all
|
// No write notifier, some systems trigger write notification on socket creation, but not all
|
||||||
QSocketNotifier en(posixSocket, QSocketNotifier::Exception);
|
QSocketNotifier en(posixSocket, QSocketNotifier::Exception);
|
||||||
connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
QSignalSpy errorSpy(&en, SIGNAL(activated(int)));
|
QSignalSpy errorSpy(&en, &QSocketNotifier::activated);
|
||||||
QVERIFY(errorSpy.isValid());
|
QVERIFY(errorSpy.isValid());
|
||||||
|
|
||||||
passive->write("hello",6);
|
passive->write("hello",6);
|
||||||
@ -289,7 +289,7 @@ void tst_QSocketNotifier::posixSockets()
|
|||||||
|
|
||||||
QSocketNotifier wn(posixSocket, QSocketNotifier::Write);
|
QSocketNotifier wn(posixSocket, QSocketNotifier::Write);
|
||||||
connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||||
QSignalSpy writeSpy(&wn, SIGNAL(activated(int)));
|
QSignalSpy writeSpy(&wn, &QSocketNotifier::activated);
|
||||||
QVERIFY(writeSpy.isValid());
|
QVERIFY(writeSpy.isValid());
|
||||||
qt_safe_write(posixSocket, "goodbye", 8);
|
qt_safe_write(posixSocket, "goodbye", 8);
|
||||||
|
|
||||||
|
@ -264,8 +264,8 @@ void tst_QPluginLoader::deleteinstanceOnUnload()
|
|||||||
PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance());
|
PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance());
|
||||||
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
|
QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok"));
|
||||||
|
|
||||||
QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
|
QSignalSpy spy1(loader1.instance(), &QObject::destroyed);
|
||||||
QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
|
QSignalSpy spy2(loader2.instance(), &QObject::destroyed);
|
||||||
QVERIFY(spy1.isValid());
|
QVERIFY(spy1.isValid());
|
||||||
QVERIFY(spy2.isValid());
|
QVERIFY(spy2.isValid());
|
||||||
if (pass == 0) {
|
if (pass == 0) {
|
||||||
@ -423,7 +423,7 @@ void tst_QPluginLoader::reloadPlugin()
|
|||||||
QVERIFY(instance);
|
QVERIFY(instance);
|
||||||
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
|
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
|
||||||
|
|
||||||
QSignalSpy spy(loader.instance(), SIGNAL(destroyed()));
|
QSignalSpy spy(loader.instance(), &QObject::destroyed);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
QVERIFY(loader.unload()); // refcount reached 0, did really unload
|
QVERIFY(loader.unload()); // refcount reached 0, did really unload
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
|
@ -916,7 +916,7 @@ void tst_QStateMachine::historyStateAfterRestart()
|
|||||||
s2->addTransition(new EventTransition(QEvent::User, s1));
|
s2->addTransition(new EventTransition(QEvent::User, s1));
|
||||||
|
|
||||||
for (int x = 0; x < 2; ++x) {
|
for (int x = 0; x < 2; ++x) {
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -952,7 +952,7 @@ void tst_QStateMachine::historyStateAfterRestart()
|
|||||||
QVERIFY(machine.configuration().contains(s2));
|
QVERIFY(machine.configuration().contains(s2));
|
||||||
QVERIFY(machine.configuration().contains(s22));
|
QVERIFY(machine.configuration().contains(s22));
|
||||||
|
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
machine.stop();
|
machine.stop();
|
||||||
QTRY_COMPARE(stoppedSpy.count(), 1);
|
QTRY_COMPARE(stoppedSpy.count(), 1);
|
||||||
@ -1232,9 +1232,9 @@ void tst_QStateMachine::stateEntryAndExit()
|
|||||||
QCOMPARE(trans->sourceState(), (QState*)s2);
|
QCOMPARE(trans->sourceState(), (QState*)s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
@ -1252,11 +1252,11 @@ void tst_QStateMachine::stateEntryAndExit()
|
|||||||
QVERIFY(machine.configuration().isEmpty());
|
QVERIFY(machine.configuration().isEmpty());
|
||||||
globalTick = 0;
|
globalTick = 0;
|
||||||
QVERIFY(!machine.isRunning());
|
QVERIFY(!machine.isRunning());
|
||||||
QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
|
QSignalSpy s1EnteredSpy(s1, &TestState::entered);
|
||||||
QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
|
QSignalSpy s1ExitedSpy(s1, &TestState::exited);
|
||||||
QSignalSpy tTriggeredSpy(t, SIGNAL(triggered()));
|
QSignalSpy tTriggeredSpy(t, &TestTransition::triggered);
|
||||||
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
|
QSignalSpy s2EnteredSpy(s2, &TestState::entered);
|
||||||
QSignalSpy s2ExitedSpy(s2, SIGNAL(exited()));
|
QSignalSpy s2ExitedSpy(s2, &TestState::exited);
|
||||||
|
|
||||||
QVERIFY(s1EnteredSpy.isValid());
|
QVERIFY(s1EnteredSpy.isValid());
|
||||||
QVERIFY(s1ExitedSpy.isValid());
|
QVERIFY(s1ExitedSpy.isValid());
|
||||||
@ -1312,8 +1312,8 @@ void tst_QStateMachine::stateEntryAndExit()
|
|||||||
s12->addTransition(t2);
|
s12->addTransition(t2);
|
||||||
s2->addTransition(s3);
|
s2->addTransition(s3);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
@ -1388,7 +1388,7 @@ void tst_QStateMachine::assignProperty()
|
|||||||
QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
|
QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
|
||||||
|
|
||||||
{
|
{
|
||||||
QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned()));
|
QSignalSpy propertiesAssignedSpy(s1, &QState::propertiesAssigned);
|
||||||
QVERIFY(propertiesAssignedSpy.isValid());
|
QVERIFY(propertiesAssignedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
|
QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
|
||||||
@ -1444,7 +1444,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
|
|||||||
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1473,7 +1473,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
|
|||||||
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1502,7 +1502,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
|
|||||||
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1552,7 +1552,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
|
|||||||
s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1587,7 +1587,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
|
|||||||
machine.setInitialState(group);
|
machine.setInitialState(group);
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(machine.configuration().contains(s1), true);
|
QTRY_COMPARE(machine.configuration().contains(s1), true);
|
||||||
QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned()));
|
QSignalSpy propertiesAssignedSpy(s2, &QState::propertiesAssigned);
|
||||||
QVERIFY(propertiesAssignedSpy.isValid());
|
QVERIFY(propertiesAssignedSpy.isValid());
|
||||||
emitter.emitSignalWithNoArg();
|
emitter.emitSignalWithNoArg();
|
||||||
QTRY_COMPARE(machine.configuration().contains(s2), true);
|
QTRY_COMPARE(machine.configuration().contains(s2), true);
|
||||||
@ -1675,7 +1675,7 @@ void tst_QStateMachine::postEvent()
|
|||||||
machine.addState(s1);
|
machine.addState(s1);
|
||||||
machine.addState(s2);
|
machine.addState(s2);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1705,7 +1705,7 @@ void tst_QStateMachine::cancelDelayedEvent()
|
|||||||
s1->addTransition(new StringTransition("a", s2));
|
s1->addTransition(new StringTransition("a", s2));
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -1725,7 +1725,7 @@ void tst_QStateMachine::cancelDelayedEvent()
|
|||||||
QVERIFY(machine.cancelDelayedEvent(id2));
|
QVERIFY(machine.cancelDelayedEvent(id2));
|
||||||
QVERIFY(!machine.cancelDelayedEvent(id2));
|
QVERIFY(!machine.cancelDelayedEvent(id2));
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
QCOMPARE(machine.configuration().size(), 1);
|
QCOMPARE(machine.configuration().size(), 1);
|
||||||
@ -1740,7 +1740,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
|
|||||||
s1->addTransition(new StringTransition("a", s2));
|
s1->addTransition(new StringTransition("a", s2));
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -1749,7 +1749,7 @@ void tst_QStateMachine::postDelayedEventAndStop()
|
|||||||
|
|
||||||
int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
|
int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
|
||||||
QVERIFY(id1 != -1);
|
QVERIFY(id1 != -1);
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
machine.stop();
|
machine.stop();
|
||||||
QTRY_COMPARE(stoppedSpy.count(), 1);
|
QTRY_COMPARE(stoppedSpy.count(), 1);
|
||||||
@ -1813,7 +1813,7 @@ void tst_QStateMachine::postDelayedEventFromThread()
|
|||||||
DelayedEventPosterThread poster(&machine);
|
DelayedEventPosterThread poster(&machine);
|
||||||
poster.start();
|
poster.start();
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1826,11 +1826,11 @@ void tst_QStateMachine::stopAndPostEvent()
|
|||||||
QStateMachine machine;
|
QStateMachine machine;
|
||||||
QState *s1 = new QState(&machine);
|
QState *s1 = new QState(&machine);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
machine.stop();
|
machine.stop();
|
||||||
QCOMPARE(stoppedSpy.count(), 0);
|
QCOMPARE(stoppedSpy.count(), 0);
|
||||||
@ -1850,7 +1850,7 @@ void tst_QStateMachine::stateFinished()
|
|||||||
QFinalState *s2 = new QFinalState(&machine);
|
QFinalState *s2 = new QFinalState(&machine);
|
||||||
s1->addTransition(s1, SIGNAL(finished()), s2);
|
s1->addTransition(s1, SIGNAL(finished()), s2);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -1888,7 +1888,7 @@ void tst_QStateMachine::parallelStates()
|
|||||||
s1->addTransition(s1, SIGNAL(finished()), s2);
|
s1->addTransition(s1, SIGNAL(finished()), s2);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
globalTick = 0;
|
globalTick = 0;
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -1933,9 +1933,9 @@ void tst_QStateMachine::parallelRootState()
|
|||||||
QFinalState *s2_f = new QFinalState(s2);
|
QFinalState *s2_f = new QFinalState(s2);
|
||||||
s2->setInitialState(s2_f);
|
s2->setInitialState(s2_f);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -1984,7 +1984,7 @@ void tst_QStateMachine::allSourceToTargetConfigurations()
|
|||||||
s2->addTransition(new StringTransition("f", s11));
|
s2->addTransition(new StringTransition("f", s11));
|
||||||
s0->addTransition(new StringTransition("e", s211));
|
s0->addTransition(new StringTransition("e", s211));
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2094,7 +2094,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
|
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
|
||||||
QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
|
QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2145,7 +2145,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
|
QCOMPARE(trans->senderObject(), (QObject*)&emitter);
|
||||||
QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
|
QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2170,7 +2170,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithIntArg(int)), s1);
|
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithIntArg(int)), s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2196,7 +2196,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
|
TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2232,7 +2232,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
trans->setTargetState(s1);
|
trans->setTargetState(s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2251,7 +2251,7 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
|
QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
|
||||||
QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
|
QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2300,8 +2300,8 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
QFinalState *s3 = new QFinalState(&machine);
|
QFinalState *s3 = new QFinalState(&machine);
|
||||||
s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s3);
|
s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s3);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
@ -2341,8 +2341,8 @@ void tst_QStateMachine::signalTransitions()
|
|||||||
QVERIFY(t1 != 0);
|
QVERIFY(t1 != 0);
|
||||||
QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString))));
|
QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString))));
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
@ -2406,7 +2406,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
|
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2459,7 +2459,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
|
QCOMPARE(trans->targetState(), (QAbstractState*)s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2485,7 +2485,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
trans->setTargetState(s1);
|
trans->setTargetState(s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2508,7 +2508,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
trans->setTargetState(s1);
|
trans->setTargetState(s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2534,7 +2534,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
trans->setTargetState(s1);
|
trans->setTargetState(s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2557,7 +2557,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
t1->setTargetState(s0);
|
t1->setTargetState(s0);
|
||||||
s1->addTransition(t1);
|
s1->addTransition(t1);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2607,8 +2607,8 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
t1->setTargetState(s2);
|
t1->setTargetState(s2);
|
||||||
s0->addTransition(t1);
|
s0->addTransition(t1);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
@ -2637,7 +2637,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
trans->setTargetState(s1);
|
trans->setTargetState(s1);
|
||||||
s0->addTransition(trans);
|
s0->addTransition(trans);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2655,7 +2655,7 @@ void tst_QStateMachine::eventTransitions()
|
|||||||
QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
|
QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
|
||||||
QCOMPARE(trans->eventTypeReceived(), QEvent::None);
|
QCOMPARE(trans->eventTypeReceived(), QEvent::None);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.setInitialState(s0);
|
machine.setInitialState(s0);
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2684,8 +2684,8 @@ void tst_QStateMachine::graphicsSceneEventTransitions()
|
|||||||
s1->addTransition(t);
|
s1->addTransition(t);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -2734,7 +2734,7 @@ void tst_QStateMachine::historyStates()
|
|||||||
root->setInitialState(s0);
|
root->setInitialState(s0);
|
||||||
s0->setInitialState(s00);
|
s0->setInitialState(s00);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@ -2771,9 +2771,9 @@ void tst_QStateMachine::historyStates()
|
|||||||
void tst_QStateMachine::startAndStop()
|
void tst_QStateMachine::startAndStop()
|
||||||
{
|
{
|
||||||
QStateMachine machine;
|
QStateMachine machine;
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
@ -2827,9 +2827,9 @@ void tst_QStateMachine::targetStateWithNoParent()
|
|||||||
QState s2;
|
QState s2;
|
||||||
s1->addTransition(&s2);
|
s1->addTransition(&s2);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
@ -3263,14 +3263,14 @@ void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup()
|
|||||||
|
|
||||||
QParallelAnimationGroup animationGroup;
|
QParallelAnimationGroup animationGroup;
|
||||||
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
|
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
|
||||||
QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
|
QSignalSpy animationFinishedSpy(&animationGroup, &QParallelAnimationGroup::finished);
|
||||||
QVERIFY(animationFinishedSpy.isValid());
|
QVERIFY(animationFinishedSpy.isValid());
|
||||||
s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
|
s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
|
||||||
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
|
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
|
||||||
s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
|
s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
|
||||||
|
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy machineFinishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(machineFinishedSpy.isValid());
|
QVERIFY(machineFinishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(machineFinishedSpy.count(), 1);
|
QTRY_COMPARE(machineFinishedSpy.count(), 1);
|
||||||
@ -3770,8 +3770,8 @@ void tst_QStateMachine::nestedStateMachines()
|
|||||||
group->addTransition(group, SIGNAL(finished()), final);
|
group->addTransition(group, SIGNAL(finished()), final);
|
||||||
machine.setInitialState(group);
|
machine.setInitialState(group);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
@ -3795,7 +3795,7 @@ void tst_QStateMachine::goToState()
|
|||||||
QState *s1 = new QState(&machine);
|
QState *s1 = new QState(&machine);
|
||||||
QState *s2 = new QState(&machine);
|
QState *s2 = new QState(&machine);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -3838,7 +3838,7 @@ void tst_QStateMachine::goToStateFromSourceWithTransition()
|
|||||||
s1->addTransition(new QSignalTransition);
|
s1->addTransition(new QSignalTransition);
|
||||||
QState *s2 = new QState(&machine);
|
QState *s2 = new QState(&machine);
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
@ -3928,7 +3928,7 @@ void tst_QStateMachine::postEventFromOtherThread()
|
|||||||
|
|
||||||
poster.start();
|
poster.start();
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -3984,9 +3984,9 @@ void tst_QStateMachine::stopInTransitionToFinalState()
|
|||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
|
|
||||||
QObject::connect(t1, SIGNAL(triggered()), &machine, SLOT(stop()));
|
QObject::connect(t1, SIGNAL(triggered()), &machine, SLOT(stop()));
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
|
QSignalSpy s2EnteredSpy(s2, &QFinalState::entered);
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QVERIFY(s2EnteredSpy.isValid());
|
QVERIFY(s2EnteredSpy.isValid());
|
||||||
@ -4029,13 +4029,13 @@ void tst_QStateMachine::stopInEventTest()
|
|||||||
s1->addTransition(new StopInEventTestTransition());
|
s1->addTransition(new StopInEventTestTransition());
|
||||||
machine.setInitialState(s1);
|
machine.setInitialState(s1);
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
|
|
||||||
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
|
QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
QVERIFY(stoppedSpy.isValid());
|
QVERIFY(stoppedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
|
machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
|
||||||
@ -4070,7 +4070,7 @@ void tst_QStateMachine::testIncrementReceivers()
|
|||||||
IncrementReceiversTest testObject;
|
IncrementReceiversTest testObject;
|
||||||
s1->addTransition(&testObject, SIGNAL(mySignal()), s2);
|
s1->addTransition(&testObject, SIGNAL(mySignal()), s2);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
machine.start();
|
machine.start();
|
||||||
|
|
||||||
QMetaObject::invokeMethod(&testObject, "mySignal", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(&testObject, "mySignal", Qt::QueuedConnection);
|
||||||
@ -4091,7 +4091,7 @@ void tst_QStateMachine::initialStateIsEnteredBeforeStartedEmitted()
|
|||||||
// transition should trigger.
|
// transition should trigger.
|
||||||
s1->addTransition(&machine, SIGNAL(started()), s2);
|
s1->addTransition(&machine, SIGNAL(started()), s2);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
}
|
}
|
||||||
@ -4226,9 +4226,9 @@ void tst_QStateMachine::transitionWithNoTarget()
|
|||||||
EventTransition *t1 = new EventTransition(QEvent::User, /*target=*/0);
|
EventTransition *t1 = new EventTransition(QEvent::User, /*target=*/0);
|
||||||
s1->addTransition(t1);
|
s1->addTransition(t1);
|
||||||
|
|
||||||
QSignalSpy s1EnteredSpy(s1, SIGNAL(entered()));
|
QSignalSpy s1EnteredSpy(s1, &QState::entered);
|
||||||
QSignalSpy s1ExitedSpy(s1, SIGNAL(exited()));
|
QSignalSpy s1ExitedSpy(s1, &QState::exited);
|
||||||
QSignalSpy t1TriggeredSpy(t1, SIGNAL(triggered()));
|
QSignalSpy t1TriggeredSpy(t1, &EventTransition::triggered);
|
||||||
|
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_VERIFY(machine.configuration().contains(s1));
|
QTRY_VERIFY(machine.configuration().contains(s1));
|
||||||
@ -4261,7 +4261,7 @@ void tst_QStateMachine::initialStateIsFinal()
|
|||||||
QStateMachine machine;
|
QStateMachine machine;
|
||||||
QFinalState *f = new QFinalState(&machine);
|
QFinalState *f = new QFinalState(&machine);
|
||||||
machine.setInitialState(f);
|
machine.setInitialState(f);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_VERIFY(machine.configuration().contains(f));
|
QTRY_VERIFY(machine.configuration().contains(f));
|
||||||
QTRY_COMPARE(finishedSpy.count(), 1);
|
QTRY_COMPARE(finishedSpy.count(), 1);
|
||||||
@ -4921,8 +4921,8 @@ void tst_QStateMachine::signalTransitionSenderInDifferentThread2()
|
|||||||
thread.start();
|
thread.start();
|
||||||
QTRY_VERIFY(thread.isRunning());
|
QTRY_VERIFY(thread.isRunning());
|
||||||
|
|
||||||
QSignalSpy startedSpy(&machine, SIGNAL(started()));
|
QSignalSpy startedSpy(&machine, &QStateMachine::started);
|
||||||
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
|
||||||
machine.start();
|
machine.start();
|
||||||
QTRY_COMPARE(startedSpy.count(), 1);
|
QTRY_COMPARE(startedSpy.count(), 1);
|
||||||
|
|
||||||
|
@ -87,8 +87,8 @@ void tst_QFutureWatcher::startFinish()
|
|||||||
{
|
{
|
||||||
QFutureWatcher<void> futureWatcher;
|
QFutureWatcher<void> futureWatcher;
|
||||||
|
|
||||||
QSignalSpy startedSpy(&futureWatcher, SIGNAL(started()));
|
QSignalSpy startedSpy(&futureWatcher, &QFutureWatcher<void>::started);
|
||||||
QSignalSpy finishedSpy(&futureWatcher, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&futureWatcher, &QFutureWatcher<void>::finished);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -322,7 +322,7 @@ void tst_QFutureWatcher::futureSignals()
|
|||||||
a.reportStarted();
|
a.reportStarted();
|
||||||
f.setFuture(a.future());
|
f.setFuture(a.future());
|
||||||
|
|
||||||
QSignalSpy progressSpy(&f, SIGNAL(progressValueChanged(int)));
|
QSignalSpy progressSpy(&f, &QFutureWatcher<void>::progressValueChanged);
|
||||||
QVERIFY(progressSpy.isValid());
|
QVERIFY(progressSpy.isValid());
|
||||||
const int progress = 1;
|
const int progress = 1;
|
||||||
a.setProgressValue(progress);
|
a.setProgressValue(progress);
|
||||||
@ -331,8 +331,8 @@ void tst_QFutureWatcher::futureSignals()
|
|||||||
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 0);
|
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 0);
|
||||||
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 1);
|
QCOMPARE(progressSpy.takeFirst().at(0).toInt(), 1);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&f, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&f, &QFutureWatcher<void>::finished);
|
||||||
QSignalSpy resultReadySpy(&f, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&f, &QFutureWatcher<void>::resultReadyAt);
|
||||||
|
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
@ -374,10 +374,10 @@ void tst_QFutureWatcher::watchFinishedFuture()
|
|||||||
#endif
|
#endif
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
|
|
||||||
QSignalSpy startedSpy(&watcher, SIGNAL(started()));
|
QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
|
||||||
QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
|
QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -408,10 +408,10 @@ void tst_QFutureWatcher::watchCanceledFuture()
|
|||||||
#endif
|
#endif
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
|
|
||||||
QSignalSpy startedSpy(&watcher, SIGNAL(started()));
|
QSignalSpy startedSpy(&watcher, &QFutureWatcher<int>::started);
|
||||||
QSignalSpy finishedSpy(&watcher, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&watcher, &QFutureWatcher<int>::finished);
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
|
QSignalSpy canceledSpy(&watcher, &QFutureWatcher<int>::canceled);
|
||||||
|
|
||||||
QVERIFY(startedSpy.isValid());
|
QVERIFY(startedSpy.isValid());
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
@ -439,8 +439,8 @@ void tst_QFutureWatcher::disconnectRunningFuture()
|
|||||||
SignalSlotObject object;
|
SignalSlotObject object;
|
||||||
connect(watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
|
|
||||||
QSignalSpy finishedSpy(watcher, SIGNAL(finished()));
|
QSignalSpy finishedSpy(watcher, &QFutureWatcher<int>::finished);
|
||||||
QSignalSpy resultReadySpy(watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
|
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
@ -634,7 +634,7 @@ void tst_QFutureWatcher::changeFuture()
|
|||||||
|
|
||||||
SignalSlotObject object;
|
SignalSlotObject object;
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
|
|
||||||
watcher.setFuture(a); // Watch 'a' which will genere a resultReady event.
|
watcher.setFuture(a); // Watch 'a' which will genere a resultReady event.
|
||||||
@ -666,7 +666,7 @@ void tst_QFutureWatcher::cancelEvents()
|
|||||||
|
|
||||||
SignalSlotObject object;
|
SignalSlotObject object;
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
|
|
||||||
watcher.setFuture(a);
|
watcher.setFuture(a);
|
||||||
@ -694,7 +694,7 @@ void tst_QFutureWatcher::pauseEvents()
|
|||||||
|
|
||||||
SignalSlotObject object;
|
SignalSlotObject object;
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
|
|
||||||
watcher.setFuture(a);
|
watcher.setFuture(a);
|
||||||
@ -720,7 +720,7 @@ void tst_QFutureWatcher::pauseEvents()
|
|||||||
|
|
||||||
SignalSlotObject object;
|
SignalSlotObject object;
|
||||||
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
|
||||||
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
|
QSignalSpy resultReadySpy(&watcher, &QFutureWatcher<int>::resultReadyAt);
|
||||||
QVERIFY(resultReadySpy.isValid());
|
QVERIFY(resultReadySpy.isValid());
|
||||||
|
|
||||||
watcher.setFuture(a);
|
watcher.setFuture(a);
|
||||||
|
@ -102,7 +102,7 @@ void tst_QTimeLine::range()
|
|||||||
|
|
||||||
// Verify that you can change the range in the timeLine
|
// Verify that you can change the range in the timeLine
|
||||||
timeLine.setFrameRange(10, 20);
|
timeLine.setFrameRange(10, 20);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
#ifdef Q_OS_WINCE
|
#ifdef Q_OS_WINCE
|
||||||
@ -131,7 +131,7 @@ void tst_QTimeLine::currentTime()
|
|||||||
{
|
{
|
||||||
QTimeLine timeLine(2000);
|
QTimeLine timeLine(2000);
|
||||||
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
|
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
|
QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.setFrameRange(10, 20);
|
timeLine.setFrameRange(10, 20);
|
||||||
QCOMPARE(timeLine.currentTime(), 0);
|
QCOMPARE(timeLine.currentTime(), 0);
|
||||||
@ -202,7 +202,7 @@ void tst_QTimeLine::frameRate()
|
|||||||
|
|
||||||
// Default speed
|
// Default speed
|
||||||
timeLine.setUpdateInterval(1000 / 33);
|
timeLine.setUpdateInterval(1000 / 33);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration()*2);
|
QTest::qWait(timeLine.duration()*2);
|
||||||
@ -225,7 +225,7 @@ void tst_QTimeLine::value()
|
|||||||
QVERIFY(timeLine.currentValue() == 0.0);
|
QVERIFY(timeLine.currentValue() == 0.0);
|
||||||
|
|
||||||
// Default speed
|
// Default speed
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
|
QSignalSpy spy(&timeLine, &QTimeLine::valueChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration()/3);
|
QTest::qWait(timeLine.duration()/3);
|
||||||
@ -256,7 +256,7 @@ void tst_QTimeLine::currentFrame()
|
|||||||
QCOMPARE(timeLine.currentFrame(), 10);
|
QCOMPARE(timeLine.currentFrame(), 10);
|
||||||
|
|
||||||
// Default speed
|
// Default speed
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration()/3);
|
QTest::qWait(timeLine.duration()/3);
|
||||||
@ -288,7 +288,7 @@ void tst_QTimeLine::loopCount()
|
|||||||
QCOMPARE(timeLine.loopCount(), 0);
|
QCOMPARE(timeLine.loopCount(), 0);
|
||||||
|
|
||||||
// Default speed infiniti looping
|
// Default speed infiniti looping
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration());
|
QTest::qWait(timeLine.duration());
|
||||||
@ -306,8 +306,8 @@ void tst_QTimeLine::loopCount()
|
|||||||
timeLine.setFrameRange(0, 2);
|
timeLine.setFrameRange(0, 2);
|
||||||
timeLine.setLoopCount(4);
|
timeLine.setLoopCount(4);
|
||||||
|
|
||||||
QSignalSpy finishedSpy(&timeLine, SIGNAL(finished()));
|
QSignalSpy finishedSpy(&timeLine, &QTimeLine::finished);
|
||||||
QSignalSpy frameChangedSpy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy frameChangedSpy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(finishedSpy.isValid());
|
QVERIFY(finishedSpy.isValid());
|
||||||
QVERIFY(frameChangedSpy.isValid());
|
QVERIFY(frameChangedSpy.isValid());
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
@ -461,7 +461,7 @@ void tst_QTimeLine::frameChanged()
|
|||||||
timeLine.setCurveShape(QTimeLine::LinearCurve);
|
timeLine.setCurveShape(QTimeLine::LinearCurve);
|
||||||
timeLine.setFrameRange(0,9);
|
timeLine.setFrameRange(0,9);
|
||||||
timeLine.setUpdateInterval(800);
|
timeLine.setUpdateInterval(800);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
|
QSignalSpy spy(&timeLine, &QTimeLine::frameChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
// Test what happens when duration expires before all frames are emitted.
|
// Test what happens when duration expires before all frames are emitted.
|
||||||
@ -492,7 +492,7 @@ void tst_QTimeLine::stopped()
|
|||||||
QTimeLine timeLine;
|
QTimeLine timeLine;
|
||||||
timeLine.setFrameRange(0, 9);
|
timeLine.setFrameRange(0, 9);
|
||||||
qRegisterMetaType<QTimeLine::State>("QTimeLine::State");
|
qRegisterMetaType<QTimeLine::State>("QTimeLine::State");
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(stateChanged(QTimeLine::State)));
|
QSignalSpy spy(&timeLine, &QTimeLine::stateChanged);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration()*2);
|
QTest::qWait(timeLine.duration()*2);
|
||||||
@ -510,7 +510,7 @@ void tst_QTimeLine::finished()
|
|||||||
{
|
{
|
||||||
QTimeLine timeLine;
|
QTimeLine timeLine;
|
||||||
timeLine.setFrameRange(0,9);
|
timeLine.setFrameRange(0,9);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(finished()));
|
QSignalSpy spy(&timeLine, &QTimeLine::finished);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
timeLine.start();
|
timeLine.start();
|
||||||
QTest::qWait(timeLine.duration()*2);
|
QTest::qWait(timeLine.duration()*2);
|
||||||
@ -543,7 +543,7 @@ void tst_QTimeLine::multipleTimeLines()
|
|||||||
// Stopping a timer shouldn't affect the other timers
|
// Stopping a timer shouldn't affect the other timers
|
||||||
QTimeLine timeLine(200);
|
QTimeLine timeLine(200);
|
||||||
timeLine.setFrameRange(0,99);
|
timeLine.setFrameRange(0,99);
|
||||||
QSignalSpy spy(&timeLine, SIGNAL(finished()));
|
QSignalSpy spy(&timeLine, &QTimeLine::finished);
|
||||||
QVERIFY(spy.isValid());
|
QVERIFY(spy.isValid());
|
||||||
|
|
||||||
QTimeLine timeLineKiller;
|
QTimeLine timeLineKiller;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user