summaryrefslogtreecommitdiffstats
path: root/tkimg/tests/sun.test
blob: cf094917d8b968a5a1790e6933f8560ef4e1da3d (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
# This file is a Tcl script to test out SUN reading and writing.
# It is organized in the standard fasion for Tcl tests.
#

if {[string compare test [info procs test]] == 1} {
    source defs
}

set sundata \
{WaZqlQAAABAAAAAMAAAAGAAAAkAAAAACAAAAAAAAAACACNmACwCAINmAAgCAAP/wgAD/8IAA
//CAAP/wgAIAgBrZgAIAgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAIAgBTZgCYAgAjZgAIA
gAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAgCACNmAAgCA
AP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IACAIAI2YACAIAA
//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAIAgAjZgAIAgAD/
8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAgCACNmAAgCAAP/w
gAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IACAIAI2YACAIAA//CA
AP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAIAgAjZgAIAgAD/8IAA
//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAP/wgAD/8IAA//CAAgCACNmAJgCACNk=}

test sun-1.1 {} {
    catch {image delete i}
    image create photo i -file folder.ras
    i data -format sun
} $sundata
test sun-1.2 {} {
    catch {image delete i}
    image create photo i -data $sundata
    set data [i data -format sun]
} $sundata
test sun-1.3 {} {
    i blank
    i put $data
    set data [i data -format sun]
} $sundata
test sun-1.4 {} {
    i blank
    i put $data -format sun
    set data [i data -format sun]
} $sundata

if {[info tclversion] < 8.0} {
    return
}

test sun-2.0 {Binary I/O with SUN images} {
    i blank
    set f [open folder.ras r]
    fconfigure $f -translation binary
    set return [catch {i put [read $f]} msg]
    close $f
    lappend return $msg
} {0 {}}