# 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.
#

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

set dteddata \
{VUhMMTAxMDAwMDBFMDQ4MDAwME4wMzAwMDMwMDAwMDZVICAgICAgICAgICAg
[encoded data, 46238 characters]
8wISAABBQg==}

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

test dted-2.0 {Binary I/O with DTED files} {
    i blank
    set f [open e10n48.dt0 r]
    fconfigure $f -translation binary
    set return [catch {i put [read $f]} msg]
    close $f
    lappend return $msg
} {0 {}}
