Ignore:
Timestamp:
2016-11-08T23:29:31+01:00 (8 years ago)
Author:
michael2402
Message:

Simplify ExpertToggleAction

Make ExpertToggleAction use the listener list to track weak listeners and add a method to set expert mode explicitly. Use it in OsmDataLayerTest to make tracing expert mode problems easier.

Add test case for ExpertToggleAction.

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
1 added
1 edited

Legend:

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

    r11040 r11224  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotEquals;
    76import static org.junit.Assert.assertNotNull;
    87import static org.junit.Assert.assertTrue;
     
    192191    public void testGetMenuEntries() {
    193192        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    194         boolean mode = ExpertToggleAction.isExpert();
    195         ExpertToggleAction.getInstance().actionPerformed(null);
    196         assertNotEquals(mode, ExpertToggleAction.isExpert());
    197         assertEquals(ExpertToggleAction.isExpert() ? 16 : 13, layer.getMenuEntries().length);
    198         ExpertToggleAction.getInstance().actionPerformed(null);
    199         assertEquals(mode, ExpertToggleAction.isExpert());
    200         assertEquals(ExpertToggleAction.isExpert() ? 16 : 13, layer.getMenuEntries().length);
     193        ExpertToggleAction.getInstance().setExpert(true);
     194        assertEquals(16, layer.getMenuEntries().length);
     195
     196        ExpertToggleAction.getInstance().setExpert(false);
     197        assertEquals(13, layer.getMenuEntries().length);
    201198    }
    202199
Note: See TracChangeset for help on using the changeset viewer.