| 1 |
#!/usr/bin/env python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# #################################################################### |
| 5 |
# Copyright (C) 2005-2019 by the FIFE team |
| 6 |
# http://www.fifengine.net |
| 7 |
# This file is part of FIFE. |
| 8 |
# |
| 9 |
# FIFE is free software; you can redistribute it and/or |
| 10 |
# modify it under the terms of the GNU Lesser General Public |
| 11 |
# License as published by the Free Software Foundation; either |
| 12 |
# version 2.1 of the License, or (at your option) any later version. |
| 13 |
# |
| 14 |
# This library is distributed in the hope that it will be useful, |
| 15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
# Lesser General Public License for more details. |
| 18 |
# |
| 19 |
# You should have received a copy of the GNU Lesser General Public |
| 20 |
# License along with this library; if not, write to the |
| 21 |
# Free Software Foundation, Inc., |
| 22 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 |
# #################################################################### |
| 24 |
|
| 25 |
from .swig_test_utils import * |
| 26 |
|
| 27 |
class TestGui(unittest.TestCase): |
| 28 |
|
| 29 |
def setUp(self): |
| 30 |
self.engine = getEngine() |
| 31 |
self.guimanager = self.engine.getGuiManager() |
| 32 |
self.renderbackend = self.engine.getRenderBackend() |
| 33 |
|
| 34 |
def tearDown(self): |
| 35 |
self.engine.destroy() |
| 36 |
|
| 37 |
def testFonts(self): |
| 38 |
# only skip it |
| 39 |
return |
| 40 |
ttffont = fife.TTFont('tests/data/FreeMono.ttf', 14) |
| 41 |
ttffont.thisown = 0 |
| 42 |
subimagefont = fife.SubImageFont('tests/data/rpgfont.png', |
| 43 |
' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/:();%`\'*#=[]"') |
| 44 |
subimagefont.thisown = 0 |
| 45 |
fonts = [fife.GuiFont(ttffont), fife.GuiFont(subimagefont)] |
| 46 |
for f in fonts: |
| 47 |
f.setColor(255,20,20) |
| 48 |
container = fife.Container() |
| 49 |
self.guimanager.add(container) |
| 50 |
container.setSize(self.renderbackend.getWidth(), |
| 51 |
self.renderbackend.getHeight()) |
| 52 |
container.setOpaque(False) |
| 53 |
label1 = fife.Label('This is a Truetype font') |
| 54 |
label1.setPosition(0, 70) |
| 55 |
label1.setFont(fonts[0]) |
| 56 |
container.add(label1) |
| 57 |
label2 = fife.Label('This is an Image font') |
| 58 |
label2.setPosition(0, 100) |
| 59 |
label2.setFont(fonts[1]) |
| 60 |
container.add(label2) |
| 61 |
labels = [label1, label2] |
| 62 |
|
| 63 |
self.engine.initializePumping() |
| 64 |
for i in range(100): |
| 65 |
self.engine.pump() |
| 66 |
self.engine.finalizePumping() |
| 67 |
|
| 68 |
|
| 69 |
TEST_CLASSES = [TestGui] |
| 70 |
|
| 71 |
if __name__ == '__main__': |
| 72 |
unittest.main() |
| 73 |
|