Changeset 8803 in josm for trunk/test/unit


Ignore:
Timestamp:
2015-09-29T18:56:18+02:00 (9 years ago)
Author:
simon04
Message:

fix #9114 - Store imagery offset in session

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

Legend:

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

    r8450 r8803  
    22package org.openstreetmap.josm.io.session;
    33
     4import static org.hamcrest.CoreMatchers.is;
    45import static org.junit.Assert.assertEquals;
    56import static org.junit.Assert.assertNotNull;
    67import static org.junit.Assert.assertSame;
     8import static org.junit.Assert.assertThat;
    79import static org.junit.Assert.assertTrue;
    810
     
    1618import org.openstreetmap.josm.TestUtils;
    1719import org.openstreetmap.josm.gui.layer.GpxLayer;
     20import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1821import org.openstreetmap.josm.gui.layer.Layer;
    1922import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    112115        assertEquals(marker.getName(), "Marker layer name");
    113116    }
     117
     118    @Test
     119    public void testReadImage() throws IOException, IllegalDataException {
     120        final List<Layer> layers = testRead("bing.jos");
     121        assertSame(layers.size(), 1);
     122        assertTrue(layers.get(0) instanceof ImageryLayer);
     123        final ImageryLayer image = (ImageryLayer) layers.get(0);
     124        assertThat(image.getName(), is("Bing aerial imagery"));
     125        assertEquals(image.getDx(), 12.34, 1e-9);
     126        assertEquals(image.getDy(), -56.78, 1e-9);
     127    }
    114128}
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r8510 r8803  
    44import java.io.File;
    55import java.io.IOException;
     6import java.util.Arrays;
    67import java.util.Collections;
    78import java.util.HashMap;
     
    1516import org.openstreetmap.josm.data.gpx.GpxData;
    1617import org.openstreetmap.josm.data.gpx.WayPoint;
     18import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1719import org.openstreetmap.josm.data.osm.DataSet;
    1820import org.openstreetmap.josm.gui.layer.GpxLayer;
     21import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1922import org.openstreetmap.josm.gui.layer.Layer;
    2023import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     24import org.openstreetmap.josm.gui.layer.TMSLayer;
    2125import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    2226import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    2327import org.openstreetmap.josm.tools.MultiMap;
    24 import org.openstreetmap.josm.tools.Pair;
    2528
    2629/**
     
    124127    }
    125128
     129    private ImageryLayer createImageryLayer() {
     130        ImageryLayer layer = new TMSLayer(new ImageryInfo("the name", "http://www.url.com/"));
     131        layer.setOffset(12, 34);
     132        return layer;
     133    }
     134
    126135    /**
    127136     * Tests to write an empty .jos file.
     
    185194    public void testWriteGpxAndMarkerJoz() throws IOException {
    186195        GpxLayer gpx = createGpxLayer();
    187         testWrite(Pair.toList(new Pair<Layer, Layer>(gpx, createMarkerLayer(gpx))), true);
     196        testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true);
     197    }
     198
     199    @Test
     200    public void testWriteImageryLayer() throws IOException {
     201        final Layer layer = createImageryLayer();
     202        testWrite(Collections.singletonList(layer), true);
    188203    }
    189204}
Note: See TracChangeset for help on using the changeset viewer.