MCPcopy Create free account
hub / github.com/christophhart/HISE / runTest

Method runTest

hi_scripting/scripting/api/ScriptExpansion.cpp:638–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636
637
638void ScriptUserPresetHandler::runTest()
639{
640 auto content = getScriptProcessor()->getScriptingContent();
641 auto& uph = getMainController()->getUserPresetHandler();
642
643 String report = "\n";
644
645 auto addLine = [&](const String& s)
646 {
647 report << s << "\n";
648 };
649
650 auto addLineFromTokens = [&](const StringArray& s)
651 {
652 for (auto& t : s)
653 report << t;
654
655 report << "\n";
656 };
657
658 auto addWarning = [&](const String& s)
659 {
660 report << "WARNING: " << s << "\n";
661 };
662
663 auto boolString = [](bool v)
664 {
665 return String(v ? "true" : "false");
666 };
667
668 auto getNumElements = [&](const String& type)
669 {
670 if (type == "allComponents")
671 {
672 return String(content->getNumComponents());
673 }
674 if (type == "saveInPreset")
675 {
676 int counter = 0;
677
678 for (int i = 0; i < content->getNumComponents(); i++)
679 {
680 if (content->getComponent(i)->getScriptObjectProperty("saveInPreset"))
681 counter++;
682 }
683
684 return String(counter);
685 }
686 if (type == "automationID")
687 {
688 return String(uph.getNumCustomAutomationData());
689 }
690 if (type == "moduleStates")
691 {
692 return String(getScriptProcessor()->getMainController_()->getModuleStateManager().modules.size());
693 }
694
695 return String("unknown");

Callers

nothing calls this directly

Calls 15

getScriptingContentMethod · 0.80
getMainController_Method · 0.80
createDocumentMethod · 0.80
getNameMethod · 0.65
StringClass · 0.50
toStringFunction · 0.50
getNumComponentsMethod · 0.45
getComponentMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected