Index: tests/textWind.test ================================================================== --- tests/textWind.test +++ tests/textWind.test @@ -8,103 +8,130 @@ package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands - -# Create entries in the option database to be sure that geometry options -# like border width have predictable values. - -option add *Text.borderWidth 2 -option add *Text.highlightThickness 2 -option add *Text.font {Courier -12} - deleteWindows -# Widget used in tests 1.* - 16.* -text .t -width 30 -height 6 -bd 2 -highlightthickness 2 + +set fixedFont {"Courier New" -12} +set fixedHeight [font metrics $fixedFont -linespace] +set fixedWidth [font measure $fixedFont m] +set fixedAscent [font metrics $fixedFont -ascent] + +# Widget used in almost all tests +set tWidth 30 +set tHeight 6 +text .t -width $tWidth -height $tHeight -bd 2 -highlightthickness 2 \ + -font $fixedFont 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 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. wm withdraw . 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" .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 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" .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 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 { .t insert end "This is the first line" .t insert end "\nAnd this is a second line, which wraps around" .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" .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 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" .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 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 .t insert end "This is the first line" test textWind-2.1 {TkTextWindowCmd procedure} -body { @@ -299,11 +326,12 @@ .t window create 1.0 -window .f .t window configure 1.0 -foo bar } -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" frame .f -width 10 -height 20 -bg $color .t window create 1.3 -window .f @@ -312,11 +340,12 @@ update .t index .f } -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" frame .f -width 10 -height 20 -bg $color .t window create 1.3 -window .f @@ -325,12 +354,14 @@ update catch {.t index .f} 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" frame .t.f -width 10 -height 20 -bg $color .t window create 1.3 -window .t.f @@ -339,11 +370,12 @@ update .t index .t.f } -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" frame .t.f -width 10 -height 20 -bg $color .t window create 1.3 -window .t.f @@ -352,12 +384,14 @@ update catch {.t index .t.f} 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" frame .f -width 10 -height 20 -bg $color .t window create 1.3 @@ -365,11 +399,13 @@ .t window configure 1.3 -window .f update 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 { .t insert 1.0 "Some sample text" frame .f @@ -448,12 +484,11 @@ .t window configure 1.0 -align top catch {.t window configure 1.0 -align gorp} .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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -460,11 +495,12 @@ .t window create 1.2 -window .f update 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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -471,12 +507,15 @@ .t window create 1.2 -window .f update 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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -484,11 +523,12 @@ .t window configure 1.2 -window .f update 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" frame .f -width 10 -height 20 -bg $color .t window create 1.2 -align bottom @@ -495,12 +535,15 @@ .t window configure 1.2 -window .f update 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 { .t insert 1.0 "Some sample text" .t window create 1.2 -create {frame .f -width 10 -height 20 -bg $color} @@ -507,14 +550,16 @@ update .t window configure 1.2 -create {frame .f -width 20 -height 10 -bg $color} 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 {} } -body { .t insert 1.0 "Some sample text" @@ -523,16 +568,18 @@ lappend result [.t bbox 1.2] [.t bbox 1.3] .f configure -width 25 -height 30 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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -541,14 +588,15 @@ place .f -in .t -x 100 -y 50 update 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 { .t insert 1.0 "Some sample text" frame .t.f -width 10 -height 20 -bg $color @@ -557,14 +605,15 @@ place .t.f -x 100 -y 50 update 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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -571,12 +620,16 @@ .t window create 1.2 -window .f bind .f {set x destroyed} 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 { .t insert 1.0 "Some sample text" frame .f -width 10 -height 20 -bg $color @@ -613,32 +666,32 @@ update list [winfo exists .f] [winfo width .f] [winfo height .f] [.t index .f] } -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 set msg $args } } -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 update 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 set msg $args } @@ -650,30 +703,20 @@ set msg xyzzy update list $msg [.t bbox 1.5] } -cleanup { rename bgerror {} -} -result {{{bad window path name "gorp"}} {40 11 0 0}} +} -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} -setup { .t delete 1.0 end destroy .t.f proc bgerror args { global msg - if {[lsearch -exact $msg $args] == -1} { - lappend msg $args - } - } - -test textWind-10.4 {EmbWinLayoutProc procedure, error in creating window} -constraints { - textfonts -} -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" set msg {} after idle { @@ -691,21 +734,21 @@ } lappend msg [.t bbox 1.5] [winfo exists .t.f.f] } -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" .t window create 1.5 -create { frame .t.f @@ -716,42 +759,40 @@ lappend msg [winfo exists .t.f.f] } -cleanup { 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 if {[lsearch -exact $msg $args] == -1} { lappend msg $args } } } -body { .t insert 1.0 "Some sample text" + update .t window create 1.5 -create { concat .t } set msg {} update 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" .t window create 1.5 -create { toplevel .t2 -width 100 -height 150 @@ -761,19 +802,20 @@ set msg {} update 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" .t window create 1.5 -create { toplevel .t2 -width 100 -height 150 @@ -802,13 +844,12 @@ update .t index .t.b } -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 { .t configure -wrap char .t insert 1.0 "Some sample text" @@ -815,14 +856,15 @@ frame .f -width 125 -height 20 -bg $color -bd 2 -relief raised .t window create 1.12 -window .f 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 { .t configure -wrap char .t insert 1.0 "Some sample text" @@ -830,14 +872,15 @@ .t window create 1.12 -window .f update 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 { .t configure -wrap char .t insert 1.0 "Some sample text" @@ -845,11 +888,14 @@ .t window create 1.12 -window .f update 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 } -body { .t configure -wrap none @@ -858,14 +904,15 @@ .t window create 1.12 -window .f update 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 { .t configure -wrap none .t insert 1.0 "Some sample text" @@ -873,14 +920,15 @@ .t window create 1.12 -window .f update 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 { .t configure -wrap char .t insert 1.0 "Some sample text" @@ -888,12 +936,13 @@ .t window create 1.12 -window .f update 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 destroy .f place forget .t @@ -907,11 +956,12 @@ update winfo geom .f } -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 place forget .t pack .t @@ -925,11 +975,12 @@ winfo geom .t.f } -cleanup { 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 place forget .t pack .t @@ -947,13 +998,12 @@ } -cleanup { destroy .f 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 { .t insert 1.0 "xyzzy\nFirst window here: " .t configure -wrap none @@ -967,14 +1017,16 @@ .t xview scroll 5 units update 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 { .t insert 1.0 "xyzzy\nFirst window here: " .t configure -wrap none @@ -988,14 +1040,15 @@ .t xview moveto 0 .t xview scroll 25 units 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 destroy .f } -body { @@ -1033,12 +1086,15 @@ .t window create 1.2 -window .f -align top -padx 2 -pady 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1045,12 +1101,15 @@ .t window create 1.2 -window .f -align center -padx 2 -pady 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1057,12 +1116,15 @@ .t window create 1.2 -window .f -align baseline -padx 2 -pady 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1069,12 +1131,15 @@ .t window create 1.2 -window .f -align bottom -padx 2 -pady 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1081,12 +1146,15 @@ .t window create 1.2 -window .f -align top -padx 2 -pady 1 -stretch 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1093,12 +1161,15 @@ .t window create 1.2 -window .f -align center -padx 2 -pady 1 -stretch 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1105,12 +1176,15 @@ .t window create 1.2 -window .f -align baseline -padx 2 -pady 1 -stretch 1 update 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 { .t insert 1.0 "Some sample text" frame .f -width 5 -height 5 -bg $color @@ -1117,14 +1191,15 @@ .t window create 1.2 -window .f -align bottom -padx 2 -pady 1 -stretch 1 update 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 { .t configure -spacing1 5 -spacing3 2 .t delete 1.0 end @@ -1132,12 +1207,15 @@ frame .f -width 5 -height 5 -bg $color .t window create 1.2 -window .f -align center -padx 2 -pady 1 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 { .t delete 1.0 end destroy .f @@ -1155,10 +1233,11 @@ update return $x } -cleanup { destroy .f } -result {modified removed unmapped updated} + test textWind-14.2 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text" @@ -1174,10 +1253,11 @@ update return $x } -cleanup { destroy .f } -result {modified deleted updated} + test textWind-14.3 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .f } -body { .t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9" @@ -1189,10 +1269,11 @@ update ; after 10 list $result [winfo ismapped .f] } -cleanup { destroy .f } -result {1 0} + test textWind-14.4 {EmbWinDelayedUnmap procedure} -setup { .t delete 1.0 end destroy .t.f } -body { .t insert 1.0 "Some sample text\nAnother line\n3\n4\n5\n6\n7\n8\n9" @@ -1205,17 +1286,17 @@ list $result [winfo ismapped .t.f] } -cleanup { 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 { .t configure -spacing1 0 -spacing2 0 -spacing3 0 \ -wrap none @@ -1225,11 +1306,12 @@ .t tag add a 1.1 .t tag add a 1.3 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 { .t delete 1.0 end destroy .f @@ -1243,10 +1325,11 @@ update winfo ismapped .f } -cleanup { pack .t } -result 0 + test textWind-16.2 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end destroy .f .f2 } -body { .t configure -spacing1 0 -spacing2 0 -spacing3 0 \ @@ -1261,11 +1344,16 @@ pack .f2 -before .t update 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 { .t configure -wrap none .t insert 1.0 "Some sample text" @@ -1274,10 +1362,11 @@ pack forget .t update } -cleanup { pack .t } -result {} + test textWind-16.4 {EmbWinTextStructureProc procedure} -setup { .t delete 1.0 end } -body { .t configure -spacing1 0 -spacing2 0 -spacing3 0 \ -wrap none @@ -1288,11 +1377,11 @@ pack forget .t update 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 { destroy .t .tt .f } -body {