Changeset 15348 in josm for trunk/test/unit


Ignore:
Timestamp:
2019-09-12T23:23:47+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18119 - Deselect and remove multiple images in the ImageViewerDialog (patch by francois2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java

    r15334 r15348  
    183183
    184184    @Test
    185     public void testRemoveSelectedWithImageTriggerListener() {
     185    public void testRemoveSelectedImages() {
     186        List<ImageEntry> list = getOneImage();
     187        list.add(new ImageEntry());
     188
     189        ImageData data = new ImageData(list);
     190        data.selectFirstImage();
     191        data.addImageToSelection(list.get(1));
     192        data.removeSelectedImages();
     193        assertEquals(0, data.getImages().size());
     194        assertEquals(0, data.getSelectedImages().size());
     195    }
     196
     197    @Test
     198    public void testRemoveSelectedImageTriggerListener() {
    186199        List<ImageEntry> list = getOneImage();
    187200        list.add(new ImageEntry());
     
    200213        data.selectFirstImage();
    201214        data.removeSelectedImage();
     215    }
     216
     217    @Test
     218    public void testRemoveSelectedImagesTriggerListener() {
     219        List<ImageEntry> list = getOneImage();
     220        list.add(new ImageEntry());
     221        ImageData data = new ImageData(list);
     222        ImageDataUpdateListener listener = new ImageDataUpdateListener() {
     223            @Override
     224            public void selectedImageChanged(ImageData data) {}
     225
     226            @Override
     227            public void imageDataUpdated(ImageData data) {}
     228        };
     229        new Expectations(listener) {{
     230            listener.selectedImageChanged(data); times = 2;
     231        }};
     232        data.addImageDataUpdateListener(listener);
     233        data.selectFirstImage();
     234        data.removeSelectedImages();
    202235    }
    203236
Note: See TracChangeset for help on using the changeset viewer.