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)
commitf0eebfaefad9deacf3c033782d6b49b73cea4ce7 (patch)
treee82d67b61b40bf61b24a8eed52af49c8b50991ba /tests/bind.test
parent13d19756cf0ce7e3255a5d4c9a5efdfae1bc95df (diff)
parent85827aebcfddf76f4983bb8c6e4fbefbdd6270fd (diff)
downloadtk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.zip
tk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.tar.gz
tk-f0eebfaefad9deacf3c033782d6b49b73cea4ce7.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