Changeset 17275 in josm for trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java
- Timestamp:
- 2020-10-28T20:41:00+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java
r17144 r17275 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit.Assert.assertEquals;5 import static org.junit.Assert.assertFalse;6 import static org.junit.Assert.assertNotNull;7 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNotNull; 8 8 import static org.openstreetmap.josm.gui.mappaint.MapCSSRendererTest.assertImageEquals; 9 9 … … 48 48 * Unit tests of {@link ImageProvider} class. 49 49 */ 50 publicclass ImageProviderTest {50 class ImageProviderTest { 51 51 52 52 /** … … 94 94 */ 95 95 @Test 96 publicvoid testTicket9984() throws IOException {96 void testTicket9984() throws IOException { 97 97 File file = new File(TestUtils.getRegressionDataFile(9984, "tile.png")); 98 98 assertEquals(Transparency.TRANSLUCENT, ImageProvider.read(file, true, true).getTransparency()); … … 108 108 */ 109 109 @Test 110 publicvoid testTicket10030() throws IOException {110 void testTicket10030() throws IOException { 111 111 File file = new File(TestUtils.getRegressionDataFile(10030, "tile.jpg")); 112 112 BufferedImage img = ImageProvider.read(file, true, true); … … 120 120 @Test 121 121 @SuppressFBWarnings(value = "LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE") 122 publicvoid testTicket14319() throws IOException {122 void testTicket14319() throws IOException { 123 123 LogHandler14319 handler = new LogHandler14319(); 124 124 Logger.getLogger(SVGConst.SVG_LOGGER).addHandler(handler); … … 134 134 */ 135 135 @Test 136 publicvoid testTicket19551() throws SAXException {136 void testTicket19551() throws SAXException { 137 137 TaggingPreset badPreset = new TaggingPreset(); 138 138 badPreset.setType("node,way,relation,closedway"); … … 155 155 */ 156 156 @Test 157 publicvoid testDataUrl() {157 void testDataUrl() { 158 158 // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML 159 159 assertNotNull(ImageProvider.get("data:image/png;base64," + … … 167 167 */ 168 168 @Test 169 publicvoid testImageIcon() throws IOException {169 void testImageIcon() throws IOException { 170 170 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 171 171 testImage(12, 9, "housenumber_small-AUTO-null", resource.getImageIcon()); … … 182 182 */ 183 183 @Test 184 publicvoid testImageIconBounded() throws IOException {184 void testImageIconBounded() throws IOException { 185 185 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 186 186 testImage(8, 6, "housenumber_small-BOUNDED-08x08", resource.getImageIconBounded(new Dimension(8, 8))); … … 194 194 */ 195 195 @Test 196 publicvoid testImageIconPadded() throws IOException {196 void testImageIconPadded() throws IOException { 197 197 ImageResource resource = new ImageProvider("presets/misc/housenumber_small").getResource(); 198 198 testImage(8, 8, "housenumber_small-PADDED-08x08", resource.getPaddedIcon(new Dimension(8, 8))); … … 204 204 final BufferedImage image = (BufferedImage) icon.getImage(); 205 205 final File referenceFile = getReferenceFile(reference); 206 assertEquals( "width",width, image.getWidth(null));207 assertEquals( "height",height, image.getHeight(null));206 assertEquals(width, image.getWidth(null), "width"); 207 assertEquals(height, image.getHeight(null), "height"); 208 208 assertImageEquals(reference, referenceFile, image, 0, 0, null); 209 209 } … … 219 219 */ 220 220 @Test 221 publicvoid testGetImageIconBounded() {221 void testGetImageIconBounded() { 222 222 int scale = 2; 223 223 GuiSizesHelper.setPixelDensity(scale); … … 240 240 /** 241 241 * Test getting an image for a crosshair cursor. 242 * @param guiScale coefficient of monitor pixel density to be set 243 * @throws IOException in case of I/O error 242 244 */ 243 245 @ParameterizedTest 244 246 @ValueSource(floats = {1.0f, 1.5f, 3.0f}) 245 publicvoid testGetCursorImageForCrosshair(float guiScale) throws IOException {247 void testGetCursorImageForCrosshair(float guiScale) throws IOException { 246 248 GuiSizesHelper.setPixelDensity(guiScale); 247 249 Point hotSpot = new Point(); … … 255 257 /** 256 258 * Test getting an image for a custom cursor with overlay. 259 * @param guiScale coefficient of monitor pixel density to be set 260 * @throws IOException in case of I/O error 257 261 */ 258 262 @ParameterizedTest 259 263 @ValueSource(floats = {1.0f, 1.5f, 3.0f}) 260 publicvoid testGetCursorImageWithOverlay(float guiScale) throws IOException {264 void testGetCursorImageWithOverlay(float guiScale) throws IOException { 261 265 GuiSizesHelper.setPixelDensity(guiScale); 262 266 Point hotSpot = new Point();
Note:
See TracChangeset
for help on using the changeset viewer.