feat: implement rehearsal writing in DirectionWriter#215
Merged
Conversation
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36624 |
| Functions | 74.4% | 6360 / 8550 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 72.3% | 5373 / 7430 |
| Functions | 60.2% | 1824 / 3029 |
| Branches | 43.1% | 4481 / 10386 |
Core HTML report | API HTML report
Commit 95005f43dd576fd479c89d7fb32188e32f1251d6.
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36624 |
| Functions | 74.4% | 6360 / 8550 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 72.3% | 5375 / 7432 |
| Functions | 60.2% | 1824 / 3029 |
| Branches | 43.2% | 4483 / 10387 |
Core HTML report | API HTML report
Commit 8115fa813386940d6b38631dc55e71c037ada8d3.
Fixes #205 and closes #134. `DirectionWriter` was missing a write path for `RehearsalData`, causing rehearsal marks to be silently dropped on output. Add a loop over `directionData.rehearsals` that emits `<rehearsal>` elements, mirroring the segno/coda pattern from PR #203. While wiring up the round-trip test, also fix two gaps in `DirectionReader::parseRehearsal`: it was not reading `fontData` (calling `getFontData`) and was not setting `isColorSpecified` before copying color attributes, so those fields were always lost on the read path. Tests added: - `rehearsalRoundTrip` in `DirectionWriterTest.cpp`: api → core → api round-trip at the impl layer, covering text, position, font, color, and enclosure. - `RehearsalSyntheticFileRead` in `DirectionDataTest.cpp`: loads `data/synthetic/rehearsal.3.1.xml` and asserts the read path surfaces text and enclosure. - `RehearsalRoundTripXml` in `DirectionDataTest.cpp`: full MusicXML serialization/deserialization round-trip via `mxtest::roundTrip` covering text, enclosure, and font weight.
… on write When a rehearsal element had no enclosure attribute in the source XML, the reader left RehearsalData::enclosure at its default (rectangle), and the writer would then emit enclosure="rectangle", silently modifying the document on round-trip. Fix by adding an `unspecified` sentinel to RehearsalEnclosure, changing the RehearsalData default to `unspecified`, and skipping the enclosure setEnclosure call in DirectionWriter when the value is unspecified. Adds RehearsalUnspecifiedEnclosureNoPhantomAttribute test that asserts no enclosure attribute appears in the serialized XML and that the field round-trips as unspecified.
762e282 to
a7c6684
Compare
gen-quality
|
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36624 |
| Functions | 74.4% | 6360 / 8550 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 72.3% | 5375 / 7432 |
| Functions | 60.2% | 1824 / 3029 |
| Branches | 43.2% | 4483 / 10387 |
Core HTML report | API HTML report
Commit 259076d1aefd2dcafa86732fc33965cf5d6779ca.
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.
Summary
DirectionWriterhad no write path forRehearsalData, so rehearsal marks were silently dropped whenever a score was serialized. This adds a loop overdirectionData.rehearsalsthat emits<rehearsal>elements, mirroring the segno/coda pattern from #203.While wiring up the round-trip test, two gaps in
DirectionReader::parseRehearsalwere also found and fixed: it was not callinggetFontData, and it was not settingisColorSpecifiedbefore copying color attributes, so both fields were always lost on the read path. TheisColorSpecifiedgap is the same bug class described in #207 (which covers the same pattern inparseWords— left for a separate PR).A post-review fix also adds
RehearsalEnclosure::unspecifiedas the new default forRehearsalData::enclosure. Previously the default wasrectangle, so any rehearsal with noenclosureattribute in the source XML would silently gainenclosure="rectangle"on write-back.Changes
RehearsalData.h— addedRehearsalEnclosure::unspecified; changedRehearsalDatadefault enclosure fromrectangletounspecified.DirectionWriter::getDirectionLikeThings— new loop overrehearsalsemitting<rehearsal>with text, position, font, color, and enclosure (skipped whenunspecified).DirectionReader::parseRehearsal— now readsfontDataviagetFontDataand correctly gatescolorDatabehindisColorSpecified.Testing
rehearsalRoundTrip(DirectionWriterTest.cpp) — api → core → api at the impl layer; covers text, position, font, color, and enclosure shapes. Red before the fix, green after.RehearsalSyntheticFileRead(DirectionDataTest.cpp) — loadsdata/synthetic/rehearsal.3.1.xmland asserts the read path surfaces text and enclosure. Pins the core → api direction.RehearsalRoundTripXml(DirectionDataTest.cpp) — full MusicXML serialization/deserialization round-trip; covers text, enclosure, and font weight.RehearsalUnspecifiedEnclosureNoPhantomAttribute(DirectionDataTest.cpp) — asserts thatenclosure="rectangle"does not appear in serialized XML when enclosure is unspecified, and that the field round-trips asunspecified.make test-api-roundtripbaseline (1 pinned file): still passes.make check(fmt-check): passes.References
DirectionWriter#205parseWordsnever setsWordsData.isColorSpecified— words color does not round-trip #207 (fixes theparseRehearsalisColorSpecifiedgap; theparseWordshalf of impl:parseWordsnever setsWordsData.isColorSpecified— words color does not round-trip #207 is left for a separate PR)