1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
# This file is a Tcl script to test out all of the "usual" options
# for all of the [incr Widgets]. It looks for other tests in this
# directory, and tries to create a mega-widget with each of these
# as a component. If there are any problems with "usual" definitions,
# they will be found here.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: usual.test,v 1.3 2001/08/07 19:56:48 smithc Exp $
package require tcltest
namespace import -force ::tcltest::*
if [catch {package require Iwidgets 4.0}] {
# Let's try modifying the auto_path. Note that the IWIDGETS_LIBRARY
# env var is initialized in the Makefile when doing a 'make test'.
# If sourcing this file independently, this variable must be set manually.
if ![info exists env(IWIDGETS_LIBRARY)] {
error "Unable to locate Iwidgets package. Set your IWIDGETS_LIBRARY\
environment\nvariable to the directory that contains iwidgets.tcl"
}
lappend auto_path $env(IWIDGETS_LIBRARY)
package require Iwidgets 4.0
}
if {[string compare test [info procs test]] == 1} {
source defs
}
wm geometry . {}
raise .
# ----------------------------------------------------------------------
# Create a new mega-widget class that we can use to add other
# classes as components.
# ----------------------------------------------------------------------
test usual-1.1 {create a mega-widget that we can add components to} {
itcl::class TestUsual {
inherit itk::Widget
method do {cmd} {
eval $cmd
}
}
TestUsual .testUsual
} {.testUsual}
# ----------------------------------------------------------------------
# Now, scan through all of the tests in this directory and look
# for mega-widgets. Add each mega-widget to the test class.
# ----------------------------------------------------------------------
set unique 0
foreach file [glob *.test] {
set widget [file rootname [file tail $file]]
if {$widget == "extbutton"} {
if {$::tk_version < 8.4} {
# Skip it.
continue
}
}
if {$widget != "usual"} {
set name "c[incr unique]"
test usual-1.2.$name "verify \"usual\" options for $widget" {
.testUsual do [format {
itk_component add %s {
iwidgets::%s $itk_interior.%s
}
} $name $widget $name]
} $name
}
}
::tcltest::cleanupTests
exit
|