diff options
author | Ahmed ElShreif <aelshreif7@gmail.com> | 2019-07-13 14:39:17 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-19 22:56:37 +0800 |
commit | c06a2699841054f6c7a20760deca0965a61f9274 (patch) | |
tree | 4374087482e6a2ac5c62e35d384d8624652e37ac /uitest | |
parent | b33915d56850be2235cea428b04c95ed6b8a55ac (diff) |
uitest: add more DSL commands
1) Calc
(calc_Type_command - calc_switch_sheet - calc_Select_cell - calc_AutoFill_filter)
2) impress
(impress_Type_command)
3) math
(math_element_selector - math_Type_command)
4) General Commands Compiler:
(setZoom_command)
Change-Id: Ifd2608c38474633b579a216356fe53c859c24975
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/ui_logger_dsl/Special_commands.tx | 12 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/dsl_core.py | 150 |
2 files changed, 155 insertions, 7 deletions
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx index 3ef28f65bdaf..ac0f4d9a30aa 100644 --- a/uitest/ui_logger_dsl/Special_commands.tx +++ b/uitest/ui_logger_dsl/Special_commands.tx @@ -39,18 +39,18 @@ writer_GOTO_command: then we can add whatever we need in the future */ calc_command: - calc_Type_command | switch_sheet | Select_cell | AutoFill_filter + calc_Type_command | calc_switch_sheet | calc_Select_cell | calc_AutoFill_filter ; calc_Type_command: 'Type on current cell' what_to_type=Type_options ; -switch_sheet: +calc_switch_sheet: 'Switch to sheet number' sheet_num=INT ; -Select_cell: +calc_Select_cell: 'Select from calc' select_op=select_options ; -AutoFill_filter: +calc_AutoFill_filter: 'Lanuch AutoFilter from Col' col_num=INT 'and Row' row_num=INT ; //this is the select options @@ -88,9 +88,9 @@ impress_Type_command: then we can add whatever we need in the future */ math_command: - element_selector | math_Type_command + math_element_selector | math_Type_command ; -element_selector: +math_element_selector: 'Select element no ' element_no=INT ' From ' place=ID ; math_Type_command: diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py index d914e2ed2dc4..c81a099b6de5 100644 --- a/uitest/ui_logger_dsl/dsl_core.py +++ b/uitest/ui_logger_dsl/dsl_core.py @@ -79,6 +79,14 @@ class ul_Compiler: 'writer_Type_command':self.handle_writer_type, 'writer_Select_command':self.handle_writer_select, 'writer_GOTO_command':self.handle_wirter_goto, + 'calc_Select_cell':self.handle_calc_select, + 'calc_switch_sheet':self.handle_calc_switch_sheet, + 'calc_Type_command':self.handle_calc_Type_command, + 'calc_AutoFill_filter':self.handle_calc_AutoFill_filter, + 'impress_Type_command':self.handle_impress_Type_command, + 'math_element_selector':self.handle_math_element_selector, + 'math_Type_command':self.handle_math_Type_command, + 'setZoom_command':self.handle_setZoom_command }) self.log_lines=self.get_log_file(self.input_address) @@ -106,7 +114,8 @@ class ul_Compiler: line="\t\tMainWindow = self.xUITest.getTopFocusWindow()\n" self.variables.append(line) - app={"writer":"writer_edit","calc":"grid_window"}#to be continue + app={"writer":"writer_edit","calc":"grid_window","impress":"impress_win"\ + ,"math":"math_edit"} self.current_app=app[StarterCommand.program_name] self.prev_command=StarterCommand @@ -355,6 +364,145 @@ class ul_Compiler: self.variables.append(line) self.prev_command=writer_GOTO_command + def handle_calc_select (self,calc_Select_cell): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + if(calc_Select_cell.select_op.__class__.__name__=="range_of_cells"): + line="\t\t"+self.current_app+".executeAction(\"SELECT\", mkPropertyValues({\"RANGE\": \""+\ + calc_Select_cell.select_op.input_range+"\"}))\n" + + elif(calc_Select_cell.select_op.__class__.__name__=="one_cell"): + line="\t\t"+self.current_app+".executeAction(\"SELECT\", mkPropertyValues({\"CELL\": \""+\ + calc_Select_cell.select_op.input_cell+"\"}))\n" + + self.variables.append(line) + self.prev_command=calc_Select_cell + + def handle_calc_switch_sheet (self,calc_switch_sheet): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + line="\t\t"+self.current_app+".executeAction(\"SELECT\", mkPropertyValues({\"TABLE\": \""+\ + str(calc_switch_sheet.sheet_num)+"\"}))\n" + + self.variables.append(line) + self.prev_command=calc_switch_sheet + + def handle_calc_Type_command (self,calc_Type_command): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + if(calc_Type_command.what_to_type.__class__.__name__=="char"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"TEXT\": \""+\ + calc_Type_command.what_to_type.input_char+"\"}))\n" + elif(calc_Type_command.what_to_type.__class__.__name__=="KeyCode"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"KEYCODE\": \""+\ + calc_Type_command.what_to_type.input_key_code+"\"}))\n" + + self.variables.append(line) + self.prev_command=calc_Type_command + + def handle_calc_AutoFill_filter (self,calc_AutoFill_filter): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + line="\t\t"+self.current_app+".executeAction(\"LAUNCH\", mkPropertyValues"+\ + "({\"AUTOFILTER\": \"\", \"COL\": \""+\ + str(calc_AutoFill_filter.col_num)+"\""+\ + ", \"ROW\": \""+str(calc_AutoFill_filter.row_num)\ + +"\"}))\n" + + self.variables.append(line) + self.prev_command=calc_AutoFill_filter + + def handle_impress_Type_command (self,impress_Type_command): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + if(impress_Type_command.what_to_type.__class__.__name__=="char"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"TEXT\": \""+\ + impress_Type_command.what_to_type.input_char+"\"}))\n" + elif(impress_Type_command.what_to_type.__class__.__name__=="KeyCode"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"KEYCODE\": \""+\ + impress_Type_command.what_to_type.input_key_code+"\"}))\n" + + self.variables.append(line) + self.prev_command=impress_Type_command + + def handle_math_Type_command (self,math_Type_command): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + if(math_Type_command.what_to_type.__class__.__name__=="char"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"TEXT\": \""+\ + math_Type_command.what_to_type.input_char+"\"}))\n" + elif(math_Type_command.what_to_type.__class__.__name__=="KeyCode"): + line="\t\t"+self.current_app+".executeAction(\"TYPE\", mkPropertyValues"+\ + "({\"KEYCODE\": \""+\ + math_Type_command.what_to_type.input_key_code+"\"}))\n" + + self.variables.append(line) + self.prev_command=math_Type_command + + def handle_math_element_selector (self,math_element_selector): + + line="\t\t"+str(math_element_selector.element_no)+" = element_selector.getChild(\""+\ + str(math_element_selector.element_no)+"\")\n" + self.variables.append(line) + line="\t\t"+str(math_element_selector.element_no)+".executeAction(\"SELECT\",tuple())\n" + self.variables.append(line) + self.prev_command=math_element_selector + + def handle_setZoom_command (self,setZoom_command): + + if self.current_app in self.objects: + self.objects[self.current_app]+=1 + else: + self.objects[self.current_app]=1 + line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n" + self.variables.append(line) + + line="\t\t"+self.current_app+".executeAction(\"SET\", mkPropertyValues({\"ZOOM\": \""+\ + str(setZoom_command.zoom_value)+"\"}))\n" + self.variables.append(line) + self.prev_command=setZoom_command + def Generate_UI_test(self): line="\t\tself.ui_test.close_doc()" self.variables.append(line) |