Ticket #24238: more_tests_24238.patch

File more_tests_24238.patch, 2.1 KB (added by StephaneP, 11 months ago)

More unit tests

  • photo_geotagging/test/unit/org/openstreetmap/josm/plugins/photo_geotagging/ExifGPSTaggerTest.java

     
    2121import org.openstreetmap.josm.TestUtils;
    2222import org.openstreetmap.josm.data.coor.LatLon;
    2323import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry;
     24import org.openstreetmap.josm.tools.ExifReader;
    2425
    2526class ExifGPSTaggerTest {
    2627
     
    7273    }
    7374
    7475    @Test
    75     public void testTicket24278() {
     76    public void testTicket24278() throws Exception{
    7677        final File in = new File(TestUtils.getTestDataRoot(), "_DSC1234.jpg");
    7778        final File out = new File(tempFolder, in.getName());
    7879        final ImageEntry image = newImageEntry("test", 12d, 34d, Instant.now(), 12.34d, Math.E, Math.PI);
    79         image.setExifGpsTrack(Math.PI);
    80         image.setGpsDiffMode(2);
     80        image.setExifGpsTrack(97.99);
     81        image.setGpsDiffMode(1);
    8182        image.setGps2d3dMode(3);
    8283        image.setExifGpsProcMethod("GPS");
    8384        image.setExifHPosErr(1.2d);
    8485        image.setExifGpsDop(2.5d);
    8586        image.setExifGpsDatum("WGS84");
    86         assertDoesNotThrow(() -> ExifGPSTagger.setExifGPSTag(in, out, image, true));
    87         /* TODO read temp file and assertEquals EXIF metadata values */
     87        ExifGPSTagger.setExifGPSTag(in, out, image, true);
     88        assertEquals(Math.PI, ExifReader.readDirection(out), 0.001);
     89        assertEquals(97.99, ExifReader.readGpsTrackDirection(out));
     90        assertEquals(1, ExifReader.readGpsDiffMode(out));
     91        assertEquals(3, ExifReader.readGpsMeasureMode(out));
     92        assertEquals("GPS", ExifReader.readGpsProcessingMethod(out));
     93        assertEquals(1.2, ExifReader.readHpositioningError(out));
     94        assertEquals(2.5, ExifReader.readGpsDop(out));
     95        assertEquals("WGS84", ExifReader.readGpsDatum(out));
    8896    }
    8997}