/[escript]/trunk/pyvisi_old/test/python/test_gnuplot_lib.py
ViewVC logotype

Contents of /trunk/pyvisi_old/test/python/test_gnuplot_lib.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 786 - (show annotations)
Tue Jul 25 04:58:05 2006 UTC (15 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 3916 byte(s)
switched off pyvisi
1 """
2 Class and functions for testing the Gnuplot 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.gnuplot import * # this should import the gnuplot interface
30
31 from ESyS import *
32 import Finley
33
34 class TestGnuplot(unittest.TestCase):
35 """
36 The main test class
37 """
38
39 # tests of plots
40 def testAddArrowPlot(self):
41 scene = Scene()
42 plot = scene.addArrowPlot()
43 self.assertEqual(plot.__class__.__name__, 'ArrowPlot')
44
45 def testArrowPlotBases(self):
46 bases = "%s" % ArrowPlot.__bases__
47 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
48
49 def testArrowPlotSetData(self):
50 scene = Scene()
51 plot = scene.addArrowPlot()
52 data = Finley.Brick(3,5,7).Nodes().getX() # old esys!!
53 self.assert_(plot.setData(data),msg="Failed to set data in ArrowPlot")
54
55 def testAddContourPlot(self):
56 scene = Scene()
57 plot = scene.addContourPlot()
58 self.assertEqual(plot.__class__.__name__, 'ContourPlot')
59
60 def testContourPlotBases(self):
61 bases = "%s" % ContourPlot.__bases__
62 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
63
64 def testAddLinePlot(self):
65 scene = Scene()
66 plot = scene.addLinePlot()
67 self.assertEqual(plot.__class__.__name__, 'LinePlot')
68
69 def testLinePlotBases(self):
70 bases = "%s" % LinePlot.__bases__
71 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
72
73 # end of tests of plots
74
75 def testAddAxes(self):
76 scene = Scene()
77 axes = scene.addAxes()
78 self.assertEqual(axes.__class__.__name__, 'Axes')
79
80 def testAxesBases(self):
81 bases = "%s" % Axes.__bases__
82 self.assertEqual(bases, '<class \'pyvisi.scene.Plot\'>')
83
84 def testAddText(self):
85 scene = Scene()
86 text = scene.addText()
87 self.assertEqual(text.__class__.__name__, 'Text')
88
89 def testAddCamera(self):
90 scene = Scene()
91 camera = scene.addCamera()
92 self.assertEqual(camera.__class__.__name__, 'Camera')
93
94 def testAddImage(self):
95 scene = Scene()
96 image = scene.addImage()
97 self.assertEqual(image.__class__.__name__, 'Image')
98
99 def testTextFontAttr(self):
100 # make sure the font attribute exists and is text
101 scene = Scene()
102 text = scene.addText()
103 self.assert_(text.font.isalpha(), \
104 msg='Text font attribute is not text')
105
106 def testTextChangeFont(self):
107 # now try and set the font to something, and see if that works
108 scene = Scene()
109 text = scene.addText()
110 text.font = "Helvetica"
111 self.assertEqual('Helvetica', text.font)
112 self.assertNotEqual('Times', text.font)
113
114 def testTextNotAlphaNum(self):
115 # text to see if when we set the font to alphanumeric that it barfs
116 scene = Scene()
117 text = scene.addText()
118 text.font = "Times2"
119 self.assert_(not text.font.isalpha(), \
120 msg='Text font attribute is supposed to be text not alphanum')
121
122 if __name__ == '__main__':
123 unittest.main()
124
125 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26