1 /*-------------------------------------------------------------------------
2 * C-Pluff, a plug-in framework for C
3 * Copyright 2007 Johannes Lehtinen
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *-----------------------------------------------------------------------*/
27 void nocollections(void) {
29 cp_plugin_info_t **plugins;
34 ctx = init_context(CP_LOG_ERROR, &errors);
35 check(cp_scan_plugins(ctx, 0) == CP_OK);
36 check((plugins = cp_get_plugins_info(ctx, &status, &i)) != NULL && status == CP_OK && i == 0);
37 cp_release_info(ctx, plugins);
42 void onecollection(void) {
46 ctx = init_context(CP_LOG_ERROR, &errors);
47 check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK);
48 check(cp_scan_plugins(ctx, 0) == CP_OK);
49 check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED);
54 void twocollections(void) {
58 ctx = init_context(CP_LOG_ERROR, &errors);
59 check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK);
60 check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK);
61 check(cp_scan_plugins(ctx, 0) == CP_OK);
62 check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED);
63 check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_INSTALLED);
64 check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_INSTALLED);
69 void unregcollection(void) {
73 ctx = init_context(CP_LOG_ERROR, &errors);
74 check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK);
75 check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK);
76 cp_unregister_pcollection(ctx, pcollectiondir("collection2"));
77 check(cp_scan_plugins(ctx, 0) == CP_OK);
78 check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_INSTALLED);
79 check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED);
80 check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED);
85 void unregcollections(void) {
89 ctx = init_context(CP_LOG_ERROR, &errors);
90 check(cp_register_pcollection(ctx, pcollectiondir("collection1")) == CP_OK);
91 check(cp_register_pcollection(ctx, pcollectiondir("collection2")) == CP_OK);
92 cp_unregister_pcollections(ctx);
93 check(cp_scan_plugins(ctx, 0) == CP_OK);
94 check(cp_get_plugin_state(ctx, "plugin1") == CP_PLUGIN_UNINSTALLED);
95 check(cp_get_plugin_state(ctx, "plugin2a") == CP_PLUGIN_UNINSTALLED);
96 check(cp_get_plugin_state(ctx, "plugin2b") == CP_PLUGIN_UNINSTALLED);