on xenial help sign in
Make waiting for second signal a little safer
3bec098Michael Terry
tests/plugins/LightDM/dbus.cpp+5−2
@@ -160,10 +160,13 @@ private Q_SLOTS:
160 QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
160 QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
161 greeter->authenticate("no-password");
161 greeter->authenticate("no-password");
162
162
163− // once for locked, once for user; first will be locked mode
163+ // Two property changed signals will be emitted, one for the IsLocked
164+ // property, one for the ActiveEntry; the first will be IsLocked.
165+ spy.wait();
164− while (spy.count() != 2) {
166+ if (spy.count() < 2) {
165 spy.wait();
167 spy.wait();
166 }
168 }
169+ QCOMPARE(spy.count(), 2);
167
170
168 QList<QVariant> arguments = spy.takeFirst();
171 QList<QVariant> arguments = spy.takeFirst();
169 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
172 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");