Import Tk 8.6.12

This commit is contained in:
Steve Dower
2021-11-08 17:28:57 +00:00
parent 070b8750b0
commit c6710de848
290 changed files with 5626 additions and 3660 deletions

View File

@@ -64,7 +64,7 @@ set outline black
}
.t.c bind arc <Any-Leave> {.t.c itemconf current -fill $prevFill -outline $prevOutline}
bind .t.c <1> {markarea %x %y}
bind .t.c <Button-1> {markarea %x %y}
bind .t.c <B1-Motion> {strokearea %x %y}
proc markarea {x y} {
@@ -93,7 +93,7 @@ bind .t.c <3> {puts stdout "%x %y"}
# The code below allows the circle to be move by shift-dragging.
bind .t.c <Shift-1> {
bind .t.c <Shift-Button-1> {
set curx %x
set cury %y
}

File diff suppressed because it is too large Load Diff

View File

@@ -730,6 +730,22 @@ test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setu
set id [.c create rect 0 0 1cm 1cm]
expr {[lindex [.c coords $id] 2]>1}
} -result {1}
test canvas-15.20 {bug [237971ce]} -setup {
destroy .c
canvas .c
} -body {
set id [.c create line {0 0 50 50 100 50}]
.c insert $id end {200 200}
.c coords $id
} -result {0.0 0.0 50.0 50.0 100.0 50.0 200.0 200.0}
test canvas-15.21 {bug [237971ce]} -setup {
destroy .c
canvas .c
} -body {
set id [.c create poly {0 0 50 50 100 50}]
.c insert $id end {200 200}
.c coords $id
} -result {0.0 0.0 50.0 50.0 100.0 50.0 200.0 200.0}
destroy .c
test canvas-16.1 {arc coords check} -setup {

View File

@@ -10,6 +10,8 @@ eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
if {[testConstraint defaultPseudocolor8]} {
# let's soak up a bunch of colors...so that
# machines with small color palettes still fail.
@@ -172,7 +174,7 @@ test clrpick-2.2 {tk_chooseColor command} -constraints {
tk_chooseColor -parent . -title "choose #808040"
} -result {#808040}
test clrpick-2.3 {tk_chooseColor command} -constraints {
nonUnixUserInteraction colorsLeftover
nonUnixUserInteraction colorsLeftover failsOnXQuarz
} -body {
ToPressButton . ok
tk_chooseColor -parent . -title "Press OK"

View File

@@ -172,6 +172,67 @@ namespace eval tk {
return $r
}
#
# CONTROL TIMING ASPECTS OF POINTER WARPING
#
# The proc [controlPointerWarpTiming] takes care of the following timing
# details of pointer warping:
#
# a. Allow pointer warping to happen if it was scheduled for execution at
# idle time.
# - In Tk releases 8.6 and older, pointer warping is scheduled for
# execution at idle time
# - In release 8.7 and newer this happens synchronously and no extra
# control is needed.
# The namespace variable idle_pointer_warping records which of these is
# the case.
#
# b. Work around a race condition associated with OS notification of
# mouse motion on Windows.
#
# When calling [event generate $w $event -warp 1 ...], the following
# sequence occurs:
# - At some point in the processing of this command, either via a
# synchronous execution path, or asynchronously at idle time, Tk calls
# an OS function* to carry out the mouse cursor motion.
# - Tk has previously registered a callback function** with the OS, for
# the OS to call in order to notify Tk when a mouse move is completed.
# - Tk doesn't wait for the callback function to receive the notification
# from the OS, but continues processing. This suits most use cases
# because (usually) the notification comes quickly enough
# (range: a few ms?). However ...
# - A problem arises if Tk performs some processing, immediately following
# up on [event generate $w $event -warp 1 ...], and that processing
# relies on the mouse pointer having actually moved. If such processing
# happens just before the notification from the OS has been received,
# Tk will be using not yet updated info (e.g. mouse coordinates).
#
# Hickup, choke etc ... !
#
# * the function SendInput() of the Win32 API
# ** the callback function is TkWinChildProc()
#
# This timing issue can be addressed by putting the Tk process on hold
# (do nothing at all) for a somewhat extended amount of time, while
# letting the OS complete its job in the meantime. This is what is
# accomplished by calling [after ms].
#
# ----
# For the history of this issue please refer to Tk ticket [69b48f427e],
# specifically the comment on 2019-10-27 14:24:26.
#
variable idle_pointer_warping [expr {![package vsatisfies [package provide Tk] 8.7-]}]
proc controlPointerWarpTiming {{duration 50}} {
variable idle_pointer_warping
if {$idle_pointer_warping} {
update idletasks ;# see a. above
}
if {[tk windowingsystem] eq "win32"} {
after $duration ;# see b. above
}
}
namespace export controlPointerWarpTiming
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -859,6 +859,39 @@ test event-8 {event generate with keysyms corresponding to
deleteWindows
} -result {OK}
test event-9 {no <Enter> event is generated for the container window when its
managed window in which the mouse pointer was inside gets
destroyed - bug 9e1312f32c} -setup {
set res [list ]
set iconified false
if {[winfo ismapped .]} {
wm iconify .
update
set iconified true
}
} -body {
toplevel .top
pack propagate .top 0
bind .top <Enter> {lappend res %W}
pack [frame .top.f -bg green -width 50 -height 50] -anchor se -side bottom
tkwait visibility .top.f
after 50
update
focus -force .top.f
event generate .top.f <Motion> -warp 1 -x 25 -y 25 ; # <Enter> sent to .top and .top.f
controlPointerWarpTiming
update ; # idletasks not enough
destroy .top.f ; # no <Enter> event sent
update
set res
} -cleanup {
deleteWindows
if {$iconified} {
wm deiconify .
update
}
} -result {.top .top.f}
# cleanup
update
unset -nocomplain keypress_lookup

View File

@@ -523,16 +523,16 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup {
destroy .t.f
catch {font delete xyz}
pack [label .t.f]
update
update idletasks
} -body {
font create xyz -family times -size 20
.t.f config -font xyz -text "abcd" -padx 0 -bd 0 -highlightthickness 0
set a1 [font measure xyz "abcd"]
update
update idletasks
set b1 [winfo reqwidth .t.f]
font configure xyz -family helvetica -size 20
set a2 [font measure xyz "abcd"]
update
update idletasks
set b2 [winfo reqwidth .t.f]
expr {$a1==$b1 && $a2==$b2}
} -cleanup {
@@ -2408,6 +2408,147 @@ test font-47.1 {Bug f214b8ad5b} -body {
interp delete two
} -result {}
test font-47.2 {Bug 3049518,TIP 608 - Canvas} -body {
if {"MyFont" ni [font names]} {
font create MyFont -family "Liberation Sans" -size 13
}
set text Hello!
destroy .t.c
set c [canvas .t.c]
set textid [$c create text 20 20 -font MyFont -text $text -anchor nw]
set twidth [font measure MyFont $text]
set theight [font metrics MyFont -linespace]
set circid [$c create polygon \
15 15 \
[expr {15 + $twidth}] 15 \
[expr {15 + $twidth}] [expr {15 + $theight}] \
15 [expr {15 + $theight}] \
-width 1 -joinstyle round -smooth true -fill {} -outline blue]
pack $c -fill both -expand 1 -side top
tkwait visibility $c
# Lamda test functions
set circle_text {{w user_data text circ} {
if {[winfo class $w] ne "Canvas"} {
puts "Wrong widget type: $w"
return
}
if {$user_data ne "FontChanged"} {
return
}
lappend ::results called-$w
lassign [$w bbox $text] x0 y0 x1 y1
set offset 5
set coord [lmap expr {
$x0-5 $y0-5 $x1+5 $y0-5
$x1+5 $y1+5 $x0-5 $y1+5
} {expr $expr}]
if {[catch {$w coord $circ $coord} err]} {
puts Error:$err
}
}}
set waitfor {{tag {time 333}} {after $time incr ::wait4; vwait ::wait4}}
set enclosed {{can id} {$can find enclosed {*}[$can bbox $id]}}
set results {}
apply $circle_text $c FontChanged $textid $circid
bind $c <<TkWorldChanged>> [list apply $circle_text %W %d $textid $circid]
apply $waitfor 1
# Begin test:
set results {}
lappend results [apply $enclosed $c $circid]
font configure MyFont -size 26
apply $waitfor 2
lappend results [apply $enclosed $c $circid]
font configure MyFont -size 9
apply $waitfor 3
lappend results [apply $enclosed $c $circid]
apply $waitfor 4
font configure MyFont -size 12
apply $waitfor 5
lappend results [apply $enclosed $c $circid]
} -cleanup {
destroy $c
unset -nocomplain ::results
} -result {{1 2} called-.t.c {1 2} called-.t.c {1 2} called-.t.c {1 2}}
test font-47.3 {Bug 3049518, TIP 608 - Label} -body {
if {"MyFont" ni [font names]} {
font create MyFont -family "Liberation Sans" -size 13
}
set text "Label Test"
destroy .t.l
set make-img {{size} {
set img [image create photo -width $size -height $size]
$img blank
set max [expr {$size - 1}]
for {set x 0} {$x < $size} {incr x} {
$img put red -to $x $x
$img put black -to 0 $x
$img put black -to $x 0
$img put black -to $max $x
$img put black -to $x $max
}
return $img
}}
set testWorldChanged {{w user_data} {
global make-img
if {$user_data ne "FontChanged"} {
return
}
if {![winfo exists $w] || [winfo class $w] ne "Label"} {
return
}
if {[$w cget -image] ne ""} {
image delete [$w cget -image]
}
set size [font metrics [$w cget -font] -linespace]
set img [apply ${make-img} $size]
$w configure -image $img
}}
set waitfor {{tag {time 500}} {
after $time incr ::wait4
vwait ::wait4
}}
set check {{w} {
global results
set f [$w cget -font]
set i [$w cget -image]
set fs [font metrics $f -linespace]
set ish [image height $i]
set isw [image width $i]
lappend results [list [expr {$fs == $ish ? 1 : [list $fs $ish]}] [expr {$fs == $isw ? 1 : [list $fs $isw]}]]
}}
set size [font metrics MyFont -linespace]
set img [apply ${make-img} $size]
set l [label .t.l -compound left -image $img -text $text -font MyFont]
pack $l -side top -fill both -expand 1
bind $l <<TkWorldChanged>> [list apply $testWorldChanged %W %d]
set ::results {}
apply $waitfor 0
apply $check $l
font configure MyFont -size 26
apply $waitfor 1
apply $check $l
font configure MyFont -size 9
apply $waitfor 2
apply $check $l
font configure MyFont -size 13
apply $waitfor 3
apply $check $l
set results
} -cleanup {
destroy $l
unset -nocomplain ::results
} -result {{1 1} {1 1} {1 1} {1 1}}
# cleanup
cleanupTests
return

View File

@@ -107,7 +107,7 @@ test grab-2.1 {Tk_GrabObjCmd, grab status gives correct status} -body {
grab status .
} -cleanup {
grab release .
} -result {none}
} -result none
test grab-2.2 {Tk_GrabObjCmd, grab status gives correct status} -body {
set curr [grab current .]
if { [string length $curr] > 0 } {

File diff suppressed because it is too large Load Diff

View File

@@ -561,7 +561,7 @@ test menuDraw-15.2 {TkPostTearoffMenu - Deactivation} -setup {
$tearoff index active
} -cleanup {
deleteWindows
} -result {none}
} -result none
test menuDraw-15.3 {TkPostTearoffMenu - post command} -setup {
deleteWindows
} -body {

View File

@@ -71,7 +71,7 @@ test menubutton-1.9 {configuration options} -body {
.mb cget -bd
} -cleanup {
.mb configure -bd [lindex [.mb configure -bd] 3]
} -result {4}
} -result 4
test menubutton-1.10 {configuration options} -body {
.mb configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -98,7 +98,7 @@ test menubutton-1.15 {configuration options} -body {
.mb cget -borderwidth
} -cleanup {
.mb configure -borderwidth [lindex [.mb configure -borderwidth] 3]
} -result {1}
} -result 1
test menubutton-1.16 {configuration options} -body {
.mb configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -158,7 +158,7 @@ test menubutton-1.28 {configuration options} -body {
.mb cget -height
} -cleanup {
.mb configure -height [lindex [.mb configure -height] 3]
} -result {18}
} -result 18
test menubutton-1.29 {configuration options} -body {
.mb configure -height 20.0
} -returnCodes error -result {expected integer but got "20.0"}
@@ -185,7 +185,7 @@ test menubutton-1.34 {configuration options} -body {
.mb cget -highlightthickness
} -cleanup {
.mb configure -highlightthickness [lindex [.mb configure -highlightthickness] 3]
} -result {18}
} -result 18
test menubutton-1.35 {configuration options} -body {
.mb configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
@@ -213,7 +213,7 @@ test menubutton-1.38 {configuration options} -body {
.mb cget -indicatoron
} -cleanup {
.mb configure -indicatoron [lindex [.mb configure -indicatoron] 3]
} -result {1}
} -result 1
test menubutton-1.39 {configuration options} -body {
.mb configure -indicatoron no_way
} -returnCodes error -result {expected boolean value but got "no_way"}
@@ -237,7 +237,7 @@ test menubutton-1.43 {configuration options} -body {
.mb cget -padx
} -cleanup {
.mb configure -padx [lindex [.mb configure -padx] 3]
} -result {12}
} -result 12
test menubutton-1.44 {configuration options} -body {
.mb configure -padx 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -246,7 +246,7 @@ test menubutton-1.45 {configuration options} -body {
.mb cget -pady
} -cleanup {
.mb configure -pady [lindex [.mb configure -pady] 3]
} -result {12}
} -result 12
test menubutton-1.46 {configuration options} -body {
.mb configure -pady 420x
} -returnCodes error -result {bad screen distance "420x"}
@@ -291,7 +291,7 @@ test menubutton-1.54 {configuration options} -body {
.mb cget -underline
} -cleanup {
.mb configure -underline [lindex [.mb configure -underline] 3]
} -result {5}
} -result 5
test menubutton-1.55 {configuration options} -body {
.mb configure -underline 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -300,7 +300,7 @@ test menubutton-1.56 {configuration options} -body {
.mb cget -width
} -cleanup {
.mb configure -width [lindex [.mb configure -width] 3]
} -result {402}
} -result 402
test menubutton-1.57 {configuration options} -body {
.mb configure -width 3p
} -returnCodes error -result {expected integer but got "3p"}
@@ -309,7 +309,7 @@ test menubutton-1.58 {configuration options} -body {
.mb cget -wraplength
} -cleanup {
.mb configure -wraplength [lindex [.mb configure -wraplength] 3]
} -result {100}
} -result 100
test menubutton-1.59 {configuration options} -body {
.mb configure -wraplength 6x
} -returnCodes error -result {bad screen distance "6x"}
@@ -364,10 +364,10 @@ test menubutton-3.5 {ButtonWidgetCmd procedure, "cget" option} -body {
test menubutton-3.6 {ButtonWidgetCmd procedure, "cget" option} -body {
.mb configure -highlightthickness 3
.mb cget -highlightthickness
} -result {3}
} -result 3
test menubutton-3.7 {ButtonWidgetCmd procedure, "configure" option} -body {
llength [.mb configure]
} -result {33}
} -result 33
test menubutton-3.8 {ButtonWidgetCmd procedure, "configure" option} -body {
.mb configure -gorp
} -returnCodes error -result {unknown option "-gorp"}

View File

@@ -1473,17 +1473,18 @@ test scale-20.3 {Bug [2262543fff] - Scale widget unexpectedly fires command call
test scale-20.4 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 4} -setup {
catch {destroy .s}
set res {}
set commandedVar -1
} -body {
scale .s -from 1 -to 50 -command {set commandedVar}
.s set 10
pack .s
update idletasks
.s set 10
set timeout [after 500 {set $commandedVar "timeout"}]
set commandedVar -1
vwait commandedVar ; # -command callback shall fire
set res [list [.s get] $commandedVar]
} -cleanup {
destroy .s
after cancel $timeout
destroy .s
} -result {10 10}
test scale-20.5 {Bug [2262543fff] - Scale widget unexpectedly fires command callback, case 5} -setup {
catch {destroy .s}
@@ -1492,6 +1493,7 @@ test scale-20.5 {Bug [2262543fff] - Scale widget unexpectedly fires command call
} -body {
scale .s -from 1 -to 50
pack .s
update idletasks
.s set 10
.s configure -command {set commandedVar}
update ; # -command callback shall NOT fire
@@ -1506,6 +1508,7 @@ test scale-20.6 {Bug [2262543fff] - Scale widget unexpectedly fires command call
} -body {
scale .s -from 1 -to 50
pack .s
update idletasks
.s configure -command {set commandedVar}
.s set 10
set timeout [after 500 {set $commandedVar "timeout"}]
@@ -1522,6 +1525,7 @@ test scale-20.7 {Bug [2262543fff] - Scale widget unexpectedly fires command call
} -body {
scale .s -from 1 -to 50 -command {set commandedVar}
pack .s
update idletasks
.s set 10
set timeout [after 500 {set $commandedVar "timeout"}]
vwait commandedVar ; # -command callback shall fire
@@ -1538,6 +1542,7 @@ test scale-20.8 {Bug [2262543fff] - Scale widget unexpectedly fires command call
} -body {
scale .s -from 1 -to 50 -variable scaleVar -command {set commandedVar}
pack .s
update idletasks
.s set 10
set timeout [after 500 {set $commandedVar "timeout"}]
vwait commandedVar ; # -command callback shall fire

View File

@@ -16,6 +16,7 @@ tcltest::loadTestedCommands
testConstraint xhost [llength [auto_execok xhost]]
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
# Compute a script that will load Tk into a child interpreter.
@@ -297,7 +298,7 @@ test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver te
"if 1 {open bogus_file_name}"
invoked from within
"send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}}
test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu} {
test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu failsOnXQuarz} {
testsend prop root InterpRegistry "10234 bogus\n"
set result [list [catch {send bogus bogus command} msg] $msg]
winfo interps

View File

@@ -7419,10 +7419,10 @@ test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup {
.pt delete 2.0 3.0
# moreover -startline shall be correct
# (was wrong before fixing bug 1630262)
lappend res [.t cget -start] [.pt cget -start]
lappend res [.t cget -start] [.pt cget -start] [.t get @0,0 "@0,0 lineend"]
} -cleanup {
destroy .pt
} -result {4 3}
} -result {4 3 {Line 5}}
test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup {
destroy .t .pt

View File

@@ -598,7 +598,7 @@ test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} {textfonts} {
list [.t bbox 2.0] [.t bbox 2.25] [.t bbox 3.0] $tk_textRelayout
} [list [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 7 $fixedHeight] {1.0 2.0 3.0}]
test textDisp-4.5 {UpdateDisplayInfo, tiny window} {textfonts} {
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 1
}
wm geom . 103x$height
@@ -609,7 +609,7 @@ test textDisp-4.5 {UpdateDisplayInfo, tiny window} {textfonts} {
updateText
list [.t bbox 2.0] [.t bbox 2.1] [.t bbox 3.0] $tk_textRelayout
} [list [list 5 [expr {$fixedDiff + 18}] 1 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 1 $fixedHeight] {1.0 2.0 3.0}]
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 0
}
test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
@@ -620,7 +620,7 @@ test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 1
}
frame .f2 -width 20 -height 100
@@ -652,7 +652,7 @@ test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 1
}
.t delete 1.0 end
@@ -1341,11 +1341,11 @@ test textDisp-9.10 {TkTextRedrawTag} {
.t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4"
.t tag add big 1.0 2.0
updateText
set tk_textRedraw {none}
set tk_textRedraw none
.t tag add big 1.3 1.5
updateText
set tk_textRedraw
} {none}
} none
test textDisp-9.11 {TkTextRedrawTag} {
.t configure -wrap char
.t delete 1.0 end
@@ -1660,6 +1660,21 @@ test textDisp-11.21 {TkTextSetYView, window height smaller than the line height}
.top.t see 1.0
.top.t index @0,[expr {$lineheight - 2}]
} {1.0}
test textDisp-11.22 {TkTextSetYView, peer has -startline} {
.top.t delete 1.0 end
for {set i 1} {$i <= 50} {incr i} {
.top.t insert end "Line $i\n"
}
pack [.top.t peer create .top.p] -side left
pack [scrollbar .top.sb -command {.top.p yview}] -side left -fill y
.top.p configure -startline 5 -endline 35 -yscrollcommand {.top.sb set}
updateText
.top.p yview moveto 0
updateText
set res [.top.p get @0,0 "@0,0 lineend"]
destroy .top.p
set res
} {Line 5}
.t configure -wrap word
.t delete 50.0 51.0
@@ -2352,45 +2367,61 @@ test textDisp-17.5 {TkTextScanCmd procedure} {
test textDisp-17.6 {TkTextScanCmd procedure} {textfonts} {
.t yview 1.0
.t xview moveto 0
updateText
.t scan mark 40 60
.t scan dragto 35 55
updateText
.t index @0,0
} {4.7}
test textDisp-17.7 {TkTextScanCmd procedure} {textfonts} {
.t yview 10.0
.t xview moveto 0
updateText
.t xview scroll 20 units
updateText
.t scan mark -10 60
.t scan dragto -5 65
updateText
.t index @0,0
set x [.t index @0,0]
.t scan dragto 0 [expr {70 + $fixedDiff}]
updateText
list $x [.t index @0,0]
} {6.12 2.5}
test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} {
.t yview 1.0
.t xview moveto 0
updateText
.t scan mark 0 60
.t scan dragto 30 100
updateText
.t scan dragto 25 95
updateText
.t index @0,0
} {4.7}
test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} {
.t yview end
.t xview moveto 0
updateText
.t xview scroll 100 units
updateText
.t scan mark 90 60
.t scan dragto 10 0
updateText
.t scan dragto 14 5
updateText
.t index @0,0
} {18.44}
} {14.44}
.t configure -wrap word
test textDisp-17.10 {TkTextScanCmd procedure, word wrapping} {textfonts} {
.t yview 10.0
updateText
.t scan mark -10 60
.t scan dragto -5 65
updateText
set x [.t index @0,0]
.t scan dragto 0 [expr {70 + $fixedDiff}]
updateText
list $x [.t index @0,0]
} {9.0 8.0}
.t configure -xscrollcommand scroll -yscrollcommand {}
@@ -3318,7 +3349,7 @@ test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} {
list [.t bbox 1.19] [.t bbox 1.20]
} [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]]
test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} {
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 1
}
.t configure -wrap char
@@ -3328,7 +3359,7 @@ test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} {
updateText
list [.t bbox 1.0] [.t bbox 1.1] [.t bbox 1.2]
} [list [list 3 3 1 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 1 $fixedHeight] [list 3 [expr {2*$fixedDiff + 29}] 1 $fixedHeight]]
if {$tcl_platform(platform) == "windows"} {
if {[tk windowingsystem] == "win32"} {
wm overrideredirect . 0
}
test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {textfonts} {
@@ -3654,7 +3685,7 @@ test textDisp-27.6 {SizeOfTab procedure, center alignment} {textfonts} {
.t tag add x 1.0 end
list [.t bbox 1.6] [.t bbox 1.7]
} [list [list 32 [expr {$fixedDiff + 18}] 7 $fixedHeight] [list 39 [expr {$fixedDiff + 18}] 7 $fixedHeight]]
test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {textfonts} {
test textDisp-27.7 {SizeOfTab procedure, center alignment, wrap -none (potential numerical problems)} {textfonts failsOnXQuarz} {
.t delete 1.0 end
set cm [winfo fpixels .t 1c]
.t configure -tabs {1c 2c center 3c 4c 5c 6c 7c 8c} -wrap none -width 40

View File

@@ -834,6 +834,18 @@ test textIndex-19.13 {Display lines} {
destroy .txt .sbar
} {}
test textIndex-19.14 {Display lines with elided lines} {
catch {destroy .t}
pack [text .t]
for {set n 1} {$n <= 1000} {incr n} {
.t insert end "Line $n\n"
}
.t tag configure Elided -elide 1
.t tag add Elided 6.0 951.0
update
set res [.t index "951.0 + 1 displaylines"]
} {952.0}
proc text_test_word {startend chars start} {
destroy .t
text .t
@@ -964,6 +976,43 @@ test textIndex-25.1 {IndexCountBytesOrdered, bug [3f1f79abcf]} {
destroy .t2
} {}
test textIndex-26.1 {GetIndex restricts the returned index to -starline/-endline in peers, bug [34db75c0ac]} {
set res {}
pack [text .t2]
.t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"
pack [.t2 peer create .p2 -startline 2 -endline 3]
lappend res [.p2 index "end"]
lappend res [.p2 index "end lineend"]
lappend res [.p2 index "end display lineend"]
destroy .t2 .p2
set res
} {2.0 2.0 2.0}
test textIndex-26.2 {GetIndex errors out if mark, image, window, or tag is outside peer -starline/-endline, bug [34db75c0ac]} {
set res {}
pack [text .t2]
.t2 insert end "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\n"
pack [.t2 peer create .p2 -startline 2 -endline 3]
.p2 configure -startline 3 -endline {}
.t2 mark set mymark 1.0
catch {.p2 index mymark} msg
lappend res [.t2 index mymark] $msg
image create photo redsquare -width 5 -height 5
redsquare put red -to 0 0 4 4
.t2 image create 1.0 -image redsquare
catch {.p2 index redsquare} msg
lappend res [.t2 index redsquare] $msg
frame .f -width 10 -height 10 -bg blue
.t2 window create 1.2 -window .f
catch {.p2 index .f} msg
lappend res [.t2 index .f] $msg
.t2 tag add mytag 1.3
catch {.p2 index mytag.first} msg
lappend res [.t2 index mytag.first] $msg
destroy .t2 .p2
set res
} {1.0 {bad text index "mymark"} 1.0 {bad text index "redsquare"} 1.2\
{bad text index ".f"} 1.3 {text doesn't contain any characters tagged with "mytag"}}
# cleanup
rename textimage {}
catch {destroy .t}

View File

@@ -182,6 +182,17 @@ test textMark-6.5 {insert and current marks in an empty peer - bug 3487407} -bod
} -cleanup {
.t configure -startline {} -endline {}
} -result {1.0}
test textMark-6.6 {attempt to move the insert mark beyond peer -endline - bug 34db75c0ac} -body {
.t peer create .p -startline 1 -endline 2
pack .p
update
.p mark set insert 1.2
focus -force .p
event generate .p <<NextLine>> ; # shall not error out
set res [.p index insert]
} -cleanup {
destroy .p
} -result {1.9}
test textMark-7.1 {MarkFindNext - invalid mark name} -body {
.t mark next bogus

View File

@@ -1492,7 +1492,8 @@ set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}]
test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
bind .t <ButtonRelease> {lappend x up}
.t tag bind x <ButtonRelease> {lappend x x-up}
@@ -1518,7 +1519,8 @@ test textTag-15.1 {TkTextBindProc} -constraints haveCourier12 -setup {
test textTag-15.2 {TkTextBindProc} -constraints haveCourier12 -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag bind x <Enter> {lappend x x-enter}
.t tag bind x <ButtonPress> {lappend x x-down}
@@ -1547,7 +1549,8 @@ test textTag-15.2 {TkTextBindProc} -constraints haveCourier12 -setup {
test textTag-15.3 {TkTextBindProc} -constraints haveCourier12 -setup {
.t tag delete x y
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag bind x <Enter> {lappend x x-enter}
.t tag bind x <Any-ButtonPress-1> {lappend x x-down}
@@ -1583,7 +1586,8 @@ test textTag-16.1 {TkTextPickCurrent procedure} -constraints {
} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1
set x [.t index current]
@@ -1606,9 +1610,12 @@ test textTag-16.2 {TkTextPickCurrent procedure} -constraints {
} -setup {
.t tag delete {*}[.t tag names]
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag configure big -font $bigFont
# update needed here to stabilize the test
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]
@@ -1626,7 +1633,8 @@ test textTag-16.3 {TkTextPickCurrent procedure} -constraints {
.t tag remove $i 1.0 end
}
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
foreach i {a b c d} {
.t tag bind $i <Enter> "lappend x enter-$i"
@@ -1656,7 +1664,8 @@ test textTag-16.4 {TkTextPickCurrent procedure} -constraints {
.t tag remove $i 1.0 end
}
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
foreach i {a b c d} {
.t tag bind $i <Enter> "lappend x enter-$i"
@@ -1685,7 +1694,8 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints {
.t tag remove $i 1.0 end
}
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag configure big -font $bigFont
event gen .t <Motion> -x $x1 -y $y1
@@ -1704,7 +1714,8 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints {
.t tag remove $i 1.0 end
}
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag configure big -font $bigFont
event gen .t <Motion> -x $x1 -y $y1
@@ -1724,7 +1735,8 @@ test textTag-16.7 {TkTextPickCurrent procedure} -constraints {
.t tag remove $i 1.0 end
}
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
.t tag configure big -font $bigFont
.t tag bind a <Enter> {.t tag add big 3.0 3.2}
@@ -1755,7 +1767,8 @@ test textTag-17.1 {insert procedure inserts tags} -setup {
test textTag-18.1 {TkTextPickCurrent tag bindings} -setup {
destroy .t
wm geometry . +200+200 ; update
event generate {} <Motion> -warp 1 -x 5 -y 5 ; update idletasks ; after 50
event generate {} <Motion> -warp 1 -x 5 -y 5
controlPointerWarpTiming
} -body {
text .t -width 30 -height 4 -relief sunken -borderwidth 10 \
-highlightthickness 10 -pady 2
@@ -1772,13 +1785,17 @@ test textTag-18.1 {TkTextPickCurrent tag bindings} -setup {
set res {}
# Bindings must not trigger on the widget border, only over
# the actual tagged characters themselves.
# Note that we don't need to call controlPointerWarpTiming
# in the following six calls because we're not checking that
# the mouse pointer has actually moved but rather that the
# tag binding mechanism of the text widget correctly triggers.
event gen .t <Motion> -warp 1 -x 0 -y 0 ; update
event gen .t <Motion> -warp 1 -x 10 -y 10 ; update
event gen .t <Motion> -warp 1 -x 25 -y 25 ; update
event gen .t <Motion> -warp 1 -x 20 -y 20 ; update
event gen .t <Motion> -warp 1 -x 10 -y 10 ; update
event gen .t <Motion> -warp 1 -x 25 -y 25 ; update
return $res
set res
} -cleanup {
destroy .t
} -result {Enter {25 25 tag-Enter} {20 20 tag-Leave} {25 25 tag-Enter}}

View File

@@ -1406,7 +1406,7 @@ test textWind-17.1 {peer widgets and embedded windows} -setup {
.t window create 1.3 -window .f
toplevel .tt
pack [.t peer create .tt.t]
update ; update
update
destroy .t .tt
winfo exists .f
} -result {0}
@@ -1420,7 +1420,7 @@ test textWind-17.2 {peer widgets and embedded windows} -setup {
.t window create 1.4 -window .f
toplevel .tt
pack [.t peer create .tt.t]
update ; update
update
destroy .t
.tt.t insert 1.0 "foo"
update
@@ -1435,7 +1435,7 @@ test textWind-17.3 {peer widget and -create} -setup {
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
update ; update
update
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
update
destroy .t .tt
@@ -1451,7 +1451,7 @@ test textWind-17.4 {peer widget deleted one window shouldn't delete others} -set
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
update ; update
update
destroy .tt
lappend res [.t get 1.2]
update
@@ -1469,7 +1469,7 @@ test textWind-17.5 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
update ; update
update
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1484,7 +1484,7 @@ test textWind-17.6 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
update ; update
update
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1500,7 +1500,7 @@ test textWind-17.7 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
update ; update
update
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1515,7 +1515,7 @@ test textWind-17.8 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
update ; update
update
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1531,7 +1531,7 @@ test textWind-17.9 {peer widget window configuration} -setup {
toplevel .tt
pack [.t peer create .tt.t]
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
update ; update
update
.tt.t window configure 1.2 -window [frame .tt.t.f -width 10 -height 20 -bg red]
list [.t window configure 1.2 -window] [.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1541,26 +1541,34 @@ test textWind-17.9 {peer widget window configuration} -setup {
test textWind-17.10 {peer widget window configuration} -setup {
destroy .t .tt
} -body {
set res {}
pack [text .t]
.t delete 1.0 end
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
update idletasks
.t window create 1.2 -window [frame .t.f -width 10 -height 20 -bg blue]
update idletasks
# There should be a window in the main widget but not in the peer.
lappend res [.t window configure 1.2 -window]
lappend res [.tt.t window configure 1.2 -window]
.tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg blue]
update ; update
.t window configure 1.2 -create \
{destroy %W.f ; frame %W.f -width 50 -height 7 -bg red}
.tt.t window configure 1.2 -window {}
update idletasks
.t window configure 1.2 -create {destroy %W.f ; frame %W.f -width 50 -height 7 -bg red}
update idletasks
# The main widget should not have changed.
lappend res [.t window configure 1.2 -window]
.t window configure 1.2 -window {}
set res [list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]]
.tt.t window configure 1.2 -window {}
update
lappend res [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
# Nothing should have changed.
lappend res [.t window configure 1.2 -window]
lappend res [.tt.t window configure 1.2 -window]
} -cleanup {
destroy .tt .t
} -result {{-window {} {} {} {}} {-window {} {} {} {}} {-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
} -result {{-window {} {} {} .t.f} {-window {} {} {} {}} {-window {} {} {} .t.f}\
{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -setup {
catch {destroy .t .f .f2}

View File

@@ -157,7 +157,7 @@ test tk-6.5 {tk inactive} -body {
update
after 100
set i [tk inactive]
expr {$i < 0 || ( $i > 90 && $i < 200 )}
expr {$i < 0 || ( $i > 90 && $i < 300 )}
} -result 1
test tk-7.1 {tk inactive in a safe interpreter} -body {

View File

@@ -8,6 +8,7 @@ namespace import -force tcltest::*
loadTestedCommands
testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
variable scrollInfo
proc scroll args {
@@ -77,7 +78,7 @@ test entry-2.1 "Create entry before scrollbar" -body {
-expand false -fill x
} -cleanup {destroy .te .tsb}
test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints failsOnUbuntu -body {
test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints {failsOnUbuntu failsOnXQuarz} -body {
pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
-expand true -fill both
.te insert end [string repeat "abc" 50]

View File

@@ -127,7 +127,7 @@ test spinbox-1.8.2 "option -validate" -setup {
.sb cget -validate
} -cleanup {
destroy .sb
} -result {none}
} -result none
test spinbox-1.8.3 "option -validate" -setup {
ttk::spinbox .sb -from 0 -to 100
@@ -138,14 +138,18 @@ test spinbox-1.8.3 "option -validate" -setup {
} -returnCodes error -result {bad validate "bogus": must be all, key, focus, focusin, focusout, or none}
test spinbox-1.8.4 "-validate option: " -setup {
set ::spinbox_test {}
ttk::spinbox .sb -from 0 -to 100
set ::spinbox_test {}
} -body {
.sb configure -validate all -validatecommand {lappend ::spinbox_test %P}
.sb configure -validate all -validatecommand {set ::spinbox_test %P}
pack .sb
update idletasks
.sb set 50
focus -force .sb
after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait
set ::spinbox_wait 0
set timer [after 100 {set ::spinbox_wait 1}]
vwait ::spinbox_wait
after cancel $timer
set ::spinbox_test
} -cleanup {
destroy .sb

View File

@@ -78,54 +78,63 @@ test validate-1.7 {entry widget validation - vmode focus} -body {
} -result {}
test validate-1.8 {entry widget validation - vmode focus} -body {
set ::vVals {}
set timer [after 300 lappend ::vVals timeout]
focus -force .e
# update necessary to process FocusIn event
update
vwait ::vVals
after cancel $timer
set ::vVals
} -result {.e -1 -1 abcd abcd {} focus focusin}
test validate-1.9 {entry widget validation - vmode focus} -body {
set ::vVals {}
set timer [after 300 lappend ::vVals timeout]
focus -force .
# update necessary to process FocusOut event
update
vwait ::vVals
after cancel $timer
set ::vVals
} -result {.e -1 -1 abcd abcd {} focus focusout}
.e configure -validate all
test validate-1.10 {entry widget validation - vmode all} -body {
set ::vVals {}
set timer [after 300 lappend ::vVals timeout]
focus -force .e
# update necessary to process FocusIn event
update
vwait ::vVals
after cancel $timer
set ::vVals
} -result {.e -1 -1 abcd abcd {} all focusin}
test validate-1.11 {entry widget validation} -body {
set ::vVals {}
set timer [after 300 lappend ::vVals timeout]
focus -force .
# update necessary to process FocusOut event
update
vwait ::vVals
after cancel $timer
set ::vVals
} -result {.e -1 -1 abcd abcd {} all focusout}
.e configure -validate focusin
test validate-1.12 {entry widget validation} -body {
set ::vVals {}
set timer [after 300 lappend ::vVals timeout]
focus -force .e
# update necessary to process FocusIn event
update
vwait ::vVals
after cancel $timer
set ::vVals
} -result {.e -1 -1 abcd abcd {} focusin focusin}
test validate-1.13 {entry widget validation} -body {
set ::vVals {}
focus -force .
# update necessary to process FocusOut event
update
set ::vVals
} -result {}
.e configure -validate focuso
test validate-1.14 {entry widget validation} -body {
set ::vVals {}
focus -force .e
# update necessary to process FocusIn event
update
set ::vVals
} -result {}

View File

@@ -1301,6 +1301,7 @@ test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints {
wm geometry .main 200x400+100+100
update idletasks
focus -force .main
after 100
set x [expr {[winfo x .main ] + [winfo x .main.b] + 40}]
set y [expr {[winfo y .main ] + [winfo y .main.b] + 38}]
lappend result [winfo containing $x $y]

View File

@@ -33,24 +33,27 @@ proc makeToplevels {} {
}
}
# On macOS windows are not allowed to overlap the menubar at the top
# of the screen. So tests which move a window and then check whether
# it got moved to the requested location should use a y coordinate
# larger than the height of the menubar (normally 23 pixels).
# On macOS windows are not allowed to overlap the menubar at the top of the
# screen or the dock. So tests which move a window and then check whether it
# got moved to the requested location should use a y coordinate larger than the
# height of the menubar (normally 23 pixels) and an x coordinate larger than the
# width of the dock, if it happens to be on the left.
if {[tk windowingsystem] eq "aqua"} {
set mb [expr [menubarheight] + 1]
set X 100
set Y0 $mb
set Y2 [expr $mb + 2]
set Y5 [expr $mb + 5]
} else {
set X 20
set Y0 0
set Y2 2
set Y5 5
}
set i 1
foreach geom "+$Y0+80 +80+$Y0 +0+$Y0" {
foreach geom "+$X+80 +80+$Y0 +$X+$Y0" {
destroy .t
test unixWm-1.$i {initial window position} unix {
toplevel .t -width 200 -height 150
@@ -104,7 +107,7 @@ foreach geom "+20+80 +80+$Y0 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" {
}
set i 1
foreach geom "+20+80 +100+40 +0+$Y0" {
foreach geom "+$X+80 +$X+40 +$X+$Y0" {
test unixWm-4.$i {moving window while withdrawn} unix {
wm withdraw .t
update idletasks
@@ -188,27 +191,27 @@ test unixWm-5.7 {compounded state changes} {unix nonPortable} {
destroy .t
toplevel .t -width 200 -height 100
wm geom .t +10+$Y0
wm geom .t +100+$Y0
wm minsize .t 1 1
update
test unixWm-6.1 {size changes} unix {
.t config -width 180 -height 150
update
wm geom .t
} 180x150+10+$Y0
} 180x150+100+$Y0
test unixWm-6.2 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
update
wm geom .t
} 250x60+10+$Y0
} 250x60+100+$Y0
test unixWm-6.3 {size changes} unix {
wm geom .t 250x60
.t config -width 170 -height 140
wm geom .t {}
update
wm geom .t
} 170x140+10+$Y0
} 170x140+100+$Y0
test unixWm-6.4 {size changes} {unix nonPortable userInteraction} {
wm minsize .t 1 1
update
@@ -290,7 +293,7 @@ test unixWm-8.3 {icon windows} unix {
toplevel .t -width 100 -height 30
list [catch {wm iconwindow .t b c} msg] $msg
} {1 {wrong # args: should be "wm iconwindow window ?pathName?"}}
test unixWm-8.4 {icon windows} {unix failsOnUbuntu} {
test unixWm-8.4 {icon windows} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t
destroy .icon
toplevel .t -width 100 -height 30
@@ -635,7 +638,7 @@ test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix {
destroy .icon
set result
} {1 {can't deiconify .icon: it is an icon for .t}}
test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu} {
test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu failsOnXQuarz} {
wm iconify .t
set result {}
lappend result [winfo ismapped .t] [wm state .t]
@@ -854,7 +857,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix {
destroy .t2
set result
} {1 {can't iconify .t2: it is an icon for .t}}
test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} {
test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t2
toplevel .t2
wm geom .t2 +0+0
@@ -865,7 +868,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} {
destroy .t2
set result
} {0}
test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} {
test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t2
toplevel .t2
wm geom .t2 -0+0
@@ -1364,14 +1367,14 @@ test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on gr
test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix {
destroy .t
toplevel .t
wm geometry .t 200x100+0+$Y0
wm geometry .t 200x100+100+$Y0
listbox .t.l -height 20 -width 20
pack .t.l -fill both -expand 1
update
.t.l configure -setgrid 1
update
wm geometry .t
} "20x20+0+$Y0"
} "20x20+100+$Y0"
test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix {
destroy .t
@@ -1436,7 +1439,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix {
# No tests for ReparentEvent or ComputeReparentGeometry; I can't figure
# out how to exercise these procedures reliably.
test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu} {
test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t
toplevel .t -width 400 -height 150
wm geometry .t +0+0
@@ -1960,7 +1963,7 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix {
[winfo containing [expr $x + 350] $y] \
[winfo containing [expr $x + 450] $y]
} {.t .t.f .t.f.f .t {}}
test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu} {
test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu failsOnXQuarz} {
destroy .t
destroy .t2
toplevel .t -width 200 -height 200 -bg green

View File

@@ -14,6 +14,7 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }]
test winWm-1.1 {TkWmMapWindow} -constraints win -setup {
destroy .t
@@ -278,12 +279,11 @@ test winWm-6.2 {wm attributes} -constraints win -setup {
test winWm-6.3 {wm attributes} -constraints win -setup {
destroy .t
} -body {
# This isn't quite the correct error message yet, but it works.
toplevel .t
wm attributes .t -foo
} -cleanup {
destroy .t
} -returnCodes error -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
} -returnCodes error -result {bad attribute "-foo": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test winWm-6.4 {wm attributes -alpha} -constraints win -setup {
destroy .t
@@ -532,7 +532,7 @@ test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win
destroy .tx .t .sd
} -result ok
test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints failsOnUbuntu -setup {
test winWm-9.2 "check wm forget for unmapped parent (#3205464,#2967911)" -constraints {failsOnUbuntu failsOnXQuarz} -setup {
destroy .t
toplevel .t
set winwm92 {}

View File

@@ -263,6 +263,38 @@ test window-2.11 {Tk_DestroyWindow, don't reanimate a half-dead window} -constra
list $error $msg
} -result {0 YES}
test window-2.12 {Test for ticket [9b6065d1fd] - restore Tcl [update] command} -constraints {
unixOrWin
} -body {
set code [loadTkCommand]
append code {
after 1000 {set forever 1}
after 100 {destroy .}
after 200 {catch bell msg; puts "ringing the bell -> $msg"}
after 250 {update idletasks}
after 300 {update}
puts "waiting"
vwait forever
puts "done waiting"
catch {bell} msg
puts "bell -> $msg"
catch update msg
puts "update -> $msg"
}
set script [makeFile $code script]
if {[catch {exec [interpreter] $script -geometry 10x10+0+0} msg]} {
set error 1
} else {
set error 0
}
removeFile script
list $error $msg
} -result {0 {waiting
ringing the bell -> can't invoke "bell" command: application has been destroyed
done waiting
bell -> can't invoke "bell" command: application has been destroyed
update -> }}
test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} -constraints {
unix testmenubar
@@ -342,6 +374,7 @@ test window-5.1 {Tk_MakeWindowExist procedure, stacking order and menubars} -con
} -result {}
# cleanup
cleanupTests
return

View File

@@ -294,7 +294,7 @@ test winfo-9.2 {"winfo viewable" command} -body {
test winfo-9.3 {"winfo viewable" command} -body {
winfo viewable .
} -result {1}
test winfo-9.4 {"winfo viewable" command} -constraints failsOnUbuntu -body {
test winfo-9.4 {"winfo viewable" command} -constraints {failsOnUbuntu failsOnXQuarz} -body {
wm iconify .
winfo viewable .
} -cleanup {

View File

@@ -128,18 +128,14 @@ test wm-attributes-1.1 {usage} -returnCodes error -body {
wm attributes
} -result {wrong # args: should be "wm option window ?arg ...?"}
test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body {
# This is the wrong error to output - unix has it right, but it's
# not critical.
wm attributes . _
} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
} -result {bad attribute "_": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test wm-attributes-1.2.2 {usage} -constraints win -returnCodes error -body {
wm attributes . -alpha 1.0 -disabled
} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
test wm-attributes-1.2.3 {usage} -constraints win -returnCodes error -body {
# This is the wrong error to output - unix has it right, but it's
# not critical.
wm attributes . -to
} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
} -result {bad attribute "-to": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error -body {
wm attributes . _
} -result {bad attribute "_": must be -alpha, -topmost, -zoomed, -fullscreen, or -type}
@@ -810,7 +806,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup {
destroy .t2 .r.f
} -result {can't iconify .t2: it is an embedded window}
test wm-iconify-3.1 {iconify behavior} -constraints failsOnUbuntu -body {
test wm-iconify-3.1 {iconify behavior} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .t2
wm geom .t2 -0+0
update idletasks
@@ -1418,7 +1414,7 @@ test wm-stackorder-2.7 {stacking order: no children returns self} -setup {
deleteWindows
test wm-stackorder-3.1 {unmapped toplevel} -constraints failsOnUbuntu -body {
test wm-stackorder-3.1 {unmapped toplevel} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .t1 ; update
toplevel .t2 ; update
wm iconify .t1
@@ -1739,7 +1735,7 @@ test wm-transient-4.1 {transient toplevel is withdrawn
deleteWindows
} -result {withdrawn 0}
test wm-transient-4.2 {already mapped transient toplevel
is withdrawn if toplevel is iconic} -constraints failsOnUbuntu -body {
is withdrawn if toplevel is iconic} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .top
raiseDelay
wm iconify .top
@@ -1753,7 +1749,7 @@ test wm-transient-4.2 {already mapped transient toplevel
deleteWindows
} -result {withdrawn 0}
test wm-transient-4.3 {iconify/deiconify on the toplevel
does a withdraw/deiconify on the transient} -constraints failsOnUbuntu -setup {
does a withdraw/deiconify on the transient} -constraints {failsOnUbuntu failsOnXQuarz} -setup {
set results [list]
} -body {
toplevel .top
@@ -2006,7 +2002,7 @@ test wm-state-2.7 {state change before map} -body {
} -cleanup {
deleteWindows
} -result {iconic}
test wm-state-2.8 {state change after map} -constraints failsOnUbuntu -body {
test wm-state-2.8 {state change after map} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .t
update
wm state .t iconic
@@ -2014,7 +2010,7 @@ test wm-state-2.8 {state change after map} -constraints failsOnUbuntu -body {
} -cleanup {
deleteWindows
} -result {iconic}
test wm-state-2.9 {state change after map} -constraints failsOnUbuntu -body {
test wm-state-2.9 {state change after map} -constraints {failsOnUbuntu failsOnXQuarz} -body {
toplevel .t
update
wm iconify .t