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

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 24 09:46:38 UTC 2019


 uitest/ui_logger_dsl/General_commands.tx      |   21 ++++++++++++++
 uitest/ui_logger_dsl/Special_commands.tx      |   39 +++++++++++++++++++++++---
 uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx |    4 +-
 vcl/source/uitest/logger.cxx                  |   26 ++++++++++++++---
 vcl/source/uitest/uiobject.cxx                |    4 +-
 5 files changed, 81 insertions(+), 13 deletions(-)

New commits:
commit 690238b1a0a613cbb279a52b39100aca77631223
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Mon Jun 24 11:40:17 2019 +0200
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Mon Jun 24 11:40:17 2019 +0200

    Some new features in ui_logger project
    
    this patch for:
    1) general commands grammar
    2) special commands of impress and math
    3) log select element action
    4) log SideBar Actions
    
    Change-Id: If375cd3396cfde45f70d7c202339c829b1c43471

diff --git a/uitest/ui_logger_dsl/General_commands.tx b/uitest/ui_logger_dsl/General_commands.tx
new file mode 100644
index 000000000000..fb8f6115f450
--- /dev/null
+++ b/uitest/ui_logger_dsl/General_commands.tx
@@ -0,0 +1,21 @@
+/*
+    This file for the log statments that is general for all application
+    we can use it as general commands then relate it to its application 
+    as we have starter command
+    //====================================
+    also I make set zoom to be general as it will be better
+*/
+
+SpecialCommand:
+    SideBar | setZoom_command | Select_command
+;
+
+SideBar:
+    'From SIDEBAR ' 'Choose ' '{"PANEL":' name=STRING '}'
+;
+setZoom_command:
+    'Set Zoom to ' zoom_value=INT 
+;
+Select_command:
+    'Select ' '{"OBJECT":' name=STRING '}'
+;
\ No newline at end of file
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index b73fddf805a4..40113495ac9e 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -4,7 +4,7 @@ import type_options
 */
 
 SpecialCommand:
-  writer_command | calc_command 
+  writer_command | calc_command | impress_command | math_command
 ;
 
 /*
@@ -26,9 +26,6 @@ Type_command:
 Select_command:
   'Select from Pos' from=INT 'to Pos' to=INT 
 ;
-setZoom_command:
-  'Set Zoom to ' zoom_value=INT 
-;
 GOTO_command:
   'GOTO page number' page_num=INT
 ;
@@ -68,4 +65,38 @@ one_cell:
     '{' '"CELL":' input_cell=STRING '}'
 ;
 //=================================================================//
+/*
+  This part for all the impress log statments:
+   
+    1)  Type 
+    3)  Set zoom
+
+  then we can add whatever we need in the future
+*/
+impress_command:
+    impress_Type_command 
+;
+impress_Type_command:
+    'Type on impress ' what_to_type=Type_options
+;
+//=================================================================//
+/*
+  This part for all the math log statments:
+   
+    1)  element selector 
+    2) Type
+
+  then we can add whatever we need in the future
+*/
+math_command:
+    element_selector | math_Type_command
+;
+element_selector:
+    '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/ui_logger_dsl_grammar.tx b/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx
index 516ee8694923..ffde0c4c1525 100644
--- a/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx
+++ b/uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx
@@ -5,14 +5,14 @@ import starter_commands
 import uno_commands
 import UI_Object_commands
 import Special_commands
-
+import General_commands
 
 UILogger:
     commands*=Command    
 ;
 
 Command:
-  UNOCommand | StarterCommand | UIObjectCommand | DialogCommand  | SpecialCommand
+  UNOCommand | StarterCommand | UIObjectCommand | DialogCommand  | SpecialCommand | GeneralCommand
 ;
 
 Comment:
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 3c664b76db98..4b3f69245ae6 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -224,6 +224,12 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
     else if(pUIObject->get_type()=="ScGridWinUIObject" && rID=="grid_window"){
         aContent = "Type on current cell " + aKeyCode ;
     }
+    else if(pUIObject->get_type()=="ImpressWindowUIObject" && rID=="impress_win"){
+        aContent = "Type on impress " + aKeyCode ;
+    }
+    else if(pUIObject->get_type()=="WindowUIObject" && rID=="math_edit"){
+        aContent = "Type on math " + aKeyCode ;
+    }
     else{
         aContent= pUIObject->get_type() + " Action:TYPE Id:" +
                 rID + " Parent:"+ aParentID +" " + aKeyCode;
@@ -284,15 +290,21 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
 
     //here we will customize our statments depending on the caller of this function
     OUString aLogLine ;
-
-    if(rDescription.aID=="writer_edit"){
+    //first check on general commands
+    if(rDescription.aAction=="SET"){
+        aLogLine =  "Set Zoom to be "  + GetValueInMapWithIndex(rDescription.aParameters,0);
+    }
+    else if(rDescription.aAction=="SIDEBAR"){
+        aLogLine = "From SIDEBAR Choose " + aParameterString;
+    }
+    else if(rDescription.aAction=="SELECT" && rDescription.aID==""){
+        aLogLine = "Select " + aParameterString;
+    }
+    else if(rDescription.aID=="writer_edit"){
 
         if(rDescription.aAction=="GOTO"){
             aLogLine = "GOTO page number " + GetValueInMapWithIndex(rDescription.aParameters,0);
         }
-        else if(rDescription.aAction=="SET"){
-            aLogLine =  "Set Zoom to "  + GetValueInMapWithIndex(rDescription.aParameters,0);
-        }
         else if(rDescription.aAction=="SELECT"){
             OUString to = GetValueInMapWithIndex(rDescription.aParameters,0);
             OUString from =   GetValueInMapWithIndex(rDescription.aParameters,1);
@@ -317,6 +329,10 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
             " and Row " + GetValueInMapWithIndex(rDescription.aParameters,1);
         }
     }
+    else if(rDescription.aParent=="element_selector"){
+        aLogLine ="Select element no " + rDescription.aID +
+            " From " + rDescription.aParent;
+    }
     else{
         aLogLine = rDescription.aKeyWord + " Action:" +
             rDescription.aAction + " Id:" + rDescription.aID +
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 583c4ac38659..52fcfbc855c1 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -529,8 +529,8 @@ OUString WindowUIObject::get_action(VclEventId nEvent) const
         default:
             aActionName = OUString::number(static_cast<int>(nEvent));
     }
-
-    return "Action on element: " + mxWindow->get_id() + " with action : " + aActionName;
+    return "";
+    //return "Action on element: " + mxWindow->get_id() + " with action : " + aActionName;
 }
 
 std::unique_ptr<UIObject> WindowUIObject::create(vcl::Window* pWindow)


More information about the Libreoffice-commits mailing list