summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorAhmed ElShreif <aelshreif7@gmail.com>2019-06-23 23:14:14 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-08-19 22:56:36 +0800
commitc058b2772e774bc1e6376f3a1b0c16bed631c399 (patch)
tree1e5aab508367d387acaad9d9ff9c92ceedbebf54 /uitest
parent9b35efe4be55cb30da8c9fcd962e546e7e4e5f86 (diff)
uitest: new logger DSL grammar
This patch is the first and second parts of the new DSL grammar. The grammar of all the UIObjects , Dialogs , starter commands , All of uno commands and Special commands for applications. example.ul shows an example of the new syntax of the expected new logger. Change-Id: Ib58aeab1da6627ebc464e4cb64253fd3bf91200e
Diffstat (limited to 'uitest')
-rw-r--r--uitest/ui_logger_dsl/Special_commands.tx72
-rw-r--r--uitest/ui_logger_dsl/UI_Object_commands.tx72
-rw-r--r--uitest/ui_logger_dsl/dialog_commands.tx14
-rw-r--r--uitest/ui_logger_dsl/dsl_core.py10
-rw-r--r--uitest/ui_logger_dsl/example.ul23
-rw-r--r--uitest/ui_logger_dsl/starter_commands.tx12
-rw-r--r--uitest/ui_logger_dsl/type_options.tx10
-rw-r--r--uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx21
-rw-r--r--uitest/ui_logger_dsl/uno_commands.tx10
9 files changed, 244 insertions, 0 deletions
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
new file mode 100644
index 000000000000..ec0c377884cb
--- /dev/null
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -0,0 +1,72 @@
+import type_options
+/*
+ This file for the log statments that relates to each diffrent applications
+*/
+
+SpecialCommand:
+ writer_command | calc_command
+;
+
+/*
+ This part for all the writer log statments:
+
+ 1) Type
+ 2) Select
+ 3) Set zoom
+ 4) GOTO page
+
+ then we can add whatever we need in the future
+*/
+writer_command:
+ Type_command | Select_command | setZoom_command | GOTO_command
+;
+Type_command:
+ 'Type on writer' what_to_type=Type_options
+;
+Select_command:
+ 'Select from Pos' from=INT 'to Pos' to=INT
+;
+setZoom_command:
+ 'Set Zoom to be' zoom_value=INT
+;
+GOTO_command:
+ 'GOTO page number' page_num=INT
+;
+//=================================================================//
+/*
+ This part for all the calc log statments:
+
+ 1) select sheet
+ 2) Select cell or range
+ 3) launch AutoFill
+
+ then we can add whatever we need in the future
+*/
+calc_command:
+ calc_Type_command | switch_sheet | Select_cell | AutoFill_filter
+;
+calc_Type_command:
+ 'Type on current cell' what_to_type=Type_options
+;
+switch_sheet:
+ 'Switch to sheet number' sheet_num=INT
+;
+Select_cell:
+ 'Select from calc' select_op=select_options
+;
+AutoFill_filter:
+ 'Lanuch AutoFilter from Col' col_num=INT 'and Row' row_num=INT
+;
+//this is the select options
+select_options:
+ one_cell | range_of_cells
+;
+range_of_cells:
+ '{' '"RANGE":' input_range=STRING '}'
+;
+one_cell:
+ '{' '"CELL":' input_cell=STRING '}'
+;
+//=================================================================//
+
+
diff --git a/uitest/ui_logger_dsl/UI_Object_commands.tx b/uitest/ui_logger_dsl/UI_Object_commands.tx
new file mode 100644
index 000000000000..484e5e7af9a3
--- /dev/null
+++ b/uitest/ui_logger_dsl/UI_Object_commands.tx
@@ -0,0 +1,72 @@
+import type_options
+/*
+ this file is for:
+ ButtonUIObject
+ EditUIObject
+ CheckBoxUIObject
+ RadioButtonUIObject
+ ListBoxUIObject
+ ComboBoxUIObject
+ SpinUIObject
+ SpinFieldUIObject
+ TabControlUIObject
+*/
+
+UIObjectCommand:
+ ButtonUIObject | CheckBoxUIObject | EditUIObject |
+ RadioButtonUIObject | ListBoxUIObject | ComboBoxUIObject |
+ SpinUIObject | SpinFieldUIObject | TabControlUIObject
+;
+
+ButtonUIObject:
+ 'Click on' ui_button=STRING 'from' parent_id=ID
+;
+CheckBoxUIObject:
+ 'Toggle' Check_box_id=STRING 'CheckBox' 'from' parent_id=ID
+;
+RadioButtonUIObject:
+ 'Select' Radio_button_id=STRING 'RadioButton' 'from' parent_id=ID
+;
+ComboBoxUIObject:
+ 'Select in' Combo_box_id=STRING 'ComboBox' 'item number' item_num=INT 'from' parent_id=ID
+;
+TabControlUIObject:
+ 'Choose Tab number' tab_page_number=INT 'from' parent_id=ID
+;
+
+EditUIObject:
+ action=action_on_UIObject 'from' parent_id=ID
+;
+SpinFieldUIObject:
+ change=increase_or_ecrease Spin_id=STRING 'from' parent_id=ID
+;
+ListBoxUIObject:
+ 'Select element with position ' POS=INT 'in' list=STRING 'from' parent_id=ID
+;
+//==========================================
+SpinUIObject:
+ 'from' parent_id=ID
+ //unkown for now
+;
+//==========================================
+
+//hellper grammer for EditUIObject
+action_on_UIObject:
+ Type_action | SELECT | Clear
+;
+Type_action:
+ 'Type on' edit_button=STRING what_to_type=Type_options
+;
+SELECT:
+ 'Select in ' edit_button=STRING
+ '{"FROM": "' from=INT '", "' To=INT '": "0"}'
+;
+Clear:
+ 'Clear' edit_button=STRING
+;
+
+//helper functions for SpinUIObject
+increase_or_ecrease:
+ 'Increase' | 'Decrease'
+;
+
diff --git a/uitest/ui_logger_dsl/dialog_commands.tx b/uitest/ui_logger_dsl/dialog_commands.tx
new file mode 100644
index 000000000000..66183aa51ae5
--- /dev/null
+++ b/uitest/ui_logger_dsl/dialog_commands.tx
@@ -0,0 +1,14 @@
+//this file for the Dialog commands
+
+DialogCommand:
+ OpenDialog | CloseDialog
+;
+
+OpenDialog:
+ 'Open' dialog_name=ID
+;
+
+CloseDialog:
+ 'Close Dialog'
+;
+
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
new file mode 100644
index 000000000000..7aaa6dcab656
--- /dev/null
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -0,0 +1,10 @@
+from textx.metamodel import metamodel_from_file
+
+ui_dsl_mm = metamodel_from_file('ui_logger_dsl_grammar.tx')
+
+# Load the program:
+actions = ui_dsl_mm.model_from_file('example.ul')
+
+for statement in actions.commands:
+ print(statement)
+
diff --git a/uitest/ui_logger_dsl/example.ul b/uitest/ui_logger_dsl/example.ul
new file mode 100644
index 000000000000..e53a1b53e7bb
--- /dev/null
+++ b/uitest/ui_logger_dsl/example.ul
@@ -0,0 +1,23 @@
+Start writer
+Send UNO Command (".uno:UpdateInputFields")
+Send UNO Command (".uno:FontDialog")
+Open CharacterPropertiesDialog
+Choose Tab number 0 from CharacterPropertiesDialog
+Choose Tab number 2 from CharacterPropertiesDialog
+Select "90deg" Radio Button from CharacterPropertiesDialog
+Toggle "pairkerning" CheckBox from CharacterPropertiesDialog
+Select in "weststylelb-cjk" ComboBox item number 2 from CharacterPropertiesDialog
+Increase "scalewidthsb" from CharacterPropertiesDialog
+Decrease "scalewidthsb" from CharacterPropertiesDialog
+Type on "linewidthmf" {"TEXT": "1"} from CharacterPropertiesDialog
+Select element with position 2 in "effectslb" from CharacterPropertiesDialog
+Click on "ok" from CharacterPropertiesDialog
+Close Dialog
+Type on writer {"TEXT": "s"}
+Select from Pos 5 to Pos 7
+Set Zoom to be 100
+GOTO page number 1
+Open QuerySaveDialog
+Click on "ok" from QuerySaveDialog
+Close Dialog
+
diff --git a/uitest/ui_logger_dsl/starter_commands.tx b/uitest/ui_logger_dsl/starter_commands.tx
new file mode 100644
index 000000000000..0461b8d149bd
--- /dev/null
+++ b/uitest/ui_logger_dsl/starter_commands.tx
@@ -0,0 +1,12 @@
+//this file for the staters commands when you open any LO application
+
+StarterCommand:
+ 'Start' program_name=Program
+;
+
+
+Program:
+ "writer"|"calc"|"impress"|"draw"|"math"|"database"
+;
+
+
diff --git a/uitest/ui_logger_dsl/type_options.tx b/uitest/ui_logger_dsl/type_options.tx
new file mode 100644
index 000000000000..5cc98fda2218
--- /dev/null
+++ b/uitest/ui_logger_dsl/type_options.tx
@@ -0,0 +1,10 @@
+Type_options:
+ char | KeyCode
+;
+char:
+ '{' '"TEXT":' input_char=STRING '}'
+;
+KeyCode:
+ '{' '"KEYCODE":' input_key_code=STRING '}'
+;
+
diff --git a/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx b/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx
new file mode 100644
index 000000000000..e0b7c64570ee
--- /dev/null
+++ b/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx
@@ -0,0 +1,21 @@
+//this file is to define the new dsl grammar
+
+import dialog_commands
+import starter_commands
+import uno_commands
+import UI_Object_commands
+import Special_commands
+
+
+UILogger:
+ commands*=Command
+;
+
+Command:
+ UNOCommand | StarterCommand | UIObjectCommand | DialogCommand | SpecialCommand
+;
+
+Comment:
+ /\/\/.*$/
+;
+
diff --git a/uitest/ui_logger_dsl/uno_commands.tx b/uitest/ui_logger_dsl/uno_commands.tx
new file mode 100644
index 000000000000..6419ad66120d
--- /dev/null
+++ b/uitest/ui_logger_dsl/uno_commands.tx
@@ -0,0 +1,10 @@
+UNOCommand:
+ 'Send UNO Command' '(' uno_command=STRING ')' prameters*=parameter
+;
+parameter:
+ '{' parameter_data *= data '}'
+;
+data:
+ key=STRING ':' value=ID ','
+;
+