Changeset 19455 in josm for trunk/test/unit


Ignore:
Timestamp:
2026-01-05T14:30:23+01:00 (5 weeks ago)
Author:
stoecker
Message:

fix #24517 - patch by StephaneP - NullPointerException when trying to correlate images without ExifGpsTime - modifies a function prototype which seems unused by any plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    r19082 r19455  
    33
    44import static org.junit.jupiter.api.Assertions.assertThrows;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    56
     7import java.util.Arrays;
    68import java.util.Collections;
    79
    810import org.junit.jupiter.api.AfterEach;
    911import org.junit.jupiter.api.Test;
     12import org.openstreetmap.josm.data.gpx.TimeSource;
    1013import org.openstreetmap.josm.data.osm.DataSet;
    1114import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    1316import org.openstreetmap.josm.testutils.annotations.Main;
    1417import org.openstreetmap.josm.testutils.annotations.ThreadSync;
     18import org.openstreetmap.josm.tools.date.DateUtils;
    1519
    1620/**
     
    4246        assertThrows(IllegalArgumentException.class, () -> geoImageLayer.mergeFrom(osmDataLayer));
    4347    }
     48
     49    /**
     50     * Test that {@link GeoImageLayer#getSortedImgList} filters images without ExifGpsTime
     51     */
     52    @Test
     53    void testMissingGPSTimeStamp() {
     54        ImageEntry i1, i2;
     55        i1 = new ImageEntry();
     56        i1.setExifGpsTime(DateUtils.parseInstant("2016:01:03 12:00:00"));
     57        i2 = new ImageEntry();
     58        i2.setExifTime(DateUtils.parseInstant("2016:01:03 12:00:01"));
     59
     60        GeoImageLayer geoGpsImageLayer = new GeoImageLayer(Arrays.asList(i1, i2), null);
     61        assertEquals(1, geoGpsImageLayer.getSortedImgList(false, false, TimeSource.EXIFGPSTIME).size());
     62    }
     63
    4464}
Note: See TracChangeset for help on using the changeset viewer.