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