diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-28 19:01:14 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:44 +0200 |
commit | 720130a5272480cce4dd0604ecbfa4b01bdaaeec (patch) | |
tree | 03b40a17bc466749a96328bd9c63e8e0dbbce296 /vcl/source | |
parent | 5155fa72f670c6bcfad969363e25a70a1dca7fd5 (diff) |
uitest: replace assert with correct error handling
Change-Id: Ie998858ea1c67b3bc8a03c50ee55860cd87a8809
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 259cb9f40647..737fa9283cf7 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(); |