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

@ -17,10 +17,9 @@
#include "UnlockDatabaseWidget.h"
#include <QMessageBox>
#include "ui_DatabaseOpenWidget.h"
#include "core/Database.h"
#include "gui/MessageBox.h"
UnlockDatabaseWidget::UnlockDatabaseWidget(QWidget* parent)
: DatabaseOpenWidget(parent)
@ -50,7 +49,7 @@ void UnlockDatabaseWidget::openDatabase()
Q_EMIT editFinished(true);
}
else {
QMessageBox::warning(this, tr("Error"), tr("Wrong key."));
MessageBox::warning(this, tr("Error"), tr("Wrong key."));
m_ui->editPassword->clear();
}
}