diff options
author | fvogel <fvogelnew1@free.fr> | 2021-12-20 20:24:45 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2021-12-20 20:24:45 (GMT) |
commit | 55eaa5f78815acfd39c80abad0d4c8918473aac3 (patch) | |
tree | 74f6a7fb1e1b149ddd04dd14989c5c6526da7625 | |
parent | 5c1ae063a0c061f5c216a4647975ba71e59b0b9b (diff) | |
parent | 2fdb9f02fd6d10fb497634b0ff5acef9dd5350cb (diff) | |
download | tk-55eaa5f78815acfd39c80abad0d4c8918473aac3.zip tk-55eaa5f78815acfd39c80abad0d4c8918473aac3.tar.gz tk-55eaa5f78815acfd39c80abad0d4c8918473aac3.tar.bz2 |
merge 8.6
-rw-r--r-- | generic/tkCanvText.c | 12 | ||||
-rw-r--r-- | generic/tkConfig.c | 28 | ||||
-rw-r--r-- | generic/tkDecls.h | 2 | ||||
-rw-r--r-- | generic/tkGet.c | 1 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 12 | ||||
-rw-r--r-- | generic/tkStubInit.c | 1 | ||||
-rw-r--r-- | generic/tkStyle.c | 1 | ||||
-rw-r--r-- | generic/tkTest.c | 29 | ||||
-rw-r--r-- | generic/tkText.c | 8 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 79 | ||||
-rw-r--r-- | generic/tkTextTag.c | 11 | ||||
-rw-r--r-- | generic/ttk/ttkButton.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkLabel.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkSquare.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 1 | ||||
-rw-r--r-- | macosx/tkMacOSXMouseEvent.c | 41 | ||||
-rw-r--r-- | macosx/tkMacOSXPort.h | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 7 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 32 | ||||
-rw-r--r-- | tests/config.test | 258 | ||||
-rw-r--r-- | tests/ttk/combobox.test | 5 | ||||
-rw-r--r-- | tests/ttk/ttk.test | 9 | ||||
-rw-r--r-- | unix/tkUnixPort.h | 6 |
24 files changed, 323 insertions, 248 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 0945857..656c421 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -562,7 +562,7 @@ ConfigureText( static void DeleteText( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { @@ -835,7 +835,7 @@ DisplayCanvText( } selFirstChar = -1; - selLastChar = 0; /* lint. */ + selLastChar = 0; Tk_CanvasDrawableCoords(canvas, textPtr->drawOrigin[0], textPtr->drawOrigin[1], &drawableX, &drawableY); @@ -1010,7 +1010,8 @@ TextInsert( Tcl_Obj *obj) /* New characters to be inserted. */ { TextItem *textPtr = (TextItem *) itemPtr; - int byteIndex, byteCount, charsAdded; + int byteIndex, charsAdded; + int byteCount; char *newStr, *text; const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; @@ -1606,9 +1607,7 @@ TextToPostscript( Tcl_GetString(Tcl_GetObjResult(interp))); } - x = 0; y = 0; justify = NULL; switch (textPtr->anchor) { - case TK_ANCHOR_NW: x = 0; y = 0; break; case TK_ANCHOR_N: x = 1; y = 0; break; case TK_ANCHOR_NE: x = 2; y = 0; break; case TK_ANCHOR_E: x = 2; y = 1; break; @@ -1617,11 +1616,12 @@ TextToPostscript( case TK_ANCHOR_SW: x = 0; y = 2; break; case TK_ANCHOR_W: x = 0; y = 1; break; case TK_ANCHOR_CENTER: x = 1; y = 1; break; + default: x = 0; y = 0; break; } switch (textPtr->justify) { - case TK_JUSTIFY_LEFT: justify = "0"; break; case TK_JUSTIFY_CENTER: justify = "0.5"; break; case TK_JUSTIFY_RIGHT: justify = "1"; break; + default: justify = "0"; break; } Tk_GetFontMetrics(textPtr->tkfont, &fm); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 6a0ffd8..5639de4 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -679,14 +679,14 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newValue = -1; - } else { + newValue = -1; + } else { if (Tcl_GetIndexFromObjStruct(interp, valuePtr, optionPtr->specPtr->clientData, sizeof(char *), optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) { - return TCL_ERROR; + return TCL_ERROR; } - } + } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); *((int *) internalPtr) = newValue; @@ -849,11 +849,9 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newPixels = 0; - } else { - if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, - &newPixels) != TCL_OK) { - return TCL_ERROR; - } + } else if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, + &newPixels) != TCL_OK) { + return TCL_ERROR; } if (internalPtr != NULL) { *((int *) oldInternalPtr) = *((int *) internalPtr); @@ -867,11 +865,9 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; newWin = NULL; - } else { - if (TkGetWindowFromObj(interp, tkwin, valuePtr, - &newWin) != TCL_OK) { - return TCL_ERROR; - } + } else if (TkGetWindowFromObj(interp, tkwin, valuePtr, + &newWin) != TCL_OK) { + return TCL_ERROR; } if (internalPtr != NULL) { *((Tk_Window *) oldInternalPtr) = *((Tk_Window *) internalPtr); @@ -1405,8 +1401,6 @@ Tk_RestoreSavedOptions( CLANG_ASSERT(internalPtr); switch (specPtr->type) { case TK_OPTION_BOOLEAN: - *((int *) internalPtr) = *((int *) ptr); - break; case TK_OPTION_INT: *((int *) internalPtr) = *((int *) ptr); break; @@ -1642,8 +1636,6 @@ FreeResources( if (internalFormExists) { Tk_FreeStyle(*((Tk_Style *) internalPtr)); *((Tk_Style *) internalPtr) = NULL; - } else if (objPtr != NULL) { - Tk_FreeStyleFromObj(objPtr); } break; case TK_OPTION_BITMAP: diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 2072930..56af6d3 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -1750,6 +1750,8 @@ extern const TkStubs *tkStubsPtr; EXTERN void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif +#undef Tk_FreeStyleFromObj +#define Tk_FreeStyleFromObj(objPtr) ((void)(objPtr)) #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT diff --git a/generic/tkGet.c b/generic/tkGet.c index 989584e..65a16ae 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -471,6 +471,7 @@ Tk_NameOfJustify( case TK_JUSTIFY_LEFT: return "left"; case TK_JUSTIFY_RIGHT: return "right"; case TK_JUSTIFY_CENTER: return "center"; + default: break; } return "unknown justification style"; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 03c5c9e..95350f4 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2785,9 +2785,9 @@ Tk_PhotoPutBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= modelPtr->pix32 - && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width - * modelPtr->height * 4) { + if (modelPtr->pix32 && (sourceBlock.pixelPtr >= modelPtr->pix32) + && (sourceBlock.pixelPtr < modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4)) { /* * Fix 5c51be6411: avoid reading * @@ -3231,9 +3231,9 @@ Tk_PhotoPutZoomedBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= modelPtr->pix32 - && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width - * modelPtr->height * 4) { + if (modelPtr->pix32 && (sourceBlock.pixelPtr >= modelPtr->pix32) + && (sourceBlock.pixelPtr < modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4)) { /* * Fix 5c51be6411: avoid reading * diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 210bb5f..ef418e7 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -46,6 +46,7 @@ MODULE_SCOPE const TkStubs tkStubs; #undef XGrabServer #undef XFree #undef XFlush +#undef Tk_FreeStyleFromObj #define TkUnusedStubEntry 0 #define TkpCmapStressed_ TkpCmapStressed diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 14bae66..8068404 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -1447,6 +1447,7 @@ Tk_GetStyleFromObj( * *--------------------------------------------------------------------------- */ +#undef Tk_FreeStyleFromObj void Tk_FreeStyleFromObj( TCL_UNUSED(Tcl_Obj *)) diff --git a/generic/tkTest.c b/generic/tkTest.c index 1fa821c..13d8392 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -567,6 +567,7 @@ TestobjconfigObjCmd( Tcl_Obj *doublePtr; Tcl_Obj *stringPtr; Tcl_Obj *stringTablePtr; + Tcl_Obj *stringTablePtr2; Tcl_Obj *colorPtr; Tcl_Obj *fontPtr; Tcl_Obj *bitmapPtr; @@ -584,6 +585,9 @@ TestobjconfigObjCmd( static const char *const stringTable[] = { "one", "two", "three", "four", NULL }; + static const char *const stringTable2[] = { + "one", "two", NULL + }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", Tk_Offset(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, @@ -597,7 +601,11 @@ TestobjconfigObjCmd( {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", "one", Tk_Offset(TypesRecord, stringTablePtr), -1, - TK_CONFIG_NULL_OK, stringTable, 0x10}, + 0, stringTable, 0x10}, + {TK_OPTION_STRING_TABLE, + "-stringtable2", "StringTable2", "stringTable2", + "two", Tk_Offset(TypesRecord, stringTablePtr2), -1, + 0, stringTable2, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", "red", Tk_Offset(TypesRecord, colorPtr), -1, TK_CONFIG_NULL_OK, "black", 0x20}, @@ -610,7 +618,7 @@ TestobjconfigObjCmd( {TK_OPTION_BORDER, "-border", "border", "Border", "blue", Tk_Offset(TypesRecord, borderPtr), -1, TK_CONFIG_NULL_OK, "white", 0x100}, - {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", + {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, Tk_Offset(TypesRecord, reliefPtr), -1, TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", @@ -618,10 +626,10 @@ TestobjconfigObjCmd( TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", Tk_Offset(TypesRecord, justifyPtr), -1, - TK_CONFIG_NULL_OK, 0, 0x800}, - {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, + 0, 0, 0x800}, + {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", Tk_Offset(TypesRecord, anchorPtr), -1, - TK_CONFIG_NULL_OK, 0, 0x1000}, + 0, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", Tk_Offset(TypesRecord, pixelPtr), -1, TK_CONFIG_NULL_OK, 0, 0x2000}, @@ -662,6 +670,7 @@ TestobjconfigObjCmd( recordPtr->pixelPtr = NULL; recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; + recordPtr->stringTablePtr2 = NULL; recordPtr->customPtr = NULL; result = Tk_InitOptions(interp, (char *) recordPtr, optionTable, tkwin); @@ -882,7 +891,7 @@ TestobjconfigObjCmd( {TK_OPTION_BORDER, "-border", "border", "Border", "blue", -1, Tk_Offset(InternalRecord, border), TK_CONFIG_NULL_OK, "white", 0x100}, - {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", + {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, -1, Tk_Offset(InternalRecord, relief), TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", @@ -890,10 +899,10 @@ TestobjconfigObjCmd( TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", -1, Tk_Offset(InternalRecord, justify), - TK_CONFIG_NULL_OK, 0, 0x800}, - {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, + 0, 0, 0x800}, + {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", -1, Tk_Offset(InternalRecord, anchor), - TK_CONFIG_NULL_OK, 0, 0x1000}, + 0, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", -1, Tk_Offset(InternalRecord, pixels), TK_CONFIG_NULL_OK, 0, 0x2000}, @@ -934,7 +943,7 @@ TestobjconfigObjCmd( recordPtr->relief = TK_RELIEF_FLAT; recordPtr->cursor = NULL; recordPtr->justify = TK_JUSTIFY_LEFT; - recordPtr->anchor = TK_ANCHOR_N; + recordPtr->anchor = TK_ANCHOR_CENTER; recordPtr->pixels = 0; recordPtr->mm = 0.0; recordPtr->tkwin = NULL; diff --git a/generic/tkText.c b/generic/tkText.c index 90ec575..3f99880 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -8,7 +8,7 @@ * * Copyright (c) 1992-1994 The Regents of the University of California. * Copyright (c) 1994-1996 Sun Microsystems, Inc. - * Copyright (c) 1999 by Scriptics Corporation. + * Copyright (c) 1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -2284,7 +2284,11 @@ ConfigureText( || (textPtr->selTagPtr->spacing2String != NULL) || (textPtr->selTagPtr->spacing3String != NULL) || (textPtr->selTagPtr->tabStringPtr != NULL) - || (textPtr->selTagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { + || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) + || (textPtr->selTagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) + || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_CHAR) + || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_NONE) + || (textPtr->selTagPtr->wrapMode == TEXT_WRAPMODE_WORD)) { textPtr->selTagPtr->affectsDisplay = 1; textPtr->selTagPtr->affectsDisplayGeometry = 1; } diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index a02544d..434bd83 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -153,7 +153,7 @@ typedef struct StyleValues { int spacing3; /* Spacing below last dline in text line. */ TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be * NULL). */ - int tabStyle; /* One of TABULAR or WORDPROCESSOR. */ + int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int underline; /* Non-zero means draw underline underneath * text. */ XColor *underlineColor; /* Foreground color for underline underneath @@ -440,7 +440,7 @@ typedef struct TextDInfo { * points to one of the following structures: */ -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#ifndef TK_LAYOUT_WITH_BASE_CHUNKS typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ @@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr, static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x); static void CharUndisplayProc(TkText *textPtr, TkTextDispChunk *chunkPtr); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr); static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr); static int IsSameFGStyle(TextStyle *style1, TextStyle *style2); @@ -965,7 +965,8 @@ GetStyle( styleValues.tabArrayPtr = tagPtr->tabArrayPtr; tabPrio = tagPtr->priority; } - if ((tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE) + if (((tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) + || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR)) && (tagPtr->priority > tabStylePrio)) { styleValues.tabStyle = tagPtr->tabStyle; tabStylePrio = tagPtr->priority; @@ -985,7 +986,9 @@ GetStyle( styleValues.elide = tagPtr->elide; elidePrio = tagPtr->priority; } - if ((tagPtr->wrapMode != TEXT_WRAPMODE_NULL) + if (((tagPtr->wrapMode == TEXT_WRAPMODE_CHAR) + || (tagPtr->wrapMode == TEXT_WRAPMODE_NONE) + || (tagPtr->wrapMode == TEXT_WRAPMODE_WORD)) && (tagPtr->priority > wrapPrio)) { styleValues.wrapMode = tagPtr->wrapMode; wrapPrio = tagPtr->priority; @@ -1170,7 +1173,7 @@ LayoutDLine( * chunk. */ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for * the first character on line. */ - int tabStyle; /* One of TABULAR or WORDPROCESSOR. */ + int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR or TK_TEXT_TABSTYLE_WORDPROCESSOR. */ int tabSize; /* Number of pixels consumed by current tab * stop. */ TkTextDispChunk *lastCharChunkPtr; @@ -1507,7 +1510,7 @@ LayoutDLine( } } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr != NULL) { int expectedX = ((BaseCharInfo *) baseCharChunkPtr->clientData)->width @@ -1649,7 +1652,7 @@ LayoutDLine( chunkPtr = NULL; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS FinalizeBaseChunk(NULL); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ if (noCharsYet) { @@ -1708,7 +1711,7 @@ LayoutDLine( segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr, byteOffset, maxX, breakByteOffset, 0, wrapMode, breakChunkPtr); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS FinalizeBaseChunk(NULL); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ } @@ -7624,7 +7627,7 @@ TkTextCharLayoutProc( char *p; TkTextSegment *nextPtr; Tk_FontMetrics fm; -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS const char *line; int lineOffset; BaseCharInfo *bciPtr; @@ -7649,18 +7652,18 @@ TkTextCharLayoutProc( p = segPtr->body.chars + byteOffset; tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (baseCharChunkPtr == NULL) { baseCharChunkPtr = chunkPtr; - bciPtr = ckalloc(sizeof(BaseCharInfo)); + bciPtr = (BaseCharInfo *)ckalloc(sizeof(BaseCharInfo)); baseString = &bciPtr->baseChars; Tcl_DStringInit(baseString); bciPtr->width = 0; ciPtr = &bciPtr->ci; } else { - bciPtr = baseCharChunkPtr->clientData; - ciPtr = ckalloc(sizeof(CharInfo)); + bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData; + ciPtr = (CharInfo *)ckalloc(sizeof(CharInfo)); baseString = &bciPtr->baseChars; } @@ -7686,7 +7689,7 @@ TkTextCharLayoutProc( int ch; int chLen = TkUtfToUniChar(p, &ch); -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS bytesThatFit = CharChunkMeasureChars(chunkPtr, line, lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0, &nextX); @@ -7730,7 +7733,7 @@ TkTextCharLayoutProc( bytesThatFit++; } if (bytesThatFit == 0) { -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS chunkPtr->clientData = NULL; if (chunkPtr == baseCharChunkPtr) { baseCharChunkPtr = NULL; @@ -7763,7 +7766,7 @@ TkTextCharLayoutProc( chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#ifndef TK_LAYOUT_WITH_BASE_CHUNKS ciPtr = (CharInfo *)ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); @@ -7774,7 +7777,7 @@ TkTextCharLayoutProc( ciPtr->numBytes--; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS /* * Final update for the current base chunk data. */ @@ -7879,7 +7882,7 @@ CharChunkMeasureChars( Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; -#if !TK_LAYOUT_WITH_BASE_CHUNKS +#ifndef TK_LAYOUT_WITH_BASE_CHUNKS if (chars == NULL) { chars = ciPtr->chars; charsLen = ciPtr->numBytes; @@ -7971,7 +7974,7 @@ CharDisplayProc( TextStyle *stylePtr; StyleValues *sValuePtr; int numBytes, offsetBytes, offsetX; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ @@ -7983,12 +7986,12 @@ CharDisplayProc( return; } -#if TK_DRAW_IN_CONTEXT - bciPtr = ciPtr->baseChunkPtr->clientData; +#ifdef TK_DRAW_IN_CONTEXT + bciPtr = (BaseCharInfo *)ciPtr->baseChunkPtr->clientData; numBytes = Tcl_DStringLength(&bciPtr->baseChars); string = Tcl_DStringValue(&bciPtr->baseChars); -#elif TK_LAYOUT_WITH_BASE_CHUNKS +#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS) if (ciPtr->baseChunkPtr != chunkPtr) { /* * Without context drawing only base chunks display their foreground. @@ -8029,7 +8032,7 @@ CharDisplayProc( if (!sValuePtr->elide && (numBytes > offsetBytes) && (stylePtr->fgGC != NULL)) { -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT int start = ciPtr->baseOffset + offsetBytes; int len = ciPtr->numBytes - offsetBytes; int xDisplacement = x - chunkPtr->x; @@ -8120,7 +8123,7 @@ CharUndisplayProc( CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr) { -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS if (chunkPtr == ciPtr->baseChunkPtr) { /* * Basechunks are undisplayed first, when DLines are freed or @@ -8702,7 +8705,7 @@ MeasureChars( if ((maxX >= 0) && (curX >= maxX)) { break; } -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT start += TkpMeasureCharsInContext(tkfont, source, maxBytes, start - source, special - start, maxX >= 0 ? maxX - curX : -1, flags, &width); @@ -8832,7 +8835,7 @@ TextGetScrollInfoObj( return TKTEXT_SCROLL_ERROR; } -#if TK_LAYOUT_WITH_BASE_CHUNKS +#ifdef TK_LAYOUT_WITH_BASE_CHUNKS /* *---------------------------------------------------------------------- * @@ -8863,7 +8866,7 @@ FinalizeBaseChunk( const char *baseChars; TkTextDispChunk *chunkPtr; CharInfo *ciPtr; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT int widthAdjust = 0; int newwidth; #endif /* TK_DRAW_IN_CONTEXT */ @@ -8877,20 +8880,20 @@ FinalizeBaseChunk( for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL; chunkPtr = chunkPtr->nextPtr) { -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT chunkPtr->x += widthAdjust; #endif /* TK_DRAW_IN_CONTEXT */ if (chunkPtr->displayProc != CharDisplayProc) { continue; } - ciPtr = chunkPtr->clientData; + ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseCharChunkPtr) { break; } ciPtr->chars = baseChars + ciPtr->baseOffset; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT newwidth = 0; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth); if (newwidth < chunkPtr->width) { @@ -8901,10 +8904,10 @@ FinalizeBaseChunk( } if (addChunkPtr != NULL) { - ciPtr = addChunkPtr->clientData; + ciPtr = (CharInfo *)addChunkPtr->clientData; ciPtr->chars = baseChars + ciPtr->baseOffset; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT addChunkPtr->x += widthAdjust; CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0, &addChunkPtr->width); @@ -8952,7 +8955,7 @@ FreeBaseChunk( if (chunkPtr->undisplayProc != CharUndisplayProc) { continue; } - ciPtr = chunkPtr->clientData; + ciPtr = (CharInfo *)chunkPtr->clientData; if (ciPtr->baseChunkPtr != baseChunkPtr) { break; } @@ -9002,7 +9005,7 @@ IsSameFGStyle( return 1; } -#if !TK_DRAW_IN_CONTEXT +#ifndef TK_DRAW_IN_CONTEXT if ( #ifdef MAC_OSX_TK !TkMacOSXCompareColors(style1->fgGC->foreground, @@ -9018,7 +9021,7 @@ IsSameFGStyle( sv1 = style1->sValuePtr; sv2 = style2->sValuePtr; -#if TK_DRAW_IN_CONTEXT +#ifdef TK_DRAW_IN_CONTEXT return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset; #else return sv1->tkfont == sv2->tkfont @@ -9072,14 +9075,14 @@ RemoveFromBaseChunk( * Reinstitute this base chunk for re-layout. */ - ciPtr = chunkPtr->clientData; + ciPtr = (CharInfo *)chunkPtr->clientData; baseCharChunkPtr = ciPtr->baseChunkPtr; /* * Remove the chunk data from the base chunk data. */ - bciPtr = baseCharChunkPtr->clientData; + bciPtr = (BaseCharInfo *)baseCharChunkPtr->clientData; #ifdef DEBUG_LAYOUT_WITH_BASE_CHUNKS if ((ciPtr->baseOffset + ciPtr->numBytes) diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index e839013..a8b3791 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -70,7 +70,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, NULL, -1, Tk_Offset(TkTextTag, overstrikeColor), - TK_OPTION_NULL_OK, 0, 0}, + TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-relief", NULL, NULL, NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-rmargin", NULL, NULL, @@ -97,7 +97,7 @@ static const Tk_OptionSpec tagOptionSpecs[] = { TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, NULL, -1, Tk_Offset(TkTextTag, underlineColor), - TK_OPTION_NULL_OK, 0, 0}, + TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL, NULL, -1, Tk_Offset(TkTextTag, wrapMode), TK_OPTION_NULL_OK, wrapStrings, 0}, @@ -526,8 +526,11 @@ TkTextTagCmd( || (tagPtr->spacing2String != NULL) || (tagPtr->spacing3String != NULL) || (tagPtr->tabStringPtr != NULL) - || (tagPtr->tabStyle != TK_TEXT_TABSTYLE_NONE) - || (tagPtr->wrapMode != TEXT_WRAPMODE_NULL)) { + || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_TABULAR) + || (tagPtr->tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR) + || (tagPtr->wrapMode == TEXT_WRAPMODE_CHAR) + || (tagPtr->wrapMode == TEXT_WRAPMODE_NONE) + || (tagPtr->wrapMode == TEXT_WRAPMODE_WORD)) { tagPtr->affectsDisplay = 1; tagPtr->affectsDisplayGeometry = 1; } diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index f4ef7bc..6a7eae7 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -255,11 +255,11 @@ static Tk_OptionSpec LabelOptionSpecs[] = NULL, Tk_Offset(Label,label.reliefObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(Label,label.anchorObj), -1, - TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, + "w", Tk_Offset(Label,label.anchorObj), -1, + 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", - NULL, Tk_Offset(Label, label.justifyObj), -1, - TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, + "left", Tk_Offset(Label, label.justifyObj), -1, + 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", NULL, Tk_Offset(Label, label.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ }, diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 6f32299..d37db95 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -30,7 +30,7 @@ typedef struct { Tcl_Obj *anchorObj; Tcl_Obj *justifyObj; Tcl_Obj *wrapLengthObj; - Tcl_Obj *embossedObj; + Tcl_Obj *embossedObj; /* * Computed resources: diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index bd2a8c7..a2b2823 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -72,7 +72,7 @@ static Tk_OptionSpec SquareOptionSpecs[] = NULL, Tk_Offset(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, + "center", Tk_Offset(Square,square.anchorObj), -1, 0, 0, 0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 3170e5a..7fd1442 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -195,8 +195,8 @@ static Tk_OptionSpec TagOptionSpecs[] = { NULL, Tk_Offset(DisplayItem,imageObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", - NULL, Tk_Offset(DisplayItem,anchorObj), -1, - TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */ + "center", Tk_Offset(DisplayItem,anchorObj), -1, + 0, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", NULL, Tk_Offset(DisplayItem,backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index d44bea3..d9f3d12 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -46,6 +46,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, @synthesize tkLiveResizeEnded = _tkLiveResizeEnded; @synthesize tkPointerWindow = _tkPointerWindow; @synthesize tkEventTarget = _tkEventTarget; +@synthesize tkDragTarget = _tkDragTarget; @synthesize tkButtonState = _tkButtonState; @end diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index ac49356..4ed954d 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -83,8 +83,7 @@ enum { NSPoint location = [theEvent locationInWindow]; NSPoint viewLocation = [contentView convertPoint:location fromView:nil]; TkWindow *winPtr = NULL, *grabWinPtr, *scrollTarget = NULL; - Tk_Window tkwin = NULL, capture; - static Tk_Window target = NULL, dragTarget = NULL; + Tk_Window tkwin = NULL, capture, target; NSPoint local, global; NSInteger button; TkWindow *newFocus = NULL; @@ -93,7 +92,6 @@ enum { Bool isTestingEvent = NO; Bool isMotionEvent = NO; Bool isOutside = NO; - static Bool isDragging = NO; static Bool ignoreDrags = NO; static Bool ignoreUpDown = NO; static NSTimeInterval timestamp = 0; @@ -134,14 +132,14 @@ enum { buttonState &= ~TkGetButtonMask(button); break; case NSLeftMouseDragged: - if (isOutside && !isDragging) { + if (isOutside && ![NSApp tkDragTarget]) { ignoreDrags = YES; } if (ignoreDrags) { return theEvent; } - isDragging = YES; - dragTarget = target; + [NSApp setTkDragTarget: [NSApp tkEventTarget]]; + break; case NSRightMouseDragged: case NSOtherMouseDragged: isMotionEvent = YES; @@ -163,8 +161,7 @@ enum { [NSApp setTkPointerWindow:nil]; break; case NSLeftMouseUp: - isDragging = NO; - dragTarget = NULL; + [NSApp setTkDragTarget: nil]; if ([theEvent clickCount] == 2) { ignoreUpDown = NO; } @@ -200,7 +197,6 @@ enum { if ([theEvent timestamp] - timestamp > 1) { ignoreUpDown = NO; } - if ([theEvent clickCount] == 2) { if (ignoreUpDown == YES) { return theEvent; @@ -266,7 +262,7 @@ enum { * focus window when no window contains the pointer. That proposal was * ultimately rejected. */ - + scrollTarget = TkMacOSXGetTkWindow(eventWindow); #if 0 case NSCursorUpdate: @@ -291,8 +287,19 @@ enum { return theEvent; } } else { - if (isDragging) { - winPtr = TkMacOSXGetHostToplevel((TkWindow *)dragTarget)->winPtr; + if ([NSApp tkDragTarget]) { + TkWindow *dragPtr = (TkWindow *) [NSApp tkDragTarget]; + TKWindow *dragWindow = nil; + if (dragPtr) { + dragWindow = (TKWindow *)TkMacOSXGetNSWindowForDrawable( + dragPtr->window); + } + if (!dragWindow) { + [NSApp setTkDragTarget: nil]; + target = NULL; + return theEvent; + } + winPtr = TkMacOSXGetHostToplevel((TkWindow *) [NSApp tkDragTarget])->winPtr; } else if (eventType == NSScrollWheel) { winPtr = scrollTarget; } else { @@ -355,8 +362,8 @@ enum { * when the mouse is outside of the focused toplevel. */ - if (isDragging) { - TkWindow *w = (TkWindow *) dragTarget; + if ([NSApp tkDragTarget]) { + TkWindow *w = (TkWindow *) [NSApp tkDragTarget]; win_x = global.x; win_y = global.y; for (; w != NULL; w = w->parentPtr) { @@ -373,7 +380,7 @@ enum { break; } } - target = dragTarget; + target = (Tk_Window) [NSApp tkDragTarget]; } else { target = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); } @@ -439,7 +446,7 @@ enum { */ if (eventType != NSScrollWheel) { - if (isDragging) { + if ([NSApp tkDragTarget]) { /* * When dragging the mouse into the resize area Apple shows the @@ -454,7 +461,7 @@ enum { Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow], global.x, global.y, state); } else if (eventType == NSMouseExited) { - if (isDragging) { + if ([NSApp tkDragTarget]) { Tk_UpdatePointer((Tk_Window) [NSApp tkPointerWindow], global.x, global.y, state); } else { diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 088d402..2208b76 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -35,17 +35,11 @@ #ifndef _TCL # include <tcl.h> #endif -#if TIME_WITH_SYS_TIME -# include <sys/time.h> -# include <time.h> -#else -# if HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H # include <sys/time.h> -# else -# include <time.h> -# endif #endif -#if HAVE_INTTYPES_H +#include <time.h> +#ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #include <unistd.h> diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index de0f5fd..3b03139 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -336,6 +336,7 @@ VISIBILITY_HIDDEN Bool _tkLiveResizeEnded; TkWindow *_tkPointerWindow; TkWindow *_tkEventTarget; + TkWindow *_tkDragTarget; unsigned int _tkButtonState; #endif @@ -345,8 +346,14 @@ VISIBILITY_HIDDEN @property Bool isDrawing; @property Bool needsToDraw; @property Bool tkLiveResizeEnded; + +/* + * Persistent state variables used by processMouseEvent. + */ + @property TkWindow *tkPointerWindow; @property TkWindow *tkEventTarget; +@property TkWindow *tkDragTarget; @property unsigned int tkButtonState; @end diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index c065d6c..0d52e43 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1050,13 +1050,41 @@ TkWmDeadWindow( ckfree(transientPtr); } + deadNSWindow = (TKWindow *)wmPtr->window; + + /* + * Remove references to the Tk window from the mouse event processing + * state which is recorded in the NSApplication object. + */ + + if (winPtr == [NSApp tkDragTarget]) { + [NSApp setTkDragTarget:nil]; + } + if (winPtr == [NSApp tkPointerWindow]) { + NSWindow *w; + NSPoint mouse = [NSEvent mouseLocation]; + [NSApp setTkPointerWindow:nil]; + for (w in [NSApp orderedWindows]) { + if (w == deadNSWindow) { + continue; + } + if (NSPointInRect(mouse, [w frame])) { + TkWindow *winPtr2 = TkMacOSXGetTkWindow(w); + int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; + [NSApp setTkPointerWindow:winPtr2]; + Tk_UpdatePointer((Tk_Window) winPtr2, x, y, + [NSApp tkButtonState]); + break; + } + } + } + /* * Unregister the NSWindow and remove all references to it from the Tk * data structures. If the NSWindow is a child, disassociate it from * the parent. Then close and release the NSWindow. */ - deadNSWindow = (TKWindow *)wmPtr->window; if (deadNSWindow && !Tk_IsEmbedded(winPtr)) { NSWindow *parent = [deadNSWindow parentWindow]; [deadNSWindow setTkWindow:None]; @@ -1105,6 +1133,7 @@ TkWmDeadWindow( wmPtr2->hints.initial_state != WithdrawnState); if (w != deadNSWindow && isOnScreen && [w canBecomeKeyWindow]) { [w makeKeyAndOrderFront:NSApp]; + [NSApp setTkEventTarget:TkMacOSXGetTkWindow(w)]; break; } } @@ -6644,6 +6673,7 @@ TkpChangeFocus( } if (win && [win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; + [NSApp setTkEventTarget:TkMacOSXGetTkWindow(win)]; } } diff --git a/tests/config.test b/tests/config.test index 9fd048a..7ae7ae3 100644 --- a/tests/config.test +++ b/tests/config.test @@ -3,7 +3,7 @@ # organized in the standard "white-box" fashion for Tcl tests. # # Copyright (c) 1997 Sun Microsystems, Inc. -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright (c) 1998-1999 Scriptics Corporation. # All rights reserved. package require tcltest 2.2 @@ -42,7 +42,7 @@ test config-1.1 {Tk_CreateOptionTable - reference counts} -constraints { set x } -cleanup { killTables -} -result {{1 16 -boolean} {2 16 -boolean}} +} -result {{1 17 -boolean} {2 17 -boolean}} test config-1.2 {Tk_CreateOptionTable - synonym initialization} -constraints { testobjconfig } -body { @@ -50,7 +50,7 @@ test config-1.2 {Tk_CreateOptionTable - synonym initialization} -constraints { .a cget -color } -cleanup { killTables -} -result {green} +} -result green test config-1.3 {Tk_CreateOptionTable - option database initialization} -constraints { testobjconfig } -body { @@ -77,10 +77,10 @@ test config-1.5 {Tk_CreateOptionTable - default initialization} -constraints { testobjconfig } -body { testobjconfig alltypes .a - .a cget -relief + .a cget -anchor } -cleanup { killTables -} -result {raised} +} -result center test config-1.6 {Tk_CreateOptionTable - chained tables} -constraints { testobjconfig } -body { @@ -156,7 +156,7 @@ test config-3.2 {Tk_InitOptions - initialize from database} -constraints { } -cleanup { killTables option clear -} -result {blue} +} -result blue test config-3.3 {Tk_InitOptions - initialize from database} -constraints { testobjconfig } -body { @@ -166,7 +166,7 @@ test config-3.3 {Tk_InitOptions - initialize from database} -constraints { } -cleanup { killTables option clear -} -result {left} +} -result left test config-3.4 {Tk_InitOptions - initialize from widget class} -constraints { testobjconfig } -body { @@ -174,12 +174,12 @@ test config-3.4 {Tk_InitOptions - initialize from widget class} -constraints { list [.a cget -color] } -cleanup { killTables -} -result {red} +} -result red test config-3.5 {Tk_InitOptions - no initial value} -constraints { testobjconfig } -body { testobjconfig alltypes .a - .a cget -anchor + .a cget -relief } -cleanup { killTables } -result {} @@ -227,7 +227,7 @@ test config-4.1 {DoObjConfig - boolean} -constraints testobjconfig -setup { testobjconfig alltypes .foo -boolean 0 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -235,7 +235,7 @@ test config-4.2 {DoObjConfig - boolean} -constraints testobjconfig -setup { .foo cget -boolean } -cleanup { killTables -} -returnCodes ok -result {0} +} -returnCodes ok -result 0 test config-4.3 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -251,7 +251,7 @@ test config-4.4 {DoObjConfig - boolean} -constraints testobjconfig -setup { testobjconfig alltypes .foo -boolean 1 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -259,7 +259,7 @@ test config-4.5 {DoObjConfig - boolean} -constraints testobjconfig -setup { .foo cget -boolean } -cleanup { killTables -} -returnCodes ok -result {1} +} -returnCodes ok -result 1 test config-4.6 {DoObjConfig - boolean} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -287,7 +287,7 @@ test config-4.8 {DoObjConfig - boolean internal value} -constraints { .foo cget -boolean } -cleanup { killTables -} -result {0} +} -result 0 test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} @@ -295,7 +295,7 @@ test config-4.9 {DoObjConfig - integer} -constraints testobjconfig -setup { testobjconfig alltypes .foo -integer 3 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -303,7 +303,7 @@ test config-4.10 {DoObjConfig - integer} -constraints testobjconfig -setup { .foo cget -integer } -cleanup { killTables -} -returnCodes ok -result {3} +} -returnCodes ok -result 3 test config-4.11 {DoObjConfig - integer} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -333,7 +333,7 @@ test config-4.13 {DoObjConfig - integer internal value} -constraints { .foo cget -integer } -cleanup { killTables -} -result {421} +} -result 421 test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} @@ -341,7 +341,7 @@ test config-4.14 {DoObjConfig - double} -constraints testobjconfig -setup { testobjconfig alltypes .foo -double 3.14 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.15 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -349,7 +349,7 @@ test config-4.15 {DoObjConfig - double} -constraints testobjconfig -setup { .foo cget -double } -cleanup { killTables -} -returnCodes ok -result {3.14} +} -returnCodes ok -result 3.14 test config-4.16 {DoObjConfig - double} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -377,7 +377,7 @@ test config-4.18 {DoObjConfig - double internal value} -constraints { .foo cget -double } -cleanup { killTables -} -result {62.75} +} -result 62.75 test config-4.19 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} @@ -385,7 +385,7 @@ test config-4.19 {DoObjConfig - string} -constraints testobjconfig -setup { testobjconfig alltypes .foo -string test } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.20 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -393,7 +393,7 @@ test config-4.20 {DoObjConfig - string} -constraints testobjconfig -setup { .foo cget -string } -cleanup { killTables -} -returnCodes ok -result {test} +} -returnCodes ok -result test test config-4.21 {DoObjConfig - string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -409,7 +409,7 @@ test config-4.22 {DoObjConfig - null string} -constraints testobjconfig -setup { testobjconfig alltypes .foo -string {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.23 {DoObjConfig - null string} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -443,13 +443,13 @@ test config-4.26 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.27 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two .foo cget -stringtable } -cleanup { killTables -} -returnCodes ok -result {two} +} -returnCodes ok -result two test config-4.28 {DoObjConfig - string table} -constraints testobjconfig -body { testobjconfig alltypes .foo -stringtable two .foo cget -stringtable @@ -464,7 +464,13 @@ test config-4.29 {DoObjConfig - invalid string table} -constraints { } -cleanup { killTables } -returnCodes error -result {bad stringtable "foo": must be one, two, three, or four} - +test config-4.29a {DoObjConfig - invalid string table} -constraints { + testobjconfig +} -body { + testobjconfig alltypes .foo -stringtable2 foo +} -cleanup { + killTables +} -returnCodes error -result {bad stringtable2 "foo": must be one or two} test config-4.30 {DoObjConfig - new string table} -constraints { testobjconfig } -body { @@ -472,7 +478,7 @@ test config-4.30 {DoObjConfig - new string table} -constraints { .foo configure -stringtable three } -cleanup { killTables -} -returnCodes ok -result {16} +} -returnCodes ok -result 16 test config-4.31 {DoObjConfig - new string table} -constraints { testobjconfig } -body { @@ -481,7 +487,7 @@ test config-4.31 {DoObjConfig - new string table} -constraints { .foo cget -stringtable } -cleanup { killTables -} -returnCodes ok -result {three} +} -returnCodes ok -result three test config-4.32 {DoObjConfig - new string table} -constraints { testobjconfig } -body { @@ -501,19 +507,19 @@ test config-4.33 {DoObjConfig - stringtable internal value} -constraints { .foo cget -stringtable } -cleanup { killTables -} -result {four} +} -result four test config-4.34 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.35 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue .foo cget -color } -cleanup { killTables -} -returnCodes ok -result {blue} +} -returnCodes ok -result blue test config-4.36 {DoObjConfig - color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color blue .foo cget -color @@ -537,13 +543,13 @@ test config-4.38 {DoObjConfig - color internal value} -constraints { .foo cget -color } -cleanup { killTables -} -result {purple} +} -result purple test config-4.39 {DoObjConfig - null color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.40 {DoObjConfig - null color} -constraints testobjconfig -body { testobjconfig alltypes .foo -color {} .foo cget -color @@ -564,7 +570,7 @@ test config-4.42 {DoObjConfig - getting rid of old color} -constraints { .foo configure -color #444444 } -cleanup { killTables -} -returnCodes ok -result {32} +} -returnCodes ok -result 32 test config-4.43 {DoObjConfig - getting rid of old color} -constraints { testobjconfig } -body { @@ -591,7 +597,7 @@ test config-4.45 {DoObjConfig - font} -constraints testobjconfig -setup { testobjconfig alltypes .foo -font {Helvetica 72} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.46 {DoObjConfig - font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -607,7 +613,7 @@ test config-4.47 {DoObjConfig - new font} -constraints testobjconfig -setup { .foo configure -font {Helvetica 72} } -cleanup { killTables -} -returnCodes ok -result {64} +} -returnCodes ok -result 64 test config-4.48 {DoObjConfig - new font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -632,7 +638,7 @@ test config-4.50 {DoObjConfig - null font} -constraints testobjconfig -setup { testobjconfig alltypes .foo -font {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.51 {DoObjConfig - null font} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -656,26 +662,26 @@ test config-4.53 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.54 {DoObjConfig - bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo cget -bitmap } -cleanup { killTables -} -returnCodes ok -result {gray75} +} -returnCodes ok -result gray75 test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 } -cleanup { killTables -} -returnCodes ok -result {128} +} -returnCodes ok -result 128 test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 .foo cget -bitmap } -cleanup { killTables -} -returnCodes ok -result {gray50} +} -returnCodes ok -result gray50 test config-4.57 {DoObjConfig - invalid bitmap} -constraints { testobjconfig } -body { @@ -687,7 +693,7 @@ test config-4.58 {DoObjConfig - null bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.59 {DoObjConfig - null bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap {} .foo cget -bitmap @@ -703,19 +709,19 @@ test config-4.60 {DoObjConfig - bitmap internal value} -constraints { .foo cget -bitmap } -cleanup { killTables -} -result {gray25} +} -result gray25 test config-4.61 {DoObjConfig - border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border green } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.62 {DoObjConfig - border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border green .foo cget -border } -cleanup { killTables -} -returnCodes ok -result {green} +} -returnCodes ok -result green test config-4.63 {DoObjConfig - invalid border} -constraints { testobjconfig } -body { @@ -727,7 +733,7 @@ test config-4.64 {DoObjConfig - null border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.65 {DoObjConfig - null border} -constraints testobjconfig -body { testobjconfig alltypes .foo -border {} .foo cget -border @@ -751,7 +757,7 @@ test config-4.67 {DoObjConfig - getting rid of old border} -constraints { .foo configure -border #444444 } -cleanup { killTables -} -returnCodes ok -result {256} +} -returnCodes ok -result 256 test config-4.68 {DoObjConfig - getting rid of old border} -constraints { testobjconfig } -body { @@ -766,13 +772,13 @@ test config-4.69 {DoObjConfig - relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief flat } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.70 {DoObjConfig - relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief flat .foo cget -relief } -cleanup { killTables -} -returnCodes ok -result {flat} +} -returnCodes ok -result flat test config-4.71 {DoObjConfig - invalid relief} -constraints { testobjconfig } -body { @@ -787,32 +793,32 @@ test config-4.72 {DoObjConfig - relief internal value} -constraints testobjconfi .foo cget -relief } -cleanup { killTables -} -result {ridge} +} -result ridge test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat } -cleanup { killTables -} -returnCodes ok -result {512} +} -returnCodes ok -result 512 test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat .foo cget -relief } -cleanup { killTables -} -returnCodes ok -result {flat} +} -returnCodes ok -result flat test config-4.75 {DoObjConfig - cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor arrow } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.76 {DoObjConfig - cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor arrow .foo cget -cursor } -cleanup { killTables -} -returnCodes ok -result {arrow} +} -returnCodes ok -result arrow test config-4.77 {DoObjConfig - invalid cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor foo } -cleanup { @@ -824,7 +830,7 @@ test config-4.78 {DoObjConfig - null cursor} -constraints testobjconfig -setup { testobjconfig alltypes .foo -cursor {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.79 {DoObjConfig - null cursor} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -838,14 +844,14 @@ test config-4.80 {DoObjConfig - new cursor} -constraints testobjconfig -body { .foo configure -cursor arrow } -cleanup { killTables -} -returnCodes ok -result {1024} +} -returnCodes ok -result 1024 test config-4.81 {DoObjConfig - new cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor xterm .foo configure -cursor arrow .foo cget -cursor } -cleanup { killTables -} -returnCodes ok -result {arrow} +} -returnCodes ok -result arrow test config-4.82 {DoObjConfig - cursor internal value} -constraints { testobjconfig } -setup { @@ -855,19 +861,19 @@ test config-4.82 {DoObjConfig - cursor internal value} -constraints { .foo cget -cursor } -cleanup { killTables -} -result {watch} +} -result watch test config-4.83 {DoObjConfig - justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify center } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.84 {DoObjConfig - justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify center .foo cget -justify } -cleanup { killTables -} -returnCodes ok -result {center} +} -returnCodes ok -result center test config-4.85 {DoObjConfig - invalid justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify foo } -cleanup { @@ -878,14 +884,14 @@ test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body { .foo configure -justify right } -cleanup { killTables -} -returnCodes ok -result {2048} +} -returnCodes ok -result 2048 test config-4.87 {DoObjConfig - new justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify left .foo configure -justify right .foo cget -justify } -cleanup { killTables -} -returnCodes ok -result {right} +} -returnCodes ok -result right test config-4.88 {DoObjConfig - justify internal value} -constraints { testobjconfig } -setup { @@ -895,19 +901,19 @@ test config-4.88 {DoObjConfig - justify internal value} -constraints { .foo cget -justify } -cleanup { killTables -} -result {center} +} -result center test config-4.89 {DoObjConfig - anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor center } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.90 {DoObjConfig - anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor center .foo cget -anchor } -cleanup { killTables -} -returnCodes ok -result {center} +} -returnCodes ok -result center test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor foo } -cleanup { @@ -918,14 +924,14 @@ test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { .foo configure -anchor n } -cleanup { killTables -} -returnCodes ok -result {4096} +} -returnCodes ok -result 4096 test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n .foo cget -anchor } -cleanup { killTables -} -returnCodes ok -result {n} +} -returnCodes ok -result n test config-4.94 {DoObjConfig - anchor internal value} -constraints { testobjconfig } -setup { @@ -935,18 +941,18 @@ test config-4.94 {DoObjConfig - anchor internal value} -constraints { .foo cget -anchor } -cleanup { killTables -} -result {sw} +} -result sw test config-4.95 {DoObjConfig - pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42 } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.96 {DoObjConfig - pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42 .foo cget -pixel } -cleanup { killTables -} -returnCodes ok -result {42} +} -returnCodes ok -result 42 test config-4.97 {DoObjConfig - invalid pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel foo } -cleanup { @@ -957,14 +963,14 @@ test config-4.98 {DoObjConfig - new pixel} -constraints testobjconfig -body { .foo configure -pixel 3c } -cleanup { killTables -} -returnCodes ok -result {8192} +} -returnCodes ok -result 8192 test config-4.99 {DoObjConfig - new pixel} -constraints testobjconfig -body { testobjconfig alltypes .foo -pixel 42m .foo configure -pixel 3c .foo cget -pixel } -cleanup { killTables -} -returnCodes ok -result {3c} +} -returnCodes ok -result 3c test config-4.100 {DoObjConfig - pixel internal value} -constraints { testobjconfig } -setup { @@ -976,21 +982,21 @@ test config-4.100 {DoObjConfig - pixel internal value} -constraints { expr {$screenW eq $result} } -cleanup { killTables -} -result {1} +} -result 1 test config-4.101 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window .bar } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.102 {DoObjConfig - window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window .bar .foo cget -window } -cleanup { killTables -} -returnCodes ok -result {.bar} +} -returnCodes ok -result .bar test config-4.103 {DoObjConfig - invalid window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window foo @@ -1002,7 +1008,7 @@ test config-4.104 {DoObjConfig - null window} -constraints testobjconfig -body { testobjconfig twowindows .foo -window {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.105 {DoObjConfig - null window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window {} @@ -1017,7 +1023,7 @@ test config-4.106 {DoObjConfig - new window} -constraints testobjconfig -body { .foo configure -window .blamph } -cleanup { killTables -} -returnCodes ok -result {0} +} -returnCodes ok -result 0 test config-4.107 {DoObjConfig - new window} -constraints testobjconfig -body { toplevel .bar toplevel .blamph @@ -1026,7 +1032,7 @@ test config-4.107 {DoObjConfig - new window} -constraints testobjconfig -body { .foo cget -window } -cleanup { killTables -} -returnCodes ok -result {.blamph} +} -returnCodes ok -result .blamph test config-4.108 {DoObjConfig - window internal value} -constraints { testobjconfig } -setup { @@ -1036,7 +1042,7 @@ test config-4.108 {DoObjConfig - window internal value} -constraints { .foo cget -window } -cleanup { killTables -} -result {.} +} -result . test config-4.109 {DoObjConfig - releasing old values} -constraints { testobjconfig @@ -1081,18 +1087,18 @@ test config-4.111 {DoObjConfig - custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom test } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.112 {DoObjConfig - custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom test .foo cget -custom } -cleanup { killTables -} -returnCodes ok -result {TEST} +} -returnCodes ok -result TEST test config-4.113 {DoObjConfig - null custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom {} } -cleanup { killTables -} -returnCodes ok -result {.foo} +} -returnCodes ok -result .foo test config-4.114 {DoObjConfig - null custom} -constraints testobjconfig -body { testobjconfig alltypes .foo -custom {} .foo cget -custom @@ -1151,7 +1157,7 @@ test config-6.2 {GetOptionFromObj - exact match} -constraints { .a cget -one } -cleanup { killTables -} -result {one} +} -result one test config-6.3 {GetOptionFromObj - abbreviation} -constraints { testobjconfig } -body { @@ -1159,7 +1165,7 @@ test config-6.3 {GetOptionFromObj - abbreviation} -constraints { .a cget -fo } -cleanup { killTables -} -result {four} +} -result four test config-6.4 {GetOptionFromObj - ambiguous abbreviation} -constraints { testobjconfig } -body { @@ -1183,7 +1189,7 @@ test config-6.6 {GetOptionFromObj - synonym} -constraints testobjconfig -body { .b cget -synonym } -cleanup { killTables -} -result {red} +} -result red if {[testConstraint testobjconfig]} { @@ -1201,7 +1207,7 @@ test config-7.2 {Tk_SetOptions - bogus option name} -constraints { test config-7.3 {Tk_SetOptions - synonym} -constraints testobjconfig -body { .a configure -synonym blue .a cget -color -} -result {blue} +} -result blue test config-7.4 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { @@ -1212,7 +1218,7 @@ test config-7.5 {Tk_SetOptions - missing value} -constraints { } -body { catch {.a configure -color green -relief} .a cget -color -} -result {green} +} -result green test config-7.6 {Tk_SetOptions - saving old values} -constraints { testobjconfig } -body { @@ -1258,7 +1264,7 @@ test config-7.11 {Tk_SetOptions - synonym name in error message} -constraints { ".a configure -synonym bogus"} test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body { format %x [.a configure -color red -int 7 -relief raised -double 3.14159] -} -result {226} +} -result 226 test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { testobjconfig } -body { @@ -1296,7 +1302,7 @@ test config-8.2 {Tk_RestoreSavedOptions - restore in proper order} -constraints .a cget -color } -cleanup { killTables -} -result {red} +} -result red test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints { testobjconfig } -body { @@ -1304,7 +1310,7 @@ test config-8.3 {Tk_RestoreSavedOptions - freeing object memory} -constraints { .a csave -color green -color black -color blue -color #ffff00 -color #ff00ff } -cleanup { killTables -} -result {32} +} -result 32 test config-8.4 {Tk_RestoreSavedOptions - boolean internal form} -constraints { testobjconfig } -body { @@ -1321,7 +1327,7 @@ test config-8.5 {Tk_RestoreSavedOptions - boolean internal form} -constraints { .a cget -boolean } -cleanup { killTables -} -result {1} +} -result 1 test config-8.6 {Tk_RestoreSavedOptions - integer internal form} -constraints { testobjconfig } -body { @@ -1338,7 +1344,7 @@ test config-8.7 {Tk_RestoreSavedOptions - integer internal form} -constraints { .a cget -integer } -cleanup { killTables -} -result {148962237} +} -result 148962237 test config-8.8 {Tk_RestoreSavedOptions - double internal form} -constraints { testobjconfig } -body { @@ -1347,7 +1353,7 @@ test config-8.8 {Tk_RestoreSavedOptions - double internal form} -constraints { .a cget -double } -cleanup { killTables -} -result {3.14159} +} -result 3.14159 test config-8.9 {Tk_RestoreSavedOptions - string internal form} -constraints { testobjconfig } -body { @@ -1356,7 +1362,7 @@ test config-8.9 {Tk_RestoreSavedOptions - string internal form} -constraints { .a cget -string } -cleanup { killTables -} -result {foo} +} -result foo test config-8.10 {Tk_RestoreSavedOptions - string table internal form} -constraints { testobjconfig } -body { @@ -1365,7 +1371,7 @@ test config-8.10 {Tk_RestoreSavedOptions - string table internal form} -constrai .a cget -stringtable } -cleanup { killTables -} -result {one} +} -result one test config-8.11 {Tk_RestoreSavedOptions - color internal form} -constraints { testobjconfig } -body { @@ -1374,7 +1380,7 @@ test config-8.11 {Tk_RestoreSavedOptions - color internal form} -constraints { .a cget -color } -cleanup { killTables -} -result {red} +} -result red test config-8.12 {Tk_RestoreSavedOptions - font internal form} -constraints { testobjconfig nonPortable } -body { @@ -1392,7 +1398,7 @@ test config-8.13 {Tk_RestoreSavedOptions - bitmap internal form} -constraints { .a cget -bitmap } -cleanup { killTables -} -result {gray50} +} -result gray50 test config-8.14 {Tk_RestoreSavedOptions - border internal form} -constraints { testobjconfig } -body { @@ -1401,16 +1407,16 @@ test config-8.14 {Tk_RestoreSavedOptions - border internal form} -constraints { .a cget -border } -cleanup { killTables -} -result {blue} -test config-8.15 {Tk_RestoreSavedOptions - relief internal form} -constraints { +} -result blue +test config-8.15 {Tk_RestoreSavedOptions - anchor internal form} -constraints { testobjconfig } -body { testobjconfig internal .a - catch {.a csave -relief sunken -color bogus} - .a cget -relief + catch {.a csave -anchor e -color bogus} + .a cget -anchor } -cleanup { killTables -} -result {raised} +} -result center test config-8.16 {Tk_RestoreSavedOptions - cursor internal form} -constraints { testobjconfig } -body { @@ -1419,7 +1425,7 @@ test config-8.16 {Tk_RestoreSavedOptions - cursor internal form} -constraints { .a cget -cursor } -cleanup { killTables -} -result {xterm} +} -result xterm test config-8.17 {Tk_RestoreSavedOptions - justify internal form} -constraints { testobjconfig } -body { @@ -1428,16 +1434,16 @@ test config-8.17 {Tk_RestoreSavedOptions - justify internal form} -constraints { .a cget -justify } -cleanup { killTables -} -result {left} +} -result left test config-8.18 {Tk_RestoreSavedOptions - anchor internal form} -constraints { testobjconfig } -body { testobjconfig internal .a - catch {.a csave -anchor center -color bogus} + catch {.a csave -anchor n -color bogus} .a cget -anchor } -cleanup { killTables -} -result {n} +} -result center test config-8.19 {Tk_RestoreSavedOptions - window internal form} -constraints { testobjconfig } -body { @@ -1446,7 +1452,7 @@ test config-8.19 {Tk_RestoreSavedOptions - window internal form} -constraints { .a cget -window } -cleanup { killTables -} -result {.a} +} -result .a test config-8.20 {Tk_RestoreSavedOptions - custom internal form} -constraints { testobjconfig } -body { @@ -1455,7 +1461,7 @@ test config-8.20 {Tk_RestoreSavedOptions - custom internal form} -constraints { .a cget -custom } -cleanup { killTables -} -result {FOOBAR} +} -result FOOBAR # Most of the tests below will cause memory leakage if there is a # problem. This may not be evident unless the tests are run in @@ -1560,11 +1566,11 @@ if {[testConstraint testobjconfig]} { test config-10.1 {Tk_GetOptionInfo - one item} -constraints testobjconfig -body { testobjconfig alltypes .foo - .foo configure -relief groove - .foo configure -relief + .foo configure -anchor e + .foo configure -anchor } -cleanup { destroy .foo -} -result {-relief relief Relief raised groove} +} -result {-anchor anchor Anchor center e} test config-10.2 {Tk_GetOptionInfo - one item, synonym} -constraints { testobjconfig } -body { @@ -1581,7 +1587,7 @@ test config-10.3 {Tk_GetOptionInfo - all items} -constraints { .foo configure } -cleanup { destroy .foo -} -result {{-boolean boolean Boolean 1 1} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief raised raised} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor {} {}} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} +} -result {{-boolean boolean Boolean 1 1} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-stringtable2 StringTable2 stringTable2 two two} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief {} {}} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor center center} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} test config-10.4 {Tk_GetOptionInfo - chaining through tables} -constraints testobjconfig -body { testobjconfig chain2 .foo -one asdf -three xyzzy .foo configure @@ -1607,8 +1613,8 @@ test config-11.2 {GetConfigList - null database names} -constraints { test config-11.3 {GetConfigList - null default and current value} -constraints { testobjconfig } -body { - .a configure -anchor -} -result {-anchor anchor Anchor {} {}} + .a configure -relief +} -result {-relief relief Relief {} {}} if {[testConstraint testobjconfig]} { killTables } @@ -1620,11 +1626,11 @@ if {[testConstraint testobjconfig]} { test config-12.1 {GetObjectForOption - boolean} -constraints testobjconfig -body { .a configure -boolean 0 .a cget -boolean -} -result {0} +} -result 0 test config-12.2 {GetObjectForOption - integer} -constraints testobjconfig -body { .a configure -integer 1247 .a cget -integer -} -result {1247} +} -result 1247 test config-12.3 {GetObjectForOption - double} -constraints testobjconfig -body { .a configure -double -88.82 .a cget -double @@ -1638,11 +1644,11 @@ test config-12.5 {GetObjectForOption - stringTable} -constraints { } -body { .a configure -stringtable "two" .a cget -stringtable -} -result {two} +} -result two test config-12.6 {GetObjectForOption - color} -constraints testobjconfig -body { .a configure -color "green" .a cget -color -} -result {green} +} -result green test config-12.7 {GetObjectForOption - font} -constraints testobjconfig -body { .a configure -font {Times 36} .a cget -font @@ -1650,7 +1656,7 @@ test config-12.7 {GetObjectForOption - font} -constraints testobjconfig -body { test config-12.8 {GetObjectForOption - bitmap} -constraints testobjconfig -body { .a configure -bitmap "questhead" .a cget -bitmap -} -result {questhead} +} -result questhead test config-12.9 {GetObjectForOption - border} -constraints testobjconfig -body { .a configure -border #33217c .a cget -border @@ -1660,35 +1666,35 @@ test config-12.10 {GetObjectForOption - relief} -constraints { } -body { .a configure -relief groove .a cget -relief -} -result {groove} +} -result groove test config-12.11 {GetObjectForOption - cursor} -constraints { testobjconfig } -body { .a configure -cursor watch .a cget -cursor -} -result {watch} +} -result watch test config-12.12 {GetObjectForOption - justify} -constraints { testobjconfig } -body { .a configure -justify right .a cget -justify -} -result {right} +} -result right test config-12.13 {GetObjectForOption - anchor} -constraints testobjconfig -body { .a configure -anchor e .a cget -anchor -} -result {e} +} -result e test config-12.14 {GetObjectForOption - pixels} -constraints testobjconfig -body { .a configure -pixel 193.2 .a cget -pixel -} -result {193} +} -result 193 test config-12.15 {GetObjectForOption - window} -constraints testobjconfig -body { .a configure -window .a .a cget -window -} -result {.a} +} -result .a test config-12.16 {GetObjectForOption -custom} -constraints testobjconfig -body { .a configure -custom foobar .a cget -custom -} -result {FOOBAR} +} -result FOOBAR test config-12.17 {GetObjectForOption - null values} -constraints { testobjconfig } -body { diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index 48179f3..eee0622 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -55,6 +55,11 @@ test combobox-2.6 "current -- set to unknown index" -body { .cb current notanindex } -returnCodes error -result {Incorrect index notanindex} +test combobox-2.7 {current -- set to 0 index when empty [bug 924835c36d]} -body { + .cb configure -values {} + .cb current 0 +} -returnCodes error -result {Index 0 out of range} + test combobox-2.end "Cleanup" -body { destroy .cb } test combobox-3 "Read postoffset value dynamically from current style" -body { diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index 322917c..ad4c2d5 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -440,6 +440,15 @@ test ttk-9.8 "-textvariable overrides -text" -body { .tl cget -text } -cleanup { destroy .tl } -result "Foo" +test ttk-9.9 "default for -justify" -body { + ttk::label .tl + .tl cget -justify +} -cleanup { destroy .tl } -result "left" +test ttk-9.10 "default for -anchor" -body { + ttk::label .tl + .tl cget -anchor +} -cleanup { destroy .tl } -result "w" + # # Frame widget tests: # diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 44926a4..27be5b9 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -40,17 +40,17 @@ #ifndef _TCL # include <tcl.h> #endif -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else -# if HAVE_SYS_TIME_H +# ifdef HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> # endif #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifndef NO_UNISTD_H |