summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--forms/source/component/refvaluecomponent.cxx11
-rw-r--r--qadevOOo/runner/util/ValueChanger.java17
-rw-r--r--qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java54
-rw-r--r--qadevOOo/tests/java/ifc/beans/_XPropertySet.java2
4 files changed, 58 insertions, 26 deletions
diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx
index b3f4afe30590..0be4706f9d73 100644
--- a/forms/source/component/refvaluecomponent.cxx
+++ b/forms/source/component/refvaluecomponent.cxx
@@ -103,8 +103,15 @@ namespace frm
case PROPERTY_ID_DEFAULT_STATE:
{
- sal_Int16 nDefaultChecked( (sal_Int16)TRISTATE_FALSE );
- OSL_VERIFY( _rValue >>= nDefaultChecked );
+ sal_Int16 nDefaultChecked;
+ if (!(_rValue >>= nDefaultChecked) || nDefaultChecked < 0
+ || nDefaultChecked > 2)
+ {
+ throw css::lang::IllegalArgumentException(
+ ("DefaultState property value must be a SHORT in the range"
+ " 0--2"),
+ css::uno::Reference<css::uno::XInterface>(), -1);
+ }
m_eDefaultChecked = (ToggleState)nDefaultChecked;
resetNoBroadcast();
}
diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java
index 87cc2e712cc6..197de43c81d6 100644
--- a/qadevOOo/runner/util/ValueChanger.java
+++ b/qadevOOo/runner/util/ValueChanger.java
@@ -32,7 +32,7 @@ import com.sun.star.uno.AnyConverter;
public class ValueChanger {
// Method to change a Value, thought for properties
- public static Object changePValue(Object oldValue) {
+ public static Object changePValue(Object oldValue, String name) {
Object newValue = null;
@@ -57,8 +57,15 @@ public class ValueChanger {
long oldlong = ((Long) oldValue).longValue();
newValue = Long.valueOf(oldlong + 15);
} else if (oldValue instanceof Short) {
- short oldshort = ((Short) oldValue).shortValue();
- newValue = Short.valueOf((short) (oldshort + 1));
+ short n = ((Short) oldValue).shortValue();
+ // css.form.component.{CheckBox,RadioButton} DefaultState properties
+ // must have values in the range 0--2:
+ if ("DefaultState".equals(name) && n == 2) {
+ --n;
+ } else {
+ ++n;
+ }
+ newValue = Short.valueOf(n);
} else if (oldValue instanceof Byte) {
byte oldbyte = ((Byte) oldValue).byteValue();
newValue = Byte.valueOf((byte) (oldbyte + 1));
@@ -1000,6 +1007,10 @@ public class ValueChanger {
} // end of Change PValue
+ public static Object changePValue(Object oldValue) {
+ return changePValue(oldValue, null);
+ }
+
/**
* Checks if the passed value is the API structure. The value assumed to be
* a structure if there are no public methods, and all public fields are not
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) {