add support for using CDATA with libxml2 parser. New tests for filters work nicely - TODO add datasource tests for CDATA in sql 'table' param
This commit is contained in:
parent
6e48eb3504
commit
b89f468eaf
2 changed files with 81 additions and 1 deletions
|
@ -37,7 +37,7 @@
|
||||||
using boost::property_tree::ptree;
|
using boost::property_tree::ptree;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define DEFAULT_OPTIONS (XML_PARSE_NOERROR | XML_PARSE_NOENT | XML_PARSE_NOBLANKS | XML_PARSE_DTDLOAD)
|
#define DEFAULT_OPTIONS (XML_PARSE_NOERROR | XML_PARSE_NOENT | XML_PARSE_NOBLANKS | XML_PARSE_DTDLOAD | XML_PARSE_NOCDATA)
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
80
tests/python_tests/filter_test.py
Normal file
80
tests/python_tests/filter_test.py
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from nose.tools import *
|
||||||
|
from utilities import Todo
|
||||||
|
|
||||||
|
import mapnik
|
||||||
|
|
||||||
|
map_ = '''<Map>
|
||||||
|
<Style name="s">
|
||||||
|
<Rule>
|
||||||
|
<Filter><![CDATA[(([region]>=0) and ([region]<=50))]]></Filter>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter><![CDATA[([region]>=0) and ([region]<=50)]]></Filter>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>
|
||||||
|
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
([region] >= 0)
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
([region] <= 50)
|
||||||
|
]]>
|
||||||
|
|
||||||
|
</Filter>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>([region]>=0) and ([region]<=50)</Filter>
|
||||||
|
</Rule>
|
||||||
|
<Rule>
|
||||||
|
<Filter>
|
||||||
|
([region] >= 0)
|
||||||
|
and
|
||||||
|
([region] <= 50)
|
||||||
|
</Filter>
|
||||||
|
</Rule>
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
</Map>'''
|
||||||
|
|
||||||
|
def test_filter_init():
|
||||||
|
m = mapnik.Map(1,1)
|
||||||
|
mapnik.load_map_from_string(m,map_)
|
||||||
|
filters = []
|
||||||
|
filters.append(mapnik.Filter("([region]>=0) and ([region]<=50)"))
|
||||||
|
filters.append(mapnik.Filter("(([region]>=0) and ([region]<=50))"))
|
||||||
|
filters.append(mapnik.Filter("((([region]>=0) and ([region]<=50)))"))
|
||||||
|
filters.append(mapnik.Filter('((([region]>=0) and ([region]<=50)))'))
|
||||||
|
filters.append(mapnik.Filter('''((([region]>=0) and ([region]<=50)))'''))
|
||||||
|
filters.append(mapnik.Filter('''
|
||||||
|
((([region]>=0)
|
||||||
|
and
|
||||||
|
([region]<=50)))
|
||||||
|
'''))
|
||||||
|
filters.append(mapnik.Filter('''
|
||||||
|
([region]>=0)
|
||||||
|
and
|
||||||
|
([region]<=50)
|
||||||
|
'''))
|
||||||
|
filters.append(mapnik.Filter('''
|
||||||
|
([region]
|
||||||
|
>=
|
||||||
|
0)
|
||||||
|
and
|
||||||
|
([region]
|
||||||
|
<=
|
||||||
|
50)
|
||||||
|
'''))
|
||||||
|
|
||||||
|
s = m.find_style('s')
|
||||||
|
|
||||||
|
for r in s.rules:
|
||||||
|
filters.append(r.filter)
|
||||||
|
|
||||||
|
first = filters[0]
|
||||||
|
for f in filters:
|
||||||
|
eq_(str(first),str(f))
|
Loading…
Reference in a new issue