diff options
author | gcramer <remarcg@gmx.net> | 2019-01-14 17:15:35 (GMT) |
---|---|---|
committer | gcramer <remarcg@gmx.net> | 2019-01-14 17:15:35 (GMT) |
commit | 2ab266714dbe135b01018b88d7a140da22621acc (patch) | |
tree | e72b28890e4fef3fabf8f18052b411753a415dd5 /tests | |
parent | 8a7e36f58804298b07cfc8ec27e10017321fea28 (diff) | |
download | tk-2ab266714dbe135b01018b88d7a140da22621acc.zip tk-2ab266714dbe135b01018b88d7a140da22621acc.tar.gz tk-2ab266714dbe135b01018b88d7a140da22621acc.tar.bz2 |
Fix in comparison of homegeneous equal sequences, a real problem with old implementation, see new test case bind-33.15.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bind.test | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/tests/bind.test b/tests/bind.test index b6087b1..d6d23bb 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6358,7 +6358,7 @@ test bind-33.1 {prefer longest match} -setup { } -cleanup { destroy .t.f } -result {a11} -test bind-33.2 {should prefer more specialized event} -setup { +test bind-33.2 {should prefer most specialized event} -setup { pack [frame .t.f] focus -force .t.f update @@ -6376,7 +6376,7 @@ test bind-33.2 {should prefer more specialized event} -setup { # is more specialized. But new implementation will be conform to old, # and so "11" is the expected result. } -result {11} -test bind-33.3 {should prefer more specialized event} -setup { +test bind-33.3 {should prefer most specialized event} -setup { pack [frame .t.f] focus -force .t.f update @@ -6396,7 +6396,7 @@ test bind-33.3 {should prefer more specialized event} -setup { # specialized than <1><1>. But new implementation will be conform to old, # and so "11" is the expected result. } -result {11} -test bind-33.4 {should prefer more specialized event} -setup { +test bind-33.4 {prefer most specialized event} -setup { pack [frame .t.f] focus -force .t.f update @@ -6564,6 +6564,41 @@ test bind-33.13 {prefer last in case of homogeneous patterns} -setup { # because both bindings are homogeneous equal, so the latter must # be preferred. } -result {last} +test bind-33.14 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <1><ButtonPress><1><ButtonPress> { lappend x "first" } + bind .t.f <ButtonPress><1><ButtonPress><1> { lappend x "last" } + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <1> + set x +} -cleanup { + destroy .t.f +} -result {last} +test bind-33.15 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <ButtonPress><1><ButtonPress><1> { lappend x "first" } + bind .t.f <1><ButtonPress><1><ButtonPress> { lappend x "last" } + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <1> + set x +} -cleanup { + destroy .t.f + # Old implementation fails, and returns "first", but this is wrong, + # because both bindings are homogeneous equal, so the latter must + # be preferred. +} -result {last} # cleanup |