Index: trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
===================================================================
--- trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 16224)
+++ trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java	(revision 16235)
@@ -82,21 +82,26 @@
         return Stream.of(
                 /** Tests for StyledMapRenderer#drawNodeSymbol */
-                new TestConfig("node-shapes", AREA_DEFAULT),
+                new TestConfig("node-shapes", AREA_DEFAULT)
+                        .setThresholdPixels(100).setThresholdTotalColorDiff(2_110),
 
                 /** Text for nodes */
                 new TestConfig("node-text", AREA_DEFAULT).usesFont("DejaVu Sans")
-                        .setThresholdPixels(100).setThresholdTotalColorDiff(100),
+                        .setThresholdPixels(530).setThresholdTotalColorDiff(23_800),
 
                 /** Tests that StyledMapRenderer#drawWay respects width */
-                new TestConfig("way-width", AREA_DEFAULT),
+                new TestConfig("way-width", AREA_DEFAULT)
+                        .setThresholdPixels(280).setThresholdTotalColorDiff(22_500),
 
                 /** Tests the way color property, including alpha */
-                new TestConfig("way-color", AREA_DEFAULT),
+                new TestConfig("way-color", AREA_DEFAULT)
+                        .setThresholdPixels(100).setThresholdTotalColorDiff(3_400),
 
                 /** Tests dashed ways. */
-                new TestConfig("way-dashes", AREA_DEFAULT),
+                new TestConfig("way-dashes", AREA_DEFAULT)
+                        .setThresholdPixels(460).setThresholdTotalColorDiff(12_100),
 
                 /** Tests dashed way clamping algorithm */
-                new TestConfig("way-dashes-clamp", AREA_DEFAULT),
+                new TestConfig("way-dashes-clamp", AREA_DEFAULT)
+                        .setThresholdPixels(200).setThresholdTotalColorDiff(6_800),
 
                 /** Tests fill-color property */
@@ -104,40 +109,55 @@
 
                 /** Tests the fill-image property. */
-                new TestConfig("area-fill-image", AREA_DEFAULT),
+                new TestConfig("area-fill-image", AREA_DEFAULT)
+                        .setThresholdPixels(420).setThresholdTotalColorDiff(11_200),
 
                 /** Tests area label drawing/placement */
-                new TestConfig("area-text", AREA_DEFAULT).setThresholdPixels(50).setThresholdTotalColorDiff(50),
+                new TestConfig("area-text", AREA_DEFAULT)
+                        .setThresholdPixels(550).setThresholdTotalColorDiff(17_400),
 
                 /** Tests area icon drawing/placement */
-                new TestConfig("area-icon", AREA_DEFAULT),
+                new TestConfig("area-icon", AREA_DEFAULT)
+                        .setThresholdPixels(680).setThresholdTotalColorDiff(23_000),
 
                 /** Tests if all styles are sorted correctly. Tests {@link StyleRecord#compareTo(StyleRecord)} */
-                new TestConfig("order", AREA_DEFAULT),
+                new TestConfig("order", AREA_DEFAULT)
+                        .setThresholdPixels(2050).setThresholdTotalColorDiff(101_800),
 
                 /** Tests repeat-image feature for ways */
-                new TestConfig("way-repeat-image", AREA_DEFAULT),
+                new TestConfig("way-repeat-image", AREA_DEFAULT)
+                        .setThresholdPixels(2100).setThresholdTotalColorDiff(93_000),
                 /** Tests the clamping for repeat-images and repeat-image-phase */
-                new TestConfig("way-repeat-image-clamp", AREA_DEFAULT),
+                new TestConfig("way-repeat-image-clamp", AREA_DEFAULT)
+                        .setThresholdPixels(80).setThresholdTotalColorDiff(2_300),
 
                 /** Tests text along a way */
-                new TestConfig("way-text", AREA_DEFAULT).setThresholdPixels(20).setThresholdTotalColorDiff(40),
+                new TestConfig("way-text", AREA_DEFAULT)
+                        .setThresholdPixels(3400).setThresholdTotalColorDiff(122_700),
 
                 /** Another test for node shapes */
-                new TestConfig("node-shapes2").setImageWidth(600),
+                new TestConfig("node-shapes2").setImageWidth(600)
+                        .setThresholdPixels(1230).setThresholdTotalColorDiff(43_700),
                 /** Tests default values for node shapes */
-                new TestConfig("node-shapes-default"),
+                new TestConfig("node-shapes-default")
+                        .setThresholdPixels(10).setThresholdTotalColorDiff(270),
                 /** Tests node shapes with both fill and stroke combined */
-                new TestConfig("node-shapes-combined"),
+                new TestConfig("node-shapes-combined")
+                        .setThresholdPixels(360).setThresholdTotalColorDiff(9_200),
                 /** Another test for dashed ways */
-                new TestConfig("way-dashes2"),
+                new TestConfig("way-dashes2")
+                        .setThresholdPixels(340).setThresholdTotalColorDiff(16_100),
                 /** Tests node text placement */
-                new TestConfig("node-text2").setThresholdPixels(30).setThresholdTotalColorDiff(50),
+                new TestConfig("node-text2")
+                        .setThresholdPixels(1020).setThresholdTotalColorDiff(345_000),
                 /** Tests relation link selector */
-                new TestConfig("relation-linkselector"),
+                new TestConfig("relation-linkselector")
+                        .setThresholdPixels(430).setThresholdTotalColorDiff(13_000),
                 /** Tests parent selector on relation */
-                new TestConfig("relation-parentselector"),
+                new TestConfig("relation-parentselector")
+                        .setThresholdPixels(310).setThresholdTotalColorDiff(8_200),
 
                 /** Tests evaluation of expressions */
-                new TestConfig("eval").setImageWidth(600).setThresholdPixels(100).setThresholdTotalColorDiff(100)
+                new TestConfig("eval").setImageWidth(600)
+                        .setThresholdPixels(6610).setThresholdTotalColorDiff(3_304_000)
 
                 ).map(e -> new Object[] {e, e.testDirectory})
@@ -217,5 +237,4 @@
                 int result = image.getRGB(x, y);
                 if (!colorsAreSame(expected, result)) {
-                    differencePoints.add(new Point(x, y));
                     Color expectedColor = new Color(expected, true);
                     Color resultColor = new Color(result, true);
@@ -224,18 +243,29 @@
                             + Math.abs(expectedColor.getBlue() - resultColor.getBlue());
                     int alphaDiff = Math.abs(expectedColor.getAlpha() - resultColor.getAlpha());
-                    if (differences.length() < 500) {
-                        differences.append("\nDifference at ")
-                        .append(x)
-                        .append(",")
-                        .append(y)
-                        .append(": Expected ")
-                        .append(ColorHelper.color2html(expectedColor))
-                        .append(" but got ")
-                        .append(ColorHelper.color2html(resultColor))
-                        .append(" (color diff is ")
-                        .append(colorDiff)
-                        .append(", alpha diff is ")
-                        .append(alphaDiff)
-                        .append(")");
+                    // Ignore small alpha differences due to Java versions, rendering libraries and so on
+                    if (alphaDiff <= 20) {
+                        alphaDiff = 0;
+                    }
+                    // Ignore small color differences for the same reasons, but also completely for almost-transparent pixels
+                    if (colorDiff <= 15 || resultColor.getAlpha() <= 20) {
+                        colorDiff = 0;
+                    }
+                    if (colorDiff + alphaDiff > 0) {
+                        differencePoints.add(new Point(x, y));
+                        if (differences.length() < 2000) {
+                            differences.append("\nDifference at ")
+                            .append(x)
+                            .append(",")
+                            .append(y)
+                            .append(": Expected ")
+                            .append(ColorHelper.color2html(expectedColor))
+                            .append(" but got ")
+                            .append(ColorHelper.color2html(resultColor))
+                            .append(" (color diff is ")
+                            .append(colorDiff)
+                            .append(", alpha diff is ")
+                            .append(alphaDiff)
+                            .append(")");
+                        }
                     }
                     colorDiffSum += colorDiff + alphaDiff;
