| 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 builtins import range |
| 26 |
from .swig_test_utils import * |
| 27 |
|
| 28 |
class TestVideo(unittest.TestCase): |
| 29 |
|
| 30 |
def setUp(self): |
| 31 |
self.engine = getEngine() |
| 32 |
|
| 33 |
def tearDown(self): |
| 34 |
self.engine.destroy() |
| 35 |
|
| 36 |
def testDrawLine(self): |
| 37 |
points = ( |
| 38 |
(1,1), (50,20), (20,50), (200,500), (500,200), (100,200), |
| 39 |
(10,10), (70,40), (80,30), (300,520), (340,220), (170,600), |
| 40 |
) |
| 41 |
self.engine.initializePumping() |
| 42 |
|
| 43 |
renderer = self.engine.getOffRenderer() |
| 44 |
renderer.setEnabled(True) |
| 45 |
|
| 46 |
prevPt = fife.Point(*points[1]) |
| 47 |
for pt in points[1:]: |
| 48 |
curPt = fife.Point(*pt) |
| 49 |
renderer.addLine("lines", prevPt, curPt, 255, 255, 255) |
| 50 |
prevPt = curPt |
| 51 |
|
| 52 |
for i in range(200): |
| 53 |
self.engine.pump() |
| 54 |
|
| 55 |
renderer.removeAll("lines") |
| 56 |
|
| 57 |
self.engine.finalizePumping() |
| 58 |
|
| 59 |
|
| 60 |
TEST_CLASSES = [TestVideo] |
| 61 |
|
| 62 |
if __name__ == '__main__': |
| 63 |
unittest.main() |
| 64 |
|