src/test/java/de/blau/android/filter/TagFilterTest.java
/**
     * Test against a way tagged as building that is member of a Relation that the way will be included with way nodes
     * if the relation matches
     */
Test against a way tagged as building that is member of a Relation that the way will be included with way nodes
if the relation matches
Test against a way tagged as building that is member of a Relation that the way will be included with way nodes if the relation matches
@Test
    public void tagFilterWayInRelationWithNodes() {
        try (TagFilterDatabaseHelper helper = new TagFilterDatabaseHelper(context); SQLiteDatabase db = helper.getWritableDatabase()) {
            TreeMap<String, String> tags = new TreeMap<>();
            tags.put(Tags.KEY_BUILDING, "yes");
            Logic logic = App.getLogic();
            logic.performAdd(null, 100.0f, 100.0f);
            Node n1 = logic.getSelectedNode();
            logic.performAdd(null, 1000.0f, 1000.0f);
            Node n2 = logic.getSelectedNode();
            Way w = logic.getSelectedWay();
            logic.setSelectedNode(null);
            logic.setSelectedWay(null);
            ArrayList<OsmElement> members = new ArrayList<OsmElement>();
            members.add(w);
            Relation r = logic.createRelation(null, "", members);
            logic.setTags(null, r, tags);
            insertTagFilterRow(db, TagFilter.DEFAULT_FILTER, true, true, "relation+", Tags.KEY_BUILDING, null);
            TagFilter f = new TagFilter(context);
            Assert.assertTrue(f.include(w, false));
            Assert.assertTrue(f.include(n1, false));
            Assert.assertTrue(f.include(n2, false));
        } catch (OsmIllegalOperationException e) {
            Assert.fail(e.getMessage());
        }
    }
@ Test public void tagFilterWayInRelationWithNodes ( ) { try ( TagFilterDatabaseHelper helper = new TagFilterDatabaseHelper ( context ) ; SQLiteDatabase db = helper . getWritableDatabase ( ) ) { TreeMap < String , String > tags = new TreeMap < > ( ) ; tags . put ( Tags . KEY_BUILDING , "yes" ) ; Logic logic = App . getLogic ( ) ; logic . performAdd ( null , 100.0f , 100.0f ) ; Node n1 = logic . getSelectedNode ( ) ; logic . performAdd ( null , 1000.0f , 1000.0f ) ; Node n2 = logic . getSelectedNode ( ) ; Way w = logic . getSelectedWay ( ) ; logic . setSelectedNode ( null ) ; logic . setSelectedWay ( null ) ; ArrayList < OsmElement > members = new ArrayList < OsmElement > ( ) ; members . add ( w ) ; Relation r = logic . createRelation ( null , "" , members ) ; logic . setTags ( null , r , tags ) ; insertTagFilterRow ( db , TagFilter . DEFAULT_FILTER , true , true , "relation+" , Tags . KEY_BUILDING , null ) ; TagFilter f = new TagFilter ( context ) ; Assert . assertTrue ( f . include ( w , false ) ) ; Assert . assertTrue ( f . include ( n1 , false ) ) ; Assert . assertTrue ( f . include ( n2 , false ) ) ; } catch ( OsmIllegalOperationException e ) { Assert . fail ( e . getMessage ( ) ) ; } }
Test against a way tagged as building that is member of a Relation that the way will be included with way nodes
 if the relation matches
Test against a way tagged as building that is member of a Relation that the way will be included with way nodes if the relation matches