diff options
Diffstat (limited to 'qadevOOo/tests/java/ifc/form')
57 files changed, 4132 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/form/_DataAwareControlModel.java b/qadevOOo/tests/java/ifc/form/_DataAwareControlModel.java new file mode 100644 index 000000000..60dcd7f63 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_DataAwareControlModel.java @@ -0,0 +1,163 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiPropertyTest; +import util.utils; + +import com.sun.star.form.XLoadable; +import com.sun.star.uno.XInterface; + +/** +* Testing <code>com.sun.star.form.DataAwareControlModel</code> +* service properties : +* <ul> +* <li><code> DataField</code></li> +* <li><code> BoundField</code></li> +* <li><code> LabelControl</code></li> +* </ul> <p> +* This test need the following object relations : +* <ul> +* <li> <code>'FL'</code> as <code>com.sun.star.form.XLoadable</code> +* implementation : used to connect control to data source. </li> +* <li> <code>'LC'</code> as <code>com.sun.star.uno.XInterface</code> +* implementation : as value for LabelControl property (see property +* documentation). </li> +* <li> <code>'DataAwareControlModel.NewFieldName'</code> : +* <b>optional</b> <code>String</code> relation which is used +* for new value of DataField property.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* After test completion object environment has to be recreated. +* @see com.sun.star.form.DataAwareControlModel +*/ +public class _DataAwareControlModel extends MultiPropertyTest { + + /** + * First checks if <code>com.sun.star.form.DataAwareControlModel</code> + * service is supported by the object. Then <code>load</code> method + * of <code>'FL'</code> relation is called to connect control model + * to data source. Because the property is READONLY its value is + * just checked to be non null. After that model is disconnected. <p> + * Has <b> OK </b> status if the property has non null value. <p> + * The following property tests are to be completed successfully before : + * <ul> + * <li> <code> DataField </code> : to bind the control to some database + * field.</li> + * </ul> + */ + public void _BoundField() { + requiredMethod("DataField") ; + + // This property is TRANSIENT and READONLY. + boolean bResult = true; + Object gValue = null; + + // get the loader to load the form + XLoadable loader = (XLoadable) tEnv.getObjRelation("FL"); + + try { + if (loader.isLoaded()) { + loader.unload() ; + } + loader.load(); + gValue = oObj.getPropertyValue("BoundField"); + loader.unload(); + bResult &= gValue != null; + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log) ; + bResult = false; + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log) ; + bResult = false; + } + tRes.tested("BoundField", bResult); + } + + /** + * Sets the property to a Database field name, and then checks + * if it was properly set. If <code>'DataAwareControlModel.NewFieldName' + * </code> relation is not found, then new property value is + * 'Address'. <p> + * Has <b> OK </b> status if the property was properly set + * and no exceptions were thrown. If old and new values are equal + * the test is OK if no exceptions occurred and the value remains + * the same.<p> + */ + public void _DataField() { + String relVal = (String) tEnv.getObjRelation + ("DataAwareControlModel.NewFieldName") ; + final String newVal = relVal == null ? "Address" : relVal ; + testProperty("DataField", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object oldVal) { + return newVal ; + } + @Override + protected void checkResult(String propName, Object oldValue, + Object newValue, Object resValue, Exception exception) + throws java.lang.Exception{ + + if (exception == null && oldValue.equals(newValue)) { + boolean res = true ; + if (newValue.equals(resValue)) { + log.println("Old value is equal to new value ('" + + oldValue + "'). Possibly no other suitable fields found.") ; + } else { + log.println("The value was '" + oldValue + "', set to the" + + " same value, but result is '" + resValue + "' : FAILED") ; + res = false ; + } + + tRes.tested(propName, res) ; + } else { + super.checkResult(propName, oldValue, newValue, + resValue, exception); + } + } + }) ; + } + + /** + * Sets the new value (<code>'LC'</code> relation if <code>null</code> + * was before, and <code> null </code> otherwise and then checks if + * the value have successfully changed. <p> + * Has <b>OK</b> status if the value successfully changed. + */ + public void _LabelControl() { + final XInterface xTextLabel = (XInterface)tEnv.getObjRelation("LC"); + + testProperty("LabelControl", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object oldVal) { + if (utils.isVoid(oldVal)) return xTextLabel ; + else return super.getNewValue("LabelControl",oldVal); + } + }) ; + } + + /** + * Forces environment recreation. + */ + @Override + public void after() { + disposeEnvironment() ; + } +} + diff --git a/qadevOOo/tests/java/ifc/form/_FormComponent.java b/qadevOOo/tests/java/ifc/form/_FormComponent.java new file mode 100644 index 000000000..99cdfc683 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_FormComponent.java @@ -0,0 +1,34 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.FormComponent</code> +* service properties : +* <ul> +* <li><code> Name</code></li> +* </ul> +* @see com.sun.star.form.FormComponent +*/ +public class _FormComponent extends MultiPropertyTest { + +} // finish class _FormComponent + diff --git a/qadevOOo/tests/java/ifc/form/_FormControlModel.java b/qadevOOo/tests/java/ifc/form/_FormControlModel.java new file mode 100644 index 000000000..36c48dd30 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_FormControlModel.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.FormControlModel</code> +* service properties : +* <ul> +* <li><code> ClassId</code></li> +* <li><code> TabIndex</code></li> +* <li><code> Tag</code></li> +* </ul> +* @see com.sun.star.form +*/ +public class _FormControlModel extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/_XApproveActionBroadcaster.java b/qadevOOo/tests/java/ifc/form/_XApproveActionBroadcaster.java new file mode 100644 index 000000000..f02f02516 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XApproveActionBroadcaster.java @@ -0,0 +1,102 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.form.XApproveActionBroadcaster; +import com.sun.star.form.XApproveActionListener; +import com.sun.star.lang.EventObject; + +/** +* Testing <code>com.sun.star.form.XApproveActionBroadcaster</code> +* interface methods: +* <ul> +* <li><code> addApproveActionListener() </code></li> +* <li><code> removeApproveActionListener() </code></li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XApproveActionBroadcaster +*/ +public class _XApproveActionBroadcaster extends MultiMethodTest { + public XApproveActionBroadcaster oObj = null; + + /** + * Class we need to test methods. + */ + protected class TestListener implements XApproveActionListener { + public boolean approve = false ; + + public void init() { + approve = false ; + } + public void disposing(EventObject ev) {} + public boolean approveAction(EventObject ev) { + log.println("XApproveActionListener: ActionListener was called"); + return approve ; + } + + } + + private final TestListener listener = new TestListener(); + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _addApproveActionListener() { + oObj.addApproveActionListener(listener) ; + tRes.tested("addApproveActionListener()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addApproveActionListener() </code> : adds listener to an + * object </li> + * </ul> + */ + public void _removeApproveActionListener() { + requiredMethod("addApproveActionListener()"); + listener.init() ; + listener.approve = true ; + oObj.removeApproveActionListener(listener); + tRes.tested("removeApproveActionListener()", true); + } + + + /** + * Just log output + */ + @Override + protected void after() { + log.println("Skipping all XApproveActionBroadcaster methods, since they" + + " need user interaction"); + throw new StatusException(Status.skipped(true)); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/form/_XBoundComponent.java b/qadevOOo/tests/java/ifc/form/_XBoundComponent.java new file mode 100644 index 000000000..3f38ba689 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XBoundComponent.java @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XBoundComponent; + +/** +* Testing <code>com.sun.star.form.XBoundComponent</code> +* interface methods : +* <ul> +* <li><code> commit()</code></li> +* </ul> <p> +* More deep tests of this interface are made in +* <code>com.sun.star.form.XUpdateBroadcaster</code> interface +* test as it is the ancestor of <code>XBoundComponent</code> +* interface. +* @see com.sun.star.form.XBoundComponent +*/ +public class _XBoundComponent extends MultiMethodTest { + + public XBoundComponent oObj = null; + + public void _commit() { + oObj.commit() ; + + tRes.tested("commit()",true); + } + +} //EOF of XBoundComponent + + diff --git a/qadevOOo/tests/java/ifc/form/_XBoundControl.java b/qadevOOo/tests/java/ifc/form/_XBoundControl.java new file mode 100644 index 000000000..2d6bb8c73 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XBoundControl.java @@ -0,0 +1,73 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XBoundControl; + +/** +* Testing <code>com.sun.star.form.XBoundControl</code> +* interface methods: +* <ul> +* <li><code> getLock() </code></li> +* <li><code> setLock() </code></li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XBoundControl +*/ +public class _XBoundControl extends MultiMethodTest { + public XBoundControl oObj = null; + public boolean defaultState = false; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _getLock() { + boolean res = false; + defaultState = oObj.getLock(); + res = true; + tRes.tested("getLock()",res); + } + + /** + * Test calls the method, then result is checked. <p> + * Has <b> OK </b> status if method locks input (set and gotten values are + * equal). <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLock() </code>: determines whether the input is + * currently locked or not </li> + * </ul> + */ + public void _setLock() { + boolean res = false; + boolean toSet = !defaultState; + + requiredMethod("getLock()"); + oObj.setLock(toSet); + res = (oObj.getLock() != defaultState); + oObj.setLock(defaultState); + tRes.tested("setLock()", res); + } + +} //EOF of XBoundControl + diff --git a/qadevOOo/tests/java/ifc/form/_XChangeBroadcaster.java b/qadevOOo/tests/java/ifc/form/_XChangeBroadcaster.java new file mode 100644 index 000000000..7583ca6ec --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XChangeBroadcaster.java @@ -0,0 +1,179 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XWindow; +import com.sun.star.form.XChangeBroadcaster; +import com.sun.star.form.XChangeListener; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.form.XChangeBroadcaster</code> +* interface methods: +* <ul> +* <li><code> addChangeListener() </code></li> +* <li><code> removeChangeListener() </code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Win1'</code> (of type <code>XWindow</code>): +* used to change context when testing interface methods</li> +* <li> <code>'Win2'</code> (of type <code>XWindow</code>): +* used to change context when testing interface methods </li> +* <li> <code>'CONTROL'</code> (of type <code>XControl</code> and +* must implement <code>XTextComponent</code> interface): +* used to change context when testing interface methods </li> +* <li> <code>'XChangeBroadcaster.Changer'</code> +* (of type <code>ifc.form._XChangeBroadcaster.Changer</code>) +* <b>optional</b> : this relation <b>must be specified</b> when +* <code>XTextComponent</code> is not supported by the tested +* component. It is used to change some component content +* which must cause listener call. </li> +* </ul> <p> +* +* <b>Prerequisites:</b> component must implement <code>XTextComponent</code> +* interface for changing component's text which must cause listener call. +* If the component can't support the interface, then the relation +* <code>'XChangeBroadcaster.Changer'</code> must be passed. <p> +* +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XChangeBroadcaster +*/ +public class _XChangeBroadcaster extends MultiMethodTest { + public static XChangeBroadcaster oObj = null; + protected boolean changed = false; + + /** + * This interface must be implemented by component and passed + * in relation if it doesn't support <code>XTextComponent</code> + * interface. It used to change the content of component. + */ + public interface Changer { + /** + * The method must change the component's content to + * cause a listener call. + */ + void change() ; + } + + /** + * Class we need to test methods + */ + protected class MyChangeListener implements XChangeListener { + public void disposing ( EventObject oEvent ) {} + public void changed ( EventObject oEvent ) { + System.out.println("Listener called"); + changed = true; + } + } + + protected XChangeListener listener = new MyChangeListener(); + protected XTextComponent xText = null ; + protected Changer changer = null ; + + /** + * Tries to query the tested component for <code>XTextComponent</code> + * interface and retrieves a relation + * <code>'XChangeBroadcaster.Changer'</code>. + * @throw StatusException If neither relation is found nor interface + * is queried. + */ + @Override + public void before() { + xText = UnoRuntime.queryInterface(XTextComponent.class,oObj); + changer = (Changer) tEnv.getObjRelation("XChangeBroadcaster.Changer") ; + + if (xText == null && changer == null) + throw new StatusException(Status.failed + ("Neither 'XChangeBroadcaster.Changer' relation found " + + "nor XTextComponent is supported")) ; + } + + /** + * Test calls the method, then object relations 'Win1', 'Win2', 'CONTROL' + * are obtained, and context is changed.<p> + * Has <b> OK </b> status if listener was called after context has changed. + */ + public void _addChangeListener() { + log.println("Testing addChangeListener ..."); + oObj.addChangeListener( listener ); + XWindow win1 = (XWindow) tEnv.getObjRelation("Win1"); + XWindow win2 = (XWindow) tEnv.getObjRelation("Win2"); + win1.setFocus(); + + changeContent() ; + waitForEventIdle(); + + win2.setFocus(); + XTextComponent TC = UnoRuntime.queryInterface + (XTextComponent.class,tEnv.getObjRelation("CONTROL")); + TC.setText("NOXChangeBroadcaster"); + waitForEventIdle(); + tRes.tested("addChangeListener()", changed); + } + + /** + * Test calls the method, then object relations 'Win1', 'Win2', 'CONTROL' + * are obtained, and context is changed.<p> + * Has <b> OK </b> status if listener was not called after context has + * changed.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addChangeListener() </code> : adds the specified listener + * to receive the "changed" event</li> + * </ul> + */ + public void _removeChangeListener() { + requiredMethod("addChangeListener()"); + changed = false; + log.println("Testing removeChangeListener ..."); + oObj.addChangeListener( listener ); + XWindow win2 = (XWindow) tEnv.getObjRelation("Win2"); + win2.setFocus(); + + changeContent() ; + + win2.setFocus(); + waitForEventIdle(); + tRes.tested("removeChangeListener()", !changed); + } + + /** + * Changes the content of the component depending on whether + * <code>XTextComponent</code> is supported or not. If yes + * then the text is changed, if not the relation <code>change()</code> + * method is used. + */ + protected void changeContent() { + if (xText != null) { + xText.setText("XChangeBroadcaster".equals(xText.getText()) ? + "NoXChangeBroadcaster" : "XChangeBroadcaster") ; + } else { + changer.change(); + } + } + +} // finished class _XChangeBroadcaster + diff --git a/qadevOOo/tests/java/ifc/form/_XConfirmDeleteBroadcaster.java b/qadevOOo/tests/java/ifc/form/_XConfirmDeleteBroadcaster.java new file mode 100644 index 000000000..496227c9b --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XConfirmDeleteBroadcaster.java @@ -0,0 +1,64 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import com.sun.star.form.XConfirmDeleteBroadcaster; +import com.sun.star.form.XConfirmDeleteListener; +import com.sun.star.lang.EventObject; +import com.sun.star.sdb.RowChangeEvent; +import lib.MultiMethodTest; + +/** +* Testing <code>com.sun.star.util.XConfirmDeleteBroadcaster</code> +* interface methods : +* <ul> +* <li><code>addConfirmDeleteListener()</code></li> +* <li><code>removeConfirmDeleteListener()</code></li> +* </ul> <p> +* +* Result checking is not performed. Confirm delete +* listeners are called only in case of +* interaction with UI. <p> +* +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.util.XConfirmDeleteBroadcaster +*/ +public class _XConfirmDeleteBroadcaster extends MultiMethodTest { + public XConfirmDeleteBroadcaster oObj = null; + protected XConfirmDeleteListener mxConfirmDeleteListener = + new ConfirmDeleteImpl(); + + private static class ConfirmDeleteImpl implements XConfirmDeleteListener { + public boolean confirmDelete(RowChangeEvent rowChangeEvent) { + return true; + } + public void disposing(EventObject eventObject) { + } + } + + protected void addConfirmDeleteListener() { + oObj.addConfirmDeleteListener(mxConfirmDeleteListener); + tRes.tested("addConfirmDeleteListener()", true); + } + + protected void removeConfirmDeleteListener() { + oObj.removeConfirmDeleteListener(mxConfirmDeleteListener); + tRes.tested("removeConfirmDeleteListener()", true); + } +} diff --git a/qadevOOo/tests/java/ifc/form/_XDatabaseParameterBroadcaster.java b/qadevOOo/tests/java/ifc/form/_XDatabaseParameterBroadcaster.java new file mode 100644 index 000000000..384493d58 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XDatabaseParameterBroadcaster.java @@ -0,0 +1,93 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form; + +import com.sun.star.form.XDatabaseParameterBroadcaster; +import com.sun.star.form.XDatabaseParameterListener; +import com.sun.star.sdbc.XRowSet; +import com.sun.star.uno.UnoRuntime; +import java.io.PrintWriter; +import lib.MultiMethodTest; + +/** + * + */ +public class _XDatabaseParameterBroadcaster extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XDatabaseParameterBroadcaster oObj = null ; + private CheckParameterListener listenerChecker = null; + + /** + * Interface to implement so the call of the listener can be checked. + */ + public interface CheckParameterListener extends XDatabaseParameterListener { + /** + * Set a log of the listener, so messages of the listener get printed + * into the file of the interface + */ + void setLog(PrintWriter log); + /** + * Return True, when the listener was called correctly. + */ + boolean checkListener(); + } + + /** + * Get the object relation 'ParameterListenerChecker' and + * set the log inside of the implementation. + */ + @Override + protected void before() { + listenerChecker = (CheckParameterListener) + tEnv.getObjRelation("ParameterListenerChecker"); + listenerChecker.setLog(log); + } + + /** + */ + public void _addParameterListener() { + oObj.addParameterListener(listenerChecker); + tRes.tested("addParameterListener()", true); + } + + /** + */ + public void _removeParameterListener() { + requiredMethod("addParameterListener()"); + + // trigger the action. + try { + XRowSet xRowSet = UnoRuntime.queryInterface(XRowSet.class, oObj); + xRowSet.execute(); + } + catch(com.sun.star.sdbc.SQLException e) { + log.println("Exception in XDatabaseParameterBroadcaster test."); + log.println("This does not let the test fail, but should be inquired."); + e.printStackTrace(log); + } + // was the listener called? + oObj.removeParameterListener(listenerChecker); + tRes.tested("removeParameterListener()", listenerChecker.checkListener()); + } + + @Override + protected void after() { + disposeEnvironment(); + } +} diff --git a/qadevOOo/tests/java/ifc/form/_XFormController.java b/qadevOOo/tests/java/ifc/form/_XFormController.java new file mode 100644 index 000000000..339610c32 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XFormController.java @@ -0,0 +1,151 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XWindow; +import com.sun.star.form.XFormController; +import com.sun.star.form.XFormControllerListener; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.form.XFormController</code> +* interface methods : +* <ul> +* <li><code> getCurrentControl()</code></li> +* <li><code> addActivateListener()</code></li> +* <li><code> removeActivateListener()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'otherWindow'</code> +* (of type <code>com.sun.star.awt.XWindow</code>): +* The another window is used to activate it, causing deactivating +* of the component tested. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XFormController +*/ +public class _XFormController extends MultiMethodTest { + + public static XFormController oObj = null; + + /** + * Listener which determines and stores events occurred. + */ + protected static class MyListener implements XFormControllerListener { + public boolean activated = false ; + public boolean deactivated = false ; + public void disposing ( EventObject oEvent ) {} + + public void init() { + activated = false; + deactivated = false; + } + + public void formActivated(EventObject ev) { + activated = true ; + } + + public void formDeactivated(EventObject ev) { + deactivated = true ; + } + } + + MyListener listener = new MyListener() ; + + /** + * Adds a listener, then switches focus between two windows. + * The current controller must be deactivated and activated.<p> + * + * Has <b> OK </b> status if listener <code>deactivate</code> + * and <code>activate</code> methods was called. <p> + */ + public void _addActivateListener() { + requiredMethod("getCurrentControl()"); + oObj.addActivateListener(listener) ; + + XWindow wind = UnoRuntime.queryInterface(XWindow.class, cntrl); + wind.setFocus(); + waitForEventIdle(); + XWindow otherWind = (XWindow)tEnv.getObjRelation("otherWindow"); + otherWind.setFocus(); + waitForEventIdle(); + log.println("activated = " + listener.activated + + ", deactivated = " + listener.deactivated) ; + + tRes.tested("addActivateListener()", + listener.deactivated && listener.activated) ; + } + + /** + * Removes the listener added before, then switches focus between two windows. + * + * Has <b> OK </b> status if no listener methods were called. <p> + */ + public void _removeActivateListener() { + requiredMethod("addActivateListener()") ; + + oObj.removeActivateListener(listener); + log.println("ActiveListener removed"); + listener.init(); + + XWindow wind = UnoRuntime.queryInterface(XWindow.class, cntrl); + wind.setFocus(); + waitForEventIdle(); + XWindow otherWind = (XWindow)tEnv.getObjRelation("otherWindow"); + otherWind.setFocus(); + waitForEventIdle(); + log.println("activated = " + listener.activated + + ", deactivated = " + listener.deactivated) ; + + tRes.tested("removeActivateListener()", + !listener.activated && !listener.deactivated); + } + + XControl cntrl; + + /** + * Retrieves current control and searches for it among child controls. + * + * Has <b>OK</b> status if the current control was found among component + * children. + */ + public void _getCurrentControl() { + cntrl = oObj.getCurrentControl(); + XControl[] children = oObj.getControls() ; + + boolean res = false; + for(int i = 0; i < children.length; i++) { + if (children[i].equals(cntrl)) { + log.println("Current control is equal to the object control" + + " #" + i + ":"); + log.println(cntrl); + res = true; + break; + } + } + + tRes.tested("getCurrentControl()", res) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/form/_XFormsSupplier.java b/qadevOOo/tests/java/ifc/form/_XFormsSupplier.java new file mode 100644 index 000000000..6a67b0920 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XFormsSupplier.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import com.sun.star.container.XNameContainer; + +public class _XFormsSupplier extends lib.MultiMethodTest { + + public com.sun.star.form.XFormsSupplier oObj = null; + + public void _getForms() { + XNameContainer forms = oObj.getForms(); + if (!forms.hasElements()) { + log.println("NameContainer doesn't contain forms"); + } + tRes.tested("getForms()",forms.hasElements()); + } + +} diff --git a/qadevOOo/tests/java/ifc/form/_XGrid.java b/qadevOOo/tests/java/ifc/form/_XGrid.java new file mode 100644 index 000000000..f241af55a --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XGrid.java @@ -0,0 +1,74 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XGrid; + +/** +* Testing <code>com.sun.star.form.XGrid</code> +* interface methods : +* <ul> +* <li><code> getCurrentColumnPosition()</code></li> +* <li><code> setCurrentColumnPosition(short nPos)</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XGrid +*/ +public class _XGrid extends MultiMethodTest { + public XGrid oObj = null; + public short positionValue; + + /** + * The method called. Then CurrentColumnPosition is obtained and + * compared with previously changed value. + * Has <b> OK </b> status if the method successfully returns + * and the returned value is correct. + */ + public void _getCurrentColumnPosition() { + boolean result; + + requiredMethod("setCurrentColumnPosition()"); + log.println("Testing getCurrentColumnPosition()..."); + if (oObj.getCurrentColumnPosition() == positionValue) { + result = true; + } else { + result = false; + } + tRes.tested("getCurrentColumnPosition()", result); + } + + /** + * The method called. Then CurrentColumnPosition is obtained, changed + * and saved. + * Has <b> OK </b> status if no exception has occurred. + */ + public void _setCurrentColumnPosition() { + log.println("Testing setCurrentColumnPosition()..."); + if (oObj.getCurrentColumnPosition() != 0) { + positionValue = 0; + } else { + positionValue = 1; + } + oObj.setCurrentColumnPosition(positionValue); + tRes.tested("setCurrentColumnPosition()", true); + } + +} diff --git a/qadevOOo/tests/java/ifc/form/_XGridColumnFactory.java b/qadevOOo/tests/java/ifc/form/_XGridColumnFactory.java new file mode 100644 index 000000000..376bdbf8c --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XGridColumnFactory.java @@ -0,0 +1,71 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.form.XGridColumnFactory; + + +/** +* Testing <code>com.sun.star.form.XGridColumnFactory</code> +* interface methods : +* <ul> +* <li><code> createColumn()</code></li> +* <li><code> getColumnTypes()</code></li> +* </ul> +* Test is multithread compliant. <p> +* @see com.sun.star.form.XGridColumnFactory +*/ +public class _XGridColumnFactory extends MultiMethodTest { + + public XGridColumnFactory oObj = null; + + + /** + * Test calls the method and checks return value. <p> + * Has <b> OK </b> status if the method returns + * non null value. + */ + public void _getColumnTypes() { + + String[] types = oObj.getColumnTypes(); + tRes.tested("getColumnTypes()",types!=null); + } + + /** + * Creates column of type 'TextField'. <p> + * Has <b>OK</b> status if non null value returned. + */ + public void _createColumn() { + + try { + XPropertySet column = oObj.createColumn("TextField"); + tRes.tested("createColumn()",column!=null); + } + catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("Exception occurred while creating Column"); + tRes.tested("createColumn()",false); + } + } +} // finish class _XGridColumnFactory + + + diff --git a/qadevOOo/tests/java/ifc/form/_XGridFieldDataSupplier.java b/qadevOOo/tests/java/ifc/form/_XGridFieldDataSupplier.java new file mode 100644 index 000000000..af1631be2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XGridFieldDataSupplier.java @@ -0,0 +1,59 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XGridFieldDataSupplier; +import com.sun.star.uno.Type; + +/** +* Testing <code>com.sun.star.form.XGridFieldDataSupplier</code> +* interface methods : +* <ul> +* <li><code>queryFieldDataType()</code></li> +* <li><code>queryFieldData()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XGridFieldDataSupplier +*/ +public class _XGridFieldDataSupplier extends MultiMethodTest { + public XGridFieldDataSupplier oObj = null; + + /** + * Calls the method and checks returned value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * and returned value is not null. + */ + public void _queryFieldDataType() { + boolean[] dataType = oObj.queryFieldDataType(new Type(String.class)); + tRes.tested("queryFieldDataType()", dataType != null); + } + + /** + * Calls the method and checks returned value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * and returned value is not null. + */ + public void _queryFieldData() { + Object[] data = oObj.queryFieldData(0, new Type(String.class)); + tRes.tested("queryFieldData()", data != null); + } +}// finish class _XGridFieldDataSupplier + diff --git a/qadevOOo/tests/java/ifc/form/_XImageProducerSupplier.java b/qadevOOo/tests/java/ifc/form/_XImageProducerSupplier.java new file mode 100644 index 000000000..86f2eb0b8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XImageProducerSupplier.java @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XImageProducer; +import com.sun.star.form.XImageProducerSupplier; + +/** +* Testing <code>com.sun.star.form.XImageProducerSupplier</code> +* interface methods : +* <ul> +* <li><code> getImageProducer()</code></li> +* </ul> +* @see com.sun.star.form.XImageProducerSupplier +*/ +public class _XImageProducerSupplier extends MultiMethodTest { + + public XImageProducerSupplier oObj = null; + + /** + * Test calls the method and checks return value and that + * no exceptions were thrown. <p> + * Has <b> OK </b> status if the method returns non null value + * and no exceptions were thrown. <p> + */ + public void _getImageProducer() { + boolean bResult = false; + XImageProducer ip = oObj.getImageProducer(); + bResult = ip!=null; + tRes.tested("getImageProducer()", bResult); + } +} + + diff --git a/qadevOOo/tests/java/ifc/form/_XLoadListener.java b/qadevOOo/tests/java/ifc/form/_XLoadListener.java new file mode 100644 index 000000000..0a6450582 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XLoadListener.java @@ -0,0 +1,85 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XLoadListener; + +/** +* Testing <code>com.sun.star.form.XLoadListener</code> +* interface methods : +* <ul> +* <li><code> loaded()</code></li> +* <li><code> unloading()</code></li> +* <li><code> unloaded()</code></li> +* <li><code> reloading()</code></li> +* <li><code> reloaded()</code></li> +* </ul> <p> +* This interface methods are not testable, because their +* behaviour is not documented. +* @see com.sun.star.form.XLoadListener +*/ +public class _XLoadListener extends MultiMethodTest { + + public XLoadListener oObj = null; + + /** + * Always has <b>OK</b> status. + */ + public void _loaded() { + log.println("nothing to test here"); + tRes.tested("loaded()",true); + } + + /** + * Always has <b>OK</b> status. + */ + public void _reloaded() { + log.println("nothing to test here"); + tRes.tested("reloaded()",true); + } + + /** + * Always has <b>OK</b> status. + */ + public void _reloading() { + log.println("nothing to test here"); + tRes.tested("reloading()",true); + } + + /** + * Always has <b>OK</b> status. + */ + public void _unloaded() { + log.println("nothing to test here"); + tRes.tested("unloaded()",true); + } + + /** + * Always has <b>OK</b> status. + */ + public void _unloading() { + log.println("nothing to test here"); + tRes.tested("unloading()",true); + } + +} //EOF of XLoadListener + + diff --git a/qadevOOo/tests/java/ifc/form/_XLoadable.java b/qadevOOo/tests/java/ifc/form/_XLoadable.java new file mode 100644 index 000000000..a4bf0e78d --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XLoadable.java @@ -0,0 +1,225 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + + +import lib.MultiMethodTest; + +import com.sun.star.form.XLoadable; + +/** +* Testing <code>com.sun.star.form.XLoadable</code> +* interface methods : +* <ul> +* <li><code> load()</code></li> +* <li><code> unload()</code></li> +* <li><code> reload()</code></li> +* <li><code> isLoaded()</code></li> +* <li><code> addLoadListener()</code></li> +* <li><code> removeLoadListener()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XLoadable +*/ +public class _XLoadable extends MultiMethodTest { + + public XLoadable oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestLoadListener implements com.sun.star.form.XLoadListener { + public boolean loadedCalled = false ; + public boolean reloadedCalled = false ; + public boolean unloadedCalled = false ; + private final java.io.PrintWriter log; + + public TestLoadListener(java.io.PrintWriter log) { + this.log = log ; + } + + public void disposing(com.sun.star.lang.EventObject e) { + log.println(" disposing was called.") ; + } + + public void loaded(com.sun.star.lang.EventObject e) { + loadedCalled = true ; + log.println(" loaded was called.") ; + } + + public void reloaded(com.sun.star.lang.EventObject e) { + reloadedCalled = true ; + log.println(" reloaded was called.") ; + } + + public void reloading(com.sun.star.lang.EventObject e) { + log.println(" reloading was called.") ; + } + + public void unloaded(com.sun.star.lang.EventObject e) { + unloadedCalled = true ; + log.println(" unloaded was called.") ; + } + + public void unloading(com.sun.star.lang.EventObject e) { + log.println(" unloading was called.") ; + } + } + + TestLoadListener loadListener = null ; + + /** + * Creates new listener. + */ + @Override + public void before() { + loadListener = new TestLoadListener(log) ; + } + + /** + * Loads the form. <p> + * Has <b> OK </b> status if <code>isLoaded()</code> returns + * <code>true</code> and listener method <code>loaded()</code> + * is called. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isLoaded() </code> : to be sure form is not loaded </li> + * <li> <code> addLoadListener() </code> : to check if this listener method + * is called. </li> + * </ul> + */ + public void _load() { + requiredMethod("isLoaded()") ; + requiredMethod("addLoadListener()") ; + + boolean result = true ; + oObj.load() ; + + waitForEventIdle(); + result = oObj.isLoaded() && loadListener.loadedCalled ; + + tRes.tested("load()", result) ; + } + + /** + * Unloads the form. <p> + * Has <b> OK </b> status if <code>isLoaded()</code> returns + * <code>false</code> and listener method <code>unloaded()</code> + * is called. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> reload() </code> : to be sure the form is loaded </li> + * <li> <code> addLoadListener() </code> : to check if this listener method + * is called. </li> + * </ul> + */ + public void _unload() { + requiredMethod("reload()") ; + requiredMethod("addLoadListener()") ; + + boolean result = true ; + oObj.unload() ; + + waitForEventIdle(); + result = !oObj.isLoaded() && loadListener.unloadedCalled ; + + tRes.tested("unload()", result) ; + } + + /** + * Reloads the form. <p> + * Has <b> OK </b> status if <code>isLoaded()</code> returns + * <code>true</code> and listener method <code>reloaded()</code> + * is called. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> load() </code> : to be sure form is loaded </li> + * <li> <code> addLoadListener() </code> : to check if this listener method + * is called. </li> + * </ul> + */ + public void _reload() { + requiredMethod("load()") ; + requiredMethod("addLoadListener()") ; + + boolean result = true ; + oObj.reload() ; + + waitForEventIdle(); + result = oObj.isLoaded() && loadListener.reloadedCalled; + + tRes.tested("reload()", result) ; + } + + /** + * Checks if the component is already loaded. If yes it unloads + * it <p> + * Has <b> OK </b> status if finally <code>isLoaded()</code> method + * returns <code>false</code>. + */ + public void _isLoaded() { + + boolean isLoaded = oObj.isLoaded() ; + if (isLoaded) oObj.unload(); + isLoaded = oObj.isLoaded() ; + + tRes.tested("isLoaded()", !isLoaded) ; + } + + /** + * Adds a listener. If its methods are called or not is checked + * in other object methods. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _addLoadListener() { + + boolean result = true ; + oObj.addLoadListener(loadListener) ; + + tRes.tested("addLoadListener()", result) ; + } + + /** + * Removes the listener added before. <p> + * Has <b> OK </b> status if after <code>load()</code> call no + * listener methods were called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> unload() </code> : to make this test run finally.</li> + * </ul> + */ + public void _removeLoadListener() { + requiredMethod("unload()") ; + + boolean result = true ; + oObj.removeLoadListener(loadListener) ; + loadListener.loadedCalled = false ; + oObj.load(); + + result = ! loadListener.loadedCalled ; + + tRes.tested("removeLoadListener()", result) ; + } + + @Override + protected void after() { + disposeEnvironment(); + } +} + diff --git a/qadevOOo/tests/java/ifc/form/_XReset.java b/qadevOOo/tests/java/ifc/form/_XReset.java new file mode 100644 index 000000000..b3afa18df --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XReset.java @@ -0,0 +1,170 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.form.XReset; +import com.sun.star.form.XResetListener; +import com.sun.star.lang.EventObject; + +/** +* Testing <code>com.sun.star.form.XReset</code> +* interface methods : +* <ul> +* <li><code> reset()</code></li> +* <li><code> addResetListener()</code></li> +* <li><code> removeResetListener()</code></li> +* </ul> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XReset +*/ +public class _XReset extends MultiMethodTest { + + public static XReset oObj = null; + + /** + * Indicates if listeners must approve reset requests or not. + */ + protected boolean approve = true; + /** + * Array of two elements, each of them indicates <code>reset</code> + * call of appropriate listener. + */ + protected boolean resetted[] = new boolean[2]; + /** + * Array of two elements, each of them indicates + * <code>approveReset</code> call of appropriate listener. + */ + protected boolean approveReset[] = new boolean[2]; + + /** + * The listener which sets flags (in array elements with index 0) + * on <code>reset</code> and + * <code>approveReset</code> events. It approves reset request + * depending on <code>approve</code> field. + */ + protected class MyResetListener implements XResetListener { + public void disposing ( EventObject oEvent ) {} + public boolean approveReset ( EventObject oEvent ) { + approveReset[0] = true; + //cancel the reset action + return approve; + } + public void resetted ( EventObject oEvent ) { + resetted[0] = true; + } + } + + + /** + * The listener which sets flags (in array elements with index 1) + * on <code>reset</code> and + * <code>approveReset</code> events. It approves reset request + * depending on <code>approve</code> field. + */ + protected class MyResetListener2 implements XResetListener { + public void disposing ( EventObject oEvent ) {} + public boolean approveReset ( EventObject oEvent ) { + approveReset[1] = true; + //don't cancel the reset action + return true; + } + public void resetted ( EventObject oEvent ) { + resetted[1] = true; + } + } + + /** + * Listener which is added in test + */ + protected XResetListener listener1 = new MyResetListener(); + /** + * Listener which is added in test + */ + protected XResetListener listener2 = new MyResetListener2(); + + /** + * Just adds two reset listeners. <p> + * Status for it is set later in <code>reset</code> method test. + */ + public void _addResetListener() { + + log.println("Testing addResetListener ..."); + oObj.addResetListener( listener2 ); + oObj.addResetListener( listener1 ); + + } // finished _addResetListener() + + /** + * First calls <code>reset</code> method without approving + * the request, in this case only <code>approveReset</code> + * event must be called. Second calls <code>reset</code> with + * approving the request. In this case both listener's events + * must be called. <p> + * Has <b>OK</b> status for <code>reset</code> method if in + * the first case only <code>approveReset</code> method was + * called. <p> + * Has <b>OK</b> status for <code>addResetListener</code> method + * if in the second case both listener's methods were called.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addResetListener </code> : to have listeners added.</li> + * </ul> + */ + public void _reset() { + + executeMethod("addResetListener()"); + log.println("Testing reset() ..."); + approve = false; + oObj.reset(); + waitForEventIdle(); + tRes.tested("reset()", (approveReset[0] && (! resetted[0]))); + approve = true; + oObj.reset(); + waitForEventIdle(); + tRes.tested("addResetListener()", (approveReset[1] && resetted[1])); + + } // finished _reset + + /** + * Removes the first listener, clears it's call flags, and + * calls <code>reset</code> method.<p> + * Has <b> OK </b> status if no methods of the listener removed + * were called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> reset </code> : to test this method last. </li> + * </ul> + */ + public void _removeResetListener() { + requiredMethod("reset()"); + log.println("Testing removeResetListener ..."); + approveReset[0] = resetted[0] = false; + oObj.removeResetListener(listener1); + oObj.reset(); + waitForEventIdle(); + tRes.tested("removeResetListener()", !approveReset[0] && !resetted[0]); + //removing the second listener here may avoid crashing the office + } // finished _removeResetListener() + + +} // finished class _XRefresh + + diff --git a/qadevOOo/tests/java/ifc/form/_XSubmit.java b/qadevOOo/tests/java/ifc/form/_XSubmit.java new file mode 100644 index 000000000..3b3346900 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XSubmit.java @@ -0,0 +1,171 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; + +import com.sun.star.awt.MouseEvent; +import com.sun.star.awt.XControl; +import com.sun.star.beans.XPropertySet; +import com.sun.star.form.XSubmit; +import com.sun.star.form.XSubmitListener; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.form.XSubmit</code> +* interface methods : +* <ul> +* <li><code> submit()</code></li> +* <li><code> addSubmitListener()</code></li> +* <li><code> removeSubmitListener()</code></li> +* </ul> <p> +* +* This test needs the following object relations : +* <ul> +* <li> <code>'XSubmit.Control'</code> <b>optional</b> +* (of type <code>com.sun.star.awt.XControl</code>): +* is used to pass as parameters to <code>submit</code> +* method. <code>null</code> is passed if the relation +* is not found.</li> +* <ul> <p> +* +* Other <b> prerequicity </b> is the object must have +* <code>TargetURL</code> property. <p> +* +* Short description: test adds two listeners, call +* <code> submit </code> method and checks if both listeners +* were called. Then one listener is removed and after +* <code> submit </code> method call it must not be called. <p> +* +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XSubmit +*/ +public class _XSubmit extends MultiMethodTest { + + public static XSubmit oObj = null; + + public static class MySubmitListener implements XSubmitListener { + public int called = 0 ; + public void disposing ( EventObject oEvent ) { + } + public boolean approveSubmit( EventObject oEvent ) { + called += 1; + System.out.println("Listener called"); + return true; + } + } + + + MySubmitListener listener1 = new MySubmitListener(); + MySubmitListener listener2 = new MySubmitListener(); + + /** + * Just adds two submit listeners. <p> + * Status of this method test is defined in <code> + * submit </code> method test. + */ + public void _addSubmitListener() { + log.println("Testing addSubmitListener ..."); + oObj.addSubmitListener( listener1 ); + oObj.addSubmitListener( listener2 ); + } + + /** + * Before submission tries to set 'TargetURL' property + * of component to some value assuming that component + * supports <code>com.sun.star.form.HTMLForm</code> + * service. + * Then calls the <code> submit </code> method and checks + * if listener removed were not called, and other was + * called only once.<p> + * + * Has <b> OK </b> status for <code>submit</code> if + * listener was called at least ones, for + * <code>addSubmitListener</code> method if the remaining + * listener was called only once, for + * <code>removeSubmitListener</code> method if the removed + * listener was not called. <p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> removeSubmitListener </code> : to have one listener + * added and other removed.</li> + * </ul> + */ + public void _submit() { + executeMethod("removeSubmitListener()"); + log.println("Testing submit() ..."); + XControl cntrl = (XControl) tEnv.getObjRelation("XSubmit.Control") ; + + XPropertySet xPS = UnoRuntime.queryInterface + (XPropertySet.class, oObj) ; + + if (xPS != null) { + try { + xPS.setPropertyValue("TargetURL", "someserver"); + } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch (com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + } catch (com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(log); + } catch (com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } + } else { + log.println("!!! The tested component doesn't support XPropertySet "); + } + + oObj.submit(cntrl, new MouseEvent()); + waitForEventIdle(); + + log.println("Listener1 called " + listener1.called + " times"); + log.println("Listener2 called " + listener2.called + " times"); + + tRes.tested("addSubmitListener()", listener2.called == 1); + tRes.tested("removeSubmitListener()", listener1.called == 0); + tRes.tested("submit()", listener2.called > 0); + oObj.removeSubmitListener(listener2); + } + + /** + * Just removes one of submit listeners. <p> + * Status of this method test is defined in <code> + * submit </code> method test. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> removeSubmitListener </code> : to have listeners added</li> + * </ul> + */ + public void _removeSubmitListener() { + requiredMethod("addSubmitListener()"); + oObj.removeSubmitListener(listener1); + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} + diff --git a/qadevOOo/tests/java/ifc/form/_XUpdateBroadcaster.java b/qadevOOo/tests/java/ifc/form/_XUpdateBroadcaster.java new file mode 100644 index 000000000..3df9eecd6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/_XUpdateBroadcaster.java @@ -0,0 +1,232 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form; + +import lib.MultiMethodTest; +import lib.StatusException; + +import com.sun.star.form.XUpdateBroadcaster; +import com.sun.star.form.XUpdateListener; +import com.sun.star.lang.EventObject; + +/** +* Testing <code>com.sun.star.form.XUpdateBroadcaster</code> +* interface methods : +* <ul> +* <li><code> addUpdateListener()</code></li> +* <li><code> removeUpdateListener()</code></li> +* </ul> +* This test needs the following object relations : +* <ul> +* <li> <code>'XUpdateBroadcaster.Checker'</code> : <code> +* _XUpdateBroadcaster.UpdateChecker</code> interface implementation +* which can update, commit data and check if the data was successfully +* committed.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.form.XUpdateBroadcaster +*/ +public class _XUpdateBroadcaster extends MultiMethodTest { + + public XUpdateBroadcaster oObj = null; + UpdateChecker checker = null ; + + /** + * Interface for relation. Updating, committing and checking + * if data was committed is object dependent behaviour. + */ + public interface UpdateChecker { + /** + * Method must make some data update in the object tested. + */ + void update() throws com.sun.star.uno.Exception ; + /** + * Method must commit data change made by method <code>update</code>. + */ + void commit() throws com.sun.star.uno.Exception ; + /** + * Checks if the data committed by <code>commit</code> method + * became permanent in data source. + * @return <code>true</code> if data was committed. + */ + boolean wasCommited() throws com.sun.star.uno.Exception ; + } + + /** + * Retrieves object relations. + * @throws StatusException If one of relations not found. + */ + @Override + public void before() { + checker = (UpdateChecker) + tEnv.getObjRelation("XUpdateBroadcaster.Checker") ; + if (checker == null) { + log.println("Relation not found") ; + throw new StatusException("Relation not found", + new NullPointerException("Relation not found")) ; + } + } + + /** + * Listener implementation, which can accept or reject update + * requests and store event calls. + */ + protected static class TestListener implements XUpdateListener { + /** + * Indicates must listener approve update requests or not. + */ + public boolean approve = false ; + /** + * Indicates that <code>approveUpdate</code> method was called. + */ + public boolean approveCalled = false ; + /** + * Indicates that <code>updated</code> method was called. + */ + public boolean updateCalled = false ; + + /** + * Clears all flags. + */ + public void init() { + approveCalled = false ; + updateCalled = false ; + } + public void disposing(EventObject ev) {} + public boolean approveUpdate(EventObject ev) { + approveCalled = true ; + return approve ; + } + public void updated(EventObject ev) { + updateCalled = true ; + } + } + + private final TestListener listener = new TestListener(); + + /** + * The listener methods calls are checked twice with approving + * and rejecting updates. <p> + * Has <b>OK</b> status if on update rejected only <code> + * approveUpdate</code> listener method was called, and if + * on update approved <code>approveUpdate</code> and + * <code>updated</code> methods called, and data was committed + * to the source. + */ + public void _addUpdateListener() { + boolean bResult = true; + + oObj.addUpdateListener(listener) ; + + try { + checker.update() ; + waitForEventIdle(); + checker.commit() ; + waitForEventIdle(); + boolean committed = checker.wasCommited() ; + + waitForEventIdle(); + + bResult = listener.approveCalled && + ! listener.updateCalled && + ! committed ; + + log.println("Calling with no approving : approveUpdate() was " + + (listener.approveCalled ? "":"NOT")+" called, updated() was "+ + (listener.updateCalled ? "":"NOT")+" called, the value was " + + (committed ? "" : "NOT") + " committed.") ; + + waitForEventIdle(); + + listener.init() ; + listener.approve = true ; + waitForEventIdle(); + checker.update() ; + waitForEventIdle(); + checker.commit() ; + waitForEventIdle(); + committed = checker.wasCommited() ; + + waitForEventIdle(); + + log.println("Calling with approving : approveUpdate() was " + + (listener.approveCalled ? "":"NOT")+" called, updated() was "+ + (listener.updateCalled ? "":"NOT")+" called, the value was "+ + (committed ? "" : "NOT") + " committed.") ; + + bResult = listener.approveCalled && + listener.updateCalled && + committed ; + } catch (com.sun.star.uno.Exception e) { + bResult = false ; + e.printStackTrace(log) ; + } + + tRes.tested("addUpdateListener()", bResult); + } + + /** + * Removes listener, updates data, and checks if no listener + * methods were called. <p> + * Has <b> OK </b> status if after listener removing no of its methods + * were called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addUpdateListener </code> : to have a listener added.</li> + * </ul> + */ + public void _removeUpdateListener() { + requiredMethod("addUpdateListener()"); + boolean bResult = true; + + listener.init() ; + listener.approve = true ; + + oObj.removeUpdateListener(listener); + + try { + checker.update() ; + waitForEventIdle(); + checker.commit() ; + + waitForEventIdle(); + + bResult = ! listener.approveCalled && + ! listener.updateCalled ; + } + catch (com.sun.star.uno.Exception e) { + log.println("Exception occurred during removeUpdateListener()"); + e.printStackTrace(log); + bResult = false; + } + + tRes.tested("removeUpdateListener()", bResult); + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseCheckBox.java b/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseCheckBox.java new file mode 100644 index 000000000..23d01c1fe --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseCheckBox.java @@ -0,0 +1,27 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +package ifc.form.binding; + +import lib.MultiPropertyTest; + +public class _BindableDatabaseCheckBox extends MultiPropertyTest +{ + +} diff --git a/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseRadioButton.java b/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseRadioButton.java new file mode 100644 index 000000000..dd59dba3f --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/binding/_BindableDatabaseRadioButton.java @@ -0,0 +1,27 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +package ifc.form.binding; + +import lib.MultiPropertyTest; + +public class _BindableDatabaseRadioButton extends MultiPropertyTest +{ + +} diff --git a/qadevOOo/tests/java/ifc/form/binding/_XBindableValue.java b/qadevOOo/tests/java/ifc/form/binding/_XBindableValue.java new file mode 100644 index 000000000..e0131bb45 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/binding/_XBindableValue.java @@ -0,0 +1,106 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form.binding; + +import com.sun.star.form.binding.XBindableValue; +import com.sun.star.form.binding.XValueBinding; +import com.sun.star.uno.Type; + +import java.util.ArrayList; + +import lib.MultiMethodTest; + + +public class _XBindableValue extends MultiMethodTest { + public XBindableValue oObj; + protected XValueBinding xValueBinding = null; + + public void _getValueBinding() { + requiredMethod("setValueBinding"); + + boolean res = true; + xValueBinding = oObj.getValueBinding(); + res &= checkValueBinding(xValueBinding); + tRes.tested("getValueBinding()", res); + } + + public void _setValueBinding() { + String rightOne = ""; + + try { + oObj.setValueBinding(new MyValueBinding()); + rightOne = (String) oObj.getValueBinding().getValue(null); + } catch (com.sun.star.form.binding.IncompatibleTypesException e) { + e.printStackTrace(); + } + + boolean res = rightOne.equals("MyValueBinding"); + + if (!res) { + log.println("Expected: MyValueBinding"); + log.println("getting: " + rightOne); + } + + tRes.tested("setValueBinding()", res); + } + + protected boolean checkValueBinding(XValueBinding xValueBinding) { + boolean res = true; + Type[] types = xValueBinding.getSupportedValueTypes(); + log.println("Checking: "); + + for (int i = 0; i < types.length; i++) { + log.println("\t" + types[i].getTypeName()); + + boolean localRes = xValueBinding.supportsType(types[i]); + + if (!localRes) { + log.println("\t\tsupportsType returns false -- FAILED"); + } else { + log.println("\t\tis supported -- OK"); + } + + res &= localRes; + } + + return res; + } + + static class MyValueBinding implements XValueBinding { + private final ArrayList<Type> types = new ArrayList<Type>(); + + public com.sun.star.uno.Type[] getSupportedValueTypes() { + return types.toArray(new Type[types.size()]); + } + + public Object getValue(com.sun.star.uno.Type type) + throws com.sun.star.form.binding.IncompatibleTypesException { + return "MyValueBinding"; + } + + public void setValue(Object obj) + throws com.sun.star.form.binding.IncompatibleTypesException, + com.sun.star.lang.NoSupportException { + } + + public boolean supportsType(com.sun.star.uno.Type type) { + types.add(type); + return true; + } + } +} diff --git a/qadevOOo/tests/java/ifc/form/component/_CheckBox.java b/qadevOOo/tests/java/ifc/form/component/_CheckBox.java new file mode 100644 index 000000000..9fc401a5a --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_CheckBox.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.CheckBox</code> +* service properties : +* <ul> +* <li><code> DefaultState</code></li> +* <li><code> RefValue</code></li> +* </ul> <p> +* @see com.sun.star.form.component.CheckBox +*/ +public class _CheckBox extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_ComboBox.java b/qadevOOo/tests/java/ifc/form/component/_ComboBox.java new file mode 100644 index 000000000..84001ce11 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_ComboBox.java @@ -0,0 +1,34 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.ComboBox</code> +* service properties : +* <ul> +* <li><code> DefaultText</code></li> +* </ul> <p> +* @see com.sun.star.form.component.ComboBox +*/ +public class _ComboBox extends MultiPropertyTest { + // these properties don't needed in special code. +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_CommandButton.java b/qadevOOo/tests/java/ifc/form/component/_CommandButton.java new file mode 100644 index 000000000..ac1bfaafd --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_CommandButton.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.CommandButton</code> +* service properties : +* <ul> +* <li><code> ButtonType</code></li> +* <li><code> TargetFrame</code></li> +* <li><code> TargetURL</code></li> +* </ul> +* @see com.sun.star.form.component.CommandButton +*/ +public class _CommandButton extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_CurrencyField.java b/qadevOOo/tests/java/ifc/form/component/_CurrencyField.java new file mode 100644 index 000000000..ae1d7de26 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_CurrencyField.java @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.CurrencyField</code> +* service properties : +* <ul> +* <li><code> DefaultValue</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.CurrencyField +*/ +public class _CurrencyField extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _DefaultValue() { + testProperty("DefaultValue", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return util.utils.isVoid(old) ? new Double(17.5) : + super.getNewValue(p, old) ; + } + }) ; + } +} // finish class _CurrencyField + + diff --git a/qadevOOo/tests/java/ifc/form/component/_DataForm.java b/qadevOOo/tests/java/ifc/form/component/_DataForm.java new file mode 100644 index 000000000..4ea3e11ce --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DataForm.java @@ -0,0 +1,83 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +import com.sun.star.form.TabulatorCycle; +import com.sun.star.uno.Enum; + +/** +* Testing <code>com.sun.star.form.component.DataForm</code> +* service properties : +* <ul> +* <li><code> MasterFields</code></li> +* <li><code> DetailFields</code></li> +* <li><code> Cycle</code></li> +* <li><code> NavigationBarMode</code></li> +* <li><code> AllowInserts</code></li> +* <li><code> AllowUpdates</code></li> +* <li><code> AllowDeletes</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DataForm +*/ +public class _DataForm extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must be defined. + */ + public void _NavigationBarMode() { + testProperty("NavigationBarMode", new PropertyTester() { + @Override + public String toString(Object obj) { + if (util.utils.isVoid(obj)) { + return "null"; + } else { + return "(" + obj.getClass().toString() + ")" + + ((Enum)obj).getValue(); + } + } + }); + } + + /** + * This property can be VOID, and in case if it is so new + * value must be defined. + */ + public void _Cycle() { + testProperty("Cycle", new PropertyTester() { + @Override + public Object getNewValue(String propName, Object oldValue) { + return TabulatorCycle.CURRENT; + } + @Override + public String toString(Object obj) { + if (util.utils.isVoid(obj)) + return "null"; + else + return "(" + obj.getClass().toString() + ")" + + ((Enum)obj).getValue(); + } + }); + } + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseComboBox.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseComboBox.java new file mode 100644 index 000000000..cb72ff5ed --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseComboBox.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component ; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.DatabaseComboBox</code> +* service properties : +* <ul> +* <li><code> ConvertEmptyToNull</code></li> +* <li><code> ListSource</code></li> +* <li><code> ListSourceType</code></li> +* </ul> <p> +* All properties are tested by class <code>MultiPropertyTest</code> +* @see com.sun.star.form.component.DatabaseComboBox +*/ +public class _DatabaseComboBox extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java new file mode 100644 index 000000000..887c881a2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseForm.java @@ -0,0 +1,88 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; +import util.dbg; + +import com.sun.star.form.TabulatorCycle; +import com.sun.star.uno.Enum; +import java.io.UnsupportedEncodingException; + +/** +* Testing <code>com.sun.star.form.component.DatabaseForm</code> +* service properties: +* <ul> +* <li><code> MasterFields</code></li> +* <li><code> DetailFields</code></li> +* <li><code> Cycle</code></li> +* <li><code> NavigationBarMode</code></li> +* <li><code> AllowInserts</code></li> +* <li><code> AllowUpdates</code></li> +* <li><code> AllowDeletes</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DatabaseForm +*/ +public class _DatabaseForm extends MultiPropertyTest { + + /** + * In this property test only debugging information output + * is customized. + */ + public void _NavigationBarMode() throws UnsupportedEncodingException { + dbg.printPropertyInfo(oObj, "NavigationBarMode"); + testProperty("NavigationBarMode", new PropertyTester() { + @Override + public String toString(Object obj) { + if (obj == null) { + return "null"; + } else { + return "(" + obj.getClass().toString() + ")" + + ((Enum)obj).getValue(); + } + } + }); + } + + /** + * This property new value is always fixed and debugging + * information output is customized. + */ + public void _Cycle() throws UnsupportedEncodingException { + dbg.printPropertyInfo(oObj, "Cycle"); + testProperty("Cycle", new PropertyTester() { + @Override + public Object getNewValue(String propName, Object oldValue) { + return TabulatorCycle.CURRENT; + } + + @Override + public String toString(Object obj) { + if (obj == null) { + return "null"; + } else { + return "(" + obj.getClass().toString() + ")" + + ((Enum)obj).getValue(); + } + } + }); + } +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseFormattedField.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseFormattedField.java new file mode 100644 index 000000000..85b352ef6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseFormattedField.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component ; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.DatabaseFormattedField</code> +* service properties : +* <ul> +* <li><code> ConvertEmptyToNull</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DatabaseFormattedField +*/ +public class _DatabaseFormattedField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseImageControl.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseImageControl.java new file mode 100644 index 000000000..ab675911a --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseImageControl.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.DatabaseImageControl</code> +* service properties : +* <ul> +* <li><code> ReadOnly</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DatabaseImageControl +*/ +public class _DatabaseImageControl extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseListBox.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseListBox.java new file mode 100644 index 000000000..ef8299080 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseListBox.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/* +* Testing <code>com.sun.star.form.component.DatabaseListBox</code> +* service properties : +* <ul> +* <li><code> BoundColumn</code></li> +* <li><code> ListSourceType</code></li> +* </ul> <p> +* All properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DatabaseListBox +*/ +public class _DatabaseListBox extends MultiPropertyTest { + // these properties don't needed in special code. +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabasePatternField.java b/qadevOOo/tests/java/ifc/form/component/_DatabasePatternField.java new file mode 100644 index 000000000..184e92511 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabasePatternField.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.DatabasePatternField</code> +* service properties : +* <ul> +* <li><code> ConvertEmptyToNull</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.DatabasePatternField +*/ +public class _DatabasePatternField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DatabaseTextField.java b/qadevOOo/tests/java/ifc/form/component/_DatabaseTextField.java new file mode 100644 index 000000000..37ff264c6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DatabaseTextField.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.DatabaseTextField</code> +* service properties : +* <ul> +* <li><code> ConvertEmptyToNull</code></li> +* </ul> <p> +* All properties are tested by class <code>MultiPropertyTest</code> +* @see com.sun.star.form.component.DatabaseTextField +*/ +public class _DatabaseTextField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_DateField.java b/qadevOOo/tests/java/ifc/form/component/_DateField.java new file mode 100644 index 000000000..4a0688a22 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_DateField.java @@ -0,0 +1,47 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.DateField</code> +* service properties : +* <ul> +* <li><code> DefaultDate</code></li> +* </ul> +* @see com.sun.star.form.component.DateField +*/ +public class _DateField extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _DefaultDate() { + testProperty("DefaultDate", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(20010507) : + super.getNewValue(prop, old) ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_FileControl.java b/qadevOOo/tests/java/ifc/form/component/_FileControl.java new file mode 100644 index 000000000..2cc5e5292 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_FileControl.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/* +* Testing <code>com.sun.star.form.component.FileControl</code> +* service properties : +* <ul> +* <li><code> DefaultText</code></li> +* </ul> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.FileControl +*/ +public class _FileControl extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_FormattedField.java b/qadevOOo/tests/java/ifc/form/component/_FormattedField.java new file mode 100644 index 000000000..37ce620f3 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_FormattedField.java @@ -0,0 +1,26 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component ; + +import lib.MultiPropertyTest; + +public class _FormattedField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_GridControl.java b/qadevOOo/tests/java/ifc/form/component/_GridControl.java new file mode 100644 index 000000000..de773f4d2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_GridControl.java @@ -0,0 +1,96 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.GridControl</code> +* service properties : +* <ul> +* <li><code> Border</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> RowHeight</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* </ul> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.GridControl +*/ +public class _GridControl extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _RowHeight() { + testProperty("RowHeight", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(11) : + super.getNewValue(prop, old) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Boolean.TRUE : + super.getNewValue(prop, old) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(342) : + super.getNewValue(prop, old) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(342) : + super.getNewValue(prop, old) ; + } + }) ; + } +} // finish class _GridControl + + diff --git a/qadevOOo/tests/java/ifc/form/component/_HTMLForm.java b/qadevOOo/tests/java/ifc/form/component/_HTMLForm.java new file mode 100644 index 000000000..a79e2500e --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_HTMLForm.java @@ -0,0 +1,38 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.HTMLForm</code> +* service properties : +* <ul> +* <li><code> TargetFrame</code></li> +* <li><code> TargetURL</code></li> +* <li><code> SubmitMethod</code></li> +* <li><code> SubmitEncoding</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.HTMLForm +*/ +public class _HTMLForm extends MultiPropertyTest { + +} // finish class _HTMLForm + diff --git a/qadevOOo/tests/java/ifc/form/component/_HiddenControl.java b/qadevOOo/tests/java/ifc/form/component/_HiddenControl.java new file mode 100644 index 000000000..eb77e1cd5 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_HiddenControl.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.HiddenControl</code> +* service properties : +* <ul> +* <li><code> HiddenValue</code></li> +* </ul> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.HiddenControl +*/ +public class _HiddenControl extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_ImageButton.java b/qadevOOo/tests/java/ifc/form/component/_ImageButton.java new file mode 100644 index 000000000..208defc43 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_ImageButton.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.ImageButton</code> +* service properties : +* <ul> +* <li><code> ButtonType</code></li> +* <li><code> TargetFrame</code></li> +* <li><code> TargetURL</code></li> +* </ul> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.ImageButton +*/ +public class _ImageButton extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_ListBox.java b/qadevOOo/tests/java/ifc/form/component/_ListBox.java new file mode 100644 index 000000000..bdcdad7f1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_ListBox.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.ListBox</code> +* service properties : +* <ul> +* <li><code> DefaultSelection</code></li> +* <li><code> ListSource</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.ListBox +*/ +public class _ListBox extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_NavigationToolBar.java b/qadevOOo/tests/java/ifc/form/component/_NavigationToolBar.java new file mode 100644 index 000000000..23e3473c1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_NavigationToolBar.java @@ -0,0 +1,45 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +public class _NavigationToolBar extends MultiPropertyTest { + + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(20010507) : + super.getNewValue(prop, old) ; + } + }) ; + } + + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? Integer.valueOf(20050507) : + super.getNewValue(prop, old) ; + } + }) ; + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/ifc/form/component/_NumericField.java b/qadevOOo/tests/java/ifc/form/component/_NumericField.java new file mode 100644 index 000000000..463e780c9 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_NumericField.java @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.NumericField</code> +* service properties : +* <ul> +* <li><code> DefaultValue</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.NumericField +*/ +public class _NumericField extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _DefaultValue() { + testProperty("DefaultValue", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return util.utils.isVoid(old) ? new Double(111.11) : + super.getNewValue(prop, old) ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_PatternField.java b/qadevOOo/tests/java/ifc/form/component/_PatternField.java new file mode 100644 index 000000000..67623ddfd --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_PatternField.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.PatternField</code> +* service properties : +* <ul> +* <li><code> DefaultText</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.PatternField +*/ +public class _PatternField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_RadioButton.java b/qadevOOo/tests/java/ifc/form/component/_RadioButton.java new file mode 100644 index 000000000..17a45a46f --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_RadioButton.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.form.component.RadioButton</code> +* service properties : +* <ul> +* <li><code> DefaultState</code></li> +* <li><code> RefValue</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.RadioButton +*/ +public class _RadioButton extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_RichTextControl.java b/qadevOOo/tests/java/ifc/form/component/_RichTextControl.java new file mode 100644 index 000000000..4150be3a5 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_RichTextControl.java @@ -0,0 +1,25 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +public class _RichTextControl extends MultiPropertyTest { + +} diff --git a/qadevOOo/tests/java/ifc/form/component/_ScrollBar.java b/qadevOOo/tests/java/ifc/form/component/_ScrollBar.java new file mode 100644 index 000000000..d6021c73d --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_ScrollBar.java @@ -0,0 +1,25 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +public class _ScrollBar extends MultiPropertyTest{ + +} diff --git a/qadevOOo/tests/java/ifc/form/component/_SpinButton.java b/qadevOOo/tests/java/ifc/form/component/_SpinButton.java new file mode 100644 index 000000000..8d7ae9c11 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_SpinButton.java @@ -0,0 +1,25 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +public class _SpinButton extends MultiPropertyTest { + +} diff --git a/qadevOOo/tests/java/ifc/form/component/_TextField.java b/qadevOOo/tests/java/ifc/form/component/_TextField.java new file mode 100644 index 000000000..f6b81a1ea --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_TextField.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.form.component.TextField</code> +* service properties : +* <ul> +* <li><code> DefaultText</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.TextField +*/ +public class _TextField extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/form/component/_TimeField.java b/qadevOOo/tests/java/ifc/form/component/_TimeField.java new file mode 100644 index 000000000..1faa5d959 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/component/_TimeField.java @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.component; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.form.component.TimeField</code> +* service properties : +* <ul> +* <li><code> DefaultTime</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.form.component.TimeField +*/ +public class _TimeField extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _DefaultTime() { + testProperty("DefaultTime", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : + super.getNewValue(p, old) ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/form/submission/_XSubmission.java b/qadevOOo/tests/java/ifc/form/submission/_XSubmission.java new file mode 100644 index 000000000..ce70afb20 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/submission/_XSubmission.java @@ -0,0 +1,178 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form.submission; + +import com.sun.star.form.submission.XSubmission; +import com.sun.star.form.submission.XSubmissionVetoListener; + +import lib.MultiMethodTest; + + +public class _XSubmission extends MultiMethodTest { + public XSubmission oObj = null; + + public void _addSubmissionVetoListener() { + log.println( + "submitting with VetoListener ... exception should appear"); + + boolean res = true; + XSubmissionVetoListener aListener = new MyListener(); + + try { + oObj.addSubmissionVetoListener(aListener); + oObj.submit(); + res = false; + log.println( + "the expected exception wasn't thrown ... FAILED"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println( + "Expected exception was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.lang.NoSupportException e) { + log.println( + "NoSupportExpected exception was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.util.VetoException e) { + log.println( + "VetoException was thrown while calling submit() " + + e.getMessage() + "OK"); + } + + try { + oObj.removeSubmissionVetoListener(aListener); + } catch (com.sun.star.lang.NoSupportException e) { + log.println( + "NoSupportExpected exception was thrown while removing the listener) " + + e.getMessage() + "FAILED"); + res = false; + } + + tRes.tested("addSubmissionVetoListener()", res); + } + + public void _removeSubmissionVetoListener() { + log.println( + "submitting with VetoListener ... exception should appear"); + + boolean res = true; + XSubmissionVetoListener aListener = new MyListener(); + + try { + oObj.addSubmissionVetoListener(aListener); + oObj.submit(); + res = false; + log.println( + "the expected exception wasn't thrown ... FAILED"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println( + "WrappedTargetException exception was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.lang.NoSupportException e) { + log.println( + "NoSupportExpected exception was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.util.VetoException e) { + log.println( + "VetoException was thrown while calling submit() " + + e.getMessage() + "OK"); + } + + log.println("removing the listener"); + + try { + oObj.removeSubmissionVetoListener(aListener); + } catch (com.sun.star.lang.NoSupportException e) { + log.println( + "NoSupportExpected exception was thrown while removing the listener) " + + e.getMessage() + "FAILED"); + res = false; + } + + log.println("Sleeping 2s"); + + waitForEventIdle(); + + log.println("... done"); + + log.println( + "submitting after VetoListener has been removed... no exception should appear"); + + try { + oObj.submit(); + log.println("No Exception ... OK"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println( + "WrappedTargetException was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.util.VetoException e) { + log.println( + "VetoException was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } + + tRes.tested("removeSubmissionVetoListener()", res); + } + + /** Calls submit and returns true if no exception was thrown + * then adds a SubmissionVetoListener and checks if the + * exception is thrown in case of a veto of this listener. + */ + public void _submit() { + boolean res = true; + log.println( + "submitting without VetoListener ... no exception should appear"); + + try { + oObj.submit(); + log.println("No Exception ... OK"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println( + "Exception was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } catch (com.sun.star.util.VetoException e) { + log.println( + "VetoException was thrown while calling submit() " + + e.getMessage() + "FAILED"); + res = false; + } + + tRes.tested("submit()", res); + } + + public class MyListener implements XSubmissionVetoListener { + public void disposing( + com.sun.star.lang.EventObject eventObject) { + } + + public void submitting( + com.sun.star.lang.EventObject eventObject) + throws com.sun.star.util.VetoException { + log.println("MyVetoListener was called"); + throw new com.sun.star.util.VetoException( + "submission isn't allowed ..."); + } + } + +} diff --git a/qadevOOo/tests/java/ifc/form/submission/_XSubmissionSupplier.java b/qadevOOo/tests/java/ifc/form/submission/_XSubmissionSupplier.java new file mode 100644 index 000000000..d0fd030af --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/submission/_XSubmissionSupplier.java @@ -0,0 +1,72 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.form.submission; + +import com.sun.star.form.submission.XSubmission; +import com.sun.star.form.submission.XSubmissionSupplier; +import com.sun.star.form.submission.XSubmissionVetoListener; +import com.sun.star.task.XInteractionHandler; +import lib.MultiMethodTest; + +public class _XSubmissionSupplier extends MultiMethodTest +{ + public XSubmissionSupplier oObj = null; + public boolean submitWasCalled = false; + + public void _Submission() { + XSubmission stub = new MyXSubmission(); + oObj.setSubmission (stub); + XSubmission xSubmission = oObj.getSubmission (); + try { + xSubmission.submit (); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Exception during submit "+e.getMessage ()); + } + catch (com.sun.star.util.VetoException e) { + log.println("VetoException during submit "+e.getMessage ()); + } + tRes.tested ("Submission()",submitWasCalled); + } + + private class MyXSubmission implements XSubmission { + + public void submit () throws com.sun.star.util.VetoException, com.sun.star.lang.WrappedTargetException + { + submitWasCalled=true; + log.println("MyXSubmission: someone called submit :-)"); + } + + public void submitWithInteraction( XInteractionHandler handler ) throws com.sun.star.util.VetoException, com.sun.star.lang.WrappedTargetException + { + log.println("MyXSubmission: someone called submitWithInteraction :-)"); + } + + public void addSubmissionVetoListener( XSubmissionVetoListener listener ) throws com.sun.star.lang.NoSupportException + { + throw new com.sun.star.lang.NoSupportException(); + } + + public void removeSubmissionVetoListener( XSubmissionVetoListener listener ) throws com.sun.star.lang.NoSupportException + { + throw new com.sun.star.lang.NoSupportException(); + } + + } + +} diff --git a/qadevOOo/tests/java/ifc/form/validation/_XValidatable.java b/qadevOOo/tests/java/ifc/form/validation/_XValidatable.java new file mode 100644 index 000000000..eec5315ed --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/validation/_XValidatable.java @@ -0,0 +1,76 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form.validation; + +import com.sun.star.form.validation.XValidatable; +import com.sun.star.form.validation.XValidator; + +import lib.MultiMethodTest; + + +public class _XValidatable extends MultiMethodTest { + public XValidatable oObj; + + public void _getValidator() { + requiredMethod("setValidator()"); + + XValidator xValidator = oObj.getValidator(); + boolean res = xValidator.isValid(Boolean.FALSE); + tRes.tested("getValidator()", res); + } + + public void _setValidator() { + boolean res = false; + + try { + oObj.setValidator(new MyValidator()); + + XValidator xValidator = oObj.getValidator(); + String getting = xValidator.explainInvalid(null); + res = getting.equals("explainInvalid"); + + if (!res) { + log.println("\tExpected: explainInvalid"); + log.println("\tGetting: " + getting); + log.println("FAILED"); + } + } catch (com.sun.star.util.VetoException e) { + e.printStackTrace(); + } + + tRes.tested("setValidator()", res); + } + + public static class MyValidator implements XValidator { + public void addValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) + throws com.sun.star.lang.NullPointerException { + } + + public String explainInvalid(Object obj) { + return "explainInvalid"; + } + + public boolean isValid(Object obj) { + return true; + } + + public void removeValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) + throws com.sun.star.lang.NullPointerException { + } + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java b/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java new file mode 100644 index 000000000..cb1dd831a --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/validation/_XValidatableFormComponent.java @@ -0,0 +1,229 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form.validation; + +import com.sun.star.beans.Property; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.XMultiPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.form.validation.XFormComponentValidityListener; +import com.sun.star.form.validation.XValidatableFormComponent; +import com.sun.star.uno.UnoRuntime; + +import lib.MultiMethodTest; + +import util.ValueChanger; + +import java.util.StringTokenizer; + + +public class _XValidatableFormComponent extends MultiMethodTest +{ + public XValidatableFormComponent oObj; + protected XFormComponentValidityListener listener = null; + public boolean listenerCalled = false; + private String[] testPropsNames = null; + private int testPropsAmount = 0; + + public void _addFormComponentValidityListener() + { + listener = new MyListener(); + + boolean res = true; + + try + { + oObj.addFormComponentValidityListener(listener); + } + catch (com.sun.star.lang.NullPointerException e) + { + res = false; + e.printStackTrace(); + } + + changeAllProperties(); + res &= listenerCalled; + tRes.tested("addFormComponentValidityListener()", res); + } + + public void _getCurrentValue() + { + oObj.getCurrentValue(); + tRes.tested("getCurrentValue()", true); + } + + public void _isValid() + { + boolean res = oObj.isValid(); + tRes.tested("isValid()", res); + } + + public void _removeFormComponentValidityListener() + { + requiredMethod("isValid()"); + + try + { + oObj.removeFormComponentValidityListener(listener); + } + catch (com.sun.star.lang.NullPointerException e) + { + e.printStackTrace(); + } + + listenerCalled = false; + changeAllProperties(); + tRes.tested("removeFormComponentValidityListener()", true); + } + + protected void changeAllProperties() + { + XMultiPropertySet mProps = + UnoRuntime.queryInterface( + XMultiPropertySet.class, tEnv.getTestObject() + ); + XPropertySetInfo propertySetInfo = mProps.getPropertySetInfo(); + Property[] properties = propertySetInfo.getProperties(); + getPropsToTest(properties); + log.println("Changing all properties"); + + Object[] gValues = mProps.getPropertyValues(testPropsNames); + + for (int i = 0; i < testPropsAmount; i++) + { + Object oldValue = gValues[i]; + + if ( + testPropsNames[i].equals("Value") + || testPropsNames[i].equals("EffectiveValue") + ) + { + oldValue = Integer.valueOf(10); + } + else if (testPropsNames[i].equals("Time")) + { + oldValue = new com.sun.star.util.Time( + 10, (short) 10, (short) 10, (short) 10, false); + } + + Object newValue = ValueChanger.changePValue(oldValue); + gValues[i] = newValue; + } + + try + { + mProps.setPropertyValues(testPropsNames, gValues); + } + catch (com.sun.star.beans.PropertyVetoException e) + { + log.println("Exception occurred while setting properties"); + e.printStackTrace(log); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + log.println("Exception occurred while setting properties"); + e.printStackTrace(log); + } + catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("Exception occurred while setting properties"); + e.printStackTrace(log); + } + // end of try-catch + } + + //Get the properties being tested + private void getPropsToTest(Property[] properties) + { + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < properties.length; i++) + { + Property property = properties[i]; + String name = property.Name; + boolean isWritable = + ((property.Attributes & PropertyAttribute.READONLY) == 0); + boolean isNotNull = + ((property.Attributes & PropertyAttribute.MAYBEVOID) == 0); + //these have values that are interfaces we can't change + if ( + name.equals("TextUserDefinedAttributes") + || name.equals("ReferenceDevice") + || name.equals("ParaUserDefinedAttributes") + ) + { + isWritable = false; + } + + if ( + name.equals("Value") || name.equals("Time") + || name.equals("Date") + ) + { + sb = new StringBuilder(name + ";"); + } + + if ( + isWritable && isNotNull && (name.indexOf("Format") < 0) + && !name.equals("Enabled") + ) + { + sb.append(name + ";"); + } + } + + String bound = sb.toString(); + // endfor + + //get an array of bound properties + if (bound.equals("")) + { + bound = "none"; + } + + if (tEnv.getTestCase().getObjectName().indexOf("Formatted") > 0) + { + bound = "EffectiveValue;"; + } + + StringTokenizer ST = new StringTokenizer(bound, ";"); + int nr = ST.countTokens(); + testPropsNames = new String[nr]; + + for (int i = 0; i < nr; i++) + testPropsNames[i] = ST.nextToken(); + + testPropsAmount = nr; + } + + protected class MyListener implements XFormComponentValidityListener + { + public void componentValidityChanged( + com.sun.star.lang.EventObject eventObject + ) + { + System.out.println("componentValidityChanged called"); + listenerCalled = true; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) + { + System.out.println("Listener Disposed"); + } + } +} diff --git a/qadevOOo/tests/java/ifc/form/validation/_XValidityConstraintListener.java b/qadevOOo/tests/java/ifc/form/validation/_XValidityConstraintListener.java new file mode 100644 index 000000000..3c4362758 --- /dev/null +++ b/qadevOOo/tests/java/ifc/form/validation/_XValidityConstraintListener.java @@ -0,0 +1,81 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.form.validation; + +import com.sun.star.form.validation.XValidatable; +import com.sun.star.form.validation.XValidator; +import com.sun.star.form.validation.XValidityConstraintListener; +import com.sun.star.uno.UnoRuntime; + +import lib.MultiMethodTest; + + +public class _XValidityConstraintListener extends MultiMethodTest { + public XValidityConstraintListener oObj; + protected boolean ValidatorCalled = false; + + public void _validityConstraintChanged() { + boolean res = false; + try { + XValidatable xValidatable = UnoRuntime.queryInterface( + XValidatable.class, + tEnv.getTestObject()); + + log.println("adding Validator"); + XValidator xValidator = new MyValidator(); + xValidatable.setValidator(xValidator); + ValidatorCalled = false; + + log.println("calling validityConstraintChanged()"); + oObj.validityConstraintChanged( + new com.sun.star.lang.EventObject()); + res = ValidatorCalled; + } catch (com.sun.star.util.VetoException e) { + e.printStackTrace(); + } + tRes.tested("validityConstraintChanged()",res); + } + + /* + * The validator to add this Listener implementation + * + */ + public class MyValidator implements XValidator { + public void addValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) + throws com.sun.star.lang.NullPointerException { + log.println("\t Validator::addValidityConstraintListener called"); + } + + public String explainInvalid(Object obj) { + log.println("\t Validator::explainInvalid() called"); + + return "explainInvalid"; + } + + public boolean isValid(Object obj) { + log.println("\t Validator::isValid() called"); + ValidatorCalled = true; + return false; + } + + public void removeValidityConstraintListener(com.sun.star.form.validation.XValidityConstraintListener xValidityConstraintListener) + throws com.sun.star.lang.NullPointerException { + log.println("\t Validator::removeValidityConstraintListener called"); + } + } +}
\ No newline at end of file |