Changeset 7098 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r7018 r7098 370 370 formatRelationNameAndType(r2, name2, preset2); 371 371 372 int comp = name1.toString().compareTo(name2.toString());372 int comp = AlphanumComparator.getInstance().compare(name1.toString(), name2.toString()); 373 373 if (comp != 0) 374 374 return comp; … … 496 496 return buildDefaultToolTip(primitive.getId(), primitive.getKeys()); 497 497 } 498 498 499 499 private String buildDefaultToolTip(long id, Map<String, String> tags) { 500 500 StringBuilder sb = new StringBuilder(); -
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r7097 r7098 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.junit.Assert.assertTrue; 4 5 import static org.junit.Assert.fail; 5 6 … … 16 17 import org.openstreetmap.josm.TestUtils; 17 18 import org.openstreetmap.josm.data.osm.DataSet; 19 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 18 20 import org.openstreetmap.josm.data.osm.Relation; 19 21 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; … … 53 55 try (InputStream is = new FileInputStream(TestUtils.getTestDataRoot() + "regress/9632/data.osm.zip")) { 54 56 DataSet ds = OsmReader.parseDataSet(Compression.ZIP.getUncompressedInputStream(is), null); 57 58 // Test with 3 known primitives causing the problem. Correct order is p1, p3, p2 with this preset 59 Relation p1 = (Relation) ds.getPrimitiveById(2983382, OsmPrimitiveType.RELATION); 60 Relation p2 = (Relation) ds.getPrimitiveById(550315, OsmPrimitiveType.RELATION); 61 Relation p3 = (Relation) ds.getPrimitiveById(167042, OsmPrimitiveType.RELATION); 62 63 System.out.println("p1: "+DefaultNameFormatter.getInstance().format(p1)+" - "+p1); // route_master ("Bus 453", 6 members) 64 System.out.println("p2: "+DefaultNameFormatter.getInstance().format(p2)+" - "+p2); // TMC ("A 6 Kaiserslautern - Mannheim [negative]", 123 members) 65 System.out.println("p3: "+DefaultNameFormatter.getInstance().format(p3)+" - "+p3); // route(lcn Sal Salier-Radweg(412 members) 66 67 assertTrue(comparator.compare(p1, p2) == -1); // p1 < p2 68 assertTrue(comparator.compare(p2, p1) == 1); // p2 > p1 69 70 assertTrue(comparator.compare(p1, p3) == -1); // p1 < p3 71 assertTrue(comparator.compare(p3, p1) == 1); // p3 > p1 72 assertTrue(comparator.compare(p2, p3) == 1); // p2 > p3 73 assertTrue(comparator.compare(p3, p2) == -1); // p3 < p2 74 55 75 Relation[] relations = new ArrayList<>(ds.getRelations()).toArray(new Relation[0]); 56 System.out.println(Arrays.toString(relations)); 76 57 77 // Check each compare possibility 58 78 for (int i=0; i<relations.length; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.