diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
| commit | 0d5336db012f45753abace489f18f0ca299c6961 (patch) | |
| tree | b1bf3280a9046df99226158978502eeb26f5b0a3 /tests/safePrimarySelection.test | |
| parent | e97381a6d921de403516d5b761539a450f4af83c (diff) | |
| parent | 1320b8a2a9c1269a345d44d673a7a35707fbbe9c (diff) | |
| download | tk-core-tip-626.zip tk-core-tip-626.tar.gz tk-core-tip-626.tar.bz2 | |
Merge 9.0core-tip-626
Diffstat (limited to 'tests/safePrimarySelection.test')
| -rw-r--r-- | tests/safePrimarySelection.test | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test index fd237f0..4605735 100644 --- a/tests/safePrimarySelection.test +++ b/tests/safePrimarySelection.test @@ -67,20 +67,20 @@ set ::_test_tmp::script { namespace eval ::_test_tmp {} proc ::_test_tmp::getPrimarySelection {} { - if {[catch {::tk::GetSelection . PRIMARY} sel]} { - set sel {} - } - return $sel + if {[catch {::tk::GetSelection . PRIMARY} sel]} { + set sel {} + } + return $sel } proc ::_test_tmp::setPrimarySelection {} { - destroy .preset - text .preset -exportselection 1 - .preset insert end OLD_VALUE - # pack .preset - .preset tag add sel 1.0 end-1c - update - return + destroy .preset + text .preset -exportselection 1 + .preset insert end OLD_VALUE + # pack .preset + .preset tag add sel 1.0 end-1c + update + return } # Clearing the PRIMARY selection is troublesome. @@ -88,123 +88,123 @@ set ::_test_tmp::script { # However, the window must continue to exist, or some X11 servers # will set the PRIMARY selection to something else. proc ::_test_tmp::clearPrimarySelection {} { - destroy .clear - text .clear -exportselection 1 - .clear insert end TMP_VALUE - # pack .clear - .clear tag add sel 1.0 end-1c - update - .clear tag remove sel 1.0 end-1c - update - return + destroy .clear + text .clear -exportselection 1 + .clear insert end TMP_VALUE + # pack .clear + .clear tag add sel 1.0 end-1c + update + .clear tag remove sel 1.0 end-1c + update + return } # If this interpreter can write to the PRIMARY # selection, the commands below will do so. proc ::_test_tmp::tryText {} { - text .t -exportselection 1 - .t insert end PAYLOAD - pack .t - .t tag add sel 1.0 end-1c - update - return + text .t -exportselection 1 + .t insert end PAYLOAD + pack .t + .t tag add sel 1.0 end-1c + update + return } proc ::_test_tmp::tryEntry {} { - entry .t -exportselection 1 - .t insert end PAYLOAD - pack .t - .t selection range 0 end - update - return + entry .t -exportselection 1 + .t insert end PAYLOAD + pack .t + .t selection range 0 end + update + return } proc ::_test_tmp::tryTtkEntry {} { - ::ttk::entry .t -exportselection 1 - .t insert end PAYLOAD - pack .t - .t selection range 0 end - update - return + ::ttk::entry .t -exportselection 1 + .t insert end PAYLOAD + pack .t + .t selection range 0 end + update + return } proc ::_test_tmp::tryListbox {} { - listbox .t -exportselection 1 - .t insert end list1 PAYLOAD list3 - pack .t - .t selection set 1 - update - return + listbox .t -exportselection 1 + .t insert end list1 PAYLOAD list3 + pack .t + .t selection set 1 + update + return } proc ::_test_tmp::trySpinbox {ver} { - if {$ver == 1} { - # spinbox as entry - spinbox .t -exportselection 1 -values {1 2 3 4 5} - .t delete 0 end - .t insert end PAYLOAD - pack .t - .t selection range 0 end - update - return - # selects PAYLOAD - } elseif {$ver == 2} { - # spinbox spun - spinbox .t -exportselection 1 -values {1 2 3 4 5} - .t invoke buttonup - pack .t - .t selection range 0 end - update - return - # selects 2 - } else { - # spinbox spun/selected/spun - spinbox .t -exportselection 1 -values {1 2 3 4 5} - .t invoke buttonup - pack .t - .t selection range 0 end - update - .t invoke buttonup - update - return - # selects 3 - } + if {$ver == 1} { + # spinbox as entry + spinbox .t -exportselection 1 -values {1 2 3 4 5} + .t delete 0 end + .t insert end PAYLOAD + pack .t + .t selection range 0 end + update + return + # selects PAYLOAD + } elseif {$ver == 2} { + # spinbox spun + spinbox .t -exportselection 1 -values {1 2 3 4 5} + .t invoke buttonup + pack .t + .t selection range 0 end + update + return + # selects 2 + } else { + # spinbox spun/selected/spun + spinbox .t -exportselection 1 -values {1 2 3 4 5} + .t invoke buttonup + pack .t + .t selection range 0 end + update + .t invoke buttonup + update + return + # selects 3 + } } proc ::_test_tmp::tryTtkSpinbox {ver} { - if {$ver == 1} { - # ttk::spinbox as entry - ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} - .t delete 0 end - .t insert end PAYLOAD - pack .t - .t selection range 0 end - update - return - } elseif {$ver == 2} { - # ttk::spinbox spun - ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} - ::ttk::spinbox::Spin .t +1 - ::ttk::spinbox::Spin .t +1 - pack .t - # ttk::spinbox::Spin sets selection - update - return - # selects 2 - } else { - # ttk::spinbox spun/selected/spun - ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} - ::ttk::spinbox::Spin .t +1 - ::ttk::spinbox::Spin .t +1 - pack .t - # ttk::spinbox::Spin sets selection - update - ::ttk::spinbox::Spin .t +1 - update - return - # selects 3 - } + if {$ver == 1} { + # ttk::spinbox as entry + ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} + .t delete 0 end + .t insert end PAYLOAD + pack .t + .t selection range 0 end + update + return + } elseif {$ver == 2} { + # ttk::spinbox spun + ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} + ::ttk::spinbox::Spin .t +1 + ::ttk::spinbox::Spin .t +1 + pack .t + # ttk::spinbox::Spin sets selection + update + return + # selects 2 + } else { + # ttk::spinbox spun/selected/spun + ::ttk::spinbox .t -exportselection 1 -values {1 2 3 4 5} + ::ttk::spinbox::Spin .t +1 + ::ttk::spinbox::Spin .t +1 + pack .t + # ttk::spinbox::Spin sets selection + update + ::ttk::spinbox::Spin .t +1 + update + return + # selects 3 + } } } |
