From 68a96f747345dd55bcb6abdd8eee0e2d9768c9ec Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 17 Jul 2024 19:18:32 +0500 Subject: 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 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sc/source/core/data/documen2.cxx | 3 ++- sc/source/core/data/queryiter.cxx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'sc') 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 #include +#include #include #include #include @@ -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 -- cgit