{
QSequentialAnimationGroup group;
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(groupStateChangedSpy.isValid());
QCOMPARE(group.state(), QAnimationGroup::Stopped);
group.start();
QSignalSpy spy3(anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy spy4(anim4, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy1.isValid());
+ QVERIFY(spy2.isValid());
+ QVERIFY(spy3.isValid());
+ QVERIFY(spy4.isValid());
+
//first; let's start forward
group.start();
//all the animations should be started
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(groupStateChangedSpy.isValid());
+ QVERIFY(childStateChangedSpy.isValid());
+
QCOMPARE(groupStateChangedSpy.count(), 0);
QCOMPARE(childStateChangedSpy.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy1.isValid());
+ QVERIFY(stateChangedSpy2.isValid());
+
QCOMPARE(stateChangedSpy1.count(), 0);
QCOMPARE(stateChangedSpy2.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QSignalSpy stateChangedSpy1(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy1(&anim1, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy1.isValid());
+ QVERIFY(finishedSpy1.isValid());
+
QSignalSpy stateChangedSpy2(&anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy2(&anim2, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy2.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
QSignalSpy stateChangedSpy3(&anim3, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy3(&anim3, SIGNAL(finished()));
+ QVERIFY(stateChangedSpy3.isValid());
+ QVERIFY(finishedSpy3.isValid());
+
group.addAnimation(&anim1);
group.addAnimation(&anim2);
group.addAnimation(&anim3);
loopsForever.setLoopCount(-1);
QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy.isValid());
group.addAnimation(&anim1);
group.addAnimation(¬TimeDriven);
QParallelAnimationGroup group;
TestAnimation2 *anim = new TestAnimation2(250, &group); // 0, duration = 250;
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();
QTest::qWait(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int)));
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(runningSpy.isValid());
+ QVERIFY(currentLoopSpy.isValid());
+
anim->setCurrentTime(1);
anim->setCurrentTime(100);
QCOMPARE(finishedSpy.count(), 0);
//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 finishedSpy(anim, SIGNAL(finished()));
+ QVERIFY(runningSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
anim->setStartValue(10);
anim->setEndValue(20);
anim->setDuration(200);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QVERIFY(runningSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
anim->setStartValue(10);
anim->setEndValue(20);
anim->setDuration(200);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+
+ QVERIFY(runningSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
anim->start();
QTest::qWait(50);
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration() + 100);
QTRY_COMPARE(runningSpy.count(), 2); //started and then stopped
QPointer<QVariantAnimation> anim = new QPropertyAnimation(&o, "ole");
anim->setEndValue(100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
QTest::qWait(anim->duration()/2);
QPointer<QVariantAnimation> anim2 = new QPropertyAnimation(&o, "ole");
{
DummyPropertyAnimation anim;
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy.isValid());
anim.setDuration(0);
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
anim.start();
QPropertyAnimation anim(&o, "ole");
anim.setEndValue(100);
QSignalSpy spy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy.isValid());
anim.stop();
switch (originState) {
anim.setEndValue(5);
anim.setDuration(1000);
QSignalSpy spy(&anim, SIGNAL(valueChanged(QVariant)));
+ QVERIFY(spy.isValid());
anim.start();
QTest::qWait(anim.duration() + 100);
QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy finishedSpy(anim, SIGNAL(finished()));
+ QVERIFY(runningSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
QCOMPARE(anim->currentValue().toInt(), 0);
QCOMPARE(runningSpy.count(), 0);
QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(a1StateChangedSpy.isValid());
+ QVERIFY(seqStateChangedSpy.isValid());
+
QSequentialAnimationGroup group;
group.addAnimation(sequence);
QSignalSpy seqCurrentAnimChangedSpy(sequence, SIGNAL(currentAnimationChanged(QAbstractAnimation*)));
QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(seqCurrentAnimChangedSpy.isValid());
+ QVERIFY(seqStateChangedSpy.isValid());
+
QVariantAnimation *anims[3];
QSignalSpy *animsStateChanged[3];
anims[i] = new DummyPropertyAnimation;
anims[i]->setDuration(100);
animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(animsStateChanged[i]->isValid());
}
anims[1]->setLoopCount(2);
QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(a1Spy.isValid());
+ QVERIFY(a2Spy.isValid());
+ QVERIFY(a3Spy.isValid());
+ QVERIFY(seqSpy.isValid());
+
a2_s_o1->setLoopCount(2);
sequence->addAnimation(a1_s_o1);
sequence->addAnimation(a2_s_o1);
QSequentialAnimationGroup group;
QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(groupSpy.isValid());
group.addAnimation(sequence);
group.setLoopCount(2);
QSignalSpy groupStateChangedSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy childStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(groupStateChangedSpy.isValid());
+ QVERIFY(childStateChangedSpy.isValid());
+
QCOMPARE(groupStateChangedSpy.count(), 0);
QCOMPARE(childStateChangedSpy.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QSignalSpy stateChangedSpy1(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
QSignalSpy stateChangedSpy2(anim2, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy1.isValid());
+ QVERIFY(stateChangedSpy2.isValid());
+
QCOMPARE(stateChangedSpy1.count(), 0);
QCOMPARE(stateChangedSpy2.count(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
anim3->setDuration(0);
QSignalSpy stateChangedSpy(anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(stateChangedSpy.isValid());
group.addAnimation(anim1);
group.addAnimation(anim2);
QSequentialAnimationGroup group;
UncontrolledAnimation notTimeDriven(&o1, &group);
QSignalSpy spy(&group, SIGNAL(finished()));
+ QVERIFY(spy.isValid());
group.start();
QCOMPARE(group.state(), QAnimationGroup::Running);
spy.clear();
DummyPropertyAnimation anim(&group);
QSignalSpy animStateChangedSpy(&anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(animStateChangedSpy.isValid());
group.setCurrentTime(300);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
anim->setDuration(250);
anim->setEndValue(250);
QSignalSpy spy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)));
+ QVERIFY(spy.isValid());
QCOMPARE(group.duration(), 250);
group.start();
QTest::qWait(100);
{
QFutureWatcher<void> futureWatcher;
- QSignalSpy started(&futureWatcher, SIGNAL(started()));
- QSignalSpy finished(&futureWatcher, SIGNAL(finished()));
+ QSignalSpy startedSpy(&futureWatcher, SIGNAL(started()));
+ QSignalSpy finishedSpy(&futureWatcher, SIGNAL(finished()));
+
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
futureWatcher.setFuture(QtConcurrent::run(sleeper));
QTest::qWait(10); // spin the event loop to deliver queued signals.
- QCOMPARE(started.count(), 1);
- QCOMPARE(finished.count(), 0);
+ QCOMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 0);
futureWatcher.future().waitForFinished();
QTest::qWait(10);
- QCOMPARE(started.count(), 1);
- QCOMPARE(finished.count(), 1);
+ QCOMPARE(startedSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 1);
}
void mapSleeper(int &)
f.setFuture(a.future());
QSignalSpy progressSpy(&f, SIGNAL(progressValueChanged(int)));
+ QVERIFY(progressSpy.isValid());
const int progress = 1;
a.setProgressValue(progress);
QTest::qWait(10);
QSignalSpy finishedSpy(&f, SIGNAL(finished()));
QSignalSpy resultReadySpy(&f, SIGNAL(resultReadyAt(int)));
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(resultReadySpy.isValid());
+
const int result = 10;
a.reportResult(&result);
QTest::qWait(10);
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(resultReadySpy.isValid());
+ QVERIFY(canceledSpy.isValid());
+
watcher.setFuture(f);
QTest::qWait(10);
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
QSignalSpy canceledSpy(&watcher, SIGNAL(canceled()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(resultReadySpy.isValid());
+ QVERIFY(canceledSpy.isValid());
+
watcher.setFuture(f);
QTest::qWait(10);
QSignalSpy finishedSpy(watcher, SIGNAL(finished()));
QSignalSpy resultReadySpy(watcher, SIGNAL(resultReadyAt(int)));
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(resultReadySpy.isValid());
+
const int result = 10;
a.reportResult(&result);
QTest::qWait(10);
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a); // Watch 'a' which will genere a resultReady event.
watcher.setFuture(b); // But oh no! we're switching to another future
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
watcher.cancel();
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
watcher.pause();
SignalSlotObject object;
connect(&watcher, SIGNAL(resultReadyAt(int)), &object, SLOT(resultReadyAt(int)));
QSignalSpy resultReadySpy(&watcher, SIGNAL(resultReadyAt(int)));
+ QVERIFY(resultReadySpy.isValid());
watcher.setFuture(a);
a.pause();
QVERIFY(tailFile.open(QFile::ReadOnly));
tailFile.seek(file.size());
- QSignalSpy readSignal(&tailFile, SIGNAL(readyRead()));
+ QSignalSpy readSignalSpy(&tailFile, SIGNAL(readyRead()));
+ QVERIFY(readSignalSpy.isValid());
file.write("", 1);
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
- QCOMPARE(readSignal.count(), 1);
+ QCOMPARE(readSignalSpy.count(), 1);
}
void tst_QFile::flush()
watcher.addPath(testFile.fileName());
QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(const QString &)));
+ QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
watcher.addPath(testDir.dirName());
QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(const QString &)));
+ QVERIFY(changedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
QSignalSpy fileChangedSpy(&watcher, SIGNAL(fileChanged(const QString &)));
QSignalSpy dirChangedSpy(&watcher, SIGNAL(directoryChanged(const QString &)));
+ QVERIFY(fileChangedSpy.isValid());
+ QVERIFY(dirChangedSpy.isValid());
QEventLoop eventLoop;
QTimer timer;
connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
process = new QProcess;
QSignalSpy spy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
+ QVERIFY(spy.isValid());
connect(process, SIGNAL(readyRead()), this, SLOT(readFromProcess()));
/* valgrind dislike SUID binaries(those that have the `s'-flag set), which
#endif
process = new QProcess;
QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState)));
+ QVERIFY(stateSpy.isValid());
process->start("testProcessCrash/testProcessCrash");
QVERIFY(process->waitForStarted(5000));
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(spy.isValid());
+ QVERIFY(spy2.isValid());
+
QVERIFY(process->waitForFinished(30000));
QCOMPARE(spy.count(), 1);
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(spy.isValid());
+ QVERIFY(spy2.isValid());
+
QObject::connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
QTestEventLoop::instance().enterLoop(30);
QSignalSpy spy1(process, SIGNAL(readyReadStandardOutput()));
QSignalSpy spy2(process, SIGNAL(readyReadStandardError()));
+ QVERIFY(spy1.isValid());
+ QVERIFY(spy2.isValid());
+
QTime stopWatch;
stopWatch.start();
forever {
qint64 totalBytes = 0;
QByteArray dump;
QSignalSpy readyReadSpy(&process, SIGNAL(readyRead()));
+ QVERIFY(readyReadSpy.isValid());
while (stopWatch.elapsed() < 2000) {
process.write(array);
while (process.bytesToWrite() > 0) {
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
+ QVERIFY(spy.isValid());
process->kill();
QProcess proc;
connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot()));
QSignalSpy spy(&proc, SIGNAL(readyRead()));
+ QVERIFY(spy.isValid());
#ifdef Q_OS_MAC
proc.start("testProcessEcho/testProcessEcho.app");
QVERIFY(process->waitForStarted(5000));
QSignalSpy spy(process, SIGNAL(readyRead()));
+ QVERIFY(spy.isValid());
process->write("foo");
QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout());
qRegisterMetaType<qint64>("qint64");
QSignalSpy spy(process, SIGNAL(bytesWritten(qint64)));
+ QVERIFY(spy.isValid());
process->write("f");
QTestEventLoop::instance().enterLoop(30);
QVERIFY(!QTestEventLoop::instance().timeout());
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(stateSpy.isValid());
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
// Mac OS X and HP-UX have a really low default process limit (~100), so spawning
// to many processes here will cause test failures later on.
#if defined Q_OS_HPUX
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
for (int i = 0; i < 50; ++i) {
process.start("/blurp", QStringList() << "-v" << "-debug");
process.waitForStarted();
QSignalSpy finishedSpy(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
// The error signal may be emitted before start() returns
connect(&process, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()), Qt::QueuedConnection);
QSignalSpy errorSpy(&process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy finishedSpy1(&process, SIGNAL(finished(int)));
QSignalSpy finishedSpy2(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+
+ QVERIFY(errorSpy.isValid());
+ QVERIFY(finishedSpy1.isValid());
+ QVERIFY(finishedSpy2.isValid());
+
QVERIFY(!process.waitForReadyRead()); // used to crash
process.start("doesntexist");
QVERIFY(!process.waitForReadyRead());
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(&process, SIGNAL(error(QProcess::ProcessError)));
+ QVERIFY(spy.isValid());
process.start(programString);
QCOMPARE(process.error(), QProcess::FailedToStart);
QSignalSpy spyStarted(&process, SIGNAL(started()));
QSignalSpy spyFinished(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+ QVERIFY(spyStarted.isValid());
+ QVERIFY(spyFinished.isValid());
+
process.start("testProcessNormal/testProcessNormal");
QVERIFY(process.waitForStarted(5000));
QVERIFY(process.waitForFinished(5000));
QSignalSpy rowsAboutToBeRemovedSpy(&model, SIGNAL(rowsAboutToBeRemoved( const QModelIndex &, int , int )));
QSignalSpy rowsRemovedSpy(&model, SIGNAL(rowsRemoved( const QModelIndex &, int, int )));
+ QVERIFY(rowsAboutToBeRemovedSpy.isValid());
+ QVERIFY(rowsRemovedSpy.isValid());
+
QCOMPARE(model.removeRows(6, 4), true);
QCOMPARE(rowsAboutToBeRemovedSpy.count(), 1);
QCOMPARE(rowsRemovedSpy.count(), 1);
QSignalSpy columnsAboutToBeRemovedSpy(&model, SIGNAL(columnsAboutToBeRemoved( const QModelIndex &, int , int )));
QSignalSpy columnsRemovedSpy(&model, SIGNAL(columnsRemoved( const QModelIndex &, int, int )));
+ QVERIFY(columnsAboutToBeRemovedSpy.isValid());
+ QVERIFY(columnsRemovedSpy.isValid());
+
QCOMPARE(model.removeColumns(6, 4), true);
QCOMPARE(columnsAboutToBeRemovedSpy.count(), 1);
QCOMPARE(columnsRemovedSpy.count(), 1);
QSignalSpy rowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted( const QModelIndex &, int , int )));
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted( const QModelIndex &, int, int )));
+ QVERIFY(rowsAboutToBeInsertedSpy.isValid());
+ QVERIFY(rowsInsertedSpy.isValid());
+
QCOMPARE(model.insertRows(6, 4), true);
QCOMPARE(rowsAboutToBeInsertedSpy.count(), 1);
QCOMPARE(rowsInsertedSpy.count(), 1);
QSignalSpy columnsAboutToBeInsertedSpy(&model, SIGNAL(columnsAboutToBeInserted( const QModelIndex &, int , int )));
QSignalSpy columnsInsertedSpy(&model, SIGNAL(columnsInserted( const QModelIndex &, int, int )));
+ QVERIFY(columnsAboutToBeInsertedSpy.isValid());
+ QVERIFY(columnsInsertedSpy.isValid());
+
QCOMPARE(model.insertColumns(6, 4), true);
QCOMPARE(columnsAboutToBeInsertedSpy.count(), 1);
QCOMPARE(columnsInsertedSpy.count(), 1);
QtTestModel model(10, 10);
QSignalSpy resetSpy(&model, SIGNAL(modelReset()));
+ QVERIFY(resetSpy.isValid());
model.reset();
QCOMPARE(resetSpy.count(), 1);
}
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
if (!topLevel)
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
QPersistentModelIndex persistentSource = sourceIndex;
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
QPersistentModelIndex persistentDest = destIndex;
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setAncestorRowNumbers(QList<int>() << 9);
moveCommand->setNumCols(4);
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
ModelMoveCommand *moveCommand;
QList<int> ancestors;
while (ancestors.size() < depth)
QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this);
moveCommand->setNumCols(4);
moveCommand->setStartRow(startRow);
QSignalSpy beforeResetSpy(m_model, SIGNAL(modelAboutToBeReset()));
QSignalSpy afterResetSpy(m_model, SIGNAL(modelReset()));
+ QVERIFY(beforeResetSpy.isValid());
+ QVERIFY(afterResetSpy.isValid());
QSortFilterProxyModel *nullProxy = new QSortFilterProxyModel(this);
nullProxy->setSourceModel(m_model);
QSignalSpy withRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QSet<int>)));
QSignalSpy withoutRoles(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QVERIFY(withRoles.isValid());
+ QVERIFY(withoutRoles.isValid());
+
model.emitSignals();
QCOMPARE(withRoles.size(), withoutRoles.size());
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
ModelChangeChildrenLayoutsCommand *changeCommand = new ModelChangeChildrenLayoutsCommand(&model, this);
changeCommand->setAncestorRowNumbers(QList<int>() << 2);
changeCommand->setSecondAncestorRowNumbers(QList<int>() << 5);
QSignalSpy beforeSpy(&model, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy afterSpy(&model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QVERIFY(beforeSpy.isValid());
+ QVERIFY(afterSpy.isValid());
+
// Because the arguments in the signal are persistent, we need to check them for the aboutToBe
// case at emission time - before they get updated.
SignalArgumentChecker checker(p1, p2);
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsInserted(QModelIndex,int,int)));
+ QVERIFY(modelBeforeSpy.isValid());
+ QVERIFY(modelAfterSpy.isValid());
+ QVERIFY(proxyBeforeSpy.isValid());
+ QVERIFY(proxyAfterSpy.isValid());
+
QStandardItem *item = new QStandardItem(QString("new item"));
parentItem->appendRow(item);
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsRemoved(QModelIndex,int,int)));
+ QVERIFY(modelBeforeSpy.isValid());
+ QVERIFY(modelAfterSpy.isValid());
+ QVERIFY(proxyBeforeSpy.isValid());
+ QVERIFY(proxyAfterSpy.isValid());
+
const QModelIndex topLevel = m_model->index(0, 0, QModelIndex());
const QModelIndex secondLevel = m_model->index(0, 0, topLevel);
const QModelIndex thirdLevel = m_model->index(0, 0, secondLevel);
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ QVERIFY(modelBeforeSpy.isValid());
+ QVERIFY(modelAfterSpy.isValid());
+ QVERIFY(proxyBeforeSpy.isValid());
+ QVERIFY(proxyAfterSpy.isValid());
+
{
ModelMoveCommand moveCommand(&model, 0);
moveCommand.setAncestorRowNumbers(QList<int>() << 5);
QSignalSpy proxyBeforeSpy(m_proxy, SIGNAL(modelAboutToBeReset()));
QSignalSpy proxyAfterSpy(m_proxy, SIGNAL(modelReset()));
+ QVERIFY(modelBeforeSpy.isValid());
+ QVERIFY(modelAfterSpy.isValid());
+ QVERIFY(proxyBeforeSpy.isValid());
+ QVERIFY(proxyAfterSpy.isValid());
+
{
ModelResetCommandFixed resetCommand(&model, 0);
resetCommand.setAncestorRowNumbers(QList<int>() << 5);
view.setModel(&model);
QSignalSpy spy(view.selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QVERIFY(spy.isValid());
view.selectionModel()->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select);
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
QModelIndex br = model.index(selectBottom, selectRight);
MyStandardItemModel model(rowCount, columnCount);
QItemSelectionModel selections(&model);
QSignalSpy spy(&selections, SIGNAL(selectionChanged(QItemSelection,QItemSelection)));
+ QVERIFY(spy.isValid());
QModelIndex tl = model.index(selectTop, selectLeft);
QModelIndex br = model.index(selectBottom, selectRight);
QSignalSpy columnSpy(selectionModel,
SIGNAL(currentColumnChanged(QModelIndex,QModelIndex)));
+ QVERIFY(currentSpy.isValid());
+ QVERIFY(rowSpy.isValid());
+ QVERIFY(columnSpy.isValid());
+
// Select the same row and column indexes, but with a different parent
selectionModel->setCurrentIndex(
treemodel->index(0, 0, treemodel->index(1, 0)),
selectionModel.select(sel, QItemSelectionModel::SelectCurrent);
QSignalSpy deselectSpy(&selectionModel, SIGNAL(selectionChanged(const QItemSelection& , const QItemSelection&)));
+ QVERIFY(deselectSpy.isValid());
model.removeRows(0, 1, root);
QVERIFY(deselectSpy.count() == 1);
RemovalObserver ro(&selModel);
QSignalSpy spy(&selModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)));
+ QVERIFY(spy.isValid());
bool ok = model.removeRows(4, 2);
QVERIFY(ok);
QItemSelectionModel selectionModel(&model, 0);
QSignalSpy currentIndexSpy(&selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)));
+ QVERIFY(currentIndexSpy.isValid());
QModelIndex firstIndex = model.index(0, 0);
QVERIFY(firstIndex.isValid());
view.show();
view.setModel(&proxy);
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)));
+ QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
QCOMPARE(spy.count(), 1);
QSignalSpy aboutToRemoveSpy(&proxy, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)));
QSignalSpy aboutToInsertSpy(&proxy, SIGNAL(rowsAboutToBeInserted(QModelIndex, int, int)));
+ QVERIFY(removeSpy.isValid());
+ QVERIFY(insertSpy.isValid());
+ QVERIFY(aboutToRemoveSpy.isValid());
+ QVERIFY(aboutToInsertSpy.isValid());
+
model.removeRows(start, count, QModelIndex());
QCOMPARE(aboutToRemoveSpy.count(), expectedRemovedProxyIntervals.count());
QSignalSpy initialRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int)));
QSignalSpy initialInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int)));
+ QVERIFY(initialRemoveSpy.isValid());
+ QVERIFY(initialInsertSpy.isValid());
+
proxy.setFilterRegExp(initialFilter);
QCOMPARE(initialRemoveSpy.count(), initialRemoveIntervals.count());
QSignalSpy finalRemoveSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int)));
QSignalSpy finalInsertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int)));
+ QVERIFY(finalRemoveSpy.isValid());
+ QVERIFY(finalInsertSpy.isValid());
+
proxy.setFilterRegExp(finalFilter);
QCOMPARE(finalRemoveSpy.count(), finalRemoveIntervals.count());
QSignalSpy removeSpy(&proxy, SIGNAL(rowsRemoved(QModelIndex, int, int)));
QSignalSpy insertSpy(&proxy, SIGNAL(rowsInserted(QModelIndex, int, int)));
+ QVERIFY(removeSpy.isValid());
+ QVERIFY(insertSpy.isValid());
+
{
QModelIndex index = model.index(row, 0, QModelIndex());
model.setData(index, newValue, Qt::DisplayRole);
view.show();
view.setModel(&proxy);
QSignalSpy spy(view.selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)));
+ QVERIFY(spy.isValid());
view.setCurrentIndex(proxy.index(0, 0));
QCOMPARE(spy.count(), 1);
QSignalSpy colsInsertedSpy(&proxy, SIGNAL(columnsInserted(const QModelIndex&, int, int)));
QSignalSpy rowsInsertedSpy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int)));
+ QVERIFY(colsInsertedSpy.isValid());
+ QVERIFY(rowsInsertedSpy.isValid());
+
(void)proxy.rowCount(QModelIndex()); // force mapping of "a", "b", "c"
QCOMPARE(colsInsertedSpy.count(), 0);
QCOMPARE(rowsInsertedSpy.count(), 0);
proxy.setSourceModel(&model);
QSignalSpy spy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int)));
+ QVERIFY(spy.isValid());
QStandardItem *itemA = new QStandardItem();
model.appendRow(itemA); // A will be filtered
QSignalSpy removedSpy(&proxy, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
QSignalSpy insertedSpy(&proxy, SIGNAL(rowsInserted(const QModelIndex&, int, int)));
+ QVERIFY(removedSpy.isValid());
+ QVERIFY(insertedSpy.isValid());
+
proxy.setFilterRegExp("C"); // A and B will be filtered out, C filtered in
// we should now have been notified that the subtree represented by itemA has been removed
QSignalSpy spyAbout1(&proxyModel, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy spyChanged1(&proxyModel, SIGNAL(layoutChanged()));
+ QVERIFY(spyAbout1.isValid());
+ QVERIFY(spyChanged1.isValid());
+
//introducing secondProxyModel to test the layoutChange when many items appears at once
QSortFilterProxyModel secondProxyModel;
secondProxyModel.setSourceModel(&proxyModel);
QSignalSpy spyAbout2(&secondProxyModel, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy spyChanged2(&secondProxyModel, SIGNAL(layoutChanged()));
+ QVERIFY(spyAbout2.isValid());
+ QVERIFY(spyChanged2.isValid());
+
proxyModel.updateXX();
QApplication::processEvents();
//now rows should be visible, and sorted
QSignalSpy dataChangedSpy(&model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QVERIFY(dataChangedSpy.isValid());
+
// Verify that the no-arg signal is still emitted.
QSignalSpy layoutAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged()));
QSignalSpy layoutChangedSpy(&proxy, SIGNAL(layoutChanged()));
+ QVERIFY(layoutAboutToBeChangedSpy.isValid());
+ QVERIFY(layoutChangedSpy.isValid());
+
QSignalSpy parentsAboutToBeChangedSpy(&proxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy parentsChangedSpy(&proxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QVERIFY(parentsAboutToBeChangedSpy.isValid());
+ QVERIFY(parentsChangedSpy.isValid());
+
QSignalSpy proxy2ParentsAboutToBeChangedSpy(&proxy2, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy proxy2ParentsChangedSpy(&proxy2, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QVERIFY(proxy2ParentsAboutToBeChangedSpy.isValid());
+ QVERIFY(proxy2ParentsChangedSpy.isValid());
+
QStandardItem *item = model.invisibleRootItem()->child(1)->child(1);
// Ensure mapped:
QSignalSpy filterBothBeforeParentLayoutSpy(&filterBothProxy, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>)));
QSignalSpy filterBothAfterParentLayoutSpy(&filterBothProxy, SIGNAL(layoutChanged(QList<QPersistentModelIndex>)));
+ QVERIFY(modelBeforeSpy.isValid());
+ QVERIFY(modelAfterSpy.isValid());
+ QVERIFY(proxyBeforeMoveSpy.isValid());
+ QVERIFY(proxyAfterMoveSpy.isValid());
+ QVERIFY(proxyBeforeParentLayoutSpy.isValid());
+ QVERIFY(proxyAfterParentLayoutSpy.isValid());
+ QVERIFY(filterBeforeParentLayoutSpy.isValid());
+ QVERIFY(filterAfterParentLayoutSpy.isValid());
+ QVERIFY(filterBothBeforeParentLayoutSpy.isValid());
+ QVERIFY(filterBothAfterParentLayoutSpy.isValid());
+
{
ModelMoveCommand moveCommand(&model, 0);
moveCommand.setAncestorRowNumbers(QList<int>() << 2);
QSignalSpy spy1(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()));
QSignalSpy spy2(QAbstractEventDispatcher::instance(), SIGNAL(awake()));
+ QVERIFY(spy1.isValid());
+ QVERIFY(spy2.isValid());
+
QEventLoop eventLoop;
QCoreApplication::postEvent(&eventLoop, new QEvent(QEvent::User));
// make sure the eventloop runs
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
+ QVERIFY(spy.isValid());
thread.cond.wakeOne();
thread.cond.wait(&thread.mutex);
QVERIFY(spy.count() > 0);
(void) eventLoop.exec();
QSignalSpy spy(QAbstractEventDispatcher::instance(&thread), SIGNAL(awake()));
+ QVERIFY(spy.isValid());
thread.eventLoop->wakeUp();
// give the thread time to wake up
QVERIFY(currentModel);
qRegisterMetaType<QModelIndex>("QModelIndex");
QSignalSpy spy(currentModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)));
+ QVERIFY(spy.isValid());
QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false);
QCOMPARE(spy.count(), 0);
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
QSignalSpy spy(currentModel, SIGNAL(headerDataChanged( Qt::Orientation, int , int )));
+ QVERIFY(spy.isValid());
QString text = "Index private pointers should always be the same";
int signalCount = 0;
QModelIndex index = currentModel->index(0, 0, topIndex);
QVERIFY(index.isValid());
QSignalSpy spy(currentModel, SIGNAL(layoutChanged()));
+ QVERIFY(spy.isValid());
for (int i=-1; i < 10; ++i){
currentModel->sort(i);
if (index != currentModel->index(0, 0, topIndex)){
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
+ QVERIFY(columnsAboutToBeRemovedSpy.isValid());
+ QVERIFY(rowsAboutToBeRemovedSpy.isValid());
+ QVERIFY(columnsRemovedSpy.isValid());
+ QVERIFY(rowsRemovedSpy.isValid());
+ QVERIFY(modelResetSpy.isValid());
+ QVERIFY(modelLayoutChangedSpy.isValid());
+
QFETCH(int, numberOfRowsAboutToBeRemovedSignals);
QFETCH(int, numberOfColumnsAboutToBeRemovedSignals);
QFETCH(int, numberOfRowsRemovedSignals);
QSignalSpy modelResetSpy(currentModel, SIGNAL(modelReset()));
QSignalSpy modelLayoutChangedSpy(currentModel, SIGNAL(layoutChanged()));
+ QVERIFY(columnsAboutToBeInsertedSpy.isValid());
+ QVERIFY(rowsAboutToBeInsertedSpy.isValid());
+ QVERIFY(columnsInsertedSpy.isValid());
+ QVERIFY(rowsInsertedSpy.isValid());
+ QVERIFY(modelResetSpy.isValid());
+ QVERIFY(modelLayoutChangedSpy.isValid());
+
QFETCH(int, numberOfRowsAboutToBeInsertedSignals);
QFETCH(int, numberOfColumnsAboutToBeInsertedSignals);
QFETCH(int, numberOfRowsInsertedSignals);
qRegisterMetaType<CustomString>("CustomString");
QtTestCustomObject obj;
QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString)));
+ QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 0);
CustomString arg("hello");
QSocketNotifier rn(posixSocket, QSocketNotifier::Read);
connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy readSpy(&rn, SIGNAL(activated(int)));
+ QVERIFY(readSpy.isValid());
QSocketNotifier wn(posixSocket, QSocketNotifier::Write);
connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy writeSpy(&wn, SIGNAL(activated(int)));
+ QVERIFY(writeSpy.isValid());
QSocketNotifier en(posixSocket, QSocketNotifier::Exception);
connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
QSignalSpy errorSpy(&en, SIGNAL(activated(int)));
+ QVERIFY(errorSpy.isValid());
passive->write("hello",6);
passive->waitForBytesWritten(5000);
QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed()));
QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed()));
+ QVERIFY(spy1.isValid());
+ QVERIFY(spy2.isValid());
if (pass == 0) {
QCOMPARE(loader2.unload(), false); // refcount not reached 0, not really unloaded
QCOMPARE(spy1.count(), 0);
for (int x = 0; x < 2; ++x) {
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(s22));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
}
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(stoppedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
machine.setInitialState(s1);
QCOMPARE(machine.initialState(), (QAbstractState*)s1);
{
QSignalSpy tTriggeredSpy(t, SIGNAL(triggered()));
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
QSignalSpy s2ExitedSpy(s2, SIGNAL(exited()));
+
+ QVERIFY(s1EnteredSpy.isValid());
+ QVERIFY(s1ExitedSpy.isValid());
+ QVERIFY(tTriggeredSpy.isValid());
+ QVERIFY(s2EnteredSpy.isValid());
+ QVERIFY(s2ExitedSpy.isValid());
+
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s1);
globalTick = 0;
machine.start();
{
QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned()));
+ QVERIFY(propertiesAssignedSpy.isValid());
machine.start();
QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
}
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(obj.property("foo").toInt(), 456);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(obj.property("foo").toInt(), 456);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(obj.property("foo").toInt(), 456);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(obj.property("foo").toInt(), 321);
machine.start();
QTRY_COMPARE(machine.configuration().contains(s1), true);
QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned()));
+ QVERIFY(propertiesAssignedSpy.isValid());
emitter.emitSignalWithNoArg();
QTRY_COMPARE(machine.configuration().contains(s2), true);
QVERIFY(propertiesAssignedSpy.isEmpty());
machine.addState(s2);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
QVERIFY(!machine.cancelDelayedEvent(id2));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
QVERIFY(machine.configuration().contains(s2));
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
QVERIFY(id1 != -1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QVERIFY(stoppedSpy.isValid());
machine.stop();
QTRY_COMPARE(stoppedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
QState *s1 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
+ QVERIFY(stoppedSpy.isValid());
machine.stop();
QCOMPARE(stoppedSpy.count(), 0);
machine.postEvent(new QEvent(QEvent::User));
s1->addTransition(s1, SIGNAL(finished()), s2);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
s2->setInitialState(s2_f);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
machine.start();
QCoreApplication::processEvents();
s0->addTransition(new StringTransition("e", s211));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s0->addTransition(trans);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
s1->addTransition(t1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
s0->addTransition(trans);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QTest::ignoreMessage(QtWarningMsg, "QObject event transitions are not supported for custom types");
QCOMPARE(trans->eventTypeReceived(), QEvent::None);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.setInitialState(s0);
machine.start();
QCoreApplication::processEvents();
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QVERIFY(finishedSpy.count() == 0);
s0->setInitialState(s00);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QCoreApplication::processEvents();
QCOMPARE(machine.configuration().size(), 2);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(stoppedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
QVERIFY(!machine.isRunning());
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
machine.start();
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(stoppedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+
machine.start();
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: No common ancestor for targets and source of transition from state 's1'");
QTRY_COMPARE(startedSpy.count(), 1);
QParallelAnimationGroup animationGroup;
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
+ QVERIFY(animationFinishedSpy.isValid());
s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
machine.setInitialState(s1);
QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(machineFinishedSpy.isValid());
machine.start();
QTRY_COMPARE(machineFinishedSpy.count(), 1);
QCOMPARE(machine.configuration().size(), 1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(startedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QTRY_COMPARE(machine.configuration().count(), 1+2*3);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QState *s2 = new QState(&machine);
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
poster.start();
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(finishedSpy.isValid());
machine.start();
QTRY_COMPARE(finishedSpy.count(), 1);
}
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
QSignalSpy s2EnteredSpy(s2, SIGNAL(entered()));
+ QVERIFY(stoppedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(s2EnteredSpy.isValid());
machine.start();
// Stopping should take precedence over finished.
machine.setInitialState(s1);
QSignalSpy startedSpy(&machine, SIGNAL(started()));
+ QVERIFY(startedSpy.isValid());
machine.start();
QTRY_COMPARE(startedSpy.count(), 1);
QSignalSpy stoppedSpy(&machine, SIGNAL(stopped()));
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ QVERIFY(stoppedSpy.isValid());
+ QVERIFY(finishedSpy.isValid());
machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
QTRY_COMPARE(stoppedSpy.count(), 1);
// Verify that you can change the range in the timeLine
timeLine.setFrameRange(10, 20);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(spy.isValid());
timeLine.start();
#ifdef Q_OS_WINCE
QTest::qWait(1000);
timeLine.setUpdateInterval((timeLine.duration()/2) / 33);
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
+ QVERIFY(spy.isValid());
timeLine.setFrameRange(10, 20);
QCOMPARE(timeLine.currentTime(), 0);
timeLine.start();
// Default speed
timeLine.setUpdateInterval(1000 / 33);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
// Default speed
qRegisterMetaType<qreal>("qreal");
QSignalSpy spy(&timeLine, SIGNAL(valueChanged(qreal)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
QVERIFY(timeLine.currentValue() > 0);
// Default speed
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()/3);
QVERIFY(timeLine.currentFrame() > 10);
// Default speed infiniti looping
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration());
QCOMPARE(timeLine.state(), QTimeLine::Running);
QSignalSpy finishedSpy(&timeLine, SIGNAL(finished()));
QSignalSpy frameChangedSpy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(finishedSpy.isValid());
+ QVERIFY(frameChangedSpy.isValid());
QEventLoop loop;
connect(&timeLine, SIGNAL(finished()), &loop, SLOT(quit()));
timeLine.setFrameRange(0,9);
timeLine.setUpdateInterval(1000);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
timeLine.setFrameRange(0, 9);
qRegisterMetaType<QTimeLine::State>("QTimeLine::State");
QSignalSpy spy(&timeLine, SIGNAL(stateChanged(QTimeLine::State)));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
QTimeLine timeLine;
timeLine.setFrameRange(0,9);
QSignalSpy spy(&timeLine, SIGNAL(finished()));
+ QVERIFY(spy.isValid());
timeLine.start();
QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
QTimeLine timeLine(200);
timeLine.setFrameRange(0,99);
QSignalSpy spy(&timeLine, SIGNAL(finished()));
+ QVERIFY(spy.isValid());
QTimeLine timeLineKiller;
timeLineKiller.setFrameRange(0,99);