File: winClipboard.test

package info (click to toggle)
saods9 3.0.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 86,868 kB
  • ctags: 82,021
  • sloc: ansic: 663,637; tcl: 111,403; cpp: 52,727; sh: 27,784; makefile: 6,177; asm: 3,355; lex: 2,890; ada: 1,637; pascal: 1,621; xml: 1,221; yacc: 883; f90: 84; perl: 82; python: 33; fortran: 17; ruby: 13; sed: 12; php: 11
file content (85 lines) | stat: -rw-r--r-- 3,103 bytes parent folder | download
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
# 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 (c) 1997 by Sun Microsystems, Inc.
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: winClipboard.test,v 1.1.1.1 2004/04/02 22:35:05 joye Exp $

package require tcltest 2.1
namespace import -force tcltest::configure
namespace import -force tcltest::testsDirectory
configure -testdir [file join [pwd] [file dirname [info script]]]
configure -loadfile [file join [testsDirectory] constraints.tcl]
tcltest::loadTestedCommands

namespace import -force tcltest::bytestring

# Note that these tests may fail if another application is grabbing the
# clipboard (e.g. an X server)

testConstraint testclipboard [llength [info commands testclipboard]]

test winClipboard-1.1 {TkSelGetSelection} {pcOnly} {
    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} {pcOnly testclipboard} {
    clipboard clear
    clipboard append {}
    catch {selection get -selection CLIPBOARD} r1
    catch {testclipboard} r2
    list $r1 $r2
} {{} {}}
test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testclipboard} {
    clipboard clear
    clipboard append abcd
    update
    catch {selection get -selection CLIPBOARD} r1
    catch {testclipboard} r2
    list $r1 $r2
} {abcd abcd}
test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} {pcOnly testclipboard} {
    clipboard clear
    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} {pcOnly testclipboard} {
    clipboard clear
    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"]]

test winClipboard-2.1 {TkSelUpdateClipboard reentrancy problem} {pcOnly testclipboard} {
    clipboard clear
    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} {pcOnly testclipboard} {
    clipboard clear
    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"]

# cleanup
::tcltest::cleanupTests
return