Add test to make sure sheet names with '&' get imported correctly.

Change-Id: Iea7bb77cdbd5f3ba3b658c373b7d4156b2ca6337
This commit is contained in:
Kohei Yoshida
2014-12-01 23:02:38 -05:00
parent 285cd8301c
commit 3b47c8fda3
2 changed files with 18 additions and 0 deletions

Binary file not shown.

View File

@@ -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();