From 2e76ff1958de5ead81208559c8666377f0927dda Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 2 Apr 2012 11:57:24 -0700 Subject: [PATCH] make stroke property on line_symbolizer a reference when accessed from python (not a copy) --- bindings/python/mapnik_line_symbolizer.cpp | 2 +- tests/python_tests/object_test.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bindings/python/mapnik_line_symbolizer.cpp b/bindings/python/mapnik_line_symbolizer.cpp index 9c7053b90..7ce8d5dc7 100644 --- a/bindings/python/mapnik_line_symbolizer.cpp +++ b/bindings/python/mapnik_line_symbolizer.cpp @@ -60,7 +60,7 @@ void export_line_symbolizer() "Set/get the rasterization method of the line of the point") .add_property("stroke",make_function (&line_symbolizer::get_stroke, - return_value_policy()), + return_value_policy()), &line_symbolizer::set_stroke) .add_property("smooth", &line_symbolizer::smooth, diff --git a/tests/python_tests/object_test.py b/tests/python_tests/object_test.py index cf0920d55..9bcfc0cad 100644 --- a/tests/python_tests/object_test.py +++ b/tests/python_tests/object_test.py @@ -21,6 +21,15 @@ def test_line_symbolizer_init(): s = mapnik.LineSymbolizer() eq_(s.rasterizer, mapnik.line_rasterizer.FULL) +def test_line_symbolizer_stroke_reference(): + l = mapnik.LineSymbolizer(mapnik.Color('green'),0.1) + l.stroke.add_dash(.1,.1) + l.stroke.add_dash(.1,.1) + eq_(l.stroke.get_dashes(), [(.1,.1),(.1,.1)]) + eq_(l.stroke.color,mapnik.Color('green')) + eq_(l.stroke.opacity,1.0) + assert_almost_equal(l.stroke.width,0.1) + # ShieldSymbolizer initialization def test_shieldsymbolizer_init(): s = mapnik.ShieldSymbolizer(mapnik.Expression('[Field Name]'), 'DejaVu Sans Bold', 6, mapnik.Color('#000000'), mapnik.PathExpression('../data/images/dummy.png'))