diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tkPack.c | 24 | ||||
-rw-r--r-- | tests/grid.test | 14 | ||||
-rw-r--r-- | tests/pack.test | 18 |
4 files changed, 51 insertions, 11 deletions
@@ -1,3 +1,9 @@ +2001-09-23 Peter Spjuth <peter.spjuth@space.se> + * generic/tkPack.c (ConfigureSlaves): + * tests/pack.test: + * tests/grid.test: Pack accepted asymmetric values for -ipadx/y. + Only -padx/y supports asymmetry. [Bug #462348] + 2001-09-21 Jeff Hobbs <jeffh@ActiveState.com> * generic/tkWindow.c (Tk_CreateAnonymousWindow): diff --git a/generic/tkPack.c b/generic/tkPack.c index eeb538a..5ec3496 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPack.c,v 1.11 2001/09/21 21:34:10 hobbs Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.12 2001/09/23 11:30:44 pspjuth Exp $ */ #include "tkPort.h" @@ -1691,15 +1691,29 @@ ConfigureSlaves(interp, tkwin, objc, objv) positionGiven = 1; } } else if (index == CONF_IPADX) { - if (TkParsePadAmount(interp, slave, objv[i+1], - 0, &slavePtr->iPadX) != TCL_OK) { + if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + != TCL_OK) + || (tmp < 0)) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "bad ipadx value \"", + Tcl_GetString(objv[i+1]), + "\": must be positive screen distance", + (char *) NULL); return TCL_ERROR; } + slavePtr->iPadX = tmp * 2; } else if (index == CONF_IPADY) { - if (TkParsePadAmount(interp, slave, objv[i+1], - 0, &slavePtr->iPadY) != TCL_OK) { + if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + != TCL_OK) + || (tmp < 0)) { + Tcl_ResetResult(interp); + Tcl_AppendResult(interp, "bad ipady value \"", + Tcl_GetString(objv[i+1]), + "\": must be positive screen distance", + (char *) NULL); return TCL_ERROR; } + slavePtr->iPadY = tmp * 2; } else if (index == CONF_PADX) { if (TkParsePadAmount(interp, slave, objv[i+1], &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { diff --git a/tests/grid.test b/tests/grid.test index 55df6c1..b7711a0 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.12 2001/08/22 19:59:49 pspjuth Exp $ +# RCS: @(#) $Id: grid.test,v 1.13 2001/09/23 11:30:44 pspjuth Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -957,6 +957,12 @@ test grid-13.4 {-ipadx} { } {1 {bad ipadx value "x": must be positive screen distance}} grid_reset 13.4 +test grid-13.4.1 {-ipadx} { + frame .f -width 20 -height 20 -highlightthickness 0 -bg red + list [catch "grid .f -ipadx {5 5}" msg] $msg +} {1 {bad ipadx value "5 5": must be positive screen distance}} +grid_reset 13.4.1 + test grid-13.5 {-ipadx} { frame .f -width 200 -height 100 -highlightthickness 0 -bg red grid .f @@ -974,6 +980,12 @@ test grid-13.6 {-ipady} { } {1 {bad ipady value "x": must be positive screen distance}} grid_reset 13.6 +test grid-13.6.1 {-ipady} { + frame .f -width 20 -height 20 -highlightthickness 0 -bg red + list [catch "grid .f -ipady {5 5}" msg] $msg +} {1 {bad ipady value "5 5": must be positive screen distance}} +grid_reset 13.6.1 + test grid-13.7 {-ipady} { frame .f -width 200 -height 100 -highlightthickness 0 -bg red grid .f diff --git a/tests/pack.test b/tests/pack.test index 1603762..d05854f 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.7 2001/08/21 20:21:36 pspjuth Exp $ +# RCS: @(#) $Id: pack.test,v 1.8 2001/09/23 11:30:44 pspjuth Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] @@ -761,19 +761,27 @@ test pack-12.18.1 {command options and errors} { 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 -} {1 {bad pad value "abc": must be positive screen distance}} +} {1 {bad ipadx value "abc": must be positive screen distance}} test pack-12.20 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -ipadx -1} msg] $msg -} {1 {bad pad value "-1": must be positive screen distance}} +} {1 {bad ipadx value "-1": must be positive screen distance}} +test pack-12.20.1 {command options and errors} { + pack forget .pack.a .pack.b .pack.c .pack.d + list [catch {pack .pack.a -ipadx {5 5}} msg] $msg +} {1 {bad ipadx value "5 5": must be positive screen distance}} test pack-12.21 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -ipady abc} msg] $msg -} {1 {bad pad value "abc": must be positive screen distance}} +} {1 {bad ipady value "abc": must be positive screen distance}} test pack-12.22 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -ipady -1} msg] $msg -} {1 {bad pad value "-1": must be positive screen distance}} +} {1 {bad ipady value "-1": must be positive screen distance}} +test pack-12.22.1 {command options and errors} { + pack forget .pack.a .pack.b .pack.c .pack.d + list [catch {pack .pack.a -ipady {5 5}} msg] $msg +} {1 {bad ipady value "5 5": must be positive screen distance}} test pack-12.23 {command options and errors} { pack forget .pack.a .pack.b .pack.c .pack.d list [catch {pack .pack.a -side bac} msg] $msg |