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