[Libreoffice-commits] core.git: 2 commits - sc/qa
Aleksas Pantechovskis
alex.pantec at gmail.com
Sat Mar 5 20:52:40 UTC 2016
sc/qa/unit/ucalc.cxx | 22 +++++------
sc/qa/unit/ucalc_sharedformula.cxx | 70 ++++++++++++++++++-------------------
2 files changed, 46 insertions(+), 46 deletions(-)
New commits:
commit 4ccd0d99f00b11f1615a50f5eabaf261cc218c76
Author: Aleksas Pantechovskis <alex.pantec at gmail.com>
Date: Fri Mar 4 15:50:37 2016 +0200
tdf#98264, replace CPPUNIT_ASSERT with CPPUNIT_ASSERT_EQUAL
Change-Id: I682eba5e733fdd3f93781d48c0cfcb3452ba7da0
Reviewed-on: https://gerrit.libreoffice.org/22907
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index ba4d8dd..d543deb 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -43,7 +43,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
aPos.SetRow(8); // B9
m_pDoc->SetString(aPos, "=A9*2");
@@ -51,7 +51,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
aPos.SetRow(12); // B13
m_pDoc->SetString(aPos, "=A13*2");
@@ -65,7 +65,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Insert formulas to B15:B16.
aPos.SetRow(14); // B15
@@ -76,7 +76,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(14), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Insert a formula to B14, and B9:B16 should be shared.
aPos.SetRow(13); // B14
@@ -85,7 +85,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Insert an incompatible formula to B12, to split the shared range to B9:B11 and B13:B16.
aPos.SetRow(11); // B12
@@ -98,14 +98,14 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
aPos.SetRow(12); // B13
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("This cell is expected to be a shared formula cell.", pFC && pFC->IsShared());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Extend B13:B16 to B13:B20.
aPos.SetRow(16); // B17
@@ -121,19 +121,19 @@ void Test::testSharedFormulas()
// B13:B20 should be shared.
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Empty B19. This should split it into B13:B18, and B20 non-shared.
aPos.SetRow(18);
m_pDoc->SetEmptyCell(aPos);
- CPPUNIT_ASSERT_MESSAGE("This cell should have been emptied.", m_pDoc->GetCellType(aPos) == CELLTYPE_NONE);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This cell should have been emptied.", CELLTYPE_NONE, m_pDoc->GetCellType(aPos));
aPos.SetRow(12); // B13
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT(pFC);
// B13:B18 should be shared.
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(12), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(6), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// B20 shold be non-shared.
aPos.SetRow(19); // B20
pFC = m_pDoc->GetFormulaCell(aPos);
@@ -154,7 +154,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT(pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(14), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Set numeric value to B15, to make B16:B18 shared.
aPos.SetRow(14);
@@ -165,12 +165,12 @@ void Test::testSharedFormulas()
// B16:B18 should be shared.
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(3), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Set string value to B16 to make B17:B18 shared.
aPos.SetRow(15);
ScCellValue aCell(svl::SharedString("Test"));
- CPPUNIT_ASSERT_MESSAGE("This should be a string value.", aCell.meType == CELLTYPE_STRING);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This should be a string value.", CELLTYPE_STRING, aCell.meType);
aCell.commit(*m_pDoc, aPos);
CPPUNIT_ASSERT_EQUAL(aCell.mpString->getString(), m_pDoc->GetString(aPos));
aPos.SetRow(16);
@@ -179,7 +179,7 @@ void Test::testSharedFormulas()
// B17:B18 should be shared.
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(16), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Set edit text to B17. Now B18 should be non-shared.
ScFieldEditEngine& rEditEngine = m_pDoc->GetEditEngine();
@@ -218,7 +218,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("B10 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Delete A4:B8. This should split the grouping to B2:B3 and B9:B10.
clearRange(m_pDoc, ScRange(0,3,0,1,7,0));
@@ -227,14 +227,14 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("B2 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
aPos.SetRow(8);
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("B9 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Delete rows 4:8 and shift row 9 and below up to row 4. This should
// re-merge the two into a group of B2:B5.
@@ -244,7 +244,7 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("B2 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Insert 2 rows at row 4, to split it into B2:B3 and B6:B7.
m_pDoc->InsertRow(ScRange(0,3,0,MAXCOL,4,0));
@@ -252,14 +252,14 @@ void Test::testSharedFormulas()
CPPUNIT_ASSERT_MESSAGE("B2 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
aPos.SetRow(5);
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("B6 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
m_pDoc->DeleteTab(0);
}
@@ -657,12 +657,12 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
// This check makes only sense if group listeners are activated.
#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
- CPPUNIT_ASSERT_MESSAGE("There should only be 2 area listeners.", aListeners.size() == 2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("There should only be 2 area listeners.", size_t(2), aListeners.size());
// First one should be group-listening on A1:B2.
- CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This listener should be listening on A1:B2.", ScRange(0,0,0,1,1,0), aListeners[0].maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
// Second one should be group-listening on A4:B5.
- CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This listener should be listening on A1:B2.", ScRange(0,0,0,1,1,0), aListeners[0].maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
#endif
@@ -693,8 +693,8 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// We should only have one listener group-listening on A1:B4.
aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside);
- CPPUNIT_ASSERT_MESSAGE("There should only be 1 area listener.", aListeners.size() == 1);
- CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B4.", aListeners[0].maArea == ScRange(0,0,0,1,3,0));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("There should only be 1 area listener.", size_t(1), aListeners.size());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This listener should be listening on A1:B4.", ScRange(0,0,0,1,3,0), aListeners[0].maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
#endif
@@ -723,12 +723,12 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
// This check makes only sense if group listeners are activated.
#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
- CPPUNIT_ASSERT_MESSAGE("There should only be 2 area listeners.", aListeners.size() == 2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("There should only be 2 area listeners.", size_t(2), aListeners.size());
// First one should be group-listening on A1:B2.
- CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This listener should be listening on A1:B2.", ScRange(0,0,0,1,1,0), aListeners[0].maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
// Second one should be group-listening on A4:B5.
- CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("This listener should be listening on A1:B2.", ScRange(0,0,0,1,1,0), aListeners[0].maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
#endif
@@ -1058,7 +1058,7 @@ void Test::testSharedFormulasDeleteColumns()
const ScTokenArray* pCode = pFC->GetCode();
CPPUNIT_ASSERT(pCode && pCode->GetLen() == 1);
const FormulaToken* pToken = pCode->GetArray()[0];
- CPPUNIT_ASSERT(pToken->GetType() == svSingleRef);
+ CPPUNIT_ASSERT_EQUAL(svSingleRef, static_cast<StackVarEnum>(pToken->GetType()));
const ScSingleRefData* pSRef = pToken->GetSingleRef();
CPPUNIT_ASSERT(pSRef->IsColDeleted());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pSRef->toAbs(ScAddress(1,0,0)).Row());
@@ -1314,7 +1314,7 @@ void Test::testSharedFormulasCopyPaste()
CPPUNIT_ASSERT_MESSAGE("B9 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Copy formulas in B6:B9 to the clipboard doc.
ScRange aSrcRange(1,5,0,1,8,0); // B6:B9
@@ -1324,7 +1324,7 @@ void Test::testSharedFormulasCopyPaste()
CPPUNIT_ASSERT_MESSAGE("B9 in the clip doc should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(5), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Paste them to C2:C10.
ScRange aDestRange(2,1,0,2,9,0);
@@ -1335,7 +1335,7 @@ void Test::testSharedFormulasCopyPaste()
CPPUNIT_ASSERT_MESSAGE("C2 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(9), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
ScRange aRange(1,0,0,1,9,0); // B1:B10
ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
@@ -1352,7 +1352,7 @@ void Test::testSharedFormulasCopyPaste()
CPPUNIT_ASSERT_MESSAGE("Must be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
}
// Overwrite B1:B10.
@@ -1360,7 +1360,7 @@ void Test::testSharedFormulasCopyPaste()
m_pDoc->SetValue(ScAddress(1,i,0), i*10);
for (SCROW i = 0; i <= 9; ++i)
- CPPUNIT_ASSERT_MESSAGE("Numeric cell was expected.", m_pDoc->GetCellType(ScAddress(1,i,0)) == CELLTYPE_VALUE);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Numeric cell was expected.", CELLTYPE_VALUE, m_pDoc->GetCellType(ScAddress(1,i,0)));
// Undo the action to fill B1:B10 with formula cells again.
pUndo->Undo();
@@ -1373,7 +1373,7 @@ void Test::testSharedFormulasCopyPaste()
CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
- CPPUNIT_ASSERT_MESSAGE("The token is expected to be shared.", pFC->GetCode() == pFC->GetSharedCode());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
}
m_pDoc->DeleteTab(0);
commit 907e76271161c241fd8abe99773258e641687e79
Author: Aleksas Pantechovskis <alex.pantec at gmail.com>
Date: Fri Mar 4 15:21:01 2016 +0200
tdf#98264, use DOUBLE_ASSERT_EQUAL for double comparison
Change-Id: I590dcf408163e2470ee387f0394f6daa1145da49
Reviewed-on: https://gerrit.libreoffice.org/22906
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 00a2108..3718131 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3822,8 +3822,8 @@ void Test::testMoveRefBetweenSheets()
CPPUNIT_ASSERT(bMoved);
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)));
+ ASSERT_DOUBLES_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,1,1)));
+ ASSERT_DOUBLES_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0,2,1)));
// The reference in the pasted formula should display sheet name after the move.
if (!checkFormula(*m_pDoc, ScAddress(0,1,1), "Test1.A1"))
@@ -3860,9 +3860,9 @@ void Test::testUndoCut()
ScDocument* pUndoDoc = new ScDocument(SCDOCMODE_UNDO);
pUndoDoc->InitUndo(m_pDoc, 0 ,0);
m_pDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, pUndoDoc);
- CPPUNIT_ASSERT_EQUAL( 1.0, pUndoDoc->GetValue(ScAddress(0,0,0)));
- CPPUNIT_ASSERT_EQUAL( 10.0, pUndoDoc->GetValue(ScAddress(0,1,0)));
- CPPUNIT_ASSERT_EQUAL(100.0, pUndoDoc->GetValue(ScAddress(0,2,0)));
+ ASSERT_DOUBLES_EQUAL( 1.0, pUndoDoc->GetValue(ScAddress(0,0,0)));
+ ASSERT_DOUBLES_EQUAL( 10.0, pUndoDoc->GetValue(ScAddress(0,1,0)));
+ ASSERT_DOUBLES_EQUAL(100.0, pUndoDoc->GetValue(ScAddress(0,2,0)));
ScUndoCut aUndo(&getDocShell(), aRange, aRange.aEnd, aMark, pUndoDoc);
// "Cut" the selection.
@@ -3871,18 +3871,18 @@ void Test::testUndoCut()
// Undo it, and check the result.
aUndo.Undo();
- CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,0,0)));
- CPPUNIT_ASSERT_EQUAL( 10.0, m_pDoc->GetValue(ScAddress(0,1,0)));
- CPPUNIT_ASSERT_EQUAL(100.0, m_pDoc->GetValue(ScAddress(0,2,0)));
- CPPUNIT_ASSERT_EQUAL(111.0, m_pDoc->GetValue(0,3,0)); // The SUM value should be back to the original.
+ ASSERT_DOUBLES_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,0,0)));
+ ASSERT_DOUBLES_EQUAL( 10.0, m_pDoc->GetValue(ScAddress(0,1,0)));
+ ASSERT_DOUBLES_EQUAL(100.0, m_pDoc->GetValue(ScAddress(0,2,0)));
+ ASSERT_DOUBLES_EQUAL(111.0, m_pDoc->GetValue(0,3,0)); // The SUM value should be back to the original.
// Redo it and check.
aUndo.Redo();
- CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(0,3,0));
+ ASSERT_DOUBLES_EQUAL(0.0, m_pDoc->GetValue(0,3,0));
// Undo again.
aUndo.Undo();
- CPPUNIT_ASSERT_EQUAL(111.0, m_pDoc->GetValue(0,3,0));
+ ASSERT_DOUBLES_EQUAL(111.0, m_pDoc->GetValue(0,3,0));
m_pDoc->DeleteTab(0);
}
More information about the Libreoffice-commits
mailing list