aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hochstein2013-01-14 05:10:39 (EST)
committerDirk Fauth2013-01-14 05:10:39 (EST)
commitd4bc3994ec59e292ea803c901a57543583b84b11 (patch)
treed0c58715286cf45e5f5b5e0abe9d24a7dc0b58a7
parent86507af375e4b1693230b3267e2632a6107ceedd (diff)
downloadorg.eclipse.nebula.widgets.nattable-d4bc3994ec59e292ea803c901a57543583b84b11.zip
org.eclipse.nebula.widgets.nattable-d4bc3994ec59e292ea803c901a57543583b84b11.tar.gz
org.eclipse.nebula.widgets.nattable-d4bc3994ec59e292ea803c901a57543583b84b11.tar.bz2
Bug 390943 - fixed returning color white for not persisted colors
-rw-r--r--org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java11
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistor.java2
2 files changed, 9 insertions, 4 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java
index b5e93aa..7daad4a 100644
--- a/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java
+++ b/org.eclipse.nebula.widgets.nattable.core.test/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistorTest.java
@@ -11,6 +11,7 @@
package org.eclipse.nebula.widgets.nattable.persistence;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import java.util.Properties;
@@ -38,11 +39,15 @@ public class ColorPersistorTest {
}
@Test
- public void shouldRecostructColorInstanceFromSavedRGBString() throws Exception {
+ public void shouldLoadColorFromSavedRGBString() throws Exception {
properties.setProperty("prefix.color", "255, 0, 0");
-
Color actual = ColorPersistor.loadColor("prefix", properties);
-
assertEquals(TEST_COLOR, actual);
}
+
+ @Test
+ public void shouldFailToLoadForMissingRGBString() throws Exception {
+ Color actual = ColorPersistor.loadColor("missing", properties);
+ assertNull(actual);
+ }
}
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistor.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistor.java
index 5b4bbf5..f24c2cf 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistor.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/persistence/ColorPersistor.java
@@ -42,7 +42,7 @@ public class ColorPersistor {
String colorAsString = properties.getProperty(prefix);
if (colorAsString == null) {
- return DEFAULT_COLOR;
+ return null;
} else {
return asColor(colorAsString);
}