summaryrefslogtreecommitdiffstats
path: root/tkimg/tests/raw.test
blob: fd73679c732727f07d96bba5278490ac2736d0eb (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
# This file is a Tcl script to test out RAW reading and writing.
# It is organized in the standard fashion for Tcl tests.
#

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

set rawdata \
{TWFnaWM9UkFXCldpZHRoPTE2CkhlaWdodD0xMgpOdW1DaGFuPTMKQnl0ZU9yZGVyPUludGVs
ClNjYW5PcmRlcj1Ub3BEb3duClBpeGVsVHlwZT1ieXRlCtnZ2dnZ2dnZ2QAAAAAAAAAAAAAA
ANnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/gAAAANnZ
2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ
2dnZ2dnZ2dnZ2dnZ2dnZ2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ANnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ
2dnZ2QAAAPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAA
APD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAAAPD/gPD/
gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/
gPD/gPD/gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/gPD/gPD/
gPD/gPD/gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAAAPD/gPD/gPD/gPD/gPD/gPD/gPD/gPD/
gPD/gPD/gPD/gAAAANnZ2dnZ2dnZ2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAANnZ2dnZ2dnZ2Q==}

test raw-1.1 {} {
    catch {image delete i}
    image create photo i -file folder.raw
    i data -format "raw -useheader true -nomap true -nchan 3"
} $rawdata
test raw-1.2 {} {
    catch {image delete i}
    image create photo i -data $rawdata
    set data [i data -format "raw -useheader true -nomap true -nchan 3"]
} $rawdata
test raw-1.3 {} {
    i blank
    i put $rawdata
    set data [i data -format "raw -useheader true -nomap true -nchan 3"]
} $rawdata
test raw-1.4 {} {
    i blank
    i put $rawdata -format raw
    set data [i data -format "raw -useheader true -nomap true -nchan 3"]
} $rawdata
if {[info tclversion] < 8.0} {
    return
}

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