summaryrefslogtreecommitdiffstats
path: root/tests/bind.test
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2015-02-06 20:22:21 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2015-02-06 20:22:21 (GMT)
commit58e9f1afe26da4a67ba15060983d0ae36270d85c (patch)
treee82d67b61b40bf61b24a8eed52af49c8b50991ba /tests/bind.test
parentd562e0111dc2adeae2f8928df368a4c31299d00c (diff)
parent5caf2bbcaff347c7b35c25efba3c4a637cff66b8 (diff)
downloadtk-58e9f1afe26da4a67ba15060983d0ae36270d85c.zip
tk-58e9f1afe26da4a67ba15060983d0ae36270d85c.tar.gz
tk-58e9f1afe26da4a67ba15060983d0ae36270d85c.tar.bz2
Add support for an 'M' binding substitution that is replaced with the number of script-based binding patterns matched so far for the event.
Diffstat (limited to 'tests/bind.test')
-rw-r--r--tests/bind.test33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/bind.test b/tests/bind.test
index c777d66..77f944c 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -25,7 +25,6 @@ foreach event [bind all] {
bind all $event {}
}
-
proc unsetBindings {} {
bind all <Enter> {}
bind Test <Enter> {}
@@ -2172,6 +2171,38 @@ test bind-16.44 {ExpandPercents procedure} -setup {
destroy .t.f
} -result {?? ??}
+test bind-16.45 {ExpandPercents procedure} -setup {
+ entry .t.e
+ pack .t.e
+ focus -force .t.e
+ foreach p [event info] {event delete $p}
+ update
+} -body {
+ bind .t.e <Key> {set x "%M"}
+ bind Entry <Key> {set y "%M"}
+ bind all <Key> {set z "%M"}
+ set x none; set y none; set z none
+ event gen .t.e <Key-a>
+ list $x $y $z
+} -cleanup {
+ destroy .t.e
+} -result {0 1 2}
+test bind-16.46 {ExpandPercents procedure} -setup {
+ entry .t.e
+ pack .t.e
+ focus -force .t.e
+ foreach p [event info] {event delete $p}
+ update
+} -body {
+ bind all <Key> {set z "%M"}
+ bind Entry <Key> {set y "%M"}
+ bind .t.e <Key> {set x "%M"}
+ set x none; set y none; set z none
+ event gen .t.e <Key-a>
+ list $x $y $z
+} -cleanup {
+ destroy .t.e
+} -result {0 1 2}
test bind-17.1 {event command} -body {
event