Gui: make unit tests working from command line if Gui is up

This commit is contained in:
wmayer
2022-12-24 19:13:40 +01:00
parent 3b8b9c3c49
commit fa6dc8d0e1
4 changed files with 44 additions and 9 deletions

View File

@@ -121,6 +121,7 @@ public:
add_varargs_method("UnitTest",&Module::new_UnitTest,"UnitTest");
add_varargs_method("setTest",&Module::setTest,"setTest");
add_varargs_method("addTest",&Module::addTest,"addTest");
add_varargs_method("runTest",&Module::runTest,"runTest");
add_varargs_method("testILoggerBlocker",&Module::testILoggerBlocker,"testILoggerBlocker");
initialize("This module is the QtUnitGui module"); // register with Python
}
@@ -160,6 +161,15 @@ private:
dlg->raise();
return Py::None();
}
Py::Object runTest(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
throw Py::Exception();
TestGui::UnitTestDialog* dlg = TestGui::UnitTestDialog::instance();
bool success = dlg->runCurrentTest();
return Py::Boolean(success);
}
Py::Object testILoggerBlocker(const Py::Tuple& args) {
(void) args;
ILoggerBlockerTest iltest;