From 66e690169427f2f6ed22641b67b73ce658a9739d Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Wed, 22 Apr 2020 14:00:19 +0200 Subject: test: Add test for conflicts with enable/disable --- tests/plugin-loader/rygel-plugin-loader-test.vala | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/plugin-loader/rygel-plugin-loader-test.vala b/tests/plugin-loader/rygel-plugin-loader-test.vala index 816ac490..94133de4 100644 --- a/tests/plugin-loader/rygel-plugin-loader-test.vala +++ b/tests/plugin-loader/rygel-plugin-loader-test.vala @@ -1,7 +1,7 @@ class TestConfig : Rygel.BaseConfiguration { public HashTable enable = new HashTable (str_hash, str_equal); - public void toggl_enable (string module) { + public void toggle_enable (string module) { enable[module] = !enable[module]; this.section_changed (module, Rygel.SectionEntry.ENABLED); } @@ -54,6 +54,35 @@ void test_plugin_loader_conflict () { assert (loader.loaded_plugins.length == 2); assert ("librygel-tracker.so" in loader.loaded_plugins); assert ("librygel-no-conflict.so" in loader.loaded_plugins); + + Rygel.MetaConfig.cleanup (); +} + + +void test_plugin_loader_conflict_dynamic_enable () { + var config = new TestConfig (); + config.enable["Tracker"] = true; + config.enable["Tracker3"] = false; + config.enable["SomePlugin"] = true; + Rygel.MetaConfig.register_configuration (config); + + var loader = new TestPluginLoader("conflicts", + {"librygel-tracker.so", "librygel-no-conflict.so"}, + {"librygel-tracker3.so"}); + + loader.load_modules_sync (); + assert (loader.loaded_plugins.length == 2); + assert ("librygel-tracker.so" in loader.loaded_plugins); + assert ("librygel-no-conflict.so" in loader.loaded_plugins); + + // Enabling Tracker3 should not change the list of loaded plugins + config.toggle_enable ("Tracker3"); + + assert (loader.loaded_plugins.length == 2); + assert ("librygel-tracker.so" in loader.loaded_plugins); + assert ("librygel-no-conflict.so" in loader.loaded_plugins); + + Rygel.MetaConfig.cleanup (); } int main (string[] args) { @@ -61,5 +90,7 @@ int main (string[] args) { Test.add_func ("/librygel-core/plugins/load-conflict", test_plugin_loader_conflict); + Test.add_func ("/librygel-core/plugins/load-conflict-enable", + test_plugin_loader_conflict_dynamic_enable); return Test.run (); } \ No newline at end of file -- cgit v1.2.1