#include <UnitTestImp.h>
Public Slots | |
void | on_aboutButton_clicked () |
Shows the about dialog. | |
void | on_helpButton_clicked () |
Shows the help dialog. | |
void | on_startButton_clicked () |
Runs the unit tests. | |
void | on_treeViewFailure_itemDoubleClicked (QTreeWidgetItem *item, int column) |
Opens a dialog to display a detailed description about the error. | |
Public Member Functions | |
void | addUnitTest (const QString &unit) |
Adds a unit test. | |
void | clearErrorList () |
Emtpies the error listview. | |
QString | getUnitTest () const |
Returns the unit test. | |
void | insertError (const QString &failure, const QString &details) |
Inserts an item with text failure to the listview. | |
void | reject () |
Closes and resets this dialog. | |
void | reset () |
Resets this dialog. | |
void | setErrorCount (int) |
Sets the number of faulty tests to ct. | |
void | setFailCount (int) |
Sets the number of failed tests to ct. | |
void | setProgressFraction (float fraction, const QString &=QString::null) |
Sets the progress of the progress bar whereas fraction is in between 0.0 and 1.0. | |
void | setRemainCount (int) |
Sets the number of remaining tests to ct. | |
void | setRunCount (int) |
Sets the number of performed tests to ct. | |
void | setStatusText (const QString &text) |
Sets the text in the status bar. | |
void | setUnitTest (const QString &unit) |
Sets the unit test. | |
void | showErrorDialog (const char *title, const char *message) |
Shows an error dialog with title and message. | |
Static Public Member Functions | |
static void | destruct () |
Destructs the instance of this dialog. | |
static bool | hasInstance () |
Returns true if an instance of this dialog exists, false otherwise. | |
static UnitTestDialog * | instance () |
Creates and returns the one and only instance of this dialog. | |
Protected Member Functions | |
void | setProgressColor (const QColor &col) |
Sets the color to the progressbar to col. | |
UnitTestDialog (QWidget *parent=0, Qt::WFlags f=0) | |
Constructs a TestGui::UnitTestDialog as a child of 'parent', with the name 'name' and widget flags set to 'f'. | |
~UnitTestDialog () | |
Destroys the object and frees any allocated resources. |
Definition at line 33 of file UnitTestImp.h.
UnitTestDialog::UnitTestDialog | ( | QWidget * | parent = 0 , |
|
Qt::WFlags | f = 0 | |||
) | [protected] |
Constructs a TestGui::UnitTestDialog as a child of 'parent', with the name 'name' and widget flags set to 'f'.
The dialog will by default be modeless, unless you set 'modal' to TRUE to construct a modal dialog.
Definition at line 82 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::progressBar, setProgressColor(), TestGui::Ui_UnitTest::setupUi(), and TestGui::Ui_UnitTest::treeViewFailure.
Referenced by instance().
UnitTestDialog::~UnitTestDialog | ( | ) | [protected] |
Destroys the object and frees any allocated resources.
Definition at line 100 of file UnitTestImp.cpp.
void UnitTestDialog::addUnitTest | ( | const QString & | unit | ) |
Adds a unit test.
If a test with name unit already is added then nothing happens.
Definition at line 207 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::comboTests.
Referenced by setUnitTest().
void UnitTestDialog::clearErrorList | ( | ) |
Emtpies the error listview.
Definition at line 270 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::treeViewFailure.
Referenced by TestGui::UnitTestPy::clearErrorList(), and TestGui::UnitTestDialogPy::clearErrorList().
void UnitTestDialog::destruct | ( | void | ) | [static] |
Destructs the instance of this dialog.
Definition at line 58 of file UnitTestImp.cpp.
QString UnitTestDialog::getUnitTest | ( | ) | const |
Returns the unit test.
Definition at line 235 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::comboTests.
bool UnitTestDialog::hasInstance | ( | ) | [static] |
Returns true if an instance of this dialog exists, false otherwise.
Definition at line 70 of file UnitTestImp.cpp.
void UnitTestDialog::insertError | ( | const QString & | failure, | |
const QString & | details | |||
) |
Inserts an item with text failure to the listview.
details will be shown when double-clicking on the matching listitem.
Definition at line 279 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::treeViewFailure.
Referenced by TestGui::UnitTestPy::insertError(), and TestGui::UnitTestDialogPy::insertError().
UnitTestDialog * UnitTestDialog::instance | ( | void | ) | [static] |
Creates and returns the one and only instance of this dialog.
Definition at line 47 of file UnitTestImp.cpp.
References Gui::getMainWindow(), and UnitTestDialog().
Referenced by TestGui::UnitTestPy::clearErrorList(), TestGui::UnitTestDialogPy::clearErrorList(), TestGui::UnitTestPy::errorDialog(), TestGui::UnitTestDialogPy::errorDialog(), TestGui::UnitTestPy::getUnitTest(), TestGui::UnitTestDialogPy::getUnitTest(), TestGui::UnitTestPy::insertError(), TestGui::UnitTestDialogPy::insertError(), TestGui::UnitTestPy::setErrorCount(), TestGui::UnitTestDialogPy::setErrorCount(), TestGui::UnitTestPy::setFailCount(), TestGui::UnitTestDialogPy::setFailCount(), TestGui::UnitTestDialogPy::setProgressFrac(), TestGui::UnitTestPy::setProgressFraction(), TestGui::UnitTestPy::setRemainCount(), TestGui::UnitTestDialogPy::setRemainCount(), TestGui::UnitTestPy::setRunCount(), TestGui::UnitTestDialogPy::setRunCount(), TestGui::UnitTestPy::setStatusText(), TestGui::UnitTestDialogPy::setStatusText(), TestGui::UnitTestPy::setUnitTest(), and TestGui::UnitTestDialogPy::setUnitTest().
void UnitTestDialog::on_aboutButton_clicked | ( | ) | [slot] |
Shows the about dialog.
Definition at line 138 of file UnitTestImp.cpp.
void UnitTestDialog::on_helpButton_clicked | ( | ) | [slot] |
Shows the help dialog.
Definition at line 126 of file UnitTestImp.cpp.
void UnitTestDialog::on_startButton_clicked | ( | ) | [slot] |
Runs the unit tests.
Definition at line 149 of file UnitTestImp.cpp.
References Base::PyException::getStackTrace(), Base::Interpreter(), draftTools::msg(), reset(), setProgressColor(), showErrorDialog(), TestGui::Ui_UnitTest::startButton, and Base::Exception::what().
void UnitTestDialog::on_treeViewFailure_itemDoubleClicked | ( | QTreeWidgetItem * | item, | |
int | column | |||
) | [slot] |
Opens a dialog to display a detailed description about the error.
Definition at line 118 of file UnitTestImp.cpp.
void UnitTestDialog::reject | ( | void | ) |
void UnitTestDialog::reset | ( | void | ) |
Resets this dialog.
Definition at line 194 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::progressBar, TestGui::Ui_UnitTest::textLabelErrCt, TestGui::Ui_UnitTest::textLabelFailCt, TestGui::Ui_UnitTest::textLabelRemCt, TestGui::Ui_UnitTest::textLabelRunCt, and TestGui::Ui_UnitTest::treeViewFailure.
Referenced by on_startButton_clicked(), and reject().
void UnitTestDialog::setErrorCount | ( | int | ct | ) |
Sets the number of faulty tests to ct.
Definition at line 306 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::textLabelErrCt.
Referenced by TestGui::UnitTestPy::setErrorCount(), and TestGui::UnitTestDialogPy::setErrorCount().
void UnitTestDialog::setFailCount | ( | int | ct | ) |
Sets the number of failed tests to ct.
Definition at line 298 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::textLabelFailCt.
Referenced by TestGui::UnitTestPy::setFailCount(), and TestGui::UnitTestDialogPy::setFailCount().
void UnitTestDialog::setProgressColor | ( | const QColor & | col | ) | [protected] |
Sets the color to the progressbar to col.
Definition at line 107 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::progressBar.
Referenced by on_startButton_clicked(), setProgressFraction(), and UnitTestDialog().
void UnitTestDialog::setProgressFraction | ( | float | fraction, | |
const QString & | color = QString::null | |||
) |
Sets the progress of the progress bar whereas fraction is in between 0.0 and 1.0.
It also sets the color of the progress bar to red if a failure or error in the unit test occurred.
Definition at line 253 of file UnitTestImp.cpp.
References SketcherExample::f, TestGui::Ui_UnitTest::progressBar, and setProgressColor().
Referenced by TestGui::UnitTestDialogPy::setProgressFrac(), and TestGui::UnitTestPy::setProgressFraction().
void UnitTestDialog::setRemainCount | ( | int | ct | ) |
Sets the number of remaining tests to ct.
Definition at line 314 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::textLabelRemCt.
Referenced by TestGui::UnitTestPy::setRemainCount(), and TestGui::UnitTestDialogPy::setRemainCount().
void UnitTestDialog::setRunCount | ( | int | ct | ) |
Sets the number of performed tests to ct.
Definition at line 290 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::textLabelRunCt.
Referenced by TestGui::UnitTestPy::setRunCount(), and TestGui::UnitTestDialogPy::setRunCount().
void UnitTestDialog::setStatusText | ( | const QString & | text | ) |
Sets the text in the status bar.
Definition at line 243 of file UnitTestImp.cpp.
References TestGui::Ui_UnitTest::textLabelStatus.
Referenced by TestGui::UnitTestPy::setStatusText(), and TestGui::UnitTestDialogPy::setStatusText().
void UnitTestDialog::setUnitTest | ( | const QString & | unit | ) |
Sets the unit test.
If the item is not there yet it gets added.
Definition at line 221 of file UnitTestImp.cpp.
References addUnitTest(), and TestGui::Ui_UnitTest::comboTests.
Referenced by TestGui::UnitTestPy::setUnitTest(), and TestGui::UnitTestDialogPy::setUnitTest().
void UnitTestDialog::showErrorDialog | ( | const char * | title, | |
const char * | message | |||
) |
Shows an error dialog with title and message.
Definition at line 177 of file UnitTestImp.cpp.
Referenced by TestGui::UnitTestPy::errorDialog(), TestGui::UnitTestDialogPy::errorDialog(), and on_startButton_clicked().