summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-09-14 19:42:25 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-09-14 19:42:25 (GMT)
commitd9112839a88e25fdc849732b331ef56da48e192b (patch)
treea67e606b97577ca302df534b923da46f9fe6352d
parenta3561e3753f30dbcd0ef5db6dcc61146219fc513 (diff)
downloadtk-d9112839a88e25fdc849732b331ef56da48e192b.zip
tk-d9112839a88e25fdc849732b331ef56da48e192b.tar.gz
tk-d9112839a88e25fdc849732b331ef56da48e192b.tar.bz2
Fix [489b69a820]: Slightly wrong error message on 'wm attributes $w -junk'
-rw-r--r--tests/winWm.test3
-rw-r--r--tests/wm.test8
-rw-r--r--win/tkWinWm.c9
3 files changed, 9 insertions, 11 deletions
diff --git a/tests/winWm.test b/tests/winWm.test
index e19fcf2..030d11a 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -279,12 +279,11 @@ test winWm-6.2 {wm attributes} -constraints win -setup {
test winWm-6.3 {wm attributes} -constraints win -setup {
destroy .t
} -body {
- # This isn't quite the correct error message yet, but it works.
toplevel .t
wm attributes .t -foo
} -cleanup {
destroy .t
-} -returnCodes error -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+} -returnCodes error -result {bad attribute "-foo": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test winWm-6.4 {wm attributes -alpha} -constraints win -setup {
destroy .t
diff --git a/tests/wm.test b/tests/wm.test
index 7959302..52a2422 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -128,18 +128,14 @@ test wm-attributes-1.1 {usage} -returnCodes error -body {
wm attributes
} -result {wrong # args: should be "wm option window ?arg ...?"}
test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body {
- # This is the wrong error to output - unix has it right, but it's
- # not critical.
wm attributes . _
-} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+} -result {bad attribute "_": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test wm-attributes-1.2.2 {usage} -constraints win -returnCodes error -body {
wm attributes . -alpha 1.0 -disabled
} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
test wm-attributes-1.2.3 {usage} -constraints win -returnCodes error -body {
- # This is the wrong error to output - unix has it right, but it's
- # not critical.
wm attributes . -to
-} -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}
+} -result {bad attribute "-to": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost}
test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error -body {
wm attributes . _
} -result {bad attribute "_": must be -alpha, -topmost, -zoomed, -fullscreen, or -type}
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 414df3e..d2602f7 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -3072,9 +3072,6 @@ WmAttributesCmd(
}
for (i = 3; i < objc; i += 2) {
string = Tcl_GetStringFromObj(objv[i], &length);
- if ((length < 2) || (string[0] != '-')) {
- goto configArgs;
- }
if (strncmp(string, "-disabled", length) == 0) {
stylePtr = &style;
styleBit = WS_DISABLED;
@@ -3107,6 +3104,12 @@ WmAttributesCmd(
Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "TOPMOST", NULL);
return TCL_ERROR;
}
+ } else if (i == 3) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "bad attribute \"%s\": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost",
+ string));
+ Tcl_SetErrorCode(interp, "TK", "WM", "ATTR", "UNRECOGNIZED", NULL);
+ return TCL_ERROR;
} else {
goto configArgs;
}