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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Oct 15 12:15:59 UTC 2020


 include/svx/weldeditview.hxx       |    2 +
 svx/source/dialog/weldeditview.cxx |   38 +++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

New commits:
commit 464f872ea9b5d6d5090cad2ebf9d561e778f3f53
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 15 10:21:13 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 15 14:15:21 2020 +0200

    add a GetUITestFactory for WeldEditView
    
    Change-Id: I9d174279163de1cd2297234441c8e0263e0a6631
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104354
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/weldeditview.hxx b/include/svx/weldeditview.hxx
index 00f49f6965a7..11f35c2e7164 100644
--- a/include/svx/weldeditview.hxx
+++ b/include/svx/weldeditview.hxx
@@ -32,6 +32,8 @@ public:
 
     OUString GetText() const { return m_xEditEngine->GetText(); }
 
+    virtual FactoryFunction GetUITestFactory() const override;
+
     void SetModifyHdl(const Link<LinkParamNone*, void>& rLink)
     {
         m_xEditEngine->SetModifyHdl(rLink);
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index e7d90fab15b8..9f4329b7adfd 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -40,9 +40,11 @@
 #include <unotools/accessiblestatesethelper.hxx>
 #include <vcl/cursor.hxx>
 #include <vcl/event.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/ptrstyle.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/uitest/uiobject.hxx>
 
 WeldEditView::WeldEditView() {}
 
@@ -1495,4 +1497,40 @@ void WeldEditView::LoseFocus()
     }
 }
 
+namespace
+{
+class WeldEditViewUIObject final : public WindowUIObject
+{
+private:
+    WeldEditView* mpEditView;
+
+public:
+    WeldEditViewUIObject(vcl::Window* pEditViewWin, WeldEditView* pEditView)
+        : WindowUIObject(pEditViewWin)
+        , mpEditView(pEditView)
+    {
+    }
+
+    static std::unique_ptr<UIObject> create(vcl::Window* pWindow)
+    {
+        VclDrawingArea* pEditViewWin = dynamic_cast<VclDrawingArea*>(pWindow);
+        assert(pEditViewWin);
+        return std::unique_ptr<UIObject>(new WeldEditViewUIObject(
+            pEditViewWin, static_cast<WeldEditView*>(pEditViewWin->GetUserData())));
+    }
+
+    virtual StringMap get_state() override
+    {
+        StringMap aMap = WindowUIObject::get_state();
+        aMap["Text"] = mpEditView->GetText();
+        return aMap;
+    }
+
+private:
+    virtual OUString get_name() const override { return "WeldEditViewUIObject"; }
+};
+}
+
+FactoryFunction WeldEditView::GetUITestFactory() const { return WeldEditViewUIObject::create; }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list