sc/qa/uitest/autofilter2/tdf158440.py      |   52 +++++++++++++++++++++++++++++
 sc/qa/uitest/data/autofilter/tdf158440.ods |binary
 2 files changed, 52 insertions(+)

New commits:
commit cca29491a338cb7d43c373107bb73822e1d4e4a4
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Feb 12 12:16:29 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Feb 12 14:10:44 2024 +0100

    tdf#158440: sc: Add UItest
    
    Based on 
https://gerrit.libreoffice.org/c/core/+/163021/comments/ff5eb7d3_2426919e
    
    Change-Id: I579dce86775599dc215395b93b15bc9a2f510cb1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163243
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/autofilter2/tdf158440.py 
b/sc/qa/uitest/autofilter2/tdf158440.py
new file mode 100644
index 000000000000..df0b17c6706e
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf158440.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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 tdf158440(UITestCase):
+
+    def test_tdf158440(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf158440.ods")) as 
calc_doc:
+
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+
+            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+            xAll = xFloatWindow.getChild("toggle_all")
+            xAll.executeAction("CLICK", tuple())
+
+            xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+            xList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(529, len(xList.getChildren()))
+
+            xFirstEntry = xList.getChild("1")
+            xFirstEntry.executeAction("CLICK", tuple())
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+            gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+
+            self.assertEqual("111", get_state_as_dict(gridwin)["CurrentRow"])
+            self.assertEqual("0", get_state_as_dict(gridwin)["CurrentColumn"])
+
+            gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: '535' != '111'
+            self.assertEqual("535", get_state_as_dict(gridwin)["CurrentRow"])
+            self.assertEqual("0", get_state_as_dict(gridwin)["CurrentColumn"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf158440.ods 
b/sc/qa/uitest/data/autofilter/tdf158440.ods
new file mode 100644
index 000000000000..128b876a6526
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf158440.ods differ

Reply via email to