/[escript]/trunk-mpi-branch/pyvisi_old/test/python/test_vtk_lib.py
ViewVC logotype

Contents of /trunk-mpi-branch/pyvisi_old/test/python/test_vtk_lib.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 968 - (show annotations)
Tue Feb 13 22:56:57 2007 UTC (14 years, 8 months ago) by ksteube
File MIME type: text/x-python
File size: 3897 byte(s)
Branch for MPI solution of implicit problems
1 """
2 Class and functions for testing the vtk interface
3
4 @var __author__: name of author
5 @var __license__: licence agreement
6 @var __copyright__: copyrights
7 @var __url__: url entry point on documentation
8 @var __version__: version
9 @var __date__: date of the version
10 """
11
12 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
13 http://www.access.edu.au
14 Primary Business: Queensland, Australia"""
15 __license__="""Licensed under the Open Software License version 3.0
16 http://www.opensource.org/licenses/osl-3.0.php"""
17 __author__="Paul Cochrane"
18 __url__="http://www.iservo.edu.au/esys"
19 __version__="$Revision$"
20 __date__="$Date$"
21
22
23 import unittest
24 import sys,os,string
25 here = os.getcwd() + '/../../'
26 sys.path.append(here)
27 from pyvisi import * # this should import the general stuff from pyvisi
28 # shouldn't that line be from pyvisi import *??
29 from pyvisi.lib.vtk import * # this should import the vtk interface
30
31 from ESyS import *
32 import Finley
33
34
35 class TestVTK(unittest.TestCase):
36 """
37 The main test class
38 """
39
40 # tests of plots
41 def testAddArrowPlot(self):
42 scene = Scene()
43 plot = scene.addArrowPlot()
44 self.assertEqual(plot.__class__.__name__, 'ArrowPlot')
45
46 def testArrowPlotBases(self):
47 bases = "%s" % ArrowPlot.__bases__
48 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
49
50 def testArrowPlotSetData(self):
51 scene = Scene()
52 plot = scene.addArrowPlot()
53 data = Finley.Brick(3,5,7).Nodes().getX() # old esys!!
54 self.assert_(plot.setData(data),msg="Failed to set data in ArrowPlot")
55
56 def testAddContourPlot(self):
57 scene = Scene()
58 plot = scene.addContourPlot()
59 self.assertEqual(plot.__class__.__name__, 'ContourPlot')
60
61 def testContourPlotBases(self):
62 bases = "%s" % ContourPlot.__bases__
63 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
64
65 def testAddLinePlot(self):
66 scene = Scene()
67 plot = scene.addLinePlot()
68 self.assertEqual(plot.__class__.__name__, 'LinePlot')
69
70 def testLinePlotBases(self):
71 bases = "%s" % LinePlot.__bases__
72 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
73
74 # end of tests of plots
75
76 def testAddAxes(self):
77 scene = Scene()
78 axes = scene.addAxes()
79 self.assertEqual(axes.__class__.__name__, 'Axes')
80
81 def testAxesBases(self):
82 bases = "%s" % Axes.__bases__
83 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
84
85 def testAddText(self):
86 scene = Scene()
87 text = scene.addText()
88 self.assertEqual(text.__class__.__name__, 'Text')
89
90 def testAddCamera(self):
91 scene = Scene()
92 camera = scene.addCamera()
93 self.assertEqual(camera.__class__.__name__, 'Camera')
94
95 def testAddImage(self):
96 scene = Scene()
97 image = scene.addImage()
98 self.assertEqual(image.__class__.__name__, 'Image')
99
100 def testTextFontAttr(self):
101 # make sure the font attribute exists and is text
102 scene = Scene()
103 text = scene.addText()
104 self.assert_(text.font.isalpha(), \
105 msg='Text font attribute is not text')
106
107 def testTextChangeFont(self):
108 # now try and set the font to something, and see if that works
109 scene = Scene()
110 text = scene.addText()
111 text.font = "Helvetica"
112 self.assertEqual('Helvetica', text.font)
113 self.assertNotEqual('Times', text.font)
114
115 def testTextNotAlphaNum(self):
116 # text to see if when we set the font to alphanumeric that it barfs
117 scene = Scene()
118 text = scene.addText()
119 text.font = "Times2"
120 self.assert_(not text.font.isalpha(), \
121 msg='Text font attribute is supposed to be text not alphanum')
122
123 if __name__ == '__main__':
124 unittest.main()
125
126 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26