Changeset 12978 in josm for trunk/test/functional/org
- Timestamp:
- 2017-10-10T15:04:35+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
r12966 r12978 117 117 118 118 /** Tests text along a way */ 119 new TestConfig("way-text", AREA_DEFAULT) 119 new TestConfig("way-text", AREA_DEFAULT), 120 121 /** Another test for node shapes */ 122 new TestConfig("node-shapes2").setImageWidth(600), 123 /** Tests default values for node shapes */ 124 new TestConfig("node-shapes-default"), 125 /** Tests node shapes with both fill and stroke combined */ 126 new TestConfig("node-shapes-combined"), 127 /** Another test for dashed ways */ 128 new TestConfig("way-dashes2"), 129 /** Tests node text placement */ 130 new TestConfig("node-text2"), 131 /** Tests relation link selector */ 132 new TestConfig("relation-linkselector"), 133 /** Tests parent selector on relation */ 134 new TestConfig("relation-parentselector") 135 120 136 ).map(e -> new Object[] {e, e.testDirectory}) 121 137 .collect(Collectors.toList()); … … 162 178 163 179 ProjectionBounds pb = new ProjectionBounds(); 164 pb.extend(Main.getProjection().latlon2eastNorth(testConfig. testArea.getMin()));165 pb.extend(Main.getProjection().latlon2eastNorth(testConfig. testArea.getMax()));166 double scale = (pb.maxEast - pb.minEast) / IMAGE_SIZE;180 pb.extend(Main.getProjection().latlon2eastNorth(testConfig.getTestArea().getMin())); 181 pb.extend(Main.getProjection().latlon2eastNorth(testConfig.getTestArea().getMax())); 182 double scale = (pb.maxEast - pb.minEast) / testConfig.imageWidth; 167 183 168 184 RenderingHelper.StyleData sd = new RenderingHelper.StyleData(); 169 185 sd.styleUrl = testConfig.getStyleSourceUrl(); 170 RenderingHelper rh = new RenderingHelper(dataSet, testConfig. testArea, scale, Collections.singleton(sd));186 RenderingHelper rh = new RenderingHelper(dataSet, testConfig.getTestArea(), scale, Collections.singleton(sd)); 171 187 rh.setFillBackground(false); 172 188 BufferedImage image = rh.render(); … … 180 196 181 197 // now compute differences: 182 assertEquals( IMAGE_SIZE, reference.getWidth());183 assertEquals( IMAGE_SIZE, reference.getHeight());198 assertEquals(image.getWidth(), reference.getWidth()); 199 assertEquals(image.getHeight(), reference.getHeight()); 184 200 185 201 StringBuilder differences = new StringBuilder(); … … 246 262 private static class TestConfig { 247 263 private final String testDirectory; 248 private finalBounds testArea;264 private Bounds testArea; 249 265 private final ArrayList<String> fonts = new ArrayList<>(); 266 private DataSet ds; 267 private int imageWidth = IMAGE_SIZE; 250 268 251 269 TestConfig(String testDirectory, Bounds testArea) { … … 254 272 } 255 273 274 TestConfig(String testDirectory) { 275 this.testDirectory = testDirectory; 276 } 277 278 public TestConfig setImageWidth(int imageWidth) { 279 this.imageWidth = imageWidth; 280 return this; 281 } 282 256 283 public TestConfig usesFont(String string) { 257 284 this.fonts.add(string); … … 272 299 273 300 public DataSet getOsmDataSet() throws FileNotFoundException, IllegalDataException { 274 return OsmReader.parseDataSet(new FileInputStream(getTestDirectory() + "/data.osm"), null); 301 if (ds == null) { 302 ds = OsmReader.parseDataSet(new FileInputStream(getTestDirectory() + "/data.osm"), null); 303 } 304 return ds; 305 } 306 307 public Bounds getTestArea() throws FileNotFoundException, IllegalDataException { 308 if (testArea == null) { 309 testArea = getOsmDataSet().getDataSourceBounds().get(0); 310 } 311 return testArea; 275 312 } 276 313
Note:
See TracChangeset
for help on using the changeset viewer.