Debian Codegraph @

tests/extension_tests/extension_test_utils.py

raw
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 import os, sys, unittest
26
27 def genpath(somepath):
28 return os.path.sep.join(somepath.split('/'))
29
30 _paths = ('engine/swigwrappers/python', 'engine/extensions')
31 for p in _paths:
32 if p not in sys.path:
33 sys.path.append(os.path.sep.join(p.split('/')))
34
35 from fife import fife
36 from fife.extensions import fifelog
37
38 def getEngine(minimized=False):
39 e = fife.Engine()
40 log = fifelog.LogManager(e, promptlog=False, filelog=True)
41 log.setVisibleModules('all')
42 s = e.getSettings()
43 s.setDefaultFontPath('tests/data/FreeMono.ttf')
44 s.setDefaultFontGlyphs(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +
45 ".,!?-+/:();%`'*#=[]")
46 if minimized:
47 s.setScreenWidth(1)
48 s.setScreenHeight(1)
49 s.setDefaultFontSize(12)
50 e.init()
51 return e
52
53 __all__ = []
54 __all__.append('unittest')
55 __all__.append('fife')
56 __all__.append('fifelog')
57 __all__.append('genpath')
58 __all__.append('getEngine')