summaryrefslogtreecommitdiff
path: root/qadevOOo/runner
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/runner
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/runner')
-rw-r--r--qadevOOo/runner/util/ValueChanger.java17
1 files changed, 14 insertions, 3 deletions
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