diff options
author | peter.spjuth@gmail.com <pspjuth> | 2004-01-09 22:23:26 (GMT) |
---|---|---|
committer | peter.spjuth@gmail.com <pspjuth> | 2004-01-09 22:23:26 (GMT) |
commit | 41e127adf20e67048bce9f37d6ed81ccafc25add (patch) | |
tree | bcc85547dddf9359f1fcf1e1f07c20c313763041 /tests | |
parent | 9c5f4049da417ed02b8a48adcc61ff8f88bfce2e (diff) | |
download | tk-41e127adf20e67048bce9f37d6ed81ccafc25add.zip tk-41e127adf20e67048bce9f37d6ed81ccafc25add.tar.gz tk-41e127adf20e67048bce9f37d6ed81ccafc25add.tar.bz2 |
Implementation of TIP#146,
"Add Overall Anchoring to the Grid Geometry Manager",
adding [grid anchor] subcommand.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/grid.test | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/tests/grid.test b/tests/grid.test index 2c13a38..187f061 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.22 2003/09/18 20:34:07 pspjuth Exp $ +# RCS: @(#) $Id: grid.test,v 1.23 2004/01/09 22:23:26 pspjuth Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -34,6 +34,7 @@ proc grid_reset {{test ?} {top .}} { grid rowconfigure . $i -weight 0 -minsize 0 -pad 0 -uniform "" } grid propagate . 1 + grid anchor . nw update } @@ -46,7 +47,7 @@ test grid-1.1 {basic argument checking} { test grid-1.2 {basic argument checking} { list [catch {grid foo bar} msg] $msg -} {1 {bad option "foo": must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}} +} {1 {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves}} test grid-1.3 {basic argument checking} { button .b @@ -1261,6 +1262,7 @@ test grid-16.1 {layout centering} { grid .$i -row $i -column $i -sticky nswe } grid propagate . 0 + grid anchor . center . configure -width 300 -height 250 update grid bbox . @@ -1691,6 +1693,51 @@ test grid-20.2 {recalculate size after removal (forget)} { } {1 1} grid_reset 20.2 +test grid-21.1 {anchor} { + list [catch {grid anchor . 1 xxx} msg] $msg +} {1 {wrong # args: should be "grid anchor window ?anchor?"}} +grid_reset 21.1 + +test grid-21.2 {anchor} { + list [catch {grid anchor .} msg] $msg +} {0 nw} +grid_reset 21.2 + +test grid-21.3 {anchor} { + list [catch {grid anchor . se;grid anchor .} msg] $msg +} {0 se} +grid_reset 21.3 + +test grid-21.4 {anchor} { + list [catch {grid anchor .x} msg] $msg +} {1 {bad window path name ".x"}} +grid_reset 21.4 + +test grid-21.5 {anchor} { + list [catch {grid anchor . x} msg] $msg +} {1 {bad anchor "x": must be n, ne, e, se, s, sw, w, nw, or center}} +grid_reset 21.5 + +test grid-21.6 {anchor} { + foreach i {0 1 2} { + frame .$i -bg gray -width 75 -height 50 -bd 2 -relief ridge + grid .$i -row $i -column $i -sticky nswe + } + grid propagate . 0 + . configure -width 300 -height 250 + + set res {} + foreach a {n ne e se s sw w nw center} { + grid anchor . $a + update + lappend res [grid bbox .] + } + set res +} [list {37 0 225 150} {75 0 225 150} {75 50 225 150} {75 100 225 150} \ + {37 100 225 150} {0 100 225 150} {0 50 225 150} {0 0 225 150} \ + {37 50 225 150}] +grid_reset 21.6 + # cleanup cleanupTests return |