#
# camera.test --
#
#     This file contains some automated tests to exercise code in
#     c3dcamera.c.
#

package require tcltest 2.2
namespace import -force ::tcltest::*

package require Tk
package require Canvas3d

canvas3d .win

test canvas3d-camera.1.1 {} -body {
  .win create polygon \
       {0.0 0.0 0.0   100.0 0.0 0.0   100.0 100.0 0.0   0.0 100.0 0.0}
   foreach {r x y z} [.win boundingsphere all] {}
   list [expr round($r)] [expr round($x)] [expr round($y)] [expr round($z)]
} -result {71 50 50 0}

test canvas3d-camera.1.2 {} -body {
  .win delete all
  .win create polygon \
       {0.0 0.0 0.0   100.0 0.0 0.0   100.0 100.0 0.0   0.0 100.0 0.0}
  .win create polygon \
       {0.0 0.0 100.0   100.0 0.0 100.0   100.0 100.0 100.0   0.0 100.0 100.0}
   foreach {r x y z} [.win boundingsphere all] {}
   list [expr round($r)] [expr round($x)] [expr round($y)] [expr round($z)]
} -result {87 50 50 50}

test canvas3d-camera.1.3 {} -body {
   .win create light {500.0 500.0 500.0}
   .win create text {10 10} -text helloworld
   foreach {r x y z} [.win boundingsphere all] {}
   list [expr round($r)] [expr round($x)] [expr round($y)] [expr round($z)]
} -result {87 50 50 50}

test canvas3d-camera.1.4 {} -body {
  .win delete all
  .win boundingsphere all
} -result {}

destroy .win

# cleanup
cleanupTests
return
