on xenial help sign in
Make waiting for second signal a little safer
commit3bec0983daf1f369a33106d71bcdfe321c2f9fe9 authorMichael Terry <michael.terry@canonical.com> dateTue 16 Dec 2014, 09:28 (12 years ago) parentcb21dfa
1 file changed+5−2
tests/plugins/LightDM/dbus.cpp+5−2
tests/plugins/LightDM/dbus.cpp+5−2
@@ -160,10 +160,13 @@ private Q_SLOTS:
160160 QSignalSpy spy(this, SIGNAL(PropertiesChangedRelay(QString, QVariantMap, QStringList)));
161161 greeter->authenticate("no-password");
162162
163− // once for locked, once for user; first will be locked mode
164− while (spy.count() != 2) {
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();
166+ if (spy.count() < 2) {
165167 spy.wait();
166168 }
169+ QCOMPARE(spy.count(), 2);
167170
168171 QList<QVariant> arguments = spy.takeFirst();
169172 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");