summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--generic/tkPlace.c28
-rw-r--r--tests/place.test16
3 files changed, 31 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index ff299b3..196e3d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-07 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/place.test:
+ * generic/tkPlace.c: place info did not return all settings,
+ and didn't make sure the result was a proper list.
+ Put '-in' first in result to be more consistent with how
+ grid/pack info behaves. [Bug #635025][Bug #532022]
+
2002-11-07 Daniel Steffen <das@users.sourceforge.net>
* unix/Makefile.in: added macosx/README to dist target.
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 9d5e7f5..05a75fb 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.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: tkPlace.c,v 1.12 2002/06/14 22:25:12 jenglish Exp $
+ * RCS: @(#) $Id: tkPlace.c,v 1.13 2002/11/07 19:10:30 pspjuth Exp $
*/
#include "tkPort.h"
@@ -735,7 +735,11 @@ PlaceInfoCommand(interp, tkwin)
if (slavePtr == NULL) {
return TCL_OK;
}
- sprintf(buffer, "-x %d", slavePtr->x);
+ if (slavePtr->masterPtr != NULL) {
+ Tcl_AppendElement(interp, "-in");
+ Tcl_AppendElement(interp, Tk_PathName(slavePtr->masterPtr->tkwin));
+ }
+ sprintf(buffer, " -x %d", slavePtr->x);
Tcl_AppendResult(interp, buffer, (char *) NULL);
sprintf(buffer, " -relx %.4g", slavePtr->relX);
Tcl_AppendResult(interp, buffer, (char *) NULL);
@@ -768,22 +772,10 @@ PlaceInfoCommand(interp, tkwin)
Tcl_AppendResult(interp, " -relheight {}", (char *) NULL);
}
- Tcl_AppendResult(interp, " -anchor ",
- Tk_NameOfAnchor(slavePtr->anchor),
- (char *) NULL);
- if (slavePtr->borderMode == BM_OUTSIDE) {
- Tcl_AppendResult(interp, " -bordermode outside",
- (char *) NULL);
- } else if (slavePtr->borderMode == BM_IGNORE) {
- Tcl_AppendResult(interp, " -bordermode ignore", (char *) NULL);
- }
- if ((slavePtr->masterPtr != NULL)
- && (slavePtr->masterPtr->tkwin !=
- Tk_Parent(slavePtr->tkwin))) {
- Tcl_AppendResult(interp, " -in ",
- Tk_PathName(slavePtr->masterPtr->tkwin),
- (char *) NULL);
- }
+ Tcl_AppendElement(interp, "-anchor");
+ Tcl_AppendElement(interp, Tk_NameOfAnchor(slavePtr->anchor));
+ Tcl_AppendElement(interp, "-bordermode");
+ Tcl_AppendElement(interp, borderModeStrings[slavePtr->borderMode]);
return TCL_OK;
}
diff --git a/tests/place.test b/tests/place.test
index 02d87ac..4bf47fb 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -5,7 +5,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: place.test,v 1.7 2002/07/13 20:28:35 dgp Exp $
+# RCS: @(#) $Id: place.test,v 1.8 2002/11/07 19:10:30 pspjuth Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -27,13 +27,23 @@ update
test place-1.1 {Tk_PlaceCmd procedure, "info" option} {
place .t.f2 -x 0
place info .t.f2
-} {-x 0 -relx 0 -y 0 -rely 0 -width {} -relwidth {} -height {} -relheight {} -anchor nw}
+} {-in .t -x 0 -relx 0 -y 0 -rely 0 -width {} -relwidth {} -height {} -relheight {} -anchor nw -bordermode inside}
test place-1.2 {Tk_PlaceCmd procedure, "info" option} {
place .t.f2 -x 1 -y 2 -width 3 -height 4 -relx 0.1 -rely 0.2 \
-relwidth 0.3 -relheight 0.4 -anchor se -in .t.f \
-bordermode outside
place info .t.f2
-} {-x 1 -relx 0.1 -y 2 -rely 0.2 -width 3 -relwidth 0.3 -height 4 -relheight 0.4 -anchor se -bordermode outside -in .t.f}
+} {-in .t.f -x 1 -relx 0.1 -y 2 -rely 0.2 -width 3 -relwidth 0.3 -height 4 -relheight 0.4 -anchor se -bordermode outside}
+test place-1.3 {Tk_PlaceCmd procedure, "info" option} {
+ # Make sure the result is built as a proper list by using a space in parent
+ frame ".t.a b"
+ place .t.f2 -x 1 -y 2 -width {} -height 4 -relx 0.2 -rely 0.2 \
+ -relwidth 0.3 -relheight {} -anchor w -in ".t.a b" \
+ -bordermode ignore
+ set res [place info .t.f2]
+ destroy ".t.a b"
+ set res
+} {-in {.t.a b} -x 1 -relx 0.2 -y 2 -rely 0.2 -width {} -relwidth 0.3 -height 4 -relheight {} -anchor w -bordermode ignore}
test place-2.1 {ConfigureSlave procedure, -height option} {
list [catch {place .t.f2 -height abcd} msg] $msg