diff options
Diffstat (limited to 'gio/tests/resources.c')
-rw-r--r-- | gio/tests/resources.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gio/tests/resources.c b/gio/tests/resources.c index ed6a24964..bf3bd9f43 100644 --- a/gio/tests/resources.c +++ b/gio/tests/resources.c @@ -411,6 +411,8 @@ test_resource_module (void) error = NULL; + /* Module is not loaded yet */ + found = g_resources_get_info ("/resourceplugin/test1.txt", G_RESOURCE_LOOKUP_FLAGS_NONE, &size, &flags, &error); @@ -418,6 +420,8 @@ test_resource_module (void) g_assert_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND); g_clear_error (&error); + /* Load the module */ + g_type_module_use (G_TYPE_MODULE (module)); found = g_resources_get_info ("/resourceplugin/test1.txt", @@ -436,13 +440,25 @@ test_resource_module (void) size = g_bytes_get_size (data); g_assert (size == 6); g_assert_cmpstr (g_bytes_get_data (data, NULL), ==, "test1\n"); - g_bytes_unref (data); + /* Don't unref data, should keep the module in use */ + + /* Unuse the module */ g_type_module_unuse (G_TYPE_MODULE (module)); found = g_resources_get_info ("/resourceplugin/test1.txt", G_RESOURCE_LOOKUP_FLAGS_NONE, &size, &flags, &error); + g_assert (found); + g_assert_no_error (error); + + + /* Unref the data, should unload the module */ + g_bytes_unref (data); + + found = g_resources_get_info ("/resourceplugin/test1.txt", + G_RESOURCE_LOOKUP_FLAGS_NONE, + &size, &flags, &error); g_assert (!found); g_assert_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND); g_clear_error (&error); |