Changeset 6597 in josm for trunk/test
- Timestamp:
- 2014-01-02T22:45:23+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy
r6564 r6597 18 18 } 19 19 20 def getRefToRoleMap(Relation relation) {20 static def getRefToRoleMap(Relation relation) { 21 21 def refToRole = new TreeMap<String, String>() 22 22 for (i in relation.getMembers()) { … … 28 28 void testCreate1() { 29 29 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) 31 31 assert mp.a.getDescriptionText() == "Sequence: Create multipolygon" 32 32 assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.1.2:outer, 1.2:inner]" … … 36 36 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 37 37 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) 39 39 assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner, 1.1.2:inner]" 40 40 } … … 43 43 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 44 44 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) 46 46 assert mp.b.getMembersCount() == 3 47 47 assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer]" 48 48 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) 50 50 assert mp2.b.getMembersCount() == 4 51 51 assert getRefToRoleMap(mp2.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.2:inner]" … … 55 55 def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null); 56 56 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) 58 58 assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner]" 59 59 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) 61 61 assert getRefToRoleMap(mp2.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.1.2:outer, 1.2:inner]" 62 62 }
Note:
See TracChangeset
for help on using the changeset viewer.