diff options
author | fvogel <fvogelnew1@free.fr> | 2018-10-03 21:30:42 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2018-10-03 21:30:42 (GMT) |
commit | 78c3a3fb7fde872d1ef9f70ee1b146189ffb5b71 (patch) | |
tree | 3752735297e3b5ecb5acbc8f3604ef3efd596a72 /tests/textWind.test | |
parent | d1f4d0e4a8e4c74689750d2470eb48403fd03478 (diff) | |
download | tk-78c3a3fb7fde872d1ef9f70ee1b146189ffb5b71.zip tk-78c3a3fb7fde872d1ef9f70ee1b146189ffb5b71.tar.gz tk-78c3a3fb7fde872d1ef9f70ee1b146189ffb5b71.tar.bz2 |
Patch [48ff500999]: Better textWind.test, that no longer depends on a fonts/textfonts constraint. Patch from Brad Lanam, slightly tuned for the legacy text widget in Tk 8.6
Diffstat (limited to 'tests/textWind.test')
-rw-r--r-- | tests/textWind.test | 397 |
1 files changed, 246 insertions, 151 deletions
diff --git a/tests/textWind.test b/tests/textWind.test index fd29e19..3899ab5 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -16,23 +16,27 @@ tcltest::loadTestedCommands option add *Text.borderWidth 2 option add *Text.highlightThickness 2 -option add *Text.font {Courier -12} +option add *Text.font {"Courier New" -12} deleteWindows # Widget used in tests 1.* - 16.* -text .t -width 30 -height 6 -bd 2 -highlightthickness 2 +set tWidth 30 +set tHeight 6 +text .t -width $tWidth -height $tHeight -bd 2 -highlightthickness 2 pack .t -expand 1 -fill both update .t debug on -# 15 on XP, 13 on Solaris 8 -set fixedHeight [font metrics {Courier -12} -linespace] -set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP +set fixedFont {"Courier New" -12} +set fixedHeight [font metrics $fixedFont -linespace] +set fixedWidth [font measure $fixedFont m] +set fixedAscent [font metrics $fixedFont -ascent] + set color [expr {[winfo depth .t] > 1 ? "green" : "black"}] wm geometry . {} - + # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. @@ -41,9 +45,16 @@ wm minsize . 1 1 wm positionfrom . user wm deiconify . +set bw [.t cget -borderwidth] +set px [.t cget -padx] +set py [.t cget -pady] +set hlth [.t cget -highlightthickness] +set padx [expr {$bw+$px+$hlth}] +set pady [expr {$bw+$py+$hlth}] + # ---------------------------------------------------------------------- -test textWind-1.1 {basic tests of options} -constraints fonts -setup { +test textWind-1.1 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" @@ -53,8 +64,13 @@ test textWind-1.1 {basic tests of options} -constraints fonts -setup { update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \ [.t window configure .f -window] -} -result {1 3x3+19+23 {19 23 3 3} {-window {} {} {} .f}} -test textWind-1.2 {basic tests of options} -constraints fonts -setup { +} -result [list \ + 1 \ + 3x3+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight+(($fixedHeight-3)/2)}] \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+$fixedHeight+(($fixedHeight-3)/2)}] 3 3] \ + {-window {} {} {} .f}] + +test textWind-1.2 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" @@ -64,7 +80,12 @@ test textWind-1.2 {basic tests of options} -constraints fonts -setup { update list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] \ [.t window configure .f -align] -} -result {1 3x3+19+18 {19 18 3 3} {-align {} {} center top}} +} -result [list \ + 1 \ + 3x3+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight}] \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+$fixedHeight}] 3 3] \ + {-align {} {} center top}] + test textWind-1.3 {basic tests of options} -setup { .t delete 1.0 end } -body { @@ -73,17 +94,23 @@ test textWind-1.3 {basic tests of options} -setup { .t window create 2.2 -create "Test script" .t window configure 2.2 -create } -result {-create {} {} {} {Test script}} -test textWind-1.4 {basic tests of options} -constraints fonts -setup { + +test textWind-1.4 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" + # 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 list [winfo geom .f] [.t window configure .f -padx] [.t bbox 2.3] -} -result {10x20+24+18 {-padx {} {} 0 5} {39 21 7 13}} -test textWind-1.5 {basic tests of options} -constraints fonts -setup { +} -result [list \ + 10x20+[expr {$padx+2*$fixedWidth+5}]+[expr {$pady+$fixedHeight}] \ + {-padx {} {} 0 5} \ + [list [expr {$padx+2*$fixedWidth+10+2*5}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] + +test textWind-1.5 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" @@ -92,8 +119,12 @@ test textWind-1.5 {basic tests of options} -constraints fonts -setup { .t window create 2.2 -window .f -pady 4 update list [winfo geom .f] [.t window configure .f -pady] [.t bbox 2.31] -} -result {10x20+19+22 {-pady {} {} 0 4} {19 46 7 13}} -test textWind-1.6 {basic tests of options} -constraints fonts -setup { +} -result [list \ + 10x20+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight+4}] \ + {-pady {} {} 0 4} \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+$fixedHeight+20+2*4}] $fixedWidth $fixedHeight]] + +test textWind-1.6 {basic tests of options} -setup { .t delete 1.0 end } -body { .t insert end "This is the first line" @@ -102,7 +133,9 @@ test textWind-1.6 {basic tests of options} -constraints fonts -setup { .t window create 2.2 -window .f -stretch 1 update list [winfo geom .f] [.t window configure .f -stretch] -} -result {5x13+19+18 {-stretch {} {} 0 1}} +} -result [list \ + 5x$fixedHeight+[expr {$padx+2*$fixedWidth}]+[expr {$pady+$fixedHeight}] \ + {-stretch {} {} 0 1}] .t delete 1.0 end @@ -301,7 +334,8 @@ test textWind-3.1 {EmbWinConfigure procedure} -setup { } -cleanup { destroy .f } -returnCodes error -result {unknown option "-foo"} -test textWind-3.2 {EmbWinConfigure procedure} -constraints fonts -setup { + +test textWind-3.2 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" @@ -314,7 +348,8 @@ test textWind-3.2 {EmbWinConfigure procedure} -constraints fonts -setup { } -cleanup { destroy .f } -returnCodes error -result {bad text index ".f"} -test textWind-3.3 {EmbWinConfigure procedure} -constraints fonts -setup { + +test textWind-3.3 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" @@ -327,8 +362,10 @@ test textWind-3.3 {EmbWinConfigure procedure} -constraints fonts -setup { list [winfo ismapped .f] [.t bbox 1.4] } -cleanup { destroy .f -} -result {0 {26 5 7 13}} -test textWind-3.4 {EmbWinConfigure procedure} -constraints fonts -setup { +} -result [list 0 \ + [list [expr {$padx+3*$fixedWidth}] $pady $fixedWidth $fixedHeight]] + +test textWind-3.4 {EmbWinConfigure procedure} -setup { destroy .t.f } -body { .t insert 1.0 "Some sample text" @@ -341,7 +378,8 @@ test textWind-3.4 {EmbWinConfigure procedure} -constraints fonts -setup { } -cleanup { destroy .t.f } -returnCodes error -result {bad text index ".t.f"} -test textWind-3.5 {EmbWinConfigure procedure} -constraints fonts -setup { + +test textWind-3.5 {EmbWinConfigure procedure} -setup { destroy .t.f } -body { .t insert 1.0 "Some sample text" @@ -354,8 +392,10 @@ test textWind-3.5 {EmbWinConfigure procedure} -constraints fonts -setup { list [winfo ismapped .t.f] [.t bbox 1.4] } -cleanup { destroy .t.f -} -result {0 {26 5 7 13}} -test textWind-3.6 {EmbWinConfigure procedure} -constraints fonts -setup { +} -result [list 0 \ + [list [expr {$padx+3*$fixedWidth}] $pady $fixedWidth $fixedHeight]] + +test textWind-3.6 {EmbWinConfigure procedure} -setup { destroy .f } -body { .t insert 1.0 "Some sample text" @@ -367,7 +407,9 @@ test textWind-3.6 {EmbWinConfigure procedure} -constraints fonts -setup { list [catch {.t index .f} msg] $msg [winfo ismapped .f] [.t bbox 1.4] } -cleanup { destroy .f -} -result {0 1.3 1 {36 8 7 13}} +} -result [list 0 1.3 1 \ + [list [expr {$padx+3*$fixedWidth+10}] [expr {$pady+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] + test textWind-3.7 {EmbWinConfigure procedure} -setup { destroy .f } -body { @@ -450,8 +492,7 @@ test textWind-4.6 {AlignParseProc and AlignPrintProc procedures} -body { .t window configure 1.0 -align } -result {-align {} {} center top} - -test textWind-5.1 {EmbWinStructureProc procedure} -constraints fonts -setup { +test textWind-5.1 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -462,7 +503,8 @@ test textWind-5.1 {EmbWinStructureProc procedure} -constraints fonts -setup { destroy .f .t index .f } -returnCodes error -result {bad text index ".f"} -test textWind-5.2 {EmbWinStructureProc procedure} -constraints fonts -setup { + +test textWind-5.2 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -473,8 +515,11 @@ test textWind-5.2 {EmbWinStructureProc procedure} -constraints fonts -setup { destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] -} -result {{19 11 0 0} {19 5 7 13}} -test textWind-5.3 {EmbWinStructureProc procedure} -constraints fonts -setup { +} -result [list \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0] \ + [list [expr {$padx+2*$fixedWidth}] $pady $fixedWidth $fixedHeight]] + +test textWind-5.3 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -486,7 +531,8 @@ test textWind-5.3 {EmbWinStructureProc procedure} -constraints fonts -setup { destroy .f .t index .f } -returnCodes error -result {bad text index ".f"} -test textWind-5.4 {EmbWinStructureProc procedure} -constraints fonts -setup { + +test textWind-5.4 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end } -body { .t insert 1.0 "Some sample text" @@ -497,8 +543,11 @@ test textWind-5.4 {EmbWinStructureProc procedure} -constraints fonts -setup { destroy .f catch {.t index .f} list [.t bbox 1.2] [.t bbox 1.3] -} -result {{19 18 0 0} {19 5 7 13}} -test textWind-5.5 {EmbWinStructureProc procedure} -constraints fonts -setup { +} -result [list \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+$fixedHeight}] 0 0] \ + [list [expr {$padx+2*$fixedWidth}] $pady $fixedWidth $fixedHeight]] + +test textWind-5.5 {EmbWinStructureProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -509,10 +558,12 @@ test textWind-5.5 {EmbWinStructureProc procedure} -constraints fonts -setup { destroy .f update list [catch {.t index .f} msg] $msg [.t bbox 1.2] [.t bbox 1.3] -} -result {0 1.2 {19 6 20 10} {39 5 7 13}} +} -result [list 0 1.2 \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+(($fixedHeight-10)/2)}] 20 10] \ + [list [expr {$padx+2*$fixedWidth+20}] $pady $fixedWidth $fixedHeight]] -test textWind-6.1 {EmbWinRequestProc procedure} -constraints fonts -setup { +test textWind-6.1 {EmbWinRequestProc procedure} -setup { .t delete 1.0 end destroy .f set result {} @@ -525,12 +576,14 @@ test textWind-6.1 {EmbWinRequestProc procedure} -constraints fonts -setup { lappend result [.t bbox 1.2] [.t bbox 1.3] } -cleanup { destroy .f -} -result {{19 5 10 20} {29 8 7 13} {19 5 25 30} {44 13 7 13}} +} -result [list \ + [list [expr {$padx+2*$fixedWidth}] $pady 10 20] \ + [list [expr {$padx+2*$fixedWidth+10}] [expr {$pady+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight] \ + [list [expr {$padx+2*$fixedWidth}] $pady 25 30] \ + [list [expr {$padx+2*$fixedWidth+25}] [expr {$pady+((30-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] -test textWind-7.1 {EmbWinLostSlaveProc procedure} -constraints { - textfonts -} -setup { +test textWind-7.1 {EmbWinLostSlaveProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -543,10 +596,11 @@ test textWind-7.1 {EmbWinLostSlaveProc procedure} -constraints { list [winfo geom .f] [.t bbox 1.2] } -cleanup { destroy .f -} -result [list 10x20+105+55 [list 19 [expr {11+$fixedDiff/2}] 0 0]] -test textWind-7.2 {EmbWinLostSlaveProc procedure} -constraints { - textfonts -} -setup { +} -result [list \ + 10x20+[expr {$padx+100}]+[expr {$pady+50}] \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] + +test textWind-7.2 {EmbWinLostSlaveProc procedure} -setup { .t delete 1.0 end destroy .t.f } -body { @@ -559,10 +613,11 @@ test textWind-7.2 {EmbWinLostSlaveProc procedure} -constraints { list [winfo geom .t.f] [.t bbox 1.2] } -cleanup { destroy .t.f -} -result [list 10x20+105+55 [list 19 [expr {11+$fixedDiff/2}] 0 0]] +} -result [list \ + 10x20+[expr {$padx+100}]+[expr {$pady+50}] \ + [list [expr {$padx+2*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] - -test textWind-8.1 {EmbWinDeleteProc procedure} -constraints fonts -setup { +test textWind-8.1 {EmbWinDeleteProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -573,8 +628,12 @@ test textWind-8.1 {EmbWinDeleteProc procedure} -constraints fonts -setup { set x XXX .t delete 1.2 list $x [.t bbox 1.2] [.t bbox 1.3] [winfo exists .f] -} -result {destroyed {19 5 7 13} {26 5 7 13} 0} -test textWind-8.2 {EmbWinDeleteProc procedure} -constraints fonts -setup { +} -result [list destroyed \ + [list [expr {$padx+2*$fixedWidth}] $pady $fixedWidth $fixedHeight] \ + [list [expr {$padx+3*$fixedWidth}] $pady $fixedWidth $fixedHeight] \ + 0] + +test textWind-8.2 {EmbWinDeleteProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -615,9 +674,8 @@ test textWind-10.1 {EmbWinLayoutProc procedure} -setup { } -cleanup { destroy .f } -result {1 10 20 1.5} -test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -constraints { - fonts -} -setup { + +test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end proc bgerror args { global msg @@ -625,7 +683,7 @@ test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -const } } -body { .t insert 1.0 "Some sample text" - .t window create 1.5 -create { + .t window create 1.5 -create { error "couldn't create window" } set msg xyzzy @@ -633,10 +691,11 @@ test textWind-10.2 {EmbWinLayoutProc procedure, error in creating window} -const list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} -} -result {{{couldn't create window}} {40 11 0 0}} -test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -constraints { - fonts -} -setup { +} -result [list \ + {{couldn't create window}} \ + [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] + +test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end proc bgerror args { global msg @@ -652,26 +711,16 @@ test textWind-10.3 {EmbWinLayoutProc procedure, error in creating window} -const list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} -} -result {{{bad window path name "gorp"}} {40 11 0 0}} - .t delete 1.0 end - destroy .t.f - proc bgerror args { - global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } - } +} -result [list \ + {{bad window path name "gorp"}} \ + [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] -test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -constraints { - textfonts -} -setup { +test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t.f proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } + lappend msg $args } } -body { .t insert 1.0 "Some sample text" @@ -693,17 +742,17 @@ test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -const } -cleanup { destroy .t.f rename bgerror {} -} -result [list {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0] 1] -test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -constraints { - textfonts -} -setup { +} -result [list \ + {{can't embed .t.f.f relative to .t}} {{window name "f" already exists in parent}} \ + [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0] \ + 1] + +test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t.f proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } + lappend msg $args } } -body { .t insert 1.0 "Some sample text" @@ -718,10 +767,8 @@ test textWind-10.5 {EmbWinLayoutProc procedure, error in creating window} -const destroy .t.f rename bgerror {} } -result {{{can't embed .t.f.f relative to .t}} 1} -catch {destroy .t.f} -test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -constraints { - textfonts -} -setup { + +test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end proc bgerror args { global msg @@ -731,6 +778,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -const } } -body { .t insert 1.0 "Some sample text" + update .t window create 1.5 -create { concat .t } @@ -739,17 +787,16 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -const lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} -} -result [list {{can't embed .t relative to .t}} [list 40 [expr {11+$fixedDiff/2}] 0 0]] -test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints { - textfonts -} -setup { +} -result [list \ + {{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} -setup { .t delete 1.0 end destroy .t2 proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } + lappend msg $args } } -body { .t insert 1.0 "Some sample text" @@ -763,15 +810,16 @@ test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -const lappend msg [.t bbox 1.5] } -cleanup { rename bgerror {} -} -result [list {{can't embed .t2 relative to .t}} {{window name "t2" already exists in parent}} [list 40 [expr {11+$fixedDiff/2}] 0 0]] +} -result [list \ + {{can't embed .t2 relative to .t}} {{window name "t2" already exists in parent}} \ + [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] + test textWind-10.8 {EmbWinLayoutProc procedure, error in creating window} -setup { .t delete 1.0 end destroy .t2 proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } + lappend msg $args } } -body { .t insert 1.0 "Some sample text" @@ -804,9 +852,8 @@ test textWind-10.9 {EmbWinLayoutProc procedure, steal window from self} -setup { } -cleanup { destroy .t.b } -result {1.3} -test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -constraints { - fonts -} -setup { + +test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { @@ -817,10 +864,11 @@ test textWind-10.10 {EmbWinLayoutProc procedure, doesn't fit on line} -constrain list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{89 5 126 20} {5 25 7 13}} -test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -constraints { - fonts -} -setup { +} -result [list \ + [list [expr {$padx+12*$fixedWidth}] $pady [expr {$tWidth*$fixedWidth-12*$fixedWidth}] 20] \ + [list $padx [expr {$pady+20}] $fixedWidth $fixedHeight]] + +test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { @@ -832,10 +880,11 @@ test textWind-10.11 {EmbWinLayoutProc procedure, doesn't fit on line} -constrain list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{89 5 126 20} {5 25 7 13}} -test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -constraints { - fonts -} -setup { +} -result [list \ + [list [expr {$padx+12*$fixedWidth}] $pady [expr {$tWidth*$fixedWidth-12*$fixedWidth}] 20] \ + [list $padx [expr {$pady+20}] $fixedWidth $fixedHeight]] + +test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { @@ -847,7 +896,10 @@ test textWind-10.12 {EmbWinLayoutProc procedure, doesn't fit on line} -constrain list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{5 18 127 20} {132 21 7 13}} +} -result [list \ + [list $padx [expr {$pady+$fixedHeight}] 127 20] \ + [list [expr {$padx+127}] [expr {$pady+$fixedHeight+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] + test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f @@ -860,10 +912,11 @@ test textWind-10.13 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{89 5 126 20} {}} -test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -constraints { - fonts -} -setup { +} -result [list \ + [list [expr {$padx+12*$fixedWidth}] $pady [expr {$tWidth*$fixedWidth-12*$fixedWidth}] 20] \ + {}] + +test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { @@ -875,10 +928,11 @@ test textWind-10.14 {EmbWinLayoutProc procedure, doesn't fit on line} -constrain list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{89 5 126 78} {}} -test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -constraints { - fonts -} -setup { +} -result [list \ + [list [expr {$padx+12*$fixedWidth}] $pady [expr {$tWidth*$fixedWidth-12*$fixedWidth}] [expr {$tHeight*$fixedHeight}]] \ + {}] + +test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -setup { .t delete 1.0 end destroy .f } -body { @@ -890,8 +944,9 @@ test textWind-10.15 {EmbWinLayoutProc procedure, doesn't fit on line} -constrain list [.t bbox .f] [.t bbox 1.13] } -cleanup { destroy .f -} -result {{5 18 210 65} {}} - +} -result [list \ + [list $padx [expr {$pady+$fixedHeight}] [expr {$tWidth*$fixedWidth}] [expr {($tHeight-1)*$fixedHeight}]] \ + {}] test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup { .t delete 1.0 end @@ -909,7 +964,8 @@ test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup { } -cleanup { destroy .f place forget .t -} -result {30x20+119+55} +} -result [list 30x20+[expr {$padx+30+12*$fixedWidth}]+[expr {$pady+50}]] + test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup { .t delete 1.0 end destroy .t.f @@ -927,7 +983,8 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup { destroy .t.f place forget .t pack .t -} -result {30x20+89+5} +} -result [list 30x20+[expr {$padx+12*$fixedWidth}]+$pady] + test textWind-11.3 {EmbWinDisplayProc procedure, configuration optimization} -setup { .t delete 1.0 end destroy .f @@ -949,9 +1006,8 @@ test textWind-11.3 {EmbWinDisplayProc procedure, configuration optimization} -se place forget .t pack .t } -result {no configures} -test textWind-11.4 {EmbWinDisplayProc procedure, horizontal scrolling} -constraints { - fonts -} -setup { + +test textWind-11.4 {EmbWinDisplayProc procedure, horizontal scrolling} -setup { .t delete 1.0 end destroy .f .f2 } -body { @@ -969,10 +1025,12 @@ test textWind-11.4 {EmbWinDisplayProc procedure, horizontal scrolling} -constrai list [winfo ismapped .f] [winfo geom .f] [.t bbox .f] [winfo ismapped .f2] } -cleanup { destroy .f .f2 -} -result {1 30x20+103+18 {103 18 30 20} 0} -test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -constraints { - fonts -} -setup { +} -result [list 1 \ + 30x20+[expr {$padx+14*$fixedWidth}]+[expr {$pady+$fixedHeight}] \ + [list [expr {$padx+14*$fixedWidth}] [expr {$pady+$fixedHeight}] 30 20] \ + 0] + +test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -setup { .t delete 1.0 end destroy .f .f2 } -body { @@ -990,10 +1048,11 @@ test textWind-11.5 {EmbWinDisplayProc procedure, horizontal scrolling} -constrai update list [winfo ismapped .f] [winfo ismapped .f2] [winfo geom .f2] [.t bbox .f2] } -cleanup { - destroy .f .f2 -} -result {0 1 40x10+119+23 {119 23 40 10}} -.t configure -wrap char - + destroy .f .f2 + .t configure -wrap char +} -result [list 0 1 \ + 40x10+[expr {$padx+37*$fixedWidth+30-25*$fixedWidth}]+[expr {$pady+$fixedHeight+((20-10)/2)}] \ + [list [expr {$padx+37*$fixedWidth+30-25*$fixedWidth}] [expr {$pady+$fixedHeight+((20-10)/2)}] 40 10]] test textWind-12.1 {EmbWinUndisplayProc procedure, mapping/unmapping} -setup { .t delete 1.0 end @@ -1035,8 +1094,11 @@ test textWind-13.1 {EmbWinBboxProc procedure} -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x5+21+6 {21 6 5 5}} -test textWind-13.2 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x5+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1}] 5 5]] + +test textWind-13.2 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1047,8 +1109,11 @@ test textWind-13.2 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x5+21+9 {21 9 5 5}} -test textWind-13.3 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x5+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1+(($fixedHeight-7)/2)}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1+(($fixedHeight-7)/2)}] 5 5]] + +test textWind-13.3 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1059,8 +1124,11 @@ test textWind-13.3 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x5+21+10 {21 10 5 5}} -test textWind-13.4 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x5+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1+($fixedAscent-6)}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1+($fixedAscent-6)}] 5 5]] + +test textWind-13.4 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1071,8 +1139,11 @@ test textWind-13.4 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x5+21+12 {21 12 5 5}} -test textWind-13.5 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x5+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1+($fixedHeight-7)}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1+($fixedHeight-7)}] 5 5]] + +test textWind-13.5 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1083,8 +1154,11 @@ test textWind-13.5 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x11+21+6 {21 6 5 11}} -test textWind-13.6 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x[expr {$fixedHeight-2}]+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1}] 5 [expr {$fixedHeight-2}]]] + +test textWind-13.6 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1095,8 +1169,11 @@ test textWind-13.6 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x11+21+6 {21 6 5 11}} -test textWind-13.7 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x[expr {$fixedHeight-2}]+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1}] 5 [expr {$fixedHeight-2}]]] + +test textWind-13.7 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1107,8 +1184,11 @@ test textWind-13.7 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x9+21+6 {21 6 5 9}} -test textWind-13.8 {EmbWinBboxProc procedure} -constraints fonts -setup { +} -result [list \ + 5x[expr {$fixedAscent-1}]+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1}] 5 [expr {$fixedAscent-1}]]] + +test textWind-13.8 {EmbWinBboxProc procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1119,10 +1199,11 @@ test textWind-13.8 {EmbWinBboxProc procedure} -constraints fonts -setup { list [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f -} -result {5x11+21+6 {21 6 5 11}} -test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -constraints { - fonts -} -setup { +} -result [list \ + 5x[expr {$fixedHeight-2}]+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+1}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+1}] 5 [expr {$fixedHeight-2}]]] + +test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -setup { .t delete 1.0 end destroy .f } -body { @@ -1134,8 +1215,11 @@ test textWind-13.9 {EmbWinBboxProc procedure, spacing options} -constraints { update list [winfo geom .f] [.t bbox .f] } -cleanup { + .t configure -spacing1 0 -spacing3 0 destroy .f -} -result {5x5+21+14 {21 14 5 5}} +} -result [list \ + 5x5+[expr {$padx+2*$fixedWidth+2}]+[expr {$pady+5+(($fixedHeight-5)/2)}] \ + [list [expr {$padx+2*$fixedWidth+2}] [expr {$pady+5+(($fixedHeight-5)/2)}] 5 5]] test textWind-14.1 {EmbWinDelayedUnmap procedure} -setup { @@ -1157,6 +1241,7 @@ test textWind-14.1 {EmbWinDelayedUnmap procedure} -setup { } -cleanup { destroy .f } -result {modified removed unmapped updated} + test textWind-14.2 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .f @@ -1176,6 +1261,7 @@ test textWind-14.2 {EmbWinDelayedUnmap procedure} -setup { } -cleanup { destroy .f } -result {modified deleted updated} + test textWind-14.3 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .f @@ -1191,6 +1277,7 @@ test textWind-14.3 {EmbWinDelayedUnmap procedure} -setup { } -cleanup { destroy .f } -result {1 0} + test textWind-14.4 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .t.f @@ -1207,13 +1294,13 @@ test textWind-14.4 {EmbWinDelayedUnmap procedure} -setup { destroy .t.f } -result {1 0} - test textWind-15.1 {TkTextWindowIndex procedure} -setup { .t delete 1.0 end } -body { .t index .foo } -returnCodes error -result {bad text index ".foo"} -test textWind-15.2 {TkTextWindowIndex procedure} -constraints fonts -setup { + +test textWind-15.2 {TkTextWindowIndex procedure} -setup { .t delete 1.0 end destroy .f } -body { @@ -1227,7 +1314,8 @@ test textWind-15.2 {TkTextWindowIndex procedure} -constraints fonts -setup { list [.t index .f] [.t bbox 1.7] } -cleanup { destroy .f -} -result {1.6 {77 8 7 13}} +} -result [list 1.6 \ + [list [expr {$padx+6*$fixedWidth+30}] [expr {$pady+((20-$fixedHeight)/2)}] $fixedWidth $fixedHeight]] test textWind-16.1 {EmbWinTextStructureProc procedure} -setup { @@ -1245,6 +1333,7 @@ test textWind-16.1 {EmbWinTextStructureProc procedure} -setup { } -cleanup { pack .t } -result 0 + test textWind-16.2 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end destroy .f .f2 @@ -1263,7 +1352,12 @@ test textWind-16.2 {EmbWinTextStructureProc procedure} -setup { lappend result [winfo geom .f] [.t bbox .f] } -cleanup { destroy .f .f2 -} -result {30x20+47+5 {47 5 30 20} 30x20+47+35 {47 5 30 20}} +} -result [list \ + 30x20+[expr {$padx+6*$fixedWidth}]+$pady \ + [list [expr {$padx+6*$fixedWidth}] $pady 30 20] \ + 30x20+[expr {$padx+6*$fixedWidth}]+[expr {$pady+30}] \ + [list [expr {$padx+6*$fixedWidth}] $pady 30 20]] + test textWind-16.3 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end } -body { @@ -1276,6 +1370,7 @@ test textWind-16.3 {EmbWinTextStructureProc procedure} -setup { } -cleanup { pack .t } -result {} + test textWind-16.4 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end } -body { @@ -1290,7 +1385,7 @@ test textWind-16.4 {EmbWinTextStructureProc procedure} -setup { list [winfo ismapped .t.f] [.t bbox .t.f] } -cleanup { pack .t -} -result {1 {47 5 30 20}} +} -result [list 1 [list [expr {$padx+6*$fixedWidth}] $pady 30 20]] test textWind-17.1 {peer widgets and embedded windows} -setup { |