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

Contents of /trunk/pyvisi/test/python/test_text.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 601 - (show annotations)
Fri Mar 17 06:18:25 2006 UTC (13 years, 7 months ago) by gross
File MIME type: text/x-python
File size: 2237 byte(s)
directories are moved around to match escript convention
1 # Copyright (C) 2004 Paul Cochrane
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # $Id: test_text.py,v 1.2 2004/11/24 06:24:06 paultcochrane Exp $
18
19 ## @file test_text.py
20
21 import unittest
22 import sys,os,string
23 here = os.getcwd() + '/../../'
24 sys.path.append(here)
25 from pyvisi import * # this should import all of the pyvisi stuff needed
26
27 from ESyS import *
28 import Finley
29
30 """
31 Class and functions for testing the Text class
32 """
33
34 class TestText(unittest.TestCase):
35 """
36 The main test class
37 """
38
39 def testAddText(self):
40 scene = Scene()
41 text = scene.addText()
42 self.assertEqual(text.__class__.__name__, 'Text')
43
44 def testTextFontAttr(self):
45 # make sure the font attribute exists and is text
46 scene = Scene()
47 text = scene.addText()
48 self.assert_(text.font.isalpha(), \
49 msg='Text font attribute is not text')
50
51 def testTextChangeFont(self):
52 # now try and set the font to something, and see if that works
53 scene = Scene()
54 text = scene.addText()
55 text.font = "Helvetica"
56 self.assertEqual('Helvetica', text.font)
57 self.assertNotEqual('Times', text.font)
58
59 def testTextNotAlphaNum(self):
60 # text to see if when we set the font to alphanumeric that it barfs
61 scene = Scene()
62 text = scene.addText()
63 text.font = "Times2"
64 self.assert_(not text.font.isalpha(), \
65 msg='Text font attribute is supposed to be text not alphanum')
66
67 if __name__ == '__main__':
68 unittest.main()
69
70 # vim: expandtab shiftwidth=4:

  ViewVC Help
Powered by ViewVC 1.1.26