cui/qa/uitest/dialogs/macroselectordlg.py |   29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

New commits:
commit 97766e9a67f5f36cd824bdbfab290177b3d5a05a
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Feb 20 16:00:03 2023 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Mar 6 20:14:10 2023 +0000

    fix build tests: cui: rework uitest to work with --without-java
    
    This fixes make UITest_cui_dialogs on Ubuntu 20.04/gcc 9.4.0.
    
    Change-Id: I6ed187f515b47b7e54ed85c08ee9523f1b777575
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147335
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148361
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/cui/qa/uitest/dialogs/macroselectordlg.py 
b/cui/qa/uitest/dialogs/macroselectordlg.py
index cb0d1928ba46..96ba11a2d888 100644
--- a/cui/qa/uitest/dialogs/macroselectordlg.py
+++ b/cui/qa/uitest/dialogs/macroselectordlg.py
@@ -9,29 +9,36 @@ from uitest.uihelper.common import get_state_as_dict
 
 class tdf145978(UITestCase):
     def test_tdf145978(self):
-        with self.ui_test.execute_dialog_through_command(".uno:RunMacro", 
close_button="") as xDialog:
+        with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as 
xDialog:
             xCategoriesTree = xDialog.getChild("categories")
             xCategoriesTreeEntry = xCategoriesTree.getChild('1') #Application 
Macros
             xCategoriesTreeEntry.executeAction("EXPAND", tuple())
-            xCategoriesTreeEntry = xCategoriesTreeEntry.getChild('8') 
#HelloWorld
-            xCategoriesTreeEntry.executeAction("SELECT", tuple())
 
-            aCategoriesTreeEntryText = 
get_state_as_dict(xCategoriesTreeEntry)["Text"]
+            xSubCategoriesTreeEntry = None
+            for i in xCategoriesTreeEntry.getChildren():
+                xChild = xCategoriesTreeEntry.getChild(i)
+                if get_state_as_dict(xChild)["Text"] == "HelloWorld":
+                    xSubCategoriesTreeEntry = xChild
+                    break
+
+            xSubCategoriesTreeEntry.executeAction("SELECT", tuple())
 
             xCommandsTree = xDialog.getChild("commands")
-            xCommandsTreeEntry = xCommandsTree.getChild('2') #HelloWorld Python
-            xCommandsTreeEntry.executeAction("SELECT", tuple())
 
-            aCommandsTreeEntryText = 
get_state_as_dict(xCommandsTreeEntry)["Text"]
+            xCommandsTreeEntry = None
+            for i in xCommandsTree.getChildren():
+                xChild = xCommandsTree.getChild(i)
+                if get_state_as_dict(xChild)["Text"] == "HelloWorldPython":
+                    xCommandsTreeEntry = xChild
+                    break
 
-            xOKBtn = xDialog.getChild("ok")
-            self.ui_test.close_dialog_through_button(xOKBtn)
+            xCommandsTreeEntry.executeAction("SELECT", tuple())
 
         #Verify the dialog reloads with previous run macro selected
         with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as 
xDialog:
             xTree = xDialog.getChild("categories")
-            self.assertEqual(get_state_as_dict(xTree)["SelectEntryText"], 
aCategoriesTreeEntryText)
+            self.assertEqual("HelloWorld", 
get_state_as_dict(xTree)["SelectEntryText"])
             xTree = xDialog.getChild("commands")
-            self.assertEqual(get_state_as_dict(xTree)["SelectEntryText"], 
aCommandsTreeEntryText)
+            self.assertEqual("HelloWorldPython", 
get_state_as_dict(xTree)["SelectEntryText"])
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to