changeset 35:b700f37dc118

Add test for .cat file
author Chris Cannam
date Tue, 10 Jun 2014 08:50:54 +0100
parents a2d9aed55a2a
children 7d4c98c696a5
files TestStaticData.cpp TestStaticData.h
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/TestStaticData.cpp	Mon Dec 16 13:28:28 2013 +0000
+++ b/TestStaticData.cpp	Tue Jun 10 08:50:54 2014 +0100
@@ -40,7 +40,9 @@
 #include "TestStaticData.h"
 
 #include <vamp-hostsdk/Plugin.h>
+#include <vamp-hostsdk/PluginLoader.h>
 using namespace Vamp;
+using namespace Vamp::HostExt;
 
 #include <memory>
 using namespace std;
@@ -56,6 +58,9 @@
 Tester::TestRegistrar<TestValueRanges>
 TestValueRanges::m_registrar("A3 Inappropriate value extents");
 
+Tester::TestRegistrar<TestCategory>
+TestCategory::m_registrar("A3 Missing category");
+
 Test::Results
 TestIdentifiers::test(string key, Options)
 {
@@ -198,4 +203,18 @@
     return r;
 }
 
+Test::Results
+TestCategory::test(string key, Options)
+{
+    PluginLoader::PluginCategoryHierarchy hierarchy =
+        PluginLoader::getInstance()->getPluginCategory(key);
+    
+    Results r;
 
+    if (hierarchy.empty()) {
+        r.push_back(warning("Plugin category missing or cannot be loaded (no .cat file?)"));
+    }
+
+    return r;
+}
+
--- a/TestStaticData.h	Mon Dec 16 13:28:28 2013 +0000
+++ b/TestStaticData.h	Tue Jun 10 08:50:54 2014 +0100
@@ -76,4 +76,14 @@
     static Tester::TestRegistrar<TestValueRanges> m_registrar;
 };
 
+class TestCategory : public Test
+{
+public:
+    TestCategory() : Test() { }
+    Results test(std::string key, Options options);
+    
+protected:
+    static Tester::TestRegistrar<TestCategory> m_registrar;
+};
+
 #endif