summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-12-01 23:02:38 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-12-01 23:07:02 -0500
commit7f90730aa55d011716c8115af6fe8198358b06e5 (patch)
treeaff97846463869c84a4da5cdec286033a4652108 /sc
parentae8e24c9e90aaf5a3c4ad3c95a9a23048e63bcd1 (diff)
Add test to make sure sheet names with '&' get imported correctly.
Change-Id: Iea7bb77cdbd5f3ba3b658c373b7d4156b2ca6337 (cherry picked from commit 3b47c8fda324af275aac9e6d237b6da6c8e5ca00)
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/sheet-names.xlsxbin0 -> 9425 bytes
-rw-r--r--sc/qa/unit/filters-test.cxx18
2 files changed, 18 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/sheet-names.xlsx b/sc/qa/unit/data/xlsx/sheet-names.xlsx
new file mode 100644
index 000000000000..97e0488f4374
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/sheet-names.xlsx
Binary files differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index db2ea40a736a..fab94ba40af9 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -75,6 +75,7 @@ public:
//void testContentXLS_XML();
void testSharedFormulaXLS();
void testSharedFormulaXLSX();
+ void testSheetNamesXLSX();
void testLegacyCellAnchoredRotatedShape();
void testEnhancedProtectionXLS();
void testEnhancedProtectionXLSX();
@@ -95,6 +96,7 @@ public:
//CPPUNIT_TEST(testContentXLS_XML);
CPPUNIT_TEST(testSharedFormulaXLS);
CPPUNIT_TEST(testSharedFormulaXLSX);
+ CPPUNIT_TEST(testSheetNamesXLSX);
CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape);
CPPUNIT_TEST(testEnhancedProtectionXLS);
CPPUNIT_TEST(testEnhancedProtectionXLSX);
@@ -402,6 +404,22 @@ void ScFiltersTest::testSharedFormulaXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testSheetNamesXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("sheet-names.", XLSX);
+ ScDocument& rDoc = xDocSh->GetDocument();
+
+ std::vector<OUString> aTabNames = rDoc.GetAllTableNames();
+ CPPUNIT_ASSERT_MESSAGE("The document should have 5 sheets in total.", aTabNames.size() == 5);
+ CPPUNIT_ASSERT_EQUAL(OUString("S&P"), aTabNames[0]);
+ CPPUNIT_ASSERT_EQUAL(OUString("Sam's Club"), aTabNames[1]);
+ CPPUNIT_ASSERT_EQUAL(OUString("\"The Sheet\""), aTabNames[2]);
+ CPPUNIT_ASSERT_EQUAL(OUString("A<B"), aTabNames[3]);
+ CPPUNIT_ASSERT_EQUAL(OUString("C>D"), aTabNames[4]);
+
+ xDocSh->DoClose();
+}
+
void impl_testLegacyCellAnchoredRotatedShape( ScDocument& rDoc, Rectangle& aRect, ScDrawObjData& aAnchor, long TOLERANCE = 30 /* 30 hmm */ )
{
ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();