Changeset 10457 in josm for trunk/test


Ignore:
Timestamp:
2016-06-22T21:45:43+02:00 (4 years ago)
Author:
Don-vip
Message:

fix #13033 - JoinAreasActionTest: Do not set status line (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r10436 r10457  
    66import java.io.IOException;
    77import java.io.InputStream;
     8import java.util.Collection;
    89
    910import org.junit.BeforeClass;
     
    1415import org.openstreetmap.josm.actions.search.SearchAction;
    1516import org.openstreetmap.josm.data.osm.DataSet;
     17import org.openstreetmap.josm.data.osm.OsmPrimitive;
     18import org.openstreetmap.josm.data.osm.Way;
    1619import org.openstreetmap.josm.gui.layer.Layer;
    1720import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1821import org.openstreetmap.josm.io.IllegalDataException;
    1922import org.openstreetmap.josm.io.OsmReader;
     23import org.openstreetmap.josm.tools.Utils;
    2024
    2125/**
     
    6569            Layer layer = new OsmDataLayer(ds, null, null);
    6670            Main.getLayerManager().addLayer(layer);
    67             try {
    68                 for (String ref : new String[]{"A", "B", "C", "D", "E"}) {
    69                     System.out.print("Joining ways " + ref);
    70                     SearchAction.search("type:way ref="+ref, SearchAction.SearchMode.replace);
    71                     assertEquals(2, ds.getSelectedWays().size());
    72                     Main.main.menu.joinAreas.join(ds.getSelectedWays());
    73                     assertEquals(1, ds.getSelectedWays().size());
    74                     System.out.println(" ==> OK");
    75                 }
    76             } finally {
    77                 // Ensure we clean the place before leaving, even if test fails.
    78                 Main.getLayerManager().removeLayer(layer);
     71            for (String ref : new String[]{"A", "B", "C", "D", "E"}) {
     72                System.out.print("Joining ways " + ref);
     73                Collection<OsmPrimitive> found = SearchAction.searchAndReturn("type:way ref="+ref, SearchAction.SearchMode.replace);
     74                assertEquals(2, found.size());
     75
     76                Main.main.menu.joinAreas.join(Utils.filteredCollection(found, Way.class));
     77
     78                Collection<OsmPrimitive> found2 = SearchAction.searchAndReturn("type:way ref="+ref, SearchAction.SearchMode.replace);
     79                assertEquals(1, found2.size());
     80                System.out.println(" ==> OK");
    7981            }
    8082        }
Note: See TracChangeset for help on using the changeset viewer.