xref: /AOO41X/main/qadevOOo/tests/java/ifc/awt/_XDataTransferProviderAccess.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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.awt;
29 
30 
31 import lib.MultiMethodTest;
32 import lib.Status;
33 import lib.StatusException;
34 
35 import com.sun.star.awt.XDataTransferProviderAccess;
36 import com.sun.star.awt.XWindow;
37 import com.sun.star.datatransfer.clipboard.XClipboard;
38 import com.sun.star.datatransfer.dnd.XDragGestureRecognizer;
39 import com.sun.star.datatransfer.dnd.XDragSource;
40 import com.sun.star.datatransfer.dnd.XDropTarget;
41 
42 /**
43 * Testing <code>com.sun.star.awt.XDataTransferProviderAccess</code>
44 * interface methods :
45 * <ul>
46 *  <li><code> getDragGestureRecognizer()</code></li>
47 *  <li><code> getDragSource()</code></li>
48 *  <li><code> getDropTarget()</code></li>
49 *  <li><code> getClipboard()</code></li>
50 * </ul> <p>
51 * This test needs the following object relations :
52 * <ul>
53 *  <li> <code>'XDataTransferProviderAccess.XWindow'</code>
54 *  (of type <code>com.sun.star.awt.XWindow</code>):
55 *   this window must created by the Toolkit tested. </li>
56 * <ul> <p>
57 * Test is <b> NOT </b> multithread compilant. <p>
58 * @see com.sun.star.awt.XDataTransferProviderAccess
59 */
60 public class _XDataTransferProviderAccess extends MultiMethodTest {
61 
62     public XDataTransferProviderAccess oObj = null;
63     protected XWindow win = null ;
64 
65     /**
66     * Retrieves object relations.
67     * @throws StatusException If one of relations not found.
68     */
69     public void before() {
70         win = (XWindow) tEnv.getObjRelation
71             ("XDataTransferProviderAccess.XWindow") ;
72         if (win == null) throw new StatusException(Status.failed
73             ("Relation not found")) ;
74     }
75 
76     /**
77     * Tries to get gesture recognizer for the window passed as
78     * relation. <p>
79     * Has <b> OK </b> status if not <code>null</code> value returned
80     */
81     public void _getDragGestureRecognizer() {
82 
83         boolean result = true ;
84         XDragGestureRecognizer rec = oObj.getDragGestureRecognizer(win) ;
85 
86         result = rec != null ;
87 
88         tRes.tested("getDragGestureRecognizer()", result) ;
89     }
90 
91     /**
92     * Tries to get drag source for the window passed as
93     * relation. <p>
94     * Has <b> OK </b> status if not <code>null</code> value returned
95     */
96     public void _getDragSource() {
97 
98         boolean result = true ;
99         XDragSource src = oObj.getDragSource(win) ;
100 
101         result = src != null ;
102 
103         tRes.tested("getDragSource()", result) ;
104     }
105 
106     /**
107     * Tries to get drop target for the window passed as
108     * relation. <p>
109     * Has <b> OK </b> status if not <code>null</code> value returned
110     */
111     public void _getDropTarget() {
112 
113         boolean result = true ;
114         XDropTarget targ = oObj.getDropTarget(win) ;
115 
116         result = targ != null ;
117 
118         tRes.tested("getDropTarget()", result) ;
119     }
120 
121     /**
122     * Tries to obtain default clipboard.<p>
123     * Has <b> OK </b> status if not <code>null</code> value returned.
124     */
125     public void _getClipboard() {
126 
127         boolean result = true ;
128         XClipboard cb = oObj.getClipboard("") ;
129 
130         result = cb != null ;
131 
132         tRes.tested("getClipboard()", result) ;
133     }
134 }
135 
136