Skip to content

Commit a34ba6c

Browse files
authored
Merge pull request #46 from baconpaul/create-in-test
Create an Actual Plugin in the Test Set
2 parents 56872a9 + 4ff27a1 commit a34ba6c

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if (${CLAP_HELPERS_BUILD_TESTS})
5151
endif()
5252

5353
add_executable(${PROJECT_NAME}-tests EXCLUDE_FROM_ALL
54+
tests/create-an-actual-plugin.cc
5455
tests/hex-encoder.cc
5556
tests/plugin.cc
5657
tests/param-queue-tests.cc

tests/create-an-actual-plugin.cc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Actually use plugin.hh / plugin.hxx to create a plugin. Assert that it is constructable
3+
*/
4+
5+
#include "clap/helpers/plugin.hh"
6+
#include "clap/helpers/plugin.hxx"
7+
8+
#include <type_traits>
9+
10+
#include <catch2/catch_all.hpp>
11+
12+
struct test_plugin : clap::helpers::Plugin<clap::helpers::MisbehaviourHandler::Terminate,
13+
clap::helpers::CheckingLevel::Maximal>
14+
{
15+
const clap_plugin_descriptor *getDescription()
16+
{
17+
static const char *features[] = {CLAP_PLUGIN_FEATURE_INSTRUMENT,
18+
CLAP_PLUGIN_FEATURE_SYNTHESIZER, nullptr};
19+
static clap_plugin_descriptor desc = {CLAP_VERSION,
20+
"org.free-audio.test-case.plugin",
21+
"Test Case Plugin",
22+
"Free Audio",
23+
"http://cleveraudio.org",
24+
"",
25+
"",
26+
"1.0.0",
27+
"This is a test only plugin",
28+
&features[0]};
29+
return &desc;
30+
}
31+
32+
test_plugin(const clap_host *host) : clap::helpers::Plugin<clap::helpers::MisbehaviourHandler::Terminate,
33+
clap::helpers::CheckingLevel::Maximal>(getDescription(), host) {}
34+
};
35+
36+
CATCH_TEST_CASE("Create an Actual Plugin")
37+
{
38+
CATCH_SECTION("Test Plugin is Creatable")
39+
{
40+
CATCH_REQUIRE(std::is_constructible<test_plugin, const clap_host *>::value);
41+
}
42+
}

0 commit comments

Comments
 (0)