diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-01 12:52:40 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-01 15:44:45 +0200 |
commit | 6f9d03561f069cf563874515a7412e125c2b26de (patch) | |
tree | 9857d9d98680bed7f2f8fad4225bdbc1a073f7f6 /sw | |
parent | c131d6c6b935617fa84286a9e441c1c791520445 (diff) |
tdf#126504: sw: Add unittest
Change-Id: Iceca8bc3ae2dcad04040498565200361157f83e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97613
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf126504.odt | bin | 0 -> 9266 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf126504.odt b/sw/qa/extras/uiwriter/data3/tdf126504.odt Binary files differnew file mode 100644 index 000000000000..3f09230f21d5 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf126504.odt diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index db45c779d04e..d7f20d6bd21a 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -238,6 +238,53 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133990) CPPUNIT_ASSERT_EQUAL(1, getPages()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126504) +{ + load(DATA_DIRECTORY, "tdf126504.odt"); + + 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(2), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + //Use selectAll 2 times in a row + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Copy", {}); + dispatchCommand(mxComponent, ".uno:GoToEndOfPage", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + dispatchCommand(mxComponent, ".uno:Redo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), 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(2), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982) { load(DATA_DIRECTORY, "tdf133982.docx"); |