Changeset 11698 in josm for trunk/test/unit
- Timestamp:
- 2017-03-08T16:07:36+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
r11697 r11698 34 34 import org.openstreetmap.josm.data.Bounds; 35 35 import org.openstreetmap.josm.data.osm.DataSet; 36 import org.openstreetmap.josm.data.osm.OsmPrimitive; 36 37 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 37 38 import org.openstreetmap.josm.gui.NavigatableComponent; … … 70 71 /** 71 72 * The different configurations of this test. 73 * 72 74 * @return The parameters. 73 75 */ … … 88 90 89 91 /** Tests dashed ways. */ 90 new TestConfig("way-dashes", AREA_DEFAULT) 92 new TestConfig("way-dashes", AREA_DEFAULT), 93 94 /** Tests if all styles are sorted correctly. Tests {@link StyleRecord#compareTo(StyleRecord)} */ 95 new TestConfig("order", AREA_DEFAULT) 91 96 92 97 ).map(e -> new Object[] {e, e.testDirectory}) … … 113 118 114 119 List<String> fonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()); 115 for (String font : testConfig.fonts) {120 for (String font : testConfig.fonts) { 116 121 Assume.assumeTrue("Test requires font: " + font, fonts.contains(font)); 117 122 } … … 138 143 } 139 144 MapPaintStyles.getStyles().setStyleSources(Arrays.asList(source)); 145 MapPaintStyles.fireMapPaintSylesUpdated(); 146 MapPaintStyles.getStyles().clearCached(); 140 147 141 148 } finally { … … 162 169 }; 163 170 nc.zoomTo(testConfig.testArea); 164 dataSet.allPrimitives().stream().forEach(n -> n.setHighlighted(n.isKeyTrue("highlight"))); 165 dataSet.allPrimitives().stream().filter(n -> n.isKeyTrue("disabled")).forEach(n -> n.setDisabledState(false)); 171 dataSet.allPrimitives().stream().forEach(this::loadPrimitiveStyle); 172 dataSet.setSelected(dataSet.allPrimitives().stream().filter(n -> n.isKeyTrue("selected")).collect(Collectors.toList())); 173 166 174 Graphics2D g = image.createGraphics(); 167 175 // Force all render hints to be defaults - do not use platform values … … 217 225 ImageIO.write(diffImage, "png", new File(testConfig.getTestDirectory() + "/test-differences.png")); 218 226 219 fail(MessageFormat.format("Images for test { 1} differ at {2} points: {3}",227 fail(MessageFormat.format("Images for test {0} differ at {1} points: {2}", 220 228 testConfig.testDirectory, differencePoints.size(), differences.toString())); 229 } 230 } 231 232 private void loadPrimitiveStyle(OsmPrimitive n) { 233 n.setHighlighted(n.isKeyTrue("highlight")); 234 if (n.isKeyTrue("disabled")) { 235 n.setDisabledState(false); 221 236 } 222 237 }
Note:
See TracChangeset
for help on using the changeset viewer.