diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /qadevOOo/tests/java/ifc/awt | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qadevOOo/tests/java/ifc/awt')
64 files changed, 10457 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlButtonModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlButtonModel.java new file mode 100644 index 0000000000..93d2063d5e --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlButtonModel.java @@ -0,0 +1,115 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; + +/* +* Testing <code>com.sun.star.awt.UnoControlButtonModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> DefaultButton</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Label</code></li> +* <li><code> Printable</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* </ul> +* @see com.sun.star.awt.UnoControlButtonModel +*/ +public class _UnoControlButtonModel extends MultiPropertyTest { + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester BoolTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Boolean.TRUE)) + return Boolean.FALSE; + else + return Boolean.TRUE; + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BackgroundColor() { + log.println("Testing with custom Property tester") ; + testProperty("BackgroundColor", ColorTester) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextColor", ColorTester) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _Tabstop() { + log.println("Testing with custom Property tester") ; + testProperty("Tabstop", BoolTester) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _PushButtonType() { + log.println("Testing with custom Property tester") ; + testProperty("PushButtonType", + Short.valueOf((short)0), Short.valueOf((short)1)); + } + + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlCheckBoxModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlCheckBoxModel.java new file mode 100644 index 0000000000..74906e8bf0 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlCheckBoxModel.java @@ -0,0 +1,104 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlCheckBoxModel</code> +* service properties : +* <ul> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Label</code></li> +* <li><code> Printable</code></li> +* <li><code> State</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* <li><code> TriState</code></li> +* </ul> +* @see com.sun.star.awt.UnoControlCheckBoxModel +*/ +public class _UnoControlCheckBoxModel extends MultiPropertyTest { + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * 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 p, Object old) { + if (utils.isVoid(old)) return Boolean.TRUE ; + else return null ; + } + }) ; + } + + /** + * 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 p, Object old) { + if (utils.isVoid(old)) return Integer.valueOf(12345) ; + else return null ; + } + }) ; + } + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlComboBoxModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlComboBoxModel.java new file mode 100644 index 0000000000..7e3202eba1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlComboBoxModel.java @@ -0,0 +1,134 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/* +* Testing <code>com.sun.star.awt.UnoControlComboBoxModel</code> +* service properties : +* <ul> +* <li><code> Autocomplete</code></li> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Dropdown</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> LineCount</code></li> +* <li><code> MaxTextLen</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> StringItemList</code></li> +* <li><code> Tabstop</code></li> +* <li><code> Text</code></li> +* <li><code> TextColor</code></li> +* </ul> +* @see com.sun.star.awt.UnoControlComboBoxModel +*/ +public class _UnoControlComboBoxModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + public void _Text() { + try { + oObj.setPropertyValue("MaxTextLen",Short.valueOf((short)0)); + } catch (com.sun.star.beans.UnknownPropertyException ue) { + } catch (com.sun.star.beans.PropertyVetoException pe) { + } catch (com.sun.star.lang.IllegalArgumentException ie) { + } catch (com.sun.star.lang.WrappedTargetException we) { + } + testProperty("Text"); + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } + +} //EOF UnoControlComboBoxModel + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlContainerModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlContainerModel.java new file mode 100644 index 0000000000..a57e92986e --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlContainerModel.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.awt; + +import lib.MultiPropertyTest; + +/* +* Testing <code>com.sun.star.awt.UnoControlButtonModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Enabled</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Printable</code></li> +* <li><code> Text</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* </ul> +* After test completion object environment has to be recreated. +* @see com.sun.star.awt.UnoControlContainerModel +*/ +public class _UnoControlContainerModel extends MultiPropertyTest { + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BackgroundColor() { + log.println("Testing with custom Property tester") ; + testProperty("BackgroundColor", ColorTester) ; + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlCurrencyFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlCurrencyFieldModel.java new file mode 100644 index 0000000000..5698cab3f3 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlCurrencyFieldModel.java @@ -0,0 +1,130 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlCurrencyFieldModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> CurrencySymbol</code></li> +* <li><code> DecimalAccuracy</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> ShowThousandsSeparator</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Spin</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* <li><code> Value</code></li> +* <li><code> ValueMax</code></li> +* <li><code> ValueMin</code></li> +* <li><code> ValueStep</code></li> +* </ul> +* @see com.sun.star.awt.UnoControlCurrencyFieldModel +*/ +public class _UnoControlCurrencyFieldModel extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return utils.isVoid(old) ? Integer.valueOf(6543) : null ; + } + }) ; + } + + /** + * 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 utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * 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 utils.isVoid(old) ? Integer.valueOf(123) : null ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return utils.isVoid(old) ? Integer.valueOf(123) : null ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _Value() { + testProperty("Value", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return utils.isVoid(old) ? Double.valueOf(777) : + super.getNewValue(prop, old) ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlDateFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlDateFieldModel.java new file mode 100644 index 0000000000..e0918f9e94 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlDateFieldModel.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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/* +* Testing <code>com.sun.star.awt.UnoControlDateFieldModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> Date</code></li> +* <li><code> DateMax</code></li> +* <li><code> DateMin</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> DateFormat</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Spin</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlDateFieldModel +*/ +public class _UnoControlDateFieldModel extends MultiPropertyTest { + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return utils.isVoid(old) ? Integer.valueOf(6543) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _Date() { + testProperty("Date", new PropertyTester() { + @Override + protected Object getNewValue(String prop, Object old) { + return utils.isVoid(old) ? Integer.valueOf(6543) : + 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 utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * 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 utils.isVoid(old) ? Integer.valueOf(123) : null ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } + + public void _DateShowCentury() { + boolean res = false; + try { + util.dbg.printPropertyInfo(oObj,"DateShowCentury",log); + Object oDsc = oObj.getPropertyValue("DateShowCentury"); + Boolean dsc = null; + if (util.utils.isVoid(oDsc)) { + log.println("Property is void, set it to true"); + dsc = Boolean.TRUE; + } else { + dsc = (Boolean) oDsc; + dsc = Boolean.valueOf(!dsc.booleanValue()); + log.println("Setting property to "+dsc); + } + oObj.setPropertyValue("DateShowCentury",dsc); + Boolean getdsc = (Boolean) oObj.getPropertyValue("DateShowCentury"); + log.println("Getting value "+getdsc); + res = dsc.equals(getdsc); + } catch (com.sun.star.beans.UnknownPropertyException upe) { + log.println("Don't know the Property 'DateShowCentury'"); + } catch (com.sun.star.lang.WrappedTargetException wte) { + log.println("WrappedTargetException while getting Property 'DateShowCentury'"); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + log.println("IllegalArgumentException while getting Property 'DateShowCentury'"); + } catch (com.sun.star.beans.PropertyVetoException pve) { + log.println("PropertyVetoException while getting Property 'DateShowCentury'"); + } + tRes.tested("DateShowCentury",res); + + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlDialogElement.java b/qadevOOo/tests/java/ifc/awt/_UnoControlDialogElement.java new file mode 100644 index 0000000000..b374321386 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlDialogElement.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.awt; + +import lib.MultiPropertyTest; + +public class _UnoControlDialogElement extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlDialogModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlDialogModel.java new file mode 100644 index 0000000000..e3fbbed11a --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlDialogModel.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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlDialogModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Title</code></li> +* <li><code> TextColor</code></li> +* <li><code> Sizeable</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlDialogModel +*/ +public class _UnoControlDialogModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlEditModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlEditModel.java new file mode 100644 index 0000000000..6d2617ccb7 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlEditModel.java @@ -0,0 +1,126 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlEditModel</code> +* service properties : +* <ul> +* <li><code> Align</code></li> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> EchoChar</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> HardLineBreaks</code></li> +* <li><code> HScroll</code></li> +* <li><code> MaxTextLen</code></li> +* <li><code> MultiLine</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Tabstop</code></li> +* <li><code> Text</code></li> +* <li><code> TextColor</code></li> +* <li><code> VScroll</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlEditModel +*/ +public class _UnoControlEditModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlFileControlModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlFileControlModel.java new file mode 100644 index 0000000000..3226f392a8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlFileControlModel.java @@ -0,0 +1,113 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlFileControlModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* <li><code> FontEmphasisMark</code></li> +* <li><code> FontRelief</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Printable</code></li> +* <li><code> Tabstop</code></li> +* <li><code> Text</code></li> +* <li><code> TextColor</code></li> +* <li><code> TextLineColor</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlFileControlModel +*/ +public class _UnoControlFileControlModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlFixedLineModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlFixedLineModel.java new file mode 100644 index 0000000000..bea4e906f8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlFixedLineModel.java @@ -0,0 +1,69 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlFixedLineModel</code> +* service properties : +* <ul> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* <li><code> Label</code></li> +* <li><code> Orientation</code></li> +* <li><code> Printable</code></li> +* <li><code> TextColor</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlFixedLineModel +*/ +public class _UnoControlFixedLineModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlFixedTextModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlFixedTextModel.java new file mode 100644 index 0000000000..3b2ed525f8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlFixedTextModel.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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlFixedTextModel</code> +* service properties : +* <ul> +* <li><code> Align</code></li> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Label</code></li> +* <li><code> MultiLine</code></li> +* <li><code> Printable</code></li> +* <li><code> TextColor</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlFixedTextModel +*/ +public class _UnoControlFixedTextModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlFormattedFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlFormattedFieldModel.java new file mode 100644 index 0000000000..4ab1a03bdf --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlFormattedFieldModel.java @@ -0,0 +1,254 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlFormattedFieldModel</code> +* service properties : +* <ul> +* <li><code> Align</code></li> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> EffectiveDefault</code></li> +* <li><code> EffectiveMax</code></li> +* <li><code> EffectiveMin</code></li> +* <li><code> EffectiveValue</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> FormatKey</code></li> +* <li><code> FormatsSupplier</code></li> +* <li><code> MaxTextLen</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Spin</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> Text</code></li> +* <li><code> TextColor</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlFormattedFieldModel +*/ +public class _UnoControlFormattedFieldModel extends MultiPropertyTest { + + /** + * Redefined method must return a valid service name, that differs from + * name exists. + * + */ + protected PropertyTester ControlTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, + "com.sun.star.form.control.FormattedField")) + return "com.sun.star.awt.UnoControlFormattedField"; + else + return "com.sun.star.form.control.FormattedField"; + } + }; + + /** + * This property must contain a valid service name. + */ + public void _DefaultControl() { + log.println("Testing with custom Property tester") ; + testProperty("DefaultControl", ControlTester) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * 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 p, Object v) { + return utils.isVoid(v) ? Integer.valueOf(123) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Integer.valueOf(123) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Integer.valueOf(123) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _EffectiveDefault() { + testProperty("EffectiveDefault", Double.valueOf(5.8),Double.valueOf(2.3)) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _EffectiveValue() { + testProperty("EffectiveValue", Double.valueOf(5.8),Double.valueOf(2.3)) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _EffectiveMax() { + testProperty("EffectiveMax", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Double.valueOf(123.8) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _FormatsSupplier() { + testProperty("FormatsSupplier", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + Object newValue = null; + try { + newValue = tParam.getMSF().createInstance( + "com.sun.star.util.NumberFormatsSupplier"); + } catch (com.sun.star.uno.Exception e) { + System.out.println("caught exception: " + e); + } + return newValue; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _EffectiveMin() { + testProperty("EffectiveMin", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Double.valueOf(0.1) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _FormatKey() { + testProperty("FormatKey", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Integer.valueOf(0) : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _StrictFromat() { + testProperty("StrictFromat", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? Boolean.TRUE : + super.getNewValue(p,v) ; + } + }) ; + } + + /** + * 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 p, Object v) { + return utils.isVoid(v) ? Boolean.TRUE : + null ; + } + }) ; + } + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _Text() { + testProperty("Text", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object v) { + return utils.isVoid(v) ? "UnoControlFormattedFieldModel" : + super.getNewValue(p,v) ; + } + }) ; + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlGroupBoxModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlGroupBoxModel.java new file mode 100644 index 0000000000..0b4899d8bb --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlGroupBoxModel.java @@ -0,0 +1,78 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlGroupBoxModel</code> +* service properties : +* <ul> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Label</code></li> +* <li><code> Printable</code></li> +* <li><code> TextColor</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlGroupBoxModel +*/ +public class _UnoControlGroupBoxModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : + super.getNewValue(p, old) ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlImageControlModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlImageControlModel.java new file mode 100644 index 0000000000..8b58c6284f --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlImageControlModel.java @@ -0,0 +1,104 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlImageControlModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor </code></li> +* <li><code> Border </code></li> +* <li><code> DefaultControl </code></li> +* <li><code> Enabled </code></li> +* <li><code> ImageURL </code></li> +* <li><code> Printable </code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlImageControlModel +*/ +public class _UnoControlImageControlModel extends MultiPropertyTest { + + /** + * Custom <code>PropertyTester</code> used in <code>ImageURL</code> test. + */ + protected PropertyTester URLTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg"))) + return util.utils.getFullTestURL("crazy-blue.jpg"); + else + return util.utils.getFullTestURL("space-metal.jpg"); + } + } ; + + /** + * Test changes one image URL onto another. + */ + public void _ImageURL() { + testProperty("ImageURL", URLTester) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + return utils.isVoid(oldValue) ? Integer.valueOf(8945) : + super.getNewValue(propName, oldValue) ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * 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 p, Object v) { + return utils.isVoid(v) ? Boolean.TRUE : + null ; + } + }) ; + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlListBoxModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlListBoxModel.java new file mode 100644 index 0000000000..4c9b682f1d --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlListBoxModel.java @@ -0,0 +1,122 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlListBoxModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Dropdown</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> LineCount</code></li> +* <li><code> MultiSelection</code></li> +* <li><code> Printable</code></li> +* <li><code> SelectedItems</code></li> +* <li><code> StringItemList</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* </ul> +* Almost all properties testing is automated by +* <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlListBoxModel +*/ +public class _UnoControlListBoxModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlModel.java new file mode 100644 index 0000000000..3ce601dd4b --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlModel.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.awt; + +import lib.MultiPropertyTest; + +public class _UnoControlModel extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlNumericFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlNumericFieldModel.java new file mode 100644 index 0000000000..f305c5823e --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlNumericFieldModel.java @@ -0,0 +1,130 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlNumericFieldModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DecimalAccuracy</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> ShowThousandsSeparator</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Spin</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* <li><code> Value</code></li> +* <li><code> ValueMax</code></li> +* <li><code> ValueMin</code></li> +* <li><code> ValueStep</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlNumericFieldModel +*/ +public class _UnoControlNumericFieldModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Value() { + testProperty("Value", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Double.valueOf(234.89) : + super.getNewValue(p, old) ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlPatternFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlPatternFieldModel.java new file mode 100644 index 0000000000..cd1814f30d --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlPatternFieldModel.java @@ -0,0 +1,112 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlPatternFieldModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> EditMask</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> LiteralMask</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> Text</code></li> +* <li><code> TextColor</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlPatternFieldModel +*/ +public class _UnoControlPatternFieldModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlProgressBarModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlProgressBarModel.java new file mode 100644 index 0000000000..9e998c8547 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlProgressBarModel.java @@ -0,0 +1,84 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlProgressBarModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FillColor</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* <li><code> Printable</code></li> +* <li><code> ProgressValue</code></li> +* <li><code> ProgressValueMax</code></li> +* <li><code> ProgressValueMin</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlProgressBarModel +*/ +public class _UnoControlProgressBarModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _FillColor() { + testProperty("FillColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _ProgressValue() { + testProperty("ProgressValue", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(10) : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlRadioButtonModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlRadioButtonModel.java new file mode 100644 index 0000000000..373c2f603e --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlRadioButtonModel.java @@ -0,0 +1,103 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlRadioButtonModel</code> +* service properties : +* <ul> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Label</code></li> +* <li><code> Printable</code></li> +* <li><code> State</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlRadioButtonModel +*/ +public class _UnoControlRadioButtonModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } + + /** + * Redefined method returns value, that differs from property value. + */ + protected PropertyTester ColorTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (util.ValueComparer.equalValue(oldValue, Integer.valueOf(17))) + return Integer.valueOf(25); + else + return Integer.valueOf(17); + } + }; + + /** + * This property can be void, so if old value is <code> null </code> + * new value must be specified. + */ + public void _TextLineColor() { + log.println("Testing with custom Property tester") ; + testProperty("TextLineColor", ColorTester) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlScrollBarModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlScrollBarModel.java new file mode 100644 index 0000000000..cc083692fa --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlScrollBarModel.java @@ -0,0 +1,111 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.UnoControlScrollBarModel</code> +* service properties : +* <ul> +* <li><code> BlockIncrement</code></li> +* <li><code> Border</code></li> +* <li><code> DefaultControl</code></li> +* <li><code> Enabled</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* <li><code> LineIncrement</code></li> +* <li><code> Orientation</code></li> +* <li><code> Printable</code></li> +* <li><code> ScrollValue</code></li> +* <li><code> ScrollValueMax</code></li> +* <li><code> VisibleSize</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlScrollBarModel +*/ +public class _UnoControlScrollBarModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(32768) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _SymbolColor() { + testProperty("SymbolColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(65324) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _ScrollValue() { + testProperty("ScrollValue", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(10) : Integer.valueOf(15) ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _VisibleSize() { + testProperty("VisibleSize", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(10) : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlSpinButtonModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlSpinButtonModel.java new file mode 100644 index 0000000000..2aa70a45c9 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlSpinButtonModel.java @@ -0,0 +1,65 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + +public class _UnoControlSpinButtonModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(32768) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _SymbolColor() { + testProperty("SymbolColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(65324) : null ; + } + }) ; + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/ifc/awt/_UnoControlTimeFieldModel.java b/qadevOOo/tests/java/ifc/awt/_UnoControlTimeFieldModel.java new file mode 100644 index 0000000000..fcc6b7246c --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_UnoControlTimeFieldModel.java @@ -0,0 +1,134 @@ +/* + * 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.awt; + +import lib.MultiPropertyTest; +import util.utils; + + +/** +* Testing <code>com.sun.star.awt.UnoControlTimeFieldModel</code> +* service properties : +* <ul> +* <li><code> BackgroundColor</code></li> +* <li><code> Border</code></li> +* <li><code> HelpText</code></li> +* <li><code> HelpURL</code></li> +* <li><code> FontEmphasisMark</code></li> +* <li><code> FontRelief</code></li> +* <li><code> Enabled</code></li> +* <li><code> TimeFormat</code></li> +* <li><code> FontDescriptor</code></li> +* <li><code> Printable</code></li> +* <li><code> ReadOnly</code></li> +* <li><code> Spin</code></li> +* <li><code> StrictFormat</code></li> +* <li><code> Tabstop</code></li> +* <li><code> TextColor</code></li> +* <li><code> TextLineColor</code></li> +* <li><code> Time</code></li> +* <li><code> TimeFormat</code></li> +* <li><code> TimeMax</code></li> +* <li><code> TimeMin</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.awt.UnoControlTimeFieldModel +*/ +public class _UnoControlTimeFieldModel extends MultiPropertyTest { + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BackgroundColor() { + testProperty("BackgroundColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _BorderColor() { + testProperty("BorderColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(1234) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextColor() { + testProperty("TextColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _TextLineColor() { + testProperty("TextLineColor", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : null ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Time() { + testProperty("Time", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Integer.valueOf(4321) : + super.getNewValue(p, old) ; + } + }) ; + } + + /** + * This property can be VOID, and in case if it is so new + * value must defined. + */ + public void _Tabstop() { + testProperty("Tabstop", new PropertyTester() { + @Override + protected Object getNewValue(String p, Object old) { + return utils.isVoid(old) ? Boolean.TRUE : null ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XButton.java b/qadevOOo/tests/java/ifc/awt/_XButton.java new file mode 100644 index 0000000000..4cd4364814 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XButton.java @@ -0,0 +1,103 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XButton; + +/** +* Testing <code>com.sun.star.awt.XButton</code> +* interface methods : +* <ul> +* <li><code> addActionListener()</code></li> +* <li><code> removeActionListener()</code></li> +* <li><code> setLabel()</code></li> +* <li><code> setActionCommand()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XButton +*/ +public class _XButton extends MultiMethodTest { + + public XButton oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestActionListener implements com.sun.star.awt.XActionListener { + + public void disposing(com.sun.star.lang.EventObject e) { + } + + public void actionPerformed(com.sun.star.awt.ActionEvent e) {} + } + + TestActionListener listener = new TestActionListener() ; + + /** + * !!! Can be checked only interactively !!! + */ + public void _addActionListener() { + + boolean result = true ; + oObj.addActionListener(listener) ; + + tRes.tested("addActionListener()", result) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeActionListener() { + + boolean result = true ; + oObj.removeActionListener(listener) ; + + tRes.tested("removeActionListener()", result) ; + } + + /** + * Just sets some text for label. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _setLabel() { + + boolean result = true ; + oObj.setLabel("XButton Label") ; + + tRes.tested("setLabel()", result) ; + } + + /** + * Just sets some command for button. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _setActionCommand() { + + boolean result = true ; + oObj.setActionCommand("XButtonCommand") ; + + tRes.tested("setActionCommand()", result) ; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XCheckBox.java b/qadevOOo/tests/java/ifc/awt/_XCheckBox.java new file mode 100644 index 0000000000..06073680e8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XCheckBox.java @@ -0,0 +1,135 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XCheckBox; + +/** +* Testing <code>com.sun.star.awt.XCheckBox</code> +* interface methods : +* <ul> +* <li><code> addItemListener()</code></li> +* <li><code> removeItemListener()</code></li> +* <li><code> getState()</code></li> +* <li><code> setState()</code></li> +* <li><code> setLabel()</code></li> +* <li><code> enableTriState()</code></li> +* </ul> <p> +* +* @see com.sun.star.awt.XCheckBox +*/ +public class _XCheckBox extends MultiMethodTest { + + public XCheckBox oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestItemListener implements com.sun.star.awt.XItemListener { + + public void disposing(com.sun.star.lang.EventObject e) { + } + + public void itemStateChanged(com.sun.star.awt.ItemEvent e) {} + } + TestItemListener listener = new TestItemListener() ; + short state = -1 ; + + /** + * !!! Can be checked only interactively !!! + */ + public void _addItemListener() { + + boolean result = true ; + oObj.addItemListener(listener) ; + tRes.tested("addItemListener()", result) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeItemListener() { + + boolean result = true ; + oObj.removeItemListener(listener) ; + + tRes.tested("removeItemListener()", result) ; + } + + /** + * Just retrieves current state and stores it. <p> + * Has <b>OK</b> status if no runtime exceptions occurs. + */ + public void _getState() { + + boolean result = true ; + state = oObj.getState() ; + + tRes.tested("getState()", result) ; + } + + /** + * Sets a new value and then checks get value. <p> + * Has <b>OK</b> status if set and get values are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getState </code> </li> + * </ul> + */ + public void _setState() { + requiredMethod("getState()") ; + + boolean result = true ; + short newState = state == 0 ? (short)1 : (short)0 ; + oObj.setState(newState) ; + result = newState == oObj.getState() ; + + tRes.tested("setState()", result) ; + } + + /** + * Just sets some text for label. <p> + * Has <b>OK</b> status if no runtime exceptions occurs. + */ + public void _setLabel() { + + boolean result = true ; + oObj.setLabel("XCheckBox test") ; + + tRes.tested("setLabel()", result) ; + } + + /** + * Just enables tristate. <p> + * Has <b>OK</b> status if no runtime exceptions occurs. + */ + public void _enableTriState() { + + boolean result = true ; + oObj.enableTriState(true) ; + + tRes.tested("enableTriState()", result) ; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XComboBox.java b/qadevOOo/tests/java/ifc/awt/_XComboBox.java new file mode 100644 index 0000000000..37bf4e3242 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XComboBox.java @@ -0,0 +1,262 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.awt.XComboBox; + +/** +* Testing <code>com.sun.star.awt.XComboBox</code> +* interface methods : +* <ul> +* <li><code> addItemListener()</code></li> +* <li><code> removeItemListener()</code></li> +* <li><code> addActionListener()</code></li> +* <li><code> removeActionListener()</code></li> +* <li><code> addItem()</code></li> +* <li><code> addItems()</code></li> +* <li><code> removeItems()</code></li> +* <li><code> getItemCount()</code></li> +* <li><code> getItem()</code></li> +* <li><code> getItems()</code></li> +* <li><code> getDropDownLineCount()</code></li> +* <li><code> setDropDownLineCount()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XComboBox +*/ +public class _XComboBox extends MultiMethodTest { + + public XComboBox oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestActionListener + implements com.sun.star.awt.XActionListener { + + public void disposing(com.sun.star.lang.EventObject e) {} + + public void actionPerformed(com.sun.star.awt.ActionEvent e) {} + } + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestItemListener + implements com.sun.star.awt.XItemListener { + + public void disposing(com.sun.star.lang.EventObject e) {} + + public void itemStateChanged(com.sun.star.awt.ItemEvent e) {} + } + private final TestActionListener actionListener = new TestActionListener(); + private final TestItemListener itemListener = new TestItemListener(); + short lineCount = 0; + short itemCount = 0; + + /** + * !!! Can be checked only interactively !!! + */ + public void _addItemListener() { + + oObj.addItemListener(itemListener); + + tRes.tested("addItemListener()", Status.skipped(true)); + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeItemListener() { + requiredMethod("addItemListener()"); + + oObj.removeItemListener(itemListener); + + tRes.tested("removeItemListener()", Status.skipped(true)); + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _addActionListener() { + + oObj.addActionListener(actionListener); + + tRes.tested("addActionListener()", Status.skipped(true)); + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeActionListener() { + requiredMethod("addActionListener()"); + + oObj.removeActionListener(actionListener); + + tRes.tested("removeActionListener()", Status.skipped(true)); + } + + /** + * Adds one item to the last position and check the number of + * items after addition. <p> + * Has <b>OK</b> status if the number of items increased by 1.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getItemCount </code> </li> + * </ul> + */ + public void _addItem() { + requiredMethod("getItemCount()"); + + boolean result = true; + oObj.addItem("Item1", itemCount); + result = oObj.getItemCount() == itemCount + 1; + + tRes.tested("addItem()", result); + } + + /** + * Adds one two items to the last position and check the number of + * items after addition. <p> + * Has <b>OK</b> status if the number of items increased by 2.<p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItem </code> </li> + * </ul> + */ + public void _addItems() { + executeMethod("addItem()"); + + boolean result = true; + short oldCnt = oObj.getItemCount(); + oObj.addItems(new String[] { "Item2", "Item3" }, oldCnt); + result = oObj.getItemCount() == oldCnt + 2; + + tRes.tested("addItems()", result); + } + + /** + * Gets the current number of items and tries to remove them all + * then checks number of items. <p> + * Has <b>OK</b> status if no items remains. <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> getItems </code> </li> + * <li> <code> getItem </code> </li> + * </ul> + */ + public void _removeItems() { + executeMethod("getItems()"); + executeMethod("getItem()"); + + boolean result = true; + short oldCnt = oObj.getItemCount(); + oObj.removeItems((short) 0, oldCnt); + result = oObj.getItemCount() == 0; + + tRes.tested("removeItems()", result); + } + + /** + * Just retrieves current number of items and stores it. <p> + * Has <b>OK</b> status if the count is not less than 0. + */ + public void _getItemCount() { + + itemCount = oObj.getItemCount(); + + tRes.tested("getItemCount()", itemCount >= 0); + } + + /** + * After <code>addItem</code> and <code>addItems</code> methods + * test the following items must exist {..., "Item1", "Item2", "Item3"} + * Retrieves the item from the position which was ititially the last.<p> + * Has <b>OK</b> status if the "Item1" was retrieved. <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItems </code> </li> + * </ul> + */ + public void _getItem() { + requiredMethod("addItems()"); + + boolean result = true; + String item = oObj.getItem(itemCount); + result = "Item1".equals(item); + + tRes.tested("getItem()", result); + } + + /** + * After <code>addItem</code> and <code>addItems</code> methods + * test the following items must exist {..., "Item1", "Item2", "Item3"} + * Retrieves all items. <p> + * Has <b>OK</b> status if the last three items retrieved are + * "Item1", "Item2" and "Item3". <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItems </code> </li> + * </ul> + */ + public void _getItems() { + requiredMethod("addItems()"); + + boolean result = true; + String[] items = oObj.getItems(); + for (int i = itemCount; i < (itemCount + 3); i++) { + result &= ("Item" + (i + 1)).equals(items[i]); + } + + tRes.tested("getItems()", result); + } + + /** + * Gets line count and stores it. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getDropDownLineCount() { + + boolean result = true; + lineCount = oObj.getDropDownLineCount(); + + tRes.tested("getDropDownLineCount()", result); + } + + /** + * Sets a new value and then checks get value. <p> + * Has <b>OK</b> status if set and get values are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getDropDownLineCount </code> </li> + * </ul> + */ + public void _setDropDownLineCount() { + requiredMethod("getDropDownLineCount()"); + + boolean result = true; + oObj.setDropDownLineCount((short) (lineCount + 1)); + result = oObj.getDropDownLineCount() == lineCount + 1; + + tRes.tested("setDropDownLineCount()", result); + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XControl.java b/qadevOOo/tests/java/ifc/awt/_XControl.java new file mode 100644 index 0000000000..ffb9bcbaa2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XControl.java @@ -0,0 +1,213 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XView; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.uno.XInterface; + +/** +* Testing <code>com.sun.star.awt.XControl</code> +* interface methods: +* <ul> +* <li><code> setContext() </code></li> +* <li><code> getContext() </code></li> +* <li><code> createPeer() </code></li> +* <li><code> getPeer() </code></li> +* <li><code> setModel() </code></li> +* <li><code> getModel() </code></li> +* <li><code> setDesignMode() </code></li> +* <li><code> isDesignMode() </code></li> +* <li><code> isTransparent() </code></li> +* <li><code> getView() </code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CONTEXT'</code> (of type <code>XInterface</code>): +* used as a parameter to setContext() and for testing getContext().</li> +* <li> <code>'WINPEER'</code> (of type <code>XWindowPeer</code>): +* used as a parameter to createPeer() and for testing getPeer()</li> +* <li> <code>'TOOLKIT'</code> (of type <code>XToolkit</code>): +* used as a parameter to createPeer()</li> +* <li> <code>'MODEL'</code> (of type <code>XControlModel</code>): +* used as a parameter to setModel() and for testing getModel()</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XControl +*/ +public class _XControl extends MultiMethodTest { + public XControl oObj = null; + public XControlModel aModel = null; + public boolean desMode; + + /** + * After test calls the method, the Context is set to a corresponding + * object relation.<p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _setContext() { + XInterface cont = (XInterface) tEnv.getObjRelation("CONTEXT"); + oObj.setContext(cont); + tRes.tested("setContext()",true); + } + + /** + * After test calls the method, the Context is gotten and compared + * with object relation 'CONTEXT'.<p> + * Has <b> OK </b> status if get value is equals to value set before.<p> + * The following method tests are to be completed successfully before: + * <ul> + * <li> <code> setContext() </code> : set Context to a corresponding + * object relation</li> + * </ul> + */ + public void _getContext() { + requiredMethod("setContext()"); + XInterface cont = (XInterface) tEnv.getObjRelation("CONTEXT"); + Object get = oObj.getContext(); + boolean res = get.equals(cont); + if (!res) { + log.println("!!! Error: getting: "+get.toString()); + log.println("!!! expected: "+cont.toString()); + } + tRes.tested("getContext()",res); + } + + + /** + * The objects needed to create peer are obtained + * from corresponding object relations, then the peer is created. + * <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _createPeer() { + XWindowPeer the_win = (XWindowPeer) tEnv.getObjRelation("WINPEER"); + XToolkit the_kit = (XToolkit) tEnv.getObjRelation("TOOLKIT"); + oObj.createPeer(the_kit,the_win); + tRes.tested("createPeer()",true); + } + + /* + * Test calls the method. Then the object relation 'WINPEER' is + * obtained, and compared with the peer, gotten from (XControl) oObj + * variable.<p> + * Has <b> OK </b> status if peer gotten isn't null + * The following method tests are to be completed successfully before: + */ + public void _getPeer() { + requiredMethod("createPeer()"); + boolean res = false; + XWindowPeer get = oObj.getPeer(); + if (get == null) { + log.println("The method 'getPeer' returns NULL"); + } else { + res = true; + } + tRes.tested("getPeer()",res); + } + + + /** + * At first current model is obtained and saved to variable aModel. + * Then object relation 'MODEL' is gotten and test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _setModel() { + aModel = oObj.getModel(); + XControlModel the_model = (XControlModel) tEnv.getObjRelation("MODEL"); + oObj.setModel(the_model); + tRes.tested("setModel()",true); + } + + /** + * Test calls the method, then object relation 'MODEL' is gotten and + * compared with object returned by the method. Then previously saved + * value of model (aModel) restored to (XControl) oObj<p> + * Has <b> OK </b> status if models set and get are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setModel() </code> : setting model from corresponding + * object relation </li> + * </ul> + */ + public void _getModel() { + requiredMethod("setModel()"); + XControlModel the_model = (XControlModel) tEnv.getObjRelation("MODEL"); + XControlModel get = oObj.getModel(); + boolean res = get.equals(the_model); + if (!res) { + log.println("getting: "+get.toString()); + log.println("expected: "+the_model.toString()); + } + if (aModel != null) { + oObj.setModel(aModel); + } + tRes.tested("getModel()",res); + } + + /** + * Test calls the method. Then mode is checked using isDesignMode().<p> + * Has <b> OK </b> status if mode is switched. + */ + public void _setDesignMode() { + desMode = oObj.isDesignMode(); + oObj.setDesignMode(!desMode); + tRes.tested("setDesignMode()",oObj.isDesignMode() == !desMode); + } + + /** + * The mode is changed and result is checked.<p> + * Has <b> OK </b> status if the mode changed successfully. + */ + public void _isDesignMode() { + requiredMethod("setDesignMode()"); + oObj.setDesignMode(desMode); + tRes.tested("isDesignMode()", oObj.isDesignMode() == desMode); + } + + /** + * Test calls the method.<p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _isTransparent() { + oObj.isTransparent(); + tRes.tested("isTransparent()",true ); + } + + /** + * Test calls the method.<p> + * Has <b> OK </b> status if the method returns not null. <p> + */ + public void _getView() { + XView the_view = oObj.getView(); + tRes.tested("getView()", the_view != null); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XControlContainer.java b/qadevOOo/tests/java/ifc/awt/_XControlContainer.java new file mode 100644 index 0000000000..0c7e636209 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XControlContainer.java @@ -0,0 +1,133 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; + +/** +* Testing <code>com.sun.star.awt.XControlContainer</code> +* interface methods: +* <ul> +* <li><code> setStatusText() </code></li> +* <li><code> addControl() </code></li> +* <li><code> removeControl() </code></li> +* <li><code> getControl() </code></li> +* <li><code> getControls() </code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CONTROL1'</code> (of type <code>XControl</code>): +* used as a parameter to addControl(), getControl() and removeControl()</li> +* <li> <code>'CONTROL2'</code> (of type <code>XControl</code>): +* used as a parameter to addControl(), getControl() and removeControl()</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XControlContainer +*/ +public class _XControlContainer extends MultiMethodTest { + public XControlContainer oObj = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _setStatusText() { + oObj.setStatusText("testing XControlContainer::setStatusText(String)"); + tRes.tested("setStatusText()",true); + } + + /** + * Test calls the method twice - two controls gotten from object relations + * 'CONTROL1' and 'CONTROL2' added to container.<p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _addControl() { + oObj.addControl("CONTROL1", (XControl)tEnv.getObjRelation("CONTROL1")); + oObj.addControl("CONTROL2", (XControl)tEnv.getObjRelation("CONTROL2")); + tRes.tested("addControl()",true); + } + + /** + * Test calls the method with object relation 'CONTROL1' as a + * parameter. Then control gotten from container is checked, and if returned + * value is null then another control 'CONTROL2' is removed from container, + * otherwise returned value of method test is 'false'.<p> + * Has <b> OK </b> status if control is removed successfully.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addControl() </code> : adds control to a container </li> + * <li> <code> getControl() </code> : gets control from container </li> + * <li> <code> getControls() </code> : gets controls from container</li> + * </ul> + */ + public void _removeControl() { + boolean result = true; + + requiredMethod("addControl()"); + requiredMethod("getControl()"); + requiredMethod("getControls()"); + oObj.removeControl( (XControl) tEnv.getObjRelation("CONTROL1") ); + XControl ctrl = oObj.getControl("CONTROL1"); + if (ctrl != null) { + result = false; + log.println("'removeControl()' fails; Control still exists"); + } else { + oObj.removeControl( (XControl) tEnv.getObjRelation("CONTROL2") ); + } + tRes.tested("removeControl()", result); + } + + /** + * Test calls the method with 'CONTROL1' as a parameter, then we just + * compare returned object and object relation 'CONTROL1'.<p> + * Has <b> OK </b> status if value returned by the method is equal to + * a corresponding object relation.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addControl() </code> : adds control to a container </li> + * </ul> + */ + public void _getControl() { + requiredMethod("addControl()"); + XControl xCtrlComp = oObj.getControl("CONTROL1"); + XControl xCl = (XControl) tEnv.getObjRelation("CONTROL1"); + tRes.tested("getControl()", xCtrlComp.equals(xCl)); + } + + /** + * Test calls the method, then returned value is checked.<p> + * Has <b> OK </b> status if returned array consists of at least two + * elements.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addControl() </code> : adds control to a container </li> + * </ul> + */ + public void _getControls() { + requiredMethod("addControl()"); + XControl[] xCtrls = oObj.getControls(); + tRes.tested("getControls()",xCtrls.length >= 2); + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java b/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java new file mode 100644 index 0000000000..beb74889d4 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java @@ -0,0 +1,307 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XCurrencyField; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.XCurrencyField</code> +* interface methods : +* <ul> +* <li><code> setValue()</code></li> +* <li><code> getValue()</code></li> +* <li><code> setMin()</code></li> +* <li><code> getMin()</code></li> +* <li><code> setMax()</code></li> +* <li><code> getMax()</code></li> +* <li><code> setFirst()</code></li> +* <li><code> getFirst()</code></li> +* <li><code> setLast()</code></li> +* <li><code> getLast()</code></li> +* <li><code> setSpinSize()</code></li> +* <li><code> getSpinSize()</code></li> +* <li><code> setDecimalDigits()</code></li> +* <li><code> getDecimalDigits()</code></li> +* <li><code> setStrictFormat()</code></li> +* <li><code> isStrictFormat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XCurrencyField +*/ +public class _XCurrencyField extends MultiMethodTest { + + public XCurrencyField oObj = null; + private double val = 0; + private double min = 0; + private double max = 0; + private double first = 0; + private double last = 0; + private double spin = 0; + private short digits = 0; + private boolean strict = true; + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getValue </code> </li> + * </ul> + */ + public void _setValue() { + requiredMethod("getValue()"); + + double value = val + 1.1; + oObj.setValue(value); + double ret = oObj.getValue(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setValue()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getValue() { + val = oObj.getValue(); + + tRes.tested("getValue()", true); + } + + /** + * Sets minimal value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMin </code> </li> + * </ul> + */ + public void _setMin() { + requiredMethod("getMin()"); + + double value = min + 1.1; + oObj.setMin(value); + double ret = oObj.getMin(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setMin()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getMin() { + + boolean result = true; + min = oObj.getMin(); + + tRes.tested("getMin()", result); + } + + /** + * Sets maximal value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMax </code> </li> + * </ul> + */ + public void _setMax() { + requiredMethod("getMax()"); + + double value = max + 1.1; + oObj.setMax(value); + double ret = oObj.getMax(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setMax()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getMax() { + + boolean result = true; + max = oObj.getMax(); + + tRes.tested("getMax()", result); + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getFirst </code> </li> + * </ul> + */ + public void _setFirst() { + requiredMethod("getFirst()"); + + double value = first + 1.1; + oObj.setFirst(value); + double ret = oObj.getFirst(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setFirst()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getFirst() { + + boolean result = true; + first = oObj.getFirst(); + + tRes.tested("getFirst()", result); + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLast </code> </li> + * </ul> + */ + public void _setLast() { + requiredMethod("getLast()"); + + double value = last + 1.1; + oObj.setLast(value); + double ret = oObj.getLast(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setLast()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getLast() { + + boolean result = true; + last = oObj.getLast(); + + tRes.tested("getLast()", result); + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getSpinSize </code> </li> + * </ul> + */ + public void _setSpinSize() { + requiredMethod("getSpinSize()"); + + double value = spin + 1.1; + oObj.setSpinSize(value); + double ret = oObj.getSpinSize(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setSpinSize()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getSpinSize() { + + boolean result = true; + spin = oObj.getSpinSize(); + + tRes.tested("getSpinSize()", result); + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getDecimalDigits </code> </li> + * </ul> + */ + public void _setDecimalDigits() { + requiredMethod("getDecimalDigits()"); + + boolean result = true; + oObj.setDecimalDigits((short) (digits + 1)); + + short res = oObj.getDecimalDigits(); + result = res == (digits + 1); + + tRes.tested("setDecimalDigits()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getDecimalDigits() { + + boolean result = true; + digits = oObj.getDecimalDigits(); + + tRes.tested("getDecimalDigits()", result); + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isStrictFormat </code> </li> + * </ul> + */ + public void _setStrictFormat() { + requiredMethod("isStrictFormat()"); + + boolean result = true; + oObj.setStrictFormat(!strict); + result = oObj.isStrictFormat() == !strict; + + tRes.tested("setStrictFormat()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _isStrictFormat() { + + boolean result = true; + strict = oObj.isStrictFormat(); + + tRes.tested("isStrictFormat()", result); + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XDataTransferProviderAccess.java b/qadevOOo/tests/java/ifc/awt/_XDataTransferProviderAccess.java new file mode 100644 index 0000000000..54c273a708 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XDataTransferProviderAccess.java @@ -0,0 +1,127 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.awt.XDataTransferProviderAccess; +import com.sun.star.awt.XWindow; +import com.sun.star.datatransfer.clipboard.XClipboard; +import com.sun.star.datatransfer.dnd.XDragGestureRecognizer; +import com.sun.star.datatransfer.dnd.XDragSource; +import com.sun.star.datatransfer.dnd.XDropTarget; + +/** +* Testing <code>com.sun.star.awt.XDataTransferProviderAccess</code> +* interface methods : +* <ul> +* <li><code> getDragGestureRecognizer()</code></li> +* <li><code> getDragSource()</code></li> +* <li><code> getDropTarget()</code></li> +* <li><code> getClipboard()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'XDataTransferProviderAccess.XWindow'</code> +* (of type <code>com.sun.star.awt.XWindow</code>): +* this window must created by the Toolkit tested. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XDataTransferProviderAccess +*/ +public class _XDataTransferProviderAccess extends MultiMethodTest { + + public XDataTransferProviderAccess oObj = null; + protected XWindow win = null ; + + /** + * Retrieves object relations. + * @throws StatusException If one of relations not found. + */ + @Override + public void before() { + win = (XWindow) tEnv.getObjRelation + ("XDataTransferProviderAccess.XWindow") ; + if (win == null) throw new StatusException(Status.failed + ("Relation not found")) ; + } + + /** + * Tries to get gesture recognizer for the window passed as + * relation. <p> + * Has <b> OK </b> status if not <code>null</code> value returned + */ + public void _getDragGestureRecognizer() { + + boolean result = true ; + XDragGestureRecognizer rec = oObj.getDragGestureRecognizer(win) ; + + result = rec != null ; + + tRes.tested("getDragGestureRecognizer()", result) ; + } + + /** + * Tries to get drag source for the window passed as + * relation. <p> + * Has <b> OK </b> status if not <code>null</code> value returned + */ + public void _getDragSource() { + + boolean result = true ; + XDragSource src = oObj.getDragSource(win) ; + + result = src != null ; + + tRes.tested("getDragSource()", result) ; + } + + /** + * Tries to get drop target for the window passed as + * relation. <p> + * Has <b> OK </b> status if not <code>null</code> value returned + */ + public void _getDropTarget() { + + boolean result = true ; + XDropTarget targ = oObj.getDropTarget(win) ; + + result = targ != null ; + + tRes.tested("getDropTarget()", result) ; + } + + /** + * Tries to obtain default clipboard.<p> + * Has <b> OK </b> status if not <code>null</code> value returned. + */ + public void _getClipboard() { + + boolean result = true ; + XClipboard cb = oObj.getClipboard("") ; + + result = cb != null ; + + tRes.tested("getClipboard()", result) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XDateField.java b/qadevOOo/tests/java/ifc/awt/_XDateField.java new file mode 100644 index 0000000000..c70d34ab16 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XDateField.java @@ -0,0 +1,332 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XDateField; +import com.sun.star.util.Date; + +/** +* Testing <code>com.sun.star.awt.XDateField</code> +* interface methods : +* <ul> +* <li><code> setDate()</code></li> +* <li><code> getDate()</code></li> +* <li><code> setMin()</code></li> +* <li><code> getMin()</code></li> +* <li><code> setMax()</code></li> +* <li><code> getMax()</code></li> +* <li><code> setFirst()</code></li> +* <li><code> getFirst()</code></li> +* <li><code> setLast()</code></li> +* <li><code> getLast()</code></li> +* <li><code> setLongFormat()</code></li> +* <li><code> isLongFormat()</code></li> +* <li><code> setEmpty()</code></li> +* <li><code> isEmpty()</code></li> +* <li><code> setStrictFormat()</code></li> +* <li><code> isStrictFormat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XDateField +*/ +public class _XDateField extends MultiMethodTest { + + public XDateField oObj = null; + + private boolean strict = false ; + private boolean longFormat = false ; + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getTime </code> </li> + * </ul> + */ + public void _setDate() { + requiredMethod("getDate()") ; + + boolean result = true ; + oObj.setDate(new Date((short)1, (short)1, (short)1900)) ; + Date date = oObj.getDate(); + result = date.Day == 1 && date.Month == 1 && date.Year == 1900; + + if (! result ) { + System.out.println("getDate: " + oObj.getDate() + " , expected 1900-01-01"); + } + + tRes.tested("setDate()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getDate() { + + boolean result = true ; + oObj.getDate() ; + + tRes.tested("getDate()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMin </code> </li> + * </ul> + */ + public void _setMin() { + + boolean result = true ; + oObj.setMin(new Date((short)5, (short)2, (short)1963)); + Date date = oObj.getMin(); + result = date.Day == 5 && date.Month == 2 && date.Year == 1963; + + tRes.tested("setMin()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getMin() { + + boolean result = true ; + oObj.getMin() ; + + tRes.tested("getMin()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMax </code> </li> + * </ul> + */ + public void _setMax() { + + boolean result = true ; + oObj.setMax(new Date((short)18, (short)9, (short)2117)) ; + Date date = oObj.getMax(); + result = date.Day == 18 && date.Month == 9 && date.Year == 2117; + + tRes.tested("setMax()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getMax() { + + boolean result = true ; + oObj.getMax() ; + + tRes.tested("getMax()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getFirst </code> </li> + * </ul> + */ + public void _setFirst() { + + boolean result = true ; + oObj.setFirst(new Date((short)7, (short)12, (short)1972)) ; + Date date = oObj.getFirst(); + result = date.Day == 7 && date.Month == 12 && date.Year == 1972; + + if (!result) { + log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ; + } + + tRes.tested("setFirst()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getFirst() { + + boolean result = true ; + com.sun.star.util.Date val = oObj.getFirst() ; + + log.println("getFirst() = " + val) ; + + tRes.tested("getFirst()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLast </code> </li> + * </ul> + */ + public void _setLast() { + + boolean result = true ; + oObj.setLast(new Date((short)23, (short)8, (short)2053)) ; + Date date = oObj.getLast(); + result = date.Day == 23 && date.Month == 8 && date.Year == 2053; + + if (!result) { + log.println("Set to 2053-08-23 but returned " + oObj.getLast()) ; + } + + tRes.tested("setLast()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getLast() { + + boolean result = true ; + com.sun.star.util.Date val = oObj.getLast() ; + + log.println("getLast() = " + val) ; + + tRes.tested("getLast()", result) ; + } + + /** + * Sets the value to empty. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTime </code> : value must be not empty </li> + * </ul> + */ + public void _setEmpty() { + requiredMethod("setDate()") ; + + boolean result = true ; + oObj.setEmpty() ; + + tRes.tested("setEmpty()", result) ; + } + + /** + * Checks if the field is empty. <p> + * Has <b> OK </b> status if the value is empty.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setEmpty() </code> </li> + * </ul> + */ + public void _isEmpty() { + requiredMethod("setEmpty()") ; + + boolean result = true ; + result = oObj.isEmpty() ; + + tRes.tested("isEmpty()", result) ; + } + + /** + * Checks strict state. <p> + * Has <b> OK </b> status if strict format is properly set. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isStrictFormat </code> </li> + * </ul> + */ + public void _setStrictFormat() { + requiredMethod("isStrictFormat()") ; + + boolean result = true ; + oObj.setStrictFormat(!strict) ; + + result = oObj.isStrictFormat() == !strict ; + + if (!result) { + log.println("Was '" + strict + "', set to '" + !strict + + "' but returned '" + oObj.isStrictFormat() + "'") ; + } + + tRes.tested("setStrictFormat()", result) ; + } + + /** + * Gets strict state and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _isStrictFormat() { + + boolean result = true ; + strict = oObj.isStrictFormat() ; + + tRes.tested("isStrictFormat()", result) ; + } + + + /** + * Checks long format state. <p> + * Has <b> OK </b> status if long format is properly set. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isLongFormat </code> </li> + * </ul> + */ + public void _setLongFormat() { + + boolean result = true ; + oObj.setLongFormat(!longFormat) ; + + result = oObj.isLongFormat() == !longFormat ; + + if (!result) { + log.println("Was '" + longFormat + "', set to '" + !longFormat + + "' but returned '" + oObj.isLongFormat() + "'") ; + } + + tRes.tested("setLongFormat()", result) ; + } + + /** + * Gets long format state and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _isLongFormat() { + + boolean result = true ; + longFormat = oObj.isLongFormat() ; + + tRes.tested("isLongFormat()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XDialog.java b/qadevOOo/tests/java/ifc/awt/_XDialog.java new file mode 100644 index 0000000000..65b4f47ae2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XDialog.java @@ -0,0 +1,150 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XDialog; + +/** +* Testing <code>com.sun.star.awt.XDialog</code> +* interface methods : +* <ul> +* <li><code> setTitle()</code></li> +* <li><code> getTitle()</code></li> +* <li><code> execute()</code></li> +* <li><code> endExecute()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* After test completion object environment has to be recreated. +* @see com.sun.star.awt.XDialog +*/ +public class _XDialog extends MultiMethodTest { + + public XDialog oObj = null; + + /** + * As <code>execute()</code> method is a blocking call, + * then it must be executed in a separate thread. This + * thread class just call <code>execute</code> method + * of tested object. + */ + protected Thread execThread = new Thread( + new Runnable() { + public void run() { + oObj.execute() ; + } + }) ; + + /** + * Sets the title to some string. <p> + * Has <b>OK</b> status if no runtime exceptions occurs. + */ + public void _setTitle() { + + oObj.setTitle("XDialog test") ; + + tRes.tested("setTitle()", true) ; + } + + /** + * Gets the title and compares it to the value set in + * <code>setTitle</code> method test. <p> + * Has <b>OK</b> status is set/get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTitle </code> </li> + * </ul> + */ + public void _getTitle() { + requiredMethod("setTitle()") ; + + tRes.tested("getTitle()", + "XDialog test".equals(oObj.getTitle())) ; + } + + /** + * Starts the execution of dialog in a separate thread. + * As this call is blocking then the thread execution + * must not be finished. <p> + * Has <b>OK</b> status if thread wasn't finished and + * no exceptions occurred. + */ + public void _execute() { + boolean result = true ; + + log.println("Starting execute() thread ...") ; + execThread.start() ; + + try { + execThread.join(200) ; + } catch (InterruptedException e) { + log.println("execute() thread was interrupted") ; + result = false ; + } + result &= execThread.isAlive() ; + + tRes.tested("execute()", result) ; + } + + /** + * Calls the method and checks if the execution thread + * where <code>execute()</code> method is running was + * finished. If <code>execute</code> method didn't return + * and still running then thread interrupted. <p> + * Has <b>OK</b> status if <code>execute</code> method + * call successfully returned. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> execute </code> </li> + * </ul> + */ + public void _endExecute() { + requiredMethod("execute()") ; + + boolean result = true ; + + oObj.endExecute() ; + + try { + execThread.join(200) ; + } catch (InterruptedException e) { + log.println("execute() thread was interrupted") ; + result = false ; + } + + if (execThread.isAlive()) { + execThread.interrupt() ; + } + + result &= !execThread.isAlive() ; + + tRes.tested("endExecute()", result) ; + } + + /** + * Disposes object environment. + */ + @Override + public void after() { + disposeEnvironment() ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XFixedText.java b/qadevOOo/tests/java/ifc/awt/_XFixedText.java new file mode 100644 index 0000000000..9ea5527c71 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XFixedText.java @@ -0,0 +1,111 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.TextAlign; +import com.sun.star.awt.XFixedText; + +/** +* Testing <code>com.sun.star.awt.XFixedText</code> +* interface methods : +* <ul> +* <li><code> setText()</code></li> +* <li><code> getText()</code></li> +* <li><code> setAlignment()</code></li> +* <li><code> getAlignment()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XFixedText +*/ +public class _XFixedText extends MultiMethodTest { + + public XFixedText oObj = null; + private String text = null ; + private int align = -1 ; + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getText </code> </li> + * </ul> + */ + public void _setText() { + requiredMethod("getText()") ; + + boolean result = true ; + oObj.setText(text + "_") ; + result = (text+"_").equals(oObj.getText()) ; + + tRes.tested("setText()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getText() { + + boolean result = true ; + text = oObj.getText() ; + if (util.utils.isVoid(text)) text = "XFixedText"; + + tRes.tested("getText()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getAlignment </code> </li> + * </ul> + */ + public void _setAlignment() { + requiredMethod("getAlignment()") ; + + boolean result = true ; + int newAlign = align == + TextAlign.CENTER ? TextAlign.LEFT : TextAlign.CENTER ; + oObj.setAlignment((short)newAlign) ; + short getAlign = oObj.getAlignment() ; + result = newAlign == getAlign ; + + tRes.tested("setAlignment()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getAlignment() { + + boolean result = true ; + align = oObj.getAlignment() ; + + tRes.tested("getAlignment()", result) ; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XImageConsumer.java b/qadevOOo/tests/java/ifc/awt/_XImageConsumer.java new file mode 100644 index 0000000000..7c170fb256 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XImageConsumer.java @@ -0,0 +1,135 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XImageConsumer; + +/** +* Testing <code>com.sun.star.awt.XImageConsumer</code> +* interface methods : +* <ul> +* <li><code> init()</code></li> +* <li><code> setColorModel()</code></li> +* <li><code> setPixelsByBytes()</code></li> +* <li><code> setPixelsByLongs()</code></li> +* <li><code> complete()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XImageConsumer +*/ + +public class _XImageConsumer extends MultiMethodTest { + + public XImageConsumer oObj = null; + + /** + * Initialize the consumer with size 2x2. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _init() { + + boolean result = true ; + oObj.init(2, 2) ; + + tRes.tested("init()", result) ; + } + + /** + * Sets color model. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> init </code> </li> + * </ul> + */ + public void _setColorModel() { + requiredMethod("init()") ; + + boolean result = true ; + int[] pal = new int[256] ; + for (int i = 0; i < 256; i++) pal[i] = i ; + oObj.setColorModel((short)8, pal, 100, 100, 100, 100) ; + + tRes.tested("setColorModel()", result) ; + } + + /** + * Fill the picture with for pixels. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be executed before : + * <ul> + * <li> <code> setColorModel </code> </li> + * </ul> + */ + public void _setPixelsByBytes() { + executeMethod("setColorModel()") ; + + boolean result = true ; + oObj.setPixelsByBytes(0, 0, 2, 2, + new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ; + + tRes.tested("setPixelsByBytes()", result) ; + } + + /** + * Fill the picture with for pixels. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be executed before : + * <ul> + * <li> <code> setColorModel </code> </li> + * </ul> + */ + public void _setPixelsByLongs() { + executeMethod("setColorModel()") ; + + boolean result = true ; + oObj.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ; + + tRes.tested("setPixelsByLongs()", result) ; + } + + /** + * Just calls the method. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> init </code> </li> + * </ul> <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> setPixelsByBytes </code> </li> + * <li> <code> setPixelsByBytes </code> </li> + * </ul> + */ + public void _complete() { + requiredMethod("init()") ; + executeMethod("setPixelsByBytes()") ; + executeMethod("setPixelsByBytes()") ; + + boolean result = true ; + oObj.complete(0, null) ; + + tRes.tested("complete()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XImageProducer.java b/qadevOOo/tests/java/ifc/awt/_XImageProducer.java new file mode 100644 index 0000000000..140c6ff3de --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XImageProducer.java @@ -0,0 +1,143 @@ +/* + * 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.awt; + + +import java.io.PrintWriter; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XImageConsumer; +import com.sun.star.awt.XImageProducer; + +/** +* Testing <code>com.sun.star.awt.XImageProducer</code> +* interface methods : +* <ul> +* <li><code> addConsumer()</code></li> +* <li><code> removeConsumer()</code></li> +* <li><code> startProduction()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XImageProducer +*/ +public class _XImageProducer extends MultiMethodTest { + + public XImageProducer oObj = null; + + /** + * Consumer implementation which sets flags on appropriate + * method calls. + */ + protected static class TestImageConsumer implements XImageConsumer { + PrintWriter log = null ; + public boolean initCalled = false ; + + TestImageConsumer(PrintWriter log) { + log.println("### Consumer initialized" ) ; + this.log = log ; + } + + public void init(int width, int height) { + log.println("### init() called") ; + initCalled = true ; + } + + public void setColorModel(short bitCount, int[] RGBAPal, + int redMask, int greenMask, int blueMask, int alphaMask) { + log.println("### setColorModel() called") ; + } + + public void setPixelsByBytes(int x, int y, int width, int height, + byte[] data, int offset, int scanSize) { + log.println("### setPixelByBytes() called") ; + } + + public void setPixelsByLongs(int x, int y, int width, int height, + int[] data, int offset, int scanSize) { + log.println("### setPixelByLongs() called") ; + } + + public void complete(int status, XImageProducer prod) { + log.println("### complete() called") ; + } + } + + TestImageConsumer consumer = null ; + + /** + * Creates a new XImageConsumer implementation. + */ + @Override + public void before() { + consumer = new TestImageConsumer(log) ; + } + + /** + * Adds a new consumer to producer. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _addConsumer() { + + boolean result = true ; + oObj.addConsumer(consumer) ; + + tRes.tested("addConsumer()", result) ; + } + + /** + * Removes the consumer added before. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be executed before : + * <ul> + * <li> <code> startProduction </code> </li> + * </ul> + */ + public void _removeConsumer() { + executeMethod("startProduction()") ; + + boolean result = true ; + oObj.removeConsumer(consumer) ; + + tRes.tested("removeConsumer()", result) ; + } + + /** + * Starts the production and after short waiting checks what + * consumer's methods were called. <p> + * Has <b> OK </b> status if at least <code>init</code> consumer + * methods was called. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addConsumer </code> </li> + * </ul> + */ + public void _startProduction() { + requiredMethod("addConsumer()") ; + + oObj.startProduction() ; + + waitForEventIdle(); + + tRes.tested("startProduction()", consumer.initCalled) ; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XItemListener.java b/qadevOOo/tests/java/ifc/awt/_XItemListener.java new file mode 100644 index 0000000000..f15022142a --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XItemListener.java @@ -0,0 +1,109 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.awt.ItemEvent; +import com.sun.star.awt.XItemListener; + +/** +* Testing <code>com.sun.star.awt.XItemListener</code> +* interface methods : +* <ul> +* <li><code> itemStateChanged()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'TestItemListener'</code> +* (of type <code>ifc.awt._XItemListener.TestItemListener</code>): +* this <code>XItemListener</code> implementation must be +* added to the object tested for checking +* <code> itemStateChanged()</code> method call. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XItemListener +*/ +public class _XItemListener extends MultiMethodTest { + + public XItemListener oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + * and stores event passed. + */ + public static class TestItemListener implements com.sun.star.awt.XItemListener { + public boolean itemStateChangedCalled = false ; + public ItemEvent event = null ; + + public void itemStateChanged(com.sun.star.awt.ItemEvent e) { + itemStateChangedCalled = true ; + event = e ; + } + + public void disposing(com.sun.star.lang.EventObject e) {} + + } + + TestItemListener itemListener = null ; + + /** + * Retrieves object relation. + * @throws StatusException If the relation not found. + */ + @Override + public void before() { + itemListener = (TestItemListener) tEnv.getObjRelation("TestItemListener") ; + if (itemListener == null) + throw new StatusException(Status.failed("Relation not found")) ; + } + + /** + * First a <code>ItemEvent</code> object created and + * it is passed to <code>itemStateChanged</code> method + * call. Then a short wait follows for listener already + * registered at the object to be called. <p> + * Has <b> OK </b> status if the listener was called with + * the same <code>ItemEvent</code> object as was created + * before. + */ + public void _itemStateChanged() { + + boolean result = true ; + + ItemEvent event = new ItemEvent() ; + event.Selected = 1 ; + event.Highlighted = 2 ; + oObj.itemStateChanged(event) ; + + waitForEventIdle(); + + result = itemListener.itemStateChangedCalled && + itemListener.event.Selected == 1 && + itemListener.event.Highlighted == 2 ; + + tRes.tested("itemStateChanged()", result) ; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XLayoutConstrains.java b/qadevOOo/tests/java/ifc/awt/_XLayoutConstrains.java new file mode 100644 index 0000000000..5e1b4cb9fd --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XLayoutConstrains.java @@ -0,0 +1,68 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.Size; +import com.sun.star.awt.XLayoutConstrains; + +/** +* Testing <code>com.sun.star.awt.XLayoutConstrains</code> +* interface methods: +* <ul> +* <li><code> getMinimumSize() </code></li> +* <li><code> getPreferredSize() </code></li> +* <li><code> calcAdjustedSize() </code></li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XLayoutConstrains +*/ +public class _XLayoutConstrains extends MultiMethodTest { + public XLayoutConstrains oObj = null; + + /** + * Test calls the method, then check if returned value is not null.<p> + * Has <b> OK </b> status if the method returns not null. + */ + public void _getMinimumSize() { + Size aSize = oObj.getMinimumSize(); + tRes.tested("getMinimumSize()", aSize != null); + } + + /** + * Test calls the method, then check if returned value is not null.<p> + * Has <b> OK </b> status if the method returns not null. + */ + public void _getPreferredSize() { + Size aSize = oObj.getPreferredSize(); + tRes.tested("getPreferredSize()", aSize != null); + } + + /** + * Test calls the method with the new size as a parameter.<p> + * Has <b> OK </b> status if the method returns not null. + */ + public void _calcAdjustedSize() { + Size aSize = oObj.calcAdjustedSize(new Size(50,50)); + tRes.tested("calcAdjustedSize()", aSize != null); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XListBox.java b/qadevOOo/tests/java/ifc/awt/_XListBox.java new file mode 100644 index 0000000000..6c6ddd6b24 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XListBox.java @@ -0,0 +1,491 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.awt.XListBox; + +/** +* Testing <code>com.sun.star.awt.XListBox</code> +* interface methods : +* <ul> +* <li><code> addItemListener()</code></li> +* <li><code> removeItemListener()</code></li> +* <li><code> addActionListener()</code></li> +* <li><code> removeActionListener()</code></li> +* <li><code> addItem()</code></li> +* <li><code> addItems()</code></li> +* <li><code> removeItems()</code></li> +* <li><code> getItemCount()</code></li> +* <li><code> getItem()</code></li> +* <li><code> getItems()</code></li> +* <li><code> getSelectedItemPos()</code></li> +* <li><code> getSelectedItemsPos()</code></li> +* <li><code> getSelectedItem()</code></li> +* <li><code> getSelectedItems()</code></li> +* <li><code> selectItemPos()</code></li> +* <li><code> selectItemsPos()</code></li> +* <li><code> selectItem()</code></li> +* <li><code> isMutipleMode()</code></li> +* <li><code> setMultipleMode()</code></li> +* <li><code> getDropDownLineCount()</code></li> +* <li><code> setDropDownLineCount()</code></li> +* <li><code> makeVisible()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XListBox +*/ +public class _XListBox extends MultiMethodTest { + + public XListBox oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestActionListener implements com.sun.star.awt.XActionListener { + + public void disposing(com.sun.star.lang.EventObject e) {} + + public void actionPerformed(com.sun.star.awt.ActionEvent e) {} + + } + + TestActionListener actionListener = new TestActionListener() ; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestItemListener implements com.sun.star.awt.XItemListener { + + public void disposing(com.sun.star.lang.EventObject e) {} + + public void itemStateChanged(com.sun.star.awt.ItemEvent e) {} + } + + TestItemListener itemListener = new TestItemListener() ; + + short lineCount = 0 ; + short itemCount = 0 ; + + /** + * Retrieves object relations. + */ + @Override + public void before() { + itemCount = oObj.getItemCount(); + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _addItemListener() { + + oObj.addItemListener(itemListener) ; + + tRes.tested("addItemListener()", Status.skipped(true)) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeItemListener() { + requiredMethod("addItemListener()") ; + + oObj.removeItemListener(itemListener) ; + + tRes.tested("removeItemListener()", Status.skipped(true)) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _addActionListener() { + + oObj.addActionListener(actionListener) ; + + tRes.tested("addActionListener()", Status.skipped(true)) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeActionListener() { + requiredMethod("addActionListener()") ; + + oObj.removeActionListener(actionListener) ; + + tRes.tested("removeActionListener()", Status.skipped(true)) ; + } + + /** + * Adds one item to the last position and check the number of + * items after addition. <p> + * Has <b>OK</b> status if the number of items increased by 1.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getItemCount </code> </li> + * </ul> + */ + public void _addItem() { + requiredMethod("getItemCount()") ; + + boolean result = true ; + oObj.addItem("Item1", itemCount) ; + result = oObj.getItemCount() == itemCount + 1 ; + + tRes.tested("addItem()", result) ; + } + + /** + * Adds one two items to the last position and check the number of + * items after addition. <p> + * Has <b>OK</b> status if the number of items increased by 2.<p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItem </code> </li> + * </ul> + */ + public void _addItems() { + executeMethod("addItem()") ; + + boolean result = true ; + short oldCnt = oObj.getItemCount() ; + oObj.addItems(new String[] {"Item2", "Item3"}, oldCnt) ; + result = oObj.getItemCount() == oldCnt + 2 ; + + tRes.tested("addItems()", result) ; + } + + /** + * Gets the current number of items and tries to remove them all + * then checks number of items. <p> + * Has <b>OK</b> status if no items remains. <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> getItems </code> </li> + * <li> <code> getItem </code> </li> + * </ul> + */ + public void _removeItems() { + executeMethod("getItems()") ; + executeMethod("getItem()") ; + executeMethod("getSelectedItemPos()") ; + executeMethod("getSelectedItemsPos()") ; + executeMethod("getSelectedItem()") ; + executeMethod("getSelectedItems()") ; + + boolean result = true ; + short oldCnt = oObj.getItemCount() ; + oObj.removeItems((short)0, oldCnt) ; + result = oObj.getItemCount() == 0 ; + + tRes.tested("removeItems()", result) ; + } + + /** + * Just retrieves current number of items and stores it. <p> + * Has <b>OK</b> status if the count is not less than 0. + */ + public void _getItemCount() { + + itemCount = oObj.getItemCount() ; + + tRes.tested("getItemCount()", itemCount >= 0) ; + } + + /** + * After <code>addItem</code> and <code>addItems</code> methods + * test the following items must exist {..., "Item1", "Item2", "Item3"} + * Retrieves the item from the position which was ititially the last.<p> + * Has <b>OK</b> status if the "Item1" was retrieved. <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItems </code> </li> + * </ul> + */ + public void _getItem() { + requiredMethod("addItems()") ; + + boolean result = true ; + String item = oObj.getItem(itemCount) ; + result = "Item1".equals(item) ; + + tRes.tested("getItem()", result) ; + } + + /** + * After <code>addItem</code> and <code>addItems</code> methods + * test the following items must exist {..., "Item1", "Item2", "Item3"} + * Retrieves all items. <p> + * Has <b>OK</b> status if the last three items retrieved are + * "Item1", "Item2" and "Item3". <p> + * The following method tests are to be executed before : + * <ul> + * <li> <code> addItems </code> </li> + * </ul> + */ + public void _getItems() { + requiredMethod("addItems()") ; + + boolean result = true ; + String[] items = oObj.getItems() ; + for (int i = itemCount; i < (itemCount + 3); i++) { + result &= ("Item" + (i+1 - itemCount)).equals(items[i]) ; + } + + tRes.tested("getItems()", result) ; + } + + /** + * Gets line count and stores it. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getDropDownLineCount() { + + boolean result = true ; + lineCount = oObj.getDropDownLineCount() ; + + tRes.tested("getDropDownLineCount()", result) ; + } + + /** + * Sets a new value and then checks get value. <p> + * Has <b>OK</b> status if set and get values are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getDropDownLineCount </code> </li> + * </ul> + */ + public void _setDropDownLineCount() { + requiredMethod("getDropDownLineCount()") ; + + boolean result = true ; + oObj.setDropDownLineCount((short)(lineCount + 1)) ; + result = oObj.getDropDownLineCount() == lineCount + 1 ; + + tRes.tested("setDropDownLineCount()", result) ; + } + + /** + * Selects some item and gets selected item position. <p> + * Has <b> OK </b> status if position is equal to position set. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> : to have some items </li> + * </ul> + */ + public void _getSelectedItemPos() { + requiredMethod("addItems()") ; + + boolean result = true ; + oObj.selectItemPos((short)1, true) ; + short pos = oObj.getSelectedItemPos() ; + + result = pos == 1 ; + + tRes.tested("getSelectedItemPos()", result) ; + } + + /** + * Clears all selections, then selects some items and gets selected + * item positions. <p> + * Has <b> OK </b> status if positions get are the same as were set.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> selectItemsPos </code> </li> + * </ul> + */ + public void _getSelectedItemsPos() { + requiredMethod("selectItemsPos()") ; + + boolean result = true ; + short cnt = oObj.getItemCount() ; + for (short i = 0; i < cnt; i++) { + oObj.selectItemPos(i, false) ; + } + oObj.selectItemsPos(new short[] {0, 2}, true) ; + + short[] items = oObj.getSelectedItemsPos() ; + + result = items != null && items.length == 2 && + items[0] == 0 && items[1] == 2 ; + + tRes.tested("getSelectedItemsPos()", result) ; + } + + /** + * Unselects all items, selects some item and then gets selected item. <p> + * Has <b> OK </b> status if items selected and get are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> : to have some items </li> + * </ul> + */ + public void _getSelectedItem() { + requiredMethod("addItems()") ; + + boolean result = true ; + short cnt = oObj.getItemCount() ; + for (short i = 0; i < cnt; i++) { + oObj.selectItemPos(i, false) ; + } + oObj.selectItem("Item3", true) ; + String item = oObj.getSelectedItem() ; + + result = "Item3".equals(item) ; + + tRes.tested("getSelectedItem()", result) ; + } + + /** + * Clears all selections, then selects some items positions and gets + * selected items. <p> + * Has <b> OK </b> status if items get are the same as items on + * positions which were set.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> selectItemsPos </code> </li> + * <li> <code> getItem </code>: this method is used here for checking. + * </li> + * </ul> + */ + public void _getSelectedItems() { + requiredMethod("selectItemsPos()") ; + requiredMethod("getItem()") ; + + boolean result = true ; + short cnt = oObj.getItemCount() ; + for (short i = 0; i < cnt; i++) { + oObj.selectItemPos(i, false) ; + } + oObj.selectItemsPos(new short[] {0, 2}, true) ; + + String[] items = oObj.getSelectedItems() ; + result = items != null && items.length == 2 && + oObj.getItem((short)0).equals(items[0]) && + oObj.getItem((short)2).equals(items[1]) ; + + tRes.tested("getSelectedItems()", result) ; + } + + /** + * Unselects all items, then selects a single item. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> : to have some items </li> + * </ul> + */ + public void _selectItemPos() { + requiredMethod("addItems()") ; + + boolean result = true ; + short cnt = oObj.getItemCount() ; + for (short i = 0; i < cnt; i++) { + oObj.selectItemPos(i, false) ; + } + oObj.selectItemPos((short)1, true) ; + + tRes.tested("selectItemPos()", result) ; + } + + /** + * Just selects some items. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> : to have some items </li> + * </ul> + */ + public void _selectItemsPos() { + requiredMethod("addItems()") ; + requiredMethod("setMultipleMode()") ; + + boolean result = true ; + oObj.selectItemsPos(new short[] {0, 2}, true) ; + + tRes.tested("selectItemsPos()", result) ; + } + + /** + * Just selects an item. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> : to have some items </li> + * </ul> + */ + public void _selectItem() { + requiredMethod("addItems()") ; + + boolean result = true ; + oObj.selectItem("Item3", true) ; + + tRes.tested("selectItem()", result) ; + } + + /** + * Checks if multiple mode is set. <p> + * Has <b> OK </b> status if multiple mode is set. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setMultipleMode </code> </li> + * </ul> + */ + public void _isMutipleMode() { + requiredMethod("setMultipleMode()") ; + + boolean result = true ; + result = oObj.isMutipleMode() ; + + tRes.tested("isMutipleMode()", result) ; + } + + /** + * Sets multiple mode. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _setMultipleMode() { + + boolean result = true ; + oObj.setMultipleMode(true) ; + + tRes.tested("setMultipleMode()", result) ; + } + + /** + * Just calls the method to make visible third item. <p> + * Has <b> OK </b> status if no runtime exceptions occurred.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addItems </code> </li> + * </ul> + */ + public void _makeVisible() { + requiredMethod("addItems()") ; + + boolean result = true ; + oObj.makeVisible((short)2) ; + + tRes.tested("makeVisible()", result) ; + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java new file mode 100644 index 0000000000..04f8808287 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java @@ -0,0 +1,98 @@ +/* + * 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.awt; + +import com.sun.star.awt.AsyncCallback; +import com.sun.star.awt.XCallback; +import com.sun.star.awt.XMessageBox; +import com.sun.star.awt.XMessageBoxFactory; +import com.sun.star.awt.XRequestCallback; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.uno.Any; +import com.sun.star.uno.UnoRuntime; +import lib.MultiMethodTest; +import util.UITools; + +/** + * Testing <code>com.sun.star.awt.XMessageBoxFactory</code> + * interface methods : + * <ul> + * <li><code> </code>createMessageBox()</li> + * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * @see com.sun.star.awt.XMessageBoxFactory + */ +public class _XMessageBoxFactory extends MultiMethodTest { + public XMessageBoxFactory oObj = null; + + public void _createMessageBox() { + final XMessageBox mb = oObj.createMessageBox( + (XWindowPeer) tEnv.getObjRelation("WINPEER"), + com.sun.star.awt.MessageBoxType.ERRORBOX, 1, "The Title", + "The Message"); + final UITools tools = new UITools( + UnoRuntime.queryInterface(XWindow.class, mb)); + final boolean[] done = new boolean[] { false }; + final boolean[] good = new boolean[] { false }; + XRequestCallback async = AsyncCallback.create( + tParam.getComponentContext()); + async.addCallback( + new XCallback() { + public void notify(Object aData) { + mb.execute(); + synchronized (done) { + done[0] = true; + done.notifyAll(); + } + } + }, + Any.VOID); + async.addCallback( + new XCallback() { + public void notify(Object aData) { + try { + tools.clickButton("OK"); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new RuntimeException(e); + } + synchronized (good) { + good[0] = true; + } + } + }, + Any.VOID); + synchronized (done) { + while (!done[0]) { + try { + done.wait(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + boolean ok; + synchronized (good) { + ok = good[0]; + } + tRes.tested("createMessageBox()", ok); + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XNumericField.java b/qadevOOo/tests/java/ifc/awt/_XNumericField.java new file mode 100644 index 0000000000..a194fe332c --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XNumericField.java @@ -0,0 +1,308 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XNumericField; +import util.utils; + +/** +* Testing <code>com.sun.star.awt.XNumericField</code> +* interface methods : +* <ul> +* <li><code> setValue()</code></li> +* <li><code> getValue()</code></li> +* <li><code> setMin()</code></li> +* <li><code> getMin()</code></li> +* <li><code> setMax()</code></li> +* <li><code> getMax()</code></li> +* <li><code> setFirst()</code></li> +* <li><code> getFirst()</code></li> +* <li><code> setLast()</code></li> +* <li><code> getLast()</code></li> +* <li><code> setSpinSize()</code></li> +* <li><code> getSpinSize()</code></li> +* <li><code> setDecimalDigits()</code></li> +* <li><code> getDecimalDigits()</code></li> +* <li><code> setStrictFormat()</code></li> +* <li><code> isStrictFormat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XNumericField +*/ +public class _XNumericField extends MultiMethodTest { + + public XNumericField oObj = null; + private double val = 0 ; + private double min = 0 ; + private double max = 0 ; + private double first = 0 ; + private double last = 0 ; + private double spin = 0 ; + private short digits = 0 ; + private boolean strict = true ; + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getValue </code> </li> + * </ul> + */ + public void _setValue() { + requiredMethod("getValue()"); + + double value = val + 1.1; + oObj.setValue(value) ; + + tRes.tested("setValue()", utils.approxEqual(oObj.getValue(), value)); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getValue() { + val = oObj.getValue() ; + + tRes.tested("getValue()", true) ; + } + + /** + * Sets minimal value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMin </code> </li> + * </ul> + */ + public void _setMin() { + requiredMethod("getMin()") ; + + double value = min + 1.1; + oObj.setMin(value); + double ret = oObj.getMin(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setMin()", result); + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getMin() { + + boolean result = true ; + min = oObj.getMin() ; + + tRes.tested("getMin()", result) ; + } + + /** + * Sets maximal value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMax </code> </li> + * </ul> + */ + public void _setMax() { + requiredMethod("getMax()") ; + + double value = max + 1.1; + oObj.setMax(value); + double ret = oObj.getMax(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setMax()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getMax() { + + boolean result = true ; + max = oObj.getMax() ; + + tRes.tested("getMax()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getFirst </code> </li> + * </ul> + */ + public void _setFirst() { + requiredMethod("getFirst()") ; + + double value = first + 1.1; + oObj.setFirst(value); + double ret = oObj.getFirst(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setFirst()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getFirst() { + + boolean result = true ; + first = oObj.getFirst() ; + + tRes.tested("getFirst()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLast </code> </li> + * </ul> + */ + public void _setLast() { + requiredMethod("getLast()") ; + + double value = last + 1.1; + oObj.setLast(value); + double ret = oObj.getLast(); + boolean result = utils.approxEqual(ret, value); + + tRes.tested("setLast()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getLast() { + + boolean result = true ; + last = oObj.getLast() ; + + tRes.tested("getLast()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getSpinSize </code> </li> + * </ul> + */ + public void _setSpinSize() { + requiredMethod("getSpinSize()") ; + + boolean result = true ; + double value = spin + 1.1; + oObj.setSpinSize(value) ; + result = utils.approxEqual(oObj.getSpinSize(), value); + + tRes.tested("setSpinSize()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getSpinSize() { + + boolean result = true ; + spin = oObj.getSpinSize() ; + + tRes.tested("getSpinSize()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getDecimalDigits </code> </li> + * </ul> + */ + public void _setDecimalDigits() { + requiredMethod("getDecimalDigits()") ; + + boolean result = true ; + oObj.setDecimalDigits((short)(digits + 1)) ; + + short res = oObj.getDecimalDigits() ; + result = res == (digits + 1) ; + + tRes.tested("setDecimalDigits()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _getDecimalDigits() { + + boolean result = true ; + digits = oObj.getDecimalDigits() ; + + tRes.tested("getDecimalDigits()", result) ; + } + + /** + * Sets value changed and then compares it to get value. <p> + * Has <b>OK</b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isStrictFormat </code> </li> + * </ul> + */ + public void _setStrictFormat() { + requiredMethod("isStrictFormat()") ; + + boolean result = true ; + oObj.setStrictFormat(!strict) ; + result = oObj.isStrictFormat() == !strict ; + + tRes.tested("setStrictFormat()", result) ; + } + + /** + * Just calls the method and stores value returned. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _isStrictFormat() { + + boolean result = true ; + strict = oObj.isStrictFormat() ; + + tRes.tested("isStrictFormat()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XPatternField.java b/qadevOOo/tests/java/ifc/awt/_XPatternField.java new file mode 100644 index 0000000000..1613be4a0c --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XPatternField.java @@ -0,0 +1,167 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XPatternField; + +/** +* Testing <code>com.sun.star.awt.XPatternField</code> +* interface methods : +* <ul> +* <li><code> setMasks()</code></li> +* <li><code> getMasks()</code></li> +* <li><code> setString()</code></li> +* <li><code> getString()</code></li> +* <li><code> setStrictFormat()</code></li> +* <li><code> isStrictFormat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XPatternField +*/ +public class _XPatternField extends MultiMethodTest { + + public XPatternField oObj = null ; + private String editMask = null ; + private String literalMask = null ; + private String string = null ; + private boolean strict = false ; + + /** + * Sets masks to new values then gets them and compare. <p> + * Has <b> OK </b> status if set and get masks are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMasks </code> </li> + * </ul> + */ + public void _setMasks() { + requiredMethod("getMasks()") ; + + boolean result = true ; + String newEdit = editMask == null ? "ccc" : editMask + "ccc" ; + String newLiteral = literalMask == null ? " " : literalMask + " " ; + oObj.setMasks(newEdit, newLiteral) ; + + String[] edit = new String[1] ; + String[] literal = new String[1] ; + oObj.getMasks(edit, literal) ; + + result &= newEdit.equals(edit[0]) ; + result &= newLiteral.equals(literal[0]) ; + + tRes.tested("setMasks()", result) ; + } + + /** + * Gets masks and stores them. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _getMasks() { + + boolean result = true ; + String[] edit = new String[1] ; + String[] literal = new String[1] ; + oObj.getMasks(edit, literal) ; + + log.println("Edit mask = '" + edit[0] + "', literal = '" + + literal[0] + "'") ; + + editMask = edit[0] ; + literalMask = literal[0] ; + + tRes.tested("getMasks()", result) ; + } + + /** + * Sets new string and then get it for verification. <p> + * Has <b> OK </b> status if get and set strings are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getString </code> </li> + * <li> <code> setMasks </code> : mask must be set for new string + * would be valid. </li> + * </ul> + */ + public void _setString() { + requiredMethod("setMasks()") ; + requiredMethod("getString()") ; + + boolean result = true ; + String newString = string = "abc" ; + oObj.setString(newString) ; + String getString = oObj.getString() ; + + result = newString.equals(getString) ; + + if (!result) { + log.println("Was '" + string + "', Set '" + newString + + "', Get '" + getString + "'") ; + } + + tRes.tested("setString()", result) ; + } + + /** + * Gets current string and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getString() { + + boolean result = true ; + string = oObj.getString() ; + + tRes.tested("getString()", result) ; + } + + /** + * Sets new strict state then checks it. <p> + * Has <b> OK </b> status if the state was changed. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isStrictFormat </code> </li> + * </ul> + */ + public void _setStrictFormat() { + requiredMethod("isStrictFormat()") ; + + boolean result = true ; + oObj.setStrictFormat(!strict) ; + + result = oObj.isStrictFormat() == !strict ; + + tRes.tested("setStrictFormat()", result) ; + } + + /** + * Gets the current strict state and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _isStrictFormat() { + + boolean result = true ; + strict = oObj.isStrictFormat() ; + + tRes.tested("isStrictFormat()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XRadioButton.java b/qadevOOo/tests/java/ifc/awt/_XRadioButton.java new file mode 100644 index 0000000000..a8757cd1c8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XRadioButton.java @@ -0,0 +1,136 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.awt.XRadioButton; + +/** +* Testing <code>com.sun.star.awt.XRadioButton</code> +* interface methods : +* <ul> +* <li><code> addItemListener()</code></li> +* <li><code> removeItemListener()</code></li> +* <li><code> getState()</code></li> +* <li><code> setState()</code></li> +* <li><code> setLabel()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XRadioButton +*/ +public class _XRadioButton extends MultiMethodTest { + + public XRadioButton oObj = null; + private boolean state = false ; + + /** + * Listener implementation which sets flags on appropriate method calls + */ + protected static class TestItemListener implements com.sun.star.awt.XItemListener { + private final java.io.PrintWriter log; + + public TestItemListener(java.io.PrintWriter log) { + this.log = log ; + } + + public void disposing(com.sun.star.lang.EventObject e) { + log.println(" disposing was called.") ; + } + + public void itemStateChanged(com.sun.star.awt.ItemEvent e) { + log.println(" itemStateChanged was called.") ; + } + + } + + TestItemListener itemListener = null ; + + /** + * !!! Can be checked only interactively !!! + */ + public void _addItemListener() { + + itemListener = new TestItemListener(log) ; + + oObj.addItemListener(itemListener) ; + + tRes.tested("addItemListener()", Status.skipped(true)) ; + } + + /** + * !!! Can be checked only interactively !!! + */ + public void _removeItemListener() { + requiredMethod("addItemListener()") ; + + oObj.removeItemListener(itemListener) ; + + tRes.tested("removeItemListener()", Status.skipped(true)) ; + } + + /** + * Gets state and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getState() { + + boolean result = true ; + state = oObj.getState() ; + + tRes.tested("getState()", result) ; + } + + /** + * Sets a new state and the gets it for checking. <p> + * Has <b> OK </b> status if set and get states are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getState </code> </li> + * </ul> + */ + public void _setState() { + requiredMethod("getState()") ; + + boolean result = true ; + oObj.setState(!state) ; + + waitForEventIdle(); + + result = oObj.getState() == !state ; + + tRes.tested("setState()", result) ; + } + + /** + * Just sets a new label. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _setLabel() { + + boolean result = true ; + oObj.setLabel("XRadioButton") ; + + tRes.tested("setLabel()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XScrollBar.java b/qadevOOo/tests/java/ifc/awt/_XScrollBar.java new file mode 100644 index 0000000000..a298ed0829 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XScrollBar.java @@ -0,0 +1,203 @@ +/* + * 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.awt; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.awt.Point; +import com.sun.star.awt.ScrollBarOrientation; +import com.sun.star.awt.XScrollBar; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; + +import java.awt.Robot; +import java.awt.event.InputEvent; + +import lib.MultiMethodTest; + + +public class _XScrollBar extends MultiMethodTest { + public XScrollBar oObj; + public boolean adjusted = false; + com.sun.star.awt.XAdjustmentListener listener = new AdjustmentListener(); + + public void _addAdjustmentListener() throws Exception { + util.FormTools.switchDesignOf(tParam.getMSF(), + (XTextDocument) tEnv.getObjRelation("Document")); + oObj.addAdjustmentListener(listener); + adjustScrollBar(); + + boolean res = adjusted; + oObj.removeAdjustmentListener(listener); + adjusted = false; + adjustScrollBar(); + res &= !adjusted; + tRes.tested("addAdjustmentListener()", res); + } + + public void _removeAdjustmentListener() { + //this method is checked in addAdjustmentListener + //so that method is required here and if it works + //this method is given OK too + requiredMethod("addAdjustmentListener()"); + tRes.tested("removeAdjustmentListener()", true); + } + + public void _setBlockIncrement() { + oObj.setBlockIncrement(15); + oObj.setBlockIncrement(5); + int bi = oObj.getBlockIncrement(); + tRes.tested("setBlockIncrement()",bi==5); + } + + public void _getBlockIncrement() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setBlockIncrement()"); + tRes.tested("getBlockIncrement()", true); + } + + public void _setLineIncrement() { + oObj.setLineIncrement(12); + oObj.setLineIncrement(2); + int li = oObj.getLineIncrement(); + tRes.tested("setLineIncrement()",li==2); + } + + public void _getLineIncrement() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setLineIncrement()"); + tRes.tested("getLineIncrement()", true); + } + + public void _setMaximum() { + oObj.setMaximum(490); + oObj.setMaximum(480); + int max = oObj.getMaximum(); + tRes.tested("setMaximum()",max==480); + } + + public void _getMaximum() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setMaximum()"); + tRes.tested("getMaximum()", true); + } + + public void _setOrientation() { + oObj.setOrientation(ScrollBarOrientation.HORIZONTAL); + oObj.setOrientation(ScrollBarOrientation.VERTICAL); + int ori = oObj.getOrientation(); + tRes.tested("setOrientation()",ori==ScrollBarOrientation.VERTICAL); + } + + public void _getOrientation() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setOrientation()"); + tRes.tested("getOrientation()", true); + } + + public void _setValue() { + oObj.setMaximum(600); + oObj.setValue(480); + oObj.setValue(520); + int val = oObj.getValue(); + tRes.tested("setValue()",val==520); + } + + public void _getValue() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setValue()"); + tRes.tested("getValue()", true); + } + + public void _setVisibleSize() { + oObj.setVisibleSize(700); + oObj.setVisibleSize(500); + int vs = oObj.getVisibleSize(); + tRes.tested("setVisibleSize()",vs==500); + } + + public void _getVisibleSize() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setVisibleSize()"); + tRes.tested("getVisibleSize()", true); + } + + public void _setValues() { + oObj.setValues(80, 200, 300); + oObj.setValues(70, 210, 500); + int val = oObj.getValue(); + int vs = oObj.getVisibleSize(); + int max = oObj.getMaximum(); + tRes.tested("setValues()",((val==70) && (vs==210) && (max==500))); + } + + private void adjustScrollBar() { + + + XScrollBar sc = UnoRuntime.queryInterface( + XScrollBar.class, tEnv.getTestObject()); + + sc.setValue(500); + + waitForEventIdle(); + + XAccessible acc = UnoRuntime.queryInterface( + XAccessible.class, tEnv.getTestObject()); + + XAccessibleComponent aCom = UnoRuntime.queryInterface( + XAccessibleComponent.class, + acc.getAccessibleContext()); + + Point location = aCom.getLocationOnScreen(); + try { + Robot rob = new Robot(); + rob.mouseMove(location.X + 50, location.Y + 75); + rob.mousePress(InputEvent.BUTTON1_MASK); + rob.mouseRelease(InputEvent.BUTTON1_MASK); + } catch (java.awt.AWTException e) { + System.out.println("couldn't adjust scrollbar"); + } + + waitForEventIdle(); + } + + public class AdjustmentListener + implements com.sun.star.awt.XAdjustmentListener { + public void adjustmentValueChanged(com.sun.star.awt.AdjustmentEvent adjustmentEvent) { + System.out.println("Adjustment Value changed"); + System.out.println("AdjustmentEvent: " + adjustmentEvent.Value); + adjusted = true; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + System.out.println("Listener disposed"); + } + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XSpinField.java b/qadevOOo/tests/java/ifc/awt/_XSpinField.java new file mode 100644 index 0000000000..d7044a3c30 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XSpinField.java @@ -0,0 +1,195 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.SpinEvent; +import com.sun.star.awt.XSpinField; +import com.sun.star.awt.XSpinListener; +import com.sun.star.lang.EventObject; + +/** +* Testing <code>com.sun.star.awt.XSpinField</code> +* interface methods : +* <ul> +* <li><code> addSpinListener()</code></li> +* <li><code> removeSpinListener()</code></li> +* <li><code> up()</code></li> +* <li><code> down()</code></li> +* <li><code> first()</code></li> +* <li><code> last()</code></li> +* <li><code> enableRepeat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XSpinField +*/ +public class _XSpinField extends MultiMethodTest { + + public XSpinField oObj = null; + + /** + * Listener implementation which set flags on appropriate + * listener methods calls. + */ + protected static class TestListener implements XSpinListener { + public boolean upFl = false ; + public boolean downFl = false ; + public boolean firstFl = false ; + public boolean lastFl = false ; + + public void up(SpinEvent e) { + upFl = true ; + } + public void down(SpinEvent e) { + downFl = true ; + } + public void first(SpinEvent e) { + firstFl = true ; + } + public void last(SpinEvent e) { + lastFl = true ; + } + public void disposing(EventObject e) {} + } + + private final TestListener listener = new TestListener() ; + + /** + * Just adds a listener. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _addSpinListener() { + oObj.addSpinListener(listener) ; + + tRes.tested("addSpinListener()", true) ; + } + + /** + * Calls the method. <p> + * Has <b>OK</b> status if the appropriate listener method + * was called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addSpinListener </code> </li> + * </ul> + */ + public void _up() { + requiredMethod("addSpinListener()") ; + + oObj.up() ; + waitForEventIdle(); + + tRes.tested("up()", listener.upFl) ; + } + + /** + * Calls the method. <p> + * Has <b>OK</b> status if the appropriate listener method + * was called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addSpinListener </code> </li> + * </ul> + */ + public void _down() throws Exception { + requiredMethod("addSpinListener()") ; + + oObj.down() ; + waitForEventIdle(); + + tRes.tested("down()", listener.downFl) ; + } + + /** + * Calls the method. <p> + * Has <b>OK</b> status if the appropriate listener method + * was called.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addSpinListener </code> </li> + * </ul> + */ + public void _first() throws Exception { + requiredMethod("addSpinListener()") ; + + oObj.first(); + waitForEventIdle(); + + tRes.tested("first()", listener.firstFl) ; + } + + /** + * Calls the method. <p> + * Has <b>OK</b> status if the appropriate listener method + * was called.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addSpinListener </code> </li> + * </ul> + */ + public void _last() throws Exception { + requiredMethod("addSpinListener()") ; + + oObj.last(); + waitForEventIdle(); + + tRes.tested("last()", listener.lastFl) ; + } + + /** + * Removes the listener, then calls <code>up</code> method and + * checks if the listener wasn't called. <p> + * Has <b>OK</b> status if listener wasn't called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addSpinListener </code> </li> + * <li> <code> up </code> </li> + * <li> <code> down </code> </li> + * <li> <code> first </code> </li> + * <li> <code> last </code> </li> + * </ul> + */ + public void _removeSpinListener() { + requiredMethod("addSpinListener()") ; + executeMethod("up()") ; + executeMethod("down()") ; + executeMethod("first()") ; + executeMethod("last()") ; + + listener.upFl = false ; + + oObj.removeSpinListener(listener) ; + + oObj.up() ; + + tRes.tested("removeSpinListener()", !listener.upFl) ; + } + + /** + * Enables then disables repeating. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _enableRepeat() { + oObj.enableRepeat(true) ; + oObj.enableRepeat(false) ; + + tRes.tested("enableRepeat()", true) ; + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XSpinValue.java b/qadevOOo/tests/java/ifc/awt/_XSpinValue.java new file mode 100644 index 0000000000..a8a65e2db3 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XSpinValue.java @@ -0,0 +1,195 @@ +/* + * 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.awt; + +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleComponent; +import com.sun.star.awt.Point; +import com.sun.star.awt.ScrollBarOrientation; +import com.sun.star.awt.XSpinValue; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import java.awt.Robot; +import java.awt.event.InputEvent; +import lib.MultiMethodTest; + +public class _XSpinValue extends MultiMethodTest { + + public XSpinValue oObj; + public boolean adjusted = false; + com.sun.star.awt.XAdjustmentListener listener = new AdjustmentListener(); + + public void _addAdjustmentListener() throws Exception { + util.FormTools.switchDesignOf(tParam.getMSF(), + (XTextDocument) tEnv.getObjRelation("Document")); + oObj.addAdjustmentListener(listener); + adjustScrollBar(); + + boolean res = adjusted; + oObj.removeAdjustmentListener(listener); + adjusted = false; + adjustScrollBar(); + res &= !adjusted; + tRes.tested("addAdjustmentListener()", res); + } + + public void _removeAdjustmentListener() { + //this method is checked in addAdjustmentListener + //so that method is required here and if it works + //this method is given OK too + requiredMethod("addAdjustmentListener()"); + tRes.tested("removeAdjustmentListener()", true); + } + + public void _setSpinIncrement() { + oObj.setSpinIncrement(15); + oObj.setSpinIncrement(5); + int bi = oObj.getSpinIncrement(); + tRes.tested("setSpinIncrement()",bi==5); + } + + public void _getSpinIncrement() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setSpinIncrement()"); + tRes.tested("getSpinIncrement()", true); + } + + + public void _setMaximum() { + oObj.setMaximum(490); + oObj.setMaximum(480); + int max = oObj.getMaximum(); + tRes.tested("setMaximum()",max==480); + } + + public void _getMaximum() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setMaximum()"); + tRes.tested("getMaximum()", true); + } + + public void _setMinimum() { + oObj.setMinimum(90); + oObj.setMinimum(80); + int max = oObj.getMinimum(); + tRes.tested("setMinimum()",max==80); + } + + public void _getMinimum() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setMinimum()"); + tRes.tested("getMinimum()", true); + } + + public void _setOrientation() { + boolean res = true; + try { + oObj.setOrientation(ScrollBarOrientation.HORIZONTAL); + oObj.setOrientation(ScrollBarOrientation.VERTICAL); + } catch (com.sun.star.lang.NoSupportException e) { + log.println("Couldn't set Orientation"); + } + int ori = oObj.getOrientation(); + res &= (ori==ScrollBarOrientation.VERTICAL); + tRes.tested("setOrientation()",res ); + } + + public void _getOrientation() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setOrientation()"); + tRes.tested("getOrientation()", true); + } + + public void _setValue() { + oObj.setMaximum(600); + oObj.setValue(480); + oObj.setValue(520); + int val = oObj.getValue(); + tRes.tested("setValue()",val==520); + } + + public void _getValue() { + //this method is checked in the corresponding set method + //so that method is required here and if it works + //this method is given OK too + requiredMethod("setValue()"); + tRes.tested("getValue()", true); + } + + public void _setValues() { + oObj.setValues(80, 200, 180); + oObj.setValues(70, 210, 200); + int val = oObj.getValue(); + int min = oObj.getMinimum(); + int max = oObj.getMaximum(); + tRes.tested("setValues()",((min==70) && (max==210) && (val==200))); + } + + private void adjustScrollBar() { + + + XSpinValue sv = UnoRuntime.queryInterface( + XSpinValue.class, tEnv.getTestObject()); + + sv.setValue(500); + + waitForEventIdle(); + + XAccessible acc = UnoRuntime.queryInterface( + XAccessible.class, tEnv.getTestObject()); + + XAccessibleComponent aCom = UnoRuntime.queryInterface( + XAccessibleComponent.class, + acc.getAccessibleContext()); + + Point location = aCom.getLocationOnScreen(); + try { + Robot rob = new Robot(); + rob.mouseMove(location.X + 20, location.Y + 10); + rob.mousePress(InputEvent.BUTTON1_MASK); + rob.mouseRelease(InputEvent.BUTTON1_MASK); + } catch (java.awt.AWTException e) { + System.out.println("couldn't adjust scrollbar"); + } + + waitForEventIdle(); + } + + public class AdjustmentListener + implements com.sun.star.awt.XAdjustmentListener { + public void adjustmentValueChanged(com.sun.star.awt.AdjustmentEvent adjustmentEvent) { + System.out.println("Adjustment Value changed"); + System.out.println("AdjustmentEvent: " + adjustmentEvent.Value); + adjusted = true; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + System.out.println("Listener disposed"); + } + } + +} diff --git a/qadevOOo/tests/java/ifc/awt/_XSystemChildFactory.java b/qadevOOo/tests/java/ifc/awt/_XSystemChildFactory.java new file mode 100644 index 0000000000..5955e9a0b6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XSystemChildFactory.java @@ -0,0 +1,31 @@ +/* + * 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.awt; + +import com.sun.star.awt.XSystemChildFactory; +import lib.MultiMethodTest; + +public final class _XSystemChildFactory extends MultiMethodTest { + public XSystemChildFactory oObj; + + public void _createSystemChild() { + //TODO + tRes.tested("createSystemChild()", true); + } +} diff --git a/qadevOOo/tests/java/ifc/awt/_XTabController.java b/qadevOOo/tests/java/ifc/awt/_XTabController.java new file mode 100644 index 0000000000..8fa384497c --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTabController.java @@ -0,0 +1,156 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XTabController; +import com.sun.star.awt.XTabControllerModel; + +/** +* This interface is DEPRECATED !!! +* All test results are SKIPPED.OK now. +* Testing <code>com.sun.star.awt.XTabController</code> +* interface methods : +* <ul> +* <li><code> activateFirst()</code></li> +* <li><code> activateLast()</code></li> +* <li><code> activateTabOrder()</code></li> +* <li><code> autoTabOrder()</code></li> +* <li><code> getContainer()</code></li> +* <li><code> getControls()</code></li> +* <li><code> getModel()</code></li> +* <li><code> setContainer()</code></li> +* <li><code> setModel()</code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'MODEL'</code> : <code>XTabControllerModel</code> a model for +* the object</li> +* <li> <code>'CONTAINER'</code> : <code>XControlContainer</code> a container +* for the object</li> +* <ul> <p> +* @see com.sun.star.awt.XTabController +*/ +public class _XTabController extends MultiMethodTest { + public XTabController oObj = null; + + /** + * Test calls the method with object relation 'MODEL' as a parameter.<p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _setModel() { + oObj.setModel( (XTabControllerModel) tEnv.getObjRelation("MODEL")); + tRes.tested("setModel()", Status.skipped(true) ); + } + + /** + * Test calls the method, then checks returned value.<p> + * Has <b> OK </b> status if method returns a value that equals to + * corresponding object relation.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setModel() </code> : sets model for the object </li> + * </ul> + */ + public void _getModel() { + requiredMethod("setModel()"); + oObj.getModel(); + tRes.tested("getModel()", Status.skipped(true)); + } + + /** + * Test calls the method with object relation 'CONTAINER' as a parameter.<p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _setContainer() { + oObj.setContainer( (XControlContainer) + tEnv.getObjRelation("CONTAINER")); + tRes.tested("setContainer()", Status.skipped(true)); + } + + /** + * Test calls the method, then checks returned value.<p> + * Has <b> OK </b> status if method returns a value that equals to + * corresponding object relation.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setContainer() </code> : sets container for the object</li> + * </ul> + */ + public void _getContainer() { + requiredMethod( "setContainer()"); + oObj.getContainer(); + tRes.tested("getContainer()", Status.skipped(true) ); + } + + /** + * Test calls the method, then checks returned sequence.<p> + * Has <b> OK </b> status if returned sequence is not null.<p> + */ + public void _getControls() { + oObj.getControls(); + tRes.tested("getControls()", Status.skipped(true) ); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _autoTabOrder() { + oObj.autoTabOrder(); + tRes.tested("autoTabOrder()", Status.skipped(true)); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _activateTabOrder() { + oObj.activateTabOrder(); + tRes.tested("activateTabOrder()", Status.skipped(true)); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _activateFirst() { + oObj.activateFirst(); + tRes.tested("activateFirst()", Status.skipped(true)); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _activateLast() { + oObj.activateLast(); + tRes.tested("activateLast()", Status.skipped(true)); + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTabControllerModel.java b/qadevOOo/tests/java/ifc/awt/_XTabControllerModel.java new file mode 100644 index 0000000000..4b20701680 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTabControllerModel.java @@ -0,0 +1,157 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; +import lib.Status; + +import com.sun.star.awt.XTabControllerModel; + +/** +* Testing <code>com.sun.star.awt.XTabControllerModel</code> +* interface methods : +* <ul> +* <li><code> getGroupControl()</code></li> +* <li><code> setGroupControl()</code></li> +* <li><code> setControlModels()</code></li> +* <li><code> getControlModels()</code></li> +* <li><code> setGroup()</code></li> +* <li><code> getGroupCount()</code></li> +* <li><code> getGroup()</code></li> +* <li><code> getGroupByName()</code></li> +* </ul> <p> +* +* Since the interface is <b>DEPRECATED</b> all methods have +* status SKIPPED.OK <p> +* +* This test needs the following object relations : +* <ul> +* <li> <code>'Model1'</code> : <code>XControlModel</code> relation +* , any control model belonging to the object tested.</li> +* <li> <code>'Model2'</code> : <code>XControlModel</code> relation +* , any control model belonging to the object tested.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XTabControllerModel +*/ +public class _XTabControllerModel extends MultiMethodTest { + + public XTabControllerModel oObj = null; + + + /** + * Sets group control to <code>true</code> then calls + * <code>getGroupControl()</code> method and checks the value. <p> + * Has <b> OK </b> status if the method returns <code>true</code> + * <p> + */ + public void _getGroupControl() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("getGroupControl()", Status.skipped(true)); + } + + /** + * Sets group control to <code>false</code> then calls + * <code>getGroupControl()</code> method and checks the value. <p> + * Has <b> OK </b> status if the method returns <code>false</code> + * <p> + */ + public void _setGroupControl() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("setGroupControl()", Status.skipped(true)); + } + + /** + * Test calls the method and sets control models to a single + * model from 'Model1' relation. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _setControlModels() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("setControlModels()", Status.skipped(true)); + } + + /** + * Calls method and checks if models were properly set in + * <code>setControlModels</code> method test. <p> + * Has <b>OK</b> status if the model sequence set is equal + * to the sequence get. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setControlModels </code> : to set sequence of models.</li> + * </ul> + */ + public void _getControlModels() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("getControlModels()", Status.skipped(true)); + } + + /** + * Sets the group named 'XTabControlModel' to sequence with a single + * element from 'Model2' relation. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _setGroup() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("setGroup()", Status.skipped(true)); + } + + /** + * Calls method and checks if the group was properly set in + * <code>setGroup</code> method test. <p> + * Has <b>OK</b> status if the sequence set is equal + * to the sequence get. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGroup </code> : to set the sequence.</li> + * </ul> + */ + public void _getGroup() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("getGroup()", Status.skipped(true)); + } + + /** + * Retrieves group named 'XTabControllerModel' added in <code> + * setGroup</code> method test, and checks it. <p> + * Has <b> OK </b> status if sequence get is equal to sequence set. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGroup </code> : to set the sequence.</li> + * </ul> + */ + public void _getGroupByName() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("getGroupByName()", Status.skipped(true)); + } + + /** + * Gets number of groups. + * Has <b> OK </b> status if the number is greater than 0. + * <ul> + * <li> <code> setGroup </code> : to has at least one group.</li> + * </ul> + */ + public void _getGroupCount() { + log.println("Always SKIPPED.OK since deprecated."); + tRes.tested("getGroupCount()", Status.skipped(true)); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTextComponent.java b/qadevOOo/tests/java/ifc/awt/_XTextComponent.java new file mode 100644 index 0000000000..b22cdbdb2b --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTextComponent.java @@ -0,0 +1,255 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; +import util.ValueComparer; + +import com.sun.star.awt.Selection; +import com.sun.star.awt.TextEvent; +import com.sun.star.awt.XTextComponent; +import com.sun.star.awt.XTextListener; +import com.sun.star.lang.EventObject; + +/** +* Testing <code>com.sun.star.awt.XTextComponent</code> +* interface methods: +* <ul> +* <li><code> addTextListener() </code></li> +* <li><code> removeTextListener() </code></li> +* <li><code> setText() </code></li> +* <li><code> getText() </code></li> +* <li><code> insertText() </code></li> +* <li><code> getSelectedText() </code></li> +* <li><code> setSelection() </code></li> +* <li><code> getSelection() </code></li> +* <li><code> setEditable() </code></li> +* <li><code> isEditable() </code></li> +* <li><code> setMaxTextLen() </code></li> +* <li><code> getMaxTextLen() </code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'XTextComponent.onlyNumbers'</code> (of type <code>Object</code>): +* needed for checking if component can contain only numeric values </li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XTextComponent +*/ +public class _XTextComponent extends MultiMethodTest { + public XTextComponent oObj = null; + public boolean textChanged = false; + // indicates that component can contain only numeric values + private boolean num = false ; + + /** + * Listener implementation which just set flag when listener + * method is called. + */ + protected class MyChangeListener implements XTextListener { + public void disposing ( EventObject oEvent ) {} + public void textChanged(TextEvent ev) { + textChanged = true; + } + } + + XTextListener listener = new MyChangeListener(); + + /** + * Retrieves object relation, then sets flag 'num' to 'true' + * if relation is not null. + */ + @Override + public void before() { + if (tEnv.getObjRelation("XTextComponent.onlyNumbers") != null) + num = true; + } + + /** + * After test calls the method, a new text is set to the object. Then + * we check if listener was called, and set a new text value + * to the object.<p> + * Has <b> OK </b> status if listener was called. + */ + public void _addTextListener() throws Exception { + oObj.addTextListener(listener); + oObj.setText("Listen"); + waitForEventIdle(); + if (!textChanged) { + log.println("Listener wasn't called after changing Text"); + } + + tRes.tested("addTextListener()",textChanged); + } + + /** + * After setting flag 'textChanged' to false, test calls the method. + * Then a new text value is set to the object. <p> + * Has <b> OK </b> status if listener was not called. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li><code> addTextListener() </code>: adds listener to the object.</li> + * </ul> + */ + public void _removeTextListener() { + requiredMethod("addTextListener()"); + textChanged = false; + oObj.removeTextListener(listener); + oObj.setText("Do not listen"); + tRes.tested("removeTextListener()",!textChanged); + } + + /** + * At first we're setting some string variable 'newText' depending of a kind + * of object we are working with. Then test calls the method. <p> + * Has <b> OK </b> status if set value is equal to a value obtained after. + */ + public void _setText() { + String newText = num ? "823" : "setText" ; + if (tEnv.getTestCase().getObjectName().equals("OTimeControl")) { + newText = "8:15"; + } + log.println("Setting text to : '" + newText + "'") ; + oObj.setText(newText); + log.println("Getting text : '" + oObj.getText() + "'") ; + tRes.tested("setText()",oObj.getText().equals(newText)); + } + + /** + * At first we're setting some string variable 'newText' depending of a kind + * of object we are working with. Then we set text to the object and call + * the method. <p> + * Has <b> OK </b> status if set value is equal to a value obtained using + * getText() method. + */ + public void _getText() { + String newText = num ? "823" : "setText" ; + if (tEnv.getTestCase().getObjectName().equals("OTimeControl")) { + newText = "8:15"; + } + oObj.setText(newText); + tRes.tested("getText()",oObj.getText().equals(newText)); + } + + /** + * At first we're setting string variables 'text' and 'itext' depending + * of a kind of object we are working with. Next, value from 'text' variable + * is set to an object using setText(), then the method insertText() is called. + * <p> + * Has <b> OK </b> status if text is inserted to the object. + */ + public void _insertText() { + String text = num ? "753" : "iText" ; + String itext = num ? "6" : "insert" ; + log.println("Setting text to : '" + text + "'") ; + oObj.setText(text); + log.println("Inserting text to (0,1) : '" + itext + "'") ; + oObj.insertText(new Selection(0,1), itext); + log.println("getText() returns: " + oObj.getText()); + tRes.tested("insertText()", oObj.getText().equals + (num ? "653" : "insertText")); + } + + /** + * After text is set to the object, test calls the method.<p> + * Has <b> OK </b> status if selected text is equal to first three symbols + * of text added before. + */ + public void _getSelectedText() { + String text = num ? "753" : "txt" ; + oObj.setText(text); + oObj.setSelection(new Selection(0,3)); + boolean result = oObj.getSelectedText().equals(text); + + if (! result) { + System.out.println("Getting '"+oObj.getSelectedText()+"'"); + System.out.println("Expected '"+text+"'"); + } + + tRes.tested("getSelectedText()",result); + } + + /** + * After setting new text to an object, and defining selection variable, + * test calls the method. <p> + * Has <b> OK </b> status if selection set before is equal to a selection we + * got using getSelection(). + */ + public void _setSelection() { + oObj.setText("setSelection"); + Selection sel = new Selection(0,3); + oObj.setSelection(sel); + tRes.tested("setSelection()", ValueComparer.equalValue + (oObj.getSelection(), sel)); + } + + /** + * After setting new text to an object, and defining selection variable, + * test calls the method. <p> + * Has <b> OK </b> status if selection set before is equal to a selection we + * got using getSelection(). + */ + public void _getSelection() { + oObj.setText("getSelection"); + Selection sel = new Selection(2,3); + oObj.setSelection(sel); + tRes.tested("getSelection()", ValueComparer.equalValue + (oObj.getSelection(), sel)); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if method has changed a property 'Editable'. + */ + public void _setEditable(){ + oObj.setEditable(true); + tRes.tested("setEditable()", oObj.isEditable()); + } + + /** + * First we set 'Editable' variable to false. Then test calls the method.<p> + * Has <b> OK </b> status if method returns value we set before. + */ + public void _isEditable(){ + oObj.setEditable(false); + tRes.tested("isEditable()", ! oObj.isEditable()); + } + + /** + * Test calls the method. Then new text value is set to the object. <p> + * Has <b> OK </b> status if text, returned by getText() is a string of + * length we set before. + */ + public void _setMaxTextLen() { + oObj.setMaxTextLen((short)10); + tRes.tested("setMaxTextLen()",oObj.getMaxTextLen()==10); + } + + /** + * At first we set MaxTextLen, then test calls the method. <p> + * Has <b> OK </b> status if method returns a value we set before. + */ + public void _getMaxTextLen() { + oObj.setMaxTextLen((short)15); + log.println("getMaxTextLen() returns: "+oObj.getMaxTextLen()); + tRes.tested("getMaxTextLen()",oObj.getMaxTextLen()==15); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTextLayoutConstrains.java b/qadevOOo/tests/java/ifc/awt/_XTextLayoutConstrains.java new file mode 100644 index 0000000000..c15b5d0936 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTextLayoutConstrains.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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.Size; +import com.sun.star.awt.XTextLayoutConstrains; + +/** +* Testing <code>com.sun.star.awt.XTextLayoutConstrains</code> +* interface methods: +* <ul> +* <li><code> getMinimumSize() </code></li> +* <li><code> getColumnsAndLines() </code></li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XTextLayoutConstrains +*/ +public class _XTextLayoutConstrains extends MultiMethodTest { + public XTextLayoutConstrains oObj = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if both returned size fields are not equal to zero. + */ + public void _getMinimumSize() { + short nCols = 0; + short nLines = 0; + Size mSize = oObj.getMinimumSize(nCols,nLines); + boolean res = ( (mSize.Height != 0) && (mSize.Width != 0) ); + if (!res) { + log.println("mSize.height: " + mSize.Height); + log.println("mSize.width: " + mSize.Width); + } + tRes.tested("getMinimumSize()", res); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if both returned values are not equal to zero. + */ + public void _getColumnsAndLines() { + short[] nCols = new short[1]; + short[] nLines = new short[1]; + oObj.getColumnsAndLines(nCols,nLines); + boolean res = ( (nCols[0] != 0) && (nLines[0] != 0) ); + if (!res) { + log.println("nCols: " + nCols[0]); + log.println("nLines: " + nLines[0]); + } + tRes.tested("getColumnsAndLines()",res); + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTextListener.java b/qadevOOo/tests/java/ifc/awt/_XTextListener.java new file mode 100644 index 0000000000..2d57e349ca --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTextListener.java @@ -0,0 +1,119 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.awt.TextEvent; +import com.sun.star.awt.XTextListener; + +/** +* Testing <code>com.sun.star.awt.XTextListener</code> +* interface methods: +* <ul> +* <li><code> textChanged() </code></li> +* </ul><p> +* +* This test needs the following object relations : +* <ul> +* <li> <code>'TestTextListener'</code> +* (of type <code>ifc.awt._XTextListener.TestTextListener</code>): +* this listener implementation must be registered for object tested for +* checking +* <code>textChanged()</code> method call. The listener must be registered +* in object environment creation because it's not a fact that tested +* component supports <code>XTextComponent</code> interface and the listener +* can be registered in another object.</li> +* <ul> <p> +* +* @see com.sun.star.awt.XTextListener +*/ +public class _XTextListener extends MultiMethodTest { + public XTextListener oObj = null; + + /** + * Listener implementation which sets flags on appropriate method calls + * and stores event passed. + */ + public static class TestTextListener implements + com.sun.star.awt.XTextListener { + public boolean textChangedCalled = false ; + public TextEvent event = null ; + + public void textChanged(TextEvent e) { + textChangedCalled = true ; + event = e ; + } + + public void disposing(com.sun.star.lang.EventObject e) {} + + } + + TestTextListener textListener = null; + /** + * Retrieves object relation. + * @throws StatusException If the relation not found. + */ + @Override + public void before() { + textListener = (TestTextListener) + tEnv.getObjRelation("TestTextListener"); + if (textListener == null) { + throw new StatusException(Status.failed("Relation not found")); + } + } + + /** + * First a <code>TextEvent</code> object created and + * it is passed to <code>textChanged</code> method + * call. Then a short wait follows for listener already + * registered at the object to be called. <p> + * Has <b> OK </b> status if the listener was called with + * the same <code>TextEvent</code> object as was created + * before. + */ + public void _textChanged() { + + boolean result = true ; + + TextEvent event = new TextEvent() ; + event.dummy1 = 2; + oObj.textChanged(event); + + waitForEventIdle(); + + result = textListener.textChangedCalled && + textListener.event.dummy1 == 2; + + tRes.tested("textChanged()", result) ; + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTimeField.java b/qadevOOo/tests/java/ifc/awt/_XTimeField.java new file mode 100644 index 0000000000..cee4e51d6c --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTimeField.java @@ -0,0 +1,287 @@ +/* + * 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.awt; + + +import lib.MultiMethodTest; + +import com.sun.star.awt.XTimeField; +import com.sun.star.util.Time; + +/** +* Testing <code>com.sun.star.awt.XTimeField</code> +* interface methods : +* <ul> +* <li><code> setTime()</code></li> +* <li><code> getTime()</code></li> +* <li><code> setMin()</code></li> +* <li><code> getMin()</code></li> +* <li><code> setMax()</code></li> +* <li><code> getMax()</code></li> +* <li><code> setFirst()</code></li> +* <li><code> getFirst()</code></li> +* <li><code> setLast()</code></li> +* <li><code> getLast()</code></li> +* <li><code> setEmpty()</code></li> +* <li><code> isEmpty()</code></li> +* <li><code> setStrictFormat()</code></li> +* <li><code> isStrictFormat()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XTimeField +*/ +public class _XTimeField extends MultiMethodTest { + + public XTimeField oObj = null; + private boolean strict = false ; + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getTime </code> </li> + * </ul> + */ + public void _setTime() { + requiredMethod("getTime()") ; + + boolean result = true ; + oObj.setTime(new Time(0, (short)0, (short)15, (short)11, false)); + Time time = oObj.getTime(); + result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 15 && time.Hours == 11 && !time.IsUTC; + + if (! result ) { + System.out.println("Getting " + oObj.getTime() + " expected 11:15"); + } + + tRes.tested("setTime()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getTime() { + + boolean result = true ; + oObj.getTime() ; + + tRes.tested("getTime()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMin </code> </li> + * </ul> + */ + public void _setMin() { + + boolean result = true ; + oObj.setMin(new Time(0, (short)14, (short)18, (short)6, false)); + Time time = oObj.getMin(); + result = time.NanoSeconds == 0 && time.Seconds == 14 && time.Minutes == 18 && time.Hours == 6 && !time.IsUTC; + + tRes.tested("setMin()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getMin() { + + boolean result = true ; + oObj.getMin() ; + + tRes.tested("getMin()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMax </code> </li> + * </ul> + */ + public void _setMax() { + + boolean result = true ; + oObj.setMax(new Time(855447, (short)31, (short)23, (short)22, false)) ; + Time time = oObj.getMax(); + result = time.NanoSeconds == 855447 && time.Seconds == 31 && time.Minutes == 23 && time.Hours == 22 && !time.IsUTC; + + tRes.tested("setMax()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getMax() { + + boolean result = true ; + oObj.getMax() ; + + tRes.tested("getMax()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getFirst </code> </li> + * </ul> + */ + public void _setFirst() { + + boolean result = true ; + oObj.setFirst(new Time(0, (short)0, (short)30, (short)7, false)) ; + Time time = oObj.getFirst(); + result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 30 && time.Hours == 7 && !time.IsUTC; + + if (!result) { + log.println("Set to 07:30 but returned " + oObj.getFirst()) ; + } + + tRes.tested("setFirst()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getFirst() { + + boolean result = true ; + com.sun.star.util.Time val = oObj.getFirst() ; + + log.println("getFirst() = " + val) ; + + tRes.tested("getFirst()", result) ; + } + + /** + * Sets a new value and checks if it was correctly set. <p> + * Has <b> OK </b> status if set and get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLast </code> </li> + * </ul> + */ + public void _setLast() { + + boolean result = true ; + oObj.setLast(new Time(500000, (short)31, (short)30, (short)18, false)) ; + Time time = oObj.getLast(); + result = time.NanoSeconds == 500000 && time.Seconds == 31 && time.Minutes == 30 && time.Hours == 18 && !time.IsUTC; + + if (!result) { + log.println("Set to 18:30:31.5 but returned " + oObj.getLast()) ; + } + + tRes.tested("setLast()", result) ; + } + + /** + * Gets the current value. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + */ + public void _getLast() { + + boolean result = true ; + com.sun.star.util.Time val = oObj.getLast() ; + + log.println("getLast() = " + val) ; + + tRes.tested("getLast()", result) ; + } + + /** + * Sets the value to empty. <p> + * Has <b> OK </b> status if no runtime exceptions occurred + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTime </code> : value must be not empty </li> + * </ul> + */ + public void _setEmpty() { + requiredMethod("setTime()") ; + + boolean result = true ; + oObj.setEmpty() ; + + tRes.tested("setEmpty()", result) ; + } + + /** + * Checks if the field is empty. <p> + * Has <b> OK </b> status if the value is empty.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setEmpty() </code> </li> + * </ul> + */ + public void _isEmpty() { + requiredMethod("setEmpty()") ; + + boolean result = true ; + result = oObj.isEmpty() ; + + tRes.tested("isEmpty()", result) ; + } + + /** + * Checks strict state. <p> + * Has <b> OK </b> status if strict format is set. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> isStrictFormat </code> </li> + * </ul> + */ + public void _setStrictFormat() { + requiredMethod("isStrictFormat()") ; + + boolean result = true ; + oObj.setStrictFormat(!strict) ; + + result = oObj.isStrictFormat() == !strict ; + + tRes.tested("setStrictFormat()", result) ; + } + + /** + * Gets strict state and stores it. <p> + * Has <b> OK </b> status if no runtime exceptions occurred. + */ + public void _isStrictFormat() { + + boolean result = true ; + strict = oObj.isStrictFormat() ; + + tRes.tested("isStrictFormat()", result) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/_XToolkit.java b/qadevOOo/tests/java/ifc/awt/_XToolkit.java new file mode 100644 index 0000000000..5cac8c74ad --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XToolkit.java @@ -0,0 +1,147 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.WindowDescriptor; +import com.sun.star.awt.XDevice; +import com.sun.star.awt.XRegion; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.XWindowPeer; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.awt.XToolkit</code> +* interface methods: +* <ul> +* <li><code> getDesktopWindow() </code></li> +* <li><code> getWorkArea() </code></li> +* <li><code> createWindow() </code></li> +* <li><code> createWindows() </code></li> +* <li><code> createScreenCompatibleDevice() </code></li> +* <li><code> createRegion() </code></li> +* </ul><p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XToolkit +*/ +public class _XToolkit extends MultiMethodTest { + public XToolkit oObj = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status always, because Desktop component + * currently is not supported as visible. + */ + public void _getDesktopWindow() { + XWindowPeer win = oObj.getDesktopWindow(); + if (win == null) { + log.println("getDesktopWindow() returns NULL"); + } + tRes.tested("getDesktopWindow()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. + */ + public void _getWorkArea() { + Rectangle area = oObj.getWorkArea(); + tRes.tested("getWorkArea()", area != null); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. + */ + public void _createWindow() { + boolean res = false; + try { + XWindowPeer cWin = oObj.createWindow( + createDesc(new Rectangle(0,0,100,100))); + if (cWin == null) { + log.println("createWindow() create a NULL Object"); + } else { + UnoRuntime.queryInterface(XComponent.class, cWin).dispose(); + res = true; + } + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("Exception occurred while checking 'createWindow':"); + ex.printStackTrace(log); + } + tRes.tested("createWindow()", res); + } + + /** + * After defining of WindowDescriptor array, test calls the method. <p> + * Has <b> OK </b> status if all elements of the returned array are + * not null. + */ + public void _createWindows() { + boolean res = false; + try { + WindowDescriptor[] descs = new WindowDescriptor[2]; + descs[0] = createDesc(new Rectangle(0,0,100,100)); + descs[1] = createDesc(new Rectangle(100,100,200,200)); + XWindowPeer[] cWins = oObj.createWindows(descs); + if ( (cWins[0] == null) || (cWins[1] == null) ) { + log.println("createWindows() creates NULL Windows"); + } else { + UnoRuntime.queryInterface(XComponent.class, cWins[0]).dispose(); + UnoRuntime.queryInterface(XComponent.class, cWins[1]).dispose(); + res = true; + } + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("Exception occurred while checking 'createWindows':"); + ex.printStackTrace(log); + } + tRes.tested("createWindows()", res); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. + */ + public void _createScreenCompatibleDevice() { + XDevice dev = oObj.createScreenCompatibleDevice(100, 100); + tRes.tested("createScreenCompatibleDevice()", dev != null); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. + */ + public void _createRegion() { + XRegion reg = oObj.createRegion(); + tRes.tested("createRegion()", reg != null); + } + + /** + * Just creates the WindowDescriptor as an argument for createWindow(). + */ + public WindowDescriptor createDesc(Rectangle rect) { + XWindowPeer win = (XWindowPeer) tEnv.getObjRelation("WINPEER"); + return new WindowDescriptor(com.sun.star.awt.WindowClass.TOP, + "", win, (short) -1, rect, com.sun.star.awt.WindowAttribute.SHOW); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XTopWindow.java b/qadevOOo/tests/java/ifc/awt/_XTopWindow.java new file mode 100644 index 0000000000..91d4d3c367 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XTopWindow.java @@ -0,0 +1,190 @@ +/* + * 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.awt; + +import java.io.PrintWriter; + +import lib.MultiMethodTest; + +import com.sun.star.awt.XMenuBar; +import com.sun.star.awt.XTopWindow; +import com.sun.star.awt.XTopWindowListener; +import com.sun.star.lang.EventObject; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.awt.XTopWindow</code> +* interface methods : +* <ul> +* <li><code> addTopWindowListener()</code></li> +* <li><code> removeTopWindowListener()</code></li> +* <li><code> toFront()</code></li> +* <li><code> toBack()</code></li> +* <li><code> setMenuBar()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XTopWindow +*/ +public class _XTopWindow extends MultiMethodTest { + + public XTopWindow oObj = null; + + /** + * Listener implementation which sets flags on different + * method calls. + */ + protected static class TestListener implements XTopWindowListener { + private final PrintWriter log; + public boolean activated = false ; + public boolean deactivated = false ; + + public TestListener(PrintWriter log) { + this.log = log ; + } + + public void initListener() { + activated = false; + deactivated = false; + } + + public void windowOpened(EventObject e) { + log.println("windowOpened() called") ; + } + public void windowClosing(EventObject e) { + log.println("windowClosing() called") ; + } + public void windowClosed(EventObject e) { + log.println("windowClosed() called") ; + } + public void windowMinimized(EventObject e) { + log.println("windowMinimized() called") ; + } + public void windowNormalized(EventObject e) { + log.println("windowNormalized() called") ; + } + public void windowActivated(EventObject e) { + activated = true; + log.println("windowActivated() called") ; + } + public void windowDeactivated(EventObject e) { + deactivated = true; + log.println("windowDeactivated() called") ; + } + public void disposing(EventObject e) {} + } + + protected TestListener listener = null ; + + XTextDocument aTextDoc = null; + + + @Override + protected void before() { + aTextDoc = util.WriterTools.createTextDoc(tParam.getMSF()); + } + + /** + * Adds a listener . <p> + * + * Has <b>OK</b> status always (listener calls are checked in + * other methods. <p> + */ + public void _addTopWindowListener() { + listener = new TestListener(log) ; + + oObj.addTopWindowListener(listener) ; + + tRes.tested("addTopWindowListener()", true); + } + + /** + * Removes a listener added before. <p> + * Has <b>OK</b> status always. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> toBack </code> : to have a definite method execution + * order.</li> + * </ul> + */ + public void _removeTopWindowListener() { + executeMethod("toBack()"); + + oObj.removeTopWindowListener(listener); + + tRes.tested("removeTopWindowListener()", true); + } + + /** + * Moves the window to front and check the listener calls. <p> + * Has <b>OK</b> status if listener <code>activated</code> method + * was called. + */ + public void _toFront() { + requiredMethod("addTopWindowListener()"); + listener.initListener(); + oObj.toFront(); + waitForEventIdle(); + + tRes.tested("toFront()", listener.activated && !listener.deactivated); + } + + /** + * This method doesn't do anything the Office implementation. <p> + * So it has always <b>OK</b> status + */ + public void _toBack() { + oObj.toBack(); + tRes.tested("toBack()", true); + } + + /** + * Creates a simple menu bar and adds to the window. <p> + * Has <b>OK</b> status if no runtime exceptions occurred. + */ + public void _setMenuBar() { + XMenuBar menu = null ; + boolean result = true ; + + try { + menu = UnoRuntime.queryInterface(XMenuBar.class, + tParam.getMSF(). + createInstance("com.sun.star.awt.MenuBar")) ; + + menu.insertItem((short)1, "MenuItem", + com.sun.star.awt.MenuItemStyle.CHECKABLE, (short)1) ; + + oObj.setMenuBar(menu) ; + } catch (com.sun.star.uno.Exception e) { + log.println("Can't instantiate MenuBar service") ; + result = false ; + } + + tRes.tested("setMenuBar()", result) ; + } + + /** + * Disposes the document created in <code>before</code> method. + */ + @Override + protected void after() { + aTextDoc.dispose(); + } +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XUnoControlContainer.java b/qadevOOo/tests/java/ifc/awt/_XUnoControlContainer.java new file mode 100644 index 0000000000..de59741d4b --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XUnoControlContainer.java @@ -0,0 +1,173 @@ +/* + * 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.awt; + +import com.sun.star.awt.XTabController; +import com.sun.star.awt.XUnoControlContainer; +import lib.MultiMethodTest; + +/** + * Testing <code>com.sun.star.awt.XUnoControlContainer</code> + * interface methods : + * <ul> + * <li><code> addTabController()</code></li> + * <li><code> removeTabController()</code></li> + * <li><code> getTabControllers()</code></li> + * <li><code> setTabControllers()</code></li> + * </ul> <p> + * +* This test needs the following object relations : +* <ul> +* <li> <code>'TABCONTROL1'</code> (of type <code>XTabController</code>)</li> +* <li> <code>'TABCONTROL2'</code> (of type <code>XTabController</code>)</li> + *</ul> + * + * Test is <b> NOT </b> multithread compliant. <p> + */ + +public class _XUnoControlContainer extends MultiMethodTest { + public XUnoControlContainer oObj = null; + private XTabController[] TabControllers = new XTabController[2]; + private XTabController tabControl1 = null; + private XTabController tabControl2 = null; + + /** + * This method gets the object relations. + * + */ + @Override + protected void before() { + + tabControl1 = (XTabController) tEnv.getObjRelation("TABCONTROL1"); + tabControl2 = (XTabController) tEnv.getObjRelation("TABCONTROL2"); + if ((tabControl1 == null) || (tabControl2 == null)){ + log.println("ERROR: Needed object relations 'TABCONTROL1' and " + + "'TABCONTROL2' are not found."); + } + TabControllers[0] = tabControl1; + TabControllers[1] = tabControl2; + + } + + + + /** + * This tests removes the object relations <code>TABCONTROL1</code> and + * <code>TABCONTROL1</code>. + * Has <b> OK </b> status if the sequence of <code>XTabController[]</code> + * get before calling method is smaller then sequence of + * <code>XTabController[]</code> get after calling method.<p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getTabControllers() </code> </li> + * <li> <code> removeTabController() </code> </li> + * </ul> + */ + public void _setTabControllers() { + requiredMethod( "getTabControllers()"); + requiredMethod( "removeTabController()"); + + log.println("removing TABCONTROL1 and TABCONTROL2"); + oObj.removeTabController(tabControl1); + oObj.removeTabController(tabControl2); + + log.println("get current controllers"); + XTabController[] myTabControllers = oObj.getTabControllers(); + + log.println("set new controllers"); + oObj.setTabControllers( TabControllers ); + + log.println("get new current controllers"); + XTabController[] myNewTabControllers = oObj.getTabControllers(); + + tRes.tested("setTabControllers()", + (myTabControllers.length < myNewTabControllers.length )); + + } + + /** + * Test calls the method, then checks returned value.<p> + * Has <b> OK </b> status if method returns a value that greater than zero.<p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addTabController() </code></li> + * </ul> + */ + public void _getTabControllers() { + requiredMethod( "addTabController()"); + XTabController[] myTabControllers = oObj.getTabControllers(); + tRes.tested("getTabControllers()", ( myTabControllers.length > 0)); + } + + /** + * Test calls the method with object relation 'TABCONTROL1' as a parameter.<p> + * Has <b> OK </b> status if the sequence of <code>XTabController[]</code> + * get before calling method is smaller then sequence of + * <code>XTabController[]</code> get after calling method.<p> + */ + public void _addTabController() { + log.println("get current controllers"); + XTabController[] myTabControllers = oObj.getTabControllers(); + + log.println("add TABCONTROL1"); + oObj.addTabController( tabControl1 ); + + log.println("get new current controllers"); + XTabController[] myNewTabControllers = oObj.getTabControllers(); + + tRes.tested("addTabController()", + (myTabControllers.length < myNewTabControllers.length )); + } + + /** + * Test calls the method with object relation 'TABCONTROL2' as a parameter.<p> + * Has <b> OK </b> status if the sequence of <code>XTabController[]</code> + * get before calling method is smaller then sequence of + * <code>XTabController[]</code> get after calling method.<p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getTabControllers() </code></li> + * <li> <code> addTabController() </code></li> + * </ul> + */ + public void _removeTabController() { + requiredMethod( "getTabControllers()"); + requiredMethod( "addTabController()"); + + log.println("add TABCONTROL2"); + oObj.addTabController( tabControl2 ); + + log.println("get current controllers"); + XTabController[] myTabControllers = oObj.getTabControllers(); + + log.println("remove TABCONTROL2"); + oObj.removeTabController(tabControl2); + + log.println("get new current controllers"); + XTabController[] myNewTabControllers = oObj.getTabControllers(); + + tRes.tested("removeTabController()", + (myTabControllers.length > myNewTabControllers.length )); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XView.java b/qadevOOo/tests/java/ifc/awt/_XView.java new file mode 100644 index 0000000000..a7858d037d --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XView.java @@ -0,0 +1,135 @@ +/* + * 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.awt; + +import lib.MultiMethodTest; + +import com.sun.star.awt.Size; +import com.sun.star.awt.XGraphics; +import com.sun.star.awt.XView; + +/** +* Testing <code>com.sun.star.awt.XView</code> +* interface methods: +* <ul> +* <li><code> setGraphics() </code></li> +* <li><code> getGraphics() </code></li> +* <li><code> getSize() </code></li> +* <li><code> draw() </code></li> +* <li><code> setZoom() </code></li> +* </ul><p> +* This test needs the following object relations : +* <ul> +* <li> <code>'GRAPHICS'</code> (of type <code>XGraphics</code>): +* used as a parameter to setGraphics() </li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XView +*/ +public class _XView extends MultiMethodTest { + public XView oObj = null; + + /** + * After obtaining object relation 'GRAPHICS', test calls the method. <p> + * Has <b> OK </b> status if the method returns true. + */ + public void _setGraphics() { + XGraphics graph = (XGraphics) tEnv.getObjRelation("GRAPHICS"); + boolean isSet = oObj.setGraphics(graph); + if ( !isSet ) { + log.println("setGraphics() returns false"); + } + tRes.tested("setGraphics()", isSet); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGraphics() </code> : sets the output device </li> + * </ul> + */ + public void _getGraphics() { + requiredMethod("setGraphics()"); + XGraphics graph = oObj.getGraphics(); + if (graph == null) { + log.println("getGraphics() returns NULL"); + } + tRes.tested("getGraphics()", graph != null); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method returns structure with fields that + * are not equal to zero. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGraphics() </code> : sets the output device </li> + * </ul> + */ + public void _getSize() { + requiredMethod("setGraphics()"); + Size aSize = oObj.getSize(); + boolean res = (aSize.Height != 0) && (aSize.Width != 0); + if ( !res ) { + log.println("Height: " + aSize.Height); + log.println("Width: " + aSize.Width); + } + tRes.tested("getSize()", res); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGraphics() </code> : sets the output device </li> + * </ul> + */ + public void _draw() { + requiredMethod("setGraphics()"); + oObj.draw(20, 20); + tRes.tested("draw()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setGraphics() </code> : sets the output device </li> + * </ul> + */ + public void _setZoom() { + requiredMethod("setGraphics()"); + oObj.setZoom(2,2); + tRes.tested("setZoom()", true); + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/_XWindow.java b/qadevOOo/tests/java/ifc/awt/_XWindow.java new file mode 100644 index 0000000000..089118ae73 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/_XWindow.java @@ -0,0 +1,581 @@ +/* + * 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.awt; + +import com.sun.star.awt.FocusEvent; +import com.sun.star.awt.KeyEvent; +import com.sun.star.awt.MouseEvent; +import com.sun.star.awt.PaintEvent; +import com.sun.star.awt.Point; +import com.sun.star.awt.PosSize; +import com.sun.star.awt.Rectangle; +import com.sun.star.awt.Size; +import com.sun.star.awt.WindowEvent; +import com.sun.star.awt.XFocusListener; +import com.sun.star.awt.XKeyListener; +import com.sun.star.awt.XMouseListener; +import com.sun.star.awt.XMouseMotionListener; +import com.sun.star.awt.XPaintListener; +import com.sun.star.awt.XWindow; +import com.sun.star.awt.XWindowListener; +import com.sun.star.drawing.XControlShape; +import com.sun.star.lang.EventObject; +import lib.MultiMethodTest; +import util.ValueComparer; + +/** +* Testing <code>com.sun.star.awt.XWindow</code> +* interface methods : +* <ul> +* <li><code> setPosSize()</code></li> +* <li><code> getPosSize()</code></li> +* <li><code> setVisible()</code></li> +* <li><code> setEnable()</code></li> +* <li><code> setFocus()</code></li> +* <li><code> addWindowListener()</code></li> +* <li><code> removeWindowListener()</code></li> +* <li><code> addFocusListener()</code></li> +* <li><code> removeFocusListener()</code></li> +* <li><code> addKeyListener()</code></li> +* <li><code> removeKeyListener()</code></li> +* <li><code> addMouseListener()</code></li> +* <li><code> removeMouseListener()</code></li> +* <li><code> addMouseMotionListener()</code></li> +* <li><code> removeMouseMotionListener()</code></li> +* <li><code> addPaintListener()</code></li> +* <li><code> removePaintListener()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'XWindow.AnotherWindow'</code> (of type <code>XWindow</code>): +* Some another window which can gain focus so the tested one +* must lost it. </li> +* <li> <code>'XWindow.ControlShape'</code> <b>optional</b> +* (of type <code>XControlShape</code>): +* Some shapes can't change their size within fixed ControlShape +* and their size could be changed only if size of container +* ControlShape is changed. For such shapes this relation should +* be passed for proper <code>addWindowListener</code> test. </li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.awt.XWindow +*/ +public class _XWindow extends MultiMethodTest { + public XWindow oObj = null; + private Rectangle posSize = null ; + private XWindow win = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method does not return null. + */ + public void _getPosSize() { + posSize = oObj.getPosSize() ; + tRes.tested("getPosSize()", posSize != null) ; + } + + /** + * After defining Rectangle structure to be set, test calls the method. <p> + * Has <b> OK </b> status if structure obtained using getPosSize() is + * equal to structure previously set using setPosSize(). <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getPosSize() </code> : returns the outer bounds of + * the window </li> + * </ul> + */ + public void _setPosSize() { + Rectangle newRec = new Rectangle(); + + requiredMethod("getPosSize()"); + newRec.X = posSize.X + 1; + newRec.Y = posSize.Y + 1; + newRec.Width = posSize.Width - 3; + newRec.Height = posSize.Height - 3; + oObj.setPosSize(newRec.X, newRec.Y, newRec.Width, newRec.Height, + PosSize.POSSIZE); + Rectangle gPS = oObj.getPosSize(); + log.println("Was : (" + posSize.X + ", " + posSize.Y + ", " + + posSize.Width + ", " + posSize.Height + "), "); + log.println("Set : (" + newRec.X + ", " + newRec.Y + ", " + + newRec.Width + ", " + newRec.Height + "), "); + log.println("Get : (" + gPS.X + ", " + gPS.Y + ", " + + gPS.Width + ", " + gPS.Height + "). "); + tRes.tested("setPosSize()", ValueComparer.equalValue(newRec, gPS) ); + } + + /** + * At first object relation 'XWindow.AnotherWindow' is obtained. + * Then test calls the methods of two 'XWindow' objects several times to be + * sure that the focus has changed. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _setFocus() { + win = (XWindow) tEnv.getObjRelation("XWindow.AnotherWindow"); + oObj.setFocus(); + win.setFocus(); + oObj.setFocus(); + tRes.tested("setFocus()", true); + } + + /** + * Test calls the method twice with two parameters: 'true' and 'false'. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _setVisible() { + oObj.setVisible(false); + oObj.setVisible(true); + tRes.tested("setVisible()", true); + } + + /** + * Test calls the method twice with two parameters: 'true' and 'false'. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _setEnable() { + oObj.setEnable(false); + oObj.setEnable(true); + tRes.tested("setEnable()", true); + } + + + /** + * A class we use to test addWindowListener() and + * removeWindowListener() + */ + public static class TestWindowListener implements XWindowListener { + public boolean resized = false ; + public boolean moved = false ; + public boolean hidden = false ; + public boolean shown = false ; + + public void init() { + resized = false ; + moved = false ; + hidden = false ; + shown = false ; + } + + public void windowResized(WindowEvent e) { + resized = true ; + } + public void windowMoved(WindowEvent e) { + moved = true ; + } + public void windowHidden(EventObject e) { + hidden = true ; + } + public void windowShown(EventObject e) { + shown = true ; + } + public void disposing(EventObject e) {} + + } + + private final TestWindowListener wListener = new TestWindowListener() ; + + + /** + * Test calls the method. Then we check if listener's methods were called + * when we move, resize, hide and show the window. The resizing is + * performed depending on 'XWindow.ControlShape' existence. If this + * relation exists then the size and position of container control + * shape is changed, else the position and size of window itself is + * changed<p> + * + * Has <b> OK </b> status if methods of wListener were called when + * corresponding events occurred. <p> + * + * The following method tests are to be executed before : + * <ul> + * <li> <code> setPosSize() </code>: sets the outer bounds of the + * window</li> + * <li> <code> setVisible() </code>: shows or hides the window + * depending on the parameter</li> + * </ul> + */ + public void _addWindowListener() { + executeMethod("setPosSize()"); + executeMethod("setVisible()"); + boolean result = true ; + + oObj.addWindowListener(wListener); + + // testing wListener.windowMoved() + XControlShape ctrlShape = (XControlShape) + tEnv.getObjRelation("XWindow.ControlShape"); + log.println("change object position and size..."); + + if (ctrlShape != null) { + try { + Size sz = ctrlShape.getSize(); + sz.Height += 100; + ctrlShape.setSize(sz); + Point pos = ctrlShape.getPosition(); + pos.X += 100 ; + ctrlShape.setPosition(pos); + } catch (com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't change size or position: "); + e.printStackTrace(log); + } + } else { + oObj.setPosSize(posSize.X + 2, 0, 0, 0, PosSize.X); + oObj.setPosSize(0, 0, 100, 100, PosSize.WIDTH); + } + + waitForEventIdle(); + boolean res = wListener.resized && wListener.moved && + !wListener.hidden && !wListener.shown; + result &= res; + if (!res) { + log.println("\twindowHidden() wasn't called: " + !wListener.hidden); + log.println("\twindowShown() wasn't called: " + !wListener.shown); + log.println("\twindowResized() was called: " + wListener.resized); + log.println("\twindowMoved() was called: " + wListener.moved); + } else { + log.println("windowMoved() and windowResized() was called"); + } + + // testing wListener.windowHidden() + wListener.init(); + waitForEventIdle(); + log.println("set object invisible..."); + oObj.setVisible(false); + waitForEventIdle(); + res = wListener.hidden && !wListener.resized + && !wListener.moved && !wListener.shown; + result &= res; + if (!res) { + log.println("\twindowHidden() was called: " + wListener.hidden); + log.println("\twindowShown() wasn't called: " + !wListener.shown); + log.println("\twindowResized() wasn't called: " + !wListener.resized); + log.println("\twindowMoved() wasn't called: " + !wListener.moved); + } else { + log.println("windowHidden() was called"); + } + + // testing wListener.windowShown() + wListener.init() ; + waitForEventIdle(); + log.println("set object visible..."); + oObj.setVisible(true) ; + waitForEventIdle(); + res = wListener.shown && !wListener.resized && + !wListener.hidden && !wListener.moved; + result &= res; + if (!res) { + log.println("\twindowHidden() wasn't called: " + !wListener.hidden); + log.println("\twindowShown() was called: " + wListener.shown); + log.println("\twindowResized() wasn't called: " + !wListener.resized); + log.println("\twindowMoved() wasn't called: " + !wListener.moved); + } else { + log.println("windowShown() was called"); + } + + tRes.tested("addWindowListener()", result) ; + } + + + /** + * Test calls the method. Then we change window and check that listener's + * methods were not called. <p> + * Has <b> OK </b> status if listener does not react on window events.<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addWindowListener() </code>: adds window listener to the + * object </li> + * </ul> + */ + public void _removeWindowListener() { + requiredMethod("addWindowListener()"); + oObj.removeWindowListener(wListener); + wListener.init(); + oObj.setPosSize(posSize.X, posSize.Y, + posSize.Width , posSize.Height, PosSize.POSSIZE); + oObj.setVisible(false); + oObj.setVisible(true); + boolean res = !(wListener.resized || wListener.moved + || wListener.hidden || wListener.shown); + + tRes.tested("removeWindowListener()", res); + } + + /** + * A class we use to test addFocusListener() and + * removeFocusListener() + */ + public static class TestFocusListener implements XFocusListener { + public boolean gained = false ; + public boolean lost = false ; + + public void focusGained(FocusEvent e) { + gained = true ; + } + public void focusLost(FocusEvent e) { + lost = true ; + } + public void init() { + gained = false; + lost = false; + } + public void disposing(EventObject e) {} + + } + + private final TestFocusListener fListener = new TestFocusListener(); + + /** + * Test calls the method. Then we change focus and check that listener's + * methods were called. <p> + * Has <b> OK </b> status if methods of fListener were called when + * corresponding events occurred. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setFocus() </code>: sets the focus to the window </li> + * </ul> + */ + public void _addFocusListener() { + boolean result = true ; + + requiredMethod("setFocus()"); + oObj.addFocusListener(fListener) ; + + // testing fListener.lost() + oObj.setFocus(); + waitForEventIdle(); + win.setFocus(); + waitForEventIdle(); + result &= fListener.lost; + if (!fListener.lost) { + log.println("Lost focus was not notified about") ; + } + + // testing fListener.gained() + oObj.setFocus() ; + waitForEventIdle(); + result &= fListener.gained; + if (!fListener.gained) { + log.println("Gained focus was not notified about") ; + } + + tRes.tested("addFocusListener()", result) ; + } + + /** + * Test calls the method. Then we change focus and check that listener's + * methods were not called. <p> + * Has <b> OK </b> status if listener does not react on focus changing. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addFocusListener() </code> : adds focus listener to + * the object </li> + * </ul> + */ + public void _removeFocusListener() { + requiredMethod("addFocusListener()"); + oObj.removeFocusListener(fListener); + fListener.init(); + oObj.setFocus(); + win.setFocus(); + oObj.setFocus(); + boolean res = !(fListener.gained || fListener.lost); + tRes.tested("removeFocusListener()", res); + } + + /** + * A class we use to test addKeyListener() and + * removeKeyListener() + */ + public static class TestKeyListener implements XKeyListener { + public void keyPressed(KeyEvent e) {} + public void keyReleased(KeyEvent e) {} + public void disposing(EventObject e) {} + public void init() {} + } + + private final TestKeyListener kListener = new TestKeyListener(); + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _addKeyListener() { + oObj.addKeyListener(kListener); + tRes.tested("addKeyListener()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addKeyListener() </code> : adds key listener to + * the object </li> + * </ul> + */ + public void _removeKeyListener() { + requiredMethod("addKeyListener()"); + oObj.removeKeyListener(kListener); + tRes.tested("removeKeyListener()", true); + } + + /** + * A class we use to test addMouseListener() and + * removeMouseListener() + */ + public static class TestMouseListener implements XMouseListener { + + public void mousePressed(MouseEvent e) { + } + + public void mouseReleased(MouseEvent e) { + } + + public void mouseEntered(MouseEvent e) { + } + + public void mouseExited(MouseEvent e) { + } + + public void disposing(EventObject e) {} + + public void init() { + } + + } + + private final TestMouseListener mListener = new TestMouseListener(); + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _addMouseListener() { + oObj.addMouseListener(mListener); + tRes.tested("addMouseListener()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addMouseListener() </code> : adds mouse listener to + * the object</li> + * </ul> + */ + public void _removeMouseListener() { + requiredMethod("addMouseListener()"); + oObj.removeMouseListener(mListener); + tRes.tested("removeMouseListener()", true); + } + + /** + * A class we use to test addMouseMotionListener() and + * removeMouseMotionListener() + */ + public static class TestMouseMotionListener implements XMouseMotionListener { + + public void mouseDragged(MouseEvent e) { + } + + public void mouseMoved(MouseEvent e) { + } + + public void disposing(EventObject e) { + } + + public void init() { + } + + } + + private final TestMouseMotionListener mmListener = new TestMouseMotionListener(); + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _addMouseMotionListener() { + oObj.addMouseMotionListener(mmListener); + tRes.tested("addMouseMotionListener()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addMouseMotionListener() </code> : adds mouse motion + * listener to the object</li> + * </ul> + */ + public void _removeMouseMotionListener() { + requiredMethod("addMouseMotionListener()"); + oObj.removeMouseMotionListener(mmListener); + tRes.tested("removeMouseMotionListener()", true); + } + + /** + * A class we use to test addPaintListener() and + * removePaintListener() + */ + public static class TestPaintListener implements XPaintListener { + + public void windowPaint(PaintEvent e) { + } + + public void disposing(EventObject e) {} + + public void init() { + } + + } + + private final TestPaintListener pListener = new TestPaintListener(); + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public void _addPaintListener() { + oObj.addPaintListener(pListener); + tRes.tested("addPaintListener()", true); + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> addPaintListener() </code> : adds paint listener to + * the object </li> + * </ul> + */ + public void _removePaintListener() { + requiredMethod("addPaintListener()"); + oObj.removePaintListener(pListener); + tRes.tested("removePaintListener()", true); + } + +} + diff --git a/qadevOOo/tests/java/ifc/awt/tree/_TreeControlModel.java b/qadevOOo/tests/java/ifc/awt/tree/_TreeControlModel.java new file mode 100644 index 0000000000..2cf028c079 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_TreeControlModel.java @@ -0,0 +1,28 @@ +/* + * 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.awt.tree; + +import lib.MultiPropertyTest; + +/* +* Testing <code>com.sun.star.awt.tree.TreeControlModel</code> +* service properties </br> +* @see com.sun.star.awt.tree.TreeControlModel +*/ +public class _TreeControlModel extends MultiPropertyTest { } diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeDataModel.java b/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeDataModel.java new file mode 100644 index 0000000000..5b5976055a --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeDataModel.java @@ -0,0 +1,90 @@ +/* + * 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.awt.tree; + +import com.sun.star.awt.tree.XMutableTreeDataModel; +import com.sun.star.awt.tree.XMutableTreeNode; +import lib.MultiMethodTest; + +/** +* Testing <code>com.sun.star.awt.tree.XMutableTreeDataModel</code> +* interface methods : +* <ul> +* <li><code> createNode()</code></li> +* <li><code> setRoot()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> + +* @see com.sun.star.awt.tree.XMutableTreeDataModel +*/ +public class _XMutableTreeDataModel extends MultiMethodTest { + + public XMutableTreeDataModel oObj = null; + + private XMutableTreeNode mNewNode = null; + + /** + * Sets the title to some string. <p> + * Has <b>OK</b> status if no runtime exceptions occurs. + */ + public void _createNode() { + + mNewNode = oObj.createNode("Hallo Welt", true); + + tRes.tested("createNode()", true) ; + } + + /** + * Gets the title and compares it to the value set in + * <code>setTitle</code> method test. <p> + * Has <b>OK</b> status is set/get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTitle </code> </li> + * </ul> + */ + public void _setRoot() { + requiredMethod("createNode()") ; + + boolean bOK = true; + try { + + oObj.setRoot(mNewNode); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: while trying to set a new root an IllegalArgumentException was thrown:\n" + ex.toString()); + } + + try { + + oObj.setRoot(null); + bOK = false; + log.println("ERROR: while trying to set a null object as root expected IllegalArgumentException was not thrown."); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("expected IllegalArgumentException was thrown => ok"); + + } + + tRes.tested("setRoot()", bOK); + + } + +} + + diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeNode.java b/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeNode.java new file mode 100644 index 0000000000..76c7e6cac8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_XMutableTreeNode.java @@ -0,0 +1,285 @@ +/* + * 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.awt.tree; + +import com.sun.star.awt.tree.XMutableTreeNode; +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +/** + * Testing <code>com.sun.star.awt.tree.XTreeDataModel</code> + * interface methods : + * <ul> + * <li><code> appendChild()</code></li> + * <li><code> insertChildByIndex()</code></li> + * <li><code> removeChildByIndex()</code></li> + * <li><code> setHasChildrenOnDemand()</code></li> + * <li><code> setDisplayValue()</code></li> + * <li><code> setNodeGraphicURL()</code></li> + * <li><code> setExpandedGraphicURL()</code></li> + * <li><code> setCollapsedGraphicURL()</code></li> + * <li><code> DataValue()</code></li> + * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * + * @see com.sun.star.awt.tree.XTreeDataModel + */ +public class _XMutableTreeNode extends MultiMethodTest { + + public XMutableTreeNode oObj = null; + + private XMutableTreeNodeCreator nodeCreator = null; + + public interface XMutableTreeNodeCreator{ + XMutableTreeNode createNode(String name); + } + + @Override + public void before(){ + nodeCreator = (XMutableTreeNodeCreator) tEnv.getObjRelation("XMutableTreeNodeCreator"); + if (nodeCreator == null){ + throw new StatusException(Status.failed( + "Couldn't get relation 'XMutableTreeNodeCreator'")); + } + + } + + public void _appendChild(){ + boolean bOK = true; + + log.println("try to append a valid node..."); + + XMutableTreeNode myNode = nodeCreator.createNode("myNodeToAppend"); + + try { + oObj.appendChild(myNode); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: could not append a valid node: " + ex.toString()); + bOK = false; + } + + log.println("try to append the node a second time..."); + try { + + oObj.appendChild(myNode); + log.println("ERROR: expected IllegalArgumentException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("expected IllegalArgumentException was thrown => OK"); + } + + log.println("try to append the object itself..."); + try { + + oObj.appendChild(oObj); + log.println("ERROR: expected IllegalArgumentException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("expected IllegalArgumentException was thrown => OK"); + } + + tRes.tested("appendChild()", bOK); + } + + public void _insertChildByIndex(){ + boolean bOK = true; + + XMutableTreeNode myNode = nodeCreator.createNode("myNodeToInsert"); + + try { + log.println("try to insert a valid node..."); + oObj.insertChildByIndex(0, myNode); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: could not insert a valid node: " + ex.toString()); + bOK = false; + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: could not insert a valid node on index '0': " + ex.toString()); + bOK = false; + } + + try { + log.println("try to insert a valid node a second time..."); + oObj.insertChildByIndex(0, myNode); + log.println("ERROR: expected IllegalArgumentException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("expected IllegalArgumentException wa thrown => OK"); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: wrong IndexOutOfBoundsException was thrown. Expected is IllegalArgumentException => FAILED"); + bOK = false; + } + + XMutableTreeNode myNode2 = nodeCreator.createNode("myNodeToInsert2"); + + try { + log.println("try to insert a valid node on invalid index '-3'..."); + oObj.insertChildByIndex(-3, myNode2); + log.println("ERROR: expected IndexOutOfBoundsException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: wrong IllegalArgumentException was thrown. Expected is IndexOutOfBoundsException => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("Expected IndexOutOfBoundsException was thrown => OK"); + } + + try { + log.println("try to insert the object itself..."); + oObj.insertChildByIndex(0, oObj); + log.println("ERROR: expected IllegalArgumentException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("expected IllegalArgumentException was thrown => OK"); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("unexpected IndexOutOfBoundsException was thrown, expected was IllegalArgumentException => FAILED"); + bOK = false; + } + + tRes.tested("insertChildByIndex()", bOK); + } + + public void _removeChildByIndex(){ + + requiredMethod("insertChildByIndex()"); + boolean bOK = true; + + try { + log.println("try to remove node at index '0'..."); + oObj.removeChildByIndex(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: IndexOutOfBoundsException was thrown => FAILED"); + bOK = false; + } + + try { + log.println("try to remove node at invalid index '-3'"); + oObj.removeChildByIndex(-3); + log.println("ERROR: expected IndexOutOfBoundsException was not thrown => FAILED"); + bOK = false; + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("expected IndexOutOfBoundsException was thrown => OK"); + } + tRes.tested("removeChildByIndex()", bOK); + } + + public void _setHasChildrenOnDemand(){ + boolean bOK = true; + + log.println("setHasChildrenOnDemand(true)"); + oObj.setHasChildrenOnDemand(true); + + log.println("setHasChildrenOnDemand(false)"); + oObj.setHasChildrenOnDemand(false); + + tRes.tested("setHasChildrenOnDemand()", bOK); + } + + public void _setDisplayValue(){ + boolean bOK = true; + + log.println("setDisplayValue(\"MyTestValue\")"); + oObj.setDisplayValue("MyTestValue"); + + log.println("setDisplayValue(null)"); + oObj.setDisplayValue(null); + + log.println("oObj.setDisplayValue(oObj)"); + oObj.setDisplayValue(oObj); + + tRes.tested("setDisplayValue()", bOK); + } + + public void _setNodeGraphicURL(){ + boolean bOK = true; + + log.println("setNodeGraphicURL(\"MyTestURL\")"); + oObj.setNodeGraphicURL("MyTestURL"); + + log.println("setNodeGraphicURL(null)"); + oObj.setNodeGraphicURL(null); + + tRes.tested("setNodeGraphicURL()", bOK); + } + + public void _setExpandedGraphicURL(){ + boolean bOK = true; + + log.println("setExpandedGraphicURL(\"myExpandedURL\")"); + oObj.setExpandedGraphicURL("myExpandedURL"); + + log.println("setExpandedGraphicURL(null)"); + oObj.setExpandedGraphicURL(null); + + tRes.tested("setExpandedGraphicURL()", bOK); + } + + public void _setCollapsedGraphicURL(){ + boolean bOK = true; + + log.println("setCollapsedGraphicURL(\"myCollapsedURL\")"); + oObj.setCollapsedGraphicURL("myCollapsedURL"); + + log.println("setCollapsedGraphicURL(null)"); + oObj.setCollapsedGraphicURL(null); + + tRes.tested("setCollapsedGraphicURL()", bOK); + } + + public void _DataValue(){ + boolean bOK = true; + + log.println("setDataValue(\"myDataValue\")"); + oObj.setDataValue("myDataValue"); + + String sDataValue = (String) oObj.getDataValue(); + + if ( ! sDataValue.equals("myDataValue")) { + log.println("ERROR: getDataValue does not return the value which is inserted before:\n" + + "\texpected: myDataValue\n" + + "\tgot: " + sDataValue); + bOK = false; + } + + log.println("setDataValue(null)"); + oObj.setDataValue(null); + + Object oDataValue = oObj.getDataValue(); + if ( oDataValue != null) { + log.println("ERROR: getDataValue does not return the value which is inserted before:\n" + + "\texpected: null\n" + + "\tgot: " + oDataValue.toString()); + bOK = false; + } + + log.println("oObj.setDisplayValue(oObj)"); + oObj.setDisplayValue(oObj); + + oDataValue = oObj.getDataValue(); + if ( oDataValue != null) { + log.println("ERROR: getDataValue does not return the value which is inserted before:\n" + + "\texpected: " + oObj.toString() +"\n" + + "\tgot: " + oDataValue.toString()); + bOK = false; + } + + tRes.tested("DataValue()", bOK); + } + +} diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XTreeControl.java b/qadevOOo/tests/java/ifc/awt/tree/_XTreeControl.java new file mode 100644 index 0000000000..e3c124d0a6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_XTreeControl.java @@ -0,0 +1,640 @@ +/* + * 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.awt.tree; + +import com.sun.star.awt.tree.ExpandVetoException; +import com.sun.star.awt.tree.TreeExpansionEvent; +import com.sun.star.awt.tree.XMutableTreeNode; +import com.sun.star.awt.tree.XTreeControl; +import com.sun.star.awt.tree.XTreeEditListener; +import com.sun.star.awt.tree.XTreeExpansionListener; +import com.sun.star.awt.tree.XTreeNode; +import com.sun.star.lang.EventObject; +import com.sun.star.util.VetoException; +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +/** + * Testing <code>com.sun.star.awt.tree.XTreeControl</code> + * interface methods : + * <ul> + * <li><code> isNodeExpanded()</code></li> + * <li><code> isNodeCollapsed()</code></li> + * <li><code> makeNodeVisible()</code></li> + * <li><code> isNodeVisible()</code></li> + * <li><code> expandNode()</code></li> + * <li><code> collapseNode()</code></li> + * <li><code> addTreeExpansionListener()</code></li> + * <li><code> removeTreeExpansionListener()</code></li> + * <li><code> getNodeForLocation()</code></li> + * <li><code> getClosestNodeForLocation()</code></li> + * <li><code> isEditing()</code></li> + * <li><code> stopEditing()</code></li> + * <li><code> cancelEditing()</code></li> + * <li><code> startEditingAtNode()</code></li> + * <li><code> addTreeEditListener()</code></li> + * <li><code> removeTreeEditListener()</code></li> + * <li><code> DefaultExpandedGraphicURL()</code></li> + * <li><code> DefaultCollapsedGraphicURL()</code></li>* </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * + * @see com.sun.star.awt.tree.XTreeControl + */ +public class _XTreeControl extends MultiMethodTest { + + public XTreeControl oObj = null; + + private XMutableTreeNode mXNode = null; + + XTreeExpansionListener mTreeExpansionListener1 = new TreeExpansionListenerImpl1(); + + XTreeExpansionListener mTreeExpansionListener2 = new TreeExpansionListenerImpl2(); + + XTreeEditListener mTreeEditListener1 = new TreeEditListenerImpl1(); + + XTreeEditListener mTreeEditListener2 = new TreeEditListenerImpl2(); + + boolean mTreeExpanded1 = false; + boolean mTreeExpanding1 = false; + boolean mTreeCollapsed1 = false; + boolean mTreeCollapsing1 = false; + + boolean mTreeExpanded2 = false; + boolean mTreeExpanding2 = false; + boolean mTreeCollapsed2 = false; + boolean mTreeCollapsing2 = false; + + public interface XTreeDataModelListenerEvent{ + void fireEvent(); + } + + public class TreeExpansionListenerImpl1 implements XTreeExpansionListener{ + public void requestChildNodes(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 1: requestChildNodes"); + } + + public void treeExpanding(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException { + log.println("event at ExpansionListener 1: treeExpanding"); + mTreeExpanding1 = true; + } + + public void treeCollapsing(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException { + log.println("event at ExpansionListener 1: treeCollapsing"); + mTreeCollapsing1 = true; + } + + public void treeExpanded(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 1: treeExpanded"); + mTreeExpanded1 = true; + } + + public void treeCollapsed(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 1: treeCollapsed"); + mTreeCollapsed1 = true; + } + + public void disposing(EventObject eventObject) { + log.println("event at ExpansionListener 1: disposing"); + } + } + + public class TreeExpansionListenerImpl2 implements XTreeExpansionListener{ + public void requestChildNodes(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 2: requestChildNodes"); + } + + public void treeExpanding(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException { + log.println("event at ExpansionListener 2: treeExpanding"); + mTreeExpanding2 = true; + } + + public void treeCollapsing(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException { + log.println("event at ExpansionListener 2: treeCollapsing"); + mTreeCollapsing2 = true; + } + + public void treeExpanded(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 2: treeExpanded"); + mTreeExpanded2 = true; + } + + public void treeCollapsed(TreeExpansionEvent treeExpansionEvent) { + log.println("event at ExpansionListener 2: treeCollapsed"); + mTreeCollapsed2 = true; + } + + public void disposing(EventObject eventObject) { + log.println("event at ExpansionListener 2: disposing"); + } + + } + + public class TreeEditListenerImpl1 implements XTreeEditListener{ + public void nodeEditing(XTreeNode xTreeNode) throws VetoException { + log.println("event at EditListener 1: nodeEditing"); + } + + public void nodeEdited(XTreeNode xTreeNode, String string) { + log.println("event at EditListener 1: nodeEdited"); + } + + public void disposing(EventObject eventObject) { + log.println("event at EditListener 1: disposing"); + } + } + + public class TreeEditListenerImpl2 implements XTreeEditListener{ + public void nodeEditing(XTreeNode xTreeNode) throws VetoException { + log.println("event at EditListener 2: nodeEditing"); + } + + public void nodeEdited(XTreeNode xTreeNode, String string) { + log.println("event at EditListener 2: nodeEdited"); + } + + public void disposing(EventObject eventObject) { + log.println("event at EditListener 2: disposing"); + } + } + + private void resetTreeExpandingListener(){ + mTreeExpanded1 = false; + mTreeExpanded2 = false; + mTreeCollapsed1 = false; + mTreeCollapsed2 = false; + mTreeExpanding1 = false; + mTreeExpanding2 = false; + mTreeCollapsing1 = false; + mTreeCollapsing2 = false; + } + + @Override + public void before(){ + mXNode = (XMutableTreeNode) tEnv.getObjRelation("XTreeControl_Node"); + if (mXNode == null) { + throw new StatusException(Status.failed("ERROR: could not get object relation 'XTreeControl_Node'")); + } + } + + public void _isNodeExpanded() { + + boolean bOK = true; + + boolean isExpanded = false; + + try { + isExpanded = oObj.isNodeExpanded(mXNode); + log.println("node is expanded: " + isExpanded); + + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not query for 'isNodeExpanded()': " + ex.toString()); + } + + if (isExpanded) + try { + + log.println("try to collapse node..."); + oObj.collapseNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + else + try { + + log.println("try to expand node..."); + oObj.expandNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } + + try { + + boolean isAlsoExpanded = oObj.isNodeExpanded(mXNode); + + bOK &= (isExpanded != isAlsoExpanded); + + log.println("node is expanded: " + isAlsoExpanded + " => " + bOK); + + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not query for 'isNodeExpanded()': " + ex.toString()); + } + + tRes.tested("isNodeExpanded()", bOK); + + } + public void _isNodeCollapsed(){ + + boolean bOK = true; + + boolean isCollapsed = false; + + try { + isCollapsed = oObj.isNodeCollapsed(mXNode); + log.println("node is Collapsed: " + isCollapsed); + + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not query for 'isNodeCollapsed()': " + ex.toString()); + } + + if ( ! isCollapsed) + try { + + log.println("try to collapse node..."); + oObj.collapseNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + else + try { + + log.println("try to expand node..."); + oObj.expandNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } + + try { + + boolean isAlsoCollapsed = oObj.isNodeCollapsed(mXNode); + + bOK &= (isCollapsed != isAlsoCollapsed); + + log.println("node is Collapsed: " + isAlsoCollapsed + " => " + bOK); + + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not query for 'isNodeCollapsed()': " + ex.toString()); + } + + tRes.tested("isNodeCollapsed()", bOK); + + } + public void _makeNodeVisible(){ + + boolean bOK = true; + try { + + oObj.makeNodeVisible(mXNode); + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not call method 'makeNodeVisible()' successfully: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not call method 'makeNodeVisible()' successfully: " + ex.toString()); + } + try { + + bOK &= oObj.isNodeVisible(mXNode); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not call method 'isNodeVisible()' successfully: " + ex.toString()); + } + + tRes.tested("makeNodeVisible()", bOK); + + } + public void _isNodeVisible(){ + + this.requiredMethod("makeNodeVisible()"); + + boolean bOK = true; + log.println("since required method 'makeNodeVisible()' uses method 'isNodeVisible()' this test is ok."); + tRes.tested("isNodeVisible()", bOK); + + } + + public void _expandNode(){ + + this.requiredMethod("isNodeExpanded()"); + + boolean bOK = true; + log.println("since required method 'isnodeExpanded()' uses method 'expandNode()' this test is ok."); + tRes.tested("expandNode()", bOK); + + } + + public void _collapseNode(){ + + this.requiredMethod("isNodeCollapsed()"); + + boolean bOK = true; + log.println("since required method 'isnodeCollapsed()' uses method 'expandNode()' this test is ok."); + tRes.tested("collapseNode()", bOK); + + } + + public void _addTreeExpansionListener(){ + + boolean bOK = true; + + log.println("collapse Node to get an initial status..."); + try { + + oObj.collapseNode(mXNode); + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + + log.println("add mTreeExpansionListener1..."); + oObj.addTreeExpansionListener(mTreeExpansionListener1); + + log.println("add mTreeExpansionListener2"); + oObj.addTreeExpansionListener(mTreeExpansionListener2); + + resetTreeExpandingListener(); + + log.println("expand Node..."); + try { + + oObj.expandNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } + + bOK &= mTreeExpanded1 & mTreeExpanded2 & ! mTreeCollapsed1 & ! mTreeCollapsed2 + & mTreeExpanding1 & mTreeExpanding2 & ! mTreeCollapsing1 & ! mTreeCollapsing2; + + resetTreeExpandingListener(); + + log.println("collapse Node..."); + try { + + oObj.collapseNode(mXNode); + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + + bOK &= ! mTreeExpanded1 & ! mTreeExpanded2 & mTreeCollapsed1 & mTreeCollapsed2 + & ! mTreeExpanding1 & ! mTreeExpanding2 & mTreeCollapsing1 & mTreeCollapsing2; + + tRes.tested("addTreeExpansionListener()", bOK); + + } + + public void _removeTreeExpansionListener(){ + + this.requiredMethod("addTreeExpansionListener()"); + + boolean bOK = true; + + log.println("collapse Node to get an initial status..."); + try { + + oObj.collapseNode(mXNode); + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + + resetTreeExpandingListener(); + + log.println("remove mTreeExpansionListener2 ..."); + oObj.removeTreeExpansionListener(mTreeExpansionListener2); + + log.println("expand Node..."); + try { + + oObj.expandNode(mXNode); + + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not expand node: " + ex.toString()); + } + + bOK &= mTreeExpanded1 & ! mTreeExpanded2 & ! mTreeCollapsed1 & ! mTreeCollapsed2 + & mTreeExpanding1 & ! mTreeExpanding2 & ! mTreeCollapsing1 & ! mTreeCollapsing2; + + resetTreeExpandingListener(); + + log.println("collapse Node..."); + try { + + oObj.collapseNode(mXNode); + } catch (ExpandVetoException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + bOK = false; + log.println("ERROR: could not collapse node: " + ex.toString()); + } + + bOK &= ! mTreeExpanded1 & ! mTreeExpanded2 & mTreeCollapsed1 & ! mTreeCollapsed2 + & ! mTreeExpanding1 & ! mTreeExpanding2 & mTreeCollapsing1 & ! mTreeCollapsing2; + + log.println("remove mTreeExpansionListener2 ..."); + oObj.removeTreeExpansionListener(mTreeExpansionListener2); + + tRes.tested("removeTreeExpansionListener()", bOK); + + } + + public void _getNodeForLocation(){ + + boolean bOK = false; + + + tRes.tested("getNodeForLocation()", bOK); + + } + + public void _getClosestNodeForLocation(){ + + boolean bOK = false; + + log.println("try to get Node for location 100,100"); + XTreeNode myNode = oObj.getClosestNodeForLocation(100,100); + + bOK &= (myNode != null); + + tRes.tested("getClosestNodeForLocation()", bOK); + + } + + public void _isEditing(){ + + boolean bOK = false; + + log.println("not ready because of i78701"); + + tRes.tested("isEditing()", bOK); + + } + + public void _stopEditing(){ + + boolean bOK = false; + log.println("not ready because of i78701"); + + + tRes.tested("stopEditing()", bOK); + + } + + public void _cancelEditing(){ + + boolean bOK = false; + + log.println("not ready because of i78701"); + + tRes.tested("cancelEditing()", bOK); + + } + + public void _startEditingAtNode(){ + + boolean bOK = false; + + log.println("not ready because of i78701"); + + tRes.tested("startEditingAtNode()", bOK); + + } + + public void _addTreeEditListener(){ + + boolean bOK = true; + + log.println("add EditListener 1..."); + oObj.addTreeEditListener(mTreeEditListener1); + + log.println("add EditListener 2..."); + oObj.addTreeEditListener(mTreeEditListener2); + + try { + oObj.startEditingAtNode(mXNode); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: could not start editing at node: " + ex.toString()); + bOK = false; + } + + log.println("not ready because of i78701"); + bOK = false; + + + tRes.tested("addTreeEditListener()", bOK); + + } + + public void _removeTreeEditListener(){ + + boolean bOK = false; + + log.println("not ready because of i78701"); + + tRes.tested("removeTreeEditListener()", bOK); + + } + + public void _DefaultExpandedGraphicURL(){ + + boolean bOK = true; + + String current = oObj.getDefaultExpandedGraphicURL(); + log.println("current DefaultExpandedGraphicURL: " + current); + + String changeUrl = null; + + if (current.equals("private:graphicrepository/sd/res/triangle_right.png")) + changeUrl = "private:graphicrepository/sd/res/triangle_down.png"; + else changeUrl = "private:graphicrepository/sd/res/triangle_right.png"; + + log.println("try to set '" + changeUrl + "' as new DefaultExpandedGraphicURL"); + + oObj.setDefaultExpandedGraphicURL(changeUrl); + + String newUrl = oObj.getDefaultExpandedGraphicURL(); + + log.println("new DefaultExpandedGraphicURL: " + newUrl); + + bOK &= ! newUrl.equals(current); + + tRes.tested("DefaultExpandedGraphicURL()", bOK); + + } + + public void _DefaultCollapsedGraphicURL(){ + + boolean bOK = true; + + String current = oObj.getDefaultCollapsedGraphicURL(); + log.println("current DefaultCollapsedGraphicURL: " + current); + + String changeUrl = null; + + if (current.equals("private:graphicrepository/sd/res/triangle_right.png")) + changeUrl = "private:graphicrepository/sd/res/triangle_down.png"; + else changeUrl = "private:graphicrepository/sd/res/triangle_right.png"; + + log.println("try to set '" + changeUrl + "' as new DefaultCollapsedGraphicURL"); + oObj.setDefaultCollapsedGraphicURL(changeUrl); + + String newUrl = oObj.getDefaultCollapsedGraphicURL(); + + log.println("new DefaultCollapsedGraphicURL: " + newUrl); + + bOK &= ! newUrl.equals(current); + + tRes.tested("DefaultCollapsedGraphicURL()", bOK); + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XTreeDataModel.java b/qadevOOo/tests/java/ifc/awt/tree/_XTreeDataModel.java new file mode 100644 index 0000000000..3c544efd54 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_XTreeDataModel.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.awt.tree; + +import com.sun.star.awt.tree.TreeDataModelEvent; +import com.sun.star.awt.tree.XTreeDataModel; +import com.sun.star.awt.tree.XTreeDataModelListener; +import com.sun.star.lang.EventObject; +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +/** + * Testing <code>com.sun.star.awt.tree.XTreeDataModel</code> + * interface methods : + * <ul> + * <li><code> createNode()</code></li> + * <li><code> setRoot()</code></li> + * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * + * @see com.sun.star.awt.tree.XTreeDataModel + */ +public class _XTreeDataModel extends MultiMethodTest { + + public XTreeDataModel oObj = null; + + XTreeDataModelListener mListener1 = new myEventListener1(); + + XTreeDataModelListener mListener2 = new myEventListener2(); + + XTreeDataModelListenerEvent mListenerEvent = null; + + boolean mTreeStructureChanged1 = false; + + boolean mTreeStructureChanged2 = false; + + public interface XTreeDataModelListenerEvent{ + void fireEvent(); + } + + public class myEventListener1 implements XTreeDataModelListener{ + public void treeNodesChanged(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 1: treeNodesChanged"); + } + + public void treeNodesInserted(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 1: treeNodesInserted"); + } + + public void treeNodesRemoved(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 1: treeNodesRemoved"); + } + + public void treeStructureChanged(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 1: treeStructureChanged"); + mTreeStructureChanged1 = true; + } + + public void disposing(EventObject eventObject) { + log.println("Listener 1: disposing"); + } + } + + public class myEventListener2 implements XTreeDataModelListener{ + public void treeNodesChanged(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 2: treeNodesChanged"); + } + + public void treeNodesInserted(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 2: treeNodesInserted"); + } + + public void treeNodesRemoved(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 2: treeNodesRemoved"); + } + + public void treeStructureChanged(TreeDataModelEvent treeDataModelEvent) { + log.println("Listener 2: treeStructureChanged"); + mTreeStructureChanged2 = true; + } + + public void disposing(EventObject eventObject) { + log.println("Listener 2: disposing"); + } + + } + + @Override + public void before(){ + mListenerEvent = (XTreeDataModelListenerEvent) tEnv.getObjRelation("XTreeDataModelListenerEvent"); + if (mListenerEvent == null) { + throw new StatusException(Status.failed("ERROR: could not get object relation 'XTreeDataModelListenerEvent'\n" + + "This object relation must be kind of 'ifc.awt.tree._XTreeDataModel.XTreeDataModelListenerEvent'")); + } + } + + /** + * Gets the title and compares it to the value set in + * <code>setTitle</code> method test. <p> + * Has <b>OK</b> status is set/get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTitle </code> </li> + * </ul> + */ + public void _getRoot() { + + boolean bOK = true; + oObj.getRoot(); + + tRes.tested("getRoot()", bOK); + + } + + public void _addTreeDataModelListener(){ + + boolean bOK = true; + + log.println("add listener 1 to object..."); + oObj.addTreeDataModelListener(mListener1); + + log.println("add listener 2 to object..."); + oObj.addTreeDataModelListener(mListener2); + + mTreeStructureChanged1 = false; + mTreeStructureChanged2 = false; + + mListenerEvent.fireEvent(); + + bOK = mTreeStructureChanged1 & mTreeStructureChanged2; + + tRes.tested("addTreeDataModelListener()", bOK); + } + + public void _removeTreeDataModelListener(){ + + boolean bOK = true; + + log.println("remove listener 2 from object..."); + oObj.removeTreeDataModelListener(mListener2); + + mTreeStructureChanged1 = false; + mTreeStructureChanged2 = false; + + mListenerEvent.fireEvent(); + + bOK = mTreeStructureChanged1 & ! mTreeStructureChanged2; + + tRes.tested("removeTreeDataModelListener()", bOK); + + } +} + + diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java b/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java new file mode 100644 index 0000000000..f0ca8ae9f6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java @@ -0,0 +1,259 @@ +/* + * 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.awt.tree; + +import com.sun.star.awt.tree.XTreeNode; +import com.sun.star.uno.AnyConverter; +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +/** + * Testing <code>com.sun.star.awt.tree.XTreeDataModel</code> + * interface methods : + * <ul> + * <li><code> getChildAt()</code></li> + * <li><code> getChildCount()</code></li> + * <li><code> getParent()</code></li> + * <li><code> getIndex()</code></li> + * <li><code> hasChildrenOnDemand()</code></li> + * <li><code> getDisplayValue()</code></li> + * <li><code> getNodeGraphicURL()</code></li> + * <li><code> getExpandedGraphicURL()</code></li> + * <li><code> getCollapsedGraphicURL()</code></li> * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * + * @see com.sun.star.awt.tree.XTreeDataModel + */ +public class _XTreeNode extends MultiMethodTest { + + public XTreeNode oObj = null; + + private int mCount = 0; + + String msDisplayValue = null; + String msExpandedGraphicURL = null; + String msCollapsedGraphicURL = null; + String msNodeGraphicURL = null; + + + @Override + public void before(){ + msDisplayValue = (String) tEnv.getObjRelation("XTreeNode_DisplayValue"); + if (msDisplayValue == null){ + throw new StatusException(Status.failed( + "Couldn't get relation 'XTreeNode_DisplayValue'")); + } + + msExpandedGraphicURL = (String) tEnv.getObjRelation("XTreeNode_ExpandedGraphicURL"); + if (msExpandedGraphicURL == null){ + throw new StatusException(Status.failed( + "Couldn't get relation 'XTreeNode_ExpandedGraphicURL'")); + } + + msCollapsedGraphicURL = (String) tEnv.getObjRelation("XTreeNode_CollapsedGraphicURL"); + if (msCollapsedGraphicURL == null){ + throw new StatusException(Status.failed( + "Couldn't get relation 'XTreeNode_CollapsedGraphicURL'")); + } + + msNodeGraphicURL = (String) tEnv.getObjRelation("XTreeNode_NodeGraphicURL"); + if(msNodeGraphicURL == null){ + throw new StatusException(Status.failed( + "Couldn't get relation 'XTreeNode_NodeGraphicURL'")); + } + + } + + /** + * Gets the title and compares it to the value set in + * <code>setTitle</code> method test. <p> + * Has <b>OK</b> status is set/get values are equal. + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setTitle </code> </li> + * </ul> + */ + public void _getChildAt(){ + this.requiredMethod("getChildCount()"); + boolean bOK = true; + + for (int i=0; i < mCount ; i++){ + XTreeNode xNode = null; + try { + xNode = oObj.getChildAt(i); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: getChildAt(" + i + "): " + ex.toString()); + } + if (xNode == null){ + log.println("ERROR: getChildAt(" + i + ") returns null => FAILED"); + bOK = false; + } + } + + tRes.tested("getChildAt()", bOK); + } + + + public void _getChildCount(){ + + boolean bOK = true; + mCount = oObj.getChildCount(); + log.println("got count '" + mCount + "' of children"); + if (mCount < 1 ) { + log.println("ERROR: got a count < 1. The test object must support more than zero children => FAILED"); + bOK = false; + } + tRes.tested("getChildCount()", bOK); + } + + + public void _getParent(){ + this.requiredMethod("getChildAt()"); + + boolean bOK = true; + XTreeNode xNode = null; + try { + log.println("try to getChildAt(0)"); + xNode = oObj.getChildAt(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: getChildAt(0): " + ex.toString()); + } + + log.println("try to get parent of children"); + if (xNode == null) { + log.println("missing xNode"); + tRes.tested("getParent()", false); + } + else { + XTreeNode xParrent = xNode.getParent(); + + + bOK = oObj.equals(xParrent); + log.println("original object and parent should be the same: " + bOK); + tRes.tested("getParent()", bOK); + } + } + + + public void _getIndex(){ + this.requiredMethod("getChildAt()"); + + boolean bOK = true; + XTreeNode xNode = null; + try { + log.println("try to getChildAt(0)"); + xNode = oObj.getChildAt(0); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("ERROR: getChildAt(0): " + ex.toString()); + } + + log.println("try to get index from child..."); + int index = oObj.getIndex(xNode); + + if (index != 0){ + log.println("ERROR: getIndex() does not return '0' => FAILED"); + bOK = false; + } + + tRes.tested("getIndex()", bOK); + } + + + public void _hasChildrenOnDemand(){ + + boolean bOK = true; + + bOK = oObj.hasChildrenOnDemand(); + tRes.tested("hasChildrenOnDemand()", bOK); + } + + + public void _getDisplayValue(){ + + boolean bOK = true; + String DisplayValue = null; + Object dispVal = oObj.getDisplayValue(); + + try { + DisplayValue = AnyConverter.toString(dispVal); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("ERROR: could not convert the returned object of 'getDisplayValue()' " + + "to String with AnyConverter: " + ex.toString()); + } + + if ( ! this.msDisplayValue.equals(DisplayValue)){ + log.println("ERROR: getNodeGraphicURL() does not return expected value:\n" + + "\tExpected: " + this.msDisplayValue +"\n" + + "\tGot: " + DisplayValue); + bOK = false; + } + + tRes.tested("getDisplayValue()", bOK); + } + + + public void _getNodeGraphicURL(){ + + boolean bOK = true; + String graphicURL = oObj.getNodeGraphicURL(); + + if ( ! this.msNodeGraphicURL.equals(graphicURL)){ + log.println("ERROR: getNodeGraphicURL() does not return expected value:\n" + + "\tExpected: " + this.msNodeGraphicURL +"\n" + + "\tGot: " + graphicURL); + bOK = false; + } + tRes.tested("getNodeGraphicURL()", bOK); + } + + + public void _getExpandedGraphicURL(){ + + boolean bOK = true; + String ExpandedGraphicURL = oObj.getExpandedGraphicURL(); + + if ( ! this.msExpandedGraphicURL.equals(ExpandedGraphicURL)){ + log.println("ERROR: getExpandedGraphicURL() does not return expected value:\n" + + "\tExpected: " + this.msExpandedGraphicURL +"\n" + + "\tGot: " + ExpandedGraphicURL); + bOK = false; + } + + tRes.tested("getExpandedGraphicURL()", bOK); + } + + + public void _getCollapsedGraphicURL(){ + + boolean bOK = true; + + String CollapsedGraphicURL = oObj.getCollapsedGraphicURL(); + + if ( ! this.msCollapsedGraphicURL.equals(CollapsedGraphicURL)){ + log.println("ERROR: getExpandedGraphicURL() does not return expected value:\n" + + "\tExpected: " + this.msCollapsedGraphicURL +"\n" + + "\tGot: " + CollapsedGraphicURL); + bOK = false; + } + + tRes.tested("getCollapsedGraphicURL()", bOK); + } + +} |