Changeset 10432 in josm for trunk/test


Ignore:
Timestamp:
2016-06-20T00:06:54+02:00 (4 years ago)
Author:
Don-vip
Message:

fix #13001 - Add MainPanel + some new methods (patch by michael2402, modified) - gsoc-core

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/NoteImporterTest.java

    r10396 r10432  
    77import java.io.File;
    88
     9import org.junit.Rule;
    910import org.junit.Test;
    1011import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.TestUtils;
    12 import org.openstreetmap.josm.gui.layer.Layer;
     13import org.openstreetmap.josm.testutils.JOSMTestRules;
    1314
    1415/**
     
    1819
    1920    /**
     21     * Use the test rules to remove any layers and reset state.
     22     */
     23    @Rule
     24    public final JOSMTestRules rules = new JOSMTestRules();
     25
     26    /**
    2027     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/12531">Bug #12531</a>.
    2128     */
    2229    @Test
    2330    public void testTicket12531() {
    24         if (Main.map != null) {
    25             for (Layer l: Main.getLayerManager().getLayers()) {
    26                 Main.getLayerManager().removeLayer(l);
    27             }
    28             Main.main.setMapFrame(null);
    29         }
     31        Main.getLayerManager().resetState();
    3032        assertNull(Main.map);
    3133        assertTrue(new NoteImporter().importDataHandleExceptions(
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r10402 r10432  
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.data.projection.Projections;
    15 import org.openstreetmap.josm.gui.layer.MainLayerManager;
    1615import org.openstreetmap.josm.gui.util.GuiHelper;
    1716import org.openstreetmap.josm.io.OsmApi;
     
    223222        });
    224223        // Remove all layers
    225         MainLayerManager lm = Main.getLayerManager();
    226         while (!lm.getLayers().isEmpty()) {
    227             lm.removeLayer(lm.getLayers().get(0));
    228         }
     224        Main.getLayerManager().resetState();
    229225
    230226        // TODO: Remove global listeners and other global state.
Note: See TracChangeset for help on using the changeset viewer.