diff options
author | culler <culler> | 2024-05-29 16:18:42 (GMT) |
---|---|---|
committer | culler <culler> | 2024-05-29 16:18:42 (GMT) |
commit | b39986a99d587498f5ba40e71cddf6ea0360b89f (patch) | |
tree | 6327e3356f8a0142e8863e1062aa6f5284449054 /tests | |
parent | 65eb0c8c381b378de6ac9095d2b5549078b4eee5 (diff) | |
download | tk-b39986a99d587498f5ba40e71cddf6ea0360b89f.zip tk-b39986a99d587498f5ba40e71cddf6ea0360b89f.tar.gz tk-b39986a99d587498f5ba40e71cddf6ea0360b89f.tar.bz2 |
Add a simple version of the processevents test command and use it for the event-9* tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/event.test | 85 |
1 files changed, 45 insertions, 40 deletions
diff --git a/tests/event.test b/tests/event.test index 7fcdab3..10dcf07 100644 --- a/tests/event.test +++ b/tests/event.test @@ -929,13 +929,13 @@ test event-9.11 {pointer window container = parent} -setup { create_and_pack_frames .one wm deiconify .one tkwait visibility .one.f1.f2 - _pause 200 - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish display of window set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .one.f1.f2 - _pause 200; # service crossing events + processevents end set result } -cleanup { bind all <Leave> {} @@ -953,13 +953,13 @@ test event-9.12 {pointer window container != parent} -setup { wm deiconify .one tkwait visibility .one.g event generate .one <Motion> -warp 1 -x 250 -y 250 - _pause 200 - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish mouse warp set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .one.g - _pause 200; # service crossing events -- crashes without this + processevents end set result } -cleanup { bind all <Leave> {} @@ -975,18 +975,19 @@ test event-9.13 {pointer window is a toplevel, toplevel destination} -setup { wm withdraw .two wm deiconify .two waitForWindowEvent .two <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish displaying windows set result | } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .two waitForWindowEvent .one <Enter> - # destroying .one here instead of in cleanup makes the test pass - destroy .one + processevents end set result } -cleanup { bind all <Leave> {} bind all <Enter> {} + destroy .one unset result } -result {|<Enter> NotifyNonlinear .one|} @@ -1000,17 +1001,18 @@ test event-9.14 {pointer window is a toplevel, tk internal destination} -setup { wm deiconify .one wm deiconify .two waitForWindowEvent .two <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .two waitForWindowEvent .one.f1.f2 <Enter> + processevents end + set result +} -cleanup { bind all <Leave> {} bind all <Enter> {} destroy .one - set result -} -cleanup { unset result } -result {|<Enter> NotifyNonlinearVirtual .one|<Enter> NotifyNonlinearVirtual .one.f1|<Enter> NotifyNonlinear .one.f1.f2|} @@ -1022,12 +1024,12 @@ test event-9.15 {pointer window is a toplevel, destination is screen root} -setu waitForWindowEvent .two <Enter> event generate .two <Motion> -warp 1 -x 275 -y 275 controlPointerWarpTiming - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} set result "|" } -body { - _pause 200; # ensure servicing of all scheduled events (only <Expose> events expected) + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .two + processevents end set result } -cleanup { bind all <Leave> {} @@ -1044,13 +1046,13 @@ test event-9.16 {Successive destructions (pointer window + parent), single gener create_and_pack_frames .one wm deiconify .one tkwait visibility .one.f1.f2 - _pause 200 - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish displaying window set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .one.f1 - _pause 200; # service crossing events + processevents end set result } -cleanup { bind all <Leave> {} @@ -1067,15 +1069,16 @@ test event-9.17 {Successive destructions (pointer window + parent), separate cro create_and_pack_frames .one wm deiconify .one tkwait visibility .one.f1.f2 - _pause 200 - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish displaying window set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .one.f1.f2 - _pause 200; # service crossing events + update; # make sure window is gone destroy .one.f1 - _pause 200; # service crossing events + update; # make sure window is gone + processevents end set result } -cleanup { bind all <Leave> {} @@ -1092,17 +1095,18 @@ test event-9.18 {Successive destructions (pointer window + ancestors including i create_and_pack_frames .two wm deiconify .two waitForWindowEvent .two.f1.f2 <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .two waitForWindowEvent .one <Enter> + processevents end + set result +} -cleanup { bind all <Leave> {} bind all <Enter> {} destroy .one - set result -} -cleanup { unset result } -result {|<Enter> NotifyNonlinear .one|} @@ -1114,24 +1118,25 @@ test event-9.19 {Successive destructions (pointer window + ancestors including i wm geometry .two 300x300+100+100 create_and_pack_frames .two wm deiconify .two - waitForWindowEvent .two.f1.f2 <Enter> toplevel .three pack propagate .three 0 wm geometry .three 300x300+110+110 create_and_pack_frames .three wm deiconify .three waitForWindowEvent .three.f1.f2 <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} + update; # finish displaying windows set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .three waitForWindowEvent .two.f1.f2 <Enter> + processevents end + set result +} -cleanup { bind all <Leave> {} bind all <Enter> {} destroy .two - set result -} -cleanup { unset result } -result {|<Enter> NotifyNonlinearVirtual .two|<Enter> NotifyNonlinearVirtual .two.f1|<Enter> NotifyNonlinear .two.f1.f2|} @@ -1144,12 +1149,12 @@ test event-9.20 {Successive destructions (pointer window + ancestors including i create_and_pack_frames .two wm deiconify .two waitForWindowEvent .two.f1.f2 <Enter> - bind all <Leave> {append result "<Leave> %d %W|"} - bind all <Enter> {append result "<Enter> %d %W|"} set result "|" } -body { + bind all <Leave> {append result "<Leave> %d %W|"} + bind all <Enter> {append result "<Enter> %d %W|"} destroy .two - _pause 200; # service events (only screen drawing events expected) + processevents end set result } -cleanup { bind all <Leave> {} |