home *** CD-ROM | disk | FTP | other *** search
- #==============================================================================
- # poly.test
- #------------------------------------------------------------------------------
- # Test of the Tcl SIPP polygon commands.
- #------------------------------------------------------------------------------
- # Copyright 1992 Mark Diekhans
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Mark Diekhans makes
- # no representations about the suitability of this software for any purpose.
- # It is provided "as is" without express or implied warranty.
- #------------------------------------------------------------------------------
- # $Id: poly.test,v 2.0 1992/11/02 03:55:57 markd Rel $
- #==============================================================================
-
- if {[info procs test] == ""} {source testprocs.tcl}
-
- proc MakePolys {testid} {
- test $testid {
- SippVertexPush {{0 0 0}}
- set vertexList {{ 0 0 0} {-1 0 0} {-1 -1 0} {-1 -1 0}}
- SippPolygonPush
-
- set vertexList {{ 0 0 0} {-1 0 0} {-1 -1 0} {-1 -1 0}}
- SippPolygonPush $vertexList
- } 0 {}
- }
-
- #
- # Test setup.
- #
-
- test {polygon-1.1} {
- set shader1 [SippShaderBasic .6 .1 .4 {.8 .5 .2}]
- crange $shader1 0 5
- } 0 {shader}
-
- #
- # Test SippVertexPush command.
- #
-
- test {polygon-2.1} {
- SippVertexPush
- } 1 {wrong # args: SippVertexPush [-tex] vertexList}
-
- test {polygon-2.2} {
- SippVertexPush {a b}
- } 1 {vertex or vector must be a list of three elements}
-
- test {polygon-2.3} {
- SippVertexPush {{1 2}}
- } 1 {vertex or vector must be a list of three elements}
-
- test {polygon-2.4} {
- SippVertexPush {{1 2 3} {1 2}}
- } 1 {vertex or vector must be a list of three elements}
-
- #
- # Test SippPolygonPush command.
- #
-
- test {polygon-3.1} {
- SippPolygonPush {2 3} {1 2 2}
- } 1 {expected option of `-tex', got `2 3'}
-
- test {polygon-3.2} {
- SippPolygonPush {{1 2 3} {1 2 a}}
- } 1 {expected floating-point number but got "a"}
-
- test {polygon-3.3} {
- SippPolygonPush -tex {{1 2 3} {1 2 a}}
- } 1 {vertex-texture list must be a list of two coordinates}
-
- #
- # Test SippSurfaceCreate command.
- #
-
- test {polygon-4.1} {
- set surface [SippSurfaceCreate foo]
- } 1 {invalid shader handle: foo}
-
- test {polygon-4.2} {
- set surface1 [SippSurfaceCreate $shader1]
- } 1 {the polygon stack is empty}
-
- test {polygon-4.3} {
- MakePolys polygon-4.3
- set surface1 [SippSurfaceCreate $shader1]
- SippSurfaceDelete $surface1
- crange $surface1 0 6
- } 0 {surface}
-
- #
- # Test SippSurfaceDelete command.
- #
-
- test {polygon-5.1} {
- SippSurfaceDelete foo
- } 1 {invalid surface handle: foo}
-
- test {polygon-5.2} {
- MakePolys polygon-5.2
- set surface1 [SippSurfaceCreate $shader1]
- SippSurfaceDelete $surface1
- } 0 {}
-
- test {polygon-5.3} {
- SippSurfaceDelete $surface1
- } 1 {surface is not open}
-
- #
- # Test SippSurfaceSetShader command.
- #
-
- test {polygon-6.1} {
- SippSurfaceSetShader foo baz
- } 1 {invalid surface handle: foo}
-
- test {polygon-6.2} {
- MakePolys polygon-6.2
- set surface1 [SippSurfaceCreate $shader1]
- SippSurfaceSetShader $surface1 baz
- } 1 {invalid shader handle: baz}
-
- test {polygon-6.3} {
- SippSurfaceSetShader $surface1 $shader1
- } 0 {}
-
- #
- # Cleanup.
- #
-
- test {polygon-7.1} {
- SippSurfaceDelete $surface1
- SippShaderDelete $shader1
- } 0 {}
-
-