Changeset 16224 in josm for trunk/test/functional
- Timestamp:
- 2020-04-04T10:39:46+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
r16100 r16224 42 42 import org.openstreetmap.josm.io.OsmReader; 43 43 import org.openstreetmap.josm.testutils.JOSMTestRules; 44 import org.openstreetmap.josm.tools.ColorHelper; 44 45 45 46 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 217 218 if (!colorsAreSame(expected, result)) { 218 219 differencePoints.add(new Point(x, y)); 219 int colorDiff = colorDiff(new Color(expected, true), new Color(result, true)); 220 Color expectedColor = new Color(expected, true); 221 Color resultColor = new Color(result, true); 222 int colorDiff = Math.abs(expectedColor.getRed() - resultColor.getRed()) 223 + Math.abs(expectedColor.getGreen() - resultColor.getGreen()) 224 + Math.abs(expectedColor.getBlue() - resultColor.getBlue()); 225 int alphaDiff = Math.abs(expectedColor.getAlpha() - resultColor.getAlpha()); 220 226 if (differences.length() < 500) { 221 227 differences.append("\nDifference at ") … … 224 230 .append(y) 225 231 .append(": Expected ") 226 .append( Integer.toHexString(expected))232 .append(ColorHelper.color2html(expectedColor)) 227 233 .append(" but got ") 228 .append( Integer.toHexString(result))234 .append(ColorHelper.color2html(resultColor)) 229 235 .append(" (color diff is ") 230 236 .append(colorDiff) 237 .append(", alpha diff is ") 238 .append(alphaDiff) 231 239 .append(")"); 232 240 } 233 colorDiffSum += colorDiff; 241 colorDiffSum += colorDiff + alphaDiff; 234 242 } 235 243 } … … 262 270 n.setDisabledState(false); 263 271 } 264 }265 266 private int colorDiff(Color c1, Color c2) {267 return Math.abs(c1.getAlpha() - c2.getAlpha()) + Math.abs(c1.getRed() - c2.getRed())268 + Math.abs(c1.getGreen() - c2.getGreen()) + Math.abs(c1.getBlue() - c2.getBlue());269 272 } 270 273
Note:
See TracChangeset
for help on using the changeset viewer.