1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.accessibility;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.accessibility.XAccessibleExtendedComponent;
33 import com.sun.star.awt.XFont;
34 
35 /**
36  * Testing <code>com.sun.star.accessibility.XAccessibleExtendedComponent</code>
37  * interface methods :
38  * <ul>
39  *  <li><code> getForeground()</code></li>
40  *  <li><code> getBackground()</code></li>
41  *  <li><code> getFont()</code></li>
42  *  <li><code> isEnabled()</code></li>
43  *  <li><code> getTitledBorderText()</code></li>
44  *  <li><code> getToolTipText()</code></li>
45  * </ul> <p>
46  * @see com.sun.star.accessibility.XAccessibleExtendedComponent
47  */
48 public class _XAccessibleExtendedComponent extends MultiMethodTest {
49 
50     public XAccessibleExtendedComponent oObj = null;
51 
52     /**
53      * Just calls the method.
54      * deprecated from version srx644g 29.10.02 on
55      *
56     public void _getForeground() {
57         int forColor = oObj.getForeground();
58         log.println("getForeground(): " + forColor);
59         tRes.tested("getForeground()", true);
60     }
61 
62     /**
63      * Just calls the method.
64      * deprecated from version srx644g 29.10.02 on
65      *
66     public void _getBackground() {
67         int backColor = oObj.getBackground();
68         log.println("getBackground(): " + backColor);
69         tRes.tested("getBackground()", true);
70     }
71 
72     /**
73      * Just calls the method.
74      */
75     public void _getFont() {
76         XFont font = oObj.getFont();
77         log.println("getFont(): " + font);
78         tRes.tested("getFont()", true);
79     }
80 
81     /**
82      * Calls the method and compares returned value with value that was
83      * returned by the method
84      * <code>XAccessibleStateSet.contains(AccessibleStateType.ENABLED)</code>.
85      * Has OK status if returned values are equal.
86      * deprecated from version srx644g 29.10.02 on
87      *
88     public void _isEnabled() {
89         boolean isEnabled = oObj.isEnabled();
90         log.println("isEnabled(): " + isEnabled);
91 
92         boolean res = true;
93 
94         XAccessibleStateSet accStateSet = (XAccessibleStateSet)
95             UnoRuntime.queryInterface(XAccessibleStateSet.class, oObj);
96 
97         if (accStateSet != null) {
98             res = accStateSet.contains(AccessibleStateType.ENABLED)==isEnabled;
99         }
100 
101         tRes.tested("isEnabled()", res);
102     }
103 
104     /**
105      * Calls the method and checks returned value.
106      * Has OK status if returned value isn't null.
107      */
108     public void _getTitledBorderText() {
109         String titleBorderText = oObj.getTitledBorderText();
110         log.println("getTitledBorderText(): '" + titleBorderText + "'");
111         tRes.tested("getTitledBorderText()", titleBorderText != null);
112     }
113 
114     /**
115      * Calls the method and checks returned value.
116      * Has OK status if returned value isn't null.
117      */
118     public void _getToolTipText() {
119         String toolTipText = oObj.getToolTipText();
120         log.println("getToolTipText(): '" + toolTipText + "'");
121         tRes.tested("getToolTipText()", toolTipText != null);
122     }
123 }