src/androidTest/java/de/blau/android/propertyeditor/PropertyEditorTest.java
/**
     * Change tags on an existing node
     */
Change tags on an existing node
Change tags on an existing node
@Test
    public void existingNode() {
        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());
        }
        Node n = (Node) App.getDelegator().getOsmElement(Node.NAME, 101792984);
        assertNotNull(n);
        main.performTagEdit(n, null, false, false);
        Activity propertyEditor = instrumentation.waitForMonitorWithTimeout(monitor, 30000);
        assertTrue(propertyEditor instanceof PropertyEditor);
        TestUtils.clickText(device, true, main.getString(R.string.menu_tags), false, false);
        final String original = "Bergdietikon";
        final String edited = "dietikonBerg";
        device.wait(Until.findObject(By.clickable(true).textStartsWith(original)), 500);
        UiObject editText = device.findObject(new UiSelector().clickable(true).textStartsWith(original));
        try {
            editText.click(); 
            editText.setText(edited);
        } catch (UiObjectNotFoundException e) {
            fail(e.getMessage());
        }
        TestUtils.clickHome(device, true);
        assertEquals(edited, n.getTagWithKey(Tags.KEY_NAME));
    }
@ Test public void existingNode ( ) { 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 ( ) ) ; } Node n = ( Node ) App . getDelegator ( ) . getOsmElement ( Node . NAME , 101792984 ) ; assertNotNull ( n ) ; main . performTagEdit ( n , null , false , false ) ; Activity propertyEditor = instrumentation . waitForMonitorWithTimeout ( monitor , 30000 ) ; assertTrue ( propertyEditor instanceof PropertyEditor ) ; TestUtils . clickText ( device , true , main . getString ( R . string . menu_tags ) , false , false ) ; final String original = "Bergdietikon" ; final String edited = "dietikonBerg" ; device . wait ( Until . findObject ( By . clickable ( true ) . textStartsWith ( original ) ) , 500 ) ; UiObject editText = device . findObject ( new UiSelector ( ) . clickable ( true ) . textStartsWith ( original ) ) ; try { editText . click ( ) ; editText . setText ( edited ) ; } catch ( UiObjectNotFoundException e ) { fail ( e . getMessage ( ) ) ; } TestUtils . clickHome ( device , true ) ; assertEquals ( edited , n . getTagWithKey ( Tags . KEY_NAME ) ) ; }
Change tags on an existing node
Change tags on an existing node
// NOTE this seems to be necessary