[Libreoffice-commits] core.git: Branch 'private/EL-SHREIF/ui_logger' - uitest/ui_logger_dsl

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 13 12:43:26 UTC 2019


 uitest/ui_logger_dsl/Special_commands.tx |   12 +-
 uitest/ui_logger_dsl/dsl_core.py         |  150 ++++++++++++++++++++++++++++++-
 2 files changed, 155 insertions(+), 7 deletions(-)

New commits:
commit 7f9fb99e0da8690463fca230f28e2a7b5349a0af
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sat Jul 13 14:39:17 2019 +0200
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Sat Jul 13 14:39:17 2019 +0200

    Adding the Compiler of this 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

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)


More information about the Libreoffice-commits mailing list