commit b4a41352efb67499417acd611aeb276bd2d7632c parent 220540c1cc39a7cbd6706339f8ab9574e9f00c51 Author: jatinchowdhury18 <[email protected]> Date: Sun, 18 Apr 2021 14:24:24 -0700 Update Mix Groups Test to account for Message thread issues (#189) Co-authored-by: jatinchowdhury18 <[email protected]> Diffstat:
M | Plugin/Source/Headless/UnitTests/MixGroupsTest.cpp | | | 25 | ++++++++++++++++++++----- |
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/Plugin/Source/Headless/UnitTests/MixGroupsTest.cpp b/Plugin/Source/Headless/UnitTests/MixGroupsTest.cpp @@ -17,7 +17,10 @@ public: if (auto* pCast = dynamic_cast<RangedAudioParameter*> (p)) { if (pCast->paramID == MixGroupsConstants::mixGroupParamID) + { pCast->setValueNotifyingHost (value); + break; + } } } } @@ -76,13 +79,25 @@ public: setMixGroup (plugin2.get(), 1.0f); auto params1 = plugin1->getParameters(); - auto params2 = plugin2->getParameters(); - - constexpr int numRuns = 100; + constexpr int numRuns = 50; for (int i = 0; i < numRuns; ++i) { - auto paramIdxToChange = getRandom().nextInt (params1.size()); - params1[paramIdxToChange]->setValueNotifyingHost (getRandom().nextFloat()); + auto paramIdxToChange = Random::getSystemRandom().nextInt (params1.size()); + auto param = params1[paramIdxToChange]; + + // make sure we don't change the Mix Group parameter! + if (auto* pCast = dynamic_cast<RangedAudioParameter*> (param)) + { + if (pCast->paramID == MixGroupsConstants::mixGroupParamID) + { + i--; + continue; + } + } + + std::cout << "Setting parameter: " << param->getName (1024) << std::endl; + param->setValueNotifyingHost (getRandom().nextFloat()); + MessageManager::getInstance()->runDispatchLoopUntil (50); compareStates (plugin1.get(), plugin2.get()); } }