Changeset 9661 in josm for trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
- Timestamp:
- 2016-01-28T09:29:14+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java
r9594 r9661 79 79 public void testGetSurroundingObjects() { 80 80 Layer layer = initDataSet(); 81 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size()); 82 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(0, 0)).size()); 83 assertEquals(1, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(1.5, 1.5)).size()); 84 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(3, 3)).size()); 85 Main.main.removeLayer(layer); 81 try { 82 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size()); 83 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(0, 0)).size()); 84 assertEquals(1, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(1.5, 1.5)).size()); 85 assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(new EastNorth(3, 3)).size()); 86 } finally { 87 // Ensure we clean the place before leaving, even if test fails. 88 Main.main.removeLayer(layer); 89 } 86 90 } 87 91 … … 92 96 public void testGetSmallestSurroundingObject() { 93 97 Layer layer = initDataSet(); 94 assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null)); 95 assertNotNull(SelectByInternalPointAction.getSmallestSurroundingObject(new EastNorth(1.5, 1.5))); 96 Main.main.removeLayer(layer); 98 try { 99 assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null)); 100 assertNotNull(SelectByInternalPointAction.getSmallestSurroundingObject(new EastNorth(1.5, 1.5))); 101 } finally { 102 // Ensure we clean the place before leaving, even if test fails. 103 Main.main.removeLayer(layer); 104 } 97 105 } 98 106 … … 103 111 public void testPerformSelection() { 104 112 Layer layer = initDataSet(); 105 DataSet ds = JosmAction.getCurrentDataSet(); 113 try { 114 DataSet ds = JosmAction.getCurrentDataSet(); 106 115 107 assertEquals(0, ds.getSelected().size()); 108 SelectByInternalPointAction.performSelection(null, false, false); 109 assertEquals(0, ds.getSelected().size()); 110 SelectByInternalPointAction.performSelection(new EastNorth(0, 0), false, false); 111 assertEquals(0, ds.getSelected().size()); 112 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, false); 113 assertEquals(1, ds.getSelected().size()); 114 ds.clearSelection(); 115 ds.addSelected(ds.getNodes()); 116 assertEquals(4, ds.getSelected().size()); 117 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), true, false); 118 assertEquals(5, ds.getSelected().size()); 119 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, true); 120 assertEquals(4, ds.getSelected().size()); 121 122 Main.main.removeLayer(layer); 116 assertEquals(0, ds.getSelected().size()); 117 SelectByInternalPointAction.performSelection(null, false, false); 118 assertEquals(0, ds.getSelected().size()); 119 SelectByInternalPointAction.performSelection(new EastNorth(0, 0), false, false); 120 assertEquals(0, ds.getSelected().size()); 121 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, false); 122 assertEquals(1, ds.getSelected().size()); 123 ds.clearSelection(); 124 ds.addSelected(ds.getNodes()); 125 assertEquals(4, ds.getSelected().size()); 126 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), true, false); 127 assertEquals(5, ds.getSelected().size()); 128 SelectByInternalPointAction.performSelection(new EastNorth(1.5, 1.5), false, true); 129 assertEquals(4, ds.getSelected().size()); 130 } finally { 131 // Ensure we clean the place before leaving, even if test fails. 132 Main.main.removeLayer(layer); 133 } 123 134 } 124 135 }
Note:
See TracChangeset
for help on using the changeset viewer.