diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-04-23 10:10:27 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-04-23 10:10:27 (GMT) |
commit | 1df699cb6d8b09689e447d9a18fd9549e11206ff (patch) | |
tree | 27b554625996ef377c009d3c66ddbf8a2c9d5573 /tests | |
parent | 370b8a92d6b9937dd1fefcd6cb105c47195a3908 (diff) | |
parent | 269d4eec3f4013ae6828714fa998a38fd9dddd5b (diff) | |
download | tk-1df699cb6d8b09689e447d9a18fd9549e11206ff.zip tk-1df699cb6d8b09689e447d9a18fd9549e11206ff.tar.gz tk-1df699cb6d8b09689e447d9a18fd9549e11206ff.tar.bz2 |
Merge 8.7
Diffstat (limited to 'tests')
-rw-r--r-- | tests/event.test | 3 | ||||
-rw-r--r-- | tests/text.test | 4 | ||||
-rw-r--r-- | tests/textDisp.test | 33 | ||||
-rw-r--r-- | tests/textIndex.test | 37 | ||||
-rw-r--r-- | tests/textMark.test | 11 |
5 files changed, 85 insertions, 3 deletions
diff --git a/tests/event.test b/tests/event.test index 03405dd..c649303 100644 --- a/tests/event.test +++ b/tests/event.test @@ -829,6 +829,9 @@ test event-9 {no <Enter> event is generated for the container window when its 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 after 50 ; # Win specific - wait for SendInput to be executed update ; # idletasks not enough diff --git a/tests/text.test b/tests/text.test index 3778a12..5ec97eb 100644 --- a/tests/text.test +++ b/tests/text.test @@ -7492,10 +7492,10 @@ test text-32.3 {peer widget -start, -endline 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, -endline and deletion (bug 1630262)} -setup { destroy .t .pt diff --git a/tests/textDisp.test b/tests/textDisp.test index a2e960f..540ae31 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -1668,6 +1668,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 @@ -2360,45 +2375,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 {} diff --git a/tests/textIndex.test b/tests/textIndex.test index 2d42b8e..f2cccac 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -964,6 +964,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} diff --git a/tests/textMark.test b/tests/textMark.test index 938ce7f..bbe839f 100644 --- a/tests/textMark.test +++ b/tests/textMark.test @@ -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 |