Changeset 6597 in josm for trunk/test


Ignore:
Timestamp:
2014-01-02T22:45:23+01:00 (11 years ago)
Author:
simon04
Message:

see #9492 - split "Create Multipolyon" in % and "Update Multipolygon"; for the latter obtain the relation from the selected ways (if unambiguous)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy

    r6564 r6597  
    1818    }
    1919
    20     def getRefToRoleMap(Relation relation) {
     20    static def getRefToRoleMap(Relation relation) {
    2121        def refToRole = new TreeMap<String, String>()
    2222        for (i in relation.getMembers()) {
     
    2828    void testCreate1() {
    2929        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    30         def mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), Collections.emptyList())
     30        def mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null)
    3131        assert mp.a.getDescriptionText() == "Sequence: Create multipolygon"
    3232        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.1.2:outer, 1.2:inner]"
     
    3636        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    3737        def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.", false, false))
    38         def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, Collections.emptyList())
     38        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    3939        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner, 1.1.2:inner]"
    4040    }
     
    4343        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    4444        def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=\".*1\$\"", false, true))
    45         def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, Collections.emptyList())
     45        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    4646        assert mp.b.getMembersCount() == 3
    4747        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer]"
    4848        def ways2 = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1.2", false, true))
    49         def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, Collections.singleton(mp.b))
     49        def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, mp.b)
    5050        assert mp2.b.getMembersCount() == 4
    5151        assert getRefToRoleMap(mp2.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.2:inner]"
     
    5555        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    5656        def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.1", false, false))
    57         def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, Collections.emptyList())
     57        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    5858        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner]"
    5959        def ways2 = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1.1 OR ref=1.2 OR ref=1.1.2", false, true))
    60         def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, Collections.singleton(mp.b))
     60        def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, mp.b)
    6161        assert getRefToRoleMap(mp2.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.1.2:outer, 1.2:inner]"
    6262    }
Note: See TracChangeset for help on using the changeset viewer.