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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 11 12:13:25 UTC 2021


 sc/qa/uitest/autofilter/tdf140754.py       |   84 +++++++++++++++++++++++++++++
 sc/qa/uitest/data/autofilter/tdf140754.ods |binary
 2 files changed, 84 insertions(+)

New commits:
commit feb4067be5d8e40902190dc58a7a634a21102f34
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Mar 10 17:15:06 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Mar 11 13:12:45 2021 +0100

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

diff --git a/sc/qa/uitest/autofilter/tdf140754.py b/sc/qa/uitest/autofilter/tdf140754.py
new file mode 100644
index 000000000000..4d413ac0d85f
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf140754.py
@@ -0,0 +1,84 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+
+class tdf140754(UITestCase):
+
+    def test_tdf140754(self):
+
+        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf140754.ods"))
+
+        #Make sure 'multi-threaded calculation' is enabled
+        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+        xDialogOpt = self.xUITest.getTopFocusWindow()
+
+        xPages = xDialogOpt.getChild("pages")
+        xCalcEntry = xPages.getChild('3')
+        xCalcEntry.executeAction("EXPAND", tuple())
+        xCalcCalculateEntry = xCalcEntry.getChild('3')
+        xCalcCalculateEntry.executeAction("SELECT", tuple())
+
+        self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"])
+
+        xOKBtn = xDialogOpt.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        document = self.ui_test.get_component()
+
+        self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+        self.assertEqual(0, get_cell_by_position(document, 0, 0, 82).getValue())
+        self.assertEqual(1, get_cell_by_position(document, 0, 0, 238).getValue())
+        self.assertEqual(28, get_cell_by_position(document, 0, 0, 265).getValue())
+        self.assertEqual(28, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+
+        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+        xFloatWindow = self.xUITest.getFloatWindow()
+        xAll = xFloatWindow.getChild("toggle_all")
+        xAll.executeAction("CLICK", tuple())
+
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+        xList = xCheckListMenu.getChild("check_list_box")
+        self.assertEqual(25, len(xList.getChildren()))
+
+        # Without the fix in place, this test would have crashed here
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+        self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+        self.assertEqual(1, get_cell_by_position(document, 0, 0, 82).getValue())
+        self.assertEqual(39, get_cell_by_position(document, 0, 0, 238).getValue())
+        self.assertEqual(66, get_cell_by_position(document, 0, 0, 265).getValue())
+        self.assertEqual(282, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"}))
+        xFloatWindow = self.xUITest.getFloatWindow()
+        xAll = xFloatWindow.getChild("toggle_all")
+        xAll.executeAction("CLICK", tuple())
+
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+        xList = xCheckListMenu.getChild("check_list_box")
+        self.assertEqual(10, len(xList.getChildren()))
+
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+        self.assertEqual(1, get_cell_by_position(document, 0, 0, 30).getValue())
+        self.assertEqual(11, get_cell_by_position(document, 0, 0, 82).getValue())
+        self.assertEqual(69, get_cell_by_position(document, 0, 0, 238).getValue())
+        self.assertEqual(96, get_cell_by_position(document, 0, 0, 265).getValue())
+        self.assertEqual(411, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf140754.ods b/sc/qa/uitest/data/autofilter/tdf140754.ods
new file mode 100644
index 000000000000..f3b3923e3451
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf140754.ods differ


More information about the Libreoffice-commits mailing list