summaryrefslogtreecommitdiffstats
path: root/tests/panedwindow.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-10-24 17:22:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-10-24 17:22:53 (GMT)
commit8fe41c5f5161f7a62a5a03cb9f3c2298d97d418c (patch)
tree28dc2d93877f5ee96f7c219e50e5968afd2a11a8 /tests/panedwindow.test
parent0f9c3bda5775877cf26e9c274cc60b759eb99e86 (diff)
downloadtk-8fe41c5f5161f7a62a5a03cb9f3c2298d97d418c.zip
tk-8fe41c5f5161f7a62a5a03cb9f3c2298d97d418c.tar.gz
tk-8fe41c5f5161f7a62a5a03cb9f3c2298d97d418c.tar.bz2
Add -hide and -stretch options to panedwindow widgets. (TIPs 177 and 179)
Thanks to Brian Griffin for developing these! [Patch 983886]
Diffstat (limited to 'tests/panedwindow.test')
-rw-r--r--tests/panedwindow.test211
1 files changed, 156 insertions, 55 deletions
diff --git a/tests/panedwindow.test b/tests/panedwindow.test
index 1ca995d..b8881d6 100644
--- a/tests/panedwindow.test
+++ b/tests/panedwindow.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: panedwindow.test,v 1.15 2004/09/10 06:58:42 hobbs Exp $
+# RCS: @(#) $Id: panedwindow.test,v 1.16 2004/10/24 17:22:55 dkf Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -14,65 +14,79 @@ tcltest::loadTestedCommands
set i 1
panedwindow .p
-foreach test {
- {-background "#ff0000" "#ff0000" non-existent
- {unknown color name "non-existent"}}
- {-bd 4 4 badValue {bad screen distance "badValue"}}
- {-bg "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
- {-borderwidth 1.3 1 badValue {bad screen distance "badValue"}}
- {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
- {-handlesize 20 20 badValue {bad screen distance "badValue"}}
- {-height 20 20 badValue {bad screen distance "badValue"}}
- {-opaqueresize true 1 foo {expected boolean value but got "foo"}}
- {-orient horizontal horizontal badValue
- {bad orient "badValue": must be horizontal or vertical}}
- {-relief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
- {-sashcursor arrow arrow badValue {bad cursor spec "badValue"}}
- {-sashpad 1.3 1 badValue {bad screen distance "badValue"}}
- {-sashrelief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
- {-sashwidth 10 10 badValue {bad screen distance "badValue"}}
- {-showhandle true 1 foo {expected boolean value but got "foo"}}
- {-width 402 402 badValue {bad screen distance "badValue"}}
+foreach {testName testData} {
+ panedwindow-1.1 {-background
+ "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
+ panedwindow-1.2 {-bd
+ 4 4 badValue {bad screen distance "badValue"}}
+ panedwindow-1.3 {-bg
+ "#ff0000" "#ff0000" non-existent {unknown color name "non-existent"}}
+ panedwindow-1.4 {-borderwidth
+ 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1.5 {-cursor
+ arrow arrow badValue {bad cursor spec "badValue"}}
+ panedwindow-1.6 {-handlesize
+ 20 20 badValue {bad screen distance "badValue"}}
+ panedwindow-1.7 {-height
+ 20 20 badValue {bad screen distance "badValue"}}
+ panedwindow-1.8 {-opaqueresize
+ true 1 foo {expected boolean value but got "foo"}}
+ panedwindow-1.9 {-orient
+ horizontal horizontal
+ badValue {bad orient "badValue": must be horizontal or vertical}}
+ panedwindow-1.10 {-relief
+ groove groove
+ 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
+ panedwindow-1.11 {-sashcursor
+ arrow arrow badValue {bad cursor spec "badValue"}}
+ panedwindow-1.12 {-sashpad
+ 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1.13 {-sashrelief
+ groove groove
+ 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
+ panedwindow-1.14 {-sashwidth
+ 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1.15 {-showhandle
+ true 1 foo {expected boolean value but got "foo"}}
+ panedwindow-1.16 {-width
+ 402 402 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
- test panedwindow-1.$i {configuration options} {
- .p configure $name [lindex $test 1]
- list [lindex [.p configure $name] 4] [.p cget $name]
- } [list [lindex $test 2] [lindex $test 2]]
- incr i
- if {[lindex $test 3] ne ""} {
- test panedwindow-1.$i {configuration options} {
- list [catch {.p configure $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
- }
- .p configure $name [lindex [.p configure $name] 3]
- incr i
+ lassign $testData optionName goodIn goodOut badIn badOut
+ test ${testName}(good) "configuration options: $optionName" {
+ .p configure $optionName $goodIn
+ list [lindex [.p configure $optionName] 4] [.p cget $optionName]
+ } [list $goodOut $goodOut]
+ test ${testName}(bad) "configuration options: $optionName" -body {
+ .p configure $optionName $badIn
+ } -returnCodes error -result $badOut
+ # Reset to default
+ .p configure $optionName [lindex [.p configure $optionName] 3]
}
.p add [button .b]
.p add [button .c]
-foreach test {
- {-after .c .c badValue {bad window path name "badValue"}}
- {-before .c .c badValue {bad window path name "badValue"}}
- {-height 10 10 badValue {bad screen distance "badValue"}}
- {-minsize 10 10 badValue {bad screen distance "badValue"}}
- {-padx 1.3 1 badValue {bad screen distance "badValue"}}
- {-pady 1.3 1 badValue {bad screen distance "badValue"}}
- {-sticky nsew nesw abcd {bad stickyness value "abcd": must be a string containing zero or more of n, e, s, and w}}
- {-width 10 10 badValue {bad screen distance "badValue"}}
+foreach {testName testData} {
+ panedwindow-1a.1 {-after .c .c badValue {bad window path name "badValue"}}
+ panedwindow-1a.2 {-before .c .c badValue {bad window path name "badValue"}}
+ panedwindow-1a.3 {-height 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.4 {-hide false 0 foo {expected boolean value but got "foo"}}
+ panedwindow-1a.5 {-minsize 10 10 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.6 {-padx 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.7 {-pady 1.3 1 badValue {bad screen distance "badValue"}}
+ panedwindow-1a.8 {-sticky nsew nesw abcd {bad stickyness value "abcd": must be a string containing zero or more of n, e, s, and w}}
+ panedwindow-1a.9 {-stretch alw always foo {bad stretch "foo": must be one of always, first, last, middle, or never}}
+ panedwindow-1a.10 {-width 10 10 badValue {bad screen distance "badValue"}}
} {
- set name [lindex $test 0]
- test panedwindow-1.$i {configuration options} {
- .p paneconfigure .b $name [lindex $test 1]
- list [lindex [.p paneconfigure .b $name] 4] [.p panecget .b $name]
- } [list [lindex $test 2] [lindex $test 2]]
- incr i
- if {[lindex $test 3] ne ""} {
- test panedwindow-1.$i {configuration options} {
- list [catch {.p paneconfigure .b $name [lindex $test 3]} msg] $msg
- } [list 1 [lindex $test 4]]
- }
- .p paneconfigure .b $name [lindex [.p paneconfigure .b $name] 3]
- incr i
+ lassign $test testName optionName goodIn goodOut badIn badOut
+ test ${testName}(good) "configuration options: $optionName" {
+ .p paneconfigure .b $optionName $goodIn
+ list [lindex [.p paneconfigure .b $optionName] 4] \
+ [.p panecget .b $optionName]
+ } [list $goodOut $goodOut]
+ test ${testName}(bad) "configuration options: $optionName" -body {
+ .p paneconfigure .b $optionName $badIn
+ } -returnCodes error -result $badOut
+ # Reset to default
+ .p paneconfig .b $optionName [lindex [.p paneconfig .b $optionName] 3]
}
destroy .p .b .c
@@ -2199,6 +2213,93 @@ test panedwindow-24.28 {ConfigurePanes, restrict possible panes} {
destroy .f .f.f .f.f.f .f.f.f.p .b
set result
} [list 0 ""]
+test panedwindow-24.29 {ConfigurePanes, -hide works} {
+ panedwindow .p
+ frame .f1 -width 10 -bg red
+ frame .f2 -width 10 -bg white
+ frame .f3 -width 10 -bg blue
+ frame .f4 -width 10 -bg green
+ .p add .f1 .f2 .f3 .f4
+ pack .p -fill both -expand 1
+ update
+ set result [list]
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo ismapped .f1] [winfo ismapped .f2] [winfo ismapped .f3] [winfo ismapped .f4]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ destroy .f1 .f2 .f3 .f4 .p
+ set result
+} [list 1 1 1 1 10 10 10 10 1 0 1 1 10 10 10 24]
+test panedwindow-24.30 {ConfigurePanes, -stretch first} {
+ panedwindow .p
+ frame .f1 -width 10 -bg red
+ frame .f2 -width 10 -bg white
+ frame .f3 -width 10 -bg blue
+ frame .f4 -width 10 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch first
+ pack .p -fill both -expand 1
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ destroy .f1 .f2 .f3 .f4 .p
+ set result
+} [list 10 10 10 10 24 10 10 10]
+test panedwindow-24.31 {ConfigurePanes, -stretch middle} {
+ panedwindow .p
+ frame .f1 -width 10 -bg red
+ frame .f2 -width 10 -bg white
+ frame .f3 -width 10 -bg blue
+ frame .f4 -width 10 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch middle
+ pack .p -fill both -expand 1
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ destroy .f1 .f2 .f3 .f4 .p
+ set result
+} [list 10 10 10 10 10 10 24 10]
+test panedwindow-24.32 {ConfigurePanes, -stretch always} {
+ panedwindow .p
+ frame .f1 -width 10 -bg red
+ frame .f2 -width 10 -bg white
+ frame .f3 -width 10 -bg blue
+ frame .f4 -width 10 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch always
+ pack .p -fill both -expand 1
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ destroy .f1 .f2 .f3 .f4 .p
+ set result
+} [list 10 10 10 10 14 10 14 14]
+test panedwindow-24.33 {ConfigurePanes, -stretch never} {
+ panedwindow .p
+ frame .f1 -width 10 -bg red
+ frame .f2 -width 10 -bg white
+ frame .f3 -width 10 -bg blue
+ frame .f4 -width 10 -bg green
+ .p add .f1 .f2 .f3 .f4 -stretch never
+ pack .p -fill both -expand 1
+ update
+ set result [list]
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ .p paneconfigure .f2 -hide 1
+ update
+ lappend result [winfo width .f1] [winfo width .f2] [winfo width .f3] [winfo width .f4]
+ destroy .f1 .f2 .f3 .f4 .p
+ set result
+} [list 10 10 10 10 10 10 10 10]
test panedwindow-25.1 {Unlink, remove a paned with -before/-after refs} {
# Bug 928413