# Commands covered: # Rappture::Gauge # Rappture::Gauge::value # # This file contains a collection of tests for one of the Rappture Tcl # commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # ====================================================================== # AUTHOR: Derrick Kearney, Purdue University # Copyright (c) 2004-2012 HUBzero Foundation, LLC # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest package require RapptureGUI namespace import -force ::tcltest::* } #---------------------------------------------------------- #---------------------------------------------------------- # value command # # value # value # value -check #---------------------------------------------------------- test gauge.value.1 {value command, 0 args, default value is 0} \ -setup { set w [Rappture::Gauge .#auto] } -body { $w value } -cleanup { destroy $w catch {unset w} } -result {0} test gauge.value.2 {value command, 0 args, set value is returned} \ -setup { set w [Rappture::Gauge .#auto] $w value 4 } -body { $w value } -cleanup { destroy $w catch {unset w} } -result {4} test gauge.value.3 {value command, 1 args, set value, value is returned} \ -setup { set w [Rappture::Gauge .#auto] } -body { $w value 4 } -cleanup { destroy $w catch {unset w} } -result {4} test gauge.value.4 {value command, just -check flag, value is returned} \ -setup { set w [Rappture::Gauge .#auto] } -body { $w value -check } -cleanup { destroy $w catch {unset w} } -result {0} test gauge.value.5 {value command, invalid flag, return error} \ -setup { set w [Rappture::Gauge .#auto] } -body { list [catch {$w value -chcek} msg] $msg } -cleanup { destroy $w catch {unset w} } -result {1 {bad value "-chcek": should be a real number}} ::tcltest::cleanupTests return