1 /* 2 * This file is part of the LibreOffice project. 3 * 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/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 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 . 17 */ 18 19 package ifc.awt; 20 21 22 import lib.MultiMethodTest; 23 import lib.Status; 24 import lib.StatusException; 25 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; 32 33 /** 34 * Testing <code>com.sun.star.awt.XDataTransferProviderAccess</code> 35 * interface methods : 36 * <ul> 37 * <li><code> getDragGestureRecognizer()</code></li> 38 * <li><code> getDragSource()</code></li> 39 * <li><code> getDropTarget()</code></li> 40 * <li><code> getClipboard()</code></li> 41 * </ul> <p> 42 * This test needs the following object relations : 43 * <ul> 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> 47 * <ul> <p> 48 * Test is <b> NOT </b> multithread compliant. <p> 49 * @see com.sun.star.awt.XDataTransferProviderAccess 50 */ 51 public class _XDataTransferProviderAccess extends MultiMethodTest { 52 53 public XDataTransferProviderAccess oObj = null; 54 protected XWindow win = null ; 55 56 /** 57 * Retrieves object relations. 58 * @throws StatusException If one of relations not found. 59 */ 60 @Override before()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")) ; 66 } 67 68 /** 69 * Tries to get gesture recognizer for the window passed as 70 * relation. <p> 71 * Has <b> OK </b> status if not <code>null</code> value returned 72 */ _getDragGestureRecognizer()73 public void _getDragGestureRecognizer() { 74 75 boolean result = true ; 76 XDragGestureRecognizer rec = oObj.getDragGestureRecognizer(win) ; 77 78 result = rec != null ; 79 80 tRes.tested("getDragGestureRecognizer()", result) ; 81 } 82 83 /** 84 * Tries to get drag source for the window passed as 85 * relation. <p> 86 * Has <b> OK </b> status if not <code>null</code> value returned 87 */ _getDragSource()88 public void _getDragSource() { 89 90 boolean result = true ; 91 XDragSource src = oObj.getDragSource(win) ; 92 93 result = src != null ; 94 95 tRes.tested("getDragSource()", result) ; 96 } 97 98 /** 99 * Tries to get drop target for the window passed as 100 * relation. <p> 101 * Has <b> OK </b> status if not <code>null</code> value returned 102 */ _getDropTarget()103 public void _getDropTarget() { 104 105 boolean result = true ; 106 XDropTarget targ = oObj.getDropTarget(win) ; 107 108 result = targ != null ; 109 110 tRes.tested("getDropTarget()", result) ; 111 } 112 113 /** 114 * Tries to obtain default clipboard.<p> 115 * Has <b> OK </b> status if not <code>null</code> value returned. 116 */ _getClipboard()117 public void _getClipboard() { 118 119 boolean result = true ; 120 XClipboard cb = oObj.getClipboard("") ; 121 122 result = cb != null ; 123 124 tRes.tested("getClipboard()", result) ; 125 } 126 } 127 128