Skip to content

test: cover score timeline and score viewer rows of the release checklist - #678

Merged
FelipeDefensor merged 3 commits into
devfrom
test/score
Oct 19, 2026
Merged

FelipeDefensor merged 3 commits into
devfrom
test/score

Conversation

@FelipeDefensor

Copy link
Copy Markdown
Collaborator

Score timeline (tests/ui/timelines/score/test_score_timeline_ui.py):

  • Creating a score timeline from the menu bar, once and several times.
  • Setting and resetting the color of several selected notes at once.
  • The delete shortcut does nothing on notes (score components can't be deleted), and Enter opens the Inspector.
  • Notes keep their position after save and reopen.
  • Importing a score with no beat timeline shows an error.
  • Importing a score and then deleting every beat doesn't crash; the notes' metric position becomes None.

Score viewer (tests/ui/windows/test_svg_viewer.py): these drive the real SvgViewer end to end. Toolbar commands go through commands.execute, shortcuts through QTest.keyClick, and mouse and wheel input through real Qt events on the view's viewport. Only the MusicXML-to-SVG rendering step, which drives a QWebEngineView through VexFlow, is sidestepped: a hand-built SVG is loaded through SvgViewer.load_svg_data, the method the app calls once that step is done. Covered:

  • Annotations: creating, deleting and editing them by shortcut and toolbar, moving them with the mouse, clearing one to empty and confirming or declining its deletion, and changing the font size.
  • An annotation keeps its place after save and reopen, read back from the rebuilt viewer.
  • Closing and reopening the viewer.
  • Notes: double-clicking one seeks to it, single and multiple selection, zooming in and out.
  • The selection highlight follows the selected note. The test grabs the note's patch of the view and looks for the red fill SvgStaveNote.paint applies while it is selected; QGraphicsScene.render doesn't reproduce that fill, so it has to go through the view.

The rendering itself stays a manual check.

One commit changes the app: the score viewer's "Add annotation" and "Edit annotation" take the text as an optional argument and only ask for it when it's missing, as the commands in #671 do. The toolbar and the shortcuts still ask, and the shortcut tests keep answering that dialog.

These were written against 0.6.5 and rebased onto dev. Both test files conflicted only where dev had added tests at the end of the file; both sides are kept, except one line left over from the old test_symbol_staff_collision, which dev has since replaced. The viewer fixture now gets its viewer from get_or_create_svg_view(), because on dev reading svg_view no longer creates one. The tests predate some of TESTING.md's conventions; bringing them in line is left for a separate cleanup PR.

Run: uv run --python 3.12 pytest tests/ui/timelines/score tests/ui/windows/test_svg_viewer.py

Release-checklist rows: R333, R334, R341, R342, R343, R344, R346, R348, R349, R354, R375, R376, R377, R380, R382, R383, R384, R388, R389, R390, R391, R392, R393, R394. The IDs refer to the checklist copy in tilia-testing (release-checklist/test-links.csv); the code doesn't mention them.

…n text

"Add annotation" and "Edit annotation" always asked for the text in a
dialog. They now take it as an optional argument and only ask when it's
missing, like the commands in #671. The toolbar and the shortcuts call
them without arguments, so they still ask.

Editing to an empty text still asks whether to delete the annotation,
whether the empty text was typed or passed.
Adds regression coverage for: creating a score timeline (once or
several times) from the menu bar; setting/resetting the color of
several selected notes at once; the note keyboard shortcut for delete
doing nothing (score components aren't deletable) while Enter opens
the inspector; reloading a saved file keeps notes at the same
position; importing a score with no beat timeline shows an error; and
importing a score then deleting all beats does not crash, degrading
metric position to None instead.
Drives the real SvgViewer end to end: toolbar commands via
commands.execute(...), keyboard shortcuts via QTest.keyClick, and
mouse/wheel input via real Qt events on the view's viewport. Covers
annotations (create/delete/edit via shortcut and toolbar, moving with
the mouse, clearing to empty with confirm/decline, font size), window
lifecycle (close/reopen), and note interaction (click-to-seek,
single/multiple selection, zoom in/out).

Sidesteps only the MusicXML -> SVG render step
(tilia/parsers/score/musicxml_to_svg.py, which drives a QWebEngineView
through VexFlow) by loading a hand-built SVG directly through
SvgViewer.load_svg_data -- the same method the app calls once that
pipeline hands back its result.

The selection highlight is checked through the view: the note's patch
of the view is grabbed and searched for the red fill that paint()
applies while the item is selected, before and after moving the
selection. Going through QGraphicsScene.render instead doesn't
reproduce that fill.

An annotation added through the toolbar lands within a pixel of where
it was after a save-and-open round trip, read back from the rebuilt
viewer.
@FelipeDefensor

Copy link
Copy Markdown
Collaborator Author

Squashed to three commits and rebased onto dev (the only conflict was both sides appending tests and imports to test_score_timeline_ui.py; both kept).

Guarantees of the feat commit, checked by removing or neutralising the code and running tests/ui/timelines/score + tests/ui/windows/test_svg_viewer.py (97 tests):

  • Add/edit take the text as an argument: svg_viewer.py reverted to dev → 8 failed, 89 passed.
  • They still ask when no text is passed (toolbar, shortcuts): dialog call replaced by a cancel → 2 failed (test_create_annotation_shortcut, test_edit_annotation_shortcut).
  • Editing to an empty text still asks before deleting, also when the text is passed: confirmation skipped for passed text → 1 failed (test_edit_annotation_to_empty_deletes_it_toolbar).

With the code in place: 97 passed; full suite (pytest -n auto): 3121 passed, 14 skipped, 11 xfailed.

@FelipeDefensor
FelipeDefensor merged commit a06a969 into dev Oct 19, 2026
11 checks passed
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