Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / tests / java / ifc / util / _XModeSelector.java
blobf189a3c39a64617f5ab25fbda0ae19f86974b274
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 ************************************************************************/
28 package ifc.util;
30 import lib.MultiMethodTest;
32 import com.sun.star.util.XModeSelector;
34 /**
35 * Testing <code>com.sun.star.util.XModeSelector</code>
36 * interface methods :
37 * <ul>
38 * <li><code>setMode()</code></li>
39 * <li><code>getMode()</code></li>
40 * <li><code>getSupportedModes()</code></li>
41 * <li><code>supportsMode()</code></li>
42 * </ul> <p>
43 * Test is <b> NOT </b> multithread compilant. <p>
44 * @see com.sun.star.util.XModeSelector
46 public class _XModeSelector extends MultiMethodTest {
47 public XModeSelector oObj = null;
49 String[] supportedModes;
50 /**
51 * Calls the method and as argument pass one of the supported modes
52 * that was returned by method getSupportedMode.<p>
53 * Has <b> OK </b> status if no runtime exceptions occurred.
55 public void _setMode() {
56 requiredMethod("getSupportedModes()");
57 try {
58 oObj.setMode(supportedModes[0]);
59 } catch(com.sun.star.lang.NoSupportException e) {
60 log.println("Method setMode() doesn't support mode '"
61 + supportedModes[0] + "'");
62 tRes.tested("setMode()", false);
63 return ;
65 tRes.tested("setMode()", true);
68 /**
69 * Calls the method and check returned value.<p>
70 * Has <b> OK </b> status if no runtime exceptions occurred
71 * and returned value is equal to value that was set by method setMode.
73 public void _getMode() {
74 requiredMethod("setMode()");
75 String curMode = oObj.getMode();
76 tRes.tested("getMode()", curMode.equals(supportedModes[0]));
79 /**
80 * Calls the method and checks value returned by method.<p>
81 * Has <b> OK </b> status if no runtime exceptions occurred
82 * and returned value is not null.
84 public void _getSupportedModes() {
85 supportedModes = oObj.getSupportedModes();
86 tRes.tested("getSupportedModes()", supportedModes != null);
89 /**
90 * Calls the method. First one of the supported modes that was returned
91 * by method getSupportedMode is passed as argument.
92 * Then the method is called again and the mode that is certainly not supported
93 * is passed. Checks up returned values in both cases.<p>
94 * Has <b> OK </b> status if no runtime exceptions occurred,
95 * returned value is true in first call and is false in second call.
97 public void _supportsMode() {
98 requiredMethod("getSupportedModes()");
99 boolean result = oObj.supportsMode(supportedModes[0]) &&
100 ! oObj.supportsMode(supportedModes[0] + "_ForTest");
101 tRes.tested("supportsMode()", result);
103 }// finish class _XModeSelector