diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-17 12:16:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-17 15:21:57 +0200 |
commit | 69e7000ed420faf513002076089aca82bddfbc28 (patch) | |
tree | ac34589617f15a2be40b57a7c2296565022683f4 /sd | |
parent | c1b00424f17eaea8f55565dae285521c1ec4d042 (diff) |
Simplify checking for "running under unit/ui test"
In various places, the code checks if we are running as a unit test or a
UI test. This code grew organically, and is most re-using environment
variables that were designed for narrower purposes.
Rather than being clever, just add two new explicit and simple
environment variables in the natural place (the command that runs them),
and check for those variables in the code.
Change-Id: Icce0997914fa0be30a5ac1f29bd870bdb5893a8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170618
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/framework/module/SlideSorterModule.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx b/sd/source/ui/framework/module/SlideSorterModule.cxx index 6b6987df2968..80e97aeb8022 100644 --- a/sd/source/ui/framework/module/SlideSorterModule.cxx +++ b/sd/source/ui/framework/module/SlideSorterModule.cxx @@ -81,8 +81,9 @@ SlideSorterModule::SlideSorterModule ( UpdateViewTabBar(nullptr); + static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST"); if (officecfg::Office::Impress::MultiPaneGUI::SlideSorterBar::Visible::ImpressView::get().value_or(true) - && (!getenv("LO_TESTNAME") || !comphelper::LibreOfficeKit::isActive())) + && (!bRunningUnitTest || !comphelper::LibreOfficeKit::isActive())) AddActiveMainView(FrameworkHelper::msImpressViewURL); if (officecfg::Office::Impress::MultiPaneGUI::SlideSorterBar::Visible::OutlineView::get().value_or(true)) AddActiveMainView(FrameworkHelper::msOutlineViewURL); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index d30840feb64d..3bc5d96770e9 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2779,7 +2779,8 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs auto xChanges = comphelper::ConfigurationChanges::create(); officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, xChanges); - if (!getenv("LO_TESTNAME") || !comphelper::LibreOfficeKit::isActive()) + static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST"); + if (!bRunningUnitTest || !comphelper::LibreOfficeKit::isActive()) officecfg::Office::Impress::MultiPaneGUI::SlideSorterBar::Visible::ImpressView::set(true,xChanges); xChanges->commit(); |