summaryrefslogtreecommitdiffstats
path: root/tests/winClipboard.test
blob: ed16d0c1aba467230c6b2684db2dc71e586d072f (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
# 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-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: winClipboard.test,v 1.1.4.3 1999/03/11 18:51:20 hershey Exp $

if {$tcl_platform(platform)!="windows"} {
    puts "skipping: Windows only tests..."
    return
}

if {[lsearch [namespace children] ::test] == -1} {
    source [file join [pwd] [file dirname [info script]] defs.tcl]
}

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

test winClipboard-1.1 {TkSelGetSelection} {
    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} {
    clipboard clear
    clipboard append {}
    list [selection get -selection CLIPBOARD] [testclipboard]
} {{} {}}
test winClipboard-1.3 {TkSelGetSelection & TkWinClipboardRender} {
    clipboard clear
    clipboard append abcd
    list [selection get -selection CLIPBOARD] [testclipboard]
} {abcd abcd}
test winClipboard-1.4 {TkSelGetSelection & TkWinClipboardRender} {
    clipboard clear
    clipboard append "line 1\nline 2"
    list [selection get -selection CLIPBOARD] [testclipboard]
} [list "line 1\nline 2" "line 1\r\nline 2"]

# cleanup
::test::cleanupTests
return