@@ -933,7 +933,7 @@ void EditorServiceTest::test_requestLinearVelocityInterpolationOnColumn_shouldIn
933933 QVERIFY (editorService.requestPosition (0 , 0 , 0 , 7 , 0 ));
934934 QVERIFY (editorService.requestNoteOnAtCurrentPosition (1 , 3 , 64 ));
935935
936- editorService.requestLinearVelocityInterpolationOnColumn (0 , 7 , 0 , 100 );
936+ editorService.requestLinearVelocityInterpolationOnColumn (0 , 7 , 0 , 100 , false );
937937
938938 QCOMPARE (noteDataChangedSpy.count (), 6 );
939939 QCOMPARE (editorService.displayNoteAtPosition (0 , 0 , 0 , 0 ), " C-3" );
@@ -965,7 +965,7 @@ void EditorServiceTest::test_requestLinearVelocityInterpolationOnTrack_shouldInt
965965 QVERIFY (editorService.requestPosition (0 , 0 , 1 , 7 , 0 ));
966966 QVERIFY (editorService.requestNoteOnAtCurrentPosition (1 , 3 , 64 ));
967967
968- editorService.requestLinearVelocityInterpolationOnTrack (0 , 7 , 0 , 100 );
968+ editorService.requestLinearVelocityInterpolationOnTrack (0 , 7 , 0 , 100 , false );
969969
970970 QCOMPARE (noteDataChangedSpy.count (), 12 );
971971
@@ -984,6 +984,34 @@ void EditorServiceTest::test_requestLinearVelocityInterpolationOnTrack_shouldInt
984984 QCOMPARE (editorService.displayVelocityAtPosition (0 , 0 , 1 , 7 ), " 100" );
985985}
986986
987+ void EditorServiceTest::test_requestLinearVelocityInterpolationOnColumn_shouldInterpolateVelocitiesAsPercentages ()
988+ {
989+ EditorService editorService;
990+ QSignalSpy noteDataChangedSpy { &editorService, &EditorService::noteDataAtPositionChanged };
991+
992+ QVERIFY (editorService.requestPosition (0 , 0 , 0 , 0 , 0 ));
993+ QVERIFY (editorService.requestNoteOnAtCurrentPosition (1 , 3 , 100 )); // Initial velocity 100
994+ QVERIFY (editorService.requestPosition (0 , 0 , 0 , 3 , 0 ));
995+ QVERIFY (editorService.requestNoteOnAtCurrentPosition (1 , 3 , 50 )); // Initial velocity 50
996+ QVERIFY (editorService.requestPosition (0 , 0 , 0 , 7 , 0 ));
997+ QVERIFY (editorService.requestNoteOnAtCurrentPosition (1 , 3 , 20 )); // Initial velocity 20
998+
999+ // Interpolate from 50% to 150%
1000+ editorService.requestLinearVelocityInterpolationOnColumn (0 , 7 , 50 , 150 , true );
1001+
1002+ QCOMPARE (noteDataChangedSpy.count (), 6 );
1003+ QCOMPARE (editorService.displayNoteAtPosition (0 , 0 , 0 , 0 ), " C-3" );
1004+ // Line 0: 100 * 0.50 = 50
1005+ QCOMPARE (editorService.displayVelocityAtPosition (0 , 0 , 0 , 0 ), " 050" );
1006+ QCOMPARE (editorService.displayNoteAtPosition (0 , 0 , 0 , 3 ), " C-3" );
1007+ // Line 3: Interpolated percentage at line 3: 50 + (150 - 50) * (3.0 / 7.0) = 50 + 100 * 0.42857 = 50 + 42.857 = 92.857
1008+ // Velocity at line 3: 50 * 92.857 / 100 = 46.4285 -> 46
1009+ QCOMPARE (editorService.displayVelocityAtPosition (0 , 0 , 0 , 3 ), " 046" );
1010+ QCOMPARE (editorService.displayNoteAtPosition (0 , 0 , 0 , 7 ), " C-3" );
1011+ // Line 7: 20 * 1.50 = 30
1012+ QCOMPARE (editorService.displayVelocityAtPosition (0 , 0 , 0 , 7 ), " 030" );
1013+ }
1014+
9871015void EditorServiceTest::test_requestPosition_invalidPosition_shouldNotChangePosition ()
9881016{
9891017 EditorService editorService;
0 commit comments