Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / testtools / source / bridgetest / cli / cli_cs_testobj.cs
blob8f396c924cead772814790555c1347ec86f62318
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 using System;
20 using System.Diagnostics;
21 using System.Threading;
22 using System.Runtime.CompilerServices;
23 using uno;
24 using uno.util;
25 using unoidl.com.sun.star.uno;
26 using unoidl.com.sun.star.lang;
27 using unoidl.test.testtools.bridgetest;
29 namespace cs_testobj
32 class CheckFailed: System.Exception {
33 public CheckFailed(string message): base(message) {}
36 public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2
38 private XComponentContext m_xContext;
40 public BridgeTestObject( XComponentContext xContext )
42 m_xContext = xContext;
44 public BridgeTestObject()
48 private bool _bool;
49 private char _char;
50 private byte _byte;
51 private short _short;
52 private ushort _ushort;
53 private int _long;
54 private uint _ulong;
55 private long _hyper;
56 private ulong _uhyper;
57 private float _float;
58 private double _double;
59 private String _string;
60 private Object _xInterface;
61 private Any _any;
62 private TestEnum _testEnum = TestEnum.TEST;
63 private TestElement[] _testElements = new TestElement[0];
64 private TestDataElements _testDataElements = new TestDataElements();
65 private int _nLastCallId = 0;
66 private bool _bFirstCall = true;
67 private bool _bSequenceOfCallTestPassed = true;
69 private bool[] _arBool;
70 private char[] _arChar;
71 private byte[] _arByte;
72 private short[]_arShort;
73 private int[] _arLong;
74 private long[] _arHyper;
75 private UInt16[] _arUShort;
76 private UInt32[] _arULong;
77 private UInt64[] _arUHyper;
78 private string[] _arString;
79 private float[] _arFloat;
80 private double[] _arDouble;
81 private TestEnum[] _arEnum;
82 private Object[] _arObject;
83 private int[][] _arLong2;
84 private int[][][] _arLong3;
85 private Any[] _arAny;
87 // private int _raiseAttr1;
90 public void setValues(
91 bool bBool,
92 char cChar,
93 byte nByte,
94 short nShort,
95 ushort nUShort,
96 int nLong,
97 uint nULong,
98 long nHyper,
99 ulong nUHyper,
100 float fFloat,
101 double fDouble,
102 TestEnum testEnum,
103 String str,
104 Object xInterface,
105 Any any,
106 TestElement [] testElements,
107 TestDataElements testDataElements )
109 Debug.WriteLine( "##### " + GetType().FullName + ".setValues:" + any );
111 _bool = bBool;
112 _char = cChar;
113 _byte = nByte;
114 _short = nShort;
115 _ushort = nUShort;
116 _long = nLong;
117 _ulong = nULong;
118 _hyper = nHyper;
119 _uhyper = nUHyper;
120 _float = fFloat;
121 _double = fDouble;
122 _testEnum = testEnum;
123 _string = str;
124 _xInterface = xInterface;
125 _any = any;
126 _testElements = testElements;
127 _testDataElements = testDataElements;
130 public TestDataElements setValues2(
131 /*INOUT*/ref bool io_bool,
132 /*INOUT*/ref char io_char,
133 /*INOUT*/ref byte io_byte,
134 /*INOUT*/ref short io_short,
135 /*INOUT*/ref ushort io_ushort,
136 /*INOUT*/ref int io_long,
137 /*INOUT*/ref uint io_ulong,
138 /*INOUT*/ref long io_hyper,
139 /*INOUT*/ref ulong io_uhyper,
140 /*INOUT*/ref float io_float,
141 /*INOUT*/ref double io_double,
142 /*INOUT*/ref TestEnum io_testEnum,
143 /*INOUT*/ref String io_string,
144 /*INOUT*/ref Object io_xInterface,
145 /*INOUT*/ref Any io_any,
146 /*INOUT*/ref TestElement[] io_testElements,
147 /*INOUT*/ref TestDataElements io_testDataElements )
149 Debug.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any );
151 _bool = io_bool;
152 _char = io_char;
153 _byte = io_byte;
154 _short = io_short;
155 _ushort = io_ushort;
156 _long = io_long;
157 _ulong = io_ulong;
158 _hyper = io_hyper;
159 _uhyper = io_uhyper;
160 _float = io_float;
161 _double = io_double;
162 _testEnum = io_testEnum;
163 _string = io_string;
164 _xInterface = io_xInterface;
165 _any = io_any;
166 _testElements = (TestElement[]) io_testElements.Clone();
167 _testDataElements = io_testDataElements;
169 TestElement temp = io_testElements[ 0 ];
170 io_testElements[ 0 ] = io_testElements[ 1 ];
171 io_testElements[ 1 ] = temp;
173 return _testDataElements;
176 public TestDataElements getValues(
177 /*OUT*/out bool o_bool,
178 /*OUT*/out char o_char,
179 /*OUT*/out byte o_byte,
180 /*OUT*/out short o_short,
181 /*OUT*/out ushort o_ushort,
182 /*OUT*/out int o_long,
183 /*OUT*/out uint o_ulong,
184 /*OUT*/out long o_hyper,
185 /*OUT*/out ulong o_uhyper,
186 /*OUT*/out float o_float,
187 /*OUT*/out double o_double,
188 /*OUT*/out TestEnum o_testEnum,
189 /*OUT*/out String o_string,
190 /*OUT*/out Object o_xInterface,
191 /*OUT*/out Any o_any,
192 /*OUT*/out TestElement[] o_testElements,
193 /*OUT*/out TestDataElements o_testDataElements )
195 Debug.WriteLine( "##### " + GetType().FullName + ".getValues" );
197 o_bool = _bool;
198 o_char = _char;
199 o_byte = _byte;
200 o_short = _short;
201 o_ushort = _ushort;
202 o_long = _long;
203 o_ulong = _ulong;
204 o_hyper = _hyper;
205 o_uhyper = _uhyper;
206 o_float = _float;
207 o_double = _double;
208 o_testEnum = _testEnum;
209 o_string = _string;
210 o_xInterface = _xInterface;
211 o_any = _any;
212 o_testElements = _testElements;
213 o_testDataElements = _testDataElements;
215 return _testDataElements;
218 public SmallStruct echoSmallStruct(/*[in]*/SmallStruct arg)
220 return arg;
223 public MediumStruct echoMediumStruct(/*[in]*/MediumStruct arg)
225 return arg;
228 public BigStruct echoBigStruct(/*[in]*/BigStruct arg)
230 return arg;
233 public TwoFloats echoTwoFloats(/*[in]*/TwoFloats arg)
235 return arg;
238 public FourFloats echoFourFloats(/*[in]*/FourFloats arg)
240 return arg;
243 public MixedFloatAndInteger echoMixedFloatAndInteger(/*[in]*/MixedFloatAndInteger arg)
245 return arg;
248 public ThreeByteStruct echoThreeByteStruct(/*[in]*/ThreeByteStruct arg)
250 return arg;
253 public int testPPCAlignment( long l1, long l2, int i1, long l3, int i2 )
255 return i2;
258 public int testPPC64Alignment( double d1, double d2, double d3, int i1 )
260 return i1;
263 public double testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 )
265 return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10;
268 // Attributes
269 public bool Bool
271 get { return _bool; }
272 set { _bool = value; }
274 public byte Byte
276 get { return _byte; }
277 set { _byte = value; }
279 public char Char
281 get { return _char; }
282 set { _char = value; }
284 public short Short
286 get { return _short; }
287 set { _short = value; }
289 public ushort UShort
291 get { return _ushort; }
292 set { _ushort = value; }
294 public int Long
296 get { return _long; }
297 set { _long = value; }
299 public uint ULong
301 get { return _ulong; }
302 set { _ulong = value; }
304 public long Hyper
306 get { return _hyper; }
307 set { _hyper = value; }
309 public ulong UHyper
311 get { return _uhyper; }
312 set { _uhyper = value; }
314 public float Float
316 get { return _float; }
317 set { _float = value; }
319 public double Double
321 get { return _double; }
322 set { _double = value; }
324 public TestEnum Enum
326 get { return _testEnum; }
327 set { _testEnum = value; }
329 public String String
331 get { return _string; }
332 set { _string = value; }
334 public Object Interface
336 get { return _xInterface; }
337 set { _xInterface = value; }
339 public uno.Any Any
341 get {
343 Debug.WriteLine( "##### " + GetType().FullName + ".Any" );
344 return _any;
346 set {
347 Debug.WriteLine( "##### " + GetType().FullName + ".Any:" + value );
348 _any = value;
351 public TestElement [] Sequence
353 get { return _testElements; }
354 set { _testElements = value; }
356 public TestDataElements Struct
358 get { return _testDataElements; }
359 set { _testDataElements = value; }
361 public Any transportAny(Any value)
363 return value;
365 public void call(int nCallId , int nWaitMUSEC)
367 Thread.Sleep(nWaitMUSEC / 10000);
369 if(_bFirstCall)
370 _bFirstCall = false;
372 else
373 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);
375 _nLastCallId = nCallId;
377 public void callOneway( int nCallId , int nWaitMUSEC )
379 Thread.Sleep(nWaitMUSEC / 10000);
381 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);
382 _nLastCallId = nCallId;
384 public bool sequenceOfCallTestPassed()
386 return _bSequenceOfCallTestPassed;
388 [MethodImpl( MethodImplOptions.Synchronized )]
389 public void callRecursivly( XRecursiveCall xCall, int nToCall )
391 lock (this)
393 if(nToCall != 0)
395 nToCall --;
396 xCall.callRecursivly(this , nToCall);
400 [MethodImpl( MethodImplOptions.Synchronized )]
401 public void startRecursiveCall( XRecursiveCall xCall, int nToCall )
403 lock (this)
405 if(nToCall != 0)
407 nToCall --;
408 xCall.callRecursivly( this , nToCall );
413 // XBridgeTest
414 public TestDataElements raiseException(
415 short nArgumentPos, String rMsg, Object xContext )
417 throw new IllegalArgumentException(rMsg, xContext, nArgumentPos);
419 public void raiseRuntimeExceptionOneway( String rMsg, Object xContext )
421 throw new RuntimeException(rMsg, xContext);
424 private void dothrow( System.Exception e )
426 throw e;
428 public int RuntimeException
430 get {
433 dothrow( new RuntimeException(_string, _xInterface) );
434 return 0; // dummy
436 catch (System.Exception exc)
438 throw exc;
441 set { throw new RuntimeException(_string, _xInterface); }
444 // XBridgeTest2
445 public int[][] setDim2(int[][] val)
447 _arLong2 = val;
448 return val;
451 public int[][][] setDim3(int[][][] val)
453 _arLong3 = val;
454 return val;
457 public Any[] setSequenceAny(Any[] val)
459 _arAny = val;
460 return val;
463 public bool[] setSequenceBool(bool[] val)
465 _arBool = val;
466 return val;
469 public byte[] setSequenceByte(byte[] val)
471 _arByte = val;
472 return val;
475 public char[] setSequenceChar(char[] val)
477 _arChar = val;
478 return val;
481 public short[] setSequenceShort(short[] val)
483 _arShort = val;
484 return val;
487 public int[] setSequenceLong(int[] val)
489 _arLong = val;
490 return val;
493 public long[] setSequenceHyper(long[] val)
495 _arHyper = val;
496 return val;
499 public float[] setSequenceFloat(float[] val)
501 _arFloat = val;
502 return val;
505 public double[] setSequenceDouble(double[] val)
507 _arDouble = val;
508 return val;
511 public TestEnum[] setSequenceEnum(TestEnum[] val)
513 _arEnum = val;
514 return val;
517 public UInt16[] setSequenceUShort(UInt16[] val)
519 _arUShort = val;
520 return val;
523 public UInt32[] setSequenceULong(UInt32[] val)
525 _arULong = val;
526 return val;
529 public UInt64[] setSequenceUHyper(UInt64[] val)
531 _arUHyper = val;
532 return val;
535 public Object[] setSequenceXInterface(Object[] val)
537 _arObject = val;
538 return val;
541 public string[] setSequenceString(string[] val)
543 _arString = val;
544 return val;
547 public TestElement[] setSequenceStruct(TestElement[] val)
549 _testElements = val;
550 return val;
553 public void setSequencesInOut(ref bool[] aSeqBoolean,
554 ref char[] aSeqChar,
555 ref byte[] aSeqByte,
556 ref short[] aSeqShort,
557 ref UInt16[] aSeqUShort,
558 ref int[] aSeqLong,
559 ref UInt32[] aSeqULong,
560 ref long[] aSeqHyper,
561 ref UInt64[] aSeqUHyper,
562 ref float[] aSeqFloat,
563 ref double[] aSeqDouble,
564 ref TestEnum[] aSeqTestEnum,
565 ref string[] aSeqString,
566 ref object[] aSeqXInterface,
567 ref Any[] aSeqAny,
568 ref int[][] aSeqDim2,
569 ref int[][][] aSeqDim3)
571 _arBool = aSeqBoolean;
572 _arChar = aSeqChar;
573 _arByte = aSeqByte;
574 _arShort = aSeqShort;
575 _arUShort = aSeqUShort;
576 _arLong = aSeqLong;
577 _arULong = aSeqULong;
578 _arHyper = aSeqHyper;
579 _arUHyper = aSeqUHyper;
580 _arFloat = aSeqFloat;
581 _arDouble = aSeqDouble;
582 _arEnum = aSeqTestEnum;
583 _arString = aSeqString;
584 _arObject = aSeqXInterface;
585 _arAny = aSeqAny;
586 _arLong2 = aSeqDim2;
587 _arLong3 = aSeqDim3;
590 public void setSequencesOut(out bool[] aSeqBoolean,
591 out char[] aSeqChar,
592 out byte[] aSeqByte,
593 out short[] aSeqShort,
594 out UInt16[] aSeqUShort,
595 out int[] aSeqLong,
596 out UInt32[] aSeqULong,
597 out long[] aSeqHyper,
598 out UInt64[] aSeqUHyper,
599 out float[] aSeqFloat,
600 out double[] aSeqDouble,
601 out TestEnum[] aSeqTestEnum,
602 out string[] aSeqString,
603 out object[] aSeqXInterface,
604 out Any[] aSeqAny,
605 out int[][] aSeqDim2,
606 out int[][][] aSeqDim3)
608 aSeqBoolean = _arBool;
609 aSeqChar = _arChar;
610 aSeqByte = _arByte;
611 aSeqShort = _arShort;
612 aSeqUShort = _arUShort;
613 aSeqLong = _arLong;
614 aSeqULong = _arULong;
615 aSeqHyper = _arHyper;
616 aSeqUHyper = _arUHyper;
617 aSeqFloat = _arFloat;
618 aSeqDouble = _arDouble;
619 aSeqTestEnum = _arEnum;
620 aSeqString = _arString;
621 aSeqXInterface = _arObject;
622 aSeqAny = _arAny;
623 aSeqDim2 = _arLong2;
624 aSeqDim3 = _arLong3;
628 /* Attention: Debugging this code (probably in mixed mode) may lead to exceptions
629 * which do not occur when running normally (Visual Studio 2003)
631 public void testConstructorsService(XComponentContext context)
633 Constructors.create1(context,
634 true,
635 0x80, // -128 in C++,
636 Int16.MinValue,
637 UInt16.MaxValue,
638 Int32.MinValue,
639 UInt32.MaxValue,
640 Int64.MinValue,
641 UInt64.MaxValue,
642 0.123f,
643 0.456,
644 'X',
645 "test",
646 typeof(Any),
647 new Any(true),
648 new bool[] { true },
649 new byte[] { 0x80}, // in C++ the value is compared with SAL_MIN_INT8 which is -128
650 new short[] { Int16.MinValue },
651 new UInt16[] { UInt16.MaxValue },
652 new Int32[] {Int32.MinValue},
653 new UInt32[] { UInt32.MaxValue },
654 new long[] { Int64.MinValue },
655 new UInt64[] { UInt64.MaxValue },
656 new float[] { 0.123f },
657 new double[] { 0.456 },
658 new char[] { 'X' },
659 new string[] { "test" },
660 new Type[] { typeof(Any) },
661 new Any[] { new Any(true) },
662 new bool[][] { new bool[] { true } },
663 new Any[][] { new Any[] { new Any(true) } },
664 new TestEnum[] { TestEnum.TWO },
665 new TestStruct[] { new TestStruct(10) },
666 new TestPolyStruct[] { new TestPolyStruct(true) },
667 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) },
668 new object[] { null },
669 TestEnum.TWO,
670 new TestStruct(10),
671 new TestPolyStruct(true),
672 new TestPolyStruct(new Any(true)),
673 null
676 Constructors.create2(context,
677 new Any(true),
678 new Any((System.Byte) 0x80),
679 new Any(Int16.MinValue),
680 new Any(UInt16.MaxValue),
681 new Any(Int32.MinValue),
682 new Any(UInt32.MaxValue),
683 new Any(Int64.MinValue),
684 new Any(UInt64.MaxValue),
685 new Any(0.123f),
686 new Any(0.456),
687 new Any('X'),
688 new Any("test"),
689 new Any(typeof(Any)),
690 new Any(true),
691 new Any(typeof(bool[]), new bool[] { true }),
692 new Any(typeof(byte[]), new byte[] { (System.Byte) 0x80}),
693 new Any(typeof(short[]), new short[] { Int16.MinValue }),
694 new Any(typeof(UInt16[]), new UInt16[] { UInt16.MaxValue }),
695 new Any(typeof(int[]), new int[] { Int32.MinValue }),
696 new Any(typeof(UInt32[]), new UInt32[] { UInt32.MaxValue }),
697 new Any(typeof(long[]), new long[] { Int64.MinValue }),
698 new Any(typeof(UInt64[]), new UInt64[] { UInt64.MaxValue }),
699 new Any(typeof(float[]), new float[] { 0.123f }),
700 new Any(typeof(double[]), new double[] { 0.456 }),
701 new Any(typeof(char[]), new char[] { 'X' }),
702 new Any(typeof(string[]), new string[] { "test" }),
703 new Any(typeof(Type[]), new Type[] { typeof(Any) }),
704 new Any(typeof(Any[]), new Any[] { new Any(true) }),
705 new Any(typeof(bool[][]), new bool[][] { new bool[] { true } }),
706 new Any(
707 typeof(Any[][]), new Any[][] { new Any[] { new Any(true) } }),
708 new Any(typeof(TestEnum[]), new TestEnum[] { TestEnum.TWO }),
709 new Any(
710 typeof(TestStruct[]), new TestStruct[] { new TestStruct(10) }),
711 new Any(
712 PolymorphicType.GetType(
713 typeof(TestPolyStruct[]),
714 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>[]"),
715 new TestPolyStruct[] { new TestPolyStruct(true) }) ,
716 new Any(
717 PolymorphicType.GetType(
718 typeof(TestPolyStruct[]),
719 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>[]"),
720 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }),
721 new Any(typeof(object[])/*TODO*/, new object[] { null }),
722 new Any(typeof(TestEnum), TestEnum.TWO),
723 new Any(typeof(TestStruct), new TestStruct(10)),
724 new Any(
725 PolymorphicType.GetType(
726 typeof(TestPolyStruct),
727 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>"),
728 new TestPolyStruct(true)),
729 new Any(
730 PolymorphicType.GetType(
731 typeof(TestPolyStruct),
732 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>"),
733 new TestPolyStruct(new Any(true))),
734 new Any(typeof(object), null)
738 XMultiBase1 xMulti = Constructors2.create1(
739 context,
740 new TestPolyStruct(typeof(int)),
741 new TestPolyStruct(new Any(true)),
742 new TestPolyStruct(true),
743 new TestPolyStruct((Byte) 0x80),
744 new TestPolyStruct(Int16.MinValue),
745 new TestPolyStruct(Int32.MinValue),
746 new TestPolyStruct(Int64.MinValue),
747 new TestPolyStruct('X'),
748 new TestPolyStruct("test"),
749 new TestPolyStruct(0.123f),
750 new TestPolyStruct(0.456d),
751 new TestPolyStruct(new object()),
752 new TestPolyStruct(new uno.util.WeakComponentBase()),
753 new TestPolyStruct(TestEnum.TWO),
754 new TestPolyStruct(new TestPolyStruct2('X', new Any(true))),
755 new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test")),
756 new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true)))),
757 new TestPolyStruct2( new TestPolyStruct2('X', new Any(true)), new TestPolyStruct('X')),
758 new TestPolyStruct(new Type[] { typeof(int)}),
759 new TestPolyStruct(new Any[] { new Any(true) }),
760 new TestPolyStruct(new bool[] {true}),
761 new TestPolyStruct(new byte[] {0x80}),
762 new TestPolyStruct(new short[] {Int16.MinValue}),
763 new TestPolyStruct(new int[] {Int32.MinValue}),
764 new TestPolyStruct(new long[] {Int64.MinValue}),
765 new TestPolyStruct(new char[] {'X'}),
766 new TestPolyStruct(new string[] {"test"}),
767 new TestPolyStruct(new float[] {0.123f}),
768 new TestPolyStruct(new double[] {0.456d}),
769 new TestPolyStruct(new object[] {new object()}),
770 new TestPolyStruct(new unoidl.com.sun.star.lang.XComponent[] {new uno.util.WeakComponentBase()}),
771 new TestPolyStruct(new TestEnum[] {TestEnum.TWO}),
772 new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2('X', new Any[] {new Any(true)})}),
773 new TestPolyStruct(new TestPolyStruct2[] {
774 new TestPolyStruct2(new TestPolyStruct('X'), new Any[] {new Any(true)})}),
775 new TestPolyStruct(new int[][] { new int[] {Int32.MinValue} }),
776 new TestPolyStruct[]{ new TestPolyStruct(Int32.MinValue)},
777 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))},
778 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test"))},
779 new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true))))},
780 new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)),new TestPolyStruct('X'))},
781 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct('X')}},
782 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}},
783 new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)), "test"))}},
784 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X',new TestPolyStruct(new Any(true))))}},
785 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)),new TestPolyStruct('X'))}}
788 //test the returned interface
789 xMulti.fn11(1);
794 public XCurrentContextChecker getCurrentContextChecker()
796 return null; //TODO: not yet tested in CLI UNO
799 public TestPolyStruct transportPolyBoolean(/*[in]*/TestPolyStruct arg)
801 return arg;
804 public void transportPolyHyper(/*[in][out]*/ ref TestPolyStruct arg)
808 public void transportPolySequence(TestPolyStruct arg1,
809 out TestPolyStruct arg2)
811 arg2 = arg1;
814 public TestPolyStruct getNullPolyBadEnum()
816 return new TestPolyStruct(unoidl.test.testtools.bridgetest.TestBadEnum.M);
819 public TestPolyStruct getNullPolyLong()
821 return new TestPolyStruct();
824 public TestPolyStruct getNullPolyString()
826 return new TestPolyStruct();
829 public TestPolyStruct getNullPolyType()
831 return new TestPolyStruct();
834 public TestPolyStruct getNullPolyAny()
836 return new TestPolyStruct();
839 public TestPolyStruct getNullPolySequence()
841 return new TestPolyStruct();
844 public TestPolyStruct getNullPolyEnum()
846 return new TestPolyStruct();
849 public TestPolyStruct getNullPolyStruct()
851 return new TestPolyStruct();
854 public TestPolyStruct getNullPolyInterface()
856 return new TestPolyStruct();
859 public XMulti getMulti()
861 return new testtools.bridgetest.cli_cs.Multi();
864 private static void checkEqual(int value, int argument) {
865 if (argument != value) {
866 throw new CheckFailed(value + " != " + argument);
870 private static void checkEqual(double value, double argument) {
871 if (argument != value) {
872 throw new CheckFailed(value + " != " + argument);
876 private static void checkEqual(string value, string argument) {
877 if (argument != value) {
878 throw new CheckFailed(value + " != " + argument);
882 public string testMulti(XMulti multi)
884 try {
885 checkEqual(0.0, multi.att1);
886 multi.att1 = 0.1;
887 checkEqual(0.1, multi.att1);
888 checkEqual(11 * 1, multi.fn11(1));
889 checkEqual("12" + "abc", multi.fn12("abc"));
890 checkEqual(21 * 2, multi.fn21(2));
891 checkEqual("22" + "de", multi.fn22("de"));
892 checkEqual(0.0, multi.att3);
893 multi.att3 = 0.3;
894 checkEqual(0.3, multi.att3);
895 checkEqual(31 * 3, multi.fn31(3));
896 checkEqual("32" + "f", multi.fn32("f"));
897 checkEqual(33, multi.fn33());
898 checkEqual(41 * 4, multi.fn41(4));
899 checkEqual(61 * 6, multi.fn61(6));
900 checkEqual("62" + "", multi.fn62(""));
901 checkEqual(71 * 7, multi.fn71(7));
902 checkEqual("72" + "g", multi.fn72("g"));
903 checkEqual(73, multi.fn73());
904 } catch (CheckFailed f) {
905 return f.Message;
907 return "";
910 public int RaiseAttr1
912 get { throw new RuntimeException(); }
913 set { throw new IllegalArgumentException(); }
916 public int RaiseAttr2
918 get { throw new IllegalArgumentException(); }
919 set { throw new IllegalArgumentException(); }