From 69586e8381037417d106d8474d9f73638c5b9c55 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 17 Jul 2024 14:45:22 +0500 Subject: UI tests: use a dedicated desktop on Windows Similar to commit 1f24d35033c2f02335ce254bbcf6ba89e1b7565e (cppunittester: use a dedicated desktop on Windows, 2023-07-09), this change allows to run UI tests on Windows without them interferring with what you are doing. The code testing LIBO_TEST_DEFAULT_DESKTOP environment variable to avoid the separate desktop, and creating it, is extracted to a new function in systools. Change-Id: I6df3cb4ae581ae289e49b47d3135d01f632fbd95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170615 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- desktop/source/app/sofficemain.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'desktop/source/app/sofficemain.cxx') diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 33881784d45c..7e38ac2b2807 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -29,6 +29,10 @@ // needed before sal/main.h to avoid redefinition of macros #include +#if defined _WIN32 +#include +#endif + #include #include #include @@ -51,6 +55,12 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() { +#if defined _WIN32 + // If this is a UI test, we may need to switch to a dedicated desktop + if (getenv("LO_RUNNING_UI_TEST") != nullptr) + sal::systools::maybeCreateTestDesktop(); +#endif + sal_detail_initialize(sal::detail::InitializeSoffice, nullptr); #if HAVE_FEATURE_BREAKPAD -- cgit