summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-05 14:17:07 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-05 16:53:20 +0200
commitbdad6055eb32fa6e7ee9e43cf1a54edbd2318fcd (patch)
treee3dc4dde9cb69752f36d82fc17947908c74ea828
parente855481ead996a3b8270fae91bd23d6c8d75ef25 (diff)
tdf#153972: sc: Add UItest
Change-Id: I7479be100d2c0abd9484a4095b3b2acf958beffd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152616 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/qa/uitest/autofilter2/tdf153972.py60
-rw-r--r--sc/qa/uitest/data/autofilter/tdf153972.odsbin0 -> 10491 bytes
2 files changed, 60 insertions, 0 deletions
diff --git a/sc/qa/uitest/autofilter2/tdf153972.py b/sc/qa/uitest/autofilter2/tdf153972.py
new file mode 100644
index 000000000000..1697300c95a4
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf153972.py
@@ -0,0 +1,60 @@
+# -*- 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_url_for_data_file, get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position, is_row_hidden
+
+class tdf153972(UITestCase):
+ def test_tdf153972(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf153972.ods")) as doc:
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = calcDoc.getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xMenu = xFloatWindow.getChild("menu")
+
+ # Filter by Color
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ xSubFloatWindow = self.xUITest.getFloatWindow()
+ xSubMenu = xSubFloatWindow.getChild("background")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 4 != 0
+ self.assertEqual(4, len(xSubMenu.getChildren()))
+ self.assertEqual('Lime', get_state_as_dict(xSubMenu.getChild('0'))['Text'])
+ self.assertEqual('Red', get_state_as_dict(xSubMenu.getChild('1'))['Text'])
+ self.assertEqual('Yellow', get_state_as_dict(xSubMenu.getChild('2'))['Text'])
+ self.assertEqual('No Fill', get_state_as_dict(xSubMenu.getChild('3'))['Text'])
+
+ # Choose Red
+ xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ self.assertTrue(is_row_hidden(doc, 1))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertTrue(is_row_hidden(doc, 4))
+ self.assertTrue(is_row_hidden(doc, 5))
+ self.assertFalse(is_row_hidden(doc, 6))
+ self.assertTrue(is_row_hidden(doc, 7))
+ self.assertTrue(is_row_hidden(doc, 8))
+ self.assertFalse(is_row_hidden(doc, 9))
+ self.assertTrue(is_row_hidden(doc, 10))
+ self.assertFalse(is_row_hidden(doc, 11))
+ self.assertTrue(is_row_hidden(doc, 12))
+ self.assertFalse(is_row_hidden(doc, 13))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf153972.ods b/sc/qa/uitest/data/autofilter/tdf153972.ods
new file mode 100644
index 000000000000..e720419bda2e
--- /dev/null
+++ b/sc/qa/uitest/data/autofilter/tdf153972.ods
Binary files differ