diff options
Diffstat (limited to 'tests/winClipboard.test')
-rw-r--r-- | tests/winClipboard.test | 118 |
1 files changed, 82 insertions, 36 deletions
diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 7a710fd..b5594b8 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -10,69 +10,115 @@ # Copyright (c) 1998-2000 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: winClipboard.test,v 1.14 2004/06/24 12:45:44 dkf Exp $ +# RCS: @(#) $Id: winClipboard.test,v 1.17 2008/11/03 22:02:12 patthoyts Exp $ -package require tcltest 2.1 +package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +namespace import -force tcltest::test # Note that these tests may fail if another application is grabbing the # clipboard (e.g. an X server) -test winClipboard-1.1 {TkSelGetSelection} win { +test winClipboard-1.1 {TkSelGetSelection} -constraints win -setup { clipboard clear - catch {selection get -selection CLIPBOARD} msg - set msg -} {CLIPBOARD selection doesn't exist or form "STRING" not defined} -test winClipboard-1.2 {TkSelGetSelection} {win testclipboard} { +} -body { + selection get -selection CLIPBOARD +} -cleanup { clipboard clear +} -returnCodes error -result {CLIPBOARD selection doesn't exist or form "STRING" not defined} + +test winClipboard-1.2 {TkSelGetSelection} -constraints { + win testclipboard +} -setup { + clipboard clear +} -body { clipboard append {} - catch {selection get -selection CLIPBOARD} r1 - catch {testclipboard} r2 - list $r1 $r2 -} {{} {}} -test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} { + list [selection get -selection CLIPBOARD] [testclipboard] +} -cleanup { + clipboard clear +} -result {{} {}} + +test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} -constraints { + win testclipboard +} -setup { clipboard clear +} -body { clipboard append abcd update - catch {selection get -selection CLIPBOARD} r1 - catch {testclipboard} r2 - list $r1 $r2 -} {abcd abcd} -test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} { + list [selection get -selection CLIPBOARD] [testclipboard] +} -cleanup { clipboard clear +} -result {abcd abcd} + +test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} -constraints { + win testclipboard +} -setup { + clipboard clear +} -body { + set map [list "\r" "\\r" "\n" "\\n"] clipboard append "line 1\nline 2" - catch {selection get -selection CLIPBOARD} r1 - catch {testclipboard} r2 - list $r1 $r2 -} [list "line 1\nline 2" "line 1\r\nline 2"] -test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} {win testclipboard} { + list [string map $map [selection get -selection CLIPBOARD]]\ + [string map $map [testclipboard]] +} -cleanup { + clipboard clear +} -result [list "line 1\\nline 2" "line 1\\nline 2"] + +test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints { + win testclipboard +} -setup { clipboard clear +} -body { + set map [list "\r" "\\r" "\n" "\\n"] clipboard append "line 1\u00c7\nline 2" - catch {selection get -selection CLIPBOARD} r1 - catch {testclipboard} r2 - list $r1 $r2 -} [list "line 1\u00c7\nline 2" [bytestring "line 1\u00c7\r\nline 2"]] + list [string map $map [selection get -selection CLIPBOARD]]\ + [string map $map [testclipboard]] +} -cleanup { + clipboard clear +} -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"] + +test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints { + win testclipboard +} -setup { + clipboard clear +} -body { + clipboard append "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444" + list [selection get -selection CLIPBOARD] [testclipboard] +} -cleanup { + clipboard clear +} -result [list "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"\ + "\u043f\u0440\u0438\u0432\u0435\u0442 \u043c\u0438\u0444"] -test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} {win testclipboard} { +test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} -constraints { + win testclipboard +} -setup { clipboard clear +} -body { clipboard append -type OUR_ACTION "action data" clipboard append "string data" update - catch {selection get -selection CLIPBOARD -type OUR_ACTION} r1 - catch {testclipboard} r2 - list $r1 $r2 -} [list "action data" "string data"] -test winClipboard-2.2 {TkSelUpdateClipboard reentrancy problem} {win testclipboard} { + list [selection get -selection CLIPBOARD -type OUR_ACTION] [testclipboard] +} -cleanup { clipboard clear +} -result {{action data} {string data}} + +test winClipboard-2.2 {TkSelUpdateClipboard reentrancy problem} -constraints { + win testclipboard +} -setup { + clipboard clear +} -body { clipboard append -type OUR_ACTION "new data" clipboard append "more data in string" update - catch {testclipboard} r1 - catch {selection get -selection CLIPBOARD -type OUR_ACTION} r2 - list $r1 $r2 -} [list "more data in string" "new data"] + list [testclipboard] [selection get -selection CLIPBOARD -type OUR_ACTION] +} -cleanup { + clipboard clear +} -result {{more data in string} {new data}} # cleanup cleanupTests return + +# Local variables: +# mode: tcl +# End:
\ No newline at end of file |