Changeset 17081 in josm for trunk


Ignore:
Timestamp:
2020-10-01T21:17:32+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #19865 - IOOBE selecting several pictures and attempting to delete them (patch by francois2)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/ImageData.java

    r16548 r17081  
    267267            data.remove(img);
    268268        }
    269         if (selectedImagesIndex.get(0) == data.size()) {
     269        if (selectedImagesIndex.get(0) >= data.size()) {
    270270            setSelectedImageIndex(data.size() - 1);
    271271        } else {
  • trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java

    r15352 r17081  
    196196
    197197    @Test
     198    public void testRemoveSelectedImagesWithRemainingImages() {
     199        List<ImageEntry> list = getOneImage();
     200        list.add(new ImageEntry());
     201        list.add(new ImageEntry());
     202
     203        ImageData data = new ImageData(list);
     204        data.selectLastImage();
     205        data.addImageToSelection(list.get(1));
     206        data.removeSelectedImages();
     207        assertEquals(1, data.getImages().size());
     208        assertEquals(1, data.getSelectedImages().size());
     209    }
     210
     211    @Test
    198212    public void testSelectImageAfterRemove() {
    199213        List<ImageEntry> list = getOneImage();
     
    347361        data.selectFirstImage();
    348362        assertEquals(1, data.getSelectedImages().size());
    349 
    350363    }
    351364
Note: See TracChangeset for help on using the changeset viewer.