home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / tsipp / tsipp.lha / tsipp3.0a / tests / light.test < prev    next >
Encoding:
Text File  |  1992-11-02  |  6.6 KB  |  264 lines

  1. #==============================================================================
  2. #                                 light.test
  3. #------------------------------------------------------------------------------
  4. # Test of the Tcl SIPP light commands.
  5. #------------------------------------------------------------------------------
  6. # Copyright 1992 Mark Diekhans
  7. # Permission to use, copy, modify, and distribute this software and its
  8. # documentation for any purpose and without fee is hereby granted, provided
  9. # that the above copyright notice appear in all copies.  Mark Diekhans makes
  10. # no representations about the suitability of this software for any purpose.
  11. # It is provided "as is" without express or implied warranty.
  12. #------------------------------------------------------------------------------
  13. # $Id: light.test,v 2.0 1992/11/02 03:55:53 markd Rel $
  14. #==============================================================================
  15.  
  16. if {[info procs test] == ""} {source testprocs.tcl}
  17.  
  18. #
  19. # Test SippLightSourceCreate command.
  20. #
  21.  
  22. test {light-1.1} {
  23.     SippLightSourceCreate
  24. } 1 {wrong # args: SippLightSourceCreate {x y z} color type}
  25.  
  26. test {light-1.2} {
  27.     SippLightSourceCreate {1 3 4} {1.0 1 1} POINT BAZ
  28. } 1 {wrong # args: SippLightSourceCreate {x y z} color type}
  29.  
  30. test {light-1.3} {
  31.     SippLightSourceCreate {1 3 4} {1.0 1 xx} POINT
  32. } 1 {expected floating-point number but got "xx"}
  33.  
  34. test {light-1.4} {
  35.     SippLightSourceCreate {1 x 4} {1.0 .4 1} POINT
  36. } 1 {expected floating-point number but got "x"}
  37.  
  38. test {light-1.5} {
  39.     SippLightSourceCreate {1 3 4} {1.0 2 1} POINT
  40. } 1 {Expected a number in the range 0..1, got: 2}
  41.  
  42. test {light-1.6} {
  43.     SippLightSourceCreate {1 3 4} {1.0 2 1} SPUD
  44. } 1 {Expected a number in the range 0..1, got: 2}
  45.  
  46. test {light-1.7} {
  47.     set lightsource1 [SippLightSourceCreate {1 3 4} {1.0 1 1} POINT]
  48.     crange $lightsource1 0 4
  49. } 0 {light}
  50.  
  51. test {light-1.8} {
  52.     set lightsource2 [SippLightSourceCreate {1 3 4} {0 .9 1} DIRECTION]
  53.     crange $lightsource2 0 4
  54. } 0 {light}
  55.  
  56. #
  57. # Test SippSpotLightCreate command.
  58. #
  59.  
  60. test {light-2.1} {
  61.     SippSpotLightCreate
  62. } 1 {wrong # args: SippSpotLightCreate position point opening color type shadow}
  63.  
  64. test {light-2.2} {
  65.     SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 .1} SHARP true 0
  66. } 1 {wrong # args: SippSpotLightCreate position point opening color type shadow}
  67.  
  68. test {light-2.3} {
  69.     SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 xx} SHARP true
  70. } 1 {expected floating-point number but got "xx"}
  71.  
  72. test {light-2.4} {
  73.     SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1 1.11} SHARP true
  74. } 1 {Expected a number in the range 0..1, got: 1.11}
  75.  
  76. test {light-2.5} {
  77.     SippSpotLightCreate {1 3 4} {4 3 2} 20 {1 .5 1} SPAM true
  78. } 1 {expected one of "SHARP" or "SOFT", got "SPAM"}
  79.  
  80. test {light-2.6} {
  81.     SippSpotLightCreate {1 3 4} {4 3 2} 20 {1.0 1} SHARP foo
  82. } 1 {color must be a list of three elements}
  83.  
  84. test {light-2.7} {
  85.     SippSpotLightCreate {1 3 4} {4 3 2} X20 {1.0 1} SHARP foo
  86. } 1 {expected floating-point number but got "X20"}
  87.  
  88. test {light-2.8} {
  89.     set spotlight1 [SippSpotLightCreate  {1 3 4} {4 3 2} D20 {1.0 1 .1} SHARP true]
  90.     crange $spotlight1 0 4
  91. } 0 {light}
  92.  
  93. test {light-2.9} {
  94.     set spotlight2 [SippSpotLightCreate  {1 3 4} {4 3 2} R40 {1.0 1 .1} SOFT false]
  95.     crange $spotlight1 0 4
  96. } 0 {light}
  97.  
  98. #
  99. # Test SippLightSourcePut command.
  100. #
  101.  
  102. test {light-3.1} {
  103.     SippLightSourcePut
  104. } 1 {wrong # args: SippLightSourcePut light {x y z}}
  105.  
  106. test {light-3.2} {
  107.     SippLightSourcePut $lightsource1 {1 2 3} 4
  108. } 1 {wrong # args: SippLightSourcePut light {x y z}}
  109.  
  110. test {light-3.3} {
  111.     SippLightSourcePut $lightsource1 {1 x 3}
  112. } 1 {expected floating-point number but got "x"}
  113.  
  114. test {light-3.4} {
  115.     SippLightSourcePut $spotlight1 {1 1 3}
  116. } 1 {operation not valid on spotlights}
  117.  
  118. test {light-3.5} {
  119.     SippLightSourcePut $lightsource1 {1 1 3}
  120. } 0 {}
  121.  
  122. #
  123. # Test SippSpotLightPos command.
  124. #
  125.  
  126. test {light-4.1} {
  127.     SippSpotLightPos
  128. } 1 {wrong # args: SippSpotLightPos light {x y z}}
  129.  
  130. test {light-4.2} {
  131.     SippSpotLightPos $spotlight1 {1 2 3} 4
  132. } 1 {wrong # args: SippSpotLightPos light {x y z}}
  133.  
  134. test {light-4.3} {
  135.     SippSpotLightPos $spotlight1 {1 x 3}
  136. } 1 {expected floating-point number but got "x"}
  137.  
  138. test {light-4.4} {
  139.     SippSpotLightPos $lightsource1 {1 2 3}
  140. } 1 {operation not valid on lightsources}
  141.  
  142. test {light-4.4} {
  143.     SippSpotLightPos $spotlight1 {1 2 3}
  144. } 0 {}
  145.  
  146. #
  147. # Test SippSpotLightShadows command.
  148. #
  149.  
  150. test {light-5.1} {
  151.     SippSpotLightShadows
  152. } 1 {wrong # args: SippSpotLightShadows light flag}
  153.  
  154. test {light-5.2} {
  155.     SippSpotLightShadows $spotlight1 true 1
  156. } 1 {wrong # args: SippSpotLightShadows light flag}
  157.  
  158. test {light-5.3} {
  159.     SippSpotLightShadows $spotlight1 foo
  160. } 1 {expected boolean value but got "foo"}
  161.  
  162. test {light-5.4} {
  163.     SippSpotLightShadows $lightsource1 true
  164. } 1 {operation not valid on lightsources}
  165.  
  166. test {light-5.6} {
  167.     SippSpotLightShadows $spotlight1 true
  168. } 0 {}
  169.  
  170. test {light-5.7} {
  171.     SippSpotLightShadows $spotlight1 false
  172. } 0 {}
  173.  
  174. #
  175. # Test SippLightColor command.
  176. #
  177.  
  178. test {light-6.1} {
  179.     SippLightColor
  180. } 1 {wrong # args: SippLightColor light color}
  181.  
  182. test {light-6.2} {
  183.     SippLightColor $spotlight1 {0 1 xx}
  184. } 1 {expected floating-point number but got "xx"}
  185.  
  186. test {light-6.3} {
  187.     SippLightColor $lightsource1 {0 2 0}
  188. } 1 {Expected a number in the range 0..1, got: 2}
  189.  
  190. test {light-6.4} {
  191.     SippLightColor $lightsource1 {0 1 .6}
  192. } 0 {}
  193.  
  194. test {light-6.5} {
  195.     SippLightColor $spotlight1 {0 1 .6}
  196. } 0 {}
  197.  
  198. #
  199. # Test SippLightActive command.
  200. #
  201.  
  202. test {light-7.1} {
  203.     SippLightActive
  204. } 1 {wrong # args: SippLightActive light flag}
  205.  
  206. test {light-7.2} {
  207.     SippLightActive $spotlight1 true 1
  208. } 1 {wrong # args: SippLightActive light flag}
  209.  
  210. test {light-7.3} {
  211.     SippLightActive $lightsource1 foo
  212. } 1 {expected boolean value but got "foo"}
  213.  
  214. test {light-7.4} {
  215.     SippLightActive $lightsource1 true
  216. } 0 {}
  217.  
  218. test {light-7.5} {
  219.     SippLightActive $lightsource1 false
  220. } 0 {}
  221.  
  222. test {light-7.6} {
  223.     SippLightActive $spotlight1 true
  224. } 0 {}
  225.  
  226. test {light-7.7} {
  227.     SippLightActive $spotlight1 false
  228. } 0 {}
  229.  
  230.  
  231. #
  232. # Test SippLightDestruct command.
  233. #
  234.  
  235. test {light-8.1} {
  236.     SippLightDestruct
  237. } 1 {wrong # args: SippLightDestruct lightlist}
  238.  
  239. test {light-8.2} {
  240.     SippLightDestruct $lightsource1 $spotlight1
  241. } 1 {wrong # args: SippLightDestruct lightlist}
  242.  
  243. test {light-8.3} {
  244.     SippLightDestruct $lightsource1 foo
  245. } 1 {wrong # args: SippLightDestruct lightlist}
  246.  
  247. test {light-8.4} {
  248.     list [catch {SippLightDestruct [list $lightsource1 $lightsource1]} msg] \
  249.          [crange $msg 0 30]
  250. } 0 {1 {duplicate handle in list: light}}
  251.  
  252. test {light-8.5} {
  253.     SippLightDestruct $lightsource1
  254. } 0 {}
  255.  
  256. test {light-8.6} {
  257.     SippLightDestruct $spotlight1
  258. } 0 {}
  259.  
  260. test {light-8.7} {
  261.     SippLightDestruct [list $spotlight2 $lightsource2]
  262. } 0 {}
  263.  
  264.