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

Diff of /trunk/pyvisi/test/python/run_image.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1147 by ksteube, Wed May 16 06:39:11 2007 UTC revision 1148 by jongui, Wed May 16 22:45:33 2007 UTC
# Line 4  from esys.pyvisi.constant import * Line 4  from esys.pyvisi.constant import *
4  import unittest, os  import unittest, os
5  from stat import ST_SIZE  from stat import ST_SIZE
6    
7  PYVISI_TEST_MESHES_PATH = os.path.join(PYVISI_TEST_DATA_ROOT,"data_meshes")  try:
8  PYVISI_TEST_IMAGE_IMAGES_PATH = "data_sample_images/image/"      PYVISI_WORKDIR=os.environ['PYVISI_WORKDIR']
9    except KeyError:
10        PYVISI_WORKDIR='.'
11    try:
12        PYVISI_TEST_DATA_ROOT=os.environ['PYVISI_TEST_DATA_ROOT']
13    except KeyError:
14        PYVISI_TEST_DATA_ROOT='.'
15    
16    PYVISI_TEST_MESHES_PATH = os.path.join(PYVISI_TEST_DATA_ROOT, "data_meshes")
17    PYVISI_TEST_IMAGE_REFERENCE_IMAGES_PATH = os.path.join(PYVISI_TEST_DATA_ROOT, \
18            "data_reference_images", "image")
19    PYVISI_TEST_IMAGE_IMAGES_PATH = os.path.join(PYVISI_WORKDIR, \
20            "data_sample_images", "image")
21    
22  MIN_IMAGE_SIZE = 100  MIN_IMAGE_SIZE = 100
23  FILE_3D = "interior_3D.xml"  FILE_3D = "interior_3D.xml"
24  IMAGE = "flinders.jpg"  IMAGE = "flinders.jpg"
   
25  X_SIZE = 400  X_SIZE = 400
26  Y_SIZE = 400  Y_SIZE = 400
   
27  JPG_RENDERER = Renderer.OFFLINE_JPG  JPG_RENDERER = Renderer.OFFLINE_JPG
28    
29  class TestImage:  class TestImage:
# Line 25  class TestImage: Line 36  class TestImage:
36    
37      def render(self, file):      def render(self, file):
38          self.scene.render(image_name = \          self.scene.render(image_name = \
39                  PYVISI_TEST_IMAGE_IMAGES_PATH + file)                  os.path.join(PYVISI_TEST_IMAGE_IMAGES_PATH, file))
40    
41          self.failUnless(os.stat(PYVISI_TEST_IMAGE_IMAGES_PATH + \          self.failUnless(os.stat(os.path.join(PYVISI_TEST_IMAGE_IMAGES_PATH, \
42                  file)[ST_SIZE] > MIN_IMAGE_SIZE)                  file))[ST_SIZE] > MIN_IMAGE_SIZE)
43    
44  class TestImageOnAMap(unittest.TestCase, TestImage):  class TestImageOnAMap(unittest.TestCase, TestImage):
45      def setUp(self):      def setUp(self):
# Line 38  class TestImageOnAMap(unittest.TestCase, Line 49  class TestImageOnAMap(unittest.TestCase,
49            
50          self.data_collector = DataCollector(source = Source.XML)          self.data_collector = DataCollector(source = Source.XML)
51          self.data_collector.setFileName(file_name = \          self.data_collector.setFileName(file_name = \
52                  PYVISI_TEST_MESHES_PATH + FILE_3D)                  os.path.join(PYVISI_TEST_MESHES_PATH, FILE_3D))
53                    
54          self.map = Map(scene = self.scene,          self.map = Map(scene = self.scene,
55                  data_collector = self.data_collector,                  data_collector = self.data_collector,
# Line 46  class TestImageOnAMap(unittest.TestCase, Line 57  class TestImageOnAMap(unittest.TestCase,
57                  cell_to_point = False, outline = True)                  cell_to_point = False, outline = True)
58    
59          self.image_reader = ImageReader(ImageFormat.JPG)          self.image_reader = ImageReader(ImageFormat.JPG)
60          self.image_reader.setImageName(PYVISI_TEST_MESHES_PATH + IMAGE)          self.image_reader.setImageName(os.path.join(PYVISI_TEST_MESHES_PATH,\
61                    IMAGE))
62    
63          self.image = Image(scene = self.scene, image_reader = self.image_reader)          self.image = Image(scene = self.scene, image_reader = self.image_reader)
64    

Legend:
Removed from v.1147  
changed lines
  Added in v.1148

  ViewVC Help
Powered by ViewVC 1.1.26