Changeset 12965 in josm for trunk


Ignore:
Timestamp:
2017-10-09T16:47:21+02:00 (7 years ago)
Author:
bastiK
Message:

MapCSSRendererTest: use proper bounds and avoid 20 px border added by NavigatableComponent

Location:
trunk/test
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    r12825 r12965  
    3131import org.junit.runners.Parameterized;
    3232import org.junit.runners.Parameterized.Parameters;
     33import org.openstreetmap.josm.Main;
    3334import org.openstreetmap.josm.TestUtils;
    3435import org.openstreetmap.josm.data.Bounds;
     36import org.openstreetmap.josm.data.ProjectionBounds;
    3537import org.openstreetmap.josm.data.osm.DataSet;
    3638import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    7072    private TestConfig testConfig;
    7173
     74    // development flag - set to true in order to update all reference images
     75    private static final boolean UPDATE_ALL = false;
     76
    7277    /**
    7378     * The different configurations of this test.
     
    195200            }
    196201        };
    197         nc.zoomTo(testConfig.testArea);
     202        ProjectionBounds pb = new ProjectionBounds();
     203        pb.extend(Main.getProjection().latlon2eastNorth(testConfig.testArea.getMin()));
     204        pb.extend(Main.getProjection().latlon2eastNorth(testConfig.testArea.getMax()));
     205        double scale = (pb.maxEast - pb.minEast) / IMAGE_SIZE;
     206        nc.zoomTo(pb.getCenter(), scale);
     207
    198208        dataSet.allPrimitives().stream().forEach(this::loadPrimitiveStyle);
    199209        dataSet.setSelected(dataSet.allPrimitives().stream().filter(n -> n.isKeyTrue("selected")).collect(Collectors.toList()));
     
    211221        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    212222        new StyledMapRenderer(g, nc, false).render(dataSet, false, testConfig.testArea);
     223
     224        if (UPDATE_ALL) {
     225            ImageIO.write(image, "png", new File(testConfig.getTestDirectory() + "/reference.png"));
     226            return;
     227        }
    213228
    214229        BufferedImage reference = testConfig.getReference();
Note: See TracChangeset for help on using the changeset viewer.