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

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

set tgadata \
{AAAKAAAAAAAAAAAAUgAMABgg0d/b3wDf29+JAAAAiP///wAAAACIAAD/AAAAAIgA/wAAAAAA
iP8AAAAAAACI//8AAAAAAIj/AP8AAAAAiAD//wEAAADf298A39vfiQAAAIj///8AAAAAiAAA
/wAAAACIAP8AAAAAAIj/AAAAAAAAiP//AAAAAACI/wD/AAAAAIgA//8BAAAA39vfAN/b34kA
AACI////AAAAAIgAAP8AAAAAiAD/AAAAAACI/wAAAAAAAIj//wAAAAAAiP8A/wAAAACIAP//
AQAAAN/b3wDf29+JAAAAiP///wAAAACIAAD/AAAAAIgA/wAAAAAAiP8AAAAAAACI//8AAAAA
AIj/AP8AAAAAiAD//wEAAADf298A39vfiQAAAIj///8AAAAAiAAA/wAAAACIAP8AAAAAAIj/
AAAAAAAAiP//AAAAAACI/wD/AAAAAIgA//8BAAAA39vfAN/b34kAAACI////AAAAAIgAAP8A
AAAAiAD/AAAAAACI/wAAAAAAAIj//wAAAAAAiP8A/wAAAACIAP//AQAAAN/b3wDf29+JAAAA
iP///wAAAACIAAD/AAAAAIgA/wAAAAAAiP8AAAAAAACI//8AAAAAAIj/AP8AAAAAiAD//wEA
AADf298A39vfiQAAAIj///8AAAAAiAAA/wAAAACIAP8AAAAAAIj/AAAAAAAAiP//AAAAAACI
/wD/AAAAAIgA//8BAAAA39vfAN/b34kAAACI////AAAAAIgAAP8AAAAAiAD/AAAAAACI/wAA
AAAAAIj//wAAAAAAiP8A/wAAAACIAP//AQAAAN/b3wDf29/PAAAAAN/b39Hf298=}


test tga-1.1 {} {
    catch {image delete i}
    image create photo i -file hori.tga
    i data -format tga
} $tgadata
test tga-1.2 {} {
    catch {image delete i}
    image create photo i -data $tgadata
    set data [i data -format tga]
} $tgadata
test tga-1.3 {} {
    i blank
    i put $tgadata
    set data [i data -format tga]
} $tgadata
test tga-1.4 {} {
    i blank
    i put $tgadata -format tga
    set data [i data -format tga]
} $tgadata
if {[info tclversion] < 8.0} {
    return
}

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