[Libreoffice-commits] core.git: svtools/source uitest/ui_logger_dsl vcl/source

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 27 18:30:06 UTC 2020


 svtools/source/control/valueset.cxx        |   13 +++++++++++
 uitest/ui_logger_dsl/UI_Object_commands.tx |    7 +++++-
 uitest/ui_logger_dsl/dsl_core.py           |   33 +++++++++++++++++++++++++++++
 vcl/source/uitest/logger.cxx               |    5 ++++
 4 files changed, 57 insertions(+), 1 deletion(-)

New commits:
commit 707903aa8c74047c4fe6364b114b0736f61a4b4d
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Mon Aug 24 11:39:37 2020 +0200
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Thu Aug 27 20:29:22 2020 +0200

    uilogger : Add support in the Logger and DSL for ValueSet
    
    For example the DSL syntax will be:
            >>Choose element with position 18 in 'colorset' from 'cui/ui/colorpage/colorset'
    
    Change-Id: I9186b870da096719873c8709dedbc4bb4d315e2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101267
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index e56f3e7e2d43..96216831e4d7 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -44,6 +44,8 @@
 #include <boost/property_tree/ptree.hpp>
 
 #include <uiobject.hxx>
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
 
 using namespace css::uno;
 using namespace css::lang;
@@ -51,6 +53,16 @@ using namespace css::accessibility;
 
 namespace
 {
+void collectUIInformation( const OUString& aID , const OUString& aParentID , const OUString& aPos )
+{
+    EventDescription aDescription;
+    aDescription.aID = aID ;
+    aDescription.aParameters = {{"POS", aPos }};
+    aDescription.aAction = "SELECT";
+    aDescription.aKeyWord = "ValueSet";
+    aDescription.aParent = aParentID;
+    UITestLogger::getInstance().logEvent(aDescription);
+}
 
 enum
 {
@@ -155,6 +167,7 @@ void ValueSet::ImplDeleteItems()
 void ValueSet::Select()
 {
     maSelectHdl.Call( this );
+    collectUIInformation(OStringToOUString(GetDrawingArea()->get_buildable_name(),RTL_TEXTENCODING_UTF8) , OStringToOUString(GetDrawingArea()->get_help_id(),RTL_TEXTENCODING_UTF8) , OUString::number(GetSelectedItemId()));
 }
 
 void ValueSet::UserDraw( const UserDrawEvent& )
diff --git a/uitest/ui_logger_dsl/UI_Object_commands.tx b/uitest/ui_logger_dsl/UI_Object_commands.tx
index a3fe81b72b2b..7770bc1ee581 100644
--- a/uitest/ui_logger_dsl/UI_Object_commands.tx
+++ b/uitest/ui_logger_dsl/UI_Object_commands.tx
@@ -11,12 +11,14 @@ import type_options
         7)  SpinUIObject		( Increase event - Decrease event )
         8)  TabControlUIObject ( Change tab event )
         9)  ToolBoxUIObject ( Click on item event )
+        10) ValueSetUIObject (Choose item)
 */
 
 UIObjectCommand:
   ButtonUIObject | CheckBoxUIObject | EditUIObject | 
   RadioButtonUIObject | ListBoxUIObject | ComboBoxUIObject | 
-  SpinFieldUIObject | TabControlUIObject | ToolBoxUIObject
+  SpinFieldUIObject | TabControlUIObject | ToolBoxUIObject |
+  ValueSetUIObject
 ;
 
 ButtonUIObject:
@@ -46,6 +48,9 @@ ListBoxUIObject:
 ToolBoxUIObject:
    'Click on item number' POS=INT 'in' toolbox_id=ID
 ;
+ValueSetUIObject:
+   'Choose element with position ' POS=INT 'in' value_set_id=STRING 'from' parent_id=STRING
+;
 //=============================================================
 //helper grammar for EditUIObject
 action_on_UIObject:
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index feb69b76a320..b9941c81c746 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -104,6 +104,7 @@ class ul_Compiler:
                 "SpinFieldUIObject": self.handle_spin_field,
                 "EditUIObject": self.handle_Edit_uiObject,
                 "ToolBoxUIObject": self.handle_ToolBox_uiObject,
+                "ValueSetUIObject": self.handle_ValueSet_uiObject,
                 "writer_Type_command": self.handle_writer_type,
                 "writer_Select_command": self.handle_writer_select,
                 "writer_GOTO_command": self.handle_writer_goto,
@@ -627,6 +628,38 @@ class ul_Compiler:
 
         self.prev_command = ToolBoxUIObject
 
+    def handle_ValueSet_uiObject(self, ValueSetUIObject):
+
+        name_of_obj = ""
+        if keyword.iskeyword(ValueSetUIObject.value_set_id):
+            name_of_obj = "x" + ValueSetUIObject.value_set_id
+        else:
+            name_of_obj = ValueSetUIObject.value_set_id
+
+        parent_txt = ValueSetUIObject.parent_id.split("/")
+        parent = parent_txt[len(parent_txt)-2]
+        if( parent.upper() != self.last_parent[self.parent_hierarchy_count].upper()):
+            self.init_Object(
+                parent,
+                parent,
+                self.last_parent[self.parent_hierarchy_count],
+            )
+
+            self.init_Object(
+                name_of_obj, ValueSetUIObject.value_set_id, parent
+            )
+
+        else:
+            self.init_Object(
+                name_of_obj, ValueSetUIObject.value_set_id, self.last_parent[self.parent_hierarchy_count]
+            )
+
+        self.write_line_with_one_parameters(
+            name_of_obj, "CHOOSE", "POS", ValueSetUIObject.POS
+        )
+
+        self.prev_command = ValueSetUIObject
+
     def handle_writer_type(self, writer_Type_command):
 
         self.init_app()
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index b7a9e02ac48a..27a3a0e6b039 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -389,6 +389,11 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
     {
         aLogLine = "From SIDEBAR Choose " + aParameterString;
     }
+    else if (rDescription.aKeyWord == "ValueSet")
+    {
+        aLogLine = "Choose element with position " + GetValueInMapWithIndex(rDescription.aParameters, 0) +
+                 " in '" + rDescription.aID +"' from '" + rDescription.aParent + "'";
+    }
     else if (rDescription.aAction == "SELECT" && rDescription.aID.isEmpty())
     {
         aLogLine = "Select " + aParameterString;


More information about the Libreoffice-commits mailing list