diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-11 11:31:54 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-01-11 11:31:54 (GMT) |
commit | 2a52c1f6b17be29292bd301a7ee90157e856e6f7 (patch) | |
tree | 63cd5d18b3efd2bcaaead5ebfd77d6e334e11490 | |
parent | d72792591c268e1d4022885dcc8b0afeef200670 (diff) | |
parent | 225f01858954fb5bc8b0f1304167d52e7249d22d (diff) | |
download | tk-2a52c1f6b17be29292bd301a7ee90157e856e6f7.zip tk-2a52c1f6b17be29292bd301a7ee90157e856e6f7.tar.gz tk-2a52c1f6b17be29292bd301a7ee90157e856e6f7.tar.bz2 |
Fix [d4fb4e80d220e46e588f310291fd7a4205e8cd67|d4fb4e80d2]: Image photo commands read/write/put do not accept "-" as first letter in file names resp. image data
-rw-r--r-- | generic/tkImgPhoto.c | 4 | ||||
-rw-r--r-- | tests/imgPhoto.test | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 47aa523..f6fee84 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -1675,6 +1675,10 @@ ParseSubcommandOptions( */ if ((allowedOptions & bit) == 0) { + if (optPtr->name == NULL) { + optPtr->name = objv[index]; + continue; + } Tcl_AppendResult(interp, "unrecognized option \"", Tcl_GetString(objv[index]), "\": must be ", NULL); diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index d4118b0..14c3d40 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -226,7 +226,7 @@ test imgPhoto-4.28 {ImgPhotoCmd procedure: put option} { list [catch {p1 put {{blahgle}}} err] $err } {1 {can't parse color "blahgle"}} test imgPhoto-4.29 {ImgPhotoCmd procedure: put option} { - p1 put -to 10 10 20 20 {{white}} + p1 put {{white}} -to 10 10 20 20 p1 get 19 19 } {255 255 255} test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} { @@ -440,6 +440,23 @@ test imgPhoto-4.72 {ImgPhotoCmd procedure: copy with -compositingrule} { checkImgTrans p1 3 3 } {0 2 1 1 2 0} catch {rename checkImgTrans {}} +test imgPhoto-4.74 {ImgPhotoCmd procedure: put option error handling} -setup { + image create photo photo1 +} -body { + photo1 put {{white}} -to 10 10 20 20 {{white}} +} -cleanup { + image delete photo1 +} -returnCodes 1 -result {wrong # args: should be "photo1 put data ?options?"} +test imgPhoto-4.75 {<photo> read command: filename starting with '-'} -constraints { + hasTeapotPhoto +} -body { + file copy -force $teapotPhotoFile -teapotPhotoFile + image create photo photo1 + photo1 read -teapotPhotoFile +} -cleanup { + image delete photo1 + file delete ./-teapotPhotoFile +} -result {} test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} hasTeapotPhoto { eval image delete [image names] |