diff options
author | gcramer <remarcg@gmx.net> | 2019-01-13 10:13:47 (GMT) |
---|---|---|
committer | gcramer <remarcg@gmx.net> | 2019-01-13 10:13:47 (GMT) |
commit | f094a8c8a291d30c8013117f93b1a90b664986bd (patch) | |
tree | 41d24eb99aa1b81e8cd430e58f2f1c842b172b08 /tests/bind.test | |
parent | 7a6e5802ad2316efd38f519c23ea346c7d36b0ec (diff) | |
download | tk-f094a8c8a291d30c8013117f93b1a90b664986bd.zip tk-f094a8c8a291d30c8013117f93b1a90b664986bd.tar.gz tk-f094a8c8a291d30c8013117f93b1a90b664986bd.tar.bz2 |
(1) Return type of Tk_CreateBinding changed to 'Mask'. (2) Fix of issue with homogeneous equal sequences. New test cases bind-32.12 and bind-32.13.
Diffstat (limited to 'tests/bind.test')
-rw-r--r-- | tests/bind.test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/bind.test b/tests/bind.test index 2d46f9b..b6087b1 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6527,11 +6527,42 @@ test bind-33.11 {should prefer most specialized} -setup { event generate .t.f <2> set x } -cleanup { + destroy .t.f # This test case shows that old implementation has an issue, because # in my opinion it is expected that first one is matching, this binding # is more specialized. But new implementation will be conform to old, # and so "last" is the expected result. +} -result {last} +test bind-33.12 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <Control-1><1> { lappend x "first" } + bind .t.f <1><Control-1> { lappend x "last" } + event generate .t.f <Control-1> + event generate .t.f <Control-1> + set x +} -cleanup { + destroy .t.f +} -result {last} +test bind-33.13 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <1><Control-1> { lappend x "first" } + bind .t.f <Control-1><1> { lappend x "last" } + event generate .t.f <Control-1> + event generate .t.f <Control-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} |