diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-01-03 21:52:18 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-01-03 21:52:18 (GMT) |
commit | 4302a869f0212a3e4878e66a7260b434f6584476 (patch) | |
tree | e6976e66edf648406e32b092395121e045301692 /tkimg/tga/tests | |
parent | a780057cc1b51dd3a557549c3cf2431f09136c0d (diff) | |
parent | 60d692811c12788ed4468d5ff680633304e8f641 (diff) | |
download | blt-4302a869f0212a3e4878e66a7260b434f6584476.zip blt-4302a869f0212a3e4878e66a7260b434f6584476.tar.gz blt-4302a869f0212a3e4878e66a7260b434f6584476.tar.bz2 |
Merge commit '60d692811c12788ed4468d5ff680633304e8f641' as 'tkimg'
Diffstat (limited to 'tkimg/tga/tests')
-rwxr-xr-x | tkimg/tga/tests/all.tcl | 24 | ||||
-rwxr-xr-x | tkimg/tga/tests/hori.tga | bin | 0 -> 642 bytes | |||
-rwxr-xr-x | tkimg/tga/tests/tga.test | 56 |
3 files changed, 80 insertions, 0 deletions
diff --git a/tkimg/tga/tests/all.tcl b/tkimg/tga/tests/all.tcl new file mode 100755 index 0000000..7010d2d --- /dev/null +++ b/tkimg/tga/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 224 2009-07-27 08:47:46Z nijtmans $
+
+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/tga/tests/hori.tga b/tkimg/tga/tests/hori.tga Binary files differnew file mode 100755 index 0000000..2facb77 --- /dev/null +++ b/tkimg/tga/tests/hori.tga diff --git a/tkimg/tga/tests/tga.test b/tkimg/tga/tests/tga.test new file mode 100755 index 0000000..2f00fb7 --- /dev/null +++ b/tkimg/tga/tests/tga.test @@ -0,0 +1,56 @@ +# This file is a Tcl script to test out TGA reading and writing.
+# It is organized in the standard fashion for Tcl tests.
+#
+
+puts "img::tga [package require img::tga]"
+
+set tgadata \
+{AAAKAAAAAAAAAAAAUgAMACAg0d/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+I
+AP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A
+39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/
+AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//
+AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA
+/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA
+/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA
+/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD/
+//8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8A
+AP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP//
+//8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAA
+AAD/iAD///8BAAAA/9/b3/8A39vf/4kAAAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAA
+AAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/4kA
+AAD/iP////8AAAAA/4gAAP//AAAAAP+IAP8A/wAAAAD/iP8AAP8AAAAA/4j//wD/AAAAAP+I
+/wD//wAAAAD/iAD///8BAAAA/9/b3/8A39vf/88AAAD/AN/b3//R39vf/w==}
+
+
+test tga-1.1 {} {
+ catch {image delete i}
+ image create photo i -file [file join $tcltest::testsDirectory hori.tga]
+ i data -format tga
+} $tgadata
+test tga-1.2 {} {
+ catch {image delete i}
+ image create photo i -data $tgadata
+ set data [i data -format tga]
+} $tgadata
+test tga-1.3 {} {
+ i blank
+ i put $tgadata
+ set data [i data -format tga]
+} $tgadata
+test tga-1.4 {} {
+ i blank
+ i put $tgadata -format tga
+ set data [i data -format tga]
+} $tgadata
+if {[info tclversion] < 8.0} {
+ return
+}
+
+test tga-2.0 {Binary I/O with TGA images} {
+ i blank
+ set f [open [file join $tcltest::testsDirectory hori.tga] r]
+ fconfigure $f -translation binary
+ set return [catch {i put [read $f]} msg]
+ close $f
+ lappend return $msg
+} {0 {}}
|