Skip to content

Commit

Permalink
Merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Jan 23, 2024
2 parents 0b9a066 + 03582e5 commit d6c0736
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 185 deletions.
7 changes: 6 additions & 1 deletion generic/tkConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,13 @@ DoObjConfig(
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
newPixels = INT_MIN;
} else if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr,
} else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr,
&newPixels) != TCL_OK) {
if (nullOK && interp) {
Tcl_AppendResult(interp, "expected screen distance or \"\" but got \"",
Tcl_GetString(valuePtr), "\"", NULL);
Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
}
return TCL_ERROR;
}
if (internalPtr != NULL) {
Expand Down
9 changes: 5 additions & 4 deletions generic/tkGet.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ Tk_GetScreenMM(
error:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad screen distance \"%s\"", string));
"expected screen distance but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "SCREEN_DISTANCE", NULL);
}
return TCL_ERROR;
Expand Down Expand Up @@ -713,8 +713,9 @@ TkGetDoublePixels(
}
if (!tkwin) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("bad screen", -1));
Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"expected screen distance but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
}
return TCL_ERROR;
}
Expand All @@ -729,7 +730,7 @@ TkGetDoublePixels(
error:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad screen distance \"%s\"", string));
"expected screen distance but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL);
}
return TCL_ERROR;
Expand Down
6 changes: 3 additions & 3 deletions generic/tkObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ SetPixelFromAny(
error:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad screen distance \"%.50s\"", string));
"expected screen distance but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
}
return TCL_ERROR;
Expand Down Expand Up @@ -801,8 +801,8 @@ SetMMFromAny(
if (rest == string) {
error:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad screen distance \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "DISTANCE", NULL);
"expected screen distance but got \"%s\"", string));
Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
return TCL_ERROR;
}
switch (*rest) {
Expand Down
2 changes: 1 addition & 1 deletion generic/tkUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ TkPixelParseProc(

if ((result == TCL_OK) && (clientData == NULL) && (*doublePtr < 0.0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad screen distance \"%s\"", value));
"expected screen distance but got \"%s\"", value));
Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", NULL);
return TCL_ERROR;
}
Expand Down
14 changes: 7 additions & 7 deletions tests/bind.test
Original file line number Diff line number Diff line change
Expand Up @@ -2988,7 +2988,7 @@ test bind-22.24 {HandleEventGenerate: options <Configure> -borderwidth xyz} -set
return $x
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.25 {HandleEventGenerate: options <Configure> -borderwidth 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -3230,7 +3230,7 @@ test bind-22.41 {HandleEventGenerate: options <Expose> -height xyz} -setup {
event generate .t.f <Expose> -height xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.42 {HandleEventGenerate: options <Expose> -height 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -3662,7 +3662,7 @@ test bind-22.73 {HandleEventGenerate: options <Key> -rootx xyz} -setup {
event generate .t.f <Key> -rootx xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.74 {HandleEventGenerate: options <Key> -rootx 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -3772,7 +3772,7 @@ test bind-22.81 {HandleEventGenerate: options <Key> -rooty xyz} -setup {
event generate .t.f <Key> -rooty xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.82 {HandleEventGenerate: options <Key> -rooty 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -4362,7 +4362,7 @@ test bind-22.124 {HandleEventGenerate: options <Expose> -width xyz} -setup {
event generate .t.f <Expose> -width xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.125 {HandleEventGenerate: options <Expose> -width 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -4567,7 +4567,7 @@ test bind-22.139 {HandleEventGenerate: options <Key> -x xyz} -setup {
event generate .t.f <Key> -x xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.140 {HandleEventGenerate: options <Key> -x 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down Expand Up @@ -4733,7 +4733,7 @@ test bind-22.151 {HandleEventGenerate: options <Key> -y xyz} -setup {
event generate .t.f <Key> -y xyz
} -cleanup {
destroy .t.f
} -returnCodes error -result {bad screen distance "xyz"}
} -returnCodes error -result {expected screen distance but got "xyz"}

test bind-22.152 {HandleEventGenerate: options <Key> -y 2i} -setup {
frame .t.f -class Test -width 150 -height 100
Expand Down
56 changes: 28 additions & 28 deletions tests/button.test
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ test button-1.34 {configuration option: "bd" for label} -setup {
.l configure -bd badValue
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.35 {configuration option: "bd" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -362,7 +362,7 @@ test button-1.36 {configuration option: "bd" for button} -setup {
.b configure -bd badValue
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.37 {configuration option: "bd" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -381,7 +381,7 @@ test button-1.38 {configuration option: "bd" for checkbutton} -setup {
.c configure -bd badValue
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.39 {configuration option: "bd" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -400,7 +400,7 @@ test button-1.40 {configuration option: "bd" for radiobutton} -setup {
.r configure -bd badValue
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}

test button-1.41 {configuration option: "bg" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
Expand Down Expand Up @@ -574,7 +574,7 @@ test button-1.58 {configuration option: "borderwidth" for label} -setup {
.l configure -borderwidth badValue
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.59 {configuration option: "borderwidth" for button} -setup {
button .b -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -593,7 +593,7 @@ test button-1.60 {configuration option: "borderwidth" for button} -setup {
.b configure -borderwidth badValue
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.61 {configuration option: "borderwidth" for checkbutton} -setup {
checkbutton .c -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -612,7 +612,7 @@ test button-1.62 {configuration option: "borderwidth" for checkbutton} -setup {
.c configure -borderwidth badValue
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.63 {configuration option: "borderwidth" for radiobutton} -setup {
radiobutton .r -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -631,7 +631,7 @@ test button-1.64 {configuration option: "borderwidth" for radiobutton} -setup {
.r configure -borderwidth badValue
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}

test button-1.65 {configuration option: "command" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
Expand Down Expand Up @@ -1405,7 +1405,7 @@ test button-1.144 {configuration option: "highlightthickness" for label} -setup
.l configure -highlightthickness badValue
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.145 {configuration option: "highlightthickness" for button} -setup {
button .b -borderwidth 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -1424,7 +1424,7 @@ test button-1.146 {configuration option: "highlightthickness" for button} -setup
.b configure -highlightthickness badValue
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.147 {configuration option: "highlightthickness" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -1443,7 +1443,7 @@ test button-1.148 {configuration option: "highlightthickness" for checkbutton} -
.c configure -highlightthickness badValue
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}
test button-1.149 {configuration option: "highlightthickness" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -1462,7 +1462,7 @@ test button-1.150 {configuration option: "highlightthickness" for radiobutton} -
.r configure -highlightthickness badValue
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "badValue"}
} -returnCodes {error} -result {expected screen distance but got "badValue"}

test button-1.151 {configuration option: "image" for label} -constraints {
testImageType
Expand Down Expand Up @@ -1810,7 +1810,7 @@ test button-1.184 {configuration option: "padx" for label} -setup {
.l configure -padx 420x
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.185 {configuration option: "padx" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -1829,7 +1829,7 @@ test button-1.186 {configuration option: "padx" for button} -setup {
.b configure -padx 420x
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.187 {configuration option: "padx" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -1848,7 +1848,7 @@ test button-1.188 {configuration option: "padx" for checkbutton} -setup {
.c configure -padx 420x
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.189 {configuration option: "padx" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -1867,7 +1867,7 @@ test button-1.190 {configuration option: "padx" for radiobutton} -setup {
.r configure -padx 420x
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}

test button-1.191 {configuration option: "pady" for label} -setup {
label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
Expand All @@ -1887,7 +1887,7 @@ test button-1.192 {configuration option: "pady" for label} -setup {
.l configure -pady 420x
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.193 {configuration option: "pady" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -1906,7 +1906,7 @@ test button-1.194 {configuration option: "pady" for button} -setup {
.b configure -pady 420x
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.195 {configuration option: "pady" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -1925,7 +1925,7 @@ test button-1.196 {configuration option: "pady" for checkbutton} -setup {
.c configure -pady 420x
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}
test button-1.197 {configuration option: "pady" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -1944,7 +1944,7 @@ test button-1.198 {configuration option: "pady" for radiobutton} -setup {
.r configure -pady 420x
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "420x"}
} -returnCodes {error} -result {expected screen distance but got "420x"}

test button-1.199 {configuration option: "repeatdelay" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
Expand Down Expand Up @@ -2600,7 +2600,7 @@ test button-1.263 {configuration option: "wraplength" for label} -setup {
.l configure -wraplength 6x
} -cleanup {
destroy .l
} -returnCodes {error} -result {bad screen distance "6x"}
} -returnCodes {error} -result {expected screen distance but got "6x"}
test button-1.264 {configuration option: "wraplength" for button} -setup {
button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .b
Expand All @@ -2619,7 +2619,7 @@ test button-1.265 {configuration option: "wraplength" for button} -setup {
.b configure -wraplength 6x
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "6x"}
} -returnCodes {error} -result {expected screen distance but got "6x"}
test button-1.266 {configuration option: "wraplength" for checkbutton} -setup {
checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .c
Expand All @@ -2638,7 +2638,7 @@ test button-1.267 {configuration option: "wraplength" for checkbutton} -setup {
.c configure -wraplength 6x
} -cleanup {
destroy .c
} -returnCodes {error} -result {bad screen distance "6x"}
} -returnCodes {error} -result {expected screen distance but got "6x"}
test button-1.268 {configuration option: "wraplength" for radiobutton} -setup {
radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
pack .r
Expand All @@ -2657,7 +2657,7 @@ test button-1.269 {configuration option: "wraplength" for radiobutton} -setup {
.r configure -wraplength 6x
} -cleanup {
destroy .r
} -returnCodes {error} -result {bad screen distance "6x"}
} -returnCodes {error} -result {expected screen distance but got "6x"}

test button-1.270 {configuration options} -body {
# Additional check to make sure that -selectcolor may be empty in
Expand Down Expand Up @@ -3393,14 +3393,14 @@ test button-5.20 {ConfigureButton - -width option} -body {
.b configure -width abc
} -cleanup {
destroy .b
} -returnCodes {error} -result {bad screen distance "abc"}
} -returnCodes {error} -result {expected screen distance but got "abc"}
test button-5.21 {ConfigureButton - -width option} -body {
button .b -bitmap questhead
catch {.b configure -width abc}
return $errorInfo
} -cleanup {
destroy .b
} -result {bad screen distance "abc"
} -result {expected screen distance but got "abc"
(processing -width option)
invoked from within
".b configure -width abc"}
Expand All @@ -3414,7 +3414,7 @@ test button-5.22 {ConfigureButton - -height option} -constraints {
} -cleanup {
destroy .b
image delete image1
} -returnCodes {error} -result {bad screen distance "0.5x"}
} -returnCodes {error} -result {expected screen distance but got "0.5x"}
test button-5.23 {ConfigureButton - -height option} -constraints {
testImageType
} -setup {
Expand All @@ -3427,7 +3427,7 @@ test button-5.23 {ConfigureButton - -height option} -constraints {
} -cleanup {
destroy .b
image delete image1
} -result {bad screen distance "0.5x"
} -result {expected screen distance but got "0.5x"
(processing -height option)
invoked from within
".b configure -height 0.5x"}
Expand Down
Loading

0 comments on commit d6c0736

Please sign in to comment.