summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-07-17 14:45:22 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-07-17 18:13:19 +0200
commit69586e8381037417d106d8474d9f73638c5b9c55 (patch)
tree20a7cf1545dbb459f20046c73d80bb48a0dab30c /desktop/source
parentaa938fe03cfb968f7f4ed9760dcbe579a74bdc02 (diff)
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/app/sofficemain.cxx10
1 files changed, 10 insertions, 0 deletions
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 <prewin.h>
+#if defined _WIN32
+#include <systools/win32/test_desktop.hxx>
+#endif
+
#include <rtl/bootstrap.hxx>
#include <sal/main.h>
#include <tools/extendapplicationenvironment.hxx>
@@ -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