merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / task / _XJobExecutor.java
blob02900437cf8bdb0d558b35d6d5065b9186eb46c6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XJobExecutor.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.task;
33 import lib.MultiMethodTest;
35 import com.sun.star.container.XNamed;
36 import com.sun.star.task.XJobExecutor;
38 /**
39 * Testing <code>com.sun.star.frame._XJobExecutor</code>
40 * interface methods:
41 * <ul>
42 * <li><code> trigger() </code></li>
43 * </ul><p>
45 * This test needs the following object relations :
46 * <ul>
47 * <li> <code>'CallCounter'</code>
48 * (of type <code>com.sun.star.container.XNamed</code>):
49 * the <code>getName()</code> method of which must
50 * return number of calls to <code>XJob.execute</code>
51 * method which is registered for event 'TestEvent'
52 * </li>
53 * <ul> <p>
54 * @see com.sun.star.frame.XJobExecutor
56 public class _XJobExecutor extends MultiMethodTest {
57 public static XJobExecutor oObj = null;
59 /**
60 * Gets the number of Job calls before and after triggering event.
62 * Has <b>OK</b> status if the Job was called on triggering
63 * event.
65 public void _trigger() {
66 XNamed counter = (XNamed) tEnv.getObjRelation("CallCounter");
68 int before = Integer.parseInt(counter.getName());
70 oObj.trigger("TestEvent");
72 try {
73 Thread.sleep(1000);
74 } catch (InterruptedException ex) {}
76 int after = Integer.parseInt(counter.getName());
78 log.println("Calls before: " + before + ", after: " + after);
80 tRes.tested("trigger()", after == before + 1);