Changeset 23571 in osm for applications/editors/josm/plugins/turnrestrictions/test
- Timestamp:
- 2010-10-12T16:31:47+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/AllUnitTests.java
r23510 r23571 1 1 package org.openstreetmap.josm.plugins.turnrestrictions; 2 2 3 import org.junit.runner.RunWith; 4 import org.junit.runners.Suite; 3 5 import org.openstreetmap.josm.plugins.turnrestrictions.editor.AllEditorTests; 4 6 5 import junit.framework.Test; 6 import junit.framework.TestSuite; 7 8 public class AllUnitTests { 9 public static Test suite() throws Exception { 10 TestSuite suite = new TestSuite(AllUnitTests.class.getName()); 11 suite.addTest(AllEditorTests.suite()); 12 return suite; 13 } 14 } 7 @RunWith(Suite.class) 8 @Suite.SuiteClasses({ 9 AllEditorTests.class, 10 TurnRestrictionBuilderTest.class 11 }) 12 public class AllUnitTests {} -
applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AllEditorTests.java
r23510 r23571 1 1 package org.openstreetmap.josm.plugins.turnrestrictions.editor; 2 2 3 import groovy.util.GroovyTestSuite;4 import junit.framework.Test;5 3 import junit.framework.TestCase; 6 import junit.framework.TestSuite;7 4 8 public class AllEditorTests extends TestCase{ 5 import org.junit.runner.RunWith; 6 import org.junit.runners.Suite; 9 7 10 private static final String TEST_ROOT = "test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/"; 11 private static final GroovyTestSuite gsuite = new GroovyTestSuite(); 12 13 private static <T extends TestCase> Class<T> groovyts(String className) throws Exception { 14 return gsuite.compile(TEST_ROOT + className + ".groovy"); 15 } 16 17 public static Test suite() throws Exception { 18 TestSuite suite = new TestSuite(AllEditorTests.class.getName()); 19 suite.addTestSuite(groovyts("JosmSelectionListModelTest")); 20 suite.addTestSuite(groovyts("TurnRestrictionEditorModelUnitTest")); 21 suite.addTestSuite(groovyts("TurnRestrictionLegEditorUnitTest")); 22 suite.addTestSuite(groovyts("TurnRestrictionTypeRendererTest")); 23 suite.addTestSuite(groovyts("TurnRestrictionTypeTest")); 24 return suite; 25 } 26 } 8 @RunWith(Suite.class) 9 @Suite.SuiteClasses({ 10 JosmSelectionListModelTest.class, 11 TurnRestrictionEditorModelUnitTest.class, 12 TurnRestrictionLegEditorUnitTest.class, 13 TurnRestrictionTypeRendererTest.class, 14 TurnRestrictionTypeTest.class, 15 ExceptValueModelTest.class 16 }) 17 public class AllEditorTests extends TestCase{} -
applications/editors/josm/plugins/turnrestrictions/test/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModelTest.groovy
r23510 r23571 33 33 DataSet ds = new DataSet() 34 34 OsmDataLayer layer = new OsmDataLayer(ds, "test", null) 35 JosmSelectionListModel model = new JosmSelectionListModel(layer , new DefaultListSelectionModel());35 JosmSelectionListModel model = new JosmSelectionListModel(layer); 36 36 37 37 shouldFail(IllegalArgumentException){ 38 model = new JosmSelectionListModel(layer, null) 39 } 40 41 shouldFail(IllegalArgumentException){ 42 model = new JosmSelectionListModel(null, new DefaultListSelectionModel()) 38 model = new JosmSelectionListModel(null) 43 39 } 44 40 } … … 48 44 DataSet ds = new DataSet() 49 45 OsmDataLayer layer = new OsmDataLayer(ds, "test", null) 50 JosmSelectionListModel model = new JosmSelectionListModel(layer , new DefaultListSelectionModel());46 JosmSelectionListModel model = new JosmSelectionListModel(layer); 51 47 52 48 // set a selection with three objects … … 70 66 DataSet ds = new DataSet() 71 67 OsmDataLayer layer = new OsmDataLayer(ds, "test", null) 72 JosmSelectionListModel model = new JosmSelectionListModel(layer , new DefaultListSelectionModel());68 JosmSelectionListModel model = new JosmSelectionListModel(layer); 73 69 def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()] 74 70 model.setJOSMSelection(objects) … … 88 84 DataSet ds = new DataSet() 89 85 OsmDataLayer layer = new OsmDataLayer(ds, "test", null) 90 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();91 86 92 JosmSelectionListModel model = new JosmSelectionListModel(layer, selectionModel); 87 JosmSelectionListModel model = new JosmSelectionListModel(layer); 88 DefaultListSelectionModel selectionModel = model.getListSelectionModel() 89 93 90 assert model.getSelected() != null 94 91 assert model.getSelected().isEmpty() … … 109 106 DataSet ds = new DataSet() 110 107 OsmDataLayer layer = new OsmDataLayer(ds, "test", null) 111 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();112 108 113 109 // set selected with null is OK - nothing selected thereafter 114 JosmSelectionListModel model = new JosmSelectionListModel(layer, selectionModel); 110 JosmSelectionListModel model = new JosmSelectionListModel(layer); 111 DefaultListSelectionModel selectionModel = model.getListSelectionModel() 115 112 model.setSelected(null) 116 113 assert model.getSelected().isEmpty() … … 135 132 public void test_editLayerChanged() { 136 133 DataSet ds = new DataSet() 137 DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();134 138 135 def objects = [new Node(new LatLon(1,1)), new Way(), new Relation()] 139 136 objects.each {ds.addPrimitive(it)} … … 142 139 OsmDataLayer layer2 = new OsmDataLayer(new DataSet(),"layer2", null) 143 140 144 JosmSelectionListModel model = new JosmSelectionListModel(layer1 , selectionModel);145 141 JosmSelectionListModel model = new JosmSelectionListModel(layer1); 142 DefaultListSelectionModel selectionModel = model.getListSelectionModel() 146 143 // switch from edit layer1 to edit layer2. content of the JOSM selection 147 144 // should be empty thereafter
Note:
See TracChangeset
for help on using the changeset viewer.