Mercurial > fife-parpg
comparison tests/swig_tests/gui_tests.py @ 0:4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 29 Jun 2008 18:44:17 +0000 |
parents | |
children | d2f1e81fbe2c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4a0efb7baf70 |
---|---|
1 #!/usr/bin/env python | |
2 from swig_test_utils import * | |
3 | |
4 class TestGui(unittest.TestCase): | |
5 | |
6 def setUp(self): | |
7 self.engine = getEngine() | |
8 self.guimanager = self.engine.getGuiManager() | |
9 self.renderbackend = self.engine.getRenderBackend() | |
10 | |
11 def tearDown(self): | |
12 del self.engine | |
13 | |
14 def testFonts(self): | |
15 ttffont = fife.TTFont('tests/data/FreeMono.ttf', 14) | |
16 ttffont.thisown = 0 | |
17 subimagefont = fife.SubImageFont('tests/data/rpgfont.png', | |
18 ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/:();%`\'*#=[]"', | |
19 self.engine.getImagePool()) | |
20 subimagefont.thisown = 0 | |
21 fonts = [fife.GuiFont(ttffont), fife.GuiFont(subimagefont)] | |
22 for f in fonts: | |
23 f.setColor(255,20,20) | |
24 container = fife.Container() | |
25 self.guimanager.add(container) | |
26 container.setSize(self.renderbackend.getWidth(), | |
27 self.renderbackend.getHeight()) | |
28 container.setOpaque(False) | |
29 label1 = fife.Label('This is a Truetype font') | |
30 label1.setPosition(0, 70) | |
31 label1.setFont(fonts[0]) | |
32 container.add(label1) | |
33 label2 = fife.Label('This is a Image font') | |
34 label2.setPosition(0, 100) | |
35 label2.setFont(fonts[1]) | |
36 container.add(label2) | |
37 labels = [label1, label2] | |
38 | |
39 self.engine.initializePumping() | |
40 for i in xrange(100): | |
41 self.engine.pump() | |
42 self.engine.finalizePumping() | |
43 | |
44 | |
45 TEST_CLASSES = [TestGui] | |
46 | |
47 if __name__ == '__main__': | |
48 unittest.main() | |
49 |