Add test for MapWithAILayer#getMenuEntries

Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2020-02-24 14:36:29 -07:00
rodzic a9c06e44df
commit a365b4468f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
2 zmienionych plików z 17 dodań i 1 usunięć

Wyświetl plik

@ -226,7 +226,13 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis
return continuousDownload;
}
private static class ContinuousDownloadAction extends AbstractAction implements LayerAction {
/**
* Allow continuous download of data (for the layer that MapWithAI is clamped
* to).
*
* @author Taylor Smock
*/
public static class ContinuousDownloadAction extends AbstractAction implements LayerAction {
private static final long serialVersionUID = -3528632887550700527L;
private final MapWithAILayer layer;

Wyświetl plik

@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -37,6 +38,7 @@ import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.Layer;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAILayer.ContinuousDownloadAction;
import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;
import org.openstreetmap.josm.testutils.JOSMTestRules;
@ -175,4 +177,12 @@ public class MapWithAILayerTest {
assertEquals(2, mapWithAILayer.getDataSet().getDataSourceBounds().parallelStream().distinct().count(),
"There should be two data sources");
}
@Test
public void testGetMenuEntries() {
Layer layer = MapWithAIDataUtils.getLayer(true);
Action[] actions = layer.getMenuEntries();
assertTrue(actions.length > 0);
assertEquals(ContinuousDownloadAction.class, layer.getMenuEntries()[actions.length - 3].getClass());
}
}