Skip to content

docs(rules): record Qt offscreen-test and layout gotchas#82

Merged
jakewan merged 1 commit into
mainfrom
feature/qt-app-testing-gotchas
Jun 22, 2026
Merged

docs(rules): record Qt offscreen-test and layout gotchas#82
jakewan merged 1 commit into
mainfrom
feature/qt-app-testing-gotchas

Conversation

@jakewan

@jakewan jakewan commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Overview

The transactions-view work (#33, merged in PR #81) ran into a few Qt traps that aren't captured anywhere, so the next app session would re-discover them the hard way. This records them in the path-conditioned qt-app.md rule (which loads only when app/ files are edited), turning hard-won debugging into guidance.

Three additions:

  • Offscreen assertions — a control's visible/enabled getter returns effective state (ancestor- and window-dependent), so it reads false under the offscreen test harness even when the local binding is true. Assert a logical readonly property bool instead, and bind the visual property to it.
  • Layout recursive-rearrange — binding a child's Layout.preferredWidth to its parent layout's own size feeds back and makes Qt abort the layout pass with a runtime warning headless tests log but pass through. Use Layout.fillWidth, and give ListView delegates a fixed width sized height-from-content.
  • Mock faithfulness — when a mock models client-internal behavior, mirror the real client's observable state transitions so specs see realistic states.

Follows up the work in #33 (PR #81).

The transactions-view work surfaced three Qt traps worth codifying so a
future app session reads the lesson instead of re-discovering it:

- Offscreen assertions: a control's visible/enabled getter returns
  effective (ancestor/window-dependent) state, so it reads false in the
  offscreen harness even when the local binding is true. Assert a logical
  readonly bool instead, and bind the visual property to it.
- Layout recursive-rearrange: binding a child's Layout.preferredWidth to
  its parent layout's own size feeds back and Qt aborts the pass with a
  runtime warning headless tests spam but pass through. Use fillWidth, and
  give ListView delegates a fixed width sized height-from-content.
- Mock faithfulness: when a mock models client-internal behavior, mirror
  the real client's observable state transitions so specs see realistic
  states.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jakewan jakewan marked this pull request as ready for review June 22, 2026 00:24
@jakewan jakewan merged commit 01097d1 into main Jun 22, 2026
3 checks passed
@jakewan jakewan deleted the feature/qt-app-testing-gotchas branch June 22, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant