diff options
author | Ahmed ElShreif <aelshreif7@gmail.com> | 2020-08-24 11:39:37 +0200 |
---|---|---|
committer | Ahmed ElShreif <aelshreif7@gmail.com> | 2020-08-27 20:29:22 +0200 |
commit | 707903aa8c74047c4fe6364b114b0736f61a4b4d (patch) | |
tree | d75f8fcb69bc2c95409d602c0c36033cc695812a | |
parent | 98b47440d2f95504f6bca82d2081343bdc183cde (diff) |
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@googlemail.com>
-rw-r--r-- | svtools/source/control/valueset.cxx | 13 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/UI_Object_commands.tx | 7 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/dsl_core.py | 33 | ||||
-rw-r--r-- | vcl/source/uitest/logger.cxx | 5 |
4 files changed, 57 insertions, 1 deletions
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; |