2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
22 import util
.ValueChanger
;
24 import com
.sun
.star
.awt
.Point
;
25 import com
.sun
.star
.beans
.XPropertySet
;
26 import com
.sun
.star
.lang
.XServiceInfo
;
27 import com
.sun
.star
.uno
.UnoRuntime
;
30 public class _LineShapeDescriptor
extends MultiMethodTest
{
32 public XPropertySet oObj
= null; // oObj filled by MultiMethodTest
35 public void _LineColor() {
36 XServiceInfo xInfo
= UnoRuntime
.queryInterface(XServiceInfo
.class, oObj
);
37 if ( ! xInfo
.supportsService
38 ("com.sun.star.drawing.LineShapeDescriptor")) {
39 log
.println("Service not available !!!!!!!!!!!!!");
40 tRes
.tested("Supported", false);
42 changeProp("LineColor");
45 public void _LineDash() {
46 changeProp("LineDash");
48 public void _LineEnd() {
49 changeProp("LineEnd");
51 public void _LineEndCenter() {
52 changeProp("LineEndCenter");
54 public void _LineEndWidth() {
55 changeProp("LineEndWidth");
57 public void _LineJoint() {
58 changeProp("LineJoint");
60 public void _LineStart() {
61 changeProp("LineStart");
63 public void _LineStartCenter() {
64 changeProp("LineStartCenter");
66 public void _LineStartWidth() {
67 changeProp("LineStartWidth");
69 public void _LineStyle() {
70 changeProp("LineStyle");
72 public void _LineTransparence() {
73 changeProp("LineTransparence");
75 public void _LineWidth() {
76 changeProp("LineWidth");
79 public void changeProp(String name
) {
83 Object ValueToSet
= null;
86 gValue
= oObj
.getPropertyValue(name
);
87 if ( (name
.equals("LineEnd")) || (name
.equals("LineStart")) ) {
88 if (gValue
== null) gValue
= newPoints(null);
89 ValueToSet
= newPoints( (Point
[]) gValue
);
92 ValueToSet
= ValueChanger
.changePValue(gValue
);
94 oObj
.setPropertyValue(name
,ValueToSet
);
95 sValue
= oObj
.getPropertyValue(name
);
98 //check get-set methods
99 if (gValue
.equals(sValue
)) {
100 log
.println("Value for '"+name
+"' hasn't changed");
101 tRes
.tested(name
, false);
104 log
.println("Property '"+name
+"' OK");
105 tRes
.tested(name
, true);
107 } catch (Exception e
) {
108 log
.println("Exception occurred while testing property '" +
110 e
.printStackTrace(log
);
111 tRes
.tested(name
, false);
115 } // end of ChangeProp
117 public Point
[] newPoints(Point
[] old
) {
119 Point
[] newP
= new Point
[3];
122 newP
[0] = new Point(0, 2);
123 newP
[1] = new Point(2, 0);
124 newP
[2] = new Point(0, -2);