1 |
gross |
637 |
""" |
2 |
|
|
Class and functions for testing the Text class |
3 |
cochrane |
337 |
|
4 |
gross |
637 |
@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 |
cochrane |
337 |
|
12 |
gross |
637 |
__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 |
cochrane |
337 |
|
22 |
gross |
637 |
|
23 |
cochrane |
337 |
import unittest |
24 |
|
|
import sys,os,string |
25 |
|
|
here = os.getcwd() + '/../../' |
26 |
|
|
sys.path.append(here) |
27 |
|
|
from pyvisi import * # this should import all of the pyvisi stuff needed |
28 |
|
|
|
29 |
|
|
from ESyS import * |
30 |
|
|
import Finley |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
class TestText(unittest.TestCase): |
34 |
|
|
""" |
35 |
|
|
The main test class |
36 |
|
|
""" |
37 |
|
|
|
38 |
|
|
def testAddText(self): |
39 |
|
|
scene = Scene() |
40 |
|
|
text = scene.addText() |
41 |
|
|
self.assertEqual(text.__class__.__name__, 'Text') |
42 |
|
|
|
43 |
|
|
def testTextFontAttr(self): |
44 |
|
|
# make sure the font attribute exists and is text |
45 |
|
|
scene = Scene() |
46 |
|
|
text = scene.addText() |
47 |
|
|
self.assert_(text.font.isalpha(), \ |
48 |
|
|
msg='Text font attribute is not text') |
49 |
|
|
|
50 |
|
|
def testTextChangeFont(self): |
51 |
|
|
# now try and set the font to something, and see if that works |
52 |
|
|
scene = Scene() |
53 |
|
|
text = scene.addText() |
54 |
|
|
text.font = "Helvetica" |
55 |
|
|
self.assertEqual('Helvetica', text.font) |
56 |
|
|
self.assertNotEqual('Times', text.font) |
57 |
|
|
|
58 |
|
|
def testTextNotAlphaNum(self): |
59 |
|
|
# text to see if when we set the font to alphanumeric that it barfs |
60 |
|
|
scene = Scene() |
61 |
|
|
text = scene.addText() |
62 |
|
|
text.font = "Times2" |
63 |
|
|
self.assert_(not text.font.isalpha(), \ |
64 |
|
|
msg='Text font attribute is supposed to be text not alphanum') |
65 |
|
|
|
66 |
|
|
if __name__ == '__main__': |
67 |
|
|
unittest.main() |
68 |
|
|
|
69 |
|
|
# vim: expandtab shiftwidth=4: |