api: header and layout round-trip: midi-name, defaults fonts, credit gaps, per-measure print#202
Merged
Conversation
Summary ------- The reader (PartReader::parseMidiInstrument) sets MidiData.name from <midi-name>, but PartWriter never wrote it back, so a MIDI instrument name was lost on round-trip. Add the writer side so <midi-name> survives write -> read. Test plan --------- - Add MidiNameRoundTripTest: construct a ScoreData with a MIDI name, round-trip it through write+read, assert the name survives. - make fmt / make check / make test all green. - make test-api-roundtrip green.
Summary ------- The <defaults> fonts <music-font>, <word-font>, and <lyric-font> were not modeled in DefaultsData and were dropped on both read and write. Reuse the existing FontData type: - Add optional musicFont/wordFont (FontData) and a lyricFonts vector (new LyricFontData = FontData + number/name attributes) to DefaultsData. - Wire the read side (LayoutFunctions::addDefaultsFonts core -> api) and write side (addDefaultsFonts api -> core), reusing the existing getFontData / setAttributesFromFontData helpers, which adapt to the core EmptyFont and LyricFont element shapes via SFINAE. Test plan --------- - Add DefaultsFontsRoundTripTest covering word/music font and multiple lyric fonts (with number/name) through write+read. - make fmt / make check / make test all green. - make test-api-roundtrip green.
Summary ------- Three gaps in <credit> handling are addressed: - credit-image: add api::PageImageData (source, type, width, height, page, position) and a ScoreData.pageImageItems vector; read and write <credit-image> credits. (Vertical alignment uses the credit-image specific ValignImage vocabulary and is intentionally not modeled.) - no-words credits: a <credit> whose content is not <credit-words> (e.g. <credit-symbol>) was dropped on read. It is now preserved as a PageTextData (empty text + credit-types). On write, a credit-words element is always emitted so metadata-only credits survive. - multiple credit-type: previously only the first <credit-type> survived. Add PageTextData.creditTypes (full list, document order); read and write all of them. The legacy field still mirrors the first credit-type. The two PageText read/write functions were unified into createCredits, operating on ScoreData so they can populate both text and image items. Test plan --------- - Add CreditRoundTripTest: multiple credit-types, a no-words credit, and a credit-image (with size and position) through write+read. - make fmt / make check / make test all green. - make test-api-roundtrip green.
Summary ------- Per-measure <print> layout was write-biased: MeasureWriter emitted a <staff-layout> staff-distance, but the read side ignored it, so it was lost on round-trip. (new-system, new-page, page-number, system-layout and page-layout were already read at the score level via ScoreReader::scanForSystemInfo / scanForPageInfo; MeasureReader::parsePrint was a no-op.) - Read: ScoreReader::scanForSystemInfo now also reads the per-measure <staff-layout> staff-distance into SystemData.layout.staffDistance. - Write: MeasureWriter::writeSystemInfo now emits <staff-layout> staff-distance from SystemData.layout.staffDistance. - parsePrint is documented to explain that per-measure print layout is captured at the score level (keyed by measure index), since the per-measure music-data hook has no api home of its own. Test plan --------- - Add PrintLayoutRoundTripTest: a per-measure print with staff-distance (and system-distance) survives write+read. Verified red before the read-side change and green after. - make fmt / make check / make test all green. - make test-api-roundtrip green.
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36620 |
| Functions | 74.4% | 6360 / 8548 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 69.1% | 4839 / 6998 |
| Functions | 55.9% | 1567 / 2802 |
| Branches | 40.8% | 3968 / 9730 |
Core HTML report | API HTML report
Commit 754d165b6f362c0692a0adea1c36633549a26305.
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.
Addresses issues found during an
mx::apiaudit; sections 3 (#192), 2.4 (#189), 2.2 (#187), 2.1 (#186) of the checked-in audit doc.Scope notes: credit-image valign uses the image-specific
ValignImagevocabulary (not modeled);credit-symbolglyph not modeled (structure preserved). Per-measure print new-system/new-page/page-number/system-layout/page-layout already round-trip at score level keyed by measure index.Test plan
MidiNameRoundTripTest.cpp,DefaultsFontsRoundTripTest.cpp,CreditRoundTripTest.cpp,PrintLayoutRoundTripTest.cpp(red before fix, green after)make testgreen (229 cases),make checkgreen,make test-api-roundtripbaseline unchangedReferences