1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: climaker.cs,v $
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 ************************************************************************/
32 using System
.Reflection
;
33 using System
.Diagnostics
;
37 using unoidl
.test
.cliure
.climaker
;
38 //using unoidl.com.sun.star.uno;
39 using ucss
=unoidl
.com
.sun
.star
;
41 /** This class is for testing the generated code in the uno services
44 public class Context
: ucss
.uno
.XComponentContext
46 public enum test_kind
{
53 public Context(test_kind k
, params object[] args
)
56 factory
= new Factory(k
, args
);
59 public ucss
.lang
.XMultiComponentFactory
getServiceManager()
61 if (kind
== test_kind
.NO_FACTORY
)
66 public Any
getValueByName(string Name
)
68 if (kind
== test_kind
.NORMAL
)
70 if (Name
== "/singletons/unoidl.test.cliure.climaker.S4")
72 Component c
= new Component(this);
73 return new Any(typeof(object), c
);
76 else if (kind
== test_kind
.CREATION_FAILED
)
83 class Factory
: ucss
.lang
.XMultiComponentFactory
85 public Factory(Context
.test_kind k
, params object[] args
) {
87 if (k
== Context
.test_kind
.TEST_EXCEPTION
)
88 exception
= (ucss
.uno
.Exception
) args
[0];
90 public object createInstanceWithArgumentsAndContext(
91 string ServiceSpecifier
,
93 unoidl
.com
.sun
.star
.uno
.XComponentContext Context
) {
95 case test_kind
.NORMAL
:
96 return new Component(Context
, Arguments
);
97 case test_kind
.CREATION_FAILED
:
99 case test_kind
.TEST_EXCEPTION
:
102 throw new Exception("Factory not properly initialized");
105 public object createInstanceWithContext(
106 string aServiceSpecifier
,
107 unoidl
.com
.sun
.star
.uno
.XComponentContext Context
) {
109 case test_kind
.NORMAL
:
110 return new Component(Context
);
111 case test_kind
.CREATION_FAILED
:
113 case test_kind
.TEST_EXCEPTION
:
116 throw new Exception("Factory not properly initialized");
120 public string[] getAvailableServiceNames()
122 return new string[]{};
124 ucss
.uno
.Exception exception
;
141 public String Function
153 public void assure(bool b
) {
156 Console
.WriteLine(m_sFunction
+ " failed!");
161 public void printStatus() {
162 Console
.WriteLine("\n=====================================");
167 msg
= "Test failed! " + m_nErrors
.ToString() + " Errors.";
169 msg
= "Test succeeded!";
171 Console
.WriteLine(msg
+ "\n=====================================");
183 public sealed class Test
185 public static int Main(String
[] args
)
188 // System.Diagnostics.Debugger.Launch();
191 Logger log
= new Logger();
195 t
.testPolyStruct(log
);
196 t
.testEmptyStruct2(log
);
197 t
.testFullStruct2(log
);
199 t
.testSingletons(log
);
200 t
.testAttributes(log
);
201 t
.testPolyStructAttributes(log
);
202 t
.testPolymorphicType(log
);
203 t
.testInterface(log
);
212 Console
.Write(e
.Message
);
219 public void testEnum1(Logger l
) {
220 l
.Function
= "testEnum1";
221 l
.assure(((int)Enum1
.VALUE1
) == -100);
222 l
.assure(((int)Enum1
.VALUE2
) == 100);
225 public void testEnum2(Logger l
) {
226 l
.Function
= "testEnum2";
227 l
.assure( ((int) Enum2
.VALUE0
) == 0);
228 l
.assure( ((int) Enum2
.VALUE1
) == 1);
229 l
.assure( ((int) Enum2
.VALUE2
) == 2);
230 l
.assure( ((int) Enum2
.VALUE4
) == 4);
233 public void testPolyStruct(Logger l
) {
234 l
.Function
= "testPolyStruct";
235 PolyStruct s
= new PolyStruct();
236 l
.assure(s
.member1
== null);
237 l
.assure(s
.member2
== 0);
238 s
= new PolyStruct("ABC", 5);
239 l
.assure(s
.member1
.Equals("ABC"));
240 l
.assure(s
.member2
== 5);
243 public void testEmptyStruct2(Logger l
) {
244 l
.Function
= "testEmptyStruct2";
245 Struct2 s
= new Struct2();
246 l
.assure(s
.p1
== false);
252 l
.assure(s
.p7
== 0L);
253 l
.assure(s
.p8
== 0L);
254 l
.assure(s
.p9
== 0.0f
);
255 l
.assure(s
.p10
== 0.0);
256 l
.assure(s
.p11
== '\u0000');
257 l
.assure(s
.p12
.Equals(""));
258 l
.assure(s
.p13
.Equals(typeof(void)));
259 l
.assure(s
.p14
.Equals(Any
.VOID
));
260 l
.assure(s
.p15
== Enum2
.VALUE0
);
261 l
.assure(s
.p16
.member1
== 0);
262 l
.assure(s
.p17
== null);
263 l
.assure(s
.p18
== null);
264 l
.assure(s
.t1
== false);
270 l
.assure(s
.t7
== 0L);
271 l
.assure(s
.t8
== 0L);
272 l
.assure(s
.t9
== 0.0f
);
273 l
.assure(s
.t10
== 0.0);
274 l
.assure(s
.t11
== '\u0000');
275 l
.assure(s
.t12
.Equals(""));
276 l
.assure(s
.t13
.Equals(typeof(void)));
277 l
.assure(s
.t14
.Equals(Any
.VOID
));
278 l
.assure(s
.t15
== Enum2
.VALUE0
);
279 l
.assure(s
.t16
.member1
== 0);
280 l
.assure(s
.t17
== null);
281 l
.assure(s
.t18
== null);
282 l
.assure(s
.a1
.Length
== 0);
283 l
.assure(s
.a2
.Length
== 0);
284 l
.assure(s
.a3
.Length
== 0);
285 l
.assure(s
.a4
.Length
== 0);
286 l
.assure(s
.a5
.Length
== 0);
287 l
.assure(s
.a6
.Length
== 0);
288 l
.assure(s
.a7
.Length
== 0);
289 l
.assure(s
.a8
.Length
== 0);
290 l
.assure(s
.a9
.Length
== 0);
291 l
.assure(s
.a10
.Length
== 0);
292 l
.assure(s
.a11
.Length
== 0);
293 l
.assure(s
.a12
.Length
== 0);
294 l
.assure(s
.a13
.Length
== 0);
295 l
.assure(s
.a14
.Length
== 0);
296 l
.assure(s
.a15
.Length
== 0);
297 l
.assure(s
.a16
.Length
== 0);
298 l
.assure(s
.a17
.Length
== 0);
299 l
.assure(s
.a18
.Length
== 0);
300 l
.assure(s
.aa1
.Length
== 0);
301 l
.assure(s
.aa2
.Length
== 0);
302 l
.assure(s
.aa3
.Length
== 0);
303 l
.assure(s
.aa4
.Length
== 0);
304 l
.assure(s
.aa5
.Length
== 0);
305 l
.assure(s
.aa6
.Length
== 0);
306 l
.assure(s
.aa7
.Length
== 0);
307 l
.assure(s
.aa8
.Length
== 0);
308 l
.assure(s
.aa9
.Length
== 0);
309 l
.assure(s
.aa10
.Length
== 0);
310 l
.assure(s
.aa11
.Length
== 0);
311 l
.assure(s
.aa12
.Length
== 0);
312 l
.assure(s
.aa13
.Length
== 0);
313 l
.assure(s
.aa14
.Length
== 0);
314 l
.assure(s
.aa15
.Length
== 0);
315 l
.assure(s
.aa16
.Length
== 0);
316 l
.assure(s
.aa17
.Length
== 0);
317 l
.assure(s
.aa18
.Length
== 0);
318 l
.assure(s
.at1
.Length
== 0);
319 l
.assure(s
.at2
.Length
== 0);
320 l
.assure(s
.at3
.Length
== 0);
321 l
.assure(s
.at4
.Length
== 0);
322 l
.assure(s
.at5
.Length
== 0);
323 l
.assure(s
.at6
.Length
== 0);
324 l
.assure(s
.at7
.Length
== 0);
325 l
.assure(s
.at8
.Length
== 0);
326 l
.assure(s
.at9
.Length
== 0);
327 l
.assure(s
.at10
.Length
== 0);
328 l
.assure(s
.at11
.Length
== 0);
329 l
.assure(s
.at12
.Length
== 0);
330 l
.assure(s
.at13
.Length
== 0);
331 l
.assure(s
.at14
.Length
== 0);
332 l
.assure(s
.at15
.Length
== 0);
333 l
.assure(s
.at16
.Length
== 0);
334 l
.assure(s
.at17
.Length
== 0);
335 l
.assure(s
.at18
.Length
== 0);
338 public void testFullStruct2(Logger l
) {
340 Struct2 s
= new Struct2(
341 true, (byte) 1, (short) 2, (ushort) 3, 4, 5, 6L, 7L, 0.8f
, 0.9d
, 'A',
342 "BCD", typeof(ulong), new Any(22), Enum2
.VALUE4
,
343 new Struct1(1), null, null, false, (byte) 0, (short) 0, (ushort) 0,
344 0, 0, 0L, 0L, 0.0f
, 0.0, '\u0000', "", typeof(void), Any
.VOID
,
345 Enum2
.VALUE0
, new Struct1(), null, null,
346 new bool[] { false, true }
, new byte[] { (byte) 1, (byte) 2 }
,
347 new short[0], new ushort[0], new int[0], new uint[0],
348 new long[0], new ulong[0], new float[0], new double[0], new char[0],
349 new String
[0], new Type
[0], new Any
[0], new Enum2
[0],
350 new Struct1
[] { new Struct1(1), new Struct1(2) }
, new Object
[0],
351 new ucss
.uno
.XNamingService
[0], new bool[0][], new byte[0][],
352 new short[0][], new ushort[0][], new int[0][], new uint[0][],
353 new long[0][], new ulong[0][], new float[0][], new double[0][],
354 new char[0][], new String
[0][], new Type
[0][], new Any
[0][],
355 new Enum2
[0][], new Struct1
[0][], new Object
[0][],
356 new ucss
.uno
.XNamingService
[0][], new bool[0][], new byte[0][],
357 new short[0][], new ushort[0][], new int[0][], new uint[0][],
358 new long[0][], new ulong[0][], new float[0][], new double[0][],
359 new char[0][], new String
[0][], new Type
[0][], new Any
[0][],
360 new Enum2
[0][], new Struct1
[0][], new Object
[0][],
361 new ucss
.uno
.XNamingService
[0][]);
362 l
.assure(s
.p1
== true);
368 l
.assure(s
.p7
== 6L);
369 l
.assure(s
.p8
== 7L);
370 l
.assure(s
.p9
== 0.8f
);
371 l
.assure(s
.p10
== 0.9);
372 l
.assure(s
.p11
== 'A');
373 l
.assure(s
.p12
.Equals("BCD"));
374 l
.assure(s
.p13
.Equals(typeof(ulong)));
375 l
.assure(s
.p14
.Equals(new Any(22)));
376 l
.assure(s
.p15
== Enum2
.VALUE4
);
377 l
.assure(s
.p16
.member1
== 1);
378 l
.assure(s
.p17
== null);
379 l
.assure(s
.p18
== null);
380 l
.assure(s
.t1
== false);
386 l
.assure(s
.t7
== 0L);
387 l
.assure(s
.t8
== 0L);
388 l
.assure(s
.t9
== 0.0f
);
389 l
.assure(s
.t10
== 0.0);
390 l
.assure(s
.t11
== '\u0000');
391 l
.assure(s
.t12
.Equals(""));
392 l
.assure(s
.t13
.Equals(typeof(void)));
393 l
.assure(s
.t14
.Equals(Any
.VOID
));
394 l
.assure(s
.t15
== Enum2
.VALUE0
);
395 l
.assure(s
.t16
.member1
== 0);
396 l
.assure(s
.t17
== null);
397 l
.assure(s
.t18
== null);
398 l
.assure(s
.a1
.Length
== 2);
399 l
.assure(s
.a1
[0] == false);
400 l
.assure(s
.a1
[1] == true);
401 l
.assure(s
.a2
.Length
== 2);
402 l
.assure(s
.a2
[0] == 1);
403 l
.assure(s
.a2
[1] == 2);
404 l
.assure(s
.a3
.Length
== 0);
405 l
.assure(s
.a4
.Length
== 0);
406 l
.assure(s
.a5
.Length
== 0);
407 l
.assure(s
.a6
.Length
== 0);
408 l
.assure(s
.a7
.Length
== 0);
409 l
.assure(s
.a8
.Length
== 0);
410 l
.assure(s
.a9
.Length
== 0);
411 l
.assure(s
.a10
.Length
== 0);
412 l
.assure(s
.a11
.Length
== 0);
413 l
.assure(s
.a12
.Length
== 0);
414 l
.assure(s
.a13
.Length
== 0);
415 l
.assure(s
.a14
.Length
== 0);
416 l
.assure(s
.a15
.Length
== 0);
417 l
.assure(s
.a16
.Length
== 2);
418 l
.assure(s
.a16
[0].member1
== 1);
419 l
.assure(s
.a16
[1].member1
== 2);
420 l
.assure(s
.a17
.Length
== 0);
421 l
.assure(s
.a18
.Length
== 0);
422 l
.assure(s
.aa1
.Length
== 0);
423 l
.assure(s
.aa2
.Length
== 0);
424 l
.assure(s
.aa3
.Length
== 0);
425 l
.assure(s
.aa4
.Length
== 0);
426 l
.assure(s
.aa5
.Length
== 0);
427 l
.assure(s
.aa6
.Length
== 0);
428 l
.assure(s
.aa7
.Length
== 0);
429 l
.assure(s
.aa8
.Length
== 0);
430 l
.assure(s
.aa9
.Length
== 0);
431 l
.assure(s
.aa10
.Length
== 0);
432 l
.assure(s
.aa11
.Length
== 0);
433 l
.assure(s
.aa12
.Length
== 0);
434 l
.assure(s
.aa13
.Length
== 0);
435 l
.assure(s
.aa14
.Length
== 0);
436 l
.assure(s
.aa15
.Length
== 0);
437 l
.assure(s
.aa16
.Length
== 0);
438 l
.assure(s
.aa17
.Length
== 0);
439 l
.assure(s
.aa18
.Length
== 0);
440 l
.assure(s
.at1
.Length
== 0);
441 l
.assure(s
.at2
.Length
== 0);
442 l
.assure(s
.at3
.Length
== 0);
443 l
.assure(s
.at4
.Length
== 0);
444 l
.assure(s
.at5
.Length
== 0);
445 l
.assure(s
.at6
.Length
== 0);
446 l
.assure(s
.at7
.Length
== 0);
447 l
.assure(s
.at8
.Length
== 0);
448 l
.assure(s
.at9
.Length
== 0);
449 l
.assure(s
.at10
.Length
== 0);
450 l
.assure(s
.at11
.Length
== 0);
451 l
.assure(s
.at12
.Length
== 0);
452 l
.assure(s
.at13
.Length
== 0);
453 l
.assure(s
.at14
.Length
== 0);
454 l
.assure(s
.at15
.Length
== 0);
455 l
.assure(s
.at16
.Length
== 0);
456 l
.assure(s
.at17
.Length
== 0);
457 l
.assure(s
.at18
.Length
== 0);
460 public void testS1(Logger l
) {
461 l
.Function
= "testS1";
462 object obj
= new Object();
463 ucss
.uno
.RuntimeException excRuntime
=
464 new ucss
.uno
.RuntimeException("RuntimeException", obj
);
465 ucss
.uno
.Exception excException
=
466 new ucss
.uno
.Exception("Exception", obj
);
467 ucss
.lang
.IllegalAccessException excIllegalAccess
=
468 new ucss
.lang
.IllegalAccessException("IllegalAccessException", obj
);
469 ucss
.uno
.DeploymentException excDeployment
=
470 new ucss
.uno
.DeploymentException("DeploymentException", obj
);
471 ucss
.lang
.InvalidListenerException excInvalidListener
=
472 new ucss
.lang
.InvalidListenerException("ListenerException", obj
);
474 /* create1 does not specify exceptions. Therefore RuntimeExceptions
475 fly through and other exceptions cause a DeploymentException.
478 S1
.create1(new Context(Context
.test_kind
.TEST_EXCEPTION
, excRuntime
));
479 } catch (ucss
.uno
.RuntimeException e
) {
480 l
.assure(e
.Message
== excRuntime
.Message
481 && e
.Context
== obj
);
482 } catch (System
.Exception
) {
486 Context c
= new Context(Context
.test_kind
.TEST_EXCEPTION
, excException
);
489 } catch (ucss
.uno
.DeploymentException e
) {
490 //The message of the original exception should be contained
491 // in the Deploymentexception
492 l
.assure(e
.Message
.IndexOf(excException
.Message
) != -1 && e
.Context
== c
);
493 } catch (System
.Exception
) {
497 /* create2 specifies many exceptions, including RuntimeException and Exception.
498 Because Exception is specified all exceptions are allowed, hence all thrown
499 exceptions fly through.
502 S1
.create2(new Context(Context
.test_kind
.TEST_EXCEPTION
, excRuntime
));
503 } catch (ucss
.uno
.RuntimeException e
) {
504 l
.assure(e
.Message
== excRuntime
.Message
505 && e
.Context
== obj
);
506 } catch (System
.Exception
) {
511 S1
.create2(new Context(Context
.test_kind
.TEST_EXCEPTION
, excIllegalAccess
));
512 } catch (ucss
.lang
.IllegalAccessException e
) {
513 l
.assure(e
.Message
== excIllegalAccess
.Message
514 && e
.Context
== obj
);
515 } catch (System
.Exception
) {
520 S1
.create2(new Context(Context
.test_kind
.TEST_EXCEPTION
, excException
));
521 } catch (ucss
.uno
.Exception e
) {
522 l
.assure(e
.Message
== excException
.Message
523 && e
.Context
== obj
);
524 } catch (System
.Exception
) {
528 /* create3 specifies exceptions but no com.sun.star.uno.Exception. RuntimeException
529 and derived fly through. Other specified exceptions are rethrown and all other
530 exceptions cause a DeploymentException.
533 S1
.create3(new Context(Context
.test_kind
.TEST_EXCEPTION
, excDeployment
),
535 } catch (ucss
.uno
.DeploymentException e
) {
536 l
.assure(e
.Message
== excDeployment
.Message
537 && e
.Context
== obj
);
538 } catch (System
.Exception
) {
543 S1
.create3(new Context(Context
.test_kind
.TEST_EXCEPTION
, excIllegalAccess
),
545 } catch (ucss
.lang
.IllegalAccessException e
) {
546 l
.assure(e
.Message
== excIllegalAccess
.Message
547 && e
.Context
== obj
);
548 } catch (System
.Exception
) {
552 c
= new Context(Context
.test_kind
.TEST_EXCEPTION
, excInvalidListener
);
554 S1
.create3(c
, new Any
[0]);
555 } catch (ucss
.uno
.DeploymentException e
) {
556 l
.assure(e
.Message
.IndexOf(excInvalidListener
.Message
) != -1
558 } catch (System
.Exception
) {
562 /* test the case when the context cannot provide a service manager.
565 S1
.create2(new Context(Context
.test_kind
.NO_FACTORY
));
566 } catch (ucss
.uno
.DeploymentException e
) {
567 l
.assure(e
.Message
.Length
> 0);
568 } catch (System
.Exception
) {
572 /* When the service manager returns a null pointer then a DeploymentException
576 S1
.create2(new Context(Context
.test_kind
.CREATION_FAILED
));
577 } catch (ucss
.uno
.DeploymentException e
) {
578 l
.assure(e
.Message
.Length
> 0);
579 } catch (System
.Exception
) {
584 /** Test creation of components and if the passing of parameters works.
586 c
= new Context(Context
.test_kind
.NORMAL
);
588 XTest xTest
= S1
.create1(c
);
589 Component cobj
= (Component
) xTest
;
590 l
.assure(cobj
.Args
[0].Value
== c
);
592 Any a1
= new Any("bla");
593 Any a2
= new Any(3.14f
);
594 Any a3
= new Any(3.145d
);
595 xTest
= S1
.create2(c
, a1
, a2
, a3
);
596 cobj
= (Component
) xTest
;
597 l
.assure(cobj
.Args
[0].Value
== c
598 && a1
.Equals(cobj
.Args
[1])
599 && a2
.Equals(cobj
.Args
[2])
600 && a3
.Equals(cobj
.Args
[3]));
614 Type b13
= typeof(ulong);
615 Any b14
= new Any(22);
616 Enum2 b15
= Enum2
.VALUE4
;
617 Struct1 b16
= new Struct1(1);
618 PolyStruct b17
= new PolyStruct('A', 1);
619 PolyStruct b18
= new PolyStruct(new Any(true), 1);
620 object b19
= new uno
.util
.WeakComponentBase();
621 ucss
.lang
.XComponent b20
= (ucss
.lang
.XComponent
) b19
;
639 ucss
.lang
.XComponent b38
= b20
;
640 bool[] b39
= new bool[] { false, true }
;
641 byte[] b40
= new byte[] { (byte) 1, (byte) 2 }
;
642 short[] b41
= new short[] { (short) 123, (short) 456}
;
643 ushort[] b42
= new ushort[] { (ushort) 789, (ushort) 101}
;
644 int[] b43
= new int[] {1, 2, 3}
;
645 uint[] b44
= new uint[] {4, 5, 6}
;
646 long[] b45
= new long[] {7,8,9}
;
647 ulong[] b46
= new ulong[] {123, 4356}
;
648 float[] b47
= new float[] {2435f,87f}
;
649 double[] b48
= new double[] {234d,45.2134d}
;
650 char[] b49
= new char[] {'\u1234', 'A'}
;
651 string[] b50
= new string[] {"a","bc"}
;
652 Type
[] b51
= new Type
[] {typeof(int), typeof(long)}
;
653 Any
[] b52
= new Any
[] {new Any(1), new Any("adf")}
;
654 Enum2
[] b53
= new Enum2
[] {Enum2.VALUE2}
;
655 Struct1
[] b54
= new Struct1
[] {new Struct1(11), new Struct1(22)}
;
656 object[] b55
= new object[0];
657 ucss
.lang
.XComponent
[] b56
= new ucss
.lang
.XComponent
[]{
658 new uno
.util
.WeakComponentBase(), new uno
.util
.WeakComponentBase()};
659 bool[][] b57
= new bool[][] {new bool[]{true,false}
, new bool[] {true}}
;
660 byte[][] b58
= new byte[][]{new byte[] {(byte) 1}
, new byte[]{(byte) 2}}
;
661 short[][] b59
= new short[][] {new short[]{(short)6, (short)7}
, new short[] {(short)9}}
;
662 ushort[][] b60
= new ushort[][] { new ushort[]{(ushort) 11}}
;
663 int[][] b61
= new int[][] {new int[]{1}
, new int[]{2,3}
, new int[]{4,5,6}}
;
664 uint[][] b62
= new uint[][] {new uint[]{10U}
, new uint[]{20U,30U}
, new uint[]{40U,50U,60}}
;
665 long[][] b63
= new long[][] {new long[]{10L}
, new long[]{20L,30}
, new long[]{40,50,60}}
;
666 ulong[][] b64
= new ulong[][] { new ulong[]{10L}
, new ulong[]{20L, 30L}
, new ulong[]{40,50,60}}
;
667 float[][] b65
= new float[][] {new float[]{10f}
, new float[]{20f,30f}
, new float[]{40f,50f,60f}}
;
668 double[][] b66
= new double[][]{new double[]{10d}
, new double[]{20d,30d}}
;
669 char[][] b67
= new char[][] {new char[]{'a'}
, new char[]{'b', 'c'}}
;
670 string[][] b68
= new String
[][] {new string[]{"a"}
, new string[]{"ad", "lkj"}}
;
671 Type
[][] b69
= new Type
[][] {new Type[]{typeof(byte), typeof(long)}
, new Type
[]{typeof(Any)}}
;
672 Any
[][] b70
= new Any
[][] {new Any[]{new Any(1f), new Any(2d)}
, new Any
[]{new Any(34U)}}
;
673 Enum2
[][] b71
= new Enum2
[][] {new Enum2[]{Enum2.VALUE2}}
;
674 Struct1
[][] b72
= new Struct1
[][] {new Struct1[]{new Struct1(2), new Struct1(3)}}
;
675 object[][] b73
= new Object
[0][];
676 ucss
.lang
.XComponent
[][] b74
= new uno
.util
.WeakComponentBase
[0][];
680 ushort[][] b78
= b60
;
686 double[][] b84
= b66
;
688 String
[][] b86
= b68
;
692 Struct1
[][] b90
= b72
;
693 Object
[][] b91
= b73
;
694 ucss
.lang
.XComponent
[][] b92
= b74
;
698 b1
, b2
, b3
, b4
, b5
, b6
, b7
,b8
, b9
, b10
,
701 b15
, b16
, b17
, b18
, b19
, b20
,
702 b21
, b22
, b23
, b24
, b25
, b26
, b27
, b28
, b29
, b30
,
705 b35
, b36
, b37
, b38
, b39
, b40
,
706 b41
, b42
, b43
, b44
, b45
, b46
, b47
, b48
, b49
, b50
,
707 b51
, b52
, b53
, b54
, b55
, b56
, b57
, b58
, b59
, b60
,
708 b61
, b62
, b63
, b64
, b65
, b66
, b67
, b68
, b69
, b70
,
709 b71
, b72
, b73
, b74
, b75
, b76
, b77
, b78
, b79
, b80
,
710 b81
, b82
, b83
, b84
, b85
, b86
, b87
, b88
, b89
, b90
,
714 cobj
= (Component
) xTest
;
715 l
.assure(cobj
.Args
[0].Value
== c
);
716 l
.assure(b1
.Equals(cobj
.Args
[1].Value
));
717 l
.assure(b2
.Equals(cobj
.Args
[2].Value
));
718 l
.assure(b3
.Equals(cobj
.Args
[3].Value
));
719 l
.assure(b4
.Equals(cobj
.Args
[4].Value
));
720 l
.assure(b5
.Equals(cobj
.Args
[5].Value
));
721 l
.assure(b6
.Equals(cobj
.Args
[6].Value
));
722 l
.assure(b7
.Equals(cobj
.Args
[7].Value
));
723 l
.assure(b8
.Equals(cobj
.Args
[8].Value
));
724 l
.assure(b9
.Equals(cobj
.Args
[9].Value
));
725 l
.assure(b10
.Equals(cobj
.Args
[10].Value
));
726 l
.assure(b11
.Equals(cobj
.Args
[11].Value
));
727 l
.assure(b12
.Equals(cobj
.Args
[12].Value
));
728 l
.assure(b13
.Equals(cobj
.Args
[13].Value
));
729 //Anys are not wrapped by the generated code
730 l
.assure(b14
.Equals(cobj
.Args
[14]));
731 l
.assure(b15
.Equals(cobj
.Args
[15].Value
));
732 l
.assure(b16
.Equals(cobj
.Args
[16].Value
));
733 l
.assure(b17
.Equals(cobj
.Args
[17].Value
));
734 l
.assure(b18
.Equals(cobj
.Args
[18].Value
));
735 l
.assure(b19
.Equals(cobj
.Args
[19].Value
));
736 l
.assure(b20
.Equals(cobj
.Args
[20].Value
));
737 l
.assure(b21
.Equals(cobj
.Args
[21].Value
));
738 l
.assure(b22
.Equals(cobj
.Args
[22].Value
));
739 l
.assure(b23
.Equals(cobj
.Args
[23].Value
));
740 l
.assure(b24
.Equals(cobj
.Args
[24].Value
));
741 l
.assure(b25
.Equals(cobj
.Args
[25].Value
));
742 l
.assure(b26
.Equals(cobj
.Args
[26].Value
));
743 l
.assure(b27
.Equals(cobj
.Args
[27].Value
));
744 l
.assure(b28
.Equals(cobj
.Args
[28].Value
));
745 l
.assure(b29
.Equals(cobj
.Args
[29].Value
));
746 l
.assure(b30
.Equals(cobj
.Args
[30].Value
));
747 l
.assure(b31
.Equals(cobj
.Args
[31].Value
));
748 l
.assure(b32
.Equals(cobj
.Args
[32].Value
));
749 l
.assure(b33
.Equals(cobj
.Args
[33].Value
));
750 //Anys are not wrapped by the generated code
751 l
.assure(b34
.Equals(cobj
.Args
[34]));
752 l
.assure(b35
.Equals(cobj
.Args
[35].Value
));
753 l
.assure(b36
.Equals(cobj
.Args
[36].Value
));
754 l
.assure(b37
.Equals(cobj
.Args
[37].Value
));
755 l
.assure(b38
.Equals(cobj
.Args
[38].Value
));
756 l
.assure(b39
.Equals(cobj
.Args
[39].Value
));
757 l
.assure(b40
.Equals(cobj
.Args
[40].Value
));
758 l
.assure(b41
.Equals(cobj
.Args
[41].Value
));
759 l
.assure(b42
.Equals(cobj
.Args
[42].Value
));
760 l
.assure(b43
.Equals(cobj
.Args
[43].Value
));
761 l
.assure(b44
.Equals(cobj
.Args
[44].Value
));
762 l
.assure(b45
.Equals(cobj
.Args
[45].Value
));
763 l
.assure(b46
.Equals(cobj
.Args
[46].Value
));
764 l
.assure(b47
.Equals(cobj
.Args
[47].Value
));
765 l
.assure(b48
.Equals(cobj
.Args
[48].Value
));
766 l
.assure(b49
.Equals(cobj
.Args
[49].Value
));
767 l
.assure(b50
.Equals(cobj
.Args
[50].Value
));
768 l
.assure(b51
.Equals(cobj
.Args
[51].Value
));
769 l
.assure(b52
.Equals(cobj
.Args
[52].Value
));
770 l
.assure(b53
.Equals(cobj
.Args
[53].Value
));
771 l
.assure(b54
.Equals(cobj
.Args
[54].Value
));
772 l
.assure(b55
.Equals(cobj
.Args
[55].Value
));
773 l
.assure(b56
.Equals(cobj
.Args
[56].Value
));
774 l
.assure(b57
.Equals(cobj
.Args
[57].Value
));
775 l
.assure(b58
.Equals(cobj
.Args
[58].Value
));
776 l
.assure(b59
.Equals(cobj
.Args
[59].Value
));
777 l
.assure(b60
.Equals(cobj
.Args
[60].Value
));
778 l
.assure(b61
.Equals(cobj
.Args
[61].Value
));
779 l
.assure(b62
.Equals(cobj
.Args
[62].Value
));
780 l
.assure(b63
.Equals(cobj
.Args
[63].Value
));
781 l
.assure(b64
.Equals(cobj
.Args
[64].Value
));
782 l
.assure(b65
.Equals(cobj
.Args
[65].Value
));
783 l
.assure(b66
.Equals(cobj
.Args
[66].Value
));
784 l
.assure(b67
.Equals(cobj
.Args
[67].Value
));
785 l
.assure(b68
.Equals(cobj
.Args
[68].Value
));
786 l
.assure(b69
.Equals(cobj
.Args
[69].Value
));
787 l
.assure(b70
.Equals(cobj
.Args
[70].Value
));
788 l
.assure(b71
.Equals(cobj
.Args
[71].Value
));
789 l
.assure(b72
.Equals(cobj
.Args
[72].Value
));
790 l
.assure(b73
.Equals(cobj
.Args
[73].Value
));
791 l
.assure(b74
.Equals(cobj
.Args
[74].Value
));
792 l
.assure(b75
.Equals(cobj
.Args
[75].Value
));
793 l
.assure(b76
.Equals(cobj
.Args
[76].Value
));
794 l
.assure(b77
.Equals(cobj
.Args
[77].Value
));
795 l
.assure(b78
.Equals(cobj
.Args
[78].Value
));
796 l
.assure(b79
.Equals(cobj
.Args
[79].Value
));
797 l
.assure(b80
.Equals(cobj
.Args
[80].Value
));
798 l
.assure(b81
.Equals(cobj
.Args
[81].Value
));
799 l
.assure(b82
.Equals(cobj
.Args
[82].Value
));
800 l
.assure(b83
.Equals(cobj
.Args
[83].Value
));
801 l
.assure(b84
.Equals(cobj
.Args
[84].Value
));
802 l
.assure(b85
.Equals(cobj
.Args
[85].Value
));
803 l
.assure(b86
.Equals(cobj
.Args
[86].Value
));
804 l
.assure(b87
.Equals(cobj
.Args
[87].Value
));
805 l
.assure(b88
.Equals(cobj
.Args
[88].Value
));
806 l
.assure(b89
.Equals(cobj
.Args
[89].Value
));
807 l
.assure(b90
.Equals(cobj
.Args
[90].Value
));
808 l
.assure(b91
.Equals(cobj
.Args
[91].Value
));
809 l
.assure(b92
.Equals(cobj
.Args
[92].Value
));
811 } catch (Exception
) {
816 c
= new Context(Context
.test_kind
.NORMAL
);
819 PolyStruct2 arg1
= new PolyStruct2(typeof(PolyStruct2
), 1);
820 PolyStruct2 arg2
= new PolyStruct2(new Any(true), 1);
821 PolyStruct2 arg3
= new PolyStruct2(true, 1);
822 PolyStruct2 arg4
= new PolyStruct2((Byte
)8, 1);
823 PolyStruct2 arg5
= new PolyStruct2('c', 1);
824 PolyStruct2 arg6
= new PolyStruct2((Int16
)10, 1);
825 PolyStruct2 arg7
= new PolyStruct2(11, 1);
826 PolyStruct2 arg8
= new PolyStruct2(12L, 1);
827 PolyStruct2 arg9
= new PolyStruct2("Hello", 1);
828 PolyStruct2 arg10
= new PolyStruct2(1.3, 1);
829 PolyStruct2 arg11
= new PolyStruct2(1.3d
, 1);
830 PolyStruct2 arg12
= new PolyStruct2(new Object(), 1);
831 PolyStruct2 arg13
= new PolyStruct2(new uno
.util
.WeakComponentBase(), 1);
832 PolyStruct2 arg14
= new PolyStruct2(
833 new PolyStruct('A', 1), 1);
834 PolyStruct2 arg15
= new PolyStruct2(
835 new PolyStruct(new PolyStruct('A',1),1),1);
836 PolyStruct arg16
= new PolyStruct("Hallo", 1);
837 PolyStruct arg17
= new PolyStruct(
838 new PolyStruct('A',1),1);
840 Type
[] arType
= {typeof(PolyStruct), typeof(PolyStruct2)}
;
841 PolyStruct2 arg101
= new PolyStruct2(arType
,1);
842 PolyStruct2 arg102
= new PolyStruct2(
843 new Any
[] {new Any(true)}
,1);
844 PolyStruct2 arg103
= new PolyStruct2(new bool[]{true}
, 1);
845 PolyStruct2 arg104
= new PolyStruct2(new byte[] { (byte) 1}
, 1);
846 PolyStruct2 arg105
= new PolyStruct2(new char[] {'\u1234', 'A'}
, 1);
847 PolyStruct2 arg106
= new PolyStruct2(new short[] {(short)1}
, 1);
848 PolyStruct2 arg107
= new PolyStruct2(new int[] {1}
, 1);
849 PolyStruct2 arg108
= new PolyStruct2(new long[] {1}
, 1);
850 PolyStruct2 arg109
= new PolyStruct2(new string[]{"Hallo"}
, 1);
851 PolyStruct2 arg110
= new PolyStruct2(new float[]{1.3f}
, 1);
852 PolyStruct2 arg111
= new PolyStruct2(new double[] {1.3d}
, 1);
853 PolyStruct2 arg112
= new PolyStruct2(
854 new Object
[] { new Object()}
, 1);
855 PolyStruct2 arg113
= new PolyStruct2(
856 new uno
.util
.WeakComponentBase
[] {
857 new uno
.util
.WeakComponentBase()}, 1);
858 PolyStruct2 arg114
= new PolyStruct2(
860 new PolyStruct('A',1)} ,1);
861 PolyStruct2 arg115
= new PolyStruct2(
863 new PolyStruct( new PolyStruct2('A',1),1)}
865 PolyStruct2 arg201
= new PolyStruct2(new char[][] { new char[]{'A'}
,
866 new char[]{'B'}}
, 1);
868 PolyStruct2
[] arg301
= new PolyStruct2
[] {new PolyStruct2('A', 1)}
;
869 PolyStruct2
[] arg302
= new PolyStruct2
[] {new PolyStruct2(
870 new PolyStruct('A', 1), 1)};
871 PolyStruct2
[] arg303
= new PolyStruct2
[] {new PolyStruct2(
872 new PolyStruct(new PolyStruct('A',1),1),1)};
873 PolyStruct
[] arg304
= new PolyStruct
[] {new PolyStruct("Hallo", 1)}
;
874 PolyStruct
[] arg305
= new PolyStruct
[] {new PolyStruct(
875 new PolyStruct('A',1),1)};
877 PolyStruct2
[][] arg401
= new PolyStruct2
[][] {new PolyStruct2[] {new PolyStruct2('A', 1)}}
;
878 PolyStruct2
[][] arg402
= new PolyStruct2
[][] {new PolyStruct2
[] {new PolyStruct2(
879 new PolyStruct('A', 1), 1)}};
880 PolyStruct2
[][] arg403
= new PolyStruct2
[][] {new PolyStruct2
[] {new PolyStruct2(
881 new PolyStruct(new PolyStruct('A',1),1),1)}};
882 PolyStruct
[][] arg404
= new PolyStruct
[][] {new PolyStruct[] {new PolyStruct("Hallo", 1)}}
;
883 PolyStruct
[][] arg405
= new PolyStruct
[][] {new PolyStruct
[] {new PolyStruct(
884 new PolyStruct('A',1),1)}};
887 XTest xTest
= S1
.create6(c
,
888 arg1
,arg2
,arg3
,arg4
,arg5
,arg6
,arg7
,arg8
,arg9
,arg10
,
889 arg11
,arg12
,arg13
,arg14
,arg15
,arg16
,arg17
,
890 arg101
,arg102
,arg103
,arg104
,arg105
,arg106
,arg107
,arg108
,arg109
,arg110
,
891 arg111
,arg112
,arg113
,arg114
,arg115
,
893 arg301
, arg302
, arg303
, arg304
, arg305
,
894 arg401
, arg402
, arg403
, arg404
, arg405
);
895 Component cobj
= (Component
) xTest
;
896 l
.assure(cobj
.Args
[0].Value
== c
);
898 string sType
= ((PolymorphicType
) cobj
.Args
[1].Type
).PolymorphicName
;
899 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Type>");
900 sType
= ((PolymorphicType
) cobj
.Args
[2].Type
).PolymorphicName
;
901 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<uno.Any>");
902 sType
= ((PolymorphicType
) cobj
.Args
[3].Type
).PolymorphicName
;
903 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean>");
904 sType
= ((PolymorphicType
) cobj
.Args
[4].Type
).PolymorphicName
;
905 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Byte>");
906 sType
= ((PolymorphicType
) cobj
.Args
[5].Type
).PolymorphicName
;
907 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Char>");
908 sType
= ((PolymorphicType
) cobj
.Args
[6].Type
).PolymorphicName
;
909 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int16>");
910 sType
= ((PolymorphicType
) cobj
.Args
[7].Type
).PolymorphicName
;
911 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int32>");
912 sType
= ((PolymorphicType
) cobj
.Args
[8].Type
).PolymorphicName
;
913 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int64>");
914 sType
= ((PolymorphicType
) cobj
.Args
[9].Type
).PolymorphicName
;
915 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.String>");
916 sType
= ((PolymorphicType
) cobj
.Args
[10].Type
).PolymorphicName
;
917 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Single>");
918 sType
= ((PolymorphicType
) cobj
.Args
[11].Type
).PolymorphicName
;
919 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Double>");
920 sType
= ((PolymorphicType
) cobj
.Args
[12].Type
).PolymorphicName
;
921 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Object>");
922 sType
= ((PolymorphicType
) cobj
.Args
[13].Type
).PolymorphicName
;
923 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent>");
924 sType
= ((PolymorphicType
) cobj
.Args
[14].Type
).PolymorphicName
;
925 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>");
926 sType
= ((PolymorphicType
) cobj
.Args
[15].Type
).PolymorphicName
;
927 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
928 "unoidl.test.cliure.climaker.PolyStruct<" +
929 "unoidl.test.cliure.climaker.PolyStruct<" +
930 "System.Char,uno.Any>,System.String>>");
931 sType
= ((PolymorphicType
) cobj
.Args
[16].Type
).PolymorphicName
;
932 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
933 "System.String,unoidl.test.cliure.climaker.PolyStruct<" +
934 "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
936 sType
= ((PolymorphicType
) cobj
.Args
[17].Type
).PolymorphicName
;
937 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
938 "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
939 "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>");
941 sType
= ((PolymorphicType
) cobj
.Args
[18].Type
).PolymorphicName
;
942 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Type[]>");
943 sType
= ((PolymorphicType
) cobj
.Args
[19].Type
).PolymorphicName
;
944 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<uno.Any[]>");
945 sType
= ((PolymorphicType
) cobj
.Args
[20].Type
).PolymorphicName
;
946 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean[]>");
947 sType
= ((PolymorphicType
) cobj
.Args
[21].Type
).PolymorphicName
;
948 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Byte[]>");
949 sType
= ((PolymorphicType
) cobj
.Args
[22].Type
).PolymorphicName
;
950 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Char[]>");
951 sType
= ((PolymorphicType
) cobj
.Args
[23].Type
).PolymorphicName
;
952 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int16[]>");
953 sType
= ((PolymorphicType
) cobj
.Args
[24].Type
).PolymorphicName
;
954 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int32[]>");
955 sType
= ((PolymorphicType
) cobj
.Args
[25].Type
).PolymorphicName
;
956 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Int64[]>");
957 sType
= ((PolymorphicType
) cobj
.Args
[26].Type
).PolymorphicName
;
958 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.String[]>");
959 sType
= ((PolymorphicType
) cobj
.Args
[27].Type
).PolymorphicName
;
960 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Single[]>");
961 sType
= ((PolymorphicType
) cobj
.Args
[28].Type
).PolymorphicName
;
962 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Double[]>");
963 sType
= ((PolymorphicType
) cobj
.Args
[29].Type
).PolymorphicName
;
964 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Object[]>");
965 sType
= ((PolymorphicType
) cobj
.Args
[30].Type
).PolymorphicName
;
966 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent[]>");
967 sType
= ((PolymorphicType
) cobj
.Args
[31].Type
).PolymorphicName
;
968 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
969 "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any[]>[]>");
970 sType
= ((PolymorphicType
) cobj
.Args
[32].Type
).PolymorphicName
;
971 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
972 "unoidl.test.cliure.climaker.PolyStruct<" +
973 "unoidl.test.cliure.climaker.PolyStruct2<" +
974 "System.Char>,uno.Any[]>[]>");
976 sType
= ((PolymorphicType
) cobj
.Args
[33].Type
).PolymorphicName
;
977 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
980 sType
= ((PolymorphicType
) cobj
.Args
[34].Type
).PolymorphicName
;
981 l
.assure (sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[]");
982 sType
= ((PolymorphicType
) cobj
.Args
[35].Type
).PolymorphicName
;
983 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[]");
984 sType
= ((PolymorphicType
) cobj
.Args
[36].Type
).PolymorphicName
;
985 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
986 "unoidl.test.cliure.climaker.PolyStruct<" +
987 "unoidl.test.cliure.climaker.PolyStruct<" +
988 "System.Char,uno.Any>,System.String>>[]");
989 sType
= ((PolymorphicType
) cobj
.Args
[37].Type
).PolymorphicName
;
990 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
991 "System.String,unoidl.test.cliure.climaker.PolyStruct<" +
992 "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
994 sType
= ((PolymorphicType
) cobj
.Args
[38].Type
).PolymorphicName
;
995 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
996 "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
997 "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[]");
999 sType
= ((PolymorphicType
) cobj
.Args
[39].Type
).PolymorphicName
;
1000 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[][]");
1001 sType
= ((PolymorphicType
) cobj
.Args
[40].Type
).PolymorphicName
;
1002 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
1003 "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[][]");
1004 sType
= ((PolymorphicType
) cobj
.Args
[41].Type
).PolymorphicName
;
1005 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct2<" +
1006 "unoidl.test.cliure.climaker.PolyStruct<" +
1007 "unoidl.test.cliure.climaker.PolyStruct<" +
1008 "System.Char,uno.Any>,System.String>>[][]");
1009 sType
= ((PolymorphicType
) cobj
.Args
[42].Type
).PolymorphicName
;
1010 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
1011 "System.String,unoidl.test.cliure.climaker.PolyStruct<" +
1012 "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
1014 sType
= ((PolymorphicType
) cobj
.Args
[43].Type
).PolymorphicName
;
1015 l
.assure( sType
== "unoidl.test.cliure.climaker.PolyStruct<" +
1016 "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
1017 "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[][]");
1029 void testSingletons(Logger l
)
1031 l
.Function
= "testSingletons";
1032 Context c
= new Context(Context
.test_kind
.NORMAL
);
1034 XTest obj
= S4
.get(c
);
1035 l
.assure(obj
!= null);
1036 } catch (Exception
) {
1040 /** Case context fails to provide sigleton, a DeploymentException should be thrown.
1042 c
= new Context(Context
.test_kind
.CREATION_FAILED
);
1044 XTest obj
= S4
.get(c
);
1045 l
.assure(obj
!= null);
1046 } catch (ucss
.uno
.DeploymentException e
) {
1047 Type t
= typeof(unoidl
.test
.cliure
.climaker
.S4
);
1048 l
.assure( e
.Message
.IndexOf(t
.FullName
) != -1);
1049 } catch (System
.Exception
) {
1054 void testAttributes(Logger l
)
1056 l
.Function
= "testAttributes";
1058 Type typeXTest
= typeof(unoidl
.test
.cliure
.climaker
.XTest
);
1059 object[] arAttr
= typeXTest
.GetMethod("testOneway").GetCustomAttributes(false);
1060 if (arAttr
.Length
== 1)
1061 l
.assure(typeof(uno
.OnewayAttribute
).Equals(arAttr
[0].GetType()));
1066 arAttr
= typeXTest
.GetMethod("testExceptions").GetCustomAttributes(false);
1067 if (arAttr
.Length
== 1 && arAttr
[0].GetType() == typeof(uno
.ExceptionAttribute
))
1069 uno
.ExceptionAttribute attr
= arAttr
[0] as uno
.ExceptionAttribute
;
1070 if (attr
!= null && attr
.Raises
.Length
== 2)
1072 l
.assure(attr
.Raises
[0] == typeof(unoidl
.com
.sun
.star
.uno
.Exception
));
1073 l
.assure(attr
.Raises
[1] == typeof(unoidl
.com
.sun
.star
.lang
.ClassNotFoundException
));
1081 //function test must not have the oneway attribute and Exception attribute
1082 arAttr
= typeXTest
.GetMethod("test").GetCustomAttributes(false);
1083 l
.assure(arAttr
.Length
== 0);
1085 //test exceptions on service constructor methods
1086 Type typeS1
= typeof(unoidl
.test
.cliure
.climaker
.S1
);
1087 arAttr
= typeS1
.GetMethod("create3").GetCustomAttributes(false);
1088 if (arAttr
.Length
== 1 && arAttr
[0].GetType() == typeof(uno
.ExceptionAttribute
))
1090 uno
.ExceptionAttribute attr
= arAttr
[0] as uno
.ExceptionAttribute
;
1091 if (attr
!= null && attr
.Raises
.Length
== 4)
1093 l
.assure(attr
.Raises
[0] == typeof(unoidl
.com
.sun
.star
.uno
.RuntimeException
));
1094 l
.assure(attr
.Raises
[1] == typeof(unoidl
.com
.sun
.star
.lang
.ClassNotFoundException
));
1095 l
.assure(attr
.Raises
[2] == typeof(unoidl
.com
.sun
.star
.lang
.IllegalAccessException
));
1096 l
.assure(attr
.Raises
[3] == typeof(unoidl
.com
.sun
.star
.uno
.DeploymentException
));
1104 //create1 does not have exceptions
1105 arAttr
= typeS1
.GetMethod("create1").GetCustomAttributes(false);
1106 l
.assure(arAttr
.Length
== 0);
1108 //test exceptions of UNO interface attributes
1109 arAttr
= typeXTest
.GetProperty("A3").GetGetMethod().GetCustomAttributes(false);
1110 if (arAttr
.Length
== 1)
1112 uno
.ExceptionAttribute attr
= arAttr
[0] as uno
.ExceptionAttribute
;
1113 if (attr
!= null && attr
.Raises
.Length
== 2)
1115 l
.assure(attr
.Raises
[0] == typeof(unoidl
.com
.sun
.star
.uno
.Exception
));
1116 l
.assure(attr
.Raises
[1] == typeof(unoidl
.com
.sun
.star
.lang
.ClassNotFoundException
));
1124 arAttr
= typeXTest
.GetProperty("A3").GetSetMethod().GetCustomAttributes(false);
1125 if (arAttr
.Length
== 1)
1127 uno
.ExceptionAttribute attr
= arAttr
[0] as uno
.ExceptionAttribute
;
1128 if (attr
!= null && attr
.Raises
.Length
== 1)
1129 l
.assure(attr
.Raises
[0] == typeof(unoidl
.com
.sun
.star
.uno
.RuntimeException
));
1136 //attribute A1 must have the ExceptionAttribute
1137 l
.assure(typeXTest
.GetProperty("A1").GetGetMethod().GetCustomAttributes(false).Length
== 0);
1138 l
.assure(typeXTest
.GetProperty("A1").GetSetMethod().GetCustomAttributes(false).Length
== 0);
1140 //Test BoundAttribute
1141 BoundAttribute bound
= (BoundAttribute
) Attribute
.GetCustomAttribute(
1142 typeXTest
.GetProperty("A1"), typeof(BoundAttribute
));
1143 l
.assure(bound
!= null);
1145 bound
= (BoundAttribute
) Attribute
.GetCustomAttribute(
1146 typeXTest
.GetProperty("A3"), typeof(BoundAttribute
));
1147 l
.assure(bound
== null);
1150 void testPolyStructAttributes(Logger l
)
1152 l
.Function
= "testPolyStructAttributes";
1153 //Test polymorphic struct
1154 Type typeStruct
= typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
);
1155 object[] arAttr
= typeStruct
.GetCustomAttributes(false);
1156 if (arAttr
.Length
== 1)
1159 uno
.TypeParametersAttribute attr
= (uno
.TypeParametersAttribute
) arAttr
[0];
1160 string[] arNames
= new string[]{"if", "else"}
;
1161 l
.assure(attr
!= null && attr
.Parameters
.ToString().Equals(arNames
.ToString()));
1162 }catch(Exception
) {
1168 l
.assure(typeof(unoidl
.test
.cliure
.climaker
.Struct1
).GetCustomAttributes(false).Length
== 0);
1169 //member of a polymorphic struct with a parameterized type have also an attribute
1170 arAttr
= typeStruct
.GetField("member1").GetCustomAttributes(false);
1171 if (arAttr
.Length
== 1)
1173 uno
.ParameterizedTypeAttribute attr
= arAttr
[0] as uno
.ParameterizedTypeAttribute
;
1174 l
.assure(attr
!= null && attr
.Type
== "if");
1180 //test instantiated polymorphic struct: return value
1181 // Type typeXTest = typeof(XTest);
1182 // arAttr = typeXTest.GetMethod("testPolyStruct").ReturnTypeCustomAttributes.GetCustomAttributes(false);
1183 // if (arAttr.Length == 1)
1185 // uno.TypeArgumentsAttribute attr = arAttr[0] as uno.TypeArgumentsAttribute;
1186 // l.assure(attr != null && attr.Arguments.Length == 2
1187 // &&attr.Arguments[0] == typeof(char)
1188 // && attr.Arguments[1] == typeof(int));
1192 // arAttr = typeXTest.GetMethod("testPolyStruct").GetCustomAttributes(false);
1195 // private XComponentContext context;
1197 void testPolymorphicType(Logger l
)
1199 l
.Function
= "testPolymorphicType";
1200 string name
= "unoidl.test.cliure.climaker.PolyStruct<System.Int32,System.Int32>";
1202 uno
.PolymorphicType t1
= PolymorphicType
.GetType(
1203 typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
), name
);
1205 uno
.PolymorphicType t2
= PolymorphicType
.GetType(
1206 typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
), name
);
1209 l
.assure(t1
.PolymorphicName
== name
);
1210 l
.assure(t1
.OriginalType
== typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
));
1214 void testInterface(Logger l
)
1216 l
.Function
= "testInterface";
1218 Context c
= new Context(Context
.test_kind
.NORMAL
);
1219 XTest obj
= S1
.create1(c
);
1222 short aShort
= 0x7fff;
1223 ushort aUShort
= 0xffff;
1224 int aInt
= 0x7fffffff;
1225 uint aUInt
= 0xffffffff;
1226 long aLong
= 0x7fffffffffffffff;
1227 ulong aULong
= 0xffffffffffffffff;
1228 float aFloat
= 0.314f
;
1229 double aDouble
= 0.314d
;
1231 string aString
= "Hello World";
1232 Type aType
= typeof(XTest
);
1233 Any aAny
= new Any(typeof(XTest
), obj
);
1234 Enum2 aEnum2
= Enum2
.VALUE2
;
1235 Struct1 aStruct1
= new Struct1();
1236 object aXInterface
= new object();
1237 ucss
.lang
.XComponent aXComponent
= (ucss
.lang
.XComponent
) obj
;
1238 bool[] aSeqBool
= {true, false, true}
;
1240 obj
.inParameters(aBool
, aByte
, aShort
, aUShort
,
1241 aInt
, aUInt
, aLong
, aULong
,
1242 aFloat
, aDouble
, aChar
, aString
,
1243 aType
, aAny
,aEnum2
, aStruct1
,
1244 aXInterface
, aXComponent
, aSeqBool
);
1262 object outXInterface
;
1263 ucss
.lang
.XComponent outXComponent
;
1266 obj
.outParameters(out outBool
, out outByte
, out outShort
, out outUShort
,
1267 out outInt
, out outUInt
, out outLong
, out outULong
,
1268 out outFloat
, out outDouble
, out outChar
, out outString
,
1269 out outType
, out outAny
, out outEnum2
, out outStruct1
,
1270 out outXInterface
, out outXComponent
, out outSeqBool
);
1272 l
.assure(aBool
== outBool
);
1273 l
.assure(aByte
== outByte
);
1274 l
.assure(aShort
== outShort
);
1275 l
.assure(aUShort
== outUShort
);
1276 l
.assure(aInt
== outInt
);
1277 l
.assure(aUInt
== outUInt
);
1278 l
.assure(aLong
== outLong
);
1279 l
.assure(aULong
== outULong
);
1280 l
.assure(aFloat
== outFloat
);
1281 l
.assure(aDouble
== outDouble
);
1282 l
.assure(aChar
== outChar
);
1283 l
.assure(aString
== outString
);
1284 l
.assure(aType
== outType
);
1285 l
.assure(aAny
.Equals(outAny
));
1286 l
.assure(aEnum2
== outEnum2
);
1287 l
.assure(aStruct1
== outStruct1
);
1288 l
.assure(aXInterface
== outXInterface
);
1289 l
.assure(aXComponent
== outXComponent
);
1290 l
.assure(aSeqBool
== outSeqBool
);
1292 bool inoutBool
= false;;
1293 byte inoutByte
= 10;
1294 short inoutShort
= 11;
1295 ushort inoutUShort
= 12;
1297 uint inoutUInt
= 14;
1298 long inoutLong
= 15;
1299 ulong inoutULong
= 16;
1300 float inoutFloat
= 4.134f
;
1301 double inoutDouble
= 5.135;
1302 char inoutChar
= 'B';
1303 string inoutString
= "Hello Hamburg";
1304 Type inoutType
= typeof(int);
1305 Any inoutAny
= new Any(inoutInt
);
1306 Enum2 inoutEnum2
= Enum2
.VALUE4
;
1307 Struct1 inoutStruct1
= new Struct1();
1308 object inoutXInterface
= new object();
1309 ucss
.lang
.XComponent inoutXComponent
= (ucss
.lang
.XComponent
) S1
.create1(c
);
1310 bool[] inoutSeqBool
= {false, true, false}
;
1313 obj
.inoutParameters(ref inoutBool
, ref inoutByte
, ref inoutShort
, ref inoutUShort
,
1314 ref inoutInt
, ref inoutUInt
, ref inoutLong
, ref inoutULong
,
1315 ref inoutFloat
, ref inoutDouble
, ref inoutChar
, ref inoutString
,
1316 ref inoutType
, ref inoutAny
, ref inoutEnum2
, ref inoutStruct1
,
1317 ref inoutXInterface
, ref inoutXComponent
, ref inoutSeqBool
);
1319 l
.assure(aBool
== inoutBool
);
1320 l
.assure(aByte
== inoutByte
);
1321 l
.assure(aShort
== inoutShort
);
1322 l
.assure(aUShort
== inoutUShort
);
1323 l
.assure(aInt
== inoutInt
);
1324 l
.assure(aUInt
== inoutUInt
);
1325 l
.assure(aLong
== inoutLong
);
1326 l
.assure(aULong
== inoutULong
);
1327 l
.assure(aFloat
== inoutFloat
);
1328 l
.assure(aDouble
== inoutDouble
);
1329 l
.assure(aChar
== inoutChar
);
1330 l
.assure(aString
== inoutString
);
1331 l
.assure(aType
== inoutType
);
1332 l
.assure(aAny
.Equals(inoutAny
));
1333 l
.assure(aEnum2
== inoutEnum2
);
1334 l
.assure(aStruct1
== inoutStruct1
);
1335 l
.assure(aXInterface
== inoutXInterface
);
1336 l
.assure(aXComponent
== inoutXComponent
);
1337 l
.assure(aSeqBool
== inoutSeqBool
);
1340 //now check the return values
1341 obj
.inParameters(aBool
, aByte
, aShort
, aUShort
,
1342 aInt
, aUInt
, aLong
, aULong
,
1343 aFloat
, aDouble
, aChar
, aString
,
1344 aType
, aAny
,aEnum2
, aStruct1
,
1345 aXInterface
, aXComponent
, aSeqBool
);
1347 l
.assure(obj
.retBoolean() == aBool
);
1348 l
.assure(obj
.retByte() == aByte
);
1349 l
.assure(obj
.retShort() == aShort
);
1350 l
.assure(obj
.retUShort() == aUShort
);
1351 l
.assure(obj
.retLong() == aInt
);
1352 l
.assure(obj
.retULong() == aUInt
);
1353 l
.assure(obj
.retHyper() == aLong
);
1354 l
.assure(obj
.retUHyper() == aULong
);
1355 l
.assure(obj
.retFloat() == aFloat
);
1356 l
.assure(obj
.retDouble() == aDouble
);
1357 l
.assure(obj
.retChar() == aChar
);
1358 l
.assure(obj
.retString() == aString
);
1359 l
.assure(obj
.retType() == aType
);
1360 l
.assure(obj
.retAny().Equals(aAny
));
1361 l
.assure(obj
.retEnum() == aEnum2
);
1362 l
.assure(obj
.retStruct1() == aStruct1
);
1363 l
.assure(obj
.retXInterface() == aXInterface
);
1364 l
.assure(obj
.retXComponent() == aXComponent
);
1365 l
.assure(obj
.retSeqBool() == aSeqBool
);
1368 obj
= S1
.create1(c
);
1369 obj
.attrBoolean
= true;
1370 l
.assure(obj
.attrBoolean
== true);
1371 obj
.attrByte
= aByte
;
1372 l
.assure(obj
.attrByte
== aByte
);
1373 obj
.attrShort
= aShort
;
1374 l
.assure(obj
.attrShort
== aShort
);
1375 obj
.attrUShort
= aUShort
;
1376 l
.assure(obj
.attrUShort
== aUShort
);
1377 obj
.attrLong
= aInt
;
1378 l
.assure(obj
.attrLong
== aInt
);
1379 obj
.attrULong
= aUInt
;
1380 l
.assure(obj
.attrULong
== aUInt
);
1381 obj
.attrHyper
= aLong
;
1382 l
.assure(obj
.attrHyper
== aLong
);
1383 obj
.attrUHyper
= aULong
;
1384 l
.assure(obj
.attrUHyper
== aULong
);
1385 obj
.attrFloat
= aFloat
;
1386 l
.assure(obj
.attrFloat
== aFloat
);
1387 obj
.attrDouble
= aDouble
;
1388 l
.assure(obj
.attrDouble
== aDouble
);
1389 obj
.attrChar
= aChar
;
1390 l
.assure(obj
.attrChar
== aChar
);
1391 obj
.attrString
= aString
;
1392 l
.assure(obj
.attrString
== aString
);
1393 obj
.attrType
= aType
;
1394 l
.assure(obj
.attrType
== aType
);
1396 l
.assure(obj
.attrAny
.Equals(aAny
));
1397 obj
.attrEnum2
= aEnum2
;
1398 l
.assure(obj
.attrEnum2
== aEnum2
);
1399 obj
.attrStruct1
= aStruct1
;
1400 l
.assure(obj
.attrStruct1
== aStruct1
);
1401 obj
.attrXInterface
= aXInterface
;
1402 l
.assure(obj
.attrXInterface
== aXInterface
);
1403 obj
.attrXComponent
= aXComponent
;
1404 l
.assure(obj
.attrXComponent
== aXComponent
);
1405 obj
.attrSeqBoolean
= aSeqBool
;
1406 l
.assure(obj
.attrSeqBoolean
== aSeqBool
);
1407 } catch (Exception
)
1413 public void testAny(Logger l
)
1415 l
.Function
= "testAny";
1416 //create any with valid and invalid arguments
1419 Any a
= new Any(null, null);
1422 catch(System
.Exception e
)
1424 l
.assure(e
.Message
.IndexOf("Any") != -1);
1428 Any a
= new Any(typeof(int), null);
1431 catch(System
.Exception e
)
1433 l
.assure(e
.Message
.IndexOf("Any") != -1);
1439 Any a
= new Any(typeof(unoidl
.com
.sun
.star
.uno
.XComponentContext
), null);
1441 a
= new Any((sbyte)1);
1443 catch (System
.Exception
)
1448 //test polymorphic struct
1451 Any a
= new Any(typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
),
1455 catch (System
.Exception e
)
1457 l
.assure(e
.Message
.IndexOf("Any") != -1);
1461 Any a
= new Any(uno
.PolymorphicType
.GetType(
1462 typeof(unoidl
.test
.cliure
.climaker
.PolyStruct
),
1463 "unoidl.test.cliure.climaker.PolyStruct<System.Char>"),
1464 new PolyStruct('A', 10));
1466 catch (System
.Exception
)
1473 Any aVoid
= Any
.VOID
;
1474 l
.assure(aVoid
.Equals((object) Any
.VOID
));
1475 l
.assure(aVoid
.Equals(Any
.VOID
));
1477 l
.assure(aVoid
.Equals(new Any("")) == false);
1479 Any a1
= new Any(10);
1481 l
.assure(a1
.Equals(a2
));
1483 a1
= new Any(typeof(unoidl
.com
.sun
.star
.uno
.XComponentContext
), null);
1484 l
.assure(a1
.Equals(a2
) == false);
1486 l
.assure(a1
.Equals(a2
));
1487 l
.assure(a1
.Equals(null) == false);
1488 l
.assure(a1
.Equals(new object()) == false);