[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 6 08:35:45 UTC 2020


 sw/qa/extras/uiwriter/uiwriter3.cxx |   53 ++++++++++++++++++++++++++++++++++++
 sw/qa/uitest/table/tdf117601.py     |   48 --------------------------------
 2 files changed, 53 insertions(+), 48 deletions(-)

New commits:
commit 0da05130dab54fc29ed51a62ad95d13d063e2519
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Apr 3 12:41:05 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Apr 6 10:35:09 2020 +0200

    tdf#117601: move UItest to CppunitTest
    
    Change-Id: Ie326ce5c6b743248e1458b592b31d3a1c322ac49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91660
    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 e5e045dac1b3..7b35f1a85c83 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -464,4 +464,57 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf87199)
 
     CPPUNIT_ASSERT(xCellA1->getString().endsWith("test1"));
 }
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf117601)
+{
+    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(5)) }, { "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);
+    uno::Reference<text::XTextTable> xTextTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTextTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+    uno::Reference<text::XTextRange> xCellB1(xTextTable->getCellByName("B1"), uno::UNO_QUERY);
+    xCellB1->setString("test1");
+
+    uno::Reference<text::XTextRange> xCellB2(xTextTable->getCellByName("B2"), uno::UNO_QUERY);
+    xCellB2->setString("test2");
+
+    //go to middle row
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_UP);
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:EntireColumn", {});
+    dispatchCommand(mxComponent, ".uno:MergeCells", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTextTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+    CPPUNIT_ASSERT(xCellB1->getString().endsWith("test2"));
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTextTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTextTable->getColumns()->getCount());
+
+    CPPUNIT_ASSERT(xCellB1->getString().endsWith("test1"));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/uitest/table/tdf117601.py b/sw/qa/uitest/table/tdf117601.py
deleted file mode 100644
index 7c70f16a6e5e..000000000000
--- a/sw/qa/uitest/table/tdf117601.py
+++ /dev/null
@@ -1,48 +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 libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.debug import sleep
-#Bug 117601 - Crash in: libstdc++.so.6.0.22 on merge cells in writer with TDF .debs on Debian 9
-
-class tdf117601(UITestCase):
-
-    def test_tdf117601_merge_middle_column(self):
-
-        self.ui_test.create_doc_in_start_center("writer")
-        xWriterDoc = self.xUITest.getTopFocusWindow()
-        xWriterEdit = xWriterDoc.getChild("writer_edit")
-        document = self.ui_test.get_component()
-        #* open Writer
-        #* create table 3x5
-        #* merge the middle row
-        #--> crash
-        self.ui_test.execute_dialog_through_command(".uno:InsertTable")
-        xDialog = self.xUITest.getTopFocusWindow()
-
-        column = xDialog.getChild("colspin")
-        column.executeAction("UP", tuple())
-        row = xDialog.getChild("rowspin")
-        row.executeAction("UP", tuple())
-        row.executeAction("UP", tuple())
-        row.executeAction("UP", tuple())
-        xOkBtn = xDialog.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
-
-        self.assertEqual(document.TextTables.getCount(), 1)
-        #go to middle row
-        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
-        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
-        #Table - Select Column .uno:EntireColumn
-        self.xUITest.executeCommand(".uno:EntireColumn")
-        #merge
-        self.xUITest.executeCommand(".uno:MergeCells")
-        self.assertEqual(document.TextTables.getCount(), 1)
-
-        self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list