blob: 5b899e33f76ffd6014a7b3591a4e0b602ee1fe90 (
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
|
# This file is a Tcl script to test out PNG reading and writing.
# It is organized in the standard fasion for Tcl tests.
#
puts "img::png [package require img::png]"
set pngdata \
{iVBORw0KGgoAAAANSUhEUgAAABAAAAAMCAYAAAEc4A0XAAAABGdBTUEAAYagMeiWXwAAAJlJ
REFUKJGlkcsRgzAMRJ8yNMI9BVAEqohzKlqKoADulKIcEnuwIXgyvJM/611JNkkBYEBsMXwW
kmCLIYDIVwC9LZikcHckAWBfKQDrPPGgwiTFc3zlg96W/LzIr0nCg+VphLsDFNY/I9Z5KgX7
NvYkYbOG+wJLH+Lu1POoh3ZqAJw2ccXetAMOyVf0thT7Zo8tbht0cCzrH95fqko+eQjtmAAA
AABJRU5ErkJggg==}
test png-1.1 {} {
catch {image delete i}
image create photo i -file [file join $tcltest::testsDirectory folder.png]
i data -format png
} $pngdata
test png-1.2 {} {
catch {image delete i}
image create photo i -data $pngdata
set data [i data -format png]
} $pngdata
test png-1.3 {} {
i blank
i put $data
set data [i data -format png]
} $pngdata
test png-1.4 {} {
i blank
i put $data -format png
set data [i data -format png]
} $pngdata
if {[info tclversion] < 8.0} {
return
}
test png-2.0 {Binary I/O with PNG images} {
i blank
set f [open [file join $tcltest::testsDirectory folder.png] r]
fconfigure $f -translation binary
set return [catch {i put [read $f]} msg]
close $f
lappend return $msg
} {0 {}}
|