summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2024-05-31 22:01:29 (GMT)
committerculler <culler>2024-05-31 22:01:29 (GMT)
commit7e11e70c9bc4f893b845c39baea7c50cac82ffad (patch)
tree425f3defd6c6ae001da3e24a7d87d9937cf09ae3
parent95c18ceae29b680b1769777fb97a05e9d0b7b603 (diff)
downloadtk-7e11e70c9bc4f893b845c39baea7c50cac82ffad.zip
tk-7e11e70c9bc4f893b845c39baea7c50cac82ffad.tar.gz
tk-7e11e70c9bc4f893b845c39baea7c50cac82ffad.tar.bz2
Fix typo in event.test; be less lazy in processevents
-rw-r--r--generic/tkTest.c8
-rw-r--r--tests/event.test14
2 files changed, 14 insertions, 8 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index b424a36..bd6dde3 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -1729,11 +1729,17 @@ static int ProcessEventsObjCmd(
"leave", "enter", "motion", "expose", NULL};
static const int eventTypes[] = {
LeaveNotify, EnterNotify, MotionNotify, Expose};
- int whichEvents[100];
+#define NUM_TYPES (sizeof(eventTypes)/sizeof(int))
+ int whichEvents[1 + NUM_TYPES];
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "eventtype ?eventtype ...?");
return TCL_ERROR;
}
+ if (objc > NUM_TYPES + 1) {
+ Tcl_WrongNumArgs(interp, 1, objv, "too many event types");
+ return TCL_ERROR;
+ }
+#undef NUM_TYPES
for (int n = 1; n < objc; n++) {
if (Tcl_GetIndexFromObj(interp, objv[n], eventTypeNames, "eventtype", 0,
&index) != TCL_OK) {
diff --git a/tests/event.test b/tests/event.test
index edfddc4..585eb96 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -936,7 +936,7 @@ test event-9.11 {pointer window container = parent} -setup {
bind all <Leave> {append result "<Leave> %d %W|"}
bind all <Enter> {append result "<Enter> %d %W|"}
destroy .one.f1.f2
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -960,7 +960,7 @@ test event-9.12 {pointer window container != parent} -setup {
bind all <Leave> {append result "<Leave> %d %W|"}
bind all <Enter> {append result "<Enter> %d %W|"}
destroy .one.g
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -983,7 +983,7 @@ test event-9.13 {pointer window is a toplevel, toplevel destination} -setup {
bind all <Enter> {append result "<Enter> %d %W|"}
destroy .two
waitForWindowEvent .one <Enter>
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -1055,7 +1055,7 @@ test event-9.16 {Successive destructions (pointer window + parent), single gener
bind all <Leave> {append result "<Leave> %d %W|"}
bind all <Enter> {append result "<Enter> %d %W|"}
destroy .one.f1
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -1082,7 +1082,7 @@ test event-9.17 {Successive destructions (pointer window + parent), separate cro
update; # make sure window is gone
destroy .one.f1
update; # make sure window is gone
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -1105,7 +1105,7 @@ test event-9.18 {Successive destructions (pointer window + ancestors including i
bind all <Enter> {append result "<Enter> %d %W|"}
destroy .two
waitForWindowEvent .one <Enter>
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}
@@ -1136,7 +1136,7 @@ test event-9.19 {Successive destructions (pointer window + ancestors including i
destroy .three
waitForWindowEvent .two.f1.f2 <Enter>
update idletasks; #finish destroying .two
- if {[tk windowingsystem] ne "x11" }]} {processevents enter leave}
+ if {[tk windowingsystem] ne "x11"} {processevents enter leave}
set result
} -cleanup {
bind all <Leave> {}