Changeset 19641 in josm for trunk/test/functional/org
- Timestamp:
- 2026-10-06T11:40:41+02:00 (13 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/tools/ImageProviderTest.java
r19613 r19641 6 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 7 import static org.junit.jupiter.api.Assertions.assertNotNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 8 9 import static org.openstreetmap.josm.testutils.ImageTestUtils.assertImageEquals; 9 10 … … 129 130 node.put("amenity", "fuel"); 130 131 assertDoesNotThrow(() -> OsmPrimitiveImageProvider.getResource(node, Collections.emptyList())); 132 } 133 134 /** 135 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/18131">#18131</a> 136 * <p> 137 * The JOSM logo is assembled from clipped paths. Unless the SVG renderer clips with antialiasing, 138 * the outline of the logo shows jagged steps. 139 */ 140 @Test 141 void testTicket18131() { 142 ImageIcon icon = new ImageProvider("logo").setSize(new Dimension(256, 256)).get(); 143 assertNotNull(icon); 144 BufferedImage image = (BufferedImage) icon.getImage(); 145 // For every column, look at the topmost visible pixel: a fully opaque one means a hard, aliased edge 146 int opaqueEdges = 0; 147 int blendedEdges = 0; 148 for (int x = 0; x < image.getWidth(); x++) { 149 for (int y = 0; y < image.getHeight(); y++) { 150 int alpha = image.getRGB(x, y) >>> 24; 151 if (alpha == 0) { 152 continue; 153 } 154 if (alpha == 0xff) { 155 opaqueEdges++; 156 } else { 157 blendedEdges++; 158 } 159 break; 160 } 161 } 162 assertTrue(opaqueEdges * 4 < blendedEdges, 163 "expected an antialiased logo outline, but found " + opaqueEdges + " aliased and " 164 + blendedEdges + " antialiased edge pixels"); 131 165 } 132 166
Note:
See TracChangeset
for help on using the changeset viewer.
