@@ -15,6 +15,7 @@
1515 */
1616
1717#include "Greeter.h"
18+#include "PromptsModel.h"
1819
1920#include <QCoreApplication>
2021#include <QDBusInterface>
@@ -137,11 +138,13 @@ private Q_SLOTS:
137138 void testActiveEntryChanged()
138139 {
139140 QSignalSpy spy(this, &GreeterDBusTest::PropertiesChangedRelay);
141+
140142 greeter->authenticate("has-password");
141143
142− QTRY_COMPARE(spy.count(), 2); // EntryIsLocked then ActiveEntry
144+ // EntryIsLocked's default is true, thus only single property change.
145+ QTRY_COMPARE(spy.count(), 1);
143146
144− QList<QVariant> arguments = spy[1];
147+ QList<QVariant> arguments = spy[0];
145148 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
146149 QVERIFY(arguments.at(1).toMap().contains("ActiveEntry"));
147150 QVERIFY(arguments.at(1).toMap()["ActiveEntry"] == "has-password");
@@ -154,19 +157,29 @@ private Q_SLOTS:
154157 greeter->authenticate("no-password");
155158 QTRY_VERIFY(!dbusList->property("EntryIsLocked").toBool());
156159
160+ QSignalSpy promptSpy(greeter->promptsModel(), &PromptsModel::countChanged);
161+ QSignalSpy successSpy(greeter, &Greeter::loginSuccess);
162+
157163 greeter->authenticate("has-password");
158164 QTRY_VERIFY(dbusList->property("EntryIsLocked").toBool());
165+ // Make sure that EntryIsLocked stays `true` after authenticated.
166+ // Regression test for https://github.com/ubports/ubuntu-touch/issues/1406
167+ promptSpy.wait();
168+ greeter->respond(QStringLiteral("password"));
169+ successSpy.wait();
170+ QVERIFY(dbusList->property("EntryIsLocked").toBool());
159171 }
160172
161173 void testEntryIsLockedChanged()
162174 {
163175 QSignalSpy spy(this, &GreeterDBusTest::PropertiesChangedRelay);
176+
164177 greeter->authenticate("no-password");
165178
166− // EntryIsLocked=true, ActiveEntry, then EntryIsLocked=false
167− QTRY_COMPARE(spy.count(), 3);
179+ // ActiveEntry, then EntryIsLocked=false
180+ QTRY_COMPARE(spy.count(), 2);
168181
169− QList<QVariant> arguments = spy[2];
182+ QList<QVariant> arguments = spy[1];
170183 QVERIFY(arguments.at(0).toString() == "com.canonical.UnityGreeter.List");
171184 QVERIFY(arguments.at(1).toMap().contains("EntryIsLocked"));
172185 QVERIFY(arguments.at(1).toMap()["EntryIsLocked"] == false);