diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-28 15:56:15 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-28 15:56:15 (GMT) |
commit | f229cc87ab8e94200976b0233cfe07e5887cea49 (patch) | |
tree | 014c5605c2a3b2bf2bd674fc16dedc7991044f81 | |
parent | 4c618fd442a429c9c2ee4ab1c5ae13fe716eea30 (diff) | |
parent | fd3ac0319439e3de2d7f6e97705fb1af1d66cdc4 (diff) | |
download | tk-f229cc87ab8e94200976b0233cfe07e5887cea49.zip tk-f229cc87ab8e94200976b0233cfe07e5887cea49.tar.gz tk-f229cc87ab8e94200976b0233cfe07e5887cea49.tar.bz2 |
Merge trunk
36 files changed, 349 insertions, 242 deletions
diff --git a/.travis.yml b/.travis.yml index fa7f58a..b8ba8d4 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 @@ -19,7 +21,7 @@ addons: - xquartz jobs: include: -# Testing on Linux with various compilers +# Testing on Linux GCC - name: "Linux/GCC/Shared" os: linux dist: focal @@ -31,7 +33,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 @@ -105,29 +111,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" @@ -136,13 +128,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 @@ -178,21 +168,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" @@ -200,27 +190,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" @@ -228,37 +218,27 @@ 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: - homebrew: - packages: - - tcl-tk - update: true 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 9/Shared" + - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 - addons: - homebrew: - packages: - - tcl-tk - update: true 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.13" @@ -298,8 +278,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/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/tkGrid.c b/generic/tkGrid.c index 067407a..51b9512 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -3361,7 +3361,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 468ea18..ac3667b 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/tkPack.c b/generic/tkPack.c index d73de4a..00597b3 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1821,7 +1821,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/tkPlace.c b/generic/tkPlace.c index 01386a2..7625362 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -702,7 +702,7 @@ ConfigureContent( */ for (container = (TkWindow *)tkwin; container != NULL; - container = (TkWindow *)TkGetGeomMaster(container)) { + container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put \"%s\" inside \"%s\": would cause management loop", 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..964f60f 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -290,13 +290,17 @@ TkTextImageCmd( (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } - Tcl_WrongNumArgs(interp, 3, objv, NULL); + if (resultObj == NULL) { + return TCL_ERROR; + } else { + Tcl_SetObjResult(interp, resultObj); + return TCL_OK; + } break; } default: Tcl_Panic("unexpected switch fallthrough"); } - return TCL_ERROR; } /* 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/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/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..1a7ce39 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -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++) { 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/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/pack.test b/tests/pack.test index 5c919ed..02008c7 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. @@ -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/place.test b/tests/place.test index e811b1a..3ef1de7 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 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/textDisp.test b/tests/textDisp.test index a5fe324..4b85646 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -109,6 +109,8 @@ wm positionfrom . user wm deiconify . updateText +testConstraint failsOnUbuntu [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match linux $::env(TRAVIS_OS_NAME)]}] + # Some window managers (like olwm under SunOS 4.1.3) misbehave in a way # that tends to march windows off the top and left of the screen. If # this happens, some tests will fail because parts of the window will @@ -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} { @@ -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/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 2e49b27..75d11e7 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -124,7 +124,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/wm.test b/tests/wm.test index 6d5e73b..4c0da3e 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 @@ -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/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. */ |