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