summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2019-05-21 18:29:39 (GMT)
committerculler <culler>2019-05-21 18:29:39 (GMT)
commit98be79b4923b0a5ad357ec4aea70ba4e96317ef7 (patch)
treef5f492e1002efd196b35f0411275293d9092088f
parente6a53ee519d926aee00a2a2d3288878f59fe4cac (diff)
downloadtk-98be79b4923b0a5ad357ec4aea70ba4e96317ef7.zip
tk-98be79b4923b0a5ad357ec4aea70ba4e96317ef7.tar.gz
tk-98be79b4923b0a5ad357ec4aea70ba4e96317ef7.tar.bz2
On OSX 10.13 and earlier a different strategy is needed.
-rw-r--r--generic/tkTest.c6
-rw-r--r--macosx/tkMacOSXInt.h2
-rw-r--r--macosx/tkMacOSXTest.c29
-rw-r--r--tests/canvImg.test8
-rw-r--r--tests/image.test8
5 files changed, 30 insertions, 23 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 1303593..c1377d1 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define APP_IS_DRAWING TkTestAppIsDrawing()
+#define LOG_DISPLAY TkTestLogDisplay()
#else
-#define APP_IS_DRAWING 1
+#define LOG_DISPLAY 1
#endif
#ifdef __UNIX__
@@ -1581,7 +1581,7 @@ ImageDisplay(
* not just the changed portion. Tests must account for this.
*/
- if (APP_IS_DRAWING) {
+ if (LOG_DISPLAY) {
sprintf(buffer, "%s display %d %d %d %d",
instPtr->masterPtr->imageName, imageX, imageY, width, height);
Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 22d7d2c..9cb75d2 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -202,7 +202,7 @@ MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
MODULE_SCOPE Bool TkpAppIsDrawing(void);
MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin);
-MODULE_SCOPE Bool TkTestAppIsDrawing(void);
+MODULE_SCOPE Bool TkTestLogDisplay(void);
MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);
/*
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 9192fd6..eabc14e 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -90,18 +90,21 @@ DebuggerObjCmd(
/*
*----------------------------------------------------------------------
*
- * TkTestAppIsDrawing --
- *
- * A test widget display procedure which records calls can use this to
- * detect whether it is being called from within [NSView drawRect].
- * If so, it probably should not be recording the call since it was
- * probably generated spontaneously by the window manager rather than
- * by an explicit call to update. This is just a wrapper for the NSApp
- * property.
+ * TkTestLogDisplay --
*
+ * The test image display procedure calls this to determine whether it
+ * should write a log message recording that it has being run. On OSX
+ * 10.14 and later, only calls to the display procedure which occur inside
+ * of the drawRect method should be logged, since those are the only ones
+ * which actually draw anything. On earlier systems the opposite is true.
+ * The calls from within the drawRect method are redundant, since the
+ * first time the display procedure is run it will do the drawing and that
+ * first call will usually not occur inside of drawRect.
*
* Results:
- * Returns true if and only if called from within [NSView drawRect].
+ * On OSX 10.14 and later, returns true if and only if called from
+ * within [NSView drawRect]. On earlier systems returns false if
+ * and only if called from with [NSView drawRect].
*
* Side effects:
* None
@@ -109,8 +112,12 @@ DebuggerObjCmd(
*----------------------------------------------------------------------
*/
MODULE_SCOPE Bool
-TkTestAppIsDrawing(void) {
- return [NSApp isDrawing];
+TkTestLogDisplay(void) {
+ if ([NSApp macMinorVersion] >= 14) {
+ return [NSApp isDrawing];
+ } else {
+ return ![NSApp isDrawing];
+ }
}
diff --git a/tests/canvImg.test b/tests/canvImg.test
index f2bea27..c28eb5b 100644
--- a/tests/canvImg.test
+++ b/tests/canvImg.test
@@ -721,8 +721,8 @@ test canvImg-9.1 {DisplayImage procedure} -constraints testImageType -setup {
image delete foo
} -result {75 150 105 165}
-if {[tk windowingsystem] == "aqua"} {
- # Aqua will redraw the entire image if the redraw occurs in drawRect.
+if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
+ # Aqua >= 10.14 will redraw the entire image.
set result_10_1 {{foo display 0 0 30 15}}
} else {
set result_10_1 {{foo display 2 4 6 8}}
@@ -773,8 +773,8 @@ test canvImg-11.2 {ImageChangedProc procedure} -constraints {
.c delete all
image delete foo
} -result {30 75 70 125}
-if {[tk windowingsystem] == "aqua"} {
- # Aqua will redraw the entire image if the redraw occurs in drawRect.
+if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
+ # Aqua >= 10.14 will redraw the entire image.
set result_11_3 {{foo2 display 0 0 80 60}}
} else {
set result_11_3 {{foo2 display 0 0 20 40}}
diff --git a/tests/image.test b/tests/image.test
index 7744465..28adba3 100644
--- a/tests/image.test
+++ b/tests/image.test
@@ -363,8 +363,8 @@ test image-8.1 {Tk_ImageCmd procedure, "inuse" option} -constraints {
catch {destroy .b}
} -result [list 0 1]
-if {[tk windowingsystem] == "aqua"} {
- # Aqua will redraw the entire image if the redraw occurs in drawRect.
+if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
+ # Aqua >= 10.14 will redraw the entire image in drawRect.
set result_9_1 {{foo display 0 0 30 15}}
} else {
set result_9_1 {{foo display 5 6 7 8}}
@@ -385,8 +385,8 @@ test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
.c delete all
imageCleanup
} -result $result_9_1
-if {[tk windowingsystem] == "aqua"} {
- # Aqua will redraw the entire image if the redraw occurs in drawRect.
+if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
+ # Aqua >= 10.14 will redraw the entire image.
set result_9_2 {{foo display 0 0 30 15} {foo display 0 0 30 15}}
} else {
set result_9_2 {{foo display 5 6 25 9} {foo display 0 0 12 14}}