summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/AdditionsDialog.cxx2
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/queryiter.cxx8
-rw-r--r--sd/source/ui/framework/module/SlideSorterModule.cxx3
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx3
-rw-r--r--sfx2/source/view/viewfrm.cxx7
-rw-r--r--solenv/gbuild/CppunitTest.mk1
-rw-r--r--solenv/gbuild/UITest.mk1
-rw-r--r--svtools/source/control/ctrlbox.cxx5
-rw-r--r--vcl/inc/salinst.hxx4
-rw-r--r--vcl/inc/skia/utils.hxx4
-rw-r--r--vcl/source/app/salvtables.cxx9
-rw-r--r--vcl/source/app/settings.cxx3
-rw-r--r--vcl/source/filter/graphicfilter.cxx6
-rw-r--r--vcl/source/font/fontcache.cxx2
15 files changed, 36 insertions, 24 deletions
diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 3f57676a13ec..01be684d1d86 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -278,7 +278,7 @@ SearchAndParseThread::SearchAndParseThread(AdditionsDialog* pDialog, const bool
{
// if we are running a UITest, e.g. UITest_sw_options then
// don't attempt to downloading anything
- static const bool bUITest = getenv("LIBO_TEST_UNIT");
+ static const bool bUITest = getenv("LO_RUNNING_UI_TEST");
m_bUITest = bUITest;
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 49cdd8d8fb81..1c64bb8f334f 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -102,7 +102,7 @@ ScSheetLimits ScSheetLimits::CreateDefault()
if( SC_MOD())
jumboSheets = SC_MOD()->GetDefaultsOptions().GetInitJumboSheets();
else
- assert( getenv("LO_TESTNAME") != nullptr ); // in unittests
+ assert( getenv("LO_RUNNING_UNIT_TEST") != nullptr ); // in unittests
if (jumboSheets)
return ScSheetLimits(MAXCOL_JUMBO, MAXROW_JUMBO);
else
diff --git a/sc/source/core/data/queryiter.cxx b/sc/source/core/data/queryiter.cxx
index 72a3cc1dcf3e..11b4bb725ce6 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -1625,25 +1625,25 @@ static bool CanBeUsedForSorterCache(ScDocument& /*rDoc*/, const ScQueryParam& /*
&& rParam.GetEntry(0).eOp != SC_EQUAL)
return false;
// For unittests allow inefficient caching, in order for the code to be checked.
- static bool inUnitTest = getenv("LO_TESTNAME") != nullptr;
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
if(refData == nullptr || refData->Ref1.IsRowRel() || refData->Ref2.IsRowRel())
{
// If this is not a range, then a cache is not worth it. If rows are relative, then each
// computation will use a different area, so the cache wouldn't be reused. Tab/cols are
// not a problem, because formula group computations are done for the same tab/col.
- if(!inUnitTest)
+ if(!bRunningUnitTest)
return false;
}
if(rParam.nRow2 - rParam.nRow1 < 10)
{
- if(!inUnitTest)
+ if(!bRunningUnitTest)
return false;
}
if( !cell )
return false;
if( !cell->GetCellGroup() || cell->GetCellGroup()->mnLength < 10 )
{
- if(!inUnitTest)
+ if(!bRunningUnitTest)
return false;
}
// Check that all the relevant caches would be valid (may not be the case when mixing
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();
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index b5bd686aa62a..458ab766f0d9 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1458,17 +1458,18 @@ bool SfxApplication::IsHeadlessOrUITest()
if (Application::IsHeadlessModeEnabled())
return true;
- bool bIsUITest = getenv("LO_TESTNAME") == nullptr; //uitest.uicheck fails when the dialog is open
+ static const bool bIsUITest = getenv("LO_RUNNING_UI_TEST"); //uitest.uicheck fails when the dialog is open
+ bool bRet = bIsUITest;
for (sal_uInt16 i = 0, nCount = Application::GetCommandLineParamCount(); i < nCount; ++i)
{
if (Application::GetCommandLineParam(i) == "--nologo")
{
- bIsUITest = true;
+ bRet = true;
break;
}
}
- return bIsUITest;
+ return bRet;
}
bool SfxApplication::IsTipOfTheDayDue()
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index cfca2bbbf570..7ff3caec5f31 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -153,6 +153,7 @@ else
PYTHONDONTWRITEBYTECODE=1) \
$(if $(filter gdb,$(CPPUNITTRACE)),\
PYTHONWARNINGS=default) \
+ LO_RUNNING_UNIT_TEST=1 \
$(ICECREAM_RUN) $(gb_CppunitTest_coredumpctl_run) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_RR) \
$(gb_CppunitTest_CPPTESTCOMMAND) \
$(call gb_CppunitTest_get_linktarget_target,$*) \
diff --git a/solenv/gbuild/UITest.mk b/solenv/gbuild/UITest.mk
index e49dbed2fe8f..7f0597f15293 100644
--- a/solenv/gbuild/UITest.mk
+++ b/solenv/gbuild/UITest.mk
@@ -74,6 +74,7 @@ else
PYTHONPATH="$(PYPATH)" \
TestUserDir="$(call gb_Helper_make_url,$(dir $(call gb_UITest_get_target,$*)))" \
PYTHONDONTWRITEBYTECODE=0 \
+ LO_RUNNING_UI_TEST=1 \
$(if $(ENABLE_WERROR),PYTHONWARNINGS=error) \
$(if $(filter WNT,$(OS)),TZ=) \
$(gb_TEST_ENV_VARS) \
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index a4b293b7629e..5297fa43f543 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -528,7 +528,10 @@ void FontNameBox::Fill( const FontList* pList )
set_active_or_entry_text(aOldText);
}
-static bool IsRunningUnitTest() { return getenv("LO_TESTNAME") != nullptr; }
+static bool IsRunningUnitTest() {
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+ return bRunningUnitTest;
+}
void FontNameBox::EnableWYSIWYG(bool bEnable)
{
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 45c031db30ae..b356a4514aee 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -211,9 +211,7 @@ public:
virtual void BeforeAbort(const OUString& /* rErrorText */, bool /* bDumpCore */) {}
- // Note: we cannot make this a global variable, because it might be initialised BEFORE the putenv() call in cppunittester.
- static bool IsRunningUnitTest() { return getenv("LO_TESTNAME") != nullptr; }
-
+ static bool IsRunningUnitTest();
static bool IsRunningUITest();
// both must be implemented, if the VCL plugin needs to run via system event loop
diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx
index e1bed3dffdd9..99bac8e4c877 100644
--- a/vcl/inc/skia/utils.hxx
+++ b/vcl/inc/skia/utils.hxx
@@ -143,8 +143,8 @@ inline bool isUnitTestRunning(const char* name = nullptr)
{
if (name == nullptr)
{
- static const char* const testname = getenv("LO_TESTNAME");
- if (testname != nullptr)
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+ if (bRunningUnitTest)
return true;
return !vcl::test::activeGraphicsRenderTest().isEmpty();
}
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 67ac9f971a63..d80cf3facc00 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -181,9 +181,16 @@ void SalInstance::DoQuit()
}
// static
+bool SalInstance::IsRunningUnitTest()
+{
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+ return bRunningUnitTest;
+}
+
+// static
bool SalInstance::IsRunningUITest()
{
- static const bool bRunningUITest = getenv("LIBO_TEST_UNIT");
+ static const bool bRunningUITest = getenv("LO_RUNNING_UI_TEST");
return bRunningUITest;
}
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 3a9df910c06d..b2b1bcbbedf1 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2788,7 +2788,8 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable )
mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
- if (getenv("LO_TESTNAME") != nullptr)
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+ if (bRunningUnitTest)
return; // No registry changing; no SettingsConfigItem modification
HKEY hkey;
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 18bd05d107ba..b89d6dfea75f 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -100,10 +100,8 @@
static bool supportNativeWebp()
{
// Enable support only for unittests
- const char* const testname = getenv("LO_TESTNAME");
- if(testname)
- return true;
- return false;
+ static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+ return bRunningUnitTest;
}
static std::vector< GraphicFilter* > gaFilterHdlList;
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index ce4ba6adf64c..d8c0bf191379 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -173,7 +173,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont
}
#endif
- static const size_t FONTCACHE_MAX = getenv("LO_TESTNAME") ? 1 : 50;
+ static const size_t FONTCACHE_MAX = getenv("LO_RUNNING_UNIT_TEST") ? 1 : 50;
if (maFontInstanceList.size() >= FONTCACHE_MAX)
{