Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition in ReplayGain test #4345

Merged
merged 1 commit into from
Oct 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/test/replaygaintest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,18 @@ TEST_F(ReplayGainTest, NormalizePeak) {
class AdjustReplayGainTest : public MockedEngineBackendTest {};

TEST_F(AdjustReplayGainTest, AdjustReplayGainUpdatesPregain) {
const QString kTrackLocationTest = QDir::currentPath() + "/src/test/sine-30.wav";
TrackPointer pTrack(Track::newTemporary(kTrackLocationTest));

// Load the same track in decks 1 and 2 so we can see that the pregain is adjusted on both
// decks.
loadTrack(m_pMixerDeck1, pTrack);
loadTrack(m_pMixerDeck2, pTrack);

// Initialize fake track replaygain so it's not zero.
mixxx::ReplayGain replayGain;
replayGain.setRatio(1.0);
m_pTrack1->setReplayGain(replayGain);
// Load the same track in decks 1 and 2 so we can see that the pregain is adjusted on both
// decks.
m_pMixerDeck2->slotLoadTrack(m_pTrack1, false);
pTrack->setReplayGain(replayGain);
// Because of this artificial process we have to manually set the replaygain CO for the second
// deck.
m_pMixerDeck2->slotSetReplayGain(replayGain);
Expand All @@ -183,7 +188,7 @@ TEST_F(AdjustReplayGainTest, AdjustReplayGainUpdatesPregain) {
.005);
EXPECT_DOUBLE_EQ(1.2, ControlObject::getControl(ConfigKey(m_sGroup1, "replaygain"))->get());
EXPECT_DOUBLE_EQ(1.2, ControlObject::getControl(ConfigKey(m_sGroup2, "replaygain"))->get());
EXPECT_DOUBLE_EQ(1.2, m_pTrack1->getReplayGain().getRatio());
EXPECT_DOUBLE_EQ(1.2, pTrack->getReplayGain().getRatio());
}

} // anonymous namespace