[vim/vim] tests: clipboard tests fail in the GUI when the terminal has no clipboard (PR #21008)

h_east (Vim Github Repository) <[email protected]> Tue, 11 Aug 2026 09:00:32 -0700
Newsgroups gmane.editors.vim.devel
Message-ID <vim/vim/pull/[email protected]>
```
Problem:  Tests that need the clipboard in a Vim started with
          RunVimInTerminal() are not skipped when only the Vim running the
          tests has a clipboard, which is always the case in the GUI.
Solution: Add CheckClipboardInTerminal to ask a Vim started the same way
          whether it can use the clipboard.
```

related: #20920
related: #21007

Test_popup_select and Test_hlsearch_clipboard start with
"CheckFeature clipboard_working", but that asks the wrong process. A screen
dump test involves two Vims:

    the Vim running the tests        <- CheckFeature and has() answer here
      terminal buffer
        the Vim started by term_start()  <- the one under test

In a GUI test run the first one is gvim, which always has a clipboard through
GTK, so the check never skips. The second one may well have none. A temporary
log of the clipboard state during "make test_popupwin GUI_FLAG=-g" shows the
difference:

    gvim         clipmethod NONE  clip_star.available 1
    terminal Vim clipmethod NONE  clip_star.available 0

The terminal Vim found neither wayland nor x11 usable, so 'clipboard' does
nothing there, "*" stays empty and Test_popup_select fails on the screen dump.
Test_hlsearch_clipboard does not even get that far: the "let @*" in its script
produces "W23: Clipboard register not available", the hit-enter prompt keeps
the ruler from showing and RunVimInTerminal() times out.

For Test_popup_select there is no way to avoid the clipboard. Selecting text
with the mouse in a popup is a modeless selection, and mouse.c only enters
that code when clip_star.available or clip_plus.available is set, so without a
clipboard the selection never happens. The register is where a modeless
selection lives, not just how the test looks at it.

The new check runs one Vim the same way RunVimInTerminal() does and asks it.
"-v" is needed because in a GUI test run the command in "vimcmd" has "-g" in
it. The result is cached, so it costs one Vim start per test file.

What changes where:

    non-GUI CI jobs (Xvfb)        unchanged, the tests keep running
    GUI CI job with GTK3 (Xvfb)   unchanged, the tests keep running
    GUI CI job with GTK4 (weston) skipped instead of failing
    GUI run on a Wayland desktop  skipped instead of failing

The ordinary Linux jobs are where these tests get their coverage: ci-linux.yml
sets DISPLAY for every job and ci/setup-xvfb.sh runs unconditionally, so the
Vim running the tests is a terminal Vim with an X11 clipboard and nothing is
skipped there.

This takes two off the list of tests failing in the GTK4 CI job.
You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/21008

-- Commit Summary --

  * tests: clipboard tests fail in the GUI when the terminal has no clipboard

-- File Changes --

    M src/testdir/test_hlsearch.vim (1)
    M src/testdir/test_popupwin.vim (1)
    M src/testdir/util/check.vim (19)

-- Patch Links --

https://github.com/vim/vim/pull/21008.patch
https://github.com/vim/vim/pull/21008.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/21008
You are receiving this because you are subscribed to this thread.

Message ID: <vim/vim/pull/[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/21008%40github.com.