summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-06-14 23:57:34 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-06-15 00:56:34 +0200
commitf11df2981356125094e2bda317fd994513f60fb9 (patch)
tree94ef4ac6f89aea27abbc9f2722b063ab858149b4 /sw/qa
parent5cce65171b12cd652d6a9857a9c0bad1c608a65c (diff)
tdf#121031: sw: Add unittest
Change-Id: I64a3098df36d8b6ab3e1b57f9d577413f451fbe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96304 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx31
1 files changed, 31 insertions, 0 deletions
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");