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: _XInteractionHandler.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 ************************************************************************/
36 * <code>com.sun.star.task.XInteractionHandler</code> interface testing.
37 * This test needs the following object relations :
39 * <li> <code>'XInteractionHandler.Request'</code>
40 * (of type <code>com.sun.star.task.XInteractionRequest</code>):
41 * this interface implementation is handler specific and is
42 * passed as argument to method <code>handle</code>. </li>
44 * Test is <b> NOT </b> multithread compilant. <p>
45 * @see com.sun.star.task.XInteractionHandler
47 import lib
.MultiMethodTest
;
50 import com
.sun
.star
.task
.XInteractionHandler
;
51 import com
.sun
.star
.task
.XInteractionRequest
;
54 * <code>com.sun.star.task.XInteractionHandler</code> interface testing.
55 * This test needs the following object relations :
57 * <li> <code>'XInteractionHandler.Request'</code>
58 * (of type <code>com.sun.star.task.XInteractionRequest</code>):
59 * this interface implementation is handler specific and is
60 * passed as argument to method <code>handle</code>. </li>
62 * Test is <b> NOT </b> multithread compilant. <p>
63 * @see com.sun.star.task.XInteractionHandler
65 public class _XInteractionHandler
extends MultiMethodTest
{
67 // oObj filled by MultiMethodTest
68 public XInteractionHandler oObj
= null ;
70 private XInteractionRequest request
= null ;
73 * Retrieves an object relation. <p>
74 * @throws StatusException If the relation is not found.
76 public void before() {
77 request
= (XInteractionRequest
)
78 tEnv
.getObjRelation("XInteractionHandler.Request") ;
80 //if (request == null)
81 // throw new StatusException(Status.failed("Reelation not found")) ;
85 * Sinse this test is interactive (dialog window can't be
86 * disposed using API) it is skipped. <p>
87 * Always has <b>SKIPPED.OK</b> status .
89 public void _handle() {
93 final XMultiServiceFactory msf = (XMultiServiceFactory)tParam.getMSF() ;
94 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
95 XComponent textDoc = null ;
97 textDoc = SOF.createTextDoc( null );
98 } catch (com.sun.star.uno.Exception e) {
99 log.println("Can't create Document") ;
100 tRes.tested("handle()", false) ;
103 final XComponent fTextDoc = textDoc ;
104 final XModel xModelDoc = (XModel)
105 UnoRuntime.queryInterface(XModel.class, textDoc);
107 Thread thr = new Thread( new Runnable() {
111 } catch (InterruptedException e ) {}
113 //fTextDoc.dispose() ;
115 XFrame docFr = xModelDoc.getCurrentController().getFrame() ;
121 Object dsk = msf.createInstance
122 ("com.sun.star.frame.Desktop");
124 XFrame xDsk = (XFrame)
125 UnoRuntime.queryInterface(XFrame.class, dsk) ;
127 XFrame fr = xDsk.findFrame("_top", 55) ;
129 XWindow win = fr.getContainerWindow() ;
133 name = fr.getName() ;
137 } catch (com.sun.star.uno.Exception e) {
144 oObj.handle(request) ;
147 } catch (InterruptedException e ) {}
150 tRes
.tested("handle()", Status
.skipped(true)) ;