Ignore:
Timestamp:
2020-07-29T21:19:37+02:00 (4 years ago)
Author:
simon04
Message:

fix #19551 - Add ImageProviderTest.testTicket19551 (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java

    r16768 r16810  
    77import static org.junit.Assert.assertNotNull;
    88import static org.junit.Assert.assertTrue;
     9import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    910
    1011import java.awt.Color;
    1112import java.awt.Dimension;
     13import java.awt.Graphics;
    1214import java.awt.GraphicsEnvironment;
    1315import java.awt.GridLayout;
    14 import java.awt.Graphics;
    1516import java.awt.Image;
    1617import java.awt.Point;
     
    2223import java.io.File;
    2324import java.io.IOException;
     25import java.util.Arrays;
     26import java.util.Collections;
    2427import java.util.List;
    2528import java.util.logging.Handler;
     
    3841import org.openstreetmap.josm.JOSMFixture;
    3942import org.openstreetmap.josm.TestUtils;
     43import org.openstreetmap.josm.data.coor.LatLon;
     44import org.openstreetmap.josm.data.osm.Node;
     45import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
     46import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
     47import org.openstreetmap.josm.gui.tagging.presets.items.Key;
    4048import org.openstreetmap.josm.testutils.JOSMTestRules;
     49import org.xml.sax.SAXException;
    4150
    4251import com.kitfox.svg.SVGConst;
     
    4857 */
    4958public class ImageProviderTest {
    50    
     59
    5160    /**
    5261     * Setup test.
     
    126135        assertNotNull(img);
    127136        assertFalse(handler.failed);
     137    }
     138
     139    /**
     140     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/19551">#19551</a>
     141     * @throws SAXException If the type cannot be set (shouldn't throw)
     142     */
     143    @Test
     144    public void testTicket19551() throws SAXException {
     145        TaggingPreset badPreset = new TaggingPreset();
     146        badPreset.setType("node,way,relation,closedway");
     147        Key key = new Key();
     148        key.key = "amenity";
     149        key.value = "fuel";
     150        badPreset.data.add(key);
     151        TaggingPreset goodPreset = new TaggingPreset();
     152        goodPreset.setType("node,way,relation,closedway");
     153        goodPreset.data.add(key);
     154        goodPreset.iconName = "stop";
     155        TaggingPresets.addTaggingPresets(Arrays.asList(goodPreset, badPreset));
     156        Node node = new Node(LatLon.ZERO);
     157        node.put("amenity", "fuel");
     158        assertDoesNotThrow(() -> ImageProvider.getPadded(node, ImageProvider.ImageSizes.MAP.getImageDimension(), Collections.emptyList()));
    128159    }
    129160
Note: See TracChangeset for help on using the changeset viewer.