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