1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XDataTransferProviderAccess.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 import lib
.MultiMethodTest
;
36 import lib
.StatusException
;
38 import com
.sun
.star
.awt
.XDataTransferProviderAccess
;
39 import com
.sun
.star
.awt
.XWindow
;
40 import com
.sun
.star
.datatransfer
.clipboard
.XClipboard
;
41 import com
.sun
.star
.datatransfer
.dnd
.XDragGestureRecognizer
;
42 import com
.sun
.star
.datatransfer
.dnd
.XDragSource
;
43 import com
.sun
.star
.datatransfer
.dnd
.XDropTarget
;
46 * Testing <code>com.sun.star.awt.XDataTransferProviderAccess</code>
49 * <li><code> getDragGestureRecognizer()</code></li>
50 * <li><code> getDragSource()</code></li>
51 * <li><code> getDropTarget()</code></li>
52 * <li><code> getClipboard()</code></li>
54 * This test needs the following object relations :
56 * <li> <code>'XDataTransferProviderAccess.XWindow'</code>
57 * (of type <code>com.sun.star.awt.XWindow</code>):
58 * this window must created by the Toolkit tested. </li>
60 * Test is <b> NOT </b> multithread compilant. <p>
61 * @see com.sun.star.awt.XDataTransferProviderAccess
63 public class _XDataTransferProviderAccess
extends MultiMethodTest
{
65 public XDataTransferProviderAccess oObj
= null;
66 protected XWindow win
= null ;
69 * Retrieves object relations.
70 * @throws StatusException If one of relations not found.
72 public void before() {
73 win
= (XWindow
) tEnv
.getObjRelation
74 ("XDataTransferProviderAccess.XWindow") ;
75 if (win
== null) throw new StatusException(Status
.failed
76 ("Relation not found")) ;
80 * Tries to get gesture recognizer for the window passed as
82 * Has <b> OK </b> status if not <code>null</code> value returned
84 public void _getDragGestureRecognizer() {
86 boolean result
= true ;
87 XDragGestureRecognizer rec
= oObj
.getDragGestureRecognizer(win
) ;
89 result
= rec
!= null ;
91 tRes
.tested("getDragGestureRecognizer()", result
) ;
95 * Tries to get drag source for the window passed as
97 * Has <b> OK </b> status if not <code>null</code> value returned
99 public void _getDragSource() {
101 boolean result
= true ;
102 XDragSource src
= oObj
.getDragSource(win
) ;
104 result
= src
!= null ;
106 tRes
.tested("getDragSource()", result
) ;
110 * Tries to get drop target for the window passed as
112 * Has <b> OK </b> status if not <code>null</code> value returned
114 public void _getDropTarget() {
116 boolean result
= true ;
117 XDropTarget targ
= oObj
.getDropTarget(win
) ;
119 result
= targ
!= null ;
121 tRes
.tested("getDropTarget()", result
) ;
125 * Tries to obtain default clipboard.<p>
126 * Has <b> OK </b> status if not <code>null</code> value returned.
128 public void _getClipboard() {
130 boolean result
= true ;
131 XClipboard cb
= oObj
.getClipboard("") ;
133 result
= cb
!= null ;
135 tRes
.tested("getClipboard()", result
) ;