diff options
author | Saurav Chirania <saurav.chir@gmail.com> | 2018-07-23 14:32:24 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-07-28 01:10:23 +0200 |
commit | f458dabcaa18d66b054d00f5d9a389c06240f0eb (patch) | |
tree | 68f5aa7858c75729f99caddc950ac585f71cb95f /vcl | |
parent | 0c350906b1d6dc27383619dd3338fe28768f1c2e (diff) |
uitest: support parameters when sending UNO commands
This patch introduces a new function to send parameters
with UNO commands in UI Tests and adds a test which
uses the function to change the color of text in writer.
Change-Id: Ic687872ab826b50360e1bd042d9668a9f6ddbf63
Reviewed-on: https://gerrit.libreoffice.org/57857
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/uitest/uitest.cxx | 19 | ||||
-rw-r--r-- | vcl/source/uitest/uno/uitest_uno.cxx | 10 |
2 files changed, 29 insertions, 0 deletions
diff --git a/vcl/source/uitest/uitest.cxx b/vcl/source/uitest/uitest.cxx index 658b8cf75a82..bf1f69bfe54b 100644 --- a/vcl/source/uitest/uitest.cxx +++ b/vcl/source/uitest/uitest.cxx @@ -25,6 +25,25 @@ bool UITest::executeCommand(const OUString& rCommand) css::beans::PropertyState_DIRECT_VALUE}}); } +bool UITest::executeCommandWithParameters(const OUString& rCommand, + const css::uno::Sequence< css::beans::PropertyValue >& rArgs) +{ + css::uno::Sequence< css::beans::PropertyValue > lNewArgs = + {{"SynchronMode", -1, css::uno::Any(true), + css::beans::PropertyState_DIRECT_VALUE}}; + + sal_uInt32 nArgs = rArgs.getLength(); + if ( nArgs > 0 ) + { + sal_uInt32 nIndex( lNewArgs.getLength() ); + lNewArgs.realloc( lNewArgs.getLength()+rArgs.getLength() ); + + for ( sal_uInt32 i = 0; i < nArgs; i++ ) + lNewArgs[nIndex++] = rArgs[i]; + } + return comphelper::dispatchCommand(rCommand,lNewArgs); +} + bool UITest::executeDialog(const OUString& rCommand) { return comphelper::dispatchCommand( diff --git a/vcl/source/uitest/uno/uitest_uno.cxx b/vcl/source/uitest/uno/uitest_uno.cxx index a625e670667e..69d0c717a9bb 100644 --- a/vcl/source/uitest/uno/uitest_uno.cxx +++ b/vcl/source/uitest/uno/uitest_uno.cxx @@ -40,6 +40,9 @@ public: sal_Bool SAL_CALL executeCommand(const OUString& rCommand) override; + sal_Bool SAL_CALL executeCommandWithParameters(const OUString& rCommand, + const css::uno::Sequence< css::beans::PropertyValue >& rArgs) override; + sal_Bool SAL_CALL executeDialog(const OUString& rCommand) override; css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getTopFocusWindow() override; @@ -65,6 +68,13 @@ sal_Bool SAL_CALL UITestUnoObj::executeCommand(const OUString& rCommand) return UITest::executeCommand(rCommand); } +sal_Bool SAL_CALL UITestUnoObj::executeCommandWithParameters(const OUString& rCommand, + const css::uno::Sequence< css::beans::PropertyValue >& rArgs) +{ + SolarMutexGuard aGuard; + return UITest::executeCommandWithParameters(rCommand,rArgs); +} + sal_Bool SAL_CALL UITestUnoObj::executeDialog(const OUString& rCommand) { SolarMutexGuard aGuard; |