Changeset 3034 in josm for trunk/test/unit
- Timestamp:
- 2010-02-23T08:58:12+01:00 (15 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r3025 r3034 815 815 * Their dataset includes a way with three nodes, the first one being my node. 816 816 * 817 * => the merged way should include two nodes only. the deleted node should still be818 * in the data set.817 * => the merged way should include all three nodes. Deleted node should have deleted=false and 818 * special conflict with isDeleted should exist 819 819 * 820 820 */ … … 848 848 theirWay.addNode(tn2); 849 849 theirWay.addNode(tn3); 850 User user = User.getById(1111); 851 if (user == null) { 852 User.createOsmUser(1111, "their"); 853 } 854 theirWay.setUser(user); 850 theirWay.setUser(User.createOsmUser(1111, "their")); 855 851 theirWay.setTimestamp(new Date()); 856 852 their.addPrimitive(theirWay); … … 860 856 861 857 assertEquals(1, visitor.getConflicts().size()); 858 assertTrue(visitor.getConflicts().get(0).isMyDeleted()); 862 859 863 860 Way myWay = (Way)my.getPrimitiveById(4, OsmPrimitiveType.WAY); … … 865 862 866 863 Node n = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE); 867 assertTrue(!myWay.getNodes().contains(n)); 868 assertTrue(n != null); 869 870 //a node was removed from the way,it should thus be modified 871 assertTrue(myWay.isModified()); 864 assertTrue(myWay.getNodes().contains(n)); 865 866 assertFalse(myWay.isModified()); 872 867 } 873 868 … … 876 871 * Their dataset includes a relation with three nodes, the first one being my node. 877 872 * 878 * => the merged relation should include two nodes only. the deleted node should still be879 * in the dataset873 * => the merged relation should include all three nodes. There should be conflict for deleted 874 * node with isMyDeleted set 880 875 * 881 876 */ … … 884 879 885 880 886 Node n1 = new Node(new LatLon(0,0));887 n1.setOsmId(1,1);888 n1.setDeleted(true);889 my.addPrimitive( n1);890 891 892 Node n3= new Node(new LatLon(0,0));893 n3.setOsmId(1,1);894 their.addPrimitive( n3);895 896 Node n4= new Node(new LatLon(1,1));897 n4.setOsmId(2,1);898 their.addPrimitive( n4);899 900 Node n5= new Node(new LatLon(2,2));901 n5.setOsmId(3,1);902 their.addPrimitive( n5);881 Node mn1 = new Node(new LatLon(0,0)); 882 mn1.setOsmId(1,1); 883 mn1.setDeleted(true); 884 my.addPrimitive(mn1); 885 886 887 Node tn1 = new Node(new LatLon(0,0)); 888 tn1.setOsmId(1,1); 889 their.addPrimitive(tn1); 890 891 Node tn2 = new Node(new LatLon(1,1)); 892 tn2.setOsmId(2,1); 893 their.addPrimitive(tn2); 894 895 Node tn3 = new Node(new LatLon(2,2)); 896 tn3.setOsmId(3,1); 897 their.addPrimitive(tn3); 903 898 904 899 … … 906 901 theirRelation.setOsmId(4,1); 907 902 908 theirRelation.addMember(new RelationMember("", n3));909 theirRelation.addMember(new RelationMember("", n4));910 theirRelation.addMember(new RelationMember("", n5));903 theirRelation.addMember(new RelationMember("", tn1)); 904 theirRelation.addMember(new RelationMember("", tn2)); 905 theirRelation.addMember(new RelationMember("", tn3)); 911 906 their.addPrimitive(theirRelation); 912 907 913 908 DataSetMerger visitor = new DataSetMerger(my,their); 914 909 visitor.merge(); 915 916 assertEquals(0,visitor.getConflicts().size());917 918 Relation r = (Relation)my.getPrimitiveById(4,OsmPrimitiveType.RELATION);919 assertEquals(2, r.getMembersCount());920 910 921 911 Node n = (Node)my.getPrimitiveById(1,OsmPrimitiveType.NODE); 922 912 assertTrue(n != null); 923 913 924 assertTrue(r.isModified()); 914 assertEquals(1, visitor.getConflicts().size()); 915 assertTrue(visitor.getConflicts().hasConflictForMy(n)); 916 assertTrue(visitor.getConflicts().get(0).isMyDeleted()); 917 918 Relation r = (Relation)my.getPrimitiveById(4,OsmPrimitiveType.RELATION); 919 assertEquals(3, r.getMembersCount()); 920 921 assertFalse(r.isModified()); 925 922 } 926 923 -
trunk/test/unit/org/openstreetmap/josm/gui/conflict/properties/PropertiesMergeModelTest.java
r3025 r3034 12 12 import org.junit.Test; 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.conflict.Conflict; 14 15 import org.openstreetmap.josm.data.coor.LatLon; 15 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.Node; 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 19 import org.openstreetmap.josm.data.osm.Relation; 18 20 import org.openstreetmap.josm.data.osm.Way; … … 47 49 } 48 50 51 private void populate(OsmPrimitive my, OsmPrimitive their) { 52 model.populate(new Conflict<OsmPrimitive>(my, their)); 53 } 54 49 55 @Test 50 56 public void populate() { … … 55 61 d1.addPrimitive(n1); 56 62 d2.addPrimitive(n2); 57 model.populate(n1, n2);63 populate(n1, n2); 58 64 59 65 Way w1 = new Way(1); … … 61 67 d1.addPrimitive(w1); 62 68 d2.addPrimitive(w2); 63 model.populate(w2, w2);69 populate(w2, w2); 64 70 65 71 Relation r1 = new Relation(1); … … 67 73 d1.addPrimitive(r1); 68 74 d2.addPrimitive(r2); 69 model.populate(r1, r2);75 populate(r1, r2); 70 76 } 71 77 … … 79 85 d1.addPrimitive(n1); 80 86 d2.addPrimitive(n2); 81 model.populate(n1, n2);87 populate(n1, n2); 82 88 assertFalse(model.hasCoordConflict()); 83 89 84 90 n1.setCoor(new LatLon(1,1)); 85 model.populate(n1, n2);91 populate(n1, n2); 86 92 assertTrue(model.hasCoordConflict()); 87 93 … … 89 95 n1.cloneFrom(new Node(1)); 90 96 n2.setCoor(new LatLon(2,2)); 91 model.populate(n1, n2);97 populate(n1, n2); 92 98 assertTrue(model.hasCoordConflict()); 93 99 94 100 n1.setCoor(new LatLon(1,1)); 95 101 n2.setCoor(new LatLon(2,2)); 96 model.populate(n1, n2);102 populate(n1, n2); 97 103 assertTrue(model.hasCoordConflict()); 98 104
Note:
See TracChangeset
for help on using the changeset viewer.