Skip to content

2.8.0 — thirteen defects a reviewer found that 1025 tests did not

Choose a tag to compare

@alessonqueirozdev-hub alessonqueirozdev-hub released this 31 Aug 14:54
· 209 commits to master since this release

Thirteen defects, twelve of them found by a reviewer looking at the rendered gallery rather than by any test. 1025 tests passed before that review and after it — which is the honest measure of what this suite knew about how the music actually looks.

Four of the fixes turned out to be the same failure — a decision written down in more than one place, and the copies disagreeing — and four more were reserved space not matching painted ink, the vertical twin of a defect closed horizontally in 2.7.0.

Engraving

  • An unknown clef name became a treble clef, in silence. Clef(type: 'bass') drew a G clef: the legacy string switch accepted exactly g, f and c and fell through to default: treble for everything else. Every legacy call site in this repository passed treble or bass — the first happened to be right because treble is also the fallback, and every bass drew a treble clef on a bass staff, with the notes then engraved on the wrong lines. It now accepts the vocabulary people write and throws on anything else. The class also had two fields that could disagree: clefType reported treble while every renderer read a private field that said bass.
  • A slur or tie was clipped off the top of the page. A curve is drawn between notes and is not a positioned element, so the canvas was sized as if the arc were not there. Measured at staffSpace = 12: a 219 px canvas with 12 px of ink hard against row 0. Now 258 px, first ink at row 25.
  • Sung text was printed through its own notehead. The lyric line sat a fixed 1.5 staff spaces below the staff. Measured with a C4 in treble clef: the line fell at 127.5 against a notehead bottom edge of 129 — 1.5 px inside the note.
  • A dense passage on one staff squeezed the others. An SATB choir's four quarters space at 61 / 61 / 60 px alone and collapsed to 118 / 28 / 35 beside a piano triplet, while the system stayed exactly as wide. The shared grid is built from steps now: 119 / 61 / 61.
  • A hairpin attached to a note was 72 pixels long — a fixed stub with no relationship to the music. It spans to the next dynamic or the barline now.
  • Two directions above the staff were drawn on top of each other. They are interval-packed into rows now. Underneath it, a tempo mark's reserved width was a character count against a renderer using a real TextPainter — and a single tempo mark was already being clipped, 1 px against row 0, on every score with a metronome mark this package had ever drawn.
  • A tuplet containing a rest lost its stems — the notes were marked beamed for a beam that was never drawn.
  • A grace-note slur crossed the stem it was meant to avoid. Three copies of the stem-direction rule disagreed at exactly one value: the middle line, the most common position on the staff.
  • The arpeggio sign was on the wrong side, and inside the chord. It was placed opposite the stem, cited to a page that does not say that — an arpeggio is written to the left, always — and the rotated glyph's centring put the ink 39 px from where the caller asked for it.

Added

KeySignature.alterFor(step) and KeySignature.pitch(step, octave), because there was no way to say "spell this note as the key implies" — and this package's own flagship example forgot, printing a natural in front of nearly every F in a D-major piece. The accidental resolver was right the whole time; the score was wrong.

Also LyricLayout, StaffPositionCalculator.stemUpFor, Clef.clefTypeFromName, and the above-staff stacking values on LayoutEngine.

Example gallery

Eight new pages covering the half of this package that is not drawing: MusicXML round trips, MEI import, MIDI export down to a hex dump of the file header, transposing instruments, ensemble scores, long-score wrapping, theming, and a diagnostics page that triggers every reporting channel with input that actually provokes it — including the four malformed MusicXML cases that are still absorbed in silence.

And a Live Editor: type JSON, MusicXML or MEI and watch the staff re-render, with refusals and warnings shown instead of an empty panel.

A page that fails to build now says why, instead of painting the grey rectangle Flutter's release ErrorWidget gives you.

Corrected claim

The compatibility table said tablature was "modeled & rendered". It is not rendered: the renderer draws an ordinary notehead on a five-line staff with ledger lines, where tablature needs one line per string and the fret number printed on it. That row now says model only and points at #45.

Behaviour change

Clef(type: ...) throws ArgumentError on an unrecognised name instead of returning a treble clef. Code relying on that fallback was already producing a wrong score, silently.

Still open, and said plainly

Native playback exists only on Android (#1, #15). Layout cannot move to an isolate as written (#27). No text face ships (#28). Four kinds of malformed MusicXML are absorbed in silence (#29). Tablature is model-only (#45).

Verification

flutter test → 1025 pass on Ubuntu, Windows and macOS. Pixel goldens → 55 pass. dart analyze, the example app and pub publish --dry-run → clean.