Changeset 7326 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2014-07-22T00:17:42+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10292 - allow to load a session with NMEA file + enhance reading/writing unit tests for sessions

Location:
trunk/test/unit/org/openstreetmap/josm/io/session
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r7081 r7326  
    1313import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.coor.LatLon;
    1516import org.openstreetmap.josm.data.gpx.GpxData;
     17import org.openstreetmap.josm.data.gpx.WayPoint;
    1618import org.openstreetmap.josm.data.osm.DataSet;
    1719import org.openstreetmap.josm.gui.MainApplication;
     
    1921import org.openstreetmap.josm.gui.layer.Layer;
    2022import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     23import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    2124import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
    2225import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    2326import org.openstreetmap.josm.tools.MultiMap;
     27import org.openstreetmap.josm.tools.Pair;
    2428
    2529/**
     
    106110
    107111    private OsmDataLayer createOsmLayer() {
    108         OsmDataLayer layer = new OsmDataLayer(new DataSet(), null, null);
     112        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "OSM layer name", null);
    109113        layer.setAssociatedFile(new File("data.osm"));
    110114        return layer;
     
    112116
    113117    private GpxLayer createGpxLayer() {
    114         GpxLayer layer = new GpxLayer(new GpxData());
     118        GpxData data = new GpxData();
     119        data.waypoints.add(new WayPoint(new LatLon(42.72665, -0.00747)));
     120        data.waypoints.add(new WayPoint(new LatLon(42.72659, -0.00749)));
     121        GpxLayer layer = new GpxLayer(data, "GPX layer name");
    115122        layer.setAssociatedFile(new File("data.gpx"));
    116123        return layer;
     124    }
     125
     126    private MarkerLayer createMarkerLayer(GpxLayer gpx) {
     127        return new MarkerLayer(gpx.data, "Marker layer name", gpx.getAssociatedFile(), gpx);
    117128    }
    118129
     
    170181        testWrite(Collections.<Layer>singletonList(createGpxLayer()), true);
    171182    }
     183
     184    /**
     185     * Tests to write a .joz file containing GPX and marker data.
     186     * @throws IOException if any I/O error occurs
     187     */
     188    @Test
     189    public void testWriteGpxAndMarkerJoz() throws IOException {
     190        GpxLayer gpx = createGpxLayer();
     191        testWrite(Pair.toArrayList(new Pair<Layer, Layer>(gpx, createMarkerLayer(gpx))), true);
     192    }
    172193}
Note: See TracChangeset for help on using the changeset viewer.