summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpspjuth <peter.spjuth@gmail.com>2003-07-16 23:16:51 (GMT)
committerpspjuth <peter.spjuth@gmail.com>2003-07-16 23:16:51 (GMT)
commitbefc533415b9b751e657c3cdbb0ce70f23fd5b39 (patch)
tree9e2f5794e14efb7bc6208615b4ae4a496b643880
parent03f27a638c3dfbf52e7072f5f377f02ab644d527 (diff)
downloadtk-befc533415b9b751e657c3cdbb0ce70f23fd5b39.zip
tk-befc533415b9b751e657c3cdbb0ce70f23fd5b39.tar.gz
tk-befc533415b9b751e657c3cdbb0ce70f23fd5b39.tar.bz2
Make sure all options can be set
to their default value. [Bug #697652]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tkFrame.c7
-rw-r--r--tests/frame.test31
3 files changed, 39 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b86cdf..4802e24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-17 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/frame.test:
+ * generic/tkFrame.c (CreateFrame): Make sure all options can be set
+ to their default value. [Bug #697652]
+
2003-07-16 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkWindow.c (Initialize): do not free uninit'ed dstring.
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index f4f0a53..928bea1 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFrame.c,v 1.15 2003/01/22 14:32:59 dkf Exp $
+ * RCS: @(#) $Id: tkFrame.c,v 1.16 2003/07/16 23:16:52 pspjuth Exp $
*/
#include "default.h"
@@ -594,7 +594,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
if (useOption == NULL) {
useOption = Tk_GetOption(new, "use", "Use");
}
- if (useOption != NULL) {
+ if ((useOption != NULL) && (*useOption != 0)) {
if (TkpUseWindow(interp, new, useOption) != TCL_OK) {
goto error;
}
@@ -605,6 +605,9 @@ CreateFrame(clientData, interp, objc, objv, type, appName)
if (colormapName == NULL) {
colormapName = Tk_GetOption(new, "colormap", "Colormap");
}
+ if ((colormapName != NULL) && (*colormapName == 0)) {
+ colormapName = NULL;
+ }
if (visualName != NULL) {
visual = Tk_GetVisual(interp, new, visualName, &depth,
(colormapName == NULL) ? &colormap : (Colormap *) NULL);
diff --git a/tests/frame.test b/tests/frame.test
index 5decf68..22f4091 100644
--- a/tests/frame.test
+++ b/tests/frame.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: frame.test,v 1.8 2003/04/01 21:06:34 dgp Exp $
+# RCS: @(#) $Id: frame.test,v 1.9 2003/07/16 23:16:52 pspjuth Exp $
package require tcltest 2.1
eval tcltest::configure $argv
@@ -86,8 +86,21 @@ test frame-1.7 {frame configuration options} {
destroy .f
set result
} {1 {can't modify -container option after widget is created}}
+test frame-1.8 {frame configuration options} {
+ # Make sure all options can be set to the default value
+ frame .f
+ set opts {}
+ foreach opt [.f configure] {
+ if {[llength $opt] == 5} {
+ lappend opts [lindex $opt 0] [lindex $opt 4]
+ }
+ }
+ eval frame .g $opts
+ destroy .f .g
+} {}
+
frame .f
-set i 8
+set i 9
foreach test {
{-background #ff0000 #ff0000 non-existent
{unknown color name "non-existent"}}
@@ -186,12 +199,24 @@ test frame-2.10 {toplevel configuration options} {
destroy .t .x
set result
} {1 {A window cannot have both the -use and the -container option set.}}
+test frame-2.11 {toplevel configuration options} {
+ # Make sure all options can be set to the default value
+ toplevel .f
+ set opts {}
+ foreach opt [.f configure] {
+ if {[llength $opt] == 5} {
+ lappend opts [lindex $opt 0] [lindex $opt 4]
+ }
+ }
+ eval toplevel .g $opts
+ destroy .f .g
+} {}
catch {destroy .t}
toplevel .t -width 300 -height 150
wm geometry .t +0+0
update
-set i 11
+set i 12
foreach test {
{-background #ff0000 #ff0000 non-existent
{unknown color name "non-existent"}}