summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-11-24 17:12:08 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-11-24 20:07:05 +0100
commite8c78c9d636a1ac26a146bdf37469477f62e71f9 (patch)
tree905bbe9f3793abbbd4c23e0bc2ab5010a47e5153 /sc
parent111ec417d2289b6231216650ccacbb1b7a35268e (diff)
qahelper: drop getTokens and toString
Change-Id: I15f6af9fc6e7f90a1a404e90d5f6ceba4c78626f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143240 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/helper/qahelper.cxx22
-rw-r--r--sc/qa/unit/helper/qahelper.hxx9
-rw-r--r--sc/qa/unit/ucalc_formula.cxx9
3 files changed, 7 insertions, 33 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index bb61fb4eb119..4624db43510c 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -409,19 +409,6 @@ ScRangeList ScModelTestBase::getChartRanges(ScDocument& rDoc, const SdrOle2Obj&
return aRanges;
}
-ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos)
-{
- ScFormulaCell* pCell = rDoc.GetFormulaCell(rPos);
- if (!pCell)
- {
- OUString aStr = rPos.Format(ScRefFlags::VALID);
- cerr << aStr << " is not a formula cell." << endl;
- return nullptr;
- }
-
- return pCell->GetCode();
-}
-
bool checkOutput(
const ScDocument* pDoc, const ScRange& aOutRange,
const std::vector<std::vector<const char*>>& aCheck, const char* pCaption )
@@ -460,15 +447,6 @@ bool checkOutput(
return bResult;
}
-OUString toString(
- ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram)
-{
- ScCompiler aComp(rDoc, rPos, rArray, eGram);
- OUStringBuffer aBuf;
- aComp.CreateStringFromTokenArray(aBuf);
- return aBuf.makeStringAndClear();
-}
-
void ScSimpleBootstrapFixture::setUp()
{
BootstrapFixture::setUp();
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 4fb04bcf84b5..aa44f6cb1dc6 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -80,13 +80,6 @@ SCQAHELPER_DLLPUBLIC bool checkOutput(
const ScDocument* pDoc, const ScRange& aOutRange,
const std::vector<std::vector<const char*>>& aCheck, const char* pCaption );
-/**
- * Convert formula token array to a formula string.
- */
-SCQAHELPER_DLLPUBLIC OUString toString(
- ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray,
- formula::FormulaGrammar::Grammar eGram);
-
inline std::string print(const ScAddress& rAddr)
{
std::ostringstream str;
@@ -196,6 +189,4 @@ private:
#define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 )
-SCQAHELPER_DLLPUBLIC ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos);
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index dc21cb16c266..248f398b7d49 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1322,7 +1322,11 @@ void TestFormula::testFormulaCompiler()
std::unique_ptr<ScTokenArray> pArray = compileFormula(m_pDoc, OUString::createFromAscii(aTests[i].pInput), aTests[i].eInputGram);
CPPUNIT_ASSERT_MESSAGE("Token array shouldn't be NULL!", pArray);
- OUString aFormula = toString(*m_pDoc, ScAddress(), *pArray, aTests[i].eOutputGram);
+ ScCompiler aComp(*m_pDoc, ScAddress(), *pArray, aTests[i].eOutputGram);
+ OUStringBuffer aBuf;
+ aComp.CreateStringFromTokenArray(aBuf);
+ OUString aFormula = aBuf.makeStringAndClear();
+
CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(aTests[i].pOutput), aFormula);
}
}
@@ -1837,7 +1841,8 @@ void TestFormula::testFormulaAnnotateTrimOnDoubleRefs()
std::string aMsgStart = "TestCase#" + std::to_string(nTestIdx + 1) + " : ";
CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsgStart + "Incorrect formula result", rTestCase.fResult, m_pDoc->GetValue(ScAddress(4, 0, 0)));
- ScTokenArray* pCode = getTokens(*m_pDoc, ScAddress(4, 0, 0));
+ ScFormulaCell* pCell = m_pDoc->GetFormulaCell(ScAddress(4, 0, 0));
+ ScTokenArray* pCode = pCell->GetCode();
sal_Int32 nLen = pCode->GetCodeLen();
FormulaToken** pRPNArray = pCode->GetCode();