diff options
author | gcramer <remarcg@gmx.net> | 2019-01-10 14:14:55 (GMT) |
---|---|---|
committer | gcramer <remarcg@gmx.net> | 2019-01-10 14:14:55 (GMT) |
commit | 7a6e5802ad2316efd38f519c23ea346c7d36b0ec (patch) | |
tree | 9c3ec31935733ac555ac3a67f7f4220e1d68dab4 /tests | |
parent | ff3492bbc800f6cb8529315fc531339acef43fb4 (diff) | |
download | tk-7a6e5802ad2316efd38f519c23ea346c7d36b0ec.zip tk-7a6e5802ad2316efd38f519c23ea346c7d36b0ec.tar.gz tk-7a6e5802ad2316efd38f519c23ea346c7d36b0ec.tar.bz2 |
Fix in comparison of complex patterns, new test cases bind-33.9, bind-33.10, and bind-33.11.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bind.test | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/bind.test b/tests/bind.test index e3dbae9..2d46f9b 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6474,6 +6474,65 @@ test bind-33.8 {prefer most specialized} -setup { } -cleanup { destroy .t.f } -result {1} +test bind-33.9 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <1><2><2><Double-1> { lappend x "first" } + bind .t.f <1><Double-2><1><1> { lappend x "last" } + event generate .t.f <1> + event generate .t.f <2> + event generate .t.f <2> + event generate .t.f <1> + event generate .t.f <1> + set x +} -cleanup { + destroy .t.f +} -result {last} +test bind-33.10 {prefer last in case of homogeneous patterns} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <1><Double-2><1><1> { lappend x "first" } + bind .t.f <1><2><2><Double-1> { lappend x "last" } + event generate .t.f <1> + event generate .t.f <2> + event generate .t.f <2> + event generate .t.f <1> + event generate .t.f <1> + set x +} -cleanup { + destroy .t.f +} -result {last} +test bind-33.11 {should prefer most specialized} -setup { + pack [frame .t.f] + focus -force .t.f + update + set x {} +} -body { + bind .t.f <2><Double-1><Double-2><Double-1><2><2> { lappend x "first" } + bind .t.f <2><1><1><2><2><Double-1><Double-2> { lappend x "last" } + event generate .t.f <2> + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <2> + event generate .t.f <2> + event generate .t.f <1> + event generate .t.f <1> + event generate .t.f <2> + event generate .t.f <2> + set x +} -cleanup { + # 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. + destroy .t.f +} -result {last} # cleanup |