def testError(self): symbolset = mapscript.symbolSetObj(SYMBOLSET) symbola = mapscript.symbolObj('testa') symbolb = mapscript.symbolObj('testb') symbolset.appendSymbol(symbola) symbolset.appendSymbol(symbolb) self.assertRaises(mapscript.MapServerError, symbolset.save, '/bogus/new_symbols.txt')
def testSaveNewSymbolSet(self): """save a new SymbolSet to disk""" symbolset = mapscript.symbolSetObj(SYMBOLSET) symbola = mapscript.symbolObj('testa') symbolb = mapscript.symbolObj('testb') symbolset.appendSymbol(symbola) symbolset.appendSymbol(symbolb) assert symbolset.save('new_symbols.txt') == mapscript.MS_SUCCESS
def testAddSymbolToNewSymbolSet(self): """add two new symbols to a SymbolSet""" symbolset = mapscript.symbolSetObj(SYMBOLSET) symbola = mapscript.symbolObj('testa') symbolb = mapscript.symbolObj('testb') symbolset.appendSymbol(symbola) symbolset.appendSymbol(symbolb) num = symbolset.numsymbols assert num == 6, num names = [None, 'circle', 'xmarks-png', 'home-png', 'testa', 'testb'] for i in range(symbolset.numsymbols): symbol = symbolset.getSymbol(i) assert symbol.name == names[i], symbol.name
def testRemoveSymbolFromNewSymbolSet(self): """after removing a symbol, expect numsymbols -= 1""" symbolset = mapscript.symbolSetObj(SYMBOLSET) symbolset.removeSymbol(1) num = symbolset.numsymbols assert num == 3, num
def testConstructorFile(self): """new instance of symbolSetObj from symbols.txt""" symbolset = mapscript.symbolSetObj(SYMBOLSET) num = symbolset.numsymbols assert num == 4, num
def testConstructorNoArgs(self): """new instance of symbolSetObj should have one symbol""" symbolset = mapscript.symbolSetObj() num = symbolset.numsymbols assert num == 1, num