Changeset 11693 in josm


Ignore:
Timestamp:
2017-03-05T17:44:07+01:00 (5 months ago)
Author:
michael2402
Message:

Add new MapCSS reference test for way dashes/color and node texts.

Location:
trunk/test
Files:
12 added
1 edited

Legend:

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

    r11691 r11693  
    7070     * @return The parameters.
    7171     */
    72     @Parameters(name="{1}")
     72    @Parameters(name = "{1}")
    7373    public static Collection<Object[]> runs() {
    7474        return Stream.of(
     
    7676                new TestConfig("node-shapes", AREA_DEFAULT),
    7777
     78                /** Text for nodes */
     79                new TestConfig("node-text", AREA_DEFAULT),
     80
    7881                /** Tests that StyledMapRenderer#drawWay respects width */
    79                 new TestConfig("way-width", AREA_DEFAULT)
     82                new TestConfig("way-width", AREA_DEFAULT),
     83
     84                /** Tests the way color property, including alpha */
     85                new TestConfig("way-color", AREA_DEFAULT),
     86
     87                /** Tests dashed ways. */
     88                new TestConfig("way-dashes", AREA_DEFAULT)
    8089
    8190                ).map(e -> new Object[] {e, e.testDirectory})
     
    147156        nc.zoomTo(testConfig.testArea);
    148157        dataSet.allPrimitives().stream().forEach(n -> n.setHighlighted(n.isKeyTrue("highlight")));
     158        dataSet.allPrimitives().stream().filter(n -> n.isKeyTrue("disabled")).forEach(n -> n.setDisabledState(false));
    149159        Graphics2D g = image.createGraphics();
    150160        // Force all render hints to be defaults - do not use platform values
     
    207217    /**
    208218     * Check if two colors differ
    209      * @param expected
    210      * @param result
     219     * @param expected The expected color
     220     * @param actual The actual color
    211221     * @return <code>true</code> if they differ.
    212222     */
    213     private boolean colorsAreSame(int expected, int result) {
     223    private boolean colorsAreSame(int expected, int actual) {
    214224        int expectedAlpha = expected >> 24;
    215225        if (expectedAlpha == 0) {
    216             return (result & 0xff000000) == 0;
     226            return actual >> 24 == 0;
    217227        } else {
    218             return expected == result;
     228            return expected == actual;
    219229        }
    220230    }
Note: See TracChangeset for help on using the changeset viewer.