Changeset 15897 in josm for trunk/test/unit/org
- Timestamp:
- 2020-02-22T13:50:09+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java
r14201 r15897 5 5 import static org.junit.Assert.assertFalse; 6 6 import static org.junit.Assert.assertNotNull; 7 import static org.junit.Assert.assertNull; 7 8 9 import java.awt.Dimension; 8 10 import java.awt.Transparency; 9 11 import java.awt.image.BufferedImage; 10 12 import java.io.File; 11 13 import java.io.IOException; 14 import java.util.EnumSet; 12 15 import java.util.logging.Handler; 13 16 import java.util.logging.LogRecord; … … 17 20 18 21 import org.junit.BeforeClass; 22 import org.junit.Rule; 19 23 import org.junit.Test; 20 24 import org.openstreetmap.josm.JOSMFixture; 21 25 import org.openstreetmap.josm.TestUtils; 26 import org.openstreetmap.josm.data.osm.Node; 27 import org.openstreetmap.josm.data.osm.OsmUtils; 28 import org.openstreetmap.josm.testutils.JOSMTestRules; 29 import org.openstreetmap.josm.tools.ImageProvider.GetPaddedOptions; 22 30 23 31 import com.kitfox.svg.SVGConst; … … 29 37 */ 30 38 public class ImageProviderTest { 39 40 /** 41 * Setup test. 42 */ 43 @Rule 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 public JOSMTestRules test = new JOSMTestRules().mapStyles().presets(); 31 46 32 47 private static final class LogHandler14319 extends Handler { … … 116 131 "//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==")); 117 132 } 133 134 /** 135 * Unit test of {@link ImageProvider#getPadded}. 136 */ 137 @Test 138 public void testGetPadded() { 139 final EnumSet<GetPaddedOptions> noDefault = EnumSet.of(GetPaddedOptions.NO_DEFAULT); 140 final Dimension iconSize = new Dimension(16, 16); 141 142 assertNull(ImageProvider.getPadded(new Node(), new Dimension(0, 0))); 143 assertNotNull(ImageProvider.getPadded(new Node(), iconSize)); 144 assertNull(ImageProvider.getPadded(new Node(), iconSize, noDefault)); 145 assertNotNull(ImageProvider.getPadded(OsmUtils.createPrimitive("node amenity=restaurant"), iconSize, noDefault)); 146 assertNull(ImageProvider.getPadded(OsmUtils.createPrimitive("node barrier=hedge"), iconSize, 147 EnumSet.of(GetPaddedOptions.NO_DEFAULT, GetPaddedOptions.NO_DEPRECATED))); 148 assertNotNull(ImageProvider.getPadded(OsmUtils.createPrimitive("way waterway=stream"), iconSize, noDefault)); 149 assertNotNull(ImageProvider.getPadded(OsmUtils.createPrimitive("relation type=route route=railway"), iconSize, noDefault)); 150 } 118 151 }
Note:
See TracChangeset
for help on using the changeset viewer.