diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /qadevOOo/tests/java/ifc/chart | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
31 files changed, 3334 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/chart/_BarDiagram.java b/qadevOOo/tests/java/ifc/chart/_BarDiagram.java new file mode 100644 index 000000000..4d7637623 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_BarDiagram.java @@ -0,0 +1,152 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.BarDiagram</code> +* service properties: +* <ul> +* <li><code>'Vertical'</code></li> +* <li><code>'Deep'</code></li> +* <li><code>'StackedBarsConnected'</code></li> +* <li><code>'NumberOfLines'</code></li> +* </ul> +* Properties testing is automated +* by <code>lib.MultiPropertyTest</code> except property +* <code>'NumberOfLines'</code>. <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'BAR'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* <ul> <p> +* @see com.sun.star.chart.BarDiagram +* @see com.sun.star.chart.XChartDocument +* @see com.sun.star.chart.XDiagram +* @see lib.MultiPropertyTest +*/ +public class _BarDiagram extends MultiPropertyTest { + + XChartDocument doc = null; + XDiagram oldDiagram = null; + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to BarDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR"); + if (bar == null) throw new StatusException(Status.failed + ("Relation 'BAR' not found")); + + oldDiagram = doc.getDiagram(); + doc.setDiagram(bar); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + log.println("Set it to 3D"); + try { + oObj.setPropertyValue("Dim3D", Boolean.TRUE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } + + protected PropertyTester LineTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + int a = 0; + int b = 2; + if ( ((Integer) oldValue).intValue() == a) + return Integer.valueOf(b); else + return Integer.valueOf(a); + } + } ; + + /** + * Tests property 'NumberOfLines'. + * This property tests when diagram in 2D-mode only + * except all other properties. This property is currently supported by + * two dimensional vertical bar charts only. + */ + public void _NumberOfLines() { + log.println("Set it to 2D"); + try { + oObj.setPropertyValue("Dim3D", Boolean.FALSE); + oObj.setPropertyValue("Vertical", Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + + log.println("Testing with custom Property tester") ; + testProperty("NumberOfLines", LineTester) ; + } +} // EOF BarDiagram + diff --git a/qadevOOo/tests/java/ifc/chart/_Chart3DBarProperties.java b/qadevOOo/tests/java/ifc/chart/_Chart3DBarProperties.java new file mode 100644 index 000000000..401b1d9bb --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_Chart3DBarProperties.java @@ -0,0 +1,123 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.Chart3DBarProperties</code> +* service properties: +* <ul> +* <li><code> SolidType</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'BAR'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* <ul> <p> +* @see com.sun.star.chart.Chart3DBarProperties +* @see com.sun.star.chart.XChartDocument +* @see com.sun.star.chart.XDiagram +*/ +public class _Chart3DBarProperties extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to BarDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR"); + if (bar == null) throw new StatusException(Status.failed + ("Relation 'BAR' not found")); + + doc.setDiagram(bar); + log.println("Change Diagram to 3D"); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + try { + oObj.setPropertyValue("Dim3D", Boolean.TRUE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't change Diagram to 3D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram to 3D", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't change Diagram to 3D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram to 3D", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't change Diagram to 3D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram to 3D", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't change Diagram to 3D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram to 3D", e); + } + } + + /** + * Sets the diagram back to 2D as 2D rendering is much faster for the following tests. + */ + @Override + protected void after() { + log.println("Setting Diagram back to 2D"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + log.println("Change Diagram to 3D"); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + try { + oObj.setPropertyValue("Dim3D", Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't change Diagram back to 2D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram back to 2D", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't change Diagram back to 2D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram back to 2D", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't change Diagram back to 2D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram back to 2D", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't change Diagram back to 2D"); + e.printStackTrace(log); + throw new StatusException("Couldn't change Diagram back to 2D", e); + } + } + +} // finish class _Chart3DBarProperties + + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartAxis.java b/qadevOOo/tests/java/ifc/chart/_ChartAxis.java new file mode 100644 index 000000000..2a295c208 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartAxis.java @@ -0,0 +1,200 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.StatusException; +import util.ValueChanger; + +/** +* Testing <code>com.sun.star.chart.ChartAxis</code> +* service properties: +* <ul> +* <li><code> ArrangeOrder</code></li> +* <li><code> AutoMax</code></li> +* <li><code> AutoMin</code></li> +* <li><code> AutoOrigin</code></li> +* <li><code> AutoStepHelp</code></li> +* <li><code> AutoStepMain</code></li> +* <li><code> DisplayLabels</code></li> +* <li><code> GapWidth</code></li> +* <li><code> HelpMarks</code></li> +* <li><code> Logarithmic</code></li> +* <li><code> Marks</code></li> +* <li><code> Max</code></li> +* <li><code> Min</code></li> +* <li><code> NumberFormat</code></li> +* <li><code> Origin</code></li> +* <li><code> Overlap</code></li> +* <li><code> StepHelp</code></li> +* <li><code> StepMain</code></li> +* <li><code> TextBreak</code></li> +* <li><code> TextRotation</code></li> +* <li><code> TextCanOverlap</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartAxis +*/ +public class _ChartAxis extends MultiPropertyTest { + + /** + * Tests property 'Max'. + * Property 'AutoOrigin' sets to true and property 'AutoMax' + * sets to false before test. + */ + public void _Max() { + try { + //if AutoOrigin isn't true then this property works only when + //current Origin is less than new value of Max + oObj.setPropertyValue("AutoOrigin", Boolean.TRUE); + oObj.setPropertyValue("AutoMax",Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } + + testProperty("Max"); + } + + /** + * Tests property 'Min'. + * Property 'AutoOrigin' sets to true and property 'AutoMin' + * sets to false before test. + */ + public void _Min() { + try { + //if AutoOrigin isn't true then this property works only when + //current Origin is greater than new value of Min + oObj.setPropertyValue("AutoOrigin", Boolean.TRUE); + oObj.setPropertyValue("AutoMin", Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } + + testProperty("Min"); + } + + /** + * Tests property 'Origin'. + * Property 'Logarithmic' sets to false before test. + */ + public void _Origin() { + try { + oObj.setPropertyValue("Logarithmic",Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } + + testProperty("Origin"); + } + + protected PropertyTester StepMainTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + Double ValueToSet = (Double) ValueChanger.changePValue(oldValue); + double stm = ValueToSet.doubleValue(); + stm = stm / 5; + return new Double(stm); + } + }; + + /** + * Tests property 'StepMain'. + * Property 'Logarithmic' and 'AutoStepMain' sets + * to false before test. + */ + public void _StepMain() { + try { + oObj.setPropertyValue("AutoStepMain", Boolean.FALSE); + oObj.setPropertyValue("Logarithmic",Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't set property value"); + e.printStackTrace(log); + throw new StatusException("Couldn't set property value", e); + } + + testProperty("StepMain", StepMainTester); + } + + public void _StepHelp() { + try { + oObj.setPropertyValue("AutoStepMain", Boolean.FALSE); + oObj.setPropertyValue("Logarithmic",Boolean.FALSE); + oObj.setPropertyValue("StepMain", 100.0); + oObj.setPropertyValue("StepHelpCount", 10); + } catch (com.sun.star.uno.Exception e) { + throw new StatusException("Couldn't set property value", e); + } + testProperty("StepHelp"); + } +} // finish class _ChartAxis + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartAxisXSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartAxisXSupplier.java new file mode 100644 index 000000000..4f9075ef9 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartAxisXSupplier.java @@ -0,0 +1,132 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.chart.ChartAxisXSupplier</code> +* service properties : +* <ul> +* <li><code> HasXAxis</code></li> +* <li><code> HasXAxisDescription</code></li> +* <li><code> HasXAxisGrid</code></li> +* <li><code> HasXAxisHelpGrid</code></li> +* <li><code> HasXAxisTitle</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartAxisXSupplier +*/ +public class _ChartAxisXSupplier extends MultiPropertyTest { + public void _HasXAxis() { + try { + log.println("Property HasXAxis"); + boolean res = ((Boolean)oObj.getPropertyValue( + "HasXAxis")).booleanValue(); + if (!res) + oObj.setPropertyValue("HasXAxis", Boolean.TRUE); + // test connected property HasXAxisDescription + if (!((Boolean)oObj.getPropertyValue( + "HasXAxisDescription")).booleanValue()) + oObj.setPropertyValue("HasXAxisDescription", Boolean.TRUE); + + oObj.setPropertyValue("HasXAxis", Boolean.FALSE); + boolean setVal = ((Boolean)oObj.getPropertyValue( + "HasXAxis")).booleanValue(); + log.println("Start value: " + setVal); + // description should also be false now + setVal |= ((Boolean)oObj.getPropertyValue( + "HasXAxisDescription")).booleanValue(); + log.println("Connected value axis description: " + setVal); + + oObj.setPropertyValue("HasXAxis", Boolean.TRUE); + setVal |= !((Boolean)oObj.getPropertyValue( + "HasXAxis")).booleanValue(); + log.println("Changed value: " + !setVal); + + // description should be true again + setVal |= !((Boolean)oObj.getPropertyValue( + "HasXAxisDescription")).booleanValue(); + log.println("Changed connected value axis description: " + !setVal); + + tRes.tested("HasXAxis", !setVal); + // leave axis untouched + oObj.setPropertyValue("HasXAxis", Boolean.valueOf(res)); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxis", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxis", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxis", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxis", false); + } + } + + public void _HasXAxisDescription() { + requiredMethod("HasXAxis"); + try { + log.println("Property HasXAxisDescription"); + if (!((Boolean)oObj.getPropertyValue("HasXAxis")).booleanValue()) + oObj.setPropertyValue("HasXAxis", Boolean.TRUE); + + boolean res = ((Boolean)oObj.getPropertyValue( + "HasXAxisDescription")).booleanValue(); + log.println("Start value: " + res); + + oObj.setPropertyValue("HasXAxisDescription", Boolean.valueOf(!res)); + boolean setValue = ((Boolean)oObj.getPropertyValue( + "HasXAxisDescription")).booleanValue(); + log.println("Changed value: " + setValue); + tRes.tested("HasXAxisDescription", res != setValue); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxisDescription", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxisDescription", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxisDescription", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasXAxisDescription", false); + } + } +} // EOF ChartAxisXSupplier + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartAxisYSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartAxisYSupplier.java new file mode 100644 index 000000000..ca2d6aedf --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartAxisYSupplier.java @@ -0,0 +1,158 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.ChartAxisYSupplier</code> +* service properties : +* <ul> +* <li><code> HasYAxis</code></li> +* <li><code> HasYAxisDescription</code></li> +* <li><code> HasYAxisGrid</code></li> +* <li><code> HasYAxisHelpGrid</code></li> +* <li><code> HasYAxisTitle</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* </ul> <p> +* @see com.sun.star.chart.ChartAxisYSupplier +*/ +public class _ChartAxisYSupplier extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } + + public void _HasYAxis() { + try { + log.println("Property HasYAxis"); + boolean res = ((Boolean)oObj.getPropertyValue( + "HasYAxis")).booleanValue(); + if (!res) + oObj.setPropertyValue("HasYAxis", Boolean.TRUE); + // test connected property HasYAxisDescription + if (!((Boolean)oObj.getPropertyValue( + "HasYAxisDescription")).booleanValue()) + oObj.setPropertyValue("HasYAxisDescription", Boolean.TRUE); + + oObj.setPropertyValue("HasYAxis", Boolean.FALSE); + boolean setVal = ((Boolean)oObj.getPropertyValue( + "HasYAxis")).booleanValue(); + log.println("Start value: " + setVal); + // description should also be false now + setVal |= ((Boolean)oObj.getPropertyValue( + "HasYAxisDescription")).booleanValue(); + log.println("Connected value axis description: " + setVal); + + oObj.setPropertyValue("HasYAxis", Boolean.TRUE); + setVal |= !((Boolean)oObj.getPropertyValue( + "HasYAxis")).booleanValue(); + log.println("Changed value: " + !setVal); + + // description should be true again + setVal |= !((Boolean)oObj.getPropertyValue( + "HasYAxisDescription")).booleanValue(); + log.println("Changed connected value axis description: "+!setVal); + + tRes.tested("HasYAxis", !setVal); + // leave axis untouched + oObj.setPropertyValue("HasYAxis", Boolean.valueOf(res)); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxis", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxis", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxis", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxis", false); + } + } + + public void _HasYAxisDescription() { + requiredMethod("HasYAxis"); + try { + log.println("Property HasYAxisDescription"); + if (!((Boolean)oObj.getPropertyValue("HasYAxis")).booleanValue()) + oObj.setPropertyValue("HasYAxis", Boolean.TRUE); + + boolean res = ((Boolean)oObj.getPropertyValue( + "HasYAxisDescription")).booleanValue(); + log.println("Start value: " + res); + + oObj.setPropertyValue("HasYAxisDescription", Boolean.valueOf(!res)); + boolean setValue = ((Boolean)oObj.getPropertyValue( + "HasYAxisDescription")).booleanValue(); + log.println("Changed value: " + setValue); + tRes.tested("HasYAxisDescription", res != setValue); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxisDescription", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxisDescription", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxisDescription", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasYAxisDescription", false); + } + } + +} // EOF ChartAxisYSupplier + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartAxisZSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartAxisZSupplier.java new file mode 100644 index 000000000..30ac5bc92 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartAxisZSupplier.java @@ -0,0 +1,196 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.ChartAxisZSupplier</code> +* service properties : +* <ul> +* <li><code> HasZAxis</code></li> +* <li><code> HasZAxisDescription</code></li> +* <li><code> HasZAxisGrid</code></li> +* <li><code> HasZAxisHelpGrid</code></li> +* <li><code> HasZAxisTitle</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'BAR'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document</li> +* </ul> <p> +* @see com.sun.star.chart.ChartAxisZSupplier +*/ +public class _ChartAxisZSupplier extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to BarDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR"); + if (bar == null) throw new StatusException(Status.failed + ("Relation 'BAR' not found")); + + doc.setDiagram(bar); + log.println("Set it to 3D"); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + try { + oObj.setPropertyValue("Dim3D", Boolean.TRUE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } + + public void _HasZAxis() { + try { + log.println("Property HasZAxis"); + boolean res = ((Boolean)oObj.getPropertyValue( + "HasZAxis")).booleanValue(); + if (!res) + oObj.setPropertyValue("HasZAxis", Boolean.TRUE); + // test connected property HasZAxisDescription + if (!((Boolean)oObj.getPropertyValue( + "HasZAxisDescription")).booleanValue()) + oObj.setPropertyValue("HasZAxisDescription", Boolean.TRUE); + + oObj.setPropertyValue("HasZAxis", Boolean.FALSE); + boolean setVal = ((Boolean)oObj.getPropertyValue( + "HasZAxis")).booleanValue(); + log.println("Start value: " + setVal); + // description should also be false now + setVal |= ((Boolean)oObj.getPropertyValue( + "HasZAxisDescription")).booleanValue(); + log.println("Connected value axis description: " + setVal); + + oObj.setPropertyValue("HasZAxis", Boolean.TRUE); + setVal |= !((Boolean)oObj.getPropertyValue( + "HasZAxis")).booleanValue(); + log.println("Changed value: " + !setVal); + + // description should be true again + setVal |= !((Boolean)oObj.getPropertyValue( + "HasZAxisDescription")).booleanValue(); + log.println("Changed connected value axis description: " + !setVal); + + tRes.tested("HasZAxis", !setVal); + // leave axis untouched + oObj.setPropertyValue("HasZAxis", Boolean.valueOf(res)); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxis", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxis", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxis", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxis", false); + } + } + + public void _HasZAxisDescription() { + requiredMethod("HasZAxis"); + try { + log.println("Property HasZAxisDescription"); + if (!((Boolean)oObj.getPropertyValue("HasZAxis")).booleanValue()) + oObj.setPropertyValue("HasZAxis", Boolean.TRUE); + + boolean res = ((Boolean)oObj.getPropertyValue( + "HasZAxisDescription")).booleanValue(); + log.println("Start value: " + res); + + oObj.setPropertyValue("HasZAxisDescription", Boolean.valueOf(!res)); + boolean setValue = ((Boolean)oObj.getPropertyValue( + "HasZAxisDescription")).booleanValue(); + log.println("Changed value: " + setValue); + tRes.tested("HasZAxisDescription", res != setValue); + } + catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxisDescription", false); + } + catch (com.sun.star.lang.IllegalArgumentException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxisDescription", false); + } + catch (com.sun.star.beans.UnknownPropertyException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxisDescription", false); + } + catch (com.sun.star.beans.PropertyVetoException e) { + log.println(e.getMessage()); + e.printStackTrace(log); + tRes.tested("HasZAxisDescription", false); + } + } + + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} // EOF ChartAxisZSupplier + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java b/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java new file mode 100644 index 000000000..e7872378c --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartDataPointProperties.java @@ -0,0 +1,120 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; +import util.utils; + +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; + +/** +* Testing <code>com.sun.star.chart.ChartDataPointProperties</code> +* service properties : +* <ul> +* <li><code> DataCaption</code></li> +* <li><code> SymbolType</code></li> +* <li><code> SymbolBitmapURL</code></li> +* </ul> <p> +* The following predefined files needed to complete the test: +* <ul> +* <li> <code>space-metal.jpg</code> : +* for test of property 'SymbolBitmapURL' </li> +* <ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'LINE'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.ChartDataPointProperties +*/ +public class _ChartDataPointProperties extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram Line = (XDiagram) tEnv.getObjRelation("LINE"); + if (Line == null) throw new StatusException(Status.failed + ("Relation 'LINE' not found")); + + doc.setDiagram(Line); + } + + /** + * Tests property 'SymbolBitmapURL' using file <code>polibal.gif</code>. + */ + public void _SymbolBitmapURL() { + try { + oObj.setPropertyValue( + "SymbolType", + Integer.valueOf(com.sun.star.chart.ChartSymbolType.BITMAPURL) ); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + + try { + oObj.setPropertyValue( + "SymbolBitmapURL", + utils.getFullTestURL("space-metal.jpg") ); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartDataRowProperties.java b/qadevOOo/tests/java/ifc/chart/_ChartDataRowProperties.java new file mode 100644 index 000000000..5cd275f76 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartDataRowProperties.java @@ -0,0 +1,54 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.chart.ChartDataRowProperties</code> +* service properties : +* <ul> +* <li><code> Axis</code></li> +* <li><code> DataErrorProperties</code></li> +* <li><code> DataMeanValueProperties</code></li> +* <li><code> DataRegressionProperties</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartDataRowProperties +*/ +public class _ChartDataRowProperties extends MultiPropertyTest { + + public void _Axis() { + try { + Integer axis = (Integer) oObj.getPropertyValue("Axis"); + int newValue; + if (axis.intValue()==2) { + newValue = 4; + } else { + newValue = 2; + } + oObj.setPropertyValue("Axis", Integer.valueOf(newValue)); + axis = (Integer) oObj.getPropertyValue("Axis"); + tRes.tested("Axis",axis.intValue()==newValue); + } catch (Exception e) { + e.printStackTrace(log); + tRes.tested("Axis",false); + } + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartDocument.java b/qadevOOo/tests/java/ifc/chart/_ChartDocument.java new file mode 100644 index 000000000..bf9215f01 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartDocument.java @@ -0,0 +1,35 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.chart; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.chart.ChartDocument</code> +* service properties : +* <ul> +* <li><code> HasLegend</code></li> +* <li><code> HasMainTitle</code></li> +* <li><code> HasSubTitle</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartDocument +*/ +public class _ChartDocument extends MultiPropertyTest { +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartLegend.java b/qadevOOo/tests/java/ifc/chart/_ChartLegend.java new file mode 100644 index 000000000..ccfd408f4 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartLegend.java @@ -0,0 +1,33 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.chart.ChartLegend</code> +* service properties : +* <ul> +* <li><code> Alignment</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartLegend +*/ +public class _ChartLegend extends MultiPropertyTest { +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartStatistics.java b/qadevOOo/tests/java/ifc/chart/_ChartStatistics.java new file mode 100644 index 000000000..3abbcc03c --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartStatistics.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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.ChartStatistics</code> +* service properties : +* <ul> +* <li><code> RegressionCurves</code></li> +* <li><code> ConstantErrorLow</code></li> +* <li><code> ConstantErrorHigh</code></li> +* <li><code> MeanValue</code></li> +* <li><code> ErrorCategory</code></li> +* <li><code> PercentageError</code></li> +* <li><code> ErrorMargin</code></li> +* <li><code> ErrorIndicator</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* </ul> <p> +* @see com.sun.star.chart.ChartStatistics +*/ +public class _ChartStatistics extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartTableAddressSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartTableAddressSupplier.java new file mode 100644 index 000000000..f3cf71a25 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartTableAddressSupplier.java @@ -0,0 +1,59 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.chart; + +import lib.MultiPropertyTest; + +import com.sun.star.chart.ChartSeriesAddress; + +/** +* Testing <code>com.sun.star.chart.ChartTableAddressSupplier</code> +* service properties : +* <ul> +* <li><code> CategoriesRangeAddress</code></li> +* <li><code> SeriesAddresses</code></li> +* <li><code> MainTitleAddress</code></li> +* <li><code> SubTitleAddress</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartTableAddressSupplier +*/ +public class _ChartTableAddressSupplier extends MultiPropertyTest { + + /** + * Tests property 'SeriesAddresses'. + */ + public void _SeriesAddresses() { + testProperty("SeriesAddresses", new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + ChartSeriesAddress[] addr = (ChartSeriesAddress[]) oldValue ; + ChartSeriesAddress[] newAddr = null ; + if (addr.length > 1) { + newAddr = new ChartSeriesAddress[addr.length - 1] ; + System.arraycopy(addr, 0, newAddr, 0, addr.length - 1) ; + } else { + newAddr = addr ; + } + + return newAddr ; + } + }) ; + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartTitle.java b/qadevOOo/tests/java/ifc/chart/_ChartTitle.java new file mode 100644 index 000000000..a8bf068cf --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartTitle.java @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.chart; + +import lib.MultiPropertyTest; +import util.ValueChanger; + +/** +* Testing <code>com.sun.star.chart.ChartTitle</code> +* service properties : +* <ul> +* <li><code> TextRotation</code></li> +* <li><code> String</code></li> +* </ul> <p> +* @see com.sun.star.chart.ChartTitle +*/ +public class _ChartTitle extends MultiPropertyTest { + + /** + * Tests property 'TextRotation'. + */ + public void _TextRotation() { + testProperty("TextRotation", new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + Object ValueToSet = ValueChanger.changePValue(oldValue); + int ro = ((Integer) ValueToSet).intValue() * 100; + return Integer.valueOf( ro ); + } + } ); + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisXSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisXSupplier.java new file mode 100644 index 000000000..fcd260994 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisXSupplier.java @@ -0,0 +1,100 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.ChartTwoAxisXSupplier</code> +* service properties : +* <ul> +* <li><code> HasSecondaryXAxis</code></li> +* <li><code> HasSecondaryXAxisDescription</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'BAR'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.ChartTwoAxisXSupplier +*/ +public class _ChartTwoAxisXSupplier extends MultiPropertyTest { + + XChartDocument doc = null; + XDiagram oldDiagram = null; + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to BarDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR"); + if (bar == null) throw new StatusException(Status.failed + ("Relation 'BAR' not found")); + + oldDiagram = doc.getDiagram(); + + doc.setDiagram(bar); + log.println("Set it to 3D"); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + try { + oObj.setPropertyValue("Dim3D", Boolean.TRUE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } +} // EOF ChartTwoAxisXSupplier + diff --git a/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisYSupplier.java b/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisYSupplier.java new file mode 100644 index 000000000..a6b690d71 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_ChartTwoAxisYSupplier.java @@ -0,0 +1,100 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.ChartTwoAxisYSupplier</code> +* service properties : +* <ul> +* <li><code> HasSecondaryYAxis</code></li> +* <li><code> HasSecondaryYAxisDescription</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'BAR'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.ChartTwoAxisYSupplier +*/ +public class _ChartTwoAxisYSupplier extends MultiPropertyTest { + + XChartDocument doc = null; + XDiagram oldDiagram = null; + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to BarDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram bar = (XDiagram) tEnv.getObjRelation("BAR"); + if (bar == null) throw new StatusException(Status.failed + ("Relation 'BAR' not found")); + + oldDiagram = doc.getDiagram(); + + doc.setDiagram(bar); + log.println("Set it to 3D"); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + try { + oObj.setPropertyValue("Dim3D", Boolean.TRUE); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } +} // EOF ChartTwoAxisYSupplier + diff --git a/qadevOOo/tests/java/ifc/chart/_Diagram.java b/qadevOOo/tests/java/ifc/chart/_Diagram.java new file mode 100644 index 000000000..ea4fe01ca --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_Diagram.java @@ -0,0 +1,59 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.Diagram</code> +* service properties : +* <ul> +* <li><code> DataCaption</code></li> +* <li><code> DataRowSource</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* </ul> <p> +* @see com.sun.star.chart.Diagram +*/ +public class _Diagram extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_Dim3DDiagram.java b/qadevOOo/tests/java/ifc/chart/_Dim3DDiagram.java new file mode 100644 index 000000000..512bb0016 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_Dim3DDiagram.java @@ -0,0 +1,58 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.Dim3DDiagram</code> +* service properties : +* <ul> +* <li><code> Dim3D</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* </ul> <p> +* @see com.sun.star.chart.Dim3DDiagram +*/ +public class _Dim3DDiagram extends MultiPropertyTest { + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + XChartDocument doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } +} // EOF Dim3DDiagram + diff --git a/qadevOOo/tests/java/ifc/chart/_LineDiagram.java b/qadevOOo/tests/java/ifc/chart/_LineDiagram.java new file mode 100644 index 000000000..ef48ee877 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_LineDiagram.java @@ -0,0 +1,199 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.LineDiagram</code> +* service properties : +* <ul> +* <li><code> SymbolType</code></li> +* <li><code> SymbolSize</code></li> +* <li><code> SymbolBitmapURL</code></li> +* <li><code> Lines</code></li> +* <li><code> SplineType</code></li> +* </ul> <p> +* The following predefined files needed to complete the test: +* <ul> +* <li> <code>space-metal.jpg</code> : +* for test of property 'SymbolBitmapURL' </li> +* <li> <code>crazy-blue.jpg</code> : +* for test of property 'SymbolBitmapURL' </li> +* <ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'LINE'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.LineDiagram +*/ +public class _LineDiagram extends MultiPropertyTest { + + XChartDocument doc = null; + XDiagram oldDiagram = null; + + /** + * Retrieves object relations. + * @throws StatusException If one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram Line = (XDiagram) tEnv.getObjRelation("LINE"); + if (Line == null) throw new StatusException(Status.failed + ("Relation 'LINE' not found")); + + oldDiagram = doc.getDiagram(); + doc.setDiagram(Line); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } + + protected PropertyTester SymbolTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + + int a = com.sun.star.chart.ChartSymbolType.AUTO; + int b = com.sun.star.chart.ChartSymbolType.NONE; + if ( ((Integer) oldValue).intValue() == a) + return Integer.valueOf(b); else + return Integer.valueOf(a); + } + } ; + + protected PropertyTester SplineTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + + int a = 0; + int b = 2; + if ( ((Integer) oldValue).intValue() == a) + return Integer.valueOf(b); else + return Integer.valueOf(a); + } + } ; + + /** + * Tests property 'SymbolType'. + */ + public void _SymbolType() { + log.println("Testing with custom Property tester") ; + testProperty("SymbolType", SymbolTester) ; + try { + oObj.setPropertyValue("SymbolType",Integer.valueOf(-2)); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } + + /** + * Tests property 'SplineType'. + */ + public void _SplineType() { + log.println("Testing with custom Property tester") ; + testProperty("SplineType", SplineTester) ; + } + + /** + * Tests property 'SymbolBitmapURL'. + */ + public void _SymbolBitmapURL() { + log.println("Testing with custom Property tester") ; + try { + oObj.setPropertyValue("SymbolType", + Integer.valueOf(com.sun.star.chart.ChartSymbolType.BITMAPURL)); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + + try { + oObj.setPropertyValue( + "SymbolBitmapURL", + util.utils.getFullTestURL("space-metal.jpg") ); + } catch(com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } catch(com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while set property value"); + e.printStackTrace(log); + throw new StatusException("Exception while set property value", e); + } + } +} // EOF LineDiagram + diff --git a/qadevOOo/tests/java/ifc/chart/_StackableDiagram.java b/qadevOOo/tests/java/ifc/chart/_StackableDiagram.java new file mode 100644 index 000000000..9fbb2bed2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_StackableDiagram.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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.StackableDiagram</code> +* service properties : +* <ul> +* <li><code> Percent</code></li> +* <li><code> Stacked</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'STACK'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.StackableDiagram +*/ +public class _StackableDiagram extends MultiPropertyTest { + + XChartDocument doc = null; + XDiagram oldDiagram = null; + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to LineDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram stack = (XDiagram) tEnv.getObjRelation("STACK"); + if (stack == null) throw new StatusException(Status.failed + ("Relation 'STACK' not found")); + + oldDiagram = doc.getDiagram(); + + doc.setDiagram(stack); + oObj = UnoRuntime.queryInterface( XPropertySet.class, doc.getDiagram() ); + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } + +} // EOF StackableDiagram + diff --git a/qadevOOo/tests/java/ifc/chart/_StockDiagram.java b/qadevOOo/tests/java/ifc/chart/_StockDiagram.java new file mode 100644 index 000000000..32c020024 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_StockDiagram.java @@ -0,0 +1,79 @@ +/* + * 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.chart; + +import lib.MultiPropertyTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.StockDiagram</code> +* service properties : +* <ul> +* <li><code> Volume</code></li> +* <li><code> UpDown</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'CHARTDOC'</code> (of type <code>XChartDocument</code>): +* to have reference to chart document </li> +* <li> <code>'STOCK'</code> (of type <code>XDiagram</code>): +* relation that use as parameter for method setDiagram of chart document </li> +* </ul> <p> +* @see com.sun.star.chart.StockDiagram +*/ +public class _StockDiagram extends MultiPropertyTest { + + XDiagram oldDiagram = null; + XChartDocument doc = null; + + /** + * Retrieves object relations and prepares a chart document. + * @throws StatusException if one of relations not found. + */ + @Override + protected void before() { + log.println("Setting Diagram type to StockDiagram"); + doc = (XChartDocument) tEnv.getObjRelation("CHARTDOC"); + if (doc == null) throw new StatusException(Status.failed + ("Relation 'CHARTDOC' not found")); + + XDiagram stock = (XDiagram) tEnv.getObjRelation("STOCK"); + if (stock == null) throw new StatusException(Status.failed + ("Relation 'STOCK' not found")); + + oldDiagram = doc.getDiagram(); + doc.setDiagram(stock); + oObj = UnoRuntime.queryInterface(XPropertySet.class, doc.getDiagram()); + } + + /** + * Sets the old diagram for a chart document. + */ + @Override + protected void after() { + doc.setDiagram(oldDiagram); + } +} + diff --git a/qadevOOo/tests/java/ifc/chart/_X3DDisplay.java b/qadevOOo/tests/java/ifc/chart/_X3DDisplay.java new file mode 100644 index 000000000..a9db80003 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_X3DDisplay.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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.X3DDisplay; + +/** +* Testing <code>com.sun.star.chart.X3DDisplay</code> +* interface methods : +* <ul> +* <li><code> getWall()</code></li> +* <li><code> getFloor()</code></li> +* </ul> <p> +* @see com.sun.star.chart.X3DDisplay +*/ +public class _X3DDisplay extends MultiMethodTest { + + public X3DDisplay oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getWall() { + result = true; + + XPropertySet Wall = oObj.getWall(); + result = (Wall != null); + + tRes.tested("getWall()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getFloor() { + result = true; + + XPropertySet Floor = oObj.getWall(); + result = (Floor != null); + + tRes.tested("getFloor()", result); + } + +} // EOF X3DDisplay + + diff --git a/qadevOOo/tests/java/ifc/chart/_XAxisXSupplier.java b/qadevOOo/tests/java/ifc/chart/_XAxisXSupplier.java new file mode 100644 index 000000000..5063b9a4b --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XAxisXSupplier.java @@ -0,0 +1,97 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XAxisXSupplier; +import com.sun.star.drawing.XShape; + +/** +* Testing <code>com.sun.star.chart.XAxisXSupplier</code> +* interface methods : +* <ul> +* <li><code> getXMainGrid()</code></li> +* <li><code> getXAxisTitle()</code></li> +* <li><code> getXAxis()</code></li> +* <li><code> getXHelpGrid()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XAxisXSupplier +*/ +public class _XAxisXSupplier extends MultiMethodTest { + + public XAxisXSupplier oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getXMainGrid() { + result = true; + + XPropertySet MGrid = oObj.getXMainGrid(); + result = (MGrid != null); + + tRes.tested("getXMainGrid()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getXAxisTitle() { + result = true; + + XShape title = oObj.getXAxisTitle(); + result = (title != null); + + tRes.tested("getXAxisTitle()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getXAxis() { + result = true; + + XPropertySet axis = oObj.getXAxis(); + result = (axis != null); + + tRes.tested("getXAxis()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value that isn't null. <p> + */ + public void _getXHelpGrid() { + result = true; + + XPropertySet HGrid = oObj.getXHelpGrid(); + result = (HGrid != null); + + tRes.tested("getXHelpGrid()", result); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/chart/_XAxisYSupplier.java b/qadevOOo/tests/java/ifc/chart/_XAxisYSupplier.java new file mode 100644 index 000000000..a5f3fc84f --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XAxisYSupplier.java @@ -0,0 +1,100 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XAxisYSupplier; +import com.sun.star.drawing.XShape; + +/** +* Testing <code>com.sun.star.chart.XAxisYSupplier</code> +* interface methods : +* <ul> +* <li><code> getYMainGrid()</code></li> +* <li><code> getYAxisTitle()</code></li> +* <li><code> getYAxis()</code></li> +* <li><code> getYHelpGrid()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XAxisYSupplier +*/ +public class _XAxisYSupplier extends MultiMethodTest { + + public XAxisYSupplier oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getYMainGrid() { + result = true; + + XPropertySet MGrid = oObj.getYMainGrid(); + result = (MGrid != null); + + tRes.tested("getYMainGrid()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getYAxisTitle() { + result = true; + + XShape title = oObj.getYAxisTitle(); + result = (title != null); + + tRes.tested("getYAxisTitle()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getYAxis() { + result = true; + + XPropertySet axis = oObj.getYAxis(); + result = (axis != null); + + tRes.tested("getYAxis()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getYHelpGrid() { + result = true; + + XPropertySet HGrid = oObj.getYHelpGrid(); + result = (HGrid != null); + + tRes.tested("getYHelpGrid()", result); + } +} // EOF XAxisYSupplier + + diff --git a/qadevOOo/tests/java/ifc/chart/_XAxisZSupplier.java b/qadevOOo/tests/java/ifc/chart/_XAxisZSupplier.java new file mode 100644 index 000000000..00b89656c --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XAxisZSupplier.java @@ -0,0 +1,100 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XAxisZSupplier; +import com.sun.star.drawing.XShape; + +/** +* Testing <code>com.sun.star.chart.XAxisZSupplier</code> +* interface methods : +* <ul> +* <li><code> getZMainGrid()</code></li> +* <li><code> getZAxisTitle()</code></li> +* <li><code> getZAxis()</code></li> +* <li><code> getZHelpGrid()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XAxisZSupplier +*/ +public class _XAxisZSupplier extends MultiMethodTest { + public XAxisZSupplier oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getZMainGrid() { + result = true; + + XPropertySet MGrid = oObj.getZMainGrid(); + result = (MGrid != null); + + tRes.tested("getZMainGrid()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getZAxisTitle() { + result = true; + + XShape title = oObj.getZAxisTitle(); + result = (title != null); + + tRes.tested("getZAxisTitle()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getZAxis() { + result = true; + + XPropertySet axis = oObj.getZAxis(); + result = (axis != null); + + tRes.tested("getZAxis()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the method returns + * value that isn't null. <p> + */ + public void _getZHelpGrid() { + result = true; + + XPropertySet HGrid = oObj.getZHelpGrid(); + result = (HGrid != null); + + tRes.tested("getZHelpGrid()", result); + } + +} // EOF XAxisZSupplier + + diff --git a/qadevOOo/tests/java/ifc/chart/_XChartData.java b/qadevOOo/tests/java/ifc/chart/_XChartData.java new file mode 100644 index 000000000..c0a4bc3c7 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XChartData.java @@ -0,0 +1,176 @@ +/* + * 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.chart; + +import com.sun.star.chart.ChartDataChangeEvent; +import com.sun.star.chart.XChartData; +import com.sun.star.chart.XChartDataArray; +import com.sun.star.chart.XChartDataChangeEventListener; +import com.sun.star.lang.EventObject; +import com.sun.star.uno.UnoRuntime; + +import lib.MultiMethodTest; + + +/** +* Testing <code>com.sun.star.chart.XChartData</code> +* interface methods : +* <ul> +* <li><code> addChartDataChangeEventListener()</code></li> +* <li><code> removeChartDataChangeEventListener()</code></li> +* <li><code> getNotANumber()</code></li> +* <li><code> isNotANumber()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XChartData +*/ +public class _XChartData extends MultiMethodTest { + public XChartData oObj = null; + boolean result = true; + double nan = 0; + XChartDataArray dataArray = null; + boolean[] dataChanged = new boolean[2]; + XChartDataChangeEventListener listener1 = new MyEventListener(); + XChartDataChangeEventListener listener2 = new MyEventListener2(); + + /** + * Test calls the method adding two listeners and then changes data. <p> + * Has <b> OK </b> status if after data were changed + * listeners were called. <p> + */ + public void _addChartDataChangeEventListener() { + dataChanged[0] = false; + dataChanged[1] = false; + + oObj.addChartDataChangeEventListener(listener1); + oObj.addChartDataChangeEventListener(listener2); + + dataArray = UnoRuntime.queryInterface( + XChartDataArray.class, oObj); + + double[][] data = dataArray.getData(); + data[0][0] += 0.1; + dataArray.setData(data); + + if (!dataChanged[0]) { + log.println("ChartDataChangeEventListener1 " + + "isn't called after changing data"); + } + + if (!dataChanged[1]) { + log.println("ChartDataChangeEventListener2 " + + "isn't called after changing data"); + } + + tRes.tested("addChartDataChangeEventListener()", + dataChanged[0] && dataChanged[1]); + } + + /** + * Test calls the method for one listener, changes data, + * calls the method for other listener and again changes data. <p> + * Has <b> OK </b> status if listener is not called after removing. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code>addChartDataChangeEventListener</code> : to have listeners + * that must be removed by the method </li> + * </ul> + */ + public void _removeChartDataChangeEventListener() { + requiredMethod("addChartDataChangeEventListener()"); + + dataChanged[0] = false; + dataChanged[1] = false; + + oObj.removeChartDataChangeEventListener(listener1); + dataArray = UnoRuntime.queryInterface( + XChartDataArray.class, oObj); + + double[][] data = dataArray.getData(); + data[0][0] += 0.1; + dataArray.setData(data); + oObj.removeChartDataChangeEventListener(listener2); + + if (dataChanged[0]) { + log.println("ChartDataChangeEventListener1 is " + + "called after removing listener"); + } + + tRes.tested("removeChartDataChangeEventListener()", + ((!dataChanged[0]) && (dataChanged[1]))); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if the return value isn't equal to 1. <p> + */ + public void _getNotANumber() { + result = true; + + nan = oObj.getNotANumber(); + log.println("Current NotANumber is " + nan); + result = nan != 1; + + tRes.tested("getNotANumber()", result); + } + + /** + * Test calls the method with NAN value and with non NAN value. <p> + * Has <b> OK </b> status if the method returns true for NAN value and + * returns false for other value<p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code>getNotANumber</code> : to have the current NAN value </li> + * </ul> + */ + public void _isNotANumber() { + requiredMethod("getNotANumber()"); + result = true; + + result = (oObj.isNotANumber(nan) && !oObj.isNotANumber(nan + 1)); + + tRes.tested("isNotANumber()", result); + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + + class MyEventListener implements XChartDataChangeEventListener { + public void disposing(EventObject oEvent) { + System.out.println("Listener1 disposed"); + } + + public void chartDataChanged(ChartDataChangeEvent ev) { + dataChanged[0] = true; + } + } + + class MyEventListener2 implements XChartDataChangeEventListener { + public void disposing(EventObject oEvent) { + System.out.println("Listener2 disposed"); + } + + public void chartDataChanged(ChartDataChangeEvent ev) { + dataChanged[1] = true; + } + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java b/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java new file mode 100644 index 000000000..5021657ea --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java @@ -0,0 +1,240 @@ +/* + * 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.chart; + +import com.sun.star.beans.XPropertySet; +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.chart.XChartDataArray; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.chart.XChartDataArray</code> +* interface methods : +* <ul> +* <li><code> getColumnDescriptions()</code></li> +* <li><code> getData()</code></li> +* <li><code> getRowDescriptions()</code></li> +* <li><code> setColumnDescriptions()</code></li> +* <li><code> setData()</code></li> +* <li><code> setRowDescriptions()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XChartDataArray +*/ +public class _XChartDataArray extends MultiMethodTest { + + public XChartDataArray oObj = null; + boolean bResult = true; + String[] colDscs = new String[3]; + String[] rowDscs = new String[3]; + double[][] data = null; + private boolean mbExcludeSetRowAndSetColumn = false; + private String msExcludeMessage; + + @Override + protected void before() { + Object o = tEnv.getObjRelation("CRDESC"); + if (o != null) { + mbExcludeSetRowAndSetColumn = true; + msExcludeMessage = (String)o; + } + if (mbExcludeSetRowAndSetColumn) { + return; + } + XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oObj); + if(xProp != null) { + try { + boolean columnAsLabel = ((Boolean)xProp.getPropertyValue("ChartColumnAsLabel")).booleanValue(); + boolean rowAsLabel = ((Boolean)xProp.getPropertyValue("ChartRowAsLabel")).booleanValue(); + if (!columnAsLabel) { + xProp.setPropertyValue("ChartColumnAsLabel", Boolean.TRUE); + } + if (!rowAsLabel) { + xProp.setPropertyValue("ChartRowAsLabel", Boolean.TRUE); + } + } + catch(Exception e) { + // ignore + } + } + } + + /** + * Test calls the method and restores new values. <p> + * Has <b> OK </b> status if the method successfully returns. <p> + */ + public void _setColumnDescriptions() { + bResult = true; + + colDscs = oObj.getColumnDescriptions(); + if (mbExcludeSetRowAndSetColumn) { + log.println(msExcludeMessage); + throw new StatusException(Status.skipped(true)); + } + for (int i = 0; i < colDscs.length; i++) { + colDscs[i] = "Col" + i; + } + oObj.setColumnDescriptions(colDscs); + + tRes.tested("setColumnDescriptions()", bResult); + } + + /** + * Test calls the method and restores new values. <p> + * Has <b> OK </b> status if the method successfully returns. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setColumnDescriptions </code></li> + * </ul> + */ + public void _setRowDescriptions() { + bResult = true; + + rowDscs = oObj.getRowDescriptions(); + if (mbExcludeSetRowAndSetColumn) { + log.println(msExcludeMessage); + throw new StatusException(Status.skipped(true)); + } + for (int i = 0; i < rowDscs.length; i++) { + rowDscs[i] = "Row" + i; + } + oObj.setRowDescriptions(rowDscs); + + tRes.tested("setRowDescriptions()", bResult); + } + + /** + * Test calls the method and restores new values. <p> + * Has <b> OK </b> status if the method successfully returns. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setRowDescriptions </code></li> + * </ul> + */ + public void _setData() { + rowDscs = oObj.getRowDescriptions(); + colDscs = oObj.getColumnDescriptions(); + + bResult = true; + double[][] _data = oObj.getData(); + data = _data; + if(rowDscs.length != 0 && rowDscs.length != data.length) + bResult = false; + if(colDscs.length != 0 && colDscs.length != data[0].length) + bResult = false; + for (int i = 0; i < data.length; i++) { + for (int j = 0; j < data[i].length; j++) + data[i][j] = i * (j + 1); + } + oObj.setData(data); + + tRes.tested("setData()", bResult); + } + + /** + * Test calls the method and compare returned values with values restored + * after method <code>setColumnDescriptions</code>. <p> + * Has <b> OK </b> status if the returned values equils to restored values. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setData </code> : to set and restore new values </li> + * </ul> + */ + public void _getColumnDescriptions() { + requiredMethod("setColumnDescriptions()"); + + String[] dscs = oObj.getColumnDescriptions(); + bResult = dscs.length == colDscs.length; + if (bResult) { + for (int i = 0; i < dscs.length; i++) { + log.println("Col " + i + ": got " + dscs[i] + " expected: " + colDscs[i]); + if (!dscs[i].equals(colDscs[i])) { + bResult = false; + } + } + } + + tRes.tested("getColumnDescriptions()", bResult); + } + + /** + * Test calls the method and compare returned values with values restored + * after method <code>setRowDescriptions</code>. <p> + * Has <b> OK </b> status if the returned values equils to restored values. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setData </code> : to set and restore new values </li> + * </ul> + */ + public void _getRowDescriptions() { + requiredMethod("setRowDescriptions()"); + + String[] dscs = oObj.getRowDescriptions(); + bResult = dscs.length == rowDscs.length; + if (bResult) { + for (int i = 0; i < dscs.length; i++) { + log.println("Row " + i + ": got " + dscs[i] + " expected: " + rowDscs[i]); + if (!dscs[i].equals(rowDscs[i])) { + bResult = false; + } + } + } + + tRes.tested("getRowDescriptions()", bResult); + } + + /** + * Test calls the method and compare returned values with values restored + * after method <code>setData</code>. <p> + * Has <b> OK </b> status if the returned values equils to restored values. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> setData </code> : to set and restore new values </li> + * </ul> + */ + public void _getData() { + requiredMethod("setData()"); + bResult = true; + + double[][] _data = oObj.getData(); + data = _data; + if(rowDscs.length != 0 && rowDscs.length != data.length) + bResult = false; + if(colDscs.length != 0 && colDscs.length != data[0].length) + bResult = false; + for (int i = 0; i < data.length; i++) { + for (int j = 0; j < data[i].length; j++) { + if (data[i][j] != _data[i][j]) { + bResult = false; + } + } + } + + tRes.tested("getData()", bResult); + } + + @Override + protected void after() { + disposeEnvironment(); + } +} + + diff --git a/qadevOOo/tests/java/ifc/chart/_XChartDocument.java b/qadevOOo/tests/java/ifc/chart/_XChartDocument.java new file mode 100644 index 000000000..87fe405c5 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XChartDocument.java @@ -0,0 +1,154 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XChartData; +import com.sun.star.chart.XChartDocument; +import com.sun.star.chart.XDiagram; +import com.sun.star.drawing.XShape; + +/** +* Testing <code>com.sun.star.chart.XChartDocument</code> +* interface methods : +* <ul> +* <li><code> getTitle()</code></li> +* <li><code> getSubTitle()</code></li> +* <li><code> getLegend()</code></li> +* <li><code> getArea()</code></li> +* <li><code> getDiagram()</code></li> +* <li><code> setDiagram()</code></li> +* <li><code> getData()</code></li> +* <li><code> attachData()</code></li> +* </ul> <p> +* +* This test needs the following object relations : +* <ul> +* <li> <code>'DIAGRAM'</code> (of type <code>XDiagram</code>): +* is used as parameter for method <code>setDiagram</code> </li> +* <li> <code>'CHARTDATA'</code> (of type <code>XChartData</code>): +* is used as parameter for method <code>attachData</code> </li> +* </ul> +* +* @see com.sun.star.chart.XChartDocument +*/ +public class _XChartDocument extends MultiMethodTest { + + public XChartDocument oObj = null; + XDiagram diagram = null; + XChartData ChartData = null; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getTitle() { + XShape title = oObj.getTitle(); + tRes.tested("getTitle()", title != null); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getSubTitle() { + XShape subtitle = oObj.getSubTitle(); + tRes.tested("getSubTitle()", subtitle != null); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getLegend() { + XShape legend = oObj.getLegend(); + tRes.tested("getLegend()", legend != null); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getArea() { + XPropertySet area = oObj.getArea(); + tRes.tested("getArea()", area != null); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getDiagram() { + diagram = oObj.getDiagram(); + tRes.tested("getDiagram()", diagram != null); + } + + /** + * Test compares type of diagram before method call and after.<p> + * Has <b> OK </b> status if diagram types are not equal. <p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getDiagram </code> : to have diagram before method call</li> + * </ul> + * + * @see com.sun.star.chart.XDiagram + */ + public void _setDiagram() { + requiredMethod("getDiagram()"); + String oldType = diagram.getDiagramType(); + XDiagram diag = (XDiagram)tEnv.getObjRelation("DIAGRAM"); + oObj.setDiagram(diag); + String newType = oObj.getDiagram().getDiagramType(); + tRes.tested("setDiagram()", !(oldType.equals(newType))); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getData() { + ChartData = oObj.getData(); + tRes.tested("getData()", ChartData != null); + } + + /** + * Test compares data before method call and after. <p> + * Has <b> OK </b> status if the data before method call and + * after are not equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getData </code> : to have data before method call </li> + * </ul> + * @see com.sun.star.chart.XChartData + */ + public void _attachData() { + requiredMethod("getData()"); + XChartData data = (XChartData)tEnv.getObjRelation("CHARTDATA"); + oObj.attachData(data); + XChartData newdata = oObj.getData(); + + tRes.tested("attachData()", !(newdata.equals(ChartData))); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/chart/_XDiagram.java b/qadevOOo/tests/java/ifc/chart/_XDiagram.java new file mode 100644 index 000000000..de51ea2e1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XDiagram.java @@ -0,0 +1,148 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XDiagram; + +/** +* Testing <code>com.sun.star.chart.XDiagram</code> +* interface methods : +* <ul> +* <li><code> getDiagramType()</code></li> +* <li><code> getDataRowProperties()</code></li> +* <li><code> getDataPointProperties()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'ROWAMOUNT'</code> (of type <code>Integer</code>): +* to have amount of rows </li> +* <li> <code>'COLAMOUNT'</code> (of type <code>Integer</code>): +* to have amount of columns </li> +* <ul> <p> +* @see com.sun.star.chart.XDiagram +*/ +public class _XDiagram extends MultiMethodTest { + + public XDiagram oObj = null; + boolean result = true; + Integer rowamount = null; + Integer colamount = null; + + /** + * Retrieves object relations. + * @throws StatusException If one of relations not found. + */ + @Override + public void before() { + rowamount = (Integer)tEnv.getObjRelation("ROWAMOUNT"); + if (rowamount == null) throw new StatusException(Status.failed + ("Relation 'ROWAMOUNT' not found")); + + colamount = (Integer)tEnv.getObjRelation("COLAMOUNT"); + if (colamount == null) throw new StatusException(Status.failed + ("Relation 'COLAMOUNT' not found")); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value start from 'com.sun.star.chart.' <p> + */ + public void _getDiagramType() { + result = true; + + String stype = oObj.getDiagramType(); + log.println("Current Diagram Type is " + stype); + result = stype.startsWith("com.sun.star.chart."); + + tRes.tested("getDiagramType()", result); + } + + /** + * Test calls the method for every row and checks returned value. <p> + * Has <b> OK </b> status if returned value for every row isn't null and + * no exceptions were thrown. <p> + */ + public void _getDataRowProperties() { + result = true; + + int rows = rowamount.intValue(); + rows -= 1; + XPropertySet props = null; + + log.println("There are " + rows + " rows."); + try { + for (int i = 0; i < rows; i++) { + props = oObj.getDataRowProperties(i); + if (props != null) { + log.println("Row " + i + " - OK"); + } else { + log.println("Row " + i + " - FAILED"); + result = false; + } + } + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Exception while get data row properties"); + e.printStackTrace(log); + result = false; + } + + tRes.tested("getDataRowProperties()", result); + } + + /** + * Test calls the method for every point and checks returned value. <p> + * Has <b> OK </b> status if returned value for every point isn't null and + * no exceptions were thrown. <p> + */ + public void _getDataPointProperties() { + result = true; + + int rows = rowamount.intValue(); + int cols = colamount.intValue(); + XPropertySet props = null; + + log.println("There are " + rows + " rows and " + cols + " cols."); + + try { + for (int i = 0; i < rows; i++) + for (int j = 0; j < cols; j++) { + props = oObj.getDataPointProperties(i, j); + if (props != null) { + log.println("Row " + i + " Col " + j + " - OK"); + } else { + log.println("Row " + i + " Col " + j + " - FAILED"); + result = false; + } + } + } catch(com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Exception while get data point properties"); + e.printStackTrace(log); + result = false; + } + + tRes.tested("getDataPointProperties()", result); + } +} + + diff --git a/qadevOOo/tests/java/ifc/chart/_XStatisticDisplay.java b/qadevOOo/tests/java/ifc/chart/_XStatisticDisplay.java new file mode 100644 index 000000000..779183856 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XStatisticDisplay.java @@ -0,0 +1,82 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XStatisticDisplay; + +/** +* Testing <code>com.sun.star.chart.XStatisticDisplay</code> +* interface methods : +* <ul> +* <li><code> getMinMaxLine()</code></li> +* <li><code> getUpBar()</code></li> +* <li><code> getDownBar()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XStatisticDisplay +*/ +public class _XStatisticDisplay extends MultiMethodTest { + + public XStatisticDisplay oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getMinMaxLine() { + result = true; + + XPropertySet MinMaxLine = oObj.getMinMaxLine(); + result = (MinMaxLine != null); + + tRes.tested("getMinMaxLine()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getUpBar() { + result = true; + + XPropertySet UpBar = oObj.getUpBar(); + result = (UpBar != null); + + tRes.tested("getUpBar()", result); + } + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getDownBar() { + result = true; + + XPropertySet DownBar = oObj.getDownBar(); + result = (DownBar != null); + + tRes.tested("getDownBar()", result); + } + +} // EOF XStatisticDisplay + + diff --git a/qadevOOo/tests/java/ifc/chart/_XTwoAxisXSupplier.java b/qadevOOo/tests/java/ifc/chart/_XTwoAxisXSupplier.java new file mode 100644 index 000000000..488181108 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XTwoAxisXSupplier.java @@ -0,0 +1,54 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XTwoAxisXSupplier; + +/** +* Testing <code>com.sun.star.chart.XTwoAxisXSupplier</code> +* interface methods : +* <ul> +* <li><code> getSecondaryXAxis()</code></li> +* </ul> <p> +* @see com.sun.star.chart.XTwoAxisXSupplier +*/ +public class _XTwoAxisXSupplier extends MultiMethodTest { + + public XTwoAxisXSupplier oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getSecondaryXAxis() { + result = true; + + XPropertySet SecXAxis = oObj.getSecondaryXAxis(); + result = (SecXAxis != null); + + tRes.tested("getSecondaryXAxis()", result); + } + +} // EOF XTwoAxisXSupplier + + diff --git a/qadevOOo/tests/java/ifc/chart/_XTwoAxisYSupplier.java b/qadevOOo/tests/java/ifc/chart/_XTwoAxisYSupplier.java new file mode 100644 index 000000000..bc88bdc72 --- /dev/null +++ b/qadevOOo/tests/java/ifc/chart/_XTwoAxisYSupplier.java @@ -0,0 +1,63 @@ +/* + * 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.chart; + +import lib.MultiMethodTest; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.chart.XTwoAxisYSupplier; + +/** +* Testing <code>com.sun.star.chart.XTwoAxisYSupplier</code> +* interface methods : +* <ul> +* <li><code> getSecondaryYAxis()</code></li> +* </ul> <p> +* After test completion object environment has to be recreated. +* @see com.sun.star.chart.XTwoAxisYSupplier +*/ +public class _XTwoAxisYSupplier extends MultiMethodTest { + + public XTwoAxisYSupplier oObj = null; + boolean result = true; + + /** + * Test calls the method and checks returned value. <p> + * Has <b> OK </b> status if returned value isn't null. <p> + */ + public void _getSecondaryYAxis() { + result = true; + + XPropertySet SecYAxis = oObj.getSecondaryYAxis(); + result = (SecYAxis != null); + + tRes.tested("getSecondaryYAxis()", result); + } + + /** + * Forces object environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} // EOF XTwoAxisYSupplier + + |