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

  1. #==============================================================================
  2. #                                camera.test
  3. #------------------------------------------------------------------------------
  4. # Test of the Tcl SIPP camera 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: camera.test,v 2.0 1992/11/02 03:55:52 markd Rel $
  14. #==============================================================================
  15.  
  16.  
  17. if {[info procs test] == ""} {source testprocs.tcl}
  18.  
  19. #
  20. # Test SippCameraCreate command
  21. #
  22. test {camera-1.1} {
  23.     SippCameraCreate {} {} {} 0 10
  24. } 1 {wrong # args: SippCameraCreate [position] [point] [upvector] [focal]}
  25.  
  26. test {camera-1.2} {
  27.     SippCameraCreate {1 2 3} {1 2 3} 0
  28. } 1 {vertex or vector must be a list of three elements}
  29.  
  30. test {camera-1.3} {
  31.     SippCameraCreate {x y z} {1 2 3} {4 5 7}
  32. } 1 {expected floating-point number but got "x"}
  33.  
  34. test {camera-1.4} {
  35.     SippCameraCreate {1 2 3} {1 2 3} {4 x 7}
  36. } 1 {expected floating-point number but got "x"}
  37.  
  38. test {camera-1.5} {
  39.     SippCameraCreate {1 2 3} {1 2 3} {4 x 7}
  40. } 1 {expected floating-point number but got "x"}
  41.  
  42. test {camera-1.6} {
  43.     SippCameraCreate {1 2 3} {1 2 3} {4 1 7} aaa
  44. } 1 {expected floating-point number but got "aaa"}
  45.  
  46. test {camera-1.7} {
  47.     SippCameraCreate {1 2 3} {1 2 3} {4 1 7}
  48. } 1 {The position and point may not be the same}
  49.  
  50. test {camera-1.8} {
  51.     SippCameraCreate {1 0 0} {0 0 0} {21 0 0}
  52. } 1 {The view vector (position to point) and up vector may not be parallel}
  53.  
  54. test {camera-1.9} {
  55.     set camera1 [SippCameraCreate {1 2 3} {0 0 0} {4 1 7}]
  56.     crange $camera1 0 5
  57. } 0 {camera}
  58.  
  59. test {camera-1.10} {
  60.     set camera2 [SippCameraCreate {1 2 3} {0 0 0} {4 1 7} 10]
  61.     crange $camera2 0 5
  62. } 0 {camera}
  63.  
  64. test {camera-1.11} {
  65.     set camera3 [SippCameraCreate {} {1 2 3} {4 1 7} 10]
  66.     crange $camera3 0 5
  67. } 0 {camera}
  68.  
  69. #
  70. # Test SippCameraParams command.
  71. #
  72. test {camera-2.1} {
  73.     SippCameraParams
  74. } 1 {wrong # args: SippCameraParams camera [position] [point] [upvector] [focal]}
  75.  
  76. test {camera-2.2} {
  77.     SippCameraParams $camera1 {} {} {} 0 10
  78. } 1 {wrong # args: SippCameraParams camera [position] [point] [upvector] [focal]}
  79.  
  80. test {camera-2.3} {
  81.     SippCameraParams $camera1 {x y z} {1 2 3} {4 5 7}
  82. } 1 {expected floating-point number but got "x"}
  83.  
  84. test {camera-2.4} {
  85.     SippCameraParams $camera1 {1 2 3} {1 2 3} {4 x 7}
  86. } 1 {expected floating-point number but got "x"}
  87.  
  88. test {camera-2.5} {
  89.     SippCameraParams $camera1 {1 2 3} {1 2 3} {4 x 7}
  90. } 1 {expected floating-point number but got "x"}
  91.  
  92. test {camera-2.6} {
  93.     SippCameraParams $camera1 {1 2 3} {1 2 3} {4 1 7} aaa
  94. } 1 {expected floating-point number but got "aaa"}
  95.  
  96. test {camera-2.7} {
  97.     SippCameraParams $camera1 {1 2 3} {1 2 3} {4 1 7}
  98. } 1 {The position and point may not be the same}
  99.  
  100. test {camera-2.8} {
  101.     SippCameraParams $camera1 {1 0 0} {0 0 0} {11 0 0}
  102. } 1 {The view vector (position to point) and up vector may not be parallel}
  103.  
  104. test {camera-2.9} {
  105.     SippCameraParams $camera1 {1 0 0} {0 0 0} {4 1 7}
  106. } 0 {}
  107.  
  108. test {camera-2.10} {
  109.     SippCameraParams $camera1 {1 2 3} {0 0 0} {4 1 7} 10
  110. } 0 {}
  111.  
  112. #
  113. # Test the SippCameraUse command.
  114. #
  115. test {camera-3.1} {
  116.     SippCameraUse
  117. } 1 {wrong # args: SippCameraUse camera}
  118.  
  119. test {camera-3.2} {
  120.     SippCameraUse $camera1 fooo
  121. } 1 {wrong # args: SippCameraUse camera}
  122.  
  123. test {camera-3.3} {
  124.     SippCameraUse $camera1
  125. } 0 {}
  126.  
  127. test {camera-3.4} {
  128.     SippCameraUse STDCAMERA
  129. } 0 {}
  130.  
  131.  
  132. #
  133. # Test the SippCameraDestruct command.
  134. #
  135.  
  136. test {camera-4.1} {
  137.     SippCameraDestruct
  138. } 1 {wrong # args: SippCameraDestruct cameralist}
  139.  
  140. test {camera-4.2} {
  141.     SippCameraDestruct $camera1 $camera2
  142. } 1 {wrong # args: SippCameraDestruct cameralist}
  143.  
  144. test {camera-4.3} {
  145.     SippCameraDestruct [list $camera1 foo]
  146. } 1 {invalid camera handle: foo}
  147.  
  148. test {camera-4.4} {
  149.     list [catch {SippCameraDestruct [list $camera1 $camera1]} msg] \
  150.          [crange $msg 0 31]
  151. } 0 {1 {duplicate handle in list: camera}}
  152.  
  153. test {camera-4.5} {
  154.     SippCameraDestruct $camera1
  155. } 0 {}
  156.  
  157. test {camera-4.6} {
  158.     SippCameraDestruct [list $camera2 $camera3]
  159. } 0 {}
  160.  
  161.