vcl/source/uitest/uno/uiobject_uno.cxx | 2 ++ vcl/source/uitest/uno/uitest_uno.cxx | 4 ++++ 2 files changed, 6 insertions(+)
New commits: commit 39ca990a6e6a1e9b18241683ca7e9a2013db2356 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri May 3 20:46:17 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon May 6 19:25:40 2024 +0200 throw more obvious error when a UITest fails to find a ui object otherwise we might hit the assert inside the UIObjectUnoObj constructor Change-Id: I546964c0ec21bf4f874825dfd7dc11fc99ace502 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167099 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index a17c744c0331..5a67cf5f902e 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -57,6 +57,8 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UIObjectUnoObj::getChild( SolarMutexGuard aGuard; std::unique_ptr<UIObject> pObj = mpObj->get_child(rID); SAL_WARN_IF(!pObj, "vcl", "child " << rID << " of parent " << mpObj->dumpState() << " does not exist"); + if (!pObj) + throw css::uno::RuntimeException("getChild with id " + rID + " did not find a child"); return new UIObjectUnoObj(std::move(pObj)); } diff --git a/vcl/source/uitest/uno/uitest_uno.cxx b/vcl/source/uitest/uno/uitest_uno.cxx index 9886b049a43a..12694521fc19 100644 --- a/vcl/source/uitest/uno/uitest_uno.cxx +++ b/vcl/source/uitest/uno/uitest_uno.cxx @@ -80,6 +80,8 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getTopFocus { SolarMutexGuard aGuard; std::unique_ptr<UIObject> pObj = UITest::getFocusTopWindow(); + if (!pObj) + throw css::uno::RuntimeException("UITest::getFocusTopWindow did not find a window"); return new UIObjectUnoObj(std::move(pObj)); } @@ -87,6 +89,8 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getFloatWin { SolarMutexGuard aGuard; std::unique_ptr<UIObject> pObj = UITest::getFloatWindow(); + if (!pObj) + throw css::uno::RuntimeException("UITest::getFloatWindow did not find a window"); return new UIObjectUnoObj(std::move(pObj)); }