MCPcopy Create free account
hub / github.com/MapServer/MapServer / testSettingFonts

Method testSettingFonts

mapscript/python/tests/cases/fonttest.py:44–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42class FontTestCase(unittest.TestCase):
43
44 def testSettingFonts(self):
45 mo = mapscript.mapObj()
46 assert mo.fontset.numfonts == 0
47 mo.fontset.fonts.set('Vera', os.path.join(TESTS_PATH, 'vera',
48 'Vera.ttf'))
49 # NB: this does *not* increment the fonset.numfonts -- new bug
50
51 mo.setSize(300, 300)
52 mo.setExtent(-1.0, -1.0, 1.0, 1.0)
53
54 lo = mapscript.layerObj()
55 lo.type = mapscript.MS_LAYER_POINT
56 lo.connectiontype = mapscript.MS_INLINE
57 lo.status = mapscript.MS_DEFAULT
58
59 co = mapscript.classObj()
60 co.label.type = mapscript.MS_TRUETYPE
61 co.label.font = 'Vera'
62 co.label.size = 10
63 co.label.color.setHex('#000000')
64
65 so = mapscript.styleObj()
66 so.symbol = 0
67 so.color.setHex('#000000')
68
69 co.insertStyle(so)
70 lo.insertClass(co)
71 li = mo.insertLayer(lo)
72 lo = mo.getLayer(li)
73
74 point = mapscript.pointObj(0,0)
75 line = mapscript.lineObj()
76 line.add(point)
77 shape = mapscript.shapeObj(lo.type)
78 shape.add(line)
79 shape.setBounds()
80 shape.text = 'Foo'
81 shape.classindex = 0
82
83 lo.addFeature(shape)
84 im = mo.draw()
85
86 #im = mo.prepareImage()
87 #shape.draw(mo, lo, im)
88 im.save('testSettingFonts.png')
89
90
91

Callers

nothing calls this directly

Calls 4

drawMethod · 0.80
saveMethod · 0.80
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected