Changeset 11526 in josm for trunk/test/unit/org
- Timestamp:
- 2017-02-02T01:22:52+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/ImageProviderTest.java
r10409 r11526 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 5 6 import static org.junit.Assert.assertNotNull; 6 7 … … 9 10 import java.io.File; 10 11 import java.io.IOException; 12 import java.util.logging.Handler; 13 import java.util.logging.LogRecord; 14 import java.util.logging.Logger; 15 16 import javax.swing.ImageIcon; 11 17 12 18 import org.junit.BeforeClass; … … 15 21 import org.openstreetmap.josm.TestUtils; 16 22 23 import com.kitfox.svg.SVGConst; 24 17 25 /** 18 26 * Unit tests of {@link ImageProvider} class. 19 27 */ 20 28 public class ImageProviderTest { 29 30 private static final class LogHandler14319 extends Handler { 31 boolean failed; 32 33 @Override 34 public void publish(LogRecord record) { 35 if ("Could not load image: https://host-in-the-trusted-network.com/test.jpg".equals(record.getMessage())) { 36 failed = true; 37 } 38 } 39 40 @Override 41 public void flush() { 42 } 43 44 @Override 45 public void close() throws SecurityException { 46 } 47 } 21 48 22 49 /** … … 53 80 54 81 /** 82 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14319">#14319</a> 83 * @throws IOException if an error occurs during reading 84 */ 85 @Test 86 public void testTicket14319() throws IOException { 87 LogHandler14319 handler = new LogHandler14319(); 88 Logger.getLogger(SVGConst.SVG_LOGGER).addHandler(handler); 89 ImageIcon img = new ImageProvider( 90 new File(TestUtils.getRegressionDataDir(14319)).getAbsolutePath(), "attack.svg").get(); 91 assertNotNull(img); 92 assertFalse(handler.failed); 93 } 94 95 /** 55 96 * Test fetching an image using {@code wiki://} protocol. 56 97 */
Note:
See TracChangeset
for help on using the changeset viewer.