Commit 43f6922c authored by Julien Finet's avatar Julien Finet

Add pqTestUtility::recordWithDialog property

During tests, the dialog is not needed
parent 02e131e5
......@@ -59,6 +59,7 @@ pqTestUtility::pqTestUtility(QObject* p)
: QObject(p)
{
this->PlayingTest = false;
this->RecordWithDialog = true;
this->File = 0;
this->FileSuffix = QString();
......@@ -316,25 +317,28 @@ void pqTestUtility::recordTests()
QObject::connect(&this->Recorder, SIGNAL(stopped()),
this, SLOT(onRecordStopped()), Qt::UniqueConnection);
if (QApplication::activeWindow())
{
pqRecordEventsDialog* dialog = new pqRecordEventsDialog(&this->Recorder,
this,
QApplication::activeWindow());
dialog->setAttribute(Qt::WA_QuitOnClose, false);
QRect rectApp = QApplication::activeWindow()->geometry();
QRect rectDialog(QPoint(rectApp.left(),
rectApp.bottom() - dialog->sizeHint().height()),
QSize(dialog->geometry().width(), dialog->sizeHint().height()));
dialog->setGeometry(rectDialog);
dialog->show();
}
else
{
qWarning() << "No acive windows has been found";
}
if (this->RecordWithDialog)
{
if (QApplication::activeWindow())
{
pqRecordEventsDialog* dialog = new pqRecordEventsDialog(&this->Recorder,
this,
QApplication::activeWindow());
dialog->setAttribute(Qt::WA_QuitOnClose, false);
QRect rectApp = QApplication::activeWindow()->geometry();
QRect rectDialog(QPoint(rectApp.left(),
rectApp.bottom() - dialog->sizeHint().height()),
QSize(dialog->geometry().width(), dialog->sizeHint().height()));
dialog->setGeometry(rectDialog);
dialog->show();
}
else
{
qWarning() << "No active windows has been found";
}
}
this->Recorder.recordEvents(&this->Translator, observer, this->File, true);
}
......@@ -492,3 +496,15 @@ QString pqTestUtility::convertFromDataDirectory(const QString& file)
}
return filename;
}
//-----------------------------------------------------------------------------
bool pqTestUtility::recordWithDialog() const
{
return this->RecordWithDialog;
}
//-----------------------------------------------------------------------------
void pqTestUtility::setRecordWithDialog(bool withDialog)
{
this->RecordWithDialog = withDialog;
}
......@@ -57,7 +57,10 @@ class pqEventSource;
class QTTESTING_EXPORT pqTestUtility : public QObject
{
Q_OBJECT
/// This property controls whether the RecordEventsDialog is opened when
/// recording events.
/// True by default.
Q_PROPERTY(bool recordWithDialog READ recordWithDialog WRITE setRecordWithDialog)
public:
pqTestUtility(QObject* parent = 0);
~pqTestUtility();
......@@ -126,6 +129,10 @@ public:
/// give a filename convert from one of the data directories
QString convertFromDataDirectory(const QString& file);
/// True if a dialog is opened when recording, false otherwise
bool recordWithDialog() const;
/// Set whether a dialog is opened when recording.
void setRecordWithDialog(bool withDialog);
public slots:
bool playTests(const QString& filename);
void openPlayerDialog();
......@@ -152,6 +159,7 @@ protected:
pqEventPlayer Player;
pqEventTranslator Translator;
bool PlayingTest;
bool RecordWithDialog;
QIODevice* File;
QString FileSuffix;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment