tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / util / _XModeSelector.java
blobd787eea42759eb72319e6e1ec99e9c8e5cc094a8
1 /*
2 * This file is part of the LibreOffice project.
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/.
8 * This file incorporates work covered by the following license notice:
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 .
19 package ifc.util;
21 import lib.MultiMethodTest;
23 import com.sun.star.util.XModeSelector;
25 /**
26 * Testing <code>com.sun.star.util.XModeSelector</code>
27 * interface methods :
28 * <ul>
29 * <li><code>setMode()</code></li>
30 * <li><code>getMode()</code></li>
31 * <li><code>getSupportedModes()</code></li>
32 * <li><code>supportsMode()</code></li>
33 * </ul> <p>
34 * Test is <b> NOT </b> multithread compliant. <p>
35 * @see com.sun.star.util.XModeSelector
37 public class _XModeSelector extends MultiMethodTest {
38 public XModeSelector oObj = null;
40 String[] supportedModes;
41 /**
42 * Calls the method and as argument pass one of the supported modes
43 * that was returned by method getSupportedMode.<p>
44 * Has <b> OK </b> status if no runtime exceptions occurred.
46 public void _setMode() {
47 requiredMethod("getSupportedModes()");
48 try {
49 oObj.setMode(supportedModes[0]);
50 } catch(com.sun.star.lang.NoSupportException e) {
51 log.println("Method setMode() doesn't support mode '"
52 + supportedModes[0] + "'");
53 tRes.tested("setMode()", false);
54 return ;
56 tRes.tested("setMode()", true);
59 /**
60 * Calls the method and check returned value.<p>
61 * Has <b> OK </b> status if no runtime exceptions occurred
62 * and returned value is equal to value that was set by method setMode.
64 public void _getMode() {
65 requiredMethod("setMode()");
66 String curMode = oObj.getMode();
67 tRes.tested("getMode()", curMode.equals(supportedModes[0]));
70 /**
71 * Calls the method and checks value returned by method.<p>
72 * Has <b> OK </b> status if no runtime exceptions occurred
73 * and returned value is not null.
75 public void _getSupportedModes() {
76 supportedModes = oObj.getSupportedModes();
77 tRes.tested("getSupportedModes()", supportedModes != null);
80 /**
81 * Calls the method. First one of the supported modes that was returned
82 * by method getSupportedMode is passed as argument.
83 * Then the method is called again and the mode that is certainly not supported
84 * is passed. Checks up returned values in both cases.<p>
85 * Has <b> OK </b> status if no runtime exceptions occurred,
86 * returned value is true in first call and is false in second call.
88 public void _supportsMode() {
89 requiredMethod("getSupportedModes()");
90 boolean result = oObj.supportsMode(supportedModes[0]) &&
91 ! oObj.supportsMode(supportedModes[0] + "_ForTest");
92 tRes.tested("supportsMode()", result);
94 }// finish class _XModeSelector