diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-08-11 13:30:10 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-08-11 13:30:10 +0200 |
commit | 7c1f07dee02a5232d3e1ae9dcc4a0f8f02b9a528 (patch) | |
tree | b84fef7853a6b0650f9cc1b3b306f8de1a8edbf5 /smoketestoo_native | |
parent | 2719d50de4f3f53fb283c7e7ee11fc7f69797716 (diff) | |
parent | 068bd24c40aa21ba7df7e13dd76f8f62679033d3 (diff) |
CWS-TOOLING: integrate CWS sb128
Notes
Notes:
split repo tag: testing_LIBREOFFICE_CREATE
split repo tag: testing_ooo/OOO330_m4
Diffstat (limited to 'smoketestoo_native')
-rw-r--r-- | smoketestoo_native/smoketest.cxx | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/smoketestoo_native/smoketest.cxx b/smoketestoo_native/smoketest.cxx index e2cb51127f47..41baeddf9edb 100644 --- a/smoketestoo_native/smoketest.cxx +++ b/smoketestoo_native/smoketest.cxx @@ -28,6 +28,8 @@ #include "sal/config.h" #include "boost/noncopyable.hpp" +#include "com/sun/star/awt/XCallback.hpp" +#include "com/sun/star/awt/XRequestCallback.hpp" #include "com/sun/star/beans/PropertyState.hpp" #include "com/sun/star/beans/PropertyValue.hpp" #include "com/sun/star/document/MacroExecMode.hpp" @@ -40,6 +42,7 @@ #include "com/sun/star/frame/XModel.hpp" #include "com/sun/star/frame/XNotifyingDispatch.hpp" #include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" @@ -94,6 +97,29 @@ void Listener::dispatchFinished(css::frame::DispatchResultEvent const & Result) result_->condition.set(); } +class Callback: public cppu::WeakImplHelper1< css::awt::XCallback > { +public: + Callback( + css::uno::Reference< css::frame::XNotifyingDispatch > const & dispatch, + css::util::URL const & url, + css::uno::Sequence< css::beans::PropertyValue > const & arguments, + css::uno::Reference< css::frame::XDispatchResultListener > const & + listener): + dispatch_(dispatch), url_(url), arguments_(arguments), + listener_(listener) + { OSL_ASSERT(dispatch.is()); } + +private: + virtual void SAL_CALL notify(css::uno::Any const &) + throw (css::uno::RuntimeException) + { dispatch_->dispatchWithNotification(url_, arguments_, listener_); } + + css::uno::Reference< css::frame::XNotifyingDispatch > dispatch_; + css::util::URL url_; + css::uno::Sequence< css::beans::PropertyValue > arguments_; + css::uno::Reference< css::frame::XDispatchResultListener > listener_; +}; + class Test: public CppUnit::TestFixture { public: virtual void setUp(); @@ -135,8 +161,7 @@ void Test::test() { RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?" "language=Basic&location=document")); - Result result; - css::uno::Reference< css::frame::XNotifyingDispatch >( + css::uno::Reference< css::frame::XNotifyingDispatch > disp( css::uno::Reference< css::frame::XDispatchProvider >( css::uno::Reference< css::frame::XController >( css::uno::Reference< css::frame::XModel >( @@ -154,9 +179,18 @@ void Test::test() { css::uno::UNO_SET_THROW)->getFrame(), css::uno::UNO_QUERY_THROW)->queryDispatch( url, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0), - css::uno::UNO_QUERY_THROW)->dispatchWithNotification( - url, css::uno::Sequence< css::beans::PropertyValue >(), - new Listener(&result)); + css::uno::UNO_QUERY_THROW); + Result result; + // Shifted to main thread to work around potential deadlocks (i112867): + css::uno::Reference< css::awt::XRequestCallback >( + connection_.getFactory()->createInstance( //TODO: AsyncCallback ctor + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AsyncCallback"))), + css::uno::UNO_QUERY_THROW)->addCallback( + new Callback( + disp, url, css::uno::Sequence< css::beans::PropertyValue >(), + new Listener(&result)), + css::uno::Any()); result.condition.wait(); CPPUNIT_ASSERT(result.success); CPPUNIT_ASSERT_EQUAL(rtl::OUString(), result.result); |