# This file is a Tcl script to test out GIF reading and writing.
# It is organized in the standard fashion for Tcl tests.
#

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

set gifdata \
{R0lGODlhEAAMAJEAANnZ2QAAAPD/gP///yH5BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB
QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==}

test gif-1.1 {} {
    catch {image delete i}
    image create photo i -file folder.gif
} i
test gif-1.2 {} {
    catch {image delete i}
    image create photo i -data $gifdata
    i data -format gif
} $gifdata
test gif-1.3 {} {
    catch {image delete i}
    image create photo i
    i put $gifdata
    i data -format gif
} $gifdata
test gif-1.4 {} {
    i blank
    i put $gifdata -format gif
    i data -format gif
} $gifdata

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