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

puts "img::tga [package require img::tga]"

set tgadata \
{AAAKAAAAAAAAAAAAUgAMACAg0d/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+I
AP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A
39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/
AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//
AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA
/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA
/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA
/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD/
//8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8A
AP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP//
//8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAA
AAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAA
AAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kA
AAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I
/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/88AAAD/AN/b3//R39vf/w==}


test tga-1.1 {} {
    catch {image delete i}
    image create photo i -file [file join $tcltest::testsDirectory 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 [file join $tcltest::testsDirectory hori.tga] r]
    fconfigure $f -translation binary
    set return [catch {i put [read $f]} msg]
    close $f
    lappend return $msg
} {0 {}}