Initial release
This commit is contained in:
+119
@@ -0,0 +1,119 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/checkunitstructure.cpp
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/unit/checkunitstructure.h"
|
||||
#include "pluginterfaces/base/funknownimpl.h"
|
||||
#include "pluginterfaces/vst/ivstunits.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// UnitStructureTest
|
||||
//------------------------------------------------------------------------
|
||||
UnitStructureTest::UnitStructureTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool UnitStructureTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !vstPlug)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (auto iUnitInfo = U::cast<IUnitInfo> (controller))
|
||||
{
|
||||
int32 unitCount = iUnitInfo->getUnitCount ();
|
||||
if (unitCount <= 0)
|
||||
{
|
||||
addMessage (testResult,
|
||||
STR ("No units found, while controller implements IUnitInfo !!!"));
|
||||
}
|
||||
|
||||
UnitInfo unitInfo = {};
|
||||
UnitInfo tmpInfo = {};
|
||||
bool rootFound = false;
|
||||
for (int32 unitIndex = 0; unitIndex < unitCount; unitIndex++)
|
||||
{
|
||||
if (iUnitInfo->getUnitInfo (unitIndex, unitInfo) == kResultOk)
|
||||
{
|
||||
// check parent Id
|
||||
if (unitInfo.parentUnitId != kNoParentUnitId) //-1: connected to root
|
||||
{
|
||||
bool noParent = true;
|
||||
for (int32 i = 0; i < unitCount; ++i)
|
||||
{
|
||||
if (iUnitInfo->getUnitInfo (i, tmpInfo) == kResultOk)
|
||||
{
|
||||
if (unitInfo.parentUnitId == tmpInfo.id)
|
||||
{
|
||||
noParent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noParent && unitInfo.parentUnitId != kRootUnitId)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult, printf ("Unit %03d: Parent does not exist!!", unitInfo.id));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!rootFound)
|
||||
{
|
||||
// root Unit have always the rootID
|
||||
if (unitInfo.id != kRootUnitId)
|
||||
{
|
||||
// we should have a root unit id
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("Unit %03d: Should be the Root Unit => id should be %03d!!",
|
||||
unitInfo.id, kRootUnitId));
|
||||
return false;
|
||||
}
|
||||
rootFound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("Unit %03d: Has no parent, but there is a root already.",
|
||||
unitInfo.id));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addErrorMessage (testResult, printf ("Unit %03d: No unit info.", unitInfo.id));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
addMessage (testResult, STR ("All units have valid parent IDs."));
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage (testResult, STR ("This component does not support IUnitInfo!"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/checkunitstructure.h
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/testbase.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Check Unit Structure.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class UnitStructureTest : public TestBase
|
||||
{
|
||||
public:
|
||||
UnitStructureTest (ITestPlugProvider* plugProvider);
|
||||
|
||||
DECLARE_VSTTEST ("Check Unit Structure")
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
//------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
@@ -0,0 +1,198 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/scanprograms.cpp
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/unit/scanprograms.h"
|
||||
#include "public.sdk/source/vst/utility/stringconvert.h"
|
||||
#include "pluginterfaces/base/funknownimpl.h"
|
||||
#include "pluginterfaces/vst/ivstunits.h"
|
||||
#include "pluginterfaces/vst/vstpresetkeys.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// ProgramInfoTest
|
||||
//------------------------------------------------------------------------
|
||||
ProgramInfoTest::ProgramInfoTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool ProgramInfoTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !vstPlug)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (auto iUnitInfo = U::cast<IUnitInfo> (controller))
|
||||
{
|
||||
int32 programListCount = iUnitInfo->getProgramListCount ();
|
||||
if (programListCount == 0)
|
||||
{
|
||||
addMessage (testResult, STR ("This component does not export any programs."));
|
||||
return true;
|
||||
}
|
||||
else if (programListCount < 0)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
STR ("IUnitInfo::getProgramListCount () returned a negative number."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// used to check double IDs
|
||||
auto programListIds = std::unique_ptr<int32[]> (new int32[programListCount]);
|
||||
|
||||
for (int32 programListIndex = 0; programListIndex < programListCount; programListIndex++)
|
||||
{
|
||||
// get programm list info
|
||||
ProgramListInfo programListInfo;
|
||||
if (iUnitInfo->getProgramListInfo (programListIndex, programListInfo) == kResultOk)
|
||||
{
|
||||
int32 programListId = programListInfo.id;
|
||||
programListIds[programListIndex] = programListId;
|
||||
if (programListId < 0)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
printf ("Programlist %03d: Invalid ID!!!", programListIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if ID is already used by another parameter
|
||||
for (int32 idIndex = 0; idIndex < programListIndex; idIndex++)
|
||||
{
|
||||
if (programListIds[idIndex] == programListIds[programListIndex])
|
||||
{
|
||||
addErrorMessage (testResult, printf ("Programlist %03d: ID already used!!!",
|
||||
programListIndex));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto programListName = StringConvert::convert (programListInfo.name);
|
||||
if (programListName.empty ())
|
||||
{
|
||||
addErrorMessage (testResult, printf ("Programlist %03d (id=%d): No name!!!",
|
||||
programListIndex, programListId));
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 programCount = programListInfo.programCount;
|
||||
if (programCount <= 0)
|
||||
{
|
||||
addMessage (
|
||||
testResult,
|
||||
printf (
|
||||
"Programlist %03d (id=%d): \"%s\" No programs!!! (programCount is null!)",
|
||||
programListIndex, programListId,
|
||||
StringConvert::convert (programListName).data ()));
|
||||
// return false;
|
||||
}
|
||||
|
||||
addMessage (testResult, printf ("Programlist %03d (id=%d): \"%s\" (%d programs).",
|
||||
programListIndex, programListId,
|
||||
programListName.data (), programCount));
|
||||
|
||||
for (int32 programIndex = 0; programIndex < programCount; programIndex++)
|
||||
{
|
||||
TChar programName[256];
|
||||
if (iUnitInfo->getProgramName (programListId, programIndex, programName) ==
|
||||
kResultOk)
|
||||
{
|
||||
if (programName[0] == 0)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("Programlist %03d->Program %03d: has no name!!!",
|
||||
programListIndex, programIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
auto programNameUTF8 = StringConvert::convert (programName);
|
||||
auto msg = printf ("Programlist %03d->Program %03d: \"%s\"",
|
||||
programListIndex, programIndex, programNameUTF8.data ());
|
||||
|
||||
String128 programInfo {};
|
||||
if (iUnitInfo->getProgramInfo (programListId, programIndex,
|
||||
PresetAttributes::kInstrument,
|
||||
programInfo) == kResultOk)
|
||||
{
|
||||
auto programInfoUTF8 = StringConvert::convert (programInfo);
|
||||
msg += StringConvert::convert (" (instrument = \"");
|
||||
msg += (const char16_t*)programInfo;
|
||||
msg += StringConvert::convert ("\")");
|
||||
}
|
||||
|
||||
addMessage (testResult, msg.data ());
|
||||
|
||||
if (iUnitInfo->hasProgramPitchNames (programListId, programIndex) ==
|
||||
kResultOk)
|
||||
{
|
||||
addMessage (testResult, printf (" => \"%s\": supports PitchNames",
|
||||
programNameUTF8.data ()));
|
||||
|
||||
String128 pitchName = {0};
|
||||
for (int16 midiPitch = 0; midiPitch < 128; midiPitch++)
|
||||
{
|
||||
if (iUnitInfo->getProgramPitchName (programListId, programIndex,
|
||||
midiPitch,
|
||||
pitchName) == kResultOk)
|
||||
{
|
||||
msg = printf (" => MIDI Pitch %d => \"", midiPitch);
|
||||
msg += (const char16_t*)pitchName;
|
||||
msg += StringConvert::convert ("\"");
|
||||
addMessage (testResult, msg.data ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage (testResult, STR ("This component does not export any programs."));
|
||||
|
||||
// check if not more than 1 program change parameter is defined
|
||||
int32 numPrgChanges = 0;
|
||||
for (int32 i = 0; i < controller->getParameterCount (); ++i)
|
||||
{
|
||||
ParameterInfo paramInfo = {};
|
||||
if (controller->getParameterInfo (i, paramInfo) != kResultOk)
|
||||
{
|
||||
if (paramInfo.flags & ParameterInfo::kIsProgramChange)
|
||||
numPrgChanges++;
|
||||
}
|
||||
}
|
||||
if (numPrgChanges > 1)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("More than 1 programChange Parameter (%d) without support of IUnitInfo!!!",
|
||||
numPrgChanges));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/scanprograms.h
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/testbase.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Scan Programs.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class ProgramInfoTest : public TestBase
|
||||
{
|
||||
public:
|
||||
ProgramInfoTest (ITestPlugProvider* plugProvider);
|
||||
|
||||
DECLARE_VSTTEST ("Scan Programs")
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
//------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
@@ -0,0 +1,148 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/scanunits.cpp
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/unit/scanunits.h"
|
||||
#include "public.sdk/source/vst/utility/stringconvert.h"
|
||||
#include "pluginterfaces/base/funknownimpl.h"
|
||||
#include "pluginterfaces/vst/ivstunits.h"
|
||||
#include <memory>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// UnitInfoTest
|
||||
//------------------------------------------------------------------------
|
||||
UnitInfoTest::UnitInfoTest (ITestPlugProvider* plugProvider) : TestBase (plugProvider)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
bool UnitInfoTest::run (ITestResult* testResult)
|
||||
{
|
||||
if (!testResult || !vstPlug)
|
||||
return false;
|
||||
|
||||
printTestHeader (testResult);
|
||||
|
||||
if (auto iUnitInfo = U::cast<IUnitInfo> (controller))
|
||||
{
|
||||
int32 unitCount = iUnitInfo->getUnitCount ();
|
||||
if (unitCount <= 0)
|
||||
{
|
||||
addMessage (testResult,
|
||||
STR ("No units found, while controller implements IUnitInfo !!!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage (testResult, printf ("This component has %d unit(s).", unitCount));
|
||||
}
|
||||
|
||||
auto unitIds = std::unique_ptr<int32[]> (new int32[unitCount]);
|
||||
|
||||
for (int32 unitIndex = 0; unitIndex < unitCount; unitIndex++)
|
||||
{
|
||||
UnitInfo unitInfo = {};
|
||||
|
||||
if (iUnitInfo->getUnitInfo (unitIndex, unitInfo) == kResultOk)
|
||||
{
|
||||
int32 unitId = unitInfo.id;
|
||||
unitIds[unitIndex] = unitId;
|
||||
if (unitId < 0)
|
||||
{
|
||||
addErrorMessage (testResult, printf ("Unit %03d: Invalid ID!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if ID is already used by another unit
|
||||
for (int32 idIndex = 0; idIndex < unitIndex; idIndex++)
|
||||
{
|
||||
if (unitIds[idIndex] == unitIds[unitIndex])
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
printf ("Unit %03d: ID already used!!!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto unitName = StringConvert::convert (unitInfo.name);
|
||||
if (unitName.empty ())
|
||||
{
|
||||
addErrorMessage (testResult, printf ("Unit %03d: No name!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 parentUnitId = unitInfo.parentUnitId;
|
||||
if (parentUnitId < -1)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
printf ("Unit %03d: Invalid parent ID!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
else if (parentUnitId == unitId)
|
||||
{
|
||||
addErrorMessage (
|
||||
testResult,
|
||||
printf ("Unit %03d: Parent ID is equal to Unit ID!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 unitProgramListId = unitInfo.programListId;
|
||||
if (unitProgramListId < -1)
|
||||
{
|
||||
addErrorMessage (testResult,
|
||||
printf ("Unit %03d: Invalid programlist ID!", unitIndex));
|
||||
return false;
|
||||
}
|
||||
|
||||
addMessage (
|
||||
testResult,
|
||||
printf (" Unit%03d (ID = %d): \"%s\" (parent ID = %d, programlist ID = %d)",
|
||||
unitIndex, unitId, unitName.data (), parentUnitId, unitProgramListId));
|
||||
|
||||
// test select Unit
|
||||
if (iUnitInfo->selectUnit (unitIndex) == kResultTrue)
|
||||
{
|
||||
UnitID newSelected = iUnitInfo->getSelectedUnit ();
|
||||
if (newSelected != unitIndex)
|
||||
{
|
||||
addMessage (
|
||||
testResult,
|
||||
printf (
|
||||
"The host has selected Unit ID = %d but getSelectedUnit returns ID = %d!!!",
|
||||
unitIndex, newSelected));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage (testResult, printf ("Unit%03d: No unit info!", unitIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addMessage (testResult, STR ("This component has no units."));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags : clang-format SMTGSequencer
|
||||
// Project : VST SDK
|
||||
//
|
||||
// Category : Validator
|
||||
// Filename : public.sdk/source/vst/testsuite/unit/scanunits.h
|
||||
// Created by : Steinberg, 04/2005
|
||||
// Description : VST Test Suite
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// This file is part of a Steinberg SDK. It is subject to the license terms
|
||||
// in the LICENSE file found in the top-level directory of this distribution
|
||||
// and at www.steinberg.net/sdklicenses.
|
||||
// No part of the SDK, including this file, may be copied, modified, propagated,
|
||||
// or distributed except according to the terms contained in the LICENSE file.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public.sdk/source/vst/testsuite/testbase.h"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
namespace Steinberg {
|
||||
namespace Vst {
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/** Test Scan Units.
|
||||
* \ingroup TestClass
|
||||
*/
|
||||
class UnitInfoTest : public TestBase
|
||||
{
|
||||
public:
|
||||
UnitInfoTest (ITestPlugProvider* plugProvider);
|
||||
|
||||
DECLARE_VSTTEST ("Scan Units")
|
||||
|
||||
bool PLUGIN_API run (ITestResult* testResult) SMTG_OVERRIDE;
|
||||
//------------------------------------------------------------------------
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
} // Vst
|
||||
} // Steinberg
|
||||
Reference in New Issue
Block a user