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.document; 25 26 27 import lib.MultiMethodTest; 28 29 import com.sun.star.document.XMimeTypeInfo; 30 import com.sun.star.lang.XComponent; 31 32 /** 33 * Testing <code>com.sun.star.document.XMimeTypeInfo</code> 34 * interface methods : 35 * <ul> 36 * <li><code> supportsMimeType()</code></li> 37 * <li><code> getSupportedMimeTypeNames()</code></li> 38 * </ul> <p> 39 * 40 * @see com.sun.star.document.XMimeTypeInfo 41 */ 42 public class _XMimeTypeInfo extends MultiMethodTest { 43 44 public XMimeTypeInfo oObj = null; 45 public XComponent source = null ; 46 public String[] smi = null; 47 48 /** 49 * Gets supported types and stores them. <p> 50 * Has <b> OK </b> status if at least one type exists. 51 */ _getSupportedMimeTypeNames()52 public void _getSupportedMimeTypeNames() { 53 smi = oObj.getSupportedMimeTypeNames(); 54 tRes.tested("getSupportedMimeTypeNames()", smi.length>0) ; 55 } 56 57 /** 58 * Calls the method for one supported type retrieved by 59 * <code>getSupportedMimeTypeNames</code> method and for 60 * bad type. <p> 61 * 62 * Has <b> OK </b> status if <code>true</code> returned for 63 * supported type and <code>false</code> for bad type. 64 * 65 * The following method tests are to be completed successfully before : 66 * <ul> 67 * <li> <code> getSupportedMimeTypeNames </code> : to have a list of 68 * supported types. </li> 69 * </ul> 70 */ _supportsMimeType()71 public void _supportsMimeType() { 72 requiredMethod("getSupportedMimeTypeNames()"); 73 boolean pos = false; 74 pos = oObj.supportsMimeType(smi[0]); 75 if (!pos) { 76 log.println("Method returns false for existing MimeType"); 77 } 78 boolean neg = true; 79 neg = oObj.supportsMimeType("NoRealMimeType"); 80 if (neg) { 81 log.println("Method returns true for non existing MimeType"); 82 } 83 tRes.tested("supportsMimeType()", (pos && !neg)) ; 84 } 85 } 86 87 88