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

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

set pcxdata \
{CgUBCAAAAABRAAsALAEsAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAADUgABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAADB/wDE/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDC/wDE
/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDH/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDC/wDE
/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDH/wDC/wDC/wDC/wDE
/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC/wDC/wDE/wDC/wDC/wDC
/wDH/wDC/wDC/wDB/8H/ygDJ/8QAwf/HAMH/AML/AML/zADC/wDC/wDC/8YAwf/FAMn/AML/
ygDJ/8QAwf/HAMH/AML/AML/zADC/wDC/wDC/8YAwf/FAMn/AML/ygDJ/8QAwf/HAMH/AML/
AML/zADC/wDC/wDC/8YAwf/FAMn/AMH/wf/KAMn/wwDB/wDB/8IAwf/CAMH/AMP/AML/wwDB
/8IAwf/CAMH/wgDF/wDD/8IAwf8Awv/CAML/AMb/AML/AML/ygDJ/8MAwf8Awf/CAMH/wgDB
/wDD/wDC/8MAwf/CAMH/wgDB/8IAxf8Aw//CAMH/AML/wgDC/wDG/wDC/wDC/8oAyf/DAMH/
AMH/wgDB/8IAwf8Aw/8Awv/DAMH/wgDB/8IAwf/CAMX/AMP/wgDB/wDC/8IAwv8Axv8Awv8A
wf/B/8oAyf8Awf8Awv/CAML/wgDB/wDD/wDC/8wAxf8Aw/8Awv8Aw/8Awv8Axv8Awv8Awv/K
AMn/AMH/AML/wgDC/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Axf8Awv/MAML/AMb/AML/AMb/AMn/AML/
ygDJ/wDB/wDC/8IAwv/CAMX/AML/zADC/wDG/wDC/wDG/wDJ/wDC/8oAyf8Awf8Awv/CAML/
wgDF/wDC/8wAwv8Axv8Awv8Axv8Ayf8Awf/B//8A0QDC//8A0QDC//8A0QDB/8H/AMH/wgDB
/8IAwf8Awv8Awv8Awf/CAMH/wgDB/8IAwf8Awv8Awv8Awf/CAMH/wgDB/8IAwf8Awv8Awv8A
wf/CAMH/wgDB/wDC/wDC/wDC/wDB/8IAwf/CAMH/AML/AML/AML/AMH/wgDB/8IAwf8Awv8A
wv8Awf/CAMH/wgDB/8IAwf8Awv8Awv8Awf/CAMH/wgDB/8IAwf8Awv8Awv8Awf/CAMH/wgDB
/wDC/wDC/wDC/wDB/8IAwf/CAMH/AML/AML/AML/AMH/wgDB/8IAwf8Awv8Awv8Awf/CAMH/
wgDB/8IAwf8Awv8Awv8Awf/CAMH/wgDB/8IAwf8Awv8Awv8Awf/CAMH/wgDB/wDC/wDC/wDC
/wDB/8IAwf/CAMH/AML/AML/AMH/}


test pcx-1.1 {} {
    catch {image delete i}
    image create photo i -file [file join $tcltest::testsDirectory hori_bw.pcx]
    i data -format pcx
} $pcxdata
test pcx-1.2 {} {
    catch {image delete i}
    image create photo i -data $pcxdata
    set data [i data -format pcx]
} $pcxdata
test pcx-1.3 {} {
    i blank
    i put $pcxdata
    set data [i data -format pcx]
} $pcxdata
test pcx-1.4 {} {
    i blank
    i put $pcxdata -format pcx
    set data [i data -format pcx]
} $pcxdata
if {[info tclversion] < 8.0} {
    return
}

test pcx-2.0 {Binary I/O with PCX images} {
    i blank
    set f [open [file join $tcltest::testsDirectory hori_bw.pcx] r]
    fconfigure $f -translation binary
    set return [catch {i put [read $f]} msg]
    close $f
    lappend return $msg
} {0 {}}
