diff options
author | culler <culler> | 2018-11-14 13:26:43 (GMT) |
---|---|---|
committer | culler <culler> | 2018-11-14 13:26:43 (GMT) |
commit | 13080bd706087870892fd7275ef8df1693e26626 (patch) | |
tree | ecace5705e88bd8b99369843959710d553ce4f67 | |
parent | 29acee22500b4d937e6f46118f36635cdecd8f5e (diff) | |
parent | 00f20fd81a83e661ed54055ab50cbfbf2ab10fd3 (diff) | |
download | tk-13080bd706087870892fd7275ef8df1693e26626.zip tk-13080bd706087870892fd7275ef8df1693e26626.tar.gz tk-13080bd706087870892fd7275ef8df1693e26626.tar.bz2 |
Fix tests that were sporadically hanging or failing on macOS.
-rw-r--r-- | generic/tkImgPhInstance.c | 25 | ||||
-rw-r--r-- | tests/canvImg.test | 3 | ||||
-rw-r--r-- | tests/image.test | 2 | ||||
-rw-r--r-- | tests/text.test | 5 | ||||
-rw-r--r-- | tests/textWind.test | 6 |
5 files changed, 31 insertions, 10 deletions
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index fb106b1..0daca2f 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -19,6 +19,9 @@ */ #include "tkImgPhoto.h" +#ifdef MAC_OSX_TK +#define TKPUTIMAGE_CAN_BLEND +#endif /* * Declaration for internal Xlib function used here: @@ -30,7 +33,7 @@ extern int _XInitImageFuncPtrs(XImage *image); * Forward declarations */ -#ifndef MAC_OSX_TK +#ifndef TKPUTIMAGE_CAN_BLEND static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr, int xOffset, int yOffset, int width, int height); #endif @@ -411,7 +414,7 @@ TkImgPhotoGet( * *---------------------------------------------------------------------- */ -#ifndef MAC_OSX_TK +#ifndef TKPUTIMAGE_CAN_BLEND #ifndef _WIN32 #define GetRValue(rgb) (UCHAR(((rgb) & red_mask) >> red_shift)) #define GetGValue(rgb) (UCHAR(((rgb) & green_mask) >> green_shift)) @@ -486,7 +489,7 @@ BlendComplexAlpha( * optimized. */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) +#if !defined(_WIN32) if (bgImg->depth < 24) { unsigned char red_mlen, green_mlen, blue_mlen; @@ -534,7 +537,7 @@ BlendComplexAlpha( } return; } -#endif /* !_WIN32 && !MAC_OSX_TK */ +#endif /* !_WIN32 */ for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; @@ -577,7 +580,7 @@ BlendComplexAlpha( } #undef ALPHA_BLEND } -#endif /* MAC_OSX_TK */ +#endif /* TKPUTIMAGE_CAN_BLEND */ /* *---------------------------------------------------------------------- @@ -609,8 +612,10 @@ TkImgPhotoDisplay( * to imageX and imageY. */ { PhotoInstance *instancePtr = clientData; +#ifndef TKPUTIMAGE_CAN_BLEND XVisualInfo visInfo = instancePtr->visualInfo; - +#endif + /* * If there's no pixmap, it means that an error occurred while creating * the image instance so it can't be displayed. @@ -620,14 +625,13 @@ TkImgPhotoDisplay( return; } -#ifdef MAC_OSX_TK +#ifdef TKPUTIMAGE_CAN_BLEND /* - * The Mac version of TkPutImage handles RGBA images directly. There is + * If TkPutImage can handle RGBA Ximages directly there is * no need to call XGetImage or to do the Porter-Duff compositing by hand. - * We just let the CG graphics library do it, using the graphics hardware. */ - unsigned char *rgbaPixels = instancePtr->masterPtr->pix32; + unsigned char *rgbaPixels = instancePtr->masterPtr->pix32; XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels, (unsigned int)instancePtr->width, (unsigned int)instancePtr->height, @@ -638,6 +642,7 @@ TkImgPhotoDisplay( photo->data = NULL; XDestroyImage(photo); #else + if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA) && visInfo.depth >= 15 && (visInfo.class == DirectColor || visInfo.class == TrueColor)) { diff --git a/tests/canvImg.test b/tests/canvImg.test index a609337..ea413bb 100644 --- a/tests/canvImg.test +++ b/tests/canvImg.test @@ -722,6 +722,7 @@ test canvImg-9.1 {DisplayImage procedure} -constraints testImageType -setup { test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup { .c delete all + update } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor nw @@ -737,6 +738,7 @@ test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup { test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup { .c delete all + update } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor nw @@ -768,6 +770,7 @@ test canvImg-11.3 {ImageChangedProc procedure} -constraints { testImageType } -setup { .c delete all + update } -body { image create test foo -variable x image create test foo2 -variable y diff --git a/tests/image.test b/tests/image.test index e2e602e..d4ea745 100644 --- a/tests/image.test +++ b/tests/image.test @@ -349,6 +349,7 @@ test image-8.1 {Tk_ImageCmd procedure, "inuse" option} -constraints { test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup { .c delete all imageCleanup + update } -body { image create test foo -variable x .c create image 50 50 -image foo @@ -364,6 +365,7 @@ test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup { test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup { .c delete all imageCleanup + update } -body { image create test foo -variable x .c create image 50 50 -image foo diff --git a/tests/text.test b/tests/text.test index 5eadeac..95e666a 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3021,6 +3021,7 @@ test text-11a.22 {TextWidgetCmd procedure, "sync" option with -command} -setup { set ::x 0 toplevel .top pack [text .top.yt] + update set content {} for {set i 1} {$i < 30} {incr i} { append content [string repeat "$i " 15] \n @@ -3047,6 +3048,7 @@ test text-11a.31 {"<<WidgetViewSync>>" event} -setup { } -body { toplevel .top pack [text .top.yt] + update set content {} for {set i 1} {$i < 300} {incr i} { append content [string repeat "$i " 15] \n @@ -3080,6 +3082,7 @@ test text-11a.41 {"sync" "pendingsync" and <<WidgetViewSync>>} -setup { set res {} toplevel .top pack [text .top.yt] + update set content {} for {set i 1} {$i < 300} {incr i} { append content [string repeat "$i " 50] \n @@ -6542,6 +6545,8 @@ test text-27.10 {TextEditCmd procedure, set modified flag} -body { test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup { text .t pack .t +# Make sure the Text is mapped before we start + update set ::retval {} } -body { bind .t <<Modified>> "lappend ::retval modified" diff --git a/tests/textWind.test b/tests/textWind.test index 5f0c9b0..e189663 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -947,6 +947,8 @@ test textWind-11.1 {EmbWinDisplayProc procedure, geometry transforms} -setup { destroy .f place forget .t pack .t +# Make sure the Text is mapped before we start + update } -body { .t insert 1.0 "Some sample text" pack forget .t @@ -965,6 +967,8 @@ test textWind-11.2 {EmbWinDisplayProc procedure, geometry transforms} -setup { destroy .t.f place forget .t pack .t +# Make sure the Text is mapped before we start + update } -body { .t insert 1.0 "Some sample text" pack forget .t @@ -984,6 +988,8 @@ test textWind-11.3 {EmbWinDisplayProc procedure, configuration optimization} -se destroy .f place forget .t pack .t +# Make sure the Text is mapped before we start + update } -body { .t insert 1.0 "Some sample text" frame .f -width 30 -height 20 -bg $color |