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