[Libreoffice-commits] .: sc/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 11 16:09:33 PST 2013


 sc/qa/unit/ucalc.cxx |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 16ab898a4139ab1743f68caec86aaa2fb2ba10e0
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Jan 12 01:08:34 2013 +0100

    at least use correct test data ...
    
    Change-Id: Icb5bb61108f6bb674016ce044ecbe6a366b4f9c6

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a12ce89..14d0da1 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -678,7 +678,7 @@ void testFuncIFERROR(ScDocument* pDoc)
     // Empty A1:A39 first.
     clearRange(pDoc, ScRange(0, 0, 0, 0, 40, 0));
 
-    // Raw data (rows 1 through 10)
+    // Raw data (rows 1 through 12)
     const char* aData[] = {
         "1",
         "e",
@@ -689,23 +689,23 @@ void testFuncIFERROR(ScDocument* pDoc)
         "=NA()",
         "bar",
         "4",
-        "gee"
+        "gee",
+        "=1/0",
+        "23"
     };
 
     SCROW nRows = SAL_N_ELEMENTS(aData);
     for (SCROW i = 0; i < nRows; ++i)
         pDoc->SetString(0, i, 0, rtl::OUString::createFromAscii(aData[i]));
 
-    printRange(pDoc, ScRange(0, 0, 0, 0, 8, 0), "data range for IFERROR/IFNA");
+    printRange(pDoc, ScRange(0, 0, 0, 0, nRows-1, 0), "data range for IFERROR/IFNA");
 
     // formulas and results
     struct {
         const char* pFormula; const char* pResult;
     } aChecks[] = {
         { "=IFERROR(A1;9)",                         "1" },
-     // { "{=IFERROR(3*A1:A2;2002)}",               "3" },
-     // { "{=IFERROR(3*A1:A2;1998)}",            "1998" },
-     // { "=IFERROR(A2;-7)",                       "-7" },
+        { "=IFERROR(A2;9)",                         "e" },
         { "=IFERROR(A3;9)",                         "2" },
         { "=IFERROR(A4;-7)",                       "-7" },
         { "=IFERROR(A5;-7)",                       "-7" },
@@ -713,16 +713,25 @@ void testFuncIFERROR(ScDocument* pDoc)
         { "=IFERROR(A7;-7)",                       "-7" },
         { "=IFNA(A6;9)",                      "#DIV/0!" },
         { "=IFNA(A7;-7)",                          "-7" },
-     // { "=IFNA(VLOOKUP(\"4\",A8:A10;1;0);-2)",    "4" },
-     // { "=IFNA(VLOOKUP(\"fop\",A8:A10;1;0);-2)", "-2" }
+        { "=IFNA(VLOOKUP(\"4\";A8:A10;1;0);-2)",    "4" },
+        { "=IFNA(VLOOKUP(\"fop\";A8:A10;1;0);-2)", "-2" },
+        { "{=IFERROR(3*A11:A12;1998)}[0]",       "1998" },  // um.. this is not the correct way to insert a
+        { "{=IFERROR(3*A11:A12;1998)}[1]",         "69" }   // matrix formula, just a place holder, see below
     };
 
     nRows = SAL_N_ELEMENTS(aChecks);
-    for (SCROW i = 0; i < nRows; ++i)
+    for (SCROW i = 0; i < nRows-2; ++i)
     {
         SCROW nRow = 20 + i;
         pDoc->SetString(0, nRow, 0, rtl::OUString::createFromAscii(aChecks[i].pFormula));
     }
+
+    // Create a matrix range in last two rows of the range above, actual data
+    // of the placeholders.
+    ScMarkData aMark;
+    aMark.SelectOneTable(0);
+    pDoc->InsertMatrixFormula(0, 20 + nRows-2, 0, 20 + nRows-1, aMark, "=IFERROR(3*A11:A12;1998)", NULL);
+
     pDoc->CalcAll();
 
     for (SCROW i = 0; i < nRows; ++i)


More information about the Libreoffice-commits mailing list