159
159
#define TEST_ASSERT(check) do {\
164
fprintf(stderr, "lilv_test.c:%d: error: %s\n", __LINE__, #check);\
163
fprintf(stderr, "lilv_test.c:%d: error: test `%s' failed\n", __LINE__, #check);\
1941
1941
/*****************************************************************************/
1944
test_reload_bundle(void)
1946
// Create a simple plugin bundle
1947
create_bundle(MANIFEST_PREFIXES
1948
":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT "> ; rdfs:seeAlso <plugin.ttl> .\n",
1950
":plug a lv2:Plugin ; "
1951
PLUGIN_NAME("First name") " .");
1953
if (!init_world()) {
1958
lilv_world_load_specifications(world);
1961
LilvNode* bundle_uri = lilv_new_uri(world, bundle_dir_uri);
1962
lilv_world_load_bundle(world, bundle_uri);
1964
// Check that plugin is present
1965
const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
1966
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
1969
// Check that plugin name is correct
1970
LilvNode* name = lilv_plugin_get_name(plug);
1971
TEST_ASSERT(!strcmp(lilv_node_as_string(name), "First name"));
1972
lilv_node_free(name);
1974
// Unload bundle from world and delete it
1975
lilv_world_unload_bundle(world, bundle_uri);
1978
// Create a new version of the same bundle, but with a different name
1979
create_bundle(MANIFEST_PREFIXES
1980
":plug a lv2:Plugin ; lv2:binary <foo" SHLIB_EXT "> ; rdfs:seeAlso <plugin.ttl> .\n",
1982
":plug a lv2:Plugin ; "
1983
PLUGIN_NAME("Second name") " .");
1986
lilv_world_load_bundle(world, bundle_uri);
1988
// TODO: Mechanism to actually remove plugin from world list
1990
// Check that plugin is present again
1991
const LilvPlugin* plug2 = lilv_plugins_get_by_uri(plugins, plugin_uri_value);
1994
// Check that plugin now has new name
1995
LilvNode* name2 = lilv_plugin_get_name(plug2);
1997
TEST_ASSERT(!strcmp(lilv_node_as_string(name2), "Second name"));
1998
lilv_node_free(name2);
2000
lilv_node_free(bundle_uri);
2001
lilv_world_free(world);
2007
/*****************************************************************************/
1943
2009
/* add tests here */
1944
2010
static struct TestCase tests[] = {
1945
2011
TEST_CASE(util),