sw/qa/extras/uiwriter/uiwriter3.cxx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
New commits: commit f11df2981356125094e2bda317fd994513f60fb9 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Sun Jun 14 23:57:34 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jun 15 00:56:34 2020 +0200 tdf#121031: sw: Add unittest Change-Id: I64a3098df36d8b6ab3e1b57f9d577413f451fbe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96304 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index b47a7834ce7a..33d4f72ca5c0 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -645,6 +645,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130805) //CPPUNIT_ASSERT_EQUAL_MESSAGE("", xShp->getPosition().Y, xShp2->getPosition().Y); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf121031) +{ + mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence( + { { "Rows", uno::makeAny(sal_Int32(3)) }, { "Columns", uno::makeAny(sal_Int32(3)) } })); + + dispatchCommand(mxComponent, ".uno:InsertTable", aArgs); + Scheduler::ProcessEventsToIdle(); + + 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()); + + dispatchCommand(mxComponent, ".uno:DeleteTable", {}); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); + + // Without the fix in place, the table would be hidden + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/tab", 1); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067) { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits