[rygel/wip/tracker-3.0: 21/33] test: Add test for conflicts with enable/disable



commit 18d116afc218464be0138559247712810aa7d9c9
Author: Jens Georg <mail jensge org>
Date:   Wed Apr 22 14:00:19 2020 +0200

    test: Add test for conflicts with enable/disable

 tests/plugin-loader/rygel-plugin-loader-test.vala | 33 ++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)
---
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<string, bool> enable = new HashTable<string, bool> (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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]