diff options
author | Jan Holthuis <jan.holthuis@ruhr-uni-bochum.de> | 2021-10-02 19:29:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 19:29:02 +0200 |
commit | 8dfe58bb251d49bbb47a5175249bb18e1a277746 (patch) | |
tree | e892e4eba6de6d4d44c1e96e3eafdb828cd106a7 /src | |
parent | 8b1ed1b1646079c60b184369941a03f812751b08 (diff) | |
parent | b60c00fd34ea4a00d598a565086a76b87167d438 (diff) |
Merge pull request #4345 from ywwg/replaygain-test-fix
Fix race condition in ReplayGain test
Diffstat (limited to 'src')
-rw-r--r-- | src/test/replaygaintest.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/replaygaintest.cpp b/src/test/replaygaintest.cpp index c9407470ea..5ec0629383 100644 --- a/src/test/replaygaintest.cpp +++ b/src/test/replaygaintest.cpp @@ -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); @@ -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 |