diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-06-30 11:42:08 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-06-30 17:09:44 +0200 |
commit | 189086209113a20a36ad43d19e53af6678ff772c (patch) | |
tree | c7d6345af41e8a310a377a04d4ea125a743931e0 /sw | |
parent | 21c0deb19890703a9eaf24403e60c4c7546a0bfe (diff) |
tdf#134021: sw: Add unittest
Change-Id: I789adaf699a857e28416132d253c04128def5984
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97481
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf134021.docx | bin | 0 -> 23096 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 28 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf134021.docx b/sw/qa/extras/uiwriter/data3/tdf134021.docx Binary files differnew file mode 100644 index 000000000000..cda11fbdf3ef --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf134021.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 0f9f3255f990..43f181678833 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -462,6 +462,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134021) +{ + load(DATA_DIRECTORY, "tdf134021.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(12, 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(12, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130746) { load(DATA_DIRECTORY, "tdf130746.odt"); |