Ignore:
Timestamp:
2016-01-07T01:53:58+01:00 (8 years ago)
Author:
Don-vip
Message:

see #12282 - handle warnings for mappaint styles:

  • Log warnings that occur when loading style
  • Display them in Mappaint dialog (Info action)
  • Drop redundant error icon
  • Ignore XML styles in styles validation test
  • Make styles validation test fail if at least a warning occur
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java

    r9166 r9334  
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
     16import org.openstreetmap.josm.gui.mappaint.StyleSource;
    1617import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
    1718import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;
     
    4142        assertFalse(sources.isEmpty());
    4243        Map<String, Collection<Throwable>> allErrors = new HashMap<>();
     44        Map<String, Collection<String>> allWarnings = new HashMap<>();
    4345        for (ExtendedSourceEntry source : sources) {
    44             System.out.println(source.url);
    45             Collection<Throwable> errors = MapPaintStyles.addStyle(source);
    46             System.out.println(errors.isEmpty() ? " => OK" : " => KO");
    47             if (!errors.isEmpty()) {
    48                 allErrors.put(source.url, errors);
     46            // Do not validate XML styles
     47            if (!"xml".equalsIgnoreCase(source.styleType)) {
     48                System.out.println(source.url);
     49                StyleSource style = MapPaintStyles.addStyle(source);
     50                System.out.println(style.isValid() ? " => OK" : " => KO");
     51                Collection<Throwable> errors = style.getErrors();
     52                Collection<String> warnings = style.getWarnings();
     53                if (!errors.isEmpty()) {
     54                    allErrors.put(source.url, errors);
     55                }
     56                if (!warnings.isEmpty()) {
     57                    allWarnings.put(source.url, warnings);
     58                }
    4959            }
    5060        }
    51         assertTrue(allErrors.toString(), allErrors.isEmpty());
     61        assertTrue(allErrors.toString()+"\n"+allWarnings.toString(), allErrors.isEmpty() && allWarnings.isEmpty());
    5262    }
    5363}
Note: See TracChangeset for help on using the changeset viewer.