Changeset 32868 in osm for applications/editors/josm/plugins/ElevationProfile/test/unit
- Timestamp:
- 2016-08-23T01:59:35+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/test/unit/org/openstreetmap/josm/plugins/elevation/tests/EleVertexTest.java
r32775 r32868 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.elevation.tests; 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertTrue; 3 7 4 8 import java.awt.Color; 5 9 import java.util.List; 6 10 7 import org. openstreetmap.josm.Main;8 import org. openstreetmap.josm.data.Preferences;11 import org.junit.Rule; 12 import org.junit.Test; 9 13 import org.openstreetmap.josm.data.coor.LatLon; 10 14 import org.openstreetmap.josm.plugins.elevation.ColorMap; 11 15 import org.openstreetmap.josm.plugins.elevation.grid.EleCoordinate; 12 16 import org.openstreetmap.josm.plugins.elevation.grid.EleVertex; 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 13 18 14 import junit.framework.TestCase; 19 public class EleVertexTest { 15 20 16 public class EleVertexTest extends TestCase { 21 private static final double EPS = 1e-10; 17 22 18 /** 19 * Setup test. 20 */ 21 @Override 22 public void setUp() { 23 Main.pref = new Preferences(); 24 } 23 @Rule 24 public JOSMTestRules rules = new JOSMTestRules().preferences(); 25 25 26 @Test 26 27 public void testDivide() { 27 28 EleCoordinate p1 = new EleCoordinate(30.0, 30.0, 100.0); … … 36 37 // 1st vertex (p1, p2, pN 105m) 37 38 EleVertex v1 = list.get(0); 38 assertEquals(325 / 3D, v1.getEle() );39 assertEquals(325 / 3D, v1.getEle(), EPS); 39 40 assertCoorEq(v1, 30D, 30D, 0); 40 41 assertCoorEq(v1, 30D, 35D, 1); … … 44 45 EleVertex v2 = list.get(1); 45 46 46 assertEquals(335/3D, v2.getEle() );47 assertEquals(335/3D, v2.getEle(), EPS); 47 48 assertCoorEq(v2, 40D, 35D, 0); 48 49 assertCoorEq(v2, 30D, 35D, 1); … … 50 51 } 51 52 53 @Test 52 54 public void testSimpleRecurse() { 53 55 EleCoordinate c1 = new EleCoordinate(new LatLon(50.8328, 8.1337), 300); … … 89 91 }*/ 90 92 93 @Test 91 94 public void testColorMap() { 92 95 ColorMap testMap = ColorMap.create("Test", new Color[]{Color.white, Color.black}, new int[]{0, 1000}); … … 111 114 112 115 private void assertCoorEq(EleVertex v1, double x, double y, int n) { 113 assertEquals(x, v1.get(n).getX() );114 assertEquals(y, v1.get(n).getY() );116 assertEquals(x, v1.get(n).getX(), EPS); 117 assertEquals(y, v1.get(n).getY(), EPS); 115 118 } 116 119 }
Note:
See TracChangeset
for help on using the changeset viewer.