diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-21 14:46:39 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-21 21:11:58 +0100 |
commit | 780bc10c439aad5bbcbd2434f16719ba0cd65b35 (patch) | |
tree | 1b46b1e6bf58451ec16ffd38bc6b06dbd56b7198 /sc | |
parent | 2183dd48aa018a79b00c60f463f68acd7d8761d1 (diff) |
sc: remove duplicated code
Change-Id: Ice7d74263954c49a341f427c470f992225a40762
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143033
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/helper/qahelper.cxx | 19 | ||||
-rw-r--r-- | sc/qa/unit/helper/qahelper.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sharedformula.cxx | 12 |
3 files changed, 6 insertions, 27 deletions
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 17f169b9e090..28d2b1243e8c 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -444,25 +444,6 @@ ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos) return pCell->GetCode(); } -bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected) -{ - ScTokenArray* pCode = getTokens(rDoc, rPos); - if (!pCode) - { - cerr << "Empty token array." << endl; - return false; - } - - OUString aFormula = toString(rDoc, rPos, *pCode, rDoc.GetGrammar()); - if (aFormula != OUString::createFromAscii(pExpected)) - { - cerr << "Formula '" << pExpected << "' expected, but '" << aFormula << "' found" << endl; - return false; - } - - return true; -} - bool checkOutput( const ScDocument* pDoc, const ScRange& aOutRange, const std::vector<std::vector<const char*>>& aCheck, const char* pCaption ) diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 6ad03dc1fa67..b9a51701e26b 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -111,8 +111,6 @@ SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const ScRange SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const OpCode& rCode); -bool checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* pExpected); - SCQAHELPER_DLLPUBLIC bool checkOutput( const ScDocument* pDoc, const ScRange& aOutRange, const std::vector<std::vector<const char*>>& aCheck, const char* pCaption ); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 11d4132ec80d..0d2275c42b31 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -537,9 +537,9 @@ void TestSharedFormula::testSharedFormulasRefUpdateMove() CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(1,2,0))); // The formulas should have been adjusted for the move. - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,1,0), "R[-1]C[-1]")); - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,2,0), "R[-1]C[-1]")); - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,3,0), "R[-1]C[-1]")); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,1,0), "R[-1]C[-1]", "Wrong formula"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,2,0), "R[-1]C[-1]", "Wrong formula"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,3,0), "R[-1]C[-1]", "Wrong formula"); SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); CPPUNIT_ASSERT(pUndoMgr); @@ -551,9 +551,9 @@ void TestSharedFormula::testSharedFormulasRefUpdateMove() CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(1,3,0))); // And the formulas should have been re-adjusted to their original references. - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,1,0), "RC[-1]")); - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,2,0), "RC[-1]")); - CPPUNIT_ASSERT(checkFormula(*m_pDoc, ScAddress(2,3,0), "RC[-1]")); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,1,0), "RC[-1]", "Wrong formula"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,2,0), "RC[-1]", "Wrong formula"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,3,0), "RC[-1]", "Wrong formula"); m_pDoc->DeleteTab(0); } |