sc/qa/unit/ucalc_copypaste.cxx | 4234 ++++++++++++++++------------------------- 1 file changed, 1688 insertions(+), 2546 deletions(-)
New commits: commit f93f6c8452fd94e58f1ddec65e18f34d5a20726a Author: scito <i...@scito.ch> AuthorDate: Sun Jun 13 14:32:53 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jun 15 09:40:04 2021 +0200 ucalc_copypaste: improve readability and shorten The tests are written in a simpler and shorter way. (The same, but 858 lines less.) I've transformed the code with several regex in VSCode. I've made a manual clean up at the end. The regex are listed below in the form *** search regex replace regex *** aString = m_pDoc->GetString\((\d+,\s*\d+,\s*\w+)\); \s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), aString\); CPPUNIT_ASSERT_EQUAL(OUString("$2"), m_pDoc->GetString($1)); *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\); \s*CPPUNIT_ASSERT_EQUAL\(OUString\("(.*)"\), \w+\); CPPUNIT_ASSERT_EQUAL(OUString("$2"), getFormula($1)); *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\); \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$2", OUString("$3"), getFormula($1)); *** ScAddress \w+\((\d+, \d+, \d+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); setNote($1, "$3");$2 *** ScAddress (\w+)\((\d+, \d+, \d+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); ScAddress $1 = setNote($2, "$4");$3 *** ScAddress (\w+)\((\d+, \d+, \w+)\);(\s*//.+)? \s*ScPostIt\* \w+ = m_pDoc->GetOrCreateNote\(\w+\); \s*\w+->SetText\(\w+, "(.*)"\); setNote($2, "$4");$3 *** m_pDoc->GetNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\) m_pDoc->GetNote($1) *** "There should be(\s+\w+) note on (\w+) "$2:$1 note *** HasNote\(ScAddress\((\d+, \d+, (\d+|\w+))\)\) HasNote($1) *** ASSERT_DOUBLES_EQUAL\((-?\d+), CPPUNIT_ASSERT_EQUAL($1.0, *** \w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\); \s*CPPUNIT_ASSERT_EQUAL\(EMPTY_OUSTRING, \w+\); CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString()); *** \w+ = m_pDoc->GetString\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", EMPTY_OUSTRING, \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", EMPTY_OUSTRING, m_pDoc->GetString($2));$3 *** fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*ASSERT_DOUBLES_EQUAL_MESSAGE\("(.*)", (-?\d+), fValue\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$4", $5.0, m_pDoc->GetValue($1)); *** fValue = m_pDoc->GetValue\((\d+, \d+, (\d+|\w+))\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL\((-?\d+(\.0)?), fValue\); CPPUNIT_ASSERT_EQUAL($4, m_pDoc->GetValue($1));$3 *** m_pDoc->GetFormula\((\d+, \d+, \w+), \w+\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.+)", OUString\("(.+)"\), \w+\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), getFormula($1)); *** aStr = m_pDoc->GetString\((\d+, \d+, \w+)\);(\s*//.*)? \s*CPPUNIT_ASSERT_EQUAL_MESSAGE\("(.*)", OUString\("(.*)"\), aStr\); CPPUNIT_ASSERT_EQUAL_MESSAGE("$3", OUString("$4"), m_pDoc->GetString($1)); *** m_pDoc->GetNote\((\d+, \d+, (\d+|\w+))\)->GetText\(\) getNote($1) *** Change-Id: I4000b7f89a0bee1d2d52abfd6c1b055470e39d02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117174 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 6e2d37759511..fea5efb9b7a7 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -323,6 +323,8 @@ private: OUString getFormula(SCCOL nCol, SCROW nRow, SCTAB nTab); OUString getRangeByName(const OUString& aRangeName); + ScAddress setNote(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString noteText); + OUString getNote(SCCOL nCol, SCROW nRow, SCTAB nTab); }; TestCopyPaste::TestCopyPaste() {} @@ -381,6 +383,21 @@ OUString TestCopyPaste::getRangeByName(const OUString& aRangeName) return ::getRangeByName(m_pDoc, aRangeName); } +ScAddress TestCopyPaste::setNote(SCCOL nCol, SCROW nRow, SCTAB nTab, OUString noteText) +{ + ScAddress aAdr(nCol, nRow, nTab); + ScPostIt* pNote = m_pDoc->GetOrCreateNote(aAdr); + pNote->SetText(aAdr, noteText); + return aAdr; +} + +OUString TestCopyPaste::getNote(SCCOL nCol, SCROW nRow, SCTAB nTab) +{ + ScPostIt* pNote = m_pDoc->GetNote(nCol, nRow, nTab); + CPPUNIT_ASSERT_MESSAGE("Note expected", pNote); + return pNote->GetText(); +} + // Cannot be moved to qahelper since ScDocument::CopyToDocument() is not SC_DLLPUBLIC /** Executes the same steps for undo as ScViewFunc::PasteFromClip(). */ void TestCopyPaste::prepareUndoBeforePaste(bool bCut, ScDocumentUniquePtr& pPasteUndoDoc, @@ -508,15 +525,9 @@ void TestCopyPaste::testCopyPaste() ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 11", fValue, 11); // add notes to A1:C1 - ScAddress aAdrA1(0, 0, 0); // empty cell content - ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1); - pNoteA1->SetText(aAdrA1, "Hello world in A1"); - ScAddress aAdrB1(1, 0, 0); // formula cell content - ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1); - pNoteB1->SetText(aAdrB1, "Hello world in B1"); - ScAddress aAdrC1(2, 0, 0); // string cell content - ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1); - pNoteC1->SetText(aAdrC1, "Hello world in C1"); + setNote(0, 0, 0, "Hello world in A1"); // empty cell content + setNote(1, 0, 0, "Hello world in B1"); // formula cell content + setNote(2, 0, 0, "Hello world in C1"); // string cell content //copy Sheet1.A1:C1 to Sheet2.A2:C2 ScRange aRange(0, 0, 0, 2, 0, 0); @@ -582,24 +593,18 @@ void TestCopyPaste::testCopyPaste() aRangeLocal5); // check notes after copying - 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("There should be a note on Sheet2.A2", m_pDoc->HasNote(0, 1, 1)); + CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.B2", m_pDoc->HasNote(1, 1, 1)); + CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.C2", m_pDoc->HasNote(2, 1, 1)); 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()); + m_pDoc->GetNote(0, 0, 0)->GetText(), m_pDoc->GetNote(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()); + m_pDoc->GetNote(1, 0, 0)->GetText(), m_pDoc->GetNote(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()); + m_pDoc->GetNote(2, 0, 0)->GetText(), m_pDoc->GetNote(2, 1, 1)->GetText()); //check undo and redo pUndo->Undo(); @@ -607,12 +612,9 @@ void TestCopyPaste::testCopyPaste() ASSERT_DOUBLES_EQUAL_MESSAGE("after undo formula should return nothing", fValue, 0); aString = m_pDoc->GetString(2, 1, 1); CPPUNIT_ASSERT_MESSAGE("after undo, string should be removed", aString.isEmpty()); - CPPUNIT_ASSERT_MESSAGE("after undo, note on A2 should be removed", - !m_pDoc->HasNote(ScAddress(0, 1, 1))); - CPPUNIT_ASSERT_MESSAGE("after undo, note on B2 should be removed", - !m_pDoc->HasNote(ScAddress(1, 1, 1))); - CPPUNIT_ASSERT_MESSAGE("after undo, note on C2 should be removed", - !m_pDoc->HasNote(ScAddress(2, 1, 1))); + CPPUNIT_ASSERT_MESSAGE("after undo, note on A2 should be removed", !m_pDoc->HasNote(0, 1, 1)); + CPPUNIT_ASSERT_MESSAGE("after undo, note on B2 should be removed", !m_pDoc->HasNote(1, 1, 1)); + CPPUNIT_ASSERT_MESSAGE("after undo, note on C2 should be removed", !m_pDoc->HasNote(2, 1, 1)); pUndo->Redo(); fValue = m_pDoc->GetValue(ScAddress(1, 1, 1)); @@ -623,20 +625,17 @@ void TestCopyPaste::testCopyPaste() CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula should be correct again", aFormulaString, aString); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.A2", - m_pDoc->HasNote(ScAddress(0, 1, 1))); + m_pDoc->HasNote(0, 1, 1)); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.B2", - m_pDoc->HasNote(ScAddress(1, 1, 1))); + m_pDoc->HasNote(1, 1, 1)); CPPUNIT_ASSERT_MESSAGE("After Redo, there should be a note on Sheet2.C2", - m_pDoc->HasNote(ScAddress(2, 1, 1))); + m_pDoc->HasNote(2, 1, 1)); 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()); + getNote(0, 0, 0), getNote(0, 1, 1)); 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()); + getNote(1, 0, 0), getNote(1, 1, 1)); 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()); + getNote(2, 0, 0), getNote(2, 1, 1)); // Copy Sheet1.A11:A13 to Sheet1.A7:A9, both within global2 range. aRange = ScRange(0, 10, 0, 0, 12, 0); @@ -709,15 +708,9 @@ void TestCopyPaste::testCopyPasteTranspose() m_pDoc->SetString(2, 0, 0, "test"); // add notes to A1:C1 - ScAddress aAdrA1(0, 0, 0); // numerical cell content - ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1); - pNoteA1->SetText(aAdrA1, "Hello world in A1"); - ScAddress aAdrB1(1, 0, 0); // formula cell content - ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1); - pNoteB1->SetText(aAdrB1, "Hello world in B1"); - ScAddress aAdrC1(2, 0, 0); // string cell content - ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1); - pNoteC1->SetText(aAdrC1, "Hello world in C1"); + setNote(0, 0, 0, "Hello world in A1"); // numerical cell content + setNote(1, 0, 0, "Hello world in B1"); // formula cell content + setNote(2, 0, 0, "Hello world in C1"); // string cell content // transpose clipboard, paste and check on Sheet2 m_pDoc->InsertTab(1, "Sheet2"); @@ -747,21 +740,15 @@ void TestCopyPaste::testCopyPasteTranspose() 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_EQUAL_MESSAGE("Content of cell note on Sheet2.D2", - m_pDoc->GetNote(ScAddress(0, 0, 0))->GetText(), - m_pDoc->GetNote(ScAddress(3, 1, 1))->GetText()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D3", - m_pDoc->GetNote(ScAddress(1, 0, 0))->GetText(), - m_pDoc->GetNote(ScAddress(3, 2, 1))->GetText()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D4", - m_pDoc->GetNote(ScAddress(2, 0, 0))->GetText(), - m_pDoc->GetNote(ScAddress(3, 3, 1))->GetText()); + CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D2", m_pDoc->HasNote(3, 1, 1)); + CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D3", m_pDoc->HasNote(3, 2, 1)); + CPPUNIT_ASSERT_MESSAGE("There should be a note on Sheet2.D4", m_pDoc->HasNote(3, 3, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D2", getNote(0, 0, 0), + getNote(3, 1, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D3", getNote(1, 0, 0), + getNote(3, 2, 1)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Content of cell note on Sheet2.D4", getNote(2, 0, 0), + getNote(3, 3, 1)); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -956,18 +943,15 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkTranspose() true, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$2"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$2"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(2.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); @@ -975,8 +959,7 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(4, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(4, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell E2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E2", OUString("=$Sheet1.$A$4"), getFormula(4, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1050,12 +1033,10 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkFilteredTranspose() true, false, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); @@ -1063,8 +1044,7 @@ void TestCopyPaste::testCopyPasteSpecialAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D2", OUString("=$Sheet1.$A$4"), getFormula(3, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1113,18 +1093,15 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B3.", pFC); - m_pDoc->GetFormula(1, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B3", OUString("=$Sheet1.$B$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B3", OUString("=$Sheet1.$B$1"), getFormula(1, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(2.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 3, destSheet)); @@ -1132,20 +1109,17 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(1, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(1, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B5", OUString("=$Sheet1.$D$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B5", OUString("=$Sheet1.$D$1"), getFormula(1, 4, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C2.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$3"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(11.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C3.", pFC); - m_pDoc->GetFormula(2, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C3", OUString("=$Sheet1.$B$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C3", OUString("=$Sheet1.$B$3"), getFormula(2, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(12.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 3, destSheet)); @@ -1153,8 +1127,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(2, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(2, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C5", OUString("=$Sheet1.$D$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C5", OUString("=$Sheet1.$D$3"), getFormula(2, 4, destSheet)); CPPUNIT_ASSERT_EQUAL(14.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1244,18 +1217,15 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() pTransClip.reset(); printRange(m_pDoc, aDestRange, "Transposed dest sheet"); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B3.", pFC); - m_pDoc->GetFormula(1, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B3", OUString("=$Sheet1.$B$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B3", OUString("=$Sheet1.$B$1"), getFormula(1, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(2.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 3, destSheet)); @@ -1263,20 +1233,17 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(1, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(1, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B5", OUString("=$Sheet1.$D$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B5", OUString("=$Sheet1.$D$1"), getFormula(1, 4, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C2.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$3"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(11.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C3.", pFC); - m_pDoc->GetFormula(2, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C3", OUString("=$Sheet1.$B$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C3", OUString("=$Sheet1.$B$3"), getFormula(2, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(12.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 3, destSheet)); @@ -1284,20 +1251,17 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(2, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(2, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C5", OUString("=$Sheet1.$D$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C5", OUString("=$Sheet1.$D$3"), getFormula(2, 4, destSheet)); CPPUNIT_ASSERT_EQUAL(14.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell D2.", pFC); - m_pDoc->GetFormula(3, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D2", OUString("=$Sheet1.$A$6"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D2", OUString("=$Sheet1.$A$6"), getFormula(3, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(111.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell D3.", pFC); - m_pDoc->GetFormula(3, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D3", OUString("=$Sheet1.$B$6"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D3", OUString("=$Sheet1.$B$6"), getFormula(3, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(112.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 3, destSheet)); @@ -1305,8 +1269,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeRowAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(3, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D5", OUString("=$Sheet1.$D$6"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D5", OUString("=$Sheet1.$D$6"), getFormula(3, 4, destSheet)); CPPUNIT_ASSERT_EQUAL(114.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1355,18 +1318,15 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose() pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C2.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$2"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$2"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(2.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); @@ -1374,20 +1334,17 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(4, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(4, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell E2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E2", OUString("=$Sheet1.$A$4"), getFormula(4, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B3.", pFC); - m_pDoc->GetFormula(1, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B3", OUString("=$Sheet1.$C$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B3", OUString("=$Sheet1.$C$1"), getFormula(1, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(11.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell C3.", pFC); - m_pDoc->GetFormula(2, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C3", OUString("=$Sheet1.$C$2"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C3", OUString("=$Sheet1.$C$2"), getFormula(2, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(12.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 2, destSheet)); @@ -1395,8 +1352,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(4, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(4, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell E3", OUString("=$Sheet1.$C$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E3", OUString("=$Sheet1.$C$4"), getFormula(4, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(14.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1469,12 +1425,10 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkFilteredTranspose() pTransClip.get(), true, false /* false fixes tdf#141683 */, false, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); @@ -1482,14 +1436,12 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D2", OUString("=$Sheet1.$A$4"), getFormula(3, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(1, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B3.", pFC); - m_pDoc->GetFormula(1, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B3", OUString("=$Sheet1.$C$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B3", OUString("=$Sheet1.$C$1"), getFormula(1, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(11.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 2, destSheet)); @@ -1497,8 +1449,7 @@ void TestCopyPaste::testCopyPasteSpecialMultiRangeColAsLinkFilteredTranspose() pFC = m_pDoc->GetFormulaCell(ScAddress(3, 2, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D3", OUString("=$Sheet1.$C$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D3", OUString("=$Sheet1.$C$4"), getFormula(3, 2, destSheet)); CPPUNIT_ASSERT_EQUAL(14.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1535,30 +1486,25 @@ void TestCopyPaste::testCopyPasteSpecialAllAsLinkTranspose() false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$2"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$2"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(2.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D2", OUString("=$Sheet1.$A$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D2", OUString("=$Sheet1.$A$3"), getFormula(3, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(0.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(4, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(4, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell E2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E2", OUString("=$Sheet1.$A$4"), getFormula(4, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1632,24 +1578,20 @@ void TestCopyPaste::testCopyPasteSpecialAllAsLinkFilteredTranspose() false, false); pTransClip.reset(); - OUString aString; // Check pasted content to make sure they reference the correct cells. ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell B2.", pFC); - m_pDoc->GetFormula(1, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell B2", OUString("=$Sheet1.$A$1"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B2", OUString("=$Sheet1.$A$1"), getFormula(1, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(1.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(2, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(2, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell C2", OUString("=$Sheet1.$A$3"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C2", OUString("=$Sheet1.$A$3"), getFormula(2, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(0.0, pFC->GetValue()); pFC = m_pDoc->GetFormulaCell(ScAddress(3, 1, destSheet)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - m_pDoc->GetFormula(3, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula cell D2", OUString("=$Sheet1.$A$4"), aString); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D2", OUString("=$Sheet1.$A$4"), getFormula(3, 1, destSheet)); CPPUNIT_ASSERT_EQUAL(4.0, pFC->GetValue()); m_pDoc->DeleteTab(destSheet); @@ -1939,75 +1881,39 @@ void TestCopyPaste::executeCopyPasteSpecial(const SCTAB srcSheet, const SCTAB de // add notes to B3:F4 // add notes row 2 - ScAddress aAdrB3(1, 2, srcSheet); - ScPostIt* pNoteB3 = m_pDoc->GetOrCreateNote(aAdrB3); - pNoteB3->SetText(aAdrB3, "Note A1"); - ScAddress aAdrC3(2, 2, srcSheet); - ScPostIt* pNoteC3 = m_pDoc->GetOrCreateNote(aAdrC3); - pNoteC3->SetText(aAdrC3, "Note B1"); + setNote(1, 2, srcSheet, "Note A1"); + setNote(2, 2, srcSheet, "Note B1"); // No note on D3 - ScAddress aAdrE3(4, 2, srcSheet); - ScPostIt* pNoteE3 = m_pDoc->GetOrCreateNote(aAdrE3); - pNoteE3->SetText(aAdrE3, "Note D1"); + setNote(4, 2, srcSheet, "Note D1"); // No note on F3 // No note on G3 // add notes row 3 - ScAddress aAdrB4(1, 3, srcSheet); - ScPostIt* pNoteB4 = m_pDoc->GetOrCreateNote(aAdrB4); - pNoteB4->SetText(aAdrB4, "Note A2"); + setNote(1, 3, srcSheet, "Note A2"); // No note on C4 - ScAddress aAdrD4(3, 3, srcSheet); - ScPostIt* pNoteD4 = m_pDoc->GetOrCreateNote(aAdrD4); - pNoteD4->SetText(aAdrD4, "Note C2"); - ScAddress aAdrE4(4, 3, srcSheet); - ScPostIt* pNoteE4 = m_pDoc->GetOrCreateNote(aAdrE4); - pNoteE4->SetText(aAdrE4, "Note D2"); - ScAddress aAdrF4(5, 4, srcSheet); - ScPostIt* pNoteF4 = m_pDoc->GetOrCreateNote(aAdrF4); - pNoteF4->SetText(aAdrF4, "Note E2"); - ScAddress aAdrG4(6, 3, srcSheet); - ScPostIt* pNoteG4 = m_pDoc->GetOrCreateNote(aAdrG4); - pNoteG4->SetText(aAdrG4, "Note F2"); + setNote(3, 3, srcSheet, "Note C2"); + setNote(4, 3, srcSheet, "Note D2"); + setNote(5, 4, srcSheet, "Note E2"); + setNote(6, 3, srcSheet, "Note F2"); // add notes row 4 - ScAddress aAdrB5(1, 4, srcSheet); - ScPostIt* pNoteB5 = m_pDoc->GetOrCreateNote(aAdrB5); - pNoteB5->SetText(aAdrB5, "Note A3"); - ScAddress aAdrC5(2, 4, srcSheet); - ScPostIt* pNoteC5 = m_pDoc->GetOrCreateNote(aAdrC5); - pNoteC5->SetText(aAdrC5, "Note B3"); - ScAddress aAdrD5(3, 4, srcSheet); - ScPostIt* pNoteD5 = m_pDoc->GetOrCreateNote(aAdrD5); - pNoteD5->SetText(aAdrD5, "Note C3"); - ScAddress aAdrE5(4, 4, srcSheet); - ScPostIt* pNoteE5 = m_pDoc->GetOrCreateNote(aAdrE5); - pNoteE5->SetText(aAdrE5, "Note D3"); + setNote(1, 4, srcSheet, "Note A3"); + setNote(2, 4, srcSheet, "Note B3"); + setNote(3, 4, srcSheet, "Note C3"); + setNote(4, 4, srcSheet, "Note D3"); // No note on F5 // No note on G5 // add notes row 5 // No note on B6 - ScAddress aAdrC6(2, 5, srcSheet); - ScPostIt* pNoteC6 = m_pDoc->GetOrCreateNote(aAdrC6); - pNoteC6->SetText(aAdrC6, "Note B4"); - ScAddress aAdrD6(3, 5, srcSheet); - ScPostIt* pNoteD6 = m_pDoc->GetOrCreateNote(aAdrD6); - pNoteD6->SetText(aAdrD6, "Note C4"); - ScAddress aAdrE6(4, 5, srcSheet); - ScPostIt* pNoteE6 = m_pDoc->GetOrCreateNote(aAdrE6); - pNoteE6->SetText(aAdrE6, "Note D4"); - ScAddress aAdrF6(5, 5, srcSheet); - ScPostIt* pNoteF6 = m_pDoc->GetOrCreateNote(aAdrF6); - pNoteF6->SetText(aAdrF6, "Note E4"); - ScAddress aAdrG6(6, 5, srcSheet); - ScPostIt* pNoteG6 = m_pDoc->GetOrCreateNote(aAdrG6); - pNoteG6->SetText(aAdrG6, "Note F4"); + setNote(2, 5, srcSheet, "Note B4"); + setNote(3, 5, srcSheet, "Note C4"); + setNote(4, 5, srcSheet, "Note D4"); + setNote(5, 5, srcSheet, "Note E4"); + setNote(6, 5, srcSheet, "Note F4"); // row 6 for multi range row selection - ScAddress aAdrD7(3, 6, srcSheet); - ScPostIt* pNoteD7 = m_pDoc->GetOrCreateNote(aAdrD7); - pNoteD7->SetText(aAdrD7, "Note C5"); + setNote(3, 6, srcSheet, "Note C5"); // Recalc if needed if (bMultiRangeSelection && bTranspose && eDirection == ScClipParam::Row @@ -2675,36 +2581,26 @@ void TestCopyPaste::testCutPasteSpecialSkipEmptyTranspose() // check initial source void TestCopyPaste::checkCopyPasteSpecialInitial(const SCTAB srcSheet) { - OUString aString; - double fValue; const EditTextObject* pEditObj; // col 1 - ASSERT_DOUBLES_EQUAL(1, m_pDoc->GetValue(1, 2, srcSheet)); - ASSERT_DOUBLES_EQUAL(2, m_pDoc->GetValue(1, 3, srcSheet)); - ASSERT_DOUBLES_EQUAL(3, m_pDoc->GetValue(1, 4, srcSheet)); - ASSERT_DOUBLES_EQUAL(4, m_pDoc->GetValue(1, 5, srcSheet)); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(1, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(1, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(1, 5, srcSheet)); // col 2, formulas - ASSERT_DOUBLES_EQUAL(11, m_pDoc->GetValue(2, 2, srcSheet)); - m_pDoc->GetFormula(2, 2, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=B3+10"), aString); - m_pDoc->GetFormula(2, 3, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=B4+20"), aString); - ASSERT_DOUBLES_EQUAL(22, m_pDoc->GetValue(2, 3, srcSheet)); - ASSERT_DOUBLES_EQUAL(35, m_pDoc->GetValue(2, 4, srcSheet)); - m_pDoc->GetFormula(2, 4, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=E5+30"), aString); - ASSERT_DOUBLES_EQUAL(42, m_pDoc->GetValue(2, 5, srcSheet)); - m_pDoc->GetFormula(2, 5, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=B4+40"), aString); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(2, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=B3+10"), getFormula(2, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=B4+20"), getFormula(2, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(2, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(35.0, m_pDoc->GetValue(2, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=E5+30"), getFormula(2, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(42.0, m_pDoc->GetValue(2, 5, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=B4+40"), getFormula(2, 5, srcSheet)); // col 3, strings - aString = m_pDoc->GetString(3, 2, srcSheet); - CPPUNIT_ASSERT_EQUAL(OUString("a"), aString); - aString = m_pDoc->GetString(3, 3, srcSheet); - CPPUNIT_ASSERT_EQUAL(OUString("b"), aString); - aString = m_pDoc->GetString(3, 4, srcSheet); - CPPUNIT_ASSERT_EQUAL(OUString("c"), aString); - aString = m_pDoc->GetString(3, 5, srcSheet); - CPPUNIT_ASSERT_EQUAL(OUString("d"), aString); + CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(3, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("b"), m_pDoc->GetString(3, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("c"), m_pDoc->GetString(3, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("d"), m_pDoc->GetString(3, 5, srcSheet)); // col 4, rich text pEditObj = m_pDoc->GetEditText(ScAddress(4, 2, srcSheet)); CPPUNIT_ASSERT(pEditObj); @@ -2712,34 +2608,24 @@ void TestCopyPaste::checkCopyPasteSpecialInitial(const SCTAB srcSheet) pEditObj = m_pDoc->GetEditText(ScAddress(4, 3, srcSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R2"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(5, m_pDoc->GetValue(4, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(4, 4, srcSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(4, 5, srcSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R4"), pEditObj->GetText(0)); // col 5, formulas - m_pDoc->GetFormula(5, 2, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=B3+B5+60"), aString); - ASSERT_DOUBLES_EQUAL(64, m_pDoc->GetValue(5, 2, srcSheet)); - aString = m_pDoc->GetString(5, 3, srcSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - aString = m_pDoc->GetString(5, 4, srcSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - fValue = m_pDoc->GetValue(5, 5, srcSheet); - m_pDoc->GetFormula(5, 5, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=B3+B5+70"), aString); - ASSERT_DOUBLES_EQUAL(74, fValue); + CPPUNIT_ASSERT_EQUAL(OUString("=B3+B5+60"), getFormula(5, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(64.0, m_pDoc->GetValue(5, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(5, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(5, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=B3+B5+70"), getFormula(5, 5, srcSheet)); + CPPUNIT_ASSERT_EQUAL(74.0, m_pDoc->GetValue(5, 5, srcSheet)); // col 6, formulas - m_pDoc->GetFormula(6, 2, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(B3:B6;\"<4\")"), aString); - ASSERT_DOUBLES_EQUAL(6, m_pDoc->GetValue(6, 2, srcSheet)); - aString = m_pDoc->GetString(6, 3, srcSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - aString = m_pDoc->GetString(6, 4, srcSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - fValue = m_pDoc->GetValue(6, 5, srcSheet); - m_pDoc->GetFormula(6, 5, srcSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=C$3+$B$5+80"), aString); - ASSERT_DOUBLES_EQUAL(94, fValue); + CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(B3:B6;\"<4\")"), getFormula(6, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(6, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(6, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(6, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=C$3+$B$5+80"), getFormula(6, 5, srcSheet)); + CPPUNIT_ASSERT_EQUAL(94.0, m_pDoc->GetValue(6, 5, srcSheet)); // check patterns const SfxPoolItem* pItem = nullptr; @@ -2792,71 +2678,57 @@ void TestCopyPaste::checkCopyPasteSpecialInitial(const SCTAB srcSheet) // check notes after transposed copy/paste // check presence of notes - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(1, 2, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(2, 2, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 2, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 2, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 2, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 2, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 2, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(1, 3, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 3, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 3, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 3, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 3, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 3, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 3, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(1, 4, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(2, 4, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 4, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 4, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 4, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 4, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 4, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(1, 5, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(2, 5, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 5, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 5, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 5, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 5, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 5, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(1, 6, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 6, srcSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 6, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 6, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 6, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 6, srcSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 6, srcSheet))); + CPPUNIT_ASSERT(m_pDoc->HasNote(1, 2, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(2, 2, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 2, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 2, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 2, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 2, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 2, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(1, 3, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 3, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 3, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 3, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 3, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 3, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 3, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(1, 4, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(2, 4, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 4, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 4, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 4, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 4, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 4, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(1, 5, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(2, 5, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 5, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 5, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 5, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 5, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 5, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(1, 6, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 6, srcSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 6, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 6, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 6, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 6, srcSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 6, srcSheet)); // check values of notes - CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), - m_pDoc->GetNote(ScAddress(1, 2, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note A2"), - m_pDoc->GetNote(ScAddress(1, 3, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), - m_pDoc->GetNote(ScAddress(1, 4, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), - m_pDoc->GetNote(ScAddress(2, 2, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), - m_pDoc->GetNote(ScAddress(2, 4, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note C2"), - m_pDoc->GetNote(ScAddress(3, 3, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), - m_pDoc->GetNote(ScAddress(3, 4, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), - m_pDoc->GetNote(ScAddress(4, 2, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D2"), - m_pDoc->GetNote(ScAddress(4, 3, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), - m_pDoc->GetNote(ScAddress(4, 4, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), - m_pDoc->GetNote(ScAddress(5, 4, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), - m_pDoc->GetNote(ScAddress(5, 5, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note F2"), - m_pDoc->GetNote(ScAddress(6, 3, srcSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), - m_pDoc->GetNote(ScAddress(6, 5, srcSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), getNote(1, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note A2"), getNote(1, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), getNote(1, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), getNote(2, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), getNote(2, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note C2"), getNote(3, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), getNote(3, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), getNote(4, 2, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D2"), getNote(4, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), getNote(4, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), getNote(5, 4, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), getNote(5, 5, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note F2"), getNote(6, 3, srcSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), getNote(6, 5, srcSheet)); CPPUNIT_ASSERT_EQUAL(OUString("=C5"), getFormula(1, 16, srcSheet)); CPPUNIT_ASSERT_EQUAL(OUString("=$C$5"), getFormula(2, 16, srcSheet)); @@ -2973,55 +2845,43 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty, bool bCut) b means border */ - OUString aString; - double fValue; const EditTextObject* pEditObj; // col 2 - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 3, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 5, destSheet)); // col 3, numbers - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(3, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1, m_pDoc->GetValue(3, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(2, m_pDoc->GetValue(3, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(3, m_pDoc->GetValue(3, 3, destSheet)); - ASSERT_DOUBLES_EQUAL(4, m_pDoc->GetValue(3, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(3, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(3, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(3, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(3, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(3, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(3, 5, destSheet)); // col 4, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(4, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(11, m_pDoc->GetValue(4, 1, destSheet)); - m_pDoc->GetFormula(4, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+10"), aString); - m_pDoc->GetFormula(4, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D3+20"), aString); - ASSERT_DOUBLES_EQUAL(22, m_pDoc->GetValue(4, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(35, m_pDoc->GetValue(4, 3, destSheet)); - m_pDoc->GetFormula(4, 3, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=G4+30"), aString); - ASSERT_DOUBLES_EQUAL(42, m_pDoc->GetValue(4, 4, destSheet)); - m_pDoc->GetFormula(4, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D3+40"), aString); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(4, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(4, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+10"), getFormula(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D3+20"), getFormula(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(22.0, m_pDoc->GetValue(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(35.0, m_pDoc->GetValue(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=G4+30"), getFormula(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(42.0, m_pDoc->GetValue(4, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D3+40"), getFormula(4, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(4, 5, destSheet)); // col 5, strings - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(5, 0, destSheet)); - aString = m_pDoc->GetString(5, 0, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - aString = m_pDoc->GetString(5, 1, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("a"), aString); - aString = m_pDoc->GetString(5, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("b"), aString); - aString = m_pDoc->GetString(5, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("c"), aString); - aString = m_pDoc->GetString(5, 4, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("d"), aString); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(5, 5, destSheet)); - aString = m_pDoc->GetString(5, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(5, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(5, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(5, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("b"), m_pDoc->GetString(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("c"), m_pDoc->GetString(5, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("d"), m_pDoc->GetString(5, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(5, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(5, 5, destSheet)); // col 6, rich text - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(6, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(6, 0, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 0, destSheet)); CPPUNIT_ASSERT(pEditObj == nullptr); pEditObj = m_pDoc->GetEditText(ScAddress(6, 1, destSheet)); @@ -3030,80 +2890,69 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty, bool bCut) pEditObj = m_pDoc->GetEditText(ScAddress(6, 2, destSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R2"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(5, m_pDoc->GetValue(6, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(6, 3, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 4, destSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R4"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(6, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(6, 5, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 5, destSheet)); CPPUNIT_ASSERT(pEditObj == nullptr); // col 7, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 0, destSheet)); - aString = m_pDoc->GetString(7, 0, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - m_pDoc->GetFormula(7, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+60"), aString); - ASSERT_DOUBLES_EQUAL(64, m_pDoc->GetValue(7, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+60"), getFormula(7, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(64.0, m_pDoc->GetValue(7, 1, destSheet)); if (!bSkipEmpty) { - aString = m_pDoc->GetString(7, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - aString = m_pDoc->GetString(7, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(7, 3, destSheet)); } else { - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 3, destSheet)); } - fValue = m_pDoc->GetValue(7, 4, destSheet); - m_pDoc->GetFormula(7, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+70"), aString); - ASSERT_DOUBLES_EQUAL(74, fValue); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 5, destSheet)); - aString = m_pDoc->GetString(7, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+70"), getFormula(7, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(74.0, m_pDoc->GetValue(7, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 5, destSheet)); // col 8, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 0, destSheet)); - aString = m_pDoc->GetString(8, 0, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - m_pDoc->GetFormula(8, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D2:D5;\"<4\")"), aString); - ASSERT_DOUBLES_EQUAL(6, m_pDoc->GetValue(8, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(8, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D2:D5;\"<4\")"), getFormula(8, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(8, 1, destSheet)); if (!bSkipEmpty) { - aString = m_pDoc->GetString(8, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - aString = m_pDoc->GetString(8, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(8, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(8, 3, destSheet)); } else { - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 3, destSheet)); } - fValue = m_pDoc->GetValue(8, 4, destSheet); - m_pDoc->GetFormula(8, 4, destSheet, aString); + OUString aStr; + double fValue = m_pDoc->GetValue(8, 4, destSheet); + m_pDoc->GetFormula(8, 4, destSheet, aStr); if (!bCut) { - CPPUNIT_ASSERT_EQUAL(OUString("=E$3+$B$5+80"), aString); - ASSERT_DOUBLES_EQUAL(1102, fValue); + CPPUNIT_ASSERT_EQUAL(OUString("=E$3+$B$5+80"), aStr); + CPPUNIT_ASSERT_EQUAL(1102.0, fValue); } else { - CPPUNIT_ASSERT_EQUAL(OUString("=E$2+$D$4+80"), aString); - ASSERT_DOUBLES_EQUAL(94, fValue); + CPPUNIT_ASSERT_EQUAL(OUString("=E$2+$D$4+80"), aStr); + CPPUNIT_ASSERT_EQUAL(94.0, fValue); } - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 5, destSheet)); - aString = m_pDoc->GetString(8, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(8, 5, destSheet)); // col 9, numbers - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 3, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 5, destSheet)); // check patterns const SfxPoolItem* pItem = nullptr; @@ -3157,86 +3006,72 @@ void TestCopyPaste::checkCopyPasteSpecial(bool bSkipEmpty, bool bCut) // check notes after transposed copy/paste // check presence of notes - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 2, destSheet))); - CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(ScAddress(8, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 3, destSheet))); - CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(ScAddress(7, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(7, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(8, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 5, destSheet))); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(8, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(7, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(7, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(8, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 5, destSheet)); // check values of notes - CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), - m_pDoc->GetNote(ScAddress(3, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note A2"), - m_pDoc->GetNote(ScAddress(3, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), - m_pDoc->GetNote(ScAddress(3, 3, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), - m_pDoc->GetNote(ScAddress(4, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), - m_pDoc->GetNote(ScAddress(4, 3, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note C2"), - m_pDoc->GetNote(ScAddress(5, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), - m_pDoc->GetNote(ScAddress(5, 3, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), - m_pDoc->GetNote(ScAddress(6, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D2"), - m_pDoc->GetNote(ScAddress(6, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), - m_pDoc->GetNote(ScAddress(6, 3, destSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), getNote(3, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note A2"), getNote(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), getNote(3, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), getNote(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), getNote(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note C2"), getNote(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), getNote(5, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), getNote(6, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D2"), getNote(6, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), getNote(6, 3, destSheet)); if (!bSkipEmpty) - CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), - m_pDoc->GetNote(ScAddress(7, 3, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), - m_pDoc->GetNote(ScAddress(7, 4, destSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), getNote(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), getNote(7, 4, destSheet)); if (!bSkipEmpty) - CPPUNIT_ASSERT_EQUAL(OUString("Note F2"), - m_pDoc->GetNote(ScAddress(8, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), - m_pDoc->GetNote(ScAddress(8, 4, destSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note F2"), getNote(8, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), getNote(8, 4, destSheet)); // Existing references to the destination range must not change CPPUNIT_ASSERT_EQUAL(OUString("=DestSheet.D1"), getFormula(3, 101, srcSheet)); @@ -3405,135 +3240,99 @@ void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty) b means border */ - OUString aString; - double fValue; const EditTextObject* pEditObj; // col 2 - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 3, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 5, destSheet)); // col 3, numbers - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(3, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1, m_pDoc->GetValue(3, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(3, m_pDoc->GetValue(3, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(4, m_pDoc->GetValue(3, 3, destSheet)); - fValue = m_pDoc->GetValue(3, 4, destSheet); // repeated row 1 - ASSERT_DOUBLES_EQUAL(1, fValue); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(3, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(3, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(3, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(3, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(3, 4, destSheet)); // repeated row 1 + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(3, 5, destSheet)); // col 4, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(4, 0, destSheet)); - m_pDoc->GetFormula(4, 0, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - ASSERT_DOUBLES_EQUAL(11, m_pDoc->GetValue(4, 1, destSheet)); - m_pDoc->GetFormula(4, 1, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+10"), aString); - fValue = m_pDoc->GetValue(4, 2, destSheet); - m_pDoc->GetFormula(4, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=G3+30"), aString); - ASSERT_DOUBLES_EQUAL(35, fValue); - fValue = m_pDoc->GetValue(4, 3, destSheet); - m_pDoc->GetFormula(4, 3, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+40"), aString); - ASSERT_DOUBLES_EQUAL(41, fValue); - fValue = m_pDoc->GetValue(4, 4, destSheet); // repeated row 1 - ASSERT_DOUBLES_EQUAL(11, fValue); - m_pDoc->GetFormula(4, 4, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D5+10"), aString); - ASSERT_DOUBLES_EQUAL(11, m_pDoc->GetValue(4, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(4, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(4, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, getFormula(4, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+10"), getFormula(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=G3+30"), getFormula(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(35.0, m_pDoc->GetValue(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+40"), getFormula(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(41.0, m_pDoc->GetValue(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(4, 4, destSheet)); // repeated row 1 + CPPUNIT_ASSERT_EQUAL(OUString("=D5+10"), getFormula(4, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(4, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(4, 5, destSheet)); // col 5, strings - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(5, 0, destSheet)); - aString = m_pDoc->GetString(5, 1, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("a"), aString); - aString = m_pDoc->GetString(5, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("c"), aString); - aString = m_pDoc->GetString(5, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("d"), aString); - aString = m_pDoc->GetString(5, 4, destSheet); // repeated row 1 - CPPUNIT_ASSERT_EQUAL(OUString("a"), aString); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(5, 5, destSheet)); - m_pDoc->GetFormula(4, 5, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(5, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(5, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("c"), m_pDoc->GetString(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("d"), m_pDoc->GetString(5, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(5, 4, destSheet)); // repeated row 1 + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(5, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, getFormula(4, 5, destSheet)); // col 6, rich text - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(6, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(6, 0, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 0, destSheet)); CPPUNIT_ASSERT(pEditObj == nullptr); pEditObj = m_pDoc->GetEditText(ScAddress(6, 1, destSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R1"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(5, m_pDoc->GetValue(6, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(6, 2, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 3, destSheet)); CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R4"), pEditObj->GetText(0)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 4, destSheet)); // repeated row 1 CPPUNIT_ASSERT(pEditObj); CPPUNIT_ASSERT_EQUAL(OUString("R1"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(6, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(6, 5, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 5, destSheet)); CPPUNIT_ASSERT(pEditObj == nullptr); // col 7, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 0, destSheet)); - aString = m_pDoc->GetString(7, 0, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - m_pDoc->GetFormula(7, 1, destSheet, aString); - fValue = m_pDoc->GetValue(7, 1, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+60"), aString); - ASSERT_DOUBLES_EQUAL(65, fValue); // formula is not adjusted due to filter row + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D2+D4+60"), getFormula(7, 1, destSheet)); + // formula is not adjusted due to filter row + CPPUNIT_ASSERT_EQUAL(65.0, m_pDoc->GetValue(7, 1, destSheet)); if (!bSkipEmpty) - { - aString = m_pDoc->GetString(7, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - } + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(7, 2, destSheet)); else - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 2, destSheet)); - fValue = m_pDoc->GetValue(7, 3, destSheet); - m_pDoc->GetFormula(7, 3, destSheet, aString); - CPPUNIT_ASSERT_EQUAL(OUString("=D1+D3+70"), aString); - ASSERT_DOUBLES_EQUAL(1073, fValue); - m_pDoc->GetFormula(7, 4, destSheet, aString); // repeated row 1 - fValue = m_pDoc->GetValue(7, 4, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("=D5+D7+60"), aString); - ASSERT_DOUBLES_EQUAL(1061, fValue); // formula is not adjusted due to filter row - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 5, destSheet)); - aString = m_pDoc->GetString(7, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D1+D3+70"), getFormula(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1073.0, m_pDoc->GetValue(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=D5+D7+60"), getFormula(7, 4, destSheet)); // repeated row 1 + // formula is not adjusted due to filter row + CPPUNIT_ASSERT_EQUAL(1061.0, m_pDoc->GetValue(7, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 5, destSheet)); // col 8, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 0, destSheet)); - aString = m_pDoc->GetString(8, 0, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - m_pDoc->GetFormula(8, 1, destSheet, aString); - fValue = m_pDoc->GetValue(8, 1, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D2:D5;\"<4\")"), aString); - ASSERT_DOUBLES_EQUAL(5, fValue); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(8, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D2:D5;\"<4\")"), getFormula(8, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(8, 1, destSheet)); if (!bSkipEmpty) - { - aString = m_pDoc->GetString(8, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, aString); - } + CPPUNIT_ASSERT_EQUAL(EMPTY_OUSTRING, m_pDoc->GetString(8, 2, destSheet)); else - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 2, destSheet)); - fValue = m_pDoc->GetValue(8, 3, destSheet); - m_pDoc->GetFormula(8, 3, destSheet, aString); - ASSERT_DOUBLES_EQUAL(1115, fValue); - CPPUNIT_ASSERT_EQUAL(OUString("=E$3+$B$5+80"), aString); - m_pDoc->GetFormula(8, 4, destSheet, aString); // repeated row 1 - fValue = m_pDoc->GetValue(8, 4, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D5:D8;\"<4\")"), aString); - ASSERT_DOUBLES_EQUAL(1, fValue); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(8, 5, destSheet)); - aString = m_pDoc->GetString(8, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1115.0, m_pDoc->GetValue(8, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=E$3+$B$5+80"), getFormula(8, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("=SUMIF(D5:D8;\"<4\")"), getFormula(8, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(8, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(8, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(8, 5, destSheet)); // col 9, numbers - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 1, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 2, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 3, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 4, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(9, 5, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(9, 5, destSheet)); // check patterns const SfxPoolItem* pItem = nullptr; @@ -3582,77 +3381,67 @@ void TestCopyPaste::checkCopyPasteSpecialFiltered(bool bSkipEmpty) // check notes after transposed copy/paste // check presence of notes - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 0, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 1, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 1, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 2, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 2, destSheet))); - CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(ScAddress(7, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 2, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(5, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(7, 3, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(8, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 3, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(3, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(4, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 4, destSheet))); - CPPUNIT_ASSERT(m_pDoc->HasNote(ScAddress(6, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 4, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(2, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(3, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(4, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(5, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(6, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(7, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(8, 5, destSheet))); - CPPUNIT_ASSERT(!m_pDoc->HasNote(ScAddress(9, 5, destSheet))); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 0, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 1, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 1, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 2, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(!bSkipEmpty, m_pDoc->HasNote(7, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 2, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(5, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(7, 3, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(8, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 3, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(3, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(4, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 4, destSheet)); + CPPUNIT_ASSERT(m_pDoc->HasNote(6, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 4, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(2, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(3, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(4, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(5, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(6, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(7, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(8, 5, destSheet)); + CPPUNIT_ASSERT(!m_pDoc->HasNote(9, 5, destSheet)); // check values of notes - CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), - m_pDoc->GetNote(ScAddress(3, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), - m_pDoc->GetNote(ScAddress(3, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), - m_pDoc->GetNote(ScAddress(4, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), - m_pDoc->GetNote(ScAddress(4, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), - m_pDoc->GetNote(ScAddress(5, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), - m_pDoc->GetNote(ScAddress(6, 1, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), - m_pDoc->GetNote(ScAddress(6, 2, destSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note A1"), getNote(3, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note A3"), getNote(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B1"), getNote(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note B3"), getNote(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note C3"), getNote(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D1"), getNote(6, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note D3"), getNote(6, 2, destSheet)); if (!bSkipEmpty) - CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), - m_pDoc->GetNote(ScAddress(7, 2, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), - m_pDoc->GetNote(ScAddress(7, 3, destSheet))->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), - m_pDoc->GetNote(ScAddress(8, 3, destSheet))->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("Note E2"), getNote(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note E4"), getNote(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("Note F4"), getNote(8, 3, destSheet)); m_pDoc->DeleteTab(destSheet); m_pDoc->DeleteTab(srcSheet); @@ -3681,71 +3470,45 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) //check cell content after transposed copy/paste of filtered data // Note: column F is a repetition of srcSheet.Column A // Col C and G are checked to be empty - OUString aString; - double fValue; const EditTextObject* pEditObj; // row 0 - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(3, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(4, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(5, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(6, 0, destSheet)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(3, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(4, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(5, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(6, 0, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 0, destSheet)); // row 1, numbers - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 1, destSheet)); - fValue = m_pDoc->GetValue(3, 1, destSheet); // D2 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell D2", 1, fValue); - fValue = m_pDoc->GetValue(4, 1, destSheet); // E2 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell E2", 2, fValue); - fValue = m_pDoc->GetValue(5, 1, destSheet); // F2 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell F2", 3, fValue); - fValue = m_pDoc->GetValue(6, 1, destSheet); // G2 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell G2", 4, fValue); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed cell D2", 1.0, m_pDoc->GetValue(3, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed cell E2", 2.0, m_pDoc->GetValue(4, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed cell F2", 3.0, m_pDoc->GetValue(5, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed cell G2", 4.0, m_pDoc->GetValue(6, 1, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 1, destSheet)); // row 2, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 2, destSheet)); - aString = m_pDoc->GetString(2, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - m_pDoc->GetFormula(3, 2, destSheet, aString); // D3 - CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed formula D3 should point on D2", OUString("=D2+10"), - aString); - fValue = m_pDoc->GetValue(3, 2, destSheet); // D3 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula D3", 11, fValue); - m_pDoc->GetFormula(4, 2, destSheet, aString); - CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed formula E3 should point on E2", OUString("=E2+20"), - aString); - fValue = m_pDoc->GetValue(4, 2, destSheet); // E3 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula E3", 22, fValue); - m_pDoc->GetFormula(5, 2, destSheet, aString); // F3 - CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed formula F3 should point on F2", OUString("=F5+30"), - aString); - fValue = m_pDoc->GetValue(5, 2, destSheet); // F3 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula F3", 35, fValue); - m_pDoc->GetFormula(6, 2, destSheet, aString); // G3 - CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed formula G3 should point on E2", OUString("=E2+40"), - aString); - fValue = m_pDoc->GetValue(6, 2, destSheet); // G3 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula G3", 42, fValue); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 2, destSheet)); - aString = m_pDoc->GetString(7, 2, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(2, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed D3", OUString("=D2+10"), getFormula(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed D3", 11.0, m_pDoc->GetValue(3, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed E3", OUString("=E2+20"), getFormula(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed E3", 22.0, m_pDoc->GetValue(4, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed F3", OUString("=F5+30"), getFormula(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed F3", 35.0, m_pDoc->GetValue(5, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed G3", OUString("=E2+40"), getFormula(6, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed G3", 42.0, m_pDoc->GetValue(6, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 2, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 2, destSheet)); // row 3, strings - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 3, destSheet)); - aString = m_pDoc->GetString(2, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); - aString = m_pDoc->GetString(3, 3, destSheet); // D4 - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D4 should contain: a", OUString("a"), aString); - aString = m_pDoc->GetString(4, 3, destSheet); // E4 - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E4 should contain: b", OUString("b"), aString); - aString = m_pDoc->GetString(5, 3, destSheet); // F4 - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell F4 should contain: c", OUString("c"), aString); - aString = m_pDoc->GetString(6, 3, destSheet); // G4 - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell G4 should contain: d", OUString("d"), aString); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 3, destSheet)); - aString = m_pDoc->GetString(7, 3, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(2, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell D4", OUString("a"), m_pDoc->GetString(3, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell E4", OUString("b"), m_pDoc->GetString(4, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell F4", OUString("c"), m_pDoc->GetString(5, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell G4", OUString("d"), m_pDoc->GetString(6, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 3, destSheet)); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), m_pDoc->GetString(7, 3, destSheet)); // row 4, rich text - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(2, 4, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(2, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("There should be no edit cell in C5.", pEditObj == nullptr); pEditObj = m_pDoc->GetEditText(ScAddress(3, 4, destSheet)); @@ -3755,84 +3518,72 @@ void TestCopyPaste::checkCopyPasteSpecialTranspose(bool bSkipEmpty, bool bCut) pEditObj = m_pDoc->GetEditText(ScAddress(4, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in E5.", pEditObj); CPPUNIT_ASSERT_EQUAL_MESSAGE("Edit cell value wrong E5.", OUString("R2"), pEditObj->GetText(0)); - fValue = m_pDoc->GetValue(5, 4, destSheet); // F5 - ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied cell F5", 5, fValue); + CPPUNIT_ASSERT_EQUAL_MESSAGE("transposed cell F5", 5.0, m_pDoc->GetValue(5, 4, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(6, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("There should be an edit cell in G5.", pEditObj); CPPUNIT_ASSERT_EQUAL_MESSAGE("Edit cell value wrong G5.", OUString("R4"), pEditObj->GetText(0)); - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(7, 4, destSheet)); + CPPUNIT_ASSERT_EQUAL(1000.0, m_pDoc->GetValue(7, 4, destSheet)); pEditObj = m_pDoc->GetEditText(ScAddress(7, 4, destSheet)); CPPUNIT_ASSERT_MESSAGE("There should be no edit cell in H5.", pEditObj == nullptr); // row 5, formulas - ASSERT_DOUBLES_EQUAL(1000, m_pDoc->GetValue(2, 5, destSheet)); - aString = m_pDoc->GetString(2, 5, destSheet); - CPPUNIT_ASSERT_EQUAL(OUString("1000"), aString); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits