1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _LineShapeDescriptor.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
34 import util
.ValueChanger
;
36 import com
.sun
.star
.awt
.Point
;
37 import com
.sun
.star
.beans
.XPropertySet
;
38 import com
.sun
.star
.lang
.XServiceInfo
;
39 import com
.sun
.star
.uno
.UnoRuntime
;
42 public class _LineShapeDescriptor
extends MultiMethodTest
{
44 public XPropertySet oObj
= null; // oObj filled by MultiMethodTest
47 public void _LineColor() {
48 XServiceInfo xInfo
= (XServiceInfo
)
49 UnoRuntime
.queryInterface(XServiceInfo
.class, oObj
);
50 if ( ! xInfo
.supportsService
51 ("com.sun.star.drawing.LineShapeDescriptor")) {
52 log
.println("Service not available !!!!!!!!!!!!!");
53 tRes
.tested("Supported", false);
55 changeProp("LineColor");
58 public void _LineDash() {
59 changeProp("LineDash");
61 public void _LineEnd() {
62 changeProp("LineEnd");
64 public void _LineEndCenter() {
65 changeProp("LineEndCenter");
67 public void _LineEndWidth() {
68 changeProp("LineEndWidth");
70 public void _LineJoint() {
71 changeProp("LineJoint");
73 public void _LineStart() {
74 changeProp("LineStart");
76 public void _LineStartCenter() {
77 changeProp("LineStartCenter");
79 public void _LineStartWidth() {
80 changeProp("LineStartWidth");
82 public void _LineStyle() {
83 changeProp("LineStyle");
85 public void _LineTransparence() {
86 changeProp("LineTransparence");
88 public void _LineWidth() {
89 changeProp("LineWidth");
92 public void changeProp(String name
) {
96 Object ValueToSet
= null;
99 //waitForAllThreads();
100 gValue
= oObj
.getPropertyValue(name
);
101 //waitForAllThreads();
102 if ( (name
.equals("LineEnd")) || (name
.equals("LineStart")) ) {
103 if (gValue
== null) gValue
= newPoints(null);
104 ValueToSet
= newPoints( (Point
[]) gValue
);
107 ValueToSet
= ValueChanger
.changePValue(gValue
);
109 //waitForAllThreads();
110 oObj
.setPropertyValue(name
,ValueToSet
);
111 sValue
= oObj
.getPropertyValue(name
);
114 //check get-set methods
115 if (gValue
.equals(sValue
)) {
116 log
.println("Value for '"+name
+"' hasn't changed");
117 tRes
.tested(name
, false);
120 log
.println("Property '"+name
+"' OK");
121 tRes
.tested(name
, true);
123 } catch (Exception e
) {
124 log
.println("Exception occured while testing property '" +
126 e
.printStackTrace(log
);
127 tRes
.tested(name
, false);
131 } // end of ChangeProp
133 public Point
[] newPoints(Point
[] old
) {
135 Point
[] newP
= new Point
[3];
138 newP
[0] = new Point(0, 2);
139 newP
[1] = new Point(2, 0);
140 newP
[2] = new Point(0, -2);