diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-07-04 18:20:32 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-07-04 18:20:32 (GMT) |
commit | cf5c1014eabdc1f16d5d92821a8c665f8c622e6f (patch) | |
tree | 5841ec90c830f33977c06a1d0f192cc246c16837 | |
parent | a9e70540b4068a1d0edddba49d7c94360312117c (diff) | |
download | tk-cf5c1014eabdc1f16d5d92821a8c665f8c622e6f.zip tk-cf5c1014eabdc1f16d5d92821a8c665f8c622e6f.tar.gz tk-cf5c1014eabdc1f16d5d92821a8c665f8c622e6f.tar.bz2 |
Re-apply [37ba4f8cdb]: In test-cases same optimization as everywhere else: KeyPress -> Key and ButtonPress -> Button.
This somehow got lost in this branch
-rw-r--r-- | tests/event.test | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/event.test b/tests/event.test index 8058069..30d40b9 100644 --- a/tests/event.test +++ b/tests/event.test @@ -1,9 +1,9 @@ # This file is a Tcl script to test the code in tkEvent.c. It is # organized in the standard fashion for Tcl tests. # -# Copyright (c) 1994 The Regents of the University of California. -# Copyright (c) 1994-1995 Sun Microsystems, Inc. -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright © 1994 The Regents of the University of California. +# Copyright © 1994-1995 Sun Microsystems, Inc. +# Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 @@ -88,8 +88,8 @@ proc _init_keypress_lookup {} { # Lookup an event in the keypress table. # For example: # Q -> Q -# . -> period -# / -> slash +# ; -> semicolon +# > -> greater # Delete -> Delete # Escape -> Escape @@ -111,7 +111,7 @@ proc _keypress_lookup {char} { } } -# Lookup and generate a pair of KeyPress and KeyRelease events +# Lookup and generate a pair of Key and KeyRelease events proc _keypress {win key} { set keysym [_keypress_lookup $key] @@ -124,7 +124,7 @@ proc _keypress {win key} { if {[focus] != $win} { focus -force $win } - event generate $win <KeyPress-$keysym> + event generate $win <Key-$keysym> _pause 50 if {[focus] != $win} { focus -force $win @@ -194,10 +194,10 @@ test event-1.1 {Tk_HandleEvent procedure, filter events for dead windows} -setup update bind .b <Destroy> { lappend x destroy - event generate .b <1> + event generate .b <Button-1> event generate .b <ButtonRelease-1> } - bind .b <1> { + bind .b <Button-1> { lappend x button } @@ -269,7 +269,7 @@ test event-2.3(keypress) {type into entry widget, triple click, hit Delete key, event generate $e <Enter> for {set i 0} {$i < 3} {incr i} { _pause 100 - event generate $e <ButtonPress-1> + event generate $e <Button-1> _pause 100 event generate $e <ButtonRelease-1> } @@ -324,7 +324,7 @@ test event-2.6(keypress) {type into text widget, triple click, event generate $e <Enter> for {set i 0} {$i < 3} {incr i} { _pause 100 - event generate $e <ButtonPress-1> + event generate $e <Button-1> _pause 100 event generate $e <ButtonRelease-1> } @@ -356,7 +356,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests # Click down to set the insert cursor position event generate $e <Enter> - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] @@ -382,7 +382,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests # Now click and click and drag to the left, over "Tcl/Tk selection" - event generate $e <ButtonPress-1> -x $current_x -y $current_y + event generate $e <Button-1> -x $current_x -y $current_y while {[$e compare $current >= [list $anchor - 4 char]]} { foreach {current_x current_y} [_text_ind_to_x_y $e $current] break @@ -423,7 +423,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests # Click down to set the insert cursor position event generate $e <Enter> - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] @@ -449,7 +449,7 @@ test event-3.1(click-drag) {click and drag in a text widget, this tests # Now click and click and drag to the left, over "Tcl/Tk selection" - event generate $e <ButtonPress-1> -x $current_x -y $current_y + event generate $e <Button-1> -x $current_x -y $current_y while {$current >= ($anchor - 4)} { foreach {current_x current_y} [_text_ind_to_x_y $e $current] break @@ -488,11 +488,11 @@ test event-4.1(double-click-drag) {click down, click up, click down again, # Click down, release, then click down again event generate $e <Enter> - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y _pause 50 - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 # Save the highlighted text @@ -559,11 +559,11 @@ test event-4.2(double-click-drag) {click down, click up, click down again, # Click down, release, then click down again event generate $e <Enter> - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y _pause 50 - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 set result [list] @@ -631,17 +631,17 @@ test event-5.1(triple-click-drag) {Triple click and drag across lines in a event generate $e <Enter> - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y _pause 50 - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 event generate $e <ButtonRelease-1> -x $anchor_x -y $anchor_y _pause 50 - event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y + event generate $e <Button-1> -x $anchor_x -y $anchor_y _pause 50 set result [list] @@ -681,7 +681,7 @@ test event-6.1(button-state) {button press in a window that is then } -body { set t [toplevel .t] - event generate $t <ButtonPress-1> + event generate $t <Button-1> destroy $t set t [toplevel .t] set motion nomotion @@ -720,11 +720,11 @@ test event-7.1(double-click) {A double click on a lone character # Double click near left hand egde of the letter A event generate $e <Enter> - event generate $e <ButtonPress-1> -x $left_x -y $left_y + event generate $e <Button-1> -x $left_x -y $left_y _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 - event generate $e <ButtonPress-1> -x $left_x -y $left_y + event generate $e <Button-1> -x $left_x -y $left_y _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 @@ -735,18 +735,18 @@ test event-7.1(double-click) {A double click on a lone character # Clear selection by clicking at 0,0 - event generate $e <ButtonPress-1> -x 0 -y 0 + event generate $e <Button-1> -x 0 -y 0 _pause 50 event generate $e <ButtonRelease-1> -x 0 -y 0 _pause 50 # Double click near right hand edge of the letter A - event generate $e <ButtonPress-1> -x $right_x -y $right_y + event generate $e <Button-1> -x $right_x -y $right_y _pause 50 event generate $e <ButtonRelease-1> -x $right_x -y $right_y _pause 50 - event generate $e <ButtonPress-1> -x $right_x -y $right_y + event generate $e <Button-1> -x $right_x -y $right_y _pause 50 event generate $e <ButtonRelease-1> -x $right_x -y $right_y _pause 50 @@ -787,11 +787,11 @@ test event-7.2(double-click) {A double click on a lone character # Double click near left hand egde of the letter A event generate $e <Enter> - event generate $e <ButtonPress-1> -x $left_x -y $left_y + event generate $e <Button-1> -x $left_x -y $left_y _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 - event generate $e <ButtonPress-1> -x $left_x -y $left_y + event generate $e <Button-1> -x $left_x -y $left_y _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 @@ -802,18 +802,18 @@ test event-7.2(double-click) {A double click on a lone character # Clear selection by clicking at 0,0 - event generate $e <ButtonPress-1> -x 0 -y 0 + event generate $e <Button-1> -x 0 -y 0 _pause 50 event generate $e <ButtonRelease-1> -x 0 -y 0 _pause 50 # Double click near right hand edge of the letter A - event generate $e <ButtonPress-1> -x $right_x -y $right_y + event generate $e <Button-1> -x $right_x -y $right_y _pause 50 event generate $e <ButtonRelease-1> -x $right_x -y $right_y _pause 50 - event generate $e <ButtonPress-1> -x $right_x -y $right_y + event generate $e <Button-1> -x $right_x -y $right_y _pause 50 event generate $e <ButtonRelease-1> -x $right_x -y $right_y _pause 50 @@ -837,7 +837,7 @@ test event-8 {event generate with keysyms corresponding to set e [entry $t.e] pack $e tkwait visibility $e - bind $e <KeyPress> {lappend res keycode: %k keysym: %K} + bind $e <Key> {lappend res keycode: %k keysym: %K} focus -force $e update event generate $e <diaeresis> |