| 1 |
/* |
| 2 |
* This file is part of the LibreOffice project. |
| 3 |
* |
| 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/. |
| 7 |
* |
| 8 |
* This file incorporates work covered by the following license notice: |
| 9 |
* |
| 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 . |
| 17 |
*/ |
| 18 |
|
| 19 |
package complex.imageManager; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
import com.sun.star.lang.XInitialization; |
| 25 |
import lib.TestParameters; |
| 26 |
|
| 27 |
/** |
| 28 |
* Testing <code>com.sun.star.lang.XInitialization</code> |
| 29 |
* interface methods. <p> |
| 30 |
* This test needs the following object relations : |
| 31 |
* <ul> |
| 32 |
* <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>): |
| 33 |
* (<b>Optional</b>) : argument for <code>initialize</code> |
| 34 |
* method. If omitted, zero length array is used. </li> |
| 35 |
* <ul> <p> |
| 36 |
* Test is multithread compliant. <p> |
| 37 |
* Till the present time there was no need to recreate environment |
| 38 |
* after this test completion. |
| 39 |
*/ |
| 40 |
public class _XInitialization { |
| 41 |
|
| 42 |
|
| 43 |
private final TestParameters tEnv; |
| 44 |
private XInitialization oObj = null; |
| 45 |
|
| 46 |
public _XInitialization(TestParameters tEnv, XInitialization oObj) { |
| 47 |
|
| 48 |
this.tEnv = tEnv; |
| 49 |
this.oObj = oObj; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Test calls the method with 0 length array and checks that |
| 54 |
* no exceptions were thrown. <p> |
| 55 |
* Has <b> OK </b> status if no exceptions were thrown. <p> |
| 56 |
*/ |
| 57 |
public boolean _initialize() { |
| 58 |
boolean result = true ; |
| 59 |
|
| 60 |
try { |
| 61 |
Object[] args = (Object[]) tEnv.get("XInitialization.args"); |
| 62 |
if (args==null) { |
| 63 |
oObj.initialize(new Object[0]); |
| 64 |
} else { |
| 65 |
oObj.initialize(args); |
| 66 |
} |
| 67 |
|
| 68 |
} catch (com.sun.star.uno.Exception e) { |
| 69 |
System.out.println("Exception occurred while method calling.") ; |
| 70 |
result = false ; |
| 71 |
} |
| 72 |
|
| 73 |
return result ; |
| 74 |
} // finished _initialize() |
| 75 |
|
| 76 |
} // finished class _XInitialization |
| 77 |
|
| 78 |
|