URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [scrolledframe.test] - Rev 1780
Go to most recent revision | Compare with Previous | Blame | View Log
# This file is a Tcl script to test out [incr Widgets] Scrolledframe class.
# It is organized in the standard fashion for Tcl tests with the following
# notation for test case labels:
#
# 1.x - Construction/Destruction tests
# 2.x - Configuration option tests
# 3.x - Method tests
#
# Copyright (c) 1995 DSC Technologies Corporation
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# @(#) $Id: scrolledframe.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
package require Iwidgets 3.0
if {[string compare test [info procs test]] == 1} {
source defs
}
wm geometry . {}
raise .
set c 1
set o 1
set m 1
#
# Initial construction test
#
test Scrolledframe-1.$c {Scrolledframe construction} {
iwidgets::Scrolledframe .sf
pack .sf -padx 10 -pady 10 -fill both -expand yes
update
} {}
incr c
#
# Option tests which are successful.
#
test Scrolledframe-2.$o {configuration option} {
llength [.sf configure]
} {27}
incr o
foreach test {
{-borderwidth 3 3}
{-height 180 180}
{-labeltext "Scrolled Frame" "Scrolled Frame"}
{-labelpos nw nw}
{-labelpos ne ne}
{-labelpos en en}
{-labelpos e e}
{-labelpos es es}
{-labelpos se se}
{-labelpos s s}
{-labelpos sw sw}
{-labelpos wn wn}
{-labelpos w w}
{-labelpos ws ws}
{-labelpos n n}
{-hscrollmode static static}
{-hscrollmode none none}
{-hscrollmode dynamic dynamic}
{-relief raised raised}
{-sbwidth 20 20}
{-relief sunken sunken}
{-scrollmargin 10 10}
{-vscrollmode static static}
{-vscrollmode none none}
{-vscrollmode dynamic dynamic}
{-width 150 150}} {
set option [lindex $test 0]
test Scrolledframe-2.$o "configuration options, $option" {
.sf configure $option [lindex $test 1]
lindex [.sf configure $option] 4
} [lindex $test 2]
update
incr o
}
#
# Option tests which fail and produce errors.
#
foreach test {
{-vscrollmode bogus {bad vscrollmode option "bogus": should be static, dynamic, or none}}
{-hscrollmode bogus {bad hscrollmode option "bogus": should be static, dynamic, or none}}} {
set option [lindex $test 0]
test Scrolledframe-2.$o "configuration options, $option" {
list [catch {.sf configure $option [lindex $test 1]} msg] $msg
} [list 1 [lindex $test 2]]
incr o
}
#
# Method tests which are successful.
#
foreach test {
{{.sf childsite} {.sf.lwchildsite.clipper.canvas.sfchildsite}}
{{.sf xview moveto .5} {}}
{{.sf yview moveto .5} {}}
{{.sf justify left} {}}
{{.sf justify right} {}}
{{.sf justify top} {}}
{{.sf justify bottom} {}}} {
set method [lindex [lindex $test 0] 1]
test Scrolledframe-3.$m "object methods, $method" {
list [catch {eval [lindex $test 0]} msg] $msg
} [list 0 [lindex $test 1]]
update
incr m
}
#
# Creation of children tests.
#
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b1 -text Hello] -pady 10
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b2 -text World] -pady 10
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b3 -text "This is a test"] -pady 10
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b4 -text "This is a really big button"] -pady 10
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b5 -text "This is another really big button"] -pady 10
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe children} {
pack [button [.sf childsite].b6 -text "This is the last really big button"] -pady 10
update
} {}
incr c
#
# Conclusion of constrcution/destruction tests
#
test Scrolledframe-1.$c {Scrolledframe destruction} {
foreach child [winfo children [.sf childsite]] {
destroy $child
}
destroy .sf
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe construction} {
iwidgets::scrolledframe .sf -width 150 -height 180 \
-labelpos nw -labeltext Scrolledframe \
-vscrollmode static -hscrollmode dynamic
pack .sf -padx 10 -pady 10 -fill both -expand yes
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe destruction} {
destroy .sf
update
} {}
incr c
test Scrolledframe-1.$c {Scrolledframe destruction} {
iwidgets::scrolledframe .sf
pack .sf
destroy .sf
update
} {}
Go to most recent revision | Compare with Previous | Blame | View Log