summaryrefslogtreecommitdiff
path: root/qadevOOo/tests
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-01-13 15:14:07 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-01-13 15:17:18 +0100
commit7ca657e5eeb883d2a90ef80456f48a7df6e27cba (patch)
tree0281b417df208f98a4f4547d9f55d887d43d3f3c /qadevOOo/tests
parent26a967863c2dba39b6be3bd63c0d625625093eb4 (diff)
css.form.component.{CheckBox,RadioButton} DefaultState property values
...must be in the range 0--2; avoid setting bad values from generic qadevOOo property set tests, and throw an IllegalArgumentException if bad values do get set. Change-Id: Ia4a97d0fac326b3ca2ce254946dc4d418e9dd5a7
Diffstat (limited to 'qadevOOo/tests')
-rw-r--r--qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java54
-rw-r--r--qadevOOo/tests/java/ifc/beans/_XPropertySet.java2
2 files changed, 35 insertions, 21 deletions
diff --git a/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
index 925b20e9e494..b0b645a62552 100644
--- a/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
@@ -53,10 +53,24 @@ import com.sun.star.uno.UnoRuntime;
* @see com.sun.star.beans.XFastPropertySet
*/
public class _XFastPropertySet extends MultiMethodTest {
+ private static final class Prop {
+ public final int handle;
+ public final String name;
+
+ public Prop() {
+ handle = -1;
+ name = null;
+ }
+
+ public Prop(int handle, String name) {
+ this.handle = handle;
+ this.name = name;
+ }
+ };
public XFastPropertySet oObj = null;
- private final List<Integer> handles = new ArrayList<Integer>();
- private int handle = -1;
+ private final List<Prop> props = new ArrayList<Prop>();
+ private Prop prop;
private Set<String> exclude = null ;
/**
@@ -91,26 +105,26 @@ public class _XFastPropertySet extends MultiMethodTest {
Object gValue = null;
Object sValue = null;
- if ( handle == -1) {
+ if ( prop.handle == -1) {
log.println("*** No changeable properties found ***");
tRes.tested("setFastPropertyValue()", false) ;
} else {
try {
- gValue = oObj.getFastPropertyValue(handle);
- sValue = ValueChanger.changePValue(gValue);
- oObj.setFastPropertyValue(handle, sValue);
- sValue = oObj.getFastPropertyValue(handle);
+ gValue = oObj.getFastPropertyValue(prop.handle);
+ sValue = ValueChanger.changePValue(gValue, prop.name);
+ oObj.setFastPropertyValue(prop.handle, sValue);
+ sValue = oObj.getFastPropertyValue(prop.handle);
} catch (com.sun.star.beans.UnknownPropertyException e) {
- log.println("Exception occurred while trying to change property with handle = " + handle);
+ log.println("Exception occurred while trying to change property with handle = " + prop.handle);
e.printStackTrace(log);
} catch (com.sun.star.lang.WrappedTargetException e) {
- log.println("Exception occurred while trying to change property with handle = " + handle);
+ log.println("Exception occurred while trying to change property with handle = " + prop.handle);
e.printStackTrace(log);
} catch (com.sun.star.beans.PropertyVetoException e) {
- log.println("Exception occurred while trying to change property with handle = " + handle);
+ log.println("Exception occurred while trying to change property with handle = " + prop.handle);
e.printStackTrace(log);
} catch (com.sun.star.lang.IllegalArgumentException e) {
- log.println("Exception occurred while trying to change property with handle = " + handle);
+ log.println("Exception occurred while trying to change property with handle = " + prop.handle);
e.printStackTrace(log);
}
@@ -137,16 +151,16 @@ public class _XFastPropertySet extends MultiMethodTest {
getPropsToTest(propertySetInfo);
try {
- oObj.getFastPropertyValue(handle);
+ oObj.getFastPropertyValue(prop.handle);
tRes.tested("getFastPropertyValue()",true);
} catch (com.sun.star.beans.UnknownPropertyException e) {
log.println("Exception occurred while trying to get property '"
- + handle +"'");
+ + prop.handle +"'");
e.printStackTrace(log);
tRes.tested("getFastPropertyValue()",false);
} catch (com.sun.star.lang.WrappedTargetException e) {
log.println("Exception occurred while trying to get property '"
- + handle +"'");
+ + prop.handle +"'");
e.printStackTrace(log);
tRes.tested("getFastPropertyValue()",false);
}
@@ -170,24 +184,24 @@ public class _XFastPropertySet extends MultiMethodTest {
((property.Attributes & PropertyAttribute.MAYBEVOID) == 0);
boolean canChange = false;
if ( isWritable && isNotNull )
- canChange = isChangeable(handle);
+ canChange = isChangeable(handle, name);
if ( isWritable && isNotNull && canChange)
- handles.add(Integer.valueOf(handle));
+ props.add(new Prop(handle, name));
} // endfor
Random rnd = new Random();
- int nr = rnd.nextInt(handles.size());
- handle = handles.get(nr).intValue();
+ int nr = rnd.nextInt(props.size());
+ prop = props.get(nr);
}
- private boolean isChangeable(int handle) {
+ private boolean isChangeable(int handle, String name) {
boolean hasChanged = false;
try {
Object getProp = oObj.getFastPropertyValue(handle);
Object setValue = null;
if (getProp != null)
- setValue = ValueChanger.changePValue(getProp);
+ setValue = ValueChanger.changePValue(getProp, name);
else
log.println("Property with handle = " + handle
+ " is null but 'MAYBEVOID' isn't set");
diff --git a/qadevOOo/tests/java/ifc/beans/_XPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XPropertySet.java
index 630983caa9bd..76aac038c6ed 100644
--- a/qadevOOo/tests/java/ifc/beans/_XPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XPropertySet.java
@@ -281,7 +281,7 @@ public class _XPropertySet extends MultiMethodTest {
try {
log.println("try to change value of property '" + propertyName + "'" );
gValue = oObj.getPropertyValue(propertyName);
- sValue = ValueChanger.changePValue(gValue);
+ sValue = ValueChanger.changePValue(gValue, propertyName);
oObj.setPropertyValue(propertyName, sValue);
sValue = oObj.getPropertyValue(propertyName);
} catch (com.sun.star.beans.PropertyVetoException e) {