From 1bdcf3843770e085adbb7d665153b7a4d6ee7b7b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Oct 2015 19:28:20 +0000 Subject: Improve test coverage git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5742 a436a847-0d15-0410-975c-d299462d15a1 --- .../failed_lib_descriptor.c | 30 ++ .../failed_lib_descriptor.ttl.in | 38 ++ test/failed_lib_descriptor.lv2/manifest.ttl.in | 7 + .../test_failed_lib_descriptor.c | 44 +++ test/lib_descriptor.lv2/lib_descriptor.c | 112 ++++++ test/lib_descriptor.lv2/lib_descriptor.ttl.in | 41 +++ test/lib_descriptor.lv2/manifest.ttl.in | 7 + test/lib_descriptor.lv2/test_lib_descriptor.c | 52 +++ test/lilv_test.c | 59 +++- test/manifest.ttl.in | 7 - test/missing_descriptor.lv2/manifest.ttl.in | 7 + test/missing_descriptor.lv2/missing_descriptor.c | 20 ++ .../missing_descriptor.ttl.in | 38 ++ .../test_missing_descriptor.c | 44 +++ test/missing_name.lv2/manifest.ttl.in | 7 + test/missing_name.lv2/missing_name.c | 93 +++++ test/missing_name.lv2/missing_name.ttl.in | 37 ++ test/missing_name.lv2/test_missing_name.c | 44 +++ test/missing_plugin.lv2/manifest.ttl.in | 7 + test/missing_plugin.lv2/missing_plugin.c | 28 ++ test/missing_plugin.lv2/missing_plugin.ttl.in | 38 ++ test/missing_plugin.lv2/test_missing_plugin.c | 44 +++ test/missing_port_name.lv2/manifest.ttl.in | 7 + test/missing_port_name.lv2/missing_port_name.c | 93 +++++ .../missing_port_name.lv2/missing_port_name.ttl.in | 30 ++ .../missing_port_name.lv2/test_missing_port_name.c | 46 +++ test/test.lv2/manifest.ttl.in | 7 + test/test.lv2/test.c | 384 +++++++++++++++++++++ test/test.lv2/test.ttl.in | 40 +++ test/test_plugin.c | 384 --------------------- test/test_plugin.ttl.in | 40 --- 31 files changed, 1403 insertions(+), 432 deletions(-) create mode 100644 test/failed_lib_descriptor.lv2/failed_lib_descriptor.c create mode 100644 test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in create mode 100644 test/failed_lib_descriptor.lv2/manifest.ttl.in create mode 100644 test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c create mode 100644 test/lib_descriptor.lv2/lib_descriptor.c create mode 100644 test/lib_descriptor.lv2/lib_descriptor.ttl.in create mode 100644 test/lib_descriptor.lv2/manifest.ttl.in create mode 100644 test/lib_descriptor.lv2/test_lib_descriptor.c delete mode 100644 test/manifest.ttl.in create mode 100644 test/missing_descriptor.lv2/manifest.ttl.in create mode 100644 test/missing_descriptor.lv2/missing_descriptor.c create mode 100644 test/missing_descriptor.lv2/missing_descriptor.ttl.in create mode 100644 test/missing_descriptor.lv2/test_missing_descriptor.c create mode 100644 test/missing_name.lv2/manifest.ttl.in create mode 100644 test/missing_name.lv2/missing_name.c create mode 100644 test/missing_name.lv2/missing_name.ttl.in create mode 100644 test/missing_name.lv2/test_missing_name.c create mode 100644 test/missing_plugin.lv2/manifest.ttl.in create mode 100644 test/missing_plugin.lv2/missing_plugin.c create mode 100644 test/missing_plugin.lv2/missing_plugin.ttl.in create mode 100644 test/missing_plugin.lv2/test_missing_plugin.c create mode 100644 test/missing_port_name.lv2/manifest.ttl.in create mode 100644 test/missing_port_name.lv2/missing_port_name.c create mode 100644 test/missing_port_name.lv2/missing_port_name.ttl.in create mode 100644 test/missing_port_name.lv2/test_missing_port_name.c create mode 100644 test/test.lv2/manifest.ttl.in create mode 100644 test/test.lv2/test.c create mode 100644 test/test.lv2/test.ttl.in delete mode 100644 test/test_plugin.c delete mode 100644 test/test_plugin.ttl.in (limited to 'test') diff --git a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c new file mode 100644 index 0000000..6a1fd90 --- /dev/null +++ b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c @@ -0,0 +1,30 @@ +/* + Lilv Test Plugin - Failed lib descriptor + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define PLUGIN_URI "http://example.org/failed-lib-descriptor" + +LV2_SYMBOL_EXPORT +const LV2_Lib_Descriptor* +lv2_lib_descriptor(const char* bundle_path, + const LV2_Feature*const* features) +{ + return NULL; +} diff --git a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in new file mode 100644 index 0000000..f41545f --- /dev/null +++ b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in @@ -0,0 +1,38 @@ +# Lilv Test Plugin - Failed lib descriptor +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:name "Missing descriptor test" ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/failed_lib_descriptor.lv2/manifest.ttl.in b/test/failed_lib_descriptor.lv2/manifest.ttl.in new file mode 100644 index 0000000..4724f0f --- /dev/null +++ b/test/failed_lib_descriptor.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c new file mode 100644 index 0000000..2bdc999 --- /dev/null +++ b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c @@ -0,0 +1,44 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/failed-lib-descriptor" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); + TEST_ASSERT(!instance); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/lib_descriptor.lv2/lib_descriptor.c b/test/lib_descriptor.lv2/lib_descriptor.c new file mode 100644 index 0000000..48dc775 --- /dev/null +++ b/test/lib_descriptor.lv2/lib_descriptor.c @@ -0,0 +1,112 @@ +/* + Lilv Test Plugin - Missing descriptor + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define PLUGIN_URI "http://example.org/lib-descriptor" + +enum { + TEST_INPUT = 0, + TEST_OUTPUT = 1 +}; + +typedef struct { + float* input; + float* output; +} Test; + +static void +cleanup(LV2_Handle instance) +{ + free((Test*)instance); +} + +static void +connect_port(LV2_Handle instance, uint32_t port, void* data) +{ + Test* test = (Test*)instance; + switch (port) { + case TEST_INPUT: + test->input = (float*)data; + break; + case TEST_OUTPUT: + test->output = (float*)data; + break; + default: + break; + } +} + +static LV2_Handle +instantiate(const LV2_Descriptor* descriptor, + double rate, + const char* path, + const LV2_Feature* const* features) +{ + Test* test = (Test*)calloc(1, sizeof(Test)); + if (!test) { + return NULL; + } + + return (LV2_Handle)test; +} + +static void +run(LV2_Handle instance, uint32_t sample_count) +{ + Test* test = (Test*)instance; + + *test->output = *test->input; +} + +static const LV2_Descriptor descriptor = { + PLUGIN_URI, + instantiate, + connect_port, + NULL, // activate, + run, + NULL, // deactivate, + cleanup, + NULL // extension_data +}; + +static const LV2_Descriptor* +get_plugin(LV2_Lib_Handle handle, uint32_t index) +{ + switch (index) { + case 0: + return &descriptor; + default: + return NULL; + } +} + +static const LV2_Lib_Descriptor lib = { + NULL, + sizeof(LV2_Lib_Descriptor), + NULL, + get_plugin }; + +LV2_SYMBOL_EXPORT +const LV2_Lib_Descriptor* +lv2_lib_descriptor(const char* bundle_path, + const LV2_Feature*const* features) +{ + return &lib; +} diff --git a/test/lib_descriptor.lv2/lib_descriptor.ttl.in b/test/lib_descriptor.lv2/lib_descriptor.ttl.in new file mode 100644 index 0000000..19c8c4a --- /dev/null +++ b/test/lib_descriptor.lv2/lib_descriptor.ttl.in @@ -0,0 +1,41 @@ +# Lilv Test Plugin - Missing descriptor +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . +@prefix xsd: . + + + a lv2:Plugin ; + doap:name "Missing descriptor test" ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + "aGVsbG8sIHdvcmxk"^^xsd:base64Binary ; + "opaque"^^ ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/lib_descriptor.lv2/manifest.ttl.in b/test/lib_descriptor.lv2/manifest.ttl.in new file mode 100644 index 0000000..5f4eced --- /dev/null +++ b/test/lib_descriptor.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c new file mode 100644 index 0000000..3409ef2 --- /dev/null +++ b/test/lib_descriptor.lv2/test_lib_descriptor.c @@ -0,0 +1,52 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/lib-descriptor" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); + TEST_ASSERT(instance); + + LilvNode* eg_blob = lilv_new_uri(world, "http://example.org/blob"); + LilvNode* blob = lilv_world_get(world, plugin_uri, eg_blob, NULL); + TEST_ASSERT(lilv_node_is_literal(blob)); + + LilvNode* eg_junk = lilv_new_uri(world, "http://example.org/junk"); + LilvNode* junk = lilv_world_get(world, plugin_uri, eg_junk, NULL); + TEST_ASSERT(lilv_node_is_literal(junk)); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/lilv_test.c b/test/lilv_test.c index e89239c..3e2a23a 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -1,5 +1,5 @@ /* - Copyright 2007-2014 David Robillard + Copyright 2007-2015 David Robillard Copyright 2008 Krzysztof Foltman Permission to use, copy, modify, and/or distribute this software for any @@ -241,6 +241,7 @@ test_value(void) TEST_ASSERT(lilv_node_is_int(ival)); TEST_ASSERT(lilv_node_is_float(fval)); + TEST_ASSERT(!lilv_node_is_literal(NULL)); TEST_ASSERT(!lilv_node_is_literal(uval)); TEST_ASSERT(lilv_node_is_literal(sval)); TEST_ASSERT(lilv_node_is_literal(ival)); @@ -605,6 +606,9 @@ test_plugin(void) TEST_ASSERT(lilv_nodes_contains(data_uris, data_uri_val)); lilv_node_free(data_uri_val); + LilvNode* unknown_uri_val = lilv_new_uri(world, "http://example.org/unknown"); + TEST_ASSERT(!lilv_nodes_contains(data_uris, unknown_uri_val)); + free(manifest_uri); free(data_uri); @@ -645,6 +649,7 @@ test_plugin(void) TEST_ASSERT(latency_port); TEST_ASSERT(lilv_port_get_index(plug, latency_port) == 2); + TEST_ASSERT(lilv_node_is_blank(lilv_port_get_node(plug, latency_port))); LilvNode* rt_feature = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#hardRTCapable"); @@ -1060,6 +1065,12 @@ test_port(void) TEST_ASSERT(p3 == NULL); lilv_node_free(nopsym); + // Try getting an invalid property + LilvNode* num = lilv_new_int(world, 1); + LilvNodes* nothing = lilv_port_get_value(plug, p, num); + TEST_ASSERT(!nothing); + lilv_node_free(num); + LilvNode* audio_class = lilv_new_uri(world, "http://lv2plug.in/ns/lv2core#AudioPort"); LilvNode* control_class = lilv_new_uri(world, @@ -1116,6 +1127,12 @@ test_port(void) TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); lilv_node_free(name); + // Invalid language + setenv("LANG", "1!", 1); + name = lilv_port_get_name(plug, p); + TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store")); + lilv_node_free(name); + setenv("LANG", "en_CA.utf-8", 1); // Language tagged value with no untranslated values @@ -1347,11 +1364,15 @@ test_ui(void) LilvNode* ui_class_uri = lilv_new_uri(world, "http://lv2plug.in/ns/extensions/ui#GtkUI"); + LilvNode* unknown_ui_class_uri = lilv_new_uri(world, + "http://example.org/mysteryUI"); + TEST_ASSERT(lilv_node_equals(lilv_nodes_get_first(classes), ui_class_uri)); TEST_ASSERT(lilv_ui_is_a(ui0, ui_class_uri)); const LilvNode* ui_type = NULL; TEST_ASSERT(lilv_ui_is_supported(ui0, ui_supported, ui_class_uri, &ui_type)); + TEST_ASSERT(!lilv_ui_is_supported(ui0, ui_supported, unknown_ui_class_uri, &ui_type)); TEST_ASSERT(lilv_node_equals(ui_type, ui_class_uri)); const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug); @@ -1647,6 +1668,15 @@ test_state(void) lilv_instance_connect_port(instance, 1, &out); lilv_instance_run(instance, 1); + // Test instantiating twice + LilvInstance* instance2 = lilv_plugin_instantiate(plugin, 48000.0, ffeatures); + if (!instance2) { + fatal_error("Failed to create multiple instances of <%s>\n", + lilv_node_as_uri(state_plugin_uri)); + return 0; + } + lilv_instance_free(instance2); + // Get instance state state LilvState* fstate = lilv_state_new_from_instance( plugin, instance, &map, @@ -1869,6 +1899,32 @@ test_string(void) /*****************************************************************************/ +static int +test_world(void) +{ + if (!init_world()) { + return 0; + } + + LilvNode* num = lilv_new_int(world, 4); + LilvNode* uri = lilv_new_uri(world, "http://example.org/object"); + + LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL); + TEST_ASSERT(!matches); + + matches = lilv_world_find_nodes(world, NULL, num, NULL); + TEST_ASSERT(!matches); + + matches = lilv_world_find_nodes(world, NULL, uri, NULL); + TEST_ASSERT(!matches); + + lilv_world_unload_bundle(world, NULL); + + return 1; +} + +/*****************************************************************************/ + /* add tests here */ static struct TestCase tests[] = { TEST_CASE(value), @@ -1889,6 +1945,7 @@ static struct TestCase tests[] = { TEST_CASE(bad_port_index), TEST_CASE(bad_port_index), TEST_CASE(string), + TEST_CASE(world), TEST_CASE(state), { NULL, NULL } }; diff --git a/test/manifest.ttl.in b/test/manifest.ttl.in deleted file mode 100644 index 48b009b..0000000 --- a/test/manifest.ttl.in +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: . -@prefix rdfs: . - - - a lv2:Plugin ; - lv2:binary ; - rdfs:seeAlso . diff --git a/test/missing_descriptor.lv2/manifest.ttl.in b/test/missing_descriptor.lv2/manifest.ttl.in new file mode 100644 index 0000000..789d1ec --- /dev/null +++ b/test/missing_descriptor.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/missing_descriptor.lv2/missing_descriptor.c b/test/missing_descriptor.lv2/missing_descriptor.c new file mode 100644 index 0000000..0aa2050 --- /dev/null +++ b/test/missing_descriptor.lv2/missing_descriptor.c @@ -0,0 +1,20 @@ +/* + Lilv Test Plugin - Missing descriptor + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +LV2_SYMBOL_EXPORT const char* msg = "this is not the thing you're looking for"; diff --git a/test/missing_descriptor.lv2/missing_descriptor.ttl.in b/test/missing_descriptor.lv2/missing_descriptor.ttl.in new file mode 100644 index 0000000..9e2aad8 --- /dev/null +++ b/test/missing_descriptor.lv2/missing_descriptor.ttl.in @@ -0,0 +1,38 @@ +# Lilv Test Plugin - Missing descriptor +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:name "Missing descriptor test" ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c new file mode 100644 index 0000000..e0af49e --- /dev/null +++ b/test/missing_descriptor.lv2/test_missing_descriptor.c @@ -0,0 +1,44 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/missing-descriptor" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); + TEST_ASSERT(!instance); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/missing_name.lv2/manifest.ttl.in b/test/missing_name.lv2/manifest.ttl.in new file mode 100644 index 0000000..62f4813 --- /dev/null +++ b/test/missing_name.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/missing_name.lv2/missing_name.c b/test/missing_name.lv2/missing_name.c new file mode 100644 index 0000000..8a198b9 --- /dev/null +++ b/test/missing_name.lv2/missing_name.c @@ -0,0 +1,93 @@ +/* + Lilv Test Plugin - Missing descriptor + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define PLUGIN_URI "http://example.org/missing-name" + +enum { + TEST_INPUT = 0, + TEST_OUTPUT = 1 +}; + +typedef struct { + float* input; + float* output; +} Test; + +static void +cleanup(LV2_Handle instance) +{ + free((Test*)instance); +} + +static void +connect_port(LV2_Handle instance, uint32_t port, void* data) +{ + Test* test = (Test*)instance; + switch (port) { + case TEST_INPUT: + test->input = (float*)data; + break; + case TEST_OUTPUT: + test->output = (float*)data; + break; + default: + break; + } +} + +static LV2_Handle +instantiate(const LV2_Descriptor* descriptor, + double rate, + const char* path, + const LV2_Feature* const* features) +{ + Test* test = (Test*)calloc(1, sizeof(Test)); + if (!test) { + return NULL; + } + + return (LV2_Handle)test; +} + +static void +run(LV2_Handle instance, uint32_t sample_count) +{ + Test* test = (Test*)instance; + + *test->output = *test->input; +} + +static const LV2_Descriptor descriptor = { + PLUGIN_URI, + instantiate, + connect_port, + NULL, // activate, + run, + NULL, // deactivate, + cleanup, + NULL // extension_data +}; + +LV2_SYMBOL_EXPORT +const LV2_Descriptor* lv2_descriptor(uint32_t index) +{ + return (index == 0) ? &descriptor : NULL; +} diff --git a/test/missing_name.lv2/missing_name.ttl.in b/test/missing_name.lv2/missing_name.ttl.in new file mode 100644 index 0000000..68ce23e --- /dev/null +++ b/test/missing_name.lv2/missing_name.ttl.in @@ -0,0 +1,37 @@ +# Lilv Test Plugin - Missing plugin name +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/missing_name.lv2/test_missing_name.c b/test/missing_name.lv2/test_missing_name.c new file mode 100644 index 0000000..9237ae2 --- /dev/null +++ b/test/missing_name.lv2/test_missing_name.c @@ -0,0 +1,44 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/missing-name" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); + TEST_ASSERT(instance); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/missing_plugin.lv2/manifest.ttl.in b/test/missing_plugin.lv2/manifest.ttl.in new file mode 100644 index 0000000..d969cec --- /dev/null +++ b/test/missing_plugin.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/missing_plugin.lv2/missing_plugin.c b/test/missing_plugin.lv2/missing_plugin.c new file mode 100644 index 0000000..577d42a --- /dev/null +++ b/test/missing_plugin.lv2/missing_plugin.c @@ -0,0 +1,28 @@ +/* + Lilv Test Plugin - Missing plugin + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define PLUGIN_URI "http://example.org/missing-plugin" + +LV2_SYMBOL_EXPORT +const LV2_Descriptor* lv2_descriptor(uint32_t index) +{ + return NULL; +} diff --git a/test/missing_plugin.lv2/missing_plugin.ttl.in b/test/missing_plugin.lv2/missing_plugin.ttl.in new file mode 100644 index 0000000..ed8a7f3 --- /dev/null +++ b/test/missing_plugin.lv2/missing_plugin.ttl.in @@ -0,0 +1,38 @@ +# Lilv Test Plugin - Missing plugin +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:name "Missing descriptor test" ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c new file mode 100644 index 0000000..01f00cd --- /dev/null +++ b/test/missing_plugin.lv2/test_missing_plugin.c @@ -0,0 +1,44 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/missing-plugin" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL); + TEST_ASSERT(!instance); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/missing_port_name.lv2/manifest.ttl.in b/test/missing_port_name.lv2/manifest.ttl.in new file mode 100644 index 0000000..d6a4e39 --- /dev/null +++ b/test/missing_port_name.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/missing_port_name.lv2/missing_port_name.c b/test/missing_port_name.lv2/missing_port_name.c new file mode 100644 index 0000000..4ed44ed --- /dev/null +++ b/test/missing_port_name.lv2/missing_port_name.c @@ -0,0 +1,93 @@ +/* + Lilv Test Plugin - Missing port name + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define PLUGIN_URI "http://example.org/missing-port-name" + +enum { + TEST_INPUT = 0, + TEST_OUTPUT = 1 +}; + +typedef struct { + float* input; + float* output; +} Test; + +static void +cleanup(LV2_Handle instance) +{ + free((Test*)instance); +} + +static void +connect_port(LV2_Handle instance, uint32_t port, void* data) +{ + Test* test = (Test*)instance; + switch (port) { + case TEST_INPUT: + test->input = (float*)data; + break; + case TEST_OUTPUT: + test->output = (float*)data; + break; + default: + break; + } +} + +static LV2_Handle +instantiate(const LV2_Descriptor* descriptor, + double rate, + const char* path, + const LV2_Feature* const* features) +{ + Test* test = (Test*)calloc(1, sizeof(Test)); + if (!test) { + return NULL; + } + + return (LV2_Handle)test; +} + +static void +run(LV2_Handle instance, uint32_t sample_count) +{ + Test* test = (Test*)instance; + + *test->output = *test->input; +} + +static const LV2_Descriptor descriptor = { + PLUGIN_URI, + instantiate, + connect_port, + NULL, // activate, + run, + NULL, // deactivate, + cleanup, + NULL // extension_data +}; + +LV2_SYMBOL_EXPORT +const LV2_Descriptor* lv2_descriptor(uint32_t index) +{ + return (index == 0) ? &descriptor : NULL; +} diff --git a/test/missing_port_name.lv2/missing_port_name.ttl.in b/test/missing_port_name.lv2/missing_port_name.ttl.in new file mode 100644 index 0000000..5a58a80 --- /dev/null +++ b/test/missing_port_name.lv2/missing_port_name.ttl.in @@ -0,0 +1,30 @@ +# Lilv Test Plugin - Missing port name +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:license ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + ] . \ No newline at end of file diff --git a/test/missing_port_name.lv2/test_missing_port_name.c b/test/missing_port_name.lv2/test_missing_port_name.c new file mode 100644 index 0000000..0f96918 --- /dev/null +++ b/test/missing_port_name.lv2/test_missing_port_name.c @@ -0,0 +1,46 @@ +#include "lilv/lilv.h" +#include "../src/lilv_internal.h" + +#define PLUGIN_URI "http://example.org/missing-port-name" + +#define TEST_ASSERT(check) do {\ + if (!(check)) {\ + fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\ + return 1;\ + }\ +} while (0) + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]); + return 1; + } + + const char* bundle_path = argv[1]; + LilvWorld* world = lilv_world_new(); + + // Load test plugin bundle + uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path); + SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true); + LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf); + lilv_world_load_bundle(world, bundle_uri); + free(abs_bundle); + serd_node_free(&bundle); + + LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); + const LilvPlugins* plugins = lilv_world_get_all_plugins(world); + const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri); + TEST_ASSERT(plugin); + + const LilvPort* port = lilv_plugin_get_port_by_index(plugin, 0); + TEST_ASSERT(port); + LilvNode* name = lilv_port_get_name(plugin, port); + TEST_ASSERT(!name); + + lilv_world_free(world); + + return 0; +} + diff --git a/test/test.lv2/manifest.ttl.in b/test/test.lv2/manifest.ttl.in new file mode 100644 index 0000000..bc3952c --- /dev/null +++ b/test/test.lv2/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/test.lv2/test.c b/test/test.lv2/test.c new file mode 100644 index 0000000..cd9a18c --- /dev/null +++ b/test/test.lv2/test.c @@ -0,0 +1,384 @@ +/* + Lilv Test Plugin + Copyright 2011-2015 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include +#include + +#include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "lv2/lv2plug.in/ns/ext/state/state.h" +#include "lv2/lv2plug.in/ns/ext/urid/urid.h" +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define TEST_URI "http://example.org/lilv-test-plugin" + +enum { + TEST_INPUT = 0, + TEST_OUTPUT = 1 +}; + +typedef struct { + LV2_URID_Map* map; + + struct { + LV2_URID atom_Float; + } uris; + + char* tmp_file_path; + char* rec_file_path; + FILE* rec_file; + + float* input; + float* output; + unsigned num_runs; +} Test; + +static void +cleanup(LV2_Handle instance) +{ + Test* test = (Test*)instance; + if (test->rec_file) { + fclose(test->rec_file); + } + free(test->tmp_file_path); + free(test->rec_file_path); + free(instance); +} + +static void +connect_port(LV2_Handle instance, + uint32_t port, + void* data) +{ + Test* test = (Test*)instance; + switch (port) { + case TEST_INPUT: + test->input = (float*)data; + break; + case TEST_OUTPUT: + test->output = (float*)data; + break; + default: + break; + } +} + +static LV2_Handle +instantiate(const LV2_Descriptor* descriptor, + double rate, + const char* path, + const LV2_Feature* const* features) +{ + Test* test = (Test*)malloc(sizeof(Test)); + if (!test) { + return NULL; + } + + test->map = NULL; + test->input = NULL; + test->output = NULL; + test->num_runs = 0; + test->tmp_file_path = (char*)malloc(L_tmpnam); + test->rec_file_path = NULL; + test->rec_file = NULL; + + tmpnam(test->tmp_file_path); + + LV2_State_Make_Path* make_path = NULL; + + for (int i = 0; features[i]; ++i) { + if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) { + test->map = (LV2_URID_Map*)features[i]->data; + test->uris.atom_Float = test->map->map( + test->map->handle, LV2_ATOM__Float); + } else if (!strcmp(features[i]->URI, LV2_STATE__makePath)) { + make_path = (LV2_State_Make_Path*)features[i]->data; + } + } + + if (!test->map) { + fprintf(stderr, "Host does not support urid:map\n"); + free(test); + return NULL; + } + + if (make_path) { + test->rec_file_path = make_path->path(make_path->handle, "recfile"); + if (!(test->rec_file = fopen(test->rec_file_path, "w"))) { + fprintf(stderr, "ERROR: Failed to open rec file\n"); + } + fprintf(test->rec_file, "instantiate\n"); + } + + return (LV2_Handle)test; +} + +static void +run(LV2_Handle instance, + uint32_t sample_count) +{ + Test* test = (Test*)instance; + *test->output = *test->input; + if (sample_count == 1) { + ++test->num_runs; + } else if (sample_count == 2 && test->rec_file) { + // Append to rec file (changes size) + fprintf(test->rec_file, "run\n"); + } else if (sample_count == 3 && test->rec_file) { + // Change the first byte of rec file (doesn't change size) + fseek(test->rec_file, 0, SEEK_SET); + fprintf(test->rec_file, "X"); + fseek(test->rec_file, 0, SEEK_END); + } +} + +static uint32_t +map_uri(Test* plugin, const char* uri) +{ + return plugin->map->map(plugin->map->handle, uri); +} + +static LV2_State_Status +save(LV2_Handle instance, + LV2_State_Store_Function store, + void* callback_data, + uint32_t flags, + const LV2_Feature* const* features) +{ + Test* plugin = (Test*)instance; + + LV2_State_Map_Path* map_path = NULL; + LV2_State_Make_Path* make_path = NULL; + for (int i = 0; features && features[i]; ++i) { + if (!strcmp(features[i]->URI, LV2_STATE__mapPath)) { + map_path = (LV2_State_Map_Path*)features[i]->data; + } else if (!strcmp(features[i]->URI, LV2_STATE__makePath)) { + make_path = (LV2_State_Make_Path*)features[i]->data; + } + } + + store(callback_data, + map_uri(plugin, "http://example.org/greeting"), + "hello", + strlen("hello") + 1, + map_uri(plugin, LV2_ATOM__String), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + const uint32_t urid = map_uri(plugin, "http://example.org/urivalue"); + store(callback_data, + map_uri(plugin, "http://example.org/uri"), + &urid, + sizeof(uint32_t), + map_uri(plugin, LV2_ATOM__URID), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + store(callback_data, + map_uri(plugin, "http://example.org/num-runs"), + &plugin->num_runs, + sizeof(plugin->num_runs), + map_uri(plugin, LV2_ATOM__Int), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + const float two = 2.0f; + store(callback_data, + map_uri(plugin, "http://example.org/two"), + &two, + sizeof(two), + map_uri(plugin, LV2_ATOM__Float), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + const uint32_t affirmative = 1; + store(callback_data, + map_uri(plugin, "http://example.org/true"), + &affirmative, + sizeof(affirmative), + map_uri(plugin, LV2_ATOM__Bool), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + const uint32_t negative = 0; + store(callback_data, + map_uri(plugin, "http://example.org/false"), + &negative, + sizeof(negative), + map_uri(plugin, LV2_ATOM__Bool), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + const uint8_t blob[] = "I am a blob of arbitrary data."; + store(callback_data, + map_uri(plugin, "http://example.org/blob"), + blob, + sizeof(blob), + map_uri(plugin, "http://example.org/SomeUnknownType"), + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + + if (map_path) { + FILE* file = fopen(plugin->tmp_file_path, "w"); + fprintf(file, "Hello\n"); + fclose(file); + char* apath = map_path->abstract_path(map_path->handle, + plugin->tmp_file_path); + char* apath2 = map_path->abstract_path(map_path->handle, + plugin->tmp_file_path); + if (strcmp(apath, apath2)) { + fprintf(stderr, "ERROR: Path %s != %s\n", apath, apath2); + } + + store(callback_data, + map_uri(plugin, "http://example.org/extfile"), + apath, + strlen(apath) + 1, + map_uri(plugin, LV2_ATOM__Path), + LV2_STATE_IS_PORTABLE); + + free(apath); + free(apath2); + + if (plugin->rec_file) { + fflush(plugin->rec_file); + apath = map_path->abstract_path(map_path->handle, + plugin->rec_file_path); + + store(callback_data, + map_uri(plugin, "http://example.org/recfile"), + apath, + strlen(apath) + 1, + map_uri(plugin, LV2_ATOM__Path), + LV2_STATE_IS_PORTABLE); + + free(apath); + } + + if (make_path) { + char* spath = make_path->path(make_path->handle, "save"); + FILE* sfile = fopen(spath, "w"); + fprintf(sfile, "save"); + fclose(sfile); + + apath = map_path->abstract_path(map_path->handle, spath); + store(callback_data, + map_uri(plugin, "http://example.org/save-file"), + apath, + strlen(apath) + 1, + map_uri(plugin, LV2_ATOM__Path), + LV2_STATE_IS_PORTABLE); + free(apath); + free(spath); + } + } + + return LV2_STATE_SUCCESS; +} + +static LV2_State_Status +restore(LV2_Handle instance, + LV2_State_Retrieve_Function retrieve, + void* callback_data, + uint32_t flags, + const LV2_Feature* const* features) +{ + Test* plugin = (Test*)instance; + + LV2_State_Map_Path* map_path = NULL; + for (int i = 0; features && features[i]; ++i) { + if (!strcmp(features[i]->URI, LV2_STATE__mapPath)) { + map_path = (LV2_State_Map_Path*)features[i]->data; + } + } + + size_t size; + uint32_t type; + uint32_t valflags; + + plugin->num_runs = *(int32_t*)retrieve( + callback_data, + map_uri(plugin, "http://example.org/num-runs"), + &size, &type, &valflags); + + if (!map_path) { + return LV2_STATE_ERR_NO_FEATURE; + } + + char* apath = (char*)retrieve( + callback_data, + map_uri(plugin, "http://example.org/extfile"), + &size, &type, &valflags); + + if (apath) { + char* path = map_path->absolute_path(map_path->handle, apath); + FILE* f = fopen(path, "r"); + char str[8]; + size_t n_read = fread(str, 1, sizeof(str), f); + fclose(f); + if (strncmp(str, "Hello\n", n_read)) { + fprintf(stderr, "error: Restored bad file contents `%s' != `Hello'\n", + str); + } + free(path); + } + + apath = (char*)retrieve( + callback_data, + map_uri(plugin, "http://example.org/save-file"), + &size, &type, &valflags); + if (apath) { + char* spath = map_path->absolute_path(map_path->handle, apath); + FILE* sfile = fopen(spath, "r"); + if (!sfile) { + fprintf(stderr, "error: Failed to open save file %s\n", spath); + } else { + fclose(sfile); + } + free(spath); + } else { + fprintf(stderr, "error: Failed to restore save file.\n"); + } + + return LV2_STATE_SUCCESS; +} + +static const void* +extension_data(const char* uri) +{ + static const LV2_State_Interface state = { save, restore }; + if (!strcmp(uri, LV2_STATE__interface)) { + return &state; + } + return NULL; +} + +static const LV2_Descriptor descriptor = { + TEST_URI, + instantiate, + connect_port, + NULL, // activate, + run, + NULL, // deactivate, + cleanup, + extension_data +}; + +LV2_SYMBOL_EXPORT +const LV2_Descriptor* lv2_descriptor(uint32_t index) +{ + switch (index) { + case 0: + return &descriptor; + default: + return NULL; + } +} diff --git a/test/test.lv2/test.ttl.in b/test/test.lv2/test.ttl.in new file mode 100644 index 0000000..6fb6aed --- /dev/null +++ b/test/test.lv2/test.ttl.in @@ -0,0 +1,40 @@ +# Lilv Test Plugin +# Copyright 2011-2015 David Robillard +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix doap: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:name "Lilv Test" ; + doap:license ; + lv2:requiredFeature ; + lv2:optionalFeature lv2:hardRTCapable ; + lv2:extensionData ; + lv2:port [ + a lv2:InputPort , + lv2:ControlPort ; + lv2:index 0 ; + lv2:symbol "input" ; + lv2:name "Input" + ] , [ + a lv2:OutputPort , + lv2:ControlPort ; + lv2:index 1 ; + lv2:symbol "output" ; + lv2:name "Output" + ] . diff --git a/test/test_plugin.c b/test/test_plugin.c deleted file mode 100644 index edcc5ab..0000000 --- a/test/test_plugin.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - Lilv Test Plugin - Copyright 2011-2012 David Robillard - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include -#include -#include -#include - -#include "lv2/lv2plug.in/ns/ext/atom/atom.h" -#include "lv2/lv2plug.in/ns/ext/state/state.h" -#include "lv2/lv2plug.in/ns/ext/urid/urid.h" -#include "lv2/lv2plug.in/ns/lv2core/lv2.h" - -#define TEST_URI "http://example.org/lilv-test-plugin" - -enum { - TEST_INPUT = 0, - TEST_OUTPUT = 1 -}; - -typedef struct { - LV2_URID_Map* map; - - struct { - LV2_URID atom_Float; - } uris; - - char* tmp_file_path; - char* rec_file_path; - FILE* rec_file; - - float* input; - float* output; - unsigned num_runs; -} Test; - -static void -cleanup(LV2_Handle instance) -{ - Test* test = (Test*)instance; - if (test->rec_file) { - fclose(test->rec_file); - } - free(test->tmp_file_path); - free(test->rec_file_path); - free(instance); -} - -static void -connect_port(LV2_Handle instance, - uint32_t port, - void* data) -{ - Test* test = (Test*)instance; - switch (port) { - case TEST_INPUT: - test->input = (float*)data; - break; - case TEST_OUTPUT: - test->output = (float*)data; - break; - default: - break; - } -} - -static LV2_Handle -instantiate(const LV2_Descriptor* descriptor, - double rate, - const char* path, - const LV2_Feature* const* features) -{ - Test* test = (Test*)malloc(sizeof(Test)); - if (!test) { - return NULL; - } - - test->map = NULL; - test->input = NULL; - test->output = NULL; - test->num_runs = 0; - test->tmp_file_path = (char*)malloc(L_tmpnam); - test->rec_file_path = NULL; - test->rec_file = NULL; - - tmpnam(test->tmp_file_path); - - LV2_State_Make_Path* make_path = NULL; - - for (int i = 0; features[i]; ++i) { - if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) { - test->map = (LV2_URID_Map*)features[i]->data; - test->uris.atom_Float = test->map->map( - test->map->handle, LV2_ATOM__Float); - } else if (!strcmp(features[i]->URI, LV2_STATE__makePath)) { - make_path = (LV2_State_Make_Path*)features[i]->data; - } - } - - if (!test->map) { - fprintf(stderr, "Host does not support urid:map\n"); - free(test); - return NULL; - } - - if (make_path) { - test->rec_file_path = make_path->path(make_path->handle, "recfile"); - if (!(test->rec_file = fopen(test->rec_file_path, "w"))) { - fprintf(stderr, "ERROR: Failed to open rec file\n"); - } - fprintf(test->rec_file, "instantiate\n"); - } - - return (LV2_Handle)test; -} - -static void -run(LV2_Handle instance, - uint32_t sample_count) -{ - Test* test = (Test*)instance; - *test->output = *test->input; - if (sample_count == 1) { - ++test->num_runs; - } else if (sample_count == 2 && test->rec_file) { - // Append to rec file (changes size) - fprintf(test->rec_file, "run\n"); - } else if (sample_count == 3 && test->rec_file) { - // Change the first byte of rec file (doesn't change size) - fseek(test->rec_file, 0, SEEK_SET); - fprintf(test->rec_file, "X"); - fseek(test->rec_file, 0, SEEK_END); - } -} - -static uint32_t -map_uri(Test* plugin, const char* uri) -{ - return plugin->map->map(plugin->map->handle, uri); -} - -static LV2_State_Status -save(LV2_Handle instance, - LV2_State_Store_Function store, - void* callback_data, - uint32_t flags, - const LV2_Feature* const* features) -{ - Test* plugin = (Test*)instance; - - LV2_State_Map_Path* map_path = NULL; - LV2_State_Make_Path* make_path = NULL; - for (int i = 0; features && features[i]; ++i) { - if (!strcmp(features[i]->URI, LV2_STATE__mapPath)) { - map_path = (LV2_State_Map_Path*)features[i]->data; - } else if (!strcmp(features[i]->URI, LV2_STATE__makePath)) { - make_path = (LV2_State_Make_Path*)features[i]->data; - } - } - - store(callback_data, - map_uri(plugin, "http://example.org/greeting"), - "hello", - strlen("hello") + 1, - map_uri(plugin, LV2_ATOM__String), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - const uint32_t urid = map_uri(plugin, "http://example.org/urivalue"); - store(callback_data, - map_uri(plugin, "http://example.org/uri"), - &urid, - sizeof(uint32_t), - map_uri(plugin, LV2_ATOM__URID), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - store(callback_data, - map_uri(plugin, "http://example.org/num-runs"), - &plugin->num_runs, - sizeof(plugin->num_runs), - map_uri(plugin, LV2_ATOM__Int), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - const float two = 2.0f; - store(callback_data, - map_uri(plugin, "http://example.org/two"), - &two, - sizeof(two), - map_uri(plugin, LV2_ATOM__Float), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - const uint32_t affirmative = 1; - store(callback_data, - map_uri(plugin, "http://example.org/true"), - &affirmative, - sizeof(affirmative), - map_uri(plugin, LV2_ATOM__Bool), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - const uint32_t negative = 0; - store(callback_data, - map_uri(plugin, "http://example.org/false"), - &negative, - sizeof(negative), - map_uri(plugin, LV2_ATOM__Bool), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - const uint8_t blob[] = "I am a blob of arbitrary data."; - store(callback_data, - map_uri(plugin, "http://example.org/blob"), - blob, - sizeof(blob), - map_uri(plugin, "http://example.org/SomeUnknownType"), - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - - if (map_path) { - FILE* file = fopen(plugin->tmp_file_path, "w"); - fprintf(file, "Hello\n"); - fclose(file); - char* apath = map_path->abstract_path(map_path->handle, - plugin->tmp_file_path); - char* apath2 = map_path->abstract_path(map_path->handle, - plugin->tmp_file_path); - if (strcmp(apath, apath2)) { - fprintf(stderr, "ERROR: Path %s != %s\n", apath, apath2); - } - - store(callback_data, - map_uri(plugin, "http://example.org/extfile"), - apath, - strlen(apath) + 1, - map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); - - free(apath); - free(apath2); - - if (plugin->rec_file) { - fflush(plugin->rec_file); - apath = map_path->abstract_path(map_path->handle, - plugin->rec_file_path); - - store(callback_data, - map_uri(plugin, "http://example.org/recfile"), - apath, - strlen(apath) + 1, - map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); - - free(apath); - } - - if (make_path) { - char* spath = make_path->path(make_path->handle, "save"); - FILE* sfile = fopen(spath, "w"); - fprintf(sfile, "save"); - fclose(sfile); - - apath = map_path->abstract_path(map_path->handle, spath); - store(callback_data, - map_uri(plugin, "http://example.org/save-file"), - apath, - strlen(apath) + 1, - map_uri(plugin, LV2_ATOM__Path), - LV2_STATE_IS_PORTABLE); - free(apath); - free(spath); - } - } - - return LV2_STATE_SUCCESS; -} - -static LV2_State_Status -restore(LV2_Handle instance, - LV2_State_Retrieve_Function retrieve, - void* callback_data, - uint32_t flags, - const LV2_Feature* const* features) -{ - Test* plugin = (Test*)instance; - - LV2_State_Map_Path* map_path = NULL; - for (int i = 0; features && features[i]; ++i) { - if (!strcmp(features[i]->URI, LV2_STATE__mapPath)) { - map_path = (LV2_State_Map_Path*)features[i]->data; - } - } - - size_t size; - uint32_t type; - uint32_t valflags; - - plugin->num_runs = *(int32_t*)retrieve( - callback_data, - map_uri(plugin, "http://example.org/num-runs"), - &size, &type, &valflags); - - if (!map_path) { - return LV2_STATE_ERR_NO_FEATURE; - } - - char* apath = (char*)retrieve( - callback_data, - map_uri(plugin, "http://example.org/extfile"), - &size, &type, &valflags); - - if (apath) { - char* path = map_path->absolute_path(map_path->handle, apath); - FILE* f = fopen(path, "r"); - char str[8]; - size_t n_read = fread(str, 1, sizeof(str), f); - fclose(f); - if (strncmp(str, "Hello\n", n_read)) { - fprintf(stderr, "error: Restored bad file contents `%s' != `Hello'\n", - str); - } - free(path); - } - - apath = (char*)retrieve( - callback_data, - map_uri(plugin, "http://example.org/save-file"), - &size, &type, &valflags); - if (apath) { - char* spath = map_path->absolute_path(map_path->handle, apath); - FILE* sfile = fopen(spath, "r"); - if (!sfile) { - fprintf(stderr, "error: Failed to open save file %s\n", spath); - } else { - fclose(sfile); - } - free(spath); - } else { - fprintf(stderr, "error: Failed to restore save file.\n"); - } - - return LV2_STATE_SUCCESS; -} - -static const void* -extension_data(const char* uri) -{ - static const LV2_State_Interface state = { save, restore }; - if (!strcmp(uri, LV2_STATE__interface)) { - return &state; - } - return NULL; -} - -static const LV2_Descriptor descriptor = { - TEST_URI, - instantiate, - connect_port, - NULL, // activate, - run, - NULL, // deactivate, - cleanup, - extension_data -}; - -LV2_SYMBOL_EXPORT -const LV2_Descriptor* lv2_descriptor(uint32_t index) -{ - switch (index) { - case 0: - return &descriptor; - default: - return NULL; - } -} diff --git a/test/test_plugin.ttl.in b/test/test_plugin.ttl.in deleted file mode 100644 index 704f815..0000000 --- a/test/test_plugin.ttl.in +++ /dev/null @@ -1,40 +0,0 @@ -# Lilv Test Plugin -# Copyright 2011 David Robillard -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -@prefix doap: . -@prefix foaf: . -@prefix lv2: . -@prefix ui: . - - - a lv2:Plugin ; - doap:name "Lilv Test" ; - doap:license ; - lv2:requiredFeature ; - lv2:optionalFeature lv2:hardRTCapable ; - lv2:extensionData ; - lv2:port [ - a lv2:InputPort , - lv2:ControlPort ; - lv2:index 0 ; - lv2:symbol "input" ; - lv2:name "Input" - ] , [ - a lv2:OutputPort , - lv2:ControlPort ; - lv2:index 1 ; - lv2:symbol "output" ; - lv2:name "Output" - ] . -- cgit v1.2.1