1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <test/cppuhelper/propertysetmixin/CppSupplier.hpp>
21 #include <test/cppuhelper/propertysetmixin/JavaSupplier.hpp>
22 #include <test/cppuhelper/propertysetmixin/XSupplier.hpp>
23 #include <test/cppuhelper/propertysetmixin/XTest3.hpp>
25 #include <com/sun/star/beans/Ambiguous.hpp>
26 #include <com/sun/star/beans/Defaulted.hpp>
27 #include <com/sun/star/beans/Optional.hpp>
28 #include <com/sun/star/beans/Property.hpp>
29 #include <com/sun/star/beans/PropertyAttribute.hpp>
30 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
31 #include <com/sun/star/beans/PropertyState.hpp>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 #include <com/sun/star/beans/PropertyVetoException.hpp>
34 #include <com/sun/star/beans/UnknownPropertyException.hpp>
35 #include <com/sun/star/beans/XFastPropertySet.hpp>
36 #include <com/sun/star/beans/XPropertyAccess.hpp>
37 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/beans/XPropertySetInfo.hpp>
40 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
41 #include <com/sun/star/lang/XComponent.hpp>
42 #include <com/sun/star/uno/Any.hxx>
43 #include <com/sun/star/uno/Reference.hxx>
44 #include <com/sun/star/uno/RuntimeException.hpp>
45 #include <com/sun/star/uno/Sequence.hxx>
46 #include <com/sun/star/uno/Type.hxx>
47 #include <com/sun/star/uno/XComponentContext.hpp>
48 #include <cppuhelper/bootstrap.hxx>
49 #include <cppuhelper/implbase.hxx>
50 #include "cppunit/TestAssert.h"
51 #include "cppunit/TestFixture.h"
52 #include "cppunit/extensions/HelperMacros.h"
53 #include "cppunit/plugin/TestPlugIn.h"
54 #include <osl/mutex.hxx>
55 #include <rtl/ref.hxx>
56 #include <rtl/string.h>
57 #include <rtl/textenc.h>
58 #include <rtl/ustring.h>
59 #include <rtl/ustring.hxx>
60 #include <sal/types.h>
65 namespace com::sun::star
{
71 std::ostream
& operator <<(std::ostream
& out
, OUString
const & value
) {
72 return out
<< OUStringToOString(value
, RTL_TEXTENCODING_UTF8
).getStr();
75 std::ostream
& operator <<(std::ostream
& out
, css::uno::Type
const & value
) {
76 return out
<< "com::sun::star::uno::Type[" << value
.getTypeName() << ']';
79 std::ostream
& operator <<(std::ostream
& out
, css::uno::Any
const & value
) {
81 out
<< "com::sun::star::uno::Any[" << value
.getValueType() << ", ...]";
85 public cppu::WeakImplHelper
< css::beans::XPropertyChangeListener
>
88 BoundListener(): m_count(0) {}
91 osl::MutexGuard
g(m_mutex
);
95 virtual void SAL_CALL
disposing(css::lang::EventObject
const &)
96 throw (css::uno::RuntimeException
)
98 osl::MutexGuard
g(m_mutex
);
99 CPPUNIT_ASSERT(m_count
< std::numeric_limits
< int >::max());
103 virtual void SAL_CALL
propertyChange(
104 css::beans::PropertyChangeEvent
const &)
105 throw (css::uno::RuntimeException
)
106 { CPPUNIT_FAIL("BoundListener::propertyChange called"); }
109 BoundListener(BoundListener
&); // not defined
110 void operator =(BoundListener
&); // not defined
112 virtual ~BoundListener() {}
114 mutable osl::Mutex m_mutex
;
119 public cppu::WeakImplHelper
< css::beans::XVetoableChangeListener
>
122 VetoListener(): m_count(0) {}
125 osl::MutexGuard
g(m_mutex
);
129 virtual void SAL_CALL
disposing(css::lang::EventObject
const &)
130 throw (css::uno::RuntimeException
)
132 osl::MutexGuard
g(m_mutex
);
133 CPPUNIT_ASSERT(m_count
< std::numeric_limits
< int >::max());
137 virtual void SAL_CALL
vetoableChange(
138 css::beans::PropertyChangeEvent
const &)
139 throw (css::beans::PropertyVetoException
, css::uno::RuntimeException
)
140 { CPPUNIT_FAIL("VetoListener::vetoableChange called"); }
143 VetoListener(VetoListener
&); // not defined
144 void operator =(VetoListener
&); // not defined
146 virtual ~VetoListener() {}
148 mutable osl::Mutex m_mutex
;
152 class Test
: public CppUnit::TestFixture
{
154 virtual void setUp();
156 virtual void tearDown();
158 void testCppEmpty1() { testEmpty1(getCppSupplier()); }
160 void testCppEmpty2() { testEmpty2(getCppSupplier()); }
162 void testCppFull() { testFull(getCppSupplier()); }
164 void testJavaEmpty1() { testEmpty1(getJavaSupplier()); }
166 void testJavaEmpty2() { testEmpty2(getJavaSupplier()); }
168 void testJavaFull() { testFull(getJavaSupplier()); }
170 CPPUNIT_TEST_SUITE(Test
);
171 CPPUNIT_TEST(testCppEmpty1
);
172 CPPUNIT_TEST(testCppEmpty2
);
173 CPPUNIT_TEST(testCppFull
);
174 CPPUNIT_TEST(testJavaEmpty1
);
175 CPPUNIT_TEST(testJavaEmpty2
);
176 CPPUNIT_TEST(testJavaFull
);
177 CPPUNIT_TEST_SUITE_END();
180 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
181 getCppSupplier() const;
183 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
184 getJavaSupplier() const;
187 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
188 const & supplier
) const;
191 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
192 const & supplier
) const;
195 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
196 const & supplier
) const;
198 css::uno::Reference
< css::uno::XComponentContext
> m_context
;
202 m_context
= cppu::defaultBootstrap_InitialComponentContext();
203 CPPUNIT_ASSERT(m_context
.is());
206 void Test::tearDown() {
207 css::uno::Reference
< css::lang::XComponent
>(
208 m_context
, css::uno::UNO_QUERY_THROW
)->dispose();
211 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
212 Test::getCppSupplier() const
214 return test::cppuhelper::propertysetmixin::CppSupplier::create(m_context
);
217 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
218 Test::getJavaSupplier() const
220 return test::cppuhelper::propertysetmixin::JavaSupplier::create(m_context
);
223 void Test::testEmpty1(
224 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
225 const & supplier
) const
227 css::uno::Reference
< css::lang::XComponent
> empty1(
228 supplier
->getEmpty1(), css::uno::UNO_QUERY_THROW
);
230 !css::uno::Reference
< css::beans::XPropertySet
>(
231 empty1
, css::uno::UNO_QUERY
).is());
233 !css::uno::Reference
< css::beans::XFastPropertySet
>(
234 empty1
, css::uno::UNO_QUERY
).is());
236 !css::uno::Reference
< css::beans::XPropertyAccess
>(
237 empty1
, css::uno::UNO_QUERY
).is());
241 void Test::testEmpty2(
242 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
243 const & supplier
) const
245 css::uno::Reference
< css::lang::XComponent
> empty2(
246 supplier
->getEmpty2(), css::uno::UNO_QUERY_THROW
);
247 css::uno::Reference
< css::beans::XPropertySet
> empty2p(
248 empty2
, css::uno::UNO_QUERY
);
249 CPPUNIT_ASSERT(empty2p
.is());
250 css::uno::Reference
< css::beans::XPropertySetInfo
> info(
251 empty2p
->getPropertySetInfo());
252 CPPUNIT_ASSERT(info
.is());
253 CPPUNIT_ASSERT_EQUAL(
254 static_cast< sal_Int32
>(0), info
->getProperties().getLength());
256 info
->getPropertyByName(
258 CPPUNIT_FAIL("exception expected");
259 } catch (css::beans::UnknownPropertyException
&) {}
261 !info
->hasPropertyByName(
264 empty2p
->setPropertyValue(
265 OUString("any"), css::uno::Any());
266 CPPUNIT_FAIL("exception expected");
267 } catch (css::beans::UnknownPropertyException
&) {}
269 empty2p
->getPropertyValue(
271 CPPUNIT_FAIL("exception expected");
272 } catch (css::beans::UnknownPropertyException
&) {}
273 rtl::Reference
boundListener1(new BoundListener
);
274 empty2p
->addPropertyChangeListener(OUString(), boundListener1
.get());
275 empty2p
->addPropertyChangeListener(OUString(), boundListener1
.get());
276 rtl::Reference
boundListener2(new BoundListener
);
277 empty2p
->removePropertyChangeListener(
278 OUString(), boundListener2
.get());
279 rtl::Reference
vetoListener1(new VetoListener
);
280 empty2p
->addVetoableChangeListener(OUString(), vetoListener1
.get());
281 empty2p
->addVetoableChangeListener(OUString(), vetoListener1
.get());
282 rtl::Reference
vetoListener2(new VetoListener
);
283 empty2p
->addVetoableChangeListener(OUString(), vetoListener2
.get());
284 empty2p
->removeVetoableChangeListener(OUString(), vetoListener2
.get());
285 css::uno::Reference
< css::beans::XFastPropertySet
> empty2f(
286 empty2
, css::uno::UNO_QUERY
);
287 CPPUNIT_ASSERT(empty2f
.is());
289 empty2f
->setFastPropertyValue(-1, css::uno::Any());
290 CPPUNIT_FAIL("exception expected");
291 } catch (css::beans::UnknownPropertyException
&) {}
293 empty2f
->setFastPropertyValue(0, css::uno::Any());
294 CPPUNIT_FAIL("exception expected");
295 } catch (css::beans::UnknownPropertyException
&) {}
297 empty2f
->getFastPropertyValue(-1);
298 CPPUNIT_FAIL("exception expected");
299 } catch (css::beans::UnknownPropertyException
&) {}
301 empty2f
->getFastPropertyValue(0);
302 CPPUNIT_FAIL("exception expected");
303 } catch (css::beans::UnknownPropertyException
&) {}
304 css::uno::Reference
< css::beans::XPropertyAccess
> empty2a(
305 empty2
, css::uno::UNO_QUERY
);
306 CPPUNIT_ASSERT(empty2a
.is());
307 CPPUNIT_ASSERT_EQUAL(
308 static_cast< sal_Int32
>(0), empty2a
->getPropertyValues().getLength());
309 empty2a
->setPropertyValues(
310 css::uno::Sequence
< css::beans::PropertyValue
>());
311 css::uno::Sequence
< css::beans::PropertyValue
> vs(2);
312 vs
[0].Name
= OUString("any1");
314 vs
[0].State
= css::beans::PropertyState_DIRECT_VALUE
;
315 vs
[0].Name
= OUString("any2");
317 vs
[0].State
= css::beans::PropertyState_DIRECT_VALUE
;
319 empty2a
->setPropertyValues(vs
);
320 CPPUNIT_FAIL("exception expected");
321 } catch (css::beans::UnknownPropertyException
&) {}
322 CPPUNIT_ASSERT_EQUAL(0, boundListener1
->count());
323 CPPUNIT_ASSERT_EQUAL(0, boundListener2
->count());
324 CPPUNIT_ASSERT_EQUAL(0, vetoListener1
->count());
325 CPPUNIT_ASSERT_EQUAL(0, vetoListener2
->count());
327 CPPUNIT_ASSERT_EQUAL(2, boundListener1
->count());
328 CPPUNIT_ASSERT_EQUAL(0, boundListener2
->count());
329 CPPUNIT_ASSERT_EQUAL(2, vetoListener1
->count());
330 CPPUNIT_ASSERT_EQUAL(0, vetoListener2
->count());
331 empty2p
->removePropertyChangeListener(
332 OUString(), boundListener1
.get());
333 empty2p
->removePropertyChangeListener(
334 OUString(), boundListener2
.get());
335 empty2p
->removeVetoableChangeListener(OUString(), vetoListener1
.get());
336 empty2p
->removeVetoableChangeListener(OUString(), vetoListener2
.get());
337 empty2p
->addPropertyChangeListener(OUString(), boundListener1
.get());
338 empty2p
->addPropertyChangeListener(OUString(), boundListener2
.get());
339 empty2p
->addVetoableChangeListener(OUString(), vetoListener1
.get());
340 empty2p
->addVetoableChangeListener(OUString(), vetoListener2
.get());
342 empty2p
->addPropertyChangeListener(
344 css::uno::Reference
< css::beans::XPropertyChangeListener
>());
345 } catch (css::uno::RuntimeException
&) {}
347 empty2p
->addVetoableChangeListener(
349 css::uno::Reference
< css::beans::XVetoableChangeListener
>());
350 } catch (css::uno::RuntimeException
&) {}
351 CPPUNIT_ASSERT_EQUAL(3, boundListener1
->count());
352 CPPUNIT_ASSERT_EQUAL(1, boundListener2
->count());
353 CPPUNIT_ASSERT_EQUAL(3, vetoListener1
->count());
354 CPPUNIT_ASSERT_EQUAL(1, vetoListener2
->count());
358 css::uno::Reference
< test::cppuhelper::propertysetmixin::XSupplier
>
359 const & supplier
) const
361 css::uno::Reference
< test::cppuhelper::propertysetmixin::XTest3
> full(
362 supplier
->getFull(), css::uno::UNO_QUERY_THROW
);
363 css::uno::Reference
< css::beans::XPropertySet
> fullp(
364 full
, css::uno::UNO_QUERY
);
365 CPPUNIT_ASSERT(fullp
.is());
366 css::uno::Reference
< css::beans::XPropertySetInfo
> info(
367 fullp
->getPropertySetInfo());
368 CPPUNIT_ASSERT(info
.is());
369 CPPUNIT_ASSERT_EQUAL(
370 static_cast< sal_Int32
>(3), info
->getProperties().getLength());
371 css::beans::Property
prop(
372 info
->getPropertyByName(
374 CPPUNIT_ASSERT_EQUAL(
375 OUString("First"), prop
.Name
);
376 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(0), prop
.Handle
);
377 CPPUNIT_ASSERT_EQUAL(cppu::UnoType
<sal_Int32
>::get(), prop
.Type
);
378 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int16
>(0), prop
.Attributes
);
379 prop
= info
->getPropertyByName(
381 CPPUNIT_ASSERT_EQUAL(
382 OUString("Second"), prop
.Name
);
383 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(1), prop
.Handle
);
384 CPPUNIT_ASSERT_EQUAL(cppu::UnoType
<sal_Int32
>::get(), prop
.Type
);
385 CPPUNIT_ASSERT_EQUAL(
386 static_cast< sal_Int16
>(
387 css::beans::PropertyAttribute::MAYBEVOID
388 | css::beans::PropertyAttribute::BOUND
389 | css::beans::PropertyAttribute::CONSTRAINED
390 | css::beans::PropertyAttribute::MAYBEAMBIGUOUS
391 | css::beans::PropertyAttribute::MAYBEDEFAULT
392 | css::beans::PropertyAttribute::OPTIONAL
),
395 info
->getPropertyByName(
397 CPPUNIT_FAIL("exception expected");
398 } catch (css::beans::UnknownPropertyException
&) {}
399 prop
= info
->getPropertyByName(
401 CPPUNIT_ASSERT_EQUAL(
402 OUString("Fourth"), prop
.Name
);
403 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(3), prop
.Handle
);
404 CPPUNIT_ASSERT_EQUAL(cppu::UnoType
<sal_Int32
>::get(), prop
.Type
);
405 CPPUNIT_ASSERT_EQUAL(
406 static_cast< sal_Int16
>(css::beans::PropertyAttribute::OPTIONAL
),
409 info
->getPropertyByName(
411 CPPUNIT_FAIL("exception expected");
412 } catch (css::beans::UnknownPropertyException
&) {}
414 info
->hasPropertyByName(
417 info
->hasPropertyByName(
418 OUString("Second")));
420 !info
->hasPropertyByName(
423 info
->hasPropertyByName(
424 OUString("Fourth")));
426 !info
->hasPropertyByName(
428 CPPUNIT_ASSERT_EQUAL(
429 css::uno::Any(static_cast< sal_Int32
>(0)),
430 fullp
->getPropertyValue(
432 fullp
->setPropertyValue(
434 css::uno::Any(static_cast< sal_Int32
>(-100)));
435 CPPUNIT_ASSERT_EQUAL(
436 css::uno::Any(static_cast< sal_Int32
>(-100)),
437 fullp
->getPropertyValue(
439 css::uno::Any voidAny
;
440 CPPUNIT_ASSERT_EQUAL(
442 fullp
->getPropertyValue(
443 OUString("Second")));
444 fullp
->setPropertyValue(
446 css::uno::Any(static_cast< sal_Int32
>(100)));
447 CPPUNIT_ASSERT_EQUAL(
448 css::uno::Any(static_cast< sal_Int32
>(100)),
449 fullp
->getPropertyValue(
450 OUString("Second")));
451 CPPUNIT_ASSERT(full
->getSecond().Value
.Value
.IsPresent
);
452 CPPUNIT_ASSERT_EQUAL(
453 static_cast< sal_Int32
>(100), full
->getSecond().Value
.Value
.Value
);
454 CPPUNIT_ASSERT(!full
->getSecond().Value
.IsDefaulted
);
455 CPPUNIT_ASSERT(!full
->getSecond().IsAmbiguous
);
456 fullp
->setPropertyValue(
459 CPPUNIT_ASSERT_EQUAL(
461 fullp
->getPropertyValue(
462 OUString("Second")));
463 CPPUNIT_ASSERT(!full
->getSecond().Value
.Value
.IsPresent
);
464 CPPUNIT_ASSERT(!full
->getSecond().Value
.IsDefaulted
);
465 CPPUNIT_ASSERT(!full
->getSecond().IsAmbiguous
);
467 fullp
->setPropertyValue(
469 css::uno::Any(static_cast< sal_Int32
>(100)));
470 CPPUNIT_FAIL("exception expected");
471 } catch (css::beans::UnknownPropertyException
&) {}
473 fullp
->getPropertyValue(
475 CPPUNIT_FAIL("exception expected");
476 } catch (css::beans::UnknownPropertyException
&) {}
478 fullp
->setPropertyValue(
480 css::uno::Any(static_cast< sal_Int32
>(100)));
481 CPPUNIT_FAIL("exception expected");
482 } catch (css::beans::UnknownPropertyException
&) {}
484 fullp
->getPropertyValue(
486 CPPUNIT_FAIL("exception expected");
487 } catch (css::beans::UnknownPropertyException
&) {}
489 fullp
->setPropertyValue(
492 CPPUNIT_FAIL("exception expected");
493 } catch (css::beans::UnknownPropertyException
&) {}
495 fullp
->getPropertyValue(
497 CPPUNIT_FAIL("exception expected");
498 } catch (css::beans::UnknownPropertyException
&) {}
499 css::uno::Reference
< css::beans::XFastPropertySet
> fullf(
500 full
, css::uno::UNO_QUERY
);
501 CPPUNIT_ASSERT(fullf
.is());
502 CPPUNIT_ASSERT_EQUAL(
503 css::uno::Any(static_cast< sal_Int32
>(-100)),
504 fullf
->getFastPropertyValue(0));
505 fullf
->setFastPropertyValue(
506 0, css::uno::Any(static_cast< sal_Int32
>(0)));
507 CPPUNIT_ASSERT_EQUAL(
508 css::uno::Any(static_cast< sal_Int32
>(0)),
509 fullf
->getFastPropertyValue(0));
511 fullf
->getFastPropertyValue(-1);
512 } catch (css::beans::UnknownPropertyException
&) {}
514 fullf
->setFastPropertyValue(-1, css::uno::Any());
515 } catch (css::beans::UnknownPropertyException
&) {}
516 css::uno::Reference
< css::beans::XPropertyAccess
> fulla(
517 full
, css::uno::UNO_QUERY
);
518 CPPUNIT_ASSERT(fulla
.is());
519 css::uno::Sequence
< css::beans::PropertyValue
> vs(
520 fulla
->getPropertyValues());
521 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(2), vs
.getLength());
522 CPPUNIT_ASSERT_EQUAL(
523 OUString("First"), vs
[0].Name
);
524 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(0), vs
[0].Handle
);
525 CPPUNIT_ASSERT_EQUAL(
526 css::uno::Any(static_cast< sal_Int32
>(0)), vs
[0].Value
);
527 CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE
, vs
[0].State
);
528 CPPUNIT_ASSERT_EQUAL(
529 OUString("Second"), vs
[1].Name
);
530 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(1), vs
[1].Handle
);
531 CPPUNIT_ASSERT_EQUAL(voidAny
, vs
[1].Value
);
532 CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE
, vs
[1].State
);
533 vs
[0].Value
<<= static_cast< sal_Int32
>(-100);
534 vs
[1].Value
<<= static_cast< sal_Int32
>(100);
535 vs
[1].State
= css::beans::PropertyState_AMBIGUOUS_VALUE
;
536 fulla
->setPropertyValues(vs
);
537 vs
= fulla
->getPropertyValues();
538 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32
>(2), vs
.getLength());
539 CPPUNIT_ASSERT_EQUAL(
540 OUString("First"), vs
[0].Name
);
541 CPPUNIT_ASSERT_EQUAL(
542 css::uno::Any(static_cast< sal_Int32
>(-100)), vs
[0].Value
);
543 CPPUNIT_ASSERT_EQUAL(css::beans::PropertyState_DIRECT_VALUE
, vs
[0].State
);
544 CPPUNIT_ASSERT_EQUAL(
545 OUString("Second"), vs
[1].Name
);
546 CPPUNIT_ASSERT_EQUAL(
547 css::uno::Any(static_cast< sal_Int32
>(100)), vs
[1].Value
);
548 CPPUNIT_ASSERT_EQUAL(
549 css::beans::PropertyState_AMBIGUOUS_VALUE
, vs
[1].State
);
550 CPPUNIT_ASSERT(full
->getSecond().Value
.Value
.IsPresent
);
551 CPPUNIT_ASSERT_EQUAL(
552 static_cast< sal_Int32
>(100), full
->getSecond().Value
.Value
.Value
);
553 CPPUNIT_ASSERT(!full
->getSecond().Value
.IsDefaulted
);
554 CPPUNIT_ASSERT(full
->getSecond().IsAmbiguous
);
555 css::uno::Reference
< css::beans::XPropertyChangeListener
> boundListener(
557 fullp
->addPropertyChangeListener(
558 OUString("First"), boundListener
);
559 fullp
->removePropertyChangeListener(
560 OUString("First"), boundListener
);
561 fullp
->addPropertyChangeListener(
562 OUString("Second"), boundListener
);
563 fullp
->removePropertyChangeListener(
564 OUString("Second"), boundListener
);
566 fullp
->addPropertyChangeListener(
569 CPPUNIT_FAIL("exception expected");
570 } catch (css::beans::UnknownPropertyException
&) {}
572 fullp
->removePropertyChangeListener(
575 CPPUNIT_FAIL("exception expected");
576 } catch (css::beans::UnknownPropertyException
&) {}
577 fullp
->addPropertyChangeListener(
578 OUString("Fourth"), boundListener
);
579 fullp
->removePropertyChangeListener(
580 OUString("Fourth"), boundListener
);
582 fullp
->addPropertyChangeListener(
585 CPPUNIT_FAIL("exception expected");
586 } catch (css::beans::UnknownPropertyException
&) {}
588 fullp
->removePropertyChangeListener(
591 CPPUNIT_FAIL("exception expected");
592 } catch (css::beans::UnknownPropertyException
&) {}
593 css::uno::Reference
< css::beans::XVetoableChangeListener
> vetoListener(
595 fullp
->addVetoableChangeListener(
596 OUString("First"), vetoListener
);
597 fullp
->removeVetoableChangeListener(
598 OUString("First"), vetoListener
);
599 fullp
->addVetoableChangeListener(
600 OUString("Second"), vetoListener
);
601 fullp
->removeVetoableChangeListener(
602 OUString("Second"), vetoListener
);
604 fullp
->addVetoableChangeListener(
607 CPPUNIT_FAIL("exception expected");
608 } catch (css::beans::UnknownPropertyException
&) {}
610 fullp
->removeVetoableChangeListener(
613 CPPUNIT_FAIL("exception expected");
614 } catch (css::beans::UnknownPropertyException
&) {}
615 fullp
->addVetoableChangeListener(
616 OUString("Fourth"), vetoListener
);
617 fullp
->removeVetoableChangeListener(
618 OUString("Fourth"), vetoListener
);
620 fullp
->addVetoableChangeListener(
623 CPPUNIT_FAIL("exception expected");
624 } catch (css::beans::UnknownPropertyException
&) {}
626 fullp
->removeVetoableChangeListener(
629 CPPUNIT_FAIL("exception expected");
630 } catch (css::beans::UnknownPropertyException
&) {}
633 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
637 CPPUNIT_PLUGIN_IMPLEMENT();
639 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */