summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-13 08:49:27 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-04-03 08:43:06 +0200
commit56ae7d01505fdae421109cfc78449230ba589d79 (patch)
treed4bde0406a42efeb74e55580e425b1cd2813d1da /sc/qa
parentd36145d7cf6ca4d6072d4ab0a709bb8fe866336c (diff)
tdf#89920 - Handle embedded newline in Calc's search cell
If the replaced string contains a newline after find and replace, insert an edit cell in order to handle an embedded line correctly regardless of the content in the source cell. Change-Id: Ic8a5fc80b85546897572a228511b319cd5a8b9aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148752 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/macros-test.cxx26
-rw-r--r--sc/qa/extras/testdocuments/tdf89920.odsbin0 -> 11183 bytes
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index a77147504ae4..ec41a2fbe4a9 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -279,6 +279,32 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf142033)
CPPUNIT_ASSERT_EQUAL(OUString(u"string with" + OUStringChar(u'\xA') + u"newlines"), rDoc.GetString(ScAddress(1,1,0)));
}
+CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf89920)
+{
+ loadFromURL(u"tdf89920.ods");
+
+ executeMacro("vnd.sun.Star.script:Standard.Module1.SearchAndReplaceNewline?language=Basic&"
+ "location=document");
+
+ // Export to ODS
+ saveAndReload("calc8");
+
+ xmlDocUniquePtr pContentXml = parseExport("content.xml");
+ CPPUNIT_ASSERT(pContentXml);
+
+ assertXPathContent(pContentXml,
+ "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
+ "table:table-row[1]/table:table-cell[1]/text:p[1]",
+ "aa bb");
+
+ // Without the fix in place, this test would have failed here with
+ // - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0
+ assertXPathContent(pContentXml,
+ "/office:document-content/office:body/office:spreadsheet/table:table[1]/"
+ "table:table-row[1]/table:table-cell[1]/text:p[2]",
+ "cc dd");
+}
+
CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedUnicodeString)
{
const OUString sCorrectString(u"English Русский 中文");
diff --git a/sc/qa/extras/testdocuments/tdf89920.ods b/sc/qa/extras/testdocuments/tdf89920.ods
new file mode 100644
index 000000000000..216a5cc75d9d
--- /dev/null
+++ b/sc/qa/extras/testdocuments/tdf89920.ods
Binary files differ