summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx47
-rw-r--r--uitest/writer_tests4/insertTableDialog.py26
2 files changed, 47 insertions, 26 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 49e60f6bc0d9..e5e045dac1b3 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -417,4 +417,51 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf96067)
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf87199)
+{
+ 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(2)) }, { "Columns", uno::makeAny(sal_Int32(1)) } }));
+
+ dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTextTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getRows()->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount());
+
+ uno::Reference<text::XTextRange> xCellA1(xTextTable->getCellByName("A1"), uno::UNO_QUERY);
+ xCellA1->setString("test1");
+
+ uno::Reference<text::XTextRange> xCellA2(xTextTable->getCellByName("A2"), uno::UNO_QUERY);
+ xCellA2->setString("test2");
+
+ dispatchCommand(mxComponent, ".uno:EntireColumn", {});
+ dispatchCommand(mxComponent, ".uno:MergeCells", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getRows()->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount());
+
+ CPPUNIT_ASSERT(xCellA1->getString().endsWith("test2"));
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTextTable->getRows()->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTextTable->getColumns()->getCount());
+
+ xCellA1.set(xTextTable->getCellByName("A1"), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT(xCellA1->getString().endsWith("test1"));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uitest/writer_tests4/insertTableDialog.py b/uitest/writer_tests4/insertTableDialog.py
index 0cb020d19da0..427920e1985c 100644
--- a/uitest/writer_tests4/insertTableDialog.py
+++ b/uitest/writer_tests4/insertTableDialog.py
@@ -62,32 +62,6 @@ class WriterInsertTableDialog(UITestCase):
self.ui_test.close_doc()
- def test_tdf87199(self):
-
- self.insert_table("Test4", 2, 1)
-
- document = self.ui_test.get_component()
- tables = document.getTextTables()
- self.insertTextIntoCell(tables[0], "A1", "test" )
- self.insertTextIntoCell(tables[0], "A2", "test" )
-
- cursor = tables[0].getCellByName( "A1" ).createTextCursor()
-
- self.xUITest.executeCommand(".uno:EntireColumn")
-
- self.xUITest.executeCommand(".uno:MergeCells")
-
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 1)
- self.assertEqual(len(tables[0].getColumns()), 1)
-
- self.xUITest.executeCommand(".uno:Undo")
-
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[0].getColumns()), 1)
-
- self.ui_test.close_doc()
-
def test_cancel_button_insert_table_dialog(self):
self.ui_test.create_doc_in_start_center("writer")
self.ui_test.execute_dialog_through_command(".uno:InsertTable")