summaryrefslogtreecommitdiffstats
path: root/sw/qa/extras/unowriter/unowriter.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
commite3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch)
tree3c1753125149dcf36ba42a57f1574369e8524225 /sw/qa/extras/unowriter/unowriter.cxx
parentAdding debian version 4:24.2.2-3. (diff)
downloadlibreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz
libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/extras/unowriter/unowriter.cxx')
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 8bcadbaf42..80b9e556f7 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -1201,6 +1201,27 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf129841)
CPPUNIT_ASSERT_EQUAL(aRefColor, aColor);
}
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf160278)
+{
+ createSwDoc();
+ auto xTextDocument(mxComponent.queryThrow<css::text::XTextDocument>());
+ auto xText(xTextDocument->getText());
+ xText->setString(u"123"_ustr);
+ CPPUNIT_ASSERT_EQUAL(u"123"_ustr, xText->getString());
+ auto xCursor = xText->createTextCursorByRange(xText->getEnd());
+ xCursor->goLeft(1, true);
+ CPPUNIT_ASSERT_EQUAL(u"3"_ustr, xCursor->getString());
+ // Insert an SMP character U+1f702 (so it's two UTF-16 code units, 0xd83d 0xdf02):
+ xCursor->setString(u"🜂"_ustr);
+ // Without the fix, the replacement would expand the cursor one too many characters to the left,
+ // and the cursor text would become "2🜂", failing the next test:
+ CPPUNIT_ASSERT_EQUAL(u"🜂"_ustr, xCursor->getString());
+ xCursor->setString(u"test"_ustr);
+ CPPUNIT_ASSERT_EQUAL(u"test"_ustr, xCursor->getString());
+ // This test would fail, too; the text would be "1test":
+ CPPUNIT_ASSERT_EQUAL(u"12test"_ustr, xText->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */