Changeset 19387 in josm for trunk/test
- Timestamp:
- 2025-04-23T18:34:33+02:00 (2 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java
r18444 r19387 446 446 447 447 @Test 448 void testUpdateHPosErr() { 449 List<ImageEntry> list = getOneImage(); 450 ImageData data = new ImageData(list); 451 452 new Expectations(list.get(0)) {{ 453 list.get(0).setExifHPosErr(1.23); 454 list.get(0).flagNewGpsData(); 455 }}; 456 data.updateImageHPosErr(list.get(0), 1.23); 457 } 458 459 @Test 460 void testUpdateGpsDatum() { 461 List<ImageEntry> list = getOneImage(); 462 ImageData data = new ImageData(list); 463 464 new Expectations(list.get(0)) {{ 465 list.get(0).setExifGpsDatum("WGS-84"); 466 list.get(0).flagNewGpsData(); 467 }}; 468 data.updateImageExifGpsDatum(list.get(0), "WGS-84"); 469 } 470 471 @Test 472 void testUpdateGpsTrack() { 473 List<ImageEntry> list = getOneImage(); 474 ImageData data = new ImageData(list); 475 476 new Expectations(list.get(0)) {{ 477 list.get(0).setExifGpsTrack(180.5); 478 list.get(0).flagNewGpsData(); 479 }}; 480 data.updateImageGpsTrack(list.get(0), 180.5); 481 } 482 483 @Test 484 void testUpdateGpsDop() { 485 List<ImageEntry> list = getOneImage(); 486 ImageData data = new ImageData(list); 487 488 new Expectations(list.get(0)) {{ 489 list.get(0).setExifGpsDop(1.9); 490 list.get(0).flagNewGpsData(); 491 }}; 492 data.updateImageExifGpsDop(list.get(0), 1.9); 493 } 494 495 @Test 496 void testUpdateGpsProcMethod() { 497 List<ImageEntry> list = getOneImage(); 498 ImageData data = new ImageData(list); 499 500 new Expectations(list.get(0)) {{ 501 list.get(0).setExifGpsProcMethod("GNSS RTK CORRELATION"); 502 list.get(0).flagNewGpsData(); 503 }}; 504 data.updateImageExifGpsProcMethod(list.get(0), "GNSS RTK CORRELATION"); 505 } 506 507 @Test 508 void testUpdateGpsDifferentialMode() { 509 List<ImageEntry> list = getOneImage(); 510 ImageData data = new ImageData(list); 511 512 new Expectations(list.get(0)) {{ 513 list.get(0).setGpsDiffMode(1); 514 list.get(0).flagNewGpsData(); 515 }}; 516 data.updateImageGpsDiffMode(list.get(0), 1); 517 } 518 519 @Test 520 void testUpdateGps2d3dMode() { 521 List<ImageEntry> list = getOneImage(); 522 ImageData data = new ImageData(list); 523 524 new Expectations(list.get(0)) {{ 525 list.get(0).setGps2d3dMode(3); 526 list.get(0).flagNewGpsData(); 527 }}; 528 data.updateImageGps2d3dMode(list.get(0), 3); 529 } 530 531 @Test 448 532 void testTriggerListenerOnUpdate() { 449 533 List<ImageEntry> list = getOneImage(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java
r18853 r19387 351 351 assertEquals(Double.valueOf(150.0d), GpxImageCorrelation.getElevation(wp)); 352 352 } 353 354 /** 355 * Unit test of {@link GpxImageCorrelation#getHPosErr} 356 */ 357 @Test 358 void testGetHorizontalPosError() { 359 assertNull(GpxImageCorrelation.getHPosErr(null)); 360 WayPoint wp = new WayPoint(LatLon.ZERO); 361 assertNull(GpxImageCorrelation.getHPosErr(wp)); 362 wp.put(GpxConstants.PT_STD_HDEV, 1.5f); 363 assertEquals(1.5f, GpxImageCorrelation.getHPosErr(wp)); 364 } 365 366 /** 367 * Unit test of {@link GpxImageCorrelation#getGpsDop} 368 */ 369 @Test 370 void testGetGpsDop() { 371 assertNull(GpxImageCorrelation.getGpsDop(null)); 372 WayPoint wp = new WayPoint(LatLon.ZERO); 373 assertNull(GpxImageCorrelation.getGpsDop(wp)); 374 wp.put(GpxConstants.PT_HDOP, 2.1f); 375 assertEquals(2.1f, GpxImageCorrelation.getGpsDop(wp)); 376 wp.put(GpxConstants.PT_PDOP, 0.9f); 377 assertEquals(0.9f, GpxImageCorrelation.getGpsDop(wp)); 378 wp.put(GpxConstants.PT_PDOP, 1.2d); 379 assertEquals(1.2d, GpxImageCorrelation.getGpsDop(wp)); 380 } 381 382 /** 383 * Unit test of {@link GpxImageCorrelation#getGpsTrack} 384 */ 385 @Test 386 void testGetGpsTrack() { 387 assertNull(GpxImageCorrelation.getHPosErr(null)); 388 WayPoint wp = new WayPoint(LatLon.ZERO); 389 assertNull(GpxImageCorrelation.getGpsTrack(wp)); 390 wp.put(GpxConstants.PT_COURSE, ""); 391 assertNull(GpxImageCorrelation.getGpsTrack(wp)); 392 wp.put(GpxConstants.PT_COURSE, "not a number"); 393 assertNull(GpxImageCorrelation.getGpsTrack(wp)); 394 wp.put(GpxConstants.PT_COURSE, "167.0"); 395 assertEquals(Double.valueOf(167.0d), GpxImageCorrelation.getGpsTrack(wp), 0.01d); 396 } 397 398 /** 399 * Unit test of {@link GpxImageCorrelation#getGpsProcMethod} 400 */ 401 @Test 402 void testGetGpsProcMethod() { 403 final List<String> positionningModes = Arrays.asList("none", "manual", "estimated", "2d", "3d", "dgps", "float rtk", "rtk"); 404 assertNull(GpxImageCorrelation.getGpsProcMethod(null, null, positionningModes)); 405 assertNull(GpxImageCorrelation.getGpsProcMethod("", "", positionningModes)); 406 assertNull(GpxImageCorrelation.getGpsProcMethod("3d", null, positionningModes)); 407 assertNull(GpxImageCorrelation.getGpsProcMethod("", "dgps", positionningModes)); 408 assertEquals("MANUAL CORRELATION", GpxImageCorrelation.getGpsProcMethod("manual", "rtk", positionningModes)); 409 assertEquals("ESTIMATED CORRELATION", GpxImageCorrelation.getGpsProcMethod("estimated", "2d", positionningModes)); 410 assertEquals("GNSS DGPS CORRELATION", GpxImageCorrelation.getGpsProcMethod("rtk", "dgps", positionningModes)); 411 assertEquals("GNSS RTK_FLOAT CORRELATION", GpxImageCorrelation.getGpsProcMethod("float rtk", "rtk", positionningModes)); 412 assertEquals("GNSS RTK_FIX CORRELATION", GpxImageCorrelation.getGpsProcMethod("rtk", "rtk", positionningModes)); 413 } 414 415 /** 416 * Unit test of {@link GpxImageCorrelation#getGps2d3dMode} 417 */ 418 @Test 419 void testGetGps2d3dMode() { 420 final List<String> positionningModes = Arrays.asList("none", "manual", "estimated", "2d", "3d", "dgps", "float rtk", "rtk"); 421 assertNull(GpxImageCorrelation.getGps2d3dMode(null, null, positionningModes)); 422 assertNull(GpxImageCorrelation.getGps2d3dMode("", "", positionningModes)); 423 assertNull(GpxImageCorrelation.getGps2d3dMode("3d", null, positionningModes)); 424 assertNull(GpxImageCorrelation.getGps2d3dMode("", "dgps", positionningModes)); 425 assertNull(GpxImageCorrelation.getGps2d3dMode("estimated", "rtk", positionningModes)); 426 assertEquals(2, GpxImageCorrelation.getGps2d3dMode("2d", "2d", positionningModes)); 427 assertEquals(2, GpxImageCorrelation.getGps2d3dMode("2d", "3d", positionningModes)); 428 assertEquals(3, GpxImageCorrelation.getGps2d3dMode("3d", "dgps", positionningModes)); 429 } 353 430 } -
trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java
r18853 r19387 22 22 */ 23 23 class ExifReaderTest { 24 private File orientationSampleFile, directionSampleFile; 24 private File orientationSampleFile, directionSampleFile, positionErrorSampleFile; 25 25 26 26 /** … … 31 31 directionSampleFile = new File("nodist/data/exif-example_direction.jpg"); 32 32 orientationSampleFile = new File("nodist/data/exif-example_orientation=6.jpg"); 33 positionErrorSampleFile = new File("nodist/data/exif-position-error.jpg"); 33 34 } 34 35 … … 56 57 } 57 58 59 /** 60 * Test reading GPS date and time 61 */ 62 @Test 63 void testReadGpsDateTime() { 64 Instant date = ExifReader.readGpsInstant(positionErrorSampleFile); 65 assertEquals(Instant.parse("2024-04-30T16:36:42Z"), date); 66 } 67 58 68 /** 59 69 * Test orientation extraction … … 102 112 103 113 /** 114 * Test horizontal position error extraction 115 */ 116 @Test 117 void testReadHorPosError() { 118 assertEquals(Double.valueOf(0.014), ExifReader.readHpositioningError(positionErrorSampleFile)); 119 } 120 121 /** 122 * Test GPS track course extraction 123 */ 124 @Test 125 void testReadGpsTrack() { 126 assertEquals(Double.valueOf(298), ExifReader.readGpsTrackDirection(positionErrorSampleFile)); 127 } 128 129 /** 130 * Test GPS differential mode extraction 131 */ 132 @Test 133 void testReadGpsDiffmode() { 134 assertEquals(Integer.valueOf(1), ExifReader.readGpsDiffMode(positionErrorSampleFile)); 135 } 136 137 /** 138 * Test GPS DOP value extraction 139 */ 140 @Test 141 void testReadGpsDop() { 142 assertEquals(Double.valueOf(0.92), ExifReader.readGpsDop(positionErrorSampleFile)); 143 } 144 145 /** 146 * Test GPS measure mode (2D/3D) extraction 147 */ 148 @Test 149 void testReadGps2d3dMode() { 150 assertEquals(Integer.valueOf(3), ExifReader.readGpsMeasureMode(positionErrorSampleFile)); 151 } 152 153 /** 154 * Test GPS datum extraction 155 */ 156 @Test 157 void testReadGpsDatum() { 158 assertEquals(String.valueOf("EPSG:9782"), ExifReader.readGpsDatum(positionErrorSampleFile)); 159 } 160 161 /** 162 * Test GPS processing method extraction 163 */ 164 @Test 165 void testReadGpsProcMethod() { 166 assertEquals(String.valueOf("GNSS RTK_FIX CORRELATION"), ExifReader.readGpsProcessingMethod(positionErrorSampleFile)); 167 } 168 169 /** 104 170 * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/11685">#11685</a> 105 171 * @throws IOException if an error occurs during reading
Note:
See TracChangeset
for help on using the changeset viewer.