scale.test
来自「linux系统下的音频通信」· TEST 代码 · 共 802 行 · 第 1/2 页
TEST
802 行
scale .s -from 0 -to 10 -label "Short" -orient vertical -length 5i pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {88 458}test scale-7.2 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 1000 -label "Long string" -orient vertical -tick 200 pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {168 108}test scale-7.3 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 1000 -orient vertical -showvalue 0 -width 10 \ -sliderlength 10 pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {22 108}test scale-7.4 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 1000 -orient vertical -showvalue 0 -bd 5 \ -relief sunken pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {39 114}test scale-7.5 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 10 -label "Short" -orient horizontal -length 5i pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {458 61}test scale-7.6 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 1000 -label "Long string" -orient horizontal \ -tick 500 pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {108 79}test scale-7.7 {ComputeScaleGeometry procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 1000 -orient horizontal -showvalue 0 pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {108 27}test scale-7.8 {ComputeScaleGeometry procedure} { catch {destroy .s} scale .s -from 0 -to 1000 -orient horizontal -showvalue 0 -bd 5 \ -relief raised -highlightthickness 2 pack .s update list [winfo reqwidth .s] [winfo reqheight .s]} {114 39}test scale-8.1 {ScaleElement procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -orient vertical -bd 1 -tick 20 -length 300 pack .s .s set 30 update list [.s identify 53 52] [.s identify 54 52] [.s identify 70 52] \ [.s identify 71 52]} {{} trough1 trough1 {}}test scale-8.2 {ScaleElement procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -orient vertical -bd 1 -tick 20 -length 300 pack .s .s set 30 update list [.s identify 60 2] [.s identify 60 3] [.s identify 60 302] \ [.s identify 60 303]} {{} trough1 trough2 {}}test scale-8.3 {ScaleElement procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -orient vertical -bd 1 -tick 20 -length 300 pack .s .s set 30 update list [.s identify 60 83] [.s identify 60 84] [.s identify 60 113] \ [.s identify 60 114] \} {trough1 slider slider trough2}test scale-8.4 {ScaleElement procedure} { catch {destroy .s} scale .s -from 0 -to 100 -orient vertical -bd 4 -width 10 \ -highlightthickness 1 -length 300 -showvalue 0 pack .s .s set 30 update list [.s identify 4 40] [.s identify 5 40] [.s identify 22 40] \ [.s identify 23 40] \} {{} trough1 trough1 {}}test scale-8.5 {ScaleElement procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -orient horizontal -bd 1 \ -highlightthickness 2 -tick 20 -sliderlength 20 \ -length 200 -label Test pack .s .s set 30 update list [.s identify 150 36] [.s identify 150 37] [.s identify 150 53] \ [.s identify 150 54]} {{} trough2 trough2 {}}test scale-8.6 {ScaleElement procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -orient horizontal -bd 2 \ -highlightthickness 1 -tick 20 -length 200 pack .s .s set 30 update list [.s identify 150 20] [.s identify 150 21] [.s identify 150 39] \ [.s identify 150 40]} {{} trough2 trough2 {}}test scale-8.7 {ScaleElement procedure} { catch {destroy .s} scale .s -from 0 -to 100 -orient horizontal -bd 4 -highlightthickness 2 \ -length 200 -width 10 -showvalue 0 pack .s .s set 30 update list [.s identify 30 5] [.s identify 30 6] [.s identify 30 23] \ [.s identify 30 24]} {{} trough1 trough1 {}}test scale-8.8 {ScaleElement procedure} { catch {destroy .s} scale .s -from 0 -to 100 -orient horizontal -bd 1 -highlightthickness 2 \ -tick 20 -sliderlength 20 -length 200 -label Test -showvalue 0 pack .s .s set 30 update list [.s identify 2 28] [.s identify 3 28] [.s identify 202 28] \ [.s identify 203 28]} {{} trough1 trough2 {}}test scale-8.9 {ScaleElement procedure} { catch {destroy .s} scale .s -from 0 -to 100 -orient horizontal -bd 1 -highlightthickness 2 \ -tick 20 -sliderlength 20 -length 200 -label Test -showvalue 0 pack .s .s set 80 update list [.s identify 145 28] [.s identify 146 28] [.s identify 165 28] \ [.s identify 166 28]} {trough1 slider slider trough2}catch {destroy .s}scale .s -from 0 -to 100 -sliderlength 10 -length 114 -bd 2pack .supdatetest scale-9.1 {PixelToValue procedure} { .s get 46 0} 0test scale-9.2 {PixelToValue procedure} { .s get -10 9} 0test scale-9.3 {PixelToValue procedure} { .s get -10 12} 1test scale-9.4 {PixelToValue procedure} { .s get -10 46} 35test scale-9.5 {PixelToValue procedure} { .s get -10 110} 99test scale-9.6 {PixelToValue procedure} { .s get -10 111} 100test scale-9.7 {PixelToValue procedure} { .s get -10 112} 100test scale-9.8 {PixelToValue procedure} { .s get -10 154} 100.s configure -orient horizontalupdatetest scale-9.9 {PixelToValue procedure} { .s get 76 152} 65test scale-10.1 {ValueToPixel procedure} {fonts} { catch {destroy .s} scale .s -from 0 -to 100 -sliderlength 20 -length 124 -bd 2 \ -orient horizontal -label Test -tick 20 pack .s update list [.s coords -10] [.s coords 40] [.s coords 1000]} {{16 47} {56 47} {116 47}}test scale-10.2 {ValueToPixel procedure} {fonts} { catch {destroy .s} scale .s -from 100 -to 0 -sliderlength 20 -length 122 -bd 1 \ -orient vertical -label Test -tick 20 pack .s update list [.s coords -10] [.s coords 40] [.s coords 1000]} {{62 114} {62 74} {62 14}}test scale-11.1 {ScaleEventProc procedure} { proc killScale value { global x if {$value > 30} { destroy .s1 lappend x [winfo exists .s1] [info commands .s1] } } catch {destroy .s1} set x initial scale .s1 -from 0 -to 100 -command killScale .s1 set 20 pack .s1 update idletasks lappend x [winfo exists .s1] .s1 set 40 update idletasks rename killScale {} set x} {initial 1 0 {}}test scale-11.2 {ScaleEventProc procedure} { eval destroy [winfo children .] scale .s1 -bg #543210 rename .s1 .s2 set x {} lappend x [winfo children .] lappend x [.s2 cget -bg] destroy .s1 lappend x [info command .s*] [winfo children .]} {.s1 #543210 {} {}}test scale-12.1 {ScaleCmdDeletedProc procedure} { eval destroy [winfo children .] scale .s1 rename .s1 {} list [info command .s*] [winfo children .]} {{} {}}catch {destroy .s}scale .s -from 0 -to 100 -command {set x} -variable ypack .supdateproc varTrace args { global traceInfo set traceInfo $args}test scale-13.1 {SetScaleValue procedure} { set x xyzzy .s set 44 set result [list $x $y] update lappend result $x $y} {xyzzy 44 44 44}test scale-13.2 {SetScaleValue procedure} { .s set -3 .s get} 0test scale-13.3 {SetScaleValue procedure} { .s set 105 .s get} 100.s configure -from 100 -to 0test scale-13.4 {SetScaleValue procedure} { .s set -3 .s get} 0test scale-13.5 {SetScaleValue procedure} { .s set 105 .s get} 100test scale-13.6 {SetScaleValue procedure} { .s set 50 update trace variable y w varTrace set traceInfo empty set x untouched .s set 50 update list $x $traceInfo} {untouched empty}catch {destroy .s}scale .s -from 0 -to 100 -sliderlength 10 -length 114 -bd 2 -orient horizontalpack .supdate.s configure -resolution 4.0updatetest scale-14.1 {RoundToResolution procedure} { .s get 84 152} 72test scale-14.2 {RoundToResolution procedure} { .s get 86 152} 76.s configure -from 100 -to 0updatetest scale-14.3 {RoundToResolution procedure} { .s get 84 152} 28test scale-14.4 {RoundToResolution procedure} { .s get 86 152} 24.s configure -from -100 -to 0updatetest scale-14.5 {RoundToResolution procedure} { .s get 84 152} -28test scale-14.6 {RoundToResolution procedure} { .s get 86 152} -24.s configure -from 0 -to -100updatetest scale-14.7 {RoundToResolution procedure} { .s get 84 152} -72test scale-14.8 {RoundToResolution procedure} { .s get 86 152} -76.s configure -from 0 -to 2.25 -resolution 0updatetest scale-14.9 {RoundToResolution procedure} { .s get 84 152} 1.64test scale-14.10 {RoundToResolution procedure} { .s get 86 152} 1.69.s configure -from 0 -to 225 -resolution 0 -digits 5updatetest scale-14.11 {RoundToResolution procedure} { .s get 84 152} 164.25test scale-14.12 {RoundToResolution procedure} { .s get 86 152} 168.75test scale-15.1 {ScaleVarProc procedure} { catch {destroy .s} set y -130 scale .s -from 0 -to -200 -variable y -orient horizontal -length 150 pack .s set y} -130test scale-15.2 {ScaleVarProc procedure} { catch {destroy .s} set y -130 scale .s -from -200 -to 0 -variable y -orient horizontal -length 150 pack .s set y -87 .s get} -87test scale-15.3 {ScaleVarProc procedure} { catch {destroy .s} set y -130 scale .s -from -200 -to 0 -variable y -orient horizontal -length 150 pack .s list [catch {set y 40q} msg] $msg [.s get]} {1 {can't set "y": can't assign non-numeric value to scale variable} -130}test scale-15.4 {ScaleVarProc procedure} { catch {destroy .s} set y 1 scale .s -from 1 -to 0 -variable y -orient horizontal -length 150 pack .s list [catch {set y x} msg] $msg [.s get]} {1 {can't set "y": can't assign non-numeric value to scale variable} 1}test scale-15.5 {ScaleVarProc procedure, variable deleted} { catch {destroy .s} set y 6 scale .s -from 10 -to 0 -variable y -orient horizontal -length 150 \ -command "set x" pack .s update set x untouched unset y update list [catch {set y} msg] $msg [.s get] $x} {0 6 6 untouched}test scale-15.6 {ScaleVarProc procedure, don't call -command} { catch {destroy .s} set y 6 scale .s -from 0 -to 100 -variable y -orient horizontal -length 150 \ -command "set x" pack .s update set x untouched set y 60 update list $x [.s get]} {untouched 60}set l [interp hidden]eval destroy [winfo children .]test scale-16.1 {scale widget vs hidden commands} { catch {destroy .s} scale .s interp hide {} .s destroy .s list [winfo children .] [interp hidden]} [list {} $l]catch {destroy .s}option clear
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?