source: branches/uq/gui/test/gauge.test @ 5167

Last change on this file since 5167 was 5167, checked in by dkearney, 9 years ago

adding beginning of testing scripts for rappture gui widgets

File size: 2.1 KB
Line 
1# Commands covered:
2# Rappture::Gauge
3# Rappture::Gauge::value
4#
5# This file contains a collection of tests for one of the Rappture Tcl
6# commands.  Sourcing this file into Tcl runs the tests and
7# generates output for errors.  No output means no errors were found.
8#
9# ======================================================================
10# AUTHOR:  Derrick Kearney, Purdue University
11# Copyright (c) 2004-2012  HUBzero Foundation, LLC
12#
13# See the file "license.terms" for information on usage and redistribution
14# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
16
17if {[lsearch [namespace children] ::tcltest] == -1} {
18    package require tcltest
19    package require RapptureGUI
20    namespace import -force ::tcltest::*
21}
22
23
24#----------------------------------------------------------
25#----------------------------------------------------------
26# value command
27#
28# value
29# value <newval>
30# value -check <newval>
31#----------------------------------------------------------
32test gauge.value.1 {value command, 0 args, default value is 0} \
33-setup {
34    set w [Rappture::Gauge .#auto]
35} -body  {
36    $w value
37} -cleanup {
38    destroy $w
39    catch {unset w}
40} -result {0}
41
42test gauge.value.2 {value command, 0 args, set value is returned} \
43-setup {
44    set w [Rappture::Gauge .#auto]
45    $w value 4
46} -body  {
47    $w value
48} -cleanup {
49    destroy $w
50    catch {unset w}
51} -result {4}
52
53test gauge.value.3 {value command, 1 args, set value, value is returned} \
54-setup {
55    set w [Rappture::Gauge .#auto]
56} -body  {
57    $w value 4
58} -cleanup {
59    destroy $w
60    catch {unset w}
61} -result {4}
62
63test gauge.value.4 {value command, just -check flag, value is returned} \
64-setup {
65    set w [Rappture::Gauge .#auto]
66} -body  {
67    $w value -check
68} -cleanup {
69    destroy $w
70    catch {unset w}
71} -result {0}
72
73test gauge.value.5 {value command, invalid flag, return error} \
74-setup {
75    set w [Rappture::Gauge .#auto]
76} -body  {
77    list [catch {$w value -chcek} msg] $msg
78} -cleanup {
79    destroy $w
80    catch {unset w}
81} -result {1 {bad value "-chcek": should be a real number}}
82
83::tcltest::cleanupTests
84return
Note: See TracBrowser for help on using the repository browser.