cui/source/dialogs/AdditionsDialog.cxx              |    5 +--
 desktop/source/app/sofficemain.cxx                  |    3 +-
 include/o3tl/test_info.hxx                          |   29 ++++++++++++++++++++
 sc/source/core/data/documen2.cxx                    |    3 +-
 sc/source/core/data/queryiter.cxx                   |    2 -
 sd/source/ui/framework/module/SlideSorterModule.cxx |    4 +-
 sd/source/ui/unoidl/unomodel.cxx                    |    4 +-
 sfx2/source/view/viewfrm.cxx                        |    5 +--
 svtools/source/control/ctrlbox.cxx                  |    8 +----
 vcl/inc/salinst.hxx                                 |    3 --
 vcl/inc/skia/utils.hxx                              |    4 +-
 vcl/osx/salinst.cxx                                 |    3 +-
 vcl/osx/service_entry.cxx                           |    4 ++
 vcl/source/app/salvtables.cxx                       |   14 ---------
 vcl/source/app/settings.cxx                         |    4 +-
 vcl/source/components/dtranscomp.cxx                |    5 ++-
 vcl/source/filter/graphicfilter.cxx                 |    4 +-
 vcl/source/font/fontcache.cxx                       |    3 +-
 vcl/source/window/dialog.cxx                        |    3 +-
 vcl/unx/generic/dtrans/X11_service.cxx              |    5 ++-
 vcl/unx/gtk3/gtkinst.cxx                            |    3 +-
 vcl/win/dtrans/WinClipboard.cxx                     |    4 +-
 22 files changed, 70 insertions(+), 52 deletions(-)

New commits:
commit 68a96f747345dd55bcb6abdd8eee0e2d9768c9ec
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jul 17 19:18:32 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Jul 17 19:15:31 2024 +0200

    Use IsRunningUnitTest / IsRunningUITest consistently
    
    The functions are moved to o3tl as inline functions.
    
    Change-Id: Ief7d7e292ef15e055ad04ab5707e5e6a2a05b916
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170636
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/cui/source/dialogs/AdditionsDialog.cxx 
b/cui/source/dialogs/AdditionsDialog.cxx
index 01be684d1d86..705d6b7e56b6 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -19,6 +19,7 @@
 #include <dialmgr.hxx>
 #include <strings.hrc>
 
+#include <o3tl/test_info.hxx>
 #include <sal/log.hxx>
 
 #include <com/sun/star/graphic/GraphicProvider.hpp>
@@ -278,9 +279,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("LO_RUNNING_UI_TEST");
-
-    m_bUITest = bUITest;
+    m_bUITest = o3tl::IsRunningUITest();
 }
 
 SearchAndParseThread::~SearchAndParseThread() {}
diff --git a/desktop/source/app/sofficemain.cxx 
b/desktop/source/app/sofficemain.cxx
index 7e38ac2b2807..9470add3b488 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -30,6 +30,7 @@
 #include <prewin.h>
 
 #if defined _WIN32
+#include <o3tl/test_info.hxx>
 #include <systools/win32/test_desktop.hxx>
 #endif
 
@@ -57,7 +58,7 @@ 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)
+    if (o3tl::IsRunningUITest())
         sal::systools::maybeCreateTestDesktop();
 #endif
 
diff --git a/include/o3tl/test_info.hxx b/include/o3tl/test_info.hxx
new file mode 100644
index 000000000000..64bd64f2d5b0
--- /dev/null
+++ b/include/o3tl/test_info.hxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <stdlib.h>
+
+namespace o3tl
+{
+inline bool IsRunningUnitTest()
+{
+    static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+    return bRunningUnitTest;
+}
+
+inline bool IsRunningUITest()
+{
+    static const bool bRunningUITest = getenv("LO_RUNNING_UI_TEST");
+    return bRunningUITest;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1c64bb8f334f..028975850f96 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -20,6 +20,7 @@
 #include <scextopt.hxx>
 #include <autonamecache.hxx>
 
+#include <o3tl/test_info.hxx>
 #include <osl/thread.h>
 #include <svx/xtable.hxx>
 #include <sfx2/bindings.hxx>
@@ -102,7 +103,7 @@ ScSheetLimits ScSheetLimits::CreateDefault()
     if( SC_MOD())
         jumboSheets = SC_MOD()->GetDefaultsOptions().GetInitJumboSheets();
     else
-        assert( getenv("LO_RUNNING_UNIT_TEST") != nullptr ); // in unittests
+        assert(o3tl::IsRunningUnitTest());
     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 11b4bb725ce6..ae8b5b2a38e8 100644
--- a/sc/source/core/data/queryiter.cxx
+++ b/sc/source/core/data/queryiter.cxx
@@ -1625,7 +1625,7 @@ 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 const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
+    static const bool bRunningUnitTest = o3tl::IsRunningUnitTest();
     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
diff --git a/sd/source/ui/framework/module/SlideSorterModule.cxx 
b/sd/source/ui/framework/module/SlideSorterModule.cxx
index 80e97aeb8022..b572f59ec9e9 100644
--- a/sd/source/ui/framework/module/SlideSorterModule.cxx
+++ b/sd/source/ui/framework/module/SlideSorterModule.cxx
@@ -22,6 +22,7 @@
 #include <comphelper/lok.hxx>
 #include <framework/FrameworkHelper.hxx>
 #include <framework/ConfigurationController.hxx>
+#include <o3tl/test_info.hxx>
 #include <officecfg/Office/Impress.hxx>
 #include <DrawController.hxx>
 #include <com/sun/star/drawing/framework/XTabBar.hpp>
@@ -81,9 +82,8 @@ 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)
-        && (!bRunningUnitTest || !comphelper::LibreOfficeKit::isActive()))
+        && (!o3tl::IsRunningUnitTest() || 
!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 3bc5d96770e9..b05fc83a676d 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -61,6 +61,7 @@
 #include <svx/svdoutl.hxx>
 #include <o3tl/safeint.hxx>
 #include <o3tl/string_view.hxx>
+#include <o3tl/test_info.hxx>
 #include <o3tl/unit_conversion.hxx>
 #include <svx/UnoNamespaceMap.hxx>
 #include <svx/svdlayer.hxx>
@@ -2779,8 +2780,7 @@ void 
SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
     auto xChanges = comphelper::ConfigurationChanges::create();
     officecfg::Office::Common::Save::Document::WarnAlienFormat::set(false, 
xChanges);
 
-    static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-    if (!bRunningUnitTest || !comphelper::LibreOfficeKit::isActive())
+    if (!o3tl::IsRunningUnitTest() || !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 458ab766f0d9..6925d9ea0a4b 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -20,6 +20,7 @@
 #include <config_feature_desktop.h>
 #include <config_wasm_strip.h>
 
+#include <o3tl/test_info.hxx>
 #include <osl/file.hxx>
 #include <sfx2/docfilt.hxx>
 #include <sfx2/infobar.hxx>
@@ -1458,9 +1459,7 @@ bool SfxApplication::IsHeadlessOrUITest()
     if (Application::IsHeadlessModeEnabled())
         return true;
 
-    static const bool bIsUITest = getenv("LO_RUNNING_UI_TEST"); 
//uitest.uicheck fails when the dialog is open
-
-    bool bRet = bIsUITest;
+    bool bRet = o3tl::IsRunningUITest(); //uitest.uicheck fails when the 
dialog is open
     for (sal_uInt16 i = 0, nCount = Application::GetCommandLineParamCount(); i 
< nCount; ++i)
     {
         if (Application::GetCommandLineParam(i) == "--nologo")
diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 5297fa43f543..c82a0d6cf0d8 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -22,6 +22,7 @@
 
 #include <comphelper/lok.hxx>
 #include <i18nutil/unicode.hxx>
+#include <o3tl/test_info.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <tools/stream.hxx>
 #include <vcl/customweld.hxx>
@@ -528,14 +529,9 @@ void FontNameBox::Fill( const FontList* pList )
         set_active_or_entry_text(aOldText);
 }
 
-static bool IsRunningUnitTest() {
-    static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-    return bRunningUnitTest;
-}
-
 void FontNameBox::EnableWYSIWYG(bool bEnable)
 {
-    if (IsRunningUnitTest())
+    if (o3tl::IsRunningUnitTest())
         return;
     if (mbWYSIWYG == bEnable)
         return;
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index b356a4514aee..380ee2ce202e 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -211,9 +211,6 @@ public:
 
     virtual void BeforeAbort(const OUString& /* rErrorText */, bool /* 
bDumpCore */) {}
 
-    static bool IsRunningUnitTest();
-    static bool IsRunningUITest();
-
     // both must be implemented, if the VCL plugin needs to run via system 
event loop
     virtual bool DoExecute(int &nExitCode);
     virtual void DoQuit();
diff --git a/vcl/inc/skia/utils.hxx b/vcl/inc/skia/utils.hxx
index 99bac8e4c877..3ff966114b27 100644
--- a/vcl/inc/skia/utils.hxx
+++ b/vcl/inc/skia/utils.hxx
@@ -22,6 +22,7 @@
 
 #include <vcl/skia/SkiaHelper.hxx>
 
+#include <o3tl/test_info.hxx>
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
 #include <driverblocklist.hxx>
@@ -143,8 +144,7 @@ inline bool isUnitTestRunning(const char* name = nullptr)
 {
     if (name == nullptr)
     {
-        static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-        if (bRunningUnitTest)
+        if (o3tl::IsRunningUnitTest())
             return true;
         return !vcl::test::activeGraphicsRenderTest().isEmpty();
     }
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index e8543fcda19c..31f02b5dcb2c 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -32,6 +32,7 @@
 #include <comphelper/solarmutex.hxx>
 
 #include <comphelper/lok.hxx>
+#include <o3tl/test_info.hxx>
 
 #include <osl/process.h>
 
@@ -647,7 +648,7 @@ bool AquaSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents)
             // events, we can end up blocking and waiting forever so
             // don't block and wait when running unit tests.
             pEvent = [NSApp nextEventMatchingMask: NSEventMaskAny
-                            untilDate: SalInstance::IsRunningUnitTest() ? 
[NSDate distantPast] : [NSDate distantFuture]
+                            untilDate: o3tl::IsRunningUnitTest() ? [NSDate 
distantPast] : [NSDate distantFuture]
                             inMode: NSDefaultRunLoopMode
                             dequeue: YES];
             if( pEvent )
diff --git a/vcl/osx/service_entry.cxx b/vcl/osx/service_entry.cxx
index a970b6a65917..ce8671c05531 100644
--- a/vcl/osx/service_entry.cxx
+++ b/vcl/osx/service_entry.cxx
@@ -17,7 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <o3tl/test_info.hxx>
 #include <vcl/svapp.hxx>
 #include <dndhelper.hxx>
 #include <vcl/sysdata.hxx>
@@ -38,7 +40,7 @@ using namespace ::com::sun::star::datatransfer::clipboard;
 
 uno::Reference< XInterface > AquaSalInstance::CreateClipboard( const Sequence< 
Any >& i_rArguments )
 {
-    if ( Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || 
IsRunningUITest() )
+    if ( Application::IsHeadlessModeEnabled() || o3tl::IsRunningUnitTest() || 
o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( i_rArguments );
 
     SalData* pSalData = GetSalData();
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d80cf3facc00..353f3ecfb285 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -180,20 +180,6 @@ void SalInstance::DoQuit()
         std::abort();
 }
 
-// static
-bool SalInstance::IsRunningUnitTest()
-{
-    static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-    return bRunningUnitTest;
-}
-
-// static
-bool SalInstance::IsRunningUITest()
-{
-    static const bool bRunningUITest = getenv("LO_RUNNING_UI_TEST");
-    return bRunningUITest;
-}
-
 SalTimer::~SalTimer() COVERITY_NOEXCEPT_FALSE {}
 
 void SalBitmap::DropScaledCache()
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index b2b1bcbbedf1..e53f89d057b6 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -26,6 +26,7 @@
 #endif
 
 #include <comphelper/processfactory.hxx>
+#include <o3tl/test_info.hxx>
 #include <rtl/bootstrap.hxx>
 
 #include <i18nlangtag/mslangid.hxx>
@@ -2788,8 +2789,7 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable )
 
         mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
 
-        static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-        if (bRunningUnitTest)
+        if (o3tl::IsRunningUnitTest())
             return; // No registry changing; no SettingsConfigItem modification
 
         HKEY hkey;
diff --git a/vcl/source/components/dtranscomp.cxx 
b/vcl/source/components/dtranscomp.cxx
index 9c052468aaef..bb771b2dca81 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -21,6 +21,7 @@
 
 #include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
+#include <o3tl/test_info.hxx>
 #include <osl/mutex.hxx>
 #include <tools/debug.hxx>
 #include <vcl/svapp.hxx>
@@ -446,7 +447,7 @@ Reference< XInterface > SalInstance::CreateDragSource(const 
SystemEnvData* pSysE
 {
     // We run unit tests in parallel, which is a problem when touching a 
shared resource
     // the system clipboard, so rather use the dummy GenericClipboard.
-    if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || 
IsRunningUITest())
+    if (Application::IsHeadlessModeEnabled() || o3tl::IsRunningUnitTest() || 
o3tl::IsRunningUITest())
         return getXWeak(new vcl::GenericDragSource());
     return ImplCreateDragSource(pSysEnv);
 }
@@ -459,7 +460,7 @@ uno::Reference<uno::XInterface> 
SalInstance::ImplCreateDropTarget(const SystemEn
 Reference< XInterface > SalInstance::CreateDropTarget(const SystemEnvData* 
pSysEnv)
 {
     // see SalInstance::CreateDragSource
-    if (Application::IsHeadlessModeEnabled() || IsRunningUnitTest() || 
IsRunningUITest())
+    if (Application::IsHeadlessModeEnabled() || o3tl::IsRunningUnitTest() || 
o3tl::IsRunningUITest())
         return getXWeak(new vcl::GenericDropTarget());
     return ImplCreateDropTarget(pSysEnv);
 }
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index b89d6dfea75f..111bd905eb33 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -86,6 +86,7 @@
 #include <mutex>
 #include <string_view>
 #include <o3tl/string_view.hxx>
+#include <o3tl/test_info.hxx>
 #include <vcl/TypeSerializer.hxx>
 
 #include "FilterConfigCache.hxx"
@@ -100,8 +101,7 @@
 static bool supportNativeWebp()
 {
     // Enable support only for unittests
-    static const bool bRunningUnitTest = getenv("LO_RUNNING_UNIT_TEST");
-    return bRunningUnitTest;
+    return o3tl::IsRunningUnitTest();
 }
 
 static std::vector< GraphicFilter* > gaFilterHdlList;
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index d8c0bf191379..70f29d37074a 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -25,6 +25,7 @@
 #include <font/PhysicalFontFace.hxx>
 #include <font/PhysicalFontFamily.hxx>
 #include <font/LogicalFontInstance.hxx>
+#include <o3tl/test_info.hxx>
 #include <tools/debug.hxx>
 #include <impfontcache.hxx>
 
@@ -173,7 +174,7 @@ rtl::Reference<LogicalFontInstance> 
ImplFontCache::GetFontInstance( PhysicalFont
         }
 #endif
 
-        static const size_t FONTCACHE_MAX = getenv("LO_RUNNING_UNIT_TEST") ? 1 
: 50;
+        static const size_t FONTCACHE_MAX = o3tl::IsRunningUnitTest() ? 1 : 50;
 
         if (maFontInstanceList.size() >= FONTCACHE_MAX)
         {
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index da3ac79345c6..7a6c45eedd91 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -29,6 +29,7 @@
 #include <comphelper/lok.hxx>
 #include <comphelper/scopeguard.hxx>
 #include <comphelper/processfactory.hxx>
+#include <o3tl/test_info.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <osl/diagnose.h>
 
@@ -957,7 +958,7 @@ bool Dialog::ImplStartExecute()
                     SAL_WARN("lok.dialog", "Dialog \"" << 
ImplGetDialogText(this) << "\" is being synchronously executed over an existing 
synchronously executing dialog.");
             }
 
-            if (SalInstance::IsRunningUnitTest())
+            if (o3tl::IsRunningUnitTest())
             { // helps starbasic unit tests show their errors
                 std::cerr << "Dialog \"" << ImplGetDialogText(this)
                           << "\"cancelled in silent mode";
diff --git a/vcl/unx/generic/dtrans/X11_service.cxx 
b/vcl/unx/generic/dtrans/X11_service.cxx
index 19f8b20fda05..1b6715f05b83 100644
--- a/vcl/unx/generic/dtrans/X11_service.cxx
+++ b/vcl/unx/generic/dtrans/X11_service.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <o3tl/test_info.hxx>
 #include <unx/salinst.h>
 #include <dndhelper.hxx>
 #include <vcl/sysdata.hxx>
@@ -47,7 +50,7 @@ Sequence< OUString > 
x11::Xdnd_dropTarget_getSupportedServiceNames()
 
 css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const 
Sequence< Any >& arguments )
 {
-    if ( IsRunningUnitTest() || IsRunningUITest() )
+    if ( o3tl::IsRunningUnitTest() || o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( arguments );
 
     SelectionManager& rManager = SelectionManager::get();
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 4f4b42e52192..179e29d250f9 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16,6 +16,7 @@
 #include <string_view>
 
 #include <dndhelper.hxx>
+#include <o3tl/test_info.hxx>
 #include <osl/process.h>
 #include <osl/file.hxx>
 #include <unx/gtk/gtkdata.hxx>
@@ -1578,7 +1579,7 @@ void VclGtkClipboard::removeClipboardListener( const 
Reference< datatransfer::cl
 
 Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& 
arguments)
 {
-    if ( IsRunningUnitTest() || IsRunningUITest() )
+    if ( o3tl::IsRunningUnitTest() || o3tl::IsRunningUITest() )
         return SalInstance::CreateClipboard( arguments );
 
     OUString sel;
diff --git a/vcl/win/dtrans/WinClipboard.cxx b/vcl/win/dtrans/WinClipboard.cxx
index 4fea55531ad5..aa81fd197ade 100644
--- a/vcl/win/dtrans/WinClipboard.cxx
+++ b/vcl/win/dtrans/WinClipboard.cxx
@@ -19,6 +19,7 @@
 
 #include <sal/config.h>
 
+#include <o3tl/test_info.hxx>
 #include <osl/diagnose.h>
 #include <comphelper/diagnose_ex.hxx>
 #include <com/sun/star/datatransfer/clipboard/ClipboardEvent.hpp>
@@ -336,8 +337,7 @@ 
dtrans_CWinClipboard_get_implementation(css::uno::XComponentContext* context,
 {
     // We run unit tests in parallel, which is a problem when touching a 
shared resource
     // like the system clipboard, so rather use the dummy GenericClipboard.
-    static const bool bRunningUnitTest
-        = SalInstance::IsRunningUnitTest() || SalInstance::IsRunningUITest();
+    static const bool bRunningUnitTest = o3tl::IsRunningUnitTest() || 
o3tl::IsRunningUITest();
 
     if (bRunningUnitTest)
     {

Reply via email to