diff options
-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] |