From 66a0174e321b7bb4d34c4dcd58d83588c7cd673d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Jan 2025 23:30:30 +0000 Subject: [PATCH 1/6] (cherry-pick): Fix [13ac26b35d]: wm iconbitmap does not correctly set the icon pixmap hint on macOS. Thanks to Serhiy Storchaka --- changes | 3 +++ macosx/tkMacOSXWm.c | 15 ++++++++------- tests/unixWm.test | 10 ++-------- tests/wm.test | 4 ++-- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/changes b/changes index 2d1290d49..9a917db45 100644 --- a/changes +++ b/changes @@ -8253,3 +8253,6 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) (emiliano) - Released 8.6.16, Dec 11, 2024 - https://core.tcl-lang.org/tk/ for details + +2025-01-03 (bug) [13ac26] wm iconbitmap does not correctly set the icon + pixmap hint on macOS (serhiy.storchaka) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 23268f9ba..3865299dc 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -2363,14 +2363,15 @@ WmIconbitmapCmd( TkMacOSXMakeRealWindowExist(winPtr); } if (WmSetAttribute(winPtr, TkMacOSXGetNSWindowForDrawable(winPtr->window), interp, - WMATT_TITLEPATH, objv[3]) == TCL_OK) { - if (!len) { - if (wmPtr->hints.icon_pixmap != None) { - Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); - wmPtr->hints.icon_pixmap = None; - } - wmPtr->hints.flags &= ~IconPixmapHint; + WMATT_TITLEPATH, objv[3]) != TCL_OK) { + return TCL_ERROR; + } + if (!len) { + if (wmPtr->hints.icon_pixmap != None) { + Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); + wmPtr->hints.icon_pixmap = None; } + wmPtr->hints.flags &= ~IconPixmapHint; } else { pixmap = Tk_GetBitmap(interp, (Tk_Window)winPtr, Tk_GetUid(str)); if (pixmap == None) { diff --git a/tests/unixWm.test b/tests/unixWm.test index fe0057d52..38178345d 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -826,15 +826,9 @@ test unixWm-22.2 {Tk_WmCmd procedure, "iconbitmap" option} {unix testwrapper} { WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} -if {[tk windowingsystem] eq "aqua"} { - set result_22_3 {0 {}} -} else { - set result_22_3 {1 {bitmap "bad-bitmap" not defined}} -} -test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \ -unix { +test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option} unix { list [catch {wm iconbitmap .t bad-bitmap} msg] $msg -} $result_22_3 +} {1 {bitmap "bad-bitmap" not defined}} test unixWm-23.1 {Tk_WmCmd procedure, "iconify" option} unix { list [catch {wm iconify .t 12} msg] $msg diff --git a/tests/wm.test b/tests/wm.test index 736a266b3..4eb0be776 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -738,11 +738,11 @@ test wm-iconbitmap-1.2.2 {usage} -constraints win -returnCodes error -body { test wm-iconbitmap-1.3 {usage} -constraints win -returnCodes error -body { wm iconbitmap .t 12 13 } -result {illegal option "12" must be "-default"} -test wm-iconbitmap-1.4 {usage} -constraints notAqua -returnCodes error -body { +test wm-iconbitmap-1.4 {usage} -returnCodes error -body { wm iconbitmap .t bad-bitmap } -result {bitmap "bad-bitmap" not defined} -test wm-iconbitmap-2.1 {setting and reading values} -constraints notAqua -setup { +test wm-iconbitmap-2.1 {setting and reading values} -setup { set result {} } -body { lappend result [wm iconbitmap .t] From 2edf7e4959ff36fbc92b6719a6f14b432d769026 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Jan 2025 23:35:54 +0000 Subject: [PATCH 2/6] Update "changes" --- changes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changes b/changes index 9a917db45..9c2936f1b 100644 --- a/changes +++ b/changes @@ -8254,5 +8254,8 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) - Released 8.6.16, Dec 11, 2024 - https://core.tcl-lang.org/tk/ for details +2024-12-19 (bug) [844c0b] Menu entry underline does not consider + activeborderwidth (vogel) + 2025-01-03 (bug) [13ac26] wm iconbitmap does not correctly set the icon pixmap hint on macOS (serhiy.storchaka) From 1137fda66394258250e392619aaf0b53c8828953 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 4 Jan 2025 22:58:19 +0000 Subject: [PATCH 3/6] (cherry-pick): Fix warning when building on Linux --- unix/tkUnixFont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 814e3ddd7..c45263085 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -262,7 +262,7 @@ static int UtfToUcs2beProc(void *clientData, const char*src, */ static XFontStruct * -XLoadQueryFontNoXError(Display *display, char *name) +XLoadQueryFontNoXError(Display *display, const char *name) { XFontStruct *fontStructPtr = NULL; Tk_ErrorHandler handler; From bfc48c0b3e0429024f0e7ce823140822f1796ad4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 Jan 2025 21:50:22 +0000 Subject: [PATCH 4/6] (cherry-pick): Merge branch less_tests_constraints --- .github/workflows/linux-build.yml | 6 +- .github/workflows/linux-with-tcl86-build.yml | 24 ++--- .github/workflows/linux-with-tcl9-build.yml | 24 ++--- macosx/tkMacOSXTest.c | 30 +++--- tests/bind.test | 6 +- tests/constraints.tcl | 95 ++++++++++++----- tests/font.test | 39 +++---- tests/fontchooser.test | 2 +- tests/frame.test | 4 +- tests/grab.test | 14 ++- tests/menu.test | 16 ++- tests/select.test | 2 +- tests/text.test | 2 +- tests/ttk/combobox.test | 2 +- tests/unixEmbed.test | 8 +- tests/unixFont.test | 104 +++++++++++-------- tests/unixSelect.test | 8 +- tests/unixWm.test | 2 +- 18 files changed, 221 insertions(+), 167 deletions(-) diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index 98fe4ca6e..05e407e98 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl 8.6 + - name: Checkout Tcl 8.7 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -139,7 +139,7 @@ jobs: uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl + - name: Checkout Tcl 8.7 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -147,7 +147,7 @@ jobs: path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev + sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev xfonts-75dpi xfonts-100dpi xfonts-scalable libxfont2 unifont mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV diff --git a/.github/workflows/linux-with-tcl86-build.yml b/.github/workflows/linux-with-tcl86-build.yml index ba8312537..06efb2b32 100644 --- a/.github/workflows/linux-with-tcl86-build.yml +++ b/.github/workflows/linux-with-tcl86-build.yml @@ -23,18 +23,18 @@ jobs: compiler: - "gcc" - "clang" - cfgopt: + config: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - - name: Checkout + - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl + - name: Checkout Tcl 8.6 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -51,9 +51,9 @@ jobs: echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV working-directory: "." env: - CFGOPT: ${{ matrix.cfgopt }} + CFGOPT: ${{ matrix.config }} COMPILER: ${{ matrix.compiler }} - OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }} + OPTS: ${{ matrix.compiler }}${{ matrix.config }} - name: Configure and Build Tcl run: | ./configure $CFGOPT "--prefix=$HOME/install dir" || { @@ -67,7 +67,7 @@ jobs: } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - - name: Configure (opts=${{ matrix.cfgopt }}) + - name: Configure (opts=${{ matrix.config }}) run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH --disable-zipfs "--prefix=$HOME/install dir" || { cat config.log @@ -110,16 +110,16 @@ jobs: matrix: compiler: - "gcc" - cfgopt: + config: - "" - "--disable-xft" - "--enable-symbols" steps: - - name: Checkout + - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl + - name: Checkout Tcl 8.6 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -127,14 +127,14 @@ jobs: path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev + sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev xfonts-75dpi xfonts-100dpi xfonts-scalable libxfont2 unifont mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: - CFGOPT: ${{ matrix.cfgopt }} + CFGOPT: ${{ matrix.config }} COMPILER: ${{ matrix.compiler }} - name: Configure and Build Tcl run: | @@ -149,7 +149,7 @@ jobs: } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - - name: Configure ${{ matrix.cfgopt }} + - name: Configure ${{ matrix.config }} run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log diff --git a/.github/workflows/linux-with-tcl9-build.yml b/.github/workflows/linux-with-tcl9-build.yml index 323b3143c..2398c943a 100644 --- a/.github/workflows/linux-with-tcl9-build.yml +++ b/.github/workflows/linux-with-tcl9-build.yml @@ -23,18 +23,18 @@ jobs: compiler: - "gcc" - "clang" - cfgopt: + config: - "" - "CFLAGS=-DTK_NO_DEPRECATED=1" - "--disable-xft" - "--disable-xss" - "--enable-symbols" steps: - - name: Checkout + - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl + - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -51,9 +51,9 @@ jobs: echo "BUILD_CONFIG_ID=$OPTS" >> $GITHUB_ENV working-directory: "." env: - CFGOPT: ${{ matrix.cfgopt }} + CFGOPT: ${{ matrix.config }} COMPILER: ${{ matrix.compiler }} - OPTS: ${{ matrix.compiler }}${{ matrix.cfgopt }} + OPTS: ${{ matrix.compiler }}${{ matrix.config }} - name: Configure and Build Tcl run: | ./configure $CFGOPT "--prefix=$HOME/install dir" || { @@ -67,7 +67,7 @@ jobs: } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - - name: Configure (opts=${{ matrix.cfgopt }}) + - name: Configure (opts=${{ matrix.config }}) run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log @@ -110,16 +110,16 @@ jobs: matrix: compiler: - "gcc" - cfgopt: + config: - "" - "--disable-xft" - "--enable-symbols" steps: - - name: Checkout + - name: Checkout Tk uses: actions/checkout@v4 with: path: tk - - name: Checkout Tcl + - name: Checkout Tcl 9.0 uses: actions/checkout@v4 with: repository: tcltk/tcl @@ -127,14 +127,14 @@ jobs: path: tcl - name: Setup Environment (compiler=${{ matrix.compiler }}) run: | - sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev + sudo apt-get install libxss-dev libxft-dev xvfb libicu-dev xfonts-75dpi xfonts-100dpi xfonts-scalable libxfont2 unifont mkdir "$HOME/install dir" touch tk/doc/man.macros tk/generic/tkStubInit.c echo "CFGOPT=$CFGOPT" >> $GITHUB_ENV echo "CC=$COMPILER" >> $GITHUB_ENV working-directory: "." env: - CFGOPT: ${{ matrix.cfgopt }} + CFGOPT: ${{ matrix.config }} COMPILER: ${{ matrix.compiler }} - name: Configure and Build Tcl run: | @@ -149,7 +149,7 @@ jobs: } echo "TCL_CONFIG_PATH=`pwd`" >> $GITHUB_ENV working-directory: tcl/unix - - name: Configure ${{ matrix.cfgopt }} + - name: Configure ${{ matrix.config }} run: | ./configure $CFGOPT --with-tcl=$TCL_CONFIG_PATH "--prefix=$HOME/install dir" || { cat config.log diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index 778ccd4a8..544707228 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -21,10 +21,10 @@ * Forward declarations of procedures defined later in this file: */ -static Tcl_ObjCmdProc PressButtonObjCmd; -static Tcl_ObjCmdProc MoveMouseObjCmd; -static Tcl_ObjCmdProc InjectKeyEventObjCmd; -static Tcl_ObjCmdProc MenuBarHeightObjCmd; +static Tcl_ObjCmdProc TestpressbuttonObjCmd; +static Tcl_ObjCmdProc TestmovemouseObjCmd; +static Tcl_ObjCmdProc TestinjectkeyeventObjCmd; +static Tcl_ObjCmdProc TestmenubarheightObjCmd; /* @@ -52,17 +52,17 @@ TkplatformtestInit( * Add commands for platform specific tests on MacOS here. */ - Tcl_CreateObjCommand(interp, "pressbutton", PressButtonObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "movemouse", MoveMouseObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "injectkeyevent", InjectKeyEventObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "menubarheight", MenuBarHeightObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testpressbutton", TestpressbuttonObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testmovemouse", TestmovemouseObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testinjectkeyevent", TestinjectkeyeventObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testmenubarheight", TestmenubarheightObjCmd, NULL, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * - * MenuBarHeightObjCmd -- + * TestmenubarheightObjCmd -- * * This procedure calls [NSMenu menuBarHeight] and returns the result * as an integer. Windows can never be placed to overlap the MenuBar, @@ -78,7 +78,7 @@ TkplatformtestInit( */ static int -MenuBarHeightObjCmd( +TestmenubarheightObjCmd( TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Not used. */ TCL_UNUSED(int), /* Not used. */ @@ -124,7 +124,7 @@ TkTestLogDisplay( /* *---------------------------------------------------------------------- * - * PressButtonObjCmd -- + * TestpressbuttonObjCmd -- * * This Tcl command simulates a button press at a specific screen * location. It injects NSEvents into the NSApplication event queue, as @@ -143,7 +143,7 @@ TkTestLogDisplay( */ static int -PressButtonObjCmd( +TestpressbuttonObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, @@ -225,7 +225,7 @@ PressButtonObjCmd( /* *---------------------------------------------------------------------- * - * MoveMouseObjCmd -- + * TestmovemouseObjCmd -- * * This Tcl command simulates a mouse motion to a specific screen * location. It injects an NSEvent into the NSApplication event queue, @@ -242,7 +242,7 @@ PressButtonObjCmd( */ static int -MoveMouseObjCmd( +TestmovemouseObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, @@ -302,7 +302,7 @@ MoveMouseObjCmd( } static int -InjectKeyEventObjCmd( +TestinjectkeyeventObjCmd( TCL_UNUSED(void *), Tcl_Interp *interp, int objc, diff --git a/tests/bind.test b/tests/bind.test index 9f506fcf9..6348b8b5c 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -6931,7 +6931,7 @@ proc testKey {window event type mods} { } set save $keyInfo set keyInfo {} - set injectcmd [list injectkeyevent $type $numericKeysym] + set injectcmd [list testinjectkeyevent $type $numericKeysym] foreach {option} $mods { lappend injectcmd $option } @@ -7002,7 +7002,7 @@ test bind-35.2 {Can bind to function keys} -constraints {aqua} -body { set numericKeysym {} focus -force . event generate . - injectkeyevent press $numericKeysym -function + testinjectkeyevent press $numericKeysym -function vwait keyInfo return $keyInfo } -cleanup { @@ -7032,7 +7032,7 @@ test bind-35.3 {Events agree for modifier keys} -constraints {aqua} -setup { vwait keyInfo } set save $keyInfo - injectkeyevent flagschanged $numericKeysym [lindex $event 1] + testinjectkeyevent flagschanged $numericKeysym [lindex $event 1] if {$keyInfo == {}} { vwait keyInfo } diff --git a/tests/constraints.tcl b/tests/constraints.tcl index b5a4e76f2..bec532e37 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -250,6 +250,27 @@ namespace eval tk { } namespace export controlPointerWarpTiming + # On macOS windows are not allowed to overlap the menubar at the top of the + # screen or the dock. So tests which move a window and then check whether it + # got moved to the requested location should use a y coordinate larger than the + # height of the menubar (normally 23 pixels) and an x coordinate larger than the + # width of the dock, if it happens to be on the left. + # menubarheight deals with this issue but may not be available from the test + # environment, therefore provide a fallback here + if {[llength [info procs menubarheight]] == 0} { + if {[tk windowingsystem] ne "aqua"} { + # Windows may overlap the menubar + proc menubarheight {} { + return 0 + } + } else { + # Windows may not overlap the menubar + proc menubarheight {} { + return 30 ; # arbitrary value known to be larger than the menubar height + } + } + namespace export menubarheight + } } } @@ -270,9 +291,7 @@ testConstraint nonUnixUserInteraction [expr { }] testConstraint haveDISPLAY [expr {[info exists env(DISPLAY)] && [testConstraint x11]}] testConstraint altDisplay [info exists env(TK_ALT_DISPLAY)] -testConstraint noExceed [expr { - ![testConstraint unix] || [catch {font actual "\{xyz"}] -}] + testConstraint deprecated [expr {![package vsatisfies [package provide Tcl] 8.7-] || ![::tk::build-info no-deprecate]}] testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-] @@ -281,24 +300,26 @@ testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-] testConstraint aquaKnownBug [expr {[testConstraint notAqua] || [testConstraint knownBug]}] # constraints for testing facilities defined in the tktest executable... -testConstraint testImageType [expr {"test" in [image types]}] +testConstraint testbitmap [llength [info commands testbitmap]] +testConstraint testborder [llength [info commands testborder]] +testConstraint testcbind [llength [info commands testcbind]] +testConstraint testclipboard [llength [info commands testclipboard]] +testConstraint testcolor [llength [info commands testcolor]] +testConstraint testcursor [llength [info commands testcursor]] +testConstraint testembed [llength [info commands testembed]] +testConstraint testfont [llength [info commands testfont]] +testConstraint testImageType [expr {"test" in [image types]}] +testConstraint testmakeexist [llength [info commands testmakeexist]] +testConstraint testmenubar [llength [info commands testmenubar]] +testConstraint testmetrics [llength [info commands testmetrics]] +testConstraint testmovemouse [llength [info commands testmovemouse]] +testConstraint testobjconfig [llength [info commands testobjconfig]] testConstraint testOldImageType [expr {"oldtest" in [image types]}] -testConstraint testbitmap [llength [info commands testbitmap]] -testConstraint testborder [llength [info commands testborder]] -testConstraint testcbind [llength [info commands testcbind]] -testConstraint testclipboard [llength [info commands testclipboard]] -testConstraint testcolor [llength [info commands testcolor]] -testConstraint testcursor [llength [info commands testcursor]] -testConstraint testembed [llength [info commands testembed]] -testConstraint testfont [llength [info commands testfont]] -testConstraint testmakeexist [llength [info commands testmakeexist]] -testConstraint testmenubar [llength [info commands testmenubar]] -testConstraint testmetrics [llength [info commands testmetrics]] -testConstraint testobjconfig [llength [info commands testobjconfig]] -testConstraint testsend [llength [info commands testsend]] -testConstraint testtext [llength [info commands testtext]] -testConstraint testwinevent [llength [info commands testwinevent]] -testConstraint testwrapper [llength [info commands testwrapper]] +testConstraint testpressbutton [llength [info commands testpressbutton]] +testConstraint testsend [llength [info commands testsend]] +testConstraint testtext [llength [info commands testtext]] +testConstraint testwinevent [llength [info commands testwinevent]] +testConstraint testwrapper [llength [info commands testwrapper]] # constraints about what sort of fonts are available testConstraint fonts 1 @@ -319,6 +340,31 @@ destroy .t if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { testConstraint fonts 0 } + +testConstraint withXft [expr {![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft")}] +testConstraint withoutXft [expr {![testConstraint withXft]}] +unset fs + +# Expected results of some tests on Linux rely on availability of the "times" +# font. This font is generally provided when Tk uses the old X font system, +# but not when using Xft on top of fontconfig. Specifically (old system): +# xlsfonts | grep times +# may return quite some output while (new system): +# fc-list | grep times +# return value is empty. That's not surprising since the two font systems are +# separate (availability of a font in one of them does not mean it's available +# in the other one). The following constraints are useful in this kind of +# situation. +testConstraint haveTimesFamilyFont [expr { + [string tolower [font actual {-family times} -family]] == "times" +}] +testConstraint haveFixedFamilyFont [expr { + [string tolower [font actual {-family fixed} -family]] == "fixed" +}] +testConstraint haveCourierFamilyFont [expr { + [string tolower [font actual {-family courier} -family]] == "courier" +}] + # Although unexpected, some systems may have a very limited set of fonts available. # The following constraints happen to evaluate to false at least on one system: the # Github CI runner for Linux with --disable-xft, which has exactly ONE single font @@ -331,17 +377,14 @@ if {![string match {{22 3 6 15} {31 18 [34] 15}} $x]} { # tests they constrain (that is: availability of any font having the given font # attributes), so that these constrained tests will in fact run on all systems having # reasonable font dotation. -testConstraint haveTimes12Font [expr { - [font actual {times 12} -size] == 12 -}] -testConstraint haveCourier37Font [expr { +testConstraint havePointsize37Font [expr { [font actual {-family courier -size 37} -size] == 37 }] -testConstraint haveTimes14BoldFont [expr { +testConstraint havePointsize14BoldFont [expr { ([font actual {times 14 bold} -size] == 14) && ([font actual {times 14 bold} -weight] eq "bold") }] -testConstraint haveTimes12BoldItalicUnderlineOverstrikeFont [expr { +testConstraint haveBoldItalicUnderlineOverstrikeFont [expr { ([font actual {times 12 bold italic overstrike underline} -weight] eq "bold") && ([font actual {times 12 bold italic overstrike underline} -slant] eq "italic") && ([font actual {times 12 bold italic overstrike underline} -underline] eq "1") && diff --git a/tests/font.test b/tests/font.test index 13001c16b..6d6aeacb0 100644 --- a/tests/font.test +++ b/tests/font.test @@ -14,8 +14,6 @@ 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(CI)] || ![string match Linux $::tcl_platform(os)]}] - set defaultfontlist [font names] proc getnondefaultfonts {} { @@ -130,7 +128,7 @@ test font-4.6 {font command: actual: arguments} -body { # (objc - skip > 4) when skip == 2 font actual xyz -displayof . abc def } -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?-option? ?--? ?char?"} -test font-4.7 {font command: actual: arguments} -constraints noExceed -body { +test font-4.7 {font command: actual: arguments} -body { # (tkfont == NULL) font actual "\{xyz" } -returnCodes error -result "font \"{xyz\" does not exist" @@ -138,7 +136,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 failsOnUbuntu} -body { +test font-4.9 {font command: actual} -constraints {haveTimesFamilyFont} -body { # (objc > 3) so objPtr = objv[3 + skip] string tolower [font actual {-family times} -family] } -result {times} @@ -384,7 +382,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} -constraints failsOnUbuntu -body { +test font-8.4 {font command: families} -constraints haveTimesFamilyFont -body { # TkpGetFontFamilies() regexp -nocase times [font families] } -result 1 @@ -402,7 +400,7 @@ test font-9.3 {font command: measure: arguments} -body { # (objc - skip != 4) font measure xyz abc def } -returnCodes error -result {wrong # args: should be "font measure font ?-displayof window? text"} -test font-9.4 {font command: measure: arguments} -constraints noExceed -body { +test font-9.4 {font command: measure: arguments} -body { # (tkfont == NULL) font measure "\{xyz" abc } -returnCodes error -result "font \"{xyz\" does not exist" @@ -440,7 +438,7 @@ test font-10.5 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 2 font metrics xyz -displayof . abc } -returnCodes error -result {bad metric "abc": must be -ascent, -descent, -fixed, or -linespace} -test font-10.6 {font command: metrics: bad font} -constraints noExceed -body { +test font-10.6 {font command: metrics: bad font} -body { # (tkfont == NULL) font metrics "\{xyz" } -returnCodes error -result "font \"{xyz\" does not exist" @@ -704,7 +702,7 @@ test font-15.9 {Tk_AllocFontFromObj procedure: get attribute font} -setup { } -cleanup { destroy .t.f } -returnCodes error -result {expected integer but got "yyy"} -test font-15.10 {Tk_AllocFontFromObj procedure: no match} -constraints noExceed -body { +test font-15.10 {Tk_AllocFontFromObj procedure: no match} -body { # (ParseFontNameObj() != TCL_OK) font actual "\{xyz" } -returnCodes error -result "font \"{xyz\" does not exist" @@ -936,11 +934,15 @@ test font-21.5 {Tk_PostscriptFontName procedure: spaces} -constraints { } } -result {LucidaBright} test font-21.6 {Tk_PostscriptFontName procedure: spaces} -constraints { - x11 failsOnUbuntu + x11 } -body { - psfontname "{new century schoolbook} 10" + set name {{new century schoolbook} 10} + if {[font actual {{new century schoolbook} 10} -family] == "new century schoolbook"} { + set x [psfontname "{new century schoolbook} 10"] + } else { + set x NewCenturySchlbk-Roman + } } -result {NewCenturySchlbk-Roman} - test font-21.7 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { @@ -2252,10 +2254,10 @@ test font-38.5 {ParseFontNameObj procedure: begins with *} -body { test font-38.6 {ParseFontNameObj procedure: begins with *} -body { font actual *-times-xyz -family } -result [font actual {times 0} -family] -test font-38.7 {ParseFontNameObj procedure: arguments} -constraints noExceed -body { +test font-38.7 {ParseFontNameObj procedure: arguments} -body { font actual "\{xyz" } -returnCodes error -result "font \"{xyz\" does not exist" -test font-38.8 {ParseFontNameObj procedure: arguments} -constraints noExceed -body { +test font-38.8 {ParseFontNameObj procedure: arguments} -body { font actual "" } -returnCodes error -result {font "" does not exist} test font-38.9 {ParseFontNameObj procedure: arguments} -body { @@ -2265,7 +2267,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 haveTimes12BoldItalicUnderlineOverstrikeFont + unixOrWin haveBoldItalicUnderlineOverstrikeFont } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} @@ -2356,14 +2358,15 @@ test font-44.1 {TkFontGetPixels: size < 0} -setup { } -cleanup { tk scaling $oldscale } -result 26 -test font-44.2 {TkFontGetPoints: size >= 0} -constraints {noExceed haveTimes12Font} -setup { +test font-44.2 {TkFontGetPoints: size >= 0} -setup { set oldscale [tk scaling] } -body { + set oldSize [font actual {times 12} -size] tk scaling 0.5 - font actual {times 12} -size + expr {[font actual {times 12} -size] == $oldSize} } -cleanup { tk scaling $oldscale -} -result 12 +} -result 1 test font-44.3 {font create with display scaling not 100% - bug 8162e9b7a9} -body { set font1 TkDefaultFont set font2 [font create Font2 {*}[font actual $font1]] @@ -2379,7 +2382,7 @@ test font-45.1 {TkFontGetAliasList: no match} -body { test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family } -result {times} -test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed failsOnUbuntu} -body { +test font-45.3 {TkFontGetAliasList: match} -constraints haveTimesFamilyFont -body { if {[font actual {{times new roman} 10} -family] eq "Times New Roman"} { # avoid test failure on systems that have a real "times new roman" font set res 1 diff --git a/tests/fontchooser.test b/tests/fontchooser.test index f852e97e0..76333e1e7 100644 --- a/tests/fontchooser.test +++ b/tests/fontchooser.test @@ -179,7 +179,7 @@ test fontchooser-4.3 {fontchooser -font} -constraints scriptImpl -body { expr {$::testfont ne {}} } -result 1 -test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl haveTimes14BoldFont} -body { +test fontchooser-4.4 {fontchooser -font} -constraints {scriptImpl havePointsize14BoldFont} -body { start { tk::fontchooser::Configure -command ApplyFont -font {times 14 bold} tk::fontchooser::Show diff --git a/tests/frame.test b/tests/frame.test index 6d98568f1..79d9d4cb8 100644 --- a/tests/frame.test +++ b/tests/frame.test @@ -435,7 +435,7 @@ set expectedScreen "" if {[tcltest::testConstraint haveDISPLAY]} { set expectedScreen [list -screen screen Screen {} $env(DISPLAY)] } -test frame-2.15 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup { +test frame-2.15 {toplevel configuration options} -constraints haveDISPLAY -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -screen $env(DISPLAY) @@ -444,7 +444,7 @@ test frame-2.15 {toplevel configuration options} -constraints {x11 haveDISPLAY} } -cleanup { deleteWindows } -result $expectedScreen -test frame-2.16 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup { +test frame-2.16 {toplevel configuration options} -constraints haveDISPLAY -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -screen $env(DISPLAY) diff --git a/tests/grab.test b/tests/grab.test index ea8e99240..6086ff756 100644 --- a/tests/grab.test +++ b/tests/grab.test @@ -12,15 +12,13 @@ eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test -# The macOS test module includes the pressbutton command to simulate a +# The macOS test module includes the testpressbutton command to simulate a # mouse button press event by injecting events into the NSApplication # event queue. On other platforms there is currently no way to test # the actual grab effect, per se, in an automated test. Therefore, # this test suite only covers the interface to the grab command (ie, # error messages, etc.) on platforms other than macOS. -testConstraint pressbutton [llength [info commands pressbutton]] - test grab-1.1 {Tk_GrabObjCmd} -body { grab } -returnCodes error -result {wrong # args: should be "grab ?-global? window" or "grab option ?arg ...?"} @@ -187,7 +185,7 @@ test grab-5.2 {Tk_GrabObjCmd, grab set} -body { } -result {. global} test grab-6.1 {local grab on child window} -constraints { - pressbutton + testpressbutton } -body { wm geometry . 100x200+200+100 set result {} @@ -196,17 +194,17 @@ test grab-6.1 {local grab on child window} -constraints { bind .f {lappend result "inside"} pack .f update idletasks - pressbutton 250 150 + testpressbutton 250 150 update lappend result ":" - pressbutton 250 250 + testpressbutton 250 250 update lappend result ":" grab set .f - pressbutton 250 150 + testpressbutton 250 150 update lappend result ":" - pressbutton 250 250 + testpressbutton 250 250 update return $result } -cleanup { diff --git a/tests/menu.test b/tests/menu.test index 3385cbcfb..fe6bf2353 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -11,8 +11,6 @@ eval tcltest::configure $argv tcltest::loadTestedCommands imageInit -testConstraint pressbutton [llength [info commands pressbutton]] -testConstraint movemouse [llength [info commands movemouse]] test menu-1.1 {Tk_MenuCmd procedure} -body { menu @@ -4252,7 +4250,7 @@ test menu-40.14 {identifiers - reserved word} -setup { } -result {2} test menu-40.1 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { -} -constraints {pressbutton} -body { +} -constraints {testpressbutton} -body { set done false event generate {} -x 100 -y 100 toplevel .t @@ -4261,13 +4259,13 @@ test menu-40.1 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f .t.m add command -command {puts Polo} -label Polo after 1000 {.t.m post 500 500} after 2000 {destroy .t} - after 2500 {pressbutton 530 510} + after 2500 {testpressbutton 530 510} after 3000 {set done true} tkwait variable done } test menu-40.2 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { -} -constraints {movemouse} -body { +} -constraints {testmovemouse} -body { set done false event generate {} -x 100 -y 100 toplevel .t @@ -4275,13 +4273,13 @@ test menu-40.2 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f .t.m add command -command {puts Marco} -label Marco .t.m add command -command {puts Polo} -label Polo after 1000 {.t.m post 500 500} - after 2000 {movemouse 530 510} + after 2000 {testmovemouse 530 510} after 3000 {destroy .t} - after 3500 {movemouse 530 530} - after 4000 pressbutton 530 530 + after 3500 {testmovemouse 530 530} + after 4000 testpressbutton 530 530 after 4500 {set done true} tkwait variable done - pressbutton 530 510 + testpressbutton 530 510 } # cleanup diff --git a/tests/select.test b/tests/select.test index ea7be2b69..a55e27968 100644 --- a/tests/select.test +++ b/tests/select.test @@ -1007,7 +1007,7 @@ test select-10.3 {ConvertSelection procedure} -constraints x11 -setup { # testing timers # This one hangs in Exceed test select-10.4 {ConvertSelection procedure} -constraints { - x11 noExceed failsOnUbuntu + x11 failsOnUbuntu } -setup { setup setupbg diff --git a/tests/text.test b/tests/text.test index 7a73ccaea..f190c8144 100644 --- a/tests/text.test +++ b/tests/text.test @@ -3488,7 +3488,7 @@ test text-14.18 {ConfigureText procedure} -constraints fonts -setup { # to the appropriate size. # On macOS, however, there is no way to make the window overlap the menubar. if {[tk windowingsystem] eq "aqua"} { - set minY [expr [menubarheight] + 1] + set minY [expr [testmenubarheight] + 1] } else { set minY 0 } diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index d5e031f1c..c38a78ece 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -74,7 +74,7 @@ test combobox-3 "Read postoffset value dynamically from current style" -body { ttk::style configure DerivedStyle.TCombobox -postoffset [list 25 0 0 0] if {[tk windowingsystem] == "aqua"} { after 500 { - pressbutton [expr {[winfo rootx .cb] + 25}] [expr {[winfo rooty .cb] + 25}] + testpressbutton [expr {[winfo rootx .cb] + 25}] [expr {[winfo rooty .cb] + 25}] } } ttk::combobox::Post .cb diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test index 007c2fee7..c28d6bd20 100644 --- a/tests/unixEmbed.test +++ b/tests/unixEmbed.test @@ -88,8 +88,6 @@ proc colorsFree {w {red 31} {green 245} {blue 192}} { && ([lindex $vals 2]/256 == $blue) } -testConstraint pressbutton [llength [info commands pressbutton]] - test unixEmbed-1.1 {Tk_UseWindow procedure, bad window identifier} -constraints { unix } -setup { @@ -1290,7 +1288,7 @@ 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 testpressbutton } -setup { deleteWindows } -body { @@ -1312,12 +1310,12 @@ test unixEmbed-11.2 {mouse coordinates in embedded toplevels} -constraints { set x [expr {[winfo rootx .main.b] + [winfo width .main.b]/2}] set y [expr {[winfo rooty .main.b] + [winfo height .main.b]/2}] lappend result [winfo containing $x $y] - pressbutton $x $y + testpressbutton $x $y update set x [expr {[winfo rootx .embed.b] + [winfo width .embed.b]/2}] set y [expr {[winfo rooty .embed.b] + [winfo height .embed.b]/2}] lappend result [winfo containing $x $y] - pressbutton $x $y + testpressbutton $x $y update set result } -cleanup { diff --git a/tests/unixFont.test b/tests/unixFont.test index 08757cd91..83568e2ca 100644 --- a/tests/unixFont.test +++ b/tests/unixFont.test @@ -16,21 +16,30 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands -testConstraint failsOnUbuntu [expr {![info exists ::env(CI)] || ![string match Linux $::tcl_platform(os)]}] -testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] - if {[tk windowingsystem] eq "x11"} { - set xlsf [auto_execok xlsfonts] + if {[testConstraint withXft]} { + set fontsystemcmd [auto_execok fc-list] + } else { + set fontsystemcmd [auto_execok xlsfonts] + } } foreach {constraint font} { - hasArial arial - hasCourierNew "courier new" - hasTimesNew "times new roman" + hasArial arial + hasCourierNew "courier new" + hasTimesNew "times new roman" } { - if {[tk windowingsystem] eq "x11"} { - testConstraint $constraint 1 - if {[llength $xlsf]} { - if {![catch {eval exec $xlsf [list *-$font-*]} res] + testConstraint $constraint 0 + if {([tk windowingsystem] eq "x11") && [llength $fontsystemcmd]} { + if {[testConstraint withXft]} { + if {[exec $fontsystemcmd $font family] ne ""} { + testConstraint $constraint 1 + } + } else { + # With the old font system, the constraint is true by default, + # except on the mac with XQuartz + testConstraint $constraint [expr {!(($tcl_platform(os) eq "Darwin") \ + && ([tk windowingsystem] eq "x11"))}] + if {![catch {eval exec $fontsystemcmd [list *-$font-*]} res] && ![string match *unmatched* $res]} { # Newer Unix systems have more default fonts installed, # so we can't rely on fallbacks for fonts to need to @@ -38,8 +47,6 @@ foreach {constraint font} { testConstraint $constraint 0 } } - } else { - testConstraint $constraint 0 } } @@ -48,20 +55,20 @@ toplevel .b wm geom .b +0+0 update idletasks -# Font should be fixed width and have chars missing below char 32, so can -# test control char expansion and missing character code. - -set courier {Courier -10} -set cx [font measure $courier 0] +# Fonts must be fixed width and have chars missing below char 32, so that +# tests can control char expansion and missing character code. Therefore +# we're using TkFixedFont here for both the label and the canvas. -label .b.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left -text "0" -font fixed +label .b.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left -text "0" -font TkFixedFont pack .b.l canvas .b.c -closeenough 0 -set t [.b.c create text 0 0 -anchor nw -just left -font $courier] +set t [.b.c create text 0 0 -anchor nw -just left -font TkFixedFont] pack .b.c update +set cx [font measure TkFixedFont 0] + set ax [winfo reqwidth .b.l] set ay [winfo reqheight .b.l] proc getsize {} { @@ -69,10 +76,10 @@ proc getsize {} { return "[winfo reqwidth .b.l] [winfo reqheight .b.l]" } -test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11 noExceed} { +test unixfont-1.1 {TkpGetNativeFont procedure: not native} {x11} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" does not exist}} -test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 failsOnUbuntu} { +test unixfont-1.2 {TkpGetNativeFont procedure: native} {x11 haveFixedFamilyFont} { font measure fixed 0 } 6 @@ -81,21 +88,21 @@ test unixfont-2.1 {TkpGetFontFromAttributes procedure: no family} x11 { set x {} } {} test unixfont-2.2 {TkpGetFontFromAttributes procedure: Times relatives} \ - {x11 noExceed hasTimesNew failsOnUbuntu} { + {x11 hasTimesNew} { 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 failsOnUbuntu failsOnXQuarz} { + {x11 hasCourierNew} { 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 failsOnUbuntu failsOnXQuarz} { + {x11 hasArial} { set x {} lappend x [lindex [font actual {-family "Arial"}] 1] lappend x [lindex [font actual {-family "Geneva"}] 1] @@ -105,19 +112,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 failsOnUbuntu} { +test unixfont-2.6 {TkpGetFontFromAttributes: fallback to fixed family} {x11 haveFixedFamilyFont} { 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 failsOnUbuntu} { +test unixfont-2.8 {TkpGetFontFromAttributes: loop over returned font names} {x11 haveFixedFamilyFont} { lindex [font actual {-family fixed -size 31}] 1 } {fixed} -test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 noExceed failsOnUbuntu} { +test unixfont-2.9 {TkpGetFontFromAttributes: reject adobe courier if possible} {x11 haveCourierFamilyFont} { lindex [font actual {-family courier}] 1 } {courier} -test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 haveCourier37Font} { +test unixfont-2.10 {TkpGetFontFromAttributes: scalable font found} {x11 havePointsize37Font} { lindex [font actual {-family courier -size 37}] 3 } 37 test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { @@ -169,11 +176,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 failsOnUbuntu} { +test unixfont-5.8 {Tk_MeasureChars procedure: internal spaces significant} {x11} { .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 failsOnUbuntu} { +test unixfont-5.9 {Tk_MeasureChars procedure: TK_PARTIAL_OK} {x11} { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 @@ -189,7 +196,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 failsOnUbuntu} { +test unixfont-5.12 {Tk_MeasureChars procedure: include eol spaces} {x11} { .b.l config -text "000 \n000" getsize } "[expr $ax*6] [expr $ay*2]" @@ -256,22 +263,29 @@ test unixfont-8.3 {InitFont procedure: can't parse info from name} x11 { catch {unset fontArray} set result } {-family -overstrike -size -slant -underline -weight} -test unixfont-8.4 {InitFont procedure: classify characters} {x11 failsOnUbuntu failsOnXQuarz} { +test unixfont-8.4 {InitFont procedure: classify characters} {x11 nonPortable} { +# Constrained by nonPortable because this test highly relies on fonts availability. +# - without Xft, I couldn't find any font featuring a glyph of 6 charwidths +# for character \u4000. The 'unifont' package provides this glyph but the +# width of \u4000 is only 2 character widths (which seems visually fine). +# - with Xft the problem is identical for \u4000, and moreover the width +# of, say, \002 depends on which fonts are installed. set x 0 - incr x [font measure $courier "䀀"] ;# 6 - incr x [font measure $courier "\002"] ;# 4 - incr x [font measure $courier "\012"] ;# 2 - incr x [font measure $courier "\101"] ;# 1 + incr x [font measure TkFixedFont "䀀"] ;# 6 + incr x [font measure TkFixedFont "\002"] ;# 4 + incr x [font measure TkFixedFont "\012"] ;# 2 + incr x [font measure TkFixedFont "\101"] ;# 1 set x } [expr $cx*13] test unixfont-8.5 {InitFont procedure: setup widths of normal chars} x11 { - font metrics $courier -fixed + font metrics TkFixedFont -fixed } 1 -test unixfont-8.6 {InitFont procedure: setup widths of special chars} {x11 failsOnUbuntu failsOnXQuarz} { +test unixfont-8.6 {InitFont procedure: setup widths of special chars} {x11 nonPortable} { +# Constrained by nonPortable, see unixfont-8.4 set x 0 - incr x [font measure $courier "\001"] ;# 4 - incr x [font measure $courier "\002"] ;# 4 - incr x [font measure $courier "\012"] ;# 2 + incr x [font measure TkFixedFont "\001"] ;# 4 + incr x [font measure TkFixedFont "\002"] ;# 4 + incr x [font measure TkFixedFont "\012"] ;# 2 set x } [expr $cx*10] test unixfont-8.7 {InitFont procedure: XA_UNDERLINE_POSITION} x11 { @@ -295,7 +309,8 @@ test unixfont-8.11 {InitFont procedure: XA_UNDERLINE_POSITION was 0} x11 { set x {} } {} -test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbuntu failsOnXQuarz} { +test unixfont-9.1 {2 chars substituted in inserted text} {x11 nonPortable} { +# Constrained by nonPortable, see unixfont-8.4 .b.c dchars $t 0 end .b.c insert $t 0 "0\a0" set x {} @@ -304,7 +319,8 @@ test unixfont-9.1 {GetControlCharSubst procedure: 2 chars subst} {x11 failsOnUbu 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 failsOnUbuntu failsOnXQuarz} { +test unixfont-9.2 {4 chars substituted in inserted text} {x11 nonPortable} { +# Constrained by nonPortable, see unixfont-8.4 .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 9fb40c9dd..ece8a9578 100644 --- a/tests/unixSelect.test +++ b/tests/unixSelect.test @@ -14,8 +14,6 @@ namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands -testConstraint failsOnXQuarz [expr {$tcl_platform(os) ne "Darwin" || [tk windowingsystem] ne "x11" }] - global longValue selValue selInfo set selValue {} @@ -126,7 +124,7 @@ test unixSelect-1.1 {TkSelGetSelection procedure: simple i18n text} -constraints } -result 4 test unixSelect-1.2 {TkSelGetSelection procedure: simple i18n text, iso8859-1} -constraints { - x11 failsOnXQuarz + x11 } -setup { setupbg } -body { @@ -320,7 +318,7 @@ test unixSelect-1.12 {TkSelGetSelection procedure: INCR i18n text, utf-8} -const } -result [string repeat x 3999]ü[string repeat x 4000] test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints { - x11 failsOnXQuarz + x11 } -setup { destroy .e setupbg @@ -336,7 +334,7 @@ test unixSelect-1.13 {TkSelGetSelection procedure: simple i18n text, utf-8} -con } -result 5 test unixSelect-1.14 {TkSelGetSelection procedure: simple i18n text, utf-8} -constraints { - x11 failsOnXQuarz + x11 } -setup { setupbg } -body { diff --git a/tests/unixWm.test b/tests/unixWm.test index 8f1bd2253..f8856162a 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -40,7 +40,7 @@ proc makeToplevels {} { # width of the dock, if it happens to be on the left. if {[tk windowingsystem] eq "aqua"} { - set mb [expr [menubarheight] + 1] + set mb [expr [testmenubarheight] + 1] set X 100 set Y0 $mb set Y2 [expr $mb + 2] From d24813a8f404352b0f9b4638835ab84262a10ec5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Jan 2025 15:29:30 +0000 Subject: [PATCH 5/6] version -> 8.6.17 --- README.md | 2 +- generic/tk.h | 4 ++-- library/tk.tcl | 2 +- unix/Makefile.in | 3 --- unix/configure | 4 ++-- unix/configure.in | 2 +- unix/tcl.m4 | 2 +- unix/tk.spec | 2 +- win/configure | 2 +- win/configure.in | 2 +- 10 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 48bc25b3b..96790fd8e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # README: Tk -This is the **Tk 8.6.16** source distribution. +This is the **Tk 8.6.17** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). diff --git a/generic/tk.h b/generic/tk.h index 3a2915dd0..aafcb3a07 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -75,10 +75,10 @@ extern "C" { #define TK_MAJOR_VERSION 8 #define TK_MINOR_VERSION 6 #define TK_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TK_RELEASE_SERIAL 16 +#define TK_RELEASE_SERIAL 17 #define TK_VERSION "8.6" -#define TK_PATCH_LEVEL "8.6.16" +#define TK_PATCH_LEVEL "8.6.17" /* * A special definition used to allow this header file to be included from diff --git a/library/tk.tcl b/library/tk.tcl index 45bec8457..5232d44dd 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -11,7 +11,7 @@ # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release -package require -exact Tk 8.6.16 +package require -exact Tk 8.6.17 # Create a ::tk namespace namespace eval ::tk { diff --git a/unix/Makefile.in b/unix/Makefile.in index bf2ae5189..f49e03272 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1547,9 +1547,6 @@ DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) -$(UNIX_DIR)/configure: $(UNIX_DIR)/configure.in $(UNIX_DIR)/tcl.m4 \ - $(UNIX_DIR)/aclocal.m4 - cd $(UNIX_DIR); autoconf $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure cd $(MAC_OSX_DIR); autoconf $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure diff --git a/unix/configure b/unix/configure index bd92f470d..8686aa6a2 100755 --- a/unix/configure +++ b/unix/configure @@ -1338,7 +1338,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".16" +TK_PATCH_LEVEL=".17" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" @@ -4496,7 +4496,7 @@ fi ;; *) # Make sure only first arg gets _r - CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` + CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 diff --git a/unix/configure.in b/unix/configure.in index 08e8dc931..3125e3e9b 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -26,7 +26,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".16" +TK_PATCH_LEVEL=".17" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 7750c7286..8ff24c6f2 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1096,7 +1096,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ;; *) # Make sure only first arg gets _r - CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'` + CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'` ;; esac AC_MSG_RESULT([Using $CC for compiling with threads]) diff --git a/unix/tk.spec b/unix/tk.spec index d51ecd5fb..467d94c91 100644 --- a/unix/tk.spec +++ b/unix/tk.spec @@ -4,7 +4,7 @@ Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. -Version: 8.6.16 +Version: 8.6.17 Release: 2 License: BSD Group: Development/Languages diff --git a/win/configure b/win/configure index f39bac3ac..b9c1d8826 100755 --- a/win/configure +++ b/win/configure @@ -1325,7 +1325,7 @@ SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".16" +TK_PATCH_LEVEL=".17" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ diff --git a/win/configure.in b/win/configure.in index fe945f37c..7580012f7 100644 --- a/win/configure.in +++ b/win/configure.in @@ -15,7 +15,7 @@ SHELL=/bin/sh TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 -TK_PATCH_LEVEL=".16" +TK_PATCH_LEVEL=".17" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ From 22074a8068d74808ef96f79c790a50ec51d93a19 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 10 Jan 2025 10:54:03 +0000 Subject: [PATCH 6/6] TK_DO_NOT_DRAW is deprecated --- macosx/tkMacOSXInt.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 29b20f71e..5547fdf1a 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -88,7 +88,9 @@ typedef struct TkWindowPrivate MacDrawable; #define TK_DRAWN_UNDER_MENU 0x08 #define TK_IS_PIXMAP 0x10 #define TK_IS_BW_PIXMAP 0x20 -#define TK_DO_NOT_DRAW 0x40 +#ifndef TK_NO_DEPRECATED +# define TK_DO_NOT_DRAW 0x40 +#endif #define TTK_HAS_CONTRASTING_BG 0x80 /*