diff options
author | Aleksas Pantechovskis <alex.pantec@gmail.com> | 2016-03-04 15:11:00 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-05 17:19:52 +0000 |
commit | c189b032236498e93cbc79c63617303aa1ba81eb (patch) | |
tree | 5329ee003c7d21b108750bf69f51e0f75f605f22 /sc | |
parent | da75a89925bce029c9464586ebf73e18e0342a9e (diff) |
tdf#98264, replace CPPUNIT_ASSERT with CPPUNIT_ASSERT_EQUAL
Change-Id: Ieae48c6a2b611d853f2320e27d5836d8c5dbedfb
Reviewed-on: https://gerrit.libreoffice.org/22905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 450 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_column.cxx | 24 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_condformat.cxx | 24 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_pivottable.cxx | 204 |
4 files changed, 361 insertions, 341 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7f1559475939..00a210885d4b 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -509,12 +509,12 @@ void Test::testSharedStringPool() aSS1 = m_pDoc->GetSharedString(ScAddress(0,2,0)); aSS2 = m_pDoc->GetSharedString(ScAddress(0,4,0)); CPPUNIT_ASSERT_MESSAGE("They must differ", aSS1.getData() != aSS2.getData()); - CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase() == aSS2.getDataIgnoreCase()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase(), aSS2.getDataIgnoreCase()); // A2 and A4 should be equal when ignoring cases. aSS1 = m_pDoc->GetSharedString(ScAddress(0,1,0)); aSS2 = m_pDoc->GetSharedString(ScAddress(0,3,0)); - CPPUNIT_ASSERT_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase() == aSS2.getDataIgnoreCase()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("They must be equal when cases are ignored.", aSS1.getDataIgnoreCase(), aSS2.getDataIgnoreCase()); } // Check the string counts after purging. Purging shouldn't remove any strings in this case. @@ -667,7 +667,7 @@ void Test::testRangeList() ScRangeList aRL; aRL.Append(ScRange(1,1,0,3,10,0)); - CPPUNIT_ASSERT_MESSAGE("List should have one range.", aRL.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("List should have one range.", size_t(1), aRL.size()); const ScRange* p = aRL[0]; CPPUNIT_ASSERT_MESSAGE("Failed to get the range object.", p); CPPUNIT_ASSERT_MESSAGE("Wrong range.", p->aStart == ScAddress(1,1,0) && p->aEnd == ScAddress(3,10,0)); @@ -690,38 +690,38 @@ void Test::testMarkData() // Select B3:F7. aMarkData.SetMarkArea(ScRange(1,2,0,5,6,0)); aSpans = aMarkData.GetMarkedRowSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be one selected row span.", aSpans.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one selected row span.", size_t(1), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(2), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(6), aSpans[0].mnEnd); aSpans = aMarkData.GetMarkedColSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be one selected column span.", aSpans.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one selected column span.", size_t(1), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(1), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(5), aSpans[0].mnEnd); // Select A11:B13. aMarkData.SetMultiMarkArea(ScRange(0,10,0,1,12,0)); aSpans = aMarkData.GetMarkedRowSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be 2 selected row spans.", aSpans.size() == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 2 selected row spans.", size_t(2), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(2), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(6), aSpans[0].mnEnd); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(10), aSpans[1].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(12), aSpans[1].mnEnd); aSpans = aMarkData.GetMarkedColSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be one selected column span.", aSpans.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one selected column span.", size_t(1), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(0), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(5), aSpans[0].mnEnd); // Select C8:C10. aMarkData.SetMultiMarkArea(ScRange(2,7,0,2,9,0)); aSpans = aMarkData.GetMarkedRowSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be one selected row span.", aSpans.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one selected row span.", size_t(1), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(2), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(12), aSpans[0].mnEnd); aSpans = aMarkData.GetMarkedColSpans(); - CPPUNIT_ASSERT_MESSAGE("There should be one selected column span.", aSpans.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one selected column span.", size_t(1), aSpans.size()); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(0), aSpans[0].mnStart); CPPUNIT_ASSERT_EQUAL(static_cast<SCCOLROW>(5), aSpans[0].mnEnd); } @@ -747,7 +747,7 @@ void Test::testInput() aParam.setTextInput(); m_pDoc->SetString(0, 0, 0, "000123", &aParam); test = m_pDoc->GetString(0, 0, 0); - CPPUNIT_ASSERT_MESSAGE("Text content should have been treated as string, not number.", test == "000123"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Text content should have been treated as string, not number.", OUString("000123"), test); m_pDoc->DeleteTab(0); } @@ -756,9 +756,11 @@ void Test::testDocStatistics() { SCTAB nStartTabs = m_pDoc->GetTableCount(); m_pDoc->InsertTab(0, "Sheet1"); - CPPUNIT_ASSERT_MESSAGE("Failed to increment sheet count.", m_pDoc->GetTableCount() == nStartTabs+1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to increment sheet count.", + static_cast<SCTAB>(nStartTabs+1), m_pDoc->GetTableCount()); m_pDoc->InsertTab(1, "Sheet2"); - CPPUNIT_ASSERT_MESSAGE("Failed to increment sheet count.", m_pDoc->GetTableCount() == nStartTabs+2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to increment sheet count.", + static_cast<SCTAB>(nStartTabs+2), m_pDoc->GetTableCount()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(0), m_pDoc->GetCellCount()); m_pDoc->SetValue(ScAddress(0,0,0), 2.0); @@ -781,7 +783,8 @@ void Test::testDocStatistics() CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(4), m_pDoc->GetFormulaGroupCount()); m_pDoc->DeleteTab(1); - CPPUNIT_ASSERT_MESSAGE("Failed to decrement sheet count.", m_pDoc->GetTableCount() == nStartTabs+1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to decrement sheet count.", + static_cast<SCTAB>(nStartTabs+1), m_pDoc->GetTableCount()); m_pDoc->DeleteTab(0); // This may fail in case there is only one sheet in the document. } @@ -1561,14 +1564,14 @@ void Test::testFuncParam() m_pDoc->CalcFormulaTree(false, false); double val; m_pDoc->GetValue(0, 0, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 2); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 2.0, val); // Now function with missing parameters. Missing values should be treated // as zeros. m_pDoc->SetString(0, 0, 0, "=AVERAGE(1;;;)"); m_pDoc->CalcFormulaTree(false, false); m_pDoc->GetValue(0, 0, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 0.25); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 0.25, val); // Conversion of string to numeric argument. m_pDoc->SetString(0, 0, 0, "=\"\"+3"); // empty string @@ -1586,15 +1589,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); m_pDoc->GetValue(0, 0, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 1, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 2, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.0, val); aVal = m_pDoc->GetString( 0, 3, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); m_pDoc->GetValue(0, 4, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7.4); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.4, val); // With "Convert also locale dependent" and "Empty string as zero"=False option. aConfig.meStringConversion = ScCalcConfig::StringConversion::LOCALE; @@ -1602,15 +1605,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); aVal = m_pDoc->GetString( 0, 0, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 1, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); m_pDoc->GetValue(0, 2, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.0, val); aVal = m_pDoc->GetString( 0, 3, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); m_pDoc->GetValue(0, 4, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7.4); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.4, val); // With "Convert only unambiguous" and "Empty string as zero"=True option. aConfig.meStringConversion = ScCalcConfig::StringConversion::UNAMBIGUOUS; @@ -1618,15 +1621,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); m_pDoc->GetValue(0, 0, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 1, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 2, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.0, val); aVal = m_pDoc->GetString( 0, 3, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 4, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); // With "Convert only unambiguous" and "Empty string as zero"=False option. aConfig.meStringConversion = ScCalcConfig::StringConversion::UNAMBIGUOUS; @@ -1634,15 +1637,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); aVal = m_pDoc->GetString( 0, 0, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 1, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); m_pDoc->GetValue(0, 2, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 7.0, val); aVal = m_pDoc->GetString( 0, 3, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 4, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); // With "Treat as zero" ("Empty string as zero" is ignored). aConfig.meStringConversion = ScCalcConfig::StringConversion::ZERO; @@ -1650,15 +1653,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); m_pDoc->GetValue(0, 0, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 1, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 2, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 3, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); m_pDoc->GetValue(0, 4, 0, val); - CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("incorrect result", 3.0, val); // With "Generate #VALUE! error" ("Empty string as zero" is ignored). aConfig.meStringConversion = ScCalcConfig::StringConversion::ILLEGAL; @@ -1666,15 +1669,15 @@ void Test::testFuncParam() m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); aVal = m_pDoc->GetString( 0, 0, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 1, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 2, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 3, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); aVal = m_pDoc->GetString( 0, 4, 0); - CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("incorrect result", OUString("#VALUE!"), aVal); m_pDoc->DeleteTab(0); } @@ -1715,7 +1718,7 @@ void Test::testNamedRange() double result; m_pDoc->GetValue (1, 0, 0, result); - CPPUNIT_ASSERT_MESSAGE ("calculation failed", result == 1.0); + ASSERT_DOUBLES_EQUAL_MESSAGE ("calculation failed", 1.0, result); // Test copy-ability of range names. ScRangeName* pCopiedRanges = new ScRangeName(*pNewRanges); @@ -1795,8 +1798,8 @@ void Test::testCSV() (aStr, aTests[i].eSep == English ? '.' : ',', aTests[i].eSep == English ? ',' : '.', nValue); - CPPUNIT_ASSERT_MESSAGE ("CSV numeric detection failure", bResult == aTests[i].bResult); - CPPUNIT_ASSERT_MESSAGE ("CSV numeric value failure", nValue == aTests[i].nValue); + CPPUNIT_ASSERT_EQUAL_MESSAGE ("CSV numeric detection failure", aTests[i].bResult, bResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE ("CSV numeric value failure", aTests[i].nValue, nValue); } } @@ -1819,8 +1822,8 @@ struct AllZeroMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_MESSAGE("element is not of numeric type", rVal.nType == SC_MATVAL_VALUE); - CPPUNIT_ASSERT_MESSAGE("element value must be zero", rVal.fVal == 0.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", SC_MATVAL_VALUE, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be zero", 0.0, rVal.fVal); } }; @@ -1828,14 +1831,14 @@ struct PartiallyFilledZeroMatrix { void operator() (SCSIZE nCol, SCSIZE nRow, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_MESSAGE("element is not of numeric type", rVal.nType == SC_MATVAL_VALUE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", SC_MATVAL_VALUE, rVal.nType); if (1 <= nCol && nCol <= 2 && 2 <= nRow && nRow <= 8) { - CPPUNIT_ASSERT_MESSAGE("element value must be 3.0", rVal.fVal == 3.0); + ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be 3.0", 3.0, rVal.fVal); } else { - CPPUNIT_ASSERT_MESSAGE("element value must be zero", rVal.fVal == 0.0); + ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be zero", 0.0, rVal.fVal); } } }; @@ -1844,8 +1847,8 @@ struct AllEmptyMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_MESSAGE("element is not of empty type", rVal.nType == SC_MATVAL_EMPTY); - CPPUNIT_ASSERT_MESSAGE("value of \"empty\" element is expected to be zero", rVal.fVal == 0.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", SC_MATVAL_EMPTY, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } }; @@ -1855,28 +1858,28 @@ struct PartiallyFilledEmptyMatrix { if (nCol == 1 && nRow == 1) { - CPPUNIT_ASSERT_MESSAGE("element is not of boolean type", rVal.nType == SC_MATVAL_BOOLEAN); - CPPUNIT_ASSERT_MESSAGE("element value is not what is expected", rVal.fVal == 1.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of boolean type", SC_MATVAL_BOOLEAN, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", 1.0, rVal.fVal); } else if (nCol == 4 && nRow == 5) { - CPPUNIT_ASSERT_MESSAGE("element is not of value type", rVal.nType == SC_MATVAL_VALUE); - CPPUNIT_ASSERT_MESSAGE("element value is not what is expected", rVal.fVal == -12.5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", SC_MATVAL_VALUE, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", -12.5, rVal.fVal); } else if (nCol == 8 && nRow == 2) { - CPPUNIT_ASSERT_MESSAGE("element is not of value type", rVal.nType == SC_MATVAL_STRING); - CPPUNIT_ASSERT_MESSAGE("element value is not what is expected", rVal.aStr.getString() == "Test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", SC_MATVAL_STRING, rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element value is not what is expected", OUString("Test"), rVal.aStr.getString()); } else if (nCol == 8 && nRow == 11) { - CPPUNIT_ASSERT_MESSAGE("element is not of empty path type", rVal.nType == SC_MATVAL_EMPTYPATH); - CPPUNIT_ASSERT_MESSAGE("value of \"empty\" element is expected to be zero", rVal.fVal == 0.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty path type", SC_MATVAL_EMPTYPATH, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } else { - CPPUNIT_ASSERT_MESSAGE("element is not of empty type", rVal.nType == SC_MATVAL_EMPTY); - CPPUNIT_ASSERT_MESSAGE("value of \"empty\" element is expected to be zero", rVal.fVal == 0.0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", SC_MATVAL_EMPTY, rVal.nType); + ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } } }; @@ -2108,11 +2111,13 @@ void Test::testMatrixEditable() // Make sure A3:A4 is a matrix. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,2,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_MESSAGE("A3 should be matrix origin.", pFC->GetMatrixFlag() == MM_FORMULA); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A3 should be matrix origin.", + MM_FORMULA, static_cast<ScMatrixMode>(pFC->GetMatrixFlag())); pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_MESSAGE("A4 should be matrix reference.", pFC->GetMatrixFlag() == MM_REFERENCE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 should be matrix reference.", + MM_REFERENCE, static_cast<ScMatrixMode>(pFC->GetMatrixFlag())); // Check to make sure A3:A4 combined is editable. ScEditableTester aTester; @@ -2138,7 +2143,8 @@ void Test::testCellCopy() void Test::testSheetCopy() { m_pDoc->InsertTab(0, "TestTab"); - CPPUNIT_ASSERT_MESSAGE("document should have one sheet to begin with.", m_pDoc->GetTableCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have one sheet to begin with.", + static_cast<SCTAB>(1), m_pDoc->GetTableCount()); // Insert text in A1. m_pDoc->SetString(ScAddress(0,0,0), "copy me"); @@ -2163,7 +2169,9 @@ void Test::testSheetCopy() // Copy and test the result. m_pDoc->CopyTab(0, 1); - CPPUNIT_ASSERT_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount() == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", + static_cast<SCTAB>(2), m_pDoc->GetTableCount()); + bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden && nRow1 == 0 && nRow2 == MAXROW); CPPUNIT_ASSERT_MESSAGE("There should be note on A3 in new sheet", m_pDoc->HasNote(ScAddress(0,2,1))); @@ -2192,7 +2200,8 @@ void Test::testSheetCopy() // Copy the sheet once again. m_pDoc->CopyTab(0, 1); - CPPUNIT_ASSERT_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount() == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", + static_cast<SCTAB>(2), m_pDoc->GetTableCount()); bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("rows 0 - 4 should be visible", !bHidden && nRow1 == 0 && nRow2 == 4); bHidden = m_pDoc->RowHidden(5, 1, &nRow1, &nRow2); @@ -2206,25 +2215,25 @@ void Test::testSheetCopy() void Test::testSheetMove() { m_pDoc->InsertTab(0, "TestTab1"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have one sheet to begin with.", m_pDoc->GetTableCount(), static_cast<SCTAB>(1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have one sheet to begin with.", static_cast<SCTAB>(1), m_pDoc->GetTableCount()); SCROW nRow1, nRow2; bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW); //test if inserting before another sheet works m_pDoc->InsertTab(0, "TestTab2"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have two sheets", m_pDoc->GetTableCount(), static_cast<SCTAB>(2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have two sheets", static_cast<SCTAB>(2), m_pDoc->GetTableCount()); bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW); // Move and test the result. m_pDoc->MoveTab(0, 1); - CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount(), static_cast<SCTAB>(2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", static_cast<SCTAB>(2), m_pDoc->GetTableCount()); bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden && nRow1 == 0 && nRow2 == MAXROW); OUString aName; m_pDoc->GetName(0, aName); - CPPUNIT_ASSERT_MESSAGE( "sheets should have changed places", aName == "TestTab1" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "sheets should have changed places", OUString("TestTab1"), aName); m_pDoc->SetRowHidden(5, 10, 0, true); bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2); @@ -2236,7 +2245,7 @@ void Test::testSheetMove() // Move the sheet once again. m_pDoc->MoveTab(1, 0); - CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", m_pDoc->GetTableCount(), static_cast<SCTAB>(2)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document now should have two sheets.", static_cast<SCTAB>(2), m_pDoc->GetTableCount()); bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("rows 0 - 4 should be visible", !bHidden && nRow1 == 0 && nRow2 == 4); bHidden = m_pDoc->RowHidden(5, 1, &nRow1, &nRow2); @@ -2244,7 +2253,7 @@ void Test::testSheetMove() bHidden = m_pDoc->RowHidden(11, 1, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden && nRow1 == 11 && nRow2 == MAXROW); m_pDoc->GetName(0, aName); - CPPUNIT_ASSERT_MESSAGE( "sheets should have changed places", aName == "TestTab2" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "sheets should have changed places", OUString("TestTab2"), aName); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); } @@ -2289,7 +2298,7 @@ void Test::testStreamValid() m_pDoc->InsertTab(1, "Sheet2"); m_pDoc->InsertTab(2, "Sheet3"); m_pDoc->InsertTab(3, "Sheet4"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("We should have 4 sheet instances.", m_pDoc->GetTableCount(), static_cast<SCTAB>(4)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("We should have 4 sheet instances.", static_cast<SCTAB>(4), m_pDoc->GetTableCount()); OUString a1("A1"); OUString a2("A2"); @@ -2826,7 +2835,8 @@ void Test::testFunctionLists() void Test::testGraphicsInGroup() { m_pDoc->InsertTab(0, "TestTab"); - CPPUNIT_ASSERT_MESSAGE("document should have one sheet to begin with.", m_pDoc->GetTableCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("document should have one sheet to begin with.", + static_cast<SCTAB>(1), m_pDoc->GetTableCount()); SCROW nRow1, nRow2; bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2); CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden && nRow1 == 0 && nRow2 == MAXROW); @@ -2843,20 +2853,24 @@ void Test::testGraphicsInGroup() SdrRectObj *pObj = new SdrRectObj(aOrigRect); pPage->InsertObject(pObj); const Rectangle &rNewRect = pObj->GetLogicRect(); - CPPUNIT_ASSERT_MESSAGE("must have equal position and size", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("must have equal position and size", + static_cast<const Rectangle &>(aOrigRect), rNewRect); ScDrawLayer::SetPageAnchored(*pObj); //Use a range of rows guaranteed to include all of the square m_pDoc->ShowRows(0, 100, 0, false); m_pDoc->SetDrawPageSize(0); - CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should not change when page anchored", + static_cast<const Rectangle &>(aOrigRect), rNewRect); m_pDoc->ShowRows(0, 100, 0, true); m_pDoc->SetDrawPageSize(0); - CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should not change when page anchored", + static_cast<const Rectangle &>(aOrigRect), rNewRect); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); - CPPUNIT_ASSERT_MESSAGE("That shouldn't change size or positioning", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("That shouldn't change size or positioning", + static_cast<const Rectangle &>(aOrigRect), rNewRect); m_pDoc->ShowRows(0, 100, 0, false); m_pDoc->SetDrawPageSize(0); @@ -2866,7 +2880,8 @@ void Test::testGraphicsInGroup() (rNewRect.Bottom() - rNewRect.Top()) <= 1); m_pDoc->ShowRows(0, 100, 0, true); m_pDoc->SetDrawPageSize(0); - CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should not change when page anchored", + static_cast<const Rectangle &>(aOrigRect), rNewRect); } { @@ -2875,25 +2890,26 @@ void Test::testGraphicsInGroup() SdrCircObj* pObj = new SdrCircObj(OBJ_CIRC, aOrigRect); pPage->InsertObject(pObj); const Rectangle& rNewRect = pObj->GetLogicRect(); - CPPUNIT_ASSERT_MESSAGE("Position and size of the circle shouldn't change when inserted into the page.", - aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Position and size of the circle shouldn't change when inserted into the page.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); - CPPUNIT_ASSERT_MESSAGE("Size changed when cell anchored. Not good.", - aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size changed when cell anchored. Not good.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); // Insert 2 rows at the top. This should push the circle object down. m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2); m_pDoc->SetDrawPageSize(0); // Make sure the size of the circle is still identical. - CPPUNIT_ASSERT_MESSAGE("Size of the circle has changed, but shouldn't!", - aOrigRect.GetSize() == rNewRect.GetSize()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size of the circle has changed, but shouldn't!", + aOrigRect.GetSize(), rNewRect.GetSize()); // Delete 2 rows at the top. This should bring the circle object to its original position. m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2); m_pDoc->SetDrawPageSize(0); - CPPUNIT_ASSERT_MESSAGE("Failed to move back to its original position.", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to move back to its original position.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); } { @@ -2907,21 +2923,22 @@ void Test::testGraphicsInGroup() pObj->NbcSetLogicRect(aOrigRect); pPage->InsertObject(pObj); const Rectangle& rNewRect = pObj->GetLogicRect(); - CPPUNIT_ASSERT_MESSAGE("Size differ.", aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size differ.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); - CPPUNIT_ASSERT_MESSAGE("Size changed when cell-anchored. Not good.", - aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size changed when cell-anchored. Not good.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); // Insert 2 rows at the top and delete them immediately. m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2); m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2); m_pDoc->SetDrawPageSize(0); - CPPUNIT_ASSERT_MESSAGE("Size of a line object changed after row insertion and removal.", - aOrigRect == rNewRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size of a line object changed after row insertion and removal.", + static_cast<const Rectangle &>(aOrigRect), rNewRect); sal_Int32 n = pObj->GetPointCount(); - CPPUNIT_ASSERT_MESSAGE("There should be exactly 2 points in a line object.", n == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly 2 points in a line object.", static_cast<sal_Int32>(2), n); CPPUNIT_ASSERT_MESSAGE("Line shape has changed.", aStartPos == pObj->GetPoint(0) && aEndPos == pObj->GetPoint(1)); } @@ -2933,7 +2950,7 @@ void Test::testGraphicsOnSheetMove() { m_pDoc->InsertTab(0, "Tab1"); m_pDoc->InsertTab(1, "Tab2"); - CPPUNIT_ASSERT_MESSAGE("There should be only 2 sheets to begin with", m_pDoc->GetTableCount() == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only 2 sheets to begin with", static_cast<SCTAB>(2), m_pDoc->GetTableCount()); m_pDoc->InitDrawLayer(); ScDrawLayer* pDrawLayer = m_pDoc->GetDrawLayer(); @@ -2947,7 +2964,7 @@ void Test::testGraphicsOnSheetMove() pPage->InsertObject(pObj); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one object on the 1st sheet.", pPage->GetObjCount(), static_cast<size_t>(1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be one object on the 1st sheet.", static_cast<size_t>(1), pPage->GetObjCount()); const ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj); CPPUNIT_ASSERT_MESSAGE("Object meta-data doesn't exist.", pData); @@ -2955,12 +2972,12 @@ void Test::testGraphicsOnSheetMove() pPage = pDrawLayer->GetPage(1); CPPUNIT_ASSERT_MESSAGE("No page instance for the 2nd sheet.", pPage); - CPPUNIT_ASSERT_EQUAL_MESSAGE("2nd sheet shouldn't have any object.", pPage->GetObjCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("2nd sheet shouldn't have any object.", static_cast<size_t>(0), pPage->GetObjCount()); // Insert a new sheet at left-end, and make sure the object has moved to // the 2nd page. m_pDoc->InsertTab(0, "NewTab"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 3 sheets.", m_pDoc->GetTableCount(), static_cast<SCTAB>(3)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be 3 sheets.", static_cast<SCTAB>(3), m_pDoc->GetTableCount()); pPage = pDrawLayer->GetPage(0); CPPUNIT_ASSERT_MESSAGE("1st sheet should have no object.", pPage && pPage->GetObjCount() == 0); pPage = pDrawLayer->GetPage(1); @@ -2975,8 +2992,8 @@ void Test::testGraphicsOnSheetMove() m_pDoc->DeleteTab(0); pPage = pDrawLayer->GetPage(0); CPPUNIT_ASSERT_MESSAGE("1st sheet should have one object.", pPage && pPage->GetObjCount() == 1); - CPPUNIT_ASSERT_MESSAGE("Size and position of the object shouldn't change.", - pObj->GetLogicRect() == aObjRect); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Size and position of the object shouldn't change.", + aObjRect, pObj->GetLogicRect()); CPPUNIT_ASSERT_MESSAGE("Wrong sheet ID in cell anchor data!", pData->maStart.Tab() == 0 && pData->maEnd.Tab() == 0); @@ -3024,22 +3041,22 @@ void Test::testToggleRefFlag() // column relative / row relative -> column absolute / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE( "Wrong conversion.", aFormula == "=$B$100" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong conversion.", OUString("=$B$100"), aFormula ); // column absolute / row absolute -> column relative / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE( "Wrong conversion.", aFormula == "=B$100" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong conversion.", OUString("=B$100"), aFormula ); // column relative / row absolute -> column absolute / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE( "Wrong conversion.", aFormula == "=$B100" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong conversion.", OUString("=$B100"), aFormula ); // column absolute / row relative -> column relative / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE( "Wrong conversion.", aFormula == "=B100" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong conversion.", OUString("=B100"), aFormula ); } { @@ -3298,10 +3315,10 @@ void Test::testCopyPaste() OUString aString; fValue = m_pDoc->GetValue(ScAddress(1,1,1)); m_pDoc->GetFormula(1,1,1, aString); - ASSERT_DOUBLES_EQUAL_MESSAGE("copied formula should return 2", fValue, 2); - CPPUNIT_ASSERT_MESSAGE("formula string was not copied correctly", aString == aFormulaString); + ASSERT_DOUBLES_EQUAL_MESSAGE("copied formula should return 2", 2.0, fValue); + CPPUNIT_ASSERT_EQUAL_MESSAGE("formula string was not copied correctly", aString, aFormulaString); fValue = m_pDoc->GetValue(ScAddress(0,1,1)); - CPPUNIT_ASSERT_MESSAGE("copied value should be 1", fValue == 1); + ASSERT_DOUBLES_EQUAL_MESSAGE("copied value should be 1", 1.0, fValue); //check local range name after copying pLocal1 = m_pDoc->GetRangeName(1)->findByUpperName(OUString("LOCAL1")); @@ -3309,7 +3326,7 @@ void Test::testCopyPaste() ScRange aRangeLocal1; bool bIsValidRef = pLocal1->IsValidReference(aRangeLocal1); CPPUNIT_ASSERT_MESSAGE("local range name 1 should be valid", bIsValidRef); - CPPUNIT_ASSERT_MESSAGE("local range 1 should still point to Sheet1.A1",aRangeLocal1 == ScRange(0,0,0,0,0,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("local range 1 should still point to Sheet1.A1",ScRange(0,0,0,0,0,0), aRangeLocal1); pLocal2 = m_pDoc->GetRangeName(1)->findByUpperName(OUString("LOCAL2")); CPPUNIT_ASSERT_MESSAGE("local2 should not be copied", pLocal2 == nullptr); @@ -3317,12 +3334,12 @@ void Test::testCopyPaste() CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.A2", m_pDoc->HasNote(ScAddress(0, 1, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.B2", m_pDoc->HasNote(ScAddress(1, 1, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.C2", m_pDoc->HasNote(ScAddress(2, 1, 1))); - CPPUNIT_ASSERT_MESSAGE("Note content on Sheet1.A1 not copied to Sheet2.A2, empty cell content", - m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(0, 1, 1))->GetText()); - CPPUNIT_ASSERT_MESSAGE("Note content on Sheet1.B1 not copied to Sheet2.B2, formula cell content", - m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(1, 1, 1))->GetText()); - CPPUNIT_ASSERT_MESSAGE("Note content on Sheet1.C1 not copied to Sheet2.C2, string cell content", - m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(2, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note content on Sheet1.A1 not copied to Sheet2.A2, empty cell content", + m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(0, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note content on Sheet1.B1 not copied to Sheet2.B2, formula cell content", + m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(1, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note content on Sheet1.C1 not copied to Sheet2.C2, string cell content", + m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(2, 1, 1))->GetText()); //check undo and redo pUndo->Undo(); @@ -3338,19 +3355,19 @@ void Test::testCopyPaste() fValue = m_pDoc->GetValue(ScAddress(1,1,1)); ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 2 after redo", fValue, 2); aString = m_pDoc->GetString(2, 1, 1); - CPPUNIT_ASSERT_MESSAGE("Cell Sheet2.C2 should contain: test", aString == "test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell Sheet2.C2 should contain: test", OUString("test"), aString); m_pDoc->GetFormula(1,1,1, aString); - CPPUNIT_ASSERT_MESSAGE("Formula should be correct again", aString == aFormulaString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula should be correct again", aString, aFormulaString); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.A2", m_pDoc->HasNote(ScAddress(0, 1, 1))); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.B2", m_pDoc->HasNote(ScAddress(1, 1, 1))); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.C2", m_pDoc->HasNote(ScAddress(2, 1, 1))); - CPPUNIT_ASSERT_MESSAGE("After Redo, note again on Sheet2.A2, empty cell content", - m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(0, 1, 1))->GetText()); - CPPUNIT_ASSERT_MESSAGE("After Redo, note again on Sheet2.B2, formula cell content", - m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(1, 1, 1))->GetText()); - CPPUNIT_ASSERT_MESSAGE("After Redo, note again on Sheet2.C2, string cell content", - m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText() == m_pDoc->GetNote(ScAddress(2, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("After Redo, note again on Sheet2.A2, empty cell content", + m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(0, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("After Redo, note again on Sheet2.B2, formula cell content", + m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(1, 1, 1))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("After Redo, note again on Sheet2.C2, string cell content", + m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText(), m_pDoc->GetNote(ScAddress(2, 1, 1))->GetText()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -3436,24 +3453,24 @@ void Test::testCopyPasteTranspose() //check cell content after transposed copy/paste OUString aString = m_pDoc->GetString(3, 3, 1); - CPPUNIT_ASSERT_MESSAGE("Cell Sheet2.D4 should contain: test", aString == "test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell Sheet2.D4 should contain: test", OUString("test"), aString); double fValue = m_pDoc->GetValue(ScAddress(3,1,1)); ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell should return 1", fValue, 1); fValue = m_pDoc->GetValue(ScAddress(3,2,1)); ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula should return 2", fValue, 2); m_pDoc->GetFormula(3, 2, 1, aString); - CPPUNIT_ASSERT_MESSAGE("transposed formula should point on Sheet2.D2", aString == "=D2+1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed formula should point on Sheet2.D2", OUString("=D2+1"), aString); // check notes after transposed copy/paste CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D2", m_pDoc->HasNote(ScAddress(3, 1, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D3", m_pDoc->HasNote(ScAddress(3, 2, 1))); CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D4", m_pDoc->HasNote(ScAddress(3, 3, 1))); - CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D2", - m_pDoc->GetNote(ScAddress(3, 1, 1))->GetText() == m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); - CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D3", - m_pDoc->GetNote(ScAddress(3, 2, 1))->GetText() == m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText()); - CPPUNIT_ASSERT_MESSAGE("Content of cell note on Sheet2.D4", - m_pDoc->GetNote(ScAddress(3, 3, 1))->GetText() == m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D2", + m_pDoc->GetNote(ScAddress(3, 1, 1))->GetText(), m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D3", + m_pDoc->GetNote(ScAddress(3, 2, 1))->GetText(), m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D4", + m_pDoc->GetNote(ScAddress(3, 3, 1))->GetText(), m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -3722,7 +3739,7 @@ void Test::testCopyPasteSkipEmpty2() m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, nullptr, &aClipDoc, false, false, true, true); CPPUNIT_ASSERT_EQUAL(OUString("A"), m_pDoc->GetString(ScAddress(0,2,0))); - CPPUNIT_ASSERT_MESSAGE("B3 should be empty.", m_pDoc->GetCellType(ScAddress(1,2,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("B3 should be empty.", CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(1,2,0))); CPPUNIT_ASSERT_EQUAL(OUString("C"), m_pDoc->GetString(ScAddress(2,2,0))); m_pDoc->DeleteTab(0); @@ -3804,7 +3821,7 @@ void Test::testMoveRefBetweenSheets() bool bMoved = rFunc.MoveBlock(ScRange(0,1,0,0,2,0), ScAddress(0,1,1), true, true, false, true); CPPUNIT_ASSERT(bMoved); - CPPUNIT_ASSERT_MESSAGE("This cell should be empty after the move.", m_pDoc->GetCellType(ScAddress(0,1,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This cell should be empty after the move.", CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(0,1,0))); CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,1,1))); CPPUNIT_ASSERT_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0,2,1))); @@ -3905,9 +3922,9 @@ void Test::testMoveBlock() //check cell content OUString aString = m_pDoc->GetString(3, 0, 0); - CPPUNIT_ASSERT_MESSAGE("Cell D1 should contain: test", aString == "test"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D1 should contain: test", OUString("test"), aString); m_pDoc->GetFormula(2, 0, 0, aString); - CPPUNIT_ASSERT_MESSAGE("Cell C1 should contain an updated formula", aString == "=B1+1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C1 should contain an updated formula", OUString("=B1+1"), aString); double fValue = m_pDoc->GetValue(aAddrB1); ASSERT_DOUBLES_EQUAL_MESSAGE("Cell B1 should contain 1", fValue, 1); @@ -3989,7 +4006,7 @@ void Test::testCopyPasteRelativeFormula() // Delete A3 and make sure it doesn't crash (see fdo#76132). clearRange(m_pDoc, ScAddress(0,2,0)); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(0,2,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(0,2,0))); m_pDoc->DeleteTab(0); } @@ -4069,7 +4086,7 @@ void Test::testCopyPasteRepeatOneFormula() ScDocFunc& rFunc = getDocShell().GetDocFunc(); rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS_BEFORE, true, true); - CPPUNIT_ASSERT_MESSAGE("C1 should be empty.", m_pDoc->GetCellType(ScAddress(2,0,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("C1 should be empty.", CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(2,0,0))); // This check makes only sense if group listeners are activated. #if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER @@ -4188,7 +4205,7 @@ void Test::testRenameTable() getDocShell().GetDocFunc().RenameTable(0,nameToSet,false,true); OUString nameJustSet; m_pDoc->GetName(0,nameJustSet); - CPPUNIT_ASSERT_MESSAGE("table not renamed", nameToSet == nameJustSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("table not renamed", nameToSet, nameJustSet); //test case 3 , rename again OUString anOldName; @@ -4197,17 +4214,18 @@ void Test::testRenameTable() nameToSet = "test2"; rDocFunc.RenameTable(0,nameToSet,false,true); m_pDoc->GetName(0,nameJustSet); - CPPUNIT_ASSERT_MESSAGE("table not renamed", nameToSet == nameJustSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("table not renamed", nameToSet, nameJustSet); //test case 4 , check if undo works SfxUndoAction* pUndo = new ScUndoRenameTab(&getDocShell(),0,anOldName,nameToSet); pUndo->Undo(); m_pDoc->GetName(0,nameJustSet); - CPPUNIT_ASSERT_MESSAGE("the correct name is not set after undo", nameJustSet == anOldName); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct name is not set after undo", nameJustSet, anOldName); pUndo->Redo(); m_pDoc->GetName(0,nameJustSet); - CPPUNIT_ASSERT_MESSAGE("the correct color is not set after redo", nameJustSet == nameToSet); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct color is not set after redo", nameJustSet, nameToSet); + delete pUndo; m_pDoc->DeleteTab(0); m_pDoc->DeleteTab(1); @@ -4224,21 +4242,22 @@ void Test::testSetBackgroundColor() //test yellow aColor=Color(COL_YELLOW); getDocShell().GetDocFunc().SetTabBgColor(0,aColor,false, true); - CPPUNIT_ASSERT_MESSAGE("the correct color is not set", - m_pDoc->GetTabBgColor(0) == aColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct color is not set", + aColor, m_pDoc->GetTabBgColor(0)); Color aOldTabBgColor=m_pDoc->GetTabBgColor(0); aColor.SetColor(COL_BLUE);//set BLUE getDocShell().GetDocFunc().SetTabBgColor(0,aColor,false, true); - CPPUNIT_ASSERT_MESSAGE("the correct color is not set the second time", - m_pDoc->GetTabBgColor(0) == aColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct color is not set the second time", + aColor, m_pDoc->GetTabBgColor(0)); //now check for undo SfxUndoAction* pUndo = new ScUndoTabColor(&getDocShell(), 0, aOldTabBgColor, aColor); pUndo->Undo(); - CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", m_pDoc->GetTabBgColor(0)== aOldTabBgColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct color is not set after undo", aOldTabBgColor, m_pDoc->GetTabBgColor(0)); pUndo->Redo(); - CPPUNIT_ASSERT_MESSAGE("the correct color is not set after undo", m_pDoc->GetTabBgColor(0)== aColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("the correct color is not set after undo", aColor, m_pDoc->GetTabBgColor(0)); + delete pUndo; m_pDoc->DeleteTab(0); } @@ -4339,7 +4358,7 @@ void Test::testSearchCells() bool bSuccess = m_pDoc->SearchAndReplace(aItem, nCol, nRow, nTab, aMarkData, aMatchedRanges, aUndoStr); CPPUNIT_ASSERT_MESSAGE("Search And Replace should succeed", bSuccess); - CPPUNIT_ASSERT_MESSAGE("There should be exactly 3 matching cells.", aMatchedRanges.size() == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly 3 matching cells.", size_t(3), aMatchedRanges.size()); ScAddress aHit(0,0,0); CPPUNIT_ASSERT_MESSAGE("A1 should be inside the matched range.", aMatchedRanges.In(aHit)); aHit.SetRow(2); @@ -4555,7 +4574,7 @@ void Test::testAutoFill() CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(ScAddress(0,0,0))); for (SCROW i = 1; i <= 5; ++i) - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(0,i,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(0,i,0))); // Redo should put the serial values back in. pUndoMgr->Redo(); @@ -4727,7 +4746,7 @@ void Test::testFindAreaPosVertical() clearRange( m_pDoc, ScRange(0, 0, 0, 1, SAL_N_ELEMENTS(aData), 0)); ScAddress aPos(0,0,0); ScRange aDataRange = insertRangeData( m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); m_pDoc->SetRowHidden(4,4,0,true); bool bHidden = m_pDoc->RowHidden(4,0); @@ -4792,7 +4811,7 @@ void Test::testFindAreaPosColRight() clearRange( m_pDoc, ScRange(0, 0, 0, 7, SAL_N_ELEMENTS(aData), 0)); ScAddress aPos(0,0,0); ScRange aDataRange = insertRangeData( m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); m_pDoc->SetColHidden(4,4,0,true); bool bHidden = m_pDoc->ColHidden(4,0); @@ -4860,7 +4879,7 @@ void Test::testShiftCells() // Insert cell at D5. This should shift the string cell to right. m_pDoc->InsertCol(3, 0, 3, 0, 3, 1); OUString aStr = m_pDoc->GetString(5, 3, 0); - CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal); + CPPUNIT_ASSERT_EQUAL_MESSAGE("We should have a string cell here.", aTestVal, aStr); CPPUNIT_ASSERT_MESSAGE("D5 is supposed to be blank.", m_pDoc->IsBlockEmpty(0, 3, 4, 3, 4)); CPPUNIT_ASSERT_MESSAGE("there should be NO note", !m_pDoc->HasNote(4, 3, 0)); @@ -4869,7 +4888,7 @@ void Test::testShiftCells() // Delete cell D5, to shift the text cell back into D5. m_pDoc->DeleteCol(3, 0, 3, 0, 3, 1); aStr = m_pDoc->GetString(4, 3, 0); - CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal); + CPPUNIT_ASSERT_EQUAL_MESSAGE("We should have a string cell here.", aTestVal, aStr); CPPUNIT_ASSERT_MESSAGE("E5 is supposed to be blank.", m_pDoc->IsBlockEmpty(0, 4, 4, 4, 4)); CPPUNIT_ASSERT_MESSAGE("there should be NO note", !m_pDoc->HasNote(5, 3, 0)); @@ -4898,7 +4917,7 @@ void Test::testNoteBasic() pNote->SetAuthor("Jim Bob"); ScPostIt *pGetNote = m_pDoc->GetNote(aAddr); - CPPUNIT_ASSERT_MESSAGE("note should be itself", pGetNote == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("note should be itself", pNote, pGetNote); // Insert one row at row 1. bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1); @@ -4906,7 +4925,7 @@ void Test::testNoteBasic() CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncRow(); // cell C4 - CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("note not there", pNote, m_pDoc->GetNote(aAddr)); // Insert column at column A. bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1); @@ -4914,36 +4933,36 @@ void Test::testNoteBasic() CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncCol(); // cell D4 - CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("note not there", pNote, m_pDoc->GetNote(aAddr)); // Insert a new sheet to shift the current sheet to the right. m_pDoc->InsertTab(0, "Table2"); CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(aAddr) == nullptr); aAddr.IncTab(); // Move to the next sheet. - CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("note not there", pNote, m_pDoc->GetNote(aAddr)); m_pDoc->DeleteTab(0); aAddr.IncTab(-1); - CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("note not there", pNote, m_pDoc->GetNote(aAddr)); // Insert cell at C4. This should NOT shift the note position. bInsertRow = m_pDoc->InsertRow(2, 0, 2, 0, 3, 1); CPPUNIT_ASSERT_MESSAGE("Failed to insert cell at C4.", bInsertRow); - CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note shouldn't have moved but it has.", pNote, m_pDoc->GetNote(aAddr)); // Delete cell at C4. Again, this should NOT shift the note position. m_pDoc->DeleteRow(2, 0, 2, 0, 3, 1); - CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note shouldn't have moved but it has.", pNote, m_pDoc->GetNote(aAddr)); // Now, with the note at D4, delete cell D3. This should shift the note one cell up. m_pDoc->DeleteRow(3, 0, 3, 0, 2, 1); aAddr.IncRow(-1); // cell D3 - CPPUNIT_ASSERT_MESSAGE("Note at D4 should have shifted up to D3.", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at D4 should have shifted up to D3.", pNote, m_pDoc->GetNote(aAddr)); // Delete column C. This should shift the note one cell left. m_pDoc->DeleteCol(0, 0, MAXROW, 0, 2, 1); aAddr.IncCol(-1); // cell C3 - CPPUNIT_ASSERT_MESSAGE("Note at D3 should have shifted left to C3.", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at D3 should have shifted left to C3.", pNote, m_pDoc->GetNote(aAddr)); // Insert a text where the note is. m_pDoc->SetString(aAddr, "Note is here."); @@ -4951,7 +4970,7 @@ void Test::testNoteBasic() // Delete row 1. This should shift the note from C3 to C2. m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 1); aAddr.IncRow(-1); // C2 - CPPUNIT_ASSERT_MESSAGE("Note at C3 should have shifted up to C2.", m_pDoc->GetNote(aAddr) == pNote); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at C3 should have shifted up to C2.", pNote, m_pDoc->GetNote(aAddr)); m_pDoc->DeleteTab(0); } @@ -5076,7 +5095,7 @@ void Test::testNoteLifeCycle() pNote->SetText(aPos, "New note"); ScPostIt* pNote2 = m_pDoc->ReleaseNote(aPos); - CPPUNIT_ASSERT_MESSAGE("This note instance is expected to be identical to the original.", pNote == pNote2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This note instance is expected to be identical to the original.", pNote, pNote2); CPPUNIT_ASSERT_MESSAGE("The note shouldn't be here after it's been released.", !m_pDoc->HasNote(aPos)); // Modify the internal state of the note instance to make sure it's really @@ -5225,21 +5244,21 @@ void Test::testAreasWithNotes() dataFound = rDoc.GetDataStart(0,col,row); CPPUNIT_ASSERT_MESSAGE("No DataStart found", dataFound); - CPPUNIT_ASSERT_MESSAGE("DataStart wrong col for notes", col == 1); - CPPUNIT_ASSERT_MESSAGE("DataStart wrong row for notes", row == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("DataStart wrong col for notes", static_cast<SCCOL>(1), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("DataStart wrong row for notes", static_cast<SCROW>(2), row); dataFound = rDoc.GetCellArea(0,col,row); CPPUNIT_ASSERT_MESSAGE("No CellArea found", dataFound); - CPPUNIT_ASSERT_MESSAGE("CellArea wrong col for notes", col == 2); - CPPUNIT_ASSERT_MESSAGE("CellArea wrong row for notes", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("CellArea wrong col for notes", static_cast<SCCOL>(2), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("CellArea wrong row for notes", static_cast<SCROW>(5), row); bool bNotes = true; dataFound = rDoc.GetPrintArea(0,col,row, bNotes); CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col for notes", col == 2); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row for notes", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong col for notes", static_cast<SCCOL>(2), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong row for notes", static_cast<SCROW>(5), row); bNotes = false; dataFound = rDoc.GetPrintArea(0,col,row, bNotes); @@ -5248,11 +5267,11 @@ void Test::testAreasWithNotes() bNotes = true; dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row for notes", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", static_cast<SCROW>(5), row); dataFound = rDoc.GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row for notes", row == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", static_cast<SCROW>(2), row); bNotes = false; dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // col 0 & 1 @@ -5266,41 +5285,41 @@ void Test::testAreasWithNotes() dataFound = rDoc.GetDataStart(0,col,row); CPPUNIT_ASSERT_MESSAGE("No DataStart found", dataFound); - CPPUNIT_ASSERT_MESSAGE("DataStart wrong col", col == 0); - CPPUNIT_ASSERT_MESSAGE("DataStart wrong row", row == 2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("DataStart wrong col", static_cast<SCCOL>(0), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("DataStart wrong row", static_cast<SCROW>(2), row); dataFound = rDoc.GetCellArea(0,col,row); CPPUNIT_ASSERT_MESSAGE("No CellArea found", dataFound); - CPPUNIT_ASSERT_MESSAGE("CellArea wrong col", col == 3); - CPPUNIT_ASSERT_MESSAGE("CellArea wrong row", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("CellArea wrong col", static_cast<SCCOL>(3), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("CellArea wrong row", static_cast<SCROW>(5), row); bNotes = true; dataFound = rDoc.GetPrintArea(0,col,row, bNotes); CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col", col == 3); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong col", static_cast<SCCOL>(3), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong row", static_cast<SCROW>(5), row); bNotes = false; dataFound = rDoc.GetPrintArea(0,col,row, bNotes); CPPUNIT_ASSERT_MESSAGE("No PrintArea found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong col", col == 3); - CPPUNIT_ASSERT_MESSAGE("PrintArea wrong row", row == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong col", static_cast<SCCOL>(3), col); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintArea wrong row", static_cast<SCROW>(3), row); bNotes = true; dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row", static_cast<SCROW>(5), row); dataFound = rDoc.GetPrintAreaVer(0,2,3,row, bNotes); // cols 2 & 3 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row", static_cast<SCROW>(3), row); bNotes = false; dataFound = rDoc.GetPrintAreaVer(0,0,1,row, bNotes); // cols 0 & 1 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); - CPPUNIT_ASSERT_MESSAGE("PrintAreaVer wrong row", row == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row", static_cast<SCROW>(3), row); rDoc.DeleteTab(0); } @@ -5711,7 +5730,7 @@ void Test::testFormulaToValue() ScAddress aPos(1,2,0); // B3 ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); { // Expected output table content. 0 = empty cell @@ -5749,26 +5768,26 @@ void Test::testFormulaToValue() } // Make sure that B3:B4 and B7:B8 are formula cells. - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,2,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,3,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,6,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,7,0)) == CELLTYPE_FORMULA); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,3,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,6,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,7,0))); // Make sure that B5:C6 are numeric cells. - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,4,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,5,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(2,4,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(2,5,0)) == CELLTYPE_VALUE); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(1,4,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(1,5,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(2,4,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(2,5,0))); // Make sure that formula cells in C3:C4 and C7:C8 are grouped. const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(2,2,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 2); - CPPUNIT_ASSERT(pFC->GetSharedLength() == 2); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); pFC = m_pDoc->GetFormulaCell(ScAddress(2,6,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 6); - CPPUNIT_ASSERT(pFC->GetSharedLength() == 2); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); // Undo and check. SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); @@ -5801,8 +5820,8 @@ void Test::testFormulaToValue() // C3:C8 should be shared formula cells. pFC = m_pDoc->GetFormulaCell(ScAddress(2,2,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 2); - CPPUNIT_ASSERT(pFC->GetSharedLength() == 6); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedLength()); // Redo and check. pUndoMgr->Redo(); @@ -5822,26 +5841,26 @@ void Test::testFormulaToValue() } // Make sure that B3:B4 and B7:B8 are formula cells. - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,2,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,3,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,6,0)) == CELLTYPE_FORMULA); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,7,0)) == CELLTYPE_FORMULA); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,3,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,6,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_FORMULA, m_pDoc->GetCellType(ScAddress(1,7,0))); // Make sure that B5:C6 are numeric cells. - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,4,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(1,5,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(2,4,0)) == CELLTYPE_VALUE); - CPPUNIT_ASSERT(m_pDoc->GetCellType(ScAddress(2,5,0)) == CELLTYPE_VALUE); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(1,4,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(1,5,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(2,4,0))); + CPPUNIT_ASSERT_EQUAL(CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(2,5,0))); // Make sure that formula cells in C3:C4 and C7:C8 are grouped. pFC = m_pDoc->GetFormulaCell(ScAddress(2,2,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 2); - CPPUNIT_ASSERT(pFC->GetSharedLength() == 2); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); pFC = m_pDoc->GetFormulaCell(ScAddress(2,6,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT(pFC->GetSharedTopRow() == 6); - CPPUNIT_ASSERT(pFC->GetSharedLength() == 2); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedTopRow()); + CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength()); // Undo again and make sure the recovered formulas in C5:C6 still track B5:B6. pUndoMgr->Undo(); @@ -5871,7 +5890,7 @@ void Test::testFormulaToValue2() // Insert data into B2:C6. ScAddress aPos(1,1,0); // B2 ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); { // Expected output table content. 0 = empty cell @@ -5959,7 +5978,7 @@ void Test::testMixData() m_pDoc->SetValue(ScAddress(0,0,0), 15.0); m_pDoc->SetValue(ScAddress(0,1,0), 16.0); m_pDoc->SetValue(ScAddress(1,0,0), 12.0); - CPPUNIT_ASSERT_MESSAGE("B2 should be empty.", m_pDoc->GetCellType(ScAddress(1,1,0)) == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("B2 should be empty.", CELLTYPE_NONE, m_pDoc->GetCellType(ScAddress(1,1,0))); // Copy A1:A2 and paste it onto B1:B2 with subtraction operation. copyToClip(m_pDoc, ScRange(0,0,0,0,1,0), &aClipDoc); @@ -6090,7 +6109,8 @@ void Test::testCopyPasteMatrixFormula() void Test::testUndoDataAnchor() { m_pDoc->InsertTab(0, "Tab1"); - CPPUNIT_ASSERT_MESSAGE("There should be only 1 sheets to begin with", m_pDoc->GetTableCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only 1 sheets to begin with", + static_cast<SCTAB>(1), m_pDoc->GetTableCount()); m_pDoc->InitDrawLayer(); ScDrawLayer* pDrawLayer = m_pDoc->GetDrawLayer(); @@ -6150,7 +6170,7 @@ void Test::testUndoDataAnchor() // Check state ScAnchorType oldType = ScDrawLayer::GetAnchorType(*pObj); - CPPUNIT_ASSERT_MESSAGE( "Failed to check state SCA_CELL.", oldType == SCA_CELL ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Failed to check state SCA_CELL.", SCA_CELL, oldType); // Get anchor data pData = ScDrawLayer::GetObjData(pObj); diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx index 6b9ca51c2746..2aaba3b7dbd4 100644 --- a/sc/qa/unit/ucalc_column.cxx +++ b/sc/qa/unit/ucalc_column.cxx @@ -19,11 +19,11 @@ void Test::testColumnFindEditCells() // Test the basics with real edit cells, using Column A. SCROW nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,MAXROW,0)); - CPPUNIT_ASSERT_MESSAGE("There should be no edit cells.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no edit cells.", SCROW(-1), nResRow); nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,0,0)); - CPPUNIT_ASSERT_MESSAGE("There should be no edit cells.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no edit cells.", SCROW(-1), nResRow); nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,10,0)); - CPPUNIT_ASSERT_MESSAGE("There should be no edit cells.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no edit cells.", SCROW(-1), nResRow); ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); rEE.SetText("Test"); @@ -33,39 +33,39 @@ void Test::testColumnFindEditCells() ScRange aRange(0,0,0,0,0,0); nResRow = m_pDoc->GetFirstEditTextRow(aRange); - CPPUNIT_ASSERT_MESSAGE("There is an edit cell here.", nResRow == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There is an edit cell here.", SCROW(0), nResRow); aRange.aStart.SetRow(1); aRange.aEnd.SetRow(1); nResRow = m_pDoc->GetFirstEditTextRow(aRange); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be an edit cell in specified range.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be an edit cell in specified range.", SCROW(-1), nResRow); aRange.aStart.SetRow(2); aRange.aEnd.SetRow(4); nResRow = m_pDoc->GetFirstEditTextRow(aRange); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be an edit cell in specified range.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be an edit cell in specified range.", SCROW(-1), nResRow); aRange.aStart.SetRow(0); aRange.aEnd.SetRow(MAXROW); nResRow = m_pDoc->GetFirstEditTextRow(aRange); - CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in specified range.", nResRow == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be an edit cell in specified range.", SCROW(0), nResRow); m_pDoc->SetString(ScAddress(0,0,0), "Test"); m_pDoc->SetValue(ScAddress(0,2,0), 1.0); ScRefCellValue aCell; aCell.assign(*m_pDoc, ScAddress(0,0,0)); - CPPUNIT_ASSERT_MESSAGE("This should be a string cell.", aCell.meType == CELLTYPE_STRING); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string cell.", CELLTYPE_STRING, aCell.meType); aCell.assign(*m_pDoc, ScAddress(0,1,0)); - CPPUNIT_ASSERT_MESSAGE("This should be an empty cell.", aCell.meType == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", CELLTYPE_NONE, aCell.meType); aCell.assign(*m_pDoc, ScAddress(0,2,0)); - CPPUNIT_ASSERT_MESSAGE("This should be a numeric cell.", aCell.meType == CELLTYPE_VALUE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a numeric cell.", CELLTYPE_VALUE, aCell.meType); aCell.assign(*m_pDoc, ScAddress(0,3,0)); - CPPUNIT_ASSERT_MESSAGE("This should be an empty cell.", aCell.meType == CELLTYPE_NONE); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be an empty cell.", CELLTYPE_NONE, aCell.meType); aRange.aStart.SetRow(1); aRange.aEnd.SetRow(1); nResRow = m_pDoc->GetFirstEditTextRow(aRange); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be an edit cell in specified range.", nResRow == -1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be an edit cell in specified range.", SCROW(-1), nResRow); // Test with non-edit cell but with ambiguous script type. diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index b51b6808b1d3..7af25cf66969 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -106,7 +106,7 @@ void Test::testCondFormatINSDEL() m_pDoc->InsertCol(0,0,MAXROW,0,0,2); const ScRangeList& rRange = pFormat->GetRange(); - CPPUNIT_ASSERT(rRange == ScRange(2,0,0,2,3,0)); + CPPUNIT_ASSERT_EQUAL(static_cast<const ScRangeList&>(ScRange(2,0,0,2,3,0)), rRange); OUString aExpr = pEntry->GetExpression(ScAddress(2,0,0), 0); CPPUNIT_ASSERT_EQUAL(aExpr, OUString("D2")); @@ -131,7 +131,7 @@ void Test::testCondFormatInsertCol() m_pDoc->InsertCol(0,0,MAXROW,0,4,2); const ScRangeList& rRange = pFormat->GetRange(); - CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,0,5,3,0)), rRange); + CPPUNIT_ASSERT_EQUAL(static_cast<const ScRangeList&>(ScRangeList(ScRange(0,0,0,5,3,0))), rRange); m_pDoc->DeleteTab(0); } @@ -180,14 +180,14 @@ void Test::testCondFormatInsertDeleteSheets() ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0); CPPUNIT_ASSERT(pList); const ScConditionalFormat* pCheck = pList->GetFormat(nKey); - CPPUNIT_ASSERT_MESSAGE("Wrong conditional format instance.", pCheck == pFormat); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong conditional format instance.", pCheck, const_cast<const ScConditionalFormat*>(pFormat)); // ... and its range is B2:B4. ScRangeList aCheckRange = pCheck->GetRange(); - CPPUNIT_ASSERT_MESSAGE("This should be a single range.", aCheckRange.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a single range.", size_t(1), aCheckRange.size()); const ScRange* pRange = aCheckRange[0]; CPPUNIT_ASSERT(pRange); - CPPUNIT_ASSERT_MESSAGE("Format should be applied to B2:B4.", *pRange == ScRange(1,1,0,1,3,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Format should be applied to B2:B4.", ScRange(1,1,0,1,3,0), *pRange); ScDocFunc& rFunc = getDocShell().GetDocFunc(); @@ -202,10 +202,10 @@ void Test::testCondFormatInsertDeleteSheets() // Make sure the range also got shifted. aCheckRange = pCheck->GetRange(); - CPPUNIT_ASSERT_MESSAGE("This should be a single range.", aCheckRange.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a single range.", size_t(1), aCheckRange.size()); pRange = aCheckRange[0]; CPPUNIT_ASSERT(pRange); - CPPUNIT_ASSERT_MESSAGE("Format should be applied to B2:B4 on the 2nd sheet after the sheet insertion.", *pRange == ScRange(1,1,1,1,3,1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Format should be applied to B2:B4 on the 2nd sheet after the sheet insertion.", ScRange(1,1,1,1,3,1), *pRange); // Delete the sheet to the left. bool bDeleted = rFunc.DeleteTable(0, true, true); @@ -218,10 +218,10 @@ void Test::testCondFormatInsertDeleteSheets() // Make sure the range got shifted back. aCheckRange = pCheck->GetRange(); - CPPUNIT_ASSERT_MESSAGE("This should be a single range.", aCheckRange.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a single range.", size_t(1), aCheckRange.size()); pRange = aCheckRange[0]; CPPUNIT_ASSERT(pRange); - CPPUNIT_ASSERT_MESSAGE("Format should be applied to B2:B4 on the 1st sheet after the sheet removal.", *pRange == ScRange(1,1,0,1,3,0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Format should be applied to B2:B4 on the 1st sheet after the sheet removal.", ScRange(1,1,0,1,3,0), *pRange); SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); CPPUNIT_ASSERT(pUndoMgr); @@ -235,10 +235,10 @@ void Test::testCondFormatInsertDeleteSheets() CPPUNIT_ASSERT(pCheck); aCheckRange = pCheck->GetRange(); - CPPUNIT_ASSERT_MESSAGE("This should be a single range.", aCheckRange.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a single range.", size_t(1), aCheckRange.size()); pRange = aCheckRange[0]; CPPUNIT_ASSERT(pRange); - CPPUNIT_ASSERT_MESSAGE("Format should be applied to B2:B4 on the 2nd sheet after the undo of the sheet removal.", *pRange == ScRange(1,1,1,1,3,1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Format should be applied to B2:B4 on the 2nd sheet after the undo of the sheet removal.", ScRange(1,1,1,1,3,1), *pRange); #if 0 // TODO : Undo of sheet insertion currently depends on the presence of // view shell, and crashes when executed during cppunit run. @@ -423,7 +423,7 @@ void Test::testCondCopyPasteSheet() CPPUNIT_ASSERT(pCondFormatItem); CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormatItem->GetCondFormatData().size()); - CPPUNIT_ASSERT( nKey == pCondFormatItem->GetCondFormatData().at(0) ); + CPPUNIT_ASSERT_EQUAL( nKey, pCondFormatItem->GetCondFormatData().at(0) ); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 619af2b0b91e..ef143ffd7bbd 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -176,7 +176,7 @@ ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) std::set<ScDPObject*> aRefs; bool bSuccess = pDPs->ReloadGroupsInCache(pDPObj, aRefs); CPPUNIT_ASSERT_MESSAGE("Failed to reload group data in cache.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("There should be only one table linked to this cache.", aRefs.size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one table linked to this cache.", size_t(1), aRefs.size()); pDPObj->ReloadGroupTableData(); return refresh(pDPObj); @@ -219,8 +219,8 @@ void Test::testPivotTable() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); bool bOverflow = false; @@ -246,7 +246,7 @@ void Test::testPivotTable() bSuccess = checkDPTableOutput<5>(m_pDoc, aOutRange, aOutputCheck, "DataPilot table output"); CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess); } - CPPUNIT_ASSERT_MESSAGE("There should be only one data cache.", pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one data cache.", size_t(1), pDPs->GetSheetCaches().size()); // Update the cell values. double aData2[] = { 100, 200, 300, 400, 500, 600 }; @@ -285,21 +285,21 @@ void Test::testPivotTable() CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess); } - CPPUNIT_ASSERT_MESSAGE("There should be only one data cache.", pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one data cache.", size_t(1), pDPs->GetSheetCaches().size()); // Free the first datapilot object after the 2nd one gets reloaded, to // prevent the data cache from being deleted before the reload. pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_MESSAGE("There should be only one data cache.", pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one data cache.", size_t(1), pDPs->GetSheetCaches().size()); // This time clear the cache to refresh the data from the source range. CPPUNIT_ASSERT_MESSAGE("This datapilot should be based on sheet data.", pDPObj2->IsSheetData()); std::set<ScDPObject*> aRefs; sal_uLong nErrId = pDPs->ReloadCache(pDPObj2, aRefs); - CPPUNIT_ASSERT_MESSAGE("Cache reload failed.", nErrId == 0); - CPPUNIT_ASSERT_MESSAGE("Reloading a cache shouldn't remove any cache.", - pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cache reload failed.", sal_uLong(0), nErrId); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Reloading a cache shouldn't remove any cache.", + static_cast<size_t>(1), pDPs->GetSheetCaches().size()); pDPObj2->ClearTableData(); pDPObj2->Output(aOutRange.aStart); @@ -326,19 +326,19 @@ void Test::testPivotTable() // Swap the two sheets. m_pDoc->MoveTab(1, 0); - CPPUNIT_ASSERT_MESSAGE("Swapping the sheets shouldn't remove the cache.", - pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Swapping the sheets shouldn't remove the cache.", + size_t(1), pDPs->GetSheetCaches().size()); CPPUNIT_ASSERT_MESSAGE("Cache should have moved.", !pDPs->GetSheetCaches().hasCache(aSrcRange)); aSrcRange.aStart.SetTab(1); aSrcRange.aEnd.SetTab(1); CPPUNIT_ASSERT_MESSAGE("Cache should be here.", pDPs->GetSheetCaches().hasCache(aSrcRange)); pDPs->FreeTable(pDPObj2); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be any data pilot table stored with the document.", - pDPs->GetCount() == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any data pilot table stored with the document.", + size_t(0), pDPs->GetCount()); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be any more data cache.", - pDPs->GetSheetCaches().size() == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more data cache.", + size_t(0), pDPs->GetSheetCaches().size()); // Insert a brand new pivot table object once again, but this time, don't // create the output to avoid creating a data cache. @@ -349,11 +349,11 @@ void Test::testPivotTable() m_pDoc, ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0), aFields, nFieldCount, false); bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); - CPPUNIT_ASSERT_MESSAGE("Data cache shouldn't exist yet before creating the table output.", - pDPs->GetSheetCaches().size() == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Data cache shouldn't exist yet before creating the table output.", + size_t(0), pDPs->GetSheetCaches().size()); // Now, "refresh" the table. This should still return a reference to self // even with the absence of data cache. @@ -400,8 +400,8 @@ void Test::testPivotTableLabels() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -456,8 +456,8 @@ void Test::testPivotTableDateLabels() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -539,8 +539,8 @@ void Test::testPivotTableFilters() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -566,7 +566,7 @@ void Test::testPivotTableFilters() m_pDoc->SetString(aFormulaAddr.Col(), aFormulaAddr.Row(), aFormulaAddr.Tab(), "=B6"); double fTest = m_pDoc->GetValue(aFormulaAddr); - CPPUNIT_ASSERT_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", fTest == 80.0); + ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", 80.0, fTest); // Set current page of 'Group2' to 'A'. pDPObj->BuildAllDimensionMembers(); @@ -594,7 +594,7 @@ void Test::testPivotTableFilters() } fTest = m_pDoc->GetValue(aFormulaAddr); - CPPUNIT_ASSERT_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", fTest == 40.0); + ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", 40.0, fTest); // Set query filter. ScSheetSourceDesc aDesc(*pDPObj->GetSheetDesc()); @@ -623,7 +623,7 @@ void Test::testPivotTableFilters() } fTest = m_pDoc->GetValue(aFormulaAddr); - CPPUNIT_ASSERT_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", fTest == 20.0); + ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect formula value that references a cell in the pivot table output.", 20.0, fTest); // Set the current page of 'Group2' back to '- all -'. The query filter // should still be in effect. @@ -646,8 +646,8 @@ void Test::testPivotTableFilters() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be any data pilot table stored with the document.", - pDPs->GetCount() == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any data pilot table stored with the document.", + size_t(0), pDPs->GetCount()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -699,8 +699,8 @@ void Test::testPivotTableNamedSource() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -729,7 +729,7 @@ void Test::testPivotTableNamedSource() m_pDoc->MoveTab(1, 0); OUString aTabName; m_pDoc->GetName(0, aTabName); - CPPUNIT_ASSERT_MESSAGE( "Wrong sheet name.", aTabName == "Table" ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong sheet name.", OUString("Table"), aTabName); CPPUNIT_ASSERT_MESSAGE("Pivot table output is on the wrong sheet!", pDPObj->GetOutRange().aStart.Tab() == 0); @@ -744,9 +744,9 @@ void Test::testPivotTableNamedSource() CPPUNIT_ASSERT_MESSAGE("Cache should exist.", pDPs->GetNameCaches().hasCache(aRangeName)); pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_MESSAGE("There should be no more tables.", pDPs->GetCount() == 0); - CPPUNIT_ASSERT_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetNameCaches().size() == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", + size_t(0), pDPs->GetNameCaches().size()); pNames->clear(); m_pDoc->DeleteTab(1); @@ -770,18 +770,18 @@ void Test::testPivotTableCache() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPCache aCache(m_pDoc); aCache.InitFromDoc(m_pDoc, aDataRange); long nDimCount = aCache.GetColumnCount(); - CPPUNIT_ASSERT_MESSAGE("wrong dimension count.", nDimCount == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension count.", 3L, nDimCount); OUString aDimName = aCache.GetDimensionName(0); - CPPUNIT_ASSERT_MESSAGE("wrong dimension name", aDimName == "F1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", OUString("F1"), aDimName); aDimName = aCache.GetDimensionName(1); - CPPUNIT_ASSERT_MESSAGE("wrong dimension name", aDimName == "F2"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", OUString("F2"), aDimName); aDimName = aCache.GetDimensionName(2); - CPPUNIT_ASSERT_MESSAGE("wrong dimension name", aDimName == "F3"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension name", OUString("F3"), aDimName); // In each dimension, member ID values also represent their sort order (in // source dimensions only, not in group dimensions). Value items are @@ -790,7 +790,7 @@ void Test::testPivotTableCache() // Dimension 0 - a mix of strings and values. long nMemCount = aCache.GetDimMemberCount(0); - CPPUNIT_ASSERT_MESSAGE("wrong dimension member count", nMemCount == 6); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", 6L, nMemCount); const ScDPItemData* pItem = aCache.GetItemDataById(0, 0); CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem && pItem->GetType() == ScDPItemData::Value && @@ -820,7 +820,7 @@ void Test::testPivotTableCache() // Dimension 1 - duplicate values in source. nMemCount = aCache.GetDimMemberCount(1); - CPPUNIT_ASSERT_MESSAGE("wrong dimension member count", nMemCount == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", 3L, nMemCount); pItem = aCache.GetItemDataById(1, 0); CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem && pItem->GetType() == ScDPItemData::String && @@ -838,7 +838,7 @@ void Test::testPivotTableCache() // Dimension 2 - values only. nMemCount = aCache.GetDimMemberCount(2); - CPPUNIT_ASSERT_MESSAGE("wrong dimension member count", nMemCount == 6); + CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong dimension member count", 6L, nMemCount); pItem = aCache.GetItemDataById(2, 0); CPPUNIT_ASSERT_MESSAGE("wrong item value", pItem && pItem->GetType() == ScDPItemData::Value && @@ -967,7 +967,7 @@ void Test::testPivotTableDuplicateDataFields() ScAddress aPos(2,2,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -977,7 +977,7 @@ void Test::testPivotTableDuplicateDataFields() CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount(), static_cast<size_t>(1)); + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1024,12 +1024,12 @@ void Test::testPivotTableDuplicateDataFields() ScPivotParam aParam; pDPObj->FillLabelData(aParam); CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly 4 labels (2 original, 1 data layout, and 1 duplicate dimensions).", - aParam.maLabelArray.size(), static_cast<size_t>(4)); + size_t(4), aParam.maLabelArray.size()); pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1060,7 +1060,7 @@ void Test::testPivotTableNormalGrouping() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -1070,7 +1070,7 @@ void Test::testPivotTableNormalGrouping() CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount(), static_cast<size_t>(1)); + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1106,7 +1106,7 @@ void Test::testPivotTableNormalGrouping() // Group A, B and C together. ScDPSaveGroupDimension aGroupDim(aBaseDimName, aGroupDimName); OUString aGroupName = aGroupDim.CreateGroupName(aGroupPrefix); - CPPUNIT_ASSERT_MESSAGE("Unexpected group name", aGroupName == "Group1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected group name", OUString("Group1"), aGroupName); ScDPSaveGroupItem aGroup(aGroupName); aGroup.AddElement("A"); @@ -1148,7 +1148,7 @@ void Test::testPivotTableNormalGrouping() ScDPSaveGroupDimension* pGroupDim = pDimData->GetGroupDimAccForBase(aBaseDimName); CPPUNIT_ASSERT_MESSAGE("There should be an existing group dimension.", pGroupDim); OUString aGroupName = pGroupDim->CreateGroupName(aGroupPrefix); - CPPUNIT_ASSERT_MESSAGE("Unexpected group name", aGroupName == "Group2"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected group name", OUString("Group2"), aGroupName); ScDPSaveGroupItem aGroup(aGroupName); aGroup.AddElement("D"); @@ -1178,9 +1178,9 @@ void Test::testPivotTableNormalGrouping() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1222,7 +1222,7 @@ void Test::testPivotTableNumberGrouping() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -1232,7 +1232,7 @@ void Test::testPivotTableNumberGrouping() CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount(), static_cast<size_t>(1)); + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScDPSaveData* pSaveData = pDPObj->GetSaveData(); @@ -1273,9 +1273,9 @@ void Test::testPivotTableNumberGrouping() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1307,7 +1307,7 @@ void Test::testPivotTableDateGrouping() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -1316,8 +1316,8 @@ void Test::testPivotTableDateGrouping() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScDPSaveData* pSaveData = pDPObj->GetSaveData(); @@ -1447,9 +1447,9 @@ void Test::testPivotTableDateGrouping() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1477,7 +1477,7 @@ void Test::testPivotTableEmptyRows() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); // Extend the range downward to include some trailing empty rows. aDataRange.aEnd.IncRow(2); @@ -1489,8 +1489,8 @@ void Test::testPivotTableEmptyRows() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1560,9 +1560,9 @@ void Test::testPivotTableEmptyRows() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1617,8 +1617,8 @@ void Test::testPivotTableTextNumber() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1664,9 +1664,9 @@ void Test::testPivotTableTextNumber() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1692,7 +1692,7 @@ void Test::testPivotTableCaseInsensitiveStrings() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -1701,8 +1701,8 @@ void Test::testPivotTableCaseInsensitiveStrings() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1720,9 +1720,9 @@ void Test::testPivotTableCaseInsensitiveStrings() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1793,7 +1793,7 @@ void Test::testPivotTableNumStability() CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount(), static_cast<size_t>(1)); + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1825,9 +1825,9 @@ void Test::testPivotTableNumStability() CPPUNIT_ASSERT_MESSAGE("Incorrect value for Sam.", rtl::math::approxEqual(fTest, fSamTotal)); pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -1855,7 +1855,7 @@ void Test::testPivotTableFieldReference() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -1864,8 +1864,8 @@ void Test::testPivotTableFieldReference() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -1993,9 +1993,9 @@ void Test::testPivotTableFieldReference() } pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -2025,7 +2025,7 @@ void Test::testPivotTableDocFunc() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = createDPFromRange( m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); @@ -2087,7 +2087,7 @@ void Test::testFuncGETPIVOTDATA() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = nullptr; @@ -2105,8 +2105,8 @@ void Test::testFuncGETPIVOTDATA() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -2222,9 +2222,9 @@ void Test::testFuncGETPIVOTDATA() pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -2246,7 +2246,7 @@ void Test::testFuncGETPIVOTDATALeafAccess() ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); - CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); + CPPUNIT_ASSERT_EQUAL_MESSAGE("failed to insert range data at correct position", aPos, aDataRange.aStart); ScDPObject* pDPObj = nullptr; @@ -2264,8 +2264,8 @@ void Test::testFuncGETPIVOTDATALeafAccess() bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); ScRange aOutRange = refresh(pDPObj); @@ -2315,9 +2315,9 @@ void Test::testFuncGETPIVOTDATALeafAccess() pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -2361,8 +2361,8 @@ void Test::testPivotTableRepeatItemLabels() ScDPCollection* pDPs = m_pDoc->GetDPCollection(); bool bSuccess = pDPs->InsertNewTable(pDPObj); CPPUNIT_ASSERT_MESSAGE("failed to insert a new datapilot object into document", bSuccess); - CPPUNIT_ASSERT_MESSAGE("there should be only one data pilot table.", - pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + size_t(1), pDPs->GetCount()); pDPObj->SetName(pDPs->CreateNewName()); bool bOverflow = false; @@ -2390,12 +2390,12 @@ void Test::testPivotTableRepeatItemLabels() CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess); } - CPPUNIT_ASSERT_MESSAGE("There should be only one data cache.", pDPs->GetSheetCaches().size() == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be only one data cache.", size_t(1), pDPs->GetSheetCaches().size()); pDPs->FreeTable(pDPObj); - CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", size_t(0), pDPs->GetCount()); CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", - pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + size_t(0), pDPs->GetSheetCaches().size()); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); |