summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-04-09 13:15:30 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-04-09 13:15:30 (GMT)
commitbf3ea79621a47c9a99cf5854ddd2c186f073301c (patch)
treefed7e2f89ea04661452e5224c69f8a8ea420db50 /tests
parent843ef125db98bc3a762319cc94e9ce8de0881cef (diff)
downloadtk-bf3ea79621a47c9a99cf5854ddd2c186f073301c.zip
tk-bf3ea79621a47c9a99cf5854ddd2c186f073301c.tar.gz
tk-bf3ea79621a47c9a99cf5854ddd2c186f073301c.tar.bz2
* generic/tkImgPhoto.c (ImgPhotoCmd): [Bug 2983824]: Use the file
extension to guess the output format to use if one isn't specified.
Diffstat (limited to 'tests')
-rw-r--r--tests/imgPhoto.test41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index ee567ca..079bed9 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -10,7 +10,7 @@
#
# Author: Paul Mackerras (paulus@cs.anu.edu.au)
#
-# RCS: @(#) $Id: imgPhoto.test,v 1.35 2009/01/13 01:46:06 patthoyts Exp $
+# RCS: @(#) $Id: imgPhoto.test,v 1.36 2010/04/09 13:15:32 dkf Exp $
package require tcltest 2.2
namespace import ::tcltest::*
@@ -1115,6 +1115,45 @@ test imgPhoto-16.1 {copying to self doesn't access freed memory} -setup {
image delete $i
} -result {}
+# Check that we can guess our supported output formats [Bug 2983824]
+test imgPhoto-17.1 {photo write: format guessing from filename} -setup {
+ set i [image create photo -width 3 -height 3]
+} -body {
+ set f [makeFile {} test.png]
+ $i write $f
+ set fd [open $f]
+ seek $fd 1
+ read $fd 3
+} -cleanup {
+ catch {close $fd}
+ image delete $i
+ catch {removeFile $f}
+} -result PNG
+test imgPhoto-17.2 {photo write: format guessing from filename} -setup {
+ set i [image create photo -width 3 -height 3]
+} -body {
+ set f [makeFile {} test.gif]
+ $i write $f
+ set fd [open $f]
+ read $fd 3
+} -cleanup {
+ catch {close $fd}
+ image delete $i
+ catch {removeFile $f}
+} -result GIF
+test imgPhoto-17.3 {photo write: format guessing from filename} -setup {
+ set i [image create photo -width 3 -height 3]
+} -body {
+ set f [makeFile {} test.ppm]
+ $i write $f
+ set fd [open $f]
+ read $fd 3
+} -cleanup {
+ catch {close $fd}
+ image delete $i
+ catch {removeFile $f}
+} -result "P6\n"
+
# ----------------------------------------------------------------------
catch {rename foreachPixel {}}