Changeset 9279 in josm for trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.groovy
- Timestamp:
- 2016-01-03T16:29:25+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.groovy
r7938 r9279 3 3 4 4 import org.junit.* 5 import org.openstreetmap.josm.JOSMFixture ;6 import org.openstreetmap.josm. gui.mappaint.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy7 import org.openstreetmap.josm.gui.mappaint. LabelCompositionStrategy.StaticLabelCompositionStrategy;8 import org.openstreetmap.josm.gui.mappaint. LabelCompositionStrategy.TagLookupCompositionStrategy9 import org.openstreetmap.josm. data.osm.Node;5 import org.openstreetmap.josm.JOSMFixture 6 import org.openstreetmap.josm.data.osm.Node 7 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy 8 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.StaticLabelCompositionStrategy 9 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.TagLookupCompositionStrategy 10 10 11 11 class LabelCompositionStrategyTest { 12 12 13 13 @BeforeClass 14 14 public static void createJOSMFixture(){ … … 19 19 public void createStaticLabelCompositionStrategy() { 20 20 def n = new Node() 21 21 22 22 def strat = new StaticLabelCompositionStrategy(null) 23 23 assert strat.compose(n) == null 24 24 25 25 strat = new StaticLabelCompositionStrategy("a label") 26 assert strat.compose(n) == "a label" 26 assert strat.compose(n) == "a label" 27 27 } 28 28 29 29 @Test 30 30 public void createTagLookupCompositionStrategy() { 31 31 def n = new Node() 32 32 n.put("my-tag", "my-value") 33 33 34 34 def strat = new TagLookupCompositionStrategy(null) 35 35 assert strat.compose(n) == null 36 36 37 37 strat = new TagLookupCompositionStrategy("name") 38 38 assert strat.compose(n) == null 39 39 40 40 strat = new TagLookupCompositionStrategy("my-tag") 41 41 assert strat.compose(n) == "my-value" 42 42 } 43 43 44 44 @Test 45 45 public void createDeriveLabelFromNameTagsCompositionStrategy() { 46 def n 46 def n 47 47 def strat 48 48 49 49 strat = new DeriveLabelFromNameTagsCompositionStrategy() 50 50 strat.setNameTags(null) 51 51 assert strat.getNameTags() == [] 52 52 53 53 strat = new DeriveLabelFromNameTagsCompositionStrategy() 54 54 strat.setNameTags(["name", "brand"]) 55 55 assert strat.getNameTags() == ["name", "brand"] 56 56 57 57 n = new Node() 58 n.put("brand", "my brand") 58 n.put("brand", "my brand") 59 59 assert strat.compose(n) == "my brand" 60 60 61 61 n = new Node() 62 62 n.put("name", "my name") 63 63 n.put("brand", "my brand") 64 assert strat.compose(n) == "my name" 64 assert strat.compose(n) == "my name" 65 65 } 66 66 }
Note:
See TracChangeset
for help on using the changeset viewer.