summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEL-SHREIF <ahmedtota29@gmail.com>2020-05-16 06:52:47 +0200
committerAhmed ElShreif <aelshreif7@gmail.com>2020-05-17 13:00:14 +0200
commit78dc713fd7b7abe4612c740a37a22eda8fc63cd2 (patch)
treeb3f192f025f42c3cc7fb42981367b744959978ca
parent67b849ea6fd9f00c32ea0e91ed03050e4e36ef2c (diff)
uitest: Fix some issue in the UI Logger DSL core
It solve these problems: 1) math generated test cases wasn't run because the element selector wasn't initialized 2) avoid variables that has variable name equal number only 3) avoid reusing UI object that reference to closed dialog Change-Id: I21221716bfa76889b6563955f60a7f99143fe9c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94338 Tested-by: Jenkins Reviewed-by: Ahmed ElShreif <aelshreif7@gmail.com>
-rw-r--r--uitest/ui_logger_dsl/Special_commands.tx2
-rw-r--r--uitest/ui_logger_dsl/dsl_core.py25
2 files changed, 24 insertions, 3 deletions
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index 1667eace0ef3..071cfb9dcbbb 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -174,7 +174,7 @@ math_command:
math_element_selector | math_Type_command
;
math_element_selector:
- 'Select element no ' element_no=INT ' From ' place=ID
+ 'Select element no ' element_no=INT 'From' place=ID
;
math_Type_command:
'Type on math ' what_to_type=Type_options
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index 074e4b871467..d4a9601f3997 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -42,6 +42,7 @@ class ul_Compiler:
parent_hierarchy_count = 0
last_parent = []
flag_for_QuerySaveDialog = False
+ math_element_selector_initializer= False;
def __init__(self, input_address, output_address):
self.ui_dsl_mm = metamodel_from_file("ui_logger_dsl_grammar.tx")
@@ -169,6 +170,7 @@ class ul_Compiler:
+ name_of_child
+ '")\n'
)
+
self.variables.append(line)
def write_line_without_parameters(self, Action_holder, Action, Action_type):
@@ -369,6 +371,10 @@ class ul_Compiler:
else:
self.flag_for_QuerySaveDialog = False
+ # This is to solve the problem of re-using the same id again in diffrent Dialogs
+
+ self.objects.clear()
+
self.prev_command = DialogCommand
def handle_button(self, ButtonUIObject):
@@ -785,9 +791,24 @@ class ul_Compiler:
def handle_math_element_selector(self, math_element_selector):
+ if( self.math_element_selector_initializer == False ):
+ # This part to initialize the element selector in math application
+ self.math_element_selector_initializer = True
+ line = (
+ double_tab
+ + "element_selector"
+ + ' = MainWindow.getChild("'
+ + "element_selector"
+ + '")\n'
+ )
+ self.variables.append(line)
+
+ # this put a prefix of char 'x' to avoid variable with name equal to number only
+ element_name="x"+str(math_element_selector.element_no)
+
line = (
double_tab
- + str(math_element_selector.element_no)
+ + str(element_name)
+ ' = element_selector.getChild("'
+ str(math_element_selector.element_no)
+ '")\n'
@@ -795,7 +816,7 @@ class ul_Compiler:
self.variables.append(line)
self.write_line_without_parameters(
- str(math_element_selector.element_no), "SELECT", "tuple"
+ str(element_name), "SELECT", "tuple"
)
self.prev_command = math_element_selector