summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter/uiwriter6.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-05-19 14:01:02 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-05-20 13:31:21 +0200
commit075ecc1c31199d0fd0f930cf1b803b04a3b17ce8 (patch)
treee34866de1da909795b8a6a54b7ac679b11857c58 /sw/qa/extras/uiwriter/uiwriter6.cxx
parentf692b5c5e4e9c57fb69d0054c654486a737d19bd (diff)
tdf#155407: fix the second replacement in FnChgToEnEmDash
It was broken from the beginning. The second replacement could look into a wrong string when checking if the characters around the "--" are eligible; it could use obsolete indices in the document, ignoring the previous replacement that changed the lendth of the text. This also replaces a use of char* to hold Unicode codepoints to pass to lcl_IsInAsciiArr, with an array of sal_Unicode (because all the checked values fit into it). Change-Id: I949630abc564fc0875be0b92228846497bb1a022 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152002 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter6.cxx')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter6.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 9a3777fcc103..eb770a05682f 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2525,6 +2525,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf146178)
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pCursor->GetPoint()->GetContentIndex());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf155407)
+{
+ createSwDoc();
+ SwXTextDocument& rTextDoc = dynamic_cast<SwXTextDocument&>(*mxComponent);
+
+ {
+ emulateTyping(rTextDoc, u"Foo - 11’--’22 ");
+ // Without the fix in place, this would fail with
+ // - Expected: Foo – 11’—’22
+ // - Actual : Foo – 11’--’22
+ CPPUNIT_ASSERT_EQUAL(OUString(u"Foo – 11’—’22 "), getParagraph(1)->getString());
+ }
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {}); // start again
+
+ {
+ emulateTyping(rTextDoc, u"Bar -- 111--222 ");
+ // Without the fix in place, this would fail with
+ // - Expected: Bar – 111–222
+ // - Actual : Bar – 111-–22
+ CPPUNIT_ASSERT_EQUAL(OUString(u"Bar – 111–222 "), getParagraph(1)->getString());
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */