/[escript]/trunk/pyvisi/test/python/run_ellipsoid.py
ViewVC logotype

Annotation of /trunk/pyvisi/test/python/run_ellipsoid.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1070 - (hide annotations)
Thu Mar 29 04:20:50 2007 UTC (14 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1713 byte(s)
Added tests for the camera, carpet, contouir, ellipsoid, light, streamline and velocity modules.
1 jongui 1070 from esys.pyvisi import DataCollector, Scene, Ellipsoid
2     from esys.pyvisi.constant import *
3     import unittest, os
4     from stat import ST_SIZE
5    
6     PYVISI_TEST_MESHES_PATH = "data_meshes/"
7     PYVISI_TEST_ELLIPSOID_IMAGES_PATH = "data_sample_images/ellipsoid/"
8     MIN_IMAGE_SIZE = 100
9     FILE_3D = "interior_3D.xml"
10    
11     X_SIZE = 400
12     Y_SIZE = 400
13    
14     JPG_RENDERER = Renderer.OFFLINE_JPG
15    
16     class TestEllipsoid(unittest.TestCase):
17     def setUp(self):
18     self.scene = \
19     Scene(renderer = JPG_RENDERER, num_viewport = 1,
20     x_size = X_SIZE, y_size = Y_SIZE)
21    
22     self.data_collector = DataCollector(source = Source.XML)
23     self.data_collector.setFileName(file_name = \
24     PYVISI_TEST_MESHES_PATH + FILE_3D)
25    
26     self.ellipsoid = Ellipsoid(scene = self.scene,
27     data_collector = self.data_collector,
28     viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR,
29     cell_to_point = False, outline = True)
30    
31     def tearDown(self):
32     self.scene
33     self.data_collector
34     self.ellipsoid
35    
36     def render(self, file):
37     self.scene.render(image_name = \
38     PYVISI_TEST_ELLIPSOID_IMAGES_PATH + file)
39    
40     self.failUnless(os.stat(PYVISI_TEST_ELLIPSOID_IMAGES_PATH + \
41     file)[ST_SIZE] > MIN_IMAGE_SIZE)
42    
43    
44     def testSphere(self):
45     self.ellipsoid.setThetaResolution(5)
46     self.ellipsoid.setPhiResolution(10)
47     self.render("TestEllpsoid_testSphere.jpg")
48    
49     def testTensorGlyph(self):
50     self.ellipsoid.setScaleFactor(0.2)
51     self.ellipsoid.setMaxScaleFactor(3)
52     self.render("TestEllpsoid_testTensorGlyph.jpg")
53    
54    
55     ##############################################################################
56    
57    
58     if __name__ == '__main__':
59     suite = unittest.TestSuite()
60     suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestEllipsoid))
61     unittest.TextTestRunner(verbosity=2).run(suite)
62    

  ViewVC Help
Powered by ViewVC 1.1.26