summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-09-27 17:23:34 +0200
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-09-27 17:25:58 +0200
commitd60c14cde375c46f9bfa290423d251577f2db3de (patch)
treee61db1c16e360b9addc55f6348c2e7daff6a4ad4 /sc/qa/unit
parente41713213682ab1b32c48a8782a61a596b5a77a5 (diff)
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
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/xls/data-table.xlsbin0 -> 13824 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx53
2 files changed, 53 insertions, 0 deletions
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 000000000000..45015d6d8e12
--- /dev/null
+++ b/sc/qa/unit/data/xls/data-table.xls
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index dd4b165f5b0f..7db8c1647c05 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.");