tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / view / _XFormLayerAccess.java
blob3d45c5474cadb34ae07d590d7d6a5411b76c5412
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.view;
21 import com.sun.star.form.XForm;
22 import com.sun.star.form.runtime.XFormController;
23 import lib.MultiMethodTest;
25 import com.sun.star.view.XFormLayerAccess;
26 import lib.Status;
27 import lib.StatusException;
30 /**
31 * Testing <code>com.sun.star.view.XFormLayerAccess</code>
32 * interface methods :
33 * <ul>
34 * <li><code> getFromController()</code></li>
35 * <li><code> isFormDesignMode()</code></li>
36 * <li><code> setFormDesignMode()</code></li>
37 * </ul> <p>
39 * Test is <b> NOT </b> multithread compliant. <p>
40 * @see com.sun.star.view.XFormLayerAccess
42 public class _XFormLayerAccess extends MultiMethodTest {
44 // oObj filled by MultiMethodTest
46 public XFormLayerAccess oObj = null;
48 private XForm xForm = null;
50 /**
51 * checks if the object relation <CODE>XFormLayerAccess.XForm</CODE>
52 * is available
54 @Override
55 public void before() {
56 xForm = (XForm) tEnv.getObjRelation("XFormLayerAccess.XForm");
57 if (xForm == null) {
58 throw new StatusException(Status.failed("Object raltion 'XFormLayerAccess.XForm' is null"));
62 /**
63 * Test disables the FormDesignMode and calls the method. <p>
64 * Has <b> OK </b> status if the method returns
65 * a not empty object of kind of com.sun.star.form.XFormController<P>
66 * The following method tests are to be completed successfully before :
67 * <ul>
68 * <li> <code> setFormDesignMode() </code></li>
69 * </ul>
70 * @see com.sun.star.view.XFormLayerAccess
72 public void _getFromController(){
73 requiredMethod("setFormDesignMode()") ;
75 log.println("try to get current DesignMode...");
76 boolean currentMode = oObj.isFormDesignMode();
77 log.println("DesignMode is " + currentMode);
79 log.println("enable DesignMode");
80 oObj.setFormDesignMode(false);
82 log.println("test for getFromController() ");
83 XFormController xFormCont = oObj.getFormController(xForm);
85 if (xFormCont == null)
86 log.println("ERROR: Could not get FromContoller");
88 log.println("set back DesignMode to previous state");
89 oObj.setFormDesignMode(currentMode);
91 tRes.tested("getFromController()", xFormCont != null );
94 /**
95 * This test calls the test for <code>setFormDesignMode()</CODE>.
96 * Has <b> OK </b> status if the test for setFormDesignMode() returns
97 * <code>true</code> since the tests use <CODE>isFormDesignMode()</CODE><P>
98 * The following method tests are to be completed successfully before :
99 * <ul>
100 * <li> <code> setFormDesignMode() </code></li>
101 * </ul>
103 public void _isFormDesignMode(){
104 requiredMethod("setFormDesignMode()") ;
106 log.println("test for isFormDesignMode() is ok since test for 'setFormDesingMode()' use it");
107 tRes.tested("isFormDesignMode()", true);
111 * This test gets the current FormDesignMode, change it to the opposite and checks if the expected value of
112 * method isFormDesignmode() was given. Then the FormDesignmode was set back to the original value.<P>
113 * Has <B> OK </B> if expected values are returned.
117 public void _setFormDesignMode(){
118 log.println("test for setFormDesignMode() and isFormDesignMode() ");
120 log.println("try to get current DesignMode...");
121 boolean currentMode = oObj.isFormDesignMode();
122 log.println("DesignMode is " + currentMode);
124 log.println("try to change to " + !currentMode + "...");
125 oObj.setFormDesignMode(!currentMode);
126 log.println("try to get new DesignMode...");
127 boolean newMode = oObj.isFormDesignMode();
128 log.println("DesignMode is " + newMode);
130 boolean bOK = (newMode != currentMode);
132 if ( !bOK)
133 log.println("ERROR: both modes are equal");
135 log.println("set back DesignMode to " + currentMode);
136 oObj.setFormDesignMode(currentMode);
138 log.println("try to get DesignMode...");
139 boolean oldMode = oObj.isFormDesignMode();
141 bOK &= (bOK &(currentMode == oldMode));
143 if (currentMode != oldMode)
144 log.println("ERROR: could not change back");
146 tRes.tested("setFormDesignMode()", bOK );
149 } // finish class _XFormLayerAccess