summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2021-09-15 19:05:49 (GMT)
committerfvogel <fvogelnew1@free.fr>2021-09-15 19:05:49 (GMT)
commit39a9ff355cf04cc3faadfa441d3e38d5732ae2b7 (patch)
treec4b0c87a20d6c54e39325da4b8ba54ef50264d82
parent29521ce8cc82db85d7897f6d4eebeff44879f674 (diff)
parent32befc53df03408b95b8e1ace173a67f7278d259 (diff)
downloadtk-39a9ff355cf04cc3faadfa441d3e38d5732ae2b7.zip
tk-39a9ff355cf04cc3faadfa441d3e38d5732ae2b7.tar.gz
tk-39a9ff355cf04cc3faadfa441d3e38d5732ae2b7.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 f659a13..1e2c02e 100644
--- a/tests/winWm.test
+++ b/tests/winWm.test
@@ -280,12 +280,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 e24181e..dd198b8 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 153a7a3..28f4838 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2912,9 +2912,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;
@@ -2947,6 +2944,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;
}