diff options
author | kerem <hallackerem@gmail.com> | 2017-01-08 13:57:59 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-01-08 13:05:39 +0000 |
commit | c00f6dd0a39c295c702dcfc808f009f1cdc365f0 (patch) | |
tree | ec97758b45d39e0c04396d134d2d1c1fe6ddc10e | |
parent | ad86820a2bc99ede49875f8b03d6e64624e7b5f4 (diff) |
tdf#90290 use custom asserter in ucalc.cxx
Change-Id: I2db09096c2862801631c92df77001b50cc8270c5
Reviewed-on: https://gerrit.libreoffice.org/32830
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 65d5892b4c5a..b7417baa1410 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3604,19 +3604,16 @@ void Test::testCutPasteRefUndo() m_pDoc->CopyFromClip(ScAddress(2,1,0), aMark, InsertDeleteFlags::CONTENTS, pUndoDoc, &aClipDoc); CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(0,1,0)); - if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "C2")) - CPPUNIT_FAIL("A2 should be referencing C2."); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "C2", "A2 should be referencing C2."); // At this point, the ref undo document should contain a formula cell at A2 that references B2. - if (!checkFormula(*pUndoDoc, ScAddress(0,1,0), "B2")) - CPPUNIT_FAIL("A2 in the undo document should be referencing B2."); + ASSERT_FORMULA_EQUAL(*pUndoDoc, ScAddress(0,1,0), "B2", "A2 in the undo document should be referencing B2."); ScUndoPaste aUndo(&getDocShell(), ScRange(ScAddress(2,1,0)), aMark, pUndoDoc, nullptr, InsertDeleteFlags::CONTENTS, nullptr, false, nullptr); aUndo.Undo(); // Now A2 should be referencing B2 once again. - if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "B2")) - CPPUNIT_FAIL("A2 should be referencing B2 after undo."); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "B2", "A2 should be referencing B2 after undo."); m_pDoc->DeleteTab(0); } @@ -3753,10 +3750,8 @@ void Test::testMoveRefBetweenSheets() CPPUNIT_ASSERT_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0,2,0))); // These formulas should not display the sheet name. - if (!checkFormula(*m_pDoc, ScAddress(0,1,0), "A1")) - CPPUNIT_FAIL("Wrong formula!"); - if (!checkFormula(*m_pDoc, ScAddress(0,2,0), "SUM(A1:C1)")) - CPPUNIT_FAIL("Wrong formula!"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,0), "A1", "Wrong formula!"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,0), "SUM(A1:C1)", "Wrong formula!"); // Move Test1.A2:A3 to Test2.A2:A3. ScDocFunc& rFunc = getDocShell().GetDocFunc(); @@ -3768,10 +3763,8 @@ void Test::testMoveRefBetweenSheets() ASSERT_DOUBLES_EQUAL(30.0, m_pDoc->GetValue(ScAddress(0,2,1))); // The reference in the pasted formula should display sheet name after the move. - if (!checkFormula(*m_pDoc, ScAddress(0,1,1), "Test1.A1")) - CPPUNIT_FAIL("Wrong formula!"); - if (!checkFormula(*m_pDoc, ScAddress(0,2,1), "SUM(Test1.A1:C1)")) - CPPUNIT_FAIL("Wrong formula!"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,1,1), "Test1.A1", "Wrong formula!"); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,2,1), "SUM(Test1.A1:C1)", "Wrong formula!"); m_pDoc->DeleteTab(1); m_pDoc->DeleteTab(0); @@ -4080,8 +4073,7 @@ void Test::testCopyPasteMixedReferenceFormula() // Insert formula to A1 with mixed relative/absolute addressing. m_pDoc->SetString(0,0,0, "=SUM(B:$C)"); - if (!checkFormula(*m_pDoc, ScAddress(0,0,0), "SUM(B:$C)")) - CPPUNIT_FAIL("Wrong formula."); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), "SUM(B:$C)", "Wrong formula."); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(0,0,0)); // Copy formula in A1 to clipboard. @@ -4092,16 +4084,14 @@ void Test::testCopyPasteMixedReferenceFormula() // Paste formula to B1. aRange = ScAddress(1,0,0); pasteFromClip(m_pDoc, aRange, &aClipDoc); - if (!checkFormula(*m_pDoc, ScAddress(1,0,0), "SUM(C:$C)")) - CPPUNIT_FAIL("Wrong formula."); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(1,0,0), "SUM(C:$C)", "Wrong formula."); CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(0,0,0)); CPPUNIT_ASSERT_EQUAL(1.0, m_pDoc->GetValue(1,0,0)); // Paste formula to C1. All three results now must be circular reference. aRange = ScAddress(2,0,0); pasteFromClip(m_pDoc, aRange, &aClipDoc); - if (!checkFormula(*m_pDoc, ScAddress(2,0,0), "SUM($C:D)")) // reference put in order - CPPUNIT_FAIL("Wrong formula."); + ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(2,0,0), "SUM($C:D)", "Wrong formula."); // reference put in order CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(0,0,0)); CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(1,0,0)); CPPUNIT_ASSERT_EQUAL(OUString("Err:522"), m_pDoc->GetString(2,0,0)); |