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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1110 - (hide annotations)
Thu Apr 19 05:24:28 2007 UTC (13 years, 5 months ago) by jongui
File MIME type: text/x-python
File size: 1440 byte(s)
Some test for the logo.
1 jongui 1110 from esys.pyvisi import Scene, ImageReader, Logo
2     from esys.pyvisi import LocalPosition
3     from esys.pyvisi.constant import *
4     import unittest, os
5     from stat import ST_SIZE
6    
7     PYVISI_TEST_MESHES_PATH = "data_meshes/"
8     PYVISI_TEST_LOGO_IMAGES_PATH = "data_sample_images/logo/"
9     MIN_IMAGE_SIZE = 100
10     LOGO = "access_logo.jpg"
11    
12     X_SIZE = 400
13     Y_SIZE = 400
14    
15     JPG_RENDERER = Renderer.OFFLINE_JPG
16    
17     class TestLogo:
18     def tearDown(self):
19     self.scene
20     self.image_reader
21     self.logo
22    
23     def render(self, file):
24     self.scene.render(image_name = \
25     PYVISI_TEST_LOGO_IMAGES_PATH + file)
26    
27     self.failUnless(os.stat(PYVISI_TEST_LOGO_IMAGES_PATH + \
28     file)[ST_SIZE] > MIN_IMAGE_SIZE)
29    
30     class TestAccessLogo(unittest.TestCase, TestLogo):
31     def setUp(self):
32     self.scene = \
33     Scene(renderer = JPG_RENDERER, num_viewport = 1,
34     x_size = X_SIZE, y_size = Y_SIZE)
35    
36     self.image_reader = ImageReader(ImageFormat.JPG)
37     self.image_reader.setImageName(PYVISI_TEST_MESHES_PATH + LOGO)
38    
39     self.logo = Logo(scene = self.scene, image_reader = self.image_reader)
40    
41     def testImage(self):
42     self.logo.setPosition(position = LocalPosition(20,50))
43     self.logo.setSize(size = 0.5)
44     self.render("TestLogo.jpg")
45    
46    
47     ###############################################################################
48    
49    
50     if __name__ == '__main__':
51     suite = unittest.TestSuite()
52     suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestAccessLogo))
53     unittest.TextTestRunner(verbosity=2).run(suite)
54    

  ViewVC Help
Powered by ViewVC 1.1.26