[Libreoffice-commits] core.git: sw/qa uitest/writer_tests4
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 4 09:11:37 UTC 2020
sw/qa/extras/uiwriter/uiwriter3.cxx | 47 ++++++++++++++++++++++++++++++
uitest/writer_tests4/insertTableDialog.py | 26 ----------------
2 files changed, 47 insertions(+), 26 deletions(-)
New commits:
commit a03b83c362ffa36fdae5befd04c391aa532cc46e
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Apr 3 20:35:52 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Sat Apr 4 11:11:05 2020 +0200
tdf#87199: move UItest to CppunitTest
Change-Id: I3a07a8e6fe6e37d55de6069082b32d84c0450177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91659
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
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")
More information about the Libreoffice-commits
mailing list