diff options
-rw-r--r-- | doc/selection.n | 20 | ||||
-rw-r--r-- | generic/tkEntry.c | 18 | ||||
-rw-r--r-- | generic/tkListbox.c | 15 | ||||
-rw-r--r-- | generic/tkText.c | 8 | ||||
-rw-r--r-- | generic/tkTextTag.c | 1 | ||||
-rw-r--r-- | generic/ttk/ttkEntry.c | 9 | ||||
-rw-r--r-- | tests/safePrimarySelection.test | 1220 |
7 files changed, 1272 insertions, 19 deletions
diff --git a/doc/selection.n b/doc/selection.n index f5bb660..ec678fa 100644 --- a/doc/selection.n +++ b/doc/selection.n @@ -140,6 +140,26 @@ If \fIcommand\fR is specified, it is a Tcl script to execute when some other window claims ownership of the selection away from \fIwindow\fR. \fISelection\fR defaults to PRIMARY. .RE +.SH WIDGET FACILITIES +.PP +The \fBtext\fR, \fBentry\fR, \fBttk::entry\fR, \fBlistbox\fR, \fBspinbox\fR and \fBttk::spinbox\fR widgets have the option \fB\-exportselection\fR. If a widget has this option set to boolean \fBtrue\fR, then (in an unsafe interpreter) a selection made in the widget is automatically written to the \fBPRIMARY\fR selection. +.PP +A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR selection to certain widgets. This copy is implemented by a widget binding to the event. The binding script makes appropriate calls to the \fBselection\fR command. +.PP +.SH PORTABILITY ISSUES +.PP +On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients. +.PP +On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a master interpreter and its unsafe slave interpreters. It is not shared between interpreters in different processes or different threads. Each master interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe slaves. +.PP +.SH SECURITY +.PP +A safe interpreter cannot read from the \fBPRIMARY\fR selection because its \fBselection\fR command is hidden. For this reason the \fBPRIMARY\fR selection cannot be written to the Tk widgets of a safe interpreter. +.PP +A Tk widget can have its option \fB\-exportselection\fR set to boolean \fBtrue\fR, but in a safe interpreter this option has no effect: writing from the widget to the \fBPRIMARY\fR selection is disabled. +.PP +These are security features. A safe interpreter may run untrusted code, and it is a security risk if this untrusted code can read or write the \fBPRIMARY\fR selection used by other interpreters. +.PP .SH EXAMPLES .PP On X11 platforms, one of the standard selections available is the diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 9e25bed..25774cc 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -887,7 +887,8 @@ EntryWidgetObjCmd( entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) - && (entryPtr->exportSelection)) { + && (entryPtr->exportSelection) + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; @@ -1122,7 +1123,7 @@ ConfigureEntry( * value. */ - oldExport = entryPtr->exportSelection; + oldExport = (entryPtr->exportSelection) && (!Tcl_IsSafe(entryPtr->interp)); if (entryPtr->type == TK_SPINBOX) { oldValues = sbPtr->valueStr; oldFormat = sbPtr->reqFormat; @@ -1276,6 +1277,7 @@ ConfigureEntry( */ if (entryPtr->exportSelection && (!oldExport) + && (!Tcl_IsSafe(entryPtr->interp)) && (entryPtr->selectFirst != -1) && !(entryPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, @@ -2745,7 +2747,8 @@ EntrySelectTo( * Grab the selection if we don't own it already. */ - if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) { + if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection) + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; @@ -2812,7 +2815,8 @@ EntryFetchSelection( const char *string; const char *selStart, *selEnd; - if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) { + if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection) + || Tcl_IsSafe(entryPtr->interp)) { return -1; } string = entryPtr->displayString; @@ -2865,7 +2869,8 @@ EntryLostSelection( */ if (TkpAlwaysShowSelection(entryPtr->tkwin) - && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection) { + && (entryPtr->selectFirst >= 0) && entryPtr->exportSelection + && (!Tcl_IsSafe(entryPtr->interp))) { entryPtr->selectFirst = -1; entryPtr->selectLast = -1; EventuallyRedraw(entryPtr); @@ -4034,7 +4039,8 @@ SpinboxWidgetObjCmd( entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) - && entryPtr->exportSelection) { + && entryPtr->exportSelection + && (!Tcl_IsSafe(entryPtr->interp))) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; diff --git a/generic/tkListbox.c b/generic/tkListbox.c index b059727..b18a7f4 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -1565,7 +1565,7 @@ ConfigureListbox( Tcl_Obj *errorResult = NULL; int oldExport, error; - oldExport = listPtr->exportSelection; + oldExport = (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)); if (listPtr->listVarName != NULL) { Tcl_UntraceVar2(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1607,10 +1607,11 @@ ConfigureListbox( /* * Claim the selection if we've suddenly started exporting it and - * there is a selection to export. + * there is a selection to export and this interp is unsafe. */ - if (listPtr->exportSelection && !oldExport + if (listPtr->exportSelection && (!oldExport) + && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->numSelected != 0)) { Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY, ListboxLostSelection, listPtr); @@ -3079,7 +3080,8 @@ ListboxSelect( EventuallyRedrawRange(listPtr, first, last); } if ((oldCount == 0) && (listPtr->numSelected > 0) - && listPtr->exportSelection) { + && (listPtr->exportSelection) + && (!Tcl_IsSafe(listPtr->interp))) { Tk_OwnSelection(listPtr->tkwin, XA_PRIMARY, ListboxLostSelection, listPtr); } @@ -3125,7 +3127,7 @@ ListboxFetchSelection( const char *stringRep; Tcl_HashEntry *entry; - if (!listPtr->exportSelection) { + if ((!listPtr->exportSelection) || Tcl_IsSafe(listPtr->interp)) { return -1; } @@ -3196,7 +3198,8 @@ ListboxLostSelection( { register Listbox *listPtr = clientData; - if ((listPtr->exportSelection) && (listPtr->nElements > 0)) { + if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) + && (listPtr->nElements > 0)) { ListboxSelect(listPtr, 0, listPtr->nElements-1, 0); GenerateListboxSelectEvent(listPtr); } diff --git a/generic/tkText.c b/generic/tkText.c index 28fca76..846f50c 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -2078,7 +2078,7 @@ ConfigureText( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; - int oldExport = textPtr->exportSelection; + int oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp)); int mask = 0; if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable, @@ -2307,7 +2307,7 @@ ConfigureText( * are tagged characters. */ - if (textPtr->exportSelection && (!oldExport)) { + if (textPtr->exportSelection && (!oldExport) && (!Tcl_IsSafe(textPtr->interp))) { TkTextSearch search; TkTextIndex first, last; @@ -3378,7 +3378,7 @@ TextFetchSelection( TkTextSearch search; TkTextSegment *segPtr; - if (!textPtr->exportSelection) { + if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { return -1; } @@ -3508,7 +3508,7 @@ TkTextLostSelection( if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; - if (!textPtr->exportSelection) { + if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) { return; } diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index d9329f5..9ade3ad 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -243,6 +243,7 @@ TkTextTagCmd( TkTextSelectionEvent(textPtr); if (addTag && textPtr->exportSelection + && (!Tcl_IsSafe(textPtr->interp)) && !(textPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection, textPtr); diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index a25574a..83f1a38 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -337,7 +337,8 @@ EntryFetchSelection( const char *string; const char *selStart, *selEnd; - if (entryPtr->entry.selectFirst < 0 || !entryPtr->entry.exportSelection) { + if (entryPtr->entry.selectFirst < 0 || (!entryPtr->entry.exportSelection) + || Tcl_IsSafe(entryPtr->core.interp)) { return -1; } string = entryPtr->entry.displayString; @@ -372,11 +373,12 @@ static void EntryLostSelection(ClientData clientData) /* EntryOwnSelection -- * Assert ownership of the PRIMARY selection, - * if -exportselection set and selection is present. + * if -exportselection set and selection is present and interp is unsafe. */ static void EntryOwnSelection(Entry *entryPtr) { if (entryPtr->entry.exportSelection + && (!Tcl_IsSafe(entryPtr->core.interp)) && !(entryPtr->core.flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection, (ClientData) entryPtr); @@ -999,7 +1001,8 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) /* Claim the selection, in case we've suddenly started exporting it. */ - if (entryPtr->entry.exportSelection && entryPtr->entry.selectFirst != -1) { + if (entryPtr->entry.exportSelection && (entryPtr->entry.selectFirst != -1) + && (!Tcl_IsSafe(entryPtr->core.interp))) { EntryOwnSelection(entryPtr); } diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test new file mode 100644 index 0000000..7cc31f4 --- /dev/null +++ b/tests/safePrimarySelection.test @@ -0,0 +1,1220 @@ +# This file is a Tcl script to test entry widgets in Tk. It is +# organized in the standard fashion for Tcl tests. +# +# Copyright (c) 1994 The Regents of the University of California. +# Copyright (c) 1994-1997 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. +# All rights reserved. + +package require tcltest 2.2 +namespace import ::tcltest::* +eval tcltest::configure $argv +tcltest::loadTestedCommands + +# ------------------------------------------------------------------------------ +# Tests that a Safe Base interpreter cannot write to the PRIMARY selection. +# ------------------------------------------------------------------------------ +# - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch +# bug-de156e9efe has been applied and still works. They test that a Safe Base +# slave interpreter cannot write to the PRIMARY selection. +# - The other tests verify that the master interpreter and an unsafe slave CAN +# write to the PRIMARY selection, and therefore that the test scripts +# themselves are valid. +# - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have +# option -exportselection 1, meaning (in an unsafe interpreter) that a +# selection made in one of these widgets is automatically written to the +# PRIMARY selection. +# - A safe interpreter must not write to the PRIMARY selection. +# - The spinbox, ttk::spinbox are variants of entry, ttk::entry respectively. +# ------------------------------------------------------------------------------ + +namespace eval ::_test_tmp {} + +# ------------------------------------------------------------------------------ +# Proc ::_test_tmp::unsafeInterp +# ------------------------------------------------------------------------------ +# Command that creates an unsafe child interpreter and tries to load Tk. +# - This is necessary for loading Tk if the tests are done in the build +# directory without installing Tk. In that case the usual auto_path loading +# mechanism cannot work because the tk binary is not where pkgIndex.tcl says +# it is. +# - This command is not needed for Safe Base slaves because safe::loadTk does +# something similar and works correctly. +# - Based on scripts in winSend.test. +# ------------------------------------------------------------------------------ + +namespace eval ::_test_tmp { + variable TkLoadCmd +} + +foreach pkg [info loaded] { + if {[lindex $pkg 1] eq "Tk"} { + set ::_test_tmp::TkLoadCmd [list load {*}$pkg] + break + } +} + +proc ::_test_tmp::unsafeInterp {name} { + variable TkLoadCmd + interp create $name + $name eval [list set argv [list -name $name]] + catch {{*}$TkLoadCmd $name} +} + + +set ::_test_tmp::script { + package require Tk + namespace eval ::_test_tmp {} + + proc ::_test_tmp::getPrimarySelection {} { + 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 + } + + # Clearing the PRIMARY selection is troublesome. + # The window need not be mapped. + # 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 + } + + # 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 + } + + proc ::_test_tmp::tryEntry {} { + 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 + } + + proc ::_test_tmp::tryListbox {} { + 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 + } + } + + 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 + } + } +} + +# Do this once for the master interpreter. +eval $::_test_tmp::script + +test safePrimarySelection-1.1 {master interpreter, text, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryText + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.2 {master interpreter, entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryEntry + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.3 {master interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryTtkEntry + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.4 {master interpreter, listbox, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryListbox + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.5 {master interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::trySpinbox 1 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.6 {master interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::trySpinbox 2 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-1.7 {master interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::trySpinbox 3 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-1.8 {master interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 1 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-1.9 {master interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 2 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-1.10 {master interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 3 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-2.1 {unsafe slave interpreter, text, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryText + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.2 {unsafe slave interpreter, entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryEntry + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.3 {unsafe slave interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkEntry + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.4 {unsafe slave interpreter, listbox, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryListbox + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.5 {unsafe slave interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 1 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.6 {unsafe slave interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 2 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-2.7 {unsafe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 3 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-2.8 {unsafe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 1 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-2.9 {unsafe slave interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 2 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-2.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 3 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-3.1 {IMPORTANT, safe slave interpreter, text, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryText + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.2 {IMPORTANT, safe slave interpreter, entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryEntry + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.3 {IMPORTANT, safe slave interpreter, ttk::entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkEntry + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.4 {IMPORTANT, safe slave interpreter, listbox, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryListbox + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.5 {IMPORTANT, safe slave interpreter, spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 1 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.6 {IMPORTANT, safe slave interpreter, spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 2 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 3 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 1 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 2 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-3.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 3 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {----} + +test safePrimarySelection-4.1 {master interpreter, text, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryText + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.2 {master interpreter, entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryEntry + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.3 {master interpreter, ttk::entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryTtkEntry + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.4 {master interpreter, listbox, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryListbox + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.5 {master interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::trySpinbox 1 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.6 {master interpreter, spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::trySpinbox 2 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-4.7 {master interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::trySpinbox 3 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-4.8 {master interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 1 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-4.9 {master interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 2 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-4.10 {master interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + ::_test_tmp::tryTtkSpinbox 3 + ::_test_tmp::getPrimarySelection +} -cleanup { + destroy {*}[winfo children .] + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-5.1 {unsafe slave interpreter, text, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryText + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.2 {unsafe slave interpreter, entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryEntry + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.3 {unsafe slave interpreter, ttk::entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkEntry + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.4 {unsafe slave interpreter, listbox, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryListbox + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.5 {unsafe slave interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 1 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.6 {unsafe slave interpreter, spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 2 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-5.7 {unsafe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 3 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-5.8 {unsafe slave interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 1 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {PAYLOAD} + +test safePrimarySelection-5.9 {unsafe slave interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 2 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {2} + +test safePrimarySelection-5.10 {unsafe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set int2 slave2 + ::_test_tmp::unsafeInterp $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 3 + $int2 eval ::_test_tmp::getPrimarySelection +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 + ::_test_tmp::clearPrimarySelection +} -result {3} + +test safePrimarySelection-6.1 {IMPORTANT, safe slave interpreter, text, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryText + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.2 {IMPORTANT, safe slave interpreter, entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryEntry + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.3 {IMPORTANT, safe slave interpreter, ttk::entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkEntry + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.4 {IMPORTANT, safe slave interpreter, listbox, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryListbox + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.5 {IMPORTANT, safe slave interpreter, spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 1 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.6 {IMPORTANT, safe slave interpreter, spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 2 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.7 {IMPORTANT, safe slave interpreter, spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::trySpinbox 3 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.8 {IMPORTANT, safe slave interpreter, ttk::spinbox as entry, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 1 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.9 {IMPORTANT, safe slave interpreter, ttk::spinbox spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 2 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + +test safePrimarySelection-6.10 {IMPORTANT, safe slave interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup { + catch {interp delete slave2} + destroy {*}[winfo children .] + ::_test_tmp::setPrimarySelection +} -body { + set res0 [::_test_tmp::getPrimarySelection] + set int2 slave2 + ::safe::interpCreate $int2 + ::safe::loadTk $int2 + $int2 eval $::_test_tmp::script + $int2 eval ::_test_tmp::tryTtkSpinbox 3 + set res1 [$int2 eval ::_test_tmp::getPrimarySelection] + set res2 [::_test_tmp::getPrimarySelection] + set res3 $res0--$res1--$res2 +} -cleanup { + interp delete $int2 + destroy {*}[winfo children .] + unset int2 res0 res1 res2 res3 + ::_test_tmp::clearPrimarySelection +} -result {OLD_VALUE----OLD_VALUE} + + +namespace delete ::_test_tmp + +# option clear +# cleanup +cleanupTests +return |