2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 import lib
.MultiMethodTest
;
24 import lib
.StatusException
;
26 import com
.sun
.star
.awt
.XDataTransferProviderAccess
;
27 import com
.sun
.star
.awt
.XWindow
;
28 import com
.sun
.star
.datatransfer
.clipboard
.XClipboard
;
29 import com
.sun
.star
.datatransfer
.dnd
.XDragGestureRecognizer
;
30 import com
.sun
.star
.datatransfer
.dnd
.XDragSource
;
31 import com
.sun
.star
.datatransfer
.dnd
.XDropTarget
;
34 * Testing <code>com.sun.star.awt.XDataTransferProviderAccess</code>
37 * <li><code> getDragGestureRecognizer()</code></li>
38 * <li><code> getDragSource()</code></li>
39 * <li><code> getDropTarget()</code></li>
40 * <li><code> getClipboard()</code></li>
42 * This test needs the following object relations :
44 * <li> <code>'XDataTransferProviderAccess.XWindow'</code>
45 * (of type <code>com.sun.star.awt.XWindow</code>):
46 * this window must created by the Toolkit tested. </li>
48 * Test is <b> NOT </b> multithread compliant. <p>
49 * @see com.sun.star.awt.XDataTransferProviderAccess
51 public class _XDataTransferProviderAccess
extends MultiMethodTest
{
53 public XDataTransferProviderAccess oObj
= null;
54 protected XWindow win
= null ;
57 * Retrieves object relations.
58 * @throws StatusException If one of relations not found.
61 public void before() {
62 win
= (XWindow
) tEnv
.getObjRelation
63 ("XDataTransferProviderAccess.XWindow") ;
64 if (win
== null) throw new StatusException(Status
.failed
65 ("Relation not found")) ;
69 * Tries to get gesture recognizer for the window passed as
71 * Has <b> OK </b> status if not <code>null</code> value returned
73 public void _getDragGestureRecognizer() {
75 boolean result
= true ;
76 XDragGestureRecognizer rec
= oObj
.getDragGestureRecognizer(win
) ;
78 result
= rec
!= null ;
80 tRes
.tested("getDragGestureRecognizer()", result
) ;
84 * Tries to get drag source for the window passed as
86 * Has <b> OK </b> status if not <code>null</code> value returned
88 public void _getDragSource() {
90 boolean result
= true ;
91 XDragSource src
= oObj
.getDragSource(win
) ;
93 result
= src
!= null ;
95 tRes
.tested("getDragSource()", result
) ;
99 * Tries to get drop target for the window passed as
101 * Has <b> OK </b> status if not <code>null</code> value returned
103 public void _getDropTarget() {
105 boolean result
= true ;
106 XDropTarget targ
= oObj
.getDropTarget(win
) ;
108 result
= targ
!= null ;
110 tRes
.tested("getDropTarget()", result
) ;
114 * Tries to obtain default clipboard.<p>
115 * Has <b> OK </b> status if not <code>null</code> value returned.
117 public void _getClipboard() {
119 boolean result
= true ;
120 XClipboard cb
= oObj
.getClipboard("") ;
122 result
= cb
!= null ;
124 tRes
.tested("getClipboard()", result
) ;