uilogger : Add support in the Logger and DSL for MenuBtn
For example the DSL syntax will be: >>Open List From menugearbtn >>Select item no 6 From List of menugearbtn >>Close List From menugearbtn Change-Id: I767948d9bc124a119632825d437746ea38c40ad3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101514 Tested-by: Jenkins Reviewed-by: Ahmed ElShreif <aelshreif7@gmail.com>
This commit is contained in:
@@ -12,13 +12,14 @@ import type_options
|
||||
8) TabControlUIObject ( Change tab event )
|
||||
9) ToolBoxUIObject ( Click on item event )
|
||||
10) ValueSetUIObject (Choose item)
|
||||
10) MenuBtnUIObject ( Select - Open - Close )
|
||||
*/
|
||||
|
||||
UIObjectCommand:
|
||||
ButtonUIObject | CheckBoxUIObject | EditUIObject |
|
||||
RadioButtonUIObject | ListBoxUIObject | ComboBoxUIObject |
|
||||
SpinFieldUIObject | TabControlUIObject | ToolBoxUIObject |
|
||||
ValueSetUIObject
|
||||
ValueSetUIObject | MenuBtnUIObject
|
||||
;
|
||||
|
||||
ButtonUIObject:
|
||||
@@ -52,6 +53,19 @@ ValueSetUIObject:
|
||||
'Choose element with position ' POS=INT 'in' value_set_id=STRING 'from' parent_id=STRING
|
||||
;
|
||||
//=============================================================
|
||||
MenuBtnUIObject:
|
||||
MenuBtnUIObjectOpen | MenuBtnUIObjectSelect | MenuBtnUIObjectClose
|
||||
;
|
||||
MenuBtnUIObjectOpen:
|
||||
'Open List From' + MenuBtn_ID=ID
|
||||
;
|
||||
MenuBtnUIObjectClose:
|
||||
'Close List From' + MenuBtn_ID=ID
|
||||
;
|
||||
MenuBtnUIObjectSelect:
|
||||
'Select item no' + item_num=INT + 'From List of' + MenuBtn_ID=ID
|
||||
;
|
||||
//=============================================================
|
||||
//helper grammar for EditUIObject
|
||||
action_on_UIObject:
|
||||
Type_action | SELECT | Clear
|
||||
|
@@ -105,6 +105,9 @@ class ul_Compiler:
|
||||
"EditUIObject": self.handle_Edit_uiObject,
|
||||
"ToolBoxUIObject": self.handle_ToolBox_uiObject,
|
||||
"ValueSetUIObject": self.handle_ValueSet_uiObject,
|
||||
"MenuBtnUIObjectOpen":self.handle_MenuBtnUIObjectOpen,
|
||||
"MenuBtnUIObjectSelect":self.handle_MenuBtnUIObjectSelect,
|
||||
"MenuBtnUIObjectClose":self.handle_MenuBtnUIObjectClose,
|
||||
"writer_Type_command": self.handle_writer_type,
|
||||
"writer_Select_command": self.handle_writer_select,
|
||||
"writer_GOTO_command": self.handle_writer_goto,
|
||||
@@ -667,6 +670,63 @@ class ul_Compiler:
|
||||
|
||||
self.prev_command = ValueSetUIObject
|
||||
|
||||
def handle_MenuBtnUIObjectOpen(self, MenuBtnUIObjectOpen):
|
||||
name_of_obj = ""
|
||||
if keyword.iskeyword(MenuBtnUIObjectOpen.MenuBtn_ID):
|
||||
name_of_obj = "x" + MenuBtnUIObjectOpen.MenuBtn_ID
|
||||
else:
|
||||
name_of_obj = MenuBtnUIObjectOpen.MenuBtn_ID
|
||||
|
||||
self.init_Object(
|
||||
name_of_obj,
|
||||
MenuBtnUIObjectOpen.MenuBtn_ID,
|
||||
self.last_parent[self.parent_hierarchy_count],
|
||||
)
|
||||
|
||||
self.write_line_with_one_parameters(
|
||||
name_of_obj, "OPENLIST", "", ""
|
||||
)
|
||||
|
||||
self.prev_command = MenuBtnUIObjectOpen
|
||||
|
||||
def handle_MenuBtnUIObjectClose(self, MenuBtnUIObjectClose):
|
||||
name_of_obj = ""
|
||||
if keyword.iskeyword(MenuBtnUIObjectClose.MenuBtn_ID):
|
||||
name_of_obj = "x" + MenuBtnUIObjectClose.MenuBtn_ID
|
||||
else:
|
||||
name_of_obj = MenuBtnUIObjectClose.MenuBtn_ID
|
||||
|
||||
self.init_Object(
|
||||
name_of_obj,
|
||||
MenuBtnUIObjectClose.MenuBtn_ID,
|
||||
self.last_parent[self.parent_hierarchy_count],
|
||||
)
|
||||
|
||||
self.write_line_with_one_parameters(
|
||||
name_of_obj, "CLOSELIST", "", ""
|
||||
)
|
||||
|
||||
self.prev_command = MenuBtnUIObjectClose
|
||||
|
||||
def handle_MenuBtnUIObjectSelect(self, MenuBtnUIObjectSelect):
|
||||
name_of_obj = ""
|
||||
if keyword.iskeyword(MenuBtnUIObjectSelect.MenuBtn_ID):
|
||||
name_of_obj = "x" + MenuBtnUIObjectSelect.MenuBtn_ID
|
||||
else:
|
||||
name_of_obj = MenuBtnUIObjectSelect.MenuBtn_ID
|
||||
|
||||
self.init_Object(
|
||||
name_of_obj,
|
||||
MenuBtnUIObjectSelect.MenuBtn_ID,
|
||||
self.last_parent[self.parent_hierarchy_count],
|
||||
)
|
||||
|
||||
self.write_line_with_one_parameters(
|
||||
name_of_obj, "OPENFROMLIST", "POS", MenuBtnUIObjectSelect.item_num[0]
|
||||
)
|
||||
|
||||
self.prev_command = MenuBtnUIObjectSelect
|
||||
|
||||
def handle_writer_type(self, writer_Type_command):
|
||||
|
||||
self.init_app()
|
||||
|
@@ -25,6 +25,22 @@
|
||||
#include <vcl/menubtn.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/uitest/uiobject.hxx>
|
||||
#include <vcl/uitest/logger.hxx>
|
||||
#include <vcl/uitest/eventdescription.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
void collectUIInformation( const OUString& aID, const OUString& aevent , const OUString& akey , const OUString& avalue)
|
||||
{
|
||||
EventDescription aDescription;
|
||||
aDescription.aID = aID;
|
||||
aDescription.aParameters = {{ akey , avalue}};
|
||||
aDescription.aAction = aevent;
|
||||
aDescription.aParent = "MainWindow";
|
||||
aDescription.aKeyWord = "MenuButton";
|
||||
UITestLogger::getInstance().logEvent(aDescription);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
|
||||
{
|
||||
@@ -85,6 +101,7 @@ void MenuButton::ExecuteMenu()
|
||||
mnCurItemId = 0;
|
||||
msCurItemIdent.clear();
|
||||
}
|
||||
collectUIInformation(get_id(),"OPENLIST","","");
|
||||
}
|
||||
|
||||
void MenuButton::CancelMenu()
|
||||
@@ -103,6 +120,7 @@ void MenuButton::CancelMenu()
|
||||
else
|
||||
vcl::Window::GetDockingManager()->EndPopupMode(mpFloatingWindow);
|
||||
}
|
||||
collectUIInformation(get_id(),"CLOSELIST","","");
|
||||
}
|
||||
|
||||
bool MenuButton::InPopupMode() const
|
||||
@@ -211,6 +229,9 @@ void MenuButton::Activate()
|
||||
|
||||
void MenuButton::Select()
|
||||
{
|
||||
if (mnCurItemId)
|
||||
collectUIInformation(get_id(),"OPENFROMLIST","POS",OUString::number(mnCurItemId));
|
||||
|
||||
maSelectHdl.Call( this );
|
||||
}
|
||||
|
||||
|
@@ -581,6 +581,17 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
|
||||
{
|
||||
aLogLine = "Select element no " + rDescription.aID + " From " + rDescription.aParent;
|
||||
}
|
||||
else if(rDescription.aKeyWord == "MenuButton"){
|
||||
if(rDescription.aAction == "OPENLIST"){
|
||||
aLogLine = "Open List From " + rDescription.aID;
|
||||
}
|
||||
else if(rDescription.aAction == "CLOSELIST"){
|
||||
aLogLine = "Close List From " + rDescription.aID;
|
||||
}
|
||||
else if(rDescription.aAction == "OPENFROMLIST"){
|
||||
aLogLine = "Select item no "+ GetValueInMapWithIndex(rDescription.aParameters, 0) +" From List of "+ rDescription.aID;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aLogLine = rDescription.aKeyWord + " Action:" + rDescription.aAction + " Id:"
|
||||
|
Reference in New Issue
Block a user