Changeset 9397 in josm for trunk/src


Ignore:
Timestamp:
2016-01-10T20:43:16+01:00 (4 years ago)
Author:
simon04
Message:

see #12325 - Do not exclude the test for non-downloaded datasets, fix unit test

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r9349 r9397  
    14681468        @Override
    14691469        protected Collection<Bounds> getBounds() {
    1470             return Main.main.getCurrentDataSet() == null || Main.main.getCurrentDataSet().getDataSourceArea() == null
     1470            return Main.main == null || Main.main.getCurrentDataSet() == null || Main.main.getCurrentDataSet().getDataSourceArea() == null
    14711471                    ? null : Main.main.getCurrentDataSet().getDataSourceBounds();
    14721472        }
     
    14751475        public String toString() {
    14761476            return all ? "allindownloadedarea" : "indownloadedarea";
     1477        }
     1478    }
     1479
     1480    /**
     1481     * Matches objects which are not outside the source area ("downloaded area").
     1482     * Unlink {@link InDataSourceArea} this matches also if no source area is set (e.g., for new layers).
     1483     */
     1484    public static class NotOutsideDataSourceArea extends InDataSourceArea {
     1485
     1486        /**
     1487         * Constructs a new {@code NotOutsideDataSourceArea}.
     1488         */
     1489        public NotOutsideDataSourceArea() {
     1490            super(false);
     1491        }
     1492
     1493        @Override
     1494        protected Collection<Bounds> getBounds() {
     1495            final Collection<Bounds> bounds = super.getBounds();
     1496            return bounds == null || bounds.isEmpty() ? Collections.singleton(Main.getProjection().getWorldBoundsLatLon()) : bounds;
     1497        }
     1498
     1499        @Override
     1500        public String toString() {
     1501            return "NotOutsideDataSourceArea";
    14771502        }
    14781503    }
  • trunk/src/org/openstreetmap/josm/data/validation/Test.java

    r9381 r9397  
    1414
    1515import org.openstreetmap.josm.Main;
    16 import org.openstreetmap.josm.actions.search.SearchCompiler.InDataSourceArea;
     16import org.openstreetmap.josm.actions.search.SearchCompiler.NotOutsideDataSourceArea;
    1717import org.openstreetmap.josm.command.Command;
    1818import org.openstreetmap.josm.command.DeleteCommand;
     
    3939public class Test extends AbstractVisitor {
    4040
    41     protected static final Predicate<OsmPrimitive> IN_DOWNLOADED_AREA = new InDataSourceArea(false);
     41    protected static final Predicate<OsmPrimitive> IN_DOWNLOADED_AREA = new NotOutsideDataSourceArea();
    4242
    4343    /** Name of the test */
Note: See TracChangeset for help on using the changeset viewer.