Update to tk 8.5.19

This commit is contained in:
Zachary Ware
2017-11-24 17:53:51 -06:00
parent 27e7dfc7da
commit c67b328f06
325 changed files with 12511 additions and 12047 deletions

View File

@@ -42,6 +42,7 @@ significance:
r - should appear raised
u - should appear raised and also slightly offset vertically
s - should appear sunken
S - should appear solid
n - preceding relief should extend right to end of line.
* - should appear "normal"
x - extra long lines to allow horizontal scrolling.
@@ -125,15 +126,35 @@ foreach i {1 2 3} {
.t.t insert end *****
.t.t insert end rrr r1
font configure TkFixedFont -size 20
.t.t tag configure sol100 -relief solid -borderwidth 100 \
-foreground red -font TkFixedFont
.t.t tag configure sol12 -relief solid -borderwidth 12 \
-foreground red -font TkFixedFont
.t.t tag configure big -font TkFixedFont
set ind [.t.t index end]
.t.t insert end "\n\nBorders do not leak on the neighbour chars"
.t.t insert end "\nOnly \"S\" is on dark background"
.t.t insert end {
xxx
x} {} S sol100 {x
xxx}
.t.t insert end "\n\nA very thick border grows toward the inside of the tagged area only"
.t.t insert end "\nOnly \"S\" is on dark background"
.t.t insert end {
xxxx} {} SSSSS sol100 {xxxx
x} {} SSSSSSSSSSSSSSSSSS sol100 {x
xxx} {} SSSSSSSSS sol100 xxxx {}
}
.t.t insert end "\n\nA thinner border is continuous"
.t.t insert end {
xxxx} {} SSSSS sol12 {xxxx
x} {} SSSSSSSSSSSSSSSSSS sol12 {x
xxx} {} SSSSSSSSS sol12 xxxx {}
}
.t.t tag add big $ind end

View File

@@ -25,6 +25,14 @@ proc setup {} {
foreach p [event info] {event delete $p}
update
}
proc setup2 {} {
catch {destroy .b.e}
entry .b.e
pack .b.e
focus -force .b.e
foreach p [event info] {event delete $p}
update
}
setup
foreach i [bind Test] {
@@ -1565,6 +1573,42 @@ test bind-16.44 {ExpandPercents procedure} {
event gen .b.f <Gravity>
set x
} {?? ??}
test bind-16.45 {ExpandPercents procedure} -setup {
set savedBind(Entry) [bind Entry <Key>]
set savedBind(All) [bind all <Key>]
setup2
bind .b.e <Key> {set x "%M"}
bind Entry <Key> {set y "%M"}
bind all <Key> {set z "%M"}
} -body {
set x none; set y none; set z none
event gen .b.e <Key-a>
list $x $y $z
} -cleanup {
bind all <Key> $savedBind(All)
bind Entry <Key> $savedBind(Entry)
unset savedBind
} -result {0 1 2}
test bind-16.46 {ExpandPercents procedure} -setup {
set savedBind(Entry) [bind Entry <Key>]
set savedBind(All) [bind all <Key>]
setup2
bind all <Key> {set z "%M"}
bind Entry <Key> {set y "%M"}
bind .b.e <Key> {set x "%M"}
} -body {
set x none; set y none; set z none
event gen .b.e <Key-a>
list $x $y $z
} -cleanup {
bind Entry <Key> $savedBind(Entry)
bind all <Key> $savedBind(All)
unset savedBind
} -result {0 1 2}
test bind-17.1 {event command} {

View File

@@ -485,8 +485,8 @@ test canvText-17.1 {TextToPostscript procedure} {
.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 setfont
set x [string range $x [string first "findfont " $x] end]
} "findfont [font actual $font -size] scalefont ISOEncode setfont
0.000 0.000 0.000 setrgbcolor AdjustColor
100 200 \[
\[(000)\]
@@ -501,7 +501,7 @@ end
%%EOF
"
test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} {
test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} -body {
catch {destroy .c}
canvas .c
pack .c
@@ -513,7 +513,9 @@ test canvText-18.1 {bug fix 2525, find enclosed on text with newlines} {
incr y2
update
.c find enclosed 99 99 [expr $x2 + $i] [expr $y2 + 1]
} 1
} -cleanup {
unset -nocomplain bbox x2 y2
} -result 1
test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} {
catch {destroy .c}

View File

@@ -778,6 +778,14 @@ test entry-6.11 {EntryComputeGeometry procedure} win {
[expr 8+5*[font measure {helvetica 12} .]] \
[expr 8+5*[font measure {helvetica 12} X]] \
[expr 8+[font measure {helvetica 12} 12345]]]
test entry-6.12 {EntryComputeGeometry procedure} {fonts} {
catch {destroy .e}
entry .e -font $fixed -bd 2 -relief raised -width 20
pack .e
.e insert end "012\t456\t"
update
list [.e index @81] [.e index @82] [.e index @116] [.e index @117]
} {6 7 7 8}
catch {destroy .e}
entry .e -width 10 -font $fixed -textvariable contents -xscrollcommand scroll
@@ -1613,13 +1621,32 @@ test entry-22.1 {lost namespaced textvar} {
namespace eval test { variable foo {a b} }
entry .e -textvariable ::test::foo
namespace delete test
.e insert end "more stuff"
.e delete 5 end
catch {set ::test::foo} result
list [.e get] [.e cget -textvar] $result
catch {.e insert end "more stuff"} result1
catch {.e delete 5 end} result2
catch {set ::test::foo} result3
list [.e get] [.e cget -textvar] $result1 $result2 $result3
} [list "a bmo" ::test::foo \
{can't set "::test::foo": parent namespace doesn't exist} \
{can't set "::test::foo": parent namespace doesn't exist} \
{can't read "::test::foo": no such variable}]
test entry-23.1 {error in trace proc attached to the textvariable} {
destroy .e
trace variable myvar w traceit
proc traceit args {error "Intentional error here!"}
entry .e -textvariable myvar
catch {.e insert end mystring} result1
catch {.e delete 0} result2
list $result1 $result2
} [list {can't set "myvar": Intentional error here!} \
{can't set "myvar": Intentional error here!}]
test entry-24.1 {textvariable lives in a non-existing namespace} {
destroy .e
catch {entry .e -textvariable thisnsdoesntexist::myvar} result1
set result1
} {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist}
destroy .e
# XXX Still need to write tests for EntryBlinkProc, EntryFocusProc,

View File

@@ -705,7 +705,7 @@ test event-7.1(double-click) {A double click on a lone character
set result
} {1.3 A 1.3 A}
test event-7.2(double-click) {A double click on a lone character\
in an entry widget should select that character} {knownBug} {
in an entry widget should select that character} {
destroy .t
set t [toplevel .t]
set e [entry $t.e]
@@ -766,7 +766,7 @@ test event-7.2(double-click) {A double click on a lone character\
lappend result [_get_selection $e]
set result
} {3 A 4 A}
} {4 A 4 A}
# cleanup

View File

@@ -15,9 +15,28 @@ toplevel .b
wm geom .b +0+0
update idletasks
set defaultfontlist [font names]
proc getnondefaultfonts {} {
global defaultfontlist
set nondeffonts [list ]
foreach afont [font names] {
if {$afont ni $defaultfontlist} {
lappend nondeffonts $afont
}
}
set nondeffonts
}
proc clearnondefaultfonts {} {
foreach afont [getnondefaultfonts] {
font delete $afont
}
}
proc setup {} {
catch {destroy .b.f}
catch {eval font delete [font names]}
clearnondefaultfonts
label .b.f
pack .b.f
update
@@ -193,20 +212,20 @@ test font-6.1 {font command: create: make up name} {
# (objc < 3) so name = NULL
setup
font create
font names
} {font1}
expr {"font1" in [font names]}
} {1}
test font-6.2 {font command: create: name specified} {
# not (objc < 3)
setup
font create xyz
font names
} {xyz}
expr {"xyz" in [font names]}
} {1}
test font-6.3 {font command: create: name not really specified} {
# (name[0] == '-') so name = NULL
setup
font create -family xyz
font names
} {font1}
expr {"font1" in [font names]}
} {1}
test font-6.4 {font command: create: generate name} {
# (name == NULL)
setup
@@ -247,9 +266,9 @@ test font-7.2 {font command: delete: loop test} {
font create c -underline 1
font create d -underline 1
font create e -underline 1
lappend x [lsort [font names]]
lappend x [lsort [getnondefaultfonts]]
font delete a e c b
lappend x [lsort [font names]]
lappend x [lsort [getnondefaultfonts]]
} {{a b c d e} d}
test font-7.3 {font command: delete: loop test} {
# (namedHashPtr == NULL) in middle of loop
@@ -260,9 +279,9 @@ test font-7.3 {font command: delete: loop test} {
font create c -underline 1
font create d -underline 1
font create e -underline 1
lappend x [lsort [font names]]
lappend x [lsort [getnondefaultfonts]]
catch {font delete a d q c e b}
lappend x [lsort [font names]]
lappend x [lsort [getnondefaultfonts]]
} {{a b c d e} {b c e}}
test font-7.4 {font command: delete: non-existent} {
# (namedHashPtr == NULL)
@@ -382,19 +401,19 @@ test font-11.1 {font command: names: arguments} {
} {1 {wrong # args: should be "font names"}}
test font-11.2 {font command: names: loop test: no passes} {
setup
font names
getnondefaultfonts
} {}
test font-11.3 {font command: names: loop test: one pass} {
setup
font create
font names
getnondefaultfonts
} {font1}
test font-11.4 {font command: names: loop test: multiple passes} {
setup
font create xyz
font create abc
font create def
lsort [font names]
lsort [getnondefaultfonts]
} {abc def xyz}
test font-11.5 {font command: names: skip deletePending fonts} {
# (nfPtr->deletePending == 0)
@@ -402,10 +421,10 @@ test font-11.5 {font command: names: skip deletePending fonts} {
set x {}
font create xyz
font create abc
lappend x [lsort [font names]]
lappend x [lsort [getnondefaultfonts]]
.b.f config -font xyz
font delete xyz
lappend x [font names]
lappend x [getnondefaultfonts]
} {{abc xyz} abc}
test font-12.1 {UpdateDependantFonts procedure: no users} {
@@ -432,9 +451,9 @@ test font-13.1 {CreateNamedFont: new named font} {
# not (new == 0)
setup
set x {}
lappend x [font names]
lappend x [getnondefaultfonts]
font create xyz
lappend x [font names]
lappend x [getnondefaultfonts]
} {{} xyz}
test font-13.2 {CreateNamedFont: named font already exists} {
# (new == 0)
@@ -586,8 +605,8 @@ test font-17.4 {Tk_FreeFont procedure: named font} {
font create xyz
.b.f config -font xyz
destroy .b.f
font names
} {xyz}
expr {"xyz" in [font names]}
} {1}
test font-17.5 {Tk_FreeFont procedure: named font} {
# not (fontPtr->refCount == 0)
setup
@@ -810,7 +829,7 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} {
lappend x [getsize]
.b.l config -wrap 0
set x
} "{[expr $ax*3] $ay} {[expr $ax*3] [expr $ay*2]}"
} "{[expr $ax*8] $ay} {[expr $ax*8] [expr $ay*2]}"
test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} {
set x {}
.b.l config -text "000 000" -wrap [expr $ax*5]
@@ -1143,6 +1162,7 @@ test font-33.1 {Tk_TextWidth procedure} {
test font-34.1 {ConfigAttributesObj procedure: arguments} {
# (Tcl_GetIndexFromObj() != TCL_OK)
set x {}
setup
list [catch {font create xyz -xyz} msg] $msg
} {1 {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike}}
@@ -1380,6 +1400,17 @@ setup
destroy .b
test font-47.1 {Bug f214b8ad5b} -body {
interp create one
interp create two
load {} Tk one
load {} Tk two
one eval menu .menubar
two eval menu .menubar
interp delete one
interp delete two
} -result {}
# cleanup
cleanupTests
return

View File

@@ -20,7 +20,7 @@ proc put {file data} {
puts -nonewline $f $data
close $f
}
test imgPPM-1.1 {FileReadPPM procedure} {
put test.ppm "P6\n0 256\n255\nabcdef"
list [catch {image create photo p1 -file test.ppm} msg] $msg
@@ -38,9 +38,9 @@ test imgPPM-1.4 {FileReadPPM procedure} {
list [catch {image create photo p1 -file test.ppm} msg] $msg
} {1 {PPM image file "test.ppm" has dimension(s) <= 0}}
test imgPPM-1.5 {FileReadPPM procedure} {
put test.ppm "P6\n10 20\n256\nabcdef"
put test.ppm "P6\n10 20\n100000\nabcdef"
list [catch {image create photo p1 -file test.ppm} msg] $msg
} {1 {PPM image file "test.ppm" has bad maximum intensity value 256}}
} {1 {PPM image file "test.ppm" has bad maximum intensity value 100000}}
test imgPPM-1.6 {FileReadPPM procedure} {
put test.ppm "P6\n10 20\n0\nabcdef"
list [catch {image create photo p1 -file test.ppm} msg] $msg
@@ -157,9 +157,78 @@ test imgPPM-4.1 {StringReadPPM procedure, data too short [Bug 1822391]} \
-returnCodes error \
-result {truncated PPM data}
test imgPPM-5.1 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n0 256\n255\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has dimension(s) <= 0}
test imgPPM-5.2 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n-2 256\n255\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has dimension(s) <= 0}
test imgPPM-5.3 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n10 0\n255\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has dimension(s) <= 0}
test imgPPM-5.4 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n10 -2\n255\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has dimension(s) <= 0}
test imgPPM-5.5 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n10 20\n100000\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has bad maximum intensity value 100000}
test imgPPM-5.6 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n10 20\n0\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {PPM image data has bad maximum intensity value 0}
test imgPPM-5.7 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n10 10\n255\nabcdef"
} -returnCodes error -cleanup {
image delete ppm
} -result {truncated PPM data}
test imgPPM-5.8 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n5 4\n255\n01234567890123456789012345678901234567890123456789012345678"
} -returnCodes error -cleanup {
image delete ppm
} -result {truncated PPM data}
test imgPPM-5.9 {StringReadPPM procedure} -setup {
image create photo ppm
} -body {
ppm put "P6\n5 4\n150\n012345678901234567890123456789012345678901234567890123456789"
list [image width ppm] [image height ppm]
} -cleanup {
image delete ppm
} -result {5 4}
eval image delete [image names]
# cleanup
catch {file delete test.ppm}
cleanupTests
return
# Local Variables:
# mode: tcl
# End:

View File

@@ -2169,6 +2169,45 @@ test listbox-30.1 {Bug 3607326} -setup {
unset -nocomplain a
} -result * -match glob -returnCodes error
test listbox-31.1 {<<ListboxSelect>> event} -setup {
destroy .l
unset -nocomplain res
} -body {
pack [listbox .l -state normal]
update
bind .l <<ListboxSelect>> {lappend res [%W curselection]}
.l insert end a b c
focus -force .l
event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires
.l configure -state disabled
focus -force .l
event generate .l <Control-Home> ; # <<ListboxSelect>> does NOT fire
.l configure -state normal
focus -force .l
event generate .l <Control-End> ; # <<ListboxSelect>> fires
.l selection clear 0 end ; # <<ListboxSelect>> does NOT fire
.l selection set 1 1 ; # <<ListboxSelect>> does NOT fire
lappend res [.l curselection]
} -cleanup {
destroy .l
unset -nocomplain res
} -result {0 2 1}
test listbox-31.2 {<<ListboxSelect>> event on lost selection} -setup {
destroy .l
} -body {
pack [listbox .l -exportselection true]
update
bind .l <<ListboxSelect>> {lappend res [list [selection own] [%W curselection]]}
.l insert end a b c
focus -force .l
event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires
selection clear ; # <<ListboxSelect>> fires again
set res
} -cleanup {
destroy .l
} -result {{.l 0} {{} {}}}
resetGridInfo
deleteWindows
option clear

View File

@@ -754,8 +754,13 @@ test menu-3.41 {MenuWidgetCmd procedure, "index" option} {
catch {destroy .m1}
menu .m1
.m1 add command -label "test"
list [catch {.m1 index "test"} msg] $msg [destroy .m1]
} {0 1 {}}
.m1 add command -label "3"
.m1 add command -label "another label"
.m1 add command -label "end"
.m1 add command -label "3a"
.m1 add command -label "final entry"
list [.m1 index "test"] [.m1 index "3"] [.m1 index "3a"] [.m1 index "end"] [destroy .m1]
} {1 3 5 6 {}}
test menu-3.42 {MenuWidgetCmd procedure, "insert" option} {
catch {destroy .m1}
menu .m1
@@ -2561,6 +2566,15 @@ test menu-36.1 {menu -underline string overruns Bug 1599877} {} {
tk::TraverseToMenu . "e"
} {}
test menu-37.1 {menubar menues cannot be posted - bug 2160206} {} {
# On Linux the following used to panic
# It now returns an error (on all platforms)
catch {destroy .m}
menu .m -type menubar
list [catch ".m post 1 1" msg] $msg
} {1 {a menubar menu cannot be posted}}
# cleanup
deleteWindows
cleanupTests

View File

@@ -14,4 +14,5 @@ ple
# More comments, this time delimited by hash-marks.
# Comment-line with space.
*x6:
*x9: \ \ \\\101\n
# comment line as last line of file.

View File

@@ -197,13 +197,14 @@ test option-15.3 {database files} appNameIsTktest {option get . x2 color} green
test option-15.4 {database files} {option get . x3 color} purple
test option-15.5 {database files} {option get . {x 4} color} brown
test option-15.6 {database files} {option get . x6 color} {}
test option-15.7 {database files} {
test option-15.7 {database files} {option get . x9 color} " \t\\A\n"
test option-15.8 {database files} {
list [catch {option read $option1 widget foo} msg] $msg
} {1 {wrong # args: should be "option readfile fileName ?priority?"}}
option add *x3 burgundy
catch {option read $option1 userDefault}
test option-15.8 {database files} {option get . x3 color} burgundy
test option-15.9 {database files} {
test option-15.9 {database files} {option get . x3 color} burgundy
test option-15.10 {database files} {
list [catch {option read $option2} msg] $msg
} {1 {missing colon on line 2}}

View File

@@ -29,24 +29,31 @@ foreach {testName testData} {
20 20 badValue {bad screen distance "badValue"}}
panedwindow-1.8 {-opaqueresize
true 1 foo {expected boolean value but got "foo"}}
panedwindow-1.9 {-orient
panedwindow-1.9 {-proxybackground
"#f0a0a0" "#f0a0a0" non-existent {unknown color name "non-existent"}}
panedwindow-1.10 {-proxyborderwidth
1.3 1.3 badValue {bad screen distance "badValue"}}
panedwindow-1.11 {-proxyrelief
groove groove
1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
panedwindow-1.12 {-orient
horizontal horizontal
badValue {bad orient "badValue": must be horizontal or vertical}}
panedwindow-1.10 {-relief
panedwindow-1.13 {-relief
groove groove
1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
panedwindow-1.11 {-sashcursor
panedwindow-1.14 {-sashcursor
arrow arrow badValue {bad cursor spec "badValue"}}
panedwindow-1.12 {-sashpad
panedwindow-1.15 {-sashpad
1.3 1 badValue {bad screen distance "badValue"}}
panedwindow-1.13 {-sashrelief
panedwindow-1.16 {-sashrelief
groove groove
1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
panedwindow-1.14 {-sashwidth
panedwindow-1.17 {-sashwidth
10 10 badValue {bad screen distance "badValue"}}
panedwindow-1.15 {-showhandle
panedwindow-1.18 {-showhandle
true 1 foo {expected boolean value but got "foo"}}
panedwindow-1.16 {-width
panedwindow-1.19 {-width
402 402 badValue {bad screen distance "badValue"}}
} {
lassign $testData optionName goodIn goodOut badIn badOut
@@ -2460,6 +2467,23 @@ test panedwindow-26.1 {DestroyPanedWindow} {
}
set result {}
} {}
test panedwindow-26.2 {UnmapNotify and MapNotify events are propagated to slaves} {
panedwindow .pw
.pw add [button .pw.b]
pack .pw
update
set result [winfo ismapped .pw.b]
pack forget .pw
update
lappend result [winfo ismapped .pw.b]
lappend result [winfo ismapped .pw]
pack .pw
update
lappend result [winfo ismapped .pw]
lappend result [winfo ismapped .pw.b]
destroy .pw .pw.b
set result
} {1 0 0 1 1}
test panedwindow-27.1 {PanedWindowIdentifyCoords} {
panedwindow .p -bd 0 -sashwidth 2 -sashpad 2

View File

@@ -387,6 +387,11 @@ test scale-6.20 {ComputeFormat procedure} {
.s set 1001.23456789
.s get
} {1001.235}
test scale-6.21 {ComputeFormat procedure} {
.s configure -length 200 -from 1000 -to 1001.8 -resolution 0 -digits 200
.s set 1001.23456789
.s get
} {1001.235}
test scale-7.1 {ComputeScaleGeometry procedure} {nonPortable fonts} {
catch {destroy .s}
@@ -862,6 +867,40 @@ test scale-18.3 {Scale button 2 events [Bug 787065]} \
} \
-result {0 {}}
test scale-19 {Bug [3529885fff] - Click in through goes in wrong direction} \
-setup {
catch {destroy .s}
catch {destroy .s1 .s2 .s3 .s4}
unset -nocomplain x1 x2 x3 x4 x y
scale .s1 -from 0 -to 100 -resolution 1 -variable x1 -digits 4 -orient horizontal -length 100
scale .s2 -from 0 -to 100 -resolution -1 -variable x2 -digits 4 -orient horizontal -length 100
scale .s3 -from 100 -to 0 -resolution 1 -variable x3 -digits 4 -orient horizontal -length 100
scale .s4 -from 100 -to 0 -resolution -1 -variable x4 -digits 4 -orient horizontal -length 100
pack .s1 .s2 .s3 .s4 -side left
update
} \
-body {
foreach {x y} [.s1 coord 50] {}
event generate .s1 <1> -x $x -y $y
event generate .s1 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s2 coord 50] {}
event generate .s2 <1> -x $x -y $y
event generate .s2 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s3 coord 50] {}
event generate .s3 <1> -x $x -y $y
event generate .s3 <ButtonRelease-1> -x $x -y $y
foreach {x y} [.s4 coord 50] {}
event generate .s4 <1> -x $x -y $y
event generate .s4 <ButtonRelease-1> -x $x -y $y
update
list $x1 $x2 $x3 $x4
} \
-cleanup {
unset x1 x2 x3 x4 x y
destroy .s1 .s2 .s3 .s4
} \
-result {1.0 1.0 1.0 1.0}
catch {destroy .s}
option clear

View File

@@ -632,6 +632,36 @@ test scrollbar-9.1 {scrollbar widget vs hidden commands} {
list [winfo children .] [interp hidden]
} [list {} $l]
test scrollbar-10.1 {<MouseWheel> event on scrollbar} -constraints {win|unix} -setup {
destroy .t .s
} -body {
pack [text .t -yscrollcommand {.s set}] -side left
for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
pack [scrollbar .s -command {.t yview}] -fill y -expand 1 -side left
update
focus -force .s
event generate .s <MouseWheel> -delta -120
after 200 {set eventprocessed 1} ; vwait eventprocessed
.t index @0,0
} -cleanup {
destroy .t .s
} -result {5.0}
test scrollbar-10.2 {<MouseWheel> event on scrollbar} -constraints {win|unix} -setup {
destroy .t .s
} -body {
pack [text .t -xscrollcommand {.s set} -wrap none] -side top
for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "}
pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top
update
focus -force .s
event generate .s <Shift-MouseWheel> -delta -120
after 200 {set eventprocessed 1} ; vwait eventprocessed
.t index @0,0
} -cleanup {
destroy .t .s
} -result {1.4}
catch {destroy .s}
catch {destroy .t}

View File

@@ -1568,9 +1568,9 @@ test spinbox-22.3 {spinbox config, -from changes SF bug 559078} {
set val
} {6}
test entry-23.1 {selection present while disabled, bug 637828} {
test spinbox-23.1 {selection present while disabled, bug 637828} {
destroy .e
entry .e
spinbox .e
.e insert end 0123456789
.e select from 3
.e select to 6
@@ -1583,6 +1583,28 @@ test entry-23.1 {selection present while disabled, bug 637828} {
} {1 1 345}
destroy .e
test spinbox-24.1 {error in trace proc attached to the textvariable} {
destroy .s
trace variable myvar w traceit
proc traceit args {error "Intentional error here!"}
spinbox .s -textvariable myvar -from 1 -to 10
catch {.s set mystring} result1
catch {.s insert 0 mystring} result2
catch {.s delete 0} result3
catch {.s invoke buttonup} result4
list $result1 $result2 $result3 $result4
} [list {can't set "myvar": Intentional error here!} \
{can't set "myvar": Intentional error here!} \
{can't set "myvar": Intentional error here!} \
{can't set "myvar": Intentional error here!}]
test spinbox-25.1 {textvariable lives in a non-existing namespace} {
destroy .s
catch {spinbox .s -textvariable thisnsdoesntexist::myvar} result1
set result1
} {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist}
catch {unset ::e ::vVals}
##

View File

@@ -698,7 +698,64 @@ test text-9.2.44 {TextWidgetCmd procedure, "count" option} -setup {
.t tag add hidden 2.9 3.17
.t tag configure hidden -elide true
lappend res [.t count -displaylines 1.19 3.24] [.t count -displaylines 1.0 end]
} -result {2 6 2 5}
} -result {2 6 1 5}
test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup {
.t delete 1.0 end
update
set res {}
} -body {
for {set i 1} {$i < 5} {incr i} {
.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
}
.t tag configure hidden -elide true
.t tag add hidden 2.15 3.10
.t configure -wrap none
set res [.t count -displaylines 2.0 3.0]
} -result {0}
test text-9.2.46 {TextWidgetCmd procedure, "count" option} -setup {
toplevel .mytop
pack [text .mytop.t -font TkFixedFont -bd 0 -padx 0 -wrap char]
set spec [font measure TkFixedFont "Line 1+++Line 1---Li"] ; # 20 chars
append spec x300+0+0
wm geometry .mytop $spec
.mytop.t delete 1.0 end
update
set res {}
} -body {
for {set i 1} {$i < 5} {incr i} {
# 0 1 2 3 4
# 012345 678901234 567890123 456789012 34567890123456789
.mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr 64+$i]]\n"
}
.mytop.t tag configure hidden -elide true
.mytop.t tag add hidden 2.30 3.10
lappend res [.mytop.t count -displaylines 2.0 3.0]
lappend res [.mytop.t count -displaylines 2.0 3.50]
} -cleanup {
destroy .mytop
} -result {1 3}
test text-9.2.47 {TextWidgetCmd procedure, "count" option} -setup {
.t delete 1.0 end
update
set res {}
} -body {
for {set i 1} {$i < 25} {incr i} {
.t insert end "Line $i\n"
}
.t tag configure hidden -elide true
.t tag add hidden 5.7 11.0
update
# next line to be fully sure that asynchronous line heights calculation is
# up-to-date otherwise this test may fail (depending on the computer
# performance), especially when the . toplevel has small height
.t count -update -ypixels 1.0 end
set y1 [lindex [.t yview] 1]
.t count -displaylines 5.0 11.0
set y2 [lindex [.t yview] 1]
.t count -displaylines 5.0 12.0
set y3 [lindex [.t yview] 1]
list [expr {$y1 == $y2}] [expr {$y1 == $y3}]
} -result {1 1}
# Newer tags are higher priority
.t tag configure elide1 -elide 0
@@ -1215,9 +1272,10 @@ test text-17.8 {DeleteChars procedure} {
.t tag add sel 1.0 end
.t delete 4.0 end
list [.t tag ranges sel] [.t get 1.0 end]
} {{1.0 3.5} {Line 1
} {{1.0 4.0} {Line 1
abcde
12345
}}
test text-17.9 {DeleteChars procedure} {
setup
@@ -2728,6 +2786,24 @@ test text-20.185 {TextSearchCmd, elide up to match} {
lappend res [.t2 search -regexp bc 1.0]
lappend res [.t2 search -regexp c 1.0]
} {{} {} 1.0 2.1 2.0 3.1 2.0 3.0}
test text-20.185.1 {TextSearchCmd, elide up to match, with UTF-8 chars before the match} {
deleteWindows
pack [text .t2]
.t2 tag configure e -elide 0
.t2 insert end A {} xyz e bb\n
.t2 insert end \u00c4 {} xyz e bb
set res {}
lappend res [.t2 search bb 1.0 "1.0 lineend"]
lappend res [.t2 search bb 2.0 "2.0 lineend"]
lappend res [.t2 search -regexp bb 1.0 "1.0 lineend"]
lappend res [.t2 search -regexp bb 2.0 "2.0 lineend"]
.t2 tag configure e -elide 1
lappend res [.t2 search bb 1.0 "1.0 lineend"]
lappend res [.t2 search bb 2.0 "2.0 lineend"]
lappend res [.t2 search -regexp bb 1.0 "1.0 lineend"]
lappend res [.t2 search -regexp -elide bb 2.0 "2.0 lineend"]
lappend res [.t2 search -regexp bb 2.0 "2.0 lineend"]
} {1.4 2.4 1.4 2.4 1.4 2.4 1.4 2.4 2.4}
test text-20.186 {TextSearchCmd, strict limits} {
deleteWindows
pack [text .t2]
@@ -3152,6 +3228,95 @@ test text-25.18 {patch 1469210 - inserting after undo} -setup {
} -cleanup {
destroy .t
} -result 1
test text-25.19 {patch 1669632 (i) - undo after <Control-1>} -setup {
destroy .t
} -body {
text .t -undo 1
.t insert end foo\nbar
.t edit reset
.t insert 2.2 WORLD
event generate .t <Control-1> -x 1 -y 1
.t insert insert HELLO
.t edit undo
.t get 2.2 2.7
} -cleanup {
destroy .t
} -result WORLD
test text-25.20 {patch 1669632 (iv) - undo after <Control-backslash>} -setup {
destroy .t
} -body {
toplevel .top
pack [text .top.t -undo 1]
.top.t insert end "This is an example text"
.top.t edit reset
.top.t mark set insert 1.5
.top.t insert 1.5 HELLO
.top.t tag add sel 1.10 1.12
update
focus -force .top.t
event generate .top.t <Control-backslash>
.top.t insert insert " WORLD "
.top.t edit undo
.top.t get 1.5 1.10
} -cleanup {
destroy .top.t .top
} -result HELLO
test text-25.21 {patch 1669632 (vii) - <<Undo>> shall not remove separators} -setup {
destroy .t
} -body {
text .t -undo 1
.t insert end "This is an example text"
.t edit reset
.t insert 1.5 "WORLD "
event generate .t <Control-1> -x 1 -y 1
.t insert insert HELLO
event generate .t <<Undo>>
.t insert insert E
event generate .t <<Undo>>
.t get 1.0 "1.0 lineend"
} -cleanup {
destroy .t
} -result "This WORLD is an example text"
test text-25.22 {patch 1669632 (v) - <<Clear>> is atomic} -setup {
destroy .t
} -body {
toplevel .top
pack [text .top.t -undo 1]
.top.t insert end "This is an example text"
.top.t edit reset
.top.t mark set insert 1.5
.top.t insert 1.5 "A"
update
focus -force .top.t
event generate .top.t <Delete>
event generate .top.t <Shift-Right>
event generate .top.t <<Clear>>
event generate .top.t <Delete>
event generate .top.t <<Undo>>
.top.t get 1.0 "1.0 lineend"
} -cleanup {
destroy .top.t .top
} -result "This A an example text"
test text-25.23 {patch 1669632 (v) - <<Cut>> is atomic} -setup {
destroy .t
} -body {
toplevel .top
pack [text .top.t -undo 1]
.top.t insert end "This is an example text"
.top.t edit reset
.top.t mark set insert 1.5
.top.t insert 1.5 "A"
update
focus -force .top.t
event generate .top.t <Delete>
event generate .top.t <Shift-Right>
event generate .top.t <<Cut>>
event generate .top.t <Delete>
event generate .top.t <<Undo>>
.top.t get 1.0 "1.0 lineend"
} -cleanup {
destroy .top.t .top
} -result "This A an example text"
test text-26.1 {bug fix - 624372, ControlUtfProc long lines} {
destroy .t

View File

@@ -664,6 +664,16 @@ test btree-14.1 {check tag presence} {
.t tag add x 141.3
.t tag names 141.1
} {x y z}
test btree-14.2 {TkTextIsElided} {
.t delete 1.0 end
.t tag config hidden -elide 1
.t insert end "Line1\nLine2\nLine3\n"
.t tag add hidden 2.0 3.0
.t tag add sel 1.2 3.2
# next line used to panic because of "Bad tag priority being toggled on"
# (see bug [382da038c9])
.t index "2.0 - 1 display line linestart"
} {1.0}
test btree-15.1 {rebalance with empty node} {
catch {destroy .t}

View File

@@ -27,9 +27,10 @@ proc scrollError args {
# Create entries in the option database to be sure that geometry options
# like border width have predictable values.
option add *Text.borderWidth 2
option add *Text.highlightThickness 2
set twbw 2
set twht 2
option add *Text.borderWidth $twbw
option add *Text.highlightThickness $twht
# The frame .f is needed to make sure that the overall window is always
# fairly wide, even if the text window is very narrow. This is needed
@@ -536,20 +537,24 @@ test textDisp-4.1 {UpdateDisplayInfo, basic} {textfonts} {
.t insert end "Line 1\nLine 2\nLine 3\n"
update
.t delete 2.0 2.end
update
set res $tk_textRelayout
.t insert 2.0 "New Line 2"
update
list [.t bbox 1.0] [.t bbox 2.0] [.t bbox 3.0] $tk_textRelayout
} [list [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] 2.0]
lappend res [.t bbox 1.0] [.t bbox 2.0] [.t bbox 3.0] $tk_textRelayout
} [list 2.0 [list 5 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] 2.0]
test textDisp-4.2 {UpdateDisplayInfo, re-use tail of text line} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
update
.t mark set x 2.21
.t delete 2.2
update
set res $tk_textRelayout
.t insert 2.0 X
update
list [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
} [list [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 12 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] {2.0 2.20}]
lappend res [.t bbox 2.0] [.t bbox x] [.t bbox 3.0] $tk_textRelayout
} [list 2.0 2.20 [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 12 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] [list 5 [expr {3*$fixedDiff + 44}] 7 $fixedHeight] {2.0 2.20}]
test textDisp-4.3 {UpdateDisplayInfo, tail of text line shifts} {textfonts} {
.t delete 1.0 end
.t insert end "Line 1\nLine 2 is so long that it wraps around\nLine 3"
@@ -610,6 +615,10 @@ catch {destroy .f2}
.t configure -borderwidth 0 -wrap char
wm geom . {}
update
set bw [.t cget -borderwidth]
set px [.t cget -padx]
set py [.t cget -pady]
set hlth [.t cget -highlightthickness]
test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
# This test was failing on Windows because the title bar on .
# was a certain minimum size and it was interfering with the size
@@ -648,7 +657,7 @@ test textDisp-4.9 {UpdateDisplayInfo, filling in extra vertical space} {textfont
update
.t delete 15.0 end
list [.t bbox 7.0] [.t bbox 12.0]
} [list [list 3 [expr {2*$fixedDiff + 29}] 7 $fixedHeight] [list 3 [expr {7*$fixedDiff + 94}] 7 $fixedHeight]]
} [list [list [expr {$hlth + $px + $bw}] [expr {$hlth + $py + $bw + $fixedHeight}] $fixedWidth $fixedHeight] [list [expr {$hlth + $px + $bw}] [expr {$hlth + $py + $bw + 6 * $fixedHeight}] $fixedWidth $fixedHeight]]
test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
@@ -657,7 +666,7 @@ test textDisp-4.10 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 13.0 end
update
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
} {5.0 {12.0 7.0 6.40 6.20 6.0 5.0} {5.0 6.0 6.20 6.40 7.0 12.0}}
} {6.0 {13.0 7.0 6.40 6.20 6.0} {6.0 6.20 6.40 7.0 13.0}}
test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\nLine 6 is such a long line that it wraps around, not once but really quite a few times.\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17"
@@ -666,7 +675,7 @@ test textDisp-4.11 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 14.0 end
update
list [.t index @0,0] $tk_textRelayout $tk_textRedraw
} {6.40 {13.0 7.0 6.80 6.60 6.40} {6.40 6.60 6.80 7.0 13.0}}
} {6.60 {14.0 7.0 6.80 6.60} {6.60 6.80 7.0 14.0}}
test textDisp-4.12 {UpdateDisplayInfo, filling in extra vertical space} {
.t delete 1.0 end
.t insert end "1\n2\n3\n4\n5\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16"
@@ -1147,6 +1156,40 @@ test textDisp-8.11 {TkTextChanged, scrollbar notification when changes are off-s
.t configure -yscrollcommand ""
set scrollInfo
} {0.0 0.625}
test textDisp-8.12 {TkTextChanged, moving the insert cursor redraws only past and new lines} {
.t delete 1.0 end
.t configure -wrap none
for {set i 1} {$i < 25} {incr i} {
.t insert end "Line $i Line $i\n"
}
.t tag add hidden 5.0 8.0
.t tag configure hidden -elide true
.t mark set insert 9.0
update
.t mark set insert 8.0 ; # up one line
update
set res [list $tk_textRedraw]
.t mark set insert 12.2 ; # in the visible text
update
lappend res $tk_textRedraw
.t mark set insert 6.5 ; # in the hidden text
update
lappend res $tk_textRedraw
.t mark set insert 3.5 ; # in the visible text again
update
lappend res $tk_textRedraw
.t mark set insert 3.8 ; # within the same line
update
lappend res $tk_textRedraw
} {{8.0 9.0} {8.0 12.0} {8.0 12.0} {3.0 8.0} {3.0 4.0}}
test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} {
.t delete 1.0 end
.t insert 1.0 \nLine2\nLine3\n
update
.t insert 3.0 ""
.t delete 1.0 2.0
update idletasks
} {}
test textDisp-9.1 {TkTextRedrawTag} {
.t configure -wrap char
@@ -1172,40 +1215,44 @@ test textDisp-9.3 {TkTextRedrawTag} {
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
update
.t tag add big 2.2 2.4
update
.t tag remove big 1.0 end
update
list $tk_textRelayout $tk_textRedraw
} {2.0 2.0}
} {{2.0 2.20} {2.0 2.20 eof}}
test textDisp-9.4 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
update
.t tag add big 2.2 2.20
update
.t tag remove big 1.0 end
update
list $tk_textRelayout $tk_textRedraw
} {2.0 2.0}
} {{2.0 2.20} {2.0 2.20 eof}}
test textDisp-9.5 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4"
update
.t tag add big 2.2 2.end
update
.t tag remove big 1.0 end
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20} {2.0 2.20}}
} {{2.0 2.20} {2.0 2.20 eof}}
test textDisp-9.6 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap"
update
.t tag add big 2.2 3.5
update
.t tag remove big 1.0 end
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 2.20 3.0} {2.0 2.20 3.0}}
} {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}}
test textDisp-9.7 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
@@ -1257,6 +1304,58 @@ test textDisp-9.11 {TkTextRedrawTag} {
update
set tk_textRedraw
} {}
test textDisp-9.12 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 5} {incr i} {
.t insert end "Line $i+++Line $i\n"
}
.t tag configure hidden -elide true
.t tag add hidden 2.6 3.6
update
.t tag add hidden 3.11 4.6
update
list $tk_textRelayout $tk_textRedraw
} {2.0 {2.0 eof}}
test textDisp-9.13 {TkTextRedrawTag} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
.t insert end "Line $i - This is Line [format %c [expr 64+$i]]\n"
}
.t tag add hidden 2.8 2.17
.t tag add hidden 6.8 7.17
.t tag configure hidden -background red
.t tag configure hidden -elide true
update
.t tag configure hidden -elide false
update
list $tk_textRelayout $tk_textRedraw
} {{2.0 6.0 7.0} {2.0 6.0 7.0}}
test textDisp-9.14 {TkTextRedrawTag} {
pack [text .tnocrash]
for {set i 1} {$i < 6} {incr i} {
.tnocrash insert end \nfoo$i
}
.tnocrash tag configure mytag1 -relief raised
.tnocrash tag configure mytag2 -relief solid
update
proc doit {} {
.tnocrash tag add mytag1 4.0 5.0
.tnocrash tag add mytag2 4.0 5.0
after idle {
.tnocrash tag remove mytag1 1.0 end
.tnocrash tag remove mytag2 1.0 end
}
.tnocrash delete 1.0 2.0
}
doit ; # must not crash
after 500 {
destroy .tnocrash
set done 1
}
vwait done
} {}
test textDisp-10.1 {TkTextRelayoutWindow} {
.t configure -wrap char
@@ -1425,7 +1524,7 @@ test textDisp-11.15 {TkTextSetYView, only a few lines visible} {
update
.top.t see 11.0
.top.t index @0,0
# Thie index 9.0 should be just visible by a couple of pixels
# The index 9.0 should be just visible by a couple of pixels
} {9.0}
test textDisp-11.16 {TkTextSetYView, only a few lines visible} {
.top.t yview 8.0
@@ -1438,9 +1537,77 @@ test textDisp-11.17 {TkTextSetYView, only a few lines visible} {
update
.top.t see 4.0
.top.t index @0,0
# Thie index 2.0 should be just visible by a couple of pixels
# The index 2.0 should be just visible by a couple of pixels
} {2.0}
destroy .top
test textDisp-11.18 {TkTextSetYView, see in elided lines} {
.top.t delete 1.0 end
for {set i 1} {$i < 20} {incr i} {
.top.t insert end [string repeat "Line $i" 10]
.top.t insert end "\n"
}
.top.t yview 4.0
.top.t tag add hidden 4.10 "4.10 lineend"
.top.t tag add hidden 5.15 10.3
.top.t tag configure hidden -elide true
update
.top.t see "8.0 lineend"
# The index "8.0 lineend" is on screen despite elided -> no scroll
.top.t index @0,0
} {4.0}
test textDisp-11.19 {TkTextSetYView, see in elided lines} {
.top.t delete 1.0 end
for {set i 1} {$i < 50} {incr i} {
.top.t insert end "Line $i\n"
}
# button just for having a line with a larger height
button .top.t.b -text "Test" -bd 2 -highlightthickness 2
.top.t window create 21.0 -window .top.t.b
.top.t tag add hidden 15.36 21.0
.top.t tag configure hidden -elide true
.top.t configure -height 15
wm geometry .top 300x200+0+0
# Indices 21.0, 17.0 and 15.0 are all on the same display line
# therefore index @0,0 shall be the same for all of them
.top.t see end
update
.top.t see 21.0
update
set ind1 [.top.t index @0,0]
.top.t see end
update
.top.t see 17.0
update
set ind2 [.top.t index @0,0]
.top.t see end
update
.top.t see 15.0
update
set ind3 [.top.t index @0,0]
list [expr {$ind1 == $ind2}] [expr {$ind1 == $ind3}]
} {1 1}
test textDisp-11.20 {TkTextSetYView, see in elided lines} {
.top.t delete 1.0 end
.top.t configure -wrap none
for {set i 1} {$i < 5} {incr i} {
.top.t insert end [string repeat "Line $i " 50]
.top.t insert end "\n"
}
.top.t delete 3.11 3.14
.top.t tag add hidden 3.0 4.0
# this shall not crash (null chunkPtr in TkTextSeeCmd is tested)
.top.t see 3.0
} {}
test textDisp-11.21 {TkTextSetYView, window height smaller than the line height} {
.top.t delete 1.0 end
for {set i 1} {$i <= 10} {incr i} {
.top.t insert end "Line $i\n"
}
set lineheight [font metrics [.top.t cget -font] -linespace]
wm geometry .top 200x[expr {$lineheight / 2}]
update
.top.t see 1.0
.top.t index @0,[expr {$lineheight - 2}]
} {1.0}
.t configure -wrap word
.t delete 50.0 51.0
@@ -1582,6 +1749,29 @@ test textDisp-13.10 {TkTextSeeCmd procedure} {} {
destroy $w
set res
} {}
test textDisp-13.11 {TkTextSeeCmd procedure} {} {
# insertion of a character at end of a line containing multi-byte
# characters and calling see at the line end shall actually show
# this character
toplevel .top2
pack [text .top2.t2 -wrap none]
for {set i 1} {$i < 5} {incr i} {
.top2.t2 insert end [string repeat "Line $i: éèàçù" 5]\n
}
wm geometry .top2 300x200+0+0
update
.top2.t2 see "1.0 lineend"
update
set ref [.top2.t2 index @0,0]
.top2.t2 insert "1.0 lineend" ç
.top2.t2 see "1.0 lineend"
update
set new [.top2.t2 index @0,0]
set res [.top2.t2 compare $ref == $new]
destroy .top2
set res
} {0}
wm geom . {}
.t configure -wrap none
@@ -1854,9 +2044,9 @@ test textDisp-16.18 {TkTextYviewCmd procedure, "moveto" roundoff} {textfonts} {
wm geometry .top1 +0+0
text .top1.t -height 3 -width 4 -wrap none -setgrid 1 -padx 6 \
-spacing3 6
.top1.t insert end "1\n2\n3\n4\n5\n6"
pack .top1.t
update
.top1.t insert end "1\n2\n3\n4\n5\n6"
.top1.t yview moveto 0.3333
set result [.top1.t yview]
destroy .top1
@@ -2018,6 +2208,70 @@ test textDisp-16.40 {text count -xpixels} {
[.t count -xpixels 1.0 "1.0 displaylineend"] \
[.t count -xpixels 1.0 end]
} {35 -35 0 42 42 42 0}
test textDisp-16.41 {text count -xpixels with indices in elided lines} {
set res {}
.t delete 1.0 end
for {set i 1} {$i < 40} {incr i} {
.t insert end [string repeat "Line $i" 20]
.t insert end "\n"
}
.t configure -wrap none
.t tag add hidden 5.15 20.15
.t tag configure hidden -elide true
lappend res [.t count -xpixels 5.15 6.0] \
[.t count -xpixels 5.15 6.1] \
[.t count -xpixels 6.0 6.1] \
[.t count -xpixels 6.1 6.2] \
[.t count -xpixels 6.1 6.0] \
[.t count -xpixels 6.0 7.0] \
[.t count -xpixels 6.1 7.1] \
[.t count -xpixels 15.0 20.15] \
[.t count -xpixels 20.15 20.16] \
[.t count -xpixels 20.16 20.15]
.t tag remove hidden 20.0 20.15
lappend res [expr {[.t count -xpixels 5.0 20.0] != 0}]
} [list 0 0 0 0 0 0 0 0 $fixedWidth -$fixedWidth 1]
test textDisp-16.42 {TkTextYviewCmd procedure with indices in elided lines} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
.t insert end [string repeat "Line $i" 20]
.t insert end "\n"
}
.t tag add hidden 5.15 20.15
.t tag configure hidden -elide true
.t yview 35.0
.t yview scroll [expr {- 15 * $fixedHeight}] pixels
update
.t index @0,0
} {5.0}
test textDisp-16.43 {TkTextYviewCmd procedure with indices in elided lines} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
.t insert end [string repeat "Line $i" 20]
.t insert end "\n"
}
.t tag add hidden 5.15 20.15
.t tag configure hidden -elide true
.t yview 35.0
.t yview scroll -15 units
update
.t index @0,0
} {5.0}
test textDisp-16.44 {TkTextYviewCmd procedure, scroll down, with elided lines} {
.t configure -wrap none
.t delete 1.0 end
foreach x [list 0 1 2 3 4 5 6 7 8 9 0] {
.t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6"
.t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden
}
.t tag configure hidden -elide true ; # 5 hidden lines
update
.t see [expr {5 + [winfo height .t] / $fixedHeight} + 1].0
update
.t index @0,0
} {2.0}
.t delete 1.0 end
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
@@ -2443,7 +2697,7 @@ test textDisp-19.11.23 {TextWidgetCmd procedure, "index +displaylines"} {
[.t index "12.0 +2d lines"] [.t index "11.0 +2d lines"] \
[.t index "13.0 +2d lines"] [.t index "13.0 +3d lines"] \
[.t index "13.0 +4d lines"]
} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 17.0}
} {16.17 16.33 16.28 16.46 16.28 16.49 16.65 16.72}
.t tag remove elide 1.0 end
test textDisp-19.11.24 {TextWidgetCmd procedure, "index +/-displaylines"} {
list [.t index "11.5 + -1 display lines"] \
@@ -2552,6 +2806,63 @@ test textDisp-19.16 {count -ypixels} {
[.t count -ypixels 16.0 "16.0 displaylineend +1c"] \
[.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"]
} [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]]
test textDisp-19.17 {count -ypixels with indices in elided lines} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
.t insert end [string repeat "Line $i" 20]
.t insert end "\n"
}
.t tag add hidden 5.15 20.15
.t tag configure hidden -elide true
set res {}
update
lappend res \
[.t count -ypixels 1.0 6.0] \
[.t count -ypixels 2.0 7.5] \
[.t count -ypixels 5.0 8.5] \
[.t count -ypixels 6.1 6.2] \
[.t count -ypixels 6.1 18.8] \
[.t count -ypixels 18.0 20.50] \
[.t count -ypixels 5.2 20.60] \
[.t count -ypixels 20.60 20.70] \
[.t count -ypixels 5.0 25.0] \
[.t count -ypixels 25.0 5.0] \
[.t count -ypixels 25.4 27.50] \
[.t count -ypixels 35.0 38.0]
.t yview 35.0
lappend res [.t count -ypixels 5.0 25.0]
} [list [expr {4 * $fixedHeight}] [expr {3 * $fixedHeight}] 0 0 0 0 0 0 [expr {5 * $fixedHeight}] [expr {- 5 * $fixedHeight}] [expr {2 * $fixedHeight}] [expr {3 * $fixedHeight}] [expr {5 * $fixedHeight}]]
test textDisp-19.18 {count -ypixels with indices in elided lines} {
.t configure -wrap none
.t delete 1.0 end
for {set i 1} {$i < 100} {incr i} {
.t insert end [string repeat "Line $i" 20]
.t insert end "\n"
}
.t tag add hidden 5.15 20.15
.t tag configure hidden -elide true
.t yview 35.0
set res {}
update
lappend res [.t count -ypixels 5.0 25.0]
.t yview scroll [expr {- 15 * $fixedHeight}] pixels
update
lappend res [.t count -ypixels 5.0 25.0]
} [list [expr {5 * $fixedHeight}] [expr {5 * $fixedHeight}]]
test textDisp-19.19 {count -ypixels with indices in elided lines} {
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 25} {incr i} {
.t insert end [string repeat "Line $i -" 6]
.t insert end "\n"
}
.t tag add hidden 5.27 11.0
.t tag configure hidden -elide true
.t yview 5.0
update
set res [list [.t count -ypixels 5.0 11.0] [.t count -ypixels 5.0 11.20]]
} [list [expr {1 * $fixedHeight}] [expr {2 * $fixedHeight}]]
.t delete 1.0 end
.t insert end "Line 1"
for {set i 2} {$i <= 200} {incr i} {
@@ -2721,6 +3032,42 @@ test textDisp-22.9 {TkTextCharBbox, handling of spacing} {textfonts} {
[.t bbox 1.1] [.t bbox 2.9]
} [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]]
.t tag delete spacing
test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
.t insert end "Line $i - Line [format %c [expr 64+$i]]\n"
}
.t tag add hidden 2.8 2.13
.t tag add hidden 6.8 7.13
.t tag configure hidden -elide true
update
list \
[expr {[lindex [.t bbox 2.9] 0] - [lindex [.t bbox 2.8] 0]}] \
[expr {[lindex [.t bbox 2.10] 0] - [lindex [.t bbox 2.8] 0]}] \
[expr {[lindex [.t bbox 2.13] 0] - [lindex [.t bbox 2.8] 0]}] \
[expr {[lindex [.t bbox 6.9] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 6.10] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 6.13] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 6.14] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 6.15] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 7.0] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 7.1] 0] - [lindex [.t bbox 6.8] 0]}] \
[expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}]
} [list 0 0 0 0 0 0 0 0 0 0 0]
test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfonts} {
.t configure -wrap char
.t delete 1.0 end
for {set i 1} {$i < 10} {incr i} {
.t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr 64+$i]]\n"
}
.t tag add hidden 1.30 2.5
.t tag configure hidden -elide true
update
list \
[expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.4] 0]}] \
[expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.5] 0]}]
} [list 0 0]
.t delete 1.0 end
.t insert end "Line 1"
@@ -3350,7 +3697,7 @@ test textDisp-28.1 {"yview" option with bizarre scroll command} {
set result [.t2.t index @0,0]
update
lappend result [.t2.t index @0,0]
} {6.0 1.0}
} {6.0 2.0}
test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
@@ -3366,7 +3713,7 @@ test textDisp-29.1 {miscellaneous: lines wrap but are still too long} {textfonts
.t2.t window create 1.1 -window .t2.t.f
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
} [list [list 0.0 [expr {14.0/30}]] 300x50+5+[expr {$fixedDiff + 18}] [list 12 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
} [list [list 0.0 [expr {20.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]]
test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
@@ -3379,10 +3726,11 @@ test textDisp-29.2 {miscellaneous: lines wrap but are still too long} {textfonts
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
update
.t2.t xview scroll 1 unit
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
} [list [list [expr {1.0*$fixedWidth/300}] [expr {21.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1 - $fixedWidth}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1 - $fixedWidth}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]]
test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
@@ -3394,6 +3742,7 @@ test textDisp-29.2.1 {miscellaneous: lines wrap but are still too long} {textfon
pack .t2.s -side bottom -fill x
.t2.t insert end 1\n
.t2.t insert end [string repeat "abc" 30]
update
.t2.t xview scroll 5 unit
update
.t2.t xview
@@ -3410,10 +3759,11 @@ test textDisp-29.2.2 {miscellaneous: lines wrap but are still too long} {textfon
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
update
.t2.t xview scroll 2 unit
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
} [list [list [expr {14.0/300}] [expr {154.0/300}]] 300x50+-9+[expr {$fixedDiff + 18}] {}]
} [list [list [expr {2.0*$fixedWidth/300}] [expr {22.0*$fixedWidth/300}]] 300x50+[expr {$twbw + $twht + 1 - 2*$fixedWidth}]+[expr {$twbw + $twht + $fixedHeight + 1}] {}]
test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
@@ -3426,10 +3776,11 @@ test textDisp-29.2.3 {miscellaneous: lines wrap but are still too long} {textfon
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
update
.t2.t xview scroll 7 pixels
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
} [list [list [expr {7.0/300}] 0.49] 300x50+-2+[expr {$fixedDiff + 18}] [list 5 [expr {$fixedDiff + 68}] 7 $fixedHeight]]
} [list [list [expr {7.0/300}] [expr {(20.0*$fixedWidth + 7)/300}]] 300x50+[expr {$twbw + $twht + 1 - 7}]+[expr {$twbw + $twht + $fixedHeight + 1}] [list [expr {$twbw + $twht + $fixedWidth + 1 - 7}] [expr {$twbw + $twht + $fixedHeight + 50 + 1}] $fixedWidth $fixedHeight]]
test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfonts} {
catch {destroy .t2}
toplevel .t2
@@ -3442,10 +3793,11 @@ test textDisp-29.2.4 {miscellaneous: lines wrap but are still too long} {textfon
.t2.t insert end 123
frame .t2.t.f -width 300 -height 50 -bd 2 -relief raised
.t2.t window create 1.1 -window .t2.t.f
update
.t2.t xview scroll 17 pixels
update
list [.t2.t xview] [winfo geom .t2.t.f] [.t2.t bbox 1.3]
} [list [list [expr {17.0/300}] [expr {157.0/300}]] 300x50+-12+[expr {$fixedDiff + 18}] {}]
} [list [list [expr {17.0/300}] [expr {(20.0*$fixedWidth + 17)/300}]] 300x50+[expr {$twbw + $twht + 1 - 17}]+[expr {$twbw + $twht + $fixedHeight + 1}] {}]
test textDisp-29.2.5 {miscellaneous: can show last character} {
catch {destroy .t2}
toplevel .t2
@@ -3786,7 +4138,7 @@ test textDisp-33.2 {one line longer than fits in the widget} {
.tt debug 1
set tk_textHeightCalc ""
.tt insert 1.0 [string repeat "more wrap + " 1]
after 100 ; update
after 100 ; update idletasks
# Nothing should have been recalculated.
set tk_textHeightCalc
} {}
@@ -3866,7 +4218,23 @@ test textDisp-34.1 {Text widgets multi-scrolling problem: Bug 2677890} -setup {
return $result
} -cleanup {
destroy .t1 .sy
} -result {{0.0 1.0} {0.0 1.0} {0.0 1.0} {0.0 0.24}}
} -result {{0.0 0.24} {0.0 0.24} {0.0 0.24} {0.0 0.24}}
test textDisp-35.1 {Init value of charHeight - Dancing scrollbar bug 1499165} -setup {
pack [text .t1] -fill both -expand y -side left
.t insert end "[string repeat a\nb\nc\n 500000]THE END\n"
set res {}
} -body {
.t see 10000.0
after 300 {set fr1 [.t yview] ; set done 1}
vwait done
after 300 {set fr2 [.t yview] ; set done 1}
vwait done
lappend res [expr {[lindex $fr1 0] == [lindex $fr2 0]}]
lappend res [expr {[lindex $fr1 1] == [lindex $fr2 1]}]
} -cleanup {
destroy .t1
} -result {1 1}
deleteWindows
option clear

View File

@@ -242,7 +242,7 @@ test textImage-3.1 {image change propagation} {
set result
} {{base:0 0 5 5} {10:0 0 10 10} {20:0 0 20 20} {40:0 0 40 40}}
test textImage-3.2 {delayed image management} {
test textImage-3.2 {delayed image management, see also bug 1591493} {
catch {
image create photo small -width 5 -height 5
small put red -to 0 0 4 4
@@ -253,11 +253,13 @@ test textImage-3.2 {delayed image management} {
.t image create end -name test
update
set result ""
lappend result [.t bbox test]
foreach {x1 y1 w1 h1} [.t bbox test] {}
lappend result [list $x1 $w1 $h1]
.t image configure test -image small -align top
update
lappend result [.t bbox test]
} {{} {0 0 5 5}}
foreach {x2 y2 w2 h2} [.t bbox test] {}
lappend result [list [expr {$x1==$x2}] [expr {$w2>0}] [expr {$h2>0}]]
} {{0 0 0} {1 1 1}}
# some temporary random tests

View File

@@ -905,6 +905,21 @@ test textIndex-22.12 {text index wordstart, unicode} {
test textIndex-22.13 {text index wordstart, unicode} {
text_test_word wordstart "\uc700\uc700 abc" 8
} 3
test textIndex-22.14 {text index wordstart, unicode, start index at internal segment start} {
catch {destroy .t}
text .t
.t insert end "C'est du texte en fran\u00e7ais\n"
.t insert end "\u042D\u0442\u043E\u0020\u0442\u0435\u043A\u0441\u0442\u0020\u043D\u0430\u0020\u0440\u0443\u0441\u0441\u043A\u043E\u043C"
.t mark set insert 1.23
set res [.t index "1.23 wordstart"]
.t mark set insert 2.16
lappend res [.t index "2.16 wordstart"] [.t index "2.15 wordstart"]
} {1.18 2.13 2.13}
test textIndex-22.15 {text index display wordstart} {
catch {destroy .t}
text .t
.t index "1.0 display wordstart" ; # used to crash
} 1.0
test textIndex-23.1 {text paragraph start} {
pack [text .t2]
@@ -928,6 +943,19 @@ test textIndex-24.1 {text mark prev} {
set res
} {1.0}
test textIndex-25.1 {IndexCountBytesOrdered, bug [3f1f79abcf]} {
pack [text .t2]
.t2 tag configure elided -elide 1
.t2 insert end "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n"
.t2 insert end "11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"
.t2 insert end "21\n22\n23\n25\n26\n27\n28\n29\n30\n31"
.t2 insert end "32\n33\n34\n36\n37\n38\n39" elided
# then this used to crash Tk:
.t2 see end
focus -force .t2 ; # to see the cursor blink
destroy .t2
} {}
# cleanup
rename textimage {}
catch {destroy .t}

View File

@@ -599,6 +599,7 @@ set x3 [expr [lindex $c 0] + [lindex $c 2]/2]
set y3 [expr [lindex $c 1] + [lindex $c 3]/2]
test textTag-15.1 {TkTextBindProc} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
bind .t <ButtonRelease> {lappend x up}
.t tag bind x <ButtonRelease> {lappend x x-up}
.t tag bind y <ButtonRelease> {lappend x y-up}
@@ -618,6 +619,7 @@ test textTag-15.1 {TkTextBindProc} haveCourier12 {
set x
} {x-up up up y-up up}
test textTag-15.2 {TkTextBindProc} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
catch {.t tag delete x}
catch {.t tag delete y}
.t tag bind x <Enter> {lappend x x-enter}
@@ -675,6 +677,7 @@ foreach tag [.t tag names] {
}
.t tag configure big -font $bigFont
test textTag-16.1 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
set x [.t index current]
event gen .t <Motion> -x $x2 -y $y2
@@ -691,6 +694,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} haveCourier12 {
lappend x [.t index current]
} {2.1 3.2 3.2 3.2 3.2 3.2 4.3}
test textTag-16.2 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
event gen .t <Motion> -x $x2 -y $y2
set x [.t index current]
@@ -704,6 +708,7 @@ foreach i {a b c d} {
.t tag bind $i <Leave> "lappend x leave-$i"
}
test textTag-16.3 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -722,6 +727,7 @@ test textTag-16.3 {TkTextPickCurrent procedure} haveCourier12 {
set x
} {enter-a enter-b | leave-b enter-c | leave-a leave-c}
test textTag-16.4 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -742,6 +748,7 @@ foreach i {a b c d} {
.t tag delete $i
}
test textTag-16.5 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -752,6 +759,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} haveCourier12 {
.t index current
} {3.2}
test textTag-16.6 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -763,6 +771,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} haveCourier12 {
.t index current
} {3.1}
test textTag-16.7 {TkTextPickCurrent procedure} haveCourier12 {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
foreach i {a b c d} {
.t tag remove $i 1.0 end
}
@@ -785,6 +794,7 @@ test textTag-17.1 {insert procedure inserts tags} {
catch {destroy .t}
test textTag-18.1 {TkTextPickCurrent tag bindings} {
event generate {} <Motion> -warp 1 -x -1 -y -1; update
text .t -width 30 -height 4 -relief sunken -borderwidth 10 \
-highlightthickness 10 -pady 2
pack .t

View File

@@ -1023,6 +1023,20 @@ test textWind-17.9 {peer widget window configuration} {
set res
} {{-window {} {} {} {}} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} {
catch {destroy .t .f}
pack [text .t]
for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"}
.t window create end -window [frame .f -background red -width 80 -height 80]
.t window create end -window [frame .f2 -background blue -width 80 -height 80]
bind .f <Map> {.t delete .f}
update
# this shall not crash (bug 1501749)
after 100 {.t yview end}
tkwait visibility .f2
update
} {}
catch {destroy .t}
option clear

View File

@@ -468,6 +468,27 @@ test notebook-1817596-3 "insert/configure" -body {
} -result [list [list .nb.l2 .nb.l0 .nb.l1] L2 L0 L1] -cleanup { destroy .nb }
test notebook-readd-1 "add same widget twice" -body {
pack [ttk::notebook .nb]
.nb add [ttk::button .nb.b1] -text "Button"
.nb add .nb.b1
.nb tabs
} -result [list .nb.b1] -cleanup { destroy .nb }
test notebook-readd-2 "add same widget twice, with options" -body {
pack [ttk::notebook .nb]
.nb add [ttk::button .nb.b1] -text "Tab label"
.nb add .nb.b1 -text "Changed tab label"
.nb tabs
} -result [list .nb.b1] -cleanup { destroy .nb }
test notebook-readd-3 "insert same widget twice, with options" -body {
pack [ttk::notebook .nb]
.nb insert end [ttk::button .nb.b1] -text "Tab label"
.nb insert end .nb.b1 -text "Changed tab label"
.nb tabs
} -result [list .nb.b1] -cleanup { destroy .nb }
# See #1343984
test notebook-1343984-1 "don't autoselect on destroy - setup" -body {

View File

@@ -143,8 +143,8 @@ test spinbox-1.8.4 "-validate option: " -setup {
.sb configure -validate all -validatecommand {lappend ::spinbox_test %P}
pack .sb
.sb set 50
focus .sb
after 100 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
focus -force .sb
after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
set ::spinbox_test
} -cleanup {
destroy .sb

View File

@@ -29,7 +29,9 @@ radiobutton .r -text Radiobutton
pack .l .b .c .r
update
test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType win} {
test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType win nonPortable} {
# nonPortable because of [3e3e25f483]: on Win7 first started with a high DPI screen
# the smallest size (i.e. 8) is not available for "MS Sans Serif" font
deleteWindows
image create test image1
image1 changed 0 0 0 0 60 40
@@ -46,7 +48,9 @@ test winbutton-1.1 {TkpComputeButtonGeometry procedure} {testImageType win} {
[winfo reqwidth .b3] [winfo reqheight .b3] \
[winfo reqwidth .b4] [winfo reqheight .b4]
} {68 48 70 50 90 52 90 52}
test winbutton-1.2 {TkpComputeButtonGeometry procedure} win {
test winbutton-1.2 {TkpComputeButtonGeometry procedure} {win nonPortable} {
# nonPortable because of [3e3e25f483]: on Win7 first started with a high DPI screen
# the smallest size (i.e. 8) is not available for "MS Sans Serif" font
deleteWindows
label .b1 -bitmap question -bd 3 -padx 0 -pady 2
button .b2 -bitmap question -bd 3 -padx 0 -pady 2