blob: afb31039a4eaccdfec814a194b3a41416dd58411 (
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
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
86
|
# This file is a Tcl script to test out DTED reading.
# Writing is currently not supported.
# It is organized in the standard fashion for Tcl tests.
package require Tk
package require tcltest
tcltest::configure {*}$argv
source [file join [file dirname [info script]] constraints.tcl]
package require Img
package require img::dted
imageInit
namespace eval ::dted::test {
namespace import ::tcltest::*
set fmt "dted"
set ext "dt0"
set file "testimgs/img.$ext"
# Encoded image content.
source $file.base64
test dted-1.1 {} -setup {
catch {image delete i}
} -body {
image create photo i -file $file
set w [image width i]
set h [image height i]
set l [list $w $h]
} -result {121 121}
test dted-1.2 {} -setup {
catch {image delete i}
} -body {
image create photo i -data $imgdata
set w [image width i]
set h [image height i]
set l [list $w $h]
} -cleanup {
image delete i
} -result {121 121}
test dted-1.3 {} -setup {
catch {image delete i}
} -body {
image create photo i
i put $imgdata
set w [image width i]
set h [image height i]
set l [list $w $h]
} -cleanup {
image delete i
} -result {121 121}
test dted-1.4 {} -setup {
catch {image delete i}
} -body {
image create photo i
i put $imgdata -format $fmt
set w [image width i]
set h [image height i]
set l [list $w $h]
} -cleanup {
image delete i
} -result {121 121}
test dted-2.0 {Binary I/O with DTED files} -setup {
catch {image delete i}
} -body {
image create photo i
set f [open $file r]
fconfigure $f -translation binary
set return [catch {i put [read $f]} msg]
close $f
lappend return $msg
} -cleanup {
image delete i
} -result {0 {}}
}
imageFinish
namespace delete ::dted::test
|