Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <sal/types.h>
21 :
22 : #include <stdlib.h> // wntmsci10 does not like <cstdlib>
23 :
24 : #include <cppunit/TestSuite.h>
25 : #include <cppunit/TestFixture.h>
26 : #include <cppunit/TestCase.h>
27 : #include <cppunit/plugin/TestPlugIn.h>
28 : #include <cppunit/extensions/HelperMacros.h>
29 :
30 : #include "Enum1.hpp"
31 : #include "Enum2.hpp"
32 : #include "Exception1.hpp"
33 : #include "Exception2.hpp"
34 : #include "Exception2a.hpp"
35 : #include "Exception2b.hpp"
36 : #include "Interface1.hpp"
37 : #include "Interface2.hpp"
38 : #include "Interface2a.hpp"
39 : #include "Interface2b.hpp"
40 : #include "Interface3.hpp"
41 : #include "Poly.hpp"
42 : #include "Struct1.hpp"
43 : #include "Struct2.hpp"
44 : #include "Struct2a.hpp"
45 : #include "Struct2b.hpp"
46 : #include "boost/type_traits/is_same.hpp"
47 : #include "com/sun/star/uno/Any.hxx"
48 : #include "com/sun/star/uno/Reference.hxx"
49 : #include "com/sun/star/uno/RuntimeException.hpp"
50 : #include "com/sun/star/uno/Sequence.hxx"
51 : #include "com/sun/star/uno/Type.hxx"
52 : #include "com/sun/star/uno/XInterface.hpp"
53 : #include "osl/diagnose.h"
54 : #include "osl/interlck.h"
55 : #include "rtl/string.h"
56 : #include "rtl/ustring.h"
57 : #include "rtl/ustring.hxx"
58 : #include "sal/types.h"
59 :
60 : namespace {
61 :
62 : class Base {
63 : public:
64 29 : Base(): m_count(0) {}
65 :
66 60 : void acquire() {
67 60 : if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
68 0 : abort();
69 : }
70 60 : }
71 :
72 60 : void release() {
73 60 : if (osl_atomic_decrement(&m_count) == 0) {
74 29 : delete this;
75 : }
76 60 : }
77 :
78 : protected:
79 29 : virtual ~Base() {}
80 :
81 : private:
82 : Base(Base &); // not declared
83 : void operator =(Base &); // not declared
84 :
85 : oslInterlockedCount m_count;
86 : };
87 :
88 60 : class Impl1: public Interface1, private Base {
89 : public:
90 0 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
91 : throw (css::uno::RuntimeException)
92 : {
93 0 : if (type
94 0 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
95 : {
96 : css::uno::Reference< css::uno::XInterface > ref(
97 0 : static_cast< css::uno::XInterface * >(this));
98 0 : return css::uno::Any(&ref, type);
99 0 : } else if (type == getCppuType< css::uno::Reference< Interface1 > >()) {
100 0 : css::uno::Reference< Interface1 > ref(this);
101 0 : return css::uno::Any(&ref, type);
102 : } else {
103 0 : return css::uno::Any();
104 : }
105 : }
106 :
107 39 : virtual void SAL_CALL acquire() throw () {
108 39 : Base::acquire();
109 39 : }
110 :
111 39 : virtual void SAL_CALL release() throw () {
112 39 : Base::release();
113 39 : }
114 : };
115 :
116 21 : class Impl2: public Interface2a, public Interface3, private Base {
117 : public:
118 6 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
119 : throw (css::uno::RuntimeException)
120 : {
121 6 : if (type
122 6 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
123 : {
124 : css::uno::Reference< css::uno::XInterface > ref(
125 : static_cast< css::uno::XInterface * >(
126 2 : static_cast< Interface2a * >(this)));
127 2 : return css::uno::Any(&ref, type);
128 4 : } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
129 1 : css::uno::Reference< Interface2 > ref(this);
130 1 : return css::uno::Any(&ref, type);
131 3 : } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
132 : {
133 0 : css::uno::Reference< Interface2a > ref(this);
134 0 : return css::uno::Any(&ref, type);
135 3 : } else if (type == getCppuType< css::uno::Reference< Interface3 > >()) {
136 1 : css::uno::Reference< Interface3 > ref(this);
137 1 : return css::uno::Any(&ref, type);
138 : } else {
139 2 : return css::uno::Any();
140 : }
141 : }
142 :
143 18 : virtual void SAL_CALL acquire() throw () {
144 18 : Base::acquire();
145 18 : }
146 :
147 18 : virtual void SAL_CALL release() throw () {
148 18 : Base::release();
149 18 : }
150 : };
151 :
152 6 : class Impl2b: public Interface2b, private Base {
153 : public:
154 0 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
155 : throw (css::uno::RuntimeException)
156 : {
157 0 : if (type
158 0 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
159 : {
160 : css::uno::Reference< css::uno::XInterface > ref(
161 : static_cast< css::uno::XInterface * >(
162 0 : static_cast< Interface2a * >(this)));
163 0 : return css::uno::Any(&ref, type);
164 0 : } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
165 0 : css::uno::Reference< Interface2 > ref(this);
166 0 : return css::uno::Any(&ref, type);
167 0 : } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
168 : {
169 0 : css::uno::Reference< Interface2a > ref(this);
170 0 : return css::uno::Any(&ref, type);
171 0 : } else if (type == getCppuType< css::uno::Reference< Interface2b > >())
172 : {
173 0 : css::uno::Reference< Interface2b > ref(this);
174 0 : return css::uno::Any(&ref, type);
175 : } else {
176 0 : return css::uno::Any();
177 : }
178 : }
179 :
180 3 : virtual void SAL_CALL acquire() throw () {
181 3 : Base::acquire();
182 3 : }
183 :
184 3 : virtual void SAL_CALL release() throw () {
185 3 : Base::release();
186 3 : }
187 : };
188 :
189 63 : class Test: public CppUnit::TestFixture {
190 : public:
191 : void testVoid();
192 : void testBoolean();
193 : void testByte();
194 : void testShort();
195 : void testUnsignedShort();
196 : void testLong();
197 : void testUnsignedLong();
198 : void testHyper();
199 : void testUnsignedHyper();
200 : void testFloat();
201 : void testDouble();
202 : void testChar();
203 : void testString();
204 : void testType();
205 : void testSequence();
206 : void testEnum();
207 : void testStruct();
208 : void testPoly();
209 : void testException();
210 : void testInterface();
211 : void testNull();
212 :
213 2 : CPPUNIT_TEST_SUITE(Test);
214 1 : CPPUNIT_TEST(testVoid);
215 1 : CPPUNIT_TEST(testBoolean);
216 1 : CPPUNIT_TEST(testByte);
217 1 : CPPUNIT_TEST(testShort);
218 1 : CPPUNIT_TEST(testUnsignedShort);
219 1 : CPPUNIT_TEST(testLong);
220 1 : CPPUNIT_TEST(testUnsignedLong);
221 1 : CPPUNIT_TEST(testHyper);
222 1 : CPPUNIT_TEST(testUnsignedHyper);
223 1 : CPPUNIT_TEST(testFloat);
224 1 : CPPUNIT_TEST(testDouble);
225 1 : CPPUNIT_TEST(testChar);
226 1 : CPPUNIT_TEST(testString);
227 1 : CPPUNIT_TEST(testType);
228 1 : CPPUNIT_TEST(testSequence);
229 1 : CPPUNIT_TEST(testEnum);
230 1 : CPPUNIT_TEST(testStruct);
231 1 : CPPUNIT_TEST(testPoly);
232 1 : CPPUNIT_TEST(testException);
233 1 : CPPUNIT_TEST(testInterface);
234 1 : CPPUNIT_TEST(testNull);
235 2 : CPPUNIT_TEST_SUITE_END();
236 : };
237 :
238 1 : void Test::testVoid() {
239 1 : css::uno::Any a;
240 1 : CPPUNIT_ASSERT(a.getValueType() == getVoidCppuType());
241 : {
242 1 : bool b = true;
243 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
244 : }
245 : {
246 1 : sal_Bool b = true;
247 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
248 : }
249 : {
250 1 : sal_Int8 b = 2;
251 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
252 : }
253 : {
254 1 : sal_uInt8 b = 2;
255 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
256 : }
257 : {
258 1 : sal_Int16 b = 2;
259 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
260 : }
261 : {
262 1 : sal_uInt16 b = 2;
263 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
264 : }
265 : {
266 1 : sal_Int32 b = 2;
267 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
268 : }
269 : {
270 1 : sal_uInt32 b = 2;
271 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
272 : }
273 : {
274 1 : sal_Int64 b = 2;
275 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
276 : }
277 : {
278 1 : sal_uInt64 b = 2;
279 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
280 : }
281 : {
282 1 : float b = 2;
283 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
284 : }
285 : {
286 1 : double b = 2;
287 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
288 : }
289 : {
290 1 : sal_Unicode b = '2';
291 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
292 : }
293 : {
294 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
295 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
296 : }
297 : {
298 1 : css::uno::Type b(getCppuType< rtl::OUString >());
299 2 : CPPUNIT_ASSERT_MESSAGE(
300 : "css::uno::Type",
301 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
302 : }
303 : {
304 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
305 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
306 : }
307 : {
308 1 : css::uno::Sequence< rtl::OUString > b(2);
309 2 : CPPUNIT_ASSERT_MESSAGE(
310 2 : "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
311 : }
312 : {
313 1 : Enum1 b = Enum1_M2;
314 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
315 : }
316 : {
317 1 : Struct1 b(2);
318 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
319 : }
320 : {
321 : Exception1 b(
322 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
323 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
324 : }
325 : {
326 1 : css::uno::Reference< Interface1 > i(new Impl1);
327 1 : css::uno::Reference< Interface1 > b(i);
328 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
329 1 : }
330 1 : }
331 :
332 1 : void Test::testBoolean() {
333 1 : css::uno::Any a(false);
334 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Bool >());
335 : {
336 1 : bool b = true;
337 1 : CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
338 : }
339 : {
340 1 : sal_Bool b = true;
341 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
342 : }
343 : {
344 1 : sal_Int8 b = 2;
345 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
346 : }
347 : {
348 1 : sal_uInt8 b = 2;
349 : if (boost::is_same< sal_uInt8, sal_Bool >::value) {
350 1 : CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
351 : } else {
352 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
353 : }
354 : }
355 : {
356 1 : sal_Int16 b = 2;
357 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
358 : }
359 : {
360 1 : sal_uInt16 b = 2;
361 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
362 : }
363 : {
364 1 : sal_Int32 b = 2;
365 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
366 : }
367 : {
368 1 : sal_uInt32 b = 2;
369 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
370 : }
371 : {
372 1 : sal_Int64 b = 2;
373 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
374 : }
375 : {
376 1 : sal_uInt64 b = 2;
377 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
378 : }
379 : {
380 1 : float b = 2;
381 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
382 : }
383 : {
384 1 : double b = 2;
385 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
386 : }
387 : {
388 1 : sal_Unicode b = '2';
389 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
390 : }
391 : {
392 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
393 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
394 : }
395 : {
396 1 : css::uno::Type b(getCppuType< rtl::OUString >());
397 2 : CPPUNIT_ASSERT_MESSAGE(
398 : "css::uno::Type",
399 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
400 : }
401 : {
402 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
403 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
404 : }
405 : {
406 1 : css::uno::Sequence< rtl::OUString > b(2);
407 2 : CPPUNIT_ASSERT_MESSAGE(
408 : "css::uno::Sequence<rtl::OUString>",
409 2 : !(a >>= b) && b.getLength() == 2);
410 : }
411 : {
412 1 : Enum1 b = Enum1_M2;
413 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
414 : }
415 : {
416 1 : Struct1 b(2);
417 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
418 : }
419 : {
420 : Exception1 b(
421 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
422 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
423 : }
424 : {
425 1 : css::uno::Reference< Interface1 > i(new Impl1);
426 1 : css::uno::Reference< Interface1 > b(i);
427 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
428 1 : }
429 1 : }
430 :
431 1 : void Test::testByte() {
432 1 : css::uno::Any a(static_cast< sal_Int8 >(1));
433 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int8 >());
434 : {
435 1 : bool b = true;
436 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
437 : }
438 : {
439 1 : sal_Bool b = true;
440 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
441 : }
442 : {
443 1 : sal_Int8 b = 2;
444 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
445 : }
446 : {
447 1 : sal_uInt8 b = 2;
448 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
449 : }
450 : {
451 1 : sal_Int16 b = 2;
452 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
453 : }
454 : {
455 1 : sal_uInt16 b = 2;
456 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
457 : }
458 : {
459 1 : sal_Int32 b = 2;
460 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
461 : }
462 : {
463 1 : sal_uInt32 b = 2;
464 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
465 : }
466 : {
467 1 : sal_Int64 b = 2;
468 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
469 : }
470 : {
471 1 : sal_uInt64 b = 2;
472 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
473 : }
474 : {
475 1 : float b = 2;
476 1 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
477 : }
478 : {
479 1 : double b = 2;
480 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
481 : }
482 : {
483 1 : sal_Unicode b = '2';
484 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
485 1 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
486 : } else {
487 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
488 : }
489 : }
490 : {
491 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
492 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
493 : }
494 : {
495 1 : css::uno::Type b(getCppuType< rtl::OUString >());
496 2 : CPPUNIT_ASSERT_MESSAGE(
497 : "css::uno::Type",
498 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
499 : }
500 : {
501 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
502 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
503 : }
504 : {
505 1 : css::uno::Sequence< rtl::OUString > b(2);
506 2 : CPPUNIT_ASSERT_MESSAGE(
507 : "css::uno::Sequence<rtl::OUString>",
508 2 : !(a >>= b) && b.getLength() == 2);
509 : }
510 : {
511 1 : Enum1 b = Enum1_M2;
512 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
513 : }
514 : {
515 1 : Struct1 b(2);
516 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
517 : }
518 : {
519 : Exception1 b(
520 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
521 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
522 : }
523 : {
524 1 : css::uno::Reference< Interface1 > i(new Impl1);
525 1 : css::uno::Reference< Interface1 > b(i);
526 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
527 1 : }
528 1 : }
529 :
530 1 : void Test::testShort() {
531 1 : css::uno::Any a(static_cast< sal_Int16 >(1));
532 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int16 >());
533 : {
534 1 : bool b = true;
535 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
536 : }
537 : {
538 1 : sal_Bool b = true;
539 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
540 : }
541 : {
542 1 : sal_Int8 b = 2;
543 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
544 : }
545 : {
546 1 : sal_uInt8 b = 2;
547 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
548 : }
549 : {
550 1 : sal_Int16 b = 2;
551 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
552 : }
553 : {
554 1 : sal_uInt16 b = 2;
555 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
556 : }
557 : {
558 1 : sal_Int32 b = 2;
559 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
560 : }
561 : {
562 1 : sal_uInt32 b = 2;
563 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
564 : }
565 : {
566 1 : sal_Int64 b = 2;
567 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
568 : }
569 : {
570 1 : sal_uInt64 b = 2;
571 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
572 : }
573 : {
574 1 : float b = 2;
575 1 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
576 : }
577 : {
578 1 : double b = 2;
579 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
580 : }
581 : {
582 1 : sal_Unicode b = '2';
583 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
584 1 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
585 : } else {
586 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
587 : }
588 : }
589 : {
590 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
591 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
592 : }
593 : {
594 1 : css::uno::Type b(getCppuType< rtl::OUString >());
595 2 : CPPUNIT_ASSERT_MESSAGE(
596 : "css::uno::Type",
597 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
598 : }
599 : {
600 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
601 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
602 : }
603 : {
604 1 : css::uno::Sequence< rtl::OUString > b(2);
605 2 : CPPUNIT_ASSERT_MESSAGE(
606 : "css::uno::Sequence<rtl::OUString>",
607 2 : !(a >>= b) && b.getLength() == 2);
608 : }
609 : {
610 1 : Enum1 b = Enum1_M2;
611 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
612 : }
613 : {
614 1 : Struct1 b(2);
615 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
616 : }
617 : {
618 : Exception1 b(
619 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
620 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
621 : }
622 : {
623 1 : css::uno::Reference< Interface1 > i(new Impl1);
624 1 : css::uno::Reference< Interface1 > b(i);
625 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
626 1 : }
627 1 : }
628 :
629 1 : void Test::testUnsignedShort() {
630 1 : sal_uInt16 n = 1;
631 1 : css::uno::Any a(&n, getCppuType(static_cast< sal_uInt16 const * >(0)));
632 2 : CPPUNIT_ASSERT(
633 1 : a.getValueType() == getCppuType(static_cast< sal_uInt16 const * >(0)));
634 : {
635 1 : bool b = true;
636 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
637 : }
638 : {
639 1 : sal_Bool b = true;
640 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
641 : }
642 : {
643 1 : sal_Int8 b = 2;
644 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
645 : }
646 : {
647 1 : sal_uInt8 b = 2;
648 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
649 : }
650 : {
651 1 : sal_Int16 b = 2;
652 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
653 : }
654 : {
655 1 : sal_uInt16 b = 2;
656 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
657 : }
658 : {
659 1 : sal_Int32 b = 2;
660 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
661 : }
662 : {
663 1 : sal_uInt32 b = 2;
664 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
665 : }
666 : {
667 1 : sal_Int64 b = 2;
668 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
669 : }
670 : {
671 1 : sal_uInt64 b = 2;
672 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
673 : }
674 : {
675 1 : float b = 2;
676 1 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
677 : }
678 : {
679 1 : double b = 2;
680 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
681 : }
682 : {
683 1 : sal_Unicode b = '2';
684 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
685 1 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
686 : } else {
687 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
688 : }
689 : }
690 : {
691 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
692 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
693 : }
694 : {
695 1 : css::uno::Type b(getCppuType< rtl::OUString >());
696 2 : CPPUNIT_ASSERT_MESSAGE(
697 : "css::uno::Type",
698 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
699 : }
700 : {
701 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
702 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
703 : }
704 : {
705 1 : css::uno::Sequence< rtl::OUString > b(2);
706 2 : CPPUNIT_ASSERT_MESSAGE(
707 : "css::uno::Sequence<rtl::OUString>",
708 2 : !(a >>= b) && b.getLength() == 2);
709 : }
710 : {
711 1 : Enum1 b = Enum1_M2;
712 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
713 : }
714 : {
715 1 : Struct1 b(2);
716 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
717 : }
718 : {
719 : Exception1 b(
720 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
721 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
722 : }
723 : {
724 1 : css::uno::Reference< Interface1 > i(new Impl1);
725 1 : css::uno::Reference< Interface1 > b(i);
726 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
727 1 : }
728 1 : }
729 :
730 1 : void Test::testLong() {
731 1 : css::uno::Any a(static_cast< sal_Int32 >(1));
732 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int32 >());
733 : {
734 1 : bool b = true;
735 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
736 : }
737 : {
738 1 : sal_Bool b = true;
739 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
740 : }
741 : {
742 1 : sal_Int8 b = 2;
743 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
744 : }
745 : {
746 1 : sal_uInt8 b = 2;
747 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
748 : }
749 : {
750 1 : sal_Int16 b = 2;
751 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
752 : }
753 : {
754 1 : sal_uInt16 b = 2;
755 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
756 : }
757 : {
758 1 : sal_Int32 b = 2;
759 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
760 : }
761 : {
762 1 : sal_uInt32 b = 2;
763 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
764 : }
765 : {
766 1 : sal_Int64 b = 2;
767 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
768 : }
769 : {
770 1 : sal_uInt64 b = 2;
771 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
772 : }
773 : {
774 1 : float b = 2;
775 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
776 : }
777 : {
778 1 : double b = 2;
779 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
780 : }
781 : {
782 1 : sal_Unicode b = '2';
783 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
784 : }
785 : {
786 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
787 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
788 : }
789 : {
790 1 : css::uno::Type b(getCppuType< rtl::OUString >());
791 2 : CPPUNIT_ASSERT_MESSAGE(
792 : "css::uno::Type",
793 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
794 : }
795 : {
796 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
797 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
798 : }
799 : {
800 1 : css::uno::Sequence< rtl::OUString > b(2);
801 2 : CPPUNIT_ASSERT_MESSAGE(
802 : "css::uno::Sequence<rtl::OUString>",
803 2 : !(a >>= b) && b.getLength() == 2);
804 : }
805 : {
806 1 : Enum1 b = Enum1_M2;
807 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
808 : }
809 : {
810 1 : Struct1 b(2);
811 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
812 : }
813 : {
814 : Exception1 b(
815 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
816 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
817 : }
818 : {
819 1 : css::uno::Reference< Interface1 > i(new Impl1);
820 1 : css::uno::Reference< Interface1 > b(i);
821 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
822 1 : }
823 1 : }
824 :
825 1 : void Test::testUnsignedLong() {
826 1 : css::uno::Any a(static_cast< sal_uInt32 >(1));
827 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt32 >());
828 : {
829 1 : bool b = true;
830 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
831 : }
832 : {
833 1 : sal_Bool b = true;
834 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
835 : }
836 : {
837 1 : sal_Int8 b = 2;
838 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
839 : }
840 : {
841 1 : sal_uInt8 b = 2;
842 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
843 : }
844 : {
845 1 : sal_Int16 b = 2;
846 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
847 : }
848 : {
849 1 : sal_uInt16 b = 2;
850 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
851 : }
852 : {
853 1 : sal_Int32 b = 2;
854 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
855 : }
856 : {
857 1 : sal_uInt32 b = 2;
858 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
859 : }
860 : {
861 1 : sal_Int64 b = 2;
862 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
863 : }
864 : {
865 1 : sal_uInt64 b = 2;
866 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
867 : }
868 : {
869 1 : float b = 2;
870 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
871 : }
872 : {
873 1 : double b = 2;
874 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
875 : }
876 : {
877 1 : sal_Unicode b = '2';
878 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
879 : }
880 : {
881 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
882 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
883 : }
884 : {
885 1 : css::uno::Type b(getCppuType< rtl::OUString >());
886 2 : CPPUNIT_ASSERT_MESSAGE(
887 : "css::uno::Type",
888 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
889 : }
890 : {
891 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
892 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
893 : }
894 : {
895 1 : css::uno::Sequence< rtl::OUString > b(2);
896 2 : CPPUNIT_ASSERT_MESSAGE(
897 : "css::uno::Sequence<rtl::OUString>",
898 2 : !(a >>= b) && b.getLength() == 2);
899 : }
900 : {
901 1 : Enum1 b = Enum1_M2;
902 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
903 : }
904 : {
905 1 : Struct1 b(2);
906 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
907 : }
908 : {
909 : Exception1 b(
910 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
911 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
912 : }
913 : {
914 1 : css::uno::Reference< Interface1 > i(new Impl1);
915 1 : css::uno::Reference< Interface1 > b(i);
916 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
917 1 : }
918 1 : }
919 :
920 1 : void Test::testHyper() {
921 1 : css::uno::Any a(static_cast< sal_Int64 >(1));
922 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int64 >());
923 : {
924 1 : bool b = true;
925 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
926 : }
927 : {
928 1 : sal_Bool b = true;
929 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
930 : }
931 : {
932 1 : sal_Int8 b = 2;
933 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
934 : }
935 : {
936 1 : sal_uInt8 b = 2;
937 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
938 : }
939 : {
940 1 : sal_Int16 b = 2;
941 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
942 : }
943 : {
944 1 : sal_uInt16 b = 2;
945 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
946 : }
947 : {
948 1 : sal_Int32 b = 2;
949 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
950 : }
951 : {
952 1 : sal_uInt32 b = 2;
953 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
954 : }
955 : {
956 1 : sal_Int64 b = 2;
957 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
958 : }
959 : {
960 1 : sal_uInt64 b = 2;
961 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
962 : }
963 : {
964 1 : float b = 2;
965 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
966 : }
967 : {
968 1 : double b = 2;
969 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
970 : }
971 : {
972 1 : sal_Unicode b = '2';
973 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
974 : }
975 : {
976 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
977 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
978 : }
979 : {
980 1 : css::uno::Type b(getCppuType< rtl::OUString >());
981 2 : CPPUNIT_ASSERT_MESSAGE(
982 : "css::uno::Type",
983 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
984 : }
985 : {
986 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
987 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
988 : }
989 : {
990 1 : css::uno::Sequence< rtl::OUString > b(2);
991 2 : CPPUNIT_ASSERT_MESSAGE(
992 : "css::uno::Sequence<rtl::OUString>",
993 2 : !(a >>= b) && b.getLength() == 2);
994 : }
995 : {
996 1 : Enum1 b = Enum1_M2;
997 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
998 : }
999 : {
1000 1 : Struct1 b(2);
1001 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1002 : }
1003 : {
1004 : Exception1 b(
1005 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1006 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1007 : }
1008 : {
1009 1 : css::uno::Reference< Interface1 > i(new Impl1);
1010 1 : css::uno::Reference< Interface1 > b(i);
1011 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1012 1 : }
1013 1 : }
1014 :
1015 1 : void Test::testUnsignedHyper() {
1016 1 : css::uno::Any a(static_cast< sal_uInt64 >(1));
1017 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt64 >());
1018 : {
1019 1 : bool b = true;
1020 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1021 : }
1022 : {
1023 1 : sal_Bool b = true;
1024 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1025 : }
1026 : {
1027 1 : sal_Int8 b = 2;
1028 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1029 : }
1030 : {
1031 1 : sal_uInt8 b = 2;
1032 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1033 : }
1034 : {
1035 1 : sal_Int16 b = 2;
1036 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1037 : }
1038 : {
1039 1 : sal_uInt16 b = 2;
1040 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1041 : }
1042 : {
1043 1 : sal_Int32 b = 2;
1044 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1045 : }
1046 : {
1047 1 : sal_uInt32 b = 2;
1048 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1049 : }
1050 : {
1051 1 : sal_Int64 b = 2;
1052 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1053 : }
1054 : {
1055 1 : sal_uInt64 b = 2;
1056 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1057 : }
1058 : {
1059 1 : float b = 2;
1060 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1061 : }
1062 : {
1063 1 : double b = 2;
1064 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1065 : }
1066 : {
1067 1 : sal_Unicode b = '2';
1068 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1069 : }
1070 : {
1071 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1072 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1073 : }
1074 : {
1075 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1076 2 : CPPUNIT_ASSERT_MESSAGE(
1077 : "css::uno::Type",
1078 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1079 : }
1080 : {
1081 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1082 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1083 : }
1084 : {
1085 1 : css::uno::Sequence< rtl::OUString > b(2);
1086 2 : CPPUNIT_ASSERT_MESSAGE(
1087 : "css::uno::Sequence<rtl::OUString>",
1088 2 : !(a >>= b) && b.getLength() == 2);
1089 : }
1090 : {
1091 1 : Enum1 b = Enum1_M2;
1092 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1093 : }
1094 : {
1095 1 : Struct1 b(2);
1096 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1097 : }
1098 : {
1099 : Exception1 b(
1100 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1101 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1102 : }
1103 : {
1104 1 : css::uno::Reference< Interface1 > i(new Impl1);
1105 1 : css::uno::Reference< Interface1 > b(i);
1106 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1107 1 : }
1108 1 : }
1109 :
1110 1 : void Test::testFloat() {
1111 1 : css::uno::Any a(1.f);
1112 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< float >());
1113 : {
1114 1 : bool b = true;
1115 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1116 : }
1117 : {
1118 1 : sal_Bool b = true;
1119 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1120 : }
1121 : {
1122 1 : sal_Int8 b = 2;
1123 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1124 : }
1125 : {
1126 1 : sal_uInt8 b = 2;
1127 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1128 : }
1129 : {
1130 1 : sal_Int16 b = 2;
1131 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1132 : }
1133 : {
1134 1 : sal_uInt16 b = 2;
1135 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1136 : }
1137 : {
1138 1 : sal_Int32 b = 2;
1139 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1140 : }
1141 : {
1142 1 : sal_uInt32 b = 2;
1143 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1144 : }
1145 : {
1146 1 : sal_Int64 b = 2;
1147 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1148 : }
1149 : {
1150 1 : sal_uInt64 b = 2;
1151 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1152 : }
1153 : {
1154 1 : float b = 2;
1155 1 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1156 : }
1157 : {
1158 1 : double b = 2;
1159 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1160 : }
1161 : {
1162 1 : sal_Unicode b = '2';
1163 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1164 : }
1165 : {
1166 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1167 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1168 : }
1169 : {
1170 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1171 2 : CPPUNIT_ASSERT_MESSAGE(
1172 : "css::uno::Type",
1173 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1174 : }
1175 : {
1176 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1177 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1178 : }
1179 : {
1180 1 : css::uno::Sequence< rtl::OUString > b(2);
1181 2 : CPPUNIT_ASSERT_MESSAGE(
1182 : "css::uno::Sequence<rtl::OUString>",
1183 2 : !(a >>= b) && b.getLength() == 2);
1184 : }
1185 : {
1186 1 : Enum1 b = Enum1_M2;
1187 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1188 : }
1189 : {
1190 1 : Struct1 b(2);
1191 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1192 : }
1193 : {
1194 : Exception1 b(
1195 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1196 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1197 : }
1198 : {
1199 1 : css::uno::Reference< Interface1 > i(new Impl1);
1200 1 : css::uno::Reference< Interface1 > b(i);
1201 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1202 1 : }
1203 1 : }
1204 :
1205 1 : void Test::testDouble() {
1206 1 : css::uno::Any a(1.);
1207 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< double >());
1208 : {
1209 1 : bool b = true;
1210 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1211 : }
1212 : {
1213 1 : sal_Bool b = true;
1214 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1215 : }
1216 : {
1217 1 : sal_Int8 b = 2;
1218 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1219 : }
1220 : {
1221 1 : sal_uInt8 b = 2;
1222 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1223 : }
1224 : {
1225 1 : sal_Int16 b = 2;
1226 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1227 : }
1228 : {
1229 1 : sal_uInt16 b = 2;
1230 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1231 : }
1232 : {
1233 1 : sal_Int32 b = 2;
1234 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1235 : }
1236 : {
1237 1 : sal_uInt32 b = 2;
1238 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1239 : }
1240 : {
1241 1 : sal_Int64 b = 2;
1242 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1243 : }
1244 : {
1245 1 : sal_uInt64 b = 2;
1246 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1247 : }
1248 : {
1249 1 : float b = 2;
1250 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1251 : }
1252 : {
1253 1 : double b = 2;
1254 1 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1255 : }
1256 : {
1257 1 : sal_Unicode b = '2';
1258 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1259 : }
1260 : {
1261 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1262 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1263 : }
1264 : {
1265 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1266 2 : CPPUNIT_ASSERT_MESSAGE(
1267 : "css::uno::Type",
1268 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1269 : }
1270 : {
1271 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1272 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1273 : }
1274 : {
1275 1 : css::uno::Sequence< rtl::OUString > b(2);
1276 2 : CPPUNIT_ASSERT_MESSAGE(
1277 : "css::uno::Sequence<rtl::OUString>",
1278 2 : !(a >>= b) && b.getLength() == 2);
1279 : }
1280 : {
1281 1 : Enum1 b = Enum1_M2;
1282 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1283 : }
1284 : {
1285 1 : Struct1 b(2);
1286 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1287 : }
1288 : {
1289 : Exception1 b(
1290 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1291 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1292 : }
1293 : {
1294 1 : css::uno::Reference< Interface1 > i(new Impl1);
1295 1 : css::uno::Reference< Interface1 > b(i);
1296 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1297 1 : }
1298 1 : }
1299 :
1300 1 : void Test::testChar() {
1301 1 : sal_Unicode c = '1';
1302 1 : css::uno::Any a(&c, getCppuType< sal_Unicode >());
1303 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Unicode >());
1304 : {
1305 1 : bool b = true;
1306 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1307 : }
1308 : {
1309 1 : sal_Bool b = true;
1310 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1311 : }
1312 : {
1313 1 : sal_Int8 b = 2;
1314 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1315 : }
1316 : {
1317 1 : sal_uInt8 b = 2;
1318 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1319 : }
1320 : {
1321 1 : sal_Int16 b = 2;
1322 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1323 : }
1324 : {
1325 1 : sal_uInt16 b = 2;
1326 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1327 : }
1328 : {
1329 1 : sal_Int32 b = 2;
1330 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1331 : }
1332 : {
1333 1 : sal_uInt32 b = 2;
1334 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1335 : }
1336 : {
1337 1 : sal_Int64 b = 2;
1338 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1339 : }
1340 : {
1341 1 : sal_uInt64 b = 2;
1342 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1343 : }
1344 : {
1345 1 : float b = 2;
1346 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1347 : }
1348 : {
1349 1 : double b = 2;
1350 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1351 : }
1352 : {
1353 1 : sal_Unicode b = '2';
1354 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1355 1 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1356 : } else {
1357 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1358 : }
1359 : }
1360 : {
1361 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1362 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1363 : }
1364 : {
1365 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1366 2 : CPPUNIT_ASSERT_MESSAGE(
1367 : "css::uno::Type",
1368 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1369 : }
1370 : {
1371 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1372 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1373 : }
1374 : {
1375 1 : css::uno::Sequence< rtl::OUString > b(2);
1376 2 : CPPUNIT_ASSERT_MESSAGE(
1377 : "css::uno::Sequence<rtl::OUString>",
1378 2 : !(a >>= b) && b.getLength() == 2);
1379 : }
1380 : {
1381 1 : Enum1 b = Enum1_M2;
1382 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1383 : }
1384 : {
1385 1 : Struct1 b(2);
1386 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1387 : }
1388 : {
1389 : Exception1 b(
1390 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1391 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1392 : }
1393 : {
1394 1 : css::uno::Reference< Interface1 > i(new Impl1);
1395 1 : css::uno::Reference< Interface1 > b(i);
1396 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1397 1 : }
1398 1 : }
1399 :
1400 1 : void Test::testString() {
1401 1 : css::uno::Any a(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
1402 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< rtl::OUString >());
1403 : {
1404 1 : bool b = true;
1405 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1406 : }
1407 : {
1408 1 : sal_Bool b = true;
1409 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1410 : }
1411 : {
1412 1 : sal_Int8 b = 2;
1413 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1414 : }
1415 : {
1416 1 : sal_uInt8 b = 2;
1417 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1418 : }
1419 : {
1420 1 : sal_Int16 b = 2;
1421 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1422 : }
1423 : {
1424 1 : sal_uInt16 b = 2;
1425 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1426 : }
1427 : {
1428 1 : sal_Int32 b = 2;
1429 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1430 : }
1431 : {
1432 1 : sal_uInt32 b = 2;
1433 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1434 : }
1435 : {
1436 1 : sal_Int64 b = 2;
1437 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1438 : }
1439 : {
1440 1 : sal_uInt64 b = 2;
1441 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1442 : }
1443 : {
1444 1 : float b = 2;
1445 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1446 : }
1447 : {
1448 1 : double b = 2;
1449 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1450 : }
1451 : {
1452 1 : sal_Unicode b = '2';
1453 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1454 : }
1455 : {
1456 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1457 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", (a >>= b) && b == "1" );
1458 : }
1459 : {
1460 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1461 2 : CPPUNIT_ASSERT_MESSAGE(
1462 : "css::uno::Type",
1463 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1464 : }
1465 : {
1466 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1467 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1468 : }
1469 : {
1470 1 : css::uno::Sequence< rtl::OUString > b(2);
1471 2 : CPPUNIT_ASSERT_MESSAGE(
1472 : "css::uno::Sequence<rtl::OUString>",
1473 2 : !(a >>= b) && b.getLength() == 2);
1474 : }
1475 : {
1476 1 : Enum1 b = Enum1_M2;
1477 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1478 : }
1479 : {
1480 1 : Struct1 b(2);
1481 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1482 : }
1483 : {
1484 : Exception1 b(
1485 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1486 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1487 : }
1488 : {
1489 1 : css::uno::Reference< Interface1 > i(new Impl1);
1490 1 : css::uno::Reference< Interface1 > b(i);
1491 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1492 1 : }
1493 1 : }
1494 :
1495 1 : void Test::testType() {
1496 1 : css::uno::Any a(getCppuType< sal_Int32 >());
1497 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< css::uno::Type >());
1498 : {
1499 1 : bool b = true;
1500 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1501 : }
1502 : {
1503 1 : sal_Bool b = true;
1504 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1505 : }
1506 : {
1507 1 : sal_Int8 b = 2;
1508 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1509 : }
1510 : {
1511 1 : sal_uInt8 b = 2;
1512 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1513 : }
1514 : {
1515 1 : sal_Int16 b = 2;
1516 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1517 : }
1518 : {
1519 1 : sal_uInt16 b = 2;
1520 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1521 : }
1522 : {
1523 1 : sal_Int32 b = 2;
1524 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1525 : }
1526 : {
1527 1 : sal_uInt32 b = 2;
1528 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1529 : }
1530 : {
1531 1 : sal_Int64 b = 2;
1532 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1533 : }
1534 : {
1535 1 : sal_uInt64 b = 2;
1536 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1537 : }
1538 : {
1539 1 : float b = 2;
1540 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1541 : }
1542 : {
1543 1 : double b = 2;
1544 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1545 : }
1546 : {
1547 1 : sal_Unicode b = '2';
1548 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1549 : }
1550 : {
1551 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1552 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1553 : }
1554 : {
1555 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1556 2 : CPPUNIT_ASSERT_MESSAGE(
1557 2 : "css::uno::Type", (a >>= b) && b == getCppuType< sal_Int32 >());
1558 : }
1559 : {
1560 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1561 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1562 : }
1563 : {
1564 1 : css::uno::Sequence< rtl::OUString > b(2);
1565 2 : CPPUNIT_ASSERT_MESSAGE(
1566 : "css::uno::Sequence<rtl::OUString>",
1567 2 : !(a >>= b) && b.getLength() == 2);
1568 : }
1569 : {
1570 1 : Enum1 b = Enum1_M2;
1571 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1572 : }
1573 : {
1574 1 : Struct1 b(2);
1575 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1576 : }
1577 : {
1578 : Exception1 b(
1579 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1580 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1581 : }
1582 : {
1583 1 : css::uno::Reference< Interface1 > i(new Impl1);
1584 1 : css::uno::Reference< Interface1 > b(i);
1585 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1586 1 : }
1587 1 : }
1588 :
1589 1 : void Test::testSequence() {
1590 1 : sal_Int32 n = 1;
1591 1 : css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1592 2 : CPPUNIT_ASSERT(
1593 1 : a.getValueType() == getCppuType< css::uno::Sequence< sal_Int32 > >());
1594 : {
1595 1 : bool b = true;
1596 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1597 : }
1598 : {
1599 1 : sal_Bool b = true;
1600 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1601 : }
1602 : {
1603 1 : sal_Int8 b = 2;
1604 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1605 : }
1606 : {
1607 1 : sal_uInt8 b = 2;
1608 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1609 : }
1610 : {
1611 1 : sal_Int16 b = 2;
1612 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1613 : }
1614 : {
1615 1 : sal_uInt16 b = 2;
1616 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1617 : }
1618 : {
1619 1 : sal_Int32 b = 2;
1620 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1621 : }
1622 : {
1623 1 : sal_uInt32 b = 2;
1624 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1625 : }
1626 : {
1627 1 : sal_Int64 b = 2;
1628 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1629 : }
1630 : {
1631 1 : sal_uInt64 b = 2;
1632 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1633 : }
1634 : {
1635 1 : float b = 2;
1636 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1637 : }
1638 : {
1639 1 : double b = 2;
1640 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1641 : }
1642 : {
1643 1 : sal_Unicode b = '2';
1644 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1645 : }
1646 : {
1647 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1648 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1649 : }
1650 : {
1651 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1652 2 : CPPUNIT_ASSERT_MESSAGE(
1653 : "css::uno::Type",
1654 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1655 : }
1656 : {
1657 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1658 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1659 : }
1660 : {
1661 1 : css::uno::Sequence< rtl::OUString > b(2);
1662 2 : CPPUNIT_ASSERT_MESSAGE(
1663 : "css::uno::Sequence<rtl::OUString>",
1664 2 : !(a >>= b) && b.getLength() == 2);
1665 : }
1666 : {
1667 1 : css::uno::Sequence< sal_Int32 > b(2);
1668 2 : CPPUNIT_ASSERT_MESSAGE(
1669 : "css::uno::Sequence<sal_Int32>",
1670 2 : (a >>= b) && b.getLength() == 1 && b[0] == 1);
1671 : }
1672 : {
1673 1 : Enum1 b = Enum1_M2;
1674 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1675 : }
1676 : {
1677 1 : Struct1 b(2);
1678 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1679 : }
1680 : {
1681 : Exception1 b(
1682 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1683 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1684 : }
1685 : {
1686 1 : css::uno::Reference< Interface1 > i(new Impl1);
1687 1 : css::uno::Reference< Interface1 > b(i);
1688 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1689 1 : }
1690 1 : }
1691 :
1692 1 : void Test::testEnum() {
1693 1 : css::uno::Any a(Enum2_M1);
1694 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Enum2 >());
1695 : {
1696 1 : bool b = true;
1697 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1698 : }
1699 : {
1700 1 : sal_Bool b = true;
1701 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1702 : }
1703 : {
1704 1 : sal_Int8 b = 2;
1705 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1706 : }
1707 : {
1708 1 : sal_uInt8 b = 2;
1709 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1710 : }
1711 : {
1712 1 : sal_Int16 b = 2;
1713 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1714 : }
1715 : {
1716 1 : sal_uInt16 b = 2;
1717 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1718 : }
1719 : {
1720 1 : sal_Int32 b = 2;
1721 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1722 : }
1723 : {
1724 1 : sal_uInt32 b = 2;
1725 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1726 : }
1727 : {
1728 1 : sal_Int64 b = 2;
1729 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1730 : }
1731 : {
1732 1 : sal_uInt64 b = 2;
1733 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1734 : }
1735 : {
1736 1 : float b = 2;
1737 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1738 : }
1739 : {
1740 1 : double b = 2;
1741 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1742 : }
1743 : {
1744 1 : sal_Unicode b = '2';
1745 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1746 : }
1747 : {
1748 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1749 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1750 : }
1751 : {
1752 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1753 2 : CPPUNIT_ASSERT_MESSAGE(
1754 : "css::uno::Type",
1755 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1756 : }
1757 : {
1758 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1759 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1760 : }
1761 : {
1762 1 : css::uno::Sequence< rtl::OUString > b(2);
1763 2 : CPPUNIT_ASSERT_MESSAGE(
1764 : "css::uno::Sequence<rtl::OUString>",
1765 2 : !(a >>= b) && b.getLength() == 2);
1766 : }
1767 : {
1768 1 : Enum1 b = Enum1_M2;
1769 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1770 : }
1771 : {
1772 1 : Enum2 b = Enum2_M2;
1773 1 : CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1774 : }
1775 : {
1776 1 : Struct1 b(2);
1777 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1778 : }
1779 : {
1780 : Exception1 b(
1781 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1782 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1783 : }
1784 : {
1785 1 : css::uno::Reference< Interface1 > i(new Impl1);
1786 1 : css::uno::Reference< Interface1 > b(i);
1787 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1788 1 : }
1789 1 : }
1790 :
1791 1 : void Test::testStruct() {
1792 1 : css::uno::Any a(Struct2a(1, 3));
1793 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Struct2a >());
1794 : {
1795 1 : bool b = true;
1796 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1797 : }
1798 : {
1799 1 : sal_Bool b = true;
1800 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1801 : }
1802 : {
1803 1 : sal_Int8 b = 2;
1804 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1805 : }
1806 : {
1807 1 : sal_uInt8 b = 2;
1808 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1809 : }
1810 : {
1811 1 : sal_Int16 b = 2;
1812 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1813 : }
1814 : {
1815 1 : sal_uInt16 b = 2;
1816 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1817 : }
1818 : {
1819 1 : sal_Int32 b = 2;
1820 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1821 : }
1822 : {
1823 1 : sal_uInt32 b = 2;
1824 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1825 : }
1826 : {
1827 1 : sal_Int64 b = 2;
1828 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1829 : }
1830 : {
1831 1 : sal_uInt64 b = 2;
1832 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1833 : }
1834 : {
1835 1 : float b = 2;
1836 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1837 : }
1838 : {
1839 1 : double b = 2;
1840 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1841 : }
1842 : {
1843 1 : sal_Unicode b = '2';
1844 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1845 : }
1846 : {
1847 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1848 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1849 : }
1850 : {
1851 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1852 2 : CPPUNIT_ASSERT_MESSAGE(
1853 : "css::uno::Type",
1854 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1855 : }
1856 : {
1857 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1858 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1859 : }
1860 : {
1861 1 : css::uno::Sequence< rtl::OUString > b(2);
1862 2 : CPPUNIT_ASSERT_MESSAGE(
1863 : "css::uno::Sequence<rtl::OUString>",
1864 2 : !(a >>= b) && b.getLength() == 2);
1865 : }
1866 : {
1867 1 : Enum1 b = Enum1_M2;
1868 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1869 : }
1870 : {
1871 1 : Struct1 b(2);
1872 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1873 : }
1874 : {
1875 1 : Struct2 b(2);
1876 1 : CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1877 : }
1878 : {
1879 1 : Struct2a b(2, 2);
1880 2 : CPPUNIT_ASSERT_MESSAGE(
1881 1 : "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1882 : }
1883 : {
1884 1 : Struct2b b(2, 2, 2);
1885 1 : CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1886 : }
1887 : {
1888 : Exception1 b(
1889 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1890 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1891 : }
1892 : {
1893 1 : css::uno::Reference< Interface1 > i(new Impl1);
1894 1 : css::uno::Reference< Interface1 > b(i);
1895 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1896 1 : }
1897 1 : }
1898 :
1899 1 : void Test::testPoly() {
1900 1 : css::uno::Any a;
1901 1 : a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1902 1 : CPPUNIT_ASSERT_MESSAGE( "type name", a.getValueType().getTypeName() == "Poly<[]char>" );
1903 2 : CPPUNIT_ASSERT_MESSAGE(
1904 : "constructor",
1905 2 : a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1906 1 : }
1907 :
1908 1 : void Test::testException() {
1909 : css::uno::Any a(
1910 : Exception2a(
1911 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1912 1 : 3));
1913 1 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Exception2a >());
1914 : {
1915 1 : bool b = true;
1916 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1917 : }
1918 : {
1919 1 : sal_Bool b = true;
1920 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1921 : }
1922 : {
1923 1 : sal_Int8 b = 2;
1924 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1925 : }
1926 : {
1927 1 : sal_uInt8 b = 2;
1928 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1929 : }
1930 : {
1931 1 : sal_Int16 b = 2;
1932 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1933 : }
1934 : {
1935 1 : sal_uInt16 b = 2;
1936 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1937 : }
1938 : {
1939 1 : sal_Int32 b = 2;
1940 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1941 : }
1942 : {
1943 1 : sal_uInt32 b = 2;
1944 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1945 : }
1946 : {
1947 1 : sal_Int64 b = 2;
1948 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1949 : }
1950 : {
1951 1 : sal_uInt64 b = 2;
1952 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1953 : }
1954 : {
1955 1 : float b = 2;
1956 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1957 : }
1958 : {
1959 1 : double b = 2;
1960 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1961 : }
1962 : {
1963 1 : sal_Unicode b = '2';
1964 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1965 : }
1966 : {
1967 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1968 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1969 : }
1970 : {
1971 1 : css::uno::Type b(getCppuType< rtl::OUString >());
1972 2 : CPPUNIT_ASSERT_MESSAGE(
1973 : "css::uno::Type",
1974 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1975 : }
1976 : {
1977 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1978 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1979 : }
1980 : {
1981 1 : css::uno::Sequence< rtl::OUString > b(2);
1982 2 : CPPUNIT_ASSERT_MESSAGE(
1983 : "css::uno::Sequence<rtl::OUString>",
1984 2 : !(a >>= b) && b.getLength() == 2);
1985 : }
1986 : {
1987 1 : Enum1 b = Enum1_M2;
1988 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1989 : }
1990 : {
1991 1 : Struct1 b(2);
1992 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1993 : }
1994 : {
1995 : Exception1 b(
1996 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1997 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1998 : }
1999 : {
2000 : Exception2 b(
2001 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2002 1 : CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
2003 : }
2004 : {
2005 : Exception2a b(
2006 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2007 1 : 2);
2008 2 : CPPUNIT_ASSERT_MESSAGE(
2009 2 : "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2010 : }
2011 : {
2012 : Exception2b b(
2013 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2014 1 : 2);
2015 1 : CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2016 : }
2017 : {
2018 1 : css::uno::Reference< Interface1 > i(new Impl1);
2019 1 : css::uno::Reference< Interface1 > b(i);
2020 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2021 1 : }
2022 1 : }
2023 :
2024 1 : void Test::testInterface() {
2025 1 : css::uno::Reference< Interface2a > i2(new Impl2);
2026 1 : css::uno::Any a(i2);
2027 2 : CPPUNIT_ASSERT(
2028 : a.getValueType()
2029 1 : == getCppuType< css::uno::Reference< Interface2a > >());
2030 : {
2031 1 : bool b = true;
2032 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2033 : }
2034 : {
2035 1 : sal_Bool b = true;
2036 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2037 : }
2038 : {
2039 1 : sal_Int8 b = 2;
2040 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2041 : }
2042 : {
2043 1 : sal_uInt8 b = 2;
2044 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2045 : }
2046 : {
2047 1 : sal_Int16 b = 2;
2048 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2049 : }
2050 : {
2051 1 : sal_uInt16 b = 2;
2052 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2053 : }
2054 : {
2055 1 : sal_Int32 b = 2;
2056 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2057 : }
2058 : {
2059 1 : sal_uInt32 b = 2;
2060 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2061 : }
2062 : {
2063 1 : sal_Int64 b = 2;
2064 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2065 : }
2066 : {
2067 1 : sal_uInt64 b = 2;
2068 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2069 : }
2070 : {
2071 1 : float b = 2;
2072 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2073 : }
2074 : {
2075 1 : double b = 2;
2076 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2077 : }
2078 : {
2079 1 : sal_Unicode b = '2';
2080 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2081 : }
2082 : {
2083 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2084 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2085 : }
2086 : {
2087 1 : css::uno::Type b(getCppuType< rtl::OUString >());
2088 2 : CPPUNIT_ASSERT_MESSAGE(
2089 : "css::uno::Type",
2090 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
2091 : }
2092 : {
2093 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2094 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2095 : }
2096 : {
2097 1 : css::uno::Sequence< rtl::OUString > b(2);
2098 2 : CPPUNIT_ASSERT_MESSAGE(
2099 : "css::uno::Sequence<rtl::OUString>",
2100 2 : !(a >>= b) && b.getLength() == 2);
2101 : }
2102 : {
2103 1 : Enum1 b = Enum1_M2;
2104 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2105 : }
2106 : {
2107 1 : Struct1 b(2);
2108 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2109 : }
2110 : {
2111 : Exception1 b(
2112 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2113 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2114 : }
2115 : {
2116 1 : css::uno::Reference< Interface1 > i(new Impl1);
2117 1 : css::uno::Reference< Interface1 > b(i);
2118 1 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2119 : }
2120 : {
2121 1 : css::uno::Reference< Interface2 > b(new Impl2);
2122 1 : CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2123 : }
2124 : {
2125 1 : css::uno::Reference< Interface2a > b(new Impl2);
2126 1 : CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2127 : }
2128 : {
2129 1 : css::uno::Reference< Interface2b > i(new Impl2b);
2130 1 : css::uno::Reference< Interface2b > b(i);
2131 1 : CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2132 : }
2133 : {
2134 1 : css::uno::Reference< Interface3 > b(new Impl2);
2135 1 : CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2136 1 : }
2137 1 : }
2138 :
2139 1 : void Test::testNull() {
2140 1 : css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2141 2 : CPPUNIT_ASSERT(
2142 : a.getValueType()
2143 1 : == getCppuType< css::uno::Reference< Interface2a > >());
2144 : {
2145 1 : bool b = true;
2146 1 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2147 : }
2148 : {
2149 1 : sal_Bool b = true;
2150 1 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2151 : }
2152 : {
2153 1 : sal_Int8 b = 2;
2154 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2155 : }
2156 : {
2157 1 : sal_uInt8 b = 2;
2158 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2159 : }
2160 : {
2161 1 : sal_Int16 b = 2;
2162 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2163 : }
2164 : {
2165 1 : sal_uInt16 b = 2;
2166 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2167 : }
2168 : {
2169 1 : sal_Int32 b = 2;
2170 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2171 : }
2172 : {
2173 1 : sal_uInt32 b = 2;
2174 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2175 : }
2176 : {
2177 1 : sal_Int64 b = 2;
2178 1 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2179 : }
2180 : {
2181 1 : sal_uInt64 b = 2;
2182 1 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2183 : }
2184 : {
2185 1 : float b = 2;
2186 1 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2187 : }
2188 : {
2189 1 : double b = 2;
2190 1 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2191 : }
2192 : {
2193 1 : sal_Unicode b = '2';
2194 1 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2195 : }
2196 : {
2197 1 : rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2198 1 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2199 : }
2200 : {
2201 1 : css::uno::Type b(getCppuType< rtl::OUString >());
2202 2 : CPPUNIT_ASSERT_MESSAGE(
2203 : "css::uno::Type",
2204 2 : !(a >>= b) && b == getCppuType< rtl::OUString >());
2205 : }
2206 : {
2207 1 : css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2208 1 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2209 : }
2210 : {
2211 1 : css::uno::Sequence< rtl::OUString > b(2);
2212 2 : CPPUNIT_ASSERT_MESSAGE(
2213 : "css::uno::Sequence<rtl::OUString>",
2214 2 : !(a >>= b) && b.getLength() == 2);
2215 : }
2216 : {
2217 1 : Enum1 b = Enum1_M2;
2218 1 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2219 : }
2220 : {
2221 1 : Struct1 b(2);
2222 1 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2223 : }
2224 : {
2225 : Exception1 b(
2226 1 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2227 1 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2228 : }
2229 : {
2230 1 : css::uno::Reference< Interface1 > b(new Impl1);
2231 2 : CPPUNIT_ASSERT_MESSAGE(
2232 2 : "Interface1", (a >>= b) && !b.is());
2233 : }
2234 : {
2235 1 : css::uno::Reference< Interface2 > b(new Impl2);
2236 2 : CPPUNIT_ASSERT_MESSAGE(
2237 2 : "Interface2", (a >>= b) && !b.is());
2238 : }
2239 : {
2240 1 : css::uno::Reference< Interface2a > b(new Impl2);
2241 1 : CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2242 : }
2243 : {
2244 1 : css::uno::Reference< Interface2b > b(new Impl2b);
2245 2 : CPPUNIT_ASSERT_MESSAGE(
2246 2 : "Interface2b", (a >>= b) && !b.is());
2247 : }
2248 : {
2249 1 : css::uno::Reference< Interface3 > b(new Impl2);
2250 2 : CPPUNIT_ASSERT_MESSAGE(
2251 2 : "Interface3", (a >>= b) && !b.is());
2252 1 : }
2253 1 : }
2254 :
2255 1 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2256 :
2257 : }
2258 :
2259 4 : CPPUNIT_PLUGIN_IMPLEMENT();
2260 :
2261 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|