summaryrefslogtreecommitdiffstats
path: root/tkimg/tests/dted.test
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-01-08 21:04:08 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-01-08 21:04:08 (GMT)
commit6dac183be1cdcc0a13966343e2c40c3ff56a3810 (patch)
tree802a6a87435da647463c945cf3571d52a84aad55 /tkimg/tests/dted.test
parentdbbb38af9cefef9e9e1a03c97945ee59063aa782 (diff)
downloadblt-6dac183be1cdcc0a13966343e2c40c3ff56a3810.zip
blt-6dac183be1cdcc0a13966343e2c40c3ff56a3810.tar.gz
blt-6dac183be1cdcc0a13966343e2c40c3ff56a3810.tar.bz2
update tkimg 1.4.7
Diffstat (limited to 'tkimg/tests/dted.test')
-rwxr-xr-xtkimg/tests/dted.test90
1 files changed, 90 insertions, 0 deletions
diff --git a/tkimg/tests/dted.test b/tkimg/tests/dted.test
new file mode 100755
index 0000000..b6dee93
--- /dev/null
+++ b/tkimg/tests/dted.test
@@ -0,0 +1,90 @@
+# This file is a Tcl script to test out DTED reading.
+# Note, that the DTED parser only supports reading.
+# 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 d [i data -format $fmt]
+ set l [list $w $h $d]
+ } -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 d [i data -format $fmt]
+ set l [list $w $h $d]
+ } -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 d [i data -format $fmt]
+ set l [list $w $h $d]
+ } -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 d [i data -format $fmt]
+ set l [list $w $h $d]
+ } -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