1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
33 * <code>com.sun.star.task.XInteractionHandler</code> interface testing.
34 * This test needs the following object relations :
36 * <li> <code>'XInteractionHandler.Request'</code>
37 * (of type <code>com.sun.star.task.XInteractionRequest</code>):
38 * this interface implementation is handler specific and is
39 * passed as argument to method <code>handle</code>. </li>
41 * Test is <b> NOT </b> multithread compilant. <p>
42 * @see com.sun.star.task.XInteractionHandler
44 import lib
.MultiMethodTest
;
47 import com
.sun
.star
.task
.XInteractionHandler
;
48 import com
.sun
.star
.task
.XInteractionRequest
;
51 * <code>com.sun.star.task.XInteractionHandler</code> interface testing.
52 * This test needs the following object relations :
54 * <li> <code>'XInteractionHandler.Request'</code>
55 * (of type <code>com.sun.star.task.XInteractionRequest</code>):
56 * this interface implementation is handler specific and is
57 * passed as argument to method <code>handle</code>. </li>
59 * Test is <b> NOT </b> multithread compilant. <p>
60 * @see com.sun.star.task.XInteractionHandler
62 public class _XInteractionHandler
extends MultiMethodTest
{
64 // oObj filled by MultiMethodTest
65 public XInteractionHandler oObj
= null ;
67 private XInteractionRequest request
= null ;
70 * Retrieves an object relation. <p>
71 * @throws StatusException If the relation is not found.
73 public void before() {
74 request
= (XInteractionRequest
)
75 tEnv
.getObjRelation("XInteractionHandler.Request") ;
77 //if (request == null)
78 // throw new StatusException(Status.failed("Reelation not found")) ;
82 * Sinse this test is interactive (dialog window can't be
83 * disposed using API) it is skipped. <p>
84 * Always has <b>SKIPPED.OK</b> status .
86 public void _handle() {
90 final XMultiServiceFactory msf = (XMultiServiceFactory)tParam.getMSF() ;
91 SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
92 XComponent textDoc = null ;
94 textDoc = SOF.createTextDoc( null );
95 } catch (com.sun.star.uno.Exception e) {
96 log.println("Can't create Document") ;
97 tRes.tested("handle()", false) ;
100 final XComponent fTextDoc = textDoc ;
101 final XModel xModelDoc = (XModel)
102 UnoRuntime.queryInterface(XModel.class, textDoc);
104 Thread thr = new Thread( new Runnable() {
108 } catch (InterruptedException e ) {}
110 //fTextDoc.dispose() ;
112 XFrame docFr = xModelDoc.getCurrentController().getFrame() ;
118 Object dsk = msf.createInstance
119 ("com.sun.star.frame.Desktop");
121 XFrame xDsk = (XFrame)
122 UnoRuntime.queryInterface(XFrame.class, dsk) ;
124 XFrame fr = xDsk.findFrame("_top", 55) ;
126 XWindow win = fr.getContainerWindow() ;
130 name = fr.getName() ;
134 } catch (com.sun.star.uno.Exception e) {
141 oObj.handle(request) ;
144 } catch (InterruptedException e ) {}
147 tRes
.tested("handle()", Status
.skipped(true)) ;