summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorAhmed ElShreif <aelshreif7@gmail.com>2019-07-07 00:52:06 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-08-19 22:56:37 +0800
commitb33915d56850be2235cea428b04c95ed6b8a55ac (patch)
tree765e3549155b2f5bf934ca1a565ce616fb449a58 /uitest
parentdcb939ad2f4b97847f88799fe09ed1b51b911694 (diff)
uitest: add special commands of writer app implementation
1) Type Command 2) Select Command 3) GoTo page Change-Id: I5ee773b6cd322c2c1bf0eba58e704b2ff1399ce7
Diffstat (limited to 'uitest')
-rw-r--r--uitest/ui_logger_dsl/Special_commands.tx13
-rw-r--r--uitest/ui_logger_dsl/dsl_core.py55
2 files changed, 61 insertions, 7 deletions
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index c6f0a1d3305e..3ef28f65bdaf 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -12,21 +12,20 @@ SpecialCommand:
1) Type
2) Select
- 3) Set zoom
- 4) GOTO page
+ 3) GOTO page
then we can add whatever we need in the future
*/
writer_command:
- Type_command | Select_command | GOTO_command
+ writer_Type_command | writer_Select_command | writer_GOTO_command
;
-Type_command:
+writer_Type_command:
'Type on writer' what_to_type=Type_options
;
-Select_command:
- 'Select from Pos' from=INT 'to Pos' to=INT
+writer_Select_command:
+ 'Select from Pos' from_pos=INT 'to Pos' to_pos=INT
;
-GOTO_command:
+writer_GOTO_command:
'GOTO page number' page_num=INT
;
//=================================================================//
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index e212c82a67d1..d914e2ed2dc4 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -26,6 +26,7 @@ class ul_Compiler:
prev_command=""
variables=[]
objects = dict()
+ current_app=""
def __init__(self , input_address , output_address):
self.ui_dsl_mm = metamodel_from_file('ui_logger_dsl_grammar.tx')
self.output_stream=self.initiate_test_generation(output_address)
@@ -75,6 +76,9 @@ class ul_Compiler:
'ListBoxUIObject':self.handle_List_box,
'SpinFieldUIObject':self.handle_spin_field,
'EditUIObject':self.handle_Edit_uiObject,
+ 'writer_Type_command':self.handle_writer_type,
+ 'writer_Select_command':self.handle_writer_select,
+ 'writer_GOTO_command':self.handle_wirter_goto,
})
self.log_lines=self.get_log_file(self.input_address)
@@ -102,6 +106,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
+ self.current_app=app[StarterCommand.program_name]
self.prev_command=StarterCommand
def handle_Dialog(self, DialogCommand):
@@ -300,6 +306,55 @@ class ul_Compiler:
self.variables.append(line)
self.prev_command=EditUIObject
+ def handle_writer_type (self,writer_Type_command):
+
+ if "writer_edit" in self.objects:
+ self.objects["writer_edit"]+=1
+ else:
+ self.objects["writer_edit"]=1
+ line="\t\twriter_edit = MainWindow.getChild(\"writer_edit\")\n"
+ self.variables.append(line)
+
+ if(writer_Type_command.what_to_type.__class__.__name__=="char"):
+ line="\t\twriter_edit.executeAction(\"TYPE\", mkPropertyValues"+\
+ "({\"TEXT\": \""+\
+ writer_Type_command.what_to_type.input_char+"\"}))\n"
+ elif(writer_Type_command.what_to_type.__class__.__name__=="KeyCode"):
+ line="\t\twriter_edit.executeAction(\"TYPE\", mkPropertyValues"+\
+ "({\"KEYCODE\": \""+\
+ writer_Type_command.what_to_type.input_key_code+"\"}))\n"
+ self.variables.append(line)
+ self.prev_command=writer_Type_command
+
+ def handle_writer_select (self,writer_Select_command):
+
+ if "writer_edit" in self.objects:
+ self.objects["writer_edit"]+=1
+ else:
+ self.objects["writer_edit"]=1
+ line="\t\twriter_edit = MainWindow.getChild(\"writer_edit\")\n"
+ self.variables.append(line)
+
+ line="\t\twriter_edit.executeAction(\"SELECT\", mkPropertyValues({\"END_POS\": \""+\
+ str(writer_Select_command.from_pos)+"\", \"START_POS\": \""+\
+ str(writer_Select_command.to_pos)+"\"}))\n"
+ self.variables.append(line)
+ self.prev_command=writer_Select_command
+
+ def handle_wirter_goto (self,writer_GOTO_command):
+
+ if "writer_edit" in self.objects:
+ self.objects["writer_edit"]+=1
+ else:
+ self.objects["writer_edit"]=1
+ line="\t\twriter_edit = MainWindow.getChild(\"writer_edit\")\n"
+ self.variables.append(line)
+
+ line="\t\twriter_edit.executeAction(\"GOTO\", mkPropertyValues({\"PAGE\": \""+\
+ str(writer_GOTO_command.page_num)+"\"}))\n"
+ self.variables.append(line)
+ self.prev_command=writer_GOTO_command
+
def Generate_UI_test(self):
line="\t\tself.ui_test.close_doc()"
self.variables.append(line)