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