diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-01-19 08:31:54 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-18 17:01:36 +0200 |
commit | e9b0ea5067ee8b7c49c4c39c713c383096fcc0c3 (patch) | |
tree | 31afc240ced636c63da624ced3e1501fc649528a /vcl/source/uitest | |
parent | ef6acba3375e1d2cbd6f9cef745b7bd154c2c4f2 (diff) |
uitest: add checkboxes to UI testing
Change-Id: I923fa22b0395b2f41bffe3798fb3e4eb18fe5dc2
Diffstat (limited to 'vcl/source/uitest')
-rw-r--r-- | vcl/source/uitest/factory.cxx | 7 | ||||
-rw-r--r-- | vcl/source/uitest/uiobject.cxx | 34 |
2 files changed, 41 insertions, 0 deletions
diff --git a/vcl/source/uitest/factory.cxx b/vcl/source/uitest/factory.cxx index 4225f70c36e1..1b4373d98af2 100644 --- a/vcl/source/uitest/factory.cxx +++ b/vcl/source/uitest/factory.cxx @@ -53,6 +53,13 @@ std::unique_ptr<UIObject> UITestWrapperFactory::createObject(vcl::Window* pWindo return std::unique_ptr<UIObject>(new EditUIObject(pEdit)); } break; + case WINDOW_CHECKBOX: + { + CheckBox* pCheckBox = dynamic_cast<CheckBox*>(pWindow); + assert(pCheckBox); + return std::unique_ptr<UIObject>(new CheckBoxUIObject(pCheckBox)); + } + break; default: break; } diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index 450369c271ea..463bcd86c512 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -380,4 +380,38 @@ OUString EditUIObject::get_name() const return OUString("EditUIObject"); } +CheckBoxUIObject::CheckBoxUIObject(VclPtr<CheckBox> xCheckbox): + WindowUIObject(xCheckbox), + mxCheckBox(xCheckbox) +{ +} + +void CheckBoxUIObject::execute(const OUString& rAction, + const StringMap& /*rParameters*/) +{ + if (rAction == "CLICK") + { + // don't use toggle directly, it does not set the value + mxCheckBox->ImplCheck(); + } +} + +StringMap CheckBoxUIObject::get_state() +{ + StringMap aMap = WindowUIObject::get_state(); + aMap["Selected"] = OUString::boolean(mxCheckBox->IsChecked()); + aMap["TriStateEnabled"] = OUString::boolean(mxCheckBox->IsTriStateEnabled()); + return aMap; +} + +UIObjectType CheckBoxUIObject::get_type() const +{ + return UIObjectType::CHECKBOX; +} + +OUString CheckBoxUIObject::get_name() const +{ + return OUString("CheckBoxUIObject"); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |