blob: 874ad8d5c360d14a90f54669dc979ef100ee550f (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# This file is a Tcl script to test out GIF reading and writing.
# It is organized in the standard fashion for Tcl tests.
#
puts "img::jpeg [package require img::jpeg]"
set jpegdata \
{/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRof
Hh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwh
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAAR
CAAMABADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA
AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG
h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl
5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA
AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk
NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2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tPU1dbX2Nna4uPk
5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDpdJ8Nah4g0ay1q9n0Se7vrdLkTT6VI80A
dQypHILgFAmcKU2nI3feJY7Foda07WrHS9T1C0v0nsZpfOis2gk3xNCuW/eMpz5pJwByOPSv
FdP+NviXR9KsNNgstJeK2to4UeSKQttVQBnEgGcD0rsPh3481Xx343I1OCzh+xadcGP7KjLn
dJBnO5m/uDpjvXFRhinW95+67/1sF0f/2Q==}
test jpeg-1.1 {} {
catch {image delete i}
image create photo i -file [file join $tcltest::testsDirectory folder.jpg]
i data -format jpeg
} $jpegdata
test jpeg-1.2 {} {
image delete i
image create photo i -data $jpegdata
set data [i data -format jpeg]
} $jpegdata2
test jpeg-1.3 {} {
i blank
i put $jpegdata
set data [i data -format jpeg]
} $jpegdata2
test jpeg-1.4 {} {
i blank
i put $jpegdata -format jpeg
set data [i data -format jpeg]
} $jpegdata2
if {[info tclversion] < 8.0} {
return
}
test jpeg-2.0 {Binary I/O with JPEG images} {
i blank
set f [open [file join $tcltest::testsDirectory folder.jpg] r]
fconfigure $f -translation binary
set return [catch {i put [read $f]} msg]
close $f
lappend return $msg
} {0 {}}
|