Ignore:
Timestamp:
2016-06-16T12:38:56+02:00 (8 years ago)
Author:
Don-vip
Message:

gsoc-core - remove more deprecation warnings (unit tests)

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r10364 r10396  
    125125            } else {
    126126                for (Layer l: Main.getLayerManager().getLayers()) {
    127                     Main.map.mapView.removeLayer(l);
     127                    Main.getLayerManager().removeLayer(l);
    128128                }
    129129            }
  • trunk/test/unit/org/openstreetmap/josm/actions/AddImageryLayerActionTest.java

    r10373 r10396  
    5454            assertEquals(1, wmsLayers.size());
    5555
    56             Main.map.mapView.removeLayer(wmsLayers.get(0));
     56            Main.getLayerManager().removeLayer(wmsLayers.get(0));
    5757        } finally {
    58             Main.map.mapView.removeLayer(tmsLayers.get(0));
     58            Main.getLayerManager().removeLayer(tmsLayers.get(0));
    5959        }
    6060    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r10225 r10396  
    5656        Field mapView = MapFrame.class.getDeclaredField("mapView");
    5757        Utils.setObjectsAccessible(mapView);
    58         mapView.set(Main.map, new MapViewMock(dataSet, layer));
     58        mapView.set(Main.map, new MapViewMock());
    5959
    6060        Node n1 = new Node(new EastNorth(0, 0));
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/MapViewMock.java

    r10342 r10396  
    88import org.openstreetmap.josm.Main;
    99import org.openstreetmap.josm.data.coor.EastNorth;
    10 import org.openstreetmap.josm.data.osm.DataSet;
    1110import org.openstreetmap.josm.gui.MapView;
    12 import org.openstreetmap.josm.gui.layer.Layer;
    13 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1411
    1512class MapViewMock extends MapView {
    16     private final transient OsmDataLayer layer;
    17     private final transient DataSet currentDataSet;
    18 
    19     MapViewMock(DataSet dataSet, OsmDataLayer layer) {
     13    MapViewMock() {
    2014        super(Main.getLayerManager(), null, null);
    21         this.layer = layer;
    22         this.currentDataSet = dataSet;
    2315    }
    2416
     
    5244        return p != null ? new Point2D.Double(p.getX(), p.getY()) : null;
    5345    }
    54 
    55     @Override
    56     public void setActiveLayer(Layer layer) {}
    57 
    58     @Override
    59     public Layer getActiveLayer() {
    60         return layer;
    61     }
    62 
    63     @Override
    64     protected DataSet getCurrentDataSet() {
    65         return currentDataSet;
    66     }
    6746}
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r10225 r10396  
    5555                Field mv = SelectAction.class.getDeclaredField("mv");
    5656                Utils.setObjectsAccessible(mv);
    57                 mv.set(this, new MapViewMock(dataSet, layer));
     57                mv.set(this, new MapViewMock());
    5858            } catch (ReflectiveOperationException e) {
    5959                e.printStackTrace();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r10300 r10396  
    4040            assertFalse(action.isEnabled());
    4141
    42             Main.map.mapView.addLayer(layer);
     42            Main.getLayerManager().addLayer(layer);
    4343            action.updateEnabledState();
    4444            assertTrue(action.isEnabled());
     
    8787
    8888        } finally {
    89             Main.map.mapView.removeLayer(layer);
     89            Main.getLayerManager().removeLayer(layer);
    9090        }
    9191    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    r10386 r10396  
    5858                } finally {
    5959                    // Ensure we clean the place before leaving, even if test fails.
    60                     Main.map.mapView.removeLayer(layer);
     60                    Main.getLayerManager().removeLayer(layer);
    6161                }
    6262            } finally {
  • trunk/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java

    r10364 r10396  
    2424        if (Main.map != null) {
    2525            for (Layer l: Main.getLayerManager().getLayers()) {
    26                 Main.map.mapView.removeLayer(l);
     26                Main.getLayerManager().removeLayer(l);
    2727            }
    2828            Main.main.setMapFrame(null);
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r10364 r10396  
    140140        if (Main.isDisplayingMapView()) {
    141141            for (NoteLayer nl : Main.getLayerManager().getLayersOfType(NoteLayer.class)) {
    142                 Main.map.mapView.removeLayer(nl);
     142                Main.getLayerManager().removeLayer(nl);
    143143            }
    144144        }
Note: See TracChangeset for help on using the changeset viewer.