sw/qa/extras/uiwriter/data/tdf164621.odt |binary sw/qa/extras/uiwriter/uiwriter3.cxx | 33 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
New commits: commit 4c10a2c4cbab82001e1a3f17afc2fcaaad045f63 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Jan 10 11:27:25 2025 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Jan 10 12:32:24 2025 +0100 tdf#164621: sw_uiwriter3: Add unittest Change-Id: Id1c03461676f1a68e2917c0a5f4c22073a0b7fc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180067 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf164621.odt b/sw/qa/extras/uiwriter/data/tdf164621.odt new file mode 100644 index 000000000000..6bbf70b481a5 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf164621.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index d169f76dbe09..cd903cf2fdcf 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -964,6 +964,39 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128375) } } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf164621) +{ + createSwDoc("tdf164621.odt"); + + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + //Use selectAll 3 times in a row + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + + // Without the fix in place, this test would have crashed here + for (sal_Int32 i = 0; i < 5; ++i) + { + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); + } + + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xIndexAccess->getCount()); + + for (sal_Int32 i = 0; i < 5; ++i) + { + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, u".uno:Undo"_ustr, {}); + } + + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135061) { createSwDoc("tdf135061.odt");