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

kerem hallackerem at gmail.com
Wed Jan 4 15:02:49 UTC 2017


 sc/qa/unit/subsequent_export-test.cxx |   49 +++++++++-------------------------
 1 file changed, 14 insertions(+), 35 deletions(-)

New commits:
commit bddfa273edc7591d7a5e171e1abab035fe42716f
Author: kerem <hallackerem at gmail.com>
Date:   Wed Jan 4 09:52:24 2017 +0200

    tdf#90290 use custom asserter in subsequent_export-test.cxx
    
    Change-Id: I8f8135728ab4f117cc99a0b78b8e3497417c5669
    Reviewed-on: https://gerrit.libreoffice.org/32717
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 56c749c..f448ee4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -1602,8 +1602,7 @@ void ScExportTest::testFormulaRefSheetNameODS()
         sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn on auto calc.
         rDoc.SetString(ScAddress(1,1,0), "='90''s Data'.B2");
         CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
-        if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
-            CPPUNIT_FAIL("Wrong formula");
+        ASSERT_FORMULA_EQUAL(rDoc, ScAddress(1,1,0), "'90''s Data'.B2", "Wrong formula");
     }
     // Now, save and reload this document.
     ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS);
@@ -1612,8 +1611,7 @@ void ScExportTest::testFormulaRefSheetNameODS()
     ScDocument& rDoc = xNewDocSh->GetDocument();
     rDoc.CalcAll();
     CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
-    if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2"))
-        CPPUNIT_FAIL("Wrong formula");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(1,1,0), "'90''s Data'.B2", "Wrong formula");
 
     xNewDocSh->DoClose();
 }
@@ -1663,10 +1661,8 @@ void ScExportTest::testCellValuesExportODS()
     CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(5,0,0));
 
     // check formula
-    if (!checkFormula(rDoc, ScAddress(4,0,0), "10*C1/4"))
-        CPPUNIT_FAIL("Wrong formula =10*C1/4");
-    if (!checkFormula(rDoc, ScAddress(7,0,0), "SUM(C1:F1)"))
-        CPPUNIT_FAIL("Wrong formula =SUM(C1:F1)");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(4,0,0), "10*C1/4", "Wrong formula =10*C1/4");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(7,0,0), "SUM(C1:F1)", "Wrong formula =SUM(C1:F1)");
     CPPUNIT_ASSERT_EQUAL(16.5, rDoc.GetValue(7,0,0));
 
     // check string
@@ -1685,8 +1681,7 @@ void ScExportTest::testCellValuesExportODS()
     //check contiguous values
     CPPUNIT_ASSERT_EQUAL( 12.0, rDoc.GetValue(0,5,0) );
     CPPUNIT_ASSERT_EQUAL( OUString("a string"), rDoc.GetString(0,6,0) );
-    if (!checkFormula(rDoc, ScAddress(0,7,0), "$A$6"))
-        CPPUNIT_FAIL("Wrong formula =$A$6");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,7,0), "$A$6", "Wrong formula =$A$6");
     CPPUNIT_ASSERT_EQUAL( rDoc.GetValue(0,5,0), rDoc.GetValue(0,7,0) );
 
     xNewDocSh->DoClose();
@@ -1881,29 +1876,14 @@ void ScExportTest::testFormulaReferenceXLS()
 
     ScDocument& rDoc = xDocSh->GetDocument();
 
-    if (!checkFormula(rDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2"))
-        CPPUNIT_FAIL("Wrong formula in D2");
-
-    if (!checkFormula(rDoc, ScAddress(3,2,0), "A3+B3+C3"))
-        CPPUNIT_FAIL("Wrong formula in D3");
-
-    if (!checkFormula(rDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)"))
-        CPPUNIT_FAIL("Wrong formula in D6");
-
-    if (!checkFormula(rDoc, ScAddress(3,6,0), "SUM(A7:C7)"))
-        CPPUNIT_FAIL("Wrong formula in D7");
-
-    if (!checkFormula(rDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2"))
-        CPPUNIT_FAIL("Wrong formula in D10");
-
-    if (!checkFormula(rDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3"))
-        CPPUNIT_FAIL("Wrong formula in D11");
-
-    if (!checkFormula(rDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)"))
-        CPPUNIT_FAIL("Wrong formula in D14");
-
-    if (!checkFormula(rDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)"))
-        CPPUNIT_FAIL("Wrong formula in D15");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2", "Wrong formula in D2");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,2,0), "A3+B3+C3", "Wrong formula in D3");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)", "Wrong formula in D6");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,6,0), "SUM(A7:C7)", "Wrong formula in D7");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2", "Wrong formula in D10");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3", "Wrong formula in D11");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)", "Wrong formula in D14");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)", "Wrong formula in D15");
 
     xDocSh->DoClose();
 }
@@ -3186,8 +3166,7 @@ void ScExportTest::testSupBookVirtualPathXLS()
 
     ScDocument& rDoc = xDocSh->GetDocument();
 
-    if (!checkFormula(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1"))
-        CPPUNIT_FAIL("Wrong SupBook VirtualPath URL");
+    ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1", "Wrong SupBook VirtualPath URL");
 
     xDocSh->DoClose();
 }


More information about the Libreoffice-commits mailing list