1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.script.framework.provider; 25 26 import drafts.com.sun.star.script.framework.provider.XFunctionProvider; 27 import drafts.com.sun.star.script.framework.provider.XFunction; 28 29 import com.sun.star.uno.UnoRuntime; 30 import com.sun.star.lang.XMultiServiceFactory; 31 import com.sun.star.uno.XInterface; 32 import com.sun.star.ucb.XSimpleFileAccess; 33 import com.sun.star.uno.Exception; 34 import com.sun.star.beans.XPropertySet; 35 36 import java.io.PrintWriter; 37 import lib.MultiMethodTest; 38 import lib.StatusException; 39 import lib.Parameters; 40 41 import java.util.Collection; 42 import java.util.Iterator; 43 44 public class _XFunctionProvider extends MultiMethodTest { 45 46 public XFunctionProvider oObj = null; 47 48 /** 49 * Retrieves object relation. 50 */ before()51 public void before() throws StatusException { 52 } 53 _getFunction()54 public void _getFunction() { 55 boolean result = true; 56 57 Collection c = 58 (Collection) tEnv.getObjRelation("_getFunction"); 59 60 Iterator tests; 61 62 if (c != null) { 63 tests = c.iterator(); 64 65 while (tests.hasNext()) { 66 result &= runGetFunctionTest((Parameters)tests.next()); 67 } 68 } 69 else { 70 result = false; 71 } 72 73 tRes.tested("getFunction()", result); 74 } 75 runGetFunctionTest(Parameters testdata)76 private boolean runGetFunctionTest(Parameters testdata) { 77 String description = testdata.get("description"); 78 String logicalname = testdata.get("logicalname"); 79 String expected = testdata.get("expected"); 80 String output = ""; 81 82 log.println(testdata.get("description")); 83 84 XFunction function = oObj.getFunction(logicalname); 85 86 if (function == null) 87 output = "null"; 88 else 89 output = "XFunction.class"; 90 91 log.println("expected: " + expected + ", output: " + output); 92 if (output.equals(expected)) 93 return true; 94 else 95 return false; 96 } 97 } 98