Draft
Conversation
The ApplicationWindow tangled window-shell concerns with the menu bar, loaders, and view-model wiring, and embedded a native mpv framebuffer object that requires a live GL surface and cannot be re-instantiated cleanly between tests. QML tests of the menu bar were therefore blocked: the first forces an ApplicationWindow nested inside a TestCase Item, the second crashes on the second instantiation under a real platform window. Splitting the content into MpvqcApplicationContent (a plain Item) gives tests a shell-free root to drive. Swapping the player for a stub when the test setup defines the `mpvqcTestMode` context property frees the FBO from test re-instantiation, so each test starts clean under both offscreen and visible-window runs. The stub is excluded from release builds alongside other test-only files.
Menu items, dialogs, message boxes, and loaders need stable handles for QML tests to drive without relying on translated text or layout positions. Adding `objectName`s across the menu bar (including its radio and language submenus) and onto every dialog, message-box, and loader root gives findChild a naming- convention-driven map of the testable surface. A smoke test exercises Help → About end-to-end as the canonical pattern future menu-bar tests will follow. The menu is opened via `menu.open()` rather than mouseClick — Menu is a Popup, not an Item, so QtTest rejects it as a click target — then the About item is clicked and the dialog loader's loaded item is observed by `objectName`.
The qmltestrunner setup previously lived in `test/prepare_qml.py` alongside pytest fixtures, blurring the line between two independent test stacks that share no scope. Splitting them into separate top-level packages makes each runner's home obvious and lets the QML test infra grow without polluting pytest's space. Two pre-existing footguns get fixed in passing. Settings now go to a per-process tempdir instead of the real user ini, so QML tests can no longer overwrite developer preferences. A QML-callable test bridge wraps `inject.configure(...)`, letting tests reset the service container between runs and removing a class of state leakage that previously had to be accepted as-is. The `test-qml` Justfile recipe collapses from a 14-line inline-Python heredoc to `uv run -m testqml.main`, putting the entry point on the same lint and type-check footing as the rest of the codebase.
| from PySide6.QtQml import QQmlEngine | ||
| from PySide6.QtQuickTest import QUICK_TEST_MAIN_WITH_SETUP | ||
|
|
||
| import testqml.bridge # noqa: F401, registers MpvqcTestBridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.