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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 18 14:13:43 UTC 2021


 sc/qa/uitest/data/tdf57465.ods |binary
 sc/qa/uitest/sort/tdf57465.py  |   54 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

New commits:
commit fd745457be6371794ca8178631ecb3523c9474cd
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Feb 18 12:34:02 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Feb 18 15:12:52 2021 +0100

    tdf#57465: sc: Add UItest
    
    Change-Id: I600ee7a628087fb35903c34793f5eb1b48eee971
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111114
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/data/tdf57465.ods b/sc/qa/uitest/data/tdf57465.ods
new file mode 100644
index 000000000000..0c4215d81605
Binary files /dev/null and b/sc/qa/uitest/data/tdf57465.ods differ
diff --git a/sc/qa/uitest/sort/tdf57465.py b/sc/qa/uitest/sort/tdf57465.py
new file mode 100644
index 000000000000..9f03d09fa798
--- /dev/null
+++ b/sc/qa/uitest/sort/tdf57465.py
@@ -0,0 +1,54 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import select_pos
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf57465(UITestCase):
+
+    def test_tdf57465(self):
+        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57465.ods"))
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:G4"}))
+
+        self.ui_test.execute_dialog_through_command(".uno:DataSort")
+        xDialog = self.xUITest.getTopFocusWindow()
+        xTabs = xDialog.getChild("tabcontrol")
+        select_pos(xTabs, "1")
+
+        xHeader = xDialog.getChild("header")
+        if (get_state_as_dict(xHeader)["Selected"]) == 'true':
+            xHeader.executeAction("CLICK", tuple())
+
+        xLeftRight = xDialog.getChild("leftright")
+        xLeftRight.executeAction("CLICK", tuple())
+
+        select_pos(xTabs, "0")
+
+        self.assertEqual("Row 1", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
+
+        xOk = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOk)
+
+        self.assertEqual("a", get_cell_by_position(document, 0, 1, 1).getString())
+
+        # Without the fix in place, this test would have failed with
+        # AssertionError: 'b' != ''
+        self.assertEqual("b", get_cell_by_position(document, 0, 2, 2).getString())
+        self.assertEqual("c", get_cell_by_position(document, 0, 3, 3).getString())
+        self.assertEqual("d", get_cell_by_position(document, 0, 4, 1).getString())
+        self.assertEqual("e", get_cell_by_position(document, 0, 5, 2).getString())
+        self.assertEqual("f", get_cell_by_position(document, 0, 6, 3).getString())
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list