sc/qa/uitest/autofilter/tdf46184.py |  116 ++++++++++++++++++------------------
 1 file changed, 59 insertions(+), 57 deletions(-)

New commits:
commit 8e591181f24df34e7d4fdf4097355eac01139336
Author:     Thorsten Behrens <[email protected]>
AuthorDate: Mon Nov 1 18:35:18 2021 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Mon Nov 1 22:16:34 2021 +0100

    Fix uitest for tdf#46184 sc AutoFilter: reset filter options
    
    Some newer functions not available on this branch
    
    Change-Id: Idb60ef42c71aff74e716c76fb8da81200ea2e13e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124562
    Tested-by: Thorsten Behrens <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/sc/qa/uitest/autofilter/tdf46184.py 
b/sc/qa/uitest/autofilter/tdf46184.py
index 08dfc520b640..73605e29e151 100755
--- a/sc/qa/uitest/autofilter/tdf46184.py
+++ b/sc/qa/uitest/autofilter/tdf46184.py
@@ -6,79 +6,81 @@
 #
 from uitest.framework import UITestCase
 from uitest.uihelper.calc import enter_text_to_cell
-from uitest.uihelper.common import select_by_text, get_state_as_dict
+from uitest.uihelper.common import get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_row
+from time import sleep
 
 #Bug 46184 - [Calc] [AutoFilter] Option "Copy results to ..." remains 
activated in AutoFilter
 
 class tdf46184(UITestCase):
     def test_tdf46184_copy_results_to(self):
-        with self.ui_test.create_doc_in_start_center("calc") as document:
-            calcDoc = self.xUITest.getTopFocusWindow()
-            gridwin = calcDoc.getChild("grid_window")
+        self.ui_test.create_doc_in_start_center("calc")
+        document = self.ui_test.get_component()
+        calcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = calcDoc.getChild("grid_window")
 
-            enter_text_to_cell(gridwin, "A1", "A")
-            enter_text_to_cell(gridwin, "A2", "1")
-            enter_text_to_cell(gridwin, "A3", "2")
-            enter_text_to_cell(gridwin, "A4", "3")
+        enter_text_to_cell(gridwin, "A1", "A")
+        enter_text_to_cell(gridwin, "A2", "1")
+        enter_text_to_cell(gridwin, "A3", "2")
+        enter_text_to_cell(gridwin, "A4", "3")
 
-            gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": 
"A1:A4"}))
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
 
-            self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
 
-            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
-            xFloatWindow = self.xUITest.getFloatWindow()
-            #Choose Standard Filter... button
-            xMenu = xFloatWindow.getChild("menu")
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
-            self.assertEqual("Standard Filter...", 
get_state_as_dict(xMenu)['SelectEntryText'])
-            xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": "0", "ROW": "0"}))
+        xFloatWindow = self.xUITest.getFloatWindow()
+        #Choose Standard Filter... button
+        xMenu = xFloatWindow.getChild("check_list_menu")
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 
-            xDialog = self.xUITest.getTopFocusWindow()
-            xfield1 = xDialog.getChild("field1")
-            xcond1 = xDialog.getChild("cond1")
-            xval1 = xDialog.getChild("val1")
-            xcopyresult = xDialog.getChild("copyresult")
-            xedcopyarea = xDialog.getChild("edcopyarea")
-            xdestpers = xDialog.getChild("destpers")
+        xDialog = self.xUITest.getTopFocusWindow()
+        xfield1 = xDialog.getChild("field1")
+        xcond1 = xDialog.getChild("cond1")
+        xval1 = xDialog.getChild("val1")
+        xcopyresult = xDialog.getChild("copyresult")
+        xedcopyarea = xDialog.getChild("edcopyarea")
+        xdestpers = xDialog.getChild("destpers")
 
-            select_by_text(xfield1, "A")
-            select_by_text(xcond1, ">")
-            xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
-            xcopyresult.executeAction("CLICK", tuple())
-            xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"}))
-            if get_state_as_dict(xdestpers)['Selected'] == 'false':
-                xdestpers.executeAction("CLICK", tuple())
-            self.assertEqual('true', 
get_state_as_dict(xcopyresult)['Selected'])
-            xOKBtn = xDialog.getChild("ok")
-            self.ui_test.close_dialog_through_button(xOKBtn)
+        xfield1.executeAction("SELECT", mkPropertyValues({"TEXT": "A"}))
+        xcond1.executeAction("SELECT", mkPropertyValues({"TEXT": ">"}))
+        xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+        xcopyresult.executeAction("CLICK", tuple())
+        xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"}))
+        if get_state_as_dict(xdestpers)['Selected'] == 'false':
+            xdestpers.executeAction("CLICK", tuple())
+        self.assertEqual('true', get_state_as_dict(xcopyresult)['Selected'])
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
 
 
-            row1 = get_row(document, 1)
-            row2 = get_row(document, 2)
-            row3 = get_row(document, 3)
-            self.assertTrue(row1.getPropertyValue("IsVisible"))
-            self.assertTrue(row2.getPropertyValue("IsVisible"))
-            self.assertTrue(row3.getPropertyValue("IsVisible"))
+        row1 = get_row(document, 1)
+        row2 = get_row(document, 2)
+        row3 = get_row(document, 3)
+        self.assertTrue(row1.getPropertyValue("IsVisible"))
+        self.assertTrue(row2.getPropertyValue("IsVisible"))
+        self.assertTrue(row3.getPropertyValue("IsVisible"))
 
-            gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
-            xFloatWindow = self.xUITest.getFloatWindow()
-            xCheckListMenu = xFloatWindow.getChild("check_list_menu")
-            xTreeList = xCheckListMenu.getChild("check_list_box")
-            xEntry = xTreeList.getChild("1")
-            xEntry.executeAction("CLICK", tuple())
-            xOkBtn = xFloatWindow.getChild("ok")
-            xOkBtn.executeAction("CLICK", tuple())
+        gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": "0", "ROW": "0"}))
+        xFloatWindow = self.xUITest.getFloatWindow()
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+        xTreeList = xCheckListMenu.getChild("check_list_box")
+        xEntry = xTreeList.getChild("1")
+        xEntry.executeAction("CLICK", tuple())
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
 
-            self.assertTrue(row1.getPropertyValue("IsVisible"))
-            self.assertFalse(row2.getPropertyValue("IsVisible"))
-            self.assertTrue(row3.getPropertyValue("IsVisible"))
+        self.assertTrue(row1.getPropertyValue("IsVisible"))
+        self.assertFalse(row2.getPropertyValue("IsVisible"))
+        self.assertTrue(row3.getPropertyValue("IsVisible"))
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to