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.ui.dialogs;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.ui.dialogs.XFilterManager;
29 
30 /**
31 * Testing <code>com.sun.star.ui.XFilterManager</code>
32 * interface methods :
33 * <ul>
34 *  <li><code> appendFilter()</code></li>
35 *  <li><code> setCurrentFilter()</code></li>
36 *  <li><code> getCurrentFilter()</code></li>
37 * </ul> <p>
38 * Test is <b> NOT </b> multithread compilant. <p>
39 * @see com.sun.star.ui.XFilterManager
40 */
41 public class _XFilterManager extends MultiMethodTest {
42 
43     public XFilterManager oObj = null;
44 
45     /**
46     * Appends a new filter (for extension 'txt'). <p>
47     * Has <b>OK</b> status if no runtime exceptions ocured.
48     */
_appendFilter()49     public void _appendFilter() {
50         boolean res = true;
51         try {
52             oObj.appendFilter("TestFilter", "txt");
53         } catch (com.sun.star.lang.IllegalArgumentException e) {
54             e.printStackTrace(log);
55             res=false;
56         }
57 
58         tRes.tested("appendFilter()", res) ;
59     }
60 
61     /**
62     * Sets the current filter to that which was appended before.<p>
63     * Has <b>OK</b> status if no exceptions occured, else one of
64     * <code>appendFilter</code> and <code>setCurrentFilter</code>
65     * methods failed. <p>
66     * The following method tests are to be completed successfully before :
67     * <ul>
68     *  <li> <code> appendFilter </code>  </li>
69     * </ul>
70     */
_setCurrentFilter()71     public void _setCurrentFilter() {
72         requiredMethod("appendFilter()") ;
73         boolean result = true;
74 
75         try {
76             oObj.setCurrentFilter("TestFilter") ;
77         } catch (com.sun.star.lang.IllegalArgumentException e) {
78             log.println("setCurrentFilter() or appendFilter() failed") ;
79             result = false ;
80         }
81 
82         tRes.tested("setCurrentFilter()", result) ;
83     }
84 
85     /**
86     * Gets current filter name and compares it filter name set before.<p>
87     * Has <b>OK</b> status if set and get filter names are equal.<p>
88     * The following method tests are to be completed successfully before :
89     * <ul>
90     *  <li> <code> setCurrentFilter </code> </li>
91     * </ul>
92     */
_getCurrentFilter()93     public void _getCurrentFilter() {
94         requiredMethod("setCurrentFilter()") ;
95 
96         String gVal = oObj.getCurrentFilter() ;
97 
98         tRes.tested("getCurrentFilter()", "TestFilter".equals(gVal)) ;
99     }
100 }
101 
102 
103