Mercurial > fife-parpg
comparison tests/extension_tests/modelview_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 | 81641655bc38 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4a0efb7baf70 |
---|---|
1 #!/usr/bin/env python | |
2 from extension_test_utils import * | |
3 from loaders import * | |
4 import time | |
5 | |
6 class TestModelView(unittest.TestCase): | |
7 | |
8 def setUp(self): | |
9 self.engine = getEngine() | |
10 self.model = self.engine.getModel() | |
11 self.metamodel = self.model.getMetaModel() | |
12 | |
13 loadMapFile("content/maps/new_official_map.xml", self.engine) | |
14 | |
15 self.map = self.model.getMaps("id", "OfficialMap")[0] | |
16 self.elevation = self.map.getElevations("id", "OfficialMapElevation")[0] | |
17 self.layer = self.elevation.getLayers("id", "OfficialMapTileLayer")[0] | |
18 | |
19 imgid = self.layer.getInstances()[0].getObject().get2dGfxVisual().getStaticImageIndexByAngle(0) | |
20 img = self.engine.getImagePool().getImage(imgid) | |
21 self.screen_cell_w = img.getWidth() | |
22 self.screen_cell_h = img.getHeight() | |
23 | |
24 self.camloc = fife.Location(self.layer) | |
25 self.camloc.setLayerCoordinates(fife.ModelCoordinate(5,0)) | |
26 | |
27 def tearDown(self): | |
28 del self.engine | |
29 | |
30 def testModelView(self): | |
31 | |
32 cam = self.engine.getView().addCamera() | |
33 cam.setCellImageDimensions(self.screen_cell_w, self.screen_cell_h) | |
34 cam.setRotation(45) | |
35 cam.setTilt(40) | |
36 cam.setLocation(self.camloc) | |
37 rb = self.engine.getRenderBackend() | |
38 viewport = fife.Rect(0, 0, rb.getScreenWidth(), rb.getScreenHeight()) | |
39 cam.setViewPort(viewport) | |
40 self.engine.getView().resetRenderers() | |
41 self.engine.initializePumping() | |
42 | |
43 for count in range(10): | |
44 self.engine.pump() | |
45 #time.sleep(0.03) | |
46 c = self.camloc.getExactLayerCoordinates() | |
47 c.x += 0.50 | |
48 c = self.camloc.setExactLayerCoordinates(c) | |
49 cam.setLocation(self.camloc) | |
50 | |
51 self.engine.finalizePumping() | |
52 | |
53 # removed from test set now due to switch to new directory structure -> content moved to clients | |
54 # to be considered if this should be taken into use again | |
55 TEST_CLASSES = [] | |
56 | |
57 if __name__ == '__main__': | |
58 unittest.main() |