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

Kohei Yoshida kohei.yoshida at collabora.com
Fri Sep 27 08:24:44 PDT 2013


 sc/qa/unit/data/xls/data-table.xls     |binary
 sc/qa/unit/subsequent_filters-test.cxx |   53 +++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

New commits:
commit d60c14cde375c46f9bfa290423d251577f2db3de
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Sep 27 17:23:34 2013 +0200

    Add a new import filter test case for data table from xls.
    
    Data Table is in Data -> Table in Excel XP, and is under "What-if Analysis"
    in 2007 and newer.
    
    Change-Id: Iec1f944a8643bafb71341981bf94c6c536c63484

diff --git a/sc/qa/unit/data/xls/data-table.xls b/sc/qa/unit/data/xls/data-table.xls
new file mode 100644
index 0000000..45015d6
Binary files /dev/null and b/sc/qa/unit/data/xls/data-table.xls differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index dd4b165..7db8c16 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -110,6 +110,7 @@ public:
     void testMergedCellsODS();
     void testRepeatedColumnsODS();
     void testDataValidityODS();
+    void testDataTableXLS();
 
     void testDataBarODS();
     void testDataBarXLSX();
@@ -171,6 +172,7 @@ public:
     CPPUNIT_TEST(testMergedCellsODS);
     CPPUNIT_TEST(testRepeatedColumnsODS);
     CPPUNIT_TEST(testDataValidityODS);
+    CPPUNIT_TEST(testDataTableXLS);
     CPPUNIT_TEST(testBrokenQuotesCSV);
     CPPUNIT_TEST(testCellValueXLSX);
     CPPUNIT_TEST(testControlImport);
@@ -1171,6 +1173,57 @@ void ScFiltersTest::testDataValidityODS()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testDataTableXLS()
+{
+    ScDocShellRef xDocSh = loadDoc("data-table.", XLS);
+    ScFormulaOptions aOptions;
+    aOptions.SetFormulaSepArg(",");
+    aOptions.SetFormulaSepArrayCol(",");
+    aOptions.SetFormulaSepArrayRow(";");
+    xDocSh->SetFormulaOptions(aOptions);
+
+    ScDocument* pDoc = xDocSh->GetDocument();
+
+    // One-variable table
+
+    if (!checkFormula(*pDoc, ScAddress(3,1,0), "PMT(B3/12,B4,-B5)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,2,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C3)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,3,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C4)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,4,0), "MULTIPLE.OPERATIONS(D$2,$B$3,$C5)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    // Two-variable table
+
+    if (!checkFormula(*pDoc, ScAddress(2,7,0), "PMT(B9/12,B10,-B11)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,D$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,D$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(3,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,D$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(4,8,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C9,$B$10,E$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(4,9,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C10,$B$10,E$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    if (!checkFormula(*pDoc, ScAddress(4,10,0), "MULTIPLE.OPERATIONS($C$8,$B$9,$C11,$B$10,E$8)"))
+        CPPUNIT_FAIL("Wrong formula!");
+
+    xDocSh->DoClose();
+}
+
 void ScFiltersTest::testBrokenQuotesCSV()
 {
     const OUString aFileNameBase("fdo48621_broken_quotes.");


More information about the Libreoffice-commits mailing list