Changeset 11493 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2017-01-25T14:12:07+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r11491 r11493 10 10 import java.io.StringReader; 11 11 import java.util.Collection; 12 import java.util.HashSet; 12 13 import java.util.Iterator; 13 14 import java.util.LinkedHashSet; … … 32 33 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.ParseResult; 33 34 import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.TagCheck; 35 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 36 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 34 37 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; 35 38 import org.openstreetmap.josm.io.OsmReader; … … 48 51 @Rule 49 52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 public JOSMTestRules test = new JOSMTestRules().projection(); 53 public JOSMTestRules test = new JOSMTestRules().projection().platform(); 51 54 52 55 static MapCSSTagChecker buildTagChecker(String css) throws ParseException { … … 216 219 } 217 220 } 221 222 private void doTestNaturalWood(int ticket, String filename, int errorsCount, int setsCount) throws Exception { 223 final MapCSSTagChecker test = buildTagChecker( 224 "area:closed:areaStyle[tag(\"natural\") = parent_tag(\"natural\")] ⧉ area:closed:areaStyle[natural] {" + 225 " throwWarning: tr(\"Overlapping Identical Natural Areas\");" + 226 "}"); 227 final MapCSSStyleSource style = new MapCSSStyleSource( 228 "area[natural=wood] {" + 229 " fill-color: woodarea#008000;" + 230 "}"); 231 MapPaintStyles.addStyle(style); 232 try (InputStream is = TestUtils.getRegressionDataStream(ticket, filename)) { 233 test.visit(OsmReader.parseDataSet(is, null).allPrimitives()); 234 List<TestError> errors = test.getErrors(); 235 assertEquals(errorsCount, errors.size()); 236 Set<Set<OsmPrimitive>> primitives = new HashSet<>(); 237 for (TestError e : errors) { 238 primitives.add(new HashSet<>(e.getPrimitives())); 239 } 240 assertEquals(setsCount, primitives.size()); 241 } finally { 242 MapPaintStyles.removeStyle(style); 243 } 244 } 245 246 /** 247 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12627">Bug #12627</a>. 248 * @throws Exception if an error occurs 249 */ 250 @Test 251 @Ignore("not fixed yet") 252 public void testTicket12627() throws Exception { 253 doTestNaturalWood(12627, "overlapping.osm", 1, 1); 254 } 255 256 /** 257 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/14289">Bug #14289</a>. 258 * @throws Exception if an error occurs 259 */ 260 @Test 261 @Ignore("not fixed yet") 262 public void testTicket14289() throws Exception { 263 doTestNaturalWood(14289, "example2.osm", 3, 3); 264 } 218 265 }
Note:
See TracChangeset
for help on using the changeset viewer.