1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir using System; 29*cdf0e10cSrcweir using System.Reflection; 30*cdf0e10cSrcweir using System.Diagnostics; 31*cdf0e10cSrcweir using uno; 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir using unoidl.test.cliure.climaker; 35*cdf0e10cSrcweir //using unoidl.com.sun.star.uno; 36*cdf0e10cSrcweir using ucss=unoidl.com.sun.star; 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir /** This class is for testing the generated code in the uno services 39*cdf0e10cSrcweir */ 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir public class Context: ucss.uno.XComponentContext 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir public enum test_kind { 44*cdf0e10cSrcweir NORMAL, 45*cdf0e10cSrcweir NO_FACTORY, 46*cdf0e10cSrcweir TEST_EXCEPTION, 47*cdf0e10cSrcweir CREATION_FAILED 48*cdf0e10cSrcweir } 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir public Context(test_kind k, params object[] args) 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir kind = k; 53*cdf0e10cSrcweir factory = new Factory(k, args); 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir public ucss.lang.XMultiComponentFactory getServiceManager() 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir if (kind == test_kind.NO_FACTORY) 59*cdf0e10cSrcweir return null; 60*cdf0e10cSrcweir return factory; 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir public Any getValueByName(string Name) 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir if (kind == test_kind.NORMAL) 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir if (Name == "/singletons/unoidl.test.cliure.climaker.S4") 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir Component c = new Component(this); 70*cdf0e10cSrcweir return new Any(typeof(object), c); 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir else if (kind == test_kind.CREATION_FAILED) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir return new Any(); 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir return new Any(); 78*cdf0e10cSrcweir } 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir class Factory: ucss.lang.XMultiComponentFactory 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir public Factory(Context.test_kind k, params object[] args) { 83*cdf0e10cSrcweir kind2 = k; 84*cdf0e10cSrcweir if (k == Context.test_kind.TEST_EXCEPTION) 85*cdf0e10cSrcweir exception = (ucss.uno.Exception) args[0]; 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir public object createInstanceWithArgumentsAndContext( 88*cdf0e10cSrcweir string ServiceSpecifier, 89*cdf0e10cSrcweir uno.Any[] Arguments, 90*cdf0e10cSrcweir unoidl.com.sun.star.uno.XComponentContext Context) { 91*cdf0e10cSrcweir switch (kind2) { 92*cdf0e10cSrcweir case test_kind.NORMAL: 93*cdf0e10cSrcweir return new Component(Context, Arguments); 94*cdf0e10cSrcweir case test_kind.CREATION_FAILED : 95*cdf0e10cSrcweir return null; 96*cdf0e10cSrcweir case test_kind.TEST_EXCEPTION: 97*cdf0e10cSrcweir throw exception; 98*cdf0e10cSrcweir default: 99*cdf0e10cSrcweir throw new Exception("Factory not properly initialized"); 100*cdf0e10cSrcweir } 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir public object createInstanceWithContext( 103*cdf0e10cSrcweir string aServiceSpecifier, 104*cdf0e10cSrcweir unoidl.com.sun.star.uno.XComponentContext Context) { 105*cdf0e10cSrcweir switch (kind2) { 106*cdf0e10cSrcweir case test_kind.NORMAL: 107*cdf0e10cSrcweir return new Component(Context); 108*cdf0e10cSrcweir case test_kind.CREATION_FAILED: 109*cdf0e10cSrcweir return null; 110*cdf0e10cSrcweir case test_kind.TEST_EXCEPTION: 111*cdf0e10cSrcweir throw exception; 112*cdf0e10cSrcweir default: 113*cdf0e10cSrcweir throw new Exception("Factory not properly initialized"); 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir public string[] getAvailableServiceNames() 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir return new string[]{}; 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir ucss.uno.Exception exception; 122*cdf0e10cSrcweir test_kind kind2; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir Factory factory; 127*cdf0e10cSrcweir test_kind kind; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir public class Logger 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir String m_sFunction; 134*cdf0e10cSrcweir int m_nErrors; 135*cdf0e10cSrcweir public Logger() { 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir public String Function 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir set 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir m_sFunction = value; 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir get 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir return m_sFunction; 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir public void assure(bool b) { 151*cdf0e10cSrcweir if (b == false) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir Console.WriteLine(m_sFunction + " failed!"); 154*cdf0e10cSrcweir m_nErrors++; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir public void printStatus() { 159*cdf0e10cSrcweir Console.WriteLine("\n====================================="); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir String msg; 163*cdf0e10cSrcweir if (m_nErrors > 0) 164*cdf0e10cSrcweir msg = "Test failed! " + m_nErrors.ToString() + " Errors."; 165*cdf0e10cSrcweir else 166*cdf0e10cSrcweir msg = "Test succeeded!"; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir Console.WriteLine(msg + "\n====================================="); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir public int Errors 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir get 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir return m_nErrors; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir public sealed class Test 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir public static int Main(String[] args) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir // System.Diagnostics.Debugger.Launch(); 186*cdf0e10cSrcweir try 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir Logger log = new Logger(); 189*cdf0e10cSrcweir Test t = new Test(); 190*cdf0e10cSrcweir t.testEnum1(log); 191*cdf0e10cSrcweir t.testEnum2(log); 192*cdf0e10cSrcweir t.testPolyStruct(log); 193*cdf0e10cSrcweir t.testEmptyStruct2(log); 194*cdf0e10cSrcweir t.testFullStruct2(log); 195*cdf0e10cSrcweir t.testS1(log); 196*cdf0e10cSrcweir t.testSingletons(log); 197*cdf0e10cSrcweir t.testAttributes(log); 198*cdf0e10cSrcweir t.testPolyStructAttributes(log); 199*cdf0e10cSrcweir t.testPolymorphicType(log); 200*cdf0e10cSrcweir t.testInterface(log); 201*cdf0e10cSrcweir t.testAny(log); 202*cdf0e10cSrcweir log.printStatus(); 203*cdf0e10cSrcweir if (log.Errors == 0) 204*cdf0e10cSrcweir return 0; 205*cdf0e10cSrcweir return -1; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir catch(Exception e) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir Console.Write(e.Message); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir return -1; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir public void testEnum1(Logger l) { 217*cdf0e10cSrcweir l.Function = "testEnum1"; 218*cdf0e10cSrcweir l.assure(((int)Enum1.VALUE1) == -100); 219*cdf0e10cSrcweir l.assure(((int)Enum1.VALUE2) == 100); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir public void testEnum2(Logger l) { 223*cdf0e10cSrcweir l.Function = "testEnum2"; 224*cdf0e10cSrcweir l.assure( ((int) Enum2.VALUE0) == 0); 225*cdf0e10cSrcweir l.assure( ((int) Enum2.VALUE1) == 1); 226*cdf0e10cSrcweir l.assure( ((int) Enum2.VALUE2) == 2); 227*cdf0e10cSrcweir l.assure( ((int) Enum2.VALUE4) == 4); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir public void testPolyStruct(Logger l) { 231*cdf0e10cSrcweir l.Function = "testPolyStruct"; 232*cdf0e10cSrcweir PolyStruct s = new PolyStruct(); 233*cdf0e10cSrcweir l.assure(s.member1 == null); 234*cdf0e10cSrcweir l.assure(s.member2 == 0); 235*cdf0e10cSrcweir s = new PolyStruct("ABC", 5); 236*cdf0e10cSrcweir l.assure(s.member1.Equals("ABC")); 237*cdf0e10cSrcweir l.assure(s.member2 == 5); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir public void testEmptyStruct2(Logger l) { 241*cdf0e10cSrcweir l.Function = "testEmptyStruct2"; 242*cdf0e10cSrcweir Struct2 s = new Struct2(); 243*cdf0e10cSrcweir l.assure(s.p1 == false); 244*cdf0e10cSrcweir l.assure(s.p2 == 0); 245*cdf0e10cSrcweir l.assure(s.p3 == 0); 246*cdf0e10cSrcweir l.assure(s.p4 == 0); 247*cdf0e10cSrcweir l.assure(s.p5 == 0); 248*cdf0e10cSrcweir l.assure(s.p6 == 0); 249*cdf0e10cSrcweir l.assure(s.p7 == 0L); 250*cdf0e10cSrcweir l.assure(s.p8 == 0L); 251*cdf0e10cSrcweir l.assure(s.p9 == 0.0f); 252*cdf0e10cSrcweir l.assure(s.p10 == 0.0); 253*cdf0e10cSrcweir l.assure(s.p11 == '\u0000'); 254*cdf0e10cSrcweir l.assure(s.p12.Equals("")); 255*cdf0e10cSrcweir l.assure(s.p13.Equals(typeof(void))); 256*cdf0e10cSrcweir l.assure(s.p14.Equals(Any.VOID)); 257*cdf0e10cSrcweir l.assure(s.p15 == Enum2.VALUE0); 258*cdf0e10cSrcweir l.assure(s.p16.member1 == 0); 259*cdf0e10cSrcweir l.assure(s.p17 == null); 260*cdf0e10cSrcweir l.assure(s.p18 == null); 261*cdf0e10cSrcweir l.assure(s.t1 == false); 262*cdf0e10cSrcweir l.assure(s.t2 == 0); 263*cdf0e10cSrcweir l.assure(s.t3 == 0); 264*cdf0e10cSrcweir l.assure(s.t4 == 0); 265*cdf0e10cSrcweir l.assure(s.t5 == 0); 266*cdf0e10cSrcweir l.assure(s.t6 == 0); 267*cdf0e10cSrcweir l.assure(s.t7 == 0L); 268*cdf0e10cSrcweir l.assure(s.t8 == 0L); 269*cdf0e10cSrcweir l.assure(s.t9 == 0.0f); 270*cdf0e10cSrcweir l.assure(s.t10 == 0.0); 271*cdf0e10cSrcweir l.assure(s.t11 == '\u0000'); 272*cdf0e10cSrcweir l.assure(s.t12.Equals("")); 273*cdf0e10cSrcweir l.assure(s.t13.Equals(typeof(void))); 274*cdf0e10cSrcweir l.assure(s.t14.Equals(Any.VOID)); 275*cdf0e10cSrcweir l.assure(s.t15 == Enum2.VALUE0); 276*cdf0e10cSrcweir l.assure(s.t16.member1 == 0); 277*cdf0e10cSrcweir l.assure(s.t17 == null); 278*cdf0e10cSrcweir l.assure(s.t18 == null); 279*cdf0e10cSrcweir l.assure(s.a1.Length == 0); 280*cdf0e10cSrcweir l.assure(s.a2.Length == 0); 281*cdf0e10cSrcweir l.assure(s.a3.Length == 0); 282*cdf0e10cSrcweir l.assure(s.a4.Length == 0); 283*cdf0e10cSrcweir l.assure(s.a5.Length == 0); 284*cdf0e10cSrcweir l.assure(s.a6.Length == 0); 285*cdf0e10cSrcweir l.assure(s.a7.Length == 0); 286*cdf0e10cSrcweir l.assure(s.a8.Length == 0); 287*cdf0e10cSrcweir l.assure(s.a9.Length == 0); 288*cdf0e10cSrcweir l.assure(s.a10.Length == 0); 289*cdf0e10cSrcweir l.assure(s.a11.Length == 0); 290*cdf0e10cSrcweir l.assure(s.a12.Length == 0); 291*cdf0e10cSrcweir l.assure(s.a13.Length == 0); 292*cdf0e10cSrcweir l.assure(s.a14.Length == 0); 293*cdf0e10cSrcweir l.assure(s.a15.Length == 0); 294*cdf0e10cSrcweir l.assure(s.a16.Length == 0); 295*cdf0e10cSrcweir l.assure(s.a17.Length == 0); 296*cdf0e10cSrcweir l.assure(s.a18.Length == 0); 297*cdf0e10cSrcweir l.assure(s.aa1.Length == 0); 298*cdf0e10cSrcweir l.assure(s.aa2.Length == 0); 299*cdf0e10cSrcweir l.assure(s.aa3.Length == 0); 300*cdf0e10cSrcweir l.assure(s.aa4.Length == 0); 301*cdf0e10cSrcweir l.assure(s.aa5.Length == 0); 302*cdf0e10cSrcweir l.assure(s.aa6.Length == 0); 303*cdf0e10cSrcweir l.assure(s.aa7.Length == 0); 304*cdf0e10cSrcweir l.assure(s.aa8.Length == 0); 305*cdf0e10cSrcweir l.assure(s.aa9.Length == 0); 306*cdf0e10cSrcweir l.assure(s.aa10.Length == 0); 307*cdf0e10cSrcweir l.assure(s.aa11.Length == 0); 308*cdf0e10cSrcweir l.assure(s.aa12.Length == 0); 309*cdf0e10cSrcweir l.assure(s.aa13.Length == 0); 310*cdf0e10cSrcweir l.assure(s.aa14.Length == 0); 311*cdf0e10cSrcweir l.assure(s.aa15.Length == 0); 312*cdf0e10cSrcweir l.assure(s.aa16.Length == 0); 313*cdf0e10cSrcweir l.assure(s.aa17.Length == 0); 314*cdf0e10cSrcweir l.assure(s.aa18.Length == 0); 315*cdf0e10cSrcweir l.assure(s.at1.Length == 0); 316*cdf0e10cSrcweir l.assure(s.at2.Length == 0); 317*cdf0e10cSrcweir l.assure(s.at3.Length == 0); 318*cdf0e10cSrcweir l.assure(s.at4.Length == 0); 319*cdf0e10cSrcweir l.assure(s.at5.Length == 0); 320*cdf0e10cSrcweir l.assure(s.at6.Length == 0); 321*cdf0e10cSrcweir l.assure(s.at7.Length == 0); 322*cdf0e10cSrcweir l.assure(s.at8.Length == 0); 323*cdf0e10cSrcweir l.assure(s.at9.Length == 0); 324*cdf0e10cSrcweir l.assure(s.at10.Length == 0); 325*cdf0e10cSrcweir l.assure(s.at11.Length == 0); 326*cdf0e10cSrcweir l.assure(s.at12.Length == 0); 327*cdf0e10cSrcweir l.assure(s.at13.Length == 0); 328*cdf0e10cSrcweir l.assure(s.at14.Length == 0); 329*cdf0e10cSrcweir l.assure(s.at15.Length == 0); 330*cdf0e10cSrcweir l.assure(s.at16.Length == 0); 331*cdf0e10cSrcweir l.assure(s.at17.Length == 0); 332*cdf0e10cSrcweir l.assure(s.at18.Length == 0); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir public void testFullStruct2(Logger l) { 336*cdf0e10cSrcweir //TODO: 337*cdf0e10cSrcweir Struct2 s = new Struct2( 338*cdf0e10cSrcweir true, (byte) 1, (short) 2, (ushort) 3, 4, 5, 6L, 7L, 0.8f, 0.9d, 'A', 339*cdf0e10cSrcweir "BCD", typeof(ulong), new Any(22), Enum2.VALUE4, 340*cdf0e10cSrcweir new Struct1(1), null, null, false, (byte) 0, (short) 0, (ushort) 0, 341*cdf0e10cSrcweir 0, 0, 0L, 0L, 0.0f, 0.0, '\u0000', "", typeof(void), Any.VOID, 342*cdf0e10cSrcweir Enum2.VALUE0, new Struct1(), null, null, 343*cdf0e10cSrcweir new bool[] { false, true }, new byte[] { (byte) 1, (byte) 2 }, 344*cdf0e10cSrcweir new short[0], new ushort[0], new int[0], new uint[0], 345*cdf0e10cSrcweir new long[0], new ulong[0], new float[0], new double[0], new char[0], 346*cdf0e10cSrcweir new String[0], new Type[0], new Any[0], new Enum2[0], 347*cdf0e10cSrcweir new Struct1[] { new Struct1(1), new Struct1(2) }, new Object[0], 348*cdf0e10cSrcweir new ucss.uno.XNamingService[0], new bool[0][], new byte[0][], 349*cdf0e10cSrcweir new short[0][], new ushort[0][], new int[0][], new uint[0][], 350*cdf0e10cSrcweir new long[0][], new ulong[0][], new float[0][], new double[0][], 351*cdf0e10cSrcweir new char[0][], new String[0][], new Type[0][], new Any[0][], 352*cdf0e10cSrcweir new Enum2[0][], new Struct1[0][], new Object[0][], 353*cdf0e10cSrcweir new ucss.uno.XNamingService[0][], new bool[0][], new byte[0][], 354*cdf0e10cSrcweir new short[0][], new ushort[0][], new int[0][], new uint[0][], 355*cdf0e10cSrcweir new long[0][], new ulong[0][], new float[0][], new double[0][], 356*cdf0e10cSrcweir new char[0][], new String[0][], new Type[0][], new Any[0][], 357*cdf0e10cSrcweir new Enum2[0][], new Struct1[0][], new Object[0][], 358*cdf0e10cSrcweir new ucss.uno.XNamingService[0][]); 359*cdf0e10cSrcweir l.assure(s.p1 == true); 360*cdf0e10cSrcweir l.assure(s.p2 == 1); 361*cdf0e10cSrcweir l.assure(s.p3 == 2); 362*cdf0e10cSrcweir l.assure(s.p4 == 3); 363*cdf0e10cSrcweir l.assure(s.p5 == 4); 364*cdf0e10cSrcweir l.assure(s.p6 == 5); 365*cdf0e10cSrcweir l.assure(s.p7 == 6L); 366*cdf0e10cSrcweir l.assure(s.p8 == 7L); 367*cdf0e10cSrcweir l.assure(s.p9 == 0.8f); 368*cdf0e10cSrcweir l.assure(s.p10 == 0.9); 369*cdf0e10cSrcweir l.assure(s.p11 == 'A'); 370*cdf0e10cSrcweir l.assure(s.p12.Equals("BCD")); 371*cdf0e10cSrcweir l.assure(s.p13.Equals(typeof(ulong))); 372*cdf0e10cSrcweir l.assure(s.p14.Equals(new Any(22))); 373*cdf0e10cSrcweir l.assure(s.p15 == Enum2.VALUE4); 374*cdf0e10cSrcweir l.assure(s.p16.member1 == 1); 375*cdf0e10cSrcweir l.assure(s.p17 == null); 376*cdf0e10cSrcweir l.assure(s.p18 == null); 377*cdf0e10cSrcweir l.assure(s.t1 == false); 378*cdf0e10cSrcweir l.assure(s.t2 == 0); 379*cdf0e10cSrcweir l.assure(s.t3 == 0); 380*cdf0e10cSrcweir l.assure(s.t4 == 0); 381*cdf0e10cSrcweir l.assure(s.t5 == 0); 382*cdf0e10cSrcweir l.assure(s.t6 == 0); 383*cdf0e10cSrcweir l.assure(s.t7 == 0L); 384*cdf0e10cSrcweir l.assure(s.t8 == 0L); 385*cdf0e10cSrcweir l.assure(s.t9 == 0.0f); 386*cdf0e10cSrcweir l.assure(s.t10 == 0.0); 387*cdf0e10cSrcweir l.assure(s.t11 == '\u0000'); 388*cdf0e10cSrcweir l.assure(s.t12.Equals("")); 389*cdf0e10cSrcweir l.assure(s.t13.Equals(typeof(void))); 390*cdf0e10cSrcweir l.assure(s.t14.Equals(Any.VOID)); 391*cdf0e10cSrcweir l.assure(s.t15 == Enum2.VALUE0); 392*cdf0e10cSrcweir l.assure(s.t16.member1 == 0); 393*cdf0e10cSrcweir l.assure(s.t17 == null); 394*cdf0e10cSrcweir l.assure(s.t18 == null); 395*cdf0e10cSrcweir l.assure(s.a1.Length == 2); 396*cdf0e10cSrcweir l.assure(s.a1[0] == false); 397*cdf0e10cSrcweir l.assure(s.a1[1] == true); 398*cdf0e10cSrcweir l.assure(s.a2.Length == 2); 399*cdf0e10cSrcweir l.assure(s.a2[0] == 1); 400*cdf0e10cSrcweir l.assure(s.a2[1] == 2); 401*cdf0e10cSrcweir l.assure(s.a3.Length == 0); 402*cdf0e10cSrcweir l.assure(s.a4.Length == 0); 403*cdf0e10cSrcweir l.assure(s.a5.Length == 0); 404*cdf0e10cSrcweir l.assure(s.a6.Length == 0); 405*cdf0e10cSrcweir l.assure(s.a7.Length == 0); 406*cdf0e10cSrcweir l.assure(s.a8.Length == 0); 407*cdf0e10cSrcweir l.assure(s.a9.Length == 0); 408*cdf0e10cSrcweir l.assure(s.a10.Length == 0); 409*cdf0e10cSrcweir l.assure(s.a11.Length == 0); 410*cdf0e10cSrcweir l.assure(s.a12.Length == 0); 411*cdf0e10cSrcweir l.assure(s.a13.Length == 0); 412*cdf0e10cSrcweir l.assure(s.a14.Length == 0); 413*cdf0e10cSrcweir l.assure(s.a15.Length == 0); 414*cdf0e10cSrcweir l.assure(s.a16.Length == 2); 415*cdf0e10cSrcweir l.assure(s.a16[0].member1 == 1); 416*cdf0e10cSrcweir l.assure(s.a16[1].member1 == 2); 417*cdf0e10cSrcweir l.assure(s.a17.Length == 0); 418*cdf0e10cSrcweir l.assure(s.a18.Length == 0); 419*cdf0e10cSrcweir l.assure(s.aa1.Length == 0); 420*cdf0e10cSrcweir l.assure(s.aa2.Length == 0); 421*cdf0e10cSrcweir l.assure(s.aa3.Length == 0); 422*cdf0e10cSrcweir l.assure(s.aa4.Length == 0); 423*cdf0e10cSrcweir l.assure(s.aa5.Length == 0); 424*cdf0e10cSrcweir l.assure(s.aa6.Length == 0); 425*cdf0e10cSrcweir l.assure(s.aa7.Length == 0); 426*cdf0e10cSrcweir l.assure(s.aa8.Length == 0); 427*cdf0e10cSrcweir l.assure(s.aa9.Length == 0); 428*cdf0e10cSrcweir l.assure(s.aa10.Length == 0); 429*cdf0e10cSrcweir l.assure(s.aa11.Length == 0); 430*cdf0e10cSrcweir l.assure(s.aa12.Length == 0); 431*cdf0e10cSrcweir l.assure(s.aa13.Length == 0); 432*cdf0e10cSrcweir l.assure(s.aa14.Length == 0); 433*cdf0e10cSrcweir l.assure(s.aa15.Length == 0); 434*cdf0e10cSrcweir l.assure(s.aa16.Length == 0); 435*cdf0e10cSrcweir l.assure(s.aa17.Length == 0); 436*cdf0e10cSrcweir l.assure(s.aa18.Length == 0); 437*cdf0e10cSrcweir l.assure(s.at1.Length == 0); 438*cdf0e10cSrcweir l.assure(s.at2.Length == 0); 439*cdf0e10cSrcweir l.assure(s.at3.Length == 0); 440*cdf0e10cSrcweir l.assure(s.at4.Length == 0); 441*cdf0e10cSrcweir l.assure(s.at5.Length == 0); 442*cdf0e10cSrcweir l.assure(s.at6.Length == 0); 443*cdf0e10cSrcweir l.assure(s.at7.Length == 0); 444*cdf0e10cSrcweir l.assure(s.at8.Length == 0); 445*cdf0e10cSrcweir l.assure(s.at9.Length == 0); 446*cdf0e10cSrcweir l.assure(s.at10.Length == 0); 447*cdf0e10cSrcweir l.assure(s.at11.Length == 0); 448*cdf0e10cSrcweir l.assure(s.at12.Length == 0); 449*cdf0e10cSrcweir l.assure(s.at13.Length == 0); 450*cdf0e10cSrcweir l.assure(s.at14.Length == 0); 451*cdf0e10cSrcweir l.assure(s.at15.Length == 0); 452*cdf0e10cSrcweir l.assure(s.at16.Length == 0); 453*cdf0e10cSrcweir l.assure(s.at17.Length == 0); 454*cdf0e10cSrcweir l.assure(s.at18.Length == 0); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir public void testS1(Logger l) { 458*cdf0e10cSrcweir l.Function = "testS1"; 459*cdf0e10cSrcweir object obj = new Object(); 460*cdf0e10cSrcweir ucss.uno.RuntimeException excRuntime = 461*cdf0e10cSrcweir new ucss.uno.RuntimeException("RuntimeException", obj); 462*cdf0e10cSrcweir ucss.uno.Exception excException = 463*cdf0e10cSrcweir new ucss.uno.Exception("Exception", obj); 464*cdf0e10cSrcweir ucss.lang.IllegalAccessException excIllegalAccess = 465*cdf0e10cSrcweir new ucss.lang.IllegalAccessException("IllegalAccessException", obj); 466*cdf0e10cSrcweir ucss.uno.DeploymentException excDeployment = 467*cdf0e10cSrcweir new ucss.uno.DeploymentException("DeploymentException", obj); 468*cdf0e10cSrcweir ucss.lang.InvalidListenerException excInvalidListener = 469*cdf0e10cSrcweir new ucss.lang.InvalidListenerException("ListenerException", obj); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir /* create1 does not specify exceptions. Therefore RuntimeExceptions 472*cdf0e10cSrcweir fly through and other exceptions cause a DeploymentException. 473*cdf0e10cSrcweir */ 474*cdf0e10cSrcweir try { 475*cdf0e10cSrcweir S1.create1(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime)); 476*cdf0e10cSrcweir } catch (ucss.uno.RuntimeException e) { 477*cdf0e10cSrcweir l.assure(e.Message == excRuntime.Message 478*cdf0e10cSrcweir && e.Context == obj); 479*cdf0e10cSrcweir } catch (System.Exception) { 480*cdf0e10cSrcweir l.assure(false); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir Context c = new Context(Context.test_kind.TEST_EXCEPTION, excException); 484*cdf0e10cSrcweir try { 485*cdf0e10cSrcweir S1.create1(c); 486*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 487*cdf0e10cSrcweir //The message of the original exception should be contained 488*cdf0e10cSrcweir // in the Deploymentexception 489*cdf0e10cSrcweir l.assure(e.Message.IndexOf(excException.Message) != -1 && e.Context == c); 490*cdf0e10cSrcweir } catch (System.Exception) { 491*cdf0e10cSrcweir l.assure(false); 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir /* create2 specifies many exceptions, including RuntimeException and Exception. 495*cdf0e10cSrcweir Because Exception is specified all exceptions are allowed, hence all thrown 496*cdf0e10cSrcweir exceptions fly through. 497*cdf0e10cSrcweir */ 498*cdf0e10cSrcweir try { 499*cdf0e10cSrcweir S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime)); 500*cdf0e10cSrcweir } catch (ucss.uno.RuntimeException e) { 501*cdf0e10cSrcweir l.assure(e.Message == excRuntime.Message 502*cdf0e10cSrcweir && e.Context == obj); 503*cdf0e10cSrcweir } catch (System.Exception) { 504*cdf0e10cSrcweir l.assure(false); 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir try { 508*cdf0e10cSrcweir S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess)); 509*cdf0e10cSrcweir } catch (ucss.lang.IllegalAccessException e) { 510*cdf0e10cSrcweir l.assure(e.Message == excIllegalAccess.Message 511*cdf0e10cSrcweir && e.Context == obj); 512*cdf0e10cSrcweir } catch (System.Exception) { 513*cdf0e10cSrcweir l.assure(false); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir try { 517*cdf0e10cSrcweir S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excException)); 518*cdf0e10cSrcweir } catch (ucss.uno.Exception e) { 519*cdf0e10cSrcweir l.assure(e.Message == excException.Message 520*cdf0e10cSrcweir && e.Context == obj); 521*cdf0e10cSrcweir } catch (System.Exception) { 522*cdf0e10cSrcweir l.assure(false); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir /* create3 specifies exceptions but no com.sun.star.uno.Exception. RuntimeException 526*cdf0e10cSrcweir and derived fly through. Other specified exceptions are rethrown and all other 527*cdf0e10cSrcweir exceptions cause a DeploymentException. 528*cdf0e10cSrcweir */ 529*cdf0e10cSrcweir try { 530*cdf0e10cSrcweir S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excDeployment), 531*cdf0e10cSrcweir new Any[]{}); 532*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 533*cdf0e10cSrcweir l.assure(e.Message == excDeployment.Message 534*cdf0e10cSrcweir && e.Context == obj); 535*cdf0e10cSrcweir } catch (System.Exception) { 536*cdf0e10cSrcweir l.assure(false); 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir try { 540*cdf0e10cSrcweir S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess), 541*cdf0e10cSrcweir new Any[0]); 542*cdf0e10cSrcweir } catch (ucss.lang.IllegalAccessException e) { 543*cdf0e10cSrcweir l.assure(e.Message == excIllegalAccess.Message 544*cdf0e10cSrcweir && e.Context == obj); 545*cdf0e10cSrcweir } catch (System.Exception) { 546*cdf0e10cSrcweir l.assure(false); 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir c = new Context(Context.test_kind.TEST_EXCEPTION, excInvalidListener); 550*cdf0e10cSrcweir try { 551*cdf0e10cSrcweir S1.create3(c, new Any[0]); 552*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 553*cdf0e10cSrcweir l.assure(e.Message.IndexOf(excInvalidListener.Message) != -1 554*cdf0e10cSrcweir && e.Context == c); 555*cdf0e10cSrcweir } catch (System.Exception) { 556*cdf0e10cSrcweir l.assure(false); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir /* test the case when the context cannot provide a service manager. 560*cdf0e10cSrcweir */ 561*cdf0e10cSrcweir try { 562*cdf0e10cSrcweir S1.create2(new Context(Context.test_kind.NO_FACTORY)); 563*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 564*cdf0e10cSrcweir l.assure(e.Message.Length > 0); 565*cdf0e10cSrcweir } catch (System.Exception) { 566*cdf0e10cSrcweir l.assure(false); 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir /* When the service manager returns a null pointer then a DeploymentException 570*cdf0e10cSrcweir * is to be thrown. 571*cdf0e10cSrcweir */ 572*cdf0e10cSrcweir try { 573*cdf0e10cSrcweir S1.create2(new Context(Context.test_kind.CREATION_FAILED)); 574*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 575*cdf0e10cSrcweir l.assure(e.Message.Length > 0); 576*cdf0e10cSrcweir } catch (System.Exception) { 577*cdf0e10cSrcweir l.assure(false); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir /** Test creation of components and if the passing of parameters works. 582*cdf0e10cSrcweir */ 583*cdf0e10cSrcweir c = new Context(Context.test_kind.NORMAL); 584*cdf0e10cSrcweir try { 585*cdf0e10cSrcweir XTest xTest = S1.create1(c); 586*cdf0e10cSrcweir Component cobj = (Component) xTest; 587*cdf0e10cSrcweir l.assure(cobj.Args[0].Value == c); 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir Any a1 = new Any("bla"); 590*cdf0e10cSrcweir Any a2 = new Any(3.14f); 591*cdf0e10cSrcweir Any a3 = new Any(3.145d); 592*cdf0e10cSrcweir xTest = S1.create2(c, a1, a2, a3); 593*cdf0e10cSrcweir cobj = (Component) xTest; 594*cdf0e10cSrcweir l.assure(cobj.Args[0].Value == c 595*cdf0e10cSrcweir && a1.Equals(cobj.Args[1]) 596*cdf0e10cSrcweir && a2.Equals(cobj.Args[2]) 597*cdf0e10cSrcweir && a3.Equals(cobj.Args[3])); 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir bool b1 = true; 600*cdf0e10cSrcweir byte b2 = 1; 601*cdf0e10cSrcweir short b3 = 2; 602*cdf0e10cSrcweir ushort b4 = 3; 603*cdf0e10cSrcweir int b5 = 4; 604*cdf0e10cSrcweir uint b6 = 5; 605*cdf0e10cSrcweir long b7 = 6; 606*cdf0e10cSrcweir ulong b8 = 7; 607*cdf0e10cSrcweir float b9 = 0.8f; 608*cdf0e10cSrcweir double b10 = 0.9; 609*cdf0e10cSrcweir char b11 = 'A'; 610*cdf0e10cSrcweir string b12 = "BCD"; 611*cdf0e10cSrcweir Type b13 = typeof(ulong); 612*cdf0e10cSrcweir Any b14 = new Any(22); 613*cdf0e10cSrcweir Enum2 b15 = Enum2.VALUE4; 614*cdf0e10cSrcweir Struct1 b16 = new Struct1(1); 615*cdf0e10cSrcweir PolyStruct b17 = new PolyStruct('A', 1); 616*cdf0e10cSrcweir PolyStruct b18 = new PolyStruct(new Any(true), 1); 617*cdf0e10cSrcweir object b19 = new uno.util.WeakComponentBase(); 618*cdf0e10cSrcweir ucss.lang.XComponent b20 = (ucss.lang.XComponent) b19; 619*cdf0e10cSrcweir bool b21 = b1; 620*cdf0e10cSrcweir byte b22 = b2; 621*cdf0e10cSrcweir short b23 = b3; 622*cdf0e10cSrcweir ushort b24 = b4; 623*cdf0e10cSrcweir int b25 = b5; 624*cdf0e10cSrcweir uint b26 = b6; 625*cdf0e10cSrcweir long b27 = b7; 626*cdf0e10cSrcweir ulong b28 = b8; 627*cdf0e10cSrcweir float b29 = b9; 628*cdf0e10cSrcweir double b30 = b10; 629*cdf0e10cSrcweir char b31 = b11; 630*cdf0e10cSrcweir string b32 = b12; 631*cdf0e10cSrcweir Type b33 = b13; 632*cdf0e10cSrcweir Any b34 = b14; 633*cdf0e10cSrcweir Enum2 b35 = b15; 634*cdf0e10cSrcweir Struct1 b36 = b16; 635*cdf0e10cSrcweir object b37 = b19; 636*cdf0e10cSrcweir ucss.lang.XComponent b38 = b20; 637*cdf0e10cSrcweir bool[] b39 = new bool[] { false, true }; 638*cdf0e10cSrcweir byte[] b40 = new byte[] { (byte) 1, (byte) 2 }; 639*cdf0e10cSrcweir short[] b41 = new short[] { (short) 123, (short) 456}; 640*cdf0e10cSrcweir ushort[] b42 = new ushort[] { (ushort) 789, (ushort) 101}; 641*cdf0e10cSrcweir int[] b43 = new int[] {1, 2, 3}; 642*cdf0e10cSrcweir uint[] b44 = new uint[] {4, 5, 6}; 643*cdf0e10cSrcweir long[] b45 = new long[] {7,8,9}; 644*cdf0e10cSrcweir ulong[] b46 = new ulong[] {123, 4356}; 645*cdf0e10cSrcweir float[] b47 = new float[] {2435f,87f}; 646*cdf0e10cSrcweir double[] b48 = new double[] {234d,45.2134d}; 647*cdf0e10cSrcweir char[] b49 = new char[] {'\u1234', 'A'}; 648*cdf0e10cSrcweir string[] b50 = new string[] {"a","bc"}; 649*cdf0e10cSrcweir Type[] b51 = new Type[] {typeof(int), typeof(long)}; 650*cdf0e10cSrcweir Any[] b52 = new Any[] {new Any(1), new Any("adf")}; 651*cdf0e10cSrcweir Enum2[] b53 = new Enum2[] {Enum2.VALUE2}; 652*cdf0e10cSrcweir Struct1[] b54 = new Struct1[] {new Struct1(11), new Struct1(22)}; 653*cdf0e10cSrcweir object[] b55 = new object[0]; 654*cdf0e10cSrcweir ucss.lang.XComponent[] b56 = new ucss.lang.XComponent[]{ 655*cdf0e10cSrcweir new uno.util.WeakComponentBase(), new uno.util.WeakComponentBase()}; 656*cdf0e10cSrcweir bool[][] b57 = new bool[][] {new bool[]{true,false}, new bool[] {true}}; 657*cdf0e10cSrcweir byte[][] b58 = new byte[][]{new byte[] {(byte) 1}, new byte[]{(byte) 2}}; 658*cdf0e10cSrcweir short[][] b59 = new short[][] {new short[]{(short)6, (short)7}, new short[] {(short)9}}; 659*cdf0e10cSrcweir ushort[][] b60 = new ushort[][] { new ushort[]{(ushort) 11}}; 660*cdf0e10cSrcweir int[][] b61 = new int[][] {new int[]{1}, new int[]{2,3}, new int[]{4,5,6}}; 661*cdf0e10cSrcweir uint[][] b62 = new uint[][] {new uint[]{10U}, new uint[]{20U,30U}, new uint[]{40U,50U,60}}; 662*cdf0e10cSrcweir long[][] b63 = new long[][] {new long[]{10L}, new long[]{20L,30}, new long[]{40,50,60}}; 663*cdf0e10cSrcweir ulong[][] b64 = new ulong[][] { new ulong[]{10L}, new ulong[]{20L, 30L}, new ulong[]{40,50,60}}; 664*cdf0e10cSrcweir float[][] b65 = new float[][] {new float[]{10f}, new float[]{20f,30f}, new float[]{40f,50f,60f}}; 665*cdf0e10cSrcweir double[][] b66 = new double[][]{new double[]{10d}, new double[]{20d,30d}}; 666*cdf0e10cSrcweir char[][] b67 = new char[][] {new char[]{'a'}, new char[]{'b', 'c'}}; 667*cdf0e10cSrcweir string[][] b68 = new String[][] {new string[]{"a"}, new string[]{"ad", "lkj"}}; 668*cdf0e10cSrcweir Type[][] b69 = new Type[][] {new Type[]{typeof(byte), typeof(long)}, new Type[]{typeof(Any)}}; 669*cdf0e10cSrcweir Any[][] b70 = new Any[][] {new Any[]{new Any(1f), new Any(2d)}, new Any[]{new Any(34U)}}; 670*cdf0e10cSrcweir Enum2[][] b71 = new Enum2[][] {new Enum2[]{Enum2.VALUE2}}; 671*cdf0e10cSrcweir Struct1[][] b72 = new Struct1[][] {new Struct1[]{new Struct1(2), new Struct1(3)}}; 672*cdf0e10cSrcweir object[][] b73 = new Object[0][]; 673*cdf0e10cSrcweir ucss.lang.XComponent[][] b74 = new uno.util.WeakComponentBase[0][]; 674*cdf0e10cSrcweir bool[][] b75 = b57; 675*cdf0e10cSrcweir byte[][] b76 = b58; 676*cdf0e10cSrcweir short[][] b77 = b59; 677*cdf0e10cSrcweir ushort[][] b78 = b60; 678*cdf0e10cSrcweir int[][] b79 = b61; 679*cdf0e10cSrcweir uint[][] b80 = b62; 680*cdf0e10cSrcweir long[][] b81 = b63; 681*cdf0e10cSrcweir ulong[][] b82 = b64; 682*cdf0e10cSrcweir float[][] b83 = b65; 683*cdf0e10cSrcweir double[][] b84 = b66; 684*cdf0e10cSrcweir char[][] b85 = b67; 685*cdf0e10cSrcweir String[][] b86 = b68; 686*cdf0e10cSrcweir Type[][] b87 =b69; 687*cdf0e10cSrcweir Any[][] b88 = b70; 688*cdf0e10cSrcweir Enum2[][] b89 = b71; 689*cdf0e10cSrcweir Struct1[][] b90 = b72; 690*cdf0e10cSrcweir Object[][] b91 = b73; 691*cdf0e10cSrcweir ucss.lang.XComponent[][] b92 = b74; 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir xTest = S1.create5( 694*cdf0e10cSrcweir c, 695*cdf0e10cSrcweir b1, b2, b3, b4, b5, b6, b7 ,b8, b9, b10, 696*cdf0e10cSrcweir b11, b12, b13, 697*cdf0e10cSrcweir b14, 698*cdf0e10cSrcweir b15, b16, b17, b18, b19, b20, 699*cdf0e10cSrcweir b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, 700*cdf0e10cSrcweir b31, b32, b33, 701*cdf0e10cSrcweir b34, 702*cdf0e10cSrcweir b35, b36, b37, b38, b39, b40, 703*cdf0e10cSrcweir b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, 704*cdf0e10cSrcweir b51, b52, b53, b54, b55, b56, b57, b58, b59, b60, 705*cdf0e10cSrcweir b61, b62, b63, b64, b65, b66, b67, b68, b69, b70, 706*cdf0e10cSrcweir b71, b72, b73, b74, b75, b76, b77, b78, b79, b80, 707*cdf0e10cSrcweir b81, b82, b83, b84, b85, b86, b87, b88, b89, b90, 708*cdf0e10cSrcweir b91, b92 709*cdf0e10cSrcweir ); 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir cobj = (Component) xTest; 712*cdf0e10cSrcweir l.assure(cobj.Args[0].Value == c); 713*cdf0e10cSrcweir l.assure(b1.Equals(cobj.Args[1].Value)); 714*cdf0e10cSrcweir l.assure(b2.Equals(cobj.Args[2].Value)); 715*cdf0e10cSrcweir l.assure(b3.Equals(cobj.Args[3].Value)); 716*cdf0e10cSrcweir l.assure(b4.Equals(cobj.Args[4].Value)); 717*cdf0e10cSrcweir l.assure(b5.Equals(cobj.Args[5].Value)); 718*cdf0e10cSrcweir l.assure(b6.Equals(cobj.Args[6].Value)); 719*cdf0e10cSrcweir l.assure(b7.Equals(cobj.Args[7].Value)); 720*cdf0e10cSrcweir l.assure(b8.Equals(cobj.Args[8].Value)); 721*cdf0e10cSrcweir l.assure(b9.Equals(cobj.Args[9].Value)); 722*cdf0e10cSrcweir l.assure(b10.Equals(cobj.Args[10].Value)); 723*cdf0e10cSrcweir l.assure(b11.Equals(cobj.Args[11].Value)); 724*cdf0e10cSrcweir l.assure(b12.Equals(cobj.Args[12].Value)); 725*cdf0e10cSrcweir l.assure(b13.Equals(cobj.Args[13].Value)); 726*cdf0e10cSrcweir //Anys are not wrapped by the generated code 727*cdf0e10cSrcweir l.assure(b14.Equals(cobj.Args[14])); 728*cdf0e10cSrcweir l.assure(b15.Equals(cobj.Args[15].Value)); 729*cdf0e10cSrcweir l.assure(b16.Equals(cobj.Args[16].Value)); 730*cdf0e10cSrcweir l.assure(b17.Equals(cobj.Args[17].Value)); 731*cdf0e10cSrcweir l.assure(b18.Equals(cobj.Args[18].Value)); 732*cdf0e10cSrcweir l.assure(b19.Equals(cobj.Args[19].Value)); 733*cdf0e10cSrcweir l.assure(b20.Equals(cobj.Args[20].Value)); 734*cdf0e10cSrcweir l.assure(b21.Equals(cobj.Args[21].Value)); 735*cdf0e10cSrcweir l.assure(b22.Equals(cobj.Args[22].Value)); 736*cdf0e10cSrcweir l.assure(b23.Equals(cobj.Args[23].Value)); 737*cdf0e10cSrcweir l.assure(b24.Equals(cobj.Args[24].Value)); 738*cdf0e10cSrcweir l.assure(b25.Equals(cobj.Args[25].Value)); 739*cdf0e10cSrcweir l.assure(b26.Equals(cobj.Args[26].Value)); 740*cdf0e10cSrcweir l.assure(b27.Equals(cobj.Args[27].Value)); 741*cdf0e10cSrcweir l.assure(b28.Equals(cobj.Args[28].Value)); 742*cdf0e10cSrcweir l.assure(b29.Equals(cobj.Args[29].Value)); 743*cdf0e10cSrcweir l.assure(b30.Equals(cobj.Args[30].Value)); 744*cdf0e10cSrcweir l.assure(b31.Equals(cobj.Args[31].Value)); 745*cdf0e10cSrcweir l.assure(b32.Equals(cobj.Args[32].Value)); 746*cdf0e10cSrcweir l.assure(b33.Equals(cobj.Args[33].Value)); 747*cdf0e10cSrcweir //Anys are not wrapped by the generated code 748*cdf0e10cSrcweir l.assure(b34.Equals(cobj.Args[34])); 749*cdf0e10cSrcweir l.assure(b35.Equals(cobj.Args[35].Value)); 750*cdf0e10cSrcweir l.assure(b36.Equals(cobj.Args[36].Value)); 751*cdf0e10cSrcweir l.assure(b37.Equals(cobj.Args[37].Value)); 752*cdf0e10cSrcweir l.assure(b38.Equals(cobj.Args[38].Value)); 753*cdf0e10cSrcweir l.assure(b39.Equals(cobj.Args[39].Value)); 754*cdf0e10cSrcweir l.assure(b40.Equals(cobj.Args[40].Value)); 755*cdf0e10cSrcweir l.assure(b41.Equals(cobj.Args[41].Value)); 756*cdf0e10cSrcweir l.assure(b42.Equals(cobj.Args[42].Value)); 757*cdf0e10cSrcweir l.assure(b43.Equals(cobj.Args[43].Value)); 758*cdf0e10cSrcweir l.assure(b44.Equals(cobj.Args[44].Value)); 759*cdf0e10cSrcweir l.assure(b45.Equals(cobj.Args[45].Value)); 760*cdf0e10cSrcweir l.assure(b46.Equals(cobj.Args[46].Value)); 761*cdf0e10cSrcweir l.assure(b47.Equals(cobj.Args[47].Value)); 762*cdf0e10cSrcweir l.assure(b48.Equals(cobj.Args[48].Value)); 763*cdf0e10cSrcweir l.assure(b49.Equals(cobj.Args[49].Value)); 764*cdf0e10cSrcweir l.assure(b50.Equals(cobj.Args[50].Value)); 765*cdf0e10cSrcweir l.assure(b51.Equals(cobj.Args[51].Value)); 766*cdf0e10cSrcweir l.assure(b52.Equals(cobj.Args[52].Value)); 767*cdf0e10cSrcweir l.assure(b53.Equals(cobj.Args[53].Value)); 768*cdf0e10cSrcweir l.assure(b54.Equals(cobj.Args[54].Value)); 769*cdf0e10cSrcweir l.assure(b55.Equals(cobj.Args[55].Value)); 770*cdf0e10cSrcweir l.assure(b56.Equals(cobj.Args[56].Value)); 771*cdf0e10cSrcweir l.assure(b57.Equals(cobj.Args[57].Value)); 772*cdf0e10cSrcweir l.assure(b58.Equals(cobj.Args[58].Value)); 773*cdf0e10cSrcweir l.assure(b59.Equals(cobj.Args[59].Value)); 774*cdf0e10cSrcweir l.assure(b60.Equals(cobj.Args[60].Value)); 775*cdf0e10cSrcweir l.assure(b61.Equals(cobj.Args[61].Value)); 776*cdf0e10cSrcweir l.assure(b62.Equals(cobj.Args[62].Value)); 777*cdf0e10cSrcweir l.assure(b63.Equals(cobj.Args[63].Value)); 778*cdf0e10cSrcweir l.assure(b64.Equals(cobj.Args[64].Value)); 779*cdf0e10cSrcweir l.assure(b65.Equals(cobj.Args[65].Value)); 780*cdf0e10cSrcweir l.assure(b66.Equals(cobj.Args[66].Value)); 781*cdf0e10cSrcweir l.assure(b67.Equals(cobj.Args[67].Value)); 782*cdf0e10cSrcweir l.assure(b68.Equals(cobj.Args[68].Value)); 783*cdf0e10cSrcweir l.assure(b69.Equals(cobj.Args[69].Value)); 784*cdf0e10cSrcweir l.assure(b70.Equals(cobj.Args[70].Value)); 785*cdf0e10cSrcweir l.assure(b71.Equals(cobj.Args[71].Value)); 786*cdf0e10cSrcweir l.assure(b72.Equals(cobj.Args[72].Value)); 787*cdf0e10cSrcweir l.assure(b73.Equals(cobj.Args[73].Value)); 788*cdf0e10cSrcweir l.assure(b74.Equals(cobj.Args[74].Value)); 789*cdf0e10cSrcweir l.assure(b75.Equals(cobj.Args[75].Value)); 790*cdf0e10cSrcweir l.assure(b76.Equals(cobj.Args[76].Value)); 791*cdf0e10cSrcweir l.assure(b77.Equals(cobj.Args[77].Value)); 792*cdf0e10cSrcweir l.assure(b78.Equals(cobj.Args[78].Value)); 793*cdf0e10cSrcweir l.assure(b79.Equals(cobj.Args[79].Value)); 794*cdf0e10cSrcweir l.assure(b80.Equals(cobj.Args[80].Value)); 795*cdf0e10cSrcweir l.assure(b81.Equals(cobj.Args[81].Value)); 796*cdf0e10cSrcweir l.assure(b82.Equals(cobj.Args[82].Value)); 797*cdf0e10cSrcweir l.assure(b83.Equals(cobj.Args[83].Value)); 798*cdf0e10cSrcweir l.assure(b84.Equals(cobj.Args[84].Value)); 799*cdf0e10cSrcweir l.assure(b85.Equals(cobj.Args[85].Value)); 800*cdf0e10cSrcweir l.assure(b86.Equals(cobj.Args[86].Value)); 801*cdf0e10cSrcweir l.assure(b87.Equals(cobj.Args[87].Value)); 802*cdf0e10cSrcweir l.assure(b88.Equals(cobj.Args[88].Value)); 803*cdf0e10cSrcweir l.assure(b89.Equals(cobj.Args[89].Value)); 804*cdf0e10cSrcweir l.assure(b90.Equals(cobj.Args[90].Value)); 805*cdf0e10cSrcweir l.assure(b91.Equals(cobj.Args[91].Value)); 806*cdf0e10cSrcweir l.assure(b92.Equals(cobj.Args[92].Value)); 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir } catch (Exception) { 809*cdf0e10cSrcweir l.assure(false); 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir //test 813*cdf0e10cSrcweir c = new Context(Context.test_kind.NORMAL); 814*cdf0e10cSrcweir try { 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir PolyStruct2 arg1 = new PolyStruct2(typeof(PolyStruct2), 1); 817*cdf0e10cSrcweir PolyStruct2 arg2 = new PolyStruct2(new Any(true), 1); 818*cdf0e10cSrcweir PolyStruct2 arg3 = new PolyStruct2(true, 1); 819*cdf0e10cSrcweir PolyStruct2 arg4 = new PolyStruct2((Byte)8, 1); 820*cdf0e10cSrcweir PolyStruct2 arg5 = new PolyStruct2('c', 1); 821*cdf0e10cSrcweir PolyStruct2 arg6 = new PolyStruct2((Int16)10, 1); 822*cdf0e10cSrcweir PolyStruct2 arg7 = new PolyStruct2(11, 1); 823*cdf0e10cSrcweir PolyStruct2 arg8 = new PolyStruct2(12L, 1); 824*cdf0e10cSrcweir PolyStruct2 arg9 = new PolyStruct2("Hello", 1); 825*cdf0e10cSrcweir PolyStruct2 arg10 = new PolyStruct2(1.3, 1); 826*cdf0e10cSrcweir PolyStruct2 arg11 = new PolyStruct2(1.3d, 1); 827*cdf0e10cSrcweir PolyStruct2 arg12 = new PolyStruct2(new Object(), 1); 828*cdf0e10cSrcweir PolyStruct2 arg13 = new PolyStruct2(new uno.util.WeakComponentBase(), 1); 829*cdf0e10cSrcweir PolyStruct2 arg14 = new PolyStruct2( 830*cdf0e10cSrcweir new PolyStruct('A', 1), 1); 831*cdf0e10cSrcweir PolyStruct2 arg15 = new PolyStruct2( 832*cdf0e10cSrcweir new PolyStruct(new PolyStruct('A',1),1),1); 833*cdf0e10cSrcweir PolyStruct arg16 = new PolyStruct("Hallo", 1); 834*cdf0e10cSrcweir PolyStruct arg17 = new PolyStruct( 835*cdf0e10cSrcweir new PolyStruct('A',1),1); 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir Type[] arType = {typeof(PolyStruct), typeof(PolyStruct2)}; 838*cdf0e10cSrcweir PolyStruct2 arg101 = new PolyStruct2(arType,1); 839*cdf0e10cSrcweir PolyStruct2 arg102 = new PolyStruct2( 840*cdf0e10cSrcweir new Any[] {new Any(true)},1); 841*cdf0e10cSrcweir PolyStruct2 arg103 = new PolyStruct2(new bool[]{true}, 1); 842*cdf0e10cSrcweir PolyStruct2 arg104 = new PolyStruct2(new byte[] { (byte) 1}, 1); 843*cdf0e10cSrcweir PolyStruct2 arg105 = new PolyStruct2(new char[] {'\u1234', 'A'}, 1); 844*cdf0e10cSrcweir PolyStruct2 arg106 = new PolyStruct2(new short[] {(short)1}, 1); 845*cdf0e10cSrcweir PolyStruct2 arg107 = new PolyStruct2(new int[] {1}, 1); 846*cdf0e10cSrcweir PolyStruct2 arg108 = new PolyStruct2(new long[] {1}, 1); 847*cdf0e10cSrcweir PolyStruct2 arg109 = new PolyStruct2(new string[]{"Hallo"}, 1); 848*cdf0e10cSrcweir PolyStruct2 arg110 = new PolyStruct2(new float[]{1.3f}, 1); 849*cdf0e10cSrcweir PolyStruct2 arg111 = new PolyStruct2(new double[] {1.3d}, 1); 850*cdf0e10cSrcweir PolyStruct2 arg112 = new PolyStruct2( 851*cdf0e10cSrcweir new Object[] { new Object()}, 1); 852*cdf0e10cSrcweir PolyStruct2 arg113 = new PolyStruct2( 853*cdf0e10cSrcweir new uno.util.WeakComponentBase[] { 854*cdf0e10cSrcweir new uno.util.WeakComponentBase()}, 1); 855*cdf0e10cSrcweir PolyStruct2 arg114 = new PolyStruct2( 856*cdf0e10cSrcweir new PolyStruct[]{ 857*cdf0e10cSrcweir new PolyStruct('A',1)} ,1); 858*cdf0e10cSrcweir PolyStruct2 arg115 = new PolyStruct2( 859*cdf0e10cSrcweir new PolyStruct[] { 860*cdf0e10cSrcweir new PolyStruct( new PolyStruct2('A',1),1)} 861*cdf0e10cSrcweir ,1); 862*cdf0e10cSrcweir PolyStruct2 arg201 = new PolyStruct2(new char[][] { new char[]{'A'}, 863*cdf0e10cSrcweir new char[]{'B'}}, 1); 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir PolyStruct2[] arg301 = new PolyStruct2[] {new PolyStruct2('A', 1)}; 866*cdf0e10cSrcweir PolyStruct2[] arg302 = new PolyStruct2[] {new PolyStruct2( 867*cdf0e10cSrcweir new PolyStruct('A', 1), 1)}; 868*cdf0e10cSrcweir PolyStruct2[] arg303 = new PolyStruct2[] {new PolyStruct2( 869*cdf0e10cSrcweir new PolyStruct(new PolyStruct('A',1),1),1)}; 870*cdf0e10cSrcweir PolyStruct[] arg304 = new PolyStruct[] {new PolyStruct("Hallo", 1)}; 871*cdf0e10cSrcweir PolyStruct[] arg305 = new PolyStruct[] {new PolyStruct( 872*cdf0e10cSrcweir new PolyStruct('A',1),1)}; 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir PolyStruct2[][] arg401 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2('A', 1)}}; 875*cdf0e10cSrcweir PolyStruct2[][] arg402 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2( 876*cdf0e10cSrcweir new PolyStruct('A', 1), 1)}}; 877*cdf0e10cSrcweir PolyStruct2[][] arg403 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2( 878*cdf0e10cSrcweir new PolyStruct(new PolyStruct('A',1),1),1)}}; 879*cdf0e10cSrcweir PolyStruct[][] arg404 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct("Hallo", 1)}}; 880*cdf0e10cSrcweir PolyStruct[][] arg405 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct( 881*cdf0e10cSrcweir new PolyStruct('A',1),1)}}; 882*cdf0e10cSrcweir 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir XTest xTest = S1.create6(c, 885*cdf0e10cSrcweir arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10, 886*cdf0e10cSrcweir arg11,arg12,arg13,arg14,arg15,arg16,arg17, 887*cdf0e10cSrcweir arg101,arg102,arg103,arg104,arg105,arg106,arg107,arg108,arg109,arg110, 888*cdf0e10cSrcweir arg111,arg112,arg113,arg114,arg115, 889*cdf0e10cSrcweir arg201, 890*cdf0e10cSrcweir arg301, arg302, arg303, arg304, arg305, 891*cdf0e10cSrcweir arg401, arg402, arg403, arg404, arg405); 892*cdf0e10cSrcweir Component cobj = (Component) xTest; 893*cdf0e10cSrcweir l.assure(cobj.Args[0].Value == c); 894*cdf0e10cSrcweir //arg1 - arg17 895*cdf0e10cSrcweir string sType = ((PolymorphicType) cobj.Args[1].Type).PolymorphicName; 896*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type>"); 897*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[2].Type).PolymorphicName; 898*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any>"); 899*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[3].Type).PolymorphicName; 900*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean>"); 901*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[4].Type).PolymorphicName; 902*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte>"); 903*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[5].Type).PolymorphicName; 904*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>"); 905*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[6].Type).PolymorphicName; 906*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16>"); 907*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[7].Type).PolymorphicName; 908*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32>"); 909*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[8].Type).PolymorphicName; 910*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64>"); 911*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[9].Type).PolymorphicName; 912*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String>"); 913*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[10].Type).PolymorphicName; 914*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single>"); 915*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[11].Type).PolymorphicName; 916*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double>"); 917*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[12].Type).PolymorphicName; 918*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object>"); 919*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[13].Type).PolymorphicName; 920*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent>"); 921*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[14].Type).PolymorphicName; 922*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>"); 923*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[15].Type).PolymorphicName; 924*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 925*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 926*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 927*cdf0e10cSrcweir "System.Char,uno.Any>,System.String>>"); 928*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[16].Type).PolymorphicName; 929*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 930*cdf0e10cSrcweir "System.String,unoidl.test.cliure.climaker.PolyStruct<" + 931*cdf0e10cSrcweir "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" + 932*cdf0e10cSrcweir "uno.Any>>>"); 933*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[17].Type).PolymorphicName; 934*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 935*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," + 936*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>"); 937*cdf0e10cSrcweir //arg101 - arg115 938*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[18].Type).PolymorphicName; 939*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type[]>"); 940*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[19].Type).PolymorphicName; 941*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any[]>"); 942*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[20].Type).PolymorphicName; 943*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean[]>"); 944*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[21].Type).PolymorphicName; 945*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte[]>"); 946*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[22].Type).PolymorphicName; 947*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char[]>"); 948*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[23].Type).PolymorphicName; 949*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16[]>"); 950*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[24].Type).PolymorphicName; 951*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32[]>"); 952*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[25].Type).PolymorphicName; 953*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64[]>"); 954*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[26].Type).PolymorphicName; 955*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String[]>"); 956*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[27].Type).PolymorphicName; 957*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single[]>"); 958*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[28].Type).PolymorphicName; 959*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double[]>"); 960*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[29].Type).PolymorphicName; 961*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object[]>"); 962*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[30].Type).PolymorphicName; 963*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent[]>"); 964*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[31].Type).PolymorphicName; 965*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 966*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any[]>[]>"); 967*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[32].Type).PolymorphicName; 968*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 969*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 970*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct2<" + 971*cdf0e10cSrcweir "System.Char>,uno.Any[]>[]>"); 972*cdf0e10cSrcweir //arg 201 973*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[33].Type).PolymorphicName; 974*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 975*cdf0e10cSrcweir "System.Char[][]>"); 976*cdf0e10cSrcweir //arg 301 - arg305 977*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[34].Type).PolymorphicName; 978*cdf0e10cSrcweir l.assure (sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[]"); 979*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[35].Type).PolymorphicName; 980*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[]"); 981*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[36].Type).PolymorphicName; 982*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 983*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 984*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 985*cdf0e10cSrcweir "System.Char,uno.Any>,System.String>>[]"); 986*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[37].Type).PolymorphicName; 987*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 988*cdf0e10cSrcweir "System.String,unoidl.test.cliure.climaker.PolyStruct<" + 989*cdf0e10cSrcweir "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" + 990*cdf0e10cSrcweir "uno.Any>>>[]"); 991*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[38].Type).PolymorphicName; 992*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 993*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," + 994*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[]"); 995*cdf0e10cSrcweir //arg 401 - arg405 996*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[39].Type).PolymorphicName; 997*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[][]"); 998*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[40].Type).PolymorphicName; 999*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 1000*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[][]"); 1001*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[41].Type).PolymorphicName; 1002*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" + 1003*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 1004*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<" + 1005*cdf0e10cSrcweir "System.Char,uno.Any>,System.String>>[][]"); 1006*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[42].Type).PolymorphicName; 1007*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 1008*cdf0e10cSrcweir "System.String,unoidl.test.cliure.climaker.PolyStruct<" + 1009*cdf0e10cSrcweir "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" + 1010*cdf0e10cSrcweir "uno.Any>>>[][]"); 1011*cdf0e10cSrcweir sType = ((PolymorphicType) cobj.Args[43].Type).PolymorphicName; 1012*cdf0e10cSrcweir l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" + 1013*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," + 1014*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[][]"); 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir } 1020*cdf0e10cSrcweir catch (Exception) 1021*cdf0e10cSrcweir { 1022*cdf0e10cSrcweir l.assure(false); 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir void testSingletons(Logger l) 1027*cdf0e10cSrcweir { 1028*cdf0e10cSrcweir l.Function = "testSingletons"; 1029*cdf0e10cSrcweir Context c = new Context(Context.test_kind.NORMAL); 1030*cdf0e10cSrcweir try { 1031*cdf0e10cSrcweir XTest obj = S4.get(c); 1032*cdf0e10cSrcweir l.assure(obj != null); 1033*cdf0e10cSrcweir } catch (Exception) { 1034*cdf0e10cSrcweir l.assure(false); 1035*cdf0e10cSrcweir } 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir /** Case context fails to provide sigleton, a DeploymentException should be thrown. 1038*cdf0e10cSrcweir */ 1039*cdf0e10cSrcweir c = new Context(Context.test_kind.CREATION_FAILED); 1040*cdf0e10cSrcweir try { 1041*cdf0e10cSrcweir XTest obj = S4.get(c); 1042*cdf0e10cSrcweir l.assure(obj != null); 1043*cdf0e10cSrcweir } catch (ucss.uno.DeploymentException e) { 1044*cdf0e10cSrcweir Type t = typeof(unoidl.test.cliure.climaker.S4); 1045*cdf0e10cSrcweir l.assure( e.Message.IndexOf(t.FullName) != -1); 1046*cdf0e10cSrcweir } catch (System.Exception) { 1047*cdf0e10cSrcweir l.assure(false); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir void testAttributes(Logger l) 1052*cdf0e10cSrcweir { 1053*cdf0e10cSrcweir l.Function = "testAttributes"; 1054*cdf0e10cSrcweir //oneway attribute 1055*cdf0e10cSrcweir Type typeXTest = typeof(unoidl.test.cliure.climaker.XTest); 1056*cdf0e10cSrcweir object[] arAttr = typeXTest.GetMethod("testOneway").GetCustomAttributes(false); 1057*cdf0e10cSrcweir if (arAttr.Length == 1) 1058*cdf0e10cSrcweir l.assure(typeof(uno.OnewayAttribute).Equals(arAttr[0].GetType())); 1059*cdf0e10cSrcweir else 1060*cdf0e10cSrcweir l.assure(false); 1061*cdf0e10cSrcweir 1062*cdf0e10cSrcweir //test exceptions 1063*cdf0e10cSrcweir arAttr = typeXTest.GetMethod("testExceptions").GetCustomAttributes(false); 1064*cdf0e10cSrcweir if (arAttr.Length == 1 && arAttr[0].GetType() == typeof(uno.ExceptionAttribute)) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute; 1067*cdf0e10cSrcweir if (attr != null && attr.Raises.Length == 2) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.Exception)); 1070*cdf0e10cSrcweir l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException)); 1071*cdf0e10cSrcweir } 1072*cdf0e10cSrcweir else 1073*cdf0e10cSrcweir l.assure(false); 1074*cdf0e10cSrcweir } 1075*cdf0e10cSrcweir else 1076*cdf0e10cSrcweir l.assure(false); 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir //function test must not have the oneway attribute and Exception attribute 1079*cdf0e10cSrcweir arAttr = typeXTest.GetMethod("test").GetCustomAttributes(false); 1080*cdf0e10cSrcweir l.assure(arAttr.Length == 0); 1081*cdf0e10cSrcweir 1082*cdf0e10cSrcweir //test exceptions on service constructor methods 1083*cdf0e10cSrcweir Type typeS1 = typeof(unoidl.test.cliure.climaker.S1); 1084*cdf0e10cSrcweir arAttr = typeS1.GetMethod("create3").GetCustomAttributes(false); 1085*cdf0e10cSrcweir if (arAttr.Length == 1 && arAttr[0].GetType() == typeof(uno.ExceptionAttribute)) 1086*cdf0e10cSrcweir { 1087*cdf0e10cSrcweir uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute; 1088*cdf0e10cSrcweir if (attr != null && attr.Raises.Length == 4) 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.RuntimeException)); 1091*cdf0e10cSrcweir l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException)); 1092*cdf0e10cSrcweir l.assure(attr.Raises[2] == typeof(unoidl.com.sun.star.lang.IllegalAccessException)); 1093*cdf0e10cSrcweir l.assure(attr.Raises[3] == typeof(unoidl.com.sun.star.uno.DeploymentException)); 1094*cdf0e10cSrcweir } 1095*cdf0e10cSrcweir else 1096*cdf0e10cSrcweir l.assure(false); 1097*cdf0e10cSrcweir } 1098*cdf0e10cSrcweir else 1099*cdf0e10cSrcweir l.assure(false); 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir //create1 does not have exceptions 1102*cdf0e10cSrcweir arAttr = typeS1.GetMethod("create1").GetCustomAttributes(false); 1103*cdf0e10cSrcweir l.assure(arAttr.Length == 0); 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir //test exceptions of UNO interface attributes 1106*cdf0e10cSrcweir arAttr = typeXTest.GetProperty("A3").GetGetMethod().GetCustomAttributes(false); 1107*cdf0e10cSrcweir if (arAttr.Length == 1) 1108*cdf0e10cSrcweir { 1109*cdf0e10cSrcweir uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute; 1110*cdf0e10cSrcweir if (attr != null && attr.Raises.Length == 2) 1111*cdf0e10cSrcweir { 1112*cdf0e10cSrcweir l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.Exception)); 1113*cdf0e10cSrcweir l.assure(attr.Raises[1] == typeof(unoidl.com.sun.star.lang.ClassNotFoundException)); 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir else 1116*cdf0e10cSrcweir l.assure(false); 1117*cdf0e10cSrcweir } 1118*cdf0e10cSrcweir else 1119*cdf0e10cSrcweir l.assure(false); 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir arAttr = typeXTest.GetProperty("A3").GetSetMethod().GetCustomAttributes(false); 1122*cdf0e10cSrcweir if (arAttr.Length == 1) 1123*cdf0e10cSrcweir { 1124*cdf0e10cSrcweir uno.ExceptionAttribute attr = arAttr[0] as uno.ExceptionAttribute; 1125*cdf0e10cSrcweir if (attr != null && attr.Raises.Length == 1) 1126*cdf0e10cSrcweir l.assure(attr.Raises[0] == typeof(unoidl.com.sun.star.uno.RuntimeException)); 1127*cdf0e10cSrcweir else 1128*cdf0e10cSrcweir l.assure(false); 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir else 1131*cdf0e10cSrcweir l.assure(false); 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir //attribute A1 must have the ExceptionAttribute 1134*cdf0e10cSrcweir l.assure(typeXTest.GetProperty("A1").GetGetMethod().GetCustomAttributes(false).Length == 0); 1135*cdf0e10cSrcweir l.assure(typeXTest.GetProperty("A1").GetSetMethod().GetCustomAttributes(false).Length == 0); 1136*cdf0e10cSrcweir 1137*cdf0e10cSrcweir //Test BoundAttribute 1138*cdf0e10cSrcweir BoundAttribute bound = (BoundAttribute) Attribute.GetCustomAttribute( 1139*cdf0e10cSrcweir typeXTest.GetProperty("A1"), typeof(BoundAttribute)); 1140*cdf0e10cSrcweir l.assure(bound != null); 1141*cdf0e10cSrcweir 1142*cdf0e10cSrcweir bound = (BoundAttribute) Attribute.GetCustomAttribute( 1143*cdf0e10cSrcweir typeXTest.GetProperty("A3"), typeof(BoundAttribute)); 1144*cdf0e10cSrcweir l.assure(bound == null); 1145*cdf0e10cSrcweir } 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir void testPolyStructAttributes(Logger l) 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir l.Function = "testPolyStructAttributes"; 1150*cdf0e10cSrcweir //Test polymorphic struct 1151*cdf0e10cSrcweir Type typeStruct = typeof(unoidl.test.cliure.climaker.PolyStruct); 1152*cdf0e10cSrcweir object[] arAttr = typeStruct.GetCustomAttributes(false); 1153*cdf0e10cSrcweir if (arAttr.Length == 1) 1154*cdf0e10cSrcweir { 1155*cdf0e10cSrcweir try { 1156*cdf0e10cSrcweir uno.TypeParametersAttribute attr = (uno.TypeParametersAttribute) arAttr[0]; 1157*cdf0e10cSrcweir string[] arNames = new string[]{"if", "else"}; 1158*cdf0e10cSrcweir l.assure(attr != null && attr.Parameters.ToString().Equals(arNames.ToString())); 1159*cdf0e10cSrcweir }catch(Exception ) { 1160*cdf0e10cSrcweir l.assure(false); 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir else 1164*cdf0e10cSrcweir l.assure(false); 1165*cdf0e10cSrcweir l.assure(typeof(unoidl.test.cliure.climaker.Struct1).GetCustomAttributes(false).Length == 0); 1166*cdf0e10cSrcweir //member of a polymorphic struct with a parameterized type have also an attribute 1167*cdf0e10cSrcweir arAttr = typeStruct.GetField("member1").GetCustomAttributes(false); 1168*cdf0e10cSrcweir if (arAttr.Length == 1) 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir uno.ParameterizedTypeAttribute attr = arAttr[0] as uno.ParameterizedTypeAttribute; 1171*cdf0e10cSrcweir l.assure(attr != null && attr.Type == "if"); 1172*cdf0e10cSrcweir } 1173*cdf0e10cSrcweir else 1174*cdf0e10cSrcweir l.assure(false); 1175*cdf0e10cSrcweir 1176*cdf0e10cSrcweir 1177*cdf0e10cSrcweir //test instantiated polymorphic struct: return value 1178*cdf0e10cSrcweir // Type typeXTest = typeof(XTest); 1179*cdf0e10cSrcweir // arAttr = typeXTest.GetMethod("testPolyStruct").ReturnTypeCustomAttributes.GetCustomAttributes(false); 1180*cdf0e10cSrcweir // if (arAttr.Length == 1) 1181*cdf0e10cSrcweir // { 1182*cdf0e10cSrcweir // uno.TypeArgumentsAttribute attr = arAttr[0] as uno.TypeArgumentsAttribute; 1183*cdf0e10cSrcweir // l.assure(attr != null && attr.Arguments.Length == 2 1184*cdf0e10cSrcweir // &&attr.Arguments[0] == typeof(char) 1185*cdf0e10cSrcweir // && attr.Arguments[1] == typeof(int)); 1186*cdf0e10cSrcweir // } 1187*cdf0e10cSrcweir // else 1188*cdf0e10cSrcweir // l.assure(false); 1189*cdf0e10cSrcweir // arAttr = typeXTest.GetMethod("testPolyStruct").GetCustomAttributes(false); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir 1192*cdf0e10cSrcweir // private XComponentContext context; 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir void testPolymorphicType(Logger l) 1195*cdf0e10cSrcweir { 1196*cdf0e10cSrcweir l.Function = "testPolymorphicType"; 1197*cdf0e10cSrcweir string name = "unoidl.test.cliure.climaker.PolyStruct<System.Int32,System.Int32>"; 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir uno.PolymorphicType t1 = PolymorphicType.GetType( 1200*cdf0e10cSrcweir typeof(unoidl.test.cliure.climaker.PolyStruct), name); 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweir uno.PolymorphicType t2 = PolymorphicType.GetType( 1203*cdf0e10cSrcweir typeof(unoidl.test.cliure.climaker.PolyStruct ), name); 1204*cdf0e10cSrcweir 1205*cdf0e10cSrcweir l.assure(t1 == t2); 1206*cdf0e10cSrcweir l.assure(t1.PolymorphicName == name); 1207*cdf0e10cSrcweir l.assure(t1.OriginalType == typeof(unoidl.test.cliure.climaker.PolyStruct)); 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir void testInterface(Logger l) 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir l.Function = "testInterface"; 1214*cdf0e10cSrcweir try { 1215*cdf0e10cSrcweir Context c = new Context(Context.test_kind.NORMAL); 1216*cdf0e10cSrcweir XTest obj = S1.create1(c); 1217*cdf0e10cSrcweir bool aBool = true; 1218*cdf0e10cSrcweir byte aByte = 0xff; 1219*cdf0e10cSrcweir short aShort = 0x7fff; 1220*cdf0e10cSrcweir ushort aUShort = 0xffff; 1221*cdf0e10cSrcweir int aInt = 0x7fffffff; 1222*cdf0e10cSrcweir uint aUInt = 0xffffffff; 1223*cdf0e10cSrcweir long aLong = 0x7fffffffffffffff; 1224*cdf0e10cSrcweir ulong aULong = 0xffffffffffffffff; 1225*cdf0e10cSrcweir float aFloat = 0.314f; 1226*cdf0e10cSrcweir double aDouble = 0.314d; 1227*cdf0e10cSrcweir char aChar = 'A'; 1228*cdf0e10cSrcweir string aString = "Hello World"; 1229*cdf0e10cSrcweir Type aType = typeof(XTest); 1230*cdf0e10cSrcweir Any aAny = new Any(typeof(XTest), obj); 1231*cdf0e10cSrcweir Enum2 aEnum2 = Enum2.VALUE2; 1232*cdf0e10cSrcweir Struct1 aStruct1 = new Struct1(); 1233*cdf0e10cSrcweir object aXInterface = new object(); 1234*cdf0e10cSrcweir ucss.lang.XComponent aXComponent = (ucss.lang.XComponent) obj; 1235*cdf0e10cSrcweir bool[] aSeqBool = {true, false, true}; 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir obj.inParameters(aBool, aByte, aShort, aUShort, 1238*cdf0e10cSrcweir aInt, aUInt, aLong, aULong, 1239*cdf0e10cSrcweir aFloat, aDouble, aChar, aString, 1240*cdf0e10cSrcweir aType, aAny,aEnum2, aStruct1, 1241*cdf0e10cSrcweir aXInterface, aXComponent, aSeqBool); 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir bool outBool; 1244*cdf0e10cSrcweir byte outByte; 1245*cdf0e10cSrcweir short outShort; 1246*cdf0e10cSrcweir ushort outUShort; 1247*cdf0e10cSrcweir int outInt; 1248*cdf0e10cSrcweir uint outUInt; 1249*cdf0e10cSrcweir long outLong; 1250*cdf0e10cSrcweir ulong outULong; 1251*cdf0e10cSrcweir float outFloat; 1252*cdf0e10cSrcweir double outDouble; 1253*cdf0e10cSrcweir char outChar; 1254*cdf0e10cSrcweir string outString; 1255*cdf0e10cSrcweir Type outType; 1256*cdf0e10cSrcweir Any outAny; 1257*cdf0e10cSrcweir Enum2 outEnum2; 1258*cdf0e10cSrcweir Struct1 outStruct1; 1259*cdf0e10cSrcweir object outXInterface; 1260*cdf0e10cSrcweir ucss.lang.XComponent outXComponent; 1261*cdf0e10cSrcweir bool[] outSeqBool; 1262*cdf0e10cSrcweir 1263*cdf0e10cSrcweir obj.outParameters(out outBool, out outByte, out outShort, out outUShort, 1264*cdf0e10cSrcweir out outInt, out outUInt, out outLong, out outULong, 1265*cdf0e10cSrcweir out outFloat, out outDouble, out outChar, out outString, 1266*cdf0e10cSrcweir out outType, out outAny, out outEnum2, out outStruct1, 1267*cdf0e10cSrcweir out outXInterface, out outXComponent, out outSeqBool); 1268*cdf0e10cSrcweir 1269*cdf0e10cSrcweir l.assure(aBool == outBool); 1270*cdf0e10cSrcweir l.assure(aByte == outByte); 1271*cdf0e10cSrcweir l.assure(aShort == outShort); 1272*cdf0e10cSrcweir l.assure(aUShort == outUShort); 1273*cdf0e10cSrcweir l.assure(aInt == outInt); 1274*cdf0e10cSrcweir l.assure(aUInt == outUInt); 1275*cdf0e10cSrcweir l.assure(aLong == outLong); 1276*cdf0e10cSrcweir l.assure(aULong == outULong); 1277*cdf0e10cSrcweir l.assure(aFloat == outFloat); 1278*cdf0e10cSrcweir l.assure(aDouble == outDouble); 1279*cdf0e10cSrcweir l.assure(aChar == outChar); 1280*cdf0e10cSrcweir l.assure(aString == outString); 1281*cdf0e10cSrcweir l.assure(aType == outType); 1282*cdf0e10cSrcweir l.assure(aAny.Equals(outAny)); 1283*cdf0e10cSrcweir l.assure(aEnum2 == outEnum2); 1284*cdf0e10cSrcweir l.assure(aStruct1 == outStruct1); 1285*cdf0e10cSrcweir l.assure(aXInterface == outXInterface); 1286*cdf0e10cSrcweir l.assure(aXComponent == outXComponent); 1287*cdf0e10cSrcweir l.assure(aSeqBool == outSeqBool); 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir bool inoutBool = false;; 1290*cdf0e10cSrcweir byte inoutByte = 10; 1291*cdf0e10cSrcweir short inoutShort = 11; 1292*cdf0e10cSrcweir ushort inoutUShort = 12; 1293*cdf0e10cSrcweir int inoutInt = 13; 1294*cdf0e10cSrcweir uint inoutUInt = 14; 1295*cdf0e10cSrcweir long inoutLong = 15; 1296*cdf0e10cSrcweir ulong inoutULong = 16; 1297*cdf0e10cSrcweir float inoutFloat = 4.134f; 1298*cdf0e10cSrcweir double inoutDouble = 5.135; 1299*cdf0e10cSrcweir char inoutChar = 'B'; 1300*cdf0e10cSrcweir string inoutString = "Hello Hamburg"; 1301*cdf0e10cSrcweir Type inoutType = typeof(int); 1302*cdf0e10cSrcweir Any inoutAny = new Any(inoutInt); 1303*cdf0e10cSrcweir Enum2 inoutEnum2 = Enum2.VALUE4; 1304*cdf0e10cSrcweir Struct1 inoutStruct1 = new Struct1(); 1305*cdf0e10cSrcweir object inoutXInterface = new object(); 1306*cdf0e10cSrcweir ucss.lang.XComponent inoutXComponent = (ucss.lang.XComponent) S1.create1(c); 1307*cdf0e10cSrcweir bool[] inoutSeqBool = {false, true, false}; 1308*cdf0e10cSrcweir 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir obj.inoutParameters(ref inoutBool, ref inoutByte, ref inoutShort, ref inoutUShort, 1311*cdf0e10cSrcweir ref inoutInt, ref inoutUInt, ref inoutLong, ref inoutULong, 1312*cdf0e10cSrcweir ref inoutFloat, ref inoutDouble, ref inoutChar, ref inoutString, 1313*cdf0e10cSrcweir ref inoutType, ref inoutAny, ref inoutEnum2, ref inoutStruct1, 1314*cdf0e10cSrcweir ref inoutXInterface, ref inoutXComponent, ref inoutSeqBool); 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir l.assure(aBool == inoutBool); 1317*cdf0e10cSrcweir l.assure(aByte == inoutByte); 1318*cdf0e10cSrcweir l.assure(aShort == inoutShort); 1319*cdf0e10cSrcweir l.assure(aUShort == inoutUShort); 1320*cdf0e10cSrcweir l.assure(aInt == inoutInt); 1321*cdf0e10cSrcweir l.assure(aUInt == inoutUInt); 1322*cdf0e10cSrcweir l.assure(aLong == inoutLong); 1323*cdf0e10cSrcweir l.assure(aULong == inoutULong); 1324*cdf0e10cSrcweir l.assure(aFloat == inoutFloat); 1325*cdf0e10cSrcweir l.assure(aDouble == inoutDouble); 1326*cdf0e10cSrcweir l.assure(aChar == inoutChar); 1327*cdf0e10cSrcweir l.assure(aString == inoutString); 1328*cdf0e10cSrcweir l.assure(aType == inoutType); 1329*cdf0e10cSrcweir l.assure(aAny.Equals(inoutAny)); 1330*cdf0e10cSrcweir l.assure(aEnum2 == inoutEnum2); 1331*cdf0e10cSrcweir l.assure(aStruct1 == inoutStruct1); 1332*cdf0e10cSrcweir l.assure(aXInterface == inoutXInterface); 1333*cdf0e10cSrcweir l.assure(aXComponent == inoutXComponent); 1334*cdf0e10cSrcweir l.assure(aSeqBool == inoutSeqBool); 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir //now check the return values 1338*cdf0e10cSrcweir obj.inParameters(aBool, aByte, aShort, aUShort, 1339*cdf0e10cSrcweir aInt, aUInt, aLong, aULong, 1340*cdf0e10cSrcweir aFloat, aDouble, aChar, aString, 1341*cdf0e10cSrcweir aType, aAny,aEnum2, aStruct1, 1342*cdf0e10cSrcweir aXInterface, aXComponent, aSeqBool); 1343*cdf0e10cSrcweir 1344*cdf0e10cSrcweir l.assure(obj.retBoolean() == aBool); 1345*cdf0e10cSrcweir l.assure(obj.retByte() == aByte); 1346*cdf0e10cSrcweir l.assure(obj.retShort() == aShort); 1347*cdf0e10cSrcweir l.assure(obj.retUShort() == aUShort); 1348*cdf0e10cSrcweir l.assure(obj.retLong() == aInt); 1349*cdf0e10cSrcweir l.assure(obj.retULong() == aUInt); 1350*cdf0e10cSrcweir l.assure(obj.retHyper() == aLong); 1351*cdf0e10cSrcweir l.assure(obj.retUHyper() == aULong); 1352*cdf0e10cSrcweir l.assure(obj.retFloat() == aFloat); 1353*cdf0e10cSrcweir l.assure(obj.retDouble() == aDouble); 1354*cdf0e10cSrcweir l.assure(obj.retChar() == aChar); 1355*cdf0e10cSrcweir l.assure(obj.retString() == aString); 1356*cdf0e10cSrcweir l.assure(obj.retType() == aType); 1357*cdf0e10cSrcweir l.assure(obj.retAny().Equals(aAny)); 1358*cdf0e10cSrcweir l.assure(obj.retEnum() == aEnum2); 1359*cdf0e10cSrcweir l.assure(obj.retStruct1() == aStruct1); 1360*cdf0e10cSrcweir l.assure(obj.retXInterface() == aXInterface); 1361*cdf0e10cSrcweir l.assure(obj.retXComponent() == aXComponent); 1362*cdf0e10cSrcweir l.assure(obj.retSeqBool() == aSeqBool); 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir obj = S1.create1(c); 1366*cdf0e10cSrcweir obj.attrBoolean = true; 1367*cdf0e10cSrcweir l.assure(obj.attrBoolean == true); 1368*cdf0e10cSrcweir obj.attrByte = aByte; 1369*cdf0e10cSrcweir l.assure(obj.attrByte == aByte); 1370*cdf0e10cSrcweir obj.attrShort = aShort; 1371*cdf0e10cSrcweir l.assure(obj.attrShort == aShort); 1372*cdf0e10cSrcweir obj.attrUShort = aUShort; 1373*cdf0e10cSrcweir l.assure(obj.attrUShort == aUShort); 1374*cdf0e10cSrcweir obj.attrLong = aInt; 1375*cdf0e10cSrcweir l.assure(obj.attrLong == aInt); 1376*cdf0e10cSrcweir obj.attrULong = aUInt; 1377*cdf0e10cSrcweir l.assure(obj.attrULong == aUInt); 1378*cdf0e10cSrcweir obj.attrHyper = aLong; 1379*cdf0e10cSrcweir l.assure(obj.attrHyper == aLong); 1380*cdf0e10cSrcweir obj.attrUHyper = aULong; 1381*cdf0e10cSrcweir l.assure(obj.attrUHyper == aULong); 1382*cdf0e10cSrcweir obj.attrFloat = aFloat; 1383*cdf0e10cSrcweir l.assure(obj.attrFloat == aFloat); 1384*cdf0e10cSrcweir obj.attrDouble = aDouble; 1385*cdf0e10cSrcweir l.assure(obj.attrDouble == aDouble); 1386*cdf0e10cSrcweir obj.attrChar = aChar; 1387*cdf0e10cSrcweir l.assure(obj.attrChar == aChar); 1388*cdf0e10cSrcweir obj.attrString = aString; 1389*cdf0e10cSrcweir l.assure(obj.attrString == aString); 1390*cdf0e10cSrcweir obj.attrType = aType; 1391*cdf0e10cSrcweir l.assure(obj.attrType == aType); 1392*cdf0e10cSrcweir obj.attrAny = aAny; 1393*cdf0e10cSrcweir l.assure(obj.attrAny.Equals(aAny)); 1394*cdf0e10cSrcweir obj.attrEnum2 = aEnum2; 1395*cdf0e10cSrcweir l.assure(obj.attrEnum2 == aEnum2); 1396*cdf0e10cSrcweir obj.attrStruct1 = aStruct1; 1397*cdf0e10cSrcweir l.assure(obj.attrStruct1 == aStruct1); 1398*cdf0e10cSrcweir obj.attrXInterface = aXInterface; 1399*cdf0e10cSrcweir l.assure(obj.attrXInterface == aXInterface); 1400*cdf0e10cSrcweir obj.attrXComponent = aXComponent; 1401*cdf0e10cSrcweir l.assure(obj.attrXComponent == aXComponent); 1402*cdf0e10cSrcweir obj.attrSeqBoolean = aSeqBool; 1403*cdf0e10cSrcweir l.assure(obj.attrSeqBoolean == aSeqBool); 1404*cdf0e10cSrcweir } catch (Exception ) 1405*cdf0e10cSrcweir { 1406*cdf0e10cSrcweir l.assure(false); 1407*cdf0e10cSrcweir } 1408*cdf0e10cSrcweir } 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir public void testAny(Logger l) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir l.Function = "testAny"; 1413*cdf0e10cSrcweir //create any with valid and invalid arguments 1414*cdf0e10cSrcweir try 1415*cdf0e10cSrcweir { 1416*cdf0e10cSrcweir Any a = new Any(null, null); 1417*cdf0e10cSrcweir l.assure(false); 1418*cdf0e10cSrcweir } 1419*cdf0e10cSrcweir catch(System.Exception e) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir l.assure(e.Message.IndexOf("Any") != -1); 1422*cdf0e10cSrcweir } 1423*cdf0e10cSrcweir try 1424*cdf0e10cSrcweir { 1425*cdf0e10cSrcweir Any a = new Any(typeof(int), null); 1426*cdf0e10cSrcweir l.assure(false); 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir catch(System.Exception e) 1429*cdf0e10cSrcweir { 1430*cdf0e10cSrcweir l.assure(e.Message.IndexOf("Any") != -1); 1431*cdf0e10cSrcweir } 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir 1434*cdf0e10cSrcweir try 1435*cdf0e10cSrcweir { 1436*cdf0e10cSrcweir Any a = new Any(typeof(unoidl.com.sun.star.uno.XComponentContext), null); 1437*cdf0e10cSrcweir a = new Any('a'); 1438*cdf0e10cSrcweir a = new Any((sbyte)1); 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir catch (System.Exception) 1441*cdf0e10cSrcweir { 1442*cdf0e10cSrcweir l.assure(false); 1443*cdf0e10cSrcweir } 1444*cdf0e10cSrcweir 1445*cdf0e10cSrcweir //test polymorphic struct 1446*cdf0e10cSrcweir try 1447*cdf0e10cSrcweir { 1448*cdf0e10cSrcweir Any a = new Any(typeof(unoidl.test.cliure.climaker.PolyStruct), 1449*cdf0e10cSrcweir new PolyStruct()); 1450*cdf0e10cSrcweir l.assure(false); 1451*cdf0e10cSrcweir } 1452*cdf0e10cSrcweir catch (System.Exception e) 1453*cdf0e10cSrcweir { 1454*cdf0e10cSrcweir l.assure(e.Message.IndexOf("Any") != -1); 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir try 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir Any a = new Any(uno.PolymorphicType.GetType( 1459*cdf0e10cSrcweir typeof(unoidl.test.cliure.climaker.PolyStruct), 1460*cdf0e10cSrcweir "unoidl.test.cliure.climaker.PolyStruct<System.Char>"), 1461*cdf0e10cSrcweir new PolyStruct('A', 10)); 1462*cdf0e10cSrcweir } 1463*cdf0e10cSrcweir catch (System.Exception ) 1464*cdf0e10cSrcweir { 1465*cdf0e10cSrcweir l.assure(false); 1466*cdf0e10cSrcweir } 1467*cdf0e10cSrcweir 1468*cdf0e10cSrcweir //test Any.Equals 1469*cdf0e10cSrcweir 1470*cdf0e10cSrcweir Any aVoid = Any.VOID; 1471*cdf0e10cSrcweir l.assure(aVoid.Equals((object) Any.VOID)); 1472*cdf0e10cSrcweir l.assure(aVoid.Equals(Any.VOID)); 1473*cdf0e10cSrcweir 1474*cdf0e10cSrcweir l.assure(aVoid.Equals(new Any("")) == false); 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir Any a1 = new Any(10); 1477*cdf0e10cSrcweir Any a2 = a1; 1478*cdf0e10cSrcweir l.assure(a1.Equals(a2)); 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir a1 = new Any(typeof(unoidl.com.sun.star.uno.XComponentContext), null); 1481*cdf0e10cSrcweir l.assure(a1.Equals(a2) == false); 1482*cdf0e10cSrcweir a2 = a1; 1483*cdf0e10cSrcweir l.assure(a1.Equals(a2)); 1484*cdf0e10cSrcweir l.assure(a1.Equals(null) == false); 1485*cdf0e10cSrcweir l.assure(a1.Equals(new object()) == false); 1486*cdf0e10cSrcweir } 1487*cdf0e10cSrcweir } 1488