tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / lang / _XInitialization.java
blob5566aef0ceeaae77cffae3f7a05ddd2e03cfb317
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.lang;
21 import lib.MultiMethodTest;
23 import com.sun.star.lang.XInitialization;
25 /**
26 * Testing <code>com.sun.star.lang.XInitialization</code>
27 * interface methods. <p>
28 * This test needs the following object relations :
29 * <ul>
30 * <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>):
31 * (<b>Optional</b>) : argument for <code>initialize</code>
32 * method. If omitted zero length array is used. </li>
33 * <ul> <p>
34 * Test is multithread compliant. <p>
35 * Till the present time there was no need to recreate environment
36 * after this test completion.
38 public class _XInitialization extends MultiMethodTest {
40 public static XInitialization oObj = null;
42 /**
43 * Test calls the method with 0 length array and checks that
44 * no exceptions were thrown. <p>
45 * Has <b> OK </b> status if no exceptions were thrown. <p>
47 public void _initialize() {
48 boolean result = true ;
50 try {
51 XInitialization xInit = (XInitialization) tEnv.getObjRelation("XInitialization.xIni");
52 if (xInit == null) xInit = oObj;
54 log.println("calling method with valid arguments...");
55 Object[] args = (Object[]) tEnv.getObjRelation("XInitialization.args");
56 if (args==null) {
57 System.out.println("Using new Object[0] as Argument");
58 xInit.initialize(new Object[0]);
59 } else {
60 xInit.initialize(args);
63 // try to call the method with invalid parameters
64 Object[] ExArgs = (Object[]) tEnv.getObjRelation("XInitialization.ExceptionArgs");
65 if (ExArgs !=null) {
66 log.println("calling method with in-valid arguments...");
67 try{
68 result = false;
69 xInit.initialize(ExArgs);
70 } catch (com.sun.star.uno.Exception e) {
71 log.println("Expected Exception 'com.sun.star.uno.Exception' occurred -> OK") ;
72 result = true ;
73 } catch (com.sun.star.uno.RuntimeException e) {
74 log.println("Expected Exception 'com.sun.star.uno.RuntimeException' occurred -> OK") ;
75 result = true ;
76 } catch (Exception e) {
77 log.println("Un-Expected Exception occurred -> FALSE") ;
78 log.println(e.toString());
79 e.printStackTrace();
83 } catch (com.sun.star.uno.Exception e) {
84 log.println("Exception occurred while method calling.") ;
85 log.println(e) ;
86 result = false ;
89 tRes.tested("initialize()", result) ;
90 } // finished _initialize()
92 /**
93 * Disposes object environment.
95 @Override
96 public void after() {
97 disposeEnvironment() ;
100 } // finished class _XInitialization