Changeset 2982 in josm for trunk/test
- Timestamp:
- 2010-02-14T15:01:00+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r1806 r2982 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit.Assert.assertFalse; 5 6 import org.junit.Assert; 4 7 import org.junit.Test; 5 6 import static org.junit.Assert.*; 8 import org.openstreetmap.josm.data.coor.LatLon; 7 9 8 10 public class RelationTest { 11 9 12 @Test(expected=NullPointerException.class) 10 13 public void createNewRelation() { … … 18 21 } 19 22 23 @Test 24 public void testBBox() { 25 DataSet ds = new DataSet(); 26 27 Node n1 = new Node(new LatLon(10, 10)); 28 Node n2 = new Node(new LatLon(20, 20)); 29 Node n3 = new Node(new LatLon(30, 30)); 30 Way w1 = new Way(); 31 w1.addNode(n1); 32 w1.addNode(n2); 33 Relation r1 = new Relation(); 34 Relation r2 = new Relation(); 35 ds.addPrimitive(r1); 36 ds.addPrimitive(r2); 37 ds.addPrimitive(n1); 38 ds.addPrimitive(n2); 39 ds.addPrimitive(n3); 40 ds.addPrimitive(w1); 41 r1.addMember(new RelationMember("", n1)); 42 r1.addMember(new RelationMember("", w1)); 43 r1.addMember(new RelationMember("", r1)); 44 r1.addMember(new RelationMember("", r2)); 45 r2.addMember(new RelationMember("", r1)); 46 r2.addMember(new RelationMember("", n3)); 47 48 BBox bbox = new BBox(w1); 49 bbox.add(n3.getBBox()); 50 Assert.assertEquals(bbox, r1.getBBox()); 51 Assert.assertEquals(bbox, r2.getBBox()); 52 53 n3.setCoor(new LatLon(40, 40)); 54 bbox.add(n3.getBBox()); 55 Assert.assertEquals(bbox, r1.getBBox()); 56 Assert.assertEquals(bbox, r2.getBBox()); 57 58 r1.removeMembersFor(r2); 59 Assert.assertEquals(w1.getBBox(), r1.getBBox()); 60 Assert.assertEquals(bbox, r2.getBBox()); 61 62 w1.addNode(n3); 63 Assert.assertEquals(w1.getBBox(), r1.getBBox()); 64 Assert.assertEquals(w1.getBBox(), r2.getBBox()); 65 } 66 20 67 }
Note:
See TracChangeset
for help on using the changeset viewer.