sc/qa/uitest/autofilter/autofilter.py |   66 ++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

New commits:
commit 90307f1cb30dd1d2e0ec5f19104cbf1515616537
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Nov 16 12:39:04 2020 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Nov 16 15:35:49 2020 +0100

    uitest: autofilter: add test for different searches
    
    Motivated by https://bugs.documentfoundation.org/show_bug.cgi?id=122419#c21
    
    Change-Id: I2086ed604c50b513019c7023ad4c01df9c5edb4a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105925
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/autofilter/autofilter.py 
b/sc/qa/uitest/autofilter/autofilter.py
index a97a9fe1f3db..78a5887a6c4c 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -9,6 +9,7 @@ from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_row
+from uitest.uihelper.calc import enter_text_to_cell
 import org.libreoffice.unotest
 import pathlib
 
@@ -140,4 +141,69 @@ class AutofilterTest(UITestCase):
 
         self.ui_test.close_doc()
 
+    def test_differentSearches(self):
+        self.ui_test.create_doc_in_start_center("calc")
+        document = self.ui_test.get_component()
+        calcDoc = self.xUITest.getTopFocusWindow()
+
+        xGridWindow = calcDoc.getChild("grid_window")
+        enter_text_to_cell(xGridWindow, "A1", "X")
+        enter_text_to_cell(xGridWindow, "A2", "11")
+        enter_text_to_cell(xGridWindow, "A3", "22")
+        xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:A3"}))
+
+        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+
+        xFloatWindow = self.xUITest.getFloatWindow()
+
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+
+        xList = xCheckListMenu.getChild("check_list_box")
+
+        self.assertEqual(2, len(xList.getChildren()))
+        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+        self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
+
+        xSearchEdit = xFloatWindow.getChild("search_edit")
+        xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"}))
+
+        self.assertEqual(1, len(xList.getChildren()))
+        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+        self.assertFalse(is_row_hidden(document, 0))
+        self.assertFalse(is_row_hidden(document, 1))
+        self.assertTrue(is_row_hidden(document, 2))
+
+        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+
+        xFloatWindow = self.xUITest.getFloatWindow()
+
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+
+        xList = xCheckListMenu.getChild("check_list_box")
+
+        self.assertEqual(2, len(xList.getChildren()))
+        self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
+        self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text'])
+
+        xSearchEdit = xFloatWindow.getChild("search_edit")
+        xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"}))
+
+        self.assertEqual(1, len(xList.getChildren()))
+        self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text'])
+
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+
+        self.assertFalse(is_row_hidden(document, 0))
+        self.assertTrue(is_row_hidden(document, 1))
+        self.assertFalse(is_row_hidden(document, 2))
+
+        self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to