summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx43
-rw-r--r--sw/qa/uitest/table/tdf131771.py40
2 files changed, 43 insertions, 40 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();
diff --git a/sw/qa/uitest/table/tdf131771.py b/sw/qa/uitest/table/tdf131771.py
deleted file mode 100644
index 5cbadee63c0e..000000000000
--- a/sw/qa/uitest/table/tdf131771.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import select_pos
-
-# Bug 131771 - Copying+Pasting a table: caused the loss of table style setting.
-
-
-class tdf131771(UITestCase):
- def test_tdf131771(self):
- with self.ui_test.create_doc_in_start_center("writer"):
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- # generate a 2x2 tables with the same autoformat table style (Default Table Style)
- # Note that this style is different than applying nothing!
- with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
- formatlbinstable = xDialog.getChild("formatlbinstable")
- entry = formatlbinstable.getChild("1")
- entry.executeAction("SELECT", tuple())
-
- # select the table
- self.xUITest.executeCommand(".uno:SelectAll")
-
- # copying and pasting the table below
- self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:Paste")
-
- document = self.ui_test.get_component()
- tables = document.getTextTables()
- self.assertEqual(tables[0].TableTemplateName, 'Default Style')
- self.assertEqual(tables[1].TableTemplateName, 'Default Style')
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: