fix: round-trip the credit-words justify attribute - #300
Merged
Conversation
The api dropped the justify attribute of <credit-words>: PageTextData had no field for it, so the impl reader never captured it and the writer never emitted it. - Add PageTextData::justify using the existing HorizontalAlignment enum (unspecified = attribute absent). Kept separate from positionData's halign because MusicXML defines both attributes on <credit-words>. - Read/write it in PageTextFunctions via the existing Converter halignMap (core::LeftCenterRight <-> api::HorizontalAlignment); no new enum or converter entries. - Unit tests: justify=center survives the round trip and appears in the serialized XML; an absent justify stays absent. - Baseline: lysuite/ly52a_PageLayout.xml now survives the strict compare (its only divergence was the dropped attribute); pinned count 121 -> 122. Closes #273
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.8% | 28487 / 36624 |
| Functions | 74.3% | 6349 / 8550 |
| Branches | 50.6% | 22632 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 78.7% | 6121 / 7780 |
| Functions | 64.3% | 2091 / 3252 |
| Branches | 47.9% | 5214 / 10876 |
Core HTML report | API HTML report
Commit 4182071428a0e060f345ac23c3e854217e41a48e.
gen-quality
|
webern
marked this pull request as ready for review
July 5, 2026 10:09
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.
Human Summary
Looks like a straightforward and correct fix for a missing attribute to me.
Summary
The api round-trip dropped the
justifyattribute of<credit-words>:PageTextDatahad no field for it, so the impl reader never captured it and the writer never emitted it.PageTextData(src/include/mx/api/PageTextData.h) gains ajustifyfield using the existingHorizontalAlignmentenum, withunspecifiedmeaning the attribute is absent — the same idiom as its neighboring halign field (positionData.horizontalAlignmnet). justify is kept separate from halign because MusicXML defines both attributes on<credit-words>.PageTextFunctions.cppreadsjustifyoff the coreFormattedTextIDand writes it back, through the existingConverterhalignMap (core::LeftCenterRight<->api::HorizontalAlignment). No new enum and no new converter entries.Non-breaking: one new defaulted field plus its equality line.
Testing
justify="center"survives the api round trip and appears in the serialized XML; an absent justify stays absent (no attribute emitted)lysuite/ly52a_PageLayout.xmlnow surfacesjustify=centerinPageTextDataand re-emitsjustify="center"— the file now survives the strict DOM compare entirely and is pinned in the baseline (121 -> 122 files,make test-api-roundtrip: 122 passed, 0 failed)credit-words@justify; they remain blocked by unrelated gaps, so they are not pinnedmake fmt/make checkcleanReferences