summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-10-27 09:55:32 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-10-27 11:54:00 +0200
commit0d4f6177c76ac2a55b469fd82282ecf4e878c21e (patch)
tree230337fe215df197d5f262ee173a047e53da2071 /sw/qa/extras
parent380b9a819a29a8aa0525632065006f4bd026cf96 (diff)
tdf#131771: sw: Move UItest to CppUnittest
Change-Id: Ic24218bee76ed9b8df3169bd8e2ede6a91689770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124252 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 8c22759ca415..3315fc897907 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1831,6 +1831,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133358)
CPPUNIT_ASSERT_EQUAL(sal_Int32(1251), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131771)
+{
+ createSwDoc();
+
+ uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
+ { { "Rows", uno::makeAny(sal_Int32(2)) }, { "Columns", uno::makeAny(sal_Int32(2)) } }));
+
+ 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());
+
+ uno::Reference<text::XTextTable> xTextTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xTextTable, "TableTemplateName"));
+ uno::Reference<beans::XPropertySet> xTableProps(xTextTable, uno::UNO_QUERY_THROW);
+ xTableProps->setPropertyValue("TableTemplateName", uno::makeAny(OUString("Default Style")));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Default Style"),
+ getProperty<OUString>(xTextTable, "TableTemplateName"));
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+ dispatchCommand(mxComponent, ".uno:GoDown", {});
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Default Style"),
+ getProperty<OUString>(xTextTable, "TableTemplateName"));
+
+ uno::Reference<text::XTextTable> xTextTable2(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: Default Style
+ // - Actual :
+ CPPUNIT_ASSERT_EQUAL(OUString("Default Style"),
+ getProperty<OUString>(xTextTable2, "TableTemplateName"));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf80663)
{
createSwDoc();