diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 20:28:26 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 20:28:26 (GMT) |
commit | b184baa1234c2143e488d1796ae98afab118b891 (patch) | |
tree | 686b0a47b272296205c7fa2bc789f62a03d20df6 /tkimg/png/tests | |
parent | f7560d0a451a793441216d76eb4d9475aab61740 (diff) | |
parent | 5aad878400425d3af44433a47c13824385689e1d (diff) | |
download | blt-b184baa1234c2143e488d1796ae98afab118b891.zip blt-b184baa1234c2143e488d1796ae98afab118b891.tar.gz blt-b184baa1234c2143e488d1796ae98afab118b891.tar.bz2 |
Merge commit '5aad878400425d3af44433a47c13824385689e1d' as 'tkimg'
Diffstat (limited to 'tkimg/png/tests')
-rw-r--r-- | tkimg/png/tests/all.tcl | 24 | ||||
-rw-r--r-- | tkimg/png/tests/folder.png | bin | 0 -> 216 bytes | |||
-rw-r--r-- | tkimg/png/tests/png.test | 45 |
3 files changed, 69 insertions, 0 deletions
diff --git a/tkimg/png/tests/all.tcl b/tkimg/png/tests/all.tcl new file mode 100644 index 0000000..672eef7 --- /dev/null +++ b/tkimg/png/tests/all.tcl @@ -0,0 +1,24 @@ +# all.tcl -- -*- tcl -*- +# +# Import common functionality, then run the tests in this directory. +# +# Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net> +# All rights reserved. +# +# RCS: @(#) $Id: all.tcl,v 1.1.1.1 2016/01/25 21:20:47 joye Exp $ + +set _pwd [pwd] +cd [file dirname [file join [pwd] [info script]]] +set _here [pwd] +cd $_pwd +source [file join [file dirname [file dirname $_here]] tests all.tcl] +unset _pwd _here + +set ::tcltest::testSingleFile false +set ::tcltest::testsDirectory [file dirname [info script]] + +# We need to ensure that the testsDirectory is absolute +::tcltest::normalizePath ::tcltest::testsDirectory + +run_tests +exit diff --git a/tkimg/png/tests/folder.png b/tkimg/png/tests/folder.png Binary files differnew file mode 100644 index 0000000..8e31c72 --- /dev/null +++ b/tkimg/png/tests/folder.png diff --git a/tkimg/png/tests/png.test b/tkimg/png/tests/png.test new file mode 100644 index 0000000..f38f350 --- /dev/null +++ b/tkimg/png/tests/png.test @@ -0,0 +1,45 @@ +# 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 \ +{iVBORw0KGgoAAAANSUhEUgAAABAAAAAMCAIAAAGTgppAAAAABGdBTUEAAYagMeiWXwAAAHxJ +REFUKJGVUMERgDAIC54D+HMDmanbuI0zxQ38uYE+uALW66N5UUISqJCE4X52ACBZS2umPkCS +pPjAdZYJCUJy3Q57LLK7vURChdEfeWulqh4dRLa6zhJEE+B0N2OcEFtGVXNYvrQV9JwauH7G +76f+WCQGurv2MCwYvuEFQANGc3uOMFYAAAAASUVORK5CYII=} + +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 {}} |