# This file is a Tcl script to test out [incr Widgets] Fileselectionbox class.
|
# This file is a Tcl script to test out [incr Widgets] Fileselectionbox class.
|
# It is organized in the standard fashion for Tcl tests with the following
|
# It is organized in the standard fashion for Tcl tests with the following
|
# notation for test case labels:
|
# notation for test case labels:
|
#
|
#
|
# 1.x - Construction/Destruction tests
|
# 1.x - Construction/Destruction tests
|
# 2.x - Configuration option tests
|
# 2.x - Configuration option tests
|
# 3.x - Method tests
|
# 3.x - Method tests
|
#
|
#
|
# Copyright (c) 1995 DSC Technologies Corporation
|
# Copyright (c) 1995 DSC Technologies Corporation
|
#
|
#
|
# See the file "license.terms" for information on usage and redistribution
|
# See the file "license.terms" for information on usage and redistribution
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
#
|
#
|
# @(#) $Id: fileselectionbox.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
|
# @(#) $Id: fileselectionbox.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
|
|
|
package require Iwidgets 3.0
|
package require Iwidgets 3.0
|
|
|
if {[string compare test [info procs test]] == 1} {
|
if {[string compare test [info procs test]] == 1} {
|
source defs
|
source defs
|
}
|
}
|
|
|
wm geometry . {}
|
wm geometry . {}
|
raise .
|
raise .
|
|
|
set c 1
|
set c 1
|
set o 1
|
set o 1
|
set m 1
|
set m 1
|
|
|
#
|
#
|
# Initial construction test
|
# Initial construction test
|
#
|
#
|
test Fileselectionbox-1.$c {Fileselectionbox construction} {
|
test Fileselectionbox-1.$c {Fileselectionbox construction} {
|
iwidgets::Fileselectionbox .fsb
|
iwidgets::Fileselectionbox .fsb
|
pack .fsb -padx 10 -pady 10 -fill both -expand yes
|
pack .fsb -padx 10 -pady 10 -fill both -expand yes
|
update
|
update
|
} {}
|
} {}
|
|
|
incr c
|
incr c
|
|
|
#
|
#
|
# Option tests which are successful.
|
# Option tests which are successful.
|
#
|
#
|
test Fileselectionbox-2.$o {configuration option} {
|
test Fileselectionbox-2.$o {configuration option} {
|
llength [.fsb configure]
|
llength [.fsb configure]
|
} {45}
|
} {45}
|
|
|
incr o
|
incr o
|
|
|
foreach test {
|
foreach test {
|
{-activebackground #ececec #ececec}
|
{-activebackground #ececec #ececec}
|
{-activerelief raised raised}
|
{-activerelief raised raised}
|
{-background #d9d9d9 #d9d9d9}
|
{-background #d9d9d9 #d9d9d9}
|
{-borderwidth 2 2}
|
{-borderwidth 2 2}
|
{-textbackground GhostWhite GhostWhite}
|
{-textbackground GhostWhite GhostWhite}
|
{-childsitepos n n}
|
{-childsitepos n n}
|
{-childsitepos s s}
|
{-childsitepos s s}
|
{-childsitepos e e}
|
{-childsitepos e e}
|
{-childsitepos w w}
|
{-childsitepos w w}
|
{-childsitepos top top}
|
{-childsitepos top top}
|
{-childsitepos bottom bottom}
|
{-childsitepos bottom bottom}
|
{-childsitepos center center}
|
{-childsitepos center center}
|
{-cursor gumby gumby}
|
{-cursor gumby gumby}
|
{-directory {..} {..}}
|
{-directory {..} {..}}
|
{-foreground Black Black}
|
{-foreground Black Black}
|
{-highlightcolor black black}
|
{-highlightcolor black black}
|
{-highlightthickness 2 2}
|
{-highlightthickness 2 2}
|
{-insertbackground Black Black}
|
{-insertbackground Black Black}
|
{-insertborderwidth 1 1}
|
{-insertborderwidth 1 1}
|
{-insertofftime 300 300}
|
{-insertofftime 300 300}
|
{-insertontime 600 600}
|
{-insertontime 600 600}
|
{-insertwidth 3 3}
|
{-insertwidth 3 3}
|
{-dirslabel "Dirs Label" "Dirs Label"}
|
{-dirslabel "Dirs Label" "Dirs Label"}
|
{-dirson no no}
|
{-dirson no no}
|
{-dirson yes yes}
|
{-dirson yes yes}
|
{-fileslabel "Files Label" "Files Label"}
|
{-fileslabel "Files Label" "Files Label"}
|
{-fileson no no}
|
{-fileson no no}
|
{-fileson yes yes}
|
{-fileson yes yes}
|
{-filetype any any}
|
{-filetype any any}
|
{-filetype directory directory}
|
{-filetype directory directory}
|
{-filetype regular regular}
|
{-filetype regular regular}
|
{-filterlabel "Filter Label" "Filter Label"}
|
{-filterlabel "Filter Label" "Filter Label"}
|
{-filteron no no}
|
{-filteron no no}
|
{-filteron yes yes}
|
{-filteron yes yes}
|
{-directory ../tests ../tests}
|
{-directory ../tests ../tests}
|
{-mask *.* *.*}
|
{-mask *.* *.*}
|
{-nomatchstring {No Files} {No Files}}
|
{-nomatchstring {No Files} {No Files}}
|
{-labelfont -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
|
{-labelfont -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*}
|
{-selectbackground #e6ceb1 #e6ceb1}
|
{-selectbackground #e6ceb1 #e6ceb1}
|
{-selectborderwidth 1 1}
|
{-selectborderwidth 1 1}
|
{-selectionlabel "Selection Label" "Selection Label"}
|
{-selectionlabel "Selection Label" "Selection Label"}
|
{-selectionon no no}
|
{-selectionon no no}
|
{-selectionon yes yes}
|
{-selectionon yes yes}
|
{-textfont -*-courier-medium-r-normal--*-120-* -*-courier-medium-r-normal--*-120-*}
|
{-textfont -*-courier-medium-r-normal--*-120-* -*-courier-medium-r-normal--*-120-*}
|
{-troughcolor #c3c3c3 #c3c3c3}
|
{-troughcolor #c3c3c3 #c3c3c3}
|
{-width 400 400}
|
{-width 400 400}
|
{-height 375 375}} {
|
{-height 375 375}} {
|
set option [lindex $test 0]
|
set option [lindex $test 0]
|
test Fileselectionbox-2.$o "configuration options, $option" {
|
test Fileselectionbox-2.$o "configuration options, $option" {
|
.fsb configure $option [lindex $test 1]
|
.fsb configure $option [lindex $test 1]
|
lindex [.fsb configure $option] 4
|
lindex [.fsb configure $option] 4
|
} [lindex $test 2]
|
} [lindex $test 2]
|
update
|
update
|
incr o
|
incr o
|
}
|
}
|
#
|
#
|
# Option tests which fail and produce errors.
|
# Option tests which fail and produce errors.
|
#
|
#
|
foreach test {
|
foreach test {
|
{-directory bogus {bad directory option "bogus": directory does not exist}}
|
{-directory bogus {bad directory option "bogus": directory does not exist}}
|
{-filetype bogus {bad filetype option "bogus": should be regular, directory, or any}}} {
|
{-filetype bogus {bad filetype option "bogus": should be regular, directory, or any}}} {
|
set option [lindex $test 0]
|
set option [lindex $test 0]
|
test Fileselectionbox-2.$o "configuration options, $option" {
|
test Fileselectionbox-2.$o "configuration options, $option" {
|
list [catch {.fsb configure $option [lindex $test 1]} msg] $msg
|
list [catch {.fsb configure $option [lindex $test 1]} msg] $msg
|
} [list 1 [lindex $test 2]]
|
} [list 1 [lindex $test 2]]
|
incr o
|
incr o
|
}
|
}
|
|
|
#
|
#
|
# Method tests which are successful.
|
# Method tests which are successful.
|
#
|
#
|
foreach test {
|
foreach test {
|
{{.fsb childsite} {.fsb.fsbchildsite}}
|
{{.fsb childsite} {.fsb.fsbchildsite}}
|
{{.fsb get} {}}} {
|
{{.fsb get} {}}} {
|
set method [lindex [lindex $test 0] 1]
|
set method [lindex [lindex $test 0] 1]
|
test Fileselectionbox-3.$m "object methods, $method" {
|
test Fileselectionbox-3.$m "object methods, $method" {
|
list [catch {eval [lindex $test 0]} msg] $msg
|
list [catch {eval [lindex $test 0]} msg] $msg
|
} [list 0 [lindex $test 1]]
|
} [list 0 [lindex $test 1]]
|
update
|
update
|
incr m
|
incr m
|
}
|
}
|
|
|
#
|
#
|
# Conclusion of constrcution/destruction tests
|
# Conclusion of constrcution/destruction tests
|
#
|
#
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
destroy .fsb
|
destroy .fsb
|
update
|
update
|
} {}
|
} {}
|
|
|
|
|
incr c
|
incr c
|
|
|
test Fileselectionbox-1.$c {Fileselectionbox construction} {
|
test Fileselectionbox-1.$c {Fileselectionbox construction} {
|
iwidgets::fileselectionbox .fsb
|
iwidgets::fileselectionbox .fsb
|
pack .fsb -padx 10 -pady 10 -fill both -expand yes
|
pack .fsb -padx 10 -pady 10 -fill both -expand yes
|
update
|
update
|
} {}
|
} {}
|
|
|
|
|
incr c
|
incr c
|
|
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
destroy .fsb
|
destroy .fsb
|
update
|
update
|
} {}
|
} {}
|
|
|
incr c
|
incr c
|
|
|
|
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
test Fileselectionbox-1.$c {Fileselectionbox destruction} {
|
iwidgets::fileselectionbox .fsb
|
iwidgets::fileselectionbox .fsb
|
pack .fsb
|
pack .fsb
|
destroy .fsb
|
destroy .fsb
|
update
|
update
|
} {}
|
} {}
|
|
|
#
|
#
|
# Childsite tests
|
# Childsite tests
|
#
|
#
|
incr o
|
incr o
|
|
|
test Fileselectionbox-1.$o {Fileselectionbox -childsitepos} {
|
test Fileselectionbox-1.$o {Fileselectionbox -childsitepos} {
|
iwidgets::fileselectionbox .fsb
|
iwidgets::fileselectionbox .fsb
|
pack .fsb
|
pack .fsb
|
update
|
update
|
label [.fsb childsite].lb -background red -text CS
|
label [.fsb childsite].lb -background red -text CS
|
pack [.fsb childsite].lb -fill both -expand yes
|
pack [.fsb childsite].lb -fill both -expand yes
|
update
|
update
|
|
|
.fsb configure -childsitepos n
|
.fsb configure -childsitepos n
|
update
|
update
|
.fsb configure -childsitepos s
|
.fsb configure -childsitepos s
|
update
|
update
|
.fsb configure -childsitepos e
|
.fsb configure -childsitepos e
|
update
|
update
|
.fsb configure -childsitepos w
|
.fsb configure -childsitepos w
|
update
|
update
|
.fsb configure -childsitepos top
|
.fsb configure -childsitepos top
|
update
|
update
|
.fsb configure -childsitepos bottom
|
.fsb configure -childsitepos bottom
|
update
|
update
|
.fsb configure -childsitepos center
|
.fsb configure -childsitepos center
|
update
|
update
|
destroy .fsb
|
destroy .fsb
|
} {}
|
} {}
|
|
|