From e57462cd7b08df2794b1c81e7bb15ed96afef1f1 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 10 May 2018 15:45:30 +0200 Subject: [PATCH] test: force EnableHeadlessMode() for PythonTest Clearly this should be on, but we can't easily pass in a command line argument like is done in CppunitTest because that doesn't end up in rtl_getAppCommandArg(), which is empty since it's the python.bin process, so we'd have to find a way to get the argv from python first... Change-Id: I9321a9f933f388a659643898e0dc38f295f2068c Reviewed-on: https://gerrit.libreoffice.org/54083 Tested-by: Jenkins Reviewed-by: Michael Stahl --- include/test/setupvcl.hxx | 2 +- test/source/bootstrapfixture.cxx | 2 +- test/source/setupvcl.cxx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/test/setupvcl.hxx b/include/test/setupvcl.hxx index e7a1d08bba2c9..78d4683e50ce5 100644 --- a/include/test/setupvcl.hxx +++ b/include/test/setupvcl.hxx @@ -17,7 +17,7 @@ namespace test { // Calls InitVCL etc.; needed from multiple places in the test infrastructure: -OOO_DLLPUBLIC_TEST_SETUPVCL void setUpVcl(); +OOO_DLLPUBLIC_TEST_SETUPVCL void setUpVcl(bool forceHeadless = false); } diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index 99fd73151dfb2..0808a6d4f9e72 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -92,7 +92,7 @@ SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory) try { ::comphelper::setProcessServiceFactory(pFactory); - test::setUpVcl(); + test::setUpVcl(true); // hard-code python tests to headless test_init_impl(false, true, pFactory); } catch (...) { abort(); } diff --git a/test/source/setupvcl.cxx b/test/source/setupvcl.cxx index 99f17b7fb0565..ff6eec8b8605e 100644 --- a/test/source/setupvcl.cxx +++ b/test/source/setupvcl.cxx @@ -57,7 +57,7 @@ IMPL_STATIC_LINK_NOARG(Hook, deinitHook, LinkParamNone *, void) { } -void test::setUpVcl() { +void test::setUpVcl(bool const forceHeadless) { // Force locale (and resource files loaded): OUString locale; if (getenv("LO_TEST_LOCALE") != nullptr) @@ -72,7 +72,7 @@ void test::setUpVcl() { MsLangId::setConfiguredSystemUILanguage(tag.getLanguageType(false)); LanguageTag::setConfiguredSystemLanguage(tag.getLanguageType(false)); InitVCL(); - if (isHeadless()) { + if (forceHeadless || isHeadless()) { Application::EnableHeadlessMode(false); } Application::setDeInitHook(LINK(nullptr, Hook, deinitHook));