fix: preserve staff-scoped staff-layout number="N"#326
Conversation
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.8% | 28513 / 36640 |
| Functions | 74.3% | 6352 / 8551 |
| Branches | 50.7% | 22678 / 44751 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 80.7% | 6401 / 7933 |
| Functions | 67.7% | 2217 / 3275 |
| Branches | 49.5% | 5496 / 11100 |
Core HTML report | API HTML report
Commit 798455f0292544538e266fed9bfd514f07e9cb02.
gen-quality
|
Both the per-measure <print> and score-level <defaults> readers took only the first <staff-layout>'s distance and dropped its number attribute entirely, folding it into the single unscoped SystemLayoutData::staffDistance. For a multi-staff part (e.g. a 2-staff piano/organ) whose only staff-layout is scoped to staff 2, this silently misattributed the distance to staff 1 (the schema default for a missing number) instead of dropping the number. Added SystemLayoutData::staffDistances (vector of new StaffDistanceData: staffIndex + distance), populated only when the source's <staff-layout> had an explicit number attribute; the existing singular staffDistance keeps its meaning for the common unscoped case. Both readers (ScoreReader:: scanForSystemInfo, LayoutFunctions::addStaffLayout) and both writers (MeasureWriter::writeSystemInfo, LayoutFunctions::addSystemMargins) handle it symmetrically since defaults and per-measure print share SystemLayoutData. ## Testing - [x] New `staffScopedStaffDistance` test (PrintLayoutRoundTripTest.cpp) - [x] make test: all pass (4729 assertions in 379 test cases, plus examples) - [x] make test-api-roundtrip: 158 passed, 0 failed (of 158 pinned; no regressions -- this fix corrects a wrong-staff misattribution rather than unlocking a new fully-passing file) - [x] make fmt / make check: clean Closes #281
c48404d to
beefd31
Compare
staff-layout number="N"
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.8% | 28513 / 36640 |
| Functions | 74.3% | 6352 / 8551 |
| Branches | 50.7% | 22678 / 44751 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 80.8% | 6434 / 7963 |
| Functions | 67.8% | 2221 / 3276 |
| Branches | 49.6% | 5524 / 11148 |
Core HTML report | API HTML report
Commit 1b8a0ab9ac2c26582882e07d4be01984f5f5b484.
gen-quality
|
| { | ||
| /// A <staff-layout> scoped to one staff of a multi-staff part (MusicXML's number attribute): | ||
| /// the space between the bottom line of the previous staff and the top line of this one. | ||
| /// staffIndex is zero-based; a source with an explicit number attribute always populates |
There was a problem hiding this comment.
A source? Meaning a file?
Since the coding agent has been tasked with round trip success, it is writing API documentation from that vantage-point which would be confusing to a user. Instead this documentation should explain how someone using mx::api to build up a score should use the interface. And the interface should avoid adding confusing things that exist solely to represent what is not music-notation-semantics-meaningful in a round-trip corpus test file.
/// staffIndex is zero-based; a source with an explicit number attribute always populates
Human Summary
TODO: human writes here
Summary
Both the per-measure
<print>and score-level<defaults>readers took only the first<staff-layout>'s distance and dropped itsnumberattribute entirely, folding it into the singleunscoped
SystemLayoutData::staffDistance. For a multi-staff part (e.g. a 2-staff piano/organ)whose only
staff-layoutis scoped to staff 2, this silently misattributed the distance to staff 1(the schema default for a missing
number) instead of just dropping the attribute -- a real,if quiet, correctness bug, not only a fidelity loss.
Added
SystemLayoutData::staffDistances(a vector of a newStaffDistanceData:staffIndex+staffDistance), populated only when the source's<staff-layout>had an explicitnumberattribute; the existing singular
staffDistancekeeps its meaning for the common unscoped case.Both readers (
ScoreReader::scanForSystemInfo,LayoutFunctions::addStaffLayout) and both writers(
MeasureWriter::writeSystemInfo,LayoutFunctions::addSystemMargins) handle it symmetrically,since
<defaults>and per-measure<print>already shareSystemLayoutData.Testing
staffScopedStaffDistancetest (PrintLayoutRoundTripTest.cpp)make test: all pass (4729 assertions in 379 test cases, plus the three examples)make test-api-roundtrip: 158 passed, 0 failed (of 158 pinned; no regressions -- this fixcorrects a wrong-staff misattribution rather than unlocking a new fully-passing file, since none
of the affected corpus files had this as their sole blocker)
make fmt/make check: cleanReferences