blob: 7240fa61c544a3be7c85accf7f83588351244bea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# This file is a Tcl script to test out Tk's Windows specific
# clipboard code. It is organized in the standard fashion for Tcl
# tests.
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
# Copyright © 1997 by Sun Microsystems, Inc.
# Copyright © 1998-2000 by Scriptics Corporation.
# All rights reserved.
package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
#################################################################
# Note that some of these tests may fail if another application #
# is grabbing the clipboard (e.g. an X server, or a VNC viewer) #
#################################################################
test winClipboard-1.1 {TkSelGetSelection} -constraints win -setup {
clipboard clear
} -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 {}
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
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"
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Ç\nline 2"
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.6 {TkSelGetSelection & TkWinClipboardRender} -constraints {
win testclipboard
} -setup {
clipboard clear
} -body {
clipboard append "привет миф"
list [selection get -selection CLIPBOARD] [testclipboard]
} -cleanup {
clipboard clear
} -result [list "привет миф" "привет миф"]
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
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
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:
|