Update ooo320-m1
[ooovba.git] / testtools / source / bridgetest / cli / cli_cs_testobj.cs
blob5cff3c9d53a94434c3926102e37367cf1bfc7212
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cli_cs_testobj.cs,v $
10 * $Revision: 1.13 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 using System;
32 using System.Diagnostics;
33 using System.Threading;
34 using System.Runtime.CompilerServices;
35 using uno;
36 using uno.util;
37 using unoidl.com.sun.star.uno;
38 using unoidl.com.sun.star.lang;
39 using unoidl.test.testtools.bridgetest;
41 namespace cs_testobj
44 class CheckFailed: System.Exception {
45 public CheckFailed(string message): base(message) {}
48 public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2
50 private XComponentContext m_xContext;
52 public BridgeTestObject( XComponentContext xContext )
54 m_xContext = xContext;
56 public BridgeTestObject()
60 private bool _bool;
61 private char _char;
62 private byte _byte;
63 private short _short;
64 private ushort _ushort;
65 private int _long;
66 private uint _ulong;
67 private long _hyper;
68 private ulong _uhyper;
69 private float _float;
70 private double _double;
71 private String _string;
72 private Object _xInterface;
73 private Any _any;
74 private TestEnum _testEnum = TestEnum.TEST;
75 private TestElement[] _testElements = new TestElement[0];
76 private TestDataElements _testDataElements = new TestDataElements();
77 private int _nLastCallId = 0;
78 private bool _bFirstCall = true;
79 private bool _bSequenceOfCallTestPassed = true;
81 private bool[] _arBool;
82 private char[] _arChar;
83 private byte[] _arByte;
84 private short[]_arShort;
85 private int[] _arLong;
86 private long[] _arHyper;
87 private UInt16[] _arUShort;
88 private UInt32[] _arULong;
89 private UInt64[] _arUHyper;
90 private string[] _arString;
91 private float[] _arFloat;
92 private double[] _arDouble;
93 private TestEnum[] _arEnum;
94 private Object[] _arObject;
95 private int[][] _arLong2;
96 private int[][][] _arLong3;
97 private Any[] _arAny;
99 // private int _raiseAttr1;
102 public void setValues(
103 bool bBool,
104 char cChar,
105 byte nByte,
106 short nShort,
107 ushort nUShort,
108 int nLong,
109 uint nULong,
110 long nHyper,
111 ulong nUHyper,
112 float fFloat,
113 double fDouble,
114 TestEnum testEnum,
115 String str,
116 Object xInterface,
117 Any any,
118 TestElement [] testElements,
119 TestDataElements testDataElements )
121 Debug.WriteLine( "##### " + GetType().FullName + ".setValues:" + any );
123 _bool = bBool;
124 _char = cChar;
125 _byte = nByte;
126 _short = nShort;
127 _ushort = nUShort;
128 _long = nLong;
129 _ulong = nULong;
130 _hyper = nHyper;
131 _uhyper = nUHyper;
132 _float = fFloat;
133 _double = fDouble;
134 _testEnum = testEnum;
135 _string = str;
136 _xInterface = xInterface;
137 _any = any;
138 _testElements = testElements;
139 _testDataElements = testDataElements;
142 public TestDataElements setValues2(
143 /*INOUT*/ref bool io_bool,
144 /*INOUT*/ref char io_char,
145 /*INOUT*/ref byte io_byte,
146 /*INOUT*/ref short io_short,
147 /*INOUT*/ref ushort io_ushort,
148 /*INOUT*/ref int io_long,
149 /*INOUT*/ref uint io_ulong,
150 /*INOUT*/ref long io_hyper,
151 /*INOUT*/ref ulong io_uhyper,
152 /*INOUT*/ref float io_float,
153 /*INOUT*/ref double io_double,
154 /*INOUT*/ref TestEnum io_testEnum,
155 /*INOUT*/ref String io_string,
156 /*INOUT*/ref Object io_xInterface,
157 /*INOUT*/ref Any io_any,
158 /*INOUT*/ref TestElement[] io_testElements,
159 /*INOUT*/ref TestDataElements io_testDataElements )
161 Debug.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any );
163 _bool = io_bool;
164 _char = io_char;
165 _byte = io_byte;
166 _short = io_short;
167 _ushort = io_ushort;
168 _long = io_long;
169 _ulong = io_ulong;
170 _hyper = io_hyper;
171 _uhyper = io_uhyper;
172 _float = io_float;
173 _double = io_double;
174 _testEnum = io_testEnum;
175 _string = io_string;
176 _xInterface = io_xInterface;
177 _any = io_any;
178 _testElements = (TestElement[]) io_testElements.Clone();
179 _testDataElements = io_testDataElements;
181 TestElement temp = io_testElements[ 0 ];
182 io_testElements[ 0 ] = io_testElements[ 1 ];
183 io_testElements[ 1 ] = temp;
185 return _testDataElements;
188 public TestDataElements getValues(
189 /*OUT*/out bool o_bool,
190 /*OUT*/out char o_char,
191 /*OUT*/out byte o_byte,
192 /*OUT*/out short o_short,
193 /*OUT*/out ushort o_ushort,
194 /*OUT*/out int o_long,
195 /*OUT*/out uint o_ulong,
196 /*OUT*/out long o_hyper,
197 /*OUT*/out ulong o_uhyper,
198 /*OUT*/out float o_float,
199 /*OUT*/out double o_double,
200 /*OUT*/out TestEnum o_testEnum,
201 /*OUT*/out String o_string,
202 /*OUT*/out Object o_xInterface,
203 /*OUT*/out Any o_any,
204 /*OUT*/out TestElement[] o_testElements,
205 /*OUT*/out TestDataElements o_testDataElements )
207 Debug.WriteLine( "##### " + GetType().FullName + ".getValues" );
209 o_bool = _bool;
210 o_char = _char;
211 o_byte = _byte;
212 o_short = _short;
213 o_ushort = _ushort;
214 o_long = _long;
215 o_ulong = _ulong;
216 o_hyper = _hyper;
217 o_uhyper = _uhyper;
218 o_float = _float;
219 o_double = _double;
220 o_testEnum = _testEnum;
221 o_string = _string;
222 o_xInterface = _xInterface;
223 o_any = _any;
224 o_testElements = _testElements;
225 o_testDataElements = _testDataElements;
227 return _testDataElements;
230 // Attributes
231 public bool Bool
233 get { return _bool; }
234 set { _bool = value; }
236 public byte Byte
238 get { return _byte; }
239 set { _byte = value; }
241 public char Char
243 get { return _char; }
244 set { _char = value; }
246 public short Short
248 get { return _short; }
249 set { _short = value; }
251 public ushort UShort
253 get { return _ushort; }
254 set { _ushort = value; }
256 public int Long
258 get { return _long; }
259 set { _long = value; }
261 public uint ULong
263 get { return _ulong; }
264 set { _ulong = value; }
266 public long Hyper
268 get { return _hyper; }
269 set { _hyper = value; }
271 public ulong UHyper
273 get { return _uhyper; }
274 set { _uhyper = value; }
276 public float Float
278 get { return _float; }
279 set { _float = value; }
281 public double Double
283 get { return _double; }
284 set { _double = value; }
286 public TestEnum Enum
288 get { return _testEnum; }
289 set { _testEnum = value; }
291 public String String
293 get { return _string; }
294 set { _string = value; }
296 public Object Interface
298 get { return _xInterface; }
299 set { _xInterface = value; }
301 public uno.Any Any
303 get {
305 Debug.WriteLine( "##### " + GetType().FullName + ".Any" );
306 return _any;
308 set {
309 Debug.WriteLine( "##### " + GetType().FullName + ".Any:" + value );
310 _any = value;
313 public TestElement [] Sequence
315 get { return _testElements; }
316 set { _testElements = value; }
318 public TestDataElements Struct
320 get { return _testDataElements; }
321 set { _testDataElements = value; }
323 public Any transportAny(Any value)
325 return value;
327 public void call(int nCallId , int nWaitMUSEC)
329 Thread.Sleep(nWaitMUSEC / 10000);
331 if(_bFirstCall)
332 _bFirstCall = false;
334 else
335 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);
337 _nLastCallId = nCallId;
339 public void callOneway( int nCallId , int nWaitMUSEC )
341 Thread.Sleep(nWaitMUSEC / 10000);
343 _bSequenceOfCallTestPassed = _bSequenceOfCallTestPassed && (nCallId > _nLastCallId);
344 _nLastCallId = nCallId;
346 public bool sequenceOfCallTestPassed()
348 return _bSequenceOfCallTestPassed;
350 [MethodImpl( MethodImplOptions.Synchronized )]
351 public void callRecursivly( XRecursiveCall xCall, int nToCall )
353 lock (this)
355 if(nToCall != 0)
357 nToCall --;
358 xCall.callRecursivly(this , nToCall);
362 [MethodImpl( MethodImplOptions.Synchronized )]
363 public void startRecursiveCall( XRecursiveCall xCall, int nToCall )
365 lock (this)
367 if(nToCall != 0)
369 nToCall --;
370 xCall.callRecursivly( this , nToCall );
375 // XBridgeTest
376 public TestDataElements raiseException(
377 short nArgumentPos, String rMsg, Object xContext )
379 throw new IllegalArgumentException(rMsg, xContext, nArgumentPos);
381 public void raiseRuntimeExceptionOneway( String rMsg, Object xContext )
383 throw new RuntimeException(rMsg, xContext);
386 private void dothrow( System.Exception e )
388 throw e;
390 public int RuntimeException
392 get {
395 dothrow( new RuntimeException(_string, _xInterface) );
396 return 0; // dummy
398 catch (System.Exception exc)
400 throw exc;
403 set { throw new RuntimeException(_string, _xInterface); }
406 // XBridgeTest2
407 public int[][] setDim2(int[][] val)
409 _arLong2 = val;
410 return val;
413 public int[][][] setDim3(int[][][] val)
415 _arLong3 = val;
416 return val;
419 public Any[] setSequenceAny(Any[] val)
421 _arAny = val;
422 return val;
425 public bool[] setSequenceBool(bool[] val)
427 _arBool = val;
428 return val;
431 public byte[] setSequenceByte(byte[] val)
433 _arByte = val;
434 return val;
437 public char[] setSequenceChar(char[] val)
439 _arChar = val;
440 return val;
443 public short[] setSequenceShort(short[] val)
445 _arShort = val;
446 return val;
449 public int[] setSequenceLong(int[] val)
451 _arLong = val;
452 return val;
455 public long[] setSequenceHyper(long[] val)
457 _arHyper = val;
458 return val;
461 public float[] setSequenceFloat(float[] val)
463 _arFloat = val;
464 return val;
467 public double[] setSequenceDouble(double[] val)
469 _arDouble = val;
470 return val;
473 public TestEnum[] setSequenceEnum(TestEnum[] val)
475 _arEnum = val;
476 return val;
479 public UInt16[] setSequenceUShort(UInt16[] val)
481 _arUShort = val;
482 return val;
485 public UInt32[] setSequenceULong(UInt32[] val)
487 _arULong = val;
488 return val;
491 public UInt64[] setSequenceUHyper(UInt64[] val)
493 _arUHyper = val;
494 return val;
497 public Object[] setSequenceXInterface(Object[] val)
499 _arObject = val;
500 return val;
503 public string[] setSequenceString(string[] val)
505 _arString = val;
506 return val;
509 public TestElement[] setSequenceStruct(TestElement[] val)
511 _testElements = val;
512 return val;
515 public void setSequencesInOut(ref bool[] aSeqBoolean,
516 ref char[] aSeqChar,
517 ref byte[] aSeqByte,
518 ref short[] aSeqShort,
519 ref UInt16[] aSeqUShort,
520 ref int[] aSeqLong,
521 ref UInt32[] aSeqULong,
522 ref long[] aSeqHyper,
523 ref UInt64[] aSeqUHyper,
524 ref float[] aSeqFloat,
525 ref double[] aSeqDouble,
526 ref TestEnum[] aSeqTestEnum,
527 ref string[] aSeqString,
528 ref object[] aSeqXInterface,
529 ref Any[] aSeqAny,
530 ref int[][] aSeqDim2,
531 ref int[][][] aSeqDim3)
533 _arBool = aSeqBoolean;
534 _arChar = aSeqChar;
535 _arByte = aSeqByte;
536 _arShort = aSeqShort;
537 _arUShort = aSeqUShort;
538 _arLong = aSeqLong;
539 _arULong = aSeqULong;
540 _arHyper = aSeqHyper;
541 _arUHyper = aSeqUHyper;
542 _arFloat = aSeqFloat;
543 _arDouble = aSeqDouble;
544 _arEnum = aSeqTestEnum;
545 _arString = aSeqString;
546 _arObject = aSeqXInterface;
547 _arAny = aSeqAny;
548 _arLong2 = aSeqDim2;
549 _arLong3 = aSeqDim3;
552 public void setSequencesOut(out bool[] aSeqBoolean,
553 out char[] aSeqChar,
554 out byte[] aSeqByte,
555 out short[] aSeqShort,
556 out UInt16[] aSeqUShort,
557 out int[] aSeqLong,
558 out UInt32[] aSeqULong,
559 out long[] aSeqHyper,
560 out UInt64[] aSeqUHyper,
561 out float[] aSeqFloat,
562 out double[] aSeqDouble,
563 out TestEnum[] aSeqTestEnum,
564 out string[] aSeqString,
565 out object[] aSeqXInterface,
566 out Any[] aSeqAny,
567 out int[][] aSeqDim2,
568 out int[][][] aSeqDim3)
570 aSeqBoolean = _arBool;
571 aSeqChar = _arChar;
572 aSeqByte = _arByte;
573 aSeqShort = _arShort;
574 aSeqUShort = _arUShort;
575 aSeqLong = _arLong;
576 aSeqULong = _arULong;
577 aSeqHyper = _arHyper;
578 aSeqUHyper = _arUHyper;
579 aSeqFloat = _arFloat;
580 aSeqDouble = _arDouble;
581 aSeqTestEnum = _arEnum;
582 aSeqString = _arString;
583 aSeqXInterface = _arObject;
584 aSeqAny = _arAny;
585 aSeqDim2 = _arLong2;
586 aSeqDim3 = _arLong3;
590 /* Attention: Debugging this code (probably in mixed mode) may lead to exceptions
591 * which do not occur when running normally (Visual Studio 2003)
593 public void testConstructorsService(XComponentContext context)
595 Constructors.create1(context,
596 true,
597 0x80, // -128 in C++,
598 Int16.MinValue,
599 UInt16.MaxValue,
600 Int32.MinValue,
601 UInt32.MaxValue,
602 Int64.MinValue,
603 UInt64.MaxValue,
604 0.123f,
605 0.456,
606 'X',
607 "test",
608 typeof(Any),
609 new Any(true),
610 new bool[] { true },
611 new byte[] { 0x80}, // in C++ the value is compared with SAL_MIN_INT8 which is -128
612 new short[] { Int16.MinValue },
613 new UInt16[] { UInt16.MaxValue },
614 new Int32[] {Int32.MinValue},
615 new UInt32[] { UInt32.MaxValue },
616 new long[] { Int64.MinValue },
617 new UInt64[] { UInt64.MaxValue },
618 new float[] { 0.123f },
619 new double[] { 0.456 },
620 new char[] { 'X' },
621 new string[] { "test" },
622 new Type[] { typeof(Any) },
623 new Any[] { new Any(true) },
624 new bool[][] { new bool[] { true } },
625 new Any[][] { new Any[] { new Any(true) } },
626 new TestEnum[] { TestEnum.TWO },
627 new TestStruct[] { new TestStruct(10) },
628 new TestPolyStruct[] { new TestPolyStruct(true) },
629 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) },
630 new object[] { null },
631 TestEnum.TWO,
632 new TestStruct(10),
633 new TestPolyStruct(true),
634 new TestPolyStruct(new Any(true)),
635 null
638 Constructors.create2(context,
639 new Any(true),
640 new Any((System.Byte) 0x80),
641 new Any(Int16.MinValue),
642 new Any(UInt16.MaxValue),
643 new Any(Int32.MinValue),
644 new Any(UInt32.MaxValue),
645 new Any(Int64.MinValue),
646 new Any(UInt64.MaxValue),
647 new Any(0.123f),
648 new Any(0.456),
649 new Any('X'),
650 new Any("test"),
651 new Any(typeof(Any)),
652 new Any(true),
653 new Any(typeof(bool[]), new bool[] { true }),
654 new Any(typeof(byte[]), new byte[] { (System.Byte) 0x80}),
655 new Any(typeof(short[]), new short[] { Int16.MinValue }),
656 new Any(typeof(UInt16[]), new UInt16[] { UInt16.MaxValue }),
657 new Any(typeof(int[]), new int[] { Int32.MinValue }),
658 new Any(typeof(UInt32[]), new UInt32[] { UInt32.MaxValue }),
659 new Any(typeof(long[]), new long[] { Int64.MinValue }),
660 new Any(typeof(UInt64[]), new UInt64[] { UInt64.MaxValue }),
661 new Any(typeof(float[]), new float[] { 0.123f }),
662 new Any(typeof(double[]), new double[] { 0.456 }),
663 new Any(typeof(char[]), new char[] { 'X' }),
664 new Any(typeof(string[]), new string[] { "test" }),
665 new Any(typeof(Type[]), new Type[] { typeof(Any) }),
666 new Any(typeof(Any[]), new Any[] { new Any(true) }),
667 new Any(typeof(bool[][]), new bool[][] { new bool[] { true } }),
668 new Any(
669 typeof(Any[][]), new Any[][] { new Any[] { new Any(true) } }),
670 new Any(typeof(TestEnum[]), new TestEnum[] { TestEnum.TWO }),
671 new Any(
672 typeof(TestStruct[]), new TestStruct[] { new TestStruct(10) }),
673 new Any(
674 PolymorphicType.GetType(
675 typeof(TestPolyStruct[]),
676 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>[]"),
677 new TestPolyStruct[] { new TestPolyStruct(true) }) ,
678 new Any(
679 PolymorphicType.GetType(
680 typeof(TestPolyStruct[]),
681 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>[]"),
682 new TestPolyStruct[] { new TestPolyStruct(new Any(true)) }),
683 new Any(typeof(object[])/*TODO*/, new object[] { null }),
684 new Any(typeof(TestEnum), TestEnum.TWO),
685 new Any(typeof(TestStruct), new TestStruct(10)),
686 new Any(
687 PolymorphicType.GetType(
688 typeof(TestPolyStruct),
689 "unoidl.test.testtools.bridgetest.TestPolyStruct<System.Boolean>"),
690 new TestPolyStruct(true)),
691 new Any(
692 PolymorphicType.GetType(
693 typeof(TestPolyStruct),
694 "unoidl.test.testtools.bridgetest.TestPolyStruct<uno.Any>"),
695 new TestPolyStruct(new Any(true))),
696 new Any(typeof(object), null)
700 XMultiBase1 xMulti = Constructors2.create1(
701 context,
702 new TestPolyStruct(typeof(int)),
703 new TestPolyStruct(new Any(true)),
704 new TestPolyStruct(true),
705 new TestPolyStruct((Byte) 0x80),
706 new TestPolyStruct(Int16.MinValue),
707 new TestPolyStruct(Int32.MinValue),
708 new TestPolyStruct(Int64.MinValue),
709 new TestPolyStruct('X'),
710 new TestPolyStruct("test"),
711 new TestPolyStruct(0.123f),
712 new TestPolyStruct(0.456d),
713 new TestPolyStruct(new object()),
714 new TestPolyStruct(new uno.util.WeakComponentBase()),
715 new TestPolyStruct(TestEnum.TWO),
716 new TestPolyStruct(new TestPolyStruct2('X', new Any(true))),
717 new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test")),
718 new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true)))),
719 new TestPolyStruct2( new TestPolyStruct2('X', new Any(true)), new TestPolyStruct('X')),
720 new TestPolyStruct(new Type[] { typeof(int)}),
721 new TestPolyStruct(new Any[] { new Any(true) }),
722 new TestPolyStruct(new bool[] {true}),
723 new TestPolyStruct(new byte[] {0x80}),
724 new TestPolyStruct(new short[] {Int16.MinValue}),
725 new TestPolyStruct(new int[] {Int32.MinValue}),
726 new TestPolyStruct(new long[] {Int64.MinValue}),
727 new TestPolyStruct(new char[] {'X'}),
728 new TestPolyStruct(new string[] {"test"}),
729 new TestPolyStruct(new float[] {0.123f}),
730 new TestPolyStruct(new double[] {0.456d}),
731 new TestPolyStruct(new object[] {new object()}),
732 new TestPolyStruct(new unoidl.com.sun.star.lang.XComponent[] {new uno.util.WeakComponentBase()}),
733 new TestPolyStruct(new TestEnum[] {TestEnum.TWO}),
734 new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2('X', new Any[] {new Any(true)})}),
735 new TestPolyStruct(new TestPolyStruct2[] {
736 new TestPolyStruct2(new TestPolyStruct('X'), new Any[] {new Any(true)})}),
737 new TestPolyStruct(new int[][] { new int[] {Int32.MinValue} }),
738 new TestPolyStruct[]{ new TestPolyStruct(Int32.MinValue)},
739 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))},
740 new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)), "test"))},
741 new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X', new TestPolyStruct(new Any(true))))},
742 new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X', new Any(true)),new TestPolyStruct('X'))},
743 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct('X')}},
744 new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2('X', new Any(true)))}},
745 new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)), "test"))}},
746 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2('X',new TestPolyStruct(new Any(true))))}},
747 new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2('X',new Any(true)),new TestPolyStruct('X'))}}
750 //test the returned interface
751 xMulti.fn11(1);
756 public XCurrentContextChecker getCurrentContextChecker()
758 return null; //TODO: not yet tested in CLI UNO
761 public TestPolyStruct transportPolyBoolean(/*[in]*/TestPolyStruct arg)
763 return arg;
766 public void transportPolyHyper(/*[in][out]*/ ref TestPolyStruct arg)
770 public void transportPolySequence(TestPolyStruct arg1,
771 out TestPolyStruct arg2)
773 arg2 = arg1;
776 public TestPolyStruct getNullPolyBadEnum()
778 return new TestPolyStruct(unoidl.test.testtools.bridgetest.TestBadEnum.M);
781 public TestPolyStruct getNullPolyLong()
783 return new TestPolyStruct();
786 public TestPolyStruct getNullPolyString()
788 return new TestPolyStruct();
791 public TestPolyStruct getNullPolyType()
793 return new TestPolyStruct();
796 public TestPolyStruct getNullPolyAny()
798 return new TestPolyStruct();
801 public TestPolyStruct getNullPolySequence()
803 return new TestPolyStruct();
806 public TestPolyStruct getNullPolyEnum()
808 return new TestPolyStruct();
811 public TestPolyStruct getNullPolyStruct()
813 return new TestPolyStruct();
816 public TestPolyStruct getNullPolyInterface()
818 return new TestPolyStruct();
821 public XMulti getMulti()
823 return new testtools.bridgetest.cli_cs.Multi();
826 private static void checkEqual(int value, int argument) {
827 if (argument != value) {
828 throw new CheckFailed(value + " != " + argument);
832 private static void checkEqual(double value, double argument) {
833 if (argument != value) {
834 throw new CheckFailed(value + " != " + argument);
838 private static void checkEqual(string value, string argument) {
839 if (argument != value) {
840 throw new CheckFailed(value + " != " + argument);
844 public string testMulti(XMulti multi)
846 try {
847 checkEqual(0.0, multi.att1);
848 multi.att1 = 0.1;
849 checkEqual(0.1, multi.att1);
850 checkEqual(11 * 1, multi.fn11(1));
851 checkEqual("12" + "abc", multi.fn12("abc"));
852 checkEqual(21 * 2, multi.fn21(2));
853 checkEqual("22" + "de", multi.fn22("de"));
854 checkEqual(0.0, multi.att3);
855 multi.att3 = 0.3;
856 checkEqual(0.3, multi.att3);
857 checkEqual(31 * 3, multi.fn31(3));
858 checkEqual("32" + "f", multi.fn32("f"));
859 checkEqual(33, multi.fn33());
860 checkEqual(41 * 4, multi.fn41(4));
861 checkEqual(61 * 6, multi.fn61(6));
862 checkEqual("62" + "", multi.fn62(""));
863 checkEqual(71 * 7, multi.fn71(7));
864 checkEqual("72" + "g", multi.fn72("g"));
865 checkEqual(73, multi.fn73());
866 } catch (CheckFailed f) {
867 return f.Message;
869 return "";
872 public int RaiseAttr1
874 get { throw new RuntimeException(); }
875 set { throw new IllegalArgumentException(); }
878 public int RaiseAttr2
880 get { throw new IllegalArgumentException(); }
881 set { throw new IllegalArgumentException(); }