Changeset 15946 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r15889 r15946 71 71 import org.openstreetmap.josm.command.SequenceCommand; 72 72 import org.openstreetmap.josm.data.UndoRedoHandler; 73 import org.openstreetmap.josm.data.coor.LatLon; 73 74 import org.openstreetmap.josm.data.osm.DataSet; 75 import org.openstreetmap.josm.data.osm.INode; 74 76 import org.openstreetmap.josm.data.osm.OsmDataManager; 75 77 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 693 695 final OsmPrimitive virtual = (osmPrimitiveIterator.hasNext() ? osmPrimitiveIterator.next().getType() : OsmPrimitiveType.NODE) 694 696 .newInstance(0, false); 697 if (virtual instanceof INode) { 698 ((INode) virtual).setCoor(LatLon.ZERO); 699 } 695 700 virtual.put(key, value); 696 701 final ImageIcon padded = ImageProvider.getPadded(virtual, ImageProvider.ImageSizes.LARGEICON.getImageDimension(), -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java
r15927 r15946 37 37 import org.openstreetmap.josm.testutils.JOSMTestRules; 38 38 import org.openstreetmap.josm.testutils.mockers.WindowMocker; 39 import org.openstreetmap.josm.tools.RightAndLefthandTraffic; 39 40 40 41 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 50 51 @Rule 51 52 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 52 public JOSMTestRules test = new JOSMTestRules() ;53 public JOSMTestRules test = new JOSMTestRules().territories().projection(); 53 54 54 55 private static TagEditHelper newTagEditHelper() { … … 124 125 assertNotNull(val); 125 126 } 127 128 /** 129 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/18798>#18798</a> 130 * 131 * @throws InvocationTargetException Check logs -- if caused by NPE, a 132 * regression probably occurred. 133 * @throws IllegalArgumentException Check source code 134 * @throws IllegalAccessException Check source code 135 * @throws NoSuchFieldException Check source code 136 * @throws SecurityException Probably shouldn't happen for tests 137 * @throws NoSuchMethodException Check source code 138 */ 139 @Test 140 public void testTicket18798() throws NoSuchMethodException, SecurityException, IllegalAccessException, 141 IllegalArgumentException, InvocationTargetException, NoSuchFieldException { 142 TestUtils.assumeWorkingJMockit(); 143 if (GraphicsEnvironment.isHeadless()) { 144 new WindowMocker(); 145 } 146 RightAndLefthandTraffic.initialize(); 147 MapCSSStyleSource css = new MapCSSStyleSource( 148 "node:righthandtraffic[junction=roundabout] { text: tr(\"Roundabout node\"); }"); 149 css.loadStyleSource(); 150 MapPaintStyles.addStyle(css); 151 Node node = new Node(LatLon.NORTH_POLE); 152 DataSet ds = new DataSet(node); 153 OsmDataManager.getInstance().setActiveDataSet(ds); 154 MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, "Test Layer", null)); 155 TagEditHelper helper = newTagEditHelper(); 156 Field sel = TagEditHelper.class.getDeclaredField("sel"); 157 sel.set(helper, Collections.singletonList(node)); 158 AddTagsDialog addTagsDialog = helper.getAddTagsDialog(); 159 Method findIcon = TagEditHelper.AbstractTagsDialog.class.getDeclaredMethod("findIcon", String.class, 160 String.class); 161 findIcon.setAccessible(true); 162 Object val = findIcon.invoke(addTagsDialog, "junction", "roundabout"); 163 assertNotNull(val); 164 } 126 165 }
Note:
See TracChangeset
for help on using the changeset viewer.