diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-22 16:51:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-12-22 16:51:16 (GMT) |
commit | 1ad353b0c90f41800998e2b597e4e6c60c01e928 (patch) | |
tree | 847bf2a1d7efc8a662e9d83bb6d2c10ee6308ad3 | |
parent | 96f5396c44f5802018117de2cee688ab61ec42c0 (diff) | |
parent | c0fe491025571aa1b4af422d0122eaacdb944396 (diff) | |
download | tk-1ad353b0c90f41800998e2b597e4e6c60c01e928.zip tk-1ad353b0c90f41800998e2b597e4e6c60c01e928.tar.gz tk-1ad353b0c90f41800998e2b597e4e6c60c01e928.tar.bz2 |
Merge 8.6
-rw-r--r-- | generic/tk3d.c | 41 | ||||
-rw-r--r-- | tests/canvas.test | 6 |
2 files changed, 27 insertions, 20 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index 55ca340..0920dc1 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -639,8 +639,7 @@ Tk_GetReliefFromObj( * * Results: * A standard Tcl return value. If all goes well then *reliefPtr is - * filled in with one of the values TK_RELIEF_RAISED, TK_RELIEF_FLAT, or - * TK_RELIEF_SUNKEN. + * filled in with one of the values TK_RELIEF_* * * Side effects: * None. @@ -656,30 +655,38 @@ Tk_GetRelief( { char c; size_t length; + int relief; c = name[0]; length = strlen(name); if ((c == 'f') && (strncmp(name, "flat", length) == 0)) { - *reliefPtr = TK_RELIEF_FLAT; - } else if ((c == 'g') && (strncmp(name, "groove", length) == 0) - && (length >= 2)) { - *reliefPtr = TK_RELIEF_GROOVE; + relief = TK_RELIEF_FLAT; + } else if ((c == 'g') && (strncmp(name, "groove", length) == 0)) { + relief = TK_RELIEF_GROOVE; } else if ((c == 'r') && (strncmp(name, "raised", length) == 0) && (length >= 2)) { - *reliefPtr = TK_RELIEF_RAISED; - } else if ((c == 'r') && (strncmp(name, "ridge", length) == 0)) { - *reliefPtr = TK_RELIEF_RIDGE; - } else if ((c == 's') && (strncmp(name, "solid", length) == 0)) { - *reliefPtr = TK_RELIEF_SOLID; - } else if ((c == 's') && (strncmp(name, "sunken", length) == 0)) { - *reliefPtr = TK_RELIEF_SUNKEN; + relief = TK_RELIEF_RAISED; + } else if ((c == 'r') && (strncmp(name, "ridge", length) == 0) + && (length >= 2)) { + relief = TK_RELIEF_RIDGE; + } else if ((c == 's') && (strncmp(name, "solid", length) == 0) + && (length >= 2)) { + relief = TK_RELIEF_SOLID; + } else if ((c == 's') && (strncmp(name, "sunken", length) == 0) + && (length >= 2)) { + relief = TK_RELIEF_SUNKEN; } else { - Tcl_SetObjResult(interp, - Tcl_ObjPrintf("bad relief \"%.50s\": must be %s", - name, "flat, groove, raised, ridge, solid, or sunken")); - Tcl_SetErrorCode(interp, "TK", "VALUE", "RELIEF", NULL); + if (interp) { + Tcl_SetObjResult(interp, + Tcl_ObjPrintf("bad relief \"%.50s\": must be %s", + name, "flat, groove, raised, ridge, solid, or sunken")); + Tcl_SetErrorCode(interp, "TK", "VALUE", "RELIEF", NULL); + } return TCL_ERROR; } + if (reliefPtr) { + *reliefPtr = relief; + } return TCL_OK; } diff --git a/tests/canvas.test b/tests/canvas.test index bf8f0fa..6a15ad1 100644 --- a/tests/canvas.test +++ b/tests/canvas.test @@ -133,12 +133,12 @@ test canvas-1.32 {configuration options: bad value for "insertwidth"} -body { .c configure -insertwidth 6x } -returnCodes error -result {bad screen distance "6x"} test canvas-1.33 {configuration options: good value for "relief"} -body { - .c configure -relief groove + .c configure -relief g .c cget -relief } -result {groove} test canvas-1.34 {configuration options: bad value for "relief"} -body { - .c configure -relief 1.5 -} -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} + .c configure -relief r +} -returnCodes error -result {bad relief "r": must be flat, groove, raised, ridge, solid, or sunken} test canvas-1.35 {configuration options: good value for "selectbackground"} -body { .c configure -selectbackground #110022 .c cget -selectbackground |