sc/qa/unit/bugfix-test.cxx | 3 sc/qa/unit/helper/qahelper.cxx | 22 - sc/qa/unit/helper/qahelper.hxx | 9 sc/qa/unit/helper/shared_test_impl.hxx | 2 sc/qa/unit/subsequent_export_test.cxx | 70 ++- sc/qa/unit/subsequent_export_test2.cxx | 20 - sc/qa/unit/subsequent_filters_test.cxx | 104 +++-- sc/qa/unit/subsequent_filters_test2.cxx | 53 +- sc/qa/unit/ucalc_copypaste.cxx | 39 +- sc/qa/unit/ucalc_formula.cxx | 583 +++++++++++++++----------------- sc/qa/unit/ucalc_sharedformula.cxx | 154 ++++---- sc/qa/unit/ucalc_sort.cxx | 100 ++--- 12 files changed, 581 insertions(+), 578 deletions(-)
New commits: commit 41bc8bb0cd4a5b92c7e7fc0080c6e3fa5650aa01 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Nov 21 16:08:12 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Nov 22 15:26:35 2022 +0100 sc: drop ASSERT_FORMULA_EQUAL Unify the code and use GetFormula everywhere. No need to define a specific assertion when we can use OUString comparison instead Change-Id: I7cd6f16bb32d6a659cac4e656bd4465393533cb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143094 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index 4217ce8d49ad..7a5e4e2b73b4 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -430,7 +430,8 @@ void ScFiltersTest::testRhbz1390776() createScDoc("xml/rhbz1390776.xml"); ScDocument* pDoc = getScDoc(); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(0, 27, 0), "SUM(A18:A23)", "Wrong range"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong range", OUString("=SUM(A18:A23)"), + pDoc->GetFormula(0, 27, 0)); } void ScFiltersTest::testTdf104310() diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 6fd30e2398a4..6627bd5636da 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -676,28 +676,6 @@ void ScModelTestBase::miscRowHeightsTest( TestParam const * aTestValues, unsigne } } -std::string to_std_string(const OUString& rStr) -{ - return std::string(rStr.toUtf8().getStr()); -} - -void checkFormula(ScDocument& rDoc, const ScAddress& rPos, const char* expected, const char* msg, CppUnit::SourceLine const & sourceLine) -{ - ScTokenArray* pCode = getTokens(rDoc, rPos); - if (!pCode) - { - CppUnit::Asserter::fail("empty token array", sourceLine); - } - - OUString aFormula = toString(rDoc, rPos, *pCode, rDoc.GetGrammar()); - OUString aExpectedFormula = OUString::createFromAscii(expected); - if (aFormula != aExpectedFormula) - { - CppUnit::Asserter::failNotEqual(to_std_string(aExpectedFormula), - to_std_string(aFormula), sourceLine, CppUnit::AdditionalMessage(msg)); - } -} - ScRange ScSimpleBootstrapFixture::insertRangeData( ScDocument* pDoc, const ScAddress& rPos, const std::vector<std::vector<const char*>>& rData ) { diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 9bdd10d405d5..91e3aed2b04f 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -258,15 +258,6 @@ private: #define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 ) -SCQAHELPER_DLLPUBLIC void checkFormula(ScDocument& rDoc, const ScAddress& rPos, - const char* expected, const char* msg, CppUnit::SourceLine const & sourceLine); - -#define ASSERT_FORMULA_EQUAL(doc, pos, expected, msg) \ - checkFormula(doc, pos, expected, msg, CPPUNIT_SOURCELINE()) - SCQAHELPER_DLLPUBLIC ScTokenArray* getTokens(ScDocument& rDoc, const ScAddress& rPos); -SCQAHELPER_DLLPUBLIC std::string to_std_string(const OUString& rStr); - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx index 33b6fe06a0f5..8dcb387df38b 100644 --- a/sc/qa/unit/helper/shared_test_impl.hxx +++ b/sc/qa/unit/helper/shared_test_impl.hxx @@ -289,7 +289,7 @@ void testCeilingFloor_Impl( ScDocument& rDoc ) static constexpr OUStringLiteral pORef = u"Sheet1.K1"; ScAddress aPos; aPos.Parse(pORef, rDoc); - ASSERT_FORMULA_EQUAL(rDoc, aPos, "AND(K3:K81)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=AND(K3:K81)"), rDoc.GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); CPPUNIT_ASSERT_MESSAGE( OUString( pORef + " result is error.").toUtf8().getStr(), isFormulaWithoutError( rDoc, aPos)); CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos)); diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 94e35146b729..195e97b69e7a 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -2057,7 +2057,8 @@ void ScExportTest::testFormulaRefSheetNameODS() sc::AutoCalcSwitch aACSwitch(*pDoc, true); // turn on auto calc. pDoc->SetString(ScAddress(1, 1, 0), "='90''s Data'.B2"); CPPUNIT_ASSERT_EQUAL(1.1, pDoc->GetValue(ScAddress(1, 1, 0))); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 1, 0), "'90''s Data'.B2", "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString("='90''s Data'.B2"), + pDoc->GetFormula(1, 1, 0)); } // Now, save and reload this document. saveAndReload("calc8"); @@ -2065,7 +2066,8 @@ void ScExportTest::testFormulaRefSheetNameODS() ScDocument* pDoc = getScDoc(); pDoc->CalcAll(); CPPUNIT_ASSERT_EQUAL(1.1, pDoc->GetValue(ScAddress(1, 1, 0))); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 1, 0), "'90''s Data'.B2", "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString("='90''s Data'.B2"), + pDoc->GetFormula(1, 1, 0)); } void ScExportTest::testCellValuesExportODS() @@ -2113,8 +2115,10 @@ void ScExportTest::testCellValuesExportODS() CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(5, 0, 0)); // check formula - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(4, 0, 0), "10*C1/4", "Wrong formula =10*C1/4"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(7, 0, 0), "SUM(C1:F1)", "Wrong formula =SUM(C1:F1)"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula =10*C1/4", OUString("=10*C1/4"), + pDoc->GetFormula(4, 0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula =SUM(C1:F1)", OUString("=SUM(C1:F1)"), + pDoc->GetFormula(7, 0, 0)); CPPUNIT_ASSERT_EQUAL(16.5, pDoc->GetValue(7, 0, 0)); // check string @@ -2133,7 +2137,8 @@ void ScExportTest::testCellValuesExportODS() //check contiguous values CPPUNIT_ASSERT_EQUAL(12.0, pDoc->GetValue(0, 5, 0)); CPPUNIT_ASSERT_EQUAL(OUString("a string"), pDoc->GetString(0, 6, 0)); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(0, 7, 0), "$A$6", "Wrong formula =$A$6"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula =$A$6", OUString("=$A$6"), + pDoc->GetFormula(0, 7, 0)); CPPUNIT_ASSERT_EQUAL(pDoc->GetValue(0, 5, 0), pDoc->GetValue(0, 7, 0)); } @@ -2319,16 +2324,22 @@ void ScExportTest::testFormulaReferenceXLS() ScDocument* pDoc = getScDoc(); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 1, 0), "$A$2+$B$2+$C$2", "Wrong formula in D2"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 2, 0), "A3+B3+C3", "Wrong formula in D3"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 5, 0), "SUM($A$6:$C$6)", "Wrong formula in D6"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 6, 0), "SUM(A7:C7)", "Wrong formula in D7"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 9, 0), "$Two.$A$2+$Two.$B$2+$Two.$C$2", - "Wrong formula in D10"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 10, 0), "$Two.A3+$Two.B3+$Two.C3", - "Wrong formula in D11"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 13, 0), "MIN($Two.$A$2:$C$2)", "Wrong formula in D14"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 14, 0), "MAX($Two.A3:C3)", "Wrong formula in D15"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D2", OUString("=$A$2+$B$2+$C$2"), + pDoc->GetFormula(3, 1, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D3", OUString("=A3+B3+C3"), + pDoc->GetFormula(3, 2, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D6", OUString("=SUM($A$6:$C$6)"), + pDoc->GetFormula(3, 5, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D7", OUString("=SUM(A7:C7)"), + pDoc->GetFormula(3, 6, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D10", OUString("=$Two.$A$2+$Two.$B$2+$Two.$C$2"), + pDoc->GetFormula(3, 9, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D11", OUString("=$Two.A3+$Two.B3+$Two.C3"), + pDoc->GetFormula(3, 10, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D14", OUString("=MIN($Two.$A$2:$C$2)"), + pDoc->GetFormula(3, 13, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D15", OUString("=MAX($Two.A3:C3)"), + pDoc->GetFormula(3, 14, 0)); } void ScExportTest::testSheetProtectionXLSX() @@ -3501,23 +3512,14 @@ void ScExportTest::testSupBookVirtualPathXLS() ScDocument* pDoc = getScDoc(); - ScAddress aPos(0, 0, 0); - ScTokenArray* pCode = getTokens(*pDoc, aPos); - if (!pCode) - CppUnit::Asserter::fail("empty token array", CPPUNIT_SOURCELINE()); - - OUString aFormula = toString(*pDoc, aPos, *pCode, pDoc->GetGrammar()); + OUString aFormula = pDoc->GetFormula(0, 0, 0); #ifdef _WIN32 aFormula = OUString::Concat(aFormula.subView(0, 9)) + aFormula.subView(12); // strip drive letter, e.g. 'C:/' #endif - OUString aExpectedFormula = "'file:///home/timar/Documents/external.xls'#$Sheet1.A1"; - if (aFormula != aExpectedFormula) - { - CppUnit::Asserter::failNotEqual( - to_std_string(aExpectedFormula), to_std_string(aFormula), CPPUNIT_SOURCELINE(), - CppUnit::AdditionalMessage("Wrong SupBook VirtualPath URL")); - } + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Wrong SupBook VirtualPath URL", + OUString("='file:///home/timar/Documents/external.xls'#$Sheet1.A1"), aFormula); } void ScExportTest::testLinkedGraphicRT() @@ -3708,19 +3710,23 @@ void ScExportTest::testRelativeNamedExpressionsXLS() // Sheet1:G3 ScAddress aPos(6, 2, 0); CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "single_cell_A3", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=single_cell_A3"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Sheet2:F6 aPos = ScAddress(5, 5, 1); CPPUNIT_ASSERT_EQUAL(18.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(test_conflict)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(test_conflict)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Sheet2:H3 aPos = ScAddress(7, 2, 1); CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "single_global_A3", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=single_global_A3"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Sheet2:H6 aPos = ScAddress(7, 5, 1); CPPUNIT_ASSERT_EQUAL(75.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(A6:F6)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A6:F6)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); } void ScExportTest::testSheetTextBoxHyperlinkXLSX() diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index d69e2cab9edc..03f747e82b63 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1060,9 +1060,9 @@ void ScExportTest2::testTdf105272() //Expected: Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]] //Actual : table1[[#this row],[total]]/table1[[#this row],['# athletes]] - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(7, 3, 0), - "Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]]", - "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Wrong formula", OUString("=Table1[[#This Row],[Total]]/Table1[[#This Row],['# Athletes]]"), + pDoc->GetFormula(7, 3, 0)); } void ScExportTest2::testTdf118990() @@ -1076,13 +1076,15 @@ void ScExportTest2::testTdf118990() // file:///share/lookupsource.xlsx - which is incorrect, since it points to local filesystem // and not to Windows network share. - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(0, 1, 0), - "VLOOKUP(B1,'file://192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", - "Wrong Windows share (using host IP) URL in A2"); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Wrong Windows share (using host IP) URL in A2", + OUString("=VLOOKUP(B1,'file://192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)"), + pDoc->GetFormula(0, 1, 0)); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(0, 2, 0), - "VLOOKUP(B1,'file://NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", - "Wrong Windows share (using hostname) URL in A3"); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + "Wrong Windows share (using hostname) URL in A3", + OUString("=VLOOKUP(B1,'file://NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)"), + pDoc->GetFormula(0, 2, 0)); } void ScExportTest2::testTdf121612() diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index ddb72bc64e37..f1dc06cce920 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -1734,29 +1734,37 @@ void ScFiltersTest::testDataTableMortgageXLS() // One-variable table - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 1, 0), "PMT(B3/12,B4,-B5)", "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 2, 0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C3)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 3, 0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C4)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 4, 0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C5)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=PMT(B3/12,B4,-B5)"), + pDoc->GetFormula(3, 1, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS(D$2,$B$3,$C3)"), + pDoc->GetFormula(3, 2, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS(D$2,$B$3,$C4)"), + pDoc->GetFormula(3, 3, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS(D$2,$B$3,$C5)"), + pDoc->GetFormula(3, 4, 0)); // Two-variable table - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(2, 7, 0), "PMT(B9/12,B10,-B11)", "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 8, 0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,D$8)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 9, 0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,D$8)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(3, 10, 0), - "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,D$8)", "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(4, 8, 0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,E$8)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(4, 9, 0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,E$8)", - "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(4, 10, 0), - "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,E$8)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=PMT(B9/12,B10,-B11)"), + pDoc->GetFormula(2, 7, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,D$8)"), + pDoc->GetFormula(3, 8, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,D$8)"), + pDoc->GetFormula(3, 9, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,D$8)"), + pDoc->GetFormula(3, 10, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,E$8)"), + pDoc->GetFormula(4, 8, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,E$8)"), + pDoc->GetFormula(4, 9, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,E$8)"), + pDoc->GetFormula(4, 10, 0)); } void ScFiltersTest::testDataTableOneVarXLSX() @@ -1773,26 +1781,26 @@ void ScFiltersTest::testDataTableOneVarXLSX() // B5:B11 should have multiple operations formula cells. Just check the // top and bottom cells. - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 4, 0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A5)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS(B$4,$A$2,$A5)"), + pDoc->GetFormula(1, 4, 0)); CPPUNIT_ASSERT_EQUAL(2.0, pDoc->GetValue(ScAddress(1, 4, 0))); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 10, 0), "MULTIPLE.OPERATIONS(B$4,$A$2,$A11)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS(B$4,$A$2,$A11)"), + pDoc->GetFormula(1, 10, 0)); CPPUNIT_ASSERT_EQUAL(14.0, pDoc->GetValue(ScAddress(1, 10, 0))); // Likewise, E5:I5 should have multiple operations formula cells. Just // check the left- and right-most cells. - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(4, 4, 0), "MULTIPLE.OPERATIONS($D5,$B$2,E$4)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS($D5,$B$2,E$4)"), + pDoc->GetFormula(4, 4, 0)); CPPUNIT_ASSERT_EQUAL(10.0, pDoc->GetValue(ScAddress(4, 4, 0))); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(8, 4, 0), "MULTIPLE.OPERATIONS($D5,$B$2,I$4)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MULTIPLE.OPERATIONS($D5,$B$2,I$4)"), + pDoc->GetFormula(8, 4, 0)); CPPUNIT_ASSERT_EQUAL(50.0, pDoc->GetValue(ScAddress(8, 4, 0))); } @@ -1811,13 +1819,15 @@ void ScFiltersTest::testDataTableMultiTableXLSX() // B4:M15 should have multiple operations formula cells. We'll just check // the top-left and bottom-right ones. - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 3, 0), "MULTIPLE.OPERATIONS($A$3,$E$1,$A4,$D$1,B$3)", - "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($A$3,$E$1,$A4,$D$1,B$3)"), + pDoc->GetFormula(1, 3, 0)); CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(1, 3, 0))); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(12, 14, 0), - "MULTIPLE.OPERATIONS($A$3,$E$1,$A15,$D$1,M$3)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", + OUString("=MULTIPLE.OPERATIONS($A$3,$E$1,$A15,$D$1,M$3)"), + pDoc->GetFormula(12, 14, 0)); CPPUNIT_ASSERT_EQUAL(144.0, pDoc->GetValue(ScAddress(12, 14, 0))); } @@ -3186,16 +3196,16 @@ void ScFiltersTest::testSharedFormulaXLS() pDoc = getScDoc(); pDoc->CalcAll(); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 0, 0), "A1*20", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 1, 0), "A2*20", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 2, 0), "A3*20", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A1*20"), pDoc->GetFormula(1, 0, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A2*20"), pDoc->GetFormula(1, 1, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A3*20"), pDoc->GetFormula(1, 2, 0)); // There is an intentional gap at row 4. - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 4, 0), "A5*20", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 5, 0), "A6*20", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 6, 0), "A7*20", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(1, 7, 0), "A8*20", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A5*20"), pDoc->GetFormula(1, 4, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A6*20"), pDoc->GetFormula(1, 5, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A7*20"), pDoc->GetFormula(1, 6, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A8*20"), pDoc->GetFormula(1, 7, 0)); // We re-group formula cells on load. Let's check that as well. @@ -3242,22 +3252,26 @@ void ScFiltersTest::testSharedFormulaRefUpdateXLSX() struct TestCase { - ScAddress aPos; + SCCOL nCol; + SCROW nRow; + SCTAB nTab; const char* pExpectedFormula; const char* pErrorMsg; }; TestCase aCases[4] = { - { ScAddress(1, 0, 0), "B29+1", "Wrong formula in B1" }, - { ScAddress(2, 0, 0), "C29+1", "Wrong formula in C1" }, - { ScAddress(3, 0, 0), "D29+1", "Wrong formula in D1" }, - { ScAddress(4, 0, 0), "E29+1", "Wrong formula in E1" }, + { 1, 0, 0, "=B29+1", "Wrong formula in B1" }, + { 2, 0, 0, "=C29+1", "Wrong formula in C1" }, + { 3, 0, 0, "=D29+1", "Wrong formula in D1" }, + { 4, 0, 0, "=E29+1", "Wrong formula in E1" }, }; for (size_t nIdx = 0; nIdx < 4; ++nIdx) { TestCase& rCase = aCases[nIdx]; - ASSERT_FORMULA_EQUAL(*pDoc, rCase.aPos, rCase.pExpectedFormula, rCase.pErrorMsg); + CPPUNIT_ASSERT_EQUAL_MESSAGE(rCase.pErrorMsg, + OUString::createFromAscii(rCase.pExpectedFormula), + pDoc->GetFormula(rCase.nCol, rCase.nRow, rCase.nTab)); } } diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 9cd12d5a72d6..fbaef3eb464f 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -933,8 +933,9 @@ void ScFiltersTest2::testErrorOnExternalReferences() CPPUNIT_ASSERT(pFC); CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoName), static_cast<int>(pFC->GetErrCode())); - ASSERT_FORMULA_EQUAL(*pDoc, ScAddress(0, 0, 0), "'file:///Path/To/FileA.ods'#$Sheet1.A1A", - "Formula changed"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula changed", + OUString("='file:///Path/To/FileA.ods'#$Sheet1.A1A"), + pDoc->GetFormula(0, 0, 0)); } void ScFiltersTest2::testTdf145054() @@ -1561,23 +1562,22 @@ void ScFiltersTest2::testTdf131536() createScDoc("xlsx/tdf131536.xlsx"); ScDocument* pDoc = getScDoc(); - ScAddress aPos(3, 9, 0); - CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL( - *pDoc, aPos, - "IF(D$4=\"-\",\"-\",MID(TEXT(INDEX($Comparison.$I:$J,$Comparison.$A5,$Comparison.D$2),\"\")" - ",2,4)" - "=RIGHT(TEXT(INDEX($Comparison.$L:$Z,$Comparison.$A5,$Comparison.D$4),\"\"),4))", - nullptr); - - ScAddress aPos2(4, 9, 0); - CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(aPos2)); - ASSERT_FORMULA_EQUAL( - *pDoc, aPos2, - "IF(D$4=\"-\",\"-\",MID(TEXT(INDEX($Comparison.$I:$J,$Comparison.$A5,$Comparison.D$2)," - "\"0\"),2,4)" - "=RIGHT(TEXT(INDEX($Comparison.$L:$Z,$Comparison.$A5,$Comparison.D$4),\"0\"),4))", - nullptr); + CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(3, 9, 0)); + CPPUNIT_ASSERT_EQUAL( + OUString( + "=IF(D$4=\"-\",\"-\",MID(TEXT(INDEX($Comparison.$I:$J,$Comparison.$A5,$Comparison.D$2)," + "\"\")" + ",2,4)" + "=RIGHT(TEXT(INDEX($Comparison.$L:$Z,$Comparison.$A5,$Comparison.D$4),\"\"),4))"), + pDoc->GetFormula(3, 9, 0)); + + CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(4, 9, 0)); + CPPUNIT_ASSERT_EQUAL( + OUString( + "=IF(D$4=\"-\",\"-\",MID(TEXT(INDEX($Comparison.$I:$J,$Comparison.$A5,$Comparison.D$2)," + "\"0\"),2,4)" + "=RIGHT(TEXT(INDEX($Comparison.$L:$Z,$Comparison.$A5,$Comparison.D$4),\"0\"),4))"), + pDoc->GetFormula(4, 9, 0)); } void ScFiltersTest2::testTdf130583() @@ -1647,12 +1647,14 @@ void ScFiltersTest2::testNamedExpressionsXLSXML() // A7 ScAddress aPos(0, 6, 0); CPPUNIT_ASSERT_EQUAL(15.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(MyRange)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(MyRange)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // B7 aPos.IncCol(); CPPUNIT_ASSERT_EQUAL(55.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(MyRange2)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(MyRange2)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); const ScRangeData* pRD = pDoc->GetRangeName()->findByUpperName("MYRANGE"); CPPUNIT_ASSERT(pRD); @@ -1669,12 +1671,14 @@ void ScFiltersTest2::testNamedExpressionsXLSXML() // A7 on Sheet1 ScAddress aPos(0, 6, 0); CPPUNIT_ASSERT_EQUAL(27.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(MyRange)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(MyRange)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // A7 on Sheet2 aPos.IncTab(); CPPUNIT_ASSERT_EQUAL(74.0, pDoc->GetValue(aPos)); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(MyRange)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(MyRange)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); const ScRangeName* pRN = pDoc->GetRangeName(0); CPPUNIT_ASSERT(pRN); @@ -1714,7 +1718,8 @@ void ScFiltersTest2::testEmptyRowsXLSXML() ScAddress aPos; aPos.Parse("B9", *pDoc); - ASSERT_FORMULA_EQUAL(*pDoc, aPos, "SUM(B4:B8)", nullptr); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B4:B8)"), + pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); } void ScFiltersTest2::testBorderDirectionsXLSXML() diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 87b9416086ff..60795656b299 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -9706,19 +9706,20 @@ void TestCopyPaste::testCutPasteRefUndo() &aClipDoc); CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(0, 1, 0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, 0), "C2", "A2 should be referencing C2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A2 should be referencing C2.", OUString("=C2"), + m_pDoc->GetFormula(0, 1, 0)); // At this point, the ref undo document should contain a formula cell at A2 that references B2. - ASSERT_FORMULA_EQUAL(*pUndoDoc, ScAddress(0, 1, 0), "B2", - "A2 in the undo document should be referencing B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A2 in the undo document should be referencing B2.", + OUString("=B2"), pUndoDoc->GetFormula(0, 1, 0)); ScUndoPaste aUndo(m_xDocShell.get(), ScRange(2, 1, 0), aMark, std::move(pUndoDoc), nullptr, InsertDeleteFlags::CONTENTS, nullptr, false, nullptr); aUndo.Undo(); // Now A2 should be referencing B2 once again. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, 0), "B2", - "A2 should be referencing B2 after undo."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A2 should be referencing B2 after undo.", OUString("=B2"), + m_pDoc->GetFormula(0, 1, 0)); m_pDoc->DeleteTab(0); } @@ -9848,8 +9849,9 @@ void TestCopyPaste::testMoveRefBetweenSheets() CPPUNIT_ASSERT_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0, 2, 0))); // These formulas should not display the sheet name. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, 0), "A1", "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 2, 0), "SUM(A1:C1)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=A1"), m_pDoc->GetFormula(0, 1, 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=SUM(A1:C1)"), + m_pDoc->GetFormula(0, 2, 0)); // Move Test1.A2:A3 to Test2.A2:A3. ScDocFunc& rFunc = m_xDocShell->GetDocFunc(); @@ -9863,8 +9865,10 @@ void TestCopyPaste::testMoveRefBetweenSheets() ASSERT_DOUBLES_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0, 2, 1))); // The reference in the pasted formula should display sheet name after the move. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, 1), "Test1.A1", "Wrong formula!"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 2, 1), "SUM(Test1.A1:C1)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=Test1.A1"), + m_pDoc->GetFormula(0, 1, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=SUM(Test1.A1:C1)"), + m_pDoc->GetFormula(0, 2, 1)); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -10174,7 +10178,8 @@ void TestCopyPaste::testCopyPasteMixedReferenceFormula() // Insert formula to A1 with mixed relative/absolute addressing. m_pDoc->SetString(0, 0, 0, "=SUM(B:$C)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 0, 0), "SUM(B:$C)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(B:$C)"), + m_pDoc->GetFormula(0, 0, 0)); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(0, 0, 0)); // Copy formula in A1 to clipboard. @@ -10185,15 +10190,16 @@ void TestCopyPaste::testCopyPasteMixedReferenceFormula() // Paste formula to B1. aRange = ScAddress(1, 0, 0); pasteFromClip(m_pDoc, aRange, &aClipDoc); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1, 0, 0), "SUM(C:$C)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(C:$C)"), + m_pDoc->GetFormula(1, 0, 0)); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(0, 0, 0)); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(1, 0, 0)); // Paste formula to C1. All three results now must be circular reference. aRange = ScAddress(2, 0, 0); pasteFromClip(m_pDoc, aRange, &aClipDoc); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2, 0, 0), "SUM($C:D)", - "Wrong formula."); // reference put in order + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM($C:D)"), + m_pDoc->GetFormula(2, 0, 0)); // reference put in order CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(0, 0, 0)); CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(1, 0, 0)); CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(2, 0, 0)); @@ -10358,7 +10364,8 @@ void TestCopyPaste::testTdf68976() // Without the fix in place, this would have failed with // - Expected: =$A$1 // - Actual : =$B$4 - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0, 1, nTab), "$A$1", "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString("=$A$1"), + m_pDoc->GetFormula(0, 1, nTab)); // Without the fix in place, this would have failed with // - Expected: 1 // - Actual : 1000 @@ -10405,7 +10412,7 @@ void TestCopyPaste::testTdf71058() // Without the fix in place, this would have failed with // - Expected: =E6 // - Actual : =C4 - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2, 2, nTab), "E6", "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString("=E6"), m_pDoc->GetFormula(2, 2, nTab)); // Without the fix in place, this would have failed with // - Expected: 1 // - Actual : 0 @@ -10414,7 +10421,7 @@ void TestCopyPaste::testTdf71058() // Without the fix in place, this would have failed with // - Expected: =E7 // - Actual : =D4 - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3, 2, nTab), "E7", "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString("=E7"), m_pDoc->GetFormula(3, 2, nTab)); // Without the fix in place, this would have failed with // - Expected: 2 // - Actual : 0 diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 0a1abe05c2f5..dc21cb16c266 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -636,18 +636,17 @@ void TestFormula::testFormulaParseReference() // Make sure the formula input and output match. { const char* aChecks[] = { - "'90''s Music'.B12", - "'90''s and 70''s'.$AB$100", - "'All Others'.Z$100", - "NoQuote.$C111" + "='90''s Music'.B12", + "='90''s and 70''s'.$AB$100", + "='All Others'.Z$100", + "=NoQuote.$C111" }; for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) { // Use the 'Dummy' sheet for this. - OUString aInput = "=" + OUString::createFromAscii(aChecks[i]); - m_pDoc->SetString(ScAddress(0,0,0), aInput); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), aChecks[i], "Wrong formula"); + m_pDoc->SetString(ScAddress(0,0,0), OUString::createFromAscii(aChecks[i])); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString::createFromAscii(aChecks[i]), m_pDoc->GetFormula(0,0,0)); } } @@ -819,32 +818,32 @@ void TestFormula::testFormulaParseReference() // Check for reference input conversion to and display string of entire column/row. { const char* row1048576Checks[][2] = { - { "=B:B", "B:B" }, - { "=B1:B1048576", "B:B" }, - { "=B1:B$1048576", "B1:B$1048576" }, - { "=B$1:B1048576", "B$1:B1048576" }, - { "=B$1:B$1048576", "B:B" } + { "=B:B", "=B:B" }, + { "=B1:B1048576", "=B:B" }, + { "=B1:B$1048576", "=B1:B$1048576" }, + { "=B$1:B1048576", "=B$1:B1048576" }, + { "=B$1:B$1048576", "=B:B" } }; const char* row16777216Checks[][2] = { - { "=B:B", "B:B" }, - { "=B1:B16777216", "B:B" }, - { "=B1:B$16777216", "B1:B$16777216" }, - { "=B$1:B16777216", "B$1:B16777216" }, - { "=B$1:B$16777216", "B:B" } + { "=B:B", "=B:B" }, + { "=B1:B16777216", "=B:B" }, + { "=B1:B$16777216", "=B1:B$16777216" }, + { "=B$1:B16777216", "=B$1:B16777216" }, + { "=B$1:B$16777216", "=B:B" } }; const char* col1024Checks[][2] = { - { "=2:2", "2:2" }, - { "=A2:AMJ2", "2:2" }, - { "=A2:$AMJ2", "A2:$AMJ2" }, - { "=$A2:AMJ2", "$A2:AMJ2" }, - { "=$A2:$AMJ2", "2:2" } + { "=2:2", "=2:2" }, + { "=A2:AMJ2", "=2:2" }, + { "=A2:$AMJ2", "=A2:$AMJ2" }, + { "=$A2:AMJ2", "=$A2:AMJ2" }, + { "=$A2:$AMJ2", "=2:2" } }; const char* col16384Checks[][2] = { - { "=2:2", "2:2" }, - { "=A2:XFD2", "2:2" }, - { "=A2:$XFD2", "A2:$XFD2" }, - { "=$A2:XFD2", "$A2:XFD2" }, - { "=$A2:$XFD2", "2:2" } + { "=2:2", "=2:2" }, + { "=A2:XFD2", "=2:2" }, + { "=A2:$XFD2", "=A2:$XFD2" }, + { "=$A2:XFD2", "=$A2:XFD2" }, + { "=$A2:$XFD2", "=2:2" } }; if (m_pDoc->MaxRow() == 1048575) @@ -853,7 +852,7 @@ void TestFormula::testFormulaParseReference() { // Use the 'Dummy' sheet for this. m_pDoc->SetString(ScAddress(0,0,0), OUString::createFromAscii(check[0])); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), check[1], "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString::createFromAscii(check[1]), m_pDoc->GetFormula(0,0,0)); } } else @@ -862,7 +861,7 @@ void TestFormula::testFormulaParseReference() for (const auto& check : row16777216Checks) { m_pDoc->SetString(ScAddress(0,0,0), OUString::createFromAscii(check[0])); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), check[1], "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString::createFromAscii(check[1]), m_pDoc->GetFormula(0,0,0)); } } if (m_pDoc->MaxCol() == 1023) @@ -870,7 +869,7 @@ void TestFormula::testFormulaParseReference() for (const auto& check : col1024Checks) { m_pDoc->SetString(ScAddress(0,0,0), OUString::createFromAscii(check[0])); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), check[1], "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString::createFromAscii(check[1]), m_pDoc->GetFormula(0,0,0)); } } else @@ -879,7 +878,7 @@ void TestFormula::testFormulaParseReference() for (const auto& check : col16384Checks) { m_pDoc->SetString(ScAddress(0,0,0), OUString::createFromAscii(check[0])); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), check[1], "Wrong formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula", OUString::createFromAscii(check[1]), m_pDoc->GetFormula(0,0,0)); } } } @@ -1710,8 +1709,8 @@ void TestFormula::testFormulaCompilerImplicitIntersection1NoGroup() // Implicit intersection optimization in ScCompiler::HandleIIOpCode() internally changes // these to "=COS(A3)" and "=COS(A4)", but these shouldn't be merged into a formula group, // otherwise B4's formula would then be "=COS(A2:A6)". - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "COS(A1:A5)", "Formula in B3 has changed."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,3,0), "COS(A1:A5)", "Formula in B4 has changed."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in B3 has changed.", OUString("=COS(A1:A5)"), m_pDoc->GetFormula(1,2,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in B4 has changed.", OUString("=COS(A1:A5)"), m_pDoc->GetFormula(1,3,0)); m_pDoc->DeleteTab(0); } @@ -1872,82 +1871,82 @@ void TestFormula::testFormulaRefUpdate() m_pDoc->SetString(ScAddress(2,3,0), "=$A$1"); // C4 ScAddress aPos(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Delete row 2 to push formula cells up (to C2:C3). m_pDoc->DeleteRow(ScRange(0,1,0,m_pDoc->MaxCol(),1,0)); aPos = ScAddress(2,1,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C2.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert one row at row 2 to move them back. m_pDoc->InsertRow(ScRange(0,1,0,m_pDoc->MaxCol(),1,0)); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert 2 rows at row 1 to shift all of A1 and C3:C4 down. m_pDoc->InsertRow(ScRange(0,0,0,m_pDoc->MaxCol(),1,0)); aPos = ScAddress(2,4,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A3", "Wrong formula in C5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C5.", OUString("=A3"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$3", "Wrong formula in C6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C6.", OUString("=$A$3"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Delete 2 rows at row 1 to shift them back. m_pDoc->DeleteRow(ScRange(0,0,0,m_pDoc->MaxCol(),1,0)); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert 3 columns at column B. to shift C3:C4 to F3:F4. m_pDoc->InsertCol(ScRange(1,0,0,3,m_pDoc->MaxRow(),0)); aPos = ScAddress(5,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in F3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in F3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(5,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in F4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in F4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Delete columns B:D to shift them back. m_pDoc->DeleteCol(ScRange(1,0,0,3,m_pDoc->MaxRow(),0)); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert cells over A1:A3 to only shift A1 down to A4. m_pDoc->InsertRow(ScRange(0,0,0,0,2,0)); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A4", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A4"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$4", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$4"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // .. and back. m_pDoc->DeleteRow(ScRange(0,0,0,0,2,0)); aPos = ScAddress(2,2,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "A1", "Wrong formula in C3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C3.", OUString("=A1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(2,3,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$A$1", "Wrong formula in C4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in C4.", OUString("=$A$1"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Delete row 1 which will delete the value cell (A1). m_pDoc->DeleteRow(ScRange(0,0,0,m_pDoc->MaxCol(),0,0)); @@ -1976,64 +1975,64 @@ void TestFormula::testFormulaRefUpdate() m_pDoc->SetString(ScAddress(0,6,0), "=SUM($B$2:$C$3)"); aPos = ScAddress(0,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B2:C3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$2:$C$3)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert a row at row 1. m_pDoc->InsertRow(ScRange(0,0,0,m_pDoc->MaxCol(),0,0)); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B3:C4)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM(B3:C4)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,7,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$3:$C$4)", "Wrong formula in A8."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A8.", OUString("=SUM($B$3:$C$4)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // ... and back. m_pDoc->DeleteRow(ScRange(0,0,0,m_pDoc->MaxCol(),0,0)); aPos = ScAddress(0,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B2:C3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$2:$C$3)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert columns B:C to shift only the value range. m_pDoc->InsertCol(ScRange(1,0,0,2,m_pDoc->MaxRow(),0)); aPos = ScAddress(0,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(D2:E3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(D2:E3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($D$2:$E$3)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($D$2:$E$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // ... and back. m_pDoc->DeleteCol(ScRange(1,0,0,2,m_pDoc->MaxRow(),0)); aPos = ScAddress(0,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B2:C3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$2:$C$3)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Insert rows 5:6 to shift the formula cells only. m_pDoc->InsertRow(ScRange(0,4,0,m_pDoc->MaxCol(),5,0)); aPos = ScAddress(0,7,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B2:C3)", "Wrong formula in A8."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A8.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,8,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$2:$C$3)", "Wrong formula in A9."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A9.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // ... and back. m_pDoc->DeleteRow(ScRange(0,4,0,m_pDoc->MaxCol(),5,0)); aPos = ScAddress(0,5,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM(B2:C3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos = ScAddress(0,6,0); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "SUM($B$2:$C$3)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // Check the values of the formula cells in A6:A7. CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,5,0))); @@ -2090,9 +2089,9 @@ void TestFormula::testFormulaRefUpdateRange() m_pDoc->SetString(ScAddress(0,6,0), "=SUM(B2:C5)"); m_pDoc->SetString(ScAddress(0,7,0), "=SUM($B$2:$C$5)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "SUM(B2:C5)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM(B2:C5)"), m_pDoc->GetFormula(0,6,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,7,0), "SUM($B$2:$C$5)", "Wrong formula in A8."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A8.", OUString("=SUM($B$2:$C$5)"), m_pDoc->GetFormula(0,7,0)); CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(ScAddress(0,6,0))); CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(ScAddress(0,7,0))); @@ -2100,9 +2099,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete row 3. This should shrink the range references by one row. m_pDoc->DeleteRow(ScRange(0,2,0,m_pDoc->MaxCol(),2,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM(B2:C4)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(B2:C4)"), m_pDoc->GetFormula(0,5,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "SUM($B$2:$C$4)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($B$2:$C$4)"), m_pDoc->GetFormula(0,6,0)); CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(0,5,0))); CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(0,6,0))); @@ -2110,9 +2109,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete row 4 - bottom of range m_pDoc->DeleteRow(ScRange(0,3,0,m_pDoc->MaxCol(),3,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(B2:C3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(B2:C3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($B$2:$C$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($B$2:$C$3)"), m_pDoc->GetFormula(0,5,0)); CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(0,4,0))); CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(0,5,0))); @@ -2120,9 +2119,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete row 2 - top of range m_pDoc->DeleteRow(ScRange(0,1,0,m_pDoc->MaxCol(),1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,3,0), "SUM(B2:C2)", "Wrong formula in A4."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A4.", OUString("=SUM(B2:C2)"), m_pDoc->GetFormula(0,3,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM($B$2:$C$2)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM($B$2:$C$2)"), m_pDoc->GetFormula(0,4,0)); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,3,0))); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,4,0))); @@ -2144,9 +2143,9 @@ void TestFormula::testFormulaRefUpdateRange() m_pDoc->SetString(ScAddress(0,1,0), "=SUM(C2:F3)"); m_pDoc->SetString(ScAddress(0,2,0), "=SUM($C$2:$F$3)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C2:F3)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C2:F3)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$2:$F$3)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$2:$F$3)"), m_pDoc->GetFormula(0,2,0)); CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(ScAddress(0,1,0))); CPPUNIT_ASSERT_EQUAL(36.0, m_pDoc->GetValue(ScAddress(0,2,0))); @@ -2154,9 +2153,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete column D. m_pDoc->DeleteCol(ScRange(3,0,0,3,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C2:E3)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C2:E3)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$2:$E$3)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$2:$E$3)"), m_pDoc->GetFormula(0,2,0)); CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(0,1,0))); CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(0,2,0))); @@ -2164,9 +2163,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete column E - the right edge of reference range. m_pDoc->DeleteCol(ScRange(4,0,0,4,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C2:D3)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C2:D3)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$2:$D$3)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$2:$D$3)"), m_pDoc->GetFormula(0,2,0)); CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(0,1,0))); CPPUNIT_ASSERT_EQUAL(16.0, m_pDoc->GetValue(ScAddress(0,2,0))); @@ -2174,9 +2173,9 @@ void TestFormula::testFormulaRefUpdateRange() // Delete column C - the left edge of reference range. m_pDoc->DeleteCol(ScRange(2,0,0,2,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C2:C3)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C2:C3)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$2:$C$3)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$2:$C$3)"), m_pDoc->GetFormula(0,2,0)); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,1,0))); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,2,0))); @@ -2197,58 +2196,58 @@ void TestFormula::testFormulaRefUpdateRange() m_pDoc->SetString(ScAddress(0,4,0), "=SUM(C2:D3)"); m_pDoc->SetString(ScAddress(0,5,0), "=SUM($C$2:$D$3)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(C2:D3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(C2:D3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($C$2:$D$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($C$2:$D$3)"), m_pDoc->GetFormula(0,5,0)); // Insert a column at column C. This should simply shift the reference without expansion. m_pDoc->InsertCol(ScRange(2,0,0,2,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(D2:E3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(D2:E3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($D$2:$E$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($D$2:$E$3)"), m_pDoc->GetFormula(0,5,0)); // Shift it back. m_pDoc->DeleteCol(ScRange(2,0,0,2,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(C2:D3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(C2:D3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($C$2:$D$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($C$2:$D$3)"), m_pDoc->GetFormula(0,5,0)); // Insert at column D. This should expand the reference by one column length. m_pDoc->InsertCol(ScRange(3,0,0,3,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(C2:E3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(C2:E3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($C$2:$E$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($C$2:$E$3)"), m_pDoc->GetFormula(0,5,0)); // Insert at column F. No expansion should occur since the edge expansion is turned off. m_pDoc->InsertCol(ScRange(5,0,0,5,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "SUM(C2:E3)", "Wrong formula in A5."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A5.", OUString("=SUM(C2:E3)"), m_pDoc->GetFormula(0,4,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM($C$2:$E$3)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM($C$2:$E$3)"), m_pDoc->GetFormula(0,5,0)); // Insert at row 2. No expansion should occur with edge expansion turned off. m_pDoc->InsertRow(ScRange(0,1,0,m_pDoc->MaxCol(),1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "SUM(C3:E4)", "Wrong formula in A6."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A6.", OUString("=SUM(C3:E4)"), m_pDoc->GetFormula(0,5,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "SUM($C$3:$E$4)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM($C$3:$E$4)"), m_pDoc->GetFormula(0,6,0)); // Insert at row 4 to expand the reference range. m_pDoc->InsertRow(ScRange(0,3,0,m_pDoc->MaxCol(),3,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "SUM(C3:E5)", "Wrong formula in A7."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A7.", OUString("=SUM(C3:E5)"), m_pDoc->GetFormula(0,6,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,7,0), "SUM($C$3:$E$5)", "Wrong formula in A8."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A8.", OUString("=SUM($C$3:$E$5)"), m_pDoc->GetFormula(0,7,0)); // Insert at row 6. No expansion with edge expansion turned off. m_pDoc->InsertRow(ScRange(0,5,0,m_pDoc->MaxCol(),5,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,7,0), "SUM(C3:E5)", "Wrong formula in A8."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A8.", OUString("=SUM(C3:E5)"), m_pDoc->GetFormula(0,7,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,8,0), "SUM($C$3:$E$5)", "Wrong formula in A9."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A9.", OUString("=SUM($C$3:$E$5)"), m_pDoc->GetFormula(0,8,0)); // Clear the range and start over. clearRange(m_pDoc, ScRange(0,0,0,20,20,0)); @@ -2266,37 +2265,37 @@ void TestFormula::testFormulaRefUpdateRange() m_pDoc->SetString(ScAddress(0,1,0), "=SUM(C6:D7)"); m_pDoc->SetString(ScAddress(0,2,0), "=SUM($C$6:$D$7)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C6:D7)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C6:D7)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$6:$D$7)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$6:$D$7)"), m_pDoc->GetFormula(0,2,0)); // Insert at column E. This should expand the reference range by one column. m_pDoc->InsertCol(ScRange(4,0,0,4,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C6:E7)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C6:E7)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$6:$E$7)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$6:$E$7)"), m_pDoc->GetFormula(0,2,0)); // Insert at column C to edge-expand the reference range. m_pDoc->InsertCol(ScRange(2,0,0,2,m_pDoc->MaxRow(),0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C6:F7)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C6:F7)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$6:$F$7)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$6:$F$7)"), m_pDoc->GetFormula(0,2,0)); // Insert at row 8 to edge-expand. m_pDoc->InsertRow(ScRange(0,7,0,m_pDoc->MaxCol(),7,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C6:F8)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C6:F8)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$6:$F$8)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$6:$F$8)"), m_pDoc->GetFormula(0,2,0)); // Insert at row 6 to edge-expand. m_pDoc->InsertRow(ScRange(0,5,0,m_pDoc->MaxCol(),5,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "SUM(C6:F9)", "Wrong formula in A2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A2.", OUString("=SUM(C6:F9)"), m_pDoc->GetFormula(0,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM($C$6:$F$9)", "Wrong formula in A3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in A3.", OUString("=SUM($C$6:$F$9)"), m_pDoc->GetFormula(0,2,0)); m_pDoc->InsertTab(1, "StickyRange"); @@ -2345,41 +2344,41 @@ void TestFormula::testFormulaRefUpdateRange() // A3:A18 must not result in #REF! anywhere. aPos.Set(0,2,1); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:B1048576", "Wrong reference in A3 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A3 after insertion.", OUString("=B2:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:B$1048576", "Wrong reference in A4 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A4 after insertion.", OUString("=B2:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:$B1048576", "Wrong reference in A5 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A5 after insertion.", OUString("=B2:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:$B$1048576", "Wrong reference in A6 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A6 after insertion.", OUString("=B2:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:B1048576", "Wrong reference in A7 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A7 after insertion.", OUString("=B$2:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:B$1048576", "Wrong reference in A8 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A8 after insertion.", OUString("=B$2:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:$B1048576", "Wrong reference in A9 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A9 after insertion.", OUString("=B$2:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:$B$1048576", "Wrong reference in A10 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A10 after insertion.", OUString("=B$2:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:B1048576", "Wrong reference in A11 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A11 after insertion.", OUString("=$B2:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:B$1048576", "Wrong reference in A12 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A12 after insertion.", OUString("=$B2:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:$B1048576", "Wrong reference in A13 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A13 after insertion.", OUString("=$B2:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:$B$1048576", "Wrong reference in A14 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A14 after insertion.", OUString("=$B2:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:B1048576", "Wrong reference in A15 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A15 after insertion.", OUString("=$B$2:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:B$1048576", "Wrong reference in A16 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A16 after insertion.", OUString("=$B$2:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:$B1048576", "Wrong reference in A17 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A17 after insertion.", OUString("=$B$2:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:$B$1048576", "Wrong reference in A18 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A18 after insertion.", OUString("=$B$2:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); // A19 reference to one row shifted out should be #REF! - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B#REF!:C#REF!", "Wrong reference in A19 after insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A19 after insertion.", OUString("=B#REF!:C#REF!"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); // A19 enter reference to last row. m_pDoc->SetString( aPos, "=B1048576:C1048576"); aPos.IncRow(); @@ -2390,41 +2389,41 @@ void TestFormula::testFormulaRefUpdateRange() // Check sticky bottom references and display of entire column references, // now in A2:A17. aPos.Set(0,1,1); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A2 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A2 after deletion.", OUString("=B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:B$1048576", "Wrong reference in A3 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A3 after deletion.", OUString("=B1:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A4 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A4 after deletion.", OUString("=B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:$B$1048576", "Wrong reference in A5 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A5 after deletion.", OUString("=B1:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:B1048576", "Wrong reference in A6 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A6 after deletion.", OUString("=B$1:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A7 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A7 after deletion.", OUString("=B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:$B1048576", "Wrong reference in A8 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A8 after deletion.", OUString("=B$1:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A9 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A9 after deletion.", OUString("=B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A10 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A10 after deletion.", OUString("=$B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:B$1048576", "Wrong reference in A11 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A11 after deletion.", OUString("=$B1:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A12 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A12 after deletion.", OUString("=$B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:$B$1048576", "Wrong reference in A13 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A13 after deletion.", OUString("=$B1:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:B1048576", "Wrong reference in A14 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A14 after deletion.", OUString("=$B$1:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A15 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A15 after deletion.", OUString("=$B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:$B1048576", "Wrong reference in A16 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A16 after deletion.", OUString("=$B$1:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A17 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A17 after deletion.", OUString("=$B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); // A18 reference to one last row should be shifted up. - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1048575:C1048575", "Wrong reference in A18 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A18 after deletion.", OUString("=B1048575:C1048575"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); // Insert 4 rows in the middle. @@ -2434,37 +2433,37 @@ void TestFormula::testFormulaRefUpdateRange() // References in A2:A17 must still be the same. aPos.Set(0,1,1); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A2 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A2 after deletion.", OUString("=B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:B$1048576", "Wrong reference in A3 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A3 after deletion.", OUString("=B1:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A4 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A4 after deletion.", OUString("=B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:$B$1048576", "Wrong reference in A5 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A5 after deletion.", OUString("=B1:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:B1048576", "Wrong reference in A6 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A6 after deletion.", OUString("=B$1:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A7 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A7 after deletion.", OUString("=B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:$B1048576", "Wrong reference in A8 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A8 after deletion.", OUString("=B$1:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A9 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A9 after deletion.", OUString("=B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A10 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A10 after deletion.", OUString("=$B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:B$1048576", "Wrong reference in A11 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A11 after deletion.", OUString("=$B1:B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A12 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A12 after deletion.", OUString("=$B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:$B$1048576", "Wrong reference in A13 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A13 after deletion.", OUString("=$B1:$B$1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:B1048576", "Wrong reference in A14 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A14 after deletion.", OUString("=$B$1:B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A15 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A15 after deletion.", OUString("=$B:B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:$B1048576", "Wrong reference in A16 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A16 after deletion.", OUString("=$B$1:$B1048576"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); - ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A17 after deletion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong reference in A17 after deletion.", OUString("=$B:$B"), m_pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab())); aPos.IncRow(); // Enter values in B1 and B1048576/B16777216 (last row). @@ -2526,9 +2525,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->SetString(ScAddress(1,1,1), "=SUM(Sheet1.B2:C3)"); m_pDoc->SetString(ScAddress(1,2,1), "=SUM($Sheet1.$B$2:$C$3)"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Swap the sheets. m_pDoc->MoveTab(0, 1); @@ -2537,9 +2536,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(1, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet1"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,0), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,0)); // Swap back. m_pDoc->MoveTab(0, 1); @@ -2548,9 +2547,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(1, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet2"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Insert a new sheet between the two. m_pDoc->InsertTab(1, "Temp"); @@ -2560,30 +2559,30 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(2, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet2"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,2), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,2)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,2), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,2)); // Move the last sheet (Sheet2) to the first position. m_pDoc->MoveTab(2, 0); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,0), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,0)); // Move back. m_pDoc->MoveTab(0, 2); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,2), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,2)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,2), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,2)); // Move the "Temp" sheet to the last position. m_pDoc->MoveTab(1, 2); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Move back. m_pDoc->MoveTab(2, 1); @@ -2594,9 +2593,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(1, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet2"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Insert a new sheet before the first one. m_pDoc->InsertTab(0, "Temp"); @@ -2606,16 +2605,16 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(2, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet2"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,2), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,2)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,2), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,2)); // Delete the temporary sheet. m_pDoc->DeleteTab(0); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Append a bunch of sheets. m_pDoc->InsertTab(2, "Temp1"); @@ -2626,9 +2625,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->MoveTab(2, 4); m_pDoc->MoveTab(3, 2); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(Sheet1.B2:C3)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($Sheet1.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,1)); // Delete the temp sheets. m_pDoc->DeleteTab(4); @@ -2640,9 +2639,9 @@ void TestFormula::testFormulaRefUpdateSheets() m_pDoc->GetName(0, aName); CPPUNIT_ASSERT_EQUAL(OUString("Sheet2"), aName); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,0), "SUM(#REF!.B2:C3)", "Wrong formula in Sheet2.B2."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B2.", OUString("=SUM(#REF!.B2:C3)"), m_pDoc->GetFormula(1,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "SUM($#REF!.$B$2:$C$3)", "Wrong formula in Sheet2.B3."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in Sheet2.B3.", OUString("=SUM($#REF!.$B$2:$C$3)"), m_pDoc->GetFormula(1,2,0)); m_pDoc->DeleteTab(0); } @@ -2675,7 +2674,7 @@ void TestFormula::testFormulaRefUpdateInsertRows() CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,4,0))); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(1,5,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,6,0), "SUM(B4:B6)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=SUM(B4:B6)"), m_pDoc->GetFormula(1,6,0)); // Clear and start over. clearSheet(m_pDoc, 0); @@ -2697,7 +2696,7 @@ void TestFormula::testFormulaRefUpdateInsertRows() CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula cell should not be an error.", 0, static_cast<int>(pFC->GetErrCode())); ASSERT_DOUBLES_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,5,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "MAX(A7:A9)", "Wrong formula!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula!", OUString("=MAX(A7:A9)"), m_pDoc->GetFormula(0,5,0)); m_pDoc->DeleteTab(0); } @@ -2713,8 +2712,8 @@ void TestFormula::testFormulaRefUpdateSheetsDelete() m_pDoc->SetString(ScAddress(4,2,0), "=SUM($Sheet2.A4:$Sheet4.A4)"); m_pDoc->DeleteTab(1); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(4,1,0), "SUM(Sheet3.A4:Sheet4.A4)", "Wrong Formula"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(4,2,0), "SUM($Sheet3.A4:$Sheet4.A4)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet3.A4:Sheet4.A4)"), m_pDoc->GetFormula(4,1,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet3.A4:$Sheet4.A4)"), m_pDoc->GetFormula(4,2,0)); m_pDoc->InsertTab(1, "Sheet2"); @@ -2722,8 +2721,8 @@ void TestFormula::testFormulaRefUpdateSheetsDelete() m_pDoc->SetString(ScAddress(5,2,3), "=SUM($Sheet1.A5:$Sheet3.A5)"); m_pDoc->DeleteTab(2); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(5,1,2), "SUM(Sheet1.A5:Sheet2.A5)", "Wrong Formula"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(5,2,2), "SUM($Sheet1.A5:$Sheet2.A5)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet1.A5:Sheet2.A5)"), m_pDoc->GetFormula(5,1,2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet1.A5:$Sheet2.A5)"), m_pDoc->GetFormula(5,2,2)); m_pDoc->InsertTab(2, "Sheet3"); @@ -2731,8 +2730,8 @@ void TestFormula::testFormulaRefUpdateSheetsDelete() m_pDoc->SetString(ScAddress(6,2,3), "=SUM($Sheet1.A6:$Sheet3.A6)"); m_pDoc->DeleteTabs(0,3); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(6,1,0), "SUM(#REF!.A6:#REF!.A6)", "Wrong Formula"); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(6,2,0), "SUM($#REF!.A6:$#REF!.A6)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(#REF!.A6:#REF!.A6)"), m_pDoc->GetFormula(6,1,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($#REF!.A6:$#REF!.A6)"), m_pDoc->GetFormula(6,2,0)); m_pDoc->InsertTab(0, "Sheet1"); m_pDoc->InsertTab(1, "Sheet2"); @@ -2748,31 +2747,31 @@ void TestFormula::testFormulaRefUpdateSheetsDelete() m_pDoc->DeleteTab(2); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,1), "SUM(Sheet1.A2:Sheet2.A2)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet1.A2:Sheet2.A2)"), m_pDoc->GetFormula(1,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,1,1), "SUM(Sheet1.A1:Sheet2.A1)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet1.A1:Sheet2.A1)"), m_pDoc->GetFormula(2,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3,1,1), "SUM(Sheet2.A3:Sheet4.A3)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet2.A3:Sheet4.A3)"), m_pDoc->GetFormula(3,1,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,1), "SUM($Sheet1.A2:$Sheet2.A2)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet1.A2:$Sheet2.A2)"), m_pDoc->GetFormula(1,2,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,2,1), "SUM($Sheet1.A1:$Sheet2.A1)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet1.A1:$Sheet2.A1)"), m_pDoc->GetFormula(2,2,1)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3,2,1), "SUM($Sheet2.A3:$Sheet4.A3)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet2.A3:$Sheet4.A3)"), m_pDoc->GetFormula(3,2,1)); m_pDoc->DeleteTab(0); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,1,0), "SUM(Sheet2.A2:Sheet2.A2)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet2.A2:Sheet2.A2)"), m_pDoc->GetFormula(1,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,1,0), "SUM(Sheet2.A1:Sheet2.A1)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet2.A1:Sheet2.A1)"), m_pDoc->GetFormula(2,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3,1,0), "SUM(Sheet2.A3:Sheet4.A3)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM(Sheet2.A3:Sheet4.A3)"), m_pDoc->GetFormula(3,1,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,2,0), "SUM($Sheet2.A2:$Sheet2.A2)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet2.A2:$Sheet2.A2)"), m_pDoc->GetFormula(1,2,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,2,0), "SUM($Sheet2.A1:$Sheet2.A1)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet2.A1:$Sheet2.A1)"), m_pDoc->GetFormula(2,2,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3,2,0), "SUM($Sheet2.A3:$Sheet4.A3)", "Wrong Formula"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong Formula", OUString("=SUM($Sheet2.A3:$Sheet4.A3)"), m_pDoc->GetFormula(3,2,0)); m_pDoc->DeleteTab(0); m_pDoc->DeleteTab(0); @@ -2826,7 +2825,7 @@ void TestFormula::testFormulaRefUpdateInsertColumns() rFunc.InsertCells(ScRange(0,0,0,1,m_pDoc->MaxRow(),0), &aMark, INS_INSCOLS_BEFORE, false, true); // Now, the original column B has moved to column D. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(3,3,0), "SUM(D1:D3)", "Wrong formula in D4 after column insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in D4 after column insertion.", OUString("=SUM(D1:D3)"), m_pDoc->GetFormula(3,3,0)); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(3,3,0))); @@ -2837,7 +2836,7 @@ void TestFormula::testFormulaRefUpdateInsertColumns() CPPUNIT_ASSERT_EQUAL(OUString("$Formula.$D2"), aSymbol); // Check that the formula using the name, now in E2, still has the same result. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(4,1,0), "RowRelativeRange", "Wrong formula in E2 after column insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in E2 after column insertion.", OUString("=RowRelativeRange"), m_pDoc->GetFormula(4,1,0)); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(4,1,0))); @@ -2848,7 +2847,7 @@ void TestFormula::testFormulaRefUpdateInsertColumns() CPPUNIT_ASSERT_EQUAL(OUString("$D:$D"), aSymbol); // Check that the formula using the name, now in E3, still has the same result. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(4,2,0), "SUM(EntireColumn)", "Wrong formula in E3 after column insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in E3 after column insertion.", OUString("=SUM(EntireColumn)"), m_pDoc->GetFormula(4,2,0)); CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(4,2,0))); @@ -2860,7 +2859,7 @@ void TestFormula::testFormulaRefUpdateInsertColumns() CPPUNIT_ASSERT_EQUAL(OUString("$2:$2"), aSymbol); // Check that the formula using the name, now in E4, still has the same result. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(4,3,0), "SUM(EntireRow)", "Wrong formula in E4 after column insertion."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula in E4 after column insertion.", OUString("=SUM(EntireRow)"), m_pDoc->GetFormula(4,3,0)); CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(4,3,0))); @@ -2900,10 +2899,10 @@ void TestFormula::testFormulaRefUpdateMove() CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(0,10,0)); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(0,11,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,8,0), "SUM(D4:D6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,9,0), "SUM($D$4:$D$6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,10,0), "D5", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,11,0), "$D$6", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(D4:D6)"), m_pDoc->GetFormula(0,8,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM($D$4:$D$6)"), m_pDoc->GetFormula(0,9,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=D5"), m_pDoc->GetFormula(0,10,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=$D$6"), m_pDoc->GetFormula(0,11,0)); // Move A9:A12 to B10:B13. bMoved = rFunc.MoveBlock(ScRange(0,8,0,0,11,0), ScAddress(1,9,0), true, false, false, false); @@ -2916,10 +2915,10 @@ void TestFormula::testFormulaRefUpdateMove() CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(1,12,0)); // Displayed formulas should stay the same since the referenced range hasn't moved. - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,9,0), "SUM(D4:D6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,10,0), "SUM($D$4:$D$6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,11,0), "D5", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,12,0), "$D$6", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(D4:D6)"), m_pDoc->GetFormula(1,9,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM($D$4:$D$6)"), m_pDoc->GetFormula(1,10,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=D5"), m_pDoc->GetFormula(1,11,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=$D$6"), m_pDoc->GetFormula(1,12,0)); // The value cells are in D4:D6. Move D4:D5 to the right but leave D6 // where it is. @@ -2932,10 +2931,10 @@ void TestFormula::testFormulaRefUpdateMove() CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1,11,0)); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(1,12,0)); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,9,0), "SUM(D4:D6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,10,0), "SUM($D$4:$D$6)", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,11,0), "E5", "Wrong formula."); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,12,0), "$D$6", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(D4:D6)"), m_pDoc->GetFormula(1,9,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM($D$4:$D$6)"), m_pDoc->GetFormula(1,10,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=E5"), m_pDoc->GetFormula(1,11,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=$D$6"), m_pDoc->GetFormula(1,12,0)); m_pDoc->DeleteTab(0); } @@ -2955,28 +2954,28 @@ void TestFormula::testFormulaRefUpdateMoveUndo() // Set formulas with single cell references in A6:A8. m_pDoc->SetString(ScAddress(0,5,0), "=A1"); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,5,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "A1", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A1"), m_pDoc->GetFormula(0,5,0)); m_pDoc->SetString(ScAddress(0,6,0), "=A1+A2+A3"); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,6,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "A1+A2+A3", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A1+A2+A3"), m_pDoc->GetFormula(0,6,0)); m_pDoc->SetString(ScAddress(0,7,0), "=A1+A3+A4"); CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(0,7,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,7,0), "A1+A3+A4", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=A1+A3+A4"), m_pDoc->GetFormula(0,7,0)); // Set formulas with range references in A10:A12. m_pDoc->SetString(ScAddress(0,9,0), "=SUM(A1:A2)"); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,9,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,9,0), "SUM(A1:A2)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(A1:A2)"), m_pDoc->GetFormula(0,9,0)); m_pDoc->SetString(ScAddress(0,10,0), "=SUM(A1:A3)"); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,10,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,10,0), "SUM(A1:A3)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(A1:A3)"), m_pDoc->GetFormula(0,10,0)); m_pDoc->SetString(ScAddress(0,11,0), "=SUM(A1:A4)"); CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(0,11,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,11,0), "SUM(A1:A4)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(A1:A4)"), m_pDoc->GetFormula(0,11,0)); // Move A1:A3 to C1:C3. Note that A4 remains. ScDocFunc& rFunc = m_xDocShell->GetDocFunc(); @@ -2984,22 +2983,22 @@ void TestFormula::testFormulaRefUpdateMoveUndo() CPPUNIT_ASSERT(bMoved); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,5,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "C1", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=C1"), m_pDoc->GetFormula(0,5,0)); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,6,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,6,0), "C1+C2+C3", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=C1+C2+C3"), m_pDoc->GetFormula(0,6,0)); CPPUNIT_ASSERT_EQUAL(8.0, m_pDoc->GetValue(ScAddress(0,7,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,7,0), "C1+C3+A4", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=C1+C3+A4"), m_pDoc->GetFormula(0,7,0)); CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,9,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,9,0), "SUM(C1:C2)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(C1:C2)"), m_pDoc->GetFormula(0,9,0)); CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,10,0))); - ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,10,0), "SUM(C1:C3)", "Wrong formula."); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", OUString("=SUM(C1:C3)"), m_pDoc->GetFormula(0,10,0)); ... etc. - the rest is truncated