Changeset 11697 in josm for trunk


Ignore:
Timestamp:
2017-03-07T23:45:28+01:00 (8 years ago)
Author:
michael2402
Message:

MapCSSRendererTest: Require fixed font for text drawing test.

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/data/renderer/node-text/style.mapcss

    r11693 r11697  
    99        symbol-fill-color: #8888ff;
    1010        text-color: red;
     11        font-family: DejaVu Sans;
    1112        _match: regexp_match("n(.+)", tag("test"));
    1213        text: eval(concat("Test ", get(prop("_match"),1)));
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    r11693 r11697  
    66
    77import java.awt.Graphics2D;
     8import java.awt.GraphicsEnvironment;
    89import java.awt.Point;
    910import java.awt.RenderingHints;
     
    1718import java.util.Arrays;
    1819import java.util.Collection;
     20import java.util.List;
    1921import java.util.stream.Collectors;
    2022import java.util.stream.Stream;
     
    7779
    7880                /** Text for nodes */
    79                 new TestConfig("node-text", AREA_DEFAULT),
     81                new TestConfig("node-text", AREA_DEFAULT).usesFont("DejaVu Sans"),
    8082
    8183                /** Tests that StyledMapRenderer#drawWay respects width */
     
    108110    public void testForOpenJDK() {
    109111        String javaHome = System.getProperty("java.home");
    110         Assume.assumeTrue(javaHome != null && javaHome.contains("openjdk"));
     112        Assume.assumeTrue("Test requires openJDK", javaHome != null && javaHome.contains("openjdk"));
     113
     114        List<String> fonts = Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
     115        for(String font : testConfig.fonts) {
     116            Assume.assumeTrue("Test requires font: " + font, fonts.contains(font));
     117        }
    111118    }
    112119
     
    233240        private final String testDirectory;
    234241        private final Bounds testArea;
     242        private final ArrayList<String> fonts = new ArrayList<>();
    235243
    236244        TestConfig(String testDirectory, Bounds testArea) {
    237245            this.testDirectory = testDirectory;
    238246            this.testArea = testArea;
     247        }
     248
     249        public TestConfig usesFont(String string) {
     250            this.fonts.add(string);
     251            return this;
    239252        }
    240253
Note: See TracChangeset for help on using the changeset viewer.