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

2017-03-25 Thread Markus Mohrhard
 include/vcl/uitest/uitest.hxx   |2 ++
 offapi/com/sun/star/ui/test/XUITest.idl |2 ++
 vcl/source/uitest/uitest.cxx|   12 
 vcl/source/uitest/uno/uitest_uno.cxx|9 +
 4 files changed, 25 insertions(+)

New commits:
commit 3c979a362b59b87dee62c85403c3c1f28f59f951
Author: Markus Mohrhard 
Date:   Sun Mar 26 00:24:10 2017 +0100

uitest: provide a way to select a floating window, e.g. popup menu

Change-Id: Ice418b974c59c7d8c773b81a82f0a06c84547f10
Reviewed-on: https://gerrit.libreoffice.org/35699
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/include/vcl/uitest/uitest.hxx b/include/vcl/uitest/uitest.hxx
index 53a049069a14..1674ad2fd50f 100644
--- a/include/vcl/uitest/uitest.hxx
+++ b/include/vcl/uitest/uitest.hxx
@@ -24,6 +24,8 @@ public:
 static void executeDialog(const OUString& rCommand);
 
 static std::unique_ptr getFocusTopWindow();
+
+static std::unique_ptr getFloatWindow();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/ui/test/XUITest.idl 
b/offapi/com/sun/star/ui/test/XUITest.idl
index 89da44c7d6e7..55f234164296 100644
--- a/offapi/com/sun/star/ui/test/XUITest.idl
+++ b/offapi/com/sun/star/ui/test/XUITest.idl
@@ -21,6 +21,8 @@ interface XUITest
 void executeDialog([in] string command);
 
 XUIObject getTopFocusWindow();
+
+XUIObject getFloatWindow();
 };
 
 }; }; }; }; };
diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx
index 413201843ced..3b19a9acc49c 100644
--- a/vcl/source/uitest/uitest.cxx
+++ b/vcl/source/uitest/uitest.cxx
@@ -49,4 +49,16 @@ std::unique_ptr UITest::getFocusTopWindow()
 return rWinData.mpFirstFrame->GetUITestFactory()(rWinData.mpFirstFrame);
 }
 
+std::unique_ptr UITest::getFloatWindow()
+{
+ImplSVData* pSVData = ImplGetSVData();
+ImplSVWinData& rWinData = pSVData->maWinData;
+
+VclPtr pFloatWin = rWinData.mpFirstFloat;
+if (pFloatWin)
+return pFloatWin->GetUITestFactory()(pFloatWin);
+
+return nullptr;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/uno/uitest_uno.cxx 
b/vcl/source/uitest/uno/uitest_uno.cxx
index c5a15a4f52ee..1d874c32c7d1 100644
--- a/vcl/source/uitest/uno/uitest_uno.cxx
+++ b/vcl/source/uitest/uno/uitest_uno.cxx
@@ -44,6 +44,8 @@ public:
 
 css::uno::Reference SAL_CALL getTopFocusWindow() 
override;
 
+css::uno::Reference SAL_CALL getFloatWindow() 
override;
+
 OUString SAL_CALL getImplementationName() override;
 
 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
@@ -76,6 +78,13 @@ css::uno::Reference SAL_CALL 
UITestUnoObj::getTopFocus
 return new UIObjectUnoObj(std::move(pObj));
 }
 
+css::uno::Reference SAL_CALL 
UITestUnoObj::getFloatWindow()
+{
+SolarMutexGuard aGuard;
+std::unique_ptr pObj = UITest::getFloatWindow();
+return new UIObjectUnoObj(std::move(pObj));
+}
+
 OUString SAL_CALL UITestUnoObj::getImplementationName()
 {
 return OUString("org.libreoffice.uitest.UITest");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-07 Thread Markus Mohrhard
 include/vcl/uitest/uiobject.hxx   |8 +++---
 offapi/com/sun/star/ui/test/XUIObject.idl |2 +
 vcl/source/uitest/uiobject.cxx|   40 +-
 vcl/source/uitest/uno/uiobject_uno.cxx|9 ++
 vcl/source/uitest/uno/uiobject_uno.hxx|2 +
 5 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit 4c02332d3d60de7a166d10413edf6e76b85d5a91
Author: Markus Mohrhard 
Date:   Mon Feb 6 18:09:12 2017 +0100

uitest: provide a way to get a json representation of the ui info

This just provides the information that is also available through the
getState method in a nicer way.

Change-Id: Ib64f6ecd2c4e9c0a940f3f9607c9a777233e90d2
Reviewed-on: https://gerrit.libreoffice.org/33978
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index f2eae6e..c2de7d4 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -83,7 +83,7 @@ public:
  * This method should not be exposed to the outside world.
  *
  */
-virtual void dumpState() const;
+virtual OUString dumpState() const;
 
 /**
  * Currently an internal method to dump the parent-child relationship 
starting from the current top focus window.
@@ -91,7 +91,7 @@ public:
  * This method should not be exposed to the outside world.
  *
  */
-virtual void dumpHierarchy() const;
+virtual OUString dumpHierarchy() const;
 };
 
 class UITEST_DLLPUBLIC WindowUIObject : public UIObject
@@ -113,9 +113,9 @@ public:
 
 virtual std::set get_children() const override;
 
-virtual void dumpState() const override;
+virtual OUString dumpState() const override;
 
-virtual void dumpHierarchy() const override;
+virtual OUString dumpHierarchy() const override;
 
 static std::unique_ptr create(vcl::Window* pWindow);
 
diff --git a/offapi/com/sun/star/ui/test/XUIObject.idl 
b/offapi/com/sun/star/ui/test/XUIObject.idl
index 9409490..e437b19 100644
--- a/offapi/com/sun/star/ui/test/XUIObject.idl
+++ b/offapi/com/sun/star/ui/test/XUIObject.idl
@@ -25,6 +25,8 @@ interface XUIObject
 string getType();
 
 sequence getChildren();
+
+string getHierarchy();
 };
 
 }; }; }; }; };
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index d5b1d70..10c67b0 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -26,8 +26,6 @@
 #include 
 #include 
 
-#define DUMP_UITEST(x) SAL_INFO("vcl.uitest", x)
-
 UIObject::~UIObject()
 {
 }
@@ -61,12 +59,14 @@ std::set UIObject::get_children() const
 return std::set();
 }
 
-void UIObject::dumpState() const
+OUString UIObject::dumpState() const
 {
+return OUString();
 }
 
-void UIObject::dumpHierarchy() const
+OUString UIObject::dumpHierarchy() const
 {
+return OUString();
 }
 
 namespace {
@@ -425,34 +425,50 @@ OUString WindowUIObject::get_name() const
 return OUString("WindowUIObject");
 }
 
-void WindowUIObject::dumpState() const
+OUString WindowUIObject::dumpState() const
 {
-DUMP_UITEST(get_name() << " " << mxWindow->get_id());
-DUMP_UITEST("Implementation Name: " << typeid(*mxWindow.get()).name());
+OUStringBuffer aStateString = "{\"name\":\"" + mxWindow->get_id() + "\"";
+aStateString.append(", 
\"ImplementationName\":\"").appendAscii(typeid(*mxWindow.get()).name()).append("\"");
 StringMap aState = const_cast(this)->get_state();
 for (auto itr = aState.begin(), itrEnd = aState.end(); itr != itrEnd; 
++itr)
 {
-DUMP_UITEST("Property: " << itr->first << " with value: " << 
itr->second);
+OUString property = ",\"" + itr->first + "\":\"" + itr->second + "\"";
+aStateString.append(property);
 }
+
 size_t nCount = mxWindow->GetChildCount();
+
 if (nCount)
-DUMP_UITEST("With " << nCount << " Children:");
+aStateString.append(",\"children\":[");
 
 for (size_t i = 0; i < nCount; ++i)
 {
+if (i != 0)
+{
+aStateString.append(",");
+}
 vcl::Window* pChild = mxWindow->GetChild(i);
 std::unique_ptr pChildWrapper =
 pChild->GetUITestFactory()(pChild);
-pChildWrapper->dumpState();
+OUString children = pChildWrapper->dumpState();
+aStateString.append(children);
 }
+
+if (nCount)
+aStateString.append("]");
+
+aStateString.append("}");
+
+OUString aString = aStateString.makeStringAndClear();
+return aString.replaceAll("\n", "\\n");
 }
 
-void WindowUIObject::dumpHierarchy() const
+OUString WindowUIObject::dumpHierarchy() const
 {
 vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
 std::unique_ptr pParentWrapper =
 pDialogParent->GetUITestFactory()(pDialogParent);
-