Browse files

apply patch from @lightmare fixing image_filter getter - closes #1534

  • Loading branch information...
1 parent 38d9163 commit 72124a9f8ae4018a1c150b17d751d0ef6682ba33 @springmeyer springmeyer committed Oct 15, 2012
Showing with 18 additions and 1 deletion.
  1. +3 −1 bindings/python/mapnik_style.cpp
  2. +15 −0 tests/python_tests/image_filters_test.py
View
4 bindings/python/mapnik_style.cpp
@@ -49,14 +49,16 @@ void set_image_filters(feature_type_style & style, std::string const& filters)
std::string::const_iterator end = filters.end();
mapnik::image_filter_grammar<std::string::const_iterator,
std::vector<mapnik::filter::filter_type> > filter_grammar;
+ std::vector<mapnik::filter::filter_type> new_filters;
bool result = boost::spirit::qi::phrase_parse(itr,end,
filter_grammar,
boost::spirit::qi::ascii::space,
- style.image_filters());
+ new_filters);
if (!result || itr!=end)
{
throw mapnik::value_error("failed to parse image-filters: '" + std::string(itr,end) + "'");
}
+ style.image_filters().swap(new_filters);
}
void export_style()
View
15 tests/python_tests/image_filters_test.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+from nose.tools import *
+import os, mapnik
+
+def test_append():
+ s = mapnik.Style()
+ eq_(s.image_filters,'')
+ s.image_filters = 'gray'
+ eq_(s.image_filters,'gray')
+ s.image_filters = 'sharpen'
+ eq_(s.image_filters,'sharpen')
+
+if __name__ == "__main__":
+ [eval(run)() for run in dir() if 'test_' in run]

0 comments on commit 72124a9

Please sign in to comment.