mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-24 15:25:31 -04:00
Add a QMessageBox wrapper class to help gui tests.
QMessageBox displays modal dialogs which blocks the gui tests. To work around this we add a MessageBox wrapper class where the tests can set the answer for the next dialog. The answer is then returned without actually showing the dialog.
This commit is contained in:
parent
551637f0c2
commit
d5b70b1bef
11 changed files with 176 additions and 41 deletions
|
@ -18,11 +18,10 @@
|
|||
#include "DatabaseOpenWidget.h"
|
||||
#include "ui_DatabaseOpenWidget.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "gui/FileDialog.h"
|
||||
#include "gui/MessageBox.h"
|
||||
#include "format/KeePass2Reader.h"
|
||||
#include "keys/FileKey.h"
|
||||
#include "keys/PasswordKey.h"
|
||||
|
@ -115,8 +114,8 @@ void DatabaseOpenWidget::openDatabase()
|
|||
Q_EMIT editFinished(true);
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to open the database.\n%1")
|
||||
.arg(reader.errorString()));
|
||||
MessageBox::warning(this, tr("Error"), tr("Unable to open the database.\n%1")
|
||||
.arg(reader.errorString()));
|
||||
m_ui->editPassword->clear();
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ CompositeKey DatabaseOpenWidget::databaseKey()
|
|||
QString keyFilename = m_ui->comboKeyFile->currentText();
|
||||
QString errorMsg;
|
||||
if (!key.load(keyFilename, &errorMsg)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Can't open key file:\n%1").arg(errorMsg));
|
||||
MessageBox::warning(this, tr("Error"), tr("Can't open key file:\n%1").arg(errorMsg));
|
||||
return CompositeKey();
|
||||
}
|
||||
masterKey.addKey(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue