From d8ac6ba98674652bd0ca317da4a0606da5adce85 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 24 Nov 2021 13:55:57 +0100 Subject: td#f145621: sw_uiwriter3: Add unittest Change-Id: I5f9584309c7ad42f43110d11d6fb3d34d8fb9898 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125770 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/qa/extras/uiwriter/data/tdf145621.odt | Bin 0 -> 9238 bytes sw/qa/extras/uiwriter/uiwriter3.cxx | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 sw/qa/extras/uiwriter/data/tdf145621.odt (limited to 'sw') diff --git a/sw/qa/extras/uiwriter/data/tdf145621.odt b/sw/qa/extras/uiwriter/data/tdf145621.odt new file mode 100644 index 000000000000..d3ff8650ee89 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf145621.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 479bf9e990bf..80874d041267 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -2184,6 +2184,24 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf121546) CPPUNIT_ASSERT_EQUAL(2, getParagraphs()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145621) +{ + createSwDoc(DATA_DIRECTORY, "tdf145621.odt"); + + CPPUNIT_ASSERT_EQUAL(OUString("AAAAAA"), getParagraph(1)->getString()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Cut", {}); + + CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString()); + + // Without the fix in place, this test would have crashed + dispatchCommand(mxComponent, ".uno:Paste", {}); + + CPPUNIT_ASSERT_EQUAL(OUString("AAAAAA"), getParagraph(1)->getString()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134626) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf134626.odt"); -- cgit