Skip to content

Commit

Permalink
AudioEngineTests: fix song size changes
Browse files Browse the repository at this point in the history
in JACK integration tests.

Those changes must only increase the song size. Else position comparison must always fail. In addition, we have to ensure the toggled grid cell does not leak into the next tests
  • Loading branch information
theGreatWhiteShark committed Oct 31, 2024
1 parent 415b0f8 commit 126ac7f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/core/AudioEngine/AudioEngineTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2159,6 +2159,9 @@ void AudioEngineTests::testTransportProcessingOffsetsJack() {

float fBpm, fLastBpm;
bool bTempoChanged = false;
const int nToggleColumn = 4;
const int nToggleRow = 4;
const float fOriginalSongSize = pAE->m_fSongSizeInTicks;

pAE->lock( RIGHT_HERE );
fLastBpm = pAE->getBpmAtColumn( 0 );
Expand Down Expand Up @@ -2192,7 +2195,7 @@ void AudioEngineTests::testTransportProcessingOffsetsJack() {
// song size. It should never change during regular playback (which is
// covered by a separate test).
const auto nOldSongSize = pAE->m_fSongSizeInTicks;
CoreActionController::toggleGridCell( 3, 4 );
CoreActionController::toggleGridCell( nToggleColumn, nToggleRow );
if ( nOldSongSize == pAE->m_fSongSizeInTicks ) {
throwException( "[testTransportProcessingOffsetsJack] song size did not change." );
}
Expand Down Expand Up @@ -2230,6 +2233,12 @@ void AudioEngineTests::testTransportProcessingOffsetsJack() {
throwException( "[testTransportProcessingOffsetsJack] tempo was not change. Decrease time increments!" );
}

// Ensure the additional grid cell we activate/deactivate is set to its
// original state.
if ( pAE->m_fSongSizeInTicks != fOriginalSongSize ) {
CoreActionController::toggleGridCell( nToggleColumn, nToggleRow );
}

stopJackAudioDriver();
}

Expand Down Expand Up @@ -2443,6 +2452,9 @@ void AudioEngineTests::testTransportRelocationOffsetsJack() {
}
float fBpm, fLastBpm;
bool bTempoChanged = false;
const int nToggleColumn = 4;
const int nToggleRow = 4;
const float fOriginalSongSize = pAE->m_fSongSizeInTicks;

pAE->lock( RIGHT_HERE );
fLastBpm = pAE->getBpmAtColumn( 0 );
Expand Down Expand Up @@ -2527,7 +2539,7 @@ void AudioEngineTests::testTransportRelocationOffsetsJack() {
// song size. It should never change during regular playback (which is
// covered by a separate test).
const auto nOldSongSize = pAE->m_fSongSizeInTicks;
CoreActionController::toggleGridCell( 4, 4 );
CoreActionController::toggleGridCell( nToggleColumn, nToggleRow );
if ( nOldSongSize == pAE->m_fSongSizeInTicks ) {
throwException( "[testTransportRelocationOffsetsJack] song size did not change." );
}
Expand Down Expand Up @@ -2635,6 +2647,12 @@ void AudioEngineTests::testTransportRelocationOffsetsJack() {
throwException( "[testTransportRelocationOffsetsJack] tempo was not change." );
}

// Ensure the additional grid cell we activate/deactivate is set to its
// original state.
if ( pAE->m_fSongSizeInTicks != fOriginalSongSize ) {
CoreActionController::toggleGridCell( nToggleColumn, nToggleRow );
}

stopJackAudioDriver();
}

Expand Down

0 comments on commit 126ac7f

Please sign in to comment.