src/androidTest/java/de/blau/android/layer/LayerDialogTest.java
/**
     * Load geojson file and check if we can zoom to extent, style, discard
     */
Load geojson file and check if we can zoom to extent, style, discard
Load geojson file and check if we can zoom to extent style discard
@Test
    public void geoJsonLayer() {
        final String geoJsonFile = "featureCollection.geojson";
        try {
            JavaResources.copyFileFromResources(main, geoJsonFile, "geojson/", "/");
        } catch (IOException e) {
            fail(e.getMessage());
        }
        assertTrue(TestUtils.clickResource(device, true, device.getCurrentPackageName() + ":id/layers", true));
        assertTrue(TestUtils.clickButton(device, device.getCurrentPackageName() + ":id/add", true));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.menu_layers_load_geojson), true, false));
        TestUtils.selectFile(device, main, null, geoJsonFile, true);
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.okay), true, false));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.Done), true, false));
        UiObject2 extentButton = TestUtils.getLayerButton(device, geoJsonFile, EXTENT_BUTTON);
        extentButton.click();
        UiObject2 menuButton = TestUtils.getLayerButton(device, geoJsonFile, MENU_BUTTON);
        menuButton.clickAndWait(Until.newWindow(), 1000);
        de.blau.android.layer.geojson.MapOverlay layer = map.getGeojsonLayer();
        assertEquals("", layer.getLabel("ignored"));
        assertEquals(Map.SHOW_LABEL_LIMIT, layer.getLabelMinZoom("ignored"));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.layer_change_style), true, false));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.none), false));
        assertTrue(TestUtils.findText(device, false, "prop0", 1000));
        assertTrue(TestUtils.clickText(device, false, "prop0", false));
        assertTrue(TestUtils.findText(device, false, Integer.toString(Map.SHOW_LABEL_LIMIT), 1000));
        assertTrue(TestUtils.clickText(device, false, "-", false));
        assertTrue(TestUtils.findText(device, false, Integer.toString(Map.SHOW_LABEL_LIMIT - 1), 1000));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.okay), true, false));
        TestUtils.sleep();
        assertEquals("prop0", layer.getLabel("ignored"));
        assertEquals(Map.SHOW_LABEL_LIMIT - 1, layer.getLabelMinZoom("ignored"));
        menuButton.clickAndWait(Until.newWindow(), 1000);
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.menu_information), true, false));
        assertTrue(TestUtils.findText(device, false, "MultiLineString"));
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.done), true, false));
        TestUtils.sleep();
        menuButton.clickAndWait(Until.newWindow(), 1000);
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.discard), true, false));
        assertNull(map.getGeojsonLayer());
    }
@ Test public void geoJsonLayer ( ) { final String geoJsonFile = "featureCollection.geojson" ; try { JavaResources . copyFileFromResources ( main , geoJsonFile , "geojson/" , "/" ) ; } catch ( IOException e ) { fail ( e . getMessage ( ) ) ; } assertTrue ( TestUtils . clickResource ( device , true , device . getCurrentPackageName ( ) + ":id/layers" , true ) ) ; assertTrue ( TestUtils . clickButton ( device , device . getCurrentPackageName ( ) + ":id/add" , true ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . menu_layers_load_geojson ) , true , false ) ) ; TestUtils . selectFile ( device , main , null , geoJsonFile , true ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . okay ) , true , false ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . Done ) , true , false ) ) ; UiObject2 extentButton = TestUtils . getLayerButton ( device , geoJsonFile , EXTENT_BUTTON ) ; extentButton . click ( ) ; UiObject2 menuButton = TestUtils . getLayerButton ( device , geoJsonFile , MENU_BUTTON ) ; menuButton . clickAndWait ( Until . newWindow ( ) , 1000 ) ; de . blau . android . layer . geojson . MapOverlay layer = map . getGeojsonLayer ( ) ; assertEquals ( "" , layer . getLabel ( "ignored" ) ) ; assertEquals ( Map . SHOW_LABEL_LIMIT , layer . getLabelMinZoom ( "ignored" ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . layer_change_style ) , true , false ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . none ) , false ) ) ; assertTrue ( TestUtils . findText ( device , false , "prop0" , 1000 ) ) ; assertTrue ( TestUtils . clickText ( device , false , "prop0" , false ) ) ; assertTrue ( TestUtils . findText ( device , false , Integer . toString ( Map . SHOW_LABEL_LIMIT ) , 1000 ) ) ; assertTrue ( TestUtils . clickText ( device , false , "-" , false ) ) ; assertTrue ( TestUtils . findText ( device , false , Integer . toString ( Map . SHOW_LABEL_LIMIT - 1 ) , 1000 ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . okay ) , true , false ) ) ; TestUtils . sleep ( ) ; assertEquals ( "prop0" , layer . getLabel ( "ignored" ) ) ; assertEquals ( Map . SHOW_LABEL_LIMIT - 1 , layer . getLabelMinZoom ( "ignored" ) ) ; menuButton . clickAndWait ( Until . newWindow ( ) , 1000 ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . menu_information ) , true , false ) ) ; assertTrue ( TestUtils . findText ( device , false , "MultiLineString" ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . done ) , true , false ) ) ; TestUtils . sleep ( ) ; menuButton . clickAndWait ( Until . newWindow ( ) , 1000 ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . discard ) , true , false ) ) ; assertNull ( map . getGeojsonLayer ( ) ) ; }
Load geojson file and check if we can zoom to extent, style, discard
Load geojson file and check if we can zoom to extent style discard