Skip to content

Commit

Permalink
test: force EnableHeadlessMode() for PythonTest
Browse files Browse the repository at this point in the history
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 <ci@libreoffice.org>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
  • Loading branch information
Michael Stahl authored and mikekaganski committed May 11, 2018
1 parent 36a6882 commit e57462c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/test/setupvcl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down
2 changes: 1 addition & 1 deletion test/source/bootstrapfixture.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
4 changes: 2 additions & 2 deletions test/source/setupvcl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
Expand Down

0 comments on commit e57462c

Please sign in to comment.