[Libreoffice-commits] core.git: sc/qa

kerem hallackerem at gmail.com
Wed Mar 15 09:20:46 UTC 2017


 sc/qa/unit/ucalc_formula.cxx |  113 +++++++++++++++++++------------------------
 1 file changed, 50 insertions(+), 63 deletions(-)

New commits:
commit 1238cd22c4e2e801eab612d667038e0173b4dccd
Author: kerem <hallackerem at gmail.com>
Date:   Thu Mar 9 00:45:40 2017 +0200

    tdf#90290 use custom asserter in ucalc_formula.cxx
    
    Change-Id: I77d3507f263660a7f35ef84a26e4a9860a2be802
    Reviewed-on: https://gerrit.libreoffice.org/34984
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 1fde291..7604e08 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -1572,47 +1572,42 @@ void Test::testFormulaRefUpdateRange()
     m_pDoc->InsertRow( ScRange( 0, aPos.Row(), 1, MAXCOL, aPos.Row()+1, 1));
 
     // A3:A18 must not result in #REF! anywhere.
-    bool bCheck = true;
     aPos.Set(0,2,1);
-    bCheck &= checkFormula(*m_pDoc, aPos, "B2:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:B1048576", "Wrong reference in A3 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B2:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:B$1048576", "Wrong reference in A4 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B2:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:$B1048576", "Wrong reference in A5 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B2:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B2:$B$1048576", "Wrong reference in A6 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$2:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:B1048576", "Wrong reference in A7 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$2:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:B$1048576", "Wrong reference in A8 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$2:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:$B1048576", "Wrong reference in A9 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$2:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$2:$B$1048576", "Wrong reference in A10 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B2:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:B1048576", "Wrong reference in A11 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B2:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:B$1048576", "Wrong reference in A12 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B2:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:$B1048576", "Wrong reference in A13 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B2:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B2:$B$1048576", "Wrong reference in A14 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$2:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:B1048576", "Wrong reference in A15 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$2:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:B$1048576", "Wrong reference in A16 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$2:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:$B1048576", "Wrong reference in A17 after insertion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$2:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$2:$B$1048576", "Wrong reference in A18 after insertion.");
     aPos.IncRow();
-    if (!bCheck)
-        CPPUNIT_FAIL("Wrong reference in A3:A18 after insertion.");
 
     // A19 reference to one row shifted out should be #REF!
-    bCheck &= checkFormula(*m_pDoc, aPos, "B#REF!:C#REF!");
-    if (!bCheck)
-        CPPUNIT_FAIL("Wrong reference in A19 after insertion.");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B#REF!:C#REF!", "Wrong reference in A19 after insertion.");
     // A19 enter reference to last row.
     m_pDoc->SetString( aPos, "=B1048576:C1048576");
     aPos.IncRow();
@@ -1622,47 +1617,42 @@ void Test::testFormulaRefUpdateRange()
 
     // Check sticky bottom references and display of entire column references,
     // now in A2:A17.
-    bCheck = true;
     aPos.Set(0,1,1);
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A2 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B1:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:B$1048576", "Wrong reference in A3 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A4 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B1:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:$B$1048576", "Wrong reference in A5 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$1:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:B1048576", "Wrong reference in A6 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A7 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$1:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:$B1048576", "Wrong reference in A8 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A9 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A10 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B1:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:B$1048576", "Wrong reference in A11 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A12 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B1:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:$B$1048576", "Wrong reference in A13 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$1:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:B1048576", "Wrong reference in A14 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A15 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$1:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:$B1048576", "Wrong reference in A16 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A17 after deletion.");
     aPos.IncRow();
-    if (!bCheck)
-        CPPUNIT_FAIL("Wrong reference in A2:A17 after deletion.");
 
     // A18 reference to one last row should be shifted up.
-    bCheck &= checkFormula(*m_pDoc, aPos, "B1048575:C1048575");
-    if (!bCheck)
-        CPPUNIT_FAIL("Wrong reference in A18 after deletion.");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1048575:C1048575", "Wrong reference in A18 after deletion.");
     aPos.IncRow();
 
     // Insert 4 rows in the middle.
@@ -1671,42 +1661,39 @@ void Test::testFormulaRefUpdateRange()
     m_pDoc->DeleteRow( ScRange( 0, aPos.Row(), 1, MAXCOL, aPos.Row()+1, 1));
 
     // References in A2:A17 must still be the same.
-    bCheck = true;
     aPos.Set(0,1,1);
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A2 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B1:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:B$1048576", "Wrong reference in A3 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A4 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B1:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B1:$B$1048576", "Wrong reference in A5 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$1:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:B1048576", "Wrong reference in A6 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:B", "Wrong reference in A7 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B$1:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B$1:$B1048576", "Wrong reference in A8 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "B:$B", "Wrong reference in A9 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A10 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B1:B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:B$1048576", "Wrong reference in A11 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A12 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B1:$B$1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B1:$B$1048576", "Wrong reference in A13 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$1:B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:B1048576", "Wrong reference in A14 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:B", "Wrong reference in A15 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B$1:$B1048576");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B$1:$B1048576", "Wrong reference in A16 after deletion.");
     aPos.IncRow();
-    bCheck &= checkFormula(*m_pDoc, aPos, "$B:$B");
+    ASSERT_FORMULA_EQUAL(*m_pDoc, aPos, "$B:$B", "Wrong reference in A17 after deletion.");
     aPos.IncRow();
-    if (!bCheck)
-        CPPUNIT_FAIL("Wrong reference in A2:A17 after deletion.");
 
     m_pDoc->DeleteTab(1);
 


More information about the Libreoffice-commits mailing list