From 0b7ce873403b1d4255496c72f9a06ae2def2bf98 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 10 Oct 2017 20:40:09 +0200 Subject: [PATCH] allow to set console and unit test option without overriding each other start unit tests in command line mode because the python pivy package is missing --- .travis.yml | 2 +- src/App/Application.cpp | 1 + src/Main/MainGui.cpp | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fdb6b76dac..8929a4c4cc 100755 --- a/.travis.yml +++ b/.travis.yml @@ -236,7 +236,7 @@ script: # Install FreeCAD and run unit tests. Test failures will fail the build ## - sudo make -j2 install - - ${INSTALLED_APP_PATH} --run-test 0 + - ${INSTALLED_APP_PATH} --console --run-test 0 - ${INSTALLED_APP_PATH} --log-file /tmp/FreeCAD_installed.log & - sleep 10 && pkill FreeCAD - cat /tmp/FreeCAD_installed.log diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 3f37233e6c..81b16ae1f0 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -2034,6 +2034,7 @@ void Application::ParseOptions(int ac, char ** av) } if (vm.count("console")) { + mConfig["Console"] = "1"; mConfig["RunMode"] = "Cmd"; } diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 37b7f24b97..aeabd66c71 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -149,6 +149,7 @@ int main( int argc, char ** argv ) // Init phase =========================================================== // sets the default run mode for FC, starts with gui if not overridden in InitConfig... App::Application::Config()["RunMode"] = "Gui"; + App::Application::Config()["Console"] = "0"; // Inits the Application #if defined (FC_OS_WIN32) @@ -242,6 +243,9 @@ int main( int argc, char ** argv ) std::streambuf* oldcerr = std::cerr.rdbuf(&stdcerr); try { + // if console option is set then run in cmd mode + if (App::Application::Config()["Console"] == "1") + App::Application::runApplication(); if (App::Application::Config()["RunMode"] == "Gui" || App::Application::Config()["RunMode"] == "Internal") Gui::Application::runApplication();