diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-02 15:38:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-02 15:38:12 (GMT) |
commit | 2027c41caa07f2bd647f1bfaea45f665dddbe43b (patch) | |
tree | 0897f0f159e11d81f8cded2ca6371905d70b258e | |
parent | 9dbf66002218945e06f22423d749f62d327e2fed (diff) | |
parent | 4b91535ac926425f7179414f60f6e1c7aed67c36 (diff) | |
download | tk-2027c41caa07f2bd647f1bfaea45f665dddbe43b.zip tk-2027c41caa07f2bd647f1bfaea45f665dddbe43b.tar.gz tk-2027c41caa07f2bd647f1bfaea45f665dddbe43b.tar.bz2 |
Merge trunk. Add MODULE_SCOPE MacSystrayInit() function (not enough to make it compile)
79 files changed, 905 insertions, 742 deletions
diff --git a/.travis.yml b/.travis.yml index 7806c16..b3c57ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: c addons: apt: + sources: + - ubuntu-toolchain-r-test packages: - binutils-mingw-w64-i686 - binutils-mingw-w64-x86-64 @@ -23,7 +25,7 @@ addons: - xquartz jobs: include: -# Testing on Linux with various compilers +# Testing on Linux GCC - name: "Linux/GCC/Shared" os: linux dist: focal @@ -35,7 +37,11 @@ jobs: script: &x11gui - make binaries libraries tktest - make install - - make test + - make test-classic >out-classic.txt + - cat out-classic.txt + - make test-ttk >out-ttk.txt + - cat out-ttk.txt + - grep -q "Failed 0" out-ttk.txt - name: "Linux/GCC/Shared: NO_DEPRECATED" os: linux dist: focal @@ -119,29 +125,15 @@ jobs: env: - BUILD_DIR=unix - CFGOPT="CC=g++ CFLAGS=-DTCL_UTF_MAX=6" -# Older versions of GCC... - - name: "Linux/GCC 7/Shared" +# Newer/Older versions of GCC + - name: "Linux/GCC 10/Shared" os: linux dist: focal - compiler: gcc-7 + compiler: gcc-10 addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - - g++-7 - env: - - BUILD_DIR=unix - - name: "Linux/GCC 6/Shared" - os: linux - dist: bionic - compiler: gcc-6 - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 + - g++-10 env: - BUILD_DIR=unix - name: "Linux/GCC 5/Shared" @@ -150,13 +142,11 @@ jobs: compiler: gcc-5 addons: apt: - sources: - - ubuntu-toolchain-r-test packages: - g++-5 env: - BUILD_DIR=unix -# Clang +# Testing on Linux Clang - name: "Linux/Clang/Shared" os: linux dist: focal @@ -192,21 +182,21 @@ jobs: - BUILD_DIR=unix - CFGOPT="--enable-symbols" # Testing on Mac, various styles - - name: "macOS/Clang/Xcode 11.7/Shared" + - name: "macOS/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - - name: "macOS/Clang++/Xcode 11.7/Shared" + - name: "macOS/Clang++/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern" - - name: "macOS/Clang/Xcode 11.7/Shared" + - name: "macOS/Xcode 12/Shared" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -214,27 +204,27 @@ jobs: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: &mactest - make all tktest - - name: "macOS/Clang/Xcode 11.7/Static" + - name: "macOS/Xcode 12/Static" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.7/Debug" + - name: "macOS/Xcode 12/Debug" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 11.7/Shared/XQuartz" + - name: "macOS/Xcode 12/Shared/XQuartz" os: osx - osx_image: xcode11.7 + osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" @@ -242,16 +232,16 @@ jobs: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest # Older MacOS versions - - name: "macOS/Clang/Xcode 11/Shared" + - name: "macOS/Xcode 11/Shared" os: osx - osx_image: xcode11 + osx_image: xcode11.7 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 10/Shared" + - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 addons: @@ -265,7 +255,7 @@ jobs: install: - ./configure ${CFGOPT} "--prefix=$HOME" || (cat config.log && exit 1) script: *mactest - - name: "macOS/Clang/Xcode 9/Shared" + - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 addons: @@ -312,8 +302,6 @@ before_install: install: - mkdir "$HOME/install dir" - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1) -before_script: - - export ERROR_ON_FAILURES=1 script: - make all tktest - make install diff --git a/ChangeLog.2004 b/ChangeLog.2004 index b900e7b..9afaa75 100644 --- a/ChangeLog.2004 +++ b/ChangeLog.2004 @@ -3521,7 +3521,7 @@ 2003-02-13 Kevin Kenny <kennykb@users.sourceforge.net> * doc/wish.n: Added language to describe the handling of the - end-of-file character \u001a in script files. [Bug 685505] + end-of-file character \x1A in script files. [Bug 685505] 2003-02-10 Jim Ingham <jingham@apple.com> @@ -301,7 +301,7 @@ The size is determined either by the \fIcontent\fR occupying the largest row or column, or the largest column or row with a \fB\-minsize\fR, \fB\-weight\fR, or \fB\-pad\fR that is non-zero. .TP -\fBgrid content fI\window\fR ?\fI\-option value\fR? +\fBgrid content \fIwindow\fR ?\fI\-option value\fR? . If no options are supplied, a list of all of the content in \fIwindow\fR is returned, most recently managed first. diff --git a/generic/nanosvg.h b/generic/nanosvg.h index 47a2c83..3f9548b 100644 --- a/generic/nanosvg.h +++ b/generic/nanosvg.h @@ -45,15 +45,15 @@ extern "C" { // NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose // to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. // -// The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. +// The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. // DPI (dots-per-inch) controls how the unit conversion is done. // // If you don't know or care about the units stuff, "px" and 96 should get you going. /* Example Usage: - // Load - NSVGImage* image; + // Load SVG + NSVGimage* image; image = nsvgParseFromFile("test.svg", "px", 96); printf("size: %f x %f\n", image->width, image->height); // Use... @@ -255,11 +255,6 @@ static int nsvg__isdigit(char c) return c >= '0' && c <= '9'; } -static int nsvg__isnum(char c) -{ - return strchr("0123456789+-.eE", c) != 0; -} - static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } @@ -795,9 +790,11 @@ static void nsvg__lineTo(NSVGparser* p, float x, float y) static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y) { - nsvg__addPoint(p, cpx1, cpy1); - nsvg__addPoint(p, cpx2, cpy2); - nsvg__addPoint(p, x, y); + if (p->npts > 0) { + nsvg__addPoint(p, cpx1, cpy1); + nsvg__addPoint(p, cpx2, cpy2); + nsvg__addPoint(p, x, y); + } } static NSVGattrib* nsvg__getAttr(NSVGparser* p) @@ -867,7 +864,9 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig, static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) { NSVGgradientData* grad = p->gradients; - while (grad) { + if (id == NULL || *id == '\0') + return NULL; + while (grad != NULL) { if (strcmp(grad->id, id) == 0) return grad; grad = grad->next; @@ -884,19 +883,26 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f NSVGgradient* grad; float ox, oy, sw, sh, sl; int nstops = 0; + int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; // TODO: use ref to fill in all unset values too. ref = data; + refIter = 0; while (ref != NULL) { + NSVGgradientData* nextRef = NULL; if (stops == NULL && ref->stops != NULL) { stops = ref->stops; nstops = ref->nstops; break; } - ref = nsvg__findGradientData(p, ref->ref); + nextRef = nsvg__findGradientData(p, ref->ref); + if (nextRef == ref) break; // prevent infite loops on malformed data + ref = nextRef; + refIter++; + if (refIter > 32) break; // prevent infite loops on malformed data } if (stops == NULL) return NULL; @@ -1099,6 +1105,10 @@ static void nsvg__addPath(NSVGparser* p, char closed) if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); + // Expect 1 + N*3 points (N = number of cubic bezier segments). + if ((p->npts % 3) != 1) + return; + path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath)); if (path == NULL) goto error; memset(path, 0, sizeof(NSVGpath)); @@ -1531,6 +1541,15 @@ static int nsvg__parseUnits(const char* units) return NSVG_UNITS_USER; } +static int nsvg__isCoordinate(const char* s) +{ + // optional sign + if (*s == '-' || *s == '+') + s++; + // must have at least one digit + return nsvg__isdigit(*s); +} + static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; @@ -1973,8 +1992,11 @@ static int nsvg__getArgsPerElement(char cmd) case 'a': case 'A': return 7; + case 'z': + case 'Z': + return 0; } - return 0; + return -1; } static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) @@ -2284,6 +2306,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) float args[10]; int nargs; int rargs = 0; + char initPoint; float cpx, cpy, cpx2, cpy2; const char* tmp[4]; char closedFlag; @@ -2306,13 +2329,14 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) nsvg__resetPath(p); cpx = 0; cpy = 0; cpx2 = 0; cpy2 = 0; + initPoint = 0; closedFlag = 0; nargs = 0; while (*s) { s = nsvg__getNextPathItem(s, item); if (!*item) break; - if (nsvg__isnum(item[0])) { + if (cmd != '\0' && nsvg__isCoordinate(item)) { if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { @@ -2325,6 +2349,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; + initPoint = 1; break; case 'l': case 'L': @@ -2374,7 +2399,6 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) } } else { cmd = item[0]; - rargs = nsvg__getArgsPerElement(cmd); if (cmd == 'M' || cmd == 'm') { // Commit path. if (p->npts > 0) @@ -2383,7 +2407,11 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) nsvg__resetPath(p); closedFlag = 0; nargs = 0; - } else if (cmd == 'Z' || cmd == 'z') { + } else if (initPoint == 0) { + // Do not allow other commands until initial point has been set (moveTo called once). + cmd = '\0'; + } + if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; // Commit path. if (p->npts > 0) { @@ -2399,6 +2427,12 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr) closedFlag = 0; nargs = 0; } + rargs = nsvg__getArgsPerElement(cmd); + if (rargs == -1) { + // Command not recognized + cmd = '\0'; + rargs = 0; + } } } // Commit path. diff --git a/generic/tkBind.c b/generic/tkBind.c index ec121cd..4ab98f5 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -2164,7 +2164,7 @@ Tk_BindEvent( TkDisplay *dispPtr; TkDisplay *oldDispPtr; Event *curEvent; - TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *)tkwin; BindInfo *bindInfoPtr; Tcl_InterpState interpState; LookupTables *physTables; @@ -2454,7 +2454,6 @@ Tk_BindEvent( LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables; PatSeq *matchPtr = matchPtrArr[k]; PatSeq *mPtr; - PSList *psl[2]; /* * Note that virtual events cannot promote. @@ -2757,11 +2756,11 @@ CompareModMasks( assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr)); for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) { - unsigned fstModMask = *PSModMaskArr_Get(fstModMaskArr, i); - unsigned sndModMask = *PSModMaskArr_Get(sndModMaskArr, i); + unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i); + unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i); - if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; } - if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; } + if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; } + if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; } } } diff --git a/generic/tkConfig.c b/generic/tkConfig.c index dd0980f..925cb72 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -1877,20 +1877,20 @@ GetObjectForOption( switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: case TK_OPTION_INT: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_DOUBLE: objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); break; case TK_OPTION_STRING: - objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1); + objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); break; case TK_OPTION_STRING_TABLE: objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ *((int *) internalPtr)], -1); break; case TK_OPTION_COLOR: { - XColor *colorPtr = *((XColor **) internalPtr); + XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); @@ -1898,7 +1898,7 @@ GetObjectForOption( break; } case TK_OPTION_FONT: { - Tk_Font tkfont = *((Tk_Font *) internalPtr); + Tk_Font tkfont = *((Tk_Font *)internalPtr); if (tkfont != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); @@ -1906,7 +1906,7 @@ GetObjectForOption( break; } case TK_OPTION_STYLE: { - Tk_Style style = *((Tk_Style *) internalPtr); + Tk_Style style = *((Tk_Style *)internalPtr); if (style != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); @@ -1914,7 +1914,7 @@ GetObjectForOption( break; } case TK_OPTION_BITMAP: { - Pixmap pixmap = *((Pixmap *) internalPtr); + Pixmap pixmap = *((Pixmap *)internalPtr); if (pixmap != None) { objPtr = Tcl_NewStringObj( @@ -1923,7 +1923,7 @@ GetObjectForOption( break; } case TK_OPTION_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) internalPtr); + Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); if (border != NULL) { objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); @@ -1931,10 +1931,10 @@ GetObjectForOption( break; } case TK_OPTION_RELIEF: - objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); break; case TK_OPTION_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) internalPtr); + Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); if (cursor != NULL) { objPtr = Tcl_NewStringObj( @@ -1944,17 +1944,17 @@ GetObjectForOption( } case TK_OPTION_JUSTIFY: objPtr = Tcl_NewStringObj(Tk_NameOfJustify( - *((Tk_Justify *) internalPtr)), -1); + *((Tk_Justify *)internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( - *((Tk_Anchor *) internalPtr)), -1); + *((Tk_Anchor *)internalPtr)), -1); break; case TK_OPTION_PIXELS: - objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + objPtr = Tcl_NewWideIntObj(*((int *)internalPtr)); break; case TK_OPTION_WINDOW: { - Tk_Window tkwin = *((Tk_Window *) internalPtr); + tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); diff --git a/generic/tkFont.c b/generic/tkFont.c index 7155cc1..79c8d54 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -741,7 +741,7 @@ Tk_FontObjCmd( } case FONT_METRICS: { Tk_Font tkfont; - int skip, index, i; + int skip, i; const TkFontMetrics *fmPtr; static const char *const switches[] = { "-ascent", "-descent", "-linespace", "-fixed", NULL @@ -1968,7 +1968,7 @@ Tk_ComputeTextLayout( int *heightPtr) /* Filled with height of string. */ { TkFont *fontPtr = (TkFont *) tkfont; - const char *start, *end, *special; + const char *start, *endp, *special; int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight; int baseline, height, curX, newX, maxWidth, *lineLengths; TextLayout *layoutPtr; @@ -2016,12 +2016,12 @@ Tk_ComputeTextLayout( curX = 0; - end = Tcl_UtfAtIndex(string, numChars); + endp = Tcl_UtfAtIndex(string, numChars); special = string; flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES; flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE; - for (start = string; start < end; ) { + for (start = string; start < endp; ) { if (start >= special) { /* * Find the next special character in the string. @@ -2032,7 +2032,7 @@ Tk_ComputeTextLayout( * whitespace set. */ - for (special = start; special < end; special++) { + for (special = start; special < endp; special++) { if (!(flags & TK_IGNORE_NEWLINES)) { if ((*special == '\n') || (*special == '\r')) { break; @@ -2066,7 +2066,7 @@ Tk_ComputeTextLayout( } } - if ((start == special) && (special < end)) { + if ((start == special) && (special < endp)) { /* * Handle the special character. * @@ -2083,7 +2083,7 @@ Tk_ComputeTextLayout( start++; curX = newX; flags &= ~TK_AT_LEAST_ONE; - if ((start < end) && + if ((start < endp) && ((wrapLength <= 0) || (newX <= wrapLength))) { /* * More chars can still fit on this line. @@ -2105,7 +2105,7 @@ Tk_ComputeTextLayout( * Consume all extra spaces at end of line. */ - while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */ + while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */ if (!(flags & TK_IGNORE_NEWLINES)) { if ((*start == '\n') || (*start == '\r')) { break; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 067407a..f5100ba 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -341,6 +341,11 @@ Tk_GridObjCmd( "content", "forget", "info", "location", "propagate", "remove", "rowconfigure", "size", "slaves", NULL }; + static const char *const optionStringsNoDep[] = { + "anchor", "bbox", "columnconfigure", "configure", + "content", "forget", "info", "location", "propagate", + "remove", "rowconfigure", "size", NULL + }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, @@ -361,8 +366,16 @@ Tk_GridObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { + /* + * Call it again without the deprecated ones to get a proper error + * message. This works well since there can't be any ambiguity between + * deprecated and new options. + */ + + Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep, + sizeof(char *), "option", 0, &index); return TCL_ERROR; } @@ -3361,7 +3374,7 @@ ConfigureContent( */ for (container = (TkWindow *)containerPtr->tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 1388367..7886355 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1030,7 +1030,7 @@ declare 47 aqua { Tk_Window TkpGetCapture(void) } declare 49 aqua { - Tk_Window TkGetTransientMaster(TkWindow *winPtr) + Tk_Window TkMacOSXGetContainer(TkWindow *winPtr) } declare 50 aqua { int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state) diff --git a/generic/tkInt.h b/generic/tkInt.h index a5e98c0..10fa4e2 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -374,7 +374,7 @@ typedef struct TkDisplay { * by that container. */ int geomInit; -#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ +#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr) /* diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 88b36ce..348868b 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -244,7 +244,7 @@ EXTERN int TkpIsWindowFloating(void *window); EXTERN Tk_Window TkpGetCapture(void); /* Slot 48 is reserved */ /* 49 */ -EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr); +EXTERN Tk_Window TkMacOSXGetContainer(TkWindow *winPtr); /* 50 */ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); @@ -439,7 +439,7 @@ typedef struct TkIntPlatStubs { int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkpGetCapture) (void); /* 47 */ void (*reserved48)(void); - Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */ + Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ @@ -694,8 +694,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; #define TkpGetCapture \ (tkIntPlatStubsPtr->tkpGetCapture) /* 47 */ /* Slot 48 is reserved */ -#define TkGetTransientMaster \ - (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 */ +#define TkMacOSXGetContainer \ + (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */ #define TkGenerateButtonEvent \ (tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */ #define TkGenWMDestroyEvent \ diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 0a297a6..a67be21 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1630,7 +1630,6 @@ ConfigureMenu( } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { - int i; Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry); @@ -1825,7 +1824,6 @@ PostProcessEntry( if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { Tcl_Obj *valuePtr; - const char *name; if (mePtr->namePtr == NULL) { if (mePtr->labelPtr == NULL) { @@ -2735,7 +2733,7 @@ CloneMenu( && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; - int i, numElements; + int numElements; /* * Now put this newly created menu into the parent menu's instance diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 6e9a49e..49c576a 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -775,28 +775,28 @@ FormatConfigValue( result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: - if (*((int *) ptr) == 0) { + if (*((int *)ptr) == 0) { result = "0"; } else { result = "1"; } break; case TK_CONFIG_INT: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_DOUBLE: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_STRING: - result = (*(char **) ptr); + result = (*(char **)ptr); if (result == NULL) { result = ""; } break; case TK_CONFIG_UID: { - Tk_Uid uid = *((Tk_Uid *) ptr); + Tk_Uid uid = *((Tk_Uid *)ptr); if (uid != NULL) { result = uid; @@ -804,7 +804,7 @@ FormatConfigValue( break; } case TK_CONFIG_COLOR: { - XColor *colorPtr = *((XColor **) ptr); + XColor *colorPtr = *((XColor **)ptr); if (colorPtr != NULL) { result = Tk_NameOfColor(colorPtr); @@ -812,7 +812,7 @@ FormatConfigValue( break; } case TK_CONFIG_FONT: { - Tk_Font tkfont = *((Tk_Font *) ptr); + Tk_Font tkfont = *((Tk_Font *)ptr); if (tkfont != NULL) { result = Tk_NameOfFont(tkfont); @@ -820,7 +820,7 @@ FormatConfigValue( break; } case TK_CONFIG_BITMAP: { - Pixmap pixmap = *((Pixmap *) ptr); + Pixmap pixmap = *((Pixmap *)ptr); if (pixmap != None) { result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap); @@ -828,7 +828,7 @@ FormatConfigValue( break; } case TK_CONFIG_BORDER: { - Tk_3DBorder border = *((Tk_3DBorder *) ptr); + Tk_3DBorder border = *((Tk_3DBorder *)ptr); if (border != NULL) { result = Tk_NameOf3DBorder(border); @@ -836,11 +836,11 @@ FormatConfigValue( break; } case TK_CONFIG_RELIEF: - result = Tk_NameOfRelief(*((int *) ptr)); + result = Tk_NameOfRelief(*((int *)ptr)); break; case TK_CONFIG_CURSOR: case TK_CONFIG_ACTIVE_CURSOR: { - Tk_Cursor cursor = *((Tk_Cursor *) ptr); + Tk_Cursor cursor = *((Tk_Cursor *)ptr); if (cursor != NULL) { result = Tk_NameOfCursor(Tk_Display(tkwin), cursor); @@ -848,29 +848,27 @@ FormatConfigValue( break; } case TK_CONFIG_JUSTIFY: - result = Tk_NameOfJustify(*((Tk_Justify *) ptr)); + result = Tk_NameOfJustify(*((Tk_Justify *)ptr)); break; case TK_CONFIG_ANCHOR: - result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr)); + result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr)); break; case TK_CONFIG_CAP_STYLE: - result = Tk_NameOfCapStyle(*((int *) ptr)); + result = Tk_NameOfCapStyle(*((int *)ptr)); break; case TK_CONFIG_JOIN_STYLE: - result = Tk_NameOfJoinStyle(*((int *) ptr)); + result = Tk_NameOfJoinStyle(*((int *)ptr)); break; case TK_CONFIG_PIXELS: - sprintf(buffer, "%d", *((int *) ptr)); + sprintf(buffer, "%d", *((int *)ptr)); result = buffer; break; case TK_CONFIG_MM: - Tcl_PrintDouble(interp, *((double *) ptr), buffer); + Tcl_PrintDouble(interp, *((double *)ptr), buffer); result = buffer; break; case TK_CONFIG_WINDOW: { - Tk_Window tkwin; - - tkwin = *((Tk_Window *) ptr); + tkwin = *((Tk_Window *)ptr); if (tkwin != NULL) { result = Tk_PathName(tkwin); } diff --git a/generic/tkPack.c b/generic/tkPack.c index d73de4a..239b00a 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -203,6 +203,8 @@ Tk_PackObjCmd( "after", "append", "before", "unpack", #endif /* !TK_NO_DEPRECATED */ "configure", "content", "forget", "info", "propagate", "slaves", NULL }; + static const char *const optionStringsNoDep[] = { + "configure", "content", "forget", "info", "propagate", NULL }; enum options { #ifndef TK_NO_DEPRECATED PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, @@ -222,19 +224,16 @@ Tk_PackObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { -#ifndef TK_NO_DEPRECATED /* * Call it again without the deprecated ones to get a proper error * message. This works well since there can't be any ambiguity between * deprecated and new options. */ - Tcl_ResetResult(interp); - Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4], + Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep, sizeof(char *), "option", 0, &index); -#endif /* TK_NO_DEPRECATED */ return TCL_ERROR; } @@ -1821,7 +1820,7 @@ ConfigureContent( */ for (container = (TkWindow *)containerPtr->tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c index fe084bf..ed8fb0b 100644 --- a/generic/tkPkgConfig.c +++ b/generic/tkPkgConfig.c @@ -100,6 +100,9 @@ static const Tcl_Config cfg[] = { {"profiled", CFG_PROFILED}, {"64bit", CFG_64}, {"optimized", CFG_OPTIMIZED}, +#ifdef TK_NO_DEPRECATED + {"nodeprecated", "1"}, +#endif {"mem_debug", CFG_MEMDEBUG}, {"fontsystem", CFG_FONTSYSTEM}, diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 01386a2..8d6b87e 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -216,6 +216,9 @@ Tk_PlaceObjCmd( static const char *const optionStrings[] = { "configure", "content", "forget", "info", "slaves", NULL }; + static const char *const optionStringsNoDep[] = { + "configure", "content", "forget", "info", NULL + }; enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; int index; @@ -278,6 +281,14 @@ Tk_PlaceObjCmd( if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { + /* + * Call it again without the deprecated ones to get a proper error + * message. This works well since there can't be any ambiguity between + * deprecated and new options. + */ + + Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep, + sizeof(char *), "option", 0, &index); return TCL_ERROR; } @@ -666,10 +677,10 @@ ConfigureContent( goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ - Tk_Window tkwin; + Tk_Window win; Tk_Window ancestor; - tkwin = contentPtr->inTkwin; + win = contentPtr->inTkwin; /* * Make sure that the new container is either the logical parent of the @@ -677,19 +688,19 @@ ConfigureContent( * aren't the same. */ - for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == Tk_Parent(contentPtr->tkwin)) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place \"%s\" relative to \"%s\"", - Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(win))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (contentPtr->tkwin == tkwin) { + if (contentPtr->tkwin == win) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place \"%s\" relative to itself", Tk_PathName(contentPtr->tkwin))); @@ -701,22 +712,22 @@ ConfigureContent( * Check for management loops. */ - for (container = (TkWindow *)tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + for (container = (TkWindow *)win; container != NULL; + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", - Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(win))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(contentPtr->tkwin)) { - ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (win != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win; } if ((contentPtr->containerPtr != NULL) - && (contentPtr->containerPtr->tkwin == tkwin)) { + && (contentPtr->containerPtr->tkwin == win)) { /* * Re-using same old container. Nothing to do. */ @@ -729,7 +740,7 @@ ConfigureContent( Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } UnlinkContent(contentPtr); - containerWin = tkwin; + containerWin = win; } /* diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 8d863c1..f459fbd 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -625,7 +625,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkpIsWindowFloating, /* 46 */ TkpGetCapture, /* 47 */ 0, /* 48 */ - TkGetTransientMaster, /* 49 */ + TkMacOSXGetContainer, /* 49 */ TkGenerateButtonEvent, /* 50 */ TkGenWMDestroyEvent, /* 51 */ TkMacOSXSetDrawingEnabled, /* 52 */ diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 89acd75..3657fa6 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -290,8 +290,12 @@ TkTextImageCmd( (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } - Tcl_WrongNumArgs(interp, 3, objv, NULL); - break; + if (resultObj == NULL) { + return TCL_ERROR; + } else { + Tcl_SetObjResult(interp, resultObj); + return TCL_OK; + } } default: Tcl_Panic("unexpected switch fallthrough"); diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 6ff1ee0..0541830 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1130,7 +1130,7 @@ TkMakeEnsemble( dictObj = Tcl_NewObj(); for (i = 0; map[i].name != NULL ; ++i) { - Tcl_Obj *nameObj, *fqdnObj; + Tcl_Obj *fqdnObj; nameObj = Tcl_NewStringObj(map[i].name, -1); fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 45ca5e6..eb8e928 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -13,7 +13,7 @@ */ #include "tkInt.h" - +#include "tkPort.h" #ifdef _WIN32 #include "tkWinInt.h" #elif !defined(MAC_OSX_TK) @@ -1642,7 +1642,7 @@ Tk_MapWindow( event.xmap.event = winPtr->window; event.xmap.window = winPtr->window; event.xmap.override_redirect = winPtr->atts.override_redirect; - Tk_HandleEvent(&event); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -1804,7 +1804,7 @@ Tk_UnmapWindow( event.xunmap.event = winPtr->window; event.xunmap.window = winPtr->window; event.xunmap.from_configure = False; - Tk_HandleEvent(&event); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } } diff --git a/library/demos/widget b/library/demos/widget index e543846..58da12f 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -516,7 +516,7 @@ proc invoke index { .t configure -cursor [::ttk::cursor busy] update set demo [string range [lindex $tags $i] 5 end] - uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]] + uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]] update .t configure -cursor $cursor @@ -624,6 +624,7 @@ proc showCode w { wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]] wm iconname $top $file set id [open [file join $tk_demoDirectory $file]] + fconfigure $id -encoding utf-8 -eofchar \032 $top.f.text delete 1.0 end $top.f.text insert 1.0 [read $id] $top.f.text mark set insert 1.0 @@ -722,10 +723,10 @@ proc PrintTextWin32 {filename} { proc tkAboutDialog {} { tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \ -message [mc "Tk widget demonstration application"] -detail \ -"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}] -[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}] -[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}] -[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]" +"[mc "Copyright \xA9 %s" {1996-1997 Sun Microsystems, Inc.}] +[mc "Copyright \xA9 %s" {1997-2000 Ajuba Solutions, Inc.}] +[mc "Copyright \xA9 %s" {2001-2009 Donal K. Fellows}] +[mc "Copyright \xA9 %s" {2002-2007 Daniel A. Steffen}]" } # Local Variables: diff --git a/library/msgs/da.msg b/library/msgs/da.msg index c302c79..282f919 100644 --- a/library/msgs/da.msg +++ b/library/msgs/da.msg @@ -3,11 +3,11 @@ namespace eval ::tk { ::msgcat::mcset da "&About..." "&Om..." ::msgcat::mcset da "All Files" "Alle filer" ::msgcat::mcset da "Application Error" "Programfejl" - ::msgcat::mcset da "&Blue" "&Bl\u00E5" + ::msgcat::mcset da "&Blue" "&Blå" ::msgcat::mcset da "Cancel" "Annuller" ::msgcat::mcset da "&Cancel" "&Annuller" ::msgcat::mcset da "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ikke skifte til katalog \"%1\$s\".\nIngen rettigheder." - ::msgcat::mcset da "Choose Directory" "V\u00E6lg katalog" + ::msgcat::mcset da "Choose Directory" "Vælg katalog" ::msgcat::mcset da "Cl&ear" "&Ryd" ::msgcat::mcset da "&Clear Console" "&Ryd konsolen" ::msgcat::mcset da "Color" "Farve" @@ -31,8 +31,8 @@ namespace eval ::tk { ::msgcat::mcset da "Fi&les:" "Fi&ler:" ::msgcat::mcset da "&Filter" ::msgcat::mcset da "Fil&ter:" - ::msgcat::mcset da "&Green" "&Gr\u00F8n" - ::msgcat::mcset da "&Help" "&Hj\u00E6lp" + ::msgcat::mcset da "&Green" "&Grøn" + ::msgcat::mcset da "&Help" "&Hjælp" ::msgcat::mcset da "Hi" "Hej" ::msgcat::mcset da "&Hide Console" "Skjul &konsol" ::msgcat::mcset da "&Ignore" "&Ignorer" @@ -42,37 +42,37 @@ namespace eval ::tk { ::msgcat::mcset da "&OK" "&O.K." ::msgcat::mcset da "OK" "O.K." ::msgcat::mcset da "Ok" - ::msgcat::mcset da "Open" "\u00C5bn" - ::msgcat::mcset da "&Open" "&\u00C5bn" - ::msgcat::mcset da "Open Multiple Files" "\u00C5bn flere filer" - ::msgcat::mcset da "P&aste" "&Inds\u00E6t" + ::msgcat::mcset da "Open" "Åbn" + ::msgcat::mcset da "&Open" "&Åbn" + ::msgcat::mcset da "Open Multiple Files" "Åbn flere filer" + ::msgcat::mcset da "P&aste" "&Indsæt" ::msgcat::mcset da "&Quit" "&Afslut" - ::msgcat::mcset da "&Red" "&R\u00F8d" + ::msgcat::mcset da "&Red" "&Rød" ::msgcat::mcset da "Replace existing file?" "Erstat eksisterende fil?" ::msgcat::mcset da "&Retry" "&Gentag" ::msgcat::mcset da "&Save" "&Gem" ::msgcat::mcset da "Save As" "Gem som" ::msgcat::mcset da "Save To Log" "Gem i log" - ::msgcat::mcset da "Select Log File" "V\u00E6lg logfil" - ::msgcat::mcset da "Select a file to source" "V\u00E6lg k\u00F8rbar fil" + ::msgcat::mcset da "Select Log File" "Vælg logfil" + ::msgcat::mcset da "Select a file to source" "Vælg kørbar fil" ::msgcat::mcset da "&Selection:" "&Udvalg:" ::msgcat::mcset da "Show &Hidden Directories" "Vis &skjulte kataloger" ::msgcat::mcset da "Show &Hidden Files and Directories" "Vis &skjulte filer og kataloger" ::msgcat::mcset da "Skip Messages" "Overspring beskeder" - ::msgcat::mcset da "&Source..." "&K\u00F8r..." + ::msgcat::mcset da "&Source..." "&Kør..." ::msgcat::mcset da "Tcl Scripts" "Tcl-Skripter" ::msgcat::mcset da "Tcl for Windows" "Tcl for Windows" ::msgcat::mcset da "Text Files" "Tekstfiler" ::msgcat::mcset da "&Yes" "&Ja" ::msgcat::mcset da "abort" "afbryd" - ::msgcat::mcset da "blue" "bl\u00E5" + ::msgcat::mcset da "blue" "blå" ::msgcat::mcset da "cancel" "afbryd" ::msgcat::mcset da "extension" ::msgcat::mcset da "extensions" - ::msgcat::mcset da "green" "gr\u00F8n" + ::msgcat::mcset da "green" "grøn" ::msgcat::mcset da "ignore" "ignorer" ::msgcat::mcset da "ok" - ::msgcat::mcset da "red" "r\u00F8d" + ::msgcat::mcset da "red" "rød" ::msgcat::mcset da "retry" "gentag" ::msgcat::mcset da "yes" "ja" } diff --git a/library/msgs/de.msg b/library/msgs/de.msg index 6dee507..2cf25d2 100644 --- a/library/msgs/de.msg +++ b/library/msgs/de.msg @@ -52,7 +52,7 @@ namespace eval ::tk { ::msgcat::mcset de "Ok" ::msgcat::mcset de "Open" "Öffnen" ::msgcat::mcset de "&Open" "Ö&ffnen" - ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen" + ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien Öffnen" ::msgcat::mcset de "P&aste" "E&infügen" ::msgcat::mcset de "&Quit" "&Beenden" ::msgcat::mcset de "&Red" "&Rot" diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ab28fbf..acbfa0e 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -31,7 +31,7 @@ static NSAppearance *lightAqua = nil; static NSAppearance *darkAqua = nil; #endif static NSColorSpace* sRGB = NULL; -static CGFloat windowBackground[4] = +static const CGFloat WINDOWBACKGROUND[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; void initColorTable() @@ -297,7 +297,7 @@ GetRGBA( if ([NSApp macOSVersion] < 101400) { for (int i = 0; i < 3; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 6c36ca7..9371889 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -366,14 +366,13 @@ FindCursorByName( TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - Tk_Window tkwin, /* Window in which cursor will be used. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; int argc; - (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -421,24 +420,16 @@ TkGetCursorByName( TkCursor * TkCreateCursorFromData( - Tk_Window tkwin, /* Window in which cursor will be used. */ - const char *source, /* Bitmap data for cursor shape. */ - const char *mask, /* Bitmap data for cursor mask. */ - int width, int height, /* Dimensions of cursor. */ - int xHot, int yHot, /* Location of hot-spot in cursor. */ - XColor fgColor, /* Foreground color for cursor. */ - XColor bgColor) /* Background color for cursor. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */ + TCL_UNUSED(int), /* Dimensions of cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(int), /* Location of hot-spot in cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(XColor), /* Foreground color for cursor. */ + TCL_UNUSED(XColor)) /* Background color for cursor. */ { - (void)tkwin; - (void)source; - (void)mask; - (void)width; - (void)height; - (void)xHot; - (void)yHot; - (void)fgColor; - (void)bgColor; - return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 1bfd163..8575b10 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -870,15 +870,15 @@ Tk_GetOpenFileObjCmd( selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { - NSUInteger i; + NSUInteger j; - for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { - if (filterCompatible(extension, i)) { - selectedFilterIndex = i; + for (j = 0; j < [filterInfo.fileTypeNames count]; j++) { + if (filterCompatible(extension, j)) { + selectedFilterIndex = j; break; } } - if (i == selectedFilterIndex) { + if (j == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 72c83b4..6c66ed8 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -550,13 +550,12 @@ TkpFontPkgInit( TkFont * TkpGetNativeFont( - Tk_Window tkwin, /* For display where font will be used. */ + TCL_UNUSED(Tk_Window), /* For display where font will be used. */ const char *name) /* Platform-specific font name. */ { MacFont *fontPtr = NULL; ThemeFontID themeFontId; CTFontRef ctFont; - (void)tkwin; if (strcmp(name, SYSTEMFONT_NAME) == 0) { themeFontId = kThemeSystemFont; @@ -700,11 +699,10 @@ TkpDeleteFont( void TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ - Tk_Window tkwin) /* For display to query. */ + TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; - (void)tkwin; for (NSString *family in list) { Tcl_ListObjAppendElement(NULL, resultPtr, @@ -774,7 +772,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ @@ -784,7 +782,6 @@ TkpGetFontAttrsForChar( *faPtr = fontPtr->font.fa; if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) { UTF16Char ch = (UTF16Char) c; - (void)tkwin; nsFont = [nsFont bestMatchingFontForCharacters:&ch length:1 attributes:nil actualCoveredLength:NULL]; @@ -1166,7 +1163,7 @@ TkpDrawCharsInContext( void TkpDrawAngledCharsInContext( - Display *display, /* Display on which to draw. */ + TCL_UNUSED(Display *), /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must @@ -1200,7 +1197,6 @@ TkpDrawAngledCharsInContext( NSFont *nsFont; CGAffineTransform t; CGFloat width, height, textX = (CGFloat) x, textY = (CGFloat) y; - (void)display; if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || @@ -1331,12 +1327,9 @@ TkMacOSXNSFontAttributesForFont( int TkMacOSXIsCharacterMissing( - Tk_Font tkfont, /* The font we are looking in. */ - unsigned int searchChar) /* The character we are looking for. */ + TCL_UNUSED(Tk_Font), /* The font we are looking in. */ + TCL_UNUSED(unsigned int)) /* The character we are looking for. */ { - (void)tkfont; - (void)searchChar; - return 0; } @@ -1375,7 +1368,7 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes( objv[i++] = Tcl_NewStringObj(familyName, -1); objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]); -#define S(s) Tcl_NewStringObj(STRINGIFY(s), (int)(sizeof(STRINGIFY(s))-1)) +#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 67ecba3..236ebbc 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -663,7 +663,7 @@ XKeysymToKeycode( macKC.x.keychar = (unsigned int) data; hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar)); if (hPtr != NULL) { - unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); + data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index bccddc5..8970109 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -36,7 +36,7 @@ #define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \ .flag = ENTRY_##f##_MENU } static const struct { - const char *name; const size_t len; const int flag; + const char *name; size_t len; int flag; } specialMenus[] = { SPECIALMENU(help, HELP), SPECIALMENU(apple, APPLE), @@ -47,8 +47,8 @@ static const struct { #define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f } static const struct { - const char *name; const size_t len; const NSUInteger mask; -} modifiers[] = { + const char *name; size_t len; NSUInteger mask; +} allModifiers[] = { MODIFIER(Control, NSControlKeyMask), MODIFIER(Ctrl, NSControlKeyMask), MODIFIER(Option, NSAlternateKeyMask), @@ -64,7 +64,7 @@ static const struct { #define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c } static const struct { - const char *name; const size_t len; const UniChar ch; + const char *name; size_t len; UniChar ch; } specialAccelerators[] = { ACCEL(PageUp, NSPageUpFunctionKey), ACCEL(PageDown, NSPageDownFunctionKey), @@ -1230,18 +1230,18 @@ ParseAccelerator( *maskPtr = 0; while (1) { i = 0; - while (modifiers[i].name) { - int l = modifiers[i].len; + while (allModifiers[i].name) { + int l = allModifiers[i].len; - if (!strncasecmp(accel, modifiers[i].name, l) && + if (!strncasecmp(accel, allModifiers[i].name, l) && (accel[l] == '-' || accel[l] == '+')) { - *maskPtr |= modifiers[i].mask; + *maskPtr |= allModifiers[i].mask; accel += l+1; break; } i++; } - if (!modifiers[i].name || !*accel) { + if (!allModifiers[i].name || !*accel) { break; } } @@ -1465,14 +1465,14 @@ TkpComputeStandardMenuGeometry( } } else { NSUInteger modifMask = [menuItem keyEquivalentModifierMask]; - int i = 0; + int j = 0; - while (modifiers[i].name) { - if (modifMask & modifiers[i].mask) { - modifMask &= ~modifiers[i].mask; + while (allModifiers[j].name) { + if (modifMask & allModifiers[j].mask) { + modifMask &= ~allModifiers[j].mask; modifierWidth += modifierCharWidth; } - i++; + j++; } accelWidth = [[menuItem keyEquivalent] sizeWithAttributes: TkMacOSXNSFontAttributesForFont(tkfont)].width; diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index ab0fadc..61c0d0d 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -149,4 +149,12 @@ MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long gre unsigned long blue); #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) +/* + * Used by tkWindow.c + */ + +MODULE_SCOPE void TkMacOSXHandleMapOrUnmap(Tk_Window tkwin, XEvent *event); + +#define TkpHandleMapOrUnmap(tkwin, event) TkMacOSXHandleMapOrUnmap(tkwin, event) + #endif /* _TKMACPORT */ diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 25ce143..23b7871 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -103,11 +103,11 @@ * debug message in case of failure. */ #define ChkErr(f, ...) ({ \ - OSStatus err = f(__VA_ARGS__); \ - if (err != noErr) { \ - TkMacOSXDbgOSErr(f, err); \ + OSStatus err_ = f(__VA_ARGS__); \ + if (err_ != noErr) { \ + TkMacOSXDbgOSErr(f, err_); \ } \ - err;}) + err_;}) #else /* TK_MAC_DEBUG */ #define TKLog(f, ...) @@ -295,6 +295,8 @@ MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData); MODULE_SCOPE unsigned long TkMacOSXClearPixel(void); +MODULE_SCOPE int MacSystrayInit(Tcl_Interp *); + #pragma mark Private Objective-C Classes diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 9309b67..a358bde 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -119,14 +119,18 @@ XDestroyWindow( * * XMapWindow -- * - * Map the given X Window to the screen. See X window documentation for - * more details. + * This X11 stub maps the given X11 Window but does not update any of + * the Tk structures describing the window. Tk applications should + * never call this directly, but it is called by Tk_MapWindow and + * Tk_WmMapWindow. * * Results: - * None. + * Returns Success or BadWindow. * * Side effects: - * The subwindow or toplevel may appear on the screen. + * The subwindow or toplevel may appear on the screen. VisibilityNotify + * events are generated. + * * *---------------------------------------------------------------------- */ @@ -142,7 +146,6 @@ XMapWindow( MacDrawable *macWin = (MacDrawable *)window; TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); - XEvent event; static Bool initialized = NO; /* @@ -158,7 +161,6 @@ XMapWindow( } display->request++; - winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr)) { TKContentView *view = [win contentView]; @@ -193,30 +195,7 @@ XMapWindow( TkMacOSXInvalClipRgns((Tk_Window)contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } - TkMacOSXInvalClipRgns((Tk_Window)winPtr); - - /* - * We only need to send the MapNotify event for toplevel windows. - */ - - event.xany.serial = LastKnownRequestProcessed(display); - event.xany.send_event = False; - event.xany.display = display; - - event.xmap.window = window; - event.xmap.type = MapNotify; - event.xmap.event = window; - event.xmap.override_redirect = winPtr->atts.override_redirect; - - /* - * To update the mapped status of packed or placed subwindows - * we handle this event immediately and then process the idle - * events that it generates. - */ - - Tk_HandleEvent(&event); - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { /* @@ -227,6 +206,11 @@ XMapWindow( TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); } + /* + * Mark the toplevel as needing to be redrawn, unless the window is being + * mapped while drawing is taking place. + */ + TKContentView *view = [win contentView]; if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; @@ -237,6 +221,7 @@ XMapWindow( */ if (initialized) { + XEvent event; event.xany.send_event = False; event.xany.display = display; event.xvisibility.type = VisibilityNotify; @@ -287,11 +272,13 @@ NotifyVisibility( * * XUnmapWindow -- * - * Unmap the given X Window to the screen. See X window documentation for - * more details. + * This X11 stub maps the given X11 Window but does not update any of + * The Tk structures describing the window. Tk applications should + * never call this directly, but it is called by Tk_UnmapWindow and + * Tk_WmUnmapWindow. * * Results: - * None. + * Always returns Success or BadWindow. * * Side effects: * The subwindow or toplevel may be removed from the screen. @@ -308,8 +295,10 @@ XUnmapWindow( TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); - XEvent event; + if (!window) { + return BadWindow; + } display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && @@ -318,28 +307,6 @@ XUnmapWindow( [win setExcludedFromWindowsMenu:YES]; } TkMacOSXInvalClipRgns((Tk_Window)winPtr); - - /* - * We only need to send the UnmapNotify event for toplevel windows. - */ - - event.xany.serial = LastKnownRequestProcessed(display); - event.xany.send_event = False; - event.xany.display = display; - - event.xunmap.type = UnmapNotify; - event.xunmap.window = window; - event.xunmap.event = window; - event.xunmap.from_configure = false; - - /* - * To update the mapped status of packed or placed subwindows - * we handle this event immediately and then process the idle - * events that it generates. - */ - - Tk_HandleEvent(&event); - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } else { /* * Rebuild the visRgn clip region for the parent so it will be allowed @@ -355,7 +322,6 @@ XUnmapWindow( TkMacOSXInvalClipRgns((Tk_Window)parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } - winPtr->flags &= ~TK_MAPPED; TKContentView *view = [win contentView]; if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 0a8d363..98bec7d 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -1086,7 +1086,7 @@ ConfigureRestrictProc( } /* - * In macOS 10.14 and later his method is called when a user changes between + * In macOS 10.14 and later this method is called when a user changes between * light and dark mode or changes the accent color. The implementation * generates two virtual events. The first is either <<LightAqua>> or * <<DarkAqua>>, depending on the view's current effective appearance. The @@ -1134,6 +1134,7 @@ static const char *const accentNames[] = { } if (!defaultColor) { defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; + preferences = [[NSUserDefaults standardUserDefaults] retain]; /* * AppKit calls this method when the user changes the Accent Color diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index cad005d..5128631 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -746,6 +746,74 @@ TkWmNewWindow( /* *---------------------------------------------------------------------- * + * TkMacOSXHandleMapOrUnmap -- + * + * The mechanism used by a geometry manager to propogate the information + * about which of its content widgets are mapped is to call Tk_MapWindow + * or Tk_UnmapNotify. Those functions generate MapNotify or UnmapNotify + * events and then handle them immediately. Other platforms use + * Tk_HandleEvent to do this. But that does not work correctly on macOS + * due to the fact that the calls to Tk_MapNotify or Tk_UnmapNotify can + * occur in display procedures which are being run in the drawRect method + * of a TKContentView. The events will be processed after drawRect + * returns, but they need to be processed immediately in some cases. + + * This function operates as a macOS alternative to Tk_HandleEvent, for + * processing MapNotify or UnmapNotify events only. It is called by + * Tk_MapWindow, Tk_UnmapWindow, TkWmMapWindow and TkWmUnmapWindow. + * Rather than using Tk_HandleEvent it installs a filter which restricts + * to the MapNotify or UnmapNotify events, it queues the event and then + * processes window events with the filter installed. This allows the + * event to be handled immediately even from within the drawRect method. + * + * Results: + * None. + * + * Side effects: + * Handles a MapNotify or UnMapNotify event. + * + *---------------------------------------------------------------------- + */ +static Tk_RestrictAction +MapUnmapRestrictProc( + TCL_UNUSED(void*), + XEvent *eventPtr) +{ + return (eventPtr->type==MapNotify || eventPtr->type==UnmapNotify ? + TK_PROCESS_EVENT : TK_DEFER_EVENT); +} + +MODULE_SCOPE +void TkMacOSXHandleMapOrUnmap( + Tk_Window tkwin, + XEvent *event) +{ + ClientData oldArg; + Tk_RestrictProc *oldProc; + TkWindow *winPtr = (TkWindow *) tkwin; + const Tk_GeomMgr *geomMgrPtr = winPtr->geomMgrPtr; + + /* + * Sadly, this approach does not work with the "text" geometry manager. + * The mysterious unexplained crash elicited by textDisp-5.2 occurs. So we + * have to check for the "text" manager and revert to using Tk_HandleEvent + * in that case. Hopefully this can be removed when the revised text + * widget is in place. + */ + + if (geomMgrPtr && strcmp(geomMgrPtr->name, "text") == 0) { + Tk_HandleEvent(event); + return; + } + oldProc = Tk_RestrictEvents(MapUnmapRestrictProc, NULL, &oldArg); + Tk_QueueWindowEvent(event, TCL_QUEUE_TAIL); + while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} + Tk_RestrictEvents(oldProc, oldArg, &oldArg); +} + +/* + *---------------------------------------------------------------------- + * * TkWmMapWindow -- * * This procedure is invoked to map a top-level window. This module gets @@ -772,6 +840,8 @@ TkWmMapWindow( * mapped. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + XEvent event; + if (wmPtr->flags & WM_NEVER_MAPPED) { /* * Create the underlying Mac window for this Tk window. @@ -835,10 +905,19 @@ TkWmMapWindow( wmPtr->flags &= ~WM_ABOUT_TO_MAP; /* - * Map the window. + * Map the window and process a MapNotify event for it. */ + winPtr->flags |= TK_MAPPED; XMapWindow(winPtr->display, winPtr->window); + event.xany.serial = LastKnownRequestProcessed(winPtr->display); + event.xany.send_event = False; + event.xany.display = winPtr->display; + event.xmap.window = winPtr->window; + event.xmap.type = MapNotify; + event.xmap.event = winPtr->window; + event.xmap.override_redirect = winPtr->atts.override_redirect; + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -863,7 +942,18 @@ TkWmUnmapWindow( TkWindow *winPtr) /* Top-level window that's about to be * unmapped. */ { + XEvent event; + + event.xany.serial = LastKnownRequestProcessed(winPtr->display); + event.xany.send_event = False; + event.xany.display = winPtr->display; + event.xunmap.type = UnmapNotify; + event.xunmap.window = winPtr->window; + event.xunmap.event = winPtr->window; + event.xunmap.from_configure = false; + winPtr->flags &= ~TK_MAPPED; XUnmapWindow(winPtr->display, winPtr->window); + TkpHandleMapOrUnmap((Tk_Window)winPtr, &event); } /* @@ -946,7 +1036,7 @@ TkWmDeadWindow( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr) { wmPtr2 = winPtr2->wmInfoPtr; @@ -1841,7 +1931,7 @@ WmDeiconifyCmd( transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; WmInfo *wmPtr2 = winPtr2->wmInfoPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr) { if ((wmPtr2->hints.initial_state == WithdrawnState) && @@ -2385,7 +2475,7 @@ WmIconifyCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); @@ -3815,7 +3905,7 @@ WmWithdrawCmd( for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; - TkWindow *containerPtr = (TkWindow *)TkGetTransientMaster(winPtr2); + TkWindow *containerPtr = (TkWindow *)TkMacOSXGetContainer(winPtr2); if (containerPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { @@ -5337,7 +5427,7 @@ TkSetWMName( /* *---------------------------------------------------------------------- * - * TkGetTransientMaster -- + * TkMacOSXGetContainer -- * * If the passed window has the TRANSIENT_FOR property set this will * return the container window. Otherwise it will return None. @@ -5352,7 +5442,7 @@ TkSetWMName( */ Tk_Window -TkGetTransientMaster( +TkMacOSXGetContainer( TkWindow *winPtr) { if (winPtr->wmInfoPtr != NULL) { @@ -6943,9 +7033,9 @@ ApplyContainerOverrideChanges( if (parentWindow && parentWindow != containerMacWin) { [parentWindow removeChildWindow:macWindow]; } - + [macWindow orderFront:NSApp]; [containerMacWin addChildWindow:macWindow - ordered:NSWindowAbove]; + ordered:NSWindowAbove]; } } } else { diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 8bc8ef6..8437aa6 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -232,11 +232,11 @@ static CGRect NormalizeButtonBounds( * support Dark Mode anyway. */ -static CGFloat windowBackground[4] = { +static const CGFloat WINDOWBACKGROUND[4] = { 235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0 }; -static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0}; -static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; +static const CGFloat WHITERGBA[4] = {1.0, 1.0, 1.0, 1.0}; +static const CGFloat BLACKRGBA[4] = {0.0, 0.0, 0.0, 1.0}; /*---------------------------------------------------------------------- * GetBackgroundColor -- @@ -256,13 +256,13 @@ static void GetBackgroundColor( CGFloat *rgba) { TkWindow *winPtr = (TkWindow *)tkwin; - TkWindow *containerPtr = (TkWindow *)TkGetGeomMaster(tkwin); + TkWindow *containerPtr = (TkWindow *)TkGetContainer(tkwin); while (containerPtr && containerPtr->privatePtr) { if (containerPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } - containerPtr = (TkWindow *)TkGetGeomMaster(containerPtr); + containerPtr = (TkWindow *)TkGetContainer(containerPtr); } if (containerPtr && containerPtr->privatePtr) { for (int i = 0; i < 4; i++) { @@ -276,7 +276,7 @@ static void GetBackgroundColor( [windowColor getComponents: rgba]; } else { for (int i = 0; i < 4; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } } @@ -314,7 +314,7 @@ static void DrawDownArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -336,7 +336,7 @@ static void DrawUpArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -406,7 +406,7 @@ static void DrawUpDownArrows( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -633,9 +633,9 @@ static void DrawListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, BLACKRGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, BLACKRGBA); } } } @@ -757,9 +757,9 @@ static void DrawDarkButton( darkSelectedGradient, 2); } if (kind == kThemePopupButton) { - DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA); + DrawUpDownArrows(context, arrowBounds, 3, 7, WHITERGBA); } else { - DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 4, 8, WHITERGBA); } } @@ -818,7 +818,7 @@ static void DrawDarkIncDecButton( darkSelectedGradient, 2); CGContextRestoreGState(context); } - DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA); + DrawUpDownArrows(context, bounds, 3, 5, WHITERGBA); HighlightButtonBorder(context, bounds); } @@ -1245,9 +1245,9 @@ static void DrawDarkListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, WHITERGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, WHITERGBA); } } } @@ -2137,6 +2137,7 @@ static void TrackElementDraw( TrackElement *elem = elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; + CGRect bounds; TtkGetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); @@ -2149,7 +2150,7 @@ static void TrackElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, @@ -2175,7 +2176,7 @@ static void TrackElementDraw( } BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack @@ -2282,6 +2283,7 @@ static void PbarElementDraw( Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; int phase = 0; double value = 0, maximum = 100, factor; + CGRect bounds; TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); @@ -2294,7 +2296,7 @@ static void PbarElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = @@ -2314,7 +2316,7 @@ static void PbarElementDraw( BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack diff --git a/tests/bind.test b/tests/bind.test index c96720a..29f8873 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -13,6 +13,9 @@ eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] + + toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks @@ -2048,7 +2051,7 @@ test bind-16.35 {ExpandPercents procedure} -constraints { set x } -cleanup { destroy .t.f -} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \u00e9} +} -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} \xE9} test bind-16.36 {ExpandPercents procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f @@ -6017,7 +6020,7 @@ test bind-28.9 {keysym names, Eth -> ETH} -body { } -cleanup { destroy .t.f } -result {<Key-ETH>} -test bind-28.10 {keysym names, Ooblique -> Oslash} -body { +test bind-28.10 {keysym names, Ooblique -> Oslash} -constraints nodeprecated -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Ooblique> foo bind .t.f diff --git a/tests/canvText.test b/tests/canvText.test index da60ea4..f39c7f2 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # Canvas used in 1.* - 17.* tests canvas .c -width 400 -height 300 -bd 2 -relief sunken pack .c @@ -940,7 +942,7 @@ test canvText-19.1 {patch 1006286, leading space caused wrap under Win32} -setup destroy .c } -result {{Yeah } Yeah- 4 4} -test canvText-20.1 {angled text bounding box} -setup { +test canvText-20.1 {angled text bounding box} -constraints failsOnUbuntu -setup { destroy .c canvas .c proc transpose {bbox} { diff --git a/tests/entry.test b/tests/entry.test index 262447f..bc246e8 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] + # For xscrollcommand set scrollInfo {} proc scroll args { @@ -2328,7 +2331,7 @@ test entry-8.17 {DeleteChars procedure} -setup { } -cleanup { destroy .e } -result 4 -test entry-8.18 {DeleteChars procedure} -setup { +test entry-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e diff --git a/tests/focus.test b/tests/focus.test index 7da289d..20d25eb 100644 --- a/tests/focus.test +++ b/tests/focus.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc focusSetup {} { destroy .t toplevel .t @@ -308,7 +310,7 @@ in .t.b1 NotifyNonlinear } .t.b1} test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { - unix testwrapper + unix testwrapper failsOnUbuntu } -body { focus .t.b1 focus . @@ -320,7 +322,7 @@ test focus-2.6 {TkFocusFilterEvent procedure, FocusIn events} -constraints { list $x $focusInfo } -result {.t.b1 {press .t.b1 x}} test focus-2.7 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper + unix testwrapper failsOnUbuntu } -body { set result {} foreach detail {NotifyAncestor NotifyInferior NotifyNonlinear @@ -341,7 +343,7 @@ test focus-2.8 {TkFocusFilterEvent procedure, FocusOut events} -constraints { focus } -result {.t.b1} test focus-2.9 {TkFocusFilterEvent procedure, FocusOut events} -constraints { - unix testwrapper + unix testwrapper failsOnUbuntu } -body { focus .t.b1 event gen [testwrapper .] <FocusOut> -detail NotifyAncestor @@ -599,7 +601,7 @@ cleanupbg # Test 5.1 fails (before and after update) test focus-5.1 {ChangeXFocus procedure, don't take focus unless have it} -constraints { - unix testwrapper secureserver + unix testwrapper secureserver failsOnUbuntu } -body { setupbg focusSetup diff --git a/tests/font.test b/tests/font.test index 28ac799..f96b122 100644 --- a/tests/font.test +++ b/tests/font.test @@ -14,6 +14,8 @@ tcltest::loadTestedCommands # Some tests require support for 4-byte UTF-8 sequences testConstraint fullutf [expr {[format %c 0x010000] != "\uFFFD"}] testConstraint utfcompat [expr {([string length "\U10000"] == 2) && [package vsatisfies [package provide Tcl] 8]}] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] set defaultfontlist [font names] @@ -61,9 +63,9 @@ test font-1.1 {TkFontPkgInit} -setup { } -body { interp create foo foo eval { - load {} Tk - wm geometry . +0+0 - update + load {} Tk + wm geometry . +0+0 + update } interp delete foo } -result {} @@ -77,25 +79,25 @@ test font-2.1 {TkFontPkgFree} -setup { # Makes sure that named font was visible only to child interp. foo eval { - load {} Tk - wm geometry . +0+0 - button .b -font {times 16} -text "hi" - pack .b - font create wiggles -family courier -underline 1 - update + load {} Tk + wm geometry . +0+0 + button .b -font {times 16} -text "hi" + pack .b + font create wiggles -family courier -underline 1 + update } lappend x [catch {font configure wiggles} msg; set msg] # Tests cancelling the idle handler for TheWorldHasChanged, # because app goes away before idle serviced. foo eval { - .b config -font wiggles - font config wiggles -size 24 - destroy . + .b config -font wiggles + font config wiggles -size 24 + destroy . } lappend x [foo eval {catch {font families} msg; set msg}] } -cleanup { - interp delete foo + interp delete foo } -result {{named font "wiggles" doesn't exist} {can't invoke "font" command: application has been destroyed}} @@ -137,7 +139,7 @@ test font-4.8 {font command: actual: all attributes} -body { # not (objc > 3) so objPtr = NULL lindex [font actual {-family times}] 0 } -result {-family} -test font-4.9 {font command: actual} -constraints {unix noExceed} -body { +test font-4.9 {font command: actual} -constraints {unix noExceed failsOnUbuntu} -body { # (objc > 3) so objPtr = objv[3 + skip] string tolower [font actual {-family times} -family] } -result {times} @@ -194,7 +196,7 @@ test font-5.4 {font command: configure: get all options} -setup { font create xyz -family xyz lindex [font configure xyz] 1 } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.5 {font command: configure: get one option} -setup { clearnondefaultfonts @@ -202,9 +204,9 @@ test font-5.5 {font command: configure: get one option} -setup { # (objc == 4) so objPtr = objv[3] font create xyz -family xyz font configure xyz -family - getnondefaultfonts + getnondefaultfonts } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.6 {font command: configure: update existing font} -setup { catch {font delete xyz} @@ -215,7 +217,7 @@ test font-5.6 {font command: configure: update existing font} -setup { update font configure xyz -family } -cleanup { - font delete xyz + font delete xyz } -result xyz test font-5.7 {font command: configure: bad option} -setup { catch {font delete xyz} @@ -223,7 +225,7 @@ test font-5.7 {font command: configure: bad option} -setup { font create xyz font configure xyz -style } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike} @@ -243,7 +245,7 @@ test font-6.2 {font command: create: name specified} -setup { font create xyz getnondefaultfonts } -cleanup { - font delete xyz + font delete xyz } -result {xyz} test font-6.3 {font command: create: name not really specified} -setup { clearnondefaultfonts @@ -285,7 +287,7 @@ test font-6.7 {font command: create: already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-7.1 {font command: delete: arguments} -body { @@ -294,7 +296,7 @@ test font-7.1 {font command: delete: arguments} -body { } -returnCodes error -result {wrong # args: should be "font delete fontname ?fontname ...?"} test font-7.2 {font command: delete: loop test} -setup { clearnondefaultfonts - set x {} + set x {} } -body { # for (i = 2; i < objc; i++) font create a -underline 1 @@ -310,7 +312,7 @@ test font-7.2 {font command: delete: loop test} -setup { } -result {{a b c d e} d} test font-7.3 {font command: delete: loop test} -setup { clearnondefaultfonts - set x {} + set x {} } -body { # (namedHashPtr == NULL) in middle of loop font create a -underline 1 @@ -343,7 +345,7 @@ test font-7.5 {font command: delete: mark for later deletion} -setup { font actual xyz font configure xyz } -cleanup { - destroy .t.f + destroy .t.f } -returnCodes error -result {named font "xyz" doesn't exist} test font-7.6 {font command: delete: mark for later deletion} -setup { destroy .t.f @@ -357,7 +359,7 @@ test font-7.6 {font command: delete: mark for later deletion} -setup { font delete xyz font actual xyz catch {font configure xyz} - .t.f cget -font + .t.f cget -font } -cleanup { destroy .t.f } -result xyz @@ -383,7 +385,7 @@ test font-8.3 {font command: families: arguments} -body { # (objc - skip != 2) when skip == 2 font families -displayof . xyz } -returnCodes error -result {wrong # args: should be "font families ?-displayof window?"} -test font-8.4 {font command: families} -body { +test font-8.4 {font command: families} -constraints failsOnUbuntu -body { # TkpGetFontFamilies() regexp -nocase times [font families] } -result 1 @@ -515,7 +517,7 @@ test font-12.1 {UpdateDependantFonts procedure: no users} -setup { font create xyz font configure xyz -family times } -cleanup { - font delete xyz + font delete xyz } -result {} test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { destroy .t.f @@ -534,21 +536,21 @@ test font-12.2 {UpdateDependantFonts procedure: pings the widgets} -setup { set b2 [winfo reqwidth .t.f] expr {$a1==$b1 && $a2==$b2} } -cleanup { - destroy .t.f + destroy .t.f font delete xyz } -result 1 test font-13.1 {CreateNamedFont: new named font} -setup { catch {font delete xyz} - set x {} + set x {} } -body { # not (new == 0) lappend x [getnondefaultfonts] font create xyz lappend x [getnondefaultfonts] } -cleanup { - font delete xyz + font delete xyz } -result {{} xyz} test font-13.2 {CreateNamedFont: named font already exists} -setup { catch {font delete xyz} @@ -557,7 +559,7 @@ test font-13.2 {CreateNamedFont: named font already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-13.3 {CreateNamedFont: named font already exists} -setup { catch {font delete xyz} @@ -566,7 +568,7 @@ test font-13.3 {CreateNamedFont: named font already exists} -setup { font create xyz font create xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup { destroy .t.f @@ -581,8 +583,8 @@ test font-13.4 {CreateNamedFont: recreate "deleted" font} -setup { font create xyz -family courier font configure xyz -family } -cleanup { - font delete xyz - destroy .t.f + font delete xyz + destroy .t.f } -result {courier} @@ -591,7 +593,7 @@ test font-14.1 {Tk_GetFont procedure} -body { test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 } -body { @@ -604,7 +606,7 @@ test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { destroy .b1 .b2 } -result {{1 0}} test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 set result {} @@ -619,7 +621,7 @@ test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { destroy .b2 } -result {{} {{1 1}}} test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { - testfont + testfont } -setup { destroy .b1 .b2 set result {} @@ -642,7 +644,7 @@ test font-15.4 {Tk_AllocFontFromObj procedure: bump ref count} -setup { .t.f config -font {-family fixed} lindex [font actual {-family fixed}] 0 } -cleanup { - destroy .t.f + destroy .t.f } -result {-family} test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { destroy .t.f @@ -654,7 +656,7 @@ test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { font create xyz .t.f config -font xyz } -cleanup { - destroy .t.f + destroy .t.f font delete xyz } -result {} test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup { @@ -665,7 +667,7 @@ test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup { # not (namedHashPtr != NULL) .t.f config -font {times 20} } -cleanup { - destroy .t.f + destroy .t.f } -result {-family} -result {} test font-15.7 {Tk_AllocFontFromObj procedure: get native font} -constraints { unix @@ -709,7 +711,7 @@ test font-15.11 {Tk_AllocFontFromObj procedure: get attribute font} -body { lindex [font actual {plan 9}] 0 } -result {-family} test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup { - destroy .l + destroy .l } -body { # Tk_MeasureChars(fontPtr, "0", ...) label .l -bd 0 -padx 0 -highlightthickness 0 -font $fixed -text "a\tb" @@ -718,7 +720,7 @@ test font-15.12 {Tk_AllocFontFromObj procedure: setup tab width} -setup { set res2 [expr [font measure $fixed "0"]*9] expr {$res1 eq $res2} } -cleanup { - destroy .l + destroy .l } -result 1 test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup { destroy .t.f @@ -729,7 +731,7 @@ test font-15.13 {Tk_AllocFontFromObj procedure: underline position} -setup { .t.f config -text "underline" -font "times -8 underline" update } -cleanup { - destroy .t.f + destroy .t.f } -result {} @@ -741,7 +743,7 @@ test font-16.1 {Tk_NameOfFont procedure} -setup { .t.f config -font -family\ fixed .t.f cget -font } -cleanup { - destroy .t.f + destroy .t.f } -result {-family fixed} @@ -927,7 +929,7 @@ test font-21.5 {Tk_PostscriptFontName procedure: spaces} -constraints { } } -result {LucidaBright} test font-21.6 {Tk_PostscriptFontName procedure: spaces} -constraints { - x11 + x11 failsOnUbuntu } -body { psfontname "{new century schoolbook} 10" } -result {NewCenturySchlbk-Roman} @@ -1449,20 +1451,20 @@ test font-21.66 {Tk_PostscriptFontName procedure: exhaustive} -constraints { test font-22.1 {Tk_TextWidth procedure} -setup { - destroy .t.l + destroy .t.l } -body { - label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ - -text "0" -font "Courier -12" - pack .t.l - set ax [winfo reqwidth .t.l] + label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ + -text "0" -font "Courier -12" + pack .t.l + set ax [winfo reqwidth .t.l] expr {[font measure [.t.l cget -font] "000"] eq $ax*3} } -cleanup { - destroy .t.l + destroy .t.l } -result 1 test font-23.1 {Tk_UnderlineChars procedure} -setup { - destroy .t.t + destroy .t.t } -body { text .t.t .t.t insert 1.0 abc\tdefg @@ -1470,7 +1472,7 @@ test font-23.1 {Tk_UnderlineChars procedure} -setup { .t.t tag add sel 1.0 end update } -cleanup { - destroy .t.t + destroy .t.t } -result {} @@ -1487,27 +1489,27 @@ test font-24.1 {Tk_ComputeTextLayout: empty string} -body { } -result {} test font-24.2 {Tk_ComputeTextLayout: simple string} -body { .t.l config -text "000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq $ay}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq $ay}] } -result {1 1} test font-24.3 {Tk_ComputeTextLayout: find special chars} -body { .t.l config -text "000\n000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.4 {Tk_ComputeTextLayout: calls Tk_MeasureChars} -body { .t.l config -text "000\n000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.5 {Tk_ComputeTextLayout: break line} -body { .t.l config -text "000\t00000" -wrap [expr 9 * $ax] - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -cleanup { .t.l config -wrap 0 } -result {1 1} @@ -1516,26 +1518,26 @@ test font-24.6 {Tk_ComputeTextLayout: normal ended on special char} -body { } -result {} test font-24.7 {Tk_ComputeTextLayout: special char was \n} -body { .t.l config -text "000\n0000" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] } -result {1 1} test font-24.8 {Tk_ComputeTextLayout: special char was \t} -body { .t.l config -text "000\t00" - update - list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \ - [expr {[winfo reqheight .t.l] eq $ay}] + update + list [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] \ + [expr {[winfo reqheight .t.l] eq $ay}] } -result {1 1} test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body { set x {} .t.l config -text "000\t000" - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "000\t000" -wrap [expr 100 * $ax] - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 11}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] return $x } -cleanup { .t.l config -wrap 0 @@ -1543,13 +1545,13 @@ test font-24.9 {Tk_ComputeTextLayout: tab didn't cause break} -body { test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body { set x {} .t.l config -text "000\t" - update + update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "000\t00" -wrap [expr $ax * 6] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 8}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -cleanup { .t.l config -wrap 0 @@ -1557,13 +1559,13 @@ test font-24.10 {Tk_ComputeTextLayout: tab caused break} -body { test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body { set x {} .t.l config -text "000 000" -wrap [expr {$ax * 5}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] .t.l config -text "000 " - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 3}]}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] return $x } -cleanup { .t.l config -wrap 0 @@ -1571,44 +1573,44 @@ test font-24.11 {Tk_ComputeTextLayout: absorb spaces at eol} -body { test font-24.12 {Tk_ComputeTextLayout: append non-printing spaces to chunk} -body { set x {} .t.l config -text "000 0000" -wrap [expr {$ax * 5}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] .t.l config -text "000\t00 0000" -wrap [expr {$ax * 12}] - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 10}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -cleanup { .t.l config -wrap 0 } -result {1 1 1 1} test font-24.13 {Tk_ComputeTextLayout: many lines -> realloc line array} -body { .t.l config -text "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" - update - list [expr {[winfo reqwidth .t.l] eq 1}] \ - [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}] + update + list [expr {[winfo reqwidth .t.l] eq 1}] \ + [expr {[winfo reqheight .t.l] eq [expr {$ay * 129}]}] } -result {1 1} test font-24.14 {Tk_ComputeTextLayout: text ended with \n} -body { set x {} - .t.l config -text "0000" - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq $ay}] - .t.l config -text "0000\n" - update - lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] - lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] - return $x + .t.l config -text "0000" + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq $ay}] + .t.l config -text "0000\n" + update + lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] + lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] + set x } -result {1 1 1 1} destroy .t.l test font-24.15 {Tk_ComputeTextLayout: justification} -setup { set x {} - destroy .t.c - canvas .t.c -closeenough 0 - .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" - pack .t.c - update + destroy .t.c + canvas .t.c -closeenough 0 + .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" + pack .t.c + update } -body { csetup "000\n00000" .t.c itemconfig text -just left @@ -1620,7 +1622,7 @@ test font-24.15 {Tk_ComputeTextLayout: justification} -setup { .t.c itemconfig text -just left return $x } -cleanup { - destroy .t.c + destroy .t.c } -result {2 1 0} @@ -1632,7 +1634,7 @@ test font-25.1 {Tk_FreeTextLayout procedure} -setup { .t.f config -text foo .t.f config -text boo } -cleanup { - destroy .t.f + destroy .t.f } -result {} @@ -1649,7 +1651,7 @@ test font-26.1 {Tk_DrawTextLayout procedure: auto-detect last char} -setup { } -body { .t.f config -text foo } -cleanup { - destroy .t.f + destroy .t.f } -result {} test font-26.2 {Tk_DrawTextLayout procedure: multiple chunks} -body { csetup "000\t00\n000" @@ -1794,110 +1796,110 @@ pack .t.c update test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body { csetup "000\n000\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x 0 -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result 0 test font-30.2 {Tk_DistanceToTextLayout procedure: loop multiple} -body { csetup "000\n000\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x $ax -y $ay return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result 5 test font-30.3 {Tk_DistanceToTextLayout procedure: loop to end} -body { csetup "000\n0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x [expr $ax*2] -y $ay return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} test font-30.4 {Tk_DistanceToTextLayout procedure: hit a special char (tab)} -body { csetup "000\t000\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x [expr $ax*6] -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result 3 test font-30.5 {Tk_DistanceToTextLayout procedure: ignore newline} -body { csetup "000\n0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x [expr $ax*2] -y $ay return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} test font-30.6 {Tk_DistanceToTextLayout procedure: ignore spaces at eol} -body { csetup "000\n000 000000000" .t.c itemconfig text -width [expr $ax*10] - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x [expr $ax*5] -y $ay .t.c itemconfig text -width 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} .t.c itemconfig text -justify center test font-30.7 {Tk_DistanceToTextLayout procedure: on left side} -body { csetup "0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x 0 -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} test font-30.8 {Tk_DistanceToTextLayout procedure: on right side} -body { csetup "0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x [expr $ax*2] -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} test font-30.9 {Tk_DistanceToTextLayout procedure: inside line} -body { csetup "0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x $ax -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result 0 test font-30.10 {Tk_DistanceToTextLayout procedure: above line} -body { csetup "0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x 0 -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result {} test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body { csetup "000\n0" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x 0 -y $ay @@ -1907,7 +1909,7 @@ test font-30.11 {Tk_DistanceToTextLayout procedure: below line} -body { } -result {} test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body { csetup "0\n000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x $ax -y $ay @@ -1918,13 +1920,13 @@ test font-30.12 {Tk_DistanceToTextLayout procedure: in line} -body { .t.c itemconfig text -justify left test font-30.13 {Tk_DistanceToTextLayout procedure: exact hit} -body { csetup "000" - .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} + .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} event generate .t.c <Leave> event generate .t.c <Enter> -x $ax -y 0 return $x } -cleanup { - bind all <Enter> {} + bind all <Enter> {} } -result 1 destroy .t.c @@ -1976,11 +1978,11 @@ destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { - destroy .t.c - canvas .t.c -closeenough 0 - .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" - pack .t.c - update + destroy .t.c + canvas .t.c -closeenough 0 + .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" + pack .t.c + update } -body { # If there were a whole bunch of returns or tabs in a row, then the # temporary buffer could overflow and write on the stack. @@ -1993,7 +1995,7 @@ test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setu set i [string first "(qwerty" $x] string range $x $i [expr {$i + 278}] } -cleanup { - destroy .t.c + destroy .t.c } -result {(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [()] @@ -2051,85 +2053,85 @@ test font-34.2 {ConfigAttributesObj procedure: arguments} -setup { test font-34.3 {ConfigAttributesObj procedure: family} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -family xyz - lappend x [font config xyz -family] - font config xyz -family times - lappend x [font config xyz -family] + font create xyz -family xyz + lappend x [font config xyz -family] + font config xyz -family times + lappend x [font config xyz -family] } -cleanup { font delete xyz } -result {xyz times} test font-34.4 {ConfigAttributesObj procedure: size} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -size 20 - lappend x [font config xyz -size] - font config xyz -size 40 - lappend x [font config xyz -size] + font create xyz -size 20 + lappend x [font config xyz -size] + font config xyz -size 40 + lappend x [font config xyz -size] } -cleanup { - font delete xyz + font delete xyz } -result {20 40} test font-34.5 {ConfigAttributesObj procedure: weight} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -weight normal - lappend x [font config xyz -weight] - font config xyz -weight bold - lappend x [font config xyz -weight] + font create xyz -weight normal + lappend x [font config xyz -weight] + font config xyz -weight bold + lappend x [font config xyz -weight] } -cleanup { - font delete xyz + font delete xyz } -result {normal bold} test font-34.6 {ConfigAttributesObj procedure: slant} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -slant roman - lappend x [font config xyz -slant] - font config xyz -slant italic - lappend x [font config xyz -slant] + font create xyz -slant roman + lappend x [font config xyz -slant] + font config xyz -slant italic + lappend x [font config xyz -slant] } -cleanup { - font delete xyz + font delete xyz } -result {roman italic} test font-34.7 {ConfigAttributesObj procedure: underline} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -underline 0 - lappend x [font config xyz -underline] - font config xyz -underline 1 - lappend x [font config xyz -underline] + font create xyz -underline 0 + lappend x [font config xyz -underline] + font config xyz -underline 1 + lappend x [font config xyz -underline] } -cleanup { - font delete xyz + font delete xyz } -result {0 1} test font-34.8 {ConfigAttributesObj procedure: overstrike} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -overstrike 0 - lappend x [font config xyz -overstrike] - font config xyz -overstrike 1 - lappend x [font config xyz -overstrike] + font create xyz -overstrike 0 + lappend x [font config xyz -overstrike] + font config xyz -overstrike 1 + lappend x [font config xyz -overstrike] } -cleanup { - font delete xyz + font delete xyz } -result {0 1} test font-34.9 {ConfigAttributesObj procedure: size} -body { - font create xyz -size xyz + font create xyz -size xyz } -returnCodes error -result {expected integer but got "xyz"} test font-34.10 {ConfigAttributesObj procedure: weight} -body { - font create xyz -weight xyz + font create xyz -weight xyz } -returnCodes error -result {bad -weight value "xyz": must be normal, or bold} test font-34.11 {ConfigAttributesObj procedure: slant} -body { - font create xyz -slant xyz + font create xyz -slant xyz } -returnCodes error -result {bad -slant value "xyz": must be roman, or italic} test font-34.12 {ConfigAttributesObj procedure: underline} -body { - font create xyz -underline xyz + font create xyz -underline xyz } -returnCodes error -result {expected boolean value but got "xyz"} test font-34.13 {ConfigAttributesObj procedure: overstrike} -body { - font create xyz -overstrike xyz + font create xyz -overstrike xyz } -returnCodes error -result {expected boolean value but got "xyz"} @@ -2140,7 +2142,7 @@ test font-35.1 {GetAttributeInfoObj procedure: one attribute} -setup { font create xyz -family xyz font config xyz -family } -cleanup { - font delete xyz + font delete xyz } -result {xyz} @@ -2151,7 +2153,7 @@ test font-36.1 {GetAttributeInfoObj procedure: unknown attribute} -setup { font create xyz font config xyz -xyz } -cleanup { - font delete xyz + font delete xyz } -returnCodes { error } -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike} @@ -2164,60 +2166,60 @@ test font-37.1 {GetAttributeInfoObj procedure: all attributes} -setup { font create xyz -family xyz font config xyz } -cleanup { - font delete xyz + font delete xyz } -result {-family xyz -size 0 -weight normal -slant roman -underline 0 -overstrike 0} test font-37.2 {GetAttributeInfo procedure: family} -setup { catch {font delete xyz} } -body { - font create xyz -family xyz - font config xyz -family + font create xyz -family xyz + font config xyz -family } -cleanup { - font delete xyz + font delete xyz } -result {xyz} test font-37.3 {GetAttributeInfo procedure: size} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -size 20 - font config xyz -size + font create xyz -size 20 + font config xyz -size } -cleanup { - font delete xyz + font delete xyz } -result 20 test font-37.4 {GetAttributeInfo procedure: weight} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -weight normal - font config xyz -weight + font create xyz -weight normal + font config xyz -weight } -cleanup { - font delete xyz + font delete xyz } -result {normal} test font-37.5 {GetAttributeInfo procedure: slant} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -slant italic - font config xyz -slant + font create xyz -slant italic + font config xyz -slant } -cleanup { - font delete xyz + font delete xyz } -result {italic} test font-37.6 {GetAttributeInfo procedure: underline} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -underline yes - font config xyz -underline + font create xyz -underline yes + font config xyz -underline } -cleanup { - font delete xyz + font delete xyz } -result 1 test font-37.7 {GetAttributeInfo procedure: overstrike} -setup { catch {font delete xyz} - set x {} + set x {} } -body { - font create xyz -overstrike no - font config xyz -overstrike + font create xyz -overstrike no + font config xyz -overstrike } -cleanup { - font delete xyz + font delete xyz } -result 0 @@ -2256,7 +2258,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { - unixOrWin + unixOrWin failsOnUbuntuNoXft } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} @@ -2338,21 +2340,21 @@ test font-43.1 {FieldSpecified procedure: specified vs. non-specified} -body { } -result [font actual {times 0} -family] -test font-44.1 {TkFontGetPixels: size < 0} -setup { - set oldscale [tk scaling] +test font-44.1 {TkFontGetPixels: size < 0} -constraints failsOnUbuntuNoXft -setup { + set oldscale [tk scaling] } -body { - tk scaling 0.5 + tk scaling 0.5 font actual {times -12} -size } -cleanup { - tk scaling $oldscale + tk scaling $oldscale } -result 24 -test font-44.2 {TkFontGetPoints: size >= 0} -constraints noExceed -setup { - set oldscale [tk scaling] +test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed failsOnUbuntuNoXft} -setup { + set oldscale [tk scaling] } -body { - tk scaling 0.5 + tk scaling 0.5 font actual {times 12} -size } -cleanup { - tk scaling $oldscale + tk scaling $oldscale } -result 12 @@ -2374,12 +2376,12 @@ test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body { test font-46.1 {font actual, with character, no option, no --} -body { - font actual {times 10} a + font actual {times 10} a } -match glob -result [list -family [font actual {times 10} -family] -size *\ -slant roman -underline 0 -overstrike 0] test font-46.2 {font actual, with character introduced by --} -body { - font actual {times 10} -- - + font actual {times 10} -- - } -match glob -result [list -family [font actual {times 10} -family] -size *\ -slant roman -underline 0 -overstrike 0] diff --git a/tests/fontchooser.test b/tests/fontchooser.test index 97ca859..a9f914d 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -6,6 +6,9 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] + # the following helper functions are related to the functions used # in winDialog.test where they are used to send messages to the win32 # dialog (hence the wierdness). @@ -179,7 +182,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body { expr {$::testfont ne {}} } -result 1 -test fontchooser-4.4 {fontchooser -font} -constraints scriptImpl -body { +test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl failsOnUbuntuNoXft} -body { start { tk::fontchooser::Configure -command ApplyFont -font {times 14 bold} tk::fontchooser::Show diff --git a/tests/grid.test b/tests/grid.test index 7f66e0d..b033311 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body { } -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"} test grid-1.2 {basic argument checking} -body { grid foo bar -} -returnCodes error -match glob -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, *size*} +} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, or size} test grid-1.3 {basic argument checking} -body { button .b grid .b -row 0 -column diff --git a/tests/oldpack.test b/tests/oldpack.test index 35fd0f6..c3676ec 100644 --- a/tests/oldpack.test +++ b/tests/oldpack.test @@ -457,10 +457,10 @@ test oldpack-8.2 {syntax errors} -body { } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} test oldpack-8.3 {syntax errors} -body { pack gorp foo -} -returnCodes error -match glob -result {bad option "gorp": must be configure, content, forget, info, *propagate*} +} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, or propagate} test oldpack-8.4 {syntax errors} -body { pack a .pack -} -returnCodes error -match glob -result {bad option "a": must be configure, content, forget, info, *propagate*} +} -returnCodes error -result {bad option "a": must be configure, content, forget, info, or propagate} test oldpack-8.5 {syntax errors} -body { pack after foobar } -returnCodes error -result {bad window path name "foobar"} diff --git a/tests/pack.test b/tests/pack.test index 5c919ed..eb3ca3b 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -11,6 +11,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] # Create some test windows. @@ -1360,7 +1361,7 @@ test pack-12.46 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack lousy .pack -} -returnCodes error -match glob -result {bad option "lousy": must be configure, content, forget, info, *propagate*} +} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, or propagate} test pack-13.1 {window deletion} -setup { pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom @@ -1542,7 +1543,7 @@ if {[tk windowingsystem] == "win32"} { } test pack-18.1 {unmap content when container unmapped} -constraints { - tempNotPc + tempNotPc failsOnUbuntu } -setup { eval destroy [winfo child .pack] } -body { @@ -1572,7 +1573,7 @@ test pack-18.1 {unmap content when container unmapped} -constraints { lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} -test pack-18.2 {unmap content when container unmapped} -setup { +test pack-18.2 {unmap content when container unmapped} -constraints failsOnUbuntu -setup { eval destroy [winfo child .pack] } -body { # adjust the position of .pack before test to avoid a screen switch diff --git a/tests/pkgconfig.test b/tests/pkgconfig.test index e080b91..f07ca0f 100644 --- a/tests/pkgconfig.test +++ b/tests/pkgconfig.test @@ -18,7 +18,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands -test pkgconfig-1.1 {query keys} nonwin { +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] + +test pkgconfig-1.1 {query keys} nodeprecated { lsort [::tk::pkgconfig list] } [list \ 64bit bindir,install bindir,runtime debug demodir,install demodir,runtime \ diff --git a/tests/place.test b/tests/place.test index e811b1a..3da19f6 100644 --- a/tests/place.test +++ b/tests/place.test @@ -13,6 +13,8 @@ tcltest::loadTestedCommands # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # XXX - This test file is woefully incomplete. At present, only a # few of the features are tested. @@ -267,7 +269,7 @@ if {[tk windowingsystem] == "win32"} { } } -test place-8.1 {PlaceStructureProc, mapping and unmapping content} -setup { +test place-8.1 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { place forget .t.f2 place forget .t.f } -body { @@ -283,7 +285,7 @@ test place-8.1 {PlaceStructureProc, mapping and unmapping content} -setup { placeUpdate lappend result [winfo ismapped .t.f2] } -result {1 0 40 30 0 1} -test place-8.2 {PlaceStructureProc, mapping and unmapping content} -setup { +test place-8.2 {PlaceStructureProc, mapping and unmapping content} -constraints failsOnUbuntu -setup { place forget .t.f2 place forget .t.f update idletasks @@ -329,7 +331,7 @@ test place-9.5 {PlaceObjCmd} -setup { place badopt .foo } -cleanup { destroy .foo -} -returnCodes error -match glob -result {bad option "badopt": must be configure, content, forget, *info*} +} -returnCodes error -result {bad option "badopt": must be configure, content, forget, or info} test place-9.6 {PlaceObjCmd, configure errors} -setup { destroy .foo } -body { diff --git a/tests/safe.test b/tests/safe.test index 5a2cd26..3a3b029 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -35,7 +35,10 @@ namespace import -force tcltest::test set hidden_cmds [list bell cd clipboard encoding exec exit \ fconfigure glob grab load menu open pwd selection \ - socket source tcl:encoding:dirs toplevel unload wm] + socket source toplevel unload wm] +if {[package vsatisfies [package provide Tcl] 8.6.7-]} { + lappend hidden_cmds tcl:encoding:dirs +} if {[package vsatisfies [package provide Tcl] 8.7-]} { lappend hidden_cmds file tcl:encoding:system tcl:file:tempdir foreach cmd { diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 3186f99..86e742e 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -11,6 +11,9 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] + proc scroll args { global scrollInfo set scrollInfo $args @@ -270,13 +273,13 @@ test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] -test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { +test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { format {%.6g} [.s fraction 4 179] } 1 test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]] } 1 -test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { +test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} {x11 failsOnUbuntu} { format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { @@ -314,7 +317,7 @@ destroy .t test scrollbar-3.43 {ScrollbarWidgetCmd procedure, "get" option} { list [catch {.s get a} msg] $msg } {1 {wrong # args: should be ".s get"}} -test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} { +test scrollbar-3.44 {ScrollbarWidgetCmd procedure, "get" option} nodeprecated { .s set 100 10 13 14 .s get } {100 10 13 14} @@ -399,27 +402,27 @@ test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { } set result } {0.4 0.4} -test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.64 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set abc def ghi jkl} msg] $msg } {1 {expected integer but got "abc"}} -test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.65 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 def ghi jkl} msg] $msg } {1 {expected integer but got "def"}} -test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 2 ghi jkl} msg] $msg } {1 {expected integer but got "ghi"}} -test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} -test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set -10 50 20 30 .s get } {0 50 0 0} -test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set 100 -10 20 30 .s get } {100 0 20 30} -test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { +test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} nodeprecated { .s set 100 50 30 20 .s get } {100 50 30 30} @@ -491,7 +494,7 @@ test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 4 } {trough1} -test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 { +test scrollbar-6.12.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 19 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { @@ -549,7 +552,7 @@ test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} -test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 { +test scrollbar-6.29.1 {ScrollbarPosition procedure} {x11 failsOnUbuntu} { .s identify 8 180 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { @@ -573,7 +576,7 @@ test scrollbar-6.33 {ScrollbarPosition procedure} win { test scrollbar-6.34 {ScrollbarPosition procedure} unix { .s identify 4 100 } {trough2} -test scrollbar-6.35 {ScrollbarPosition procedure} unix { +test scrollbar-6.35 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .s identify 18 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { @@ -612,7 +615,7 @@ test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - 1}] [expr {[winfo height .t.s] / 2}] } {slider} -test scrollbar-6.44 {ScrollbarPosition procedure} unix { +test scrollbar-6.44 {ScrollbarPosition procedure} {unix failsOnUbuntu} { .t.s identify 100 18 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { diff --git a/tests/send.test b/tests/send.test index 9c4cf04..d3322e5 100644 --- a/tests/send.test +++ b/tests/send.test @@ -15,6 +15,7 @@ eval tcltest::configure $argv tcltest::loadTestedCommands testConstraint xhost [llength [auto_execok xhost]] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] # Compute a script that will load Tk into a child interpreter. @@ -286,7 +287,7 @@ test send-8.14 {Tk_SendCmd procedure, local interp killed by send} {secureserver catch {interp delete t_s_2} -test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend} { +test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver testsend failsOnUbuntu} { catch {error foo} list [catch {send t_s_1 {if 1 {open bogus_file_name}}} msg] $msg $errorInfo $errorCode } {1 {couldn't open "bogus_file_name": no such file or directory} {couldn't open "bogus_file_name": no such file or directory @@ -296,7 +297,7 @@ test send-8.15 {Tk_SendCmd procedure, local interp, error info} {secureserver te "if 1 {open bogus_file_name}" invoked from within "send t_s_1 {if 1 {open bogus_file_name}}"} {POSIX ENOENT {no such file or directory}}} -test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend} { +test send-8.16 {Tk_SendCmd procedure, bogusCommWindow} {secureserver testsend failsOnUbuntu} { testsend prop root InterpRegistry "10234 bogus\n" set result [list [catch {send bogus bogus command} msg] $msg] winfo interps diff --git a/tests/spinbox.test b/tests/spinbox.test index 070337d..3f6ac15 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -11,6 +11,9 @@ namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] + # For xscrollcommand set scrollInfo {} proc scroll args { @@ -2618,7 +2621,7 @@ test spinbox-8.17 {DeleteChars procedure} -setup { } -cleanup { destroy .e } -result 4 -test spinbox-8.18 {DeleteChars procedure} -setup { +test spinbox-8.18 {DeleteChars procedure} -constraints failsOnUbuntuNoXft -setup { spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e diff --git a/tests/text.test b/tests/text.test index b3e10bc..d830dc2 100644 --- a/tests/text.test +++ b/tests/text.test @@ -5824,7 +5824,7 @@ test text-22.217.1 {elide up to match, with UTF-8 chars before the match} -setup } -body { .t tag configure e -elide 0 .t insert end A {} xyz e bb\n - .t insert end \u00c4 {} xyz e bb + .t insert end \xC4 {} xyz e bb set res {} lappend res [.t search bb 1.0 "1.0 lineend"] lappend res [.t search bb 2.0 "2.0 lineend"] diff --git a/tests/textDisp.test b/tests/textDisp.test index dcc9318..160e1c8 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # Platform specific procedure for updating the text widget. if {[tk windowingsystem] == "aqua"} { @@ -285,7 +287,7 @@ test textDisp-2.5 {LayoutDLine, word wrap} {textfonts} { .t insert 1.0 "This isx some sample text for testing." list [.t bbox 1.13] [.t bbox 1.19] [.t bbox 1.20] [.t bbox 1.21] } [list [list 96 5 $fixedWidth $fixedHeight] [list 138 5 $fixedWidth $fixedHeight] [list 145 5 0 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] $fixedWidth $fixedHeight]] -test textDisp-2.6 {LayoutDLine, word wrap} { +test textDisp-2.6 {LayoutDLine, word wrap} failsOnUbuntu { .t configure -wrap word .t delete 1.0 end .t insert 1.0 "This isxxx some sample text for testing." @@ -1188,7 +1190,7 @@ test textDisp-8.9 {TkTextChanged} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 8.0} {2.0 8.0}} -test textDisp-8.10 {TkTextChanged} { +test textDisp-8.10 {TkTextChanged} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1248,7 +1250,7 @@ test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} { update idletasks } {} -test textDisp-9.1 {TkTextRedrawTag} { +test textDisp-9.1 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1266,7 +1268,7 @@ test textDisp-9.2 {TkTextRedrawTag} {textfonts} { updateText list $tk_textRelayout $tk_textRedraw } {{1.0 2.0 2.17} {1.0 2.0 2.17}} -test textDisp-9.3 {TkTextRedrawTag} { +test textDisp-9.3 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1277,7 +1279,7 @@ test textDisp-9.3 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.4 {TkTextRedrawTag} { +test textDisp-9.4 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1288,7 +1290,7 @@ test textDisp-9.4 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.5 {TkTextRedrawTag} { +test textDisp-9.5 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap around\nLine 3\nLine 4" @@ -1299,7 +1301,7 @@ test textDisp-9.5 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20} {2.0 2.20 eof}} -test textDisp-9.6 {TkTextRedrawTag} { +test textDisp-9.6 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap" @@ -1310,7 +1312,7 @@ test textDisp-9.6 {TkTextRedrawTag} { updateText list $tk_textRelayout $tk_textRedraw } {{2.0 2.20 3.0 3.20} {2.0 2.20 3.0 3.20 eof}} -test textDisp-9.7 {TkTextRedrawTag} { +test textDisp-9.7 {TkTextRedrawTag} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1\nLine 2 is long enough to wrap\nLine 3 is also long enough to wrap\nLine 4" @@ -1868,7 +1870,7 @@ test textDisp-14.5 {TkTextXviewCmd procedure} { test textDisp-14.6 {TkTextXviewCmd procedure} { list [catch {.t xview moveto a} msg] $msg } {1 {expected floating-point number but got "a"}} -test textDisp-14.7 {TkTextXviewCmd procedure} { +test textDisp-14.7 {TkTextXviewCmd procedure} failsOnUbuntu { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" @@ -2068,7 +2070,7 @@ test textDisp-16.9 {TkTextYviewCmd procedure, "moveto" option} { test textDisp-16.10 {TkTextYviewCmd procedure, "moveto" option} { list [catch {.t yview moveto gorp} msg] $msg } {1 {expected floating-point number but got "gorp"}} -test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.11 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto 0.5 .t index @0,0 } {103.0} @@ -2080,21 +2082,21 @@ test textDisp-16.13 {TkTextYviewCmd procedure, "moveto" option} { .t yview moveto 1.1 .t index @0,0 } {191.0} -test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.14 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .75 .t index @0,0 } {151.60} -test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.15 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .752 .t index @0,0 } {151.60} -test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} {textfonts} { +test textDisp-16.16 {TkTextYviewCmd procedure, "moveto" option} textfonts { set count [expr {5 * $bigHeight + 150 * $fixedHeight}] set extra [expr {0.04 * double($fixedDiff * 150) / double($count)}] .t yview moveto [expr {.753 - $extra}] .t index @0,0 } {151.60} -test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} { +test textDisp-16.17 {TkTextYviewCmd procedure, "moveto" option} failsOnUbuntu { .t yview moveto .755 .t index @0,0 } {151.80} @@ -2258,7 +2260,7 @@ test textDisp-16.38 {TkTextYviewCmd procedure} { test textDisp-16.39 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 1.3i pixels} msg] $msg } {0 {}} -test textDisp-16.40 {text count -xpixels} { +test textDisp-16.40 {text count -xpixels} failsOnUbuntu { set res {} lappend res [.t count -xpixels 1.0 1.5] \ [.t count -xpixels 1.5 1.0] \ @@ -2570,7 +2572,7 @@ test textDisp-19.7 {GetYView procedure} { updateText set x $scrollInfo } {0.125 0.75} -test textDisp-19.8 {GetYView procedure} { +test textDisp-19.8 {GetYView procedure} failsOnUbuntu { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "Line 1" @@ -2867,7 +2869,7 @@ test textDisp-19.16 {count -ypixels} { [.t count -ypixels 16.0 "16.0 displaylineend +1c"] \ [.t count -ypixels "16.0 +1 displaylines" "16.0 +4 displaylines +3c"] } [list [expr {260 + 20 * $fixedDiff}] [expr {260 + 20 * $fixedDiff}] $fixedHeight [expr {2*$fixedHeight}] $fixedHeight [expr {3*$fixedHeight}]] -test textDisp-19.17 {count -ypixels with indices in elided lines} { +test textDisp-19.17 {count -ypixels with indices in elided lines} failsOnUbuntu { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -2894,7 +2896,7 @@ test textDisp-19.17 {count -ypixels with indices in elided lines} { .t yview 35.0 lappend res [.t count -ypixels 5.0 25.0] } [list [expr {4 * $fixedHeight}] [expr {3 * $fixedHeight}] 0 0 0 0 0 0 [expr {5 * $fixedHeight}] [expr {- 5 * $fixedHeight}] [expr {2 * $fixedHeight}] [expr {3 * $fixedHeight}] [expr {5 * $fixedHeight}]] -test textDisp-19.18 {count -ypixels with indices in elided lines} { +test textDisp-19.18 {count -ypixels with indices in elided lines} failsOnUbuntu { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 100} {incr i} { @@ -2932,28 +2934,28 @@ for {set i 2} {$i <= 200} {incr i} { .t configure -wrap word .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" -test textDisp-20.1 {FindDLine} { +test textDisp-20.1 {FindDLine} failsOnUbuntu { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.2 {FindDLine} { +test textDisp-20.2 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] } [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] -test textDisp-20.3 {FindDLine} { +test textDisp-20.3 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 49.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 57.0] } [list [list 3 [expr {$fixedDiff + 16}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {2*$fixedDiff + 29}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] -test textDisp-20.4 {FindDLine} { +test textDisp-20.4 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 42.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.24] [.t dlineinfo 50.40] } [list [list 3 [expr {8*$fixedDiff + 107}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] .t config -wrap none -test textDisp-20.5 {FindDLine} { +test textDisp-20.5 {FindDLine} failsOnUbuntu { .t yview 100.0 .t yview 48.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.20] [.t dlineinfo 50.40] @@ -3933,7 +3935,7 @@ catch {destroy .t2} .t configure -height 1 updateText -test textDisp-31.1 {line embedded window height update} { +test textDisp-31.1 {line embedded window height update} failsOnUbuntu { set res {} .t delete 1.0 end .t insert end "abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx" @@ -3946,7 +3948,7 @@ test textDisp-31.1 {line embedded window height update} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]] -test textDisp-31.2 {line update index shifting} { +test textDisp-31.2 {line update index shifting} failsOnUbuntu { set res {} .t.f configure -height 100 updateText @@ -3963,7 +3965,7 @@ test textDisp-31.2 {line update index shifting} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]] -test textDisp-31.3 {line update index shifting} { +test textDisp-31.3 {line update index shifting} failsOnUbuntu { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be @@ -4000,7 +4002,7 @@ test textDisp-31.4 {line embedded image height update} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 6}] [expr {$fixedHeight * 7}]] -test textDisp-31.5 {line update index shifting} { +test textDisp-31.5 {line update index shifting} failsOnUbuntu { set res {} textest configure -height 100 updateText @@ -4017,7 +4019,7 @@ test textDisp-31.5 {line update index shifting} { set res } [list [expr {100 + $fixedHeight * 6}] [expr {100 + $fixedHeight * 8}] [expr {$fixedHeight * 9}] [expr {$fixedHeight * 7}] [expr {100 + $fixedHeight * 6}]] -test textDisp-31.6 {line update index shifting} { +test textDisp-31.6 {line update index shifting} failsOnUbuntu { # Should do exactly the same as the above, as long # as we are correctly tagging the correct lines for # recalculation. The 'update' and 'delay' must be diff --git a/tests/textIndex.test b/tests/textIndex.test index 99a70d6..656542c 100644 --- a/tests/textIndex.test +++ b/tests/textIndex.test @@ -871,7 +871,7 @@ test textIndex-21.9 {text index wordend} { text_test_word worde "x.y" end-1 } 2 test textIndex-21.10 {text index wordend, unicode} { - text_test_word wordend "xyz\u00c7de fg" 0 + text_test_word wordend "xyz\xC7de fg" 0 } 6 test textIndex-21.11 {text index wordend, unicode} { text_test_word wordend "xyz\uc700de fg" 0 @@ -905,7 +905,7 @@ test textIndex-22.10 {text index wordstart} { text_test_word wordstart "one two three" end-5 } 7 test textIndex-22.11 {text index wordstart, unicode} { - text_test_word wordstart "one tw\u00c7o three" 7 + text_test_word wordstart "one tw\xC7o three" 7 } 4 test textIndex-22.12 {text index wordstart, unicode} { text_test_word wordstart "ab\uc700\uc700 cdef ghi" 12 @@ -916,8 +916,8 @@ test textIndex-22.13 {text index wordstart, unicode} { test textIndex-22.14 {text index wordstart, unicode, start index at internal segment start} { catch {destroy .t} text .t - .t insert end "C'est du texte en fran\u00e7ais\n" - .t insert end "\u042D\u0442\u043E\u0020\u0442\u0435\u043A\u0441\u0442\u0020\u043D\u0430\u0020\u0440\u0443\u0441\u0441\u043A\u043E\u043C" + .t insert end "C'est du texte en fran\xE7ais\n" + .t insert end "\u042D\u0442\u043E \u0442\u0435\u043A\u0441\u0442 \u043D\u0430 \u0440\u0443\u0441\u0441\u043A\u043E\u043C" .t mark set insert 1.23 set res [.t index "1.23 wordstart"] .t mark set insert 2.16 diff --git a/tests/textTag.test b/tests/textTag.test index 94db751..e923611 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -26,6 +26,9 @@ testConstraint haveFontSizes [expr { [font actual $bigFont -size] == 24 } ] +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] + destroy .t text .t -width 20 -height 10 @@ -1342,7 +1345,7 @@ test textTag-16.1 {TkTextPickCurrent procedure} -setup { } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { - haveFontSizes + haveFontSizes failsOnUbuntuNoXft } -setup { .t tag delete {*}[.t tag names] wm geometry . +200+200 ; update @@ -1438,7 +1441,7 @@ test textTag-16.5 {TkTextPickCurrent procedure} -constraints { } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { - haveFontSizes + haveFontSizes failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end @@ -1460,7 +1463,7 @@ test textTag-16.6 {TkTextPickCurrent procedure} -constraints { } -result {3.1} test textTag-16.7 {TkTextPickCurrent procedure} -constraints { - haveFontSizes + haveFontSizes failsOnUbuntuNoXft } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end diff --git a/tests/textWind.test b/tests/textWind.test index 286964e..03793a4 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + deleteWindows set fixedFont {"Courier" -12} @@ -792,7 +794,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup {{can't embed .t relative to .t}} \ [list [expr {$padx+5*$fixedWidth}] [expr {$pady+($fixedHeight/2)}] 0 0]] -test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -setup { +test textWind-10.7 {EmbWinLayoutProc procedure, error in creating window} -constraints failsOnUbuntu -setup { .t delete 1.0 end destroy .t2 proc bgerror args { diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index ef77adb..48179f3 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -13,7 +13,7 @@ test combobox-1.0 "Combobox tests -- setup" -body { test combobox-1.1 "Bad -values list" -body { .cb configure -values "bad \{list" -} -result "unmatched open brace in list" -returnCodes 1 +} -result "unmatched open brace in list" -returnCodes error test combobox-1.end "Combobox tests -- cleanup" -body { destroy .cb diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 5eb4740..a958d90 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -7,6 +7,8 @@ package require tcltest 2.2 namespace import -force tcltest::* loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + variable scrollInfo proc scroll args { global scrollInfo @@ -75,7 +77,7 @@ test entry-2.1 "Create entry before scrollbar" -body { -expand false -fill x } -cleanup {destroy .te .tsb} -test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -body { +test entry-2.1.1 "Create entry before scrollbar - scrollbar catches up" -constraints failsOnUbuntu -body { pack [ttk::entry .te -xscrollcommand [list .tsb set]] \ -expand true -fill both .te insert end [string repeat "abc" 50] diff --git a/tests/ttk/image.test b/tests/ttk/image.test index ea0ab1d..bb593fc 100644 --- a/tests/ttk/image.test +++ b/tests/ttk/image.test @@ -12,7 +12,7 @@ test image-1.2 "Duplicate element" -setup { ttk::style element create testElement image test.element } -body { ttk::style element create testElement image test.element -} -returnCodes 1 -result "Duplicate element testElement" +} -returnCodes error -result "Duplicate element testElement" test image-2.0 "Deletion of displayed image (label)" -setup { image create photo test.image -width 10 -height 10 diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test index 1f64d67..9ffffd8 100644 --- a/tests/ttk/labelframe.test +++ b/tests/ttk/labelframe.test @@ -11,22 +11,22 @@ test labelframe-2.1 "Can't use indirect descendant as labelwidget" -body { ttk::frame .lf.t ttk::checkbutton .lf.t.cb .lf configure -labelwidget .lf.t.cb -} -returnCodes 1 -result "can't *" -match glob \ +} -returnCodes error -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.2 "Can't use toplevel as labelwidget" -body { toplevel .lf.t .lf configure -labelwidget .lf.t -} -returnCodes 1 -result "can't *" -match glob \ +} -returnCodes error -result "can't *" -match glob \ -cleanup { destroy .lf.t } ; test labelframe-2.3 "Can't use non-windows as -labelwidget" -body { .lf configure -labelwidget BogusWindowName -} -returnCodes 1 -result {bad window path name "BogusWindowName"} +} -returnCodes error -result {bad window path name "BogusWindowName"} test labelframe-2.4 "Can't use nonexistent-windows as -labelwidget" -body { .lf configure -labelwidget .nosuchwindow -} -returnCodes 1 -result {bad window path name ".nosuchwindow"} +} -returnCodes error -result {bad window path name ".nosuchwindow"} ### diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test index fbab6bd..e58812a 100644 --- a/tests/ttk/notebook.test +++ b/tests/ttk/notebook.test @@ -25,11 +25,11 @@ test notebook-1.3 "Cannot add toplevel" -body { .nb add [toplevel .nb.t] } -cleanup { destroy .t.nb -} -returnCodes 1 -match glob -result "can't add .nb.t*" +} -returnCodes error -match glob -result "can't add .nb.t*" test notebook-1.4 "Try to select bad tab" -body { .nb select @6000,6000 -} -returnCodes 1 -match glob -result "* not found" +} -returnCodes error -match glob -result "* not found" # # Now add stuff: diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index 9d3cf77..528d56b 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -47,7 +47,7 @@ test panedwindow-1.7 "Make sure empty panedwindow still still doesn't crash" -bo test panedwindow-1.8 "Re-forget pane" -body { .pw forget .pw.f1 -} -returnCodes 1 -result ".pw.f1 is not managed by .pw" +} -returnCodes error -result ".pw.f1 is not managed by .pw" test panedwindow-1.end "Cleanup" -body { destroy .pw @@ -119,11 +119,11 @@ test panedwindow-3.0 "configure pane" -body { test panedwindow-3.1 "configure pane -- errors" -body { .pw pane 1 -weight -4 -} -returnCodes 1 -match glob -result "-weight must be nonnegative" +} -returnCodes error -match glob -result "-weight must be nonnegative" test panedwindow-3.2 "add pane -- errors" -body { .pw add [ttk::label .pw.l] -weight -1 -} -returnCodes 1 -match glob -result "-weight must be nonnegative" +} -returnCodes error -match glob -result "-weight must be nonnegative" test panedwindow-3.end "cleanup" -body { destroy .pw } @@ -147,7 +147,7 @@ test panedwindow-4.1 "forget" -body { test panedwindow-4.2 "forget forgotten" -body { .pw forget .pw.l1 -} -returnCodes 1 -result ".pw.l1 is not managed by .pw" +} -returnCodes error -result ".pw.l1 is not managed by .pw" # checkorder $winlist -- # Ensure that Y coordinates windows in $winlist are strictly increasing. diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test index d3886e7..8e2fdb9 100644 --- a/tests/ttk/progressbar.test +++ b/tests/ttk/progressbar.test @@ -77,7 +77,7 @@ test progressbar-2.5 "error in write trace" -body { trace variable PB w { error "YIPES!" ;# } .pb step set PB ;# NOTREACHED -} -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!" +} -cleanup { unset PB } -returnCodes error -match glob -result "*YIPES!" test progressbar-end "Cleanup" -body { destroy .pb diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index a0d8065..3af03d5 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -166,7 +166,7 @@ test scale-1.0 "Self-destruction" -body { ttk::scale .s -variable v pack .s ; update .s set 1 ; update -} -returnCodes 1 -match glob -result "*" +} -returnCodes error -match glob -result "*" test scale-2.1 "-state option" -setup { ttk::scale .s diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test index 0de6df5..d7fa23a 100644 --- a/tests/ttk/treetags.test +++ b/tests/ttk/treetags.test @@ -171,7 +171,7 @@ test treetags-2.3 "Virtual events delivered to focus item" -body { test treetags-2.4 "Bad events" -body { $tv tag bind bad <Enter> { puts "Entered!" } -} -returnCodes 1 -result "unsupported event <Enter>*" -match glob +} -returnCodes error -result "unsupported event <Enter>*" -match glob test treetags-3.0 "tag configure - set" -body { $tv tag configure tag1 -foreground blue -background red diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index 522e3a8..8e31fe9 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -46,33 +46,33 @@ test treeview-1.1 "columns" -body { test treeview-1.2 "Bad columns" -body { #.tv configure -columns {illegal "list"value} ttk::treeview .badtv -columns {illegal "list"value} -} -returnCodes 1 -result "list element in quotes followed by*" -match glob +} -returnCodes error -result "list element in quotes followed by*" -match glob test treeview-1.3 "bad displaycolumns" -body { .tv configure -displaycolumns {a b d} -} -returnCodes 1 -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} -} -returnCodes 1 -result "Column index 3 out of bounds" +} -returnCodes error -result "Column index 3 out of bounds" test treeview-1.5 "Don't forget to check negative numbers" -body { .tv configure -displaycolumns {1 -2 3} -} -returnCodes 1 -result "Column index -2 out of bounds" +} -returnCodes error -result "Column index -2 out of bounds" # Item creation. # test treeview-2.1 "insert -- not enough args" -body { .tv insert -} -returnCodes 1 -result "wrong # args: *" -match glob +} -returnCodes error -result "wrong # args: *" -match glob test treeview-2.3 "insert -- bad integer index" -body { .tv insert {} badindex -} -returnCodes 1 -result "expected integer *" -match glob +} -returnCodes error -result "expected integer *" -match glob test treeview-2.4 "insert -- bad parent node" -body { .tv insert badparent end -} -returnCodes 1 -result "Item badparent not found" -match glob +} -returnCodes error -result "Item badparent not found" -match glob test treeview-2.5 "insert -- finaly insert a node" -body { .tv insert {} end -id newnode -text "New node" @@ -84,7 +84,7 @@ test treeview-2.6 "insert -- make sure node was inserted" -body { test treeview-2.7 "insert -- prevent duplicate node names" -body { .tv insert {} end -id newnode -} -returnCodes 1 -result "Item newnode already exists" +} -returnCodes error -result "Item newnode already exists" test treeview-2.8 "insert -- new node at end" -body { .tv insert {} end -id lastnode @@ -126,7 +126,7 @@ test treeview-2.13 "insert -- one more at beginning" -body { test treeview-2.14 "insert -- bad options" -body { .tv insert {} end -badoption foo -} -returnCodes 1 -result {unknown option "-badoption"} +} -returnCodes error -result {unknown option "-badoption"} test treeview-2.15 "insert -- at position 0 w/no children" -body { .tv insert newnode 0 -id newnode.n2 -text "Foo" @@ -202,7 +202,7 @@ test treeview-3.11 "Can't detach root item" -body { .tv detach [list {}] update consistencyCheck .tv -} -returnCodes 1 -result "Cannot detach root item" +} -returnCodes error -result "Cannot detach root item" consistencyCheck .tv test treeview-3.12 "Reattach" -body { @@ -275,7 +275,7 @@ test treeview-4.3 "opened - closed node" -body { test treeview-5.1 "item -- error checks" -body { .tv item newnode -text "Bad values" -values "{bad}list" -} -returnCodes 1 -result "list element in braces followed by*" -match glob +} -returnCodes error -result "list element in braces followed by*" -match glob test treeview-5.2 "item -- error leaves options unchanged " -body { .tv item newnode -text @@ -298,11 +298,11 @@ test treeview-5.5 "set cell" -body { test treeview-5.6 "set illegal cell" -body { .tv set newnode #0 YYY -} -returnCodes 1 -result "Display column #0 cannot be set" +} -returnCodes error -result "Display column #0 cannot be set" test treeview-5.7 "set illegal cell" -body { .tv set newnode 3 YY ;# 3 == current #columns -} -returnCodes 1 -result "Column index 3 out of bounds" +} -returnCodes error -result "Column index 3 out of bounds" test treeview-5.8 "set display columns" -body { .tv configure -displaycolumns [list 2 1 0] @@ -318,7 +318,7 @@ test treeview-5.9 "display columns part 2" -body { test treeview-5.10 "cannot set column -id" -body { .tv column #1 -id X -} -returnCodes 1 -result "Attempt to change read-only option" +} -returnCodes error -result "Attempt to change read-only option" test treeview-5.11 "get" -body { .tv set newnode #1 @@ -406,7 +406,7 @@ test treeview-7.1 "move" -body { test treeview-7.2 "illegal move" -body { .tv move d d2 end -} -returnCodes 1 -result "Cannot insert d as descendant of d2" +} -returnCodes error -result "Cannot insert d as descendant of d2" test treeview-7.3 "illegal move has no effect" -body { consistencyCheck .tv @@ -427,7 +427,7 @@ test treeview-7.5 "replace children - precondition" -body { test treeview-7.6 "Replace children - illegal move" -body { .tv children newnode.n1 [list newnode.n1 newnode.n2 newnode.n3] -} -returnCodes 1 -result "Cannot insert newnode.n1 as descendant of newnode.n1" +} -returnCodes error -result "Cannot insert newnode.n1 as descendant of newnode.n1" consistencyCheck .tv @@ -458,7 +458,7 @@ test treeview-8.4 "Selection - clear" -body { test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo -} -returnCodes 1 -match glob -result {bad selection operation "badop": must be *} +} -returnCodes error -match glob -result {bad selection operation "badop": must be *} test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body { .tv selection set {} diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index ec1a3b6..fdd3eae 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -32,7 +32,7 @@ test ttk-6.1 "Self-destructing checkbutton" -body { trace variable sd w [list selfdestruct .sd] update .sd invoke -} -returnCodes 1 +} -returnCodes error test ttk-6.2 "Checkbutton self-destructed" -body { winfo exists .sd } -result 0 @@ -146,7 +146,7 @@ test ttk-1.2 "Check style" -body { test ttk-1.3 "Set bad style" -body { .t configure -style "nosuchstyle" -} -returnCodes 1 -result {Layout nosuchstyle not found} +} -returnCodes error -result {Layout nosuchstyle not found} test ttk-1.4 "Original style preserved" -body { .t cget -style @@ -235,11 +235,11 @@ foreach wc $widgetClasses { # misc. error detection test ttk-3.0 "Bad option" -body { ttk::button .bad -badoption foo -} -returnCodes 1 -result {unknown option "-badoption"} -match glob +} -returnCodes error -result {unknown option "-badoption"} -match glob test ttk-3.1 "Make sure widget command not created" -body { .bad state disabled -} -returnCodes 1 -result {invalid command name ".bad"} -match glob +} -returnCodes error -result {invalid command name ".bad"} -match glob test ttk-3.2 "Propagate errors from variable traces" -body { set A 0 @@ -252,7 +252,7 @@ test ttk-3.2 "Propagate errors from variable traces" -body { test ttk-3.3 "Constructor failure with cursor" -body { ttk::button .b -cursor bottom_right_corner -style BadStyle -} -returnCodes 1 -result "Layout BadStyle not found" +} -returnCodes error -result "Layout BadStyle not found" test ttk-3.4 "SF#2009213" -body { ttk::style configure TScale -sliderrelief {} @@ -388,12 +388,12 @@ test ttk-8.4 "ImageChanged" -body { test ttk-9.1 "Traces on nonexistant namespaces" -body { ttk::checkbutton .tcb -variable foo::bar -} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob +} -returnCodes error -result "*parent namespace doesn't exist*" -match glob test ttk-9.2 "Traces on nonexistant namespaces II" -body { ttk::checkbutton .tcb -variable X .tcb configure -variable foo::bar -} -returnCodes 1 -result "*parent namespace doesn't exist*" -match glob +} -returnCodes error -result "*parent namespace doesn't exist*" -match glob test ttk-9.3 "Restore saved options on configure error" -body { .tcb cget -variable @@ -458,7 +458,7 @@ test ttk-10.3 "Check class resource" -body { test ttk-10.4 "Try to modify class resource" -body { .f configure -class Bar -} -returnCodes 1 -match glob -result "*read-only option*" +} -returnCodes error -match glob -result "*read-only option*" test ttk-10.5 "Check class resource again" -body { .f cget -class @@ -548,14 +548,14 @@ test ttk-12.4 "-borderwidth frame option" -body { test ttk-13.1 "Custom styles -- bad -style option" -body { ttk::button .tb1 -style badstyle -} -returnCodes 1 -result "*badstyle not found*" -match glob +} -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.4 "Custom styles -- bad -style option" -body { ttk::button .tb1 .tb1 configure -style badstyle } -cleanup { destroy .tb1 -} -returnCodes 1 -result "*badstyle not found*" -match glob +} -returnCodes error -result "*badstyle not found*" -match glob test ttk-13.5 "Custom layouts -- missing element definition" -body { ttk::style layout badstyle { @@ -573,17 +573,17 @@ test ttk-13.5 "Custom layouts -- missing element definition" -body { test ttk-14.1 "-variable in nonexistant namespace" -body { ttk::checkbutton .tw -variable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.2 "-textvariable in nonexistant namespace" -body { ttk::label .tw -textvariable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-14.3 "-textvariable in nonexistant namespace" -body { ttk::entry .tw -textvariable ::nsn::foo -} -returnCodes 1 -result {can't trace *: parent namespace doesn't exist} \ +} -returnCodes error -result {can't trace *: parent namespace doesn't exist} \ -match glob -cleanup { destroy .tw } test ttk-15.1 {Bug 3062331} -setup { @@ -629,27 +629,27 @@ proc wrong#varargs {varpart args} { test ttk-ensemble-0 "style element create: insufficient args" -body { ttk::style -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs arg ttk::style option] test ttk-ensemble-1 "style element create: insufficient args" -body { ttk::style element -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs arg ttk::style element option] test ttk-ensemble-2 "style element create: insufficient args" -body { ttk::style element create -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs {-option value} ttk::style element create name type] test ttk-ensemble-3 "style element create: insufficient args" -body { ttk::style element create plain.background -} -returnCodes 1 -result \ +} -returnCodes error -result \ [wrong#varargs {-option value} ttk::style element create name type] test ttk-ensemble-4 "style element create: insufficient args" -body { ttk::style element create plain.background from -} -returnCodes 1 -result [wrong#args theme ?element?] +} -returnCodes error -result [wrong#args theme ?element?] test ttk-ensemble-5 "style element create: valid" -body { ttk::style element create plain.background from default diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 4372253..5d00ccf 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -11,6 +11,8 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ @@ -1086,7 +1088,7 @@ test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke widt } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { - unix notAqua + unix notAqua failsOnUbuntu } -setup { deleteWindows } -body { @@ -1188,9 +1190,9 @@ test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { - unix testembed notAqua + unix testembed notAqua } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1233,9 +1235,9 @@ test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constrain test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1249,9 +1251,9 @@ test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con deleteWindows } -result {150x80+0+0} test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { - unix + unix failsOnUbuntu } -setup { - deleteWindows + deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 @@ -1266,9 +1268,9 @@ test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -con } -result {70x300+0+0} test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { - unix + unix } -setup { - deleteWindows + deleteWindows } -body { toplevel .t pack [frame .t.f -container 1 -width 200 -height 200] -fill both @@ -1282,9 +1284,9 @@ test unixEmbed-11.1 {focus -force works for embedded toplevels} -constraints { deleteWindows } -result .embed test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints { - unix pressbutton + unix pressbutton } -setup { - deleteWindows + deleteWindows } -body { toplevel .main set result {} diff --git a/tests/unixFont.test b/tests/unixFont.test index 44e8f56..41afa6e 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -16,6 +16,9 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] +testConstraint failsOnUbuntuNoXft [expr {[testConstraint failsOnUbuntu] || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))}] + if {[tk windowingsystem] eq "x11"} { set xlsf [auto_execok xlsfonts] } @@ -69,7 +72,7 @@ proc getsize {} { test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" doesn't exist}} -test unixfont-1.2 {TkpGetNativeFont procedure: native} x11 { +test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} { font measure fixed 0 } 6 @@ -78,21 +81,21 @@ test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 { set x {} } {} test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \ - {x11 noExceed hasTimesNew} { + {x11 noExceed hasTimesNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Times New Roman"}] 1] lappend x [lindex [font actual {-family "New York"}] 1] lappend x [lindex [font actual {-family "Times"}] 1] } {times times times} test unixfont-2.3 {TkpGetFontFromAttributes procedure: Courier relatives} \ - {x11 noExceed hasCourierNew} { + {x11 noExceed hasCourierNew failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Courier New"}] 1] lappend x [lindex [font actual {-family "Monaco"}] 1] lappend x [lindex [font actual {-family "Courier"}] 1] } {courier courier courier} test unixfont-2.4 {TkpGetFontFromAttributes procedure: Helvetica relatives} \ - {x11 noExceed hasArial} { + {x11 noExceed hasArial failsOnUbuntu} { set x {} lappend x [lindex [font actual {-family "Arial"}] 1] lappend x [lindex [font actual {-family "Geneva"}] 1] @@ -102,19 +105,19 @@ test unixfont-2.5 {TkpGetFontFromAttributes procedure: fallback} x11 { font actual {-xyz-xyz-*-*-*-*-*-*-*-*-*-*-*-*} set x {} } {} -test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} x11 { +test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 10}] 1 } {fixed} test unixfont-2.7 {TkpGetFontFromAttributes: fixed family not available!} x11 { # no test available } {} -test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} x11 { +test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 failsOnUbuntu} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} -test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed} { +test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { lindex [font actual {-family courier}] 1 } {courier} -test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} x11 { +test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 failsOnUbuntuNoXft} { lindex [font actual {-family courier -size 37}] 3 } 37 test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { @@ -166,11 +169,11 @@ test unixfont-5.7 {Tk_MeasureChars procedure: already saw space in line} x11 { .b.l config -text "000000 00000" getsize } "[expr $ax*6] [expr $ay*2]" -test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} x11 { +test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} {x11 failsOnUbuntu} { .b.l config -text "00 000 00000" getsize } "[expr $ax*7] [expr $ay*2]" -test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} x11 { +test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 @@ -186,7 +189,7 @@ test unixfont-5.11 {Tk_MeasureChars: TK_AT_LEAST_ONE + not even one char fit!} x .b.l config -wrap $a set x } "$ax [expr $ay*6]" -test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} x11 { +test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} {x11 failsOnUbuntu} { .b.l config -text "000 \n000" getsize } "[expr $ax*6] [expr $ay*2]" @@ -253,7 +256,7 @@ test unixfont-8.3 {AllocFont procedure: can't parse info from name} x11 { catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} -test unixfont-8.4 {AllocFont procedure: classify characters} x11 { +test unixfont-8.4 {AllocFont procedure: classify characters} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\u4000"] ;# 6 incr x [font measure $courier "\002"] ;# 4 @@ -264,7 +267,7 @@ test unixfont-8.4 {AllocFont procedure: classify characters} x11 { test unixfont-8.5 {AllocFont procedure: setup widths of normal chars} x11 { font metrics $courier -fixed } 1 -test unixfont-8.6 {AllocFont procedure: setup widths of special chars} x11 { +test unixfont-8.6 {AllocFont procedure: setup widths of special chars} {x11 failsOnUbuntu} { set x 0 incr x [font measure $courier "\001"] ;# 4 incr x [font measure $courier "\002"] ;# 4 @@ -292,7 +295,7 @@ test unixfont-8.11 {AllocFont procedure: XA_UNDERLINE_POSITION was 0} x11 { set x {} } {} -test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { +test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} @@ -301,7 +304,7 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} x11 { lappend x [.b.c index $t @[expr $ax*2],0] lappend x [.b.c index $t @[expr $ax*3],0] } {0 1 1 2} -test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} x11 { +test unixfont-9.2 {GetControlCharSubst procedure: 4 chars subst} {x11 failsOnUbuntu} { .b.c dchars $t 0 end .b.c insert $t 0 "0\0010" set x {} diff --git a/tests/unixSelect.test b/tests/unixSelect.test index d3da806..9bb90cb 100644 --- a/tests/unixSelect.test +++ b/tests/unixSelect.test @@ -115,7 +115,7 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints } -body { pack [entry .e] update - .e insert 0 \u00fcber + .e insert 0 \xFCber .e selection range 0 end dobg {string length [selection get]} } -cleanup { @@ -131,13 +131,13 @@ test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} - dobg { pack [entry .e] update - .e insert 0 \u00fc\u0444 + .e insert 0 \xFC\u0444 .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result \u00fc? +} -result \xFC? test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -constraints { x11 @@ -148,11 +148,11 @@ test unixSelect-1.3 {TkSelGetSelection procedure: simple i18n text, iso2022} -co selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue \u00fc\u0444 + set selValue \xFC\u0444 set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] - list [string equal \u00fc\u0444 $x] [string length $x] + list [string equal \xFC\u0444 $x] [string length $x] }] lappend result $selInfo } -cleanup { @@ -172,12 +172,12 @@ test unixSelect-1.4 {TkSelGetSelection procedure: INCR i18n text, iso2022} -cons selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue [string repeat x 3999]\u00fc\u0444[string repeat x 3999] + set selValue [string repeat x 3999]\xFC\u0444[string repeat x 3999] set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] list [string equal \ - [string repeat x 3999]\u00fc\u0444[string repeat x 3999] $x] \ + [string repeat x 3999]\xFC\u0444[string repeat x 3999] $x] \ [string length $x] }] lappend result $selInfo @@ -194,11 +194,11 @@ test unixSelect-1.5 {TkSelGetSelection procedure: simple i18n text, iso2022} -co selection handle -type COMPOUND_TEXT -format COMPOUND_TEXT . \ {handler COMPOUND_TEXT} selection own . - set selValue \u00fc\u0444 + set selValue \xFC\u0444 set selInfo {} set result [dobg { set x [selection get -type COMPOUND_TEXT] - list [string equal \u00fc\u0444 $x] [string length $x] + list [string equal \xFC\u0444 $x] [string length $x] }] lappend result $selInfo } -cleanup { @@ -211,7 +211,7 @@ test unixSelect-1.6 {TkSelGetSelection procedure: INCR i18n text} -constraints { setupbg } -body { dobg [subst -nobackslashes {entry .e; pack .e; update - .e insert 0 \u00fcber$longValue + .e insert 0 \xFCber$longValue .e selection range 0 end}] string length [selection get] } -cleanup { @@ -226,13 +226,13 @@ test unixSelect-1.7 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc + .e insert 0 [string repeat x 3999]\xFC .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc +} -result [string repeat x 3999]\xFC test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints { x11 @@ -242,13 +242,13 @@ test unixSelect-1.8 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 \u00fc[string repeat x 3999] + .e insert 0 \xFC[string repeat x 3999] .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result \u00fc[string repeat x 3999] +} -result \xFC[string repeat x 3999] test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints { x11 @@ -258,13 +258,13 @@ test unixSelect-1.9 {TkSelGetSelection procedure: INCR i18n text} -constraints { dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000] + .e insert 0 [string repeat x 3999]\xFC[string repeat x 4000] .e selection range 0 end } selection get } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc[string repeat x 4000] +} -result [string repeat x 3999]\xFC[string repeat x 4000] # Now some tests to make sure that the right thing is done when # transferring UTF8 selections, to prevent [Bug 614650] and its ilk # from rearing its ugly head again. @@ -277,13 +277,13 @@ test unixSelect-1.10 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc + .e insert 0 [string repeat x 3999]\xFC .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc +} -result [string repeat x 3999]\xFC test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -293,13 +293,13 @@ test unixSelect-1.11 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 \u00fc[string repeat x 3999] + .e insert 0 \xFC[string repeat x 3999] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result \u00fc[string repeat x 3999] +} -result \xFC[string repeat x 3999] test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -309,13 +309,13 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat x 3999]\u00fc[string repeat x 4000] + .e insert 0 [string repeat x 3999]\xFC[string repeat x 4000] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat x 3999]\u00fc[string repeat x 4000] +} -result [string repeat x 3999]\xFC[string repeat x 4000] test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints { x11 @@ -325,7 +325,7 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con } -body { pack [entry .e] update - .e insert 0 \u00fcber\u0444 + .e insert 0 \xFCber\u0444 .e selection range 0 end dobg {string length [selection get -type UTF8_STRING]} } -cleanup { @@ -341,13 +341,13 @@ test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -con dobg { pack [entry .e] update - .e insert 0 \u00fc\u0444 + .e insert 0 \xFC\u0444 .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result \u00fc\u0444 +} -result \xFC\u0444 test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -357,13 +357,13 @@ test unixSelect-1.15 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 [string repeat [string repeat \u00c4\u00e4 50]\n 21] + .e insert 0 [string repeat [string repeat \xC4\xE4 50]\n 21] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result [string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -373,13 +373,13 @@ test unixSelect-1.16 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [entry .e] update - .e insert 0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21] + .e insert 0 i[string repeat [string repeat \xC4\xE4 50]\n 21] .e selection range 0 end } selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result i[string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -389,7 +389,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [text .t] update - .t insert 1.0 [string repeat [string repeat \u00c4\u00e4 50]\n 21] + .t insert 1.0 [string repeat [string repeat \xC4\xE4 50]\n 21] # Has to be selected in a separate stage .t tag add sel 1.0 21.end+1c } @@ -397,7 +397,7 @@ test unixSelect-1.17 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result [string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result [string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -constraints { x11 @@ -407,7 +407,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const dobg { pack [text .t] update - .t insert 1.0 i[string repeat [string repeat \u00c4\u00e4 50]\n 21] + .t insert 1.0 i[string repeat [string repeat \xC4\xE4 50]\n 21] # Has to be selected in a separate stage .t tag add sel 1.0 21.end+1c } @@ -415,7 +415,7 @@ test unixSelect-1.18 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const selection get -type UTF8_STRING } -cleanup { cleanupbg -} -result i[string repeat [string repeat \u00c4\u00e4 50]\n 21] +} -result i[string repeat [string repeat \xC4\xE4 50]\n 21] test unixSelect-1.19 {Automatic UTF8_STRING support for selection handle} -constraints { unix diff --git a/tests/unixWm.test b/tests/unixWm.test index dbb0ea4..b2b91b7 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,6 +13,8 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + proc sleep ms { global x after $ms {set x 1} @@ -287,7 +289,7 @@ test unixWm-8.3 {icon windows} unix { toplevel .t -width 100 -height 30 list [catch {wm iconwindow .t b c} msg] $msg } {1 {wrong # args: should be "wm iconwindow window ?pathName?"}} -test unixWm-8.4 {icon windows} unix { +test unixWm-8.4 {icon windows} {unix failsOnUbuntu} { destroy .t destroy .icon toplevel .t -width 100 -height 30 @@ -632,7 +634,7 @@ test unixWm-16.2 {Tk_WmCmd procedure, "deiconify" option} unix { destroy .icon set result } {1 {can't deiconify .icon: it is an icon for .t}} -test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} unix { +test unixWm-16.3 {Tk_WmCmd procedure, "deiconify" option} {unix failsOnUbuntu} { wm iconify .t set result {} lappend result [winfo ismapped .t] [wm state .t] @@ -851,7 +853,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } {1 {can't iconify ".t2": it is an icon for ".t"}} -test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 +0+0 @@ -862,7 +864,7 @@ test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 set result } 0 -test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} unix { +test unixWm-23.6 {Tk_WmCmd procedure, "iconify" option} {unix failsOnUbuntu} { destroy .t2 toplevel .t2 wm geom .t2 -0+0 @@ -1433,7 +1435,7 @@ test unixWm-41.4 {ConfigureEvent procedure, synthesized Configure events} unix { # No tests for ReparentEvent or ComputeReparentGeometry; I can't figure # out how to exercise these procedures reliably. -test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix { +test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} {unix failsOnUbuntu} { destroy .t toplevel .t -width 400 -height 150 wm geometry .t +0+0 @@ -1610,7 +1612,7 @@ test unixWm-45.1 {UpdateSizeHints procedure, grid information} {unix testwrapper [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {40 30 320 210 10 5} -test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper} { +test unixWm-45.2 {UpdateSizeHints procedure} {unix testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 wm minsize .t 30 40 @@ -1638,7 +1640,7 @@ test unixWm-45.3 {UpdateSizeHints procedure, grid with menu} {testmenubar testwr [expr [lindex $property 7]] [expr [lindex $property 8]] \ [expr [lindex $property 9]] [expr [lindex $property 10]] } {60 40 53 320 233 10 5} -test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper} { +test unixWm-45.4 {UpdateSizeHints procedure, not resizable with menu} {testmenubar testwrapper failsOnUbuntu} { destroy .t toplevel .t -width 80 -height 60 frame .t.menu -height 23 -width 50 @@ -1792,7 +1794,7 @@ if {[tk windowingsystem] == "aqua"} { # Windows are assumed to have a border (invisible in Gnome 3). set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t} } -test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} unix { +test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} {unix failsOnUbuntu} { update toplevel .t -width 300 -height 400 -bg green wm geom .t +100+100 @@ -1957,7 +1959,7 @@ test unixWm-50.8 {Tk_CoordsToWindow procedure, more basics} unix { [winfo containing [expr $x + 350] $y] \ [winfo containing [expr $x + 450] $y] } {.t .t.f .t.f.f .t {}} -test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} unix { +test unixWm-50.9 {Tk_CoordsToWindow procedure, unmapped windows} {unix failsOnUbuntu} { destroy .t destroy .t2 toplevel .t -width 200 -height 200 -bg green diff --git a/tests/winClipboard.test b/tests/winClipboard.test index 2f72966..45bf484 100644 --- a/tests/winClipboard.test +++ b/tests/winClipboard.test @@ -70,12 +70,12 @@ test winClipboard-1.5 {TkSelGetSelection & TkWinClipboardRender} -constraints { clipboard clear } -body { set map [list "\r" "\\r" "\n" "\\n"] - clipboard append "line 1\u00c7\nline 2" + clipboard append "line 1\xC7\nline 2" list [string map $map [selection get -selection CLIPBOARD]]\ [string map $map [testclipboard]] } -cleanup { clipboard clear -} -result [list "line 1\u00c7\\nline 2" "line 1\u00c7\\nline 2"] +} -result [list "line 1\xC7\\nline 2" "line 1\xC7\\nline 2"] test winClipboard-1.6 {TkSelGetSelection & TkWinClipboardRender} -constraints { win testclipboard diff --git a/tests/winDialog.test b/tests/winDialog.test index 280d69e..abb3a8e 100755 --- a/tests/winDialog.test +++ b/tests/winDialog.test @@ -545,7 +545,7 @@ test winDialog-5.12.3 {tk_getSaveFile: initial directory: .} -constraints { test winDialog-5.12.4 {tk_getSaveFile: initial directory: unicode} -constraints { nt testwinevent } -body { - set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"] + set dir [tcltest::makeDirectory "\u0167\xE9\u015d\u0167"] unset -nocomplain x start {set x [tk_getSaveFile \ -initialdir $dir \ @@ -631,7 +631,7 @@ test winDialog-5.12.8 {tk_getOpenFile: initial directory: .} -constraints { test winDialog-5.12.9 {tk_getOpenFile: initial directory: unicode} -constraints { nt testwinevent } -body { - set dir [tcltest::makeDirectory "\u0167\u00e9\u015d\u0167"] + set dir [tcltest::makeDirectory "\u0167\xE9\u015d\u0167"] set path [tcltest::makeFile "" testfile $dir] unset -nocomplain x start {set x [tk_getOpenFile \ diff --git a/tests/winMsgbox.test b/tests/winMsgbox.test index 0181103..447a2f6 100644 --- a/tests/winMsgbox.test +++ b/tests/winMsgbox.test @@ -224,14 +224,14 @@ test winMsgbox-2.3 {tk_messageBox message (unicode)} -constraints { } -body { global windowInfo set title "winMsgbox-2.2 [pid]" - set message "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446" + set message "\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446" after 100 [list GetWindowInfo $title 2] set r [tk_messageBox -type ok -title $title -message $message] array set info $windowInfo lappend r $info(childtext) } -cleanup { wm deiconify . -} -result [list ok "\u041f\u043e\u0438\u0441\u043a\u0020\u0441\u0442\u0440\u0430\u043d\u0438\u0446"] +} -result [list ok "\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446"] test winMsgbox-2.4 {tk_messageBox message (empty)} -constraints { win getwindowinfo diff --git a/tests/winfo.test b/tests/winfo.test index d39359b..13193ef 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -11,6 +11,8 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. @@ -291,7 +293,7 @@ test winfo-9.2 {"winfo viewable" command} -body { test winfo-9.3 {"winfo viewable" command} -body { winfo viewable . } -result 1 -test winfo-9.4 {"winfo viewable" command} -body { +test winfo-9.4 {"winfo viewable" command} -constraints failsOnUbuntu -body { wm iconify . winfo viewable . } -cleanup { @@ -320,7 +322,7 @@ test winfo-9.6 {"winfo viewable" command} -setup { } -cleanup { deleteWindows } -result {0 0} -test winfo-9.7 {"winfo viewable" command} -setup { +test winfo-9.7 {"winfo viewable" command} -constraints failsOnUbuntu -setup { deleteWindows } -body { frame .f1 -width 100 -height 100 -relief raised -bd 2 diff --git a/tests/wm.test b/tests/wm.test index 6d5e73b..d5bc733 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -27,6 +27,8 @@ proc stdWindow {} { update } +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # [raise] and [lower] may return before the window manager has completed the # operation. The raiseDelay procedure idles for a while to give the operation # a chance to complete. @@ -807,7 +809,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { destroy .t2 .r.f } -result {can't iconify ".t2": it is an embedded window} -test wm-iconify-3.1 {iconify behavior} -body { +test wm-iconify-3.1 {iconify behavior} -constraints failsOnUbuntu -body { toplevel .t2 wm geom .t2 -0+0 update idletasks @@ -1415,7 +1417,7 @@ test wm-stackorder-2.7 {stacking order: no children returns self} -setup { deleteWindows -test wm-stackorder-3.1 {unmapped toplevel} -body { +test wm-stackorder-3.1 {unmapped toplevel} -constraints failsOnUbuntu -body { toplevel .t1 ; update toplevel .t2 ; update wm iconify .t1 @@ -1525,7 +1527,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel on unix} -constraints x11 -body { + overrideredirect toplevel on unix} -constraints {x11 failsOnUbuntu} -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 @@ -1724,7 +1726,7 @@ test wm-transient-3.3 {withdraw/deiconify on the toplevel } -result {withdrawn 0 normal 1} test wm-transient-4.1 {transient toplevel is withdrawn - when mapped if toplevel is iconic} -body { + when mapped if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top wm iconify .top update @@ -1736,7 +1738,7 @@ test wm-transient-4.1 {transient toplevel is withdrawn deleteWindows } -result {withdrawn 0} test wm-transient-4.2 {already mapped transient toplevel - is withdrawn if toplevel is iconic} -body { + is withdrawn if toplevel is iconic} -constraints failsOnUbuntu -body { toplevel .top raiseDelay wm iconify .top @@ -1750,7 +1752,7 @@ test wm-transient-4.2 {already mapped transient toplevel deleteWindows } -result {withdrawn 0} test wm-transient-4.3 {iconify/deiconify on the toplevel - does a withdraw/deiconify on the transient} -setup { + does a withdraw/deiconify on the transient} -constraints failsOnUbuntu -setup { set results [list] } -body { toplevel .top @@ -1926,7 +1928,7 @@ test wm-transient-7.5 {Reassign transient, destroy transient} -body { deleteWindows } -test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -setup { +test wm-transient-8.1 {transient to withdrawn window, Bug 1163496} -constraints failsOnUbuntu -setup { deleteWindows set result {} } -body { @@ -2003,7 +2005,7 @@ test wm-state-2.7 {state change before map} -body { } -cleanup { deleteWindows } -result {iconic} -test wm-state-2.8 {state change after map} -body { +test wm-state-2.8 {state change after map} -constraints failsOnUbuntu -body { toplevel .t update wm state .t iconic @@ -2011,7 +2013,7 @@ test wm-state-2.8 {state change after map} -body { } -cleanup { deleteWindows } -result {iconic} -test wm-state-2.9 {state change after map} -body { +test wm-state-2.9 {state change after map} -constraints failsOnUbuntu -body { toplevel .t update wm iconify .t diff --git a/unix/tkUnix.c b/unix/tkUnix.c index df70cb0..633b057 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.c @@ -16,7 +16,7 @@ # include <X11/extensions/scrnsaver.h> # ifdef __APPLE__ /* Support for weak-linked libXss. */ -# define HaveXSSLibrary() (XScreenSaverQueryInfo != NULL) +# define HaveXSSLibrary() (&XScreenSaverQueryInfo != NULL) # else /* Other platforms always link libXss. */ # define HaveXSSLibrary() (1) diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index 347c9d8..7aca5d6 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -173,4 +173,10 @@ sprintf((buf), "%#08lx", (unsigned long) (w)) #endif +/* + * Used by tkWindow.c + */ + +#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) + #endif /* _UNIXPORT */ diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 8df19ed..0118608 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -125,6 +125,12 @@ | ((p)->green & 0xff00) | (((p)->blue << 8) & 0xff0000)) | 0x20000000) /* + * Used by tkWindow.c + */ + +#define TkpHandleMapOrUnmap(tkwin, event) Tk_HandleEvent(event) + +/* * These calls implement native bitmaps which are not currently * supported under Windows. The macros eliminate the calls. */ diff --git a/win/tkWinX.c b/win/tkWinX.c index 661ad29..f60823b 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -349,12 +349,12 @@ TkWinGetPlatformTheme(void) * TK_THEME_WIN_CLASSIC could be set even when running under XP if the * windows classic theme was selected. */ - if ((os.dwMajorVersion == 5) && (os.dwMinorVersion == 1)) { + if (os.dwMajorVersion == 5 && os.dwMinorVersion >= 1) { HKEY hKey; LPCWSTR szSubKey = L"Control Panel\\Appearance"; LPCWSTR szCurrent = L"Current"; DWORD dwSize = 200; - char pBuffer[200]; + WCHAR pBuffer[200]; memset(pBuffer, 0, dwSize); if (RegOpenKeyExW(HKEY_CURRENT_USER, szSubKey, 0L, @@ -363,7 +363,7 @@ TkWinGetPlatformTheme(void) } else { RegQueryValueExW(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize); RegCloseKey(hKey); - if (strcmp(pBuffer, "Windows Standard") == 0) { + if (wcscmp(pBuffer, L"Windows Standard") == 0) { tkWinTheme = TK_THEME_WIN_CLASSIC; } else { tkWinTheme = TK_THEME_WIN_XP; |