Skip to content

test(qa): run host QA scenarios on Wayland with an fcitx5 input method - #1957

Merged
l0gicgate merged 2 commits into
lgse:mainfrom
wmfeht:test/1715-wayland-qa-config
Oct 31, 2026
Merged

l0gicgate merged 2 commits into
lgse:mainfrom
wmfeht:test/1715-wayland-qa-config

Conversation

@wmfeht

@wmfeht wmfeht commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This adds an optional, host-only Wayland mode to the QA harness. It is a tool for reproducing behaviour that only shows up on Wayland, or with an input method, using the harness's scripted input and state checks. It isn't a second place to run the test suite. CI and ./scripts/qa.sh stay X11-only in the pinned container, and a Wayland run is never validation evidence.

It was written to reproduce #1715, where fcitx5 puts the first key of a composition into a field with selected text as a plain character. The X11-only harness couldn't start an input method or check Wayland, which that issue lists as untested. The findings are on #1715. The bug happens with GTK_IM_MODULE=fcitx on both X11 and Wayland, and not with GTK's native Wayland IM module.

What it adds, for host runs only (STRATA_QA_HOST=1):

  • STRATA_QA_DISPLAY=wayland runs a private headless sway in place of Xvfb. Sway gets no input devices of its own, no XWayland and a software renderer, and lives in the run's runtime directory. The app runs with GDK_BACKEND=wayland and sends input through a Wayland virtual keyboard (with a US keymap it compiles) and a virtual pointer instead of XTEST. Sway places every window at the top-left corner of the output, as Xvfb does, so target coordinates work unchanged. Screenshots use grim.
  • The input_method scenario header field (it needs session_bus) starts a private fcitx5 on the run's display and bus. Its profile holds the US keyboard and the named input method.
  • New scenario inline_renaming/input-method-composes-over-selection reproduces fix(input): let fcitx5 compose the first key over selected text #1715 with chewing. Its caret-at-end variant is a control. The scenario carries a skip reason because the pinned image has no fcitx5.

The X11 path behaves as before; its injector code was only moved behind a backend enum. The new dependencies (wayland-client, wayland-protocols-misc, wayland-protocols-wlr, xkbcommon) are optional and enabled only by the qa feature.

Limitations

I ran the whole suite on the host with STRATA_QA_DISPLAY=wayland: 559 of 635 runs passed. Expect failures that have nothing to do with the behaviour under test:

  • Keyboard layouts other than us are X11-only and fail with a message (10 runs).
  • Pixel sampling (pixel predicates and drop-animation samples) is X11-only and fails with a message.
  • Clipboard checks always see nothing (8 runs). The clipboard check reads through a second display connection, and Wayland only gives the clipboard to a client with keyboard focus.
  • The foreign drag helper (foreign_drag_source.py) uses Xlib, so it can't run on Wayland (4 runs).
  • Escape doesn't cancel a drag (8 runs). sway (wlroots) seems to drop keyboard input during a drag.
  • Drag-and-drop results can't be trusted. A quick synthetic drag copies instead of moving, and the cross-volume prompt never opens (31 runs). This may be a real Strata bug on Wayland and is filed as fix(drag): a quick drag on Wayland may copy instead of move #1958.
  • Never run: the resize command (which goes through sway's IPC socket), visual baselines (none exist for the host's GTK), and ./scripts/qa-drive.sh, which stays X11 and container-only.
  • Host differences apply to every host run, X11 included. For example, local-time mtime checks use the host's time zone, and baselines are missing for the host's GTK version.

Keyboard input, pointer clicks, popover menus, dialogs and input methods worked in the scenarios I checked.

Visual evidence

N/A: this changes the test harness only, with no user-visible change.

How to test

Requires a host with sway, swaymsg, grim, fcitx5, fcitx5-gtk and fcitx5-chewing.

  1. STRATA_QA_HOST=1 STRATA_QA_NAMED=1 STRATA_QA_DISPLAY=wayland cargo test --features qa,invariant-checks --test qa -- --include-ignored --exact input-method-composes-over-selection
  2. Repeat with STRATA_QA_DISPLAY=x11.
  3. Change the scenario's "GTK_IM_MODULE":"fcitx" to "wayland" and repeat step 1.
  4. Run ./scripts/qa.sh as usual.

Expected result: In steps 1 and 2, columns-caret-at-end passes and columns-selected-stem fails with the rename field showing 阿ㄅ.txt instead of 八.txt, which is bug #1715. In step 3, both runs pass. In step 4, the container run is unchanged and lists the new scenario as SKIPPED.

Related issue

Refs #1715 (this does not fix it). The drag-and-drop finding is filed as #1958.

Issue lgse#1715 (fcitx5 composing over selected text) could not be
reproduced by the X11-only harness, and its Wayland behaviour was
untested. Host runs gain two optional parts:

- STRATA_QA_DISPLAY=wayland starts a private headless sway instead of
  Xvfb; the process sends input through Wayland virtual keyboard and
  pointer devices instead of XTEST.
- A header's input_method starts a private fcitx5 with that input
  method on the run's display and session bus.

The input-method-composes-over-selection scenario reproduces lgse#1715 and
is skipped in the pinned image, which has no fcitx5.

Refs lgse#1715
…encies

Record the clamped Wayland pointer position and say that it is the
injector's own record, extend CI's release-graph check to the Wayland and
xkbcommon crates, note in the skip reason that the selected-stem run fails
until lgse#1715 is fixed, and name grim in Wayland screenshot errors.

Refs lgse#1715
@wmfeht

wmfeht commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator Author

Review follow-up in f287c36:

  1. Wayland pointer position. The motion is clamped to 0..=extent-1 once, and that same value goes to motion_absolute (extents unchanged) and to the stored position. The input log's button lines and move_by now see where the cursor can actually be. Doc comments on Wayland::pointer_position and Pointer::move_to now say that on Wayland the position is the injector's own record, so a lost motion goes unnoticed.
  2. QA scenarios CI job. Left as workflow_dispatch. The full ./scripts/qa.sh was run locally instead (results below).
  3. Release-graph check. The CI grep is now ^(x11rb|wayland-client|wayland-protocols-(misc|wlr)|xkbcommon) v, with a matching error message. I checked first: cargo tree --locked [--no-default-features] -e normal,build --prefix none has none of these crates in either graph (GTK pulls in only gdk4-wayland/gdk4-wayland-sys), and all five appear with --features qa. So the full pattern applies.
  4. Skip reason. The reason now says the selected-stem run fails until fix(input): let fcitx5 compose the first key over selected text #1715 is fixed and caret-at-end is the control. No docs or skill files quote skip reasons verbatim.
  5. Screenshot errors. They now name import or grim, depending on the display.

Validation (pinned container, run one after the other):

  • ./scripts/quality.sh (all phases): exit 0. fmt and clippy were clean. Tests: 4545 passed, 0 failed, 620 ignored (the QA runner's ignored scenarios included).
  • ./scripts/qa.sh (full): 634 passed, 1 failed, 2 skipped. The skipped runs are input-method-composes-over-selection (columns-selected-stem, columns-caret-at-end), skipped because the pinned image has no fcitx5. The failure was new-folder-with-selection-groups/columns (line 34: focused_pane stayed on the fixture root instead of grouped). A scoped rerun, ./scripts/qa.sh new-folder-with-selection-groups/columns, passed (1/1). This change touches only a doc comment and an error string on the X11 path, so I treat it as an unrelated flake. I didn't rerun the full suite.
  • git diff --check: clean.

Not verified: Wayland host runs (STRATA_QA_DISPLAY=wayland, sway and fcitx5) were not repeated, so the clamping and the new skip-reason text have not been exercised on Wayland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants