📄 fileselectiondialog.test
字号:
# This file is a Tcl script to test out [incr Widgets] Fileselectiondialog # 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# 4.x - Other 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: fileselectiondialog.test 144 2003-02-05 10:56:26Z mdejong $package require tcltestnamespace import -force ::tcltest::*package require Iwidgets 3.0if {[string compare test [info procs test]] == 1} { source defs}wm geometry . {}raise .set c 1set o 1set m 1## Initial construction test#test Fileselectiondialog-1.$c {Fileselectiondialog construction} { iwidgets::Fileselectiondialog .fsd .fsd activate} {}incr c## Option tests which are successful.#test Fileselectiondialog-2.$o {configuration option} { llength [.fsd configure]} {51}incr oforeach test { {-activebackground #ececec #ececec} {-borderwidth 2 2} {-childsitepos n n} {-childsitepos s s} {-childsitepos e e} {-childsitepos w w} {-childsitepos top top} {-childsitepos bottom bottom} {-childsitepos center center} {-cursor gumby gumby} {-directory {..} {..}} {-textbackground GhostWhite GhostWhite} {-foreground Black Black} {-insertbackground Black Black} {-insertborderwidth 1 1} {-insertofftime 200 200} {-insertontime 500 500} {-insertwidth 3 3} {-dirslabel "Dirs Label" "Dirs Label"} {-dirson no no} {-dirson yes yes} {-fileslabel "Files Label" "Files Label"} {-fileson no no} {-directory ../tests ../tests} {-mask *.* *.*} {-nomatchstring {No Files} {No Files}} {-fileson yes yes} {-filetype any any} {-filetype directory directory} {-filetype regular regular} {-filterlabel "Filter Label" "Filter Label"} {-filteron no no} {-filteron yes yes} {-selectbackground #c3c3c3 #c3c3c3} {-selectionlabel "Selection Label" "Selection Label"} {-selectionon no no} {-selectionon yes yes} {-textfont -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*} {-background #d9d9d9 #d9d9d9} {-buttonboxpos n n} {-buttonboxpos e e} {-buttonboxpos w w} {-buttonboxpos s s} {-cursor gumby gumby} {-modality global global} {-modality application application} {-modality none none} {-padx 15 15} {-pady 15 15} {-separator off off} {-thickness 4 4} {-separator on on} {-title Fileselectiondialog Fileselectiondialog}} { set option [lindex $test 0] test Fileselectiondialog-2.$o "configuration options, $option" { .fsd configure $option [lindex $test 1] lindex [.fsd configure $option] 4 } [lindex $test 2] update incr o}## Option tests which fail and produce errors.#foreach test { {-directory bogus {bad directory option "bogus": directory does not exist}} {-filetype bogus {bad filetype option "bogus": should be regular, directory, or any}}} { set option [lindex $test 0] test FileSelectionBox-2.$o "configuration options, $option" { list [catch {.fsd configure $option [lindex $test 1]} msg] $msg } [list 1 [lindex $test 2]] incr o}## Method tests which are successful.#foreach test { {{.fsd childsite} {.fsd.shellchildsite.dschildsite.fsb.fsbchildsite}} {{.fsd hide Help} {}} {{.fsd hide Cancel} {}} {{.fsd default Apply} {}} {{.fsd show Cancel} {}} {{.fsd deactivate} {}}} { set method [lindex [lindex $test 0] 1] test Fileselectiondialog-3.$m "object methods, $method" { list [catch {eval [lindex $test 0]} msg] $msg } [list 0 [lindex $test 1]] update incr m}## Conclusion of constrcution/destruction tests#test Fileselectiondialog-1.$c {Fileselectiondialog destruction} { destroy .fsd update} {}incr ctest Fileselectiondialog-1.$c {Fileselectiondialog construction} { iwidgets::fileselectiondialog .fsd update} {}incr ctest Fileselectiondialog-1.$c {Fileselectiondialog destruction} { destroy .fsd update} {}incr ctest Fileselectiondialog-1.$c {Fileselectiondialog destruction} { iwidgets::fileselectiondialog .fsd destroy .fsd update} {}## Childsite tests#incr otest Fileselectiondialog-1.$o {Fileselectiondialog -childsitepos} { iwidgets::fileselectiondialog .fsd .fsd activate update label [.fsd childsite].lb -background red -text CS pack [.fsd childsite].lb -fill both -expand yes update .fsd configure -childsitepos n update .fsd configure -childsitepos s update .fsd configure -childsitepos e update .fsd configure -childsitepos w update .fsd configure -childsitepos top update .fsd configure -childsitepos bottom update .fsd configure -childsitepos center update .fsd deactivate update destroy .fsd} {}::tcltest::cleanupTestsexit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -