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:
Felix Geyer 2013-10-08 22:09:20 +02:00
parent 551637f0c2
commit d5b70b1bef
11 changed files with 176 additions and 41 deletions

View file

@ -19,12 +19,12 @@
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include "ui_DatabaseOpenWidget.h"
#include "core/Database.h"
#include "core/Metadata.h"
#include "format/KeePass1Reader.h"
#include "gui/MessageBox.h"
KeePass1OpenWidget::KeePass1OpenWidget(QWidget* parent)
: DatabaseOpenWidget(parent)
@ -64,8 +64,8 @@ void KeePass1OpenWidget::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();
}
}