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
.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);
42 changeProp("LayerID");
45 public void _LayerName() {
47 changeProp("LayerName");
50 public void _MoveProtect() {
51 changeProp("MoveProtect");
56 public void _Printable() {
57 changeProp("Printable");
59 public void _SizeProtect() {
60 changeProp("SizeProtect");
62 public void _Style() {
66 public void _Transformation() {
67 changeProp("Transformation");
70 public void changeProp(String name
) {
74 Object ValueToSet
= null;
78 gValue
= oObj
.getPropertyValue(name
);
80 ValueToSet
= ValueChanger
.changePValue(gValue
);
81 if ( name
.equals("Style") ) {
82 ValueToSet
= newStyle(gValue
);
84 oObj
.setPropertyValue(name
,ValueToSet
);
85 sValue
= oObj
.getPropertyValue(name
);
88 //check get-set methods
89 if (gValue
.equals(sValue
)) {
90 log
.println("Value for '"+name
+"' hasn't changed");
91 tRes
.tested(name
, false);
93 log
.println("Property '"+name
+"' OK");
94 tRes
.tested(name
, true);
96 } catch (com
.sun
.star
.beans
.UnknownPropertyException ex
) {
97 if (isOptional(name
)) {
98 log
.println("Property '"+name
+
99 "' is optional and not supported");
100 tRes
.tested(name
,true);
102 log
.println("Exception occurred while testing property '" +
104 ex
.printStackTrace(log
);
105 tRes
.tested(name
, false);
108 catch (Exception e
) {
109 log
.println("Exception occurred while testing property '" +
111 e
.printStackTrace(log
);
112 tRes
.tested(name
, false);
116 }// end of changeProp
118 public XStyle
newStyle(Object oldStyle
) {
119 XStyle Style1
= (XStyle
) tEnv
.getObjRelation("Style1");
120 XStyle Style2
= (XStyle
) tEnv
.getObjRelation("Style2");
122 if ( (Style1
!=null) && (Style2
!=null) ) {
123 if ( ((XStyle
) oldStyle
).equals(Style1
) ) {