summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ttk/entry.test12
-rw-r--r--tests/ttk/treeview.test54
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 8b5f490..2e5f43c 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -74,6 +74,18 @@ test entry-2.1 "Create entry before scrollbar" -body {
-expand false -fill x
} -cleanup {destroy .te .tsb}
+test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body {
+ pack [ttk::entry .te -xscrollcommand [list .tsb set]] \
+ -expand true -fill both
+ .te insert end [string repeat "abc" 50]
+ catch {update} ; # error triggers because the -xscrollcommand callback
+ # errors out: invalid command name ".tsb"
+ pack [ttk::scrollbar .tsb -orient horizontal -command [list .te xview]] \
+ -expand false -fill x
+ update ; # no error
+ lappend res [expr [lindex [.tsb get] 1] < 1] ; # scrollbar did update
+} -result {1} -cleanup {destroy .te .tsb}
+
test entry-2.2 "Initial scroll position" -body {
ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
.e insert end "0123456789"
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index c9dcf52..0ad0443 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -508,6 +508,60 @@ test treeview-9.1 "scrolling" -setup {
destroy .tree
} -result {I006}
+test treeview-9.2 {scrolling on see command - bug [14188104c3]} -setup {
+ toplevel .top
+ ttk::treeview .top.tree -show {} -height 10 -columns {label} \
+ -yscrollcommand [list .top.vs set]
+ ttk::scrollbar .top.vs -command {.top.tree yview}
+ grid .top.tree -row 0 -column 0 -sticky ns
+ grid .top.vs -row 0 -column 1 -sticky ns
+ update
+ proc setrows {n} {
+ .top.tree delete [.top.tree children {}]
+ for {set i 1} {$i <= $n} {incr i} {
+ .top.tree insert {} end -id row$i \
+ -values [list [format "Row %2.2d" $i]]
+ }
+ .top.tree see row1
+ update idletasks
+ }
+} -body {
+ setrows 10
+ set res [.top.vs get]
+ setrows 20
+ lappend res [expr [lindex [.top.vs get] 1] < 1]
+} -cleanup {
+ destroy .top
+} -result {0.0 1.0 1}
+
+test treeview-9.3 {scrolling on see command, requested item is closed} -setup {
+ toplevel .top
+ ttk::treeview .top.tree -show tree -height 10 -columns {label} \
+ -yscrollcommand [list .top.vs set]
+ ttk::scrollbar .top.vs -command {.top.tree yview}
+ grid .top.tree -row 0 -column 0 -sticky ns
+ grid .top.vs -row 0 -column 1 -sticky ns
+
+ .top.tree insert {} end -id a -text a
+ .top.tree insert a end -id b -text b
+ .top.tree insert b end -id c -text c
+ .top.tree insert c end -id d -text d
+ .top.tree insert d end -id e -text e
+ for {set i 6} {$i <= 15} {incr i} {
+ .top.tree insert {} end -id row$i \
+ -values [list [format "Row %2.2d" $i]]
+ }
+ update
+} -body {
+ set before [lindex [.top.vs get] 1]
+ .top.tree see e
+ update idletasks
+ set after [lindex [.top.vs get] 1]
+ expr $after < $before
+} -cleanup {
+ destroy .top
+} -result {1}
+
### identify tests:
#
proc identify* {tv comps args} {