summaryrefslogtreecommitdiff
path: root/test/plugin/PluginPresetTest.c
diff options
context:
space:
mode:
authorpepper <peppersclothescult@gmail.com>2015-01-10 21:32:32 -0800
committerpepper <peppersclothescult@gmail.com>2015-01-10 21:32:32 -0800
commitd53fa8a169832563c62262078b8d2ffe5cab8473 (patch)
treeb911d06d357d009c976709780f10e92ce915228a /test/plugin/PluginPresetTest.c
first
Diffstat (limited to 'test/plugin/PluginPresetTest.c')
-rw-r--r--test/plugin/PluginPresetTest.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/test/plugin/PluginPresetTest.c b/test/plugin/PluginPresetTest.c
new file mode 100644
index 0000000..e16024f
--- /dev/null
+++ b/test/plugin/PluginPresetTest.c
@@ -0,0 +1,78 @@
+#include "unit/TestRunner.h"
+#include "plugin/PluginPreset.h"
+#include "PluginMock.h"
+
+const char *TEST_PRESET_FILENAME = "test.fxp";
+
+static int _testGuessPluginPresetType(void)
+{
+ CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
+ PluginPreset p = pluginPresetFactory(c);
+ assertIntEquals(PRESET_TYPE_FXP, p->presetType);
+ freePluginPreset(p);
+ freeCharString(c);
+ return 0;
+}
+
+static int _testGuessPluginPresetTypeInvalid(void)
+{
+ CharString c = newCharStringWithCString("invalid");
+ PluginPreset p = pluginPresetFactory(c);
+ assertIsNull(p);
+ freePluginPreset(p);
+ freeCharString(c);
+ return 0;
+}
+
+static int _testNewObject(void)
+{
+ CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
+ PluginPreset p = pluginPresetFactory(c);
+ assertIntEquals(p->presetType, PRESET_TYPE_FXP);
+ assertCharStringEquals(TEST_PRESET_FILENAME, p->presetName);
+ freePluginPreset(p);
+ freeCharString(c);
+ return 0;
+}
+
+static int _testIsPresetCompatibleWithPlugin(void)
+{
+ CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
+ PluginPreset p = pluginPresetFactory(c);
+ Plugin mockPlugin = newPluginMock();
+
+ pluginPresetSetCompatibleWith(p, PLUGIN_TYPE_INTERNAL);
+ assert(pluginPresetIsCompatibleWith(p, mockPlugin));
+
+ freePlugin(mockPlugin);
+ freeCharString(c);
+ freePluginPreset(p);
+ return 0;
+}
+
+static int _testIsPresetNotCompatibleWithPlugin(void)
+{
+ CharString c = newCharStringWithCString(TEST_PRESET_FILENAME);
+ PluginPreset p = pluginPresetFactory(c);
+ Plugin mockPlugin = newPluginMock();
+
+ pluginPresetSetCompatibleWith(p, PLUGIN_TYPE_VST_2X);
+ assertFalse(pluginPresetIsCompatibleWith(p, mockPlugin));
+
+ freePlugin(mockPlugin);
+ freeCharString(c);
+ freePluginPreset(p);
+ return 0;
+}
+
+TestSuite addPluginPresetTests(void);
+TestSuite addPluginPresetTests(void)
+{
+ TestSuite testSuite = newTestSuite("PluginPreset", NULL, NULL);
+ addTest(testSuite, "GuessPluginPresetType", _testGuessPluginPresetType);
+ addTest(testSuite, "GuessPluginPresetTypeInvalid", _testGuessPluginPresetTypeInvalid);
+ addTest(testSuite, "NewObject", _testNewObject);
+ addTest(testSuite, "IsPresetCompatibleWithPlugin", _testIsPresetCompatibleWithPlugin);
+ addTest(testSuite, "IsPresetNotCompatibleWithPlugin", _testIsPresetNotCompatibleWithPlugin);
+ return testSuite;
+}