summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-12-22 16:15:20 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-23 12:15:26 +0100
commit6dfbfe58ca6d0ebc3de6e57a44baacfef6e43c07 (patch)
treecbe6bd9323b3578a08497f198c027aa633cc1c91
parenttdf#146363: fix crash when changing width/height of text box (diff)
downloadcore-6dfbfe58ca6d0ebc3de6e57a44baacfef6e43c07.tar.gz
core-6dfbfe58ca6d0ebc3de6e57a44baacfef6e43c07.zip
tdf#135061: sw_uiwriter3: Add unittest
Change-Id: Ied2ae576810a9f66e51883375959d372af59abe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127326 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 22f3f806abc0ef3ef02cd6733bdb3f950085dd17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127264
-rw-r--r--sw/qa/extras/uiwriter/data/tdf135061.odtbin0 -> 10767 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx36
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf135061.odt b/sw/qa/extras/uiwriter/data/tdf135061.odt
new file mode 100644
index 000000000000..19b3afa31e47
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf135061.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index b536692fc5a6..4830a91ed8f0 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -188,6 +188,42 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf138482)
CPPUNIT_ASSERT_EQUAL(2, getShapes());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135061)
+{
+ createSwDoc(DATA_DIRECTORY, "tdf135061.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());
+ CPPUNIT_ASSERT_EQUAL(4, getShapes());
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+ Scheduler::ProcessEventsToIdle();
+
+ for (sal_Int32 i = 0; i < 5; ++i)
+ {
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+ Scheduler::ProcessEventsToIdle();
+ }
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(20, getShapes());
+
+ for (sal_Int32 i = 0; i < 5; ++i)
+ {
+ // Without the fix in place, this test would have crashed here
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+ }
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(4, getShapes());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132911)
{
SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf132911.odt");