Tk Source Code

View Ticket
Login
2026-11-20
14:55 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: 6eb2f59f user: jan.nijtmans
14:33 • Ticket [b174f151] Test failures for ttk/treeview.test under MS Windows status still Open with 3 other changes artifact: 3c957b22 user: serhiy.storchaka
09:19 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: 371839e5 user: serhiy.storchaka
2026-11-16
10:57 • Ticket [d0bceae2] Wayland branch: CI failures hidden by the constraints.tcl error status still Open with 3 other changes artifact: 8e3bf351 user: serhiy.storchaka
09:48 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: 44357d3c user: erikleunissen
09:45
tests/font.test: use TkFixedFont on win32 instead of "courier 12". See ticket [deca13e833]. Thanks to Serhiy Storchaka. check-in: 4a734d52 user: erikleunissen tags: core-8-6-branch
09:26
tests/font.test: use TkFixedFont on win32 instead of "courier 12". See ticket [deca13e833]. Thanks to Serhiy Storchaka. check-in: f9b64280 user: erikleunissen tags: core-9-0-branch
09:22
tests/font.test: use TkFixedFont on win32 instead of "courier 12". See ticket [deca13e833]. Thanks to Serhiy Storchaka. check-in: 2e318316 user: erikleunissen tags: trunk, main
2026-11-15
22:06 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: f527fcbd user: serhiy.storchaka
20:53 • Ticket [deca13e8]: 3 changes artifact: 00619e8e user: erikleunissen
2026-11-13
09:55 • Ticket [65ba1d53] Linux X11: scale failures (wayland branch) status still Open with 3 other changes artifact: 552e617f user: serhiy.storchaka
2026-11-08
10:49 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: d45384ab user: serhiy.storchaka
2026-11-07
18:33 • Ticket [deca13e8]: 3 changes artifact: bde19aa9 user: serhiy.storchaka
18:28
Fix [deca13e833]: Tests fail at high display scale (tests did not take into account the minimum width of a toplevel). check-in: d6121ae3 user: serhiy.storchaka tags: core-8-6-branch
18:28
Fix [deca13e833]: Tests fail at high display scale (tests did not take into account the minimum width of a toplevel). check-in: 21892ec6 user: serhiy.storchaka tags: core-9-0-branch
15:59
Fix [deca13e833]: Tests fail at high display scale (tests did not take into account the minimum width of a toplevel). check-in: 672afed8 user: serhiy.storchaka tags: trunk, main
2026-10-27
18:02 • Ticket [220796ff] -stipple option for canvas text item disrupts positioning, b status still Open with 3 other changes artifact: e0917a92 user: serhiy.storchaka
2026-10-22
12:12 • Ticket [e80bd792] Wayland branch: tests fail on embedding, pointer warping and screen positions, which Wayland does not support status still Open with 3 other changes artifact: f547613b user: serhiy.storchaka
2026-10-20
09:22 • Ticket [e80bd792]: 3 changes artifact: 4acb7390 user: serhiy.storchaka
09:20 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: bd0756af user: serhiy.storchaka
2026-10-08
05:08 • Ticket [deca13e8]: 3 changes artifact: 73ba2e70 user: serhiy.storchaka
2026-10-07
21:06 • Ticket [deca13e8]: 3 changes artifact: c7c7332d user: erikleunissen
20:54 • Ticket [deca13e8]: 3 changes artifact: 98e4f78a user: erikleunissen
19:04 • Ticket [deca13e8]: 3 changes artifact: ead17072 user: serhiy.storchaka
18:38 • Ticket [deca13e8]: 3 changes artifact: a67e8279 user: erikleunissen
04:41 • Ticket [deca13e8]: 3 changes artifact: 515b6cd6 user: serhiy.storchaka
01:55 • Ticket [deca13e8]: 4 changes artifact: 13b8756f user: marc_culler
2026-10-06
18:33 • Ticket [deca13e8]: 4 changes artifact: f8019020 user: erikleunissen
18:25
Selected fix from [deca13e833]: test bind-34.1: fit a 800x600 screen check-in: ef5aab84 user: erikleunissen tags: core-9-0-branch
18:23
Selected fix from [deca13e833]: test bind-34.1: fit a 800x600 screen check-in: 25633400 user: erikleunissen tags: trunk, main
2026-10-05
10:22 • Ticket [deca13e8] Tests fail at high display scale status still Open with 4 other changes artifact: 0dca5ee7 user: erikleunissen
10:17
Selected fix from [deca13e833]: correct state left by tests: pack-20.6 did not restore "pack propagate ."; event.test leaves the pointer over the larger windows of focus.test, slightly adapted from Serhiy Storchaka check-in: d83b2974 user: erikleunissen tags: core-9-0-branch
10:14
Selected fix from [deca13e833]: correct state left by tests: pack-20.6 did not restore "pack propagate ."; event.test leaves the pointer over the larger windows of focus.test, slightly adapted from Serhiy Storchaka check-in: d19371a6 user: erikleunissen tags: trunk, main
2026-10-02
20:10 • Ticket [deca13e8] Tests fail at high display scale status still Open with 3 other changes artifact: 297ae228 user: erikleunissen
20:02 • Ticket [deca13e8]: 3 changes artifact: 73f57cba user: erikleunissen
19:56 • Ticket [deca13e8]: 3 changes artifact: b0bc7d74 user: erikleunissen
19:36 • Ticket [deca13e8]: 7 changes artifact: 47b904e5 user: erikleunissen
13:45 • New ticket [deca13e8]. artifact: 33d07253 user: serhiy.storchaka

Ticket UUID: deca13e833cb782ce20f666df27c5dfdfab168d0
Title: Tests fail at high display scale
Type: Bug Version: 9.1.0
Submitter: serhiy.storchaka Created on: 2026-10-02 13:45:42
Subsystem: 86. Test Tools Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-11-20 14:55:41
Resolution: None Closed By: nobody
    Closed on:
Description:

Many tests fail when the display scale is higher than 100% (96 DPI), e.g. about 300 tests on Windows at 350%. At least some of them fail on macOS too, e.g. frame-12.3 and textImage-4.2. The causes:

  • Windows does not let a toplevel be narrower than its title bar (404 pixels at 350%). pack, grid, place, panedwindow, listbox, canvWind, wm, winWm, event and text tests.
  • Fonts and sizes specified in points. textDisp, frame, text and textImage tests.
  • Scrollbar arrows and minimal slider length on Windows grow with the scale. scrollbar tests.
  • Sizes in points set in tk.tcl for panedwindow, scrollbar and scale. The tests passed only if option.test was run before them.
  • State left by other tests: pack-20.6 did not restore pack propagate ., event.test leaves the pointer over the larger windows of focus.test. (ACCEPTED AND MERGED)
  • Window manager decorations, which grow with the DPI in some window managers. event-c3f5c85322. (ACCEPTED AND MERGED)
  • The raster font Courier is reported as not fixed at some sizes, e.g. at 150% on Windows. font-10.9. (ACCEPTED AND MERGED)
  • bind-34.1 moves a window off a small screen, e.g. 800x600. (ACCEPTED AND MERGED)

Proposed fix in branch tests-high-dpi, a separate commit for every item. With it all tests pass on Windows at 100% to 350% and on X11 at 96 to 336 DPI, with and without a window manager. It was not tested on macOS. Test bind-34.2 also needs the fix for [3f1ad1ff50].

For the first item, the new test utility removeTitleBar removes the title bar of the test windows at high scale. It is only one possible solution. The alternative is to make all sizes in these tests larger than the minimal width, computed so that the windows still fit the screen, but this would change many more lines.

User Comments: jan.nijtmans added on 2026-11-20 14:55:41:

> Please cancel one of them.

I canceled core-tests-high-dpi, instead ran everything under my own (nijtmans/tk) github account. Everything passed, so I merged everything to trunk and core-9-0-branch.


serhiy.storchaka added on 2026-11-20 09:19:06:

None of the four custom core-* tags (core-tests-high-dpi, core-mojibake_integration, core-ftd-progstate, core-ftd-eyefriendly) got a CI run tonight: the nightly sync holds back when more than three tags are set. Please cancel one of them.


serhiy.storchaka added on 2026-11-15 22:06:31:

It comes from Windows. "Courier" there is an old raster font with only a few sizes, and at 150% courier 12 gets a size for which GDI reports variable pitch, although all its characters have the same width. Tk only passes this on, so font metrics -fixed returns 0. That is surprising, but probably not critical.

font-10.9 mainly checks that these options are accepted; only the result of the last one is compared. Using TkFixedFont (Courier New on Windows), as on X11, avoids depending on the raster font.


erikleunissen added on 2026-11-15 20:53:09:

Hi Serhiy,

Regarding:

  • The raster font Courier is reported as not fixed at some sizes, e.g. at 150% on Windows. font-10.9.

I don't quite understand whether the shortcoming originates from MS Windows or from Tk. Could you please explain?


serhiy.storchaka added on 2026-11-08 10:49:46:

Branch tests-high-dpi is rebased on trunk:

  • [73f2b9cedd]: the minimal width of Windows toplevels (removeTitleBar), without the parts superseded by [672afed883].
  • [4d3273ea61]: fonts and lengths specified in points.
  • [48d0850ed7]: the size of scrollbar arrows on Windows.
  • [aa57e2a1bb]: the default sizes in points set in tk.tcl.
  • [a4b00e8746]: font-10.9 uses TkFixedFont on Windows.

The other changes are already merged. With the branch, of the changed test files only winWm-11.1 and wm-geometry-2.2 fail on Windows at 350%.


serhiy.storchaka added on 2026-11-07 18:33:42:

Branch tests-min-width is merged into trunk [672afed883] and backported to core-9-0-branch [21892ec6c4] and core-8-6-branch [d6121ae3be]. On the wayland branch the notWayland constraint was removed from the tests fixed by it [17d0ac78cf].

Still failing on Windows at 350%: most of pack.test, 11 grid tests, and textDisp-27.7, textDisp-27.7.1 and textDisp-27.7.2.


serhiy.storchaka added on 2026-10-20 09:20:19:

Branch tests-min-width tries the alternative to removeTitleBar: the windows are made wider (480 pixels), or the widgets are laid out in a frame which is not resized with the toplevel, so the expected results do not change. The workaround with wm overrideredirect in textDisp.test and text.test is no longer needed. An additional argument for this way: the same tests fail on the wayland branch, where a toplevel with client-side decorations is at least 180 pixels wide, and there the title bar cannot be removed.

So far it covers only the tests which fail on Wayland. About 110 tests, mostly in pack.test, still fail on Windows at 350%; most of them could be fixed in the same way.


serhiy.storchaka added on 2026-10-08 05:08:19:

Thank you for the idea. I tested it on Windows 11: the title does not matter. The minimal width of a toplevel is the same for the title "tktest", an empty title, or a long title: 120 pixels at 100% and 404 pixels at 350%. It is determined by the frame and the buttons of the title bar. It applies to the root window and to any other toplevel, but not to toolwindows (wm attributes -toolwindow 1) and override-redirect windows.

Other alternatives are using toolwindows in tests on Windows, or testing geometry managers on a frame of fixed size instead of on a toplevel. The latter would be the most reliable, but even more invasive, and it would not help the event and wm tests, which test the toplevel itself. In the text tests [96ca9851d7] already does something similar: the text widget is no longer packed with -fill, so it keeps its own size.


erikleunissen added on 2026-10-07 21:06:28:
Correction: where I wrote "the width of the title bar", I meant:

    "the minimum width of the title bar"

erikleunissen added on 2026-10-07 20:54:02:
Here is another idea:

Presumption: the width of the titlebar is core to the issue.

The width of the titlebar is determined by the elements that it contains,
which are buttons (for closing, iconifying and maximizing the window) and
the title. A less intrusive, generic measure could be to target the title:

Currently the title of the main window is set to "tktest" here:

    [https://core.tcl-lang.org/tk/file?ci=eec7513de860b2a7&name=tests%2Fmain.tcl&ln= 
25]

What if we set it to the empty string?

serhiy.storchaka added on 2026-10-07 19:04:26:

Thank you for your review and for merging the fixes, Erik!

Most modern HiDPI monitors use a display scale above 100%. If the tests passed only at 100%, we could not run them on such computers, and the tests we run would not test what is really used.

Forcing 100% in tests/main.tcl would not help either. It can only set tk scaling, which converts points to pixels. That would fix the tests that use fonts and lengths in points, but not the real display scale: on Windows the minimal width of a toplevel (the width of its title bar) and the size of the scrollbar arrows are system metrics, which follow the display scale whatever tk scaling is.

I am not happy with the fix for the title bar width [96ca9851d7] either, but the alternative is to change all sizes used in these tests, which is even more invasive. I am not sure my solution is the best, and I will be glad to see a better alternative.


erikleunissen added on 2026-10-07 18:38:23:
General considerations regarding this ticket:

* Thus far, I selected three changes from this ticket for merging. My reason
  for agreeing to them doesn't actually involve the scaling factor (which is
  a subject that I'm not very familiar with).

* Requiring display scaling to work as intended is one thing (and merits its
  own tests). However, requiring all Tk tests to PASS at any or various setting
  for display scaling is an entirely different matter. I am not convinced that
  that is entirely useful.

  Also, when looking at the fix for this issue:

        * Windows does not let a toplevel be narrower than its title bar
          (404 pixels at 350%). pack, grid, place, panedwindow, listbox,
          canvWind, wm, winWm, event and text tests.

  at [96ca9851d7] I find the changes quite intrusive, which contributes
  to my being unconvinced.

  Alternatively, we could limit ourselves to requiring that Tk tests PASS with
  a single scaling factor (100 % would be a natural choice), and enforce that
  by hard-coding that scaling factor in tests/main.tcl for a global effect
  across all test files in the Tk test suite.

  That said, my gut isn't always right, and as I said: I'm not very familiar
  with display scaling. Therefore, I think that more people expressing their
  opinion regarding the matter would be valuable.

serhiy.storchaka added on 2026-10-07 04:41:48:

No, I do not test on macOS. I took frame-12.3 and textImage-4.2 from your report "test failures in 8.6" on tcl-core (1 October), and assumed the same cause, since both fail on X11 and Windows at high display scale. If they fail on macOS only in 8.6, the cause there is probably different.


marc_culler (claiming to be Marc Culler) added on 2026-10-07 01:55:17:
As far as I know, the macOS failures of frame-12.3 and textImage-4.2
only occur in 8.6. Have you seen macOS failures caused by screen resolution
in 9.0 or 9.1?

erikleunissen added on 2026-10-06 18:33:56:
Regarding:

* bind-34.1 moves a window off a small screen, e.g. 800x600.

Agreed and merged into trunk and core-9-0-branch.

erikleunissen added on 2026-10-05 10:22:20:
I agree with:

   *  State left by other tests: pack-20.6 did not restore
     <tt>pack propagate .</tt>, event.test leaves the pointer over the
     larger windows of focus.test.

The latter change slightly adapted to be robust against any screen size.

Merged into trunk and core-9-0-branch. Thanks!

erikleunissen added on 2026-10-02 19:56:34:
And I merged that particular change into trunk and core-9-0-branch, commits [7517b79368] and [6e42783e36] respectively.

erikleunissen added on 2026-10-02 19:36:12:
Regarding the changes to test event-c3f5c85322: I agree that they are an improvement.