📄 listbox.test
字号:
test listbox-3.66 {ListboxWidgetCmd procedure, "insert" option} { catch {destroy .l2} listbox .l2 .l2 insert end a b c d e .l2 insert 3 x y z .l2 get 0 end} {a b c x y z d e}test listbox-3.67 {ListboxWidgetCmd procedure, "insert" option} { catch {destroy .l2} listbox .l2 .l2 insert end a b c .l2 insert -1 x .l2 get 0 end} {x a b c}test listbox-3.68 {ListboxWidgetCmd procedure, "insert" option} { catch {destroy .l2} listbox .l2 .l2 insert end a b c .l2 insert end x .l2 get 0 end} {a b c x}test listbox-3.69 {ListboxWidgetCmd procedure, "insert" option} { catch {destroy .l2} listbox .l2 .l2 insert end a b c .l2 insert 43 x .l2 get 0 end} {a b c x}test listbox-3.70 {ListboxWidgetCmd procedure, "nearest" option} { list [catch {.l nearest} msg] $msg} {1 {wrong # args: should be ".l nearest y"}}test listbox-3.71 {ListboxWidgetCmd procedure, "nearest" option} { list [catch {.l nearest a b} msg] $msg} {1 {wrong # args: should be ".l nearest y"}}test listbox-3.72 {ListboxWidgetCmd procedure, "nearest" option} { list [catch {.l nearest 20p} msg] $msg} {1 {expected integer but got "20p"}}test listbox-3.73 {ListboxWidgetCmd procedure, "nearest" option} { .l yview 3 .l nearest 1000} {7}test listbox-3.74 {ListboxWidgetCmd procedure, "scan" option} { list [catch {.l scan a b} msg] $msg} {1 {wrong # args: should be ".l scan mark|dragto x y"}}test listbox-3.75 {ListboxWidgetCmd procedure, "scan" option} { list [catch {.l scan a b c d} msg] $msg} {1 {wrong # args: should be ".l scan mark|dragto x y"}}test listbox-3.76 {ListboxWidgetCmd procedure, "scan" option} { list [catch {.l scan foo bogus 2} msg] $msg} {1 {expected integer but got "bogus"}}test listbox-3.77 {ListboxWidgetCmd procedure, "scan" option} { list [catch {.l scan foo 2 2.3} msg] $msg} {1 {expected integer but got "2.3"}}test listbox-3.78 {ListboxWidgetCmd procedure, "scan" option} {fonts} { catch {destroy .t} toplevel .t wm geom .t +0+0 listbox .t.l -width 10 -height 5 .t.l insert 0 "Short" "Somewhat longer" "Really, quite a whole lot longer than can possibly fit on the screen" "Short" a b c d e f g h i j pack .t.l update .t.l scan mark 100 140 .t.l scan dragto 90 137 update list [.t.l xview] [.t.l yview]} {{0.249364 0.427481} {0.0714286 0.428571}}test listbox-3.79 {ListboxWidgetCmd procedure, "scan" option} { list [catch {.l scan foo 2 4} msg] $msg} {1 {bad scan option "foo": must be mark or dragto}}test listbox-3.80 {ListboxWidgetCmd procedure, "see" option} { list [catch {.l see} msg] $msg} {1 {wrong # args: should be ".l see index"}}test listbox-3.81 {ListboxWidgetCmd procedure, "see" option} { list [catch {.l see a b} msg] $msg} {1 {wrong # args: should be ".l see index"}}test listbox-3.82 {ListboxWidgetCmd procedure, "see" option} { list [catch {.l see gorp} msg] $msg} {1 {bad listbox index "gorp": must be active, anchor, end, @x,y, or a number}}test listbox-3.83 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 7 .l index @0,0} {7}test listbox-3.84 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 11 .l index @0,0} {7}test listbox-3.85 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 6 .l index @0,0} {6}test listbox-3.86 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 5 .l index @0,0} {3}test listbox-3.87 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 12 .l index @0,0} {8}test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 13 .l index @0,0} {11}test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see -1 .l index @0,0} {0}test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see end .l index @0,0} {13}test listbox-3.91 {ListboxWidgetCmd procedure, "see" option} { .l yview 7 .l see 322 .l index @0,0} {13}test listbox-3.92 {ListboxWidgetCmd procedure, "see" option, partial last line} { mkPartial .partial.l see 4 .partial.l index @0,0} {1}test listbox-3.93 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l select a} msg] $msg} {1 {wrong # args: should be ".l selection option index ?index?"}}test listbox-3.94 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l select a b c d} msg] $msg} {1 {wrong # args: should be ".l selection option index ?index?"}}test listbox-3.95 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l selection a bogus} msg] $msg} {1 {bad listbox index "bogus": must be active, anchor, end, @x,y, or a number}}test listbox-3.96 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l selection a 0 lousy} msg] $msg} {1 {bad listbox index "lousy": must be active, anchor, end, @x,y, or a number}}test listbox-3.97 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l selection anchor 0 0} msg] $msg} {1 {wrong # args: should be ".l selection anchor index"}}test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} { list [.l selection anchor 5; .l index anchor] \ [.l selection anchor 0; .l index anchor]} {5 0}test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} { .l selection anchor -1 .l index anchor} {0}test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} { .l selection anchor end .l index anchor} {17}test listbox-3.101 {ListboxWidgetCmd procedure, "selection" option} { .l selection anchor 44 .l index anchor} {17}test listbox-3.102 {ListboxWidgetCmd procedure, "selection" option} { .l selection clear 0 end .l selection set 2 8 .l selection clear 3 4 .l curselection} {2 5 6 7 8}test listbox-3.103 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l selection includes 0 0} msg] $msg} {1 {wrong # args: should be ".l selection includes index"}}test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} { .l selection clear 0 end .l selection set 2 8 .l selection clear 4 list [.l selection includes 3] [.l selection includes 4] \ [.l selection includes 5]} {1 0 1}test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} { .l selection set 0 end .l selection includes -1} {0}test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} { .l selection clear 0 end .l selection set end .l selection includes end} {1}test listbox-3.107 {ListboxWidgetCmd procedure, "selection" option} { .l selection set 0 end .l selection includes 44} {0}test listbox-3.108 {ListboxWidgetCmd procedure, "selection" option} { catch {destroy .l2} listbox .l2 .l2 selection includes 0} {0}test listbox-3.109 {ListboxWidgetCmd procedure, "selection" option} { .l selection clear 0 end .l selection set 2 .l selection set 5 7 .l curselection} {2 5 6 7}test listbox-3.110 {ListboxWidgetCmd procedure, "selection" option} { .l selection set 5 7 .l curselection} {2 5 6 7}test listbox-3.111 {ListboxWidgetCmd procedure, "selection" option} { list [catch {.l selection badOption 0 0} msg] $msg} {1 {bad selection option "badOption": must be anchor, clear, includes, or set}}test listbox-3.112 {ListboxWidgetCmd procedure, "size" option} { list [catch {.l size a} msg] $msg} {1 {wrong # args: should be ".l size"}}test listbox-3.113 {ListboxWidgetCmd procedure, "size" option} { .l size} {18}test listbox-3.114 {ListboxWidgetCmd procedure, "xview" option} { catch {destroy .l2} listbox .l2 update .l2 xview} {0 1}test listbox-3.115 {ListboxWidgetCmd procedure, "xview" option} { catch {destroy .l} listbox .l -width 10 -height 5 -font $fixed .l insert 0 a b c d e f g h i j k l m n o p q r s t pack .l update .l xview} {0 1}catch {destroy .l}listbox .l -width 10 -height 5 -font $fixed.l insert 0 a b c d e f g h i j k l m n o p q r s t.l insert 1 "0123456789a123456789b123456789c123456789d123456789"pack .lupdatetest listbox-3.116 {ListboxWidgetCmd procedure, "xview" option} {fonts} { .l xview 4 .l xview} {0.08 0.28}test listbox-3.117 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l xview foo} msg] $msg} {1 {expected integer but got "foo"}}test listbox-3.118 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l xview zoom a b} msg] $msg} {1 {unknown option "zoom": must be moveto or scroll}}test listbox-3.119 {ListboxWidgetCmd procedure, "xview" option} {fonts} { .l xview 0 .l xview moveto .4 update .l xview} {0.4 0.6}test listbox-3.120 {ListboxWidgetCmd procedure, "xview" option} {fonts} { .l xview 0 .l xview scroll 2 units update .l xview} {0.04 0.24}test listbox-3.121 {ListboxWidgetCmd procedure, "xview" option} {fonts} { .l xview 30 .l xview scroll -1 pages update .l xview} {0.44 0.64}test listbox-3.122 {ListboxWidgetCmd procedure, "xview" option} {fonts} { .l configure -width 1 update .l xview 30 .l xview scroll -4 pages update .l xview} {0.52 0.54}test listbox-3.123 {ListboxWidgetCmd procedure, "yview" option} { catch {destroy .l} listbox .l pack .l update .l yview} {0 1}test listbox-3.124 {ListboxWidgetCmd procedure, "yview" option} { catch {destroy .l} listbox .l .l insert 0 el1 pack .l update .l yview} {0 1}catch {destroy .l}listbox .l -width 10 -height 5 -font $fixed.l insert 0 a b c d e f g h i j k l m n o p q r s tpack .lupdatetest listbox-3.125 {ListboxWidgetCmd procedure, "yview" option} { .l yview 4 update .l yview} {0.2 0.45}test listbox-3.126 {ListboxWidgetCmd procedure, "yview" option, partial last line} { mkPartial .partial.l yview} {0 0.266667}test listbox-3.127 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l yview foo} msg] $msg} {1 {bad listbox index "foo": must be active, anchor, end, @x,y, or a number}}test listbox-3.128 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l yview foo a b} msg] $msg} {1 {unknown option "foo": must be moveto or scroll}}test listbox-3.129 {ListboxWidgetCmd procedure, "xview" option} { .l yview 0 .l yview moveto .31 .l yview} {0.3 0.55}test listbox-3.130 {ListboxWidgetCmd procedure, "xview" option} { .l yview 2 .l yview scroll 2 pages .l yview} {0.4 0.65}test listbox-3.131 {ListboxWidgetCmd procedure, "xview" option} { .l yview 10 .l yview scroll -3 units .l yview} {0.35 0.6}test listbox-3.132 {ListboxWidgetCmd procedure, "xview" option} { .l configure -height 2 update .l yview 15 .l yview scroll -4 pages .l yview} {0.55 0.65}test listbox-3.133 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l whoknows} msg] $msg} {1 {bad option "whoknows": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, nearest, scan, see, selection, size, xview, or yview}}test listbox-3.134 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l c} msg] $msg} {1 {bad option "c": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, nearest, scan, see, selection, size, xview, or yview}}test listbox-3.135 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l in} msg] $msg} {1 {bad option "in": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, nearest, scan, see, selection, size, xview, or yview}}test listbox-3.136 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l s} msg] $msg} {1 {bad option "s": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, nearest, scan, see, selection, size, xview, or yview}}test listbox-3.137 {ListboxWidgetCmd procedure, "xview" option} { list [catch {.l se} msg] $msg} {1 {bad option "se": must be activate, bbox, cget, configure, curselection, delete, get, index, insert, nearest, scan, see, selection, size, xview, or yview}}# No tests for DestroyListbox: I can't come up with anything to test# in this procedure.test listbox-4.1 {ConfigureListbox procedure} {fonts} { catch {destroy .l} listbox .l -setgrid 1 -width 25 -height 15 pack .l update set x [getsize .] .l configure -setgrid 0 update list $x [getsize .]} {25x15 185x263}resetGridInfotest listbox-4.2 {ConfigureListbox procedure} { .l configure -highlightthickness -3 .l cget -highlightthickness} {0}test listbox-4.3 {ConfigureListbox procedure} { .l configure -exportselection 0 .l delete 0 end .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 .l selection set 3 5 .l configure -exportselection 1 selection get} {el3el4el5}test listbox-4.4 {ConfigureListbox procedure} { catch {destroy .e} entry .e .e insert 0 abc .e select from 0 .e select to 2 .l configure -exportselection 0 .l delete 0 end .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 .l selection set 3 5 .l selection clear 3 5 .l configure -exportselection 1 list [selection own] [selection get]} {.e ab}test listbox-4.5 {-exportselection option} { selection clear . .l configure -exportselection 1 .l delete 0 end .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 .l selection set 1 1 set x {} lappend x [catch {selection get} msg] $msg [.l curselection] .l config -exportselection 0 lappend x [catch {selection get} msg] $msg [.l curselection] .l selection clear 0 end lappend x [catch {selection get} msg] $msg [.l curselection] .l selection set 1 3 lappend x [catch {selection get} msg] $msg [.l curselection] .l config -exportselection 1 lappend x [catch {selection get} msg] $msg [.l curselection]} {0 el1 1 1 {PRIMARY selection doesn't exist or form "STRING" not defined} 1 1 {PRIMARY selection doesn't exist or form "STRING" not defined} {} 1 {PRIMARY selection doesn't exist or form "STRING" not defined} {1 2 3} 0 {el1el2el3} {1 2 3}}test listbox-4.6 {ConfigureListbox procedure} {fonts} { catch {destroy .l} # The following code (reset geometry, withdraw, etc.) is necessary # to reset the state of some window managers like olvwm under # SunOS 4.1.3. wm geom . 300x300 update wm geom . {} wm withdraw . listbox .l -font $fixed -width 15 -height 20 pack .l
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -