Changeset 9675 in josm


Ignore:
Timestamp:
2016-01-29T22:08:26+01:00 (9 years ago)
Author:
Don-vip
Message:

add more unit tests

Location:
trunk
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r9594 r9675  
    208208     * @return the current edit layer. null, if no edit layer exists
    209209     */
    210     protected static OsmDataLayer getEditLayer() {
     210    public static OsmDataLayer getEditLayer() {
    211211        return Main.main != null ? Main.main.getEditLayer() : null;
    212212    }
  • trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java

    r8870 r9675  
    1414
    1515import org.openstreetmap.josm.Main;
     16import org.openstreetmap.josm.actions.JosmAction;
    1617import org.openstreetmap.josm.data.APIDataSet;
    1718import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    7374        }
    7475        tests = null;
    75         OsmDataLayer editLayer = Main.main.getEditLayer();
    76         editLayer.validationErrors.clear();
    77         editLayer.validationErrors.addAll(errors);
    78         Main.map.validatorDialog.tree.setErrors(errors);
    79         if (errors == null || errors.isEmpty())
     76        OsmDataLayer editLayer = JosmAction.getEditLayer();
     77        if (editLayer != null) {
     78            editLayer.validationErrors.clear();
     79            editLayer.validationErrors.addAll(errors);
     80        }
     81        if (Main.map != null) {
     82            Main.map.validatorDialog.tree.setErrors(errors);
     83        }
     84        if (errors.isEmpty())
    8085            return true;
    8186
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

    r8840 r9675  
    1212import java.util.List;
    1313
    14 import org.openstreetmap.josm.Main;
     14import org.openstreetmap.josm.actions.JosmAction;
    1515import org.openstreetmap.josm.command.ChangeCommand;
    1616import org.openstreetmap.josm.command.Command;
     
    5353        super.startTest(monitor);
    5454
    55         OsmDataLayer layer = Main.main.getEditLayer();
     55        OsmDataLayer layer = JosmAction.getEditLayer();
    5656
    5757        if (layer != null) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java

    r8882 r9675  
    88import java.util.Set;
    99
    10 import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.actions.JosmAction;
    1111import org.openstreetmap.josm.command.Command;
     12import org.openstreetmap.josm.data.osm.DataSet;
    1213import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1314import org.openstreetmap.josm.data.osm.Relation;
     
    120121    public void startTest(ProgressMonitor monitor) {
    121122        super.startTest(monitor);
     123        DataSet ds = JosmAction.getCurrentDataSet();
     124        if (ds == null)
     125            return;
    122126        waysUsedInRelations = new HashSet<>();
    123         for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
     127        for (Relation r : ds.getRelations()) {
    124128            if (r.isUsable()) {
    125129                for (RelationMember m : r.getMembers()) {
Note: See TracChangeset for help on using the changeset viewer.