(root)/
glib-2.79.0/
gio/
tests/
null-settings-backend.c
       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 <ryanhope97@gmail.com>
      20   */
      21  
      22  #include <gio/gio.h>
      23  #define G_SETTINGS_ENABLE_BACKEND
      24  #include <gio/gsettingsbackend.h>
      25  
      26  /* Test that the "gsettings-backend" extension point has been registered.
      27   * Must be run first and separetly from other GSettingsBackend,
      28   * as they will register the extension point making the test useless.
      29   */
      30  static void
      31  test_extension_point_registered (void)
      32  {
      33    GSettingsBackend *backend;
      34    GIOExtensionPoint *extension_point;
      35  
      36    backend = g_null_settings_backend_new ();
      37    g_assert_true (G_IS_SETTINGS_BACKEND (backend));
      38    extension_point = g_io_extension_point_lookup (G_SETTINGS_BACKEND_EXTENSION_POINT_NAME);
      39  
      40    g_assert_nonnull (extension_point);
      41  
      42    g_object_unref (backend);
      43  }
      44  
      45  int
      46  main (int argc, char *argv[])
      47  {
      48    g_test_init (&argc, &argv, NULL);
      49  
      50    /* Must be run first */
      51    g_test_add_func ("/null-settings-backend/extension-point-registered", test_extension_point_registered);
      52  
      53    return g_test_run ();
      54  }