From f5624ddfa9660d24bdd8543b340301a487d46d47 Mon Sep 17 00:00:00 2001 From: Matthew James Briggs Date: Tue, 16 Jun 2026 15:27:39 +0000 Subject: [PATCH] Fix AccidentalValue::sharpSharp missing from accidentalMap in Converter.cpp The accidentalMap in Converter.cpp was missing an entry for core::AccidentalValue::sharpSharp / api::Accidental::sharpSharp. As a result, sharp-sharp was silently lost on read (falling back to Accidental::none) and written back as natural on round-trip. Adds the missing one-row entry and a regression test that verifies sharpSharp survives an api round-trip through XML. --- src/private/mx/impl/Converter.cpp | 1 + src/private/mxtest/api/PitchDataTest.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/private/mx/impl/Converter.cpp b/src/private/mx/impl/Converter.cpp index cc702d9a..f486bfbf 100644 --- a/src/private/mx/impl/Converter.cpp +++ b/src/private/mx/impl/Converter.cpp @@ -80,6 +80,7 @@ const Converter::EnumMap Converter::acci {core::AccidentalValue::natural(), api::Accidental::natural}, {core::AccidentalValue::flat(), api::Accidental::flat}, {core::AccidentalValue::doubleSharp(), api::Accidental::doubleSharp}, + {core::AccidentalValue::sharpSharp(), api::Accidental::sharpSharp}, {core::AccidentalValue::flatFlat(), api::Accidental::flatFlat}, {core::AccidentalValue::naturalSharp(), api::Accidental::naturalSharp}, {core::AccidentalValue::naturalFlat(), api::Accidental::naturalFlat}, diff --git a/src/private/mxtest/api/PitchDataTest.cpp b/src/private/mxtest/api/PitchDataTest.cpp index 607b7128..99382359 100644 --- a/src/private/mxtest/api/PitchDataTest.cpp +++ b/src/private/mxtest/api/PitchDataTest.cpp @@ -222,6 +222,29 @@ TEST(AlmostDoubleFlat, PitchData) T_END; +TEST(SharpSharp, PitchData) +{ + // Regression: accidentalMap was missing sharpSharp, so it round-tripped as Accidental::none. + auto input = Input{}; + input.step = Step::c; + input.alter = 2; + input.cents = 0.0; + input.accidental = Accidental::sharpSharp; + const std::string expectedAlterString = "2"; + const int expectedAlter = 2; + const double expectedCents = 0.0; + const Accidental expectedAccidental = Accidental::sharpSharp; + const auto output = pitchDataTest(input); + + CHECK_EQUAL(expectedAlterString, output.alterString); + CHECK_EQUAL(expectedAlterString, output.secondAlterString); + CHECK_EQUAL(expectedAlter, output.alter); + CHECK_DOUBLES_EQUAL(expectedCents, output.cents, MX_API_EQUALITY_EPSILON); + CHECK(expectedAccidental == output.accidental); +} + +T_END; + TEST(CrazyEdgeCase1, PitchData) { auto input = Input{};