Debian Codegraph @

glib/gio/tests/memory-settings-backend.c

raw
1 /*
2 * Copyright (C) 2022 Ryan Hope
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authors: Ryan Hope <[email protected]>
20 */
21
22 #include <gio/gio.h>
23 #include <locale.h>
24 #define G_SETTINGS_ENABLE_BACKEND
25 #include <gio/gsettingsbackend.h>
26
27 /* Test that the "gsettings-backend" extension point has been registered.
28 * Must be run first and separetly from other GSettingsBackend,
29 * as they will register the extension point making the test useless.
30 */
31 static void
32 test_extension_point_registered (void)
33 {
34 GSettingsBackend *backend;
35 GIOExtensionPoint *extension_point;
36
37 backend = g_memory_settings_backend_new ();
38 g_assert_true (G_IS_SETTINGS_BACKEND (backend));
39
40 extension_point = g_io_extension_point_lookup (G_SETTINGS_BACKEND_EXTENSION_POINT_NAME);
41 g_assert_nonnull (extension_point);
42
43 g_object_unref (backend);
44 }
45
46 int
47 main (int argc, char *argv[])
48 {
49 setlocale (LC_ALL, "");
50
51 g_test_init (&argc, &argv, NULL);
52
53 /* Must be run first */
54 g_test_add_func ("/memory-settings-backend/extension-point-registered", test_extension_point_registered);
55
56 return g_test_run ();
57 }