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

Saurav Chirania saurav.chir at gmail.com
Fri Jul 6 17:45:15 UTC 2018


 include/vcl/ctrl.hxx            |    2 ++
 include/vcl/uitest/uiobject.hxx |    2 ++
 vcl/source/control/ctrl.cxx     |   11 +++++++++--
 vcl/source/uitest/uiobject.cxx  |   17 +++++++++++++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 09e8815066c133b6a53fd5bc2f3d3ab8ad6e4248
Author: Saurav Chirania <saurav.chir at gmail.com>
Date:   Wed Jul 4 13:55:50 2018 +0530

    uitest logger: log the events calling CallEventListeners()
    
    Some events directly call CallEventListeners() instead
    of calling ImplCallEventListenersAndHandler.
    This patch thus moves logAction to CallEventListeners()
    Further, this patch adds logging for EditSelectionChanged
    which is broadcasted using CallEventListeners().
    
    Change-Id: Ib15367688cdbcdb542f6139d270d8d463f214fde
    Reviewed-on: https://gerrit.libreoffice.org/56952
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 5529cf86b912..48daf0e5401e 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -76,6 +76,8 @@ protected:
                     VclEventId nEvent, std::function<void()> const & callHandler
                 );
 
+    void        CallEventListeners( VclEventId nEvent, void* pData = nullptr );
+
     /** draws the given text onto the given device
 
         If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise,
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 37f9f883f058..5ff62735ea02 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -189,6 +189,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/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index a807409bdd2d..edf535e2968e 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -296,12 +296,19 @@ void Control::AppendLayoutData( const Control& rSubControl ) const
     }
 }
 
-bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, std::function<void()> const & callHandler )
+void Control::CallEventListeners( VclEventId nEvent, void* pData)
 {
     VclPtr<Control> xThis(this);
     UITestLogger::getInstance().logAction(xThis, nEvent);
 
-    CallEventListeners( nEvent );
+    vcl::Window::CallEventListeners(nEvent, pData);
+}
+
+bool Control::ImplCallEventListenersAndHandler( VclEventId nEvent, std::function<void()> const & callHandler )
+{
+    VclPtr<Control> xThis(this);
+
+    Control::CallEventListeners( nEvent );
 
     if ( !xThis->IsDisposed() )
     {
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index b098205470eb..5b72f2ab1945 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -684,6 +684,23 @@ StringMap EditUIObject::get_state()
     return aMap;
 }
 
+OUString EditUIObject::get_action(VclEventId nEvent) const
+{
+    if (nEvent == VclEventId::EditSelectionChanged)
+    {
+        const Selection& rSelection  = mxEdit->GetSelection();
+        long nMin = rSelection.Min();
+        long nMax = rSelection.Max();
+        return this->get_type() + " Action:SELECT Id:" +
+                mxEdit->get_id() +
+                " Parent:" + get_top_parent(mxEdit)->get_id() +
+                " {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
+                OUString::number(nMax) + "\"}";
+    }
+    else
+        return WindowUIObject::get_action(nEvent);
+}
+
 OUString EditUIObject::get_name() const
 {
     return OUString("EditUIObject");


More information about the Libreoffice-commits mailing list