summaryrefslogtreecommitdiffstats
path: root/tests/select.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/select.test')
-rw-r--r--tests/select.test681
1 files changed, 284 insertions, 397 deletions
diff --git a/tests/select.test b/tests/select.test
index 77bfb2e..8cbfd39 100644
--- a/tests/select.test
+++ b/tests/select.test
@@ -1,6 +1,6 @@
# This file is a Tcl script to test out Tk's selection management code,
-# especially the "selection" command. It is organized in the standard fashion
-# for Tcl tests.
+# especially the "selection" command. It is organized in the standard
+# fashion for Tcl tests.
#
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
@@ -11,12 +11,12 @@
# environment variable TK_ALT_DISPLAY is set to an alternate display.
#
-package require tcltest 2.2
-namespace import ::tcltest::*
-namespace import ::tk::test:loadTkCommand
+package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands
+namespace import -force ::tk::test:loadTkCommand
+
global longValue selValue selInfo
set selValue {}
@@ -109,55 +109,48 @@ foreach i {a b c d e f g j h i j k l m o p q r s t u v w x y z} {
}
# Now we start the main body of the test code
-
-test select-1.1 {Tk_CreateSelHandler procedure} -setup {
+
+test select-1.1 {Tk_CreateSelHandler procedure} {
setup
-} -body {
lsort [selection get TARGETS]
-} -result {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}
-test select-1.2 {Tk_CreateSelHandler procedure} -setup {
+} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}
+test select-1.2 {Tk_CreateSelHandler procedure} {
setup
-} -body {
selection handle .f1 {handler TEST} TEST
lsort [selection get TARGETS]
-} -result {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
-test select-1.3 {Tk_CreateSelHandler procedure} -setup {
+} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
+test select-1.3 {Tk_CreateSelHandler procedure} {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler TEST} TEST
set selValue "Test value"
set selInfo ""
list [selection get TEST] $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-1.4.1 {Tk_CreateSelHandler procedure} -constraints unix -setup {
+} {{Test value} {TEST 0 4000}}
+test select-1.4.1 {Tk_CreateSelHandler procedure} unix {
setup
-} -body {
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
lsort [selection get TARGETS]
-} -result {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}
-test select-1.4.2 {Tk_CreateSelHandler procedure} -constraints win -setup {
+} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}
+test select-1.4.2 {Tk_CreateSelHandler procedure} win {
setup
-} -body {
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
lsort [selection get TARGETS]
-} -result {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
-test select-1.5 {Tk_CreateSelHandler procedure} -setup {
+} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
+test select-1.5 {Tk_CreateSelHandler procedure} {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
set selValue ""
set selInfo ""
list [selection get] $selInfo
-} -result {{} {STRING 0 4000}}
-test select-1.6.1 {Tk_CreateSelHandler procedure} -constraints unix -setup {
+} {{} {STRING 0 4000}}
+test select-1.6.1 {Tk_CreateSelHandler procedure} unix {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
set selValue ""
@@ -166,12 +159,11 @@ test select-1.6.1 {Tk_CreateSelHandler procedure} -constraints unix -setup {
selection get -type TEST
selection handle .f1 {handler TEST2} TEST
selection get -type TEST
- list $selInfo [lsort [selection get TARGETS]]
-} -result {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
-test select-1.6.2 {Tk_CreateSelHandler procedure} -constraints win -setup {
+ list [set selInfo] [lsort [selection get TARGETS]]
+} {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
+test select-1.6.2 {Tk_CreateSelHandler procedure} win {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler TEST} TEST
selection handle .f1 {handler STRING}
set selValue ""
@@ -180,157 +172,141 @@ test select-1.6.2 {Tk_CreateSelHandler procedure} -constraints win -setup {
selection get -type TEST
selection handle .f1 {handler TEST2} TEST
selection get -type TEST
- list $selInfo [lsort [selection get TARGETS]]
-} -result {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-1.7.1 {Tk_CreateSelHandler procedure} -constraints unix -setup {
+ list [set selInfo] [lsort [selection get TARGETS]]
+} {{STRING 0 4000 TEST 0 4000 TEST2 0 4000} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-1.7.1 {Tk_CreateSelHandler procedure} unix {
setup
-} -body {
selection own -selection CLIPBOARD .f1
selection handle -selection CLIPBOARD .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f1 {handler TEST2} STRING
list [lsort [selection get -selection PRIMARY TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-1.7.2 {Tk_CreateSelHandler procedure} -constraints win -setup {
+} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-1.7.2 {Tk_CreateSelHandler procedure} win {
setup
-} -body {
selection own -selection CLIPBOARD .f1
selection handle -selection CLIPBOARD .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f1 {handler TEST2} STRING
list [lsort [selection get -selection PRIMARY TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-1.8 {Tk_CreateSelHandler procedure} -setup {
+} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-1.8 {Tk_CreateSelHandler procedure} {
setup
-} -body {
selection handle -format INTEGER -type TEST .f1 {handler TEST}
lsort [selection get TARGETS]
-} -result {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
+} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}
##############################################################################
-test select-2.1 {Tk_DeleteSelHandler procedure} -constraints unix -setup {
+test select-2.1 {Tk_DeleteSelHandler procedure} unix {
setup
-} -body {
selection handle .f1 {handler STRING}
selection handle -type TEST .f1 {handler TEST}
selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type TEST .f1 {}
lappend result [lsort [selection get TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING}}
-test select-2.2 {Tk_DeleteSelHandler procedure} -constraints unix -setup {
+} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING}}
+test select-2.2 {Tk_DeleteSelHandler procedure} unix {
setup
-} -body {
selection handle .f1 {handler STRING}
selection handle -type TEST .f1 {handler TEST}
selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type USER .f1 {}
lappend result [lsort [selection get TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
-test select-2.3 {Tk_DeleteSelHandler procedure} -constraints unix -setup {
+} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER UTF8_STRING} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING}}
+test select-2.3 {Tk_DeleteSelHandler procedure} unix {
setup
-} -body {
selection own -selection CLIPBOARD .f1
selection handle -selection PRIMARY .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {}
list [lsort [selection get TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-2.4 {Tk_DeleteSelHandler procedure} -constraints win -setup {
+} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW UTF8_STRING} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-2.4 {Tk_DeleteSelHandler procedure} win {
setup
-} -body {
selection handle .f1 {handler STRING}
selection handle -type TEST .f1 {handler TEST}
selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type TEST .f1 {}
lappend result [lsort [selection get TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER}}
-test select-2.5 {Tk_DeleteSelHandler procedure} -constraints win -setup {
+} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW USER}}
+test select-2.5 {Tk_DeleteSelHandler procedure} win {
setup
-} -body {
selection handle .f1 {handler STRING}
selection handle -type TEST .f1 {handler TEST}
selection handle -type USER .f1 {handler USER}
set result [list [lsort [selection get TARGETS]]]
selection handle -type USER .f1 {}
lappend result [lsort [selection get TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-2.6 {Tk_DeleteSelHandler procedure} -constraints win -setup {
+} {{MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW USER} {MULTIPLE STRING TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-2.6 {Tk_DeleteSelHandler procedure} win {
setup
-} -body {
selection own -selection CLIPBOARD .f1
selection handle -selection PRIMARY .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {}
list [lsort [selection get TARGETS]] \
[lsort [selection get -selection CLIPBOARD TARGETS]]
-} -result {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-2.7 {Tk_DeleteSelHandler procedure} -setup {
+} {{MULTIPLE STRING TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-2.7 {Tk_DeleteSelHandler procedure} {
setup
-} -body {
selection handle .f1 {handler STRING}
list [selection handle .f1 {}] [selection handle .f1 {}]
-} -result {{} {}}
+} {{} {}}
##############################################################################
-test select-3.1 {Tk_OwnSelection procedure} -setup {
+test select-3.1 {Tk_OwnSelection procedure} {
setup
-} -body {
selection own
-} -result {.f1}
-test select-3.2 {Tk_OwnSelection procedure} -body {
+} {.f1}
+test select-3.2 {Tk_OwnSelection procedure} {
setup .f1
set result [selection own]
setup .f2
lappend result [selection own]
-} -result {.f1 .f2}
-test select-3.3 {Tk_OwnSelection procedure} -setup {
+} {.f1 .f2}
+test select-3.3 {Tk_OwnSelection procedure} {
setup .f1
setup .f2
-} -body {
selection own -selection CLIPBOARD .f1
list [selection own] [selection own -selection CLIPBOARD]
-} -result {.f2 .f1}
-test select-3.4 {Tk_OwnSelection procedure} -setup {
+} {.f2 .f1}
+test select-3.4 {Tk_OwnSelection procedure} {
global lostSel
setup
-} -body {
set lostSel {owned}
selection own -command { set lostSel {lost} } .f1
selection clear .f1
set lostSel
-} -result {lost}
-test select-3.5 {Tk_OwnSelection procedure} -setup {
+} {lost}
+test select-3.5 {Tk_OwnSelection procedure} {
global lostSel
setup .f1
setup .f2
-} -body {
set lostSel {owned}
selection own -command { set lostSel {lost1} } .f1
selection own -command { set lostSel {lost2} } .f2
list $lostSel [selection own]
-} -result {lost1 .f2}
-test select-3.6 {Tk_OwnSelection procedure} -setup {
+} {lost1 .f2}
+test select-3.6 {Tk_OwnSelection procedure} {
global lostSel
setup
-} -body {
set lostSel {owned}
selection own -command { set lostSel {lost1} } .f1
selection own -command { set lostSel {lost2} } .f1
set result $lostSel
selection clear .f1
lappend result $lostSel
-} -result {owned lost2}
-test select-3.7 {Tk_OwnSelection procedure} -constraints unix -setup {
+} {owned lost2}
+test select-3.7 {Tk_OwnSelection procedure} unix {
global lostSel
setup
setupbg
-} -body {
set lostSel {owned}
selection own -command { set lostSel {lost1} } .f1
update
@@ -340,71 +316,60 @@ test select-3.7 {Tk_OwnSelection procedure} -constraints unix -setup {
update
cleanupbg
lappend result $lostSel
-} -result {{} . lost1}
+} {{} . lost1}
# check reentrancy on selection replacement
-test select-3.8 {Tk_OwnSelection procedure} -setup {
+test select-3.8 {Tk_OwnSelection procedure} {
setup
-} -body {
selection own -selection CLIPBOARD -command { destroy .f1 } .f1
selection own -selection CLIPBOARD .
-} -result {}
-test select-3.9 {Tk_OwnSelection procedure} -setup {
+} {}
+test select-3.9 {Tk_OwnSelection procedure} {
setup .f2
setup .f1
-} -body {
selection own -selection CLIPBOARD -command { destroy .f2 } .f1
selection own -selection CLIPBOARD .f2
-} -result {}
+} {}
# multiple display tests
-test select-3.10 {Tk_OwnSelection procedure} -constraints {
- altDisplay
-} -body {
+test select-3.10 {Tk_OwnSelection procedure} {altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
list [selection own -displayof .f1] [selection own -displayof .f2]
-} -result {.f1 .f2}
-test select-3.11 {Tk_OwnSelection procedure} -constraints {
- altDisplay
-} -setup {
+} {.f1 .f2}
+test select-3.11 {Tk_OwnSelection procedure} {altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
update
set result ""
-} -body {
lappend result [dobg "toplevel .t -screen $env(TK_ALT_DISPLAY); wm geom .t +0+0; selection own .t; update"]
lappend result [selection own -displayof .f1] \
[selection own -displayof .f2]
-} -cleanup {
cleanupbg
-} -result {{} .f1 {}}
+ set result
+} {{} .f1 {}}
##############################################################################
-test select-4.1 {Tk_ClearSelection procedure} -setup {
+test select-4.1 {Tk_ClearSelection procedure} {
setup
-} -body {
set result [selection own]
selection clear .f1
lappend result [selection own]
-} -result {.f1 {}}
-test select-4.2 {Tk_ClearSelection procedure} -setup {
+} {.f1 {}}
+test select-4.2 {Tk_ClearSelection procedure} {
setup
-} -body {
selection own -selection CLIPBOARD .f1
selection clear .f1
selection own -selection CLIPBOARD
-} -result {.f1}
-test select-4.3 {Tk_ClearSelection procedure} -setup {
+} {.f1}
+test select-4.3 {Tk_ClearSelection procedure} {
setup
-} -body {
list [selection clear .f1] [selection clear .f1]
-} -result {{} {}}
-test select-4.4 {Tk_ClearSelection procedure} -constraints unix -setup {
+} {{} {}}
+test select-4.4 {Tk_ClearSelection procedure} unix {
global lostSel
setup
setupbg
-} -body {
set lostSel {owned}
selection own -command { set lostSel {lost1} } .f1
update
@@ -413,15 +378,12 @@ test select-4.4 {Tk_ClearSelection procedure} -constraints unix -setup {
update
cleanupbg
lappend result [selection own]
-} -result {{} {}}
+} {{} {}}
# multiple display tests
-test select-4.5 {Tk_ClearSelection procedure} -constraints {
- altDisplay
-} -setup {
+test select-4.5 {Tk_ClearSelection procedure} {altDisplay} {
global lostSel lostSel2
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
-} -body {
set lostSel {owned}
set lostSel2 {owned2}
selection own -command { set lostSel {lost1} } .f1
@@ -430,14 +392,11 @@ test select-4.5 {Tk_ClearSelection procedure} -constraints {
selection clear -displayof .f2
update
list $lostSel $lostSel2
-} -result {owned lost2}
-test select-4.6 {Tk_ClearSelection procedure} -constraints {
- unix altDisplay
-} -setup {
+} {owned lost2}
+test select-4.6 {Tk_ClearSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
-} -body {
set lostSel {owned}
set lostSel2 {owned2}
selection own -command { set lostSel {lost1} } .f1
@@ -449,79 +408,73 @@ test select-4.6 {Tk_ClearSelection procedure} -constraints {
[selection own -displayof .f2] $lostSel $lostSel2
cleanupbg
set result
-} -result {{} .f1 {} owned lost2}
+} {{} .f1 {} owned lost2}
##############################################################################
-test select-5.1 {Tk_GetSelection procedure} -returnCodes error -setup {
+test select-5.1 {Tk_GetSelection procedure} {
setup
-} -body {
- selection get TEST
-} -result {PRIMARY selection doesn't exist or form "TEST" not defined}
-test select-5.2 {Tk_GetSelection procedure} -setup {
+ list [catch {selection get TEST} msg] $msg
+} {1 {PRIMARY selection doesn't exist or form "TEST" not defined}}
+test select-5.2 {Tk_GetSelection procedure} {
setup
-} -body {
selection get TK_WINDOW
-} -result {.f1}
-test select-5.3 {Tk_GetSelection procedure} -setup {
+} {.f1}
+test select-5.3 {Tk_GetSelection procedure} {
setup
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
set selValue "Test value"
set selInfo ""
list [selection get TEST] $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-5.4 {Tk_GetSelection procedure} -setup {
+} {{Test value} {TEST 0 4000}}
+test select-5.4 {Tk_GetSelection procedure} {
setup
-} -returnCodes error -body {
selection handle .f1 ERROR errHandler
- selection get ERROR
-} -result {PRIMARY selection doesn't exist or form "ERROR" not defined}
-test select-5.5 {Tk_GetSelection procedure} -setup {
+ list [catch {selection get ERROR} msg] $msg
+} {1 {PRIMARY selection doesn't exist or form "ERROR" not defined}}
+test select-5.5 {Tk_GetSelection procedure} {
setup
-} -body {
set selValue $longValue
set selInfo ""
selection handle .f1 {handler STRING}
list [selection get] $selInfo
-} -result "$longValue {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000}"
-test select-5.6 {Tk_GetSelection procedure} -setup {
+} "$longValue {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000}"
+test select-5.6 {Tk_GetSelection procedure} {
+ proc weirdHandler {type offset count} {
+ selection handle .f1 {}
+ handler $type $offset $count
+ }
setup
-} -returnCodes error -body {
set selValue $longValue
set selInfo ""
- selection handle .f1 {apply {{type offset count} {
- selection handle .f1 {}
+ selection handle .f1 {weirdHandler STRING}
+ list [catch {selection get} msg] $msg
+} {1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
+test select-5.7 {Tk_GetSelection procedure} {
+ proc weirdHandler {type offset count} {
+ destroy .f1
handler $type $offset $count
- }} STRING}
- selection get
-} -result {PRIMARY selection doesn't exist or form "STRING" not defined}
-test select-5.7 {Tk_GetSelection procedure} -setup {
+ }
setup
-} -returnCodes error -body {
set selValue "Test Value"
set selInfo ""
- selection handle .f1 {apply {{type offset count} {
- destroy .f1
+ selection handle .f1 {weirdHandler STRING}
+ list [catch {selection get} msg] $msg
+} {1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
+test select-5.8 {Tk_GetSelection procedure} {
+ proc weirdHandler {type offset count} {
+ selection clear
handler $type $offset $count
- }} STRING}
- selection get
-} -result {PRIMARY selection doesn't exist or form "STRING" not defined}
-test select-5.8 {Tk_GetSelection procedure} -setup {
+ }
setup
-} -body {
set selValue $longValue
set selInfo ""
- selection handle .f1 {apply {{type offset count} {
- selection clear
- handler $type $offset $count
- }} STRING}
+ selection handle .f1 {weirdHandler STRING}
list [selection get] $selInfo [catch {selection get} msg] $msg
-} -result "$longValue {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000} 1 {PRIMARY selection doesn't exist or form \"STRING\" not defined}"
-test select-5.9 {Tk_GetSelection procedure} -constraints unix -setup {
+} "$longValue {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000} 1 {PRIMARY selection doesn't exist or form \"STRING\" not defined}"
+test select-5.9 {Tk_GetSelection procedure} unix {
setup
setupbg
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
update
set selValue "Test value"
@@ -530,11 +483,10 @@ test select-5.9 {Tk_GetSelection procedure} -constraints unix -setup {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-5.10 {Tk_GetSelection procedure} -constraints unix -setup {
+} {{Test value} {TEST 0 4000}}
+test select-5.10 {Tk_GetSelection procedure} unix {
setup
setupbg
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
update
set selValue "Test value"
@@ -544,14 +496,11 @@ test select-5.10 {Tk_GetSelection procedure} -constraints unix -setup {
lappend result [dobg {selection get TEST} 1]
cleanupbg
lappend result $selInfo
-} -result {{selection owner didn't respond} {}}
+} {{selection owner didn't respond} {}}
# multiple display tests
-test select-5.11 {Tk_GetSelection procedure} -constraints {
- altDisplay
-} -setup {
+test select-5.11 {Tk_GetSelection procedure} {altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f2 {handler TEST2} TEST
set selValue "Test value"
@@ -560,14 +509,11 @@ test select-5.11 {Tk_GetSelection procedure} -constraints {
set selValue "Test value2"
set selInfo ""
lappend result [selection get -displayof .f2 TEST] $selInfo
-} -result {{Test value} {TEST 0 4000} {Test value2} {TEST2 0 4000}}
-test select-5.12 {Tk_GetSelection procedure} -constraints {
- altDisplay
-} -setup {
+} {{Test value} {TEST 0 4000} {Test value2} {TEST2 0 4000}}
+test select-5.12 {Tk_GetSelection procedure} {altDisplay} {
global lostSel lostSel2
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
selection handle -selection PRIMARY .f2 {} TEST
set selValue "Test value"
@@ -577,14 +523,11 @@ test select-5.12 {Tk_GetSelection procedure} -constraints {
set selInfo ""
lappend result [catch {selection get -displayof .f2 TEST} msg] $msg \
$selInfo
-} -result {0 {Test value} {TEST 0 4000} 1 {PRIMARY selection doesn't exist or form "TEST" not defined} {}}
-test select-5.13 {Tk_GetSelection procedure} -constraints {
- unix altDisplay
-} -setup {
+} {0 {Test value} {TEST 0 4000} 1 {PRIMARY selection doesn't exist or form "TEST" not defined} {}}
+test select-5.13 {Tk_GetSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
selection own .f1
selection handle -selection PRIMARY .f2 {handler TEST2} TEST
@@ -598,14 +541,11 @@ test select-5.13 {Tk_GetSelection procedure} -constraints {
lappend result [dobg "selection get TEST"]
cleanupbg
lappend result $selInfo
-} -result {{Test value} {Test value2} {TEST2 0 4000 TEST 0 4000}}
-test select-5.14 {Tk_GetSelection procedure} -constraints {
- unix altDisplay
-} -setup {
+} {{Test value} {Test value2} {TEST2 0 4000 TEST 0 4000}}
+test select-5.14 {Tk_GetSelection procedure} {unix altDisplay} {
setup .f1
setup .f2 $env(TK_ALT_DISPLAY)
setupbg
-} -body {
selection handle -selection PRIMARY .f1 {handler TEST} TEST
selection own .f1
selection handle -selection PRIMARY .f2 {} TEST
@@ -619,244 +559,215 @@ test select-5.14 {Tk_GetSelection procedure} -constraints {
lappend result [dobg "selection get TEST"]
cleanupbg
lappend result $selInfo
-} -result {{PRIMARY selection doesn't exist or form "TEST" not defined} {Test value2} {TEST 0 4000}}
-test select-5.15 {Tk_GetSelection procedure} -setup {
- setup
- if {[llength [info command ::bgerror]]} {
- rename ::bgerror ::TMPbgerror
- }
- set ::bgerrors {}
-} -body {
- proc ::bgerror msg {lappend ::bgerrors $msg}
- selection handle -type ERROR .f1 errHandler
- list [catch {selection get ERROR} msg] $msg [update] {*}$::bgerrors
-} -cleanup {
- rename ::bgerror {}
- if {[llength [info command ::TMPbgerror]]} {
- rename ::TMPbgerror ::bgerror
- }
-} -result {1 {PRIMARY selection doesn't exist or form "ERROR" not defined} {} {selection handler aborted}}
+} {{PRIMARY selection doesn't exist or form "TEST" not defined} {Test value2} {TEST 0 4000}}
##############################################################################
-test select-6.1 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection
-} -result {wrong # args: should be "selection option ?arg ...?"}
+test select-6.1 {Tk_SelectionCmd procedure} {
+ list [catch {selection} cmd] $cmd
+} {1 {wrong # args: should be "selection option ?arg arg ...?"}}
# selection clear
-test select-6.2 {Tk_SelectionCmd procedure} -body {
- selection clear -selection
-} -returnCodes error -result {value for "-selection" missing}
-test select-6.3 {Tk_SelectionCmd procedure} -setup {
+test select-6.2 {Tk_SelectionCmd procedure} {
+ list [catch {selection clear -selection} cmd] $cmd
+} {1 {value for "-selection" missing}}
+test select-6.3 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own .
set result [selection own]
selection clear -displayof .f1
lappend result [selection own]
-} -result {. {}}
-test select-6.4 {Tk_SelectionCmd procedure} -setup {
+} {. {}}
+test select-6.4 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own -selection CLIPBOARD .f1
set result [list [selection own] [selection own -selection CLIPBOARD]]
selection clear -selection CLIPBOARD .f1
lappend result [selection own] [selection own -selection CLIPBOARD]
-} -result {.f1 .f1 .f1 {}}
-test select-6.5 {Tk_SelectionCmd procedure} -setup {
+} {.f1 .f1 .f1 {}}
+test select-6.5 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own -selection CLIPBOARD .
set result [list [selection own] [selection own -selection CLIPBOARD]]
selection clear -selection CLIPBOARD -displayof .f1
lappend result [selection own] [selection own -selection CLIPBOARD]
-} -result {.f1 . .f1 {}}
-test select-6.6 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection clear -badopt foo
-} -result {bad option "-badopt": must be -displayof or -selection}
-test select-6.7 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection clear -selectionfoo foo
-} -result {bad option "-selectionfoo": must be -displayof or -selection}
-test select-6.8 {Tk_SelectionCmd procedure} -body {
- destroy .f2
- selection clear -displayof .f2
-} -returnCodes error -result {bad window path name ".f2"}
-test select-6.9 {Tk_SelectionCmd procedure} -body {
- destroy .f2
- selection clear .f2
-} -returnCodes error -result {bad window path name ".f2"}
-test select-6.10 {Tk_SelectionCmd procedure} -setup {
+} {.f1 . .f1 {}}
+test select-6.6 {Tk_SelectionCmd procedure} {
+ list [catch {selection clear -badopt foo} cmd] $cmd
+} {1 {bad option "-badopt": must be -displayof or -selection}}
+test select-6.7 {Tk_SelectionCmd procedure} {
+ list [catch {selection clear -selectionfoo foo} cmd] $cmd
+} {1 {bad option "-selectionfoo": must be -displayof or -selection}}
+test select-6.8 {Tk_SelectionCmd procedure} {
+ catch {destroy .f2}
+ list [catch {selection clear -displayof .f2} cmd] $cmd
+} {1 {bad window path name ".f2"}}
+test select-6.9 {Tk_SelectionCmd procedure} {
+ catch {destroy .f2}
+ list [catch {selection clear .f2} cmd] $cmd
+} {1 {bad window path name ".f2"}}
+test select-6.10 {Tk_SelectionCmd procedure} {
setup
-} -body {
set result [selection own -selection PRIMARY]
selection clear
lappend result [selection own -selection PRIMARY]
-} -result {.f1 {}}
-test select-6.11 {Tk_SelectionCmd procedure} -setup {
+} {.f1 {}}
+test select-6.11 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own -selection CLIPBOARD .f1
set result [selection own -selection CLIPBOARD]
selection clear -selection CLIPBOARD
lappend result [selection own -selection CLIPBOARD]
-} -result {.f1 {}}
-test select-6.12 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection clear foo bar
-} -result {wrong # args: should be "selection clear ?-option value ...?"}
+} {.f1 {}}
+test select-6.12 {Tk_SelectionCmd procedure} {
+ list [catch {selection clear foo bar} cmd] $cmd
+} {1 {wrong # args: should be "selection clear ?options?"}}
# selection get
-test select-6.13 {Tk_SelectionCmd procedure} -body {
- selection get -selection
-} -returnCodes error -result {value for "-selection" missing}
-test select-6.14 {Tk_SelectionCmd procedure} -setup {
+test select-6.13 {Tk_SelectionCmd procedure} {
+ list [catch {selection get -selection} cmd] $cmd
+} {1 {value for "-selection" missing}}
+test select-6.14 {Tk_SelectionCmd procedure} {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler TEST}
set selValue "Test value"
set selInfo ""
list [selection get -displayof .f1] $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-6.15 {Tk_SelectionCmd procedure} -setup {
+} {{Test value} {TEST 0 4000}}
+test select-6.15 {Tk_SelectionCmd procedure} {
global selValue selInfo
setup
-} -body {
selection handle .f1 {handler STRING}
selection handle -selection CLIPBOARD .f1 {handler TEST}
selection own -selection CLIPBOARD .f1
set selValue "Test value"
set selInfo ""
list [selection get -selection CLIPBOARD] $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-6.16 {Tk_SelectionCmd procedure} -setup {
+} {{Test value} {TEST 0 4000}}
+test select-6.16 {Tk_SelectionCmd procedure} {
global selValue selInfo
setup
-} -body {
selection handle -type TEST .f1 {handler TEST}
selection handle -type STRING .f1 {handler STRING}
set selValue "Test value"
set selInfo ""
list [selection get -type TEST] $selInfo
-} -result {{Test value} {TEST 0 4000}}
-test select-6.17 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection get -badopt foo
-} -result {bad option "-badopt": must be -displayof, -selection, or -type}
-test select-6.18 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection get -selectionfoo foo
-} -result {bad option "-selectionfoo": must be -displayof, -selection, or -type}
-test select-6.19 {Tk_SelectionCmd procedure} -body {
+} {{Test value} {TEST 0 4000}}
+test select-6.17 {Tk_SelectionCmd procedure} {
+ list [catch {selection get -badopt foo} cmd] $cmd
+} {1 {bad option "-badopt": must be -displayof, -selection, or -type}}
+test select-6.18 {Tk_SelectionCmd procedure} {
+ list [catch {selection get -selectionfoo foo} cmd] $cmd
+} {1 {bad option "-selectionfoo": must be -displayof, -selection, or -type}}
+test select-6.19 {Tk_SelectionCmd procedure} {
catch { destroy .f2 }
- selection get -displayof .f2
-} -returnCodes error -result {bad window path name ".f2"}
-test select-6.20 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection get foo bar
-} -result {wrong # args: should be "selection get ?-option value ...?"}
-test select-6.21 {Tk_SelectionCmd procedure} -setup {
+ list [catch {selection get -displayof .f2} cmd] $cmd
+} {1 {bad window path name ".f2"}}
+test select-6.20 {Tk_SelectionCmd procedure} {
+ list [catch {selection get foo bar} cmd] $cmd
+} {1 {wrong # args: should be "selection get ?options?"}}
+test select-6.21 {Tk_SelectionCmd procedure} {
global selValue selInfo
setup
-} -body {
selection handle -type TEST .f1 {handler TEST}
selection handle -type STRING .f1 {handler STRING}
set selValue "Test value"
set selInfo ""
list [selection get TEST] $selInfo
-} -result {{Test value} {TEST 0 4000}}
+} {{Test value} {TEST 0 4000}}
# selection handle
# most of the handle section has been covered earlier
-test select-6.22 {Tk_SelectionCmd procedure} -body {
- selection handle -selection
-} -returnCodes error -result {value for "-selection" missing}
-test select-6.23 {Tk_SelectionCmd procedure} -setup {
+test select-6.22 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle -selection} cmd] $cmd
+} {1 {value for "-selection" missing}}
+test select-6.23 {Tk_SelectionCmd procedure} {
global selValue selInfo
setup
-} -body {
set selValue "Test value"
set selInfo ""
list [selection handle -format INTEGER .f1 {handler TEST}] [selection get -displayof .f1] $selInfo
-} -result {{} {Test value} {TEST 0 4000}}
-test select-6.24 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection handle -badopt foo
-} -result {bad option "-badopt": must be -format, -selection, or -type}
-test select-6.25 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection handle -selectionfoo foo
-} -result {bad option "-selectionfoo": must be -format, -selection, or -type}
-test select-6.26 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection handle
-} -result {wrong # args: should be "selection handle ?-option value ...? window command"}
-test select-6.27 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection handle .
-} -result {wrong # args: should be "selection handle ?-option value ...? window command"}
-test select-6.28 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection handle . foo bar baz blat
-} -result {wrong # args: should be "selection handle ?-option value ...? window command"}
-test select-6.29 {Tk_SelectionCmd procedure} -body {
+} {{} {Test value} {TEST 0 4000}}
+test select-6.24 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle -badopt foo} cmd] $cmd
+} {1 {bad option "-badopt": must be -format, -selection, or -type}}
+test select-6.25 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle -selectionfoo foo} cmd] $cmd
+} {1 {bad option "-selectionfoo": must be -format, -selection, or -type}}
+test select-6.26 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle} cmd] $cmd
+} {1 {wrong # args: should be "selection handle ?options? window command"}}
+test select-6.27 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle .} cmd] $cmd
+} {1 {wrong # args: should be "selection handle ?options? window command"}}
+test select-6.28 {Tk_SelectionCmd procedure} {
+ list [catch {selection handle . foo bar baz blat} cmd] $cmd
+} {1 {wrong # args: should be "selection handle ?options? window command"}}
+test select-6.29 {Tk_SelectionCmd procedure} {
catch { destroy .f2 }
- selection handle .f2 dummy
-} -returnCodes error -result {bad window path name ".f2"}
+ list [catch {selection handle .f2 dummy} cmd] $cmd
+} {1 {bad window path name ".f2"}}
# selection own
-test select-6.30 {Tk_SelectionCmd procedure} -body {
- selection own -selection
-} -returnCodes error -result {value for "-selection" missing}
-test select-6.31 {Tk_SelectionCmd procedure} -setup {
+test select-6.30 {Tk_SelectionCmd procedure} {
+ list [catch {selection own -selection} cmd] $cmd
+} {1 {value for "-selection" missing}}
+test select-6.31 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own .
selection own -displayof .f1
-} -result {.}
-test select-6.32 {Tk_SelectionCmd procedure} -setup {
+} {.}
+test select-6.32 {Tk_SelectionCmd procedure} {
setup
-} -body {
selection own .
selection own -selection CLIPBOARD .f1
list [selection own] [selection own -selection CLIPBOARD]
-} -result {. .f1}
-test select-6.33 {Tk_SelectionCmd procedure} -setup {
+} {. .f1}
+test select-6.33 {Tk_SelectionCmd procedure} {
global lostSel
setup
-} -body {
set lostSel owned
selection own -command { set lostSel lost } .
selection own -selection CLIPBOARD .f1
set result $lostSel
selection own .f1
lappend result $lostSel
-} -result {owned lost}
-test select-6.34 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection own -badopt foo
-} -result {bad option "-badopt": must be -command, -displayof, or -selection}
-test select-6.35 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection own -selectionfoo foo
-} -result {bad option "-selectionfoo": must be -command, -displayof, or -selection}
-test select-6.36 {Tk_SelectionCmd procedure} -body {
- destroy .f2
- selection own -displayof .f2
-} -returnCodes error -result {bad window path name ".f2"}
-test select-6.37 {Tk_SelectionCmd procedure} -body {
- destroy .f2
- selection own .f2
-} -returnCodes error -result {bad window path name ".f2"}
-test select-6.38 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection own foo bar baz
-} -result {wrong # args: should be "selection own ?-option value ...? ?window?"}
-test select-6.39 {Tk_SelectionCmd procedure} -returnCodes error -body {
- selection foo
-} -result {bad option "foo": must be clear, get, handle, or own}
+} {owned lost}
+test select-6.34 {Tk_SelectionCmd procedure} {
+ list [catch {selection own -badopt foo} cmd] $cmd
+} {1 {bad option "-badopt": must be -command, -displayof, or -selection}}
+test select-6.35 {Tk_SelectionCmd procedure} {
+ list [catch {selection own -selectionfoo foo} cmd] $cmd
+} {1 {bad option "-selectionfoo": must be -command, -displayof, or -selection}}
+test select-6.36 {Tk_SelectionCmd procedure} {
+ catch {destroy .f2}
+ list [catch {selection own -displayof .f2} cmd] $cmd
+} {1 {bad window path name ".f2"}}
+test select-6.37 {Tk_SelectionCmd procedure} {
+ catch {destroy .f2}
+ list [catch {selection own .f2} cmd] $cmd
+} {1 {bad window path name ".f2"}}
+test select-6.38 {Tk_SelectionCmd procedure} {
+ list [catch {selection own foo bar baz} cmd] $cmd
+} {1 {wrong # args: should be "selection own ?options? ?window?"}}
+test select-6.39 {Tk_SelectionCmd procedure} {
+ list [catch {selection foo} cmd] $cmd
+} {1 {bad option "foo": must be clear, get, handle, or own}}
##############################################################################
-# This test is non-portable because some old X11/News servers ignore a
-# selection request when the window doesn't exist, which causes a different
-# error message.
-test select-7.1 {TkSelDeadWindow procedure} -constraints nonPortable -setup {
+# This test is non-portable because some old X11/News servers ignore
+# a selection request when the window doesn't exist, which causes a
+# different error message.
+test select-7.1 {TkSelDeadWindow procedure} nonPortable {
setup
-} -body {
selection handle .f1 { handler TEST }
set result [selection own]
destroy .f1
lappend result [selection own] [catch {selection get} msg] $msg
-} -result {.f1 {} 1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
+} {.f1 {} 1 {PRIMARY selection doesn't exist or form "STRING" not defined}}
##############################################################################
# Check reentrancy on losing selection
+
test select-8.1 {TkSelEventProc procedure} -constraints unix -setup {
setup
setupbg
@@ -877,17 +788,16 @@ test select-9.1 {SelCvtToX and SelCvtFromX procedures} -setup {
set selValue "1024"
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
- .f1 {handler TEST}
+ .f1 {handler TEST}
update
set result ""
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
} -result {{0x400 } {TEST 0 4000}}
-test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
+test select-9.2 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
-} -constraints unix -body {
set selValue "1024 0xffff 2048 -2 "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -896,11 +806,10 @@ test select-9.2 {SelCvtToX and SelCvtFromX procedures} -setup {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} -result {{0x400 0xffff 0x800 0xfffffffe } {TEST 0 4000}}
-test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
+} {{0x400 0xffff 0x800 0xfffffffe } {TEST 0 4000}}
+test select-9.3 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
-} -constraints unix -body {
set selValue " "
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -909,11 +818,10 @@ test select-9.3 {SelCvtToX and SelCvtFromX procedures} -setup {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} -result {{ } {TEST 0 4000}}
-test select-9.4 {SelCvtToX and SelCvtFromX procedures} -setup {
+} {{ } {TEST 0 4000}}
+test select-9.4 {SelCvtToX and SelCvtFromX procedures} unix {
setup
setupbg
-} -constraints unix -body {
set selValue "16 foobar 32"
set selInfo ""
selection handle -selection PRIMARY -format INTEGER -type TEST \
@@ -922,7 +830,7 @@ test select-9.4 {SelCvtToX and SelCvtFromX procedures} -setup {
lappend result [dobg {selection get TEST}]
cleanupbg
lappend result $selInfo
-} -result {{0x10 0x0 0x20 } {TEST 0 4000}}
+} {{0x10 0x0 0x20 } {TEST 0 4000}}
test select-9.5 {SelCvtToX and SelCvtFromX procedures} -setup {
setup
setupbg
@@ -933,21 +841,19 @@ test select-9.5 {SelCvtToX and SelCvtFromX procedures} -setup {
set selInfo ""
set selType {text/x-tk-test;detail="foo bar"}
selection handle -selection PRIMARY -format STRING -type $selType \
- .f1 [list handler $selType]
+ .f1 [list handler $selType]
lsort [dobg {selection get TARGETS}]
} -cleanup {
cleanupbg
} -result {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW {text/x-tk-test;detail="foo bar"}}
##############################################################################
+
# note, we are not testing MULTIPLE style selections
# most control paths have been exercised above
-test select-10.1 {ConvertSelection procedure, race with selection clear} -constraints {
- unix
-} -setup {
+test select-10.1 {ConvertSelection procedure, race with selection clear} unix {
setup
-} -body {
proc Ready {fd} {
variable x
lappend x [gets $fd]
@@ -961,7 +867,7 @@ test select-10.1 {ConvertSelection procedure, race with selection clear} -constr
set selInfo ""
selection handle .f1 {handler STRING}
update
- puts $fd {puts "[catch {selection get} msg]:$msg"; puts **DONE**; flush stdout}
+ puts $fd {puts "[catch {selection get} msg] $msg"; puts **DONE**; flush stdout}
flush $fd
after 200
selection own .
@@ -973,11 +879,10 @@ test select-10.1 {ConvertSelection procedure, race with selection clear} -constr
# a "broken pipe" error when Tk was actually [load]ed in the child.
catch {close $fd}
lappend x $selInfo
-} -result {{1:PRIMARY selection doesn't exist or form "STRING" not defined} {}}
-test select-10.2 {ConvertSelection procedure} -constraints unix -setup {
+} {{1 PRIMARY selection doesn't exist or form "STRING" not defined} {}}
+test select-10.2 {ConvertSelection procedure} unix {
setup
setupbg
-} -body {
set selValue [string range $longValue 0 3999]
set selInfo ""
selection handle .f1 {handler STRING}
@@ -985,24 +890,21 @@ test select-10.2 {ConvertSelection procedure} -constraints unix -setup {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result [list [string range $longValue 0 3999] {STRING 0 4000 STRING 4000 4000 STRING 0 4000 STRING 4000 4000}]
-test select-10.3 {ConvertSelection procedure} -constraints unix -setup {
+} [list [string range $longValue 0 3999] {STRING 0 4000 STRING 4000 4000 STRING 0 4000 STRING 4000 4000}]
+test select-10.3 {ConvertSelection procedure} unix {
setup
setupbg
-} -body {
selection handle .f1 ERROR errHandler
- dobg {selection get ERROR}
-} -cleanup {
+ set result ""
+ lappend result [dobg {selection get ERROR}]
cleanupbg
-} -result {PRIMARY selection doesn't exist or form "ERROR" not defined}
+ set result
+} {{PRIMARY selection doesn't exist or form "ERROR" not defined}}
# testing timers
# This one hangs in Exceed
-test select-10.4 {ConvertSelection procedure} -constraints {
- unix noExceed
-} -setup {
+test select-10.4 {ConvertSelection procedure} {unix noExceed} {
setup
setupbg
-} -body {
set selValue $longValue
set selInfo ""
selection handle .f1 {errIncrHandler STRING}
@@ -1011,13 +913,10 @@ test select-10.4 {ConvertSelection procedure} -constraints {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}}
-test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
- unix
-} -setup {
+} {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}}
+test select-10.5 {ConvertSelection procedure, reentrancy issues} unix {
setup
setupbg
-} -body {
set selValue "Test value"
set selInfo ""
selection handle -type TEST .f1 { handler TEST }
@@ -1026,17 +925,14 @@ test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}}
-test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
- unix
-} -setup {
- setup
- setupbg
-} -body {
+} {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}}
+test select-10.6 {ConvertSelection procedure, reentrancy issues} unix {
proc weirdHandler {type offset count} {
destroy .f1
handler $type $offset $count
}
+ setup
+ setupbg
set selValue $longValue
set selInfo ""
selection handle .f1 {weirdHandler STRING}
@@ -1044,15 +940,14 @@ test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {STRING 0 4000}}
+} {{PRIMARY selection doesn't exist or form "STRING" not defined} {STRING 0 4000}}
##############################################################################
# testing reentrancy
-test select-11.1 {TkSelPropProc procedure} -constraints unix -setup {
+test select-11.1 {TkSelPropProc procedure} unix {
setup
setupbg
-} -body {
set selValue $longValue
set selInfo ""
selection handle -type TEST .f1 { handler TEST }
@@ -1062,28 +957,28 @@ test select-11.1 {TkSelPropProc procedure} -constraints unix -setup {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result {{selection owner didn't respond} {.f1 STRING 0 4000 .f1 STRING 4000 4000 .f1 STRING 8000 4000 .f1 STRING 12000 4000 .f1 STRING 16000 4000 .f1 STRING 0 4000 .f1 STRING 4000 4000}}
+} {{selection owner didn't respond} {.f1 STRING 0 4000 .f1 STRING 4000 4000 .f1 STRING 8000 4000 .f1 STRING 12000 4000 .f1 STRING 16000 4000 .f1 STRING 0 4000 .f1 STRING 4000 4000}}
##############################################################################
# Note, this assumes we are using CurrentTtime
-test select-12.1 {DefaultSelection procedure} -constraints unix -body {
+test select-12.1 {DefaultSelection procedure} unix {
setup
set result [selection get -type TIMESTAMP]
setupbg
lappend result [dobg {selection get -type TIMESTAMP}]
cleanupbg
set result
-} -result {0x0 {0x0 }}
-test select-12.2 {DefaultSelection procedure} -constraints unix -body {
+} {0x0 {0x0 }}
+test select-12.2 {DefaultSelection procedure} unix {
setup
set result [lsort [list [selection get -type TARGETS]]]
setupbg
lappend result [dobg {lsort [selection get -type TARGETS]}]
cleanupbg
set result
-} -result {{MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-12.3 {DefaultSelection procedure} -constraints unix -body {
+} {{MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-12.3 {DefaultSelection procedure} unix {
setup
selection handle .f1 {handler TEST} TEST
set result [list [lsort [selection get -type TARGETS]]]
@@ -1091,26 +986,25 @@ test select-12.3 {DefaultSelection procedure} -constraints unix -body {
lappend result [dobg {lsort [selection get -type TARGETS]}]
cleanupbg
set result
-} -result {{MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-12.4 {DefaultSelection procedure} -constraints unix -setup {
+} {{MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW} {MULTIPLE TARGETS TEST TIMESTAMP TK_APPLICATION TK_WINDOW}}
+test select-12.4 {DefaultSelection procedure} unix {
setup
set result ""
-} -body {
lappend result [selection get -type TK_APPLICATION]
setupbg
lappend result [dobg {selection get -type TK_APPLICATION}]
cleanupbg
set result
-} -result [list [winfo name .] [winfo name .]]
-test select-12.5 {DefaultSelection procedure} -constraints unix -body {
+} [list [winfo name .] [winfo name .]]
+test select-12.5 {DefaultSelection procedure} unix {
setup
set result [selection get -type TK_WINDOW]
setupbg
lappend result [dobg {selection get -type TK_WINDOW}]
cleanupbg
set result
-} -result {.f1 .f1}
-test select-12.6 {DefaultSelection procedure} -body {
+} {.f1 .f1}
+test select-12.6 {DefaultSelection procedure} {
setup
selection handle .f1 {handler TARGETS.f1} TARGETS
set selValue "Targets value"
@@ -1118,14 +1012,9 @@ test select-12.6 {DefaultSelection procedure} -body {
set result [list [selection get TARGETS] $selInfo]
selection handle .f1 {} TARGETS
lappend result [selection get TARGETS]
-} -result {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
+} {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}}
-test select-13.1 {SelectionSize procedure, handler deleted} -constraints {
- unix
-} -setup {
- setup
- setupbg
-} -body {
+test select-13.1 {SelectionSize procedure, handler deleted} unix {
proc badHandler {path type offset count} {
global selValue selInfo abortCount
incr abortCount -1
@@ -1139,6 +1028,8 @@ test select-13.1 {SelectionSize procedure, handler deleted} -constraints {
}
string range $selValue $offset [expr $numBytes+$offset]
}
+ setup
+ setupbg
set selValue $longValue
set selInfo ""
selection handle .f1 {badHandler .f1 STRING}
@@ -1147,14 +1038,10 @@ test select-13.1 {SelectionSize procedure, handler deleted} -constraints {
lappend result [dobg {selection get}]
cleanupbg
lappend result $selInfo
-} -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000 .f1 STRING 4000 4000}}
-
+} {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000 .f1 STRING 4000 4000}}
+
catch {rename weirdHandler {}}
# cleanup
cleanupTests
return
-
-# Local Variables:
-# mode: tcl
-# End: