diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-31 16:47:56 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-31 23:08:54 +0200 |
commit | 99284a22f3cda8518cd2207128928c2e455c89ee (patch) | |
tree | 2af1fd4089747325b2da94272e6063b089bfd519 /sw | |
parent | df33c7a0747210b30ca1870877cc06c3fc1c4328 (diff) |
tdf#134931: sw_uiwriter: Add unittest
Change-Id: I737296f1a0646065288be2cb0be3ef7f939fb536
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99878
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf134931.odt | bin | 0 -> 9962 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf134931.odt b/sw/qa/extras/uiwriter/data3/tdf134931.odt Binary files differnew file mode 100644 index 000000000000..bfd1ccf2e561 --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf134931.odt diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index df2567abe7dd..8336544274b4 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -802,6 +802,41 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132944) CPPUNIT_ASSERT_EQUAL(1, getPages()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134931) +{ + load(DATA_DIRECTORY, "tdf134931.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(1), xIndexAccess->getCount()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); + + dispatchCommand(mxComponent, ".uno:GoDown", {}); + + for (sal_Int32 i = 0; i < 10; ++i) + { + dispatchCommand(mxComponent, ".uno:Paste", {}); + Scheduler::ProcessEventsToIdle(); + } + + CPPUNIT_ASSERT_EQUAL(sal_Int32(11), xIndexAccess->getCount()); + + // Without the fix in place, this test would have failed with: + // - Expected: 4 + // - Actual : 1 + // Because the tables are pasted but not displayed + + CPPUNIT_ASSERT_EQUAL(4, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680) { load(DATA_DIRECTORY, "tdf130680.odt"); |