diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-01-09 04:56:47 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:27 +0200 |
commit | 41160b5ed4be15bf0e57ff9ebd492429a14ebb71 (patch) | |
tree | 3c7d9fda4321378c014109fad1c3b29d47ba7e4d /vcl/source/uitest | |
parent | 3fdb733874cdc53afd92d14a49d1d76c7c7f12ac (diff) |
uitest: add ui test wrapper for Edit
Change-Id: Ife00f65311c44703edae06971f77faa6b0e2eb3f
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/factory.cxx | 8 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 49 |
2 files changed, 57 insertions, 0 deletions
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx index 37c65d48b6b3..4225f70c36e1 100644 --- a/vcl/source/uitest/factory.cxx +++ b/vcl/source/uitest/factory.cxx @@ -45,6 +45,14 @@ std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindo return std::unique_ptr<UIObject>(new DialogUIObject(pDialog)); } break; + case WINDOW_EDIT: + case WINDOW_MULTILINEEDIT: + { + Edit* pEdit = dynamic_cast<Edit*>(pWindow); + assert(pEdit); + return std::unique_ptr<UIObject>(new EditUIObject(pEdit)); + } + break; default: break; } diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index ae79f3959c5a..94e3a7d2e65a 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -235,4 +235,53 @@ UIObjectType DialogUIObject::getType() const return UIObjectType::DIALOG; } +EditUIObject::EditUIObject(VclPtr<Edit> xEdit): + WindowUIObject(xEdit), + mxEdit(xEdit) +{ +} + +void EditUIObject::execute(const OUString& rAction, + const StringMap& rParameters) +{ + if (rAction == "SET") + { + if (rParameters.find("TEXT") != rParameters.end()) + { + assert(rParameters.size() == 1); // only the text + mxEdit->SetText(rParameters.find("TEXT")->second); + } + else if (rParameters.find("SELECTION") != rParameters.end()) + { + // TODO: moggi: add code + } + else + SAL_WARN("vcl.uitest", "unkown set parameters for EditUIObject"); + } + else + { + SAL_WARN("vcl.uitest", "unknown action for EditUIObject: " << rAction); + } +} + +StringMap EditUIObject::get_state() +{ + StringMap aMap = WindowUIObject::get_state(); + aMap["MaxTextLength"] = OUString::number(mxEdit->GetMaxTextLen()); + aMap["SelectedText"] = mxEdit->GetSelected(); + aMap["Text"] = mxEdit->GetText(); + + return aMap; +} + +UIObjectType EditUIObject::getType() const +{ + return UIObjectType::EDIT; +} + +OUString EditUIObject::get_name() const +{ + return OUString("EditUIObject"); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |