def testConstructorFilename(self): """imageObj with a filename works""" imgobj = mapscript.imageObj(test_image) assert imgobj.thisown == 1 assert imgobj.height == 200 assert imgobj.width == 200 imgobj.save('testConstructorFilename.png')
def setUp(self): MapTestCase.setUp(self) f = open(HOME_IMAGE, 'rb') s = StringIO.StringIO(f.read()) f.close() symb_img = mapscript.imageObj(s) self.h_symbol = mapscript.symbolObj('house') self.h_symbol.type = mapscript.MS_SYMBOL_PIXMAP self.h_symbol.setImage(symb_img) f = open(XMARKS_IMAGE, 'rb') s = StringIO.StringIO(f.read()) f.close() symb_img = mapscript.imageObj(s) self.x_symbol = mapscript.symbolObj('xmarks') self.x_symbol.type = mapscript.MS_SYMBOL_PIXMAP self.x_symbol.setImage(symb_img)
def testConstructorUrlStream(self): """imageObj with a URL stream works""" url = urllib.urlopen('http://mapserver.gis.umn.edu/logo.jpg') imgobj = mapscript.imageObj(url, 'GD/JPEG') assert imgobj.thisown == 1 assert imgobj.height == 68 assert imgobj.width == 439 imgobj.save('testConstructorUrlStream.jpg')
def testConstructorStream(self): """imageObj with a file stream works""" f = open(test_image, 'rb') imgobj = mapscript.imageObj(f) f.close() assert imgobj.thisown == 1 assert imgobj.height == 200 assert imgobj.width == 200
def xtestConstructorUrlStream(self): """imageObj with a URL stream works""" url = urllib.urlopen('http://mapserver.org/_static/banner.png') imgobj = mapscript.imageObj(url, 'AGG/JPEG') assert imgobj.thisown == 1 assert imgobj.height == 68 assert imgobj.width == 439 imgobj.save('testConstructorUrlStream.jpg')
def testConstructorWithFormat(self): """imageObj with an optional driver works""" driver = 'GD/PNG' format = mapscript.outputFormatObj(driver) imgobj = mapscript.imageObj(10, 10, format) assert imgobj.thisown == 1 assert imgobj.format.driver == driver assert imgobj.height == 10 assert imgobj.width == 10
def testConstructorStringIO(self): """imageObj with a cStringIO works""" f = open(test_image, 'rb') data = f.read() f.close() s = cStringIO.StringIO(data) imgobj = mapscript.imageObj(s) assert imgobj.thisown == 1 assert imgobj.height == 200 assert imgobj.width == 200
def testConstructor(self): """imageObj constructor works""" imgobj = mapscript.imageObj(10, 10) assert imgobj.thisown == 1 assert imgobj.height == 10 assert imgobj.width == 10