sc/qa/unit/data/ods/tdf75702_textLineBreak.ods |binary
 sc/qa/unit/subsequent_export_test2.cxx         |   21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 60585bb65330ad703b5683aece1564dfc6301436
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Sep 19 10:57:41 2022 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Sep 19 21:10:39 2022 +0200

    tdf#75702 sc: unit test for preserving text:line-break
    
    Change-Id: Id61e46ba4e0b3e2b534cf9f8bafe03fba10cd355
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140182
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods 
b/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods
new file mode 100644
index 000000000000..b2e47b8f6ff6
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf75702_textLineBreak.ods 
differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index b722137934fa..7bbb908a96fb 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -125,6 +125,7 @@ public:
     void testTdf91634XLSX();
     void testTdf115159();
     void testTdf112567();
+    void testTdf75702();
     void testTdf103829();
     void testTdf122191();
     void testTdf142881();
@@ -249,6 +250,7 @@ public:
     CPPUNIT_TEST(testTdf91634XLSX);
     CPPUNIT_TEST(testTdf115159);
     CPPUNIT_TEST(testTdf112567);
+    CPPUNIT_TEST(testTdf75702);
     CPPUNIT_TEST(testTdf103829);
     CPPUNIT_TEST(testTdf122191);
     CPPUNIT_TEST(testTdf142881);
@@ -1439,6 +1441,24 @@ void ScExportTest2::testTdf112567()
     xDocSh->DoClose();
 }
 
+void ScExportTest2::testTdf75702()
+{
+    // The problem was that line breaks were not imported.
+    const OUString sA1("line1\nline2");
+
+    ScDocShellRef xShell = loadDoc(u"tdf75702_textLineBreak.", FORMAT_ODS);
+    ScDocument& rDoc = xShell->GetDocument();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("load a1", sA1, rDoc.GetString(0, 0, 0));
+
+    xShell = saveAndReload(*xShell, FORMAT_ODS);
+    ScDocument& rDoc2 = xShell->GetDocument();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0));
+
+    xmlDocUniquePtr pContent
+        = XPathHelper::parseExport2(*this, *xShell, m_xSFactory, 
"content.xml", FORMAT_ODS);
+    assertXPath(pContent, 
"//table:table-row[1]/table:table-cell/text:p/text:line-break");
+}
+
 void ScExportTest2::testTdf103829()
 {
     // The problem was that tabspaces were not imported or exported at all.
@@ -1453,7 +1473,6 @@ void ScExportTest2::testTdf103829()
 
     xShell = saveAndReload(*xShell, FORMAT_ODS);
     ScDocument& rDoc2 = xShell->GetDocument();
-    //CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1.getLength(), 
rDoc2.GetString(0, 0, 0).getLength());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a1", sA1, rDoc2.GetString(0, 0, 0));
     CPPUNIT_ASSERT_EQUAL_MESSAGE("reload a2", sA2, rDoc2.GetString(0, 1, 0));
 }

Reply via email to