From 126ac7f5e8e8b616d888e629cf5e7cbac411a451 Mon Sep 17 00:00:00 2001 From: theGreatWhiteShark Date: Tue, 29 Oct 2024 22:41:35 +0100 Subject: [PATCH] AudioEngineTests: fix song size changes 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 --- src/core/AudioEngine/AudioEngineTests.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/core/AudioEngine/AudioEngineTests.cpp b/src/core/AudioEngine/AudioEngineTests.cpp index eb5092ed1..9231957e7 100644 --- a/src/core/AudioEngine/AudioEngineTests.cpp +++ b/src/core/AudioEngine/AudioEngineTests.cpp @@ -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 ); @@ -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." ); } @@ -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(); } @@ -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 ); @@ -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." ); } @@ -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(); }