Changeset 15921 in josm
- Timestamp:
- 2020-02-24T21:04:37+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java
r12859 r15921 4 4 import static org.junit.Assert.assertEquals; 5 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertNotNull; 6 7 8 import java.lang.reflect.Field; 9 import java.lang.reflect.InvocationTargetException; 10 import java.lang.reflect.Method; 7 11 import java.util.ArrayList; 8 12 import java.util.Arrays; 13 import java.util.Collections; 9 14 import java.util.HashMap; 10 15 import java.util.List; … … 17 22 import org.junit.Rule; 18 23 import org.junit.Test; 24 import org.openstreetmap.josm.TestUtils; 25 import org.openstreetmap.josm.data.coor.LatLon; 26 import org.openstreetmap.josm.data.osm.DataSet; 27 import org.openstreetmap.josm.data.osm.Node; 28 import org.openstreetmap.josm.data.osm.OsmDataManager; 29 import org.openstreetmap.josm.data.osm.Way; 19 30 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem; 31 import org.openstreetmap.josm.gui.MainApplication; 32 import org.openstreetmap.josm.gui.dialogs.properties.TagEditHelper.AddTagsDialog; 33 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 34 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 35 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 20 36 import org.openstreetmap.josm.testutils.JOSMTestRules; 21 37 … … 66 82 // TODO: complete test 67 83 } 84 85 /** 86 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/18764>#18764</a> 87 * 88 * @throws InvocationTargetException Check logs -- if caused by NPE, a 89 * regression probably occurred. 90 * @throws IllegalArgumentException Check source code 91 * @throws IllegalAccessException Check source code 92 * @throws NoSuchFieldException Check source code 93 * @throws SecurityException Probably shouldn't happen for tests 94 * @throws NoSuchMethodException Check source code 95 */ 96 @Test 97 public void testTicket18764() throws NoSuchMethodException, SecurityException, IllegalAccessException, 98 IllegalArgumentException, InvocationTargetException, NoSuchFieldException { 99 MapCSSStyleSource css = new MapCSSStyleSource( 100 "*[building] ⧉ *[highway] { text: tr(\"Building crossing highway\"); }"); 101 css.loadStyleSource(); 102 MapPaintStyles.addStyle(css); 103 DataSet ds = new DataSet(); 104 // This does require a way 105 Way way = TestUtils.newWay("", new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE)); 106 way.getNodes().forEach(ds::addPrimitive); 107 ds.addPrimitive(way); 108 OsmDataManager.getInstance().setActiveDataSet(ds); 109 MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, "Test Layer", null)); 110 TagEditHelper helper = newTagEditHelper(); 111 Field sel = TagEditHelper.class.getDeclaredField("sel"); 112 sel.set(helper, Collections.singletonList(way)); 113 AddTagsDialog addTagsDialog = helper.getAddTagsDialog(); 114 Method findIcon = TagEditHelper.AbstractTagsDialog.class.getDeclaredMethod("findIcon", String.class, 115 String.class); 116 findIcon.setAccessible(true); 117 Object val = findIcon.invoke(addTagsDialog, "highway", ""); 118 assertNotNull(val); 119 } 68 120 }
Note:
See TracChangeset
for help on using the changeset viewer.