diff options
author | jenglish <jenglish@flightlab.com> | 2007-06-10 03:25:31 (GMT) |
---|---|---|
committer | jenglish <jenglish@flightlab.com> | 2007-06-10 03:25:31 (GMT) |
commit | 6eb8176a7b42558bdb5ffa99b82a3d9839982deb (patch) | |
tree | a2107ff444528de2a2aeab10c2b81ea1c6fc2094 /tests/ttk/panedwindow.test | |
parent | 9764501288b757d0532c4eb230b67d2e69cefb0b (diff) | |
download | tk-6eb8176a7b42558bdb5ffa99b82a3d9839982deb.zip tk-6eb8176a7b42558bdb5ffa99b82a3d9839982deb.tar.gz tk-6eb8176a7b42558bdb5ffa99b82a3d9839982deb.tar.bz2 |
Added -width and -height options.
Added 'panes' method, return list of managed windows.
'sashpos' method is now documented as part of the public interface,
and details clarified.
Should be easier to set initial sash positions now [Alleviates #1659067].
Diffstat (limited to 'tests/ttk/panedwindow.test')
-rw-r--r-- | tests/ttk/panedwindow.test | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index 47764a2..81232ba 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -1,5 +1,5 @@ # -# $Id: panedwindow.test,v 1.3 2007/06/09 21:45:45 jenglish Exp $ +# $Id: panedwindow.test,v 1.4 2007/06/10 03:25:32 jenglish Exp $ # package require Tk 8.5 @@ -182,7 +182,7 @@ test panedwindow-4.END "cleanup" -body { # See #1292219 -test panedwindow-5.1 "Propage Map/Unmap state to children" -body { +test panedwindow-5.1 "Propagate Map/Unmap state to children" -body { set result [list] pack [ttk::panedwindow .pw] .pw add [ttk::button .pw.b] @@ -199,4 +199,51 @@ test panedwindow-5.1 "Propage Map/Unmap state to children" -body { destroy .pw } +### sashpos tests. +# +proc sashpositions {pw} { + set positions [list] + set npanes [llength [winfo children $pw]] + for {set i 0} {$i < $npanes - 1} {incr i} { + lappend positions [$pw sashpos $i] + } + return $positions +} + +test paned-sashpos-setup "Setup for sash position test" -body { + ttk::style theme use default + ttk::style configure -sashthickness 5 + + ttk::panedwindow .pw + .pw add [frame .pw.f1 -width 20 -height 20] + .pw add [frame .pw.f2 -width 20 -height 20] + .pw add [frame .pw.f3 -width 20 -height 20] + .pw add [frame .pw.f4 -width 20 -height 20] + + update idletasks + list [winfo reqwidth .pw] [winfo reqheight .pw] +} -result [list 20 [expr {20*4 + 5*3}]] + +test paned-sashpos-attempt-restore "Attempt to set sash positions" -body { + # This is not expected to succeed, since .pw isn't large enough yet. + # + .pw sashpos 0 30 + .pw sashpos 1 60 + .pw sashpos 2 90 + + list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw] +} -result [list 20 95 [list 0 5 10]] + +test paned-sashpos-restore "Set height then sash positions" -body { + # Setting sash positions after setting -height _should_ succeed. + # + .pw configure -height 120 + .pw sashpos 0 30 + .pw sashpos 1 60 + .pw sashpos 2 90 + list [winfo reqwidth .pw] [winfo reqheight .pw] [sashpositions .pw] +} -result [list 20 120 [list 30 60 90]] + +test paned-sashpos-cleanup "Clean up" -body { destroy .pw } + tcltest::cleanupTests |