summaryrefslogtreecommitdiffstats
path: root/tests/textWind.test
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-01-09 13:44:47 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-01-09 13:44:47 (GMT)
commita6125082b3d0c0ffbc75c342295e1f534a90bbf7 (patch)
tree447b83a64befd550f0cc0ea0c51bf8d40a8ff86c /tests/textWind.test
parentc899dbf66e51a838c5465cfc6f016b9f8cf9f655 (diff)
parentf86a6ca13380485515492bb0b31d6680f89bacc1 (diff)
downloadtk-a6125082b3d0c0ffbc75c342295e1f534a90bbf7.zip
tk-a6125082b3d0c0ffbc75c342295e1f534a90bbf7.tar.gz
tk-a6125082b3d0c0ffbc75c342295e1f534a90bbf7.tar.bz2
Fix [17f44d4a0b]: Some textWind tests fail sometimes at Github. This also includes the fix for [40bc819140]: textWind-10.7 fails in some linux environments since branch bug-40bc819140 was merged into branch bug-17f44d4a0b.
Diffstat (limited to 'tests/textWind.test')
-rw-r--r--tests/textWind.test239
1 files changed, 135 insertions, 104 deletions
diff --git a/tests/textWind.test b/tests/textWind.test
index 0cb41db..881d847 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -11,7 +11,17 @@ namespace import ::tcltest::*
tcltest::configure {*}$argv
tcltest::loadTestedCommands
-testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}]
+# Platform specific procedure for updating the text widget.
+
+if {[tk windowingsystem] == "aqua"} {
+ proc updateText {} {
+ update idletasks
+ }
+} else {
+ proc updateText {} {
+ update
+ }
+}
deleteWindows
@@ -26,7 +36,7 @@ set tHeight 6
text .t -width $tWidth -height $tHeight -bd 2 -highlightthickness 2 \
-font $fixedFont
pack .t -expand 1 -fill both
-update
+updateText
.t debug on
set color [expr {[winfo depth .t] > 1 ? "green" : "black"}]
@@ -62,7 +72,7 @@ test textWind-1.1 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 3 -height 3 -bg $color
.t window create 2.2 -window .f
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \
[.t window configure .f -window]
} -result [list \
@@ -78,7 +88,7 @@ test textWind-1.2 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 3 -height 3 -bg $color
.t window create 2.2 -window .f -align top
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \
[.t window configure .f -align]
} -result [list \
@@ -104,7 +114,7 @@ test textWind-1.4 {basic tests of options} -setup {
# the window .f should be wider than the fixed width
frame .f -width 10 -height 20 -bg $color
.t window create 2.2 -window .f -padx 5
- update
+ updateText
list [winfo geom .f] [.t window configure .f -padx] [.t bbox 2.3]
} -result [list \
10x20+[expr {$padx+2*$fixedWidth+5}]+[expr {$pady+$fixedHeight}] \
@@ -118,7 +128,7 @@ test textWind-1.5 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 20 -bg $color
.t window create 2.2 -window .f -pady 4
- update
+ updateText
list [winfo geom .f] [.t window configure .f -pady] [.t bbox 2.31]
} -result [list \
10x20+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight+4}] \
@@ -132,7 +142,7 @@ test textWind-1.6 {basic tests of options} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 5 -height 5 -bg $color
.t window create 2.2 -window .f -stretch 1
- update
+ updateText
list [winfo geom .f] [.t window configure .f -stretch]
} -result [list \
5x$fixedHeight+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight}] \
@@ -195,7 +205,7 @@ test textWind-2.11 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo
- update
+ updateText
.t window configure .f
} -cleanup {
destroy .f
@@ -211,7 +221,7 @@ test textWind-2.12 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2 -create foo
- update
+ updateText
list [.t window configure .f -padx 33] [.t window configure .f -padx]
} -cleanup {
destroy .f
@@ -227,7 +237,7 @@ test textWind-2.13 {TkTextWindowCmd procedure} -setup {
.t insert end "\nAnd this is a second line, which wraps around"
frame .f -width 10 -height 6 -bg $color
.t window create 2.2 -window .f -align baseline -padx 1 -pady 2
- update
+ updateText
list [.t window configure .f -padx 14 -pady 15] \
[.t window configure .f -padx] [.t window configure .f -pady]
} -cleanup {
@@ -459,7 +469,7 @@ test textWind-3.11 {EmbWinConfigure procedure} -setup {
button .t.b -text "Hello!"
.t window create 1.4 -window .t.b
.t window create 1.6 -window .t.b
- update
+ updateText
.t index .t.b
} -result {1.6}
@@ -500,7 +510,7 @@ test textWind-5.1 {EmbWinStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
destroy .f
.t index .f
} -returnCodes error -result {bad text index ".f"}
@@ -512,7 +522,7 @@ test textWind-5.2 {EmbWinStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
destroy .f
catch {.t index .f}
list [.t bbox 1.2] [.t bbox 1.3]
@@ -528,7 +538,7 @@ test textWind-5.3 {EmbWinStructureProc procedure} -setup {
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -align bottom
.t window configure 1.2 -window .f
- update
+ updateText
destroy .f
.t index .f
} -returnCodes error -result {bad text index ".f"}
@@ -540,7 +550,7 @@ test textWind-5.4 {EmbWinStructureProc procedure} -setup {
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -align bottom
.t window configure 1.2 -window .f
- update
+ updateText
destroy .f
catch {.t index .f}
list [.t bbox 1.2] [.t bbox 1.3]
@@ -554,10 +564,10 @@ test textWind-5.5 {EmbWinStructureProc procedure} -setup {
} -body {
.t insert 1.0 "Some sample text"
.t window create 1.2 -create {frame .f -width 10 -height 20 -bg $color}
- update
+ updateText
.t window configure 1.2 -create {frame .f -width 20 -height 10 -bg $color}
destroy .f
- update
+ updateText
list [catch {.t index .f} msg] $msg [.t bbox 1.2] [.t bbox 1.3]
} -result [list 0 1.2 \
[list [expr {$padx+2*$fixedWidth}] [expr {$pady+(($fixedHeight-10)/2)}] 20 10] \
@@ -591,9 +601,9 @@ test textWind-7.1 {EmbWinLostContentProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 10 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
place .f -in .t -x 100 -y 50
- update
+ updateText
list [winfo geom .f] [.t bbox 1.2]
} -cleanup {
destroy .f
@@ -608,9 +618,9 @@ test textWind-7.2 {EmbWinLostContentProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .t.f -width 10 -height 20 -bg $color
.t window create 1.2 -window .t.f
- update
+ updateText
place .t.f -x 100 -y 50
- update
+ updateText
list [winfo geom .t.f] [.t bbox 1.2]
} -cleanup {
destroy .t.f
@@ -670,7 +680,7 @@ test textWind-10.1 {EmbWinLayoutProc procedure} -setup {
.t window create 1.5 -create {
frame .f -width 10 -height 20 -bg $color
}
- update
+ updateText
list [winfo exists .f] [winfo width .f] [winfo height .f] [.t index .f]
} -cleanup {
destroy .f
@@ -688,7 +698,7 @@ test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -setup
error "couldn't create window"
}
set msg xyzzy
- update
+ updateText
list $msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -708,7 +718,7 @@ test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -setup
concat gorp
}
set msg xyzzy
- update
+ updateText
list $msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -734,7 +744,7 @@ test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -setup
}
set count 0
while {([llength $msg] < 2) && ($count < 100)} {
- update
+ updateText
incr count
.t bbox 1.5
after 10
@@ -764,7 +774,7 @@ test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -setup
frame .t.f
frame .t.f.f -width 10 -height 20 -bg $color
}
- update idletasks
+ updateText
lappend msg [winfo exists .t.f.f]
} -cleanup {
destroy .t.f
@@ -781,12 +791,12 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
}
} -body {
.t insert 1.0 "Some sample text"
- update
+ updateText
.t window create 1.5 -create {
concat .t
}
set msg {}
- update
+ updateText
lappend msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -794,7 +804,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
{{can't embed .t relative to .t}} \
[list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]]
-test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup {
+test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup {
.t delete 1.0 end
destroy .t2
proc bgerror args {
@@ -809,7 +819,7 @@ test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -const
concat .t2
}
set msg {}
- update
+ update idletasks ; after 100 ; update
lappend msg [.t bbox 1.5]
} -cleanup {
rename bgerror {}
@@ -832,9 +842,9 @@ test textWind-10.8 {EmbWinLayoutProc procedure, error in creating window} -setup
concat .t2
}
set msg {}
- update
+ updateText
set i 0
- while {[llength $msg] == 1 && [incr i] < 200} { update }
+ while {[llength $msg] == 1 && [incr i] < 200} { updateText }
return $msg
} -cleanup {
destroy .t2
@@ -848,9 +858,9 @@ test textWind-10.9 {EmbWinLayoutProc procedure, steal window from self} -setup {
.t insert 1.0 ABCDEFGHIJKLMNOP
button .t.b -text "Hello!"
.t window create 1.5 -window .t.b
- update
+ updateText
.t window create 1.3 -create {concat .t.b}
- update
+ updateText
.t index .t.b
} -cleanup {
destroy .t.b
@@ -879,7 +889,7 @@ test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -895,7 +905,7 @@ test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+1}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -911,7 +921,7 @@ test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 20 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -927,7 +937,7 @@ test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width [expr {($tWidth-12)*$fixedWidth+5}] -height 220 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -943,7 +953,7 @@ test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 250 -height 220 -bg $color -bd 2 -relief raised
.t window create 1.12 -window .f
- update
+ updateText
list [.t bbox .f] [.t bbox 1.13]
} -cleanup {
destroy .f
@@ -964,7 +974,7 @@ test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup {
place .t -x 30 -y 50
frame .f -width 30 -height 20 -bg $color
.t window create 1.12 -window .f
- update ; after 100 ; update
+ update
winfo geom .f
} -cleanup {
destroy .f
@@ -984,7 +994,7 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup {
place .t -x 30 -y 50
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.12 -window .t.f
- update ; after 100 ; update
+ update
winfo geom .t.f
} -cleanup {
destroy .t.f
@@ -1030,7 +1040,7 @@ test textWind-11.4 {EmbWinDisplayProc procedure, horizontal scrolling} -setup {
.t insert end " with junk after it."
.t xview moveto 0
.t xview scroll 5 units
- update
+ updateText
list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] [winfo ismapped .f2]
} -cleanup {
destroy .f .f2
@@ -1051,10 +1061,10 @@ test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -setup {
frame .f2 -width 40 -height 10 -bg $color
.t window create end -window .f2
.t insert end " with junk after it."
- update
+ updateText
.t xview moveto 0
.t xview scroll 25 units
- update
+ updateText
list [winfo ismapped .f] [winfo ismapped .f2] [winfo geom .f2] [.t bbox .f2]
} -cleanup {
destroy .f .f2
@@ -1073,19 +1083,19 @@ test textWind-12.1 {EmbWinUndisplayProc procedure, mapping/unmapping} -setup {
bind .f <Map> {lappend x mapped}
bind .f <Unmap> {lappend x unmapped}
set x created
- update
+ updateText
lappend x modified
.t delete 1.0
- update
+ updateText
lappend x replaced
.t window configure .f -window {}
.t delete 1.1
.t window create 1.4 -window .f
- update
+ updateText
lappend x off-screen
.t configure -wrap none
.t insert 1.0 "Enough text to make the line run off-screen"
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1099,7 +1109,7 @@ test textWind-13.1 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align top -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1114,7 +1124,7 @@ test textWind-13.2 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1129,7 +1139,7 @@ test textWind-13.3 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align baseline -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1144,7 +1154,7 @@ test textWind-13.4 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align bottom -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1159,7 +1169,7 @@ test textWind-13.5 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align top -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1174,7 +1184,7 @@ test textWind-13.6 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1189,7 +1199,7 @@ test textWind-13.7 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align baseline -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1204,7 +1214,7 @@ test textWind-13.8 {EmbWinBboxProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align bottom -padx 2 -pady 1 -stretch 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f
@@ -1221,7 +1231,7 @@ test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 5 -height 5 -bg $color
.t window create 1.2 -window .f -align center -padx 2 -pady 1
- update
+ updateText
list [winfo geom .f] [.t bbox .f]
} -cleanup {
.t configure -spacing1 0 -spacing3 0
@@ -1238,14 +1248,14 @@ test textWind-14.1 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
bind .f <Unmap> {lappend x unmapped}
set x modified
.t insert 1.0 x
lappend x removed
.t window configure .f -window {}
lappend x updated
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1258,14 +1268,14 @@ test textWind-14.2 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
bind .f <Unmap> {lappend x unmapped}
set x modified
.t insert 1.0 x
lappend x deleted
.t delete .f
lappend x updated
- update
+ updateText
return $x
} -cleanup {
destroy .f
@@ -1278,10 +1288,10 @@ test textWind-14.3 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9"
frame .f -width 30 -height 20 -bg $color
.t window create 1.2 -window .f
- update
+ updateText
.t yview 2.0
set result [winfo ismapped .f]
- update ; after 10
+ updateText ; after 10
list $result [winfo ismapped .f]
} -cleanup {
destroy .f
@@ -1294,10 +1304,10 @@ test textWind-14.4 {EmbWinDelayedUnmap procedure} -setup {
.t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9"
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.2 -window .t.f
- update
+ updateText
.t yview 2.0
set result [winfo ismapped .t.f]
- update
+ updateText
list $result [winfo ismapped .t.f]
} -cleanup {
destroy .t.f
@@ -1335,9 +1345,9 @@ test textWind-16.1 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.6 -window .f
- update
+ updateText
pack forget .t
- update
+ updateText
winfo ismapped .f
} -cleanup {
pack .t
@@ -1352,12 +1362,12 @@ test textWind-16.2 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .f -width 30 -height 20 -bg $color
.t window create 1.6 -window .f
- update
+ updateText
set result {}
lappend result [winfo geom .f] [.t bbox .f]
frame .f2 -width 150 -height 30 -bd 2 -relief raised
pack .f2 -before .t
- update
+ updateText
lappend result [winfo geom .f] [.t bbox .f]
} -cleanup {
destroy .f .f2
@@ -1373,9 +1383,9 @@ test textWind-16.3 {EmbWinTextStructureProc procedure} -setup {
.t configure -wrap none
.t insert 1.0 "Some sample text"
.t window create 1.6
- update
+ updateText
pack forget .t
- update
+ updateText
} -cleanup {
pack .t
} -result {}
@@ -1388,9 +1398,9 @@ test textWind-16.4 {EmbWinTextStructureProc procedure} -setup {
.t insert 1.0 "Some sample text"
frame .t.f -width 30 -height 20 -bg $color
.t window create 1.6 -window .t.f
- update
+ updateText
pack forget .t
- update
+ updateText
list [winfo ismapped .t.f] [.t bbox .t.f]
} -cleanup {
pack .t
@@ -1406,7 +1416,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
+ updateText
destroy .t .tt
winfo exists .f
} -result 0
@@ -1420,10 +1430,10 @@ 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
+ updateText
destroy .t
.tt.t insert 1.0 "foo"
- update
+ updateText
destroy .tt
} -result {}
@@ -1435,9 +1445,9 @@ 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
+ updateText
.t window create 1.2 -create {frame %W.f -width 10 -height 20 -bg blue}
- update
+ updateText
destroy .t .tt
} -result {}
@@ -1451,10 +1461,10 @@ 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
+ updateText
destroy .tt
lappend res [.t get 1.2]
- update
+ updateText
lappend res [.t get 1.2]
} -cleanup {
destroy .t
@@ -1469,7 +1479,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
+ updateText
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1484,7 +1494,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
+ updateText
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1500,7 +1510,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
+ updateText
list [.t window cget 1.2 -window] [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
@@ -1515,7 +1525,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
+ updateText
list [.t window configure 1.2 -window] \
[.tt.t window configure 1.2 -window]
} -cleanup {
@@ -1531,7 +1541,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
+ updateText
.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 {
@@ -1547,28 +1557,49 @@ test textWind-17.10 {peer widget window configuration} -setup {
.t insert 1.0 "Some sample text"
toplevel .tt
pack [.t peer create .tt.t]
- update idletasks
+ updateText
.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 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]
+ updateText
+ # There is a blue window in the main widget .t but not in the peer .tt.t
+ lappend res [.t window cget 1.2 -window]
+ lappend res [.tt.t window cget 1.2 -window]
+ # Insert a green window in the peer. Warning: the blue window previously
+ # inserted in .t at index 1.2 will now be found in .t at index 1.3
+ # The underlying linked segments are common in a text widget and its peers.
+ .tt.t window create 1.2 -window [frame .tt.t.f -width 25 -height 20 -bg green]
+ updateText
+ lappend res [.t window cget 1.2 -window]
+ lappend res [.t window cget 1.3 -window]
+ # In the peer, the green window still is at 1.2, and there is no window at 1.3
+ lappend res [.tt.t window cget 1.2 -window]
+ lappend res [.tt.t window cget 1.3 -window]
+ # Insert a red window in .t at index 1.2. This replaces the blue window originally at 1.2
+ # in .t, because the green window inserted in the peer is not visible from .t, therefore
+ # the embedded window found at index 1.2 in .t is the one originally at 1.2 in .t, i.e.
+ # the blue one
+ .t window configure 1.2 -create {destroy %W.f ; update ; frame %W.f -width 50 -height 7 -bg red}
+ updateText
+ # The main widget .t still has a window named .t.f at 1.2. This is NOT the blue
+ # frame but the red frame from the -create script, which bears the same name.
+ lappend res [.t window cget 1.2 -window]
+ # The peer still has its green .tt.t.f at 1.2
+ lappend res [.tt.t window cget 1.2 -window]
+ # When removing the -window option the create script plays, therefore .t still has
+ # the red frame .t.f at 1.2
.t window configure 1.2 -window {}
+ updateText
+ lappend res [.t window cget 1.2 -window]
+ # The -create script associated to index 1.2 applies to all peers (that's the reason
+ # why the manual states that "If multiple peer widgets are in use, it is usually simpler
+ # to use the -create option if embedded windows are desired in each peer."). Therefore
+ # when removing the -window option in the peer, the -create script is run, which replaces
+ # the green frame by the red one named as per the -create script, i.e. .tt.t.f
.tt.t window configure 1.2 -window {}
- update
- # Nothing should have changed.
- lappend res [.t window configure 1.2 -window]
- lappend res [.tt.t window configure 1.2 -window]
+ updateText
+ lappend res [.tt.t window cget 1.2 -window]
} -cleanup {
destroy .tt .t
-} -result {{-window {} {} {} .t.f} {-window {} {} {} {}} {-window {} {} {} .t.f}\
-{-window {} {} {} .t.f} {-window {} {} {} .tt.t.f}}
+} -result {.t.f {} {} .t.f .tt.t.f {} .t.f .tt.t.f .t.f .tt.t.f}
test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -constraints knownBug -setup {
catch {destroy .t .f .f2}
@@ -1578,11 +1609,11 @@ test textWind-18.1 {embedded window deletion triggered by a script bound to <Map
.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
+ updateText
# this shall not crash (bug 1501749)
after 100 {.t yview end}
tkwait visibility .f2
- update
+ updateText
} -cleanup {
destroy .t .f .f2
} -result {}