bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _ShapeDescriptor.java
blob5e3049c734957f3f92d88659a62b61371bd7a093
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.beans.XPropertySet;
25 import com.sun.star.style.XStyle;
26 import com.sun.star.uno.UnoRuntime;
29 public class _ShapeDescriptor extends MultiMethodTest {
31 public XPropertySet oObj = null; // oObj filled by MultiMethodTest
32 public boolean ro = false;
34 public void _LayerID() {
35 com.sun.star.lang.XServiceInfo xInfo = UnoRuntime.queryInterface
36 (com.sun.star.lang.XServiceInfo.class, oObj);
37 if ( ! xInfo.supportsService("com.sun.star.drawing.ShapeDescriptor")) {
38 log.println("Service not available !!!!!!!!!!!!!");
39 tRes.tested("Supported", false);
41 ro = true;
42 changeProp("LayerID");
43 ro = false;
45 public void _LayerName() {
46 ro = true;
47 changeProp("LayerName");
48 ro = false;
50 public void _MoveProtect() {
51 changeProp("MoveProtect");
53 public void _Name() {
54 changeProp("Name");
56 public void _Printable() {
57 changeProp("Printable");
59 public void _SizeProtect() {
60 changeProp("SizeProtect");
62 public void _Style() {
63 changeProp("Style");
66 public void _Transformation() {
67 changeProp("Transformation");
70 public void changeProp(String name) {
72 Object gValue = null;
73 Object sValue = null;
74 Object ValueToSet = null;
77 try {
78 //waitForAllThreads();
79 gValue = oObj.getPropertyValue(name);
80 //waitForAllThreads();
81 if (!ro) {
82 ValueToSet = ValueChanger.changePValue(gValue);
83 if ( name.equals("Style") ) {
84 ValueToSet = newStyle(gValue);
86 //waitForAllThreads();
87 oObj.setPropertyValue(name,ValueToSet);
88 sValue = oObj.getPropertyValue(name);
91 //check get-set methods
92 if (gValue.equals(sValue)) {
93 log.println("Value for '"+name+"' hasn't changed");
94 tRes.tested(name, false);
95 } else {
96 log.println("Property '"+name+"' OK");
97 tRes.tested(name, true);
99 } catch (com.sun.star.beans.UnknownPropertyException ex) {
100 if (isOptional(name)) {
101 log.println("Property '"+name+
102 "' is optional and not supported");
103 tRes.tested(name,true);
104 } else {
105 log.println("Exception occurred while testing property '" +
106 name + "'");
107 ex.printStackTrace(log);
108 tRes.tested(name, false);
111 catch (Exception e) {
112 log.println("Exception occurred while testing property '" +
113 name + "'");
114 e.printStackTrace(log);
115 tRes.tested(name, false);
119 }// end of changeProp
121 public XStyle newStyle(Object oldStyle) {
122 XStyle Style1 = (XStyle) tEnv.getObjRelation("Style1");
123 XStyle Style2 = (XStyle) tEnv.getObjRelation("Style2");
124 XStyle back = null;
125 if ( (Style1!=null) && (Style2!=null) ) {
126 if ( ((XStyle) oldStyle).equals(Style1) ) {
127 back = Style2;
128 } else {
129 back = Style1;
132 return back;