2 """Very simple test script for the SGI gl library extension module
3 taken mostly from the documentation.
7 from test
.test_support
import verbose
, import_module
9 gl
= import_module('gl')
10 GL
= import_module('GL')
12 glattrs
= ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask',
13 '__doc__', '__name__', 'addtopup', 'altgetmatrix', 'arc', 'arcf',
14 'arcfi', 'arcfs', 'arci', 'arcs', 'attachcursor', 'backbuffer',
15 'backface', 'bbox2', 'bbox2i', 'bbox2s', 'bgnclosedline', 'bgnline',
16 'bgnpoint', 'bgnpolygon', 'bgnsurface', 'bgntmesh', 'bgntrim',
17 'blankscreen', 'blanktime', 'blendfunction', 'blink', 'c3f', 'c3i',
18 'c3s', 'c4f', 'c4i', 'c4s', 'callobj', 'charstr', 'chunksize', 'circ',
19 'circf', 'circfi', 'circfs', 'circi', 'circs', 'clear',
20 'clearhitcode', 'clkoff', 'clkon', 'closeobj', 'cmode', 'cmov',
21 'cmov2', 'cmov2i', 'cmov2s', 'cmovi', 'cmovs', 'color', 'colorf',
22 'compactify', 'concave', 'cpack', 'crv', 'crvn', 'curorigin',
23 'cursoff', 'curson', 'curstype', 'curvebasis', 'curveit',
24 'curveprecision', 'cyclemap', 'czclear', 'defbasis', 'defcursor',
25 'deflinestyle', 'delobj', 'deltag', 'depthcue', 'devport', 'dglclose',
26 'dglopen', 'dither', 'dopup', 'doublebuffer', 'draw', 'draw2',
27 'draw2i', 'draw2s', 'drawi', 'drawmode', 'draws', 'editobj',
28 'endclosedline', 'endfullscrn', 'endline', 'endpick', 'endpoint',
29 'endpolygon', 'endpupmode', 'endselect', 'endsurface', 'endtmesh',
30 'endtrim', 'finish', 'font', 'foreground', 'freepup', 'frontbuffer',
31 'fudge', 'fullscrn', 'gRGBcolor', 'gRGBmask', 'gammaramp', 'gbegin',
32 'gconfig', 'genobj', 'gentag', 'getbackface', 'getbuffer',
33 'getbutton', 'getcmmode', 'getcolor', 'getcpos', 'getcursor',
34 'getdcm', 'getdepth', 'getdescender', 'getdisplaymode', 'getdrawmode',
35 'getfont', 'getgdesc', 'getgpos', 'getheight', 'gethitcode',
36 'getlsbackup', 'getlsrepeat', 'getlstyle', 'getlwidth', 'getmap',
37 'getmatrix', 'getmcolor', 'getmmode', 'getmonitor',
38 'getnurbsproperty', 'getopenobj', 'getorigin', 'getothermonitor',
39 'getpattern', 'getplanes', 'getport', 'getresetls', 'getscrmask',
40 'getshade', 'getsize', 'getsm', 'gettp', 'getvaluator', 'getvideo',
41 'getviewport', 'getwritemask', 'getzbuffer', 'gewrite', 'gflush',
42 'ginit', 'glcompat', 'greset', 'gselect', 'gsync', 'gversion',
43 'iconsize', 'icontitle', 'imakebackground', 'initnames', 'ismex',
44 'isobj', 'isqueued', 'istag', 'keepaspect', 'lRGBrange', 'lampoff',
45 'lampon', 'linesmooth', 'linewidth', 'lmbind', 'lmcolor', 'lmdef',
46 'loadmatrix', 'loadname', 'logicop', 'lookat', 'lrectread',
47 'lrectwrite', 'lsbackup', 'lsetdepth', 'lshaderange', 'lsrepeat',
48 'makeobj', 'maketag', 'mapcolor', 'mapw', 'mapw2', 'maxsize',
49 'minsize', 'mmode', 'move', 'move2', 'move2i', 'move2s', 'movei',
50 'moves', 'multimap', 'multmatrix', 'n3f', 'newpup', 'newtag',
51 'noborder', 'noise', 'noport', 'normal', 'nurbscurve', 'nurbssurface',
52 'nvarray', 'objdelete', 'objinsert', 'objreplace', 'onemap', 'ortho',
53 'ortho2', 'overlay', 'packrect', 'pagecolor', 'pagewritemask',
54 'passthrough', 'patch', 'patchbasis', 'patchcurves', 'patchprecision',
55 'pclos', 'pdr', 'pdr2', 'pdr2i', 'pdr2s', 'pdri', 'pdrs',
56 'perspective', 'pick', 'picksize', 'pixmode', 'pmv', 'pmv2', 'pmv2i',
57 'pmv2s', 'pmvi', 'pmvs', 'pnt', 'pnt2', 'pnt2i', 'pnt2s', 'pnti',
58 'pnts', 'pntsmooth', 'polarview', 'polf', 'polf2', 'polf2i', 'polf2s',
59 'polfi', 'polfs', 'poly', 'poly2', 'poly2i', 'poly2s', 'polyi',
60 'polys', 'popattributes', 'popmatrix', 'popname', 'popviewport',
61 'prefposition', 'prefsize', 'pupmode', 'pushattributes', 'pushmatrix',
62 'pushname', 'pushviewport', 'pwlcurve', 'qdevice', 'qenter', 'qgetfd',
63 'qread', 'qreset', 'qtest', 'rcrv', 'rcrvn', 'rdr', 'rdr2', 'rdr2i',
64 'rdr2s', 'rdri', 'rdrs', 'readdisplay', 'readsource', 'rect',
65 'rectcopy', 'rectf', 'rectfi', 'rectfs', 'recti', 'rects', 'rectzoom',
66 'resetls', 'reshapeviewport', 'ringbell', 'rmv', 'rmv2', 'rmv2i',
67 'rmv2s', 'rmvi', 'rmvs', 'rot', 'rotate', 'rpatch', 'rpdr', 'rpdr2',
68 'rpdr2i', 'rpdr2s', 'rpdri', 'rpdrs', 'rpmv', 'rpmv2', 'rpmv2i',
69 'rpmv2s', 'rpmvi', 'rpmvs', 'sbox', 'sboxf', 'sboxfi', 'sboxfs',
70 'sboxi', 'sboxs', 'scale', 'screenspace', 'scrmask', 'setbell',
71 'setcursor', 'setdepth', 'setlinestyle', 'setmap', 'setmonitor',
72 'setnurbsproperty', 'setpattern', 'setpup', 'setshade', 'setvaluator',
73 'setvideo', 'shademodel', 'shaderange', 'singlebuffer', 'smoothline',
74 'spclos', 'splf', 'splf2', 'splf2i', 'splf2s', 'splfi', 'splfs',
75 'stepunit', 'strwidth', 'subpixel', 'swapbuffers', 'swapinterval',
76 'swaptmesh', 'swinopen', 'textcolor', 'textinit', 'textport',
77 'textwritemask', 'tie', 'tpoff', 'tpon', 'translate', 'underlay',
78 'unpackrect', 'unqdevice', 'v2d', 'v2f', 'v2i', 'v2s', 'v3d', 'v3f',
79 'v3i', 'v3s', 'v4d', 'v4f', 'v4i', 'v4s', 'varray', 'videocmd',
80 'viewport', 'vnarray', 'winattach', 'winclose', 'winconstraints',
81 'windepth', 'window', 'winget', 'winmove', 'winopen', 'winpop',
82 'winposition', 'winpush', 'winset', 'wintitle', 'wmpack', 'writemask',
83 'writepixels', 'xfpt', 'xfpt2', 'xfpt2i', 'xfpt2s', 'xfpt4', 'xfpt4i',
84 'xfpt4s', 'xfpti', 'xfpts', 'zbuffer', 'zclear', 'zdraw', 'zfunction',
85 'zsource', 'zwritemask']
88 # insure that we at least have an X display before continuing.
91 display
= os
.environ
['DISPLAY']
93 raise unittest
.SkipTest
, "No $DISPLAY -- skipping gl test"
95 # touch all the attributes of gl without doing anything
97 print 'Touching gl module attributes...'
100 print 'touching: ', attr
103 # create a small 'Crisscross' window
105 print 'Creating a small "CrissCross" window...'
110 gl
.prefposition(500, 900, 500, 900)
112 print 'winopen "CrissCross"'
113 w
= gl
.winopen('CrissCross')
119 gl
.ortho2(0.0, 400.0, 0.0, 400.0)
147 print 'Displaying window for 2 seconds...'
154 if __name__
== '__main__':