Changeset 15822 in josm for trunk/test/unit
- Timestamp:
- 2020-02-06T21:05:35+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java
r11177 r15822 5 5 6 6 import java.util.ArrayList; 7 import java.util.Collections;8 7 import java.util.List; 9 8 … … 11 10 import org.junit.Test; 12 11 import org.openstreetmap.josm.data.coor.LatLon; 13 import org.openstreetmap.josm.data.osm.DataSet;14 12 import org.openstreetmap.josm.data.osm.Node; 15 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveComparator;17 14 import org.openstreetmap.josm.data.osm.Way; 18 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 32 29 public JOSMTestRules test = new JOSMTestRules(); 33 30 34 private static String createSearchSetting(DataSet ds, boolean sameType) { 35 List<OsmPrimitive> sel = new ArrayList<>(ds.allPrimitives()); 36 Collections.sort(sel, OsmPrimitiveComparator.comparingUniqueId()); 31 private static String createSearchSetting(List<OsmPrimitive> sel, boolean sameType) { 37 32 return PropertiesDialog.createSearchSetting("foo", sel, sameType).text; 38 33 } … … 43 38 @Test 44 39 public void testTicket12504() { 45 DataSet ds = new DataSet();40 List<OsmPrimitive> sel = new ArrayList<>(); 46 41 // 160 objects with foo=bar, 400 objects without foo 47 42 for (int i = 0; i < 160+400; i++) { … … 50 45 n.put("foo", "bar"); 51 46 } 52 ds.addPrimitive(n);47 sel.add(n); 53 48 } 54 assertEquals("(\"foo\"=\"bar\")", createSearchSetting( ds, false));49 assertEquals("(\"foo\"=\"bar\")", createSearchSetting(sel, false)); 55 50 56 51 Node n = new Node(LatLon.ZERO); 57 52 n.put("foo", "baz"); 58 ds.addPrimitive(n);53 sel.add(0, n); 59 54 60 assertEquals("(\"foo\"=\"baz\") OR (\"foo\"=\"bar\")", createSearchSetting( ds, false));55 assertEquals("(\"foo\"=\"baz\") OR (\"foo\"=\"bar\")", createSearchSetting(sel, false)); 61 56 62 ds.removePrimitive(n);57 sel.remove(0); 63 58 64 59 Way w = new Way(); 65 60 w.put("foo", "bar"); 66 ds.addPrimitive(w);61 sel.add(0, w); 67 62 68 assertEquals("(type:way \"foo\"=\"bar\") OR (type:node \"foo\"=\"bar\")", createSearchSetting( ds, true));63 assertEquals("(type:way \"foo\"=\"bar\") OR (type:node \"foo\"=\"bar\")", createSearchSetting(sel, true)); 69 64 } 70 65 }
Note:
See TracChangeset
for help on using the changeset viewer.