Changeset 16590 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2020-06-10T08:04:42+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java
r16583 r16590 6 6 import static org.openstreetmap.josm.data.osm.OsmPrimitiveType.NODE; 7 7 8 import java.util.Collections; 9 8 10 import org.junit.Rule; 9 11 import org.junit.Test; … … 12 14 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 13 15 import org.openstreetmap.josm.data.osm.User; 16 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 14 17 import org.openstreetmap.josm.gui.mappaint.Environment; 15 18 import org.openstreetmap.josm.gui.util.GuiHelper; … … 113 116 public void testPref() { 114 117 String key = "Functions.JOSM_pref"; 118 Config.getPref().put(key, null); 115 119 assertEquals("foobar", Functions.JOSM_pref(null, key, "foobar")); 116 120 Config.getPref().put(key, "baz"); … … 124 128 }); 125 129 assertEquals("foobar", Functions.JOSM_pref(null, key, "foobar")); 130 Config.getPref().put(key, null); 126 131 } 132 133 /** 134 * Unit test of {@link Functions#JOSM_pref}, color handling 135 */ 136 @Test 137 public void testPrefColor() { 138 String key = "Functions.JOSM_pref"; 139 String colorKey = NamedColorProperty.NAMED_COLOR_PREFIX + NamedColorProperty.COLOR_CATEGORY_MAPPAINT + ".unknown." + key; 140 Config.getPref().put(colorKey, null); 141 assertEquals("#000000", Functions.JOSM_pref(null, key, "#000000")); 142 Config.getPref().putList(colorKey, Collections.singletonList("#00FF00")); 143 GuiHelper.runInEDTAndWait(() -> { 144 // await org.openstreetmap.josm.gui.mappaint.ElemStyles.clearCached 145 }); 146 assertEquals("#00FF00", Functions.JOSM_pref(null, key, "#000000")); 147 Config.getPref().put(colorKey, null); 148 GuiHelper.runInEDTAndWait(() -> { 149 // await org.openstreetmap.josm.gui.mappaint.ElemStyles.clearCached 150 }); 151 assertEquals("#000000", Functions.JOSM_pref(null, key, "#000000")); 152 Config.getPref().put(colorKey, null); 153 } 154 127 155 }
Note:
See TracChangeset
for help on using the changeset viewer.