tests: add initApplication() to avoid code duplications

This commit is contained in:
wmayer
2023-10-21 18:34:21 +02:00
committed by Chris Hennes
parent 06ef58c885
commit 931fcdabbf
8 changed files with 37 additions and 36 deletions

View File

@@ -0,0 +1,21 @@
#ifndef TEST_APPLICATION_H
#define TEST_APPLICATION_H
#include <App/Application.h>
namespace tests
{
static void initApplication()
{
if (App::Application::GetARGC() == 0) {
constexpr int argc = 1;
std::array<const char*, argc> argv {"FreeCAD"};
App::Application::Config()["ExeName"] = "FreeCAD";
App::Application::init(argc, const_cast<char**>(argv.data())); // NOLINT
}
}
} // namespace tests
#endif // TEST_APPLICATION_H