Changeset 9490 in josm for trunk/src


Ignore:
Timestamp:
2016-01-16T18:27:55+01:00 (4 years ago)
Author:
Don-vip
Message:

see #12377 - add multipolygon unit test

Location:
trunk/src/org/openstreetmap/josm/data/validation/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r9278 r9490  
    3131import org.openstreetmap.josm.data.validation.TestError;
    3232import org.openstreetmap.josm.gui.DefaultNameFormatter;
    33 import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement;
    3433import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    3534import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
     35import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement;
    3636import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    3737import org.openstreetmap.josm.tools.Pair;
     
    4343public class MultipolygonTest extends Test {
    4444
    45     protected static final int WRONG_MEMBER_TYPE = 1601;
    46     protected static final int WRONG_MEMBER_ROLE = 1602;
    47     protected static final int NON_CLOSED_WAY = 1603;
    48     protected static final int MISSING_OUTER_WAY = 1604;
    49     protected static final int INNER_WAY_OUTSIDE = 1605;
    50     protected static final int CROSSING_WAYS = 1606;
    51     protected static final int OUTER_STYLE_MISMATCH = 1607;
    52     protected static final int INNER_STYLE_MISMATCH = 1608;
    53     protected static final int NOT_CLOSED = 1609;
    54     protected static final int NO_STYLE = 1610;
    55     protected static final int NO_STYLE_POLYGON = 1611;
    56     protected static final int OUTER_STYLE = 1613;
     45    /** Non-Way in multipolygon */
     46    public static final int WRONG_MEMBER_TYPE = 1601;
     47    /** No useful role for multipolygon member */
     48    public static final int WRONG_MEMBER_ROLE = 1602;
     49    /** Multipolygon is not closed */
     50    public static final int NON_CLOSED_WAY = 1603;
     51    /** No outer way for multipolygon */
     52    public static final int MISSING_OUTER_WAY = 1604;
     53    /** Multipolygon inner way is outside */
     54    public static final int INNER_WAY_OUTSIDE = 1605;
     55    /** Intersection between multipolygon ways */
     56    public static final int CROSSING_WAYS = 1606;
     57    /** Style for outer way mismatches / With the currently used mappaint style(s) the style for outer way mismatches polygon */
     58    public static final int OUTER_STYLE_MISMATCH = 1607;
     59    /** With the currently used mappaint style the style for inner way equals the multipolygon style */
     60    public static final int INNER_STYLE_MISMATCH = 1608;
     61    /** Area style way is not closed */
     62    public static final int NOT_CLOSED = 1609;
     63    /** No area style for multipolygon */
     64    public static final int NO_STYLE = 1610;
     65    /** Multipolygon relation should be tagged with area tags and not the outer way(s) */
     66    public static final int NO_STYLE_POLYGON = 1611;
     67    /** Area style on outer way */
     68    public static final int OUTER_STYLE = 1613;
    5769
    5870    private static volatile ElemStyles styles;
     
    303315            }
    304316            // Diamond operator does not work with Java 9 here
     317            @SuppressWarnings("unused")
    305318            List<OsmPrimitive> newPrimitives = new ArrayList<OsmPrimitive>(primitives);
    306319            newPrimitives.add(0, r);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r9359 r9490  
    3636public class RelationChecker extends Test {
    3737
    38     protected static final int ROLE_UNKNOWN      = 1701;
    39     protected static final int ROLE_EMPTY        = 1702;
    40     protected static final int WRONG_TYPE        = 1703;
    41     protected static final int HIGH_COUNT        = 1704;
    42     protected static final int LOW_COUNT         = 1705;
    43     protected static final int ROLE_MISSING      = 1706;
    44     protected static final int RELATION_UNKNOWN  = 1707;
    45     protected static final int RELATION_EMPTY    = 1708;
     38    /** Role {0} unknown in templates {1} */
     39    public static final int ROLE_UNKNOWN      = 1701;
     40    /** Empty role type found when expecting one of {0} */
     41    public static final int ROLE_EMPTY        = 1702;
     42    /** Role member does not match expression {0} in template {1} */
     43    public static final int WRONG_TYPE        = 1703;
     44    /** Number of {0} roles too high ({1}) */
     45    public static final int HIGH_COUNT        = 1704;
     46    /** Number of {0} roles too low ({1}) */
     47    public static final int LOW_COUNT         = 1705;
     48    /** Role {0} missing */
     49    public static final int ROLE_MISSING      = 1706;
     50    /** Relation type is unknown */
     51    public static final int RELATION_UNKNOWN  = 1707;
     52    /** Relation is empty */
     53    public static final int RELATION_EMPTY    = 1708;
    4654
    4755    /**
     
    256264            // convert in localization friendly way to string of accepted types
    257265            String typesStr = Utils.join("/", Utils.transform(types, new Utils.Function<TaggingPresetType, Object>() {
     266                @Override
    258267                public Object apply(TaggingPresetType x) {
    259268                    return tr(x.getName());
     
    297306            if (!allroles.containsKey(key)) {
    298307                String templates = Utils.join("/", Utils.transform(allroles.keySet(), new Utils.Function<String, Object>() {
     308                    @Override
    299309                    public Object apply(String x) {
    300310                        return tr(x);
Note: See TracChangeset for help on using the changeset viewer.