[Libreoffice-commits] core.git: Branch 'private/moggi/ui-test' - 3 commits - vcl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Mon Mar 28 17:04:19 UTC 2016
vcl/source/uitest/factory.cxx | 8 ++++++++
vcl/source/uitest/uiobject.cxx | 18 +++++++++++++++---
vcl/source/uitest/uno/uiobject_uno.cxx | 9 +++++++++
3 files changed, 32 insertions(+), 3 deletions(-)
New commits:
commit 2578309c4016330381abca761fd5239df5b13c7b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Mar 28 19:03:20 2016 +0200
avoid crashes when trying to access missing UI object
Change-Id: Icf6acf23be021bcf386c574289966eff813a67e3
diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx
index fc66839..485fd1b 100644
--- a/vcl/source/uitest/uno/uiobject_uno.cxx
+++ b/vcl/source/uitest/uno/uiobject_uno.cxx
@@ -23,6 +23,9 @@ UIObjectUnoObj::~UIObjectUnoObj()
css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UIObjectUnoObj::getChild(const OUString& rID)
throw (css::uno::RuntimeException, std::exception)
{
+ if (!mpObj)
+ throw css::uno::RuntimeException();
+
SolarMutexGuard aGuard;
SAL_DEBUG(mpObj->get_state()["ID"]);
SAL_DEBUG(rID);
@@ -34,6 +37,9 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UIObjectUnoObj::getChild(
void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::uno::Sequence<css::beans::PropertyValue>& rPropValues)
throw (css::uno::RuntimeException, std::exception)
{
+ if (!mpObj)
+ throw css::uno::RuntimeException();
+
SolarMutexGuard aGuard;
StringMap aMap;
for (sal_Int32 i = 0, n = rPropValues.getLength(); i < n; ++i)
@@ -50,6 +56,9 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css::
css::uno::Sequence<css::beans::PropertyValue> UIObjectUnoObj::getState()
throw (css::uno::RuntimeException, std::exception)
{
+ if (!mpObj)
+ throw css::uno::RuntimeException();
+
SolarMutexGuard aGuard;
StringMap aMap = mpObj->get_state();
css::uno::Sequence<css::beans::PropertyValue> aProps(aMap.size());
commit 857954637cabcb24b3b012eabefdea587ebb56ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Mar 28 19:01:41 2016 +0200
forgot the uitest spi button wrapper in the factory
Change-Id: I5dfc9b74c2017b6aee9d3c4c01b892e9826cda58
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx
index 77c3eb9..6cf1516 100644
--- a/vcl/source/uitest/factory.cxx
+++ b/vcl/source/uitest/factory.cxx
@@ -13,6 +13,7 @@
#include <vcl/tabpage.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
+#include <vcl/spin.hxx>
std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindow)
{
@@ -90,6 +91,13 @@ std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindo
// return std::unique_ptr<UIObject>(new TabPageUIObject(pTabPage));
}
break;
+ case WINDOW_SPINBUTTON:
+ {
+ SpinButton* pSpinButton = dynamic_cast<SpinButton*>(pWindow);
+ assert(pSpinButton);
+ return std::unique_ptr<UIObject>(new SpinUIObject(pSpinButton));
+ }
+ break;
default:
break;
}
commit 23870254b88b28d4ecbcda1c5418beb3ddbcdef0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Mar 28 19:01:14 2016 +0200
replace assert with correct error handling
Change-Id: Ie998858ea1c67b3bc8a03c50ee55860cd87a8809
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 259cb9f..737fa92 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -183,8 +183,14 @@ void WindowUIObject::execute(const OUString& rAction,
}
else if (rAction == "TYPE")
{
- assert(rParameters.find("TEXT") != rParameters.end());
- const OUString& rText = rParameters.find("TEXT")->second;
+ auto itr = rParameters.find("TEXT");
+ if (itr == rParameters.end())
+ {
+ SAL_WARN("vcl.uitest", "missing parameter TEXT to action TYPE");
+ return;
+ }
+
+ const OUString& rText = itr->second;
auto aKeyEvents = generate_key_events_from_text(rText);
for (auto itr = aKeyEvents.begin(), itrEnd = aKeyEvents.end();
itr != itrEnd; ++itr)
@@ -347,7 +353,13 @@ void EditUIObject::execute(const OUString& rAction,
{
if (rParameters.find("TEXT") != rParameters.end())
{
- assert(rParameters.size() == 1); // only the text
+ auto itr = rParameters.find("TEXT");
+ if (itr == rParameters.end())
+ {
+ SAL_WARN("vcl.uitest", "missing parameter TEXT to action SET");
+ return;
+ }
+
const OUString& rText = rParameters.find("TEXT")->second;
auto aKeyEvents = generate_key_events_from_text(rText);
for (auto itr = aKeyEvents.begin(), itrEnd = aKeyEvents.end();
More information about the Libreoffice-commits
mailing list