diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-31 16:47:56 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-27 17:32:28 +0100 |
commit | 49307ae2cef2d2d43fee92f99809d2bf192343de (patch) | |
tree | 6b0fd2ecbe5c80744b4f0c229e15e96ecb557547 | |
parent | bc3d663ac83c59ccc6850277e0a00a9ab4881724 (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>
(cherry picked from commit 99284a22f3cda8518cd2207128928c2e455c89ee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104825
Tested-by: Michael Stahl <michael.stahl@cib.de>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/qa/extras/uiwriter/data/tdf134931.odt | bin | 0 -> 9962 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf134931.odt b/sw/qa/extras/uiwriter/data/tdf134931.odt Binary files differnew file mode 100644 index 000000000000..bfd1ccf2e561 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf134931.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f3f43f193310..43abc73da811 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -4526,6 +4526,41 @@ void SwUiWriterTest::testTdf88986() CPPUNIT_ASSERT(aSet.HasItem(SID_COLOR_TABLE)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, 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()); + + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:Copy", {}); + Scheduler::ProcessEventsToIdle(); + + lcl_dispatchCommand(mxComponent, ".uno:GoDown", {}); + + for (sal_Int32 i = 0; i < 10; ++i) + { + lcl_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()); +} + void SwUiWriterTest::testTdf87922() { // Create an SwDrawTextInfo. |