summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurav Chirania <saurav.chir@gmail.com>2018-05-23 19:46:56 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-06-03 17:09:16 +0200
commit1a91d1a5956e16080af3f64c1597387dd57b9570 (patch)
tree7e18cc73b4da6296656043d0771c53c301440412
parent565340d457f41197474a75ba1b036bdc3d569041 (diff)
uitest logger: support for buttons, dialog, command and key logging
This patch adds logging faclity for radiobuttons, checkboxes and button clicks. It modifies the logging for UNO commands and dialogs execution for consistency with other log statements. It also makes key logging more informative by printing the details of the object on which the user is typing. Change-Id: I911d0dfb64dacfde64193f0aea21f7d837dbf9da Reviewed-on: https://gerrit.libreoffice.org/54745 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--include/vcl/uitest/uiobject.hxx6
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--vcl/source/uitest/logger.cxx5
-rw-r--r--vcl/source/uitest/uiobject.cxx33
-rw-r--r--vcl/source/window/dialog.cxx4
5 files changed, 46 insertions, 4 deletions
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 0493cbc19c98..ea90b640824c 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -148,6 +148,8 @@ public:
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+ virtual OUString get_action(VclEventId nEvent) const override;
+
protected:
virtual OUString get_name() const override;
@@ -230,6 +232,8 @@ public:
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+ virtual OUString get_action(VclEventId nEvent) const override;
+
protected:
virtual OUString get_name() const override;
@@ -251,6 +255,8 @@ public:
static std::unique_ptr<UIObject> create(vcl::Window* pWindow);
+ virtual OUString get_action(VclEventId nEvent) const override;
+
protected:
virtual OUString get_name() const override;
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 372a7751ca2c..9c8c13e9afaa 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -600,7 +600,7 @@ void collectUIInformation(const util::URL& rURL)
if (!pFile)
return;
- UITestLogger::getInstance().logCommand(rURL.Complete);
+ UITestLogger::getInstance().logCommand("CommandSent Name:" + rURL.Complete);
}
}
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 4f07f6994529..e9a18df9b400 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -157,7 +157,10 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
aKeyCode = "{\"TEXT\": \"" + OUStringLiteral1(nChar) + "\"}";
}
- OUString aContent = "Action on element: " + rID + " with action: TYPE and content: " + aKeyCode;
+ std::unique_ptr<UIObject> pUIObject = xUIElement->GetUITestFactory()(xUIElement.get());
+
+ OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
+ rID + " Parent: UNKNOWN "+ aKeyCode;
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index ff117e34c6f1..2f4604d9f882 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -563,6 +563,17 @@ OUString ButtonUIObject::get_name() const
return OUString("ButtonUIObject");
}
+OUString ButtonUIObject::get_action(VclEventId nEvent) const
+{
+ if (nEvent == VclEventId::ButtonClick)
+ {
+ return this->get_type() + " Action:CLICK Id:" + mxButton->get_id() + " Parent:" +
+ get_top_parent(mxButton)->get_id();
+ }
+ else
+ return WindowUIObject::get_action(nEvent);
+}
+
std::unique_ptr<UIObject> ButtonUIObject::create(vcl::Window* pWindow)
{
Button* pButton = dynamic_cast<Button*>(pWindow);
@@ -773,6 +784,17 @@ OUString CheckBoxUIObject::get_name() const
return OUString("CheckBoxUIObject");
}
+OUString CheckBoxUIObject::get_action(VclEventId nEvent) const
+{
+ if (nEvent == VclEventId::CheckboxToggle)
+ {
+ return this->get_type() + " Action:CLICK Id:" + mxCheckBox->get_id() + " Parent:" +
+ get_top_parent(mxCheckBox)->get_id();
+ }
+ else
+ return WindowUIObject::get_action(nEvent);
+}
+
std::unique_ptr<UIObject> CheckBoxUIObject::create(vcl::Window* pWindow)
{
CheckBox* pCheckBox = dynamic_cast<CheckBox*>(pWindow);
@@ -812,6 +834,17 @@ OUString RadioButtonUIObject::get_name() const
return OUString("RadioButtonUIObject");
}
+OUString RadioButtonUIObject::get_action(VclEventId nEvent) const
+{
+ if (nEvent == VclEventId::RadiobuttonToggle)
+ {
+ return this->get_type() + " Action:CLICK Id:" + mxRadioButton->get_id() + " Parent:" +
+ get_top_parent(mxRadioButton)->get_id();
+ }
+ else
+ return WindowUIObject::get_action(nEvent);
+}
+
std::unique_ptr<UIObject> RadioButtonUIObject::create(vcl::Window* pWindow)
{
RadioButton* pRadioButton = dynamic_cast<RadioButton*>(pWindow);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 00040af4aeb9..b7c1a3392a73 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -905,7 +905,7 @@ bool Dialog::ImplStartExecuteModal()
css::document::DocumentEvent aObject;
aObject.EventName = "DialogExecute";
xEventBroadcaster->documentEventOccured(aObject);
- UITestLogger::getInstance().log("DialogExecute");
+ UITestLogger::getInstance().log("ModalDialogExecuted Id:" + get_id());
if (comphelper::LibreOfficeKit::isActive())
{
@@ -1444,6 +1444,7 @@ VclBuilderContainer::~VclBuilderContainer()
ModelessDialog::ModelessDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, InitFlag eFlag)
: Dialog(pParent, rID, rUIXMLDescription, WindowType::MODELESSDIALOG, eFlag)
{
+ UITestLogger::getInstance().log("ModelessDialogConstructed Id:" + get_id());
}
ModalDialog::ModalDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, bool bBorder ) :
@@ -1459,7 +1460,6 @@ void ModelessDialog::Activate()
css::document::DocumentEvent aObject;
aObject.EventName = "ModelessDialogVisible";
xEventBroadcaster->documentEventOccured(aObject);
- UITestLogger::getInstance().log("Modeless Dialog Visible");
Dialog::Activate();
}