📄 canvtext.test
字号:
# Can't test this because GetTextIndex filters out those numbers.} {}test canvText-8.3 {TextInsert procedure: inserting in a selected item} { .c itemconfig test -text "abcdefg" .c select from test 2 .c select to test 4 .c insert test 1 "xyz" .c itemcget test -text} {axyzbcdefg}test canvText-8.4 {TextInsert procedure: inserting before selection} { .c itemconfig test -text "abcdefg" .c select from test 2 .c select to test 4 .c insert test 1 "xyz" list [.c index test sel.first] [.c index test sel.last]} {5 7}test canvText-8.5 {TextInsert procedure: inserting in selection} { .c itemconfig test -text "abcdefg" .c select from test 2 .c select to test 4 .c insert test 3 "xyz" list [.c index test sel.first] [.c index test sel.last]} {2 7}test canvText-8.6 {TextInsert procedure: inserting after selection} { .c itemconfig test -text "abcdefg" .c select from test 2 .c select to test 4 .c insert test 5 "xyz" list [.c index test sel.first] [.c index test sel.last]} {2 4}test canvText-8.7 {TextInsert procedure: inserting in unselected item} { .c itemconfig test -text "abcdefg" .c select clear .c insert test 5 "xyz" .c itemcget test -text} {abcdexyzfg}test canvText-8.8 {TextInsert procedure: inserting before cursor} { .c itemconfig test -text "abcdefg" .c icursor test 3 .c insert test 2 "xyz" .c index test insert} {6}test canvText-8.9 {TextInsert procedure: inserting after cursor} { .c itemconfig test -text "abcdefg" .c icursor test 3 .c insert test 4 "xyz" .c index test insert} {3}test canvText-9.1 {TextInsert procedure: before beginning/after end} { # Can't test this because GetTextIndex filters out those numbers.} {}test canvText-9.2 {TextInsert procedure: start > end} { .c itemconfig test -text "abcdefg" .c dchars test 4 2 .c itemcget test -text} {abcdefg}test canvText-9.3 {TextInsert procedure: deleting from a selected item} { .c itemconfig test -text "abcdefg" .c select from test 2 .c select to test 4 .c dchars test 3 5 .c itemcget test -text} {abcg}test canvText-9.4 {TextInsert procedure: deleting before start} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 1 1 list [.c index test sel.first] [.c index test sel.last]} {3 7}test canvText-9.5 {TextInsert procedure: keep start > first char deleted} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 2 6 list [.c index test sel.first] [.c index test sel.last]} {2 3}test canvText-9.6 {TextInsert procedure: deleting inside selection} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 6 6 list [.c index test sel.first] [.c index test sel.last]} {4 7}test canvText-9.7 {TextInsert procedure: keep end > first char deleted} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 6 10 list [.c index test sel.first] [.c index test sel.last]} {4 5}test canvText-9.8 {TextInsert procedure: selectFirst > selectLast: deselect} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 3 10 list [catch {.c index test sel.first} msg] $msg} {1 {selection isn't in item}}test canvText-9.9 {TextInsert procedure: selectFirst <= selectLast} { .c itemconfig test -text "abcdefghijk" .c select from test 4 .c select to test 8 .c dchars test 4 7 list [.c index test sel.first] [.c index test sel.last]} {4 4}test canvText-9.10 {TextInsert procedure: move anchor} { .c itemconfig test -text "abcdefghijk" .c select from test 6 .c select to test 8 .c dchars test 2 4 .c select to test 1 list [.c index test sel.first] [.c index test sel.last]} {1 2}test canvText-9.11 {TextInsert procedure: keep anchor >= first} { .c itemconfig test -text "abcdefghijk" .c select from test 6 .c select to test 8 .c dchars test 5 7 .c select to test 1 list [.c index test sel.first] [.c index test sel.last]} {1 4}test canvText-9.12 {TextInsert procedure: anchor doesn't move} { .c itemconfig test -text "abcdefghijk" .c select from test 2 .c select to test 5 .c dchars test 6 8 .c select to test 8 list [.c index test sel.first] [.c index test sel.last]} {2 8}test canvText-9.13 {TextInsert procedure: move cursor} { .c itemconfig test -text "abcdefghijk" .c icursor test 6 .c dchars test 2 4 .c index test insert} {3}test canvText-9.14 {TextInsert procedure: keep cursor >= first} { .c itemconfig test -text "abcdefghijk" .c icursor test 6 .c dchars test 2 10 .c index test insert} {2}test canvText-9.15 {TextInsert procedure: cursor doesn't move} { .c itemconfig test -text "abcdefghijk" .c icursor test 5 .c dchars test 7 9 .c index test insert} {5} test canvText-10.1 {TextToPoint procedure} { .c coords test 0 0 .c itemconfig test -text 0 -anchor center .c index test @0,0} {0}test canvText-11.1 {TextToArea procedure} { .c coords test 0 0 .c itemconfig test -text 0 -anchor center .c find overlapping 0 0 1 1} [.c find withtag test]test canvText-11.2 {TextToArea procedure} { .c coords test 0 0 .c itemconfig test -text 0 -anchor center .c find overlapping 1000 1000 1001 1001} {}test canvText-12.1 {ScaleText procedure} { .c coords test 100 100 .c scale all 50 50 2 2 .c coords test} {150.0 150.0}test canvText-13.1 {TranslateText procedure} { .c coords test 100 100 .c move all 10 10 .c coords test} {110.0 110.0} .c itemconfig test -text "abcdefghijklmno" -anchor nw.c select from test 5.c select to test 8.c icursor test 12.c coords test 0 0test canvText-14.1 {GetTextIndex procedure} { list [.c index test end] [.c index test insert] \ [.c index test sel.first] [.c index test sel.last] \ [.c index test @0,0] \ [.c index test -1] [.c index test 10] [.c index test 100]} {15 12 5 8 0 0 10 15}test canvText-14.2 {GetTextIndex procedure: select error} { .c select clear list [catch {.c index test sel.first} msg] $msg} {1 {selection isn't in item}}test canvText-14.3 {GetTextIndex procedure: select error} { .c select clear list [catch {.c index test sel.last} msg] $msg} {1 {selection isn't in item}}test canvText-14.4 {GetTextIndex procedure: select error} { .c select clear list [catch {.c index test sel.} msg] $msg} {1 {bad index "sel."}}test canvText-14.5 {GetTextIndex procedure: bad int or unknown index} { list [catch {.c index test xyz} msg] $msg} {1 {bad index "xyz"}}test canvText-15.1 {SetTextCursor procedure} { .c itemconfig -text "abcdefg" .c icursor test 3 .c index test insert} {3}test canvText-16.1 {GetSelText procedure} { .c itemconfig test -text "abcdefghijklmno" -anchor nw .c select from test 5 .c select to test 8 selection get} {fghi}set font {Courier 12 italic}set ax [font measure $font 0]set ay [font metrics $font -linespace]test canvText-17.1 {TextToPostscript procedure} { .c delete all .c config -height 300 -highlightthickness 0 -bd 0 update .c create text 100 100 -tags test .c itemconfig test -font $font -text "00000000" -width [expr 3*$ax] .c itemconfig test -anchor n -fill black set x [.c postscript] set x [string range $x [string first "/Courier-Oblique" $x] end]} "/Courier-Oblique findfont [font actual $font -size] scalefont ISOEncode setfont0.000 0.000 0.000 setrgbcolor AdjustColor100 200 \[(000)(000)(00)] $ay -0.5 0 0 false DrawTextgrestorerestore showpage%%Trailerend%%EOF"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -