Changeset 8257 in josm for trunk


Ignore:
Timestamp:
2015-04-25T09:12:12+02:00 (10 years ago)
Author:
simon04
Message:

fix #11370 - "area" is not supported in validator asserts

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r7798 r8257  
    6767        final OsmPrimitive p = "n".equals(x[0]) || "node".equals(x[0])
    6868                ? new Node(LatLon.ZERO)
    69                 : "w".equals(x[0]) || "way".equals(x[0])
     69                : "w".equals(x[0]) || "way".equals(x[0]) || /*for MapCSS related usage*/ "area".equals(x[0])
    7070                ? new Way()
    7171                : "r".equals(x[0]) || "relation".equals(x[0])
     
    7373                : null;
    7474        if (p == null) {
    75             throw new IllegalArgumentException("Expecting n/node/w/way/r/relation, but got " + x[0]);
     75            throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + "'");
    7676        }
    7777        for (final Map.Entry<String, String> i : TextTagParser.readTagsFromText(x[1]).entrySet()) {
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r7937 r8257  
    22package org.openstreetmap.josm;
    33
    4 import static org.hamcrest.CoreMatchers.is;
    5 import static org.junit.Assert.assertThat;
    6 import static org.junit.Assert.assertTrue;
    74import static org.junit.Assert.fail;
    85
    96import java.util.Arrays;
    107import java.util.Comparator;
    11 
    12 import org.junit.Test;
    13 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    14 import org.openstreetmap.josm.data.osm.OsmUtils;
    15 import org.openstreetmap.josm.data.osm.Way;
    168
    179/**
     
    5042    public static String getRegressionDataFile(int ticketid, String filename) {
    5143        return getRegressionDataDir(ticketid) + '/' + filename;
    52     }
    53 
    54     @Test
    55     public void testCreatePrimitive() throws Exception {
    56         final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");
    57         assertTrue(p instanceof Way);
    58         assertThat(p.keySet().size(), is(2));
    59         assertThat(p.get("name"), is("Foo"));
    60         assertThat(p.get("railway"), is("rail"));
    61     }
    62 
    63     @Test(expected = IllegalArgumentException.class)
    64     public void testCreatePrimitiveFail() throws Exception {
    65         OsmUtils.createPrimitive("noway name=Foo");
    6644    }
    6745
Note: See TracChangeset for help on using the changeset viewer.