Changeset 3991 in josm for trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.groovy
- Timestamp:
- 2011-03-14T00:25:41+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.groovy
r3988 r3991 65 65 } 66 66 } 67 // License: GPL. For details, see LICENSE file.68 package org.openstreetmap.josm.gui.mappaint69 67 70 import org.junit.*71 import org.openstreetmap.josm.fixtures.JOSMFixture;72 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy73 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.StaticLabelCompositionStrategy;74 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.TagLookupCompositionStrategy75 import org.openstreetmap.josm.data.osm.Node;76 77 class LabelCompositionStrategyTest {78 79 @BeforeClass80 public static void createJOSMFixture(){81 JOSMFixture.createUnitTestFixture().init()82 }83 84 @Test85 public void createStaticLabelCompositionStrategy() {86 def n = new Node()87 88 def strat = new StaticLabelCompositionStrategy(null)89 assert strat.compose(n) == null90 91 strat = new StaticLabelCompositionStrategy("a label")92 assert strat.compose(n) == "a label"93 }94 95 @Test96 public void createTagLookupCompositionStrategy() {97 def n = new Node()98 n.put("my-tag", "my-value")99 100 def strat = new TagLookupCompositionStrategy(null)101 assert strat.compose(n) == null102 103 strat = new TagLookupCompositionStrategy("name")104 assert strat.compose(n) == null105 106 strat = new TagLookupCompositionStrategy("my-tag")107 assert strat.compose(n) == "my-value"108 }109 110 @Test111 public void createDeriveLabelFromNameTagsCompositionStrategy() {112 def n113 def strat114 115 strat = new DeriveLabelFromNameTagsCompositionStrategy()116 strat.setNameTags(null)117 assert strat.getNameTags() == []118 119 strat = new DeriveLabelFromNameTagsCompositionStrategy()120 strat.setNameTags(["name", "brand"])121 assert strat.getNameTags() == ["name", "brand"]122 123 n = new Node()124 n.put("brand", "my brand")125 assert strat.compose(n) == "my brand"126 127 n = new Node()128 n.put("name", "my name")129 n.put("brand", "my brand")130 assert strat.compose(n) == "my name"131 }132 }
Note:
See TracChangeset
for help on using the changeset viewer.