bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _LineShapeDescriptor.java
blobfeb8a8d8847a36004efde338128b9b172f69b94a
1 /*
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 .
19 package ifc.drawing;
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) {
81 Object gValue = null;
82 Object sValue = null;
83 Object ValueToSet = null;
85 try {
86 //waitForAllThreads();
87 gValue = oObj.getPropertyValue(name);
88 //waitForAllThreads();
89 if ( (name.equals("LineEnd")) || (name.equals("LineStart")) ) {
90 if (gValue == null) gValue = newPoints(null);
91 ValueToSet = newPoints( (Point[]) gValue);
93 else {
94 ValueToSet = ValueChanger.changePValue(gValue);
96 //waitForAllThreads();
97 oObj.setPropertyValue(name,ValueToSet);
98 sValue = oObj.getPropertyValue(name);
101 //check get-set methods
102 if (gValue.equals(sValue)) {
103 log.println("Value for '"+name+"' hasn't changed");
104 tRes.tested(name, false);
106 else {
107 log.println("Property '"+name+"' OK");
108 tRes.tested(name, true);
110 } catch (Exception e) {
111 log.println("Exception occurred while testing property '" +
112 name + "'");
113 e.printStackTrace(log);
114 tRes.tested(name, false);
118 } // end of ChangeProp
120 public Point[] newPoints(Point[] old) {
122 Point [] newP = new Point[3];
124 if (old == null) {
125 newP[0] = new Point(0, 2);
126 newP[1] = new Point(2, 0);
127 newP[2] = new Point(0, -2);
129 else {
130 newP = old;
131 newP[0].X += 1;
132 newP[1].X += 1;
133 newP[2].X += 1;
135 return newP;