summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-03-29 15:54:31 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-03-29 18:24:17 +0200
commitad146b4e73c0f661ea05d69fcb9a6af1b85a5fda (patch)
treed5e50d2f9a7f96f7112864d5dba1ac10be2bef61 /sw/qa
parent104275ad81f04307e7f41a1a48b9581569c8e0b6 (diff)
tdf#136778: sw_uiwriter3: Add unittest
Change-Id: I94361102f14b8b40c02419776ae480a917c5d013 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113318 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf136778.docxbin0 -> 11761 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf136778.docx b/sw/qa/extras/uiwriter/data3/tdf136778.docx
new file mode 100644
index 000000000000..d1b6c877c4ed
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf136778.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index cf14ac853264..7a62505b61c0 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1361,6 +1361,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134021)
CPPUNIT_ASSERT_EQUAL(12, getPages());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf136778)
+{
+ load(DATA_DIRECTORY, "tdf136778.docx");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ 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(1, getPages());
+
+ dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+ dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+ // Without the fix in place, it would have crashed here
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf123285)
{
load(DATA_DIRECTORY, "tdf123285.odt");