Skip to content

Commit

Permalink
Add test for GPSHPositioningError
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefal committed Oct 17, 2024
1 parent 720ab15 commit f9c515e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@

package org.apache.commons.imaging.formats.jpeg.exif;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.File;
import java.util.stream.Stream;

import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.common.RationalNumber;
import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
import org.apache.commons.imaging.formats.tiff.TiffField;
import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

Expand Down Expand Up @@ -63,4 +69,16 @@ public void test(final File imageFile) throws Exception {
Debug.debug();

}

/**
* @throws Exception if it cannot open the images.
*/
@Test
public void testReadMetadata() throws Exception {
final File imageFile = new File(GpsTest.class.getResource("/images/jpeg/exif/2024-04-30_G012.JPG").getFile());
final JpegImageMetadata jpegMetadata = (JpegImageMetadata) Imaging.getMetadata(imageFile);
final TiffField gpsHPosErrorField = jpegMetadata.findExifValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_HORIZONTAL_POSITIONING_ERROR);
final RationalNumber gpsHPosError = (RationalNumber) gpsHPosErrorField.getValue();
assertEquals(0.014, gpsHPosError.doubleValue());
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f9c515e

Please sign in to comment.