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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon May 3 15:20:59 UTC 2021


 sc/qa/unit/data/csv/tdf80149.csv      |    3 +++
 sc/qa/unit/subsequent_export-test.cxx |   28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

New commits:
commit 9f89ee7c5076f700589d3b07f3d6a50f9af7d13a
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon May 3 15:43:15 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon May 3 17:20:18 2021 +0200

    tdf#80149: sc_subsequent_export: Add unittest
    
    Change-Id: Ic4a8f50a398a2a87e6850c80dbb9ed7eb70eca68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115041
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/data/csv/tdf80149.csv b/sc/qa/unit/data/csv/tdf80149.csv
new file mode 100644
index 000000000000..0b3f214c2e23
--- /dev/null
+++ b/sc/qa/unit/data/csv/tdf80149.csv
@@ -0,0 +1,3 @@
+"row 1","Character 0x16 is here ->><<--", "File opens in libre office, but can't be saved as xlsx"
+"row 2","Subsequent rows get truncated", "This cell goes missing"
+"row 3","Subsequent rows get truncated", "This cell goes missing"
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 689a93a2e498..b25aae6c4ab4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -185,6 +185,7 @@ public:
 
     void testSupBookVirtualPathXLS();
     void testAbsNamedRangeHTML();
+    void testTdf80149();
     void testSheetLocalRangeNameXLS();
     void testRelativeNamedExpressionsXLS();
     void testSheetTextBoxHyperlinkXLSX();
@@ -375,6 +376,7 @@ public:
     CPPUNIT_TEST(testPreserveTextWhitespaceXLSX);
     CPPUNIT_TEST(testPreserveTextWhitespace2XLSX);
     CPPUNIT_TEST(testAbsNamedRangeHTML);
+    CPPUNIT_TEST(testTdf80149);
     CPPUNIT_TEST(testSheetLocalRangeNameXLS);
     CPPUNIT_TEST(testRelativeNamedExpressionsXLS);
     CPPUNIT_TEST(testSheetTextBoxHyperlinkXLSX);
@@ -3832,6 +3834,32 @@ void ScExportTest::testAbsNamedRangeHTML()
     xDocSh2->DoClose();
 }
 
+void ScExportTest::testTdf80149()
+{
+    ScDocShellRef xDocSh = loadDoc(u"tdf80149.", FORMAT_CSV);
+    xDocSh->DoHardRecalc();
+    ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+    xDocSh->DoClose();
+    xDocSh2->DoHardRecalc();
+
+    ScDocument& rDoc = xDocSh2->GetDocument();
+    CPPUNIT_ASSERT_EQUAL(OUString("row 1"), rDoc.GetString(0, 0, 0));
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Character 0x16 is here ->>_x0016_<<--
+    // - Actual  :
+    CPPUNIT_ASSERT_EQUAL(OUString("Character 0x16 is here ->>_x0016_<<--"), rDoc.GetString(1, 0, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("File opens in libre office, but can't be saved as xlsx"), rDoc.GetString(2, 0, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("row 2"), rDoc.GetString(0, 1, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("Subsequent rows get truncated"), rDoc.GetString(1, 1, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("This cell goes missing"), rDoc.GetString(2, 1, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("row 3"), rDoc.GetString(0, 2, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("Subsequent rows get truncated"), rDoc.GetString(1, 2, 0));
+    CPPUNIT_ASSERT_EQUAL(OUString("This cell goes missing"), rDoc.GetString(2, 2, 0));
+
+    xDocSh2->DoClose();
+}
+
 void ScExportTest::testSheetLocalRangeNameXLS()
 {
     ScDocShellRef xDocSh = loadDoc(u"named-ranges-local.", FORMAT_XLS);


More information about the Libreoffice-commits mailing list