Ticket #19136: 19136.1.patch

File 19136.1.patch, 2.1 KB (added by GerdP, 6 years ago)

chnages for the test. The unit test file needs more work, there are 24 "No area style for multipolygon" message with this patch

  • src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

     
    7373    public static final int RINGS_SHARE_NODES = 1617;
    7474    /** Incomplete multipolygon was modified */
    7575    public static final int MODIFIED_INCOMPLETE = 1618;
     76    /** Incomplete multipolygon was modified */
     77    public static final int NO_TAGS = 1619;
    7678
    7779    private static final int FOUND_INSIDE = 1;
    7880    private static final int FOUND_OUTSIDE = 2;
     
    132134        if (styles != null && !r.isBoundary()) {
    133135            AreaElement area = ElemStyles.getAreaElemStyle(r, false);
    134136            boolean areaStyle = area != null;
    135             // If area style was not found for relation then use style of ways
    136             if (area == null) {
    137                 for (Way w : polygon.getOuterWays()) {
    138                     area = ElemStyles.getAreaElemStyle(w, true);
    139                     if (area != null) {
    140                         break;
    141                     }
    142                 }
    143                 if (area == null) {
    144                     errors.add(TestError.builder(this, Severity.OTHER, NO_STYLE)
    145                             .message(tr("No area style for multipolygon"))
    146                             .primitives(r)
    147                             .build());
    148                 }
     137            if (r.getInterestingTags().size() <= 1) {
     138                errors.add(TestError.builder(this, Severity.ERROR, NO_TAGS)
     139                        .message(tr("No further tags for multipolygon"))
     140                        .primitives(r)
     141                        .build());
     142            } else if (area == null && !r.concernsArea()) {
     143                errors.add(TestError.builder(this, Severity.WARNING, NO_STYLE)
     144                        .message(tr("No area style for multipolygon"))
     145                        .primitives(r)
     146                        .build());
    149147            }
    150148
    151149            if (area != null) {