src/test/java/de/blau/android/filter/TagFilterTest.java
/**
     * Create a barrier node and check which rule it matches against
     */
Create a barrier node and check which rule it matches against
Create a barrier node and check which rule it matches against
@Test
    public void tagFilterNode() {
        try (TagFilterDatabaseHelper helper = new TagFilterDatabaseHelper(context); SQLiteDatabase db = helper.getWritableDatabase()) {
            TreeMap<String, String> tags = new TreeMap<>();
            tags.put(Tags.KEY_BARRIER, Tags.VALUE_KERB);
            Logic logic = App.getLogic();
            logic.performAdd(null, 100.0f, 100.0f);
            Node n1 = logic.getSelectedNode();
            logic.setSelectedNode(null);
            logic.setSelectedWay(null);
            logic.setTags(null, n1, tags);
            insertTagFilterRow(db, TagFilter.DEFAULT_FILTER, true, true, "node", Tags.KEY_BUILDING, null);
            TagFilter f = new TagFilter(context);
            Assert.assertTrue(!f.include(n1, false));
            insertTagFilterRow(db, TagFilter.DEFAULT_FILTER, true, true, "node", "b.*", null);
            f = new TagFilter(context);
            Assert.assertTrue(f.include(n1, false));
            insertTagFilterRow(db, TagFilter.DEFAULT_FILTER, true, true, "node", null, ".*l");
            f = new TagFilter(context);
            Assert.assertTrue(f.include(n1, false));
        } catch (OsmIllegalOperationException e) {
            Assert.fail(e.getMessage());
        }
    }
@ Test public void tagFilterNode ( ) { try ( TagFilterDatabaseHelper helper = new TagFilterDatabaseHelper ( context ) ; SQLiteDatabase db = helper . getWritableDatabase ( ) ) { TreeMap < String , String > tags = new TreeMap < > ( ) ; tags . put ( Tags . KEY_BARRIER , Tags . VALUE_KERB ) ; Logic logic = App . getLogic ( ) ; logic . performAdd ( null , 100.0f , 100.0f ) ; Node n1 = logic . getSelectedNode ( ) ; logic . setSelectedNode ( null ) ; logic . setSelectedWay ( null ) ; logic . setTags ( null , n1 , tags ) ; insertTagFilterRow ( db , TagFilter . DEFAULT_FILTER , true , true , "node" , Tags . KEY_BUILDING , null ) ; TagFilter f = new TagFilter ( context ) ; Assert . assertTrue ( ! f . include ( n1 , false ) ) ; insertTagFilterRow ( db , TagFilter . DEFAULT_FILTER , true , true , "node" , "b.*" , null ) ; f = new TagFilter ( context ) ; Assert . assertTrue ( f . include ( n1 , false ) ) ; insertTagFilterRow ( db , TagFilter . DEFAULT_FILTER , true , true , "node" , null , ".*l" ) ; f = new TagFilter ( context ) ; Assert . assertTrue ( f . include ( n1 , false ) ) ; } catch ( OsmIllegalOperationException e ) { Assert . fail ( e . getMessage ( ) ) ; } }
Create a barrier node and check which rule it matches against
Create a barrier node and check which rule it matches against