[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/source vcl/source

Saurav Chirania saurav.chir at gmail.com
Sun Jun 3 15:09:45 UTC 2018


 include/vcl/uitest/uiobject.hxx  |    6 +++++
 sfx2/source/control/unoctitm.cxx |    2 -
 vcl/source/uitest/logger.cxx     |    5 +++-
 vcl/source/uitest/uiobject.cxx   |   41 ++++++++++++++++++++++++++++++++++++++-
 vcl/source/window/dialog.cxx     |    4 +--
 5 files changed, 53 insertions(+), 5 deletions(-)

New commits:
commit 06f819baaaf615d4d02e3c0838513c3544389024
Author: Saurav Chirania <saurav.chir at gmail.com>
Date:   Mon May 28 10:12:40 2018 +0530

    uitest logger: ListboxSelect and ListboxFocus logging
    
    Change-Id: I5a38adaeea3c2e64366563bd449d8bf06d9161a3
    Reviewed-on: https://gerrit.libreoffice.org/55112
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 2f4604d9f882..c7c64f8c9189 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -944,7 +944,13 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
     if (nEvent == VclEventId::ListboxSelect)
     {
         sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
-        return "Action on element: " + mxListBox->get_id() + " with action : SELECT and content {\"POS\": \"" + OUString::number(nPos) + "\"}";
+        return this->get_type() + " Action:SELECT Id:" + mxListBox->get_id() +
+            " POS:" + OUString::number(nPos) + " Parent:" + get_top_parent(mxListBox)->get_id();
+    }
+    else if (nEvent == VclEventId::ListboxFocus)
+    {
+        return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id() +
+            " Parent:" + get_top_parent(mxListBox)->get_id();
     }
     else
         return WindowUIObject::get_action(nEvent);
commit 1a91d1a5956e16080af3f64c1597387dd57b9570
Author: Saurav Chirania <saurav.chir at gmail.com>
Date:   Wed May 23 19:46:56 2018 +0530

    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 at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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();
 }
 


More information about the Libreoffice-commits mailing list