Skip to content
Permalink
Browse files

Fix broken symbol tests, remove GD as default renderer

  • Loading branch information...
geographika committed Oct 10, 2018
1 parent ce97bc8 commit f3edb872a7aa5de943b24c0b1cdff87dc98146f8
Showing with 18 additions and 29 deletions.
  1. +8 −7 mapscript/python/tests/cases/symbol_test.py
  2. +10 −22 mapscript/swiginc/symbol.i
@@ -38,17 +38,16 @@ def testConstructor(self):
assert symbol.name == 'test'
assert symbol.thisown == 1

def xtestConstructorImage(self):
def testConstructorImage(self):
"""create new instance of symbolObj from an image"""
symbol = mapscript.symbolObj('xmarks', XMARKS_IMAGE)
assert symbol.name == 'xmarks'
assert symbol.type == mapscript.MS_SYMBOL_VECTOR # was MS_SYMBOL_PIXMAP!
format = mapscript.outputFormatObj('AGG/PNG')
img = symbol.getImage(format)
img.save('sym-%s.%s' % (symbol.name, img.format.extension))



# TODO creating mapscript.imageObj objects throw errors
class DynamicGraphicSymbolTestCase():

def setUp(self):
@@ -110,7 +109,7 @@ def testDrawSetRGBAImage(self):

class MapSymbolTestCase(MapTestCase):

def xtestGetPoints(self):
def testGetPoints(self):
"""get symbol points as line and test coords"""
symbol = self.map.symbolset.getSymbol(1)
assert symbol.name == 'circle'
@@ -133,11 +132,13 @@ def testSetPoints(self):
pt = self.getPointFromLine(line, 1)
self.assertPointsEqual(pt, mapscript.pointObj(3.0, 3.0))

def xtestSetStyle(self):
def testSetStyle(self):
"""expect success after setting an existing symbol's style"""
symbol = self.map.symbolset.getSymbol(1)
# TODO setPattern is no longer a method
assert symbol.setPattern(0, 1) == mapscript.MS_SUCCESS
# default MapScript API setPattern has been extended to allow lists
# assert symbol.setPattern(0, 1) == mapscript.MS_SUCCESS
symbol.pattern = [0, 1]
assert symbol.pattern == [0, 1]

def testRGBASymbolInPNG24(self):
"""draw a RGBA PNG pixmap on PNG canvas"""
@@ -53,26 +53,26 @@

~symbolObj()
{
if (self) {
if (self) {
if (msFreeSymbol(self)==MS_SUCCESS) {
free(self);
self=NULL;
}
free(self);
self=NULL;
}
}
}

int setImagepath(const char *imagefile) {
return msLoadImageSymbol(self, imagefile);
return msLoadImageSymbol(self, imagefile);
}

int setPoints(lineObj *line) {
int i;
self->sizex = 0;
self->sizey = 0;
self->sizex = 0;
self->sizey = 0;
for (i=0; i<line->numpoints; i++) {
MS_COPYPOINT(&(self->points[i]), &(line->point[i]));
self->sizex = MS_MAX(self->sizex, self->points[i].x);
self->sizey = MS_MAX(self->sizey, self->points[i].y);
self->sizex = MS_MAX(self->sizex, self->points[i].x);
self->sizey = MS_MAX(self->sizey, self->points[i].y);
}
self->numpoints = line->numpoints;
return self->numpoints;
@@ -101,23 +101,13 @@
outputFormatObj *format = NULL;
rendererVTableObj *renderer = NULL;

if (self->type != MS_SYMBOL_PIXMAP)
{
msSetError(MS_SYMERR, "Can't return image from non-pixmap symbol",
"getImage()");
return NULL;
}

if (input_format)
{
format = input_format;
}
else
{
format = msCreateDefaultOutputFormat(NULL, "GD/GIF", "gdgif");
if (format == NULL)
format = msCreateDefaultOutputFormat(NULL, "GD/PNG", "gdpng");

format = msCreateDefaultOutputFormat(NULL, "AGG/PNG", "aggpng");
if (format)
msInitializeRendererVTable(format);
}
@@ -173,5 +163,3 @@
}

}


0 comments on commit f3edb87

Please sign in to comment.
You can’t perform that action at this time.