tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / drawing / _ShapeDescriptor.java
blob1ffc66ee26240fe286272da5295a1b1090cf9473
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 gValue = oObj.getPropertyValue(name);
79 if (!ro) {
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);
92 } else {
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);
101 } else {
102 log.println("Exception occurred while testing property '" +
103 name + "'");
104 ex.printStackTrace(log);
105 tRes.tested(name, false);
108 catch (Exception e) {
109 log.println("Exception occurred while testing property '" +
110 name + "'");
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");
121 XStyle back = null;
122 if ( (Style1!=null) && (Style2!=null) ) {
123 if ( ((XStyle) oldStyle).equals(Style1) ) {
124 back = Style2;
125 } else {
126 back = Style1;
129 return back;