Skip to content

Commit

Permalink
FdoSecrets: alternative way to drive unlock dialog to hopefully make …
Browse files Browse the repository at this point in the history
…the test more reliable
  • Loading branch information
Aetf committed Sep 25, 2021
1 parent 2f87e2e commit a9516f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/fdosecrets/objects/Prompt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ namespace FdoSecrets
auto client = m_client.lock();
if (!client) {
// client already gone
qDebug() << "DBus client gone before item unlocking finish";
return;
}
for (auto it = decisions.constBegin(); it != decisions.constEnd(); ++it) {
Expand Down
5 changes: 3 additions & 2 deletions tests/gui/TestGuiFdoSecrets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,8 @@ void TestGuiFdoSecrets::processEvents()
{
// Couldn't use QApplication::processEvents, because per Qt documentation:
// events that are posted while the function runs will be queued until a later round of event processing.
// so we directly call event dispatcher in a loop until no events can be handled
// and we may post QTimer single shot events during event handling to achieve async method.
// So we directly call event dispatcher in a loop until no events can be handled
while (QAbstractEventDispatcher::instance()->processEvents(QEventLoop::AllEvents)) {
// pass
}
Expand Down Expand Up @@ -1596,7 +1597,7 @@ bool TestGuiFdoSecrets::driveAccessControlDialog(bool remember)
auto rememberCheck = dlg->findChild<QCheckBox*>("rememberCheck");
VERIFY(rememberCheck);
rememberCheck->setChecked(remember);
QTest::keyClick(dlg, Qt::Key_Enter);
dlg->done(AccessControlDialog::AllowSelected);
processEvents();
return true;
}
Expand Down

0 comments on commit a9516f0

Please sign in to comment.