📄 panedwindow.test
字号:
# This file is a Tcl script to test out [incr Widgets] Panedwindow 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: panedwindow.test,v 1.1 2003/02/05 10:54:14 mdejong Exp $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 Panedwindow-1.$c {Panedwindow construction} { iwidgets::Panedwindow .pw -width 200 -height 200 .pw add top .pw add bottom pack .pw -fill both -expand yes update } {}incr c## Option tests which are successful.#test Panedwindow-2.$o {configuration option} { llength [.pw configure]} {12}incr oforeach test { {-background #d9d9d9 #d9d9d9} {-cursor gumby gumby} {-height 300 300} {-orient vertical vertical} {-sashborderwidth 3 3} {-sashcursor arrow arrow} {-sashheight 12 12} {-sashindent -20 -20} {-sashwidth 12 12} {-thickness 5 5} {-orient horizontal horizontal} {-width 300 300}} { set option [lindex $test 0] test Panedwindow-2.$o "configuration options, $option" { .pw configure $option [lindex $test 1] lindex [.pw configure $option] 4 } [lindex $test 2] update incr o}## Method tests which are successful.#foreach test { {{.pw index 0} {0}} {{.pw index end} {1}} {{.pw index top} {0}} {{.pw index b*} {1}} {{.pw childsite 0} {.pw.pane0.childsite}} {{.pw childsite end} {.pw.pane1.childsite}} {{.pw childsite 1} {.pw.pane1.childsite}} {{.pw childsite} {.pw.pane0.childsite .pw.pane1.childsite}} {{.pw fraction 25 75} {}} {{.pw add middle -margin 10 -minimum 10} {.pw.pane2}} {{.pw delete middle} {}} {{.pw insert 1 middle} {.pw.pane3}} {{.pw fraction 20 30 50} {}} {{.pw reset} {}} {{.pw hide end} {}} {{.pw show bottom} {}} {{.pw paneconfigure 0 -minimum} {-minimum minimum Minimum 10 10}} {{.pw paneconfigure end -margin 10} {}}} { set method [lindex [lindex $test 0] 1] test Panedwindow-3.$m "object methods, $method" { list [catch {eval [lindex $test 0]} msg] $msg } [list 0 [lindex $test 1]] update incr m}## Method tests which fail and produce errors#foreach test { {{.pw index 5} {Panedwindow index "5" is out of range}} {{.pw index bogus} {bad Panedwindow index "bogus": must be number, end, or pattern}} {{.pw fraction 10 20 30} {bad fraction arguments "10 20 30": they should add up to 100}} {{.pw fraction 10 20} {wrong # args: should be ".pw fraction percentage percentage ?percentage ...?", where the number of percentages is 3 and equal 100}}} { set method [lindex [lindex $test 0] 1] test Panedwindow-3.$m "object methods, $method" { list [catch {eval [lindex $test 0]} msg] $msg } [list 1 [lindex $test 1]] incr m}## Conclusion of constrcution/destruction tests#test Panedwindow-1.$c {Panedwindow destruction} { destroy .pw update } {}incr ctest Panedwindow-1.$c {Panedwindow construction} { iwidgets::panedwindow .pw -width 200 -height 300 .pw add pane0 .pw add pane1 .pw add pane2 .pw add pane3 foreach pane [.pw childsite] { button $pane.b -text $pane -relief raised -borderwidth 3 pack $pane.b -fill both -expand yes } .pw fraction 20 20 30 30 pack .pw -fill both -expand yes update } {}incr ctest Panedwindow-1.$c {Panedwindow destruction} { destroy .pw update } {}incr ctest Panedwindow-1.$c {Panedwindow destruction} { iwidgets::panedwindow .pw pack .pw destroy .pw update } {}::tcltest::cleanupTestsexit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -