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