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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1070 - (hide annotations)
Thu Mar 29 04:20:50 2007 UTC (13 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1512 byte(s)
Added tests for the camera, carpet, contouir, ellipsoid, light, streamline and velocity modules.
1 jongui 1070 from esys.pyvisi import DataCollector, Scene, Contour
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_CONTOUR_IMAGES_PATH = "data_sample_images/contour/"
8     MIN_IMAGE_SIZE = 100
9     FILE_2D = "interior_2D.xml"
10    
11     X_SIZE = 400
12     Y_SIZE = 400
13    
14     JPG_RENDERER = Renderer.OFFLINE_JPG
15    
16     class TestContour(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_2D)
25    
26     self.contour = Contour(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.contour
35    
36     def render(self, file):
37     self.scene.render(image_name = \
38     PYVISI_TEST_CONTOUR_IMAGES_PATH + file)
39    
40     self.failUnless(os.stat(PYVISI_TEST_CONTOUR_IMAGES_PATH + \
41     file)[ST_SIZE] > MIN_IMAGE_SIZE)
42    
43     def testGenerateContours(self):
44     self.contour.generateContours(5)
45     self.render("TestContour_testGenerateContours.jpg")
46    
47    
48     ##############################################################################
49    
50    
51     if __name__ == '__main__':
52     suite = unittest.TestSuite()
53     suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestContour))
54     unittest.TextTestRunner(verbosity=2).run(suite)
55    

  ViewVC Help
Powered by ViewVC 1.1.26