Changeset 18018 in josm for trunk/test/unit/org
- Timestamp:
- 2021-07-14T18:30:55+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java
r17275 r18018 6 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit.jupiter.api.Test; 8 9 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test;10 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 12 12 import org.openstreetmap.josm.gui.dialogs.LayerListDialog.LayerListModel; 13 import org.openstreetmap.josm.gui.dialogs.layer.LayerVisibilityAction.OpacitySlider; 13 14 import org.openstreetmap.josm.gui.layer.TMSLayer; 14 15 import org.openstreetmap.josm.gui.layer.TMSLayerTest; … … 52 53 // now check values 53 54 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(); 56 57 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); 58 62 action.updateValues(); 59 63 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()); 62 66 63 67 action.setVisibleFlag(false); … … 70 74 71 75 // 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); 74 78 assertEquals(0, layer.getOpacity(), 1e-15); 75 79 layer.setOpacity(.1); // to make layer.isVisible work … … 77 81 layer.setOpacity(0); 78 82 79 action.opacitySlider.slider.setValueIsAdjusting(false);80 action.opacitySlider.setRealValue(0);83 opacitySlider.slider.setValueIsAdjusting(false); 84 opacitySlider.setRealValue(0); 81 85 assertEquals(0, layer.getOpacity(), 1e-15); 82 86 layer.setOpacity(.1); // to make layer.isVisible work … … 88 92 action.setVisibleFlag(true); 89 93 action.updateValues(); 90 assertEquals(1.0, action.opacitySlider.getRealValue(), 1e-15);94 assertEquals(1.0, opacitySlider.getRealValue(), 1e-15); 91 95 assertEquals(1.0, layer.getOpacity(), 1e-15); 92 96 }
Note:
See TracChangeset
for help on using the changeset viewer.