Changeset 15777 in josm for trunk/test/unit


Ignore:
Timestamp:
2020-01-26T19:45:25+01:00 (4 years ago)
Author:
simon04
Message:

fix #13813 - Advanced object info: use consistent coordinates/bbox format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r14138 r15777  
    1515import org.openstreetmap.josm.data.osm.Node;
    1616import org.openstreetmap.josm.data.osm.User;
     17import org.openstreetmap.josm.data.osm.Way;
    1718import org.openstreetmap.josm.gui.MainApplication;
    1819import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    4849        DataSet ds = new DataSet();
    4950        assertEquals("", InspectPrimitiveDialog.buildDataText(ds, new ArrayList<>(ds.allPrimitives())));
    50         Node n = new Node(LatLon.ZERO);
    51         n.setOsmId(1, 1);
    52         ds.addPrimitive(n);
     51        final Way way = new Way();
     52        way.addNode(new Node(new LatLon(47.2687921, 11.390525)));
     53        way.addNode(new Node(new LatLon(47.2689194, 11.3907301)));
     54        way.addNode(new Node(new LatLon(47.2684158, 11.3914047)));
     55        way.addNode(new Node(new LatLon(47.2682898, 11.3912034)));
     56        way.setOsmId(1, 1);
     57        int id = 2;
     58        for (Node node : way.getNodes()) {
     59            node.setOsmId(id, id);
     60            id++;
     61        }
     62        way.getNodes().forEach(ds::addPrimitive);
     63        ds.addPrimitive(way);
     64        way.addNode(way.firstNode()); // close way
    5365        assertEquals(
    54                 "Node: 1\n" +
     66            "Way: 1\n" +
    5567                "  Data Set: "+Integer.toHexString(ds.hashCode())+"\n" +
    5668                "  Edited at: <new object>\n" +
     
    5870                "  Version: 1\n" +
    5971                "  In changeset: 0\n" +
    60                 "  Coordinates: 0.0, 0.0\n" +
    61                 "  Coordinates (projected): 0.0, -7.081154551613622E-10\n" +
    62                 "  UTM Zone: 31S\n" +
    63                 "\n", InspectPrimitiveDialog.buildDataText(ds, new ArrayList<>(ds.allPrimitives())));
     72                "  Bounding box: 47.2682898, 11.3914047, 47.2689194, 11.390525\n" +
     73                "  Bounding box (projected): 5985976.274977, 1268085.3706241, 5986079.5621105, 1267987.4428681\n" +
     74                "  Center of bounding box: 47.2686046, 11.3909648\n" +
     75                "  Centroid: 47.2686049, 11.3909649\n" +
     76                "  5 Nodes: \n" +
     77                "    2\n" +
     78                "    3\n" +
     79                "    4\n" +
     80                "    5\n" +
     81                "    2\n" +
     82                "\n", InspectPrimitiveDialog.buildDataText(ds, new ArrayList<>(ds.getWays())));
    6483    }
    6584
Note: See TracChangeset for help on using the changeset viewer.