Changeset 18018 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2021-07-14T18:30:55+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21104 - see #20659 - Image viewer: fix tooltips and icon size, hide layer-specific visibility checkbox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r17275 r18018  
    66import static org.junit.jupiter.api.Assertions.assertTrue;
    77
     8import org.junit.jupiter.api.Test;
    89import org.junit.jupiter.api.extension.RegisterExtension;
    9 import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    1212import org.openstreetmap.josm.gui.dialogs.LayerListDialog.LayerListModel;
     13import org.openstreetmap.josm.gui.dialogs.layer.LayerVisibilityAction.OpacitySlider;
    1314import org.openstreetmap.josm.gui.layer.TMSLayer;
    1415import org.openstreetmap.josm.gui.layer.TMSLayerTest;
     
    5253        // now check values
    5354        action.updateValues();
    54         assertEquals(1.0, action.opacitySlider.getRealValue(), 1e-15);
    55         assertEquals("OpacitySlider [getRealValue()=1.0]", action.opacitySlider.toString());
     55        OpacitySlider opacitySlider = action.sliders.stream()
     56                .filter(x -> x instanceof OpacitySlider).map(x -> (OpacitySlider) x).findFirst().get();
    5657
    57         action.opacitySlider.setRealValue(.5);
     58        assertEquals(1.0, opacitySlider.getRealValue(), 1e-15);
     59        assertEquals("OpacitySlider [getRealValue()=1.0]", opacitySlider.toString());
     60
     61        opacitySlider.setRealValue(.5);
    5862        action.updateValues();
    5963
    60         assertEquals(0.5, action.opacitySlider.getRealValue(), 1e-15);
    61         assertEquals("OpacitySlider [getRealValue()=0.5]", action.opacitySlider.toString());
     64        assertEquals(0.5, opacitySlider.getRealValue(), 1e-15);
     65        assertEquals("OpacitySlider [getRealValue()=0.5]", opacitySlider.toString());
    6266
    6367        action.setVisibleFlag(false);
     
    7074
    7175        // layer stays visible during adjust
    72         action.opacitySlider.slider.setValueIsAdjusting(true);
    73         action.opacitySlider.setRealValue(0);
     76        opacitySlider.slider.setValueIsAdjusting(true);
     77        opacitySlider.setRealValue(0);
    7478        assertEquals(0, layer.getOpacity(), 1e-15);
    7579        layer.setOpacity(.1); // to make layer.isVisible work
     
    7781        layer.setOpacity(0);
    7882
    79         action.opacitySlider.slider.setValueIsAdjusting(false);
    80         action.opacitySlider.setRealValue(0);
     83        opacitySlider.slider.setValueIsAdjusting(false);
     84        opacitySlider.setRealValue(0);
    8185        assertEquals(0, layer.getOpacity(), 1e-15);
    8286        layer.setOpacity(.1); // to make layer.isVisible work
     
    8892        action.setVisibleFlag(true);
    8993        action.updateValues();
    90         assertEquals(1.0, action.opacitySlider.getRealValue(), 1e-15);
     94        assertEquals(1.0, opacitySlider.getRealValue(), 1e-15);
    9195        assertEquals(1.0, layer.getOpacity(), 1e-15);
    9296    }
Note: See TracChangeset for help on using the changeset viewer.