Changeset 255 in josm for test/org


Ignore:
Timestamp:
2007-06-13T22:30:51+02:00 (17 years ago)
Author:
imi
Message:
  • fixed AnnotationPreset image loading to load from .jar-ressources as well
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/org/openstreetmap/josm/gui/annotation/AnnotationPresetTest.java

    r193 r255  
    11package org.openstreetmap.josm.gui.annotation;
    22
     3import java.io.ByteArrayInputStream;
    34import java.io.InputStream;
    45import java.lang.reflect.Field;
     
    67
    78import javax.swing.Action;
     9import javax.swing.Icon;
    810
    911import junit.framework.TestCase;
     
    1416import org.openstreetmap.josm.gui.annotation.AnnotationPreset.Label;
    1517import org.openstreetmap.josm.gui.annotation.AnnotationPreset.Text;
     18import org.openstreetmap.josm.tools.ImageProvider;
    1619
    1720public class AnnotationPresetTest extends TestCase {
     
    5558                assertEquals("highway", key.value);
    5659        }
     60       
     61        public void testIconLoadsFromClasspath() throws Exception {
     62                String xml = "<annotations><item icon='logo'></item></annotations>";
     63                List<AnnotationPreset> all = AnnotationPreset.readAll(new ByteArrayInputStream(xml.getBytes()));
     64
     65                assertEquals(1, all.size());
     66
     67                Icon icon = (Icon)all.get(0).getValue(Action.SMALL_ICON);
     68                assertNotNull(icon);
     69                assertEquals("Icon loaded and of correct size",
     70                                24, Math.max(icon.getIconHeight(), icon.getIconWidth()));
     71    }
    5772}
Note: See TracChangeset for help on using the changeset viewer.