Skip to content

Commit 43c19fd

Browse files
committed
Added tests for plugin programs
1 parent 28a4a9d commit 43c19fd

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CHANGELIST.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# pluginval Change List
22

3+
### 0.2.4
4+
- Added tests for plugin programs
5+
36
### 0.2.3
47
- Fixed some failing tests on startup
58

Source/tests/BasicTests.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,48 @@ struct PluginInfoTest : public PluginTest
3737
static PluginInfoTest pluginInfoTest;
3838

3939

40+
//==============================================================================
41+
struct PluginPrgramsTest : public PluginTest
42+
{
43+
PluginPrgramsTest()
44+
: PluginTest ("Plugin programs", 2)
45+
{
46+
}
47+
48+
void runTest (PluginTests& ut, AudioPluginInstance& instance) override
49+
{
50+
const int numPrograms = instance.getNumPrograms();
51+
ut.logMessage ("Num programs: " + String (numPrograms));
52+
53+
for (int i = 0; i < numPrograms; ++i)
54+
ut.logVerboseMessage (String ("Program 123 name: XYZ")
55+
.replace ("123", String (i))
56+
.replace ("XYZ", instance.getProgramName (i)));
57+
58+
ut.logMessage ("All program names checked");
59+
60+
if (numPrograms > 0)
61+
{
62+
ut.logMessage ("\nChanging program");
63+
const int currentProgram = instance.getCurrentProgram();
64+
auto r = ut.getRandom();
65+
66+
for (int i = 0; i < 5; ++i)
67+
{
68+
const int programNum = r.nextInt (numPrograms);
69+
ut.logVerboseMessage ("Changing program to: " + String (programNum));
70+
instance.setCurrentProgram (programNum);
71+
}
72+
73+
ut.logVerboseMessage ("Resetting program to: " + String (currentProgram));
74+
instance.setCurrentProgram (currentProgram);
75+
}
76+
}
77+
};
78+
79+
static PluginPrgramsTest pluginPrgramsTest;
80+
81+
4082
//==============================================================================
4183
struct EditorTest : public PluginTest
4284
{

0 commit comments

Comments
 (0)