Changeset 11069 in josm for trunk/test
- Timestamp:
- 2016-10-01T22:08:48+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/corrector/ReverseWayTagCorrectorTest.java
r11061 r11069 53 53 assertSwitch(new Tag("direction", "backward"), new Tag("direction", "forward")); 54 54 assertSwitch(new Tag("direction", "north"), new Tag("direction", "south")); 55 assertSwitch(new Tag("direction", "NNE"), new Tag("direction", "SSW"));56 assertSwitch(new Tag("direction", "270"), new Tag("direction", "90"));57 assertSwitch(new Tag("direction", "135"), new Tag("direction", "315"));58 assertSwitch(new Tag("direction", "337"), new Tag("direction", "157"));59 55 // :left/:right with oneway (see #10977) 60 56 assertSwitch(new Tag("cycleway:left:oneway", "-1"), new Tag("cycleway:right:oneway", "yes")); … … 118 114 } 119 115 116 private Map<OsmPrimitive, List<TagCorrection>> getTagCorrectionsForWay(String middleNodeTags) { 117 final OsmPrimitive n1 = OsmUtils.createPrimitive("node"); 118 final OsmPrimitive n2 = OsmUtils.createPrimitive("node " + middleNodeTags); 119 final OsmPrimitive n3 = OsmUtils.createPrimitive("node"); 120 final Way w = new Way(); 121 Stream.of(n1, n2, n3).map(Node.class::cast).forEach(w::addNode); 122 return ReverseWayTagCorrector.getTagCorrectionsMap(w); 123 } 124 120 125 /** 121 126 * Test tag correction on way nodes … … 123 128 @Test 124 129 public void testSwitchingWayNodes() { 125 final OsmPrimitive n1 = OsmUtils.createPrimitive("node"); 126 final OsmPrimitive n2 = OsmUtils.createPrimitive("node direction=SSW"); 127 final OsmPrimitive n3 = OsmUtils.createPrimitive("node"); 128 final Way w = new Way(); 129 Stream.of(n1, n2, n3).map(Node.class::cast).forEach(w::addNode); 130 final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = ReverseWayTagCorrector.getTagCorrectionsMap(w); 130 final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = getTagCorrectionsForWay("direction=forward"); 131 131 Assert.assertEquals(1, tagCorrections.size()); 132 Assert.assertEquals(Collections.singleton(n2), 133 tagCorrections.keySet()); 134 Assert.assertEquals(Collections.singletonList(new TagCorrection("direction", "SSW", "direction", "NNE")), 132 Assert.assertEquals(Collections.singletonList(new TagCorrection("direction", "forward", "direction", "backward")), 135 133 tagCorrections.values().iterator().next()); 136 134 } 135 136 /** 137 * Test tag correction on way nodes are not applied for absolute values such as compass cardinal directions 138 */ 139 @Test 140 public void testNotSwitchingWayNodes() { 141 Assert.assertEquals(0, getTagCorrectionsForWay("direction=SSW").size()); 142 Assert.assertEquals(0, getTagCorrectionsForWay("direction=145").size()); 143 } 137 144 }
Note:
See TracChangeset
for help on using the changeset viewer.