summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-13 18:00:19 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-03-13 18:39:22 -0400
commita145e8859c5a878110ec1b346f244c51d1e5a80b (patch)
tree4daaf2b33280f5636ae4cb65b4e066ba9e5bc594 /sc
parent534425bfcd4c1ac08c780f417b1dd99baeac99b0 (diff)
fdo#76032: Write test for this.
Change-Id: Iec8d32a4e53d2d5d3cdc9767c2ede7654fe2bdd6
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/row-index-1-based.xlsxbin0 -> 6237 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx39
2 files changed, 39 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/row-index-1-based.xlsx b/sc/qa/unit/data/xlsx/row-index-1-based.xlsx
new file mode 100644
index 000000000000..1f60c3b5e682
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/row-index-1-based.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f22e1e2a2173..66bfb9446e43 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -127,6 +127,12 @@ public:
//change this test file only in excel and not in calc
void testCellValueXLSX();
+ /**
+ * Test importing of xlsx document that previously had its row index off
+ * by one. (fdo#76032)
+ */
+ void testRowIndex1BasedXLSX();
+
//misc tests unrelated to the import filters
void testPasswordNew();
void testPasswordOld();
@@ -195,6 +201,7 @@ public:
CPPUNIT_TEST(testDataTableMultiTableXLSX);
CPPUNIT_TEST(testBrokenQuotesCSV);
CPPUNIT_TEST(testCellValueXLSX);
+ CPPUNIT_TEST(testRowIndex1BasedXLSX);
CPPUNIT_TEST(testControlImport);
CPPUNIT_TEST(testChartImportODS);
@@ -1417,6 +1424,38 @@ void ScFiltersTest::testCellValueXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testRowIndex1BasedXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("row-index-1-based.", XLSX);
+ CPPUNIT_ASSERT(xDocSh.Is());
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ // A1
+ OUString aStr = pDoc->GetString(ScAddress(0,0,0));
+ CPPUNIT_ASSERT_EQUAL(OUString("Action Plan.Name"), aStr);
+
+ // B1
+ aStr = pDoc->GetString(ScAddress(1,0,0));
+ CPPUNIT_ASSERT_EQUAL(OUString("Action Plan.Description"), aStr);
+
+ // A2
+ aStr = pDoc->GetString(ScAddress(0,1,0));
+ CPPUNIT_ASSERT_EQUAL(OUString("Jerry"), aStr);
+
+ // B2 - multi-line text.
+ const EditTextObject* pText = pDoc->GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT(pText);
+ CPPUNIT_ASSERT(pText->GetParagraphCount() == 3);
+ aStr = pText->GetText(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("This is a longer Text."), aStr);
+ aStr = pText->GetText(1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Second line."), aStr);
+ aStr = pText->GetText(2);
+ CPPUNIT_ASSERT_EQUAL(OUString("Third line."), aStr);
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase)
{
OUString aFileExtension(getFileFormats()[0].pName, strlen(getFileFormats()[0].pName), RTL_TEXTENCODING_UTF8 );