src/androidTest/java/de/blau/android/propertyeditor/PropertyEditorTest.java
/**
     * Select a relation and check for a specific member
     */
Select a relation and check for a specific member
Select a relation and check for a specific member
@Test
    public void relation() {
        final CountDownLatch signal = new CountDownLatch(1);
        mockServer.enqueue("capabilities1");
        mockServer.enqueue("download1");
        Logic logic = App.getLogic();
        logic.downloadBox(main, new BoundingBox(8.3879800D, 47.3892400D, 8.3844600D, 47.3911300D), false, new SignalHandler(signal));
        try {
            signal.await(30, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            fail(e.getMessage());
        }
        Relation r = (Relation) App.getDelegator().getOsmElement(Relation.NAME, 2807173);
        assertNotNull(r);
        main.performTagEdit(r, null, false, false);
        Activity propertyEditor = instrumentation.waitForMonitorWithTimeout(monitor, 30000);
        assertTrue(propertyEditor instanceof PropertyEditor);
        TestUtils.clickText(device, true, main.getString(R.string.tag_details), false, false);
        TestUtils.clickText(device, true, main.getString(R.string.members), false, false);
        UiObject text = device.findObject(new UiSelector().textStartsWith("Vorbühl"));
        assertTrue(text.exists());
        assertTrue(TestUtils.clickResource(device, false, device.getCurrentPackageName() + ":id/header_member_selected", false));
        assertTrue(TestUtils.findText(device, false, main.getString(R.string.tag_action_members_title), 20000));
        assertTrue(TestUtils.clickMenuButton(device, main.getString(R.string.delete), false, false));
        assertTrue(TestUtils.textGone(device, "Vorbühl", 10000));
        TestUtils.clickHome(device, false);
        assertTrue(TestUtils.findText(device, false, main.getString(R.string.empty_relation_title), 5000));
        assertTrue(r.getMembers().isEmpty());
        assertTrue(TestUtils.clickText(device, false, main.getString(R.string.delete), true));
        assertEquals(OsmElement.STATE_DELETED, r.getState());
    }
@ Test public void relation ( ) { final CountDownLatch signal = new CountDownLatch ( 1 ) ; mockServer . enqueue ( "capabilities1" ) ; mockServer . enqueue ( "download1" ) ; Logic logic = App . getLogic ( ) ; logic . downloadBox ( main , new BoundingBox ( 8.3879800D , 47.3892400D , 8.3844600D , 47.3911300D ) , false , new SignalHandler ( signal ) ) ; try { signal . await ( 30 , TimeUnit . SECONDS ) ; } catch ( InterruptedException e ) { fail ( e . getMessage ( ) ) ; } Relation r = ( Relation ) App . getDelegator ( ) . getOsmElement ( Relation . NAME , 2807173 ) ; assertNotNull ( r ) ; main . performTagEdit ( r , null , false , false ) ; Activity propertyEditor = instrumentation . waitForMonitorWithTimeout ( monitor , 30000 ) ; assertTrue ( propertyEditor instanceof PropertyEditor ) ; TestUtils . clickText ( device , true , main . getString ( R . string . tag_details ) , false , false ) ; TestUtils . clickText ( device , true , main . getString ( R . string . members ) , false , false ) ; UiObject text = device . findObject ( new UiSelector ( ) . textStartsWith ( "Vorbühl") ) ; assertTrue ( text . exists ( ) ) ; assertTrue ( TestUtils . clickResource ( device , false , device . getCurrentPackageName ( ) + ":id/header_member_selected" , false ) ) ; assertTrue ( TestUtils . findText ( device , false , main . getString ( R . string . tag_action_members_title ) , 20000 ) ) ; assertTrue ( TestUtils . clickMenuButton ( device , main . getString ( R . string . delete ) , false , false ) ) ; assertTrue ( TestUtils . textGone ( device , "Vorbühl", 0000) ) ; TestUtils . clickHome ( device , false ) ; assertTrue ( TestUtils . findText ( device , false , main . getString ( R . string . empty_relation_title ) , 5000 ) ) ; assertTrue ( r . getMembers ( ) . isEmpty ( ) ) ; assertTrue ( TestUtils . clickText ( device , false , main . getString ( R . string . delete ) , true ) ) ; assertEquals ( OsmElement . STATE_DELETED , r . getState ( ) ) ; }
Select a relation and check for a specific member
Select a relation and check for a specific member
// select all members // delete all members // exit property editor // empty relation dialog