Link partial lyric dash verse with ending lyric#33350
Conversation
📝 WalkthroughWalkthroughThis change implements coordinated undo behavior for verse property changes in lyrics spanning partial lines. When a verse property is undone on a 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/engraving/tests/lyrics_tests.cpp`:
- Around line 40-67: Replace the soft checks with hard assertions for any
pointer that is dereferenced later: use ASSERT_TRUE/ASSERT_NE instead of
EXPECT_TRUE for the result of ScoreRW::readScore (score), Measure* m2 (from
first()->nextMeasure()), ChordRest* endCR (from lastChordRest), the found
Lyrics* l1 and l2 (from iterating endCR->lyrics()), and the PartialLyricsLine*
pll (from findPrevPartialLyricsLineDash(l1)); this ensures the test aborts on
null and prevents null dereference when calling methods like first(),
nextMeasure(), lastChordRest(), lyrics(), and findPrevPartialLyricsLineDash().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ae47a3c0-49ef-4c5f-8f42-7bdd3b31c6be
📒 Files selected for processing (6)
src/engraving/dom/lyrics.cppsrc/engraving/dom/lyrics.hsrc/engraving/dom/lyricsline.cppsrc/engraving/tests/CMakeLists.txtsrc/engraving/tests/lyrics_data/partialLyricsLineVerse.mscxsrc/engraving/tests/lyrics_tests.cpp
| MasterScore* score = ScoreRW::readScore(LYRICS_DATA_DIR + u"partialLyricsLineVerse.mscx"); | ||
|
|
||
| Measure* m2 = score->first()->nextMeasure(); | ||
|
|
||
| EXPECT_TRUE(m2); | ||
|
|
||
| ChordRest* endCR = m2->lastChordRest(0); | ||
|
|
||
| EXPECT_TRUE(endCR); | ||
|
|
||
| Lyrics* l1 = nullptr; | ||
| Lyrics* l2 = nullptr; | ||
|
|
||
| for (Lyrics* l : endCR->lyrics()) { | ||
| if (l->verse() == 0) { | ||
| l1 = l; | ||
| } | ||
| if (l->verse() == 1) { | ||
| l2 = l; | ||
| } | ||
| } | ||
|
|
||
| EXPECT_TRUE(l1); | ||
| EXPECT_TRUE(l2); | ||
|
|
||
| PartialLyricsLine* pll = findPrevPartialLyricsLineDash(l1); | ||
|
|
||
| EXPECT_TRUE(pll); |
There was a problem hiding this comment.
Use ASSERT_* for required pointers before dereferencing.
These are hard preconditions for the rest of the test. With EXPECT_TRUE, the test can continue and crash on null dereference.
💡 Suggested fix
MasterScore* score = ScoreRW::readScore(LYRICS_DATA_DIR + u"partialLyricsLineVerse.mscx");
+ASSERT_TRUE(score);
Measure* m2 = score->first()->nextMeasure();
-
-EXPECT_TRUE(m2);
+ASSERT_TRUE(m2);
ChordRest* endCR = m2->lastChordRest(0);
-
-EXPECT_TRUE(endCR);
+ASSERT_TRUE(endCR);
@@
-EXPECT_TRUE(l1);
-EXPECT_TRUE(l2);
+ASSERT_TRUE(l1);
+ASSERT_TRUE(l2);
@@
-EXPECT_TRUE(pll);
+ASSERT_TRUE(pll);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/engraving/tests/lyrics_tests.cpp` around lines 40 - 67, Replace the soft
checks with hard assertions for any pointer that is dereferenced later: use
ASSERT_TRUE/ASSERT_NE instead of EXPECT_TRUE for the result of
ScoreRW::readScore (score), Measure* m2 (from first()->nextMeasure()),
ChordRest* endCR (from lastChordRest), the found Lyrics* l1 and l2 (from
iterating endCR->lyrics()), and the PartialLyricsLine* pll (from
findPrevPartialLyricsLineDash(l1)); this ensures the test aborts on null and
prevents null dereference when calling methods like first(), nextMeasure(),
lastChordRest(), lyrics(), and findPrevPartialLyricsLineDash().
|
@miiizen Tested and approved on Ubuntu 24.04.4 LTS. |
Resolves: #32979