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

Kohei Yoshida kohei.yoshida at collabora.com
Mon Dec 1 20:07:11 PST 2014


 sc/qa/unit/data/xlsx/sheet-names.xlsx |binary
 sc/qa/unit/filters-test.cxx           |   18 ++++++++++++++++++
 2 files changed, 18 insertions(+)

New commits:
commit 3b47c8fda324af275aac9e6d237b6da6c8e5ca00
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Dec 1 23:02:38 2014 -0500

    Add test to make sure sheet names with '&' get imported correctly.
    
    Change-Id: Iea7bb77cdbd5f3ba3b658c373b7d4156b2ca6337

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 0000000..97e0488
Binary files /dev/null and b/sc/qa/unit/data/xlsx/sheet-names.xlsx differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index db2ea40..fab94ba 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();


More information about the Libreoffice-commits mailing list