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 using System; 29 using System.Diagnostics; 30 using System.Threading; 31 using System.Runtime.CompilerServices; 32 using uno; 33 using uno.util; 34 using unoidl.com.sun.star.uno; 35 using unoidl.com.sun.star.lang; 36 using unoidl.test.testtools.bridgetest; 37 38 namespace cs_testobj 39 { 40 41 class CheckFailed: System.Exception { 42 public CheckFailed(string message): base(message) {} 43 } 44 45 public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2 46 { 47 private XComponentContext m_xContext; 48 49 public BridgeTestObject( XComponentContext xContext ) 50 { 51 m_xContext = xContext; 52 } 53 public BridgeTestObject() 54 { 55 } 56 57 private bool _bool; 58 private char _char; 59 private byte _byte; 60 private short _short; 61 private ushort _ushort; 62 private int _long; 63 private uint _ulong; 64 private long _hyper; 65 private ulong _uhyper; 66 private float _float; 67 private double _double; 68 private String _string; 69 private Object _xInterface; 70 private Any _any; 71 private TestEnum _testEnum = TestEnum.TEST; 72 private TestElement[] _testElements = new TestElement[0]; 73 private TestDataElements _testDataElements = new TestDataElements(); 74 private int _nLastCallId = 0; 75 private bool _bFirstCall = true; 76 private bool _bSequenceOfCallTestPassed = true; 77 78 private bool[] _arBool; 79 private char[] _arChar; 80 private byte[] _arByte; 81 private short[]_arShort; 82 private int[] _arLong; 83 private long[] _arHyper; 84 private UInt16[] _arUShort; 85 private UInt32[] _arULong; 86 private UInt64[] _arUHyper; 87 private string[] _arString; 88 private float[] _arFloat; 89 private double[] _arDouble; 90 private TestEnum[] _arEnum; 91 private Object[] _arObject; 92 private int[][] _arLong2; 93 private int[][][] _arLong3; 94 private Any[] _arAny; 95 96 // private int _raiseAttr1; 97 98 99 public void setValues( 100 bool bBool, 101 char cChar, 102 byte nByte, 103 short nShort, 104 ushort nUShort, 105 int nLong, 106 uint nULong, 107 long nHyper, 108 ulong nUHyper, 109 float fFloat, 110 double fDouble, 111 TestEnum testEnum, 112 String str, 113 Object xInterface, 114 Any any, 115 TestElement [] testElements, 116 TestDataElements testDataElements ) 117 { 118 Debug.WriteLine( "##### " + GetType().FullName + ".setValues:" + any ); 119 120 _bool = bBool; 121 _char = cChar; 122 _byte = nByte; 123 _short = nShort; 124 _ushort = nUShort; 125 _long = nLong; 126 _ulong = nULong; 127 _hyper = nHyper; 128 _uhyper = nUHyper; 129 _float = fFloat; 130 _double = fDouble; 131 _testEnum = testEnum; 132 _string = str; 133 _xInterface = xInterface; 134 _any = any; 135 _testElements = testElements; 136 _testDataElements = testDataElements; 137 } 138 139 public TestDataElements setValues2( 140 /*INOUT*/ref bool io_bool, 141 /*INOUT*/ref char io_char, 142 /*INOUT*/ref byte io_byte, 143 /*INOUT*/ref short io_short, 144 /*INOUT*/ref ushort io_ushort, 145 /*INOUT*/ref int io_long, 146 /*INOUT*/ref uint io_ulong, 147 /*INOUT*/ref long io_hyper, 148 /*INOUT*/ref ulong io_uhyper, 149 /*INOUT*/ref float io_float, 150 /*INOUT*/ref double io_double, 151 /*INOUT*/ref TestEnum io_testEnum, 152 /*INOUT*/ref String io_string, 153 /*INOUT*/ref Object io_xInterface, 154 /*INOUT*/ref Any io_any, 155 /*INOUT*/ref TestElement[] io_testElements, 156 /*INOUT*/ref TestDataElements io_testDataElements ) 157 { 158 Debug.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any ); 159 160 _bool = io_bool; 161 _char = io_char; 162 _byte = io_byte; 163 _short = io_short; 164 _ushort = io_ushort; 165 _long = io_long; 166 _ulong = io_ulong; 167 _hyper = io_hyper; 168 _uhyper = io_uhyper; 169 _float = io_float; 170 _double = io_double; 171 _testEnum = io_testEnum; 172 _string = io_string; 173 _xInterface = io_xInterface; 174 _any = io_any; 175 _testElements = (TestElement[]) io_testElements.Clone(); 176 _testDataElements = io_testDataElements; 177 178 TestElement temp = io_testElements[ 0 ]; 179 io_testElements[ 0 ] = io_testElements[ 1 ]; 180 io_testElements[ 1 ] = temp; 181 182 return _testDataElements; 183 } 184 185 public TestDataElements getValues( 186 /*OUT*/out bool o_bool, 187 /*OUT*/out char o_char, 188 /*OUT*/out byte o_byte, 189 /*OUT*/out short o_short, 190 /*OUT*/out ushort o_ushort, 191 /*OUT*/out int o_long, 192 /*OUT*/out uint o_ulong, 193 /*OUT*/out long o_hyper, 194 /*OUT*/out ulong o_uhyper, 195 /*OUT*/out float o_float, 196 /*OUT*/out double o_double, 197 /*OUT*/out TestEnum o_testEnum, 198 /*OUT*/out String o_string, 199 /*OUT*/out Object o_xInterface, 200 /*OUT*/out Any o_any, 201 /*OUT*/out TestElement[] o_testElements, 202 /*OUT*/out TestDataElements o_testDataElements ) 203 { 204 Debug.WriteLine( "##### " + GetType().FullName + ".getValues" ); 205 206 o_bool = _bool; 207 o_char = _char; 208 o_byte = _byte; 209 o_short = _short; 210 o_ushort = _ushort; 211 o_long = _long; 212 o_ulong = _ulong; 213 o_hyper = _hyper; 214 o_uhyper = _uhyper; 215 o_float = _float; 216 o_double = _double; 217 o_testEnum = _testEnum; 218 o_string = _string; 219 o_xInterface = _xInterface; 220 o_any = _any; 221 o_testElements = _testElements; 222 o_testDataElements = _testDataElements; 223 224 return _testDataElements; 225 } 226 227 public SmallStruct echoSmallStruct(/*[in]*/SmallStruct arg) 228 { 229 return arg; 230 } 231 232 public MediumStruct echoMediumStruct(/*[in]*/MediumStruct arg) 233 { 234 return arg; 235 } 236 237 public BigStruct echoBigStruct(/*[in]*/BigStruct arg) 238 { 239 return arg; 240 } 241 242 public AllFloats echoAllFloats(/*[in]*/AllFloats arg) 243 { 244 return arg; 245 } 246 247 public int testPPCAlignment( long l1, long l2, int i1, long l3, int i2 ) 248 { 249 return i2; 250 } 251 252 // Attributes 253 public bool Bool 254 { 255 get { return _bool; } 256 set { _bool = value; } 257 } 258 public byte Byte 259 { 260 get { return _byte; } 261 set { _byte = value; } 262 } 263 public char Char 264 { 265 get { return _char; } 266 set { _char = value; } 267 } 268 public short Short 269 { 270 get { return _short; } 271 set { _short = value; } 272 } 273 public ushort UShort 274 { 275 get { return _ushort; } 276 set { _ushort = value; } 277 } 278 public int Long 279 { 280 get { return _long; } 281 set { _long = value; } 282 } 283 public uint ULong 284 { 285 get { return _ulong; } 286 set { _ulong = value; } 287 } 288 public long Hyper 289 { 290 get { return _hyper; } 291 set { _hyper = value; } 292 } 293 public ulong UHyper 294 { 295 get { return _uhyper; } 296 set { _uhyper = value; } 297 } 298 public float Float 299 { 300 get { return _float; } 301 set { _float = value; } 302 } 303 public double Double 304 { 305 get { return _double; } 306 set { _double = value; } 307 } 308 public TestEnum Enum 309 { 310 get { return _testEnum; } 311 set { _testEnum = value; } 312 } 313 public String String 314 { 315 get { return _string; } 316 set { _string = value; } 317 } 318 public Object Interface 319 { 320 get { return _xInterface; } 321 set { _xInterface = value; } 322 } 323 public uno.Any Any 324 { 325 get { 326 327 Debug.WriteLine( "##### " + GetType().FullName + ".Any" ); 328 return _any; 329 } 330 set { 331 Debug.WriteLine( "##### " + GetType().FullName + ".Any:" + value ); 332 _any = value; 333 } 334 } 335 public TestElement [] Sequence 336 { 337 get { return _testElements; } 338 set { _testElements = value; } 339 } 340 public TestDataElements Struct 341 { 342 get { return _testDataElements; } 343 set { _testDataElements = value; } 344 } 345 public Any transportAny(Any value) 346 { 347 return value; 348 } 349 public void call(int nCallId , int nWaitMUSEC) 350 { 351 Thread.Sleep(nWaitMUSEC / 10000); 352 353 if(_bFirstCall) 354 _bFirstCall = false; 355 356 else 357 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); 358 359 _nLastCallId = nCallId; 360 } 361 public void callOneway( int nCallId , int nWaitMUSEC ) 362 { 363 Thread.Sleep(nWaitMUSEC / 10000); 364 365 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId); 366 _nLastCallId = nCallId; 367 } 368 public bool sequenceOfCallTestPassed() 369 { 370 return _bSequenceOfCallTestPassed; 371 } 372 [MethodImpl( MethodImplOptions.Synchronized )] 373 public void callRecursivly( XRecursiveCall xCall, int nToCall ) 374 { 375 lock (this) 376 { 377 if(nToCall != 0) 378 { 379 nToCall --; 380 xCall.callRecursivly(this , nToCall); 381 } 382 } 383 } 384 [MethodImpl( MethodImplOptions.Synchronized )] 385 public void startRecursiveCall( XRecursiveCall xCall, int nToCall ) 386 { 387 lock (this) 388 { 389 if(nToCall != 0) 390 { 391 nToCall --; 392 xCall.callRecursivly( this , nToCall ); 393 } 394 } 395 } 396 397 // XBridgeTest 398 public TestDataElements raiseException( 399 short nArgumentPos, String rMsg, Object xContext ) 400 { 401 throw new IllegalArgumentException(rMsg, xContext, nArgumentPos); 402 } 403 public void raiseRuntimeExceptionOneway( String rMsg, Object xContext ) 404 { 405 throw new RuntimeException(rMsg, xContext); 406 } 407 408 private void dothrow( System.Exception e ) 409 { 410 throw e; 411 } 412 public int RuntimeException 413 { 414 get { 415 try 416 { 417 dothrow( new RuntimeException(_string, _xInterface) ); 418 return 0; // dummy 419 } 420 catch (System.Exception exc) 421 { 422 throw exc; 423 } 424 } 425 set { throw new RuntimeException(_string, _xInterface); } 426 } 427 428 // XBridgeTest2 429 public int[][] setDim2(int[][] val) 430 { 431 _arLong2 = val; 432 return val; 433 } 434 435 public int[][][] setDim3(int[][][] val) 436 { 437 _arLong3 = val; 438 return val; 439 } 440 441 public Any[] setSequenceAny(Any[] val) 442 { 443 _arAny = val; 444 return val; 445 } 446 447 public bool[] setSequenceBool(bool[] val) 448 { 449 _arBool = val; 450 return val; 451 } 452 453 public byte[] setSequenceByte(byte[] val) 454 { 455 _arByte = val; 456 return val; 457 } 458 459 public char[] setSequenceChar(char[] val) 460 { 461 _arChar = val; 462 return val; 463 } 464 465 public short[] setSequenceShort(short[] val) 466 { 467 _arShort = val; 468 return val; 469 } 470 471 public int[] setSequenceLong(int[] val) 472 { 473 _arLong = val; 474 return val; 475 } 476 477 public long[] setSequenceHyper(long[] val) 478 { 479 _arHyper = val; 480 return val; 481 } 482 483 public float[] setSequenceFloat(float[] val) 484 { 485 _arFloat = val; 486 return val; 487 } 488 489 public double[] setSequenceDouble(double[] val) 490 { 491 _arDouble = val; 492 return val; 493 } 494 495 public TestEnum[] setSequenceEnum(TestEnum[] val) 496 { 497 _arEnum = val; 498 return val; 499 } 500 501 public UInt16[] setSequenceUShort(UInt16[] val) 502 { 503 _arUShort = val; 504 return val; 505 } 506 507 public UInt32[] setSequenceULong(UInt32[] val) 508 { 509 _arULong = val; 510 return val; 511 } 512 513 public UInt64[] setSequenceUHyper(UInt64[] val) 514 { 515 _arUHyper = val; 516 return val; 517 } 518 519 public Object[] setSequenceXInterface(Object[] val) 520 { 521 _arObject = val; 522 return val; 523 } 524 525 public string[] setSequenceString(string[] val) 526 { 527 _arString = val; 528 return val; 529 } 530 531 public TestElement[] setSequenceStruct(TestElement[] val) 532 { 533 _testElements = val; 534 return val; 535 } 536 537 public void setSequencesInOut(ref bool[] aSeqBoolean, 538 ref char[] aSeqChar, 539 ref byte[] aSeqByte, 540 ref short[] aSeqShort, 541 ref UInt16[] aSeqUShort, 542 ref int[] aSeqLong, 543 ref UInt32[] aSeqULong, 544 ref long[] aSeqHyper, 545 ref UInt64[] aSeqUHyper, 546 ref float[] aSeqFloat, 547 ref double[] aSeqDouble, 548 ref TestEnum[] aSeqTestEnum, 549 ref string[] aSeqString, 550 ref object[] aSeqXInterface, 551 ref Any[] aSeqAny, 552 ref int[][] aSeqDim2, 553 ref int[][][] aSeqDim3) 554 { 555 _arBool = aSeqBoolean; 556 _arChar = aSeqChar; 557 _arByte = aSeqByte; 558 _arShort = aSeqShort; 559 _arUShort = aSeqUShort; 560 _arLong = aSeqLong; 561 _arULong = aSeqULong; 562 _arHyper = aSeqHyper; 563 _arUHyper = aSeqUHyper; 564 _arFloat = aSeqFloat; 565 _arDouble = aSeqDouble; 566 _arEnum = aSeqTestEnum; 567 _arString = aSeqString; 568 _arObject = aSeqXInterface; 569 _arAny = aSeqAny; 570 _arLong2 = aSeqDim2; 571 _arLong3 = aSeqDim3; 572 } 573 574 public void setSequencesOut(out bool[] aSeqBoolean, 575 out char[] aSeqChar, 576 out byte[] aSeqByte, 577 out short[] aSeqShort, 578 out UInt16[] aSeqUShort, 579 out int[] aSeqLong, 580 out UInt32[] aSeqULong, 581 out long[] aSeqHyper, 582 out UInt64[] aSeqUHyper, 583 out float[] aSeqFloat, 584 out double[] aSeqDouble, 585 out TestEnum[] aSeqTestEnum, 586 out string[] aSeqString, 587 out object[] aSeqXInterface, 588 out Any[] aSeqAny, 589 out int[][] aSeqDim2, 590 out int[][][] aSeqDim3) 591 { 592 aSeqBoolean = _arBool; 593 aSeqChar = _arChar; 594 aSeqByte = _arByte; 595 aSeqShort = _arShort; 596 aSeqUShort = _arUShort; 597 aSeqLong = _arLong; 598 aSeqULong = _arULong; 599 aSeqHyper = _arHyper; 600 aSeqUHyper = _arUHyper; 601 aSeqFloat = _arFloat; 602 aSeqDouble = _arDouble; 603 aSeqTestEnum = _arEnum; 604 aSeqString = _arString; 605 aSeqXInterface = _arObject; 606 aSeqAny = _arAny; 607 aSeqDim2 = _arLong2; 608 aSeqDim3 = _arLong3; 609 610 } 611 612 /* Attention: Debugging this code (probably in mixed mode) may lead to exceptions 613 * which do not occur when running normally (Visual Studio 2003) 614 */ 615 public void testConstructorsService(XComponentContext context) 616 { 617 Constructors.create1(context, 618 true, 619 0x80, // -128 in C++, 620 Int16.MinValue, 621 UInt16.MaxValue, 622 Int32.MinValue, 623 UInt32.MaxValue, 624 Int64.MinValue, 625 UInt64.MaxValue, 626 0.123f, 627 0.456, 628 'X', 629 "test", 630 typeof(Any), 631 new Any(true), 632 new bool[] { true }, 633 new byte[] { 0x80}, // in C++ the value is compared with SAL_MIN_INT8 which is -128 634 new short[] { Int16.MinValue }, 635 new UInt16[] { UInt16.MaxValue }, 636 new Int32[] {Int32.MinValue}, 637 new UInt32[] { UInt32.MaxValue }, 638 new long[] { Int64.MinValue }, 639 new UInt64[] { UInt64.MaxValue }, 640 new float[] { 0.123f }, 641 new double[] { 0.456 }, 642 new char[] { 'X' }, 643 new string[] { "test" }, 644 new Type[] { typeof(Any) }, 645 new Any[] { new Any(true) }, 646 new bool[][] { new bool[] { true } }, 647 new Any[][] { new Any[] { new Any(true) } }, 648 new TestEnum[] { TestEnum.TWO }, 649 new TestStruct[] { new TestStruct(10) }, 650 new TestPolyStruct[] { new TestPolyStruct(true) }, 651 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }, 652 new object[] { null }, 653 TestEnum.TWO, 654 new TestStruct(10), 655 new TestPolyStruct(true), 656 new TestPolyStruct(new Any(true)), 657 null 658 ); 659 660 Constructors.create2(context, 661 new Any(true), 662 new Any((System.Byte) 0x80), 663 new Any(Int16.MinValue), 664 new Any(UInt16.MaxValue), 665 new Any(Int32.MinValue), 666 new Any(UInt32.MaxValue), 667 new Any(Int64.MinValue), 668 new Any(UInt64.MaxValue), 669 new Any(0.123f), 670 new Any(0.456), 671 new Any('X'), 672 new Any("test"), 673 new Any(typeof(Any)), 674 new Any(true), 675 new Any(typeof(bool[]), new bool[] { true }), 676 new Any(typeof(byte[]), new byte[] { (System.Byte) 0x80}), 677 new Any(typeof(short[]), new short[] { Int16.MinValue }), 678 new Any(typeof(UInt16[]), new UInt16[] { UInt16.MaxValue }), 679 new Any(typeof(int[]), new int[] { Int32.MinValue }), 680 new Any(typeof(UInt32[]), new UInt32[] { UInt32.MaxValue }), 681 new Any(typeof(long[]), new long[] { Int64.MinValue }), 682 new Any(typeof(UInt64[]), new UInt64[] { UInt64.MaxValue }), 683 new Any(typeof(float[]), new float[] { 0.123f }), 684 new Any(typeof(double[]), new double[] { 0.456 }), 685 new Any(typeof(char[]), new char[] { 'X' }), 686 new Any(typeof(string[]), new string[] { "test" }), 687 new Any(typeof(Type[]), new Type[] { typeof(Any) }), 688 new Any(typeof(Any[]), new Any[] { new Any(true) }), 689 new Any(typeof(bool[][]), new bool[][] { new bool[] { true } }), 690 new Any( 691 typeof(Any[][]), new Any[][] { new Any[] { new Any(true) } }), 692 new Any(typeof(TestEnum[]), new TestEnum[] { TestEnum.TWO }), 693 new Any( 694 typeof(TestStruct[]), new TestStruct[] { new TestStruct(10) }), 695 new Any( 696 PolymorphicType.GetType( 697 typeof(TestPolyStruct[]), 698 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>[]"), 699 new TestPolyStruct[] { new TestPolyStruct(true) }) , 700 new Any( 701 PolymorphicType.GetType( 702 typeof(TestPolyStruct[]), 703 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>[]"), 704 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }), 705 new Any(typeof(object[])/*TODO*/, new object[] { null }), 706 new Any(typeof(TestEnum), TestEnum.TWO), 707 new Any(typeof(TestStruct), new TestStruct(10)), 708 new Any( 709 PolymorphicType.GetType( 710 typeof(TestPolyStruct), 711 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>"), 712 new TestPolyStruct(true)), 713 new Any( 714 PolymorphicType.GetType( 715 typeof(TestPolyStruct), 716 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>"), 717 new TestPolyStruct(new Any(true))), 718 new Any(typeof(object), null) 719 ); 720 721 722 XMultiBase1 xMulti = Constructors2.create1( 723 context, 724 new TestPolyStruct(typeof(int)), 725 new TestPolyStruct(new Any(true)), 726 new TestPolyStruct(true), 727 new TestPolyStruct((Byte) 0x80), 728 new TestPolyStruct(Int16.MinValue), 729 new TestPolyStruct(Int32.MinValue), 730 new TestPolyStruct(Int64.MinValue), 731 new TestPolyStruct('X'), 732 new TestPolyStruct("test"), 733 new TestPolyStruct(0.123f), 734 new TestPolyStruct(0.456d), 735 new TestPolyStruct(new object()), 736 new TestPolyStruct(new uno.util.WeakComponentBase()), 737 new TestPolyStruct(TestEnum.TWO), 738 new TestPolyStruct(new TestPolyStruct2('X', new Any(true))), 739 new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test")), 740 new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true)))), 741 new TestPolyStruct2( new TestPolyStruct2('X', new Any(true)), new TestPolyStruct('X')), 742 new TestPolyStruct(new Type[] { typeof(int)}), 743 new TestPolyStruct(new Any[] { new Any(true) }), 744 new TestPolyStruct(new bool[] {true}), 745 new TestPolyStruct(new byte[] {0x80}), 746 new TestPolyStruct(new short[] {Int16.MinValue}), 747 new TestPolyStruct(new int[] {Int32.MinValue}), 748 new TestPolyStruct(new long[] {Int64.MinValue}), 749 new TestPolyStruct(new char[] {'X'}), 750 new TestPolyStruct(new string[] {"test"}), 751 new TestPolyStruct(new float[] {0.123f}), 752 new TestPolyStruct(new double[] {0.456d}), 753 new TestPolyStruct(new object[] {new object()}), 754 new TestPolyStruct(new unoidl.com.sun.star.lang.XComponent[] {new uno.util.WeakComponentBase()}), 755 new TestPolyStruct(new TestEnum[] {TestEnum.TWO}), 756 new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2('X', new Any[] {new Any(true)})}), 757 new TestPolyStruct(new TestPolyStruct2[] { 758 new TestPolyStruct2(new TestPolyStruct('X'), new Any[] {new Any(true)})}), 759 new TestPolyStruct(new int[][] { new int[] {Int32.MinValue} }), 760 new TestPolyStruct[]{ new TestPolyStruct(Int32.MinValue)}, 761 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}, 762 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test"))}, 763 new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true))))}, 764 new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)),new TestPolyStruct('X'))}, 765 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct('X')}}, 766 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}}, 767 new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)), "test"))}}, 768 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X',new TestPolyStruct(new Any(true))))}}, 769 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)),new TestPolyStruct('X'))}} 770 ); 771 772 //test the returned interface 773 xMulti.fn11(1); 774 775 776 } 777 778 public XCurrentContextChecker getCurrentContextChecker() 779 { 780 return null; //TODO: not yet tested in CLI UNO 781 } 782 783 public TestPolyStruct transportPolyBoolean(/*[in]*/TestPolyStruct arg) 784 { 785 return arg; 786 } 787 788 public void transportPolyHyper(/*[in][out]*/ ref TestPolyStruct arg) 789 { 790 } 791 792 public void transportPolySequence(TestPolyStruct arg1, 793 out TestPolyStruct arg2) 794 { 795 arg2 = arg1; 796 } 797 798 public TestPolyStruct getNullPolyBadEnum() 799 { 800 return new TestPolyStruct(unoidl.test.testtools.bridgetest.TestBadEnum.M); 801 } 802 803 public TestPolyStruct getNullPolyLong() 804 { 805 return new TestPolyStruct(); 806 } 807 808 public TestPolyStruct getNullPolyString() 809 { 810 return new TestPolyStruct(); 811 } 812 813 public TestPolyStruct getNullPolyType() 814 { 815 return new TestPolyStruct(); 816 } 817 818 public TestPolyStruct getNullPolyAny() 819 { 820 return new TestPolyStruct(); 821 } 822 823 public TestPolyStruct getNullPolySequence() 824 { 825 return new TestPolyStruct(); 826 } 827 828 public TestPolyStruct getNullPolyEnum() 829 { 830 return new TestPolyStruct(); 831 } 832 833 public TestPolyStruct getNullPolyStruct() 834 { 835 return new TestPolyStruct(); 836 } 837 838 public TestPolyStruct getNullPolyInterface() 839 { 840 return new TestPolyStruct(); 841 } 842 843 public XMulti getMulti() 844 { 845 return new testtools.bridgetest.cli_cs.Multi(); 846 } 847 848 private static void checkEqual(int value, int argument) { 849 if (argument != value) { 850 throw new CheckFailed(value + " != " + argument); 851 } 852 } 853 854 private static void checkEqual(double value, double argument) { 855 if (argument != value) { 856 throw new CheckFailed(value + " != " + argument); 857 } 858 } 859 860 private static void checkEqual(string value, string argument) { 861 if (argument != value) { 862 throw new CheckFailed(value + " != " + argument); 863 } 864 } 865 866 public string testMulti(XMulti multi) 867 { 868 try { 869 checkEqual(0.0, multi.att1); 870 multi.att1 = 0.1; 871 checkEqual(0.1, multi.att1); 872 checkEqual(11 * 1, multi.fn11(1)); 873 checkEqual("12" + "abc", multi.fn12("abc")); 874 checkEqual(21 * 2, multi.fn21(2)); 875 checkEqual("22" + "de", multi.fn22("de")); 876 checkEqual(0.0, multi.att3); 877 multi.att3 = 0.3; 878 checkEqual(0.3, multi.att3); 879 checkEqual(31 * 3, multi.fn31(3)); 880 checkEqual("32" + "f", multi.fn32("f")); 881 checkEqual(33, multi.fn33()); 882 checkEqual(41 * 4, multi.fn41(4)); 883 checkEqual(61 * 6, multi.fn61(6)); 884 checkEqual("62" + "", multi.fn62("")); 885 checkEqual(71 * 7, multi.fn71(7)); 886 checkEqual("72" + "g", multi.fn72("g")); 887 checkEqual(73, multi.fn73()); 888 } catch (CheckFailed f) { 889 return f.Message; 890 } 891 return ""; 892 } 893 894 public int RaiseAttr1 895 { 896 get { throw new RuntimeException(); } 897 set { throw new IllegalArgumentException(); } 898 } 899 900 public int RaiseAttr2 901 { 902 get { throw new IllegalArgumentException(); } 903 set { throw new IllegalArgumentException(); } 904 } 905 906 907 } 908 909 } 910