fix(api): round-trip the key cancel location attribute - #299
Merged
Conversation
The api round-trip dropped the location attribute of the key cancel element: the reader parsed the cancel fifths value but ignored the attribute, and the writer never emitted it. Add api::CancelLocation (unspecified/left/right/beforeBarline) and KeyData::cancelLocation, bridge it with Converter::cancelLocationMap, read it in MeasureReader::parseAttributes, and write it in PropertiesWriter::writeTraditionalKey when a cancel is present. Pin synthetic/cancel.location.3.0.xml in roundtrip-baseline.txt now that it survives the strict compare (121 -> 122 pinned files). Closes #272
# Conflicts: # src/include/mx/api/KeyData.h
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.8% | 28487 / 36626 |
| Functions | 74.2% | 6349 / 8551 |
| Branches | 50.6% | 22632 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 78.7% | 6125 / 7784 |
| Functions | 64.3% | 2094 / 3255 |
| Branches | 47.9% | 5213 / 10876 |
Core HTML report | API HTML report
Commit f7230dea627a0585bcd1d1473fdef00d4e719338.
gen-quality
|
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 fairly straightforward, and correct fix to a missing attribute in the API.
Summary
The api round-trip dropped the key
cancelelement'slocationattribute (classifier signatureattr:cancel@location):MeasureReaderread the cancel fifths value but ignored the attribute, andPropertiesWriternever emitted it.KeyData.hgainsenum class CancelLocation { unspecified, left, right, beforeBarline }and aKeyData::cancelLocationfield (defaultunspecified, meaning the attribute is absent), plus the matching equality macro line. This follows the existing convention for absent-able enums (unspecifiedsentinel, neverstd::optional).ConvertergainscancelLocationMapand the twoconvertoverloads bridgingcore::CancelLocation.MeasureReader::parseAttributesreads the attribute when a cancel is present;PropertiesWriter::writeTraditionalKeywrites it whencancelLocationis notunspecified. As before, the cancel element itself is only emitted whencancel != 0, so a location without a cancel is ignored.Non-breaking: additive field with a default that preserves existing behavior.
Testing
KeyDataTest.cpp: core-level write check + serialize/deserialize survival (CancelLocationBeforeBarline), attribute-absent behavior (CancelLocationUnspecified), read path from XML mirroring the synthetic fixture (CancelLocationFromXml), and equality coverage (KeyDataEquality_change_cancelLocation). All fail before the fix.make test(4503 assertions in 350 test cases).make discover-api-roundtripbefore/after diff shows exactly one file changed:synthetic/cancel.location.3.0.xmlFAIL -> PASS, attributable to this fix. It is now pinned inroundtrip-baseline.txt(121 -> 122 files).make test-api-roundtripregression gate: 122 passed, 0 failed (of 122 pinned).make fmtandmake checkpass.References