summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-03 13:50:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2024-06-03 13:50:58 (GMT)
commitc5a5c5403dee3072a654b18e3366892d316764f3 (patch)
treefbe718133296ac1d89e0cc4e395abeec16e14cd4
parentbdbfd047cdf71c798809e18044e132e6ebfc488d (diff)
downloadtk-c5a5c5403dee3072a654b18e3366892d316764f3.zip
tk-c5a5c5403dee3072a654b18e3366892d316764f3.tar.gz
tk-c5a5c5403dee3072a654b18e3366892d316764f3.tar.bz2
Somewhat better error-messages (addendum to previous commit)
-rw-r--r--generic/ttk/ttkManager.c2
-rw-r--r--generic/ttk/ttkNotebook.c8
-rw-r--r--generic/ttk/ttkTreeview.c64
-rw-r--r--tests/ttk/notebook.test4
-rw-r--r--tests/ttk/panedwindow.test8
-rw-r--r--tests/ttk/treeview.test4
6 files changed, 45 insertions, 45 deletions
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 30e14b1..1ea5f54 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -464,7 +464,7 @@ int Ttk_GetContentIndexFromObj(
*/
if (index < 0 || (index - !!lastOK) >= mgr->nContent) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Managed window index %d out of bounds", (int)index));
+ "Managed window index \"%s\" out of bounds", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL);
return TCL_ERROR;
}
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 667b607..966f727 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -368,7 +368,7 @@ static void TabrowSize(
Ttk_RebindSublayout(tabLayout, tab);
Ttk_LayoutSize(tabLayout,tabState,&tab->width,&tab->height);
- tab->width = MAX(tab->width, minTabWidth);
+ tab->width = MAX(tab->width, minTabWidth);
if (orient == TTK_ORIENT_HORIZONTAL) {
tabrowHeight = MAX(tabrowHeight, tab->height);
@@ -890,14 +890,14 @@ static int GetTabIndex(
int status = FindTabIndex(interp, nb, objPtr, index_rtn);
if (status == TCL_OK && *index_rtn >= Ttk_NumberContent(nb->notebook.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tab index %s out of bounds", Tcl_GetString(objPtr)));
+ "Tab index \"%s\" out of bounds", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL);
return TCL_ERROR;
}
if (status == TCL_OK && *index_rtn < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "tab '%s' not found", Tcl_GetString(objPtr)));
+ "Tab '%s' not found", Tcl_GetString(objPtr)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "TAB", NULL);
status = TCL_ERROR;
}
@@ -1072,7 +1072,7 @@ static int NotebookHideCommand(
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
} else {
- TtkRedisplayWidget(&nb->core);
+ TtkRedisplayWidget(&nb->core);
}
return TCL_OK;
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index 5acf9c3..884c1f3 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -675,7 +675,7 @@ static TreeColumn *GetColumn(
return tv->tree.columns + columnIndex;
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid column index %s", Tcl_GetString(columnIDObj)));
+ "Invalid column index \"%s\"", Tcl_GetString(columnIDObj)));
Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN", NULL);
return NULL;
}
@@ -1382,16 +1382,16 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
CellSelectionClear(tv);
}
if (tv->tree.nTitleColumns < 0) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "\"#%" TCL_SIZE_MODIFIER "d\" is out of range",
- tv->tree.nTitleColumns));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "\"#%" TCL_SIZE_MODIFIER "d\" is out of range",
+ tv->tree.nTitleColumns));
Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLECOLUMNS", NULL);
return TCL_ERROR;
}
if (tv->tree.nTitleItems < 0) {
- Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "\"%" TCL_SIZE_MODIFIER "d\" is out of range",
- tv->tree.nTitleItems));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "\"%" TCL_SIZE_MODIFIER "d\" is out of range",
+ tv->tree.nTitleItems));
Tcl_SetErrorCode(interp, "TTK", "TREE", "TITLEITEMS", NULL);
return TCL_ERROR;
}
@@ -1541,10 +1541,10 @@ static int ConfigureColumn(
if (mask & GEOMETRY_CHANGED) {
if (!Tk_IsMapped(tv->core.tkwin)) {
TtkResizeWidget(&tv->core);
- } else {
+ } else {
RecomputeSlack(tv);
ResizeColumns(tv, TreeWidth(tv));
- }
+ }
}
TtkRedisplayWidget(&tv->core);
@@ -1974,13 +1974,13 @@ static void TreeviewDoLayout(void *clientData)
last = tv->tree.yscroll.first + visibleRows - tv->tree.titleRows;
total = tv->tree.totalRows - tv->tree.titleRows;
if (tv->tree.treeArea.height % tv->tree.rowHeight) {
- /* When the treeview height doesn't correspond to an exact number
- * of rows, the last row count must be incremented to draw a
- * partial row at the bottom. The total row count must also be
- * incremented to be able to scroll all the way to the bottom.
- */
- last++;
- total++;
+ /* When the treeview height doesn't correspond to an exact number
+ * of rows, the last row count must be incremented to draw a
+ * partial row at the bottom. The total row count must also be
+ * incremented to be able to scroll all the way to the bottom.
+ */
+ last++;
+ total++;
}
TtkScrolled(tv->tree.yscrollHandle, first, last, total);
}
@@ -2332,7 +2332,7 @@ static void DrawItem(
displayItemUsed);
}
- displayItem.anchorObj = tv->tree.column0.anchorObj;
+ displayItem.anchorObj = tv->tree.column0.anchorObj;
Tk_GetAnchorFromObj(NULL, column->anchorObj, &textAnchor);
displayItemUsed->textObj = item->textObj;
/* Item's image can be null, and may come from the tag */
@@ -2392,7 +2392,7 @@ static void DrawForest(
Treeview *tv, TreeItem *item, Drawable d, int depth)
{
while (item) {
- DrawSubtree(tv, item, d, depth);
+ DrawSubtree(tv, item, d, depth);
item = item->next;
}
}
@@ -2804,8 +2804,8 @@ static int TreeviewHorribleIdentify(
BoundingBox(tv, item, NULL, &itemBox);
PrepareItem(tv, item, &displayItem, state);
- if (item->textObj) { displayItem.textObj = item->textObj; }
- if (item->imageObj) { displayItem.imageObj = item->imageObj; }
+ if (item->textObj) { displayItem.textObj = item->textObj; }
+ if (item->imageObj) { displayItem.imageObj = item->imageObj; }
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, state, itemBox);
element = Ttk_IdentifyElement(layout, x, y);
@@ -2862,7 +2862,7 @@ static int TreeviewIdentifyCommand(
if (Tcl_GetIndexFromObjStruct(interp, objv[2], submethodStrings,
sizeof(char *), "command", TCL_EXACT, &submethod) != TCL_OK
- || Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &x) != TCL_OK
+ || Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[3], &x) != TCL_OK
|| Tk_GetPixelsFromObj(interp, tv->core.tkwin, objv[4], &y) != TCL_OK
) {
return TCL_ERROR;
@@ -2932,8 +2932,8 @@ static int TreeviewIdentifyCommand(
}
state = ItemState(tv, item);
PrepareItem(tv, item, &displayItem, state);
- if (item->textObj) { displayItem.textObj = item->textObj; }
- if (item->imageObj) { displayItem.imageObj = item->imageObj; }
+ if (item->textObj) { displayItem.textObj = item->textObj; }
+ if (item->imageObj) { displayItem.imageObj = item->imageObj; }
Ttk_RebindSublayout(layout, &displayItem);
Ttk_PlaceLayout(layout, state, bbox);
element = Ttk_IdentifyElement(layout, x, y);
@@ -3298,9 +3298,9 @@ static int TreeviewDeleteCommand(
*/
delq = 0;
for (i = 0; items[i]; ++i) {
- if (items[i]->state & TTK_STATE_SELECTED) {
- selChange = 1;
- } else if (items[i]->selObj != NULL) {
+ if (items[i]->state & TTK_STATE_SELECTED) {
+ selChange = 1;
+ } else if (items[i]->selObj != NULL) {
Tcl_Size length;
Tcl_ListObjLength(interp, items[i]->selObj, &length);
if (length > 0) {
@@ -3324,7 +3324,7 @@ static int TreeviewDeleteCommand(
ckfree(items);
if (selChange) {
- Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
}
tv->tree.rowPosNeedsUpdate = 1;
TtkRedisplayWidget(&tv->core);
@@ -3993,7 +3993,7 @@ static int TreeviewTagDeleteCommand(
tag = Ttk_GetTagFromObj(tagTable, objv[3]);
/* remove the tag from all cells and items */
while (item) {
- RemoveTagFromCellsAtItem(item, tag);
+ RemoveTagFromCellsAtItem(item, tag);
RemoveTag(item, tag);
item = NextPreorder(item);
}
@@ -4241,9 +4241,9 @@ static void RemoveTagFromCellsAtItem(TreeItem *item, Ttk_Tag tag)
Tcl_Size i;
for (i = 0; i < item->nTagSets; i++) {
- if (item->cellTagSets[i] != NULL) {
- Ttk_TagSetRemove(item->cellTagSets[i], tag);
- }
+ if (item->cellTagSets[i] != NULL) {
+ Ttk_TagSetRemove(item->cellTagSets[i], tag);
+ }
}
}
@@ -4322,7 +4322,7 @@ static int TreeviewCtagRemoveCommand(
} else {
item = tv->tree.root;
while (item) {
- RemoveTagFromCellsAtItem(item, tag);
+ RemoveTagFromCellsAtItem(item, tag);
item = NextPreorder(item);
}
}
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index e1d2d42..f4558bf 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -563,7 +563,7 @@ test notebook-9.1 "move last tab by numerical index" -body {
.n insert 0 3 ; # not allowed: position 3 is after last tab
} -cleanup {
destroy .n
-} -result {Managed window index 3 out of bounds} -returnCodes error
+} -result {Managed window index "3" out of bounds} -returnCodes error
test notebook-9.2 "move first tab to last position by numerical index" -body {
::ttk::notebook .n
foreach tabs {TabA TabB TabC} {
@@ -574,6 +574,6 @@ test notebook-9.2 "move first tab to last position by numerical index" -body {
.n insert 3 0 ; # not allowed: position 3 is after last tab
} -cleanup {
destroy .n
-} -result {Managed window index 3 out of bounds} -returnCodes error
+} -result {Managed window index "3" out of bounds} -returnCodes error
tcltest::cleanupTests
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index 91f8e62..b11244b 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -13,19 +13,19 @@ test panedwindow-1.0 "Setup" -body {
test panedwindow-1.0.1 "Make sure pane 0 command doesn't crash on empty pane - bug e6140f3404" -body {
.pw pane 0
-} -result {Managed window index 0 out of bounds} -returnCodes error
+} -result {Managed window index "0" out of bounds} -returnCodes error
test panedwindow-1.0.2 "Make sure pane end command doesn't crash on empty pane - bug e6140f3404" -body {
.pw pane end
-} -result {Managed window index -1 out of bounds} -returnCodes error
+} -result {Managed window index "end" out of bounds} -returnCodes error
test panedwindow-1.0.3 "Make sure forget 0 command doesn't crash on empty pane - bug e6140f3404" -body {
.pw forget 0
-} -result {Managed window index 0 out of bounds} -returnCodes error
+} -result {Managed window index "0" out of bounds} -returnCodes error
test panedwindow-1.0.4 "Make sure forget end command doesn't crash on empty pane - bug e6140f3404" -body {
.pw forget end
-} -result {Managed window index -1 out of bounds} -returnCodes error
+} -result {Managed window index "end" out of bounds} -returnCodes error
test panedwindow-1.1 "Make sure empty panedwindow doesn't crash" -body {
pack .pw -expand true -fill both
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index 5f2cc84..13eec44 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -75,7 +75,7 @@ test treeview-1.2 "Bad columns" -body {
test treeview-1.3 "bad displaycolumns" -body {
.tv configure -displaycolumns {a b d}
-} -returnCodes error -result "Invalid column index d"
+} -returnCodes error -result {Invalid column index "d"}
test treeview-1.4 "more bad displaycolumns" -body {
.tv configure -displaycolumns {1 2 3}
@@ -857,7 +857,7 @@ test treeview-11.13 "Cellselection - error" -body {
test treeview-11.14 "Cellselection - error" -body {
.tv cellselection set [list "nn xx "]
-} -returnCodes 1 -match glob -result {Invalid column index xx}
+} -returnCodes 1 -match glob -result {Invalid column index "xx"}
test treeview-11.15 "Cellselection - error" -body {
.tv cellselection set "nn c" "nn d"