xref: /AOO41X/main/qadevOOo/tests/java/ifc/awt/tree/_XTreeControl.java (revision ef39d40d3f5e66cf3f035b3e93783012b340500d)
1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.awt.tree;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.awt.tree.ExpandVetoException;
27cdf0e10cSrcweir import com.sun.star.awt.tree.TreeExpansionEvent;
28cdf0e10cSrcweir import com.sun.star.awt.tree.XMutableTreeNode;
29cdf0e10cSrcweir import com.sun.star.awt.tree.XTreeControl;
30cdf0e10cSrcweir import com.sun.star.awt.tree.XTreeEditListener;
31cdf0e10cSrcweir import com.sun.star.awt.tree.XTreeExpansionListener;
32cdf0e10cSrcweir import com.sun.star.awt.tree.XTreeNode;
33cdf0e10cSrcweir import com.sun.star.lang.EventObject;
34cdf0e10cSrcweir import com.sun.star.util.VetoException;
35cdf0e10cSrcweir import lib.MultiMethodTest;
36cdf0e10cSrcweir import lib.Status;
37cdf0e10cSrcweir import lib.StatusException;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir /**
40cdf0e10cSrcweir  * Testing <code>com.sun.star.awt.tree.XTreeControl</code>
41cdf0e10cSrcweir  * interface methods :
42cdf0e10cSrcweir  * <ul>
43cdf0e10cSrcweir  *  <li><code> isNodeExpanded()</code></li>
44cdf0e10cSrcweir  *  <li><code> isNodeCollapsed()</code></li>
45cdf0e10cSrcweir  *  <li><code> makeNodeVisible()</code></li>
46cdf0e10cSrcweir  *  <li><code> isNodeVisible()</code></li>
47cdf0e10cSrcweir  *  <li><code> expandNode()</code></li>
48cdf0e10cSrcweir  *  <li><code> collapseNode()</code></li>
49cdf0e10cSrcweir  *  <li><code> addTreeExpansionListener()</code></li>
50cdf0e10cSrcweir  *  <li><code> removeTreeExpansionListener()</code></li>
51cdf0e10cSrcweir  *  <li><code> getNodeForLocation()</code></li>
52cdf0e10cSrcweir  *  <li><code> getClosestNodeForLocation()</code></li>
53cdf0e10cSrcweir  *  <li><code> isEditing()</code></li>
54cdf0e10cSrcweir  *  <li><code> stopEditing()</code></li>
55cdf0e10cSrcweir  *  <li><code> cancelEditing()</code></li>
56cdf0e10cSrcweir  *  <li><code> startEditingAtNode()</code></li>
57cdf0e10cSrcweir  *  <li><code> addTreeEditListener()</code></li>
58cdf0e10cSrcweir  *  <li><code> removeTreeEditListener()</code></li>
59cdf0e10cSrcweir  *  <li><code> DefaultExpandedGraphicURL()</code></li>
60cdf0e10cSrcweir  *  <li><code> DefaultCollapsedGraphicURL()</code></li>* </ul> <p>
61cdf0e10cSrcweir  * Test is <b> NOT </b> multithread compilant. <p>
62cdf0e10cSrcweir  *
63cdf0e10cSrcweir  * @see com.sun.star.awt.tree.XTreeControl
64cdf0e10cSrcweir  */
65cdf0e10cSrcweir public class _XTreeControl extends MultiMethodTest {
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     public XTreeControl oObj = null;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     private XMutableTreeNode mNewNode = null;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     private XMutableTreeNode mXNode = null;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     XTreeExpansionListener mTreeExpansionListener1 = new TreeExpansionListenerImpl1();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     XTreeExpansionListener mTreeExpansionListener2 = new TreeExpansionListenerImpl2();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     XTreeEditListener mTreeEditListener1 = new TreeEditListenerImpl1();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     XTreeEditListener mTreeEditListener2 = new TreeEditListenerImpl2();
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     boolean mTreeExpanded1 = false;
82cdf0e10cSrcweir     boolean mTreeExpanding1 = false;
83cdf0e10cSrcweir     boolean mTreeCollapsed1 = false;
84cdf0e10cSrcweir     boolean mTreeCollapsing1 = false;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     boolean mTreeExpanded2 = false;
87cdf0e10cSrcweir     boolean mTreeExpanding2 = false;
88cdf0e10cSrcweir     boolean mTreeCollapsed2 = false;
89cdf0e10cSrcweir     boolean mTreeCollapsing2 = false;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     boolean mTreeNodeEditing1 = false;
92cdf0e10cSrcweir     boolean mTreeNodeEdit1 = false;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     boolean mTreeNodeEditing2 = false;
95cdf0e10cSrcweir     boolean mTreeNodeEdit2 = false;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     public static interface XTreeDataModelListenerEvent{
fireEvent()98cdf0e10cSrcweir         public void fireEvent();
99cdf0e10cSrcweir     }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     public class TreeExpansionListenerImpl1 implements XTreeExpansionListener{
requestChildNodes(TreeExpansionEvent treeExpansionEvent)102cdf0e10cSrcweir         public void requestChildNodes(TreeExpansionEvent treeExpansionEvent) {
103cdf0e10cSrcweir             log.println("event at ExpansionListener 1: requestChildNodes");
104cdf0e10cSrcweir         }
105cdf0e10cSrcweir 
treeExpanding(TreeExpansionEvent treeExpansionEvent)106cdf0e10cSrcweir         public void treeExpanding(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException {
107cdf0e10cSrcweir             log.println("event at ExpansionListener 1: treeExpanding");
108cdf0e10cSrcweir             mTreeExpanding1 = true;
109cdf0e10cSrcweir         }
110cdf0e10cSrcweir 
treeCollapsing(TreeExpansionEvent treeExpansionEvent)111cdf0e10cSrcweir         public void treeCollapsing(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException {
112cdf0e10cSrcweir             log.println("event at ExpansionListener 1: treeCollapsing");
113cdf0e10cSrcweir             mTreeCollapsing1 = true;
114cdf0e10cSrcweir         }
115cdf0e10cSrcweir 
treeExpanded(TreeExpansionEvent treeExpansionEvent)116cdf0e10cSrcweir         public void treeExpanded(TreeExpansionEvent treeExpansionEvent) {
117cdf0e10cSrcweir             log.println("event at ExpansionListener 1: treeExpanded");
118cdf0e10cSrcweir             mTreeExpanded1 = true;
119cdf0e10cSrcweir         }
120cdf0e10cSrcweir 
treeCollapsed(TreeExpansionEvent treeExpansionEvent)121cdf0e10cSrcweir         public void treeCollapsed(TreeExpansionEvent treeExpansionEvent) {
122cdf0e10cSrcweir             log.println("event at ExpansionListener 1: treeCollapsed");
123cdf0e10cSrcweir             mTreeCollapsed1 = true;
124cdf0e10cSrcweir         }
125cdf0e10cSrcweir 
disposing(EventObject eventObject)126cdf0e10cSrcweir         public void disposing(EventObject eventObject) {
127cdf0e10cSrcweir             log.println("event at ExpansionListener 1: disposing");
128cdf0e10cSrcweir         }
129cdf0e10cSrcweir     }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     public class TreeExpansionListenerImpl2 implements XTreeExpansionListener{
requestChildNodes(TreeExpansionEvent treeExpansionEvent)132cdf0e10cSrcweir         public void requestChildNodes(TreeExpansionEvent treeExpansionEvent) {
133cdf0e10cSrcweir             log.println("event at ExpansionListener 2: requestChildNodes");
134cdf0e10cSrcweir         }
135cdf0e10cSrcweir 
treeExpanding(TreeExpansionEvent treeExpansionEvent)136cdf0e10cSrcweir         public void treeExpanding(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException {
137cdf0e10cSrcweir             log.println("event at ExpansionListener 2: treeExpanding");
138cdf0e10cSrcweir             mTreeExpanding2 = true;
139cdf0e10cSrcweir         }
140cdf0e10cSrcweir 
treeCollapsing(TreeExpansionEvent treeExpansionEvent)141cdf0e10cSrcweir         public void treeCollapsing(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException {
142cdf0e10cSrcweir             log.println("event at ExpansionListener 2: treeCollapsing");
143cdf0e10cSrcweir             mTreeCollapsing2 = true;
144cdf0e10cSrcweir         }
145cdf0e10cSrcweir 
treeExpanded(TreeExpansionEvent treeExpansionEvent)146cdf0e10cSrcweir         public void treeExpanded(TreeExpansionEvent treeExpansionEvent) {
147cdf0e10cSrcweir             log.println("event at ExpansionListener 2: treeExpanded");
148cdf0e10cSrcweir             mTreeExpanded2 = true;
149cdf0e10cSrcweir         }
150cdf0e10cSrcweir 
treeCollapsed(TreeExpansionEvent treeExpansionEvent)151cdf0e10cSrcweir         public void treeCollapsed(TreeExpansionEvent treeExpansionEvent) {
152cdf0e10cSrcweir             log.println("event at ExpansionListener 2: treeCollapsed");
153cdf0e10cSrcweir             mTreeCollapsed2 = true;
154cdf0e10cSrcweir         }
155cdf0e10cSrcweir 
disposing(EventObject eventObject)156cdf0e10cSrcweir         public void disposing(EventObject eventObject) {
157cdf0e10cSrcweir             log.println("event at ExpansionListener 2: disposing");
158cdf0e10cSrcweir         }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     public class TreeEditListenerImpl1 implements XTreeEditListener{
nodeEditing(XTreeNode xTreeNode)163cdf0e10cSrcweir         public void nodeEditing(XTreeNode xTreeNode) throws VetoException {
164cdf0e10cSrcweir             log.println("event at EditListener 1: nodeEditing");
165cdf0e10cSrcweir             mTreeNodeEditing1 = true;
166cdf0e10cSrcweir         }
167cdf0e10cSrcweir 
nodeEdited(XTreeNode xTreeNode, String string)168cdf0e10cSrcweir         public void nodeEdited(XTreeNode xTreeNode, String string) {
169cdf0e10cSrcweir             log.println("event at EditListener 1: nodeEdited");
170cdf0e10cSrcweir             mTreeNodeEdit1 = true;
171cdf0e10cSrcweir         }
172cdf0e10cSrcweir 
disposing(EventObject eventObject)173cdf0e10cSrcweir         public void disposing(EventObject eventObject) {
174cdf0e10cSrcweir             log.println("event at EditListener 1: disposing");
175cdf0e10cSrcweir         }
176cdf0e10cSrcweir     }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     public class TreeEditListenerImpl2 implements XTreeEditListener{
nodeEditing(XTreeNode xTreeNode)179cdf0e10cSrcweir         public void nodeEditing(XTreeNode xTreeNode) throws VetoException {
180cdf0e10cSrcweir             log.println("event at EditListener 2: nodeEditing");
181cdf0e10cSrcweir             mTreeNodeEditing2 = true;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         }
184cdf0e10cSrcweir 
nodeEdited(XTreeNode xTreeNode, String string)185cdf0e10cSrcweir         public void nodeEdited(XTreeNode xTreeNode, String string) {
186cdf0e10cSrcweir             log.println("event at EditListener 2: nodeEdited");
187cdf0e10cSrcweir             mTreeNodeEdit2 = true;
188cdf0e10cSrcweir         }
189cdf0e10cSrcweir 
disposing(EventObject eventObject)190cdf0e10cSrcweir         public void disposing(EventObject eventObject) {
191cdf0e10cSrcweir             log.println("event at EditListener 2: disposing");
192cdf0e10cSrcweir         }
193cdf0e10cSrcweir     }
194cdf0e10cSrcweir 
resetTreeExpandingListener()195cdf0e10cSrcweir     private void resetTreeExpandingListener(){
196cdf0e10cSrcweir         mTreeExpanded1 = false;
197cdf0e10cSrcweir         mTreeExpanded2 = false;
198cdf0e10cSrcweir         mTreeCollapsed1 = false;
199cdf0e10cSrcweir         mTreeCollapsed2 = false;
200cdf0e10cSrcweir         mTreeExpanding1 = false;
201cdf0e10cSrcweir         mTreeExpanding2 = false;
202cdf0e10cSrcweir         mTreeCollapsing1 = false;
203cdf0e10cSrcweir         mTreeCollapsing2 = false;
204cdf0e10cSrcweir     }
205cdf0e10cSrcweir 
resetEditListener()206cdf0e10cSrcweir     private void resetEditListener(){
207cdf0e10cSrcweir         mTreeNodeEditing1 = false;
208cdf0e10cSrcweir         mTreeNodeEdit1 = false;
209cdf0e10cSrcweir         mTreeNodeEditing2 = false;
210cdf0e10cSrcweir         mTreeNodeEdit2 = false;
211cdf0e10cSrcweir     }
212cdf0e10cSrcweir 
before()213cdf0e10cSrcweir     public void before(){
214cdf0e10cSrcweir         mXNode = (XMutableTreeNode) tEnv.getObjRelation("XTreeControl_Node");
215cdf0e10cSrcweir         if (mXNode == null) {
216cdf0e10cSrcweir             throw new StatusException(Status.failed("ERROR: could not get object relation 'XTreeControl_Node'"));
217cdf0e10cSrcweir         }
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir 
_isNodeExpanded()220cdf0e10cSrcweir     public void _isNodeExpanded() throws ExpandVetoException{
221cdf0e10cSrcweir 
222cdf0e10cSrcweir         boolean bOK = true;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir         boolean isExpanded = false;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir         try {
227cdf0e10cSrcweir             isExpanded = oObj.isNodeExpanded(mXNode);
228cdf0e10cSrcweir             log.println("node is expanded: " + isExpanded);
229cdf0e10cSrcweir 
230cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
231cdf0e10cSrcweir             bOK = false;
232cdf0e10cSrcweir             log.println("ERROR: could not query for 'isNodeExpanded()': " + ex.toString());
233cdf0e10cSrcweir         }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir         if (isExpanded)
236cdf0e10cSrcweir             try {
237cdf0e10cSrcweir 
238cdf0e10cSrcweir                 log.println("try to collapse node...");
239cdf0e10cSrcweir                 oObj.collapseNode(mXNode);
240cdf0e10cSrcweir 
241cdf0e10cSrcweir             } catch (ExpandVetoException ex) {
242cdf0e10cSrcweir                 bOK = false;
243cdf0e10cSrcweir                 log.println("ERROR: could not collapse node: " + ex.toString());
244cdf0e10cSrcweir             } catch (com.sun.star.lang.IllegalArgumentException ex) {
245cdf0e10cSrcweir                 bOK = false;
246cdf0e10cSrcweir                 log.println("ERROR: could not collapse node: " + ex.toString());
247cdf0e10cSrcweir             }
248cdf0e10cSrcweir         else
249cdf0e10cSrcweir             try {
250cdf0e10cSrcweir 
251cdf0e10cSrcweir                 log.println("try to expand node...");
252cdf0e10cSrcweir                 oObj.expandNode(mXNode);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir             } catch (ExpandVetoException ex) {
255cdf0e10cSrcweir                 bOK = false;
256cdf0e10cSrcweir                 log.println("ERROR: could not expand node: " + ex.toString());
257cdf0e10cSrcweir             } catch (com.sun.star.lang.IllegalArgumentException ex) {
258cdf0e10cSrcweir                 bOK = false;
259cdf0e10cSrcweir                 log.println("ERROR: could not expand node: " + ex.toString());
260cdf0e10cSrcweir             }
261cdf0e10cSrcweir 
262cdf0e10cSrcweir         try {
263cdf0e10cSrcweir 
264cdf0e10cSrcweir             boolean isAlsoExpanded = oObj.isNodeExpanded(mXNode);
265cdf0e10cSrcweir 
266cdf0e10cSrcweir             bOK &= (isExpanded != isAlsoExpanded);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir             log.println("node is expanded: " + isAlsoExpanded + " => " + bOK);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
271cdf0e10cSrcweir             bOK = false;
272cdf0e10cSrcweir             log.println("ERROR: could not query for 'isNodeExpanded()': " + ex.toString());
273cdf0e10cSrcweir         }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir         tRes.tested("isNodeExpanded()", bOK);
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     }
_isNodeCollapsed()278cdf0e10cSrcweir     public void _isNodeCollapsed(){
279cdf0e10cSrcweir 
280cdf0e10cSrcweir         boolean bOK = true;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         boolean isCollapsed = false;
283cdf0e10cSrcweir 
284cdf0e10cSrcweir         try {
285cdf0e10cSrcweir             isCollapsed = oObj.isNodeCollapsed(mXNode);
286cdf0e10cSrcweir             log.println("node is Collapsed: " + isCollapsed);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
289cdf0e10cSrcweir             bOK = false;
290cdf0e10cSrcweir             log.println("ERROR: could not query for 'isNodeCollapsed()': " + ex.toString());
291cdf0e10cSrcweir         }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir         if ( ! isCollapsed)
294cdf0e10cSrcweir             try {
295cdf0e10cSrcweir 
296cdf0e10cSrcweir                 log.println("try to collapse node...");
297cdf0e10cSrcweir                 oObj.collapseNode(mXNode);
298cdf0e10cSrcweir 
299cdf0e10cSrcweir             } catch (ExpandVetoException ex) {
300cdf0e10cSrcweir                 bOK = false;
301cdf0e10cSrcweir                 log.println("ERROR: could not collapse node: " + ex.toString());
302cdf0e10cSrcweir             } catch (com.sun.star.lang.IllegalArgumentException ex) {
303cdf0e10cSrcweir                 bOK = false;
304cdf0e10cSrcweir                 log.println("ERROR: could not collapse node: " + ex.toString());
305cdf0e10cSrcweir             }
306cdf0e10cSrcweir         else
307cdf0e10cSrcweir             try {
308cdf0e10cSrcweir 
309cdf0e10cSrcweir                 log.println("try to expand node...");
310cdf0e10cSrcweir                 oObj.expandNode(mXNode);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir             } catch (ExpandVetoException ex) {
313cdf0e10cSrcweir                 bOK = false;
314cdf0e10cSrcweir                 log.println("ERROR: could not expand node: " + ex.toString());
315cdf0e10cSrcweir             } catch (com.sun.star.lang.IllegalArgumentException ex) {
316cdf0e10cSrcweir                 bOK = false;
317cdf0e10cSrcweir                 log.println("ERROR: could not expand node: " + ex.toString());
318cdf0e10cSrcweir             }
319cdf0e10cSrcweir 
320cdf0e10cSrcweir         try {
321cdf0e10cSrcweir 
322cdf0e10cSrcweir             boolean isAlsoCollapsed = oObj.isNodeCollapsed(mXNode);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir             bOK &= (isCollapsed != isAlsoCollapsed);
325cdf0e10cSrcweir 
326cdf0e10cSrcweir             log.println("node is Collapsed: " + isAlsoCollapsed + " => " + bOK);
327cdf0e10cSrcweir 
328cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
329cdf0e10cSrcweir             bOK = false;
330cdf0e10cSrcweir             log.println("ERROR: could not query for 'isNodeCollapsed()': " + ex.toString());
331cdf0e10cSrcweir         }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir         tRes.tested("isNodeCollapsed()", bOK);
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     }
_makeNodeVisible()336cdf0e10cSrcweir     public void _makeNodeVisible(){
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         boolean bOK = true;
339cdf0e10cSrcweir         try {
340cdf0e10cSrcweir 
341cdf0e10cSrcweir             oObj.makeNodeVisible(mXNode);
342cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
343cdf0e10cSrcweir             bOK = false;
344cdf0e10cSrcweir             log.println("ERROR: could not call method 'makeNodeVisible()' successfully: " + ex.toString());
345cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
346cdf0e10cSrcweir             bOK = false;
347cdf0e10cSrcweir             log.println("ERROR: could not call method 'makeNodeVisible()' successfully: " + ex.toString());
348cdf0e10cSrcweir         }
349cdf0e10cSrcweir         try {
350cdf0e10cSrcweir 
351cdf0e10cSrcweir             bOK &= oObj.isNodeVisible(mXNode);
352cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
353cdf0e10cSrcweir             bOK = false;
354cdf0e10cSrcweir             log.println("ERROR: could not call method 'isNodeVisible()' successfully: " + ex.toString());
355cdf0e10cSrcweir         }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         tRes.tested("makeNodeVisible()", bOK);
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     }
_isNodeVisible()360cdf0e10cSrcweir     public void _isNodeVisible(){
361cdf0e10cSrcweir 
362cdf0e10cSrcweir         this.requiredMethod("makeNodeVisible()");
363cdf0e10cSrcweir 
364cdf0e10cSrcweir         boolean bOK = true;
365cdf0e10cSrcweir         log.println("since required method 'makeNodeVisible()' uses method 'isNodeVisible()' this test is ok.");
366cdf0e10cSrcweir         tRes.tested("isNodeVisible()", bOK);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     }
369cdf0e10cSrcweir 
_expandNode()370cdf0e10cSrcweir     public void _expandNode(){
371cdf0e10cSrcweir 
372cdf0e10cSrcweir         this.requiredMethod("isNodeExpanded()");
373cdf0e10cSrcweir 
374cdf0e10cSrcweir         boolean bOK = true;
375cdf0e10cSrcweir         log.println("since required method 'isnodeExpanded()' uses method 'expandNode()' this test is ok.");
376cdf0e10cSrcweir         tRes.tested("expandNode()", bOK);
377cdf0e10cSrcweir 
378cdf0e10cSrcweir     }
379cdf0e10cSrcweir 
_collapseNode()380cdf0e10cSrcweir     public void _collapseNode(){
381cdf0e10cSrcweir 
382cdf0e10cSrcweir         this.requiredMethod("isNodeCollapsed()");
383cdf0e10cSrcweir 
384cdf0e10cSrcweir         boolean bOK = true;
385cdf0e10cSrcweir         log.println("since required method 'isnodeCollapsed()' uses method 'expandNode()' this test is ok.");
386cdf0e10cSrcweir         tRes.tested("collapseNode()", bOK);
387cdf0e10cSrcweir 
388cdf0e10cSrcweir     }
389cdf0e10cSrcweir 
_addTreeExpansionListener()390cdf0e10cSrcweir     public void _addTreeExpansionListener(){
391cdf0e10cSrcweir 
392cdf0e10cSrcweir         boolean bOK = true;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir         log.println("collapse Node to get an initial status...");
395cdf0e10cSrcweir         try {
396cdf0e10cSrcweir 
397cdf0e10cSrcweir             oObj.collapseNode(mXNode);
398cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
399cdf0e10cSrcweir             bOK = false;
400cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
401cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
402cdf0e10cSrcweir             bOK = false;
403cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
404cdf0e10cSrcweir         }
405cdf0e10cSrcweir 
406cdf0e10cSrcweir         log.println("add mTreeExpansionListener1...");
407cdf0e10cSrcweir         oObj.addTreeExpansionListener(mTreeExpansionListener1);
408cdf0e10cSrcweir 
409cdf0e10cSrcweir         log.println("add mTreeExpansionListener2");
410cdf0e10cSrcweir         oObj.addTreeExpansionListener(mTreeExpansionListener2);
411cdf0e10cSrcweir 
412cdf0e10cSrcweir         resetTreeExpandingListener();
413cdf0e10cSrcweir 
414cdf0e10cSrcweir         log.println("expand Node...");
415cdf0e10cSrcweir         try {
416cdf0e10cSrcweir 
417cdf0e10cSrcweir             oObj.expandNode(mXNode);
418cdf0e10cSrcweir 
419cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
420cdf0e10cSrcweir             bOK = false;
421cdf0e10cSrcweir             log.println("ERROR: could not expand node: " + ex.toString());
422cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
423cdf0e10cSrcweir             bOK = false;
424cdf0e10cSrcweir             log.println("ERROR: could not expand node: " + ex.toString());
425cdf0e10cSrcweir         }
426cdf0e10cSrcweir 
427cdf0e10cSrcweir         bOK &= mTreeExpanded1  & mTreeExpanded2  & ! mTreeCollapsed1  & ! mTreeCollapsed2
428cdf0e10cSrcweir              & mTreeExpanding1 & mTreeExpanding2 & ! mTreeCollapsing1 & ! mTreeCollapsing2;
429cdf0e10cSrcweir 
430cdf0e10cSrcweir         resetTreeExpandingListener();
431cdf0e10cSrcweir 
432cdf0e10cSrcweir         log.println("collapse Node...");
433cdf0e10cSrcweir         try {
434cdf0e10cSrcweir 
435cdf0e10cSrcweir             oObj.collapseNode(mXNode);
436cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
437cdf0e10cSrcweir             bOK = false;
438cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
439cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
440cdf0e10cSrcweir             bOK = false;
441cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
442cdf0e10cSrcweir         }
443cdf0e10cSrcweir 
444cdf0e10cSrcweir         bOK &= ! mTreeExpanded1  & ! mTreeExpanded2  & mTreeCollapsed1  & mTreeCollapsed2
445cdf0e10cSrcweir              & ! mTreeExpanding1 & ! mTreeExpanding2 & mTreeCollapsing1 & mTreeCollapsing2;
446cdf0e10cSrcweir 
447cdf0e10cSrcweir         tRes.tested("addTreeExpansionListener()", bOK);
448cdf0e10cSrcweir 
449cdf0e10cSrcweir     }
450cdf0e10cSrcweir 
_removeTreeExpansionListener()451cdf0e10cSrcweir     public void _removeTreeExpansionListener(){
452cdf0e10cSrcweir 
453cdf0e10cSrcweir         this.requiredMethod("addTreeExpansionListener()");
454cdf0e10cSrcweir 
455cdf0e10cSrcweir         boolean bOK = true;
456cdf0e10cSrcweir 
457cdf0e10cSrcweir         log.println("collapse Node to get an initial status...");
458cdf0e10cSrcweir         try {
459cdf0e10cSrcweir 
460cdf0e10cSrcweir             oObj.collapseNode(mXNode);
461cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
462cdf0e10cSrcweir             bOK = false;
463cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
464cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
465cdf0e10cSrcweir             bOK = false;
466cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
467cdf0e10cSrcweir         }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir         resetTreeExpandingListener();
470cdf0e10cSrcweir 
471cdf0e10cSrcweir         log.println("remove mTreeExpansionListener2 ...");
472cdf0e10cSrcweir         oObj.removeTreeExpansionListener(mTreeExpansionListener2);
473cdf0e10cSrcweir 
474cdf0e10cSrcweir         log.println("expand Node...");
475cdf0e10cSrcweir         try {
476cdf0e10cSrcweir 
477cdf0e10cSrcweir             oObj.expandNode(mXNode);
478cdf0e10cSrcweir 
479cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
480cdf0e10cSrcweir             bOK = false;
481cdf0e10cSrcweir             log.println("ERROR: could not expand node: " + ex.toString());
482cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
483cdf0e10cSrcweir             bOK = false;
484cdf0e10cSrcweir             log.println("ERROR: could not expand node: " + ex.toString());
485cdf0e10cSrcweir         }
486cdf0e10cSrcweir 
487cdf0e10cSrcweir         bOK &= mTreeExpanded1  & ! mTreeExpanded2  & ! mTreeCollapsed1  & ! mTreeCollapsed2
488cdf0e10cSrcweir              & mTreeExpanding1 & ! mTreeExpanding2 & ! mTreeCollapsing1 & ! mTreeCollapsing2;
489cdf0e10cSrcweir 
490cdf0e10cSrcweir         resetTreeExpandingListener();
491cdf0e10cSrcweir 
492cdf0e10cSrcweir         log.println("collapse Node...");
493cdf0e10cSrcweir         try {
494cdf0e10cSrcweir 
495cdf0e10cSrcweir             oObj.collapseNode(mXNode);
496cdf0e10cSrcweir         } catch (ExpandVetoException ex) {
497cdf0e10cSrcweir             bOK = false;
498cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
499cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
500cdf0e10cSrcweir             bOK = false;
501cdf0e10cSrcweir             log.println("ERROR: could not collapse node: " + ex.toString());
502cdf0e10cSrcweir         }
503cdf0e10cSrcweir 
504cdf0e10cSrcweir         bOK &= ! mTreeExpanded1  & ! mTreeExpanded2  & mTreeCollapsed1  & ! mTreeCollapsed2
505cdf0e10cSrcweir              & ! mTreeExpanding1 & ! mTreeExpanding2 & mTreeCollapsing1 & ! mTreeCollapsing2;
506cdf0e10cSrcweir 
507cdf0e10cSrcweir         log.println("remove mTreeExpansionListener2 ...");
508cdf0e10cSrcweir         oObj.removeTreeExpansionListener(mTreeExpansionListener2);
509cdf0e10cSrcweir 
510cdf0e10cSrcweir         tRes.tested("removeTreeExpansionListener()", bOK);
511cdf0e10cSrcweir 
512cdf0e10cSrcweir     }
513cdf0e10cSrcweir 
_getNodeForLocation()514cdf0e10cSrcweir     public void _getNodeForLocation(){
515cdf0e10cSrcweir 
516cdf0e10cSrcweir         boolean bOK = false;
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 
519cdf0e10cSrcweir         tRes.tested("getNodeForLocation()", bOK);
520cdf0e10cSrcweir 
521cdf0e10cSrcweir     }
522cdf0e10cSrcweir 
_getClosestNodeForLocation()523cdf0e10cSrcweir     public void _getClosestNodeForLocation(){
524cdf0e10cSrcweir 
525cdf0e10cSrcweir         boolean bOK = false;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir         log.println("try to get Node for location 100,100");
528cdf0e10cSrcweir         XTreeNode myNode = oObj.getClosestNodeForLocation(100,100);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir         bOK &= (myNode != null);
531cdf0e10cSrcweir 
532cdf0e10cSrcweir         tRes.tested("getClosestNodeForLocation()", bOK);
533cdf0e10cSrcweir 
534cdf0e10cSrcweir     }
535cdf0e10cSrcweir 
_isEditing()536cdf0e10cSrcweir     public void _isEditing(){
537cdf0e10cSrcweir 
538cdf0e10cSrcweir         boolean bOK = false;
539cdf0e10cSrcweir 
540cdf0e10cSrcweir         log.println("not ready because of i78701");
541cdf0e10cSrcweir 
542cdf0e10cSrcweir         tRes.tested("isEditing()", bOK);
543cdf0e10cSrcweir 
544cdf0e10cSrcweir     }
545cdf0e10cSrcweir 
_stopEditing()546cdf0e10cSrcweir     public void _stopEditing(){
547cdf0e10cSrcweir 
548cdf0e10cSrcweir         boolean bOK = false;
549cdf0e10cSrcweir         log.println("not ready because of i78701");
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 
552cdf0e10cSrcweir         tRes.tested("stopEditing()", bOK);
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     }
555cdf0e10cSrcweir 
_cancelEditing()556cdf0e10cSrcweir     public void _cancelEditing(){
557cdf0e10cSrcweir 
558cdf0e10cSrcweir         boolean bOK = false;
559cdf0e10cSrcweir 
560cdf0e10cSrcweir         log.println("not ready because of i78701");
561cdf0e10cSrcweir 
562cdf0e10cSrcweir         tRes.tested("cancelEditing()", bOK);
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     }
565cdf0e10cSrcweir 
_startEditingAtNode()566cdf0e10cSrcweir     public void _startEditingAtNode(){
567cdf0e10cSrcweir 
568cdf0e10cSrcweir         boolean bOK = false;
569cdf0e10cSrcweir 
570cdf0e10cSrcweir         log.println("not ready because of i78701");
571cdf0e10cSrcweir 
572cdf0e10cSrcweir         tRes.tested("startEditingAtNode()", bOK);
573cdf0e10cSrcweir 
574cdf0e10cSrcweir     }
575cdf0e10cSrcweir 
_addTreeEditListener()576cdf0e10cSrcweir     public void _addTreeEditListener(){
577cdf0e10cSrcweir 
578cdf0e10cSrcweir         boolean bOK = true;
579cdf0e10cSrcweir 
580cdf0e10cSrcweir         log.println("add EditListener 1....");
581cdf0e10cSrcweir         oObj.addTreeEditListener(mTreeEditListener1);
582cdf0e10cSrcweir 
583cdf0e10cSrcweir         log.println("add EditListener 2....");
584cdf0e10cSrcweir         oObj.addTreeEditListener(mTreeEditListener2);
585cdf0e10cSrcweir 
586cdf0e10cSrcweir         resetEditListener();
587cdf0e10cSrcweir 
588cdf0e10cSrcweir         try {
589cdf0e10cSrcweir 
590cdf0e10cSrcweir             oObj.startEditingAtNode(mXNode);
591cdf0e10cSrcweir         } catch (com.sun.star.lang.IllegalArgumentException ex) {
592cdf0e10cSrcweir             log.println("ERROR: could not start editing at node: " + ex.toString());
593cdf0e10cSrcweir             bOK = false;
594cdf0e10cSrcweir         }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir         log.println("not ready because of i78701");
597cdf0e10cSrcweir         bOK = false;
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 
600cdf0e10cSrcweir         tRes.tested("addTreeEditListener()", bOK);
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     }
603cdf0e10cSrcweir 
_removeTreeEditListener()604cdf0e10cSrcweir     public void _removeTreeEditListener(){
605cdf0e10cSrcweir 
606cdf0e10cSrcweir         boolean bOK = false;
607cdf0e10cSrcweir 
608cdf0e10cSrcweir         log.println("not ready because of i78701");
609cdf0e10cSrcweir 
610cdf0e10cSrcweir         tRes.tested("removeTreeEditListener()", bOK);
611cdf0e10cSrcweir 
612cdf0e10cSrcweir     }
613cdf0e10cSrcweir 
_DefaultExpandedGraphicURL()614cdf0e10cSrcweir     public void _DefaultExpandedGraphicURL(){
615cdf0e10cSrcweir 
616cdf0e10cSrcweir         boolean bOK = true;
617cdf0e10cSrcweir 
618cdf0e10cSrcweir         String current = oObj.getDefaultExpandedGraphicURL();
619cdf0e10cSrcweir         log.println("current DefaultExpandedGraphicURL: " + current);
620cdf0e10cSrcweir 
621cdf0e10cSrcweir         String changeUrl = null;
622cdf0e10cSrcweir 
623cdf0e10cSrcweir         if (current.equals("private:graphicrepository/sd/res/triangle_right.png"))
624cdf0e10cSrcweir              changeUrl = "private:graphicrepository/sd/res/triangle_down.png";
625cdf0e10cSrcweir         else changeUrl = "private:graphicrepository/sd/res/triangle_right.png";
626cdf0e10cSrcweir 
627cdf0e10cSrcweir         log.println("try to set '" + changeUrl + "' as new DefaultExpandedGraphicURL");
628cdf0e10cSrcweir 
629cdf0e10cSrcweir         oObj.setDefaultExpandedGraphicURL(changeUrl);
630cdf0e10cSrcweir 
631cdf0e10cSrcweir         String newUrl = oObj.getDefaultExpandedGraphicURL();
632cdf0e10cSrcweir 
633cdf0e10cSrcweir         log.println("new DefaultExpandedGraphicURL: " + newUrl);
634cdf0e10cSrcweir 
635cdf0e10cSrcweir         bOK &= ! newUrl.equals(current);
636cdf0e10cSrcweir 
637cdf0e10cSrcweir         tRes.tested("DefaultExpandedGraphicURL()", bOK);
638cdf0e10cSrcweir 
639cdf0e10cSrcweir     }
640cdf0e10cSrcweir 
_DefaultCollapsedGraphicURL()641cdf0e10cSrcweir     public void _DefaultCollapsedGraphicURL(){
642cdf0e10cSrcweir 
643cdf0e10cSrcweir         boolean bOK = true;
644cdf0e10cSrcweir 
645cdf0e10cSrcweir         String current = oObj.getDefaultCollapsedGraphicURL();
646cdf0e10cSrcweir         log.println("current DefaultCollapsedGraphicURL: " + current);
647cdf0e10cSrcweir 
648cdf0e10cSrcweir         String changeUrl = null;
649cdf0e10cSrcweir 
650cdf0e10cSrcweir         if (current.equals("private:graphicrepository/sd/res/triangle_right.png"))
651cdf0e10cSrcweir              changeUrl = "private:graphicrepository/sd/res/triangle_down.png";
652cdf0e10cSrcweir         else changeUrl = "private:graphicrepository/sd/res/triangle_right.png";
653cdf0e10cSrcweir 
654cdf0e10cSrcweir         log.println("try to set '" + changeUrl + "' as new DefaultCollapsedGraphicURL");
655cdf0e10cSrcweir         oObj.setDefaultCollapsedGraphicURL(changeUrl);
656cdf0e10cSrcweir 
657cdf0e10cSrcweir         String newUrl = oObj.getDefaultCollapsedGraphicURL();
658cdf0e10cSrcweir 
659cdf0e10cSrcweir         log.println("new DefaultCollapsedGraphicURL: " + newUrl);
660cdf0e10cSrcweir 
661cdf0e10cSrcweir         bOK &= ! newUrl.equals(current);
662cdf0e10cSrcweir 
663cdf0e10cSrcweir         tRes.tested("DefaultCollapsedGraphicURL()", bOK);
664cdf0e10cSrcweir     }
665cdf0e10cSrcweir }
666cdf0e10cSrcweir 
667cdf0e10cSrcweir 
668