From d71f8610d6bfae2495ad9fdcdb996139b53771f5 Mon Sep 17 00:00:00 2001 From: mdejong Date: Fri, 29 Oct 2004 22:28:30 +0000 Subject: * tests/wm.test: Add Win32 test cases for attributes subcommand. * win/tkWinWm.c (WmAttributesCmd): Fixup broken option processing logic for attributes subcommand. --- ChangeLog | 7 +++++++ tests/wm.test | 19 +++++++++++++++++-- win/tkWinWm.c | 20 +++++++++++--------- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index feb2619..f435a83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-10-29 Mo DeJong + + * tests/wm.test: Add Win32 test cases for attributes + subcommand. + * win/tkWinWm.c (WmAttributesCmd): Fixup broken + option processing logic for attributes subcommand. + 2004-10-28 Mo DeJong * win/tkWin32Dll.c (DllMain, _except_dllmain_detach_handler): diff --git a/tests/wm.test b/tests/wm.test index ff75136..e3c5c92 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -7,7 +7,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: wm.test,v 1.29 2004/10/05 22:04:46 hobbs Exp $ +# RCS: @(#) $Id: wm.test,v 1.30 2004/10/29 22:28:30 mdejong Exp $ # This file tests window manager interactions that work across # platforms. Window manager tests that only work on a specific @@ -131,7 +131,15 @@ test wm-attributes-1.2.1 {usage} win { list [catch {wm attributes . _} err] $err } {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}} -test wm-attributes-1.2.2 {usage} unix { +test wm-attributes-1.2.2 {usage} win { + list [catch {wm attributes . -alpha 1.0 -disabled} err] $err +} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}} + +test wm-attributes-1.2.3 {usage} win { + list [catch {wm attributes . -to} err] $err +} {1 {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-disabled ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"}} + +test wm-attributes-1.2.4 {usage} unix { list [catch {wm attributes . _} err] $err } {1 {wrong # args: should be "wm attributes window"}} @@ -1756,6 +1764,13 @@ test wm-state-2.17 {state change after map} { wm state .t } {normal} +test wm-state-2.18 {state change after map} win { + deleteWindows + toplevel .t + update + wm state .t zoomed + wm state .t +} {zoomed} test wm-withdraw-1.1 {usage} { list [catch {wm withdraw} err] $err diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 4a57d6a..a00d0ad 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.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: tkWinWm.c,v 1.78 2004/10/21 01:13:06 hobbs Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.79 2004/10/29 22:28:31 mdejong Exp $ */ #include "tkWinInt.h" @@ -2859,7 +2859,7 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) char *string; int i, boolean, length; - if (objc < 3) { + if ((objc < 3) || ((objc > 5) && ((objc%2) == 0))) { configArgs: Tcl_WrongNumArgs(interp, 2, objv, "window" @@ -2902,12 +2902,12 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) } else if (strncmp(string, "-alpha", length) == 0) { stylePtr = &exStyle; styleBit = WS_EX_LAYERED; - } else if ((strncmp(string, "-toolwindow", length) == 0) - && (length >= 3)) { + } else if ((length > 3) + && (strncmp(string, "-toolwindow", length) == 0)) { stylePtr = &exStyle; styleBit = WS_EX_TOOLWINDOW; - } else if ((strncmp(string, "-topmost", length) == 0) - && (length >= 3)) { + } else if ((length > 3) + && (strncmp(string, "-topmost", length) == 0)) { stylePtr = &exStyle; styleBit = WS_EX_TOPMOST; if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) { @@ -2922,7 +2922,7 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) if (styleBit == WS_EX_LAYERED) { double dval; - if (i == objc-1) { + if (objc == 4) { Tcl_SetDoubleObj(Tcl_GetObjResult(interp), wmPtr->alpha); } else { if ((i < objc-1) && @@ -2964,7 +2964,7 @@ WmAttributesCmd(tkwin, winPtr, interp, objc, objv) != TCL_OK)) { return TCL_ERROR; } - if (i == objc-1) { + if (objc == 4) { Tcl_SetIntObj(Tcl_GetObjResult(interp), ((*stylePtr & styleBit) != 0)); } else if (boolean) { @@ -4826,8 +4826,10 @@ WmStateCmd(tkwin, winPtr, interp, objc, objv) } else if (index == OPT_WITHDRAWN) { wmPtr->flags |= WM_WITHDRAWN; TkpWmSetState(winPtr, WithdrawnState); - } else { /* OPT_ZOOMED */ + } else if (index == OPT_ZOOMED) { TkpWmSetState(winPtr, ZoomState); + } else { + Tcl_Panic("wm state not matched"); } } else { if (wmPtr->iconFor != NULL) { -- cgit v0.12