Changeset 15141 in josm for trunk/test
- Timestamp:
- 2019-05-30T10:01:42+02:00 (5 years ago)
- Location:
- trunk/test
- Files:
-
- 4 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java
r15034 r15141 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue; 5 7 6 8 import java.nio.file.Files; … … 10 12 import java.util.TreeMap; 11 13 14 import org.junit.Ignore; 12 15 import org.junit.Rule; 13 16 import org.junit.Test; … … 15 18 import org.openstreetmap.josm.command.SequenceCommand; 16 19 import org.openstreetmap.josm.data.osm.DataSet; 20 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 17 21 import org.openstreetmap.josm.data.osm.Relation; 18 22 import org.openstreetmap.josm.data.osm.RelationMember; … … 21 25 import org.openstreetmap.josm.data.osm.search.SearchParseError; 22 26 import org.openstreetmap.josm.data.osm.search.SearchSetting; 27 import org.openstreetmap.josm.gui.MainApplication; 28 import org.openstreetmap.josm.gui.layer.Layer; 29 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 30 import org.openstreetmap.josm.io.OsmReader; 24 31 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 38 45 @Rule 39 46 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 public JOSMTestRules test = new JOSMTestRules().projection() ;47 public JOSMTestRules test = new JOSMTestRules().projection().main().preferences(); 41 48 42 49 private static Map<String, String> getRefToRoleMap(Relation relation) { … … 107 114 assertEquals("{1=outer, 1.1=inner, 1.1.1=outer, 1.1.2=outer, 1.2=inner}", getRefToRoleMap(mp2).toString()); 108 115 } 116 117 /** 118 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17767">Bug #17767</a>. 119 * @throws Exception if an error occurs 120 */ 121 @Test 122 public void testTicket17767() throws Exception { 123 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17767, "upd-mp.osm"), null); 124 Layer layer = new OsmDataLayer(ds, null, null); 125 MainApplication.getLayerManager().addLayer(layer); 126 try { 127 CreateMultipolygonAction updateAction = new CreateMultipolygonAction(true); 128 CreateMultipolygonAction createAction = new CreateMultipolygonAction(false); 129 assertFalse(updateAction.isEnabled()); 130 assertFalse(createAction.isEnabled()); 131 ds.setSelected(ds.getPrimitiveById(189944949L, OsmPrimitiveType.WAY)); 132 assertFalse(updateAction.isEnabled()); 133 assertTrue(createAction.isEnabled()); 134 } finally { 135 MainApplication.getLayerManager().removeLayer(layer); 136 } 137 } 138 139 /** 140 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17768">Bug #17768</a>. 141 * @throws Exception if an error occurs 142 */ 143 @Test 144 @Ignore 145 public void testTicket17768() throws Exception { 146 DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17768, "dupmem.osm"), null); 147 Layer layer = new OsmDataLayer(ds, null, null); 148 MainApplication.getLayerManager().addLayer(layer); 149 try { 150 Relation old = (Relation) ds.getPrimitiveById(580092, OsmPrimitiveType.RELATION); 151 assertEquals(3, old.getMembersCount()); 152 Relation mp = createMultipolygon(ds.getWays(), "type:way", old, true); 153 assertEquals(mp.getPrimitiveId(), old.getPrimitiveId()); 154 assertEquals(2, mp.getMembersCount()); 155 } finally { 156 MainApplication.getLayerManager().removeLayer(layer); 157 } 158 159 } 109 160 }
Note:
See TracChangeset
for help on using the changeset viewer.