diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /qadevOOo/tests/java/ifc/drawing | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qadevOOo/tests/java/ifc/drawing')
49 files changed, 3917 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor.java new file mode 100644 index 000000000..1bee62098 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_AreaShapeDescriptor.java @@ -0,0 +1,109 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +public class _AreaShapeDescriptor extends MultiPropertyTest { + + @Override + protected boolean compare(Object ob1, Object ob2) { + + return super.compare(ob1, ob2); + + } + + protected PropertyTester URLTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg"))) + return util.utils.getFullTestURL("crazy-blue.jpg"); else + return util.utils.getFullTestURL("space-metal.jpg"); + } + } ; + + protected PropertyTester StringTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(str1)) + return str2; else + return str1; + } + } ; + + public void _FillBitmapURL() { + log.println("Testing with custom Property tester") ; + testProperty("FillBitmapURL", URLTester) ; + } + + public String str1 = ""; + public String str2 = ""; + + public void _FillGradientName() { + log.println("Testing with custom Property tester") ; + str1 = "Gradient 1"; + str2 = "Gradient 3"; + testProperty("FillGradientName", StringTester) ; + } + + public void _FillBitmapName() { + log.println("Testing with custom Property tester") ; + str1 = "Sky"; + str2 = "Blank"; + testProperty("FillBitmapName", StringTester) ; + } + + public void _FillTransparenceGradientName() { + log.println("Testing with custom Property tester") ; + str1 = "Standard 1"; + str2 = "Standard 2"; + testProperty("FillTransparenceGradientName", StringTester) ; + } + + public void _FillHatchName() { + log.println("Testing with custom Property tester") ; + str1 = "Black 0 degrees"; + str2 = "Black 45 degrees"; + testProperty("FillHatchName", StringTester) ; + } + + public void _FillBitmapMode() { + log.println("Testing with custom Property tester") ; + try { + Object getting = oObj.getPropertyValue("FillBitmapMode"); + if (! (getting instanceof com.sun.star.drawing.BitmapMode)) { + log.println("getting the property 'FillBitmapMode'"); + log.println("return "+ oObj.getClass().getName()); + log.println("Expected was 'com.sun.star.drawing.BitmapMode'"); + tRes.tested("FillBitmapMode",false); + } else testProperty("FillBitmapMode"); + } + catch (Exception ex) { + log.println("Exception while checking 'FillBitmapMode'"); + ex.printStackTrace(log); + tRes.tested("FillBitmapMode",false); + } + + } + +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_ConnectorProperties.java b/qadevOOo/tests/java/ifc/drawing/_ConnectorProperties.java new file mode 100644 index 000000000..1cbe9f077 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ConnectorProperties.java @@ -0,0 +1,39 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.ConnectorProperties</code> +* service properties : +* <ul> +* <li><code> EdgeKind</code></li> +* <li><code> EdgeNode1HorzDist</code></li> +* <li><code> EdgeNode1VertDist</code></li> +* <li><code> EdgeNode2HorzDist</code></li> +* <li><code> EdgeNode2VertDist</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.ConnectorProperties +*/ +public class _ConnectorProperties extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_ConnectorShape.java b/qadevOOo/tests/java/ifc/drawing/_ConnectorShape.java new file mode 100644 index 000000000..d338126d7 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ConnectorShape.java @@ -0,0 +1,70 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +import com.sun.star.drawing.XShape; +/** +* Testing <code>com.sun.star.drawing.ConnectorShape</code> +* service properties : +* <ul> +* <li><code> EdgeLine1Delta</code></li> +* <li><code> EdgeLine2Delta</code></li> +* <li><code> EdgeLine3Delta</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.ConnectorShape +*/ +public class _ConnectorShape extends MultiPropertyTest { + public XShape[] conShapes = null; + + @Override + protected void before() { + conShapes = (XShape[]) tEnv.getObjRelation("XConnectorShape.Shapes"); + } + + public void _EndShape() { + Object oldProp = null; + try { + oldProp = oObj.getPropertyValue("EndShape"); + } catch (com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(); + } + testProperty("EndShape",oldProp,conShapes[0]); + } + + public void _StartShape() { + Object oldProp = null; + log.println("Special for StartShape"); + try { + oldProp = oObj.getPropertyValue("StartShape"); + } catch (com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(); + } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(); + } + testProperty("StartShape",oldProp,conShapes[1]); + } + + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_ConnectorShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_ConnectorShapeDescriptor.java new file mode 100644 index 000000000..99f974b49 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ConnectorShapeDescriptor.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.drawing; + +import lib.MultiPropertyTest; + +public class _ConnectorShapeDescriptor extends MultiPropertyTest { + + @Override + protected boolean compare(Object ob1, Object ob2) { + + return super.compare(ob1, ob2); + + } + +} // finish class _ConnectorShapeDescriptor + + + diff --git a/qadevOOo/tests/java/ifc/drawing/_DimensioningShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_DimensioningShapeDescriptor.java new file mode 100644 index 000000000..ef55d860e --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_DimensioningShapeDescriptor.java @@ -0,0 +1,39 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + + +public class _DimensioningShapeDescriptor extends MultiPropertyTest { + +/* + protected PropertyTester lengthTester = new PropertyTester() { + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + + int val = ((Integer)oldValue).intValue() ; + return Integer.valueOf(val + 100) ; + } + } ; +*/ + +} // finish class _ParagraphProperties + + diff --git a/qadevOOo/tests/java/ifc/drawing/_DrawingDocument.java b/qadevOOo/tests/java/ifc/drawing/_DrawingDocument.java new file mode 100644 index 000000000..a0df35bcb --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_DrawingDocument.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.DrawingDocument</code> +* service properties : +* <ul> +* <li><code> TabStop</code></li> +* <li><code> CharLocale</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.DrawingDocument +*/ +public class _DrawingDocument extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java b/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java new file mode 100644 index 000000000..597e44cee --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java @@ -0,0 +1,172 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +import com.sun.star.container.XNamed; +import com.sun.star.drawing.XDrawPage; +import com.sun.star.uno.UnoRuntime; +import util.ValueChanger; + +/** +* Testing <code>com.sun.star.drawing.DrawingDocumentDrawView</code> +* service properties : +* <ul> +* <li><code> IsMasterPageMode</code></li> +* <li><code> IsLayerMode</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'DrawPage'</code> (of type <code>XDrawPage</code>): +* a draw page which will be current page. </li> +* <ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.DrawingDocumentDrawView +*/ +public class _DrawingDocumentDrawView extends MultiPropertyTest { + + XDrawPage drawPage = null; + static String test_name = "For DrawingDocumentDrawView"; + + @Override + protected void before() { + drawPage = (XDrawPage)tEnv.getObjRelation("DrawPage"); + XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, drawPage); + xNamed.setName(test_name); + } + + /** + * Property tester which returns new <code>XDrawPage</code> object + * and compares draw pages. + */ + protected PropertyTester CurPageTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + return drawPage; + } + + @Override + protected boolean compare(Object obj1, Object obj2) { + XNamed named1 = UnoRuntime.queryInterface(XNamed.class, obj1); + XNamed named2 = UnoRuntime.queryInterface(XNamed.class, obj2); + boolean res = false; + + if (named1 != null && named2 != null) { + String name1 = named1.getName(); + String name2 = named2.getName(); + res = name1.equals(name2); + } else { + log.println("Interface XNamed not supported"); + } + + return res; + } + + @Override + protected String toString(Object obj) { + XNamed named = UnoRuntime.queryInterface(XNamed.class, obj); + String res = (named == null) ? "null" : named.getName(); + return res; + } + } ; + + public void _CurrentPage() { + log.println("Testing with custom Property tester"); + Object oldCurPage = null; + try { + oldCurPage = oObj.getPropertyValue("CurrentPage"); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } + + testProperty("CurrentPage", CurPageTester); + + try { + log.println("Back old current page"); + oObj.setPropertyValue("CurrentPage", oldCurPage); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(log); + } + } + + public void _IsMasterPageMode() { + testProperty("IsMasterPageMode"); + try { + oObj.setPropertyValue("IsMasterPageMode", Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(log); + } + } + + public void _IsLayerMode() { + testProperty("IsLayerMode"); + try { + oObj.setPropertyValue("IsLayerMode", Boolean.FALSE); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(log); + } + } + + public void _ZoomType() { + Object oldValue=null; + Object newValue=null; + try { + oldValue = oObj.getPropertyValue("ZoomValue"); + Object oldZoom = oObj.getPropertyValue("ZoomType"); + Object newZoom = ValueChanger.changePValue(oldZoom); + oObj.setPropertyValue("ZoomType", newZoom); + newValue = oObj.getPropertyValue("ZoomValue"); + } catch(com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace(log); + } catch(com.sun.star.beans.PropertyVetoException e) { + e.printStackTrace(log); + } + log.println("oldZoomValue: "+oldValue); + log.println("newZoomValue: "+newValue); + if (oldValue != null) + tRes.tested("ZoomType",(!oldValue.equals(newValue))); + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_EllipseShape.java b/qadevOOo/tests/java/ifc/drawing/_EllipseShape.java new file mode 100644 index 000000000..7cc84ea12 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_EllipseShape.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.EllipseShape</code> +* service properties : +* <ul> +* <li><code> CircleKind</code></li> +* <li><code> CircleStartAngle</code></li> +* <li><code> CircleEndAngle</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.EllipseShape +*/ +public class _EllipseShape extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_EllipseShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_EllipseShapeDescriptor.java new file mode 100644 index 000000000..d291a9e9c --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_EllipseShapeDescriptor.java @@ -0,0 +1,27 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + + +public class _EllipseShapeDescriptor extends MultiPropertyTest { + +} // finish class _EllipseShapeDescriptor + diff --git a/qadevOOo/tests/java/ifc/drawing/_FillProperties.java b/qadevOOo/tests/java/ifc/drawing/_FillProperties.java new file mode 100644 index 000000000..f4e64d7b5 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_FillProperties.java @@ -0,0 +1,213 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.drawing; + +import com.sun.star.beans.XPropertySetInfo; +import lib.MultiPropertyTest; + +import com.sun.star.awt.XBitmap; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + +/** + * Testing <code>com.sun.star.drawing.FillProperties</code> + * service properties : + * <ul> + * <li><code> FillStyle</code></li> + * <li><code> FillColor</code></li> + * <li><code> FillTransparence</code></li> + * <li><code> FillTransparenceGradientName</code></li> + * <li><code> FillTransparenceGradient</code></li> + * <li><code> FillGradientName</code></li> + * <li><code> FillGradient</code></li> + * <li><code> FillHatchName</code></li> + * <li><code> FillHatch</code></li> + * <li><code> FillBitmapName</code></li> + * <li><code> FillBitmap</code></li> + * <li><code> FillBitmapURL</code></li> + * <li><code> FillBitmapOffsetX</code></li> + * <li><code> FillBitmapOffsetY</code></li> + * <li><code> FillBitmapPositionOffsetX</code></li> + * <li><code> FillBitmapPositionOffsetY</code></li> + * <li><code> FillBitmapRectanglePoint</code></li> + * <li><code> FillBitmapLogicalSize</code></li> + * <li><code> FillBitmapSizeX</code></li> + * <li><code> FillBitmapSizeY</code></li> + * <li><code> FillBitmapMode</code></li> + * <li><code> FillBackground</code></li> + * </ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.drawing.FillProperties + */ +public class _FillProperties extends MultiPropertyTest { + + XBitmap the_bitmap = null; + XBitmap the_secondBitmap = null; + /** + * Property tester which changes URL. + */ + protected PropertyTester URLTester = new PropertyTester() { + + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg"))) { + return util.utils.getFullTestURL("crazy-blue.jpg"); + } else { + return util.utils.getFullTestURL("space-metal.jpg"); + } + } + }; + /** + * Property tester which switches two strings. + */ + protected PropertyTester StringTester = new PropertyTester() { + + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(str1)) { + return str2; + } else { + return str1; + } + } + }; + /** + * Property tester which switches two XBitmap objects. + */ + protected PropertyTester BitmapTester = new PropertyTester() { + + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (util.ValueComparer.equalValue(oldValue, the_bitmap)) { + return the_secondBitmap; + } else { + return the_bitmap; + } + } + }; + + /** + * This property must have a URL format + */ + public void _FillBitmapURL() { + log.println("Testing with custom Property tester"); + testProperty("FillBitmapURL", URLTester); + } + public String str1 = ""; + public String str2 = ""; + + /** + * This property must have predefined values + */ + public void _FillGradientName() { + log.println("Testing with custom Property tester"); + str1 = "Gradient 1"; + str2 = "Gradient 3"; + testProperty("FillGradientName", StringTester); + } + + /** + * This property must have predefined values + */ + public void _FillBitmapName() { + log.println("Testing with custom Property tester"); + str1 = "Sky"; + str2 = "Blank"; + testProperty("FillBitmapName", StringTester); + } + + /** + * This property must have predefined values + */ + public void _FillTransparenceGradientName() { + log.println("Testing with custom Property tester"); + str1 = "Transparency 2"; + str2 = "Transparency 1"; + testProperty("FillTransparenceGradientName", StringTester); + } + + /** + * This property must have predefined values + */ + public void _FillHatchName() { + log.println("Testing with custom Property tester"); + str1 = "Black 0 degrees"; + str2 = "Black 45 degrees"; + testProperty("FillHatchName", StringTester); + } + + /** + * This property is very interesting. After setting URL of bitmap you get + * <code>XBitmap</code> interface of the image file specified. + * The method first gets two different bitmaps and then tests the property. + */ + public void _FillBitmap() { + + String propName = "FillBitmap"; + + XPropertySetInfo info = oObj.getPropertySetInfo(); + + if (!info.hasPropertyByName(propName)) { + if (isOptional(propName)) { + // skipping optional property test + log.println("Property '" + propName + "' is optional and not supported"); + tRes.tested(propName, true); + return; + } + } else { + + try { + + oObj.setPropertyValue("FillBitmapURL", util.utils.getFullTestURL("crazy-blue.jpg")); + + the_bitmap = (XBitmap) AnyConverter.toObject( + new Type(XBitmap.class), oObj.getPropertyValue("FillBitmap")); + + oObj.setPropertyValue("FillBitmapURL", util.utils.getFullTestURL("space-metal.jpg")); + + the_secondBitmap = (XBitmap) AnyConverter.toObject( + new Type(XBitmap.class), oObj.getPropertyValue("FillBitmap")); + + testProperty("FillBitmap", BitmapTester); + + } catch (com.sun.star.beans.PropertyVetoException e) { + log.println("Couldn't change Bitmap"); + e.printStackTrace(log); + tRes.tested("FillBitmap", false); + + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("Couldn't change Bitmap"); + e.printStackTrace(log); + tRes.tested("FillBitmap", false); + + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Couldn't change Bitmap"); + e.printStackTrace(log); + tRes.tested("FillBitmap", false); + + } catch (com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't change Bitmap"); + e.printStackTrace(log); + tRes.tested("FillBitmap", false); + } + } + } + } diff --git a/qadevOOo/tests/java/ifc/drawing/_GenericDrawPage.java b/qadevOOo/tests/java/ifc/drawing/_GenericDrawPage.java new file mode 100644 index 000000000..71cfb5688 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_GenericDrawPage.java @@ -0,0 +1,87 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + + +/** +* Testing <code>com.sun.star.drawing.GenericDrawPage</code> +* service properties : +* <ul> +* <li><code> BorderBottom</code></li> +* <li><code> BorderLeft</code></li> +* <li><code> BorderRight</code></li> +* <li><code> BorderTop</code></li> +* <li><code> Height</code></li> +* <li><code> Width</code></li> +* <li><code> Number</code></li> +* <li><code> Orientation</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.GenericDrawPage +*/ +public class _GenericDrawPage extends MultiPropertyTest { + + public void _Number() { + log.println("Number started"); + boolean res = false; + log.println("trying to get the value"); + try { + Short wat = (Short) oObj.getPropertyValue("Number"); + if (wat == null) { + log.println("it is null"); + } else { + log.println("it isn't null"); + res=true; + } + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("an UnknownPropertyException occurred"); + + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("an WrappedTargetException occurred"); + } + + tRes.tested("Number",res); + } + + public void _UserDefinedAttributes() { + log.println("Userdefined started"); + boolean res = false; + log.println("trying to get the value"); + try { + Object wat = oObj.getPropertyValue("UserDefinedAttributes"); + if (wat == null) { + log.println("it is null"); + } else { + log.println("it isn't null"); + res=true; + } + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("an UnknownPropertyException occurred"); + + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("an WrappedTargetException occurred"); + } + + tRes.tested("UserDefinedAttributes",res); + } + +} // end of GenericDrawPage + diff --git a/qadevOOo/tests/java/ifc/drawing/_GenericDrawingDocument.java b/qadevOOo/tests/java/ifc/drawing/_GenericDrawingDocument.java new file mode 100644 index 000000000..2e72d03d8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_GenericDrawingDocument.java @@ -0,0 +1,25 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +public class _GenericDrawingDocument extends MultiPropertyTest { + +} diff --git a/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShape.java b/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShape.java new file mode 100644 index 000000000..dfbde7de1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShape.java @@ -0,0 +1,157 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +import com.sun.star.awt.XBitmap; +import com.sun.star.container.XIndexContainer; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.GraphicObjectShape</code> +* service properties : +* <ul> +* <li><code> GraphicURL</code></li> +* <li><code> GraphicStreamURL</code></li> +* <li><code> GraphicObjectFillBitmap</code></li> +* <li><code> AdjustLuminance</code></li> +* <li><code> AdjustContrast</code></li> +* <li><code> AdjustRed</code></li> +* <li><code> AdjustGreen</code></li> +* <li><code> AdjustBlue</code></li> +* <li><code> Gamma</code></li> +* <li><code> Transparency</code></li> +* <li><code> GraphicColorMode</code></li> +* <li><code> ImageMap</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Bitmap1', 'Bitmap2'</code> (of type <code>XBitmap</code>): +* values to be set for property GraphicObjectFillBitmap </li> +* <li> <code>'IMAP'</code> +* (<code>com.sun.star.image.ImageMapRectangleObject</code> service instance): +* is used to be added to ImageMap container.</li> +* <ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.GraphicObjectShape +*/ +public class _GraphicObjectShape extends MultiPropertyTest { + + /** + * Property tester which changes URL. + */ + protected PropertyTester URLTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg"))) + return util.utils.getFullTestURL("crazy-blue.jpg"); else + return util.utils.getFullTestURL("space-metal.jpg"); + } + } ; + + /** + * Property tester which switches two XBitmap objects. + * It also uses two object relations with bitmaps. + */ + protected PropertyTester BitmapTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue){ + XBitmap aBitmap1=(XBitmap) tEnv.getObjRelation("Bitmap1"); + XBitmap aBitmap2=(XBitmap) tEnv.getObjRelation("Bitmap2"); + if (oldValue.equals(aBitmap1)) return aBitmap2; + else return aBitmap1; + } + } ; + + /** + * This property must have URL format + */ + public void _GraphicURL() { + log.println("Testing with custom Property tester") ; + testProperty("GraphicURL", URLTester) ; + } + + public void _GraphicStreamURL() { + log.println("Testing with custom Property tester") ; + testProperty("GraphicStreamURL", URLTester) ; + } + + public void _GraphicObjectFillBitmap() { + log.println("Testing with custom Property tester") ; + testProperty("GraphicObjectFillBitmap", BitmapTester) ; + } + + /** + * The test first retrieves ImageMap relation, then inserts it + * to the current container. + */ + public void _ImageMap() { + if (! util.utils.hasPropertyByName(oObj,"ImageMap")) { + log.println("optional property 'ImageMap' isn't available"); + tRes.tested("ImageMap",true); + return; + } + try { + boolean result = true; + Object imapObject = tEnv.getObjRelation("ImapObject"); + + if ( imapObject == null){ + System.out.println("ERROR: object relation 'ImapObject' isn't available"); + tRes.tested("ImageMap", false); + return; + } + + Object o = oObj.getPropertyValue("ImageMap"); + XIndexContainer xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, o); + util.dbg.printInterfaces(xIndexContainer); + int elementCountFirst = xIndexContainer.getCount(); + xIndexContainer.insertByIndex(elementCountFirst, imapObject); + + // this does not really change the property: the implementation + // behind "ImageMap" stays the same, but for a real change a C++ + // implementation is needed. See css.lang.XUnoTunnel + oObj.setPropertyValue("ImageMap", xIndexContainer); + Object newObject = oObj.getPropertyValue("ImageMap"); + xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, newObject); + + int elementCountSecond = xIndexContainer.getCount(); + result = (elementCountFirst + 1 == elementCountSecond); + + tRes.tested("ImageMap", result); + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while checking 'ImageMap'"); + e.printStackTrace(log); + tRes.tested("ImageMap",false); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while checking 'ImageMap'"); + e.printStackTrace(log); + tRes.tested("ImageMap",false); + } catch (com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while checking 'ImageMap'"); + e.printStackTrace(log); + tRes.tested("ImageMap",false); + } + catch(Exception e) { + e.printStackTrace(log); + } + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShapeDescriptor.java new file mode 100644 index 000000000..830a065d4 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_GraphicObjectShapeDescriptor.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.drawing; + +import lib.MultiPropertyTest; + +import com.sun.star.awt.XBitmap; + +public class _GraphicObjectShapeDescriptor extends MultiPropertyTest { + + @Override + protected boolean compare(Object ob1, Object ob2) { + + return super.compare(ob1, ob2); + + } + + protected PropertyTester URLTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg"))) + return util.utils.getFullTestURL("crazy-blue.jpg"); else + return util.utils.getFullTestURL("space-metal.jpg"); + } + } ; + + protected PropertyTester BitmapTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + XBitmap aBitmap1=(XBitmap) tEnv.getObjRelation("Bitmap1"); + XBitmap aBitmap2=(XBitmap) tEnv.getObjRelation("Bitmap2"); + if (oldValue.equals(aBitmap1)) return aBitmap2; else return aBitmap1; + } + } ; + + public void _GraphicURL() { + log.println("Testing with custom Property tester") ; + testProperty("GraphicURL", URLTester) ; + } + + public void _GraphicObjectFillBitmap() { + log.println("Testing with custom Property tester") ; + testProperty("GraphicObjectFillBitmap", BitmapTester) ; + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_Layer.java b/qadevOOo/tests/java/ifc/drawing/_Layer.java new file mode 100644 index 000000000..c11b39cd4 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_Layer.java @@ -0,0 +1,38 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.Layer</code> +* service properties : +* <ul> +* <li><code> Name</code></li> +* <li><code> IsVisible</code></li> +* <li><code> IsPrintable</code></li> +* <li><code> IsLocked</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.Layer +*/ +public class _Layer extends MultiPropertyTest { + +}// end of _Layer.java + diff --git a/qadevOOo/tests/java/ifc/drawing/_LineProperties.java b/qadevOOo/tests/java/ifc/drawing/_LineProperties.java new file mode 100644 index 000000000..d37d6506d --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_LineProperties.java @@ -0,0 +1,77 @@ +/* + * 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.drawing; + +import com.sun.star.drawing.LineDash; +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.LineProperties</code> +* service properties : +* <ul> +* <li><code> LineStyle</code></li> +* <li><code> LineDash</code></li> +* <li><code> LineColor</code></li> +* <li><code> LineTransparence</code></li> +* <li><code> LineWidth</code></li> +* <li><code> LineJoint</code></li> +* <li><code> LineStartName</code></li> +* <li><code> LineStart</code></li> +* <li><code> LineEnd</code></li> +* <li><code> LineStartCenter</code></li> +* <li><code> LineStartWidth</code></li> +* <li><code> LineEndCenter</code></li> +* <li><code> LineEndWidth</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.LineProperties +*/ +public class _LineProperties extends MultiPropertyTest { + + /** + * Tester used for property LineStartName which can have + * only predefined String values. + */ + protected PropertyTester LineTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (oldValue.equals("Arrow")) + return "Square"; else + return "Arrow"; + } + } ; + + /** + * The property switched between 'Square' and 'Arrow' values. + */ + public void _LineStartName() { + log.println("Testing with custom Property tester"); + testProperty("LineStartName", LineTester) ; + } + + public void _LineDash() { + LineDash aLineDash = new LineDash(); + LineDash aLineDash2 = new LineDash(); + aLineDash.DashLen = 5; + aLineDash2.DashLen = 1; + testProperty("LineDash",aLineDash,aLineDash2); + } +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_LineShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_LineShapeDescriptor.java new file mode 100644 index 000000000..a619b952f --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_LineShapeDescriptor.java @@ -0,0 +1,137 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; +import util.ValueChanger; + +import com.sun.star.awt.Point; +import com.sun.star.beans.XPropertySet; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.UnoRuntime; + + +public class _LineShapeDescriptor extends MultiMethodTest { + + public XPropertySet oObj = null; // oObj filled by MultiMethodTest + + + public void _LineColor() { + XServiceInfo xInfo = UnoRuntime.queryInterface(XServiceInfo.class, oObj); + if ( ! xInfo.supportsService + ("com.sun.star.drawing.LineShapeDescriptor")) { + log.println("Service not available !!!!!!!!!!!!!"); + tRes.tested("Supported", false); + } + changeProp("LineColor"); + } + + public void _LineDash() { + changeProp("LineDash"); + } + public void _LineEnd() { + changeProp("LineEnd"); + } + public void _LineEndCenter() { + changeProp("LineEndCenter"); + } + public void _LineEndWidth() { + changeProp("LineEndWidth"); + } + public void _LineJoint() { + changeProp("LineJoint"); + } + public void _LineStart() { + changeProp("LineStart"); + } + public void _LineStartCenter() { + changeProp("LineStartCenter"); + } + public void _LineStartWidth() { + changeProp("LineStartWidth"); + } + public void _LineStyle() { + changeProp("LineStyle"); + } + public void _LineTransparence() { + changeProp("LineTransparence"); + } + public void _LineWidth() { + changeProp("LineWidth"); + } + + public void changeProp(String name) { + + Object gValue = null; + Object sValue = null; + Object ValueToSet = null; + + try { + gValue = oObj.getPropertyValue(name); + if ( (name.equals("LineEnd")) || (name.equals("LineStart")) ) { + if (gValue == null) gValue = newPoints(null); + ValueToSet = newPoints( (Point[]) gValue); + } + else { + ValueToSet = ValueChanger.changePValue(gValue); + } + oObj.setPropertyValue(name,ValueToSet); + sValue = oObj.getPropertyValue(name); + + + //check get-set methods + if (gValue.equals(sValue)) { + log.println("Value for '"+name+"' hasn't changed"); + tRes.tested(name, false); + } + else { + log.println("Property '"+name+"' OK"); + tRes.tested(name, true); + } + } catch (Exception e) { + log.println("Exception occurred while testing property '" + + name + "'"); + e.printStackTrace(log); + tRes.tested(name, false); + } + + + } // end of ChangeProp + + public Point[] newPoints(Point[] old) { + + Point [] newP = new Point[3]; + + if (old == null) { + newP[0] = new Point(0, 2); + newP[1] = new Point(2, 0); + newP[2] = new Point(0, -2); + } + else { + newP = old; + newP[0].X += 1; + newP[1].X += 1; + newP[2].X += 1; + } + return newP; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_MeasureProperties.java b/qadevOOo/tests/java/ifc/drawing/_MeasureProperties.java new file mode 100644 index 000000000..9bc3d2aa2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_MeasureProperties.java @@ -0,0 +1,51 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.MeasureProperties</code> +* service properties : +* <ul> +* <li><code> MeasureBelowReferenceEdge</code></li> +* <li><code> MeasureHelpLine1Length</code></li> +* <li><code> MeasureHelpLine2Length</code></li> +* <li><code> MeasureHelpLineDistance</code></li> +* <li><code> MeasureHelpLineOverhang</code></li> +* <li><code> MeasureKind</code></li> +* <li><code> MeasureLineDistance</code></li> +* <li><code> MeasureOverhang</code></li> +* <li><code> MeasureShowUnit</code></li> +* <li><code> MeasureTextAutoAngle</code></li> +* <li><code> MeasureTextAutoAngleView</code></li> +* <li><code> MeasureTextFixedAngle</code></li> +* <li><code> MeasureTextHorizontalPosition</code></li> +* <li><code> MeasureTextVerticalPosition</code></li> +* <li><code> MeasureTextIsFixedAngle</code></li> +* <li><code> MeasureTextRotate90</code></li> +* <li><code> MeasureTextUpsideDown</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.MeasureProperties +*/ +public class _MeasureProperties extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_MeasureShape.java b/qadevOOo/tests/java/ifc/drawing/_MeasureShape.java new file mode 100644 index 000000000..bbac993d6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_MeasureShape.java @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.MeasureShape</code> +* service properties : +* <ul> +* <li><code> StartPosition</code></li> +* <li><code> EndPosition</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.MeasureShape +*/ +public class _MeasureShape extends MultiPropertyTest { + + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_PolyPolygonBezierDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_PolyPolygonBezierDescriptor.java new file mode 100644 index 000000000..340e7978f --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_PolyPolygonBezierDescriptor.java @@ -0,0 +1,38 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.PolyPolygonBezierDescriptor</code> +* service properties : +* <ul> +* <li><code> PolygonKind</code></li> +* <li><code> PolyPolygonBezier</code></li> +* <li><code> Geometry</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.PolyPolygonBezierDescriptor +*/ +public class _PolyPolygonBezierDescriptor extends MultiPropertyTest { + +} // finish class _PolyPolygonBezierDescriptor + + diff --git a/qadevOOo/tests/java/ifc/drawing/_PolyPolygonDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_PolyPolygonDescriptor.java new file mode 100644 index 000000000..ba9e8b097 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_PolyPolygonDescriptor.java @@ -0,0 +1,38 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.PolyPolygonDescriptor</code> +* service properties : +* <ul> +* <li><code> PolygonKind</code></li> +* <li><code> PolyPolygon</code></li> +* <li><code> Geometry</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.PolyPolygonDescriptor +*/ +public class _PolyPolygonDescriptor extends MultiPropertyTest { + +} // finish class _PolyPolygonDescriptor + + diff --git a/qadevOOo/tests/java/ifc/drawing/_RotationDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_RotationDescriptor.java new file mode 100644 index 000000000..85db87e12 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_RotationDescriptor.java @@ -0,0 +1,94 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; +import lib.Status; + +/** +* Testing <code>com.sun.star.drawing.RotationDescriptor</code> +* service properties : +* <ul> +* <li><code> RotateAngle</code></li> +* <li><code> ShearAngle</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.RotationDescriptor +*/ +public class _RotationDescriptor extends MultiPropertyTest { + + /** + * Custom tester which increases value by 200 + */ + protected PropertyTester drawMeasureTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + int val = ((Integer)oldValue).intValue() ; + return Integer.valueOf(val + 200) ; + } + } ; + + /** + * !!! DEPRECATED !!! + */ + public void _RotationPointX() { + log.println("Testing with custom Property tester") ; + testProperty("RotationPointX", drawMeasureTester) ; + } + + /** + * !!! DEPRECATED !!! + */ + public void _RotationPointY() { + log.println("Testing with custom Property tester") ; + testProperty("RotationPointY", drawMeasureTester) ; + } + + /** + * Tests the property with custom tester + */ + public void _ShearAngle() { + + Object noShear = tEnv.getObjRelation("NoShear"); + + if (noShear != null) { + log.println("This shape type doesn't support shear, see #85556#"); + tRes.tested("ShearAngle",Status.skipped(true)); + return; + } + + try { + oObj.setPropertyValue("RotateAngle",Short.valueOf((short) 0)); + } catch (Exception e) { + } + log.println("Testing with custom Property tester") ; + testProperty("ShearAngle", drawMeasureTester) ; + } + + /** + * Tests the property with custom tester + */ + public void _RotateAngle() { + log.println("Testing with custom Property tester") ; + testProperty("RotateAngle", drawMeasureTester) ; + } + +} // finish class _RotationDescriptor + + diff --git a/qadevOOo/tests/java/ifc/drawing/_ShadowDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_ShadowDescriptor.java new file mode 100644 index 000000000..ec95fea71 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ShadowDescriptor.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.drawing; + +import lib.MultiPropertyTest; + +public class _ShadowDescriptor extends MultiPropertyTest { + + @Override + protected boolean compare(Object ob1, Object ob2) { + + return super.compare(ob1, ob2); + + } + +} // finish class _ShadowDescriptor + + + diff --git a/qadevOOo/tests/java/ifc/drawing/_ShadowProperties.java b/qadevOOo/tests/java/ifc/drawing/_ShadowProperties.java new file mode 100644 index 000000000..b1c039a8c --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ShadowProperties.java @@ -0,0 +1,39 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.ShadowProperties</code> +* service properties : +* <ul> +* <li><code> Shadow</code></li> +* <li><code> ShadowColor</code></li> +* <li><code> ShadowTransparence</code></li> +* <li><code> ShadowXDistance</code></li> +* <li><code> ShadowYDistance</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.ShadowProperties +*/ +public class _ShadowProperties extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_Shape.java b/qadevOOo/tests/java/ifc/drawing/_Shape.java new file mode 100644 index 000000000..9ef654283 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_Shape.java @@ -0,0 +1,151 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + +import com.sun.star.style.XStyle; + +/** +* Testing <code>com.sun.star.drawing.Shape</code> +* service properties : +* <ul> +* <li><code> ZOrder</code></li> +* <li><code> LayerID</code></li> +* <li><code> LayerName</code></li> +* <li><code> Printable</code></li> +* <li><code> MoveProtect</code></li> +* <li><code> Name</code></li> +* <li><code> SizeProtect</code></li> +* <li><code> Style</code></li> +* <li><code> Transformation</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Style1', 'Style2'</code> +* (of type <code>com.sun.star.style.XStyle</code>): +* relations used to change property 'Style'</li> +* <ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.Shape +*/ +public class _Shape extends MultiPropertyTest { + + XStyle style1 = null; + XStyle style2 = null; + + /** + * Custom tester which switches between two styles. + */ + protected PropertyTester StyleTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (util.ValueComparer.equalValue(oldValue,style1)) + return style2; else + return style1; + } + } ; + + /** + * Custom tester for 'LayerName' property which switches two + * Strings ('layout' and 'controls'). + */ + protected PropertyTester StringTester = new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) + throws java.lang.IllegalArgumentException { + if (util.ValueComparer.equalValue(oldValue,"layout")) + return "controls"; else + return "layout"; + } + } ; + + /** + * Tested with custom StyleTester which switches between two + * styles. + */ + public void _Style() { + log.println("Testing with custom Property tester") ; + style1 = (XStyle) tEnv.getObjRelation("Style1"); + style2 = (XStyle) tEnv.getObjRelation("Style2"); + testProperty("Style", StyleTester) ; + } + + /** + * Tested with custom StringTester which switches two + * Strings ('layout' and 'controls') + */ + public void _LayerName() { + if (tEnv.getTestCase().getObjectName().equals("SwXShape")) { + log.println("There is only one Layer for SwXShape"); + log.println("Therefore this property can't be changed"); + tRes.tested("LayerName",true); + } else if (tEnv.getTestCase().getObjectName().equals("ScShapeObj")) { + log.println("There is only one Layer for ScShapeObj"); + log.println("Therefore this property can't be changed"); + tRes.tested("LayerName",true); + } else if (tEnv.getTestCase().getObjectName().equals("ScAnnotationShapeObj")) { + log.println("There is only one Layer for ScAnnotationShapeObj"); + log.println("Therefore this property can't be changed"); + String aName = null; + try { + aName = (String) oObj.getPropertyValue ("LayerName"); + log.println("LayerName: '"+aName+"'"); + } catch (Exception e) { + e.printStackTrace (log); + } + tRes.tested("LayerName",aName != null); + } else { + log.println("Testing with custom Property tester") ; + testProperty("LayerName", StringTester) ; + } + } + + public void _ZOrder() { + if (tEnv.getTestCase().getObjectName().equals("ScAnnotationShapeObj")) { + log.println("There is only one Layer for ScAnnotationShapeObj"); + log.println("Therefore this property can't be changed"); + tRes.tested("ZOrder",true); + } else { + testProperty("ZOrder", Integer.valueOf(0), Integer.valueOf(1)); + } + } + + public void _LayerID() { + if (tEnv.getTestCase().getObjectName().equals("ScAnnotationShapeObj")) { + log.println("There is only one Layer for ScAnnotationShapeObj"); + log.println("Therefore this property can't be changed"); + Short aID = null; + try { + aID = (Short) oObj.getPropertyValue ("LayerID"); + log.println("LayerID: '"+aID.intValue ()+"'"); + } catch (Exception e) { + e.printStackTrace (log); + } + tRes.tested("LayerID",aID != null); + } else { + log.println("Testing with custom Property tester") ; + testProperty("LayerID"); + } + } + + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_ShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_ShapeDescriptor.java new file mode 100644 index 000000000..1ffc66ee2 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_ShapeDescriptor.java @@ -0,0 +1,134 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiMethodTest; +import util.ValueChanger; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.style.XStyle; +import com.sun.star.uno.UnoRuntime; + + +public class _ShapeDescriptor extends MultiMethodTest { + + public XPropertySet oObj = null; // oObj filled by MultiMethodTest + public boolean ro = false; + + public void _LayerID() { + com.sun.star.lang.XServiceInfo xInfo = UnoRuntime.queryInterface + (com.sun.star.lang.XServiceInfo.class, oObj); + if ( ! xInfo.supportsService("com.sun.star.drawing.ShapeDescriptor")) { + log.println("Service not available !!!!!!!!!!!!!"); + tRes.tested("Supported", false); + } + ro = true; + changeProp("LayerID"); + ro = false; + } + public void _LayerName() { + ro = true; + changeProp("LayerName"); + ro = false; + } + public void _MoveProtect() { + changeProp("MoveProtect"); + } + public void _Name() { + changeProp("Name"); + } + public void _Printable() { + changeProp("Printable"); + } + public void _SizeProtect() { + changeProp("SizeProtect"); + } + public void _Style() { + changeProp("Style"); + } + + public void _Transformation() { + changeProp("Transformation"); + } + + public void changeProp(String name) { + + Object gValue = null; + Object sValue = null; + Object ValueToSet = null; + + + try { + gValue = oObj.getPropertyValue(name); + if (!ro) { + ValueToSet = ValueChanger.changePValue(gValue); + if ( name.equals("Style") ) { + ValueToSet = newStyle(gValue); + } + oObj.setPropertyValue(name,ValueToSet); + sValue = oObj.getPropertyValue(name); + } + + //check get-set methods + if (gValue.equals(sValue)) { + log.println("Value for '"+name+"' hasn't changed"); + tRes.tested(name, false); + } else { + log.println("Property '"+name+"' OK"); + tRes.tested(name, true); + } + } catch (com.sun.star.beans.UnknownPropertyException ex) { + if (isOptional(name)) { + log.println("Property '"+name+ + "' is optional and not supported"); + tRes.tested(name,true); + } else { + log.println("Exception occurred while testing property '" + + name + "'"); + ex.printStackTrace(log); + tRes.tested(name, false); + } + } + catch (Exception e) { + log.println("Exception occurred while testing property '" + + name + "'"); + e.printStackTrace(log); + tRes.tested(name, false); + } + + + }// end of changeProp + + public XStyle newStyle(Object oldStyle) { + XStyle Style1 = (XStyle) tEnv.getObjRelation("Style1"); + XStyle Style2 = (XStyle) tEnv.getObjRelation("Style2"); + XStyle back = null; + if ( (Style1!=null) && (Style2!=null) ) { + if ( ((XStyle) oldStyle).equals(Style1) ) { + back = Style2; + } else { + back = Style1; + } + } + return back; + } + +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_Text.java b/qadevOOo/tests/java/ifc/drawing/_Text.java new file mode 100644 index 000000000..9ffffab6e --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_Text.java @@ -0,0 +1,61 @@ +/* + * 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.drawing; + +import lib.MultiPropertyTest; + +public class _Text extends MultiPropertyTest { + + @Override + protected boolean compare(Object ob1, Object ob2) { + + return super.compare(ob1, ob2); + + } + + public void _NumberingRules() { + //This property is readOnly + boolean bResult = false; + + try { + Object theRules2 = oObj.getPropertyValue( "NumberingRules" ); + if (!(theRules2 instanceof com.sun.star.container.XIndexReplace)) { + log.println("Property 'NumberingRules' is an instance of "+ + theRules2.getClass().getName()); + log.println("Expected was an instance of "+ + "com.sun.star.container.XIndexReplace"); + } + log.println("Trying to cast property 'NumberingRules' "+ + "to XIndexReplace"); + oObj.getPropertyValue( "NumberingRules" ); + bResult = true; + } catch( Exception e ) { + log.println("Error occurred while trying to get property"+ + " 'NumberingRules'"); + e.printStackTrace( log ); + bResult = false; + } + + tRes.tested( "NumberingRules", bResult); + } + +} // finish class _Text + + + diff --git a/qadevOOo/tests/java/ifc/drawing/_TextProperties.java b/qadevOOo/tests/java/ifc/drawing/_TextProperties.java new file mode 100644 index 000000000..29f40c01a --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_TextProperties.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.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.TextProperties</code> +* service properties : +* <ul> +* <li><code> IsNumbering</code></li> +* <li><code> NumberingRules</code></li> +* <li><code> TextAutoGrowHeight</code></li> +* <li><code> TextAutoGrowWidth</code></li> +* <li><code> TextContourFrame</code></li> +* <li><code> TextFitToSize</code></li> +* <li><code> HorizontalAdjust</code></li> +* <li><code> VerticalAdjust</code></li> +* <li><code> TextLeftDistance</code></li> +* <li><code> TextRightDistance</code></li> +* <li><code> TextUpperDistance</code></li> +* <li><code> TextLowerDistance</code></li> +* <li><code> TextMaximumFrameHeight</code></li> +* <li><code> TextMaximumFrameWidth</code></li> +* <li><code> TextMinimumFrameHeight</code></li> +* <li><code> TextMinimumFrameWidth</code></li> +* <li><code> TextAnimationAmount</code></li> +* <li><code> TextAnimationCount</code></li> +* <li><code> TextAnimationDelay</code></li> +* <li><code> TextAnimationDirection</code></li> +* <li><code> TextAnimationKind</code></li> +* <li><code> TextAnimationStartInside</code></li> +* <li><code> TextAnimationStopInside</code></li> +* <li><code> TextWritingMode</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.TextProperties +*/ +public class _TextProperties extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_TextShape.java b/qadevOOo/tests/java/ifc/drawing/_TextShape.java new file mode 100644 index 000000000..e2a5c8a22 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_TextShape.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.drawing; + +import lib.MultiPropertyTest; + +/** +* Testing <code>com.sun.star.drawing.TextShape</code> +* service properties : +* <ul> +* <li><code> CornerRadius</code></li> +* </ul> <p> +* Properties testing is automated by <code>lib.MultiPropertyTest</code>. +* @see com.sun.star.drawing.TextShape +*/ +public class _TextShape extends MultiPropertyTest { + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_TextShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_TextShapeDescriptor.java new file mode 100644 index 000000000..3a4012399 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_TextShapeDescriptor.java @@ -0,0 +1,27 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiPropertyTest; + + +public class _TextShapeDescriptor extends MultiPropertyTest { + +} // finish class _TextShapeDescriptor + diff --git a/qadevOOo/tests/java/ifc/drawing/_XConnectorShape.java b/qadevOOo/tests/java/ifc/drawing/_XConnectorShape.java new file mode 100644 index 000000000..ef9395f33 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XConnectorShape.java @@ -0,0 +1,139 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.drawing.ConnectionType; +import com.sun.star.drawing.XConnectableShape; +import com.sun.star.drawing.XConnectorShape; +import com.sun.star.drawing.XShape; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XConnectorShape</code> +* interface methods : +* <ul> +* <li><code> connectStart()</code></li> +* <li><code> connectEnd()</code></li> +* <li><code> disconnectBegin()</code></li> +* <li><code> disconnectEnd()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'XConnectorShape.Shapes'</code> +* (of type <code>com.sun.star.drawing.XShape[]</code>): +* an array of two shapes which <b>must</b> implement +* <code>com.sun.star.drawing.XConnectableShape</code> +* interface and are used for being connected by +* connector shape.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XConnectorShape +*/ +public class _XConnectorShape extends MultiMethodTest { + + public XConnectorShape oObj = null; //oObj filled by MultiMethodTest + private XConnectableShape shape1 = null, + shape2 = null ; + + /** + * Retrieves object relation. + * @throw StatusException If the relation is not found or shapes don't + * support <code>XConnectableShape</code> interface. + */ + @Override + public void before() { + log.println("No shapes implementing XConnectableShape still found."); + XShape[] shapes = (XShape[]) + tEnv.getObjRelation("XConnectorShape.Shapes") ; + if (shapes == null) throw new StatusException(Status.failed + ("Relation not found.")) ; + shape1 = UnoRuntime.queryInterface + (XConnectableShape.class, shapes[0]) ; + shape2 = UnoRuntime.queryInterface + (XConnectableShape.class, shapes[1]) ; + if (shape1 == null || shape2 == null) throw new StatusException + (Status.failed("Shapes don't implement XConnectableShape"+ + " interface.")) ; + } + + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _connectStart() { + oObj.connectStart(shape1, ConnectionType.AUTO); + + tRes.tested("connectStart()", true) ; + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _connectEnd() { + oObj.connectEnd(shape2, ConnectionType.AUTO); + + tRes.tested("connectEnd()", true) ; + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> connectStart() </code> : first shape needs to be + * connected. </li> + * </ul> + */ + public void _disconnectBegin() { + requiredMethod("connectStart()"); + + oObj.disconnectBegin(shape1); + + tRes.tested("disconnectBegin()", true) ; + } + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> connectEnd() </code> : first shape needs to be + * connected. </li> + * </ul> + */ + public void _disconnectEnd() { + requiredMethod("connectEnd()"); + + oObj.disconnectEnd(shape2); + + tRes.tested("disconnectEnd()", true) ; + } +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XControlShape.java b/qadevOOo/tests/java/ifc/drawing/_XControlShape.java new file mode 100644 index 000000000..fadf945a8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XControlShape.java @@ -0,0 +1,96 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiMethodTest; +import util.FormTools; + +import com.sun.star.awt.XControlModel; +import com.sun.star.drawing.XControlShape; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +/** +* Testing <code>com.sun.star.drawing.XControlShape</code> +* interface methods : +* <ul> +* <li><code> getControl()</code></li> +* <li><code> setControl()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'xDoc'</code> (of type <code>XComponent</code>): +* the document where shape tested is situated. This document +* must also implement <code>XMultiServiceFactory</code> interface +* to create some control model. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XControlShape +*/ +public class _XControlShape extends MultiMethodTest { + + public XControlShape oObj = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _getControl() { + oObj.getControl(); + tRes.tested("getControl()", true) ; + } + + /** + * With the help of document passed as relation, a new button control + * model is created and set as a control. <p> + * Has <b> OK </b> status if <code>getControl()</code> method returns + * the same control as was set. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getControl() </code> </li> + * </ul> + */ + public void _setControl() + throws com.sun.star.uno.Exception + { + requiredMethod("getControl()") ; + + XInterface oNewControl = FormTools.createControl + ((XComponent)tEnv.getObjRelation("xDoc"), "ComboBox") ; + + XControlModel xControl = UnoRuntime.queryInterface + (XControlModel.class, oNewControl) ; + + oObj.setControl(xControl) ; + + XControlModel gControl = oObj.getControl() ; + + if (oNewControl.equals(gControl)) + tRes.tested("setControl()", true) ; + else { + log.println("Control set is not equal to control get") ; + tRes.tested("setControl()", false) ; + } + } + +} // finish class _XControlShape + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XDrawPageDuplicator.java b/qadevOOo/tests/java/ifc/drawing/_XDrawPageDuplicator.java new file mode 100644 index 000000000..75073765b --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XDrawPageDuplicator.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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPageDuplicator; +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XDrawPagesSupplier; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +/** +* Testing <code>com.sun.star.drawing.XDrawPageDuplicator</code> +* interface methods : +* <ul> +* <li><code> duplicate()</code></li> +* </ul> <p> +* The object tested <b> must implement </b> +* <code>XDrawPagesSupplier</code> interface to have access to draw +* pages collection. <p> +* Test is <b> NOT </b> multithread compliant. <p> +* After test completion object environment has to be recreated. +* @see com.sun.star.drawing.XDrawPageDuplicator +*/ +public class _XDrawPageDuplicator extends MultiMethodTest { + public XDrawPageDuplicator oObj = null; + + /** + * First queries object tested for <code>XDrawPagesSupplier</code> + * interface and obtains one draw page from document. Then it + * tries to duplicate it.<p> + * Has <b> OK </b> status if the method returns not null value and + * this value is not equal to the page which was duplicated. <p> + */ + public void _duplicate(){ + boolean result = false; + XInterface testobj = tEnv.getTestObject(); + XDrawPagesSupplier PS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, testobj); + XDrawPages DPs = PS.getDrawPages(); + XDrawPage DP = null; + try { + DP = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),DPs.getByIndex(0)); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Exception occurred while testing: " + e); + } catch (com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("Exception occurred while testing: " + e); + } catch (com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception occurred while testing: " + e); + } + + if (DP != null) { + XDrawPage newPage = oObj.duplicate(DP); + result = (newPage != null) && !(newPage.equals(DP)); + } + tRes.tested("duplicate()", result); + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_XDrawPageSupplier.java b/qadevOOo/tests/java/ifc/drawing/_XDrawPageSupplier.java new file mode 100644 index 000000000..dd4b20601 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XDrawPageSupplier.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.drawing; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPageSupplier; +import lib.MultiMethodTest; + +/** + * + */ +public class _XDrawPageSupplier extends MultiMethodTest { + public XDrawPageSupplier oObj = null; + + public void _getDrawPage() { + XDrawPage xPage = oObj.getDrawPage(); + log.println("xPage: " + util.utils.getImplName(xPage)); + tRes.tested("getDrawPage()", xPage != null); + } +} diff --git a/qadevOOo/tests/java/ifc/drawing/_XDrawPages.java b/qadevOOo/tests/java/ifc/drawing/_XDrawPages.java new file mode 100644 index 000000000..a2cf2c3b3 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XDrawPages.java @@ -0,0 +1,85 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPages; + +/** +* Testing <code>com.sun.star.drawing.XDrawPages</code> +* interface methods : +* <ul> +* <li><code> insertNewByIndex()</code></li> +* <li><code> remove()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XDrawPages +*/ +public class _XDrawPages extends MultiMethodTest { + public XDrawPages oObj = null; + public XDrawPage DrawPage; + + /** + * Inserts a draw page at index 0. Number of pages is obtained + * before and after insertion.<p> + * Has <b> OK </b> status if the value returned is not null and + * number of pages increases by one after insertion. <p> + */ + public void _insertNewByIndex(){ + boolean result = true; + log.println("testing insertNewByIndex() ... "); + + int cntBefore = oObj.getCount(); + DrawPage = oObj.insertNewByIndex(0); + int cntAfter = oObj.getCount(); + result = DrawPage != null && + cntAfter == cntBefore + 1 ; + + tRes.tested("insertNewByIndex()", result); + } // end InsertNewByIndex + + /** + * Removes the draw page inserted before. Number of pages is obtained + * before and after removing.<p> + * Has <b> OK </b> status if the number of pages decreases by one + * after removing. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> insertByIndex() </code> : the page to be removed must + * be inserted first.</li> + * </ul> + */ + public void _remove(){ + requiredMethod("insertNewByIndex()") ; + + boolean result = true; + log.println("removing DrawPage..."); + + int cntBefore = oObj.getCount(); + oObj.remove(DrawPage); + int cntAfter = oObj.getCount(); + result = cntAfter + 1 == cntBefore ; + + tRes.tested("remove()", result); + } // end remove() + +} // end XDrawPages + diff --git a/qadevOOo/tests/java/ifc/drawing/_XDrawPagesSupplier.java b/qadevOOo/tests/java/ifc/drawing/_XDrawPagesSupplier.java new file mode 100644 index 000000000..8350f665d --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XDrawPagesSupplier.java @@ -0,0 +1,55 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XDrawPagesSupplier; + +/** +* Testing <code>com.sun.star.drawing.XDrawPagesSupplier</code> +* interface methods : +* <ul> +* <li><code> getDrawPages()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XDrawPagesSupplier +*/ +public class _XDrawPagesSupplier extends MultiMethodTest { + public XDrawPagesSupplier oObj = null; + + /** + * Gets draw page collection. <p> + * Has <b> OK </b> status if the value returned is not null. <p> + */ + public void _getDrawPages(){ + boolean result = true; + XDrawPages DrawPages = null; + + log.println("testing getDrawPages() ... "); + + DrawPages = oObj.getDrawPages(); + result = DrawPages != null; + + tRes.tested("getDrawPages()", result); + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_XDrawView.java b/qadevOOo/tests/java/ifc/drawing/_XDrawView.java new file mode 100644 index 000000000..30f54f67d --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XDrawView.java @@ -0,0 +1,104 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XDrawView; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + +/** +* Testing <code>com.sun.star.drawing.XDrawView</code> +* interface methods : +* <ul> +* <li><code> setCurrentPage()</code></li> +* <li><code> getCurrentPage()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Pages'</code> (of type <code>XDrawPages</code>): +* needed to have the access to pages collection.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XDrawView +*/ +public class _XDrawView extends MultiMethodTest { + + public XDrawView oObj = null; + public XDrawPage the_page = null; + + /** + * This methods gets the current DrawPage.<p> + * Has <b> OK </b> status if the returned DrawPage + * isn't empty. + */ + public void _getCurrentPage(){ + the_page = oObj.getCurrentPage(); + tRes.tested("getCurrentPage()",the_page != null); + } // end getCurrentPage + + /** + * This methods sets the current DrawPage<br> + * First a new DrawPage is inserted in the document. + * Then this DrawPage is set as current Page. + * Has <b> OK </b> status if the getCurrentPage() method returns + * the DrawPage that was previously set. + * @see ifc.drawing._XDrawPages + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getCurrentPage() </code> </li> + * </ul> + */ + public void _setCurrentPage(){ + requiredMethod("getCurrentPage()"); + try { + XDrawPages the_pages = (XDrawPages) tEnv.getObjRelation("Pages"); + the_pages.insertNewByIndex(0); + XDrawPage newPage = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),the_pages.getByIndex(1)); + oObj.setCurrentPage(newPage); + XDrawPage getting = oObj.getCurrentPage(); + boolean eq = newPage.equals(getting); + if (!eq) { + log.println("Getting: "+getting.hasElements()); + log.println("Expected: "+newPage.hasElements()); + } + //back to the previous page + oObj.setCurrentPage(the_page); + tRes.tested("setCurrentPage()",eq); + } catch (com.sun.star.lang.WrappedTargetException ex) { + log.println("Exception occurred while checking 'setCurrentPage()'"); + ex.printStackTrace(log); + tRes.tested("setCurrentPage()",false); + } catch (com.sun.star.lang.IndexOutOfBoundsException ex) { + log.println("Exception occurred while checking 'setCurrentPage()'"); + ex.printStackTrace(log); + tRes.tested("setCurrentPage()",false); + } catch (com.sun.star.lang.IllegalArgumentException ex) { + log.println("Exception occurred while checking 'setCurrentPage()'"); + ex.printStackTrace(log); + tRes.tested("setCurrentPage()",false); + } + } // end setCurrentPage + +} // end DrawView + diff --git a/qadevOOo/tests/java/ifc/drawing/_XGluePointsSupplier.java b/qadevOOo/tests/java/ifc/drawing/_XGluePointsSupplier.java new file mode 100644 index 000000000..8437143ab --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XGluePointsSupplier.java @@ -0,0 +1,55 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.container.XIndexContainer; +import com.sun.star.drawing.XGluePointsSupplier; + +/** +* Testing <code>com.sun.star.drawing.XGluePointsSupplier</code> +* interface methods : +* <ul> +* <li><code> getGluePoints()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XGluePointsSupplier +*/ +public class _XGluePointsSupplier extends MultiMethodTest { + public XGluePointsSupplier oObj = null; + + /** + * Gets glue points collection. <p> + * Has <b> OK </b> status if the value returned is not null. <p> + */ + public void _getGluePoints(){ + boolean result = true; + XIndexContainer points = null; + + log.println("testing getDrawPages() ... "); + + points = oObj.getGluePoints(); + result = points != null; + + tRes.tested("getGluePoints()", result); + } + +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_XLayerManager.java b/qadevOOo/tests/java/ifc/drawing/_XLayerManager.java new file mode 100644 index 000000000..b44ce0fa7 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XLayerManager.java @@ -0,0 +1,157 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.drawing; + +import lib.MultiMethodTest; +import util.ValueComparer; +import util.XInstCreator; + +import com.sun.star.drawing.XLayer; +import com.sun.star.drawing.XLayerManager; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapes; +import com.sun.star.uno.XInterface; + +/** +* Testing <code>com.sun.star.drawing.XLayerManager</code> +* interface methods : +* <ul> +* <li><code> insertNewByIndex()</code></li> +* <li><code> remove()</code></li> +* <li><code> attachShapeToLayer()</code></li> +* <li><code> getLayerForShape()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Shape'</code> (of type <code>util.XInstCreator</code>): +* instance creator which can create shapes.</li> +* <li> <code>'Shapes'</code> +* (of type <code>com.sun.star.drawing.XShapes</code>): +* The collection of shapes in the document. Is used +* to add new created shapes.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XLayerManager +*/ +public class _XLayerManager extends MultiMethodTest { + + public XLayerManager oObj = null; // oObj filled by MultiMethodTest + XInstCreator shape = null; + public XInterface oShape = null; + public XLayer oL = null; + + /** + * Inserts a new layer into collection. <p> + * Has <b> OK </b> status if the value returned is not null. <p> + */ + public void _insertNewByIndex(){ + log.println("insertNewByName() ... "); + oL = oObj.insertNewByIndex(0); + tRes.tested("insertNewByIndex()", oL != null); + } + + /** + * First a shape created and inserted into the document using + * relations retrieved. Attaches this shape to layer created before. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> insertNewByIndex </code> : to have a layer attach to.</li> + * </ul> + */ + public void _attachShapeToLayer() { + requiredMethod("insertNewByIndex()"); + shape = (XInstCreator)tEnv.getObjRelation("Shape"); + oShape = shape.createInstance(); + XShape oSh = (XShape) oShape; + XShapes oShapes = (XShapes) tEnv.getObjRelation("Shapes"); + oShapes.add(oSh); + boolean result = false; + + log.println("attachShapeToLayer() ... "); + + oObj.attachShapeToLayer((XShape) oShape,oL); + result = true; + + tRes.tested("attachShapeToLayer()", result); + } + + /** + * Gets the layer for shape which was attached before. <p> + * Has <b> OK </b> status if the names of layer get and + * the layer attached before are equal. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> attachShapeToLayer() </code> </li> + * </ul> + */ + public void _getLayerForShape() { + requiredMethod("attachShapeToLayer()"); + log.println("getLayerForShape() ... "); + XLayer Lay1 = oL; + XLayer Lay2 = oObj.getLayerForShape((XShape)oShape); + Object Obj1 = null; + Object Obj2 = null; + + try { + Obj1 = Lay1.getPropertyValue("Name"); + Obj2 = Lay2.getPropertyValue("Name"); + } catch (com.sun.star.lang.WrappedTargetException e) { + e.printStackTrace(log); + } catch (com.sun.star.beans.UnknownPropertyException e) { + e.printStackTrace(log); + } + + tRes.tested("getLayerForShape()",ValueComparer.equalValue(Obj1,Obj2)); + } + + /** + * Test removes the layer added before. Number of layers are get before + * and after removing.<p> + * Has <b> OK </b> status if number of layers decreases by one. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getLayerForShape() </code> </li> + * </ul> + */ + public void _remove () { + requiredMethod("getLayerForShape()"); + boolean result = true ; + // get the current thread's holder + log.println("removing the Layer..."); + + int cntBefore = oObj.getCount(); + + try { + oObj.remove(oL); + } catch (com.sun.star.container.NoSuchElementException e) { + e.printStackTrace(log); + result = false; + } + + int cntAfter = oObj.getCount(); + + result = cntBefore == cntAfter + 1; + + tRes.tested("remove()", result); + } +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XLayerSupplier.java b/qadevOOo/tests/java/ifc/drawing/_XLayerSupplier.java new file mode 100644 index 000000000..ced5953ee --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XLayerSupplier.java @@ -0,0 +1,60 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.container.XNameAccess; +import com.sun.star.drawing.XLayerManager; +import com.sun.star.drawing.XLayerSupplier; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XLayerSupplier</code> +* interface methods : +* <ul> +* <li><code> getLayerManager()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XLayerSupplier +*/ +public class _XLayerSupplier extends MultiMethodTest{ + public XLayerSupplier oObj = null; + + /** + * Gets the manager and it is queried for <code>XLayerManager</code>. <p> + * Has <b> OK </b> status if returned value is successfully + * queried for <code>XLayerManager</code>. <p> + */ + public void _getLayerManager(){ + XNameAccess oNA =null; + XLayerManager oLM = null; + boolean result = true; + + log.println("testing getLayerManager() ... "); + + oNA = oObj.getLayerManager(); + oLM = UnoRuntime.queryInterface ( XLayerManager.class, oNA); + result = oLM != null; + + tRes.tested("getLayerManager()", result); + } // finished test + +} // end XLayerSupplier + diff --git a/qadevOOo/tests/java/ifc/drawing/_XMasterPageTarget.java b/qadevOOo/tests/java/ifc/drawing/_XMasterPageTarget.java new file mode 100644 index 000000000..a1716bbe5 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XMasterPageTarget.java @@ -0,0 +1,99 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XMasterPageTarget; + +/** +* Testing <code>com.sun.star.drawing.XMasterPageTarget</code> +* interface methods : +* <ul> +* <li><code> getMasterPage()</code></li> +* <li><code> setMasterPage()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'MasterPageSupplier'</code> +* (of type <code>XDrawPages</code>): +* the relation is used to create a new draw page. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XMasterPageTarget +*/ +public class _XMasterPageTarget extends MultiMethodTest{ + + public XMasterPageTarget oObj = null; + public XDrawPage DrawPage = null; + + /** + * Gets the master page and stores. <p> + * Has <b> OK </b> status if the value returned is not null. <p> + */ + public void _getMasterPage(){ + boolean result = false; + log.println("get the MasterPage"); + + DrawPage = oObj.getMasterPage(); + result = DrawPage != null ; + + tRes.tested("getMasterPage()",result); + } + + /** + * Gets the pages supplier from relation. Then a new page is created, + * inserted and set as master page.<p> + * Has <b> OK </b> status if the master page get is equal to page + * which was set. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getMasterPage() </code> : to get old master page.</li> + * </ul> + */ + public void _setMasterPage() { + requiredMethod("getMasterPage()") ; + + boolean result = true; + XDrawPage oNewPage = null; + + XDrawPages oPages = (XDrawPages) tEnv.getObjRelation("MasterPageSupplier"); + log.println("inserting new MasterPage"); + oNewPage = oPages.insertNewByIndex(oPages.getCount()); + + // save the old MasterPage + XDrawPage oOldPage = DrawPage; + + // set the new Page as MasterPage + log.println("set the new MasterPage"); + oObj.setMasterPage(oNewPage); + + // get the new MasterPage + DrawPage = oObj.getMasterPage(); + + // test the different MasterPages + if (DrawPage.equals(oOldPage)) result = false; + + tRes.tested("setMasterPage()",result); + } + +} // end of XMasterPageTarget + diff --git a/qadevOOo/tests/java/ifc/drawing/_XMasterPagesSupplier.java b/qadevOOo/tests/java/ifc/drawing/_XMasterPagesSupplier.java new file mode 100644 index 000000000..313f0f142 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XMasterPagesSupplier.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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPages; +import com.sun.star.drawing.XMasterPagesSupplier; + +/** +* Testing <code>com.sun.star.drawing.XMasterPagesSupplier</code> +* interface methods : +* <ul> +* <li><code> getMasterPages()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XMasterPagesSupplier +*/ +public class _XMasterPagesSupplier extends MultiMethodTest{ + public XMasterPagesSupplier oObj = null; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the value returned is not null. + */ + public void _getMasterPages(){ + boolean result = false; + XDrawPages DrawPages = null; + + log.println("get the MasterPages"); + + DrawPages = oObj.getMasterPages(); + result = DrawPages != null; + + tRes.tested("getMasterPages()",result); + } +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShape.java b/qadevOOo/tests/java/ifc/drawing/_XShape.java new file mode 100644 index 000000000..8f6b5d791 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShape.java @@ -0,0 +1,186 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.awt.Point; +import com.sun.star.awt.Size; +import com.sun.star.drawing.XShape; + +/** +* Testing <code>com.sun.star.drawing.XShape</code> +* interface methods : +* <ul> +* <li><code> getPosition()</code></li> +* <li><code> setPosition()</code></li> +* <li><code> getSize()</code></li> +* <li><code> setSize()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'NoPos'</code> <b>optional</b> +* (of type <code>Object</code>): +* if this relation exists then position setting is +* not supported by the object.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShape +*/ +public class _XShape extends MultiMethodTest { + + public XShape oObj = null; //oObj filled by MultiMethodTest + + Size sOld = new Size(); + Point pOld = new Point(); + Size sNew = new Size(); + Point pNew = new Point(); + + /** + * Gets the size and stores it. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + */ + public void _getSize(){ + + boolean result = false; + + log.println("get the size"); + + sOld = oObj.getSize(); + result = true; + + tRes.tested("getSize()", result); + } + + /** + * Gets the current position and stores it if the object + * supports position setting. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown or object doesn't + * support position setting. <p> + */ + public void _getPosition(){ + boolean result = false; + + String obj = (String) tEnv.getObjRelation("NoPos"); + if (obj != null) { + log.println("Can't be used with "+obj); + result = true; + tRes.tested("getPosition()", result); + return; + } + + log.println("get the position"); + pOld = oObj.getPosition(); + result = true; + + tRes.tested("getPosition()", result); + } + + /** + * Sets a new size different from the size get before. <p> + * Has <b> OK </b> status if the size returned by <code>getSize()</code> + * is equal to the size which was set. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getSize() </code> : to set the original size changed.</li> + * </ul> + */ + public void _setSize(){ + requiredMethod("getSize()"); + + boolean result = true; + + String obj = (String) tEnv.getObjRelation("NoSetSize"); + if (obj != null) { + log.println("Can't be used with " + obj); + tRes.tested("setSize()", true); + return; + } + // get the current thread's holder + sNew = new Size(sOld.Width + 10,sOld.Height + 10) ; + + //set new size + log.println("change the size"); + try { + oObj.setSize(sNew); + } catch (com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while calling the method :" + e); + result = true ; + } + + Size gSize = oObj.getSize() ; + + log.println("Previously: "+sOld.Height+";"+sOld.Width); + log.println("Expected: "+sNew.Height+";"+sNew.Width); + log.println("Getting: "+gSize.Height+";"+gSize.Width); + + //errors in calculation from points/twips less than 1 are acceptable + result &= (sNew.Height-gSize.Height <= 2) && (sNew.Width-gSize.Width <= 2); + + if (result && ((sNew.Height-gSize.Height != 0) || (sNew.Width-gSize.Width != 0))){ + log.println("NOTE: there is a difference between the expected and the gotten value. " + + "This might be ok because of problems in calculation from points <-> twips"); + } + tRes.tested("setSize()", result); + } + + /** + * If object doesn't support position setting the test does nothing. + * Else a new position is created and set.<p> + * Has <b> OK </b> status if get position is equal to set position or + * if the position setting isn't supported. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> getPosition() </code> : to change old position. </li> + * </ul> + */ + public void _setPosition(){ + requiredMethod("getPosition()"); + + boolean result = true; + + String obj = (String) tEnv.getObjRelation("NoPos"); + if (obj != null) { + log.println("Can't be used with " + obj); + tRes.tested("setPosition()", true); + return; + } + + // get the current thread's holder + pNew = new Point(pOld.X + 100, pOld.Y + 100) ; + oObj.setPosition(pNew); + + Point gPos = oObj.getPosition() ; + + log.println("Previously: "+pOld.X+";"+pOld.Y); + log.println("Expected: "+pNew.X+";"+pNew.Y); + log.println("Getting: "+gPos.X+";"+gPos.Y); + + result = !util.ValueComparer.equalValue(pOld, gPos) ; + + tRes.tested("setPosition()", result); + } + + +} // finish class _XShape + + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapeBinder.java b/qadevOOo/tests/java/ifc/drawing/_XShapeBinder.java new file mode 100644 index 000000000..5ebe37e1c --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapeBinder.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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeBinder; +import com.sun.star.drawing.XShapes; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XShapeBinder</code> +* interface methods : +* <ul> +* <li><code> bind()</code></li> +* <li><code> unbind()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'DrawPage'</code> (must implement <code>XShapes</code>): +* the collection of shapes in a document which used to create a group.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapeBinder +*/ +public class _XShapeBinder extends MultiMethodTest { + + public XShapeBinder oObj = null; + XShape group = null; + int countBeforeBind = 0; + XShapes oShapes = null; + + /** + * Retrieves draw page collection from relation and binds them. <p> + * + * Has <b> OK </b> status if the shape group returned is not null + * number of shapes in collection is 1 (shapes are bound into a single + * shape). <p> + */ + public void _bind () { + XDrawPage dp = (XDrawPage) tEnv.getObjRelation("DrawPage"); + oShapes = UnoRuntime.queryInterface( XShapes.class, dp ); + boolean result = false; + log.println("testing bind() ... "); + countBeforeBind = oShapes.getCount(); + log.println("Count before bind:" + countBeforeBind); + group = oObj.bind(oShapes); + int countAfterBind = oShapes.getCount(); + log.println("Count after bind:" + countAfterBind); + result = group != null && countAfterBind == 1; + + tRes.tested("bind()", result); + + } + + /** + * Unbinds the group created before. <p> + * + * Has <b> OK </b> status if number of shapes in collection + * increases after the method call. <p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> bind() </code> : to create a shape group </li> + * </ul> + */ + public void _unbind () { + requiredMethod("bind()"); + boolean result = false; + + // get the current thread's holder + log.println("unbinding the shape..."); + + oObj.unbind(group); + int countAfterUnbind = oShapes.getCount(); + log.println("Count after unbind:" + countAfterUnbind); + result = countAfterUnbind >= countBeforeBind; + + tRes.tested("unbind()", result); + } +} + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapeCombiner.java b/qadevOOo/tests/java/ifc/drawing/_XShapeCombiner.java new file mode 100644 index 000000000..8cc1cf754 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapeCombiner.java @@ -0,0 +1,101 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XDrawPage; +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeCombiner; +import com.sun.star.drawing.XShapes; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XShapeCombiner</code> +* interface methods : +* <ul> +* <li><code> combine()</code></li> +* <li><code> split()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'DrawPage'</code> (must implement <code>XShapes</code>): +* the collection of shapes in a document which used to create a group.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapeCombiner +*/ +public class _XShapeCombiner extends MultiMethodTest { + + public XShapeCombiner oObj = null; //filled by MultiMethodTest + protected XShape oGroup = null; + int countBeforeComb = 0; + XShapes oShapes = null; + + /** + * Retrieves draw page collection from relation and combines them. <p> + * Has <b> OK </b> status if the shape group returned is not null nd + * number of shapes in collection is 1 (shapes are combined into a single + * shape). <p> + */ + public void _combine () { + XDrawPage dp = (XDrawPage) tEnv.getObjRelation("DrawPage"); + oShapes = UnoRuntime.queryInterface( XShapes.class, dp ); + + boolean result = false; + + log.println("testing combine() ... "); + countBeforeComb = oShapes.getCount(); + log.println("Count before combining:" + countBeforeComb); + oGroup = oObj.combine(oShapes); + int countAfterComb = oShapes.getCount(); + log.println("Count after combining:" + countAfterComb); + result = oGroup != null && countAfterComb == 1; + + tRes.tested("combine()", result); + } + + /** + * Splits the group created before. <p> + * + * Has <b> OK </b> status if number of shapes in collection after + * <code>split</code> is the same as before <code>combine</code>. <p> + * + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> combine() </code> : to create a shape group </li> + * </ul> + */ + public void _split() { + requiredMethod("combine()"); + + boolean result = false; + + log.println("splitting the shape..."); + + oObj.split(oGroup); + int countAfterSplit = oShapes.getCount(); + log.println("Count after split:" + countAfterSplit); + result = countAfterSplit == countBeforeComb; + + tRes.tested("split()", result); + } // end of split + +} // end of XShapeCombiner + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapeDescriptor.java b/qadevOOo/tests/java/ifc/drawing/_XShapeDescriptor.java new file mode 100644 index 000000000..ef088b91c --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapeDescriptor.java @@ -0,0 +1,87 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XShapeDescriptor; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XShapeDescriptor</code> +* interface methods : +* <ul> +* <li><code> getShapeType()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapeDescriptor +*/ +public class _XShapeDescriptor extends MultiMethodTest { + + public XShapeDescriptor oObj = null; + boolean result = true; + + /** + * Gets the type of shape. This type must be a service name which + * is supported by object (except of ChartObject and Frame shapes). + * The object is queried for <code>XServiceInfo</code> and + * the type is checked to be among supported service names.<p> + * + * Has <b> OK </b> status if the type is found among supported + * services. Or if the object represents a text frame.<p> + */ + public void _getShapeType() { + result = false; + + String stype = oObj.getShapeType(); + log.println("Current Shape Type is " + stype); + + XServiceInfo SI = UnoRuntime.queryInterface(XServiceInfo.class, oObj); + + String[] serviceNames = SI.getSupportedServiceNames(); + + log.println("Supported services :"); + for (int i = 0; i < serviceNames.length; i++) { + log.println(" " + serviceNames[i]); + if (serviceNames[i].equals(stype)) + result = true; + } + + //remark: we should provide the expected name as ObjRelation + + //Chart has its own behaviour it always return 'ChartObject' + if (stype.equals("com.sun.star.chart.ChartObject")) result=true; + if (stype.equals("com.sun.star.drawing.ControlShape")) result=true; + if (stype.equals("com.sun.star.drawing.ClosedBezierShape")) result=true; + if (stype.equals("com.sun.star.drawing.CaptionShape")) result=true; + + //Writer has its own behaviour it returns a 'FrameShape' + if (stype.equals("FrameShape")) result=true; + + if (!result) { + log.println("Service " + stype + " not supported in the object."); + } + + tRes.tested("getShapeType()", result); + } + +} + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapeGroup.java b/qadevOOo/tests/java/ifc/drawing/_XShapeGroup.java new file mode 100644 index 000000000..883bd1481 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapeGroup.java @@ -0,0 +1,61 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; + +import com.sun.star.drawing.XShapeGroup; + +/** +* Testing <code>com.sun.star.drawing.XShapeGroup</code> +* interface methods : +* <ul> +* <li><code> enterGroup()</code></li> +* <li><code> leaveGroup()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapeGroup +*/ +public class _XShapeGroup extends MultiMethodTest { + public XShapeGroup oObj = null; + + /** + * The method called. + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _enterGroup() { + log.println("Testing enterGroup()..."); + oObj.enterGroup(); + tRes.tested("enterGroup()", true); + } + + /** + * The method called. + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. + */ + public void _leaveGroup() { + log.println("Testing leaveGroup()..."); + oObj.leaveGroup(); + tRes.tested("leaveGroup()", true); + } + +} // end of _XShapeGroup + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapeGrouper.java b/qadevOOo/tests/java/ifc/drawing/_XShapeGrouper.java new file mode 100644 index 000000000..26b5045d1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapeGrouper.java @@ -0,0 +1,101 @@ +/* + * 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.drawing; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapeGroup; +import com.sun.star.drawing.XShapeGrouper; +import com.sun.star.drawing.XShapes; +import com.sun.star.uno.UnoRuntime; + +/** +* Testing <code>com.sun.star.drawing.XShapeGrouper</code> +* interface methods : +* <ul> +* <li><code> group()</code></li> +* <li><code> ungroup()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'DrawPage'</code> (must implement <code>XShapes</code>): +* the collection of shapes in a document which used to create a group.</li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapeGrouper +*/ +public class _XShapeGrouper extends MultiMethodTest { + + public XShapeGrouper oObj = null; // oObj filled by MultiMethodTest + XShape oGroup = null; + int countAfterGr = 0; + XShapes oShapes = null; + + /** + * Retrieves draw page collection from relation and groups them. <p> + * Has <b> OK </b> status if the shape group returned is not null. <p> + */ + public void _group() { + Object dp = tEnv.getObjRelation("DrawPage"); + if (dp == null) + throw new StatusException(Status.failed("Relation not found")) ; + + oShapes = UnoRuntime.queryInterface( XShapes.class, dp ); + boolean result = false; + log.println("Grouping " + oShapes.getCount() + " shapes ... "); + + int countBeforeGr = oShapes.getCount(); + oGroup = oObj.group(oShapes); + countAfterGr = oShapes.getCount(); + log.println("Number of shapes after grouping: " + countAfterGr); + result = oGroup != null ; + result &= countAfterGr < countBeforeGr; + + tRes.tested("group()", result); + } + + /** + * Ungroups the group created before. <p> + * Has <b> OK </b> status if the method successfully returns + * and no exceptions were thrown. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> group() </code> : to create a shape group </li> + * </ul> + */ + public void _ungroup() { + requiredMethod("group()"); + boolean result = false; + log.println("ungrouping the shape..."); + + oObj.ungroup((XShapeGroup)oGroup); + int countAfterUnGr = oShapes.getCount(); + log.println("Number of shapes after ungrouping: " + countAfterUnGr); + + result = countAfterUnGr != countAfterGr; + + tRes.tested("ungroup()", result); + } +} + + + diff --git a/qadevOOo/tests/java/ifc/drawing/_XShapes.java b/qadevOOo/tests/java/ifc/drawing/_XShapes.java new file mode 100644 index 000000000..fc23687b8 --- /dev/null +++ b/qadevOOo/tests/java/ifc/drawing/_XShapes.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.drawing; + +import lib.MultiMethodTest; +import util.XInstCreator; + +import com.sun.star.drawing.XShape; +import com.sun.star.drawing.XShapes; +import com.sun.star.uno.XInterface; + + +/** +* Testing <code>com.sun.star.drawing.XShapes</code> +* interface methods : +* <ul> +* <li><code> add()</code></li> +* <li><code> remove()</code></li> +* </ul> <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'Shape'</code> (of type <code>XShape</code>): +* a shape which can be inserted into shape collection. </li> +* <ul> <p> +* Test is <b> NOT </b> multithread compliant. <p> +* @see com.sun.star.drawing.XShapes +*/ +public class _XShapes extends MultiMethodTest { + + public XShapes oObj = null; // oObj filled by MultiMethodTest + XInstCreator shape = null; + XInterface oShape = null; + + + /** + * Retrieves a shape from relation and adds it to the collection. + * Number of shapes is checked before and after adding.<p> + * Has <b> OK </b> status if after adding number of shapes increases by + * 1. <p> + */ + public void _add () { + + boolean result = false; + shape = (XInstCreator)tEnv.getObjRelation("Shape"); + oShape = shape.createInstance(); + XShape oSh = (XShape) oShape; + + log.println("testing add() ... "); + + int cntBefore = oObj.getCount(); + oObj.add(oSh); + int cntAfter = oObj.getCount(); + result = cntBefore + 1 == cntAfter ; + + tRes.tested("add()", result); + } + + /** + * Removes the shape added before from the collection. + * Number of shapes is checked before and after removing.<p> + * Has <b> OK </b> status if after removing number of shapes decreases by + * 1. <p> + * The following method tests are to be completed successfully before : + * <ul> + * <li> <code> add() </code> : a shape added. </li> + * </ul> + */ + public void _remove () { + requiredMethod("add()"); + boolean result = false; + + log.println("removing the shape..."); + + int cntBefore = oObj.getCount(); + oObj.remove((XShape) oShape); + int cntAfter = oObj.getCount(); + result = cntBefore == cntAfter + 1; + + tRes.tested("remove()", result); + } + +} + + |