summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/grid.test70
-rw-r--r--tests/pack.test91
2 files changed, 127 insertions, 34 deletions
diff --git a/tests/grid.test b/tests/grid.test
index 31e49df..75ead6e 100644
--- a/tests/grid.test
+++ b/tests/grid.test
@@ -5,7 +5,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: grid.test,v 1.8 2000/04/17 17:44:27 ericm Exp $
+# RCS: @(#) $Id: grid.test,v 1.9 2001/02/12 18:06:47 drh Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -198,6 +198,15 @@ test grid-4.3 {forget} {
} {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
grid_reset 4.3
+test grid-4.3.1 {forget} {
+ button .c
+ grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx {3 5} -pady {4 7} -sticky ns
+ grid forget .c
+ grid .c -row 0 -column 0
+ grid info .c
+} {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}
+grid_reset 4.3.1
+
test grid-4.4 {forget, calling Tk_UnmaintainGeometry} {
frame .f -bd 2 -relief raised
place .f -x 10 -y 20 -width 200 -height 100
@@ -915,9 +924,15 @@ grid_reset 13.7
test grid-13.8 {-padx} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
list [catch "grid .f -padx x" msg] $msg
-} {1 {bad padx value "x": must be positive screen distance}}
+} {1 {bad pad value "x": must be positive screen distance}}
grid_reset 13.8
+test grid-13.8.1 {-padx} {
+ frame .f -width 20 -height 20 -highlightthickness 0 -bg red
+ list [catch "grid .f -padx {10 x}" msg] $msg
+} {1 {bad 2nd pad value "x": must be positive screen distance}}
+grid_reset 13.8.1
+
test grid-13.9 {-padx} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
@@ -925,16 +940,33 @@ test grid-13.9 {-padx} {
set a "[winfo width .f] [winfo width .]"
grid .f -padx 1
update
- list $a "[winfo width .f] [winfo width .]"
-} {{200 200} {200 202}}
+ list $a "[winfo width .f] [winfo width .] [winfo x .f]"
+} {{200 200} {200 202 1}}
grid_reset 13.9
+test grid-13.9.1 {-padx} {
+ frame .f -width 200 -height 100 -highlightthickness 0 -bg red
+ grid .f
+ update
+ set a "[winfo width .f] [winfo width .]"
+ grid .f -padx {10 5}
+ update
+ list $a "[winfo width .f] [winfo width .] [winfo x .f]"
+} {{200 200} {200 215 10}}
+grid_reset 13.9.1
+
test grid-13.10 {-pady} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
list [catch "grid .f -pady x" msg] $msg
-} {1 {bad pady value "x": must be positive screen distance}}
+} {1 {bad pad value "x": must be positive screen distance}}
grid_reset 13.10
+test grid-13.10.1 {-pady} {
+ frame .f -width 20 -height 20 -highlightthickness 0 -bg red
+ list [catch "grid .f -pady {10 x}" msg] $msg
+} {1 {bad 2nd pad value "x": must be positive screen distance}}
+grid_reset 13.10.1
+
test grid-13.11 {-pady} {
frame .f -width 200 -height 100 -highlightthickness 0 -bg red
grid .f
@@ -942,10 +974,21 @@ test grid-13.11 {-pady} {
set a "[winfo height .f] [winfo height .]"
grid .f -pady 1
update
- list $a "[winfo height .f] [winfo height .]"
-} {{100 100} {100 102}}
+ list $a "[winfo height .f] [winfo height .] [winfo y .f]"
+} {{100 100} {100 102 1}}
grid_reset 13.11
+test grid-13.11.1 {-pady} {
+ frame .f -width 200 -height 100 -highlightthickness 0 -bg red
+ grid .f
+ update
+ set a "[winfo height .f] [winfo height .]"
+ grid .f -pady {4 16}
+ update
+ list $a "[winfo height .f] [winfo height .] [winfo y .f]"
+} {{100 100} {100 120 4}}
+grid_reset 13.11.1
+
test grid-13.12 {-ipad x and y} {
frame .f -width 20 -height 20 -highlightthickness 0 -bg red
grid columnconfigure . 0 -minsize 150
@@ -1244,16 +1287,3 @@ test grid-17.1 {forget and pending idle handlers} {
# cleanup
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/pack.test b/tests/pack.test
index abfd0d4..a36cb58 100644
--- a/tests/pack.test
+++ b/tests/pack.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: pack.test,v 1.5 1999/04/21 21:53:29 rjohnson Exp $
+# RCS: @(#) $Id: pack.test,v 1.6 2001/02/12 18:06:48 drh Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -75,6 +75,12 @@ test pack-1.4 {-side option} {
test pack-2.1 {x padding and filling} {
pack1 -side right -padx 20
} {20x40+260+80 240x200+0+0}
+test pack-2.1.1 {x padding and filling} {
+ pack1 -side right -padx {10 30}
+} {20x40+250+80 240x200+0+0}
+test pack-2.1.2 {x padding and filling} {
+ pack1 -side right -padx {35 5}
+} {20x40+275+80 240x200+0+0}
test pack-2.2 {x padding and filling} {
pack1 -side right -ipadx 20
} {60x40+240+80 240x200+0+0}
@@ -84,30 +90,51 @@ test pack-2.3 {x padding and filling} {
test pack-2.4 {x padding and filling} {
pack1 -side right -padx 20 -fill x
} {20x40+260+80 240x200+0+0}
+test pack-2.4.1 {x padding and filling} {
+ pack1 -side right -padx {9 31} -fill x
+} {20x40+249+80 240x200+0+0}
test pack-2.5 {x padding and filling} {
pack1 -side right -ipadx 20 -fill x
} {60x40+240+80 240x200+0+0}
test pack-2.6 {x padding and filling} {
pack1 -side right -ipadx 5 -padx 10 -fill x
} {30x40+260+80 250x200+0+0}
+test pack-2.6.1 {x padding and filling} {
+ pack1 -side right -ipadx 5 -padx {5 15} -fill x
+} {30x40+255+80 250x200+0+0}
test pack-2.7 {x padding and filling} {
pack1 -side top -padx 20
} {20x40+140+0 300x160+0+40}
+test pack-2.7.1 {x padding and filling} {
+ pack1 -side top -padx {0 40}
+} {20x40+120+0 300x160+0+40}
+test pack-2.7.2 {x padding and filling} {
+ pack1 -side top -padx {31 9}
+} {20x40+151+0 300x160+0+40}
test pack-2.8 {x padding and filling} {
pack1 -side top -ipadx 20
} {60x40+120+0 300x160+0+40}
test pack-2.9 {x padding and filling} {
pack1 -side top -ipadx 5 -padx 10
} {30x40+135+0 300x160+0+40}
+test pack-2.9.1 {x padding and filling} {
+ pack1 -side top -ipadx 5 -padx {5 15}
+} {30x40+130+0 300x160+0+40}
test pack-2.10 {x padding and filling} {
pack1 -side top -padx 20 -fill x
} {260x40+20+0 300x160+0+40}
+test pack-2.10.1 {x padding and filling} {
+ pack1 -side top -padx {25 15} -fill x
+} {260x40+25+0 300x160+0+40}
test pack-2.11 {x padding and filling} {
pack1 -side top -ipadx 20 -fill x
} {300x40+0+0 300x160+0+40}
test pack-2.12 {x padding and filling} {
pack1 -side top -ipadx 5 -padx 10 -fill x
} {280x40+10+0 300x160+0+40}
+test pack-2.12 {x padding and filling} {
+ pack1 -side top -ipadx 5 -padx {5 15} -fill x
+} {280x40+5+0 300x160+0+40}
set pad [winfo pixels .pack 1c]
test pack-2.13 {x padding and filling} {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -125,39 +152,66 @@ test pack-2.14 {x padding and filling} {
test pack-3.1 {y padding and filling} {
pack1 -side right -pady 20
} {20x40+280+80 280x200+0+0}
+test pack-3.1.1 {y padding and filling} {
+ pack1 -side right -pady {5 35}
+} {20x40+280+65 280x200+0+0}
+test pack-3.1.2 {y padding and filling} {
+ pack1 -side right -pady {40 0}
+} {20x40+280+100 280x200+0+0}
test pack-3.2 {y padding and filling} {
pack1 -side right -ipady 20
} {20x80+280+60 280x200+0+0}
test pack-3.3 {y padding and filling} {
pack1 -side right -ipady 5 -pady 10
} {20x50+280+75 280x200+0+0}
+test pack-3.3.1 {y padding and filling} {
+ pack1 -side right -ipady 5 -pady {5 15}
+} {20x50+280+70 280x200+0+0}
test pack-3.4 {y padding and filling} {
pack1 -side right -pady 20 -fill y
} {20x160+280+20 280x200+0+0}
+test pack-3.4.1 {y padding and filling} {
+ pack1 -side right -pady {35 5} -fill y
+} {20x160+280+35 280x200+0+0}
test pack-3.5 {y padding and filling} {
pack1 -side right -ipady 20 -fill y
} {20x200+280+0 280x200+0+0}
test pack-3.6 {y padding and filling} {
pack1 -side right -ipady 5 -pady 10 -fill y
} {20x180+280+10 280x200+0+0}
+test pack-3.6.1 {y padding and filling} {
+ pack1 -side right -ipady 5 -pady {0 20} -fill y
+} {20x180+280+0 280x200+0+0}
test pack-3.7 {y padding and filling} {
pack1 -side top -pady 20
} {20x40+140+20 300x120+0+80}
+test pack-3.7.1 {y padding and filling} {
+ pack1 -side top -pady {40 0}
+} {20x40+140+40 300x120+0+80}
test pack-3.8 {y padding and filling} {
pack1 -side top -ipady 20
} {20x80+140+0 300x120+0+80}
test pack-3.9 {y padding and filling} {
pack1 -side top -ipady 5 -pady 10
} {20x50+140+10 300x130+0+70}
+test pack-3.9.1 {y padding and filling} {
+ pack1 -side top -ipady 5 -pady {3 17}
+} {20x50+140+3 300x130+0+70}
test pack-3.10 {y padding and filling} {
pack1 -side top -pady 20 -fill y
} {20x40+140+20 300x120+0+80}
+test pack-3.10.1 {y padding and filling} {
+ pack1 -side top -pady {39 1} -fill y
+} {20x40+140+39 300x120+0+80}
test pack-3.11 {y padding and filling} {
pack1 -side top -ipady 20 -fill y
} {20x80+140+0 300x120+0+80}
test pack-3.12 {y padding and filling} {
pack1 -side top -ipady 5 -pady 10 -fill y
} {20x50+140+10 300x130+0+70}
+test pack-3.12.1 {y padding and filling} {
+ pack1 -side top -ipady 5 -pady {1 19} -fill y
+} {20x50+140+1 300x130+0+70}
set pad [winfo pixels .pack 1c]
test pack-3.13 {y padding and filling} {
pack forget .pack.a .pack.b .pack.c .pack.d
@@ -595,9 +649,15 @@ test pack-11.11 {info option} {
test pack-11.12 {info option} {
pack4 -padx 2
} 2
+test pack-11.12.1 {info option} {
+ pack4 -padx {2 9}
+} {2 9}
test pack-11.13 {info option} {
pack4 -pady 3
} 3
+test pack-11.13.1 {info option} {
+ pack4 -pady {3 11}
+} {3 11}
test pack-11.14 {info option} {
pack4 -side top
} top
@@ -670,18 +730,34 @@ test pack-12.15 {command options and errors} {
pack forget .pack.a .pack.b .pack.c .pack.d
list [catch {pack .pack.a -padx abc} msg] $msg
} {1 {bad pad value "abc": must be positive screen distance}}
+test pack-12.15.1 {command options and errors} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [catch {pack .pack.a -padx {5 abc}} msg] $msg
+} {1 {bad 2nd pad value "abc": must be positive screen distance}}
test pack-12.16 {command options and errors} {
pack forget .pack.a .pack.b .pack.c .pack.d
list [catch {pack .pack.a -padx -1} msg] $msg
} {1 {bad pad value "-1": must be positive screen distance}}
+test pack-12.16.1 {command options and errors} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [catch {pack .pack.a -padx {5 -1}} msg] $msg
+} {1 {bad 2nd pad value "-1": must be positive screen distance}}
test pack-12.17 {command options and errors} {
pack forget .pack.a .pack.b .pack.c .pack.d
list [catch {pack .pack.a -pady abc} msg] $msg
} {1 {bad pad value "abc": must be positive screen distance}}
+test pack-12.17.1 {command options and errors} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [catch {pack .pack.a -pady {0 abc}} msg] $msg
+} {1 {bad 2nd pad value "abc": must be positive screen distance}}
test pack-12.18 {command options and errors} {
pack forget .pack.a .pack.b .pack.c .pack.d
list [catch {pack .pack.a -pady -1} msg] $msg
} {1 {bad pad value "-1": must be positive screen distance}}
+test pack-12.18.1 {command options and errors} {
+ pack forget .pack.a .pack.b .pack.c .pack.d
+ list [catch {pack .pack.a -pady {0 -1}} msg] $msg
+} {1 {bad 2nd pad value "-1": must be positive screen distance}}
test pack-12.19 {command options and errors} {
pack forget .pack.a .pack.b .pack.c .pack.d
list [catch {pack .pack.a -ipadx abc} msg] $msg
@@ -984,16 +1060,3 @@ foreach i {pack1 pack2 pack3 pack4} {
# cleanup
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-