xref: /trunk/main/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
19d7e27acSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39d7e27acSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49d7e27acSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59d7e27acSAndrew Rist  * distributed with this work for additional information
69d7e27acSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79d7e27acSAndrew Rist  * to you under the Apache License, Version 2.0 (the
89d7e27acSAndrew Rist  * "License"); you may not use this file except in compliance
99d7e27acSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
119d7e27acSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
139d7e27acSAndrew Rist  * Unless required by applicable law or agreed to in writing,
149d7e27acSAndrew Rist  * software distributed under the License is distributed on an
159d7e27acSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169d7e27acSAndrew Rist  * KIND, either express or implied.  See the License for the
179d7e27acSAndrew Rist  * specific language governing permissions and limitations
189d7e27acSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
209d7e27acSAndrew Rist  *************************************************************/
219d7e27acSAndrew Rist 
229d7e27acSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cppuhelper.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "test/cppuhelper/propertysetmixin/CppSupplier.hpp"
30cdf0e10cSrcweir #include "test/cppuhelper/propertysetmixin/JavaSupplier.hpp"
31cdf0e10cSrcweir #include "test/cppuhelper/propertysetmixin/XSupplier.hpp"
32cdf0e10cSrcweir #include "test/cppuhelper/propertysetmixin/XTest3.hpp"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include "com/sun/star/beans/Ambiguous.hpp"
35cdf0e10cSrcweir #include "com/sun/star/beans/Defaulted.hpp"
36cdf0e10cSrcweir #include "com/sun/star/beans/Optional.hpp"
37cdf0e10cSrcweir #include "com/sun/star/beans/Property.hpp"
38cdf0e10cSrcweir #include "com/sun/star/beans/PropertyAttribute.hpp"
39cdf0e10cSrcweir #include "com/sun/star/beans/PropertyChangeEvent.hpp"
40cdf0e10cSrcweir #include "com/sun/star/beans/PropertyState.hpp"
41cdf0e10cSrcweir #include "com/sun/star/beans/PropertyValue.hpp"
42cdf0e10cSrcweir #include "com/sun/star/beans/PropertyVetoException.hpp"
43cdf0e10cSrcweir #include "com/sun/star/beans/UnknownPropertyException.hpp"
44cdf0e10cSrcweir #include "com/sun/star/beans/XFastPropertySet.hpp"
45cdf0e10cSrcweir #include "com/sun/star/beans/XPropertyAccess.hpp"
46cdf0e10cSrcweir #include "com/sun/star/beans/XPropertyChangeListener.hpp"
47cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySet.hpp"
48cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySetInfo.hpp"
49cdf0e10cSrcweir #include "com/sun/star/beans/XVetoableChangeListener.hpp"
50cdf0e10cSrcweir #include "com/sun/star/lang/XComponent.hpp"
51cdf0e10cSrcweir #include "com/sun/star/uno/Any.hxx"
52cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
53cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
54cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx"
55cdf0e10cSrcweir #include "com/sun/star/uno/Type.hxx"
56cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp"
57cdf0e10cSrcweir #include "cppuhelper/bootstrap.hxx"
58cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx"
59*8807d2faSDamjan Jovanovic #include "gtest/gtest.h"
60cdf0e10cSrcweir #include "osl/mutex.hxx"
61cdf0e10cSrcweir #include "rtl/ref.hxx"
62cdf0e10cSrcweir #include "rtl/string.h"
63cdf0e10cSrcweir #include "rtl/textenc.h"
64cdf0e10cSrcweir #include "rtl/ustring.h"
65cdf0e10cSrcweir #include "rtl/ustring.hxx"
66cdf0e10cSrcweir #include "sal/types.h"
67*8807d2faSDamjan Jovanovic #include "osl/process.h"
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #include <limits>
70cdf0e10cSrcweir #include <ostream>
71cdf0e10cSrcweir 
72cdf0e10cSrcweir namespace com { namespace sun { namespace star {
73cdf0e10cSrcweir     struct EventObject;
74cdf0e10cSrcweir } } }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir namespace css = com::sun::star;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir namespace {
79cdf0e10cSrcweir 
operator <<(std::ostream & out,rtl::OUString const & value)80cdf0e10cSrcweir std::ostream & operator <<(std::ostream & out, rtl::OUString const & value) {
81cdf0e10cSrcweir     return out << rtl::OUStringToOString(value, RTL_TEXTENCODING_UTF8).getStr();
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
operator <<(std::ostream & out,css::uno::Type const & value)84cdf0e10cSrcweir std::ostream & operator <<(std::ostream & out, css::uno::Type const & value) {
85cdf0e10cSrcweir     return out << "com::sun::star::uno::Type[" << value.getTypeName() << ']';
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
operator <<(std::ostream & out,css::uno::Any const & value)88cdf0e10cSrcweir std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) {
89cdf0e10cSrcweir     return
90cdf0e10cSrcweir         out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]";
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir class BoundListener:
94cdf0e10cSrcweir     public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
95cdf0e10cSrcweir {
96cdf0e10cSrcweir public:
BoundListener()97cdf0e10cSrcweir     BoundListener(): m_count(0) {}
98cdf0e10cSrcweir 
count() const99cdf0e10cSrcweir     int count() const {
100cdf0e10cSrcweir         osl::MutexGuard g(m_mutex);
101cdf0e10cSrcweir         return m_count;
102cdf0e10cSrcweir     }
103cdf0e10cSrcweir 
disposing(css::lang::EventObject const &)104cdf0e10cSrcweir     virtual void SAL_CALL disposing(css::lang::EventObject const &)
105cdf0e10cSrcweir         throw (css::uno::RuntimeException)
106cdf0e10cSrcweir     {
107cdf0e10cSrcweir         osl::MutexGuard g(m_mutex);
108*8807d2faSDamjan Jovanovic         ASSERT_TRUE(m_count < std::numeric_limits< int >::max());
109cdf0e10cSrcweir         ++m_count;
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
propertyChange(css::beans::PropertyChangeEvent const &)112cdf0e10cSrcweir     virtual void SAL_CALL propertyChange(
113cdf0e10cSrcweir         css::beans::PropertyChangeEvent const &)
114cdf0e10cSrcweir         throw (css::uno::RuntimeException)
115*8807d2faSDamjan Jovanovic     { FAIL() << "BoundListener::propertyChange called"; }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir private:
118cdf0e10cSrcweir     BoundListener(BoundListener &); // not defined
119cdf0e10cSrcweir     void operator =(BoundListener &); // not defined
120cdf0e10cSrcweir 
~BoundListener()121cdf0e10cSrcweir     virtual ~BoundListener() {}
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     mutable osl::Mutex m_mutex;
124cdf0e10cSrcweir     int m_count;
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir class VetoListener:
128cdf0e10cSrcweir     public cppu::WeakImplHelper1< css::beans::XVetoableChangeListener >
129cdf0e10cSrcweir {
130cdf0e10cSrcweir public:
VetoListener()131cdf0e10cSrcweir     VetoListener(): m_count(0) {}
132cdf0e10cSrcweir 
count() const133cdf0e10cSrcweir     int count() const {
134cdf0e10cSrcweir         osl::MutexGuard g(m_mutex);
135cdf0e10cSrcweir         return m_count;
136cdf0e10cSrcweir     }
137cdf0e10cSrcweir 
disposing(css::lang::EventObject const &)138cdf0e10cSrcweir     virtual void SAL_CALL disposing(css::lang::EventObject const &)
139cdf0e10cSrcweir         throw (css::uno::RuntimeException)
140cdf0e10cSrcweir     {
141cdf0e10cSrcweir         osl::MutexGuard g(m_mutex);
142*8807d2faSDamjan Jovanovic         ASSERT_TRUE(m_count < std::numeric_limits< int >::max());
143cdf0e10cSrcweir         ++m_count;
144cdf0e10cSrcweir     }
145cdf0e10cSrcweir 
vetoableChange(css::beans::PropertyChangeEvent const &)146cdf0e10cSrcweir     virtual void SAL_CALL vetoableChange(
147cdf0e10cSrcweir         css::beans::PropertyChangeEvent const &)
148cdf0e10cSrcweir         throw (css::beans::PropertyVetoException, css::uno::RuntimeException)
149*8807d2faSDamjan Jovanovic     { FAIL() << "VetoListener::vetoableChange called"; }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir private:
152cdf0e10cSrcweir     VetoListener(VetoListener &); // not defined
153cdf0e10cSrcweir     void operator =(VetoListener &); // not defined
154cdf0e10cSrcweir 
~VetoListener()155cdf0e10cSrcweir     virtual ~VetoListener() {}
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     mutable osl::Mutex m_mutex;
158cdf0e10cSrcweir     int m_count;
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161*8807d2faSDamjan Jovanovic class Test: public ::testing::Test {
162cdf0e10cSrcweir public:
163*8807d2faSDamjan Jovanovic     virtual void SetUp();
164cdf0e10cSrcweir 
165*8807d2faSDamjan Jovanovic     virtual void TearDown();
166cdf0e10cSrcweir 
167*8807d2faSDamjan Jovanovic protected:
168cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
169cdf0e10cSrcweir     getCppSupplier() const;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
172cdf0e10cSrcweir     getJavaSupplier() const;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     void testEmpty1(
175cdf0e10cSrcweir         css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
176cdf0e10cSrcweir         const & supplier) const;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     void testEmpty2(
179cdf0e10cSrcweir         css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
180cdf0e10cSrcweir         const & supplier) const;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     void testFull(
183cdf0e10cSrcweir         css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
184cdf0e10cSrcweir         const & supplier) const;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     css::uno::Reference< css::uno::XComponentContext > m_context;
187cdf0e10cSrcweir };
188cdf0e10cSrcweir 
SetUp()189*8807d2faSDamjan Jovanovic void Test::SetUp() {
190cdf0e10cSrcweir     m_context = cppu::defaultBootstrap_InitialComponentContext();
191*8807d2faSDamjan Jovanovic     ASSERT_TRUE(m_context.is());
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
TearDown()194*8807d2faSDamjan Jovanovic void Test::TearDown() {
195cdf0e10cSrcweir     css::uno::Reference< css::lang::XComponent >(
196cdf0e10cSrcweir         m_context, css::uno::UNO_QUERY_THROW)->dispose();
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
getCppSupplier() const200cdf0e10cSrcweir Test::getCppSupplier() const
201cdf0e10cSrcweir {
202cdf0e10cSrcweir     return test::cppuhelper::propertysetmixin::CppSupplier::create(m_context);
203cdf0e10cSrcweir }
204cdf0e10cSrcweir 
205cdf0e10cSrcweir css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
getJavaSupplier() const206cdf0e10cSrcweir Test::getJavaSupplier() const
207cdf0e10cSrcweir {
208cdf0e10cSrcweir     return test::cppuhelper::propertysetmixin::JavaSupplier::create(m_context);
209cdf0e10cSrcweir }
210cdf0e10cSrcweir 
testEmpty1(css::uno::Reference<test::cppuhelper::propertysetmixin::XSupplier> const & supplier) const211cdf0e10cSrcweir void Test::testEmpty1(
212cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
213cdf0e10cSrcweir     const & supplier) const
214cdf0e10cSrcweir {
215cdf0e10cSrcweir     css::uno::Reference< css::lang::XComponent > empty1(
216cdf0e10cSrcweir         supplier->getEmpty1(), css::uno::UNO_QUERY_THROW);
217*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
218cdf0e10cSrcweir         !css::uno::Reference< css::beans::XPropertySet >(
219cdf0e10cSrcweir             empty1, css::uno::UNO_QUERY).is());
220*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
221cdf0e10cSrcweir         !css::uno::Reference< css::beans::XFastPropertySet >(
222cdf0e10cSrcweir             empty1, css::uno::UNO_QUERY).is());
223*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
224cdf0e10cSrcweir         !css::uno::Reference< css::beans::XPropertyAccess >(
225cdf0e10cSrcweir             empty1, css::uno::UNO_QUERY).is());
226cdf0e10cSrcweir     empty1->dispose();
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
testEmpty2(css::uno::Reference<test::cppuhelper::propertysetmixin::XSupplier> const & supplier) const229cdf0e10cSrcweir void Test::testEmpty2(
230cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
231cdf0e10cSrcweir     const & supplier) const
232cdf0e10cSrcweir {
233cdf0e10cSrcweir     css::uno::Reference< css::lang::XComponent > empty2(
234cdf0e10cSrcweir         supplier->getEmpty2(), css::uno::UNO_QUERY_THROW);
235cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertySet > empty2p(
236cdf0e10cSrcweir         empty2, css::uno::UNO_QUERY);
237*8807d2faSDamjan Jovanovic     ASSERT_TRUE(empty2p.is());
238cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertySetInfo > info(
239cdf0e10cSrcweir         empty2p->getPropertySetInfo());
240*8807d2faSDamjan Jovanovic     ASSERT_TRUE(info.is());
241*8807d2faSDamjan Jovanovic     ASSERT_EQ(
242cdf0e10cSrcweir         static_cast< sal_Int32 >(0), info->getProperties().getLength());
243cdf0e10cSrcweir     try {
244cdf0e10cSrcweir         info->getPropertyByName(
245cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")));
246*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
247cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
248*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
249cdf0e10cSrcweir         !info->hasPropertyByName(
250cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any"))));
251cdf0e10cSrcweir     try {
252cdf0e10cSrcweir         empty2p->setPropertyValue(
253cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")), css::uno::Any());
254*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
255cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
256cdf0e10cSrcweir     try {
257cdf0e10cSrcweir         empty2p->getPropertyValue(
258cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any")));
259*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
260cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
261cdf0e10cSrcweir     rtl::Reference< BoundListener > boundListener1(new BoundListener);
262cdf0e10cSrcweir     empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get());
263cdf0e10cSrcweir     empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get());
264cdf0e10cSrcweir     rtl::Reference< BoundListener > boundListener2(new BoundListener);
265cdf0e10cSrcweir     empty2p->removePropertyChangeListener(
266cdf0e10cSrcweir         rtl::OUString(), boundListener2.get());
267cdf0e10cSrcweir     rtl::Reference< VetoListener > vetoListener1(new VetoListener);
268cdf0e10cSrcweir     empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get());
269cdf0e10cSrcweir     empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get());
270cdf0e10cSrcweir     rtl::Reference< VetoListener > vetoListener2(new VetoListener);
271cdf0e10cSrcweir     empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener2.get());
272cdf0e10cSrcweir     empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener2.get());
273cdf0e10cSrcweir     css::uno::Reference< css::beans::XFastPropertySet > empty2f(
274cdf0e10cSrcweir         empty2, css::uno::UNO_QUERY);
275*8807d2faSDamjan Jovanovic     ASSERT_TRUE(empty2f.is());
276cdf0e10cSrcweir     try {
277cdf0e10cSrcweir         empty2f->setFastPropertyValue(-1, css::uno::Any());
278*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
279cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
280cdf0e10cSrcweir     try {
281cdf0e10cSrcweir         empty2f->setFastPropertyValue(0, css::uno::Any());
282*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
283cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
284cdf0e10cSrcweir     try {
285cdf0e10cSrcweir         empty2f->getFastPropertyValue(-1);
286*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
287cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
288cdf0e10cSrcweir     try {
289cdf0e10cSrcweir         empty2f->getFastPropertyValue(0);
290*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
291cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
292cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertyAccess > empty2a(
293cdf0e10cSrcweir         empty2, css::uno::UNO_QUERY);
294*8807d2faSDamjan Jovanovic     ASSERT_TRUE(empty2a.is());
295*8807d2faSDamjan Jovanovic     ASSERT_EQ(
296cdf0e10cSrcweir         static_cast< sal_Int32 >(0), empty2a->getPropertyValues().getLength());
297cdf0e10cSrcweir     empty2a->setPropertyValues(
298cdf0e10cSrcweir         css::uno::Sequence< css::beans::PropertyValue >());
299cdf0e10cSrcweir     css::uno::Sequence< css::beans::PropertyValue > vs(2);
300cdf0e10cSrcweir     vs[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any1"));
301cdf0e10cSrcweir     vs[0].Handle = -1;
302cdf0e10cSrcweir     vs[0].State = css::beans::PropertyState_DIRECT_VALUE;
303cdf0e10cSrcweir     vs[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("any2"));
304cdf0e10cSrcweir     vs[0].Handle = -1;
305cdf0e10cSrcweir     vs[0].State = css::beans::PropertyState_DIRECT_VALUE;
306cdf0e10cSrcweir     try {
307cdf0e10cSrcweir         empty2a->setPropertyValues(vs);
308*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
309cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
310*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, boundListener1->count());
311*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, boundListener2->count());
312*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, vetoListener1->count());
313*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, vetoListener2->count());
314cdf0e10cSrcweir     empty2->dispose();
315*8807d2faSDamjan Jovanovic     ASSERT_EQ(2, boundListener1->count());
316*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, boundListener2->count());
317*8807d2faSDamjan Jovanovic     ASSERT_EQ(2, vetoListener1->count());
318*8807d2faSDamjan Jovanovic     ASSERT_EQ(0, vetoListener2->count());
319cdf0e10cSrcweir     empty2p->removePropertyChangeListener(
320cdf0e10cSrcweir         rtl::OUString(), boundListener1.get());
321cdf0e10cSrcweir     empty2p->removePropertyChangeListener(
322cdf0e10cSrcweir         rtl::OUString(), boundListener2.get());
323cdf0e10cSrcweir     empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener1.get());
324cdf0e10cSrcweir     empty2p->removeVetoableChangeListener(rtl::OUString(), vetoListener2.get());
325cdf0e10cSrcweir     empty2p->addPropertyChangeListener(rtl::OUString(), boundListener1.get());
326cdf0e10cSrcweir     empty2p->addPropertyChangeListener(rtl::OUString(), boundListener2.get());
327cdf0e10cSrcweir     empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener1.get());
328cdf0e10cSrcweir     empty2p->addVetoableChangeListener(rtl::OUString(), vetoListener2.get());
329cdf0e10cSrcweir     try {
330cdf0e10cSrcweir         empty2p->addPropertyChangeListener(
331cdf0e10cSrcweir             rtl::OUString(),
332cdf0e10cSrcweir             css::uno::Reference< css::beans::XPropertyChangeListener >());
333cdf0e10cSrcweir     } catch (css::uno::RuntimeException &) {}
334cdf0e10cSrcweir     try {
335cdf0e10cSrcweir         empty2p->addVetoableChangeListener(
336cdf0e10cSrcweir             rtl::OUString(),
337cdf0e10cSrcweir             css::uno::Reference< css::beans::XVetoableChangeListener >());
338cdf0e10cSrcweir     } catch (css::uno::RuntimeException &) {}
339*8807d2faSDamjan Jovanovic     ASSERT_EQ(3, boundListener1->count());
340*8807d2faSDamjan Jovanovic     ASSERT_EQ(1, boundListener2->count());
341*8807d2faSDamjan Jovanovic     ASSERT_EQ(3, vetoListener1->count());
342*8807d2faSDamjan Jovanovic     ASSERT_EQ(1, vetoListener2->count());
343cdf0e10cSrcweir }
344cdf0e10cSrcweir 
testFull(css::uno::Reference<test::cppuhelper::propertysetmixin::XSupplier> const & supplier) const345cdf0e10cSrcweir void Test::testFull(
346cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
347cdf0e10cSrcweir     const & supplier) const
348cdf0e10cSrcweir {
349cdf0e10cSrcweir     css::uno::Reference< test::cppuhelper::propertysetmixin::XTest3 > full(
350cdf0e10cSrcweir         supplier->getFull(), css::uno::UNO_QUERY_THROW);
351cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertySet > fullp(
352cdf0e10cSrcweir         full, css::uno::UNO_QUERY);
353*8807d2faSDamjan Jovanovic     ASSERT_TRUE(fullp.is());
354cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertySetInfo > info(
355cdf0e10cSrcweir         fullp->getPropertySetInfo());
356*8807d2faSDamjan Jovanovic     ASSERT_TRUE(info.is());
357*8807d2faSDamjan Jovanovic     ASSERT_EQ(
358cdf0e10cSrcweir         static_cast< sal_Int32 >(3), info->getProperties().getLength());
359cdf0e10cSrcweir     css::beans::Property prop(
360cdf0e10cSrcweir         info->getPropertyByName(
361cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First"))));
362*8807d2faSDamjan Jovanovic     ASSERT_EQ(
363cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), prop.Name);
364*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(0), prop.Handle);
365*8807d2faSDamjan Jovanovic     ASSERT_EQ(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type);
366*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int16 >(0), prop.Attributes);
367cdf0e10cSrcweir     prop = info->getPropertyByName(
368cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")));
369*8807d2faSDamjan Jovanovic     ASSERT_EQ(
370cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), prop.Name);
371*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(1), prop.Handle);
372*8807d2faSDamjan Jovanovic     ASSERT_EQ(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type);
373*8807d2faSDamjan Jovanovic     ASSERT_EQ(
374cdf0e10cSrcweir         static_cast< sal_Int16 >(
375cdf0e10cSrcweir             css::beans::PropertyAttribute::MAYBEVOID
376cdf0e10cSrcweir             | css::beans::PropertyAttribute::BOUND
377cdf0e10cSrcweir             | css::beans::PropertyAttribute::CONSTRAINED
378cdf0e10cSrcweir             | css::beans::PropertyAttribute::MAYBEAMBIGUOUS
379cdf0e10cSrcweir             | css::beans::PropertyAttribute::MAYBEDEFAULT
380cdf0e10cSrcweir             | css::beans::PropertyAttribute::OPTIONAL),
381cdf0e10cSrcweir         prop.Attributes);
382cdf0e10cSrcweir     try {
383cdf0e10cSrcweir         info->getPropertyByName(
384cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")));
385*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
386cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
387cdf0e10cSrcweir     prop = info->getPropertyByName(
388cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")));
389*8807d2faSDamjan Jovanovic     ASSERT_EQ(
390cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), prop.Name);
391*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(3), prop.Handle);
392*8807d2faSDamjan Jovanovic     ASSERT_EQ(getCppuType(static_cast< sal_Int32 * >(0)), prop.Type);
393*8807d2faSDamjan Jovanovic     ASSERT_EQ(
394cdf0e10cSrcweir         static_cast< sal_Int16 >(css::beans::PropertyAttribute::OPTIONAL),
395cdf0e10cSrcweir         prop.Attributes);
396cdf0e10cSrcweir     try {
397cdf0e10cSrcweir         info->getPropertyByName(
398cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first")));
399*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
400cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
401*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
402cdf0e10cSrcweir         info->hasPropertyByName(
403cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First"))));
404*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
405cdf0e10cSrcweir         info->hasPropertyByName(
406cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second"))));
407*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
408cdf0e10cSrcweir         !info->hasPropertyByName(
409cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third"))));
410*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
411cdf0e10cSrcweir         info->hasPropertyByName(
412cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth"))));
413*8807d2faSDamjan Jovanovic     ASSERT_TRUE(
414cdf0e10cSrcweir         !info->hasPropertyByName(
415cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first"))));
416*8807d2faSDamjan Jovanovic     ASSERT_EQ(
417cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(0)),
418cdf0e10cSrcweir         fullp->getPropertyValue(
419cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First"))));
420cdf0e10cSrcweir     fullp->setPropertyValue(
421cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")),
422cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(-100)));
423*8807d2faSDamjan Jovanovic     ASSERT_EQ(
424cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(-100)),
425cdf0e10cSrcweir         fullp->getPropertyValue(
426cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First"))));
427cdf0e10cSrcweir     css::uno::Any voidAny;
428*8807d2faSDamjan Jovanovic     ASSERT_EQ(
429cdf0e10cSrcweir         voidAny,
430cdf0e10cSrcweir         fullp->getPropertyValue(
431cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second"))));
432cdf0e10cSrcweir     fullp->setPropertyValue(
433cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")),
434cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(100)));
435*8807d2faSDamjan Jovanovic     ASSERT_EQ(
436cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(100)),
437cdf0e10cSrcweir         fullp->getPropertyValue(
438cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second"))));
439*8807d2faSDamjan Jovanovic     ASSERT_TRUE(full->getSecond().Value.Value.IsPresent);
440*8807d2faSDamjan Jovanovic     ASSERT_EQ(
441cdf0e10cSrcweir         static_cast< sal_Int32 >(100), full->getSecond().Value.Value.Value);
442*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().Value.IsDefaulted);
443*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().IsAmbiguous);
444cdf0e10cSrcweir     fullp->setPropertyValue(
445cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")),
446cdf0e10cSrcweir         css::uno::Any());
447*8807d2faSDamjan Jovanovic     ASSERT_EQ(
448cdf0e10cSrcweir         voidAny,
449cdf0e10cSrcweir         fullp->getPropertyValue(
450cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second"))));
451*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().Value.Value.IsPresent);
452*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().Value.IsDefaulted);
453*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().IsAmbiguous);
454cdf0e10cSrcweir     try {
455cdf0e10cSrcweir         fullp->setPropertyValue(
456cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")),
457cdf0e10cSrcweir             css::uno::makeAny(static_cast< sal_Int32 >(100)));
458*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
459cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
460cdf0e10cSrcweir     try {
461cdf0e10cSrcweir         fullp->getPropertyValue(
462cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")));
463*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
464cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
465cdf0e10cSrcweir     try {
466cdf0e10cSrcweir         fullp->setPropertyValue(
467cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")),
468cdf0e10cSrcweir             css::uno::makeAny(static_cast< sal_Int32 >(100)));
469*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
470cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
471cdf0e10cSrcweir     try {
472cdf0e10cSrcweir         fullp->getPropertyValue(
473cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")));
474*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
475cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
476cdf0e10cSrcweir     try {
477cdf0e10cSrcweir         fullp->setPropertyValue(
478cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first")),
479cdf0e10cSrcweir             css::uno::Any());
480*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
481cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
482cdf0e10cSrcweir     try {
483cdf0e10cSrcweir         fullp->getPropertyValue(
484cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("first")));
485*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
486cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
487cdf0e10cSrcweir     css::uno::Reference< css::beans::XFastPropertySet > fullf(
488cdf0e10cSrcweir         full, css::uno::UNO_QUERY);
489*8807d2faSDamjan Jovanovic     ASSERT_TRUE(fullf.is());
490*8807d2faSDamjan Jovanovic     ASSERT_EQ(
491cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(-100)),
492cdf0e10cSrcweir         fullf->getFastPropertyValue(0));
493cdf0e10cSrcweir     fullf->setFastPropertyValue(
494cdf0e10cSrcweir         0, css::uno::makeAny(static_cast< sal_Int32 >(0)));
495*8807d2faSDamjan Jovanovic     ASSERT_EQ(
496cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(0)),
497cdf0e10cSrcweir         fullf->getFastPropertyValue(0));
498cdf0e10cSrcweir     try {
499cdf0e10cSrcweir         fullf->getFastPropertyValue(-1);
500cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
501cdf0e10cSrcweir     try {
502cdf0e10cSrcweir         fullf->setFastPropertyValue(-1, css::uno::Any());
503cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
504cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertyAccess > fulla(
505cdf0e10cSrcweir         full, css::uno::UNO_QUERY);
506*8807d2faSDamjan Jovanovic     ASSERT_TRUE(fulla.is());
507cdf0e10cSrcweir     css::uno::Sequence< css::beans::PropertyValue > vs(
508cdf0e10cSrcweir         fulla->getPropertyValues());
509*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(2), vs.getLength());
510*8807d2faSDamjan Jovanovic     ASSERT_EQ(
511cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vs[0].Name);
512*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(0), vs[0].Handle);
513*8807d2faSDamjan Jovanovic     ASSERT_EQ(
514cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(0)), vs[0].Value);
515*8807d2faSDamjan Jovanovic     ASSERT_EQ(css::beans::PropertyState_DIRECT_VALUE, vs[0].State);
516*8807d2faSDamjan Jovanovic     ASSERT_EQ(
517cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vs[1].Name);
518*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(1), vs[1].Handle);
519*8807d2faSDamjan Jovanovic     ASSERT_EQ(voidAny, vs[1].Value);
520*8807d2faSDamjan Jovanovic     ASSERT_EQ(css::beans::PropertyState_DIRECT_VALUE, vs[1].State);
521cdf0e10cSrcweir     vs[0].Value <<= static_cast< sal_Int32 >(-100);
522cdf0e10cSrcweir     vs[1].Value <<= static_cast< sal_Int32 >(100);
523cdf0e10cSrcweir     vs[1].State = css::beans::PropertyState_AMBIGUOUS_VALUE;
524cdf0e10cSrcweir     fulla->setPropertyValues(vs);
525cdf0e10cSrcweir     vs = fulla->getPropertyValues();
526*8807d2faSDamjan Jovanovic     ASSERT_EQ(static_cast< sal_Int32 >(2), vs.getLength());
527*8807d2faSDamjan Jovanovic     ASSERT_EQ(
528cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vs[0].Name);
529*8807d2faSDamjan Jovanovic     ASSERT_EQ(
530cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(-100)), vs[0].Value);
531*8807d2faSDamjan Jovanovic     ASSERT_EQ(css::beans::PropertyState_DIRECT_VALUE, vs[0].State);
532*8807d2faSDamjan Jovanovic     ASSERT_EQ(
533cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vs[1].Name);
534*8807d2faSDamjan Jovanovic     ASSERT_EQ(
535cdf0e10cSrcweir         css::uno::makeAny(static_cast< sal_Int32 >(100)), vs[1].Value);
536*8807d2faSDamjan Jovanovic     ASSERT_EQ(
537cdf0e10cSrcweir         css::beans::PropertyState_AMBIGUOUS_VALUE, vs[1].State);
538*8807d2faSDamjan Jovanovic     ASSERT_TRUE(full->getSecond().Value.Value.IsPresent);
539*8807d2faSDamjan Jovanovic     ASSERT_EQ(
540cdf0e10cSrcweir         static_cast< sal_Int32 >(100), full->getSecond().Value.Value.Value);
541*8807d2faSDamjan Jovanovic     ASSERT_TRUE(!full->getSecond().Value.IsDefaulted);
542*8807d2faSDamjan Jovanovic     ASSERT_TRUE(full->getSecond().IsAmbiguous);
543cdf0e10cSrcweir     css::uno::Reference< css::beans::XPropertyChangeListener > boundListener(
544cdf0e10cSrcweir         new BoundListener);
545cdf0e10cSrcweir     fullp->addPropertyChangeListener(
546cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), boundListener);
547cdf0e10cSrcweir     fullp->removePropertyChangeListener(
548cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), boundListener);
549cdf0e10cSrcweir     fullp->addPropertyChangeListener(
550cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), boundListener);
551cdf0e10cSrcweir     fullp->removePropertyChangeListener(
552cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), boundListener);
553cdf0e10cSrcweir     try {
554cdf0e10cSrcweir         fullp->addPropertyChangeListener(
555cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")),
556cdf0e10cSrcweir             boundListener);
557*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
558cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
559cdf0e10cSrcweir     try {
560cdf0e10cSrcweir         fullp->removePropertyChangeListener(
561cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")),
562cdf0e10cSrcweir             boundListener);
563*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
564cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
565cdf0e10cSrcweir     fullp->addPropertyChangeListener(
566cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), boundListener);
567cdf0e10cSrcweir     fullp->removePropertyChangeListener(
568cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), boundListener);
569cdf0e10cSrcweir     try {
570cdf0e10cSrcweir         fullp->addPropertyChangeListener(
571cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")),
572cdf0e10cSrcweir             boundListener);
573*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
574cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
575cdf0e10cSrcweir     try {
576cdf0e10cSrcweir         fullp->removePropertyChangeListener(
577cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")),
578cdf0e10cSrcweir             boundListener);
579*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
580cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
581cdf0e10cSrcweir     css::uno::Reference< css::beans::XVetoableChangeListener > vetoListener(
582cdf0e10cSrcweir         new VetoListener);
583cdf0e10cSrcweir     fullp->addVetoableChangeListener(
584cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vetoListener);
585cdf0e10cSrcweir     fullp->removeVetoableChangeListener(
586cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("First")), vetoListener);
587cdf0e10cSrcweir     fullp->addVetoableChangeListener(
588cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vetoListener);
589cdf0e10cSrcweir     fullp->removeVetoableChangeListener(
590cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Second")), vetoListener);
591cdf0e10cSrcweir     try {
592cdf0e10cSrcweir         fullp->addVetoableChangeListener(
593cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")),
594cdf0e10cSrcweir             vetoListener);
595*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
596cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
597cdf0e10cSrcweir     try {
598cdf0e10cSrcweir         fullp->removeVetoableChangeListener(
599cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Third")),
600cdf0e10cSrcweir             vetoListener);
601*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
602cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
603cdf0e10cSrcweir     fullp->addVetoableChangeListener(
604cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), vetoListener);
605cdf0e10cSrcweir     fullp->removeVetoableChangeListener(
606cdf0e10cSrcweir         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fourth")), vetoListener);
607cdf0e10cSrcweir     try {
608cdf0e10cSrcweir         fullp->addVetoableChangeListener(
609cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")),
610cdf0e10cSrcweir             vetoListener);
611*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
612cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
613cdf0e10cSrcweir     try {
614cdf0e10cSrcweir         fullp->removeVetoableChangeListener(
615cdf0e10cSrcweir             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Fifth")),
616cdf0e10cSrcweir             vetoListener);
617*8807d2faSDamjan Jovanovic         FAIL() << "exception expected";
618cdf0e10cSrcweir     } catch (css::beans::UnknownPropertyException &) {}
619cdf0e10cSrcweir }
620cdf0e10cSrcweir 
TEST_F(Test,testCppEmpty1)621*8807d2faSDamjan Jovanovic TEST_F(Test, testCppEmpty1) { testEmpty1(getCppSupplier()); }
622*8807d2faSDamjan Jovanovic 
TEST_F(Test,testCppEmpty2)623*8807d2faSDamjan Jovanovic TEST_F(Test, testCppEmpty2) { testEmpty2(getCppSupplier()); }
624*8807d2faSDamjan Jovanovic 
TEST_F(Test,testCppFull)625*8807d2faSDamjan Jovanovic TEST_F(Test, testCppFull) { testFull(getCppSupplier()); }
626*8807d2faSDamjan Jovanovic 
TEST_F(Test,testJavaEmpty1)627*8807d2faSDamjan Jovanovic TEST_F(Test, testJavaEmpty1) { testEmpty1(getJavaSupplier()); }
628*8807d2faSDamjan Jovanovic 
TEST_F(Test,testJavaEmpty2)629*8807d2faSDamjan Jovanovic TEST_F(Test, testJavaEmpty2) { testEmpty2(getJavaSupplier()); }
630*8807d2faSDamjan Jovanovic 
TEST_F(Test,testJavaFull)631*8807d2faSDamjan Jovanovic TEST_F(Test, testJavaFull) { testFull(getJavaSupplier()); }
632*8807d2faSDamjan Jovanovic 
633*8807d2faSDamjan Jovanovic 
634cdf0e10cSrcweir 
635cdf0e10cSrcweir }
636cdf0e10cSrcweir 
main(int argc,char ** argv)637*8807d2faSDamjan Jovanovic int main(int argc, char **argv)
638*8807d2faSDamjan Jovanovic {
639*8807d2faSDamjan Jovanovic     osl_setCommandArgs(argc, argv);
640*8807d2faSDamjan Jovanovic     ::testing::InitGoogleTest(&argc, argv);
641*8807d2faSDamjan Jovanovic     return RUN_ALL_TESTS();
642*8807d2faSDamjan Jovanovic }
643