LCOV - code coverage report
Current view: top level - glib/girepository/tests - repository.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 472 472 100.0 %
Date: 2024-05-07 05:15:23 Functions: 22 22 100.0 %
Branches: 27 32 84.4 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright 2008-2011 Colin Walters <walters@verbum.org>
       3                 :            :  * Copyright 2011 Laszlo Pandy <lpandy@src.gnome.org>
       4                 :            :  * Copyright 2011 Torsten Schönfeld <kaffeetisch@gmx.de>
       5                 :            :  * Copyright 2011, 2012 Pavel Holejsovsky <pavel.holejsovsky@gmail.com>
       6                 :            :  * Copyright 2013 Martin Pitt <martinpitt@gnome.org>
       7                 :            :  * Copyright 2014 Giovanni Campagna <gcampagna@src.gnome.org>
       8                 :            :  * Copyright 2018 Christoph Reiter
       9                 :            :  * Copyright 2019, 2024 Philip Chimento <philip.chimento@gmail.com>
      10                 :            :  * Copyright 2022 Emmanuele Bassi <ebassi@gnome.org>
      11                 :            :  * Copyright 2023 GNOME Foundation, Inc.
      12                 :            :  *
      13                 :            :  * SPDX-License-Identifier: LGPL-2.1-or-later
      14                 :            :  *
      15                 :            :  * This library is free software; you can redistribute it and/or
      16                 :            :  * modify it under the terms of the GNU Lesser General Public
      17                 :            :  * License as published by the Free Software Foundation; either
      18                 :            :  * version 2.1 of the License, or (at your option) any later version.
      19                 :            :  *
      20                 :            :  * This library is distributed in the hope that it will be useful,
      21                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      22                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23                 :            :  * Lesser General Public License for more details.
      24                 :            :  *
      25                 :            :  * You should have received a copy of the GNU Lesser General
      26                 :            :  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
      27                 :            :  *
      28                 :            :  * Author: Philip Withnall <pwithnall@gnome.org>
      29                 :            :  */
      30                 :            : 
      31                 :            : #include "config.h"
      32                 :            : 
      33                 :            : #include "gio.h"
      34                 :            : #include "girepository.h"
      35                 :            : #include "glib.h"
      36                 :            : #include "test-common.h"
      37                 :            : 
      38                 :            : static void
      39                 :          1 : test_repository_basic (RepositoryFixture *fx,
      40                 :            :                        const void *unused)
      41                 :            : {
      42                 :            :   const char * const * search_paths;
      43                 :          1 :   char **namespaces = NULL;
      44                 :            :   size_t n_namespaces;
      45                 :          1 :   const char *expected_namespaces[] = { "GLib", NULL };
      46                 :            :   char **versions;
      47                 :            :   size_t n_versions;
      48                 :          1 :   const char *prefix = NULL;
      49                 :            : 
      50                 :          1 :   g_test_summary ("Test basic opening of a repository and requiring a typelib");
      51                 :            : 
      52                 :          1 :   versions = gi_repository_enumerate_versions (fx->repository, "SomeInvalidNamespace", &n_versions);
      53                 :          1 :   g_assert_nonnull (versions);
      54                 :          1 :   g_assert_cmpstrv (versions, ((char *[]){NULL}));
      55                 :          1 :   g_assert_cmpuint (n_versions, ==, 0);
      56                 :          1 :   g_clear_pointer (&versions, g_strfreev);
      57                 :            : 
      58                 :          1 :   versions = gi_repository_enumerate_versions (fx->repository, "GLib", NULL);
      59                 :          1 :   g_assert_nonnull (versions);
      60                 :          2 :   g_assert_cmpstrv (versions, ((char *[]){"2.0", NULL}));
      61                 :          1 :   g_clear_pointer (&versions, g_strfreev);
      62                 :            : 
      63                 :          1 :   search_paths = gi_repository_get_search_path (fx->repository, NULL);
      64                 :          1 :   g_assert_nonnull (search_paths);
      65                 :          1 :   g_assert_cmpuint (g_strv_length ((char **) search_paths), >, 0);
      66                 :          1 :   g_assert_cmpstr (search_paths[0], ==, fx->gobject_typelib_dir);
      67                 :            : 
      68                 :          1 :   namespaces = gi_repository_get_loaded_namespaces (fx->repository, &n_namespaces);
      69                 :          2 :   g_assert_cmpstrv (namespaces, expected_namespaces);
      70                 :          1 :   g_assert_cmpuint (n_namespaces, ==, g_strv_length ((char **) expected_namespaces));
      71                 :          1 :   g_strfreev (namespaces);
      72                 :            : 
      73                 :          1 :   prefix = gi_repository_get_c_prefix (fx->repository, "GLib");
      74                 :          1 :   g_assert_nonnull (prefix);
      75                 :          1 :   g_assert_cmpstr (prefix, ==, "G");
      76                 :          1 : }
      77                 :            : 
      78                 :            : static void
      79                 :          1 : test_repository_info (RepositoryFixture *fx,
      80                 :            :                       const void *unused)
      81                 :            : {
      82                 :          1 :   GIBaseInfo *not_found_info = NULL;
      83                 :          1 :   GIObjectInfo *object_info = NULL, *object_info_by_gtype = NULL;
      84                 :          1 :   GISignalInfo *signal_info = NULL;
      85                 :          1 :   GIFunctionInfo *method_info = NULL;
      86                 :            :   GType gtype;
      87                 :            : 
      88                 :          1 :   g_test_summary ("Test retrieving some basic info blobs from a typelib");
      89                 :            : 
      90                 :          1 :   not_found_info = gi_repository_find_by_name (fx->repository, "GObject", "ThisDoesNotExist");
      91                 :          1 :   g_assert_null (not_found_info);
      92                 :            : 
      93                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
      94                 :          1 :   g_assert_nonnull (object_info);
      95                 :          1 :   g_assert_true (GI_IS_OBJECT_INFO (object_info));
      96                 :          1 :   g_assert_true (GI_IS_REGISTERED_TYPE_INFO (object_info));
      97                 :          1 :   g_assert_true (GI_IS_BASE_INFO (object_info));
      98                 :            : 
      99                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (object_info)), ==, "Object");
     100                 :          1 :   g_assert_cmpstr (gi_base_info_get_namespace (GI_BASE_INFO (object_info)), ==, "GObject");
     101                 :            : 
     102                 :          1 :   gtype = gi_registered_type_info_get_g_type (GI_REGISTERED_TYPE_INFO (object_info));
     103                 :          1 :   g_assert_true (g_type_is_a (gtype, G_TYPE_OBJECT));
     104                 :            : 
     105                 :          1 :   object_info_by_gtype = GI_OBJECT_INFO (gi_repository_find_by_gtype (fx->repository, G_TYPE_OBJECT));
     106                 :          1 :   g_assert_nonnull (object_info);
     107                 :            : 
     108                 :          1 :   signal_info = gi_object_info_find_signal (object_info, "notify");
     109                 :          1 :   g_assert_nonnull (signal_info);
     110                 :          1 :   g_assert_true (GI_IS_SIGNAL_INFO (signal_info));
     111                 :          1 :   g_assert_true (GI_IS_CALLABLE_INFO (signal_info));
     112                 :          1 :   g_assert_true (GI_IS_BASE_INFO (signal_info));
     113                 :            : 
     114                 :          1 :   g_assert_cmpint (gi_signal_info_get_flags (signal_info), ==,
     115                 :            :                    G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS | G_SIGNAL_ACTION);
     116                 :            : 
     117                 :          1 :   g_assert_cmpuint (gi_object_info_get_n_methods (object_info), >, 2);
     118                 :            : 
     119                 :          1 :   method_info = gi_object_info_find_method (object_info, "get_property");
     120                 :          1 :   g_assert_nonnull (method_info);
     121                 :          1 :   g_assert_true (GI_IS_FUNCTION_INFO (method_info));
     122                 :          1 :   g_assert_true (GI_IS_CALLABLE_INFO (method_info));
     123                 :          1 :   g_assert_true (GI_IS_BASE_INFO (method_info));
     124                 :            : 
     125                 :          1 :   g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (method_info)));
     126                 :          1 :   g_assert_cmpuint (gi_callable_info_get_n_args (GI_CALLABLE_INFO (method_info)), ==, 2);
     127                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     128                 :            : 
     129                 :          1 :   method_info = gi_object_info_get_method (object_info,
     130                 :          1 :                                            gi_object_info_get_n_methods (object_info) - 1);
     131                 :          1 :   g_assert_true (gi_callable_info_is_method (GI_CALLABLE_INFO (method_info)));
     132                 :          1 :   g_assert_cmpuint (gi_callable_info_get_n_args (GI_CALLABLE_INFO (method_info)), >, 0);
     133                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     134                 :            : 
     135                 :          1 :   gi_base_info_unref (signal_info);
     136                 :          1 :   gi_base_info_unref (object_info);
     137                 :          1 :   gi_base_info_unref (object_info_by_gtype);
     138                 :          1 : }
     139                 :            : 
     140                 :            : static void
     141                 :          1 : test_repository_dependencies (RepositoryFixture *fx,
     142                 :            :                               const void *unused)
     143                 :            : {
     144                 :          1 :   GError *error = NULL;
     145                 :            :   char **dependencies;
     146                 :            :   size_t n_dependencies;
     147                 :            : 
     148                 :          1 :   g_test_summary ("Test ensures namespace dependencies are correctly exposed");
     149                 :            : 
     150                 :          1 :   dependencies = gi_repository_get_dependencies (fx->repository, "GObject", &n_dependencies);
     151                 :          1 :   g_assert_cmpuint (g_strv_length (dependencies), ==, 1);
     152                 :          1 :   g_assert_cmpuint (n_dependencies, ==, 1);
     153                 :          1 :   g_assert_true (g_strv_contains ((const char **) dependencies, "GLib-2.0"));
     154                 :            : 
     155                 :          1 :   g_clear_error (&error);
     156                 :          1 :   g_clear_pointer (&dependencies, g_strfreev);
     157                 :          1 : }
     158                 :            : 
     159                 :            : static void
     160                 :          1 : test_repository_base_info_clear (RepositoryFixture *fx,
     161                 :            :                                  const void        *unused)
     162                 :            : {
     163                 :          1 :   GITypeInfo zeroed_type_info = { 0, };
     164                 :            :   GITypeInfo idempotent_type_info;
     165                 :          1 :   GIObjectInfo *object_info = NULL;
     166                 :          1 :   GIFunctionInfo *method_info = NULL;
     167                 :          1 :   GIArgInfo *arg_info = NULL;
     168                 :            : 
     169                 :          1 :   g_test_summary ("Test calling gi_base_info_clear() on a zero-filled struct");
     170                 :            : 
     171                 :            :   /* Load a valid #GITypeInfo onto the stack and clear it multiple times to
     172                 :            :    * check gi_base_info_clear() is idempotent after the first call. */
     173                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
     174                 :          1 :   g_assert_nonnull (object_info);
     175                 :          1 :   method_info = gi_object_info_find_method (object_info, "get_property");
     176                 :          1 :   g_assert_nonnull (method_info);
     177                 :          1 :   arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (method_info), 0);
     178                 :          1 :   g_assert_nonnull (arg_info);
     179                 :          1 :   gi_arg_info_load_type_info (arg_info, &idempotent_type_info);
     180                 :            : 
     181                 :          1 :   gi_base_info_clear (&idempotent_type_info);
     182                 :          1 :   gi_base_info_clear (&idempotent_type_info);
     183                 :          1 :   gi_base_info_clear (&idempotent_type_info);
     184                 :            : 
     185                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     186                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     187                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     188                 :            : 
     189                 :            :   /* Try clearing a #GITypeInfo which has always been zero-filled on the stack. */
     190                 :          1 :   gi_base_info_clear (&zeroed_type_info);
     191                 :          1 :   gi_base_info_clear (&zeroed_type_info);
     192                 :          1 :   gi_base_info_clear (&zeroed_type_info);
     193                 :          1 : }
     194                 :            : 
     195                 :            : static void
     196                 :          1 : test_repository_arg_info (RepositoryFixture *fx,
     197                 :            :                           const void *unused)
     198                 :            : {
     199                 :          1 :   GIObjectInfo *object_info = NULL;
     200                 :          1 :   GIStructInfo *struct_info = NULL;
     201                 :          1 :   GIFunctionInfo *method_info = NULL;
     202                 :          1 :   GIArgInfo *arg_info = NULL;
     203                 :          1 :   GITypeInfo *type_info = NULL;
     204                 :            :   GITypeInfo type_info_stack;
     205                 :            :   unsigned int idx;
     206                 :            : 
     207                 :          1 :   g_test_summary ("Test retrieving GIArgInfos from a typelib");
     208                 :            : 
     209                 :            :   /* Test all the methods of GIArgInfo. Here we’re looking at the
     210                 :            :    * `const char *property_name` argument of g_object_get_property(). (The
     211                 :            :    * ‘self’ argument is not exposed through gi_callable_info_get_arg().) */
     212                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
     213                 :          1 :   g_assert_nonnull (object_info);
     214                 :            : 
     215                 :          1 :   method_info = gi_object_info_find_method (object_info, "get_property");
     216                 :          1 :   g_assert_nonnull (method_info);
     217                 :            : 
     218                 :          1 :   arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (method_info), 0);
     219                 :          1 :   g_assert_nonnull (arg_info);
     220                 :            : 
     221                 :          1 :   g_assert_cmpint (gi_arg_info_get_direction (arg_info), ==, GI_DIRECTION_IN);
     222                 :          1 :   g_assert_false (gi_arg_info_is_return_value (arg_info));
     223                 :          1 :   g_assert_false (gi_arg_info_is_optional (arg_info));
     224                 :          1 :   g_assert_false (gi_arg_info_is_caller_allocates (arg_info));
     225                 :          1 :   g_assert_false (gi_arg_info_may_be_null (arg_info));
     226                 :          1 :   g_assert_false (gi_arg_info_is_skip (arg_info));
     227                 :          1 :   g_assert_cmpint (gi_arg_info_get_ownership_transfer (arg_info), ==, GI_TRANSFER_NOTHING);
     228                 :          1 :   g_assert_cmpint (gi_arg_info_get_scope (arg_info), ==, GI_SCOPE_TYPE_INVALID);
     229                 :          1 :   g_assert_false (gi_arg_info_get_closure_index (arg_info, NULL));
     230                 :          1 :   g_assert_false (gi_arg_info_get_closure_index (arg_info, &idx));
     231                 :          1 :   g_assert_cmpuint (idx, ==, 0);
     232                 :          1 :   g_assert_false (gi_arg_info_get_destroy_index (arg_info, NULL));
     233                 :          1 :   g_assert_false (gi_arg_info_get_destroy_index (arg_info, &idx));
     234                 :          1 :   g_assert_cmpuint (idx, ==, 0);
     235                 :            : 
     236                 :          1 :   type_info = gi_arg_info_get_type_info (arg_info);
     237                 :          1 :   g_assert_nonnull (type_info);
     238                 :          1 :   g_assert_true (gi_type_info_is_pointer (type_info));
     239                 :          1 :   g_assert_cmpint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_UTF8);
     240                 :            : 
     241                 :          1 :   gi_arg_info_load_type_info (arg_info, &type_info_stack);
     242                 :          1 :   g_assert_true (gi_type_info_is_pointer (&type_info_stack) == gi_type_info_is_pointer (type_info));
     243                 :          1 :   g_assert_cmpint (gi_type_info_get_tag (&type_info_stack), ==, gi_type_info_get_tag (type_info));
     244                 :            : 
     245                 :          1 :   gi_base_info_clear (&type_info_stack);
     246                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     247                 :            : 
     248                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     249                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     250                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     251                 :            : 
     252                 :            :   /* Test an (out) argument. Here it’s the `guint *n_properties` from
     253                 :            :    * g_object_class_list_properties(). */
     254                 :          1 :   struct_info = GI_STRUCT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "ObjectClass"));
     255                 :          1 :   g_assert_nonnull (struct_info);
     256                 :            : 
     257                 :          1 :   method_info = gi_struct_info_find_method (struct_info, "list_properties");
     258                 :          1 :   g_assert_nonnull (method_info);
     259                 :            : 
     260                 :          1 :   arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (method_info), 0);
     261                 :          1 :   g_assert_nonnull (arg_info);
     262                 :            : 
     263                 :          1 :   g_assert_cmpint (gi_arg_info_get_direction (arg_info), ==, GI_DIRECTION_OUT);
     264                 :          1 :   g_assert_false (gi_arg_info_is_optional (arg_info));
     265                 :          1 :   g_assert_false (gi_arg_info_is_caller_allocates (arg_info));
     266                 :          1 :   g_assert_cmpint (gi_arg_info_get_ownership_transfer (arg_info), ==, GI_TRANSFER_EVERYTHING);
     267                 :            : 
     268                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     269                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     270                 :          1 :   g_clear_pointer (&struct_info, gi_base_info_unref);
     271                 :          1 : }
     272                 :            : 
     273                 :            : static void
     274                 :          1 : test_repository_callable_info (RepositoryFixture *fx,
     275                 :            :                                const void *unused)
     276                 :            : {
     277                 :          1 :   GIObjectInfo *object_info = NULL;
     278                 :          1 :   GIFunctionInfo *method_info = NULL;
     279                 :            :   GICallableInfo *callable_info;
     280                 :          1 :   GITypeInfo *type_info = NULL;
     281                 :            :   GITypeInfo type_info_stack;
     282                 :          1 :   GIAttributeIter iter = GI_ATTRIBUTE_ITER_INIT;
     283                 :            :   const char *name, *value;
     284                 :          1 :   GIArgInfo *arg_info = NULL;
     285                 :            :   GIArgInfo arg_info_stack;
     286                 :            : 
     287                 :          1 :   g_test_summary ("Test retrieving GICallableInfos from a typelib");
     288                 :            : 
     289                 :            :   /* Test all the methods of GICallableInfo. Here we’re looking at
     290                 :            :    * g_object_get_qdata(). */
     291                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
     292                 :          1 :   g_assert_nonnull (object_info);
     293                 :            : 
     294                 :          1 :   method_info = gi_object_info_find_method (object_info, "get_qdata");
     295                 :          1 :   g_assert_nonnull (method_info);
     296                 :            : 
     297                 :          1 :   callable_info = GI_CALLABLE_INFO (method_info);
     298                 :            : 
     299                 :          1 :   g_assert_true (gi_callable_info_is_method (callable_info));
     300                 :          1 :   g_assert_false (gi_callable_info_can_throw_gerror (callable_info));
     301                 :            : 
     302                 :          1 :   type_info = gi_callable_info_get_return_type (callable_info);
     303                 :          1 :   g_assert_nonnull (type_info);
     304                 :          1 :   g_assert_true (gi_type_info_is_pointer (type_info));
     305                 :          1 :   g_assert_cmpint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_VOID);
     306                 :            : 
     307                 :          1 :   gi_callable_info_load_return_type (callable_info, &type_info_stack);
     308                 :          1 :   g_assert_true (gi_type_info_is_pointer (&type_info_stack) == gi_type_info_is_pointer (type_info));
     309                 :          1 :   g_assert_cmpint (gi_type_info_get_tag (&type_info_stack), ==, gi_type_info_get_tag (type_info));
     310                 :            : 
     311                 :          1 :   gi_base_info_clear (&type_info_stack);
     312                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     313                 :            : 
     314                 :            :   /* This method has no attributes */
     315                 :          1 :   g_assert_false (gi_callable_info_iterate_return_attributes (callable_info, &iter, &name, &value));
     316                 :            : 
     317                 :          1 :   g_assert_null (gi_callable_info_get_return_attribute (callable_info, "doesnt-exist"));
     318                 :            : 
     319                 :          1 :   g_assert_false (gi_callable_info_get_caller_owns (callable_info));
     320                 :          1 :   g_assert_true (gi_callable_info_may_return_null (callable_info));
     321                 :          1 :   g_assert_false (gi_callable_info_skip_return (callable_info));
     322                 :            : 
     323                 :          1 :   g_assert_cmpuint (gi_callable_info_get_n_args (callable_info), ==, 1);
     324                 :            : 
     325                 :          1 :   arg_info = gi_callable_info_get_arg (callable_info, 0);
     326                 :          1 :   g_assert_nonnull (arg_info);
     327                 :            : 
     328                 :          1 :   gi_callable_info_load_arg (callable_info, 0, &arg_info_stack);
     329                 :          1 :   g_assert_cmpint (gi_arg_info_get_direction (&arg_info_stack), ==, gi_arg_info_get_direction (arg_info));
     330                 :          1 :   g_assert_true (gi_arg_info_may_be_null (&arg_info_stack) == gi_arg_info_may_be_null (arg_info));
     331                 :            : 
     332                 :          1 :   gi_base_info_clear (&arg_info_stack);
     333                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     334                 :            : 
     335                 :          1 :   g_assert_cmpint (gi_callable_info_get_instance_ownership_transfer (callable_info), ==, GI_TRANSFER_NOTHING);
     336                 :            : 
     337                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     338                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     339                 :          1 : }
     340                 :            : 
     341                 :            : static void
     342                 :          1 : test_repository_callback_info (RepositoryFixture *fx,
     343                 :            :                                const void *unused)
     344                 :            : {
     345                 :          1 :   GICallbackInfo *callback_info = NULL;
     346                 :            : 
     347                 :          1 :   g_test_summary ("Test retrieving GICallbackInfos from a typelib");
     348                 :            : 
     349                 :            :   /* Test all the methods of GICallbackInfo. This is simple, because there are none. */
     350                 :          1 :   callback_info = GI_CALLBACK_INFO (gi_repository_find_by_name (fx->repository, "GObject", "ObjectFinalizeFunc"));
     351                 :          1 :   g_assert_nonnull (callback_info);
     352                 :            : 
     353                 :          1 :   g_clear_pointer (&callback_info, gi_base_info_unref);
     354                 :          1 : }
     355                 :            : 
     356                 :            : static void
     357                 :          1 : test_repository_char_types (RepositoryFixture *fx,
     358                 :            :                             const void *unused)
     359                 :            : {
     360                 :            :   GIStructInfo *gvalue_info;
     361                 :            :   GIFunctionInfo *method_info;
     362                 :            :   GITypeInfo *type_info;
     363                 :            : 
     364                 :          1 :   g_test_summary ("Test that signed and unsigned char GITypeInfo have GITypeTag of INT8 and UINT8 respectively");
     365                 :            : 
     366                 :          1 :   gvalue_info = GI_STRUCT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Value"));
     367                 :          1 :   g_assert_nonnull (gvalue_info);
     368                 :            : 
     369                 :            :   /* unsigned char */
     370                 :          1 :   method_info = gi_struct_info_find_method (gvalue_info, "get_uchar");
     371                 :          1 :   g_assert_nonnull (method_info);
     372                 :            : 
     373                 :          1 :   type_info = gi_callable_info_get_return_type (GI_CALLABLE_INFO (method_info));
     374                 :          1 :   g_assert_nonnull (type_info);
     375                 :          1 :   g_assert_cmpuint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_UINT8);
     376                 :            : 
     377                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     378                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     379                 :            : 
     380                 :            :   /* signed char */
     381                 :          1 :   method_info = gi_struct_info_find_method (gvalue_info, "get_schar");
     382                 :          1 :   g_assert_nonnull (method_info);
     383                 :            : 
     384                 :          1 :   type_info = gi_callable_info_get_return_type (GI_CALLABLE_INFO (method_info));
     385                 :          1 :   g_assert_nonnull (type_info);
     386                 :          1 :   g_assert_cmpuint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_INT8);
     387                 :            : 
     388                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     389                 :          1 :   g_clear_pointer (&method_info, gi_base_info_unref);
     390                 :          1 :   g_clear_pointer (&gvalue_info, gi_base_info_unref);
     391                 :          1 : }
     392                 :            : 
     393                 :            : static void
     394                 :          1 : test_repository_constructor_return_type (RepositoryFixture *fx,
     395                 :            :                                          const void *unused)
     396                 :            : {
     397                 :          1 :   GIObjectInfo *object_info = NULL;
     398                 :          1 :   GIFunctionInfo *constructor = NULL;
     399                 :          1 :   GITypeInfo *return_type = NULL;
     400                 :          1 :   GIBaseInfo *return_info = NULL;
     401                 :          1 :   const char *class_name = NULL;
     402                 :          1 :   const char *return_name = NULL;
     403                 :            : 
     404                 :          1 :   g_test_summary ("Test the return type of a constructor, g_object_newv()");
     405                 :            : 
     406                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
     407                 :          1 :   g_assert_nonnull (object_info);
     408                 :            : 
     409                 :          1 :   class_name = gi_registered_type_info_get_type_name (GI_REGISTERED_TYPE_INFO (object_info));
     410                 :          1 :   g_assert_nonnull (class_name);
     411                 :            : 
     412                 :          1 :   constructor = gi_object_info_find_method (object_info, "newv");
     413                 :          1 :   g_assert_nonnull (constructor);
     414                 :            : 
     415                 :          1 :   return_type = gi_callable_info_get_return_type (GI_CALLABLE_INFO (constructor));
     416                 :          1 :   g_assert_nonnull (return_type);
     417                 :          1 :   g_assert_cmpuint (gi_type_info_get_tag (return_type), ==, GI_TYPE_TAG_INTERFACE);
     418                 :            : 
     419                 :          1 :   return_info = gi_type_info_get_interface (return_type);
     420                 :          1 :   g_assert_nonnull (return_info);
     421                 :            : 
     422                 :          1 :   return_name = gi_registered_type_info_get_type_name (GI_REGISTERED_TYPE_INFO (return_info));
     423                 :          1 :   g_assert_nonnull (return_name);
     424                 :          1 :   g_assert_cmpstr (class_name, ==, return_name);
     425                 :            : 
     426                 :          1 :   g_clear_pointer (&return_info, gi_base_info_unref);
     427                 :          1 :   g_clear_pointer (&return_type, gi_base_info_unref);
     428                 :          1 :   g_clear_pointer (&constructor, gi_base_info_unref);
     429                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     430                 :          1 : }
     431                 :            : 
     432                 :            : static void
     433                 :          1 : test_repository_enum_info_c_identifier (RepositoryFixture *fx,
     434                 :            :                                         const void *unused)
     435                 :            : {
     436                 :          1 :   GIBaseInfo *info = NULL;
     437                 :          1 :   GIValueInfo *value_info = NULL;
     438                 :            :   unsigned n_infos, n_values, ix, jx;
     439                 :          1 :   const char *c_identifier = NULL;
     440                 :            : 
     441                 :          1 :   g_test_summary ("Test that every enum member has a C identifier");
     442                 :            : 
     443                 :          1 :   n_infos = gi_repository_get_n_infos (fx->repository, "GLib");
     444                 :            : 
     445         [ +  + ]:        967 :   for (ix = 0; ix < n_infos; ix++)
     446                 :            :     {
     447                 :        966 :       info = gi_repository_get_info (fx->repository, "GLib", ix);
     448                 :            : 
     449   [ -  +  +  -  :        966 :       if (GI_IS_ENUM_INFO (info))
             +  +  +  + ]
     450                 :            :         {
     451                 :         61 :           n_values = gi_enum_info_get_n_values (GI_ENUM_INFO (info));
     452         [ +  + ]:        798 :           for (jx = 0; jx < n_values; jx++)
     453                 :            :             {
     454                 :        737 :               value_info = gi_enum_info_get_value (GI_ENUM_INFO (info), jx);
     455                 :        737 :               c_identifier = gi_base_info_get_attribute (GI_BASE_INFO (value_info), "c:identifier");
     456                 :        737 :               g_assert_nonnull (c_identifier);
     457                 :            : 
     458                 :        737 :               g_clear_pointer (&value_info, gi_base_info_unref);
     459                 :            :             }
     460                 :            :         }
     461                 :            : 
     462                 :        966 :       g_clear_pointer (&info, gi_base_info_unref);
     463                 :            :     }
     464                 :          1 : }
     465                 :            : 
     466                 :            : static void
     467                 :          1 : test_repository_enum_info_static_methods (RepositoryFixture *fx,
     468                 :            :                                           const void *unused)
     469                 :            : {
     470                 :          1 :   GIEnumInfo *enum_info = NULL;
     471                 :            :   unsigned n_methods, ix;
     472                 :          1 :   GIFunctionInfo *function_info = NULL;
     473                 :            :   GIFunctionInfoFlags flags;
     474                 :          1 :   const char *symbol = NULL;
     475                 :            : 
     476                 :          1 :   g_test_summary ("Test an enum with methods");
     477                 :            : 
     478                 :          1 :   enum_info = GI_ENUM_INFO (gi_repository_find_by_name (fx->repository, "GLib", "UnicodeScript"));
     479                 :          1 :   g_assert_nonnull (enum_info);
     480                 :            : 
     481                 :          1 :   n_methods = gi_enum_info_get_n_methods (enum_info);
     482                 :          1 :   g_assert_cmpuint (n_methods, >, 0);
     483                 :            : 
     484         [ +  + ]:          3 :   for (ix = 0; ix < n_methods; ix++)
     485                 :            :     {
     486                 :          2 :       function_info = gi_enum_info_get_method (enum_info, ix);
     487                 :          2 :       g_assert_nonnull (function_info);
     488                 :            : 
     489                 :          2 :       flags = gi_function_info_get_flags (function_info);
     490                 :          2 :       g_assert_false (flags & GI_FUNCTION_IS_METHOD); /* must be static */
     491                 :            : 
     492                 :          2 :       symbol = gi_function_info_get_symbol (function_info);
     493                 :          2 :       g_assert_nonnull (symbol);
     494                 :          2 :       g_assert_true (g_str_has_prefix (symbol, "g_unicode_script_"));
     495                 :            : 
     496                 :          2 :       g_clear_pointer (&function_info, gi_base_info_unref);
     497                 :            :     }
     498                 :            : 
     499                 :          1 :   g_clear_pointer (&enum_info, gi_base_info_unref);
     500                 :          1 : }
     501                 :            : 
     502                 :            : static void
     503                 :          1 : test_repository_error_quark (RepositoryFixture *fx,
     504                 :            :                              const void *unused)
     505                 :            : {
     506                 :          1 :   GIEnumInfo *error_info = NULL;
     507                 :            : 
     508                 :          1 :   g_test_summary ("Test finding an error quark by error domain");
     509                 :            : 
     510                 :          1 :   error_info = gi_repository_find_by_error_domain (fx->repository, G_RESOLVER_ERROR);
     511                 :          1 :   g_assert_nonnull (error_info);
     512                 :          1 :   g_assert_true (GI_IS_ENUM_INFO (error_info));
     513                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (error_info)), ==, "ResolverError");
     514                 :            : 
     515                 :          1 :   g_clear_pointer (&error_info, gi_base_info_unref);
     516                 :          1 : }
     517                 :            : 
     518                 :            : static void
     519                 :          1 : test_repository_flags_info_c_identifier (RepositoryFixture *fx,
     520                 :            :                                          const void *unused)
     521                 :            : {
     522                 :          1 :   GIBaseInfo *info = NULL;
     523                 :          1 :   GIValueInfo *value_info = NULL;
     524                 :            :   unsigned n_infos, n_values, ix, jx;
     525                 :          1 :   const char *c_identifier = NULL;
     526                 :            : 
     527                 :          1 :   g_test_summary ("Test that every flags member has a C identifier");
     528                 :            : 
     529                 :          1 :   n_infos = gi_repository_get_n_infos (fx->repository, "GLib");
     530                 :            : 
     531         [ +  + ]:        967 :   for (ix = 0; ix < n_infos; ix++)
     532                 :            :     {
     533                 :        966 :       info = gi_repository_get_info (fx->repository, "GLib", ix);
     534                 :            : 
     535   [ -  +  +  -  :        966 :       if (GI_IS_FLAGS_INFO (info))
             +  +  +  + ]
     536                 :            :         {
     537                 :         22 :           n_values = gi_enum_info_get_n_values (GI_ENUM_INFO (info));
     538         [ +  + ]:        182 :           for (jx = 0; jx < n_values; jx++)
     539                 :            :             {
     540                 :        160 :               value_info = gi_enum_info_get_value (GI_ENUM_INFO (info), jx);
     541                 :        160 :               c_identifier = gi_base_info_get_attribute (GI_BASE_INFO (value_info), "c:identifier");
     542                 :        160 :               g_assert_nonnull (c_identifier);
     543                 :            : 
     544                 :        160 :               g_clear_pointer (&value_info, gi_base_info_unref);
     545                 :            :             }
     546                 :            :         }
     547                 :            : 
     548                 :        966 :       g_clear_pointer (&info, gi_base_info_unref);
     549                 :            :     }
     550                 :          1 : }
     551                 :            : 
     552                 :            : static void
     553                 :          1 : test_repository_fundamental_ref_func (RepositoryFixture *fx,
     554                 :            :                                       const void *unused)
     555                 :            : {
     556                 :            :   GIObjectInfo *info;
     557                 :            : 
     558                 :          1 :   g_test_summary ("Test getting the ref func of a fundamental type");
     559                 :            : 
     560                 :          1 :   info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "ParamSpec"));
     561                 :          1 :   g_assert_nonnull (info);
     562                 :            : 
     563                 :          1 :   g_assert_nonnull (gi_object_info_get_ref_function_pointer (info));
     564                 :            : 
     565                 :          1 :   g_clear_pointer (&info, gi_base_info_unref);
     566                 :          1 : }
     567                 :            : 
     568                 :            : static void
     569                 :          1 : test_repository_instance_method_ownership_transfer (RepositoryFixture *fx,
     570                 :            :                                                     const void *unused)
     571                 :            : {
     572                 :          1 :   GIObjectInfo *class_info = NULL;
     573                 :          1 :   GIFunctionInfo *func_info = NULL;
     574                 :            :   GITransfer transfer;
     575                 :            : 
     576                 :          1 :   g_test_summary ("Test two methods of the same object having opposite ownership transfer of the instance parameter");
     577                 :            : 
     578                 :          1 :   class_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "Gio", "DBusMethodInvocation"));
     579                 :          1 :   g_assert_nonnull (class_info);
     580                 :            : 
     581                 :          1 :   func_info = gi_object_info_find_method (class_info, "get_connection");
     582                 :          1 :   g_assert_nonnull (func_info);
     583                 :          1 :   transfer = gi_callable_info_get_instance_ownership_transfer (GI_CALLABLE_INFO (func_info));
     584                 :          1 :   g_assert_cmpint (GI_TRANSFER_NOTHING, ==, transfer);
     585                 :            : 
     586                 :          1 :   g_clear_pointer (&func_info, gi_base_info_unref);
     587                 :            : 
     588                 :          1 :   func_info = gi_object_info_find_method (class_info, "return_error_literal");
     589                 :          1 :   g_assert_nonnull (func_info);
     590                 :          1 :   transfer = gi_callable_info_get_instance_ownership_transfer (GI_CALLABLE_INFO (func_info));
     591                 :          1 :   g_assert_cmpint (GI_TRANSFER_EVERYTHING, ==, transfer);
     592                 :            : 
     593                 :          1 :   g_clear_pointer (&func_info, gi_base_info_unref);
     594                 :          1 :   g_clear_pointer (&class_info, gi_base_info_unref);
     595                 :          1 : }
     596                 :            : 
     597                 :            : static void
     598                 :          1 : test_repository_object_gtype_interfaces (RepositoryFixture *fx,
     599                 :            :                                          const void *unused)
     600                 :            : {
     601                 :            :   GIInterfaceInfo **interfaces;
     602                 :            :   size_t n_interfaces, ix;
     603                 :            :   const char *name;
     604                 :          1 :   gboolean found_initable = FALSE, found_async_initable = FALSE;
     605                 :            : 
     606                 :          1 :   g_test_summary ("Test gi_repository_get_object_gtype_interfaces()");
     607                 :            : 
     608                 :          1 :   gi_repository_get_object_gtype_interfaces (fx->repository, G_TYPE_DBUS_CONNECTION, &n_interfaces, &interfaces);
     609                 :            : 
     610                 :          1 :   g_assert_cmpuint (n_interfaces, ==, 2);
     611                 :            : 
     612         [ +  + ]:          3 :   for (ix = 0; ix < n_interfaces; ix++)
     613                 :            :     {
     614                 :          2 :       name = gi_base_info_get_name (GI_BASE_INFO (*(interfaces + ix)));
     615         [ +  + ]:          2 :       if (strcmp (name, "Initable") == 0)
     616                 :          1 :         found_initable = TRUE;
     617         [ +  - ]:          1 :       else if (strcmp (name, "AsyncInitable") == 0)
     618                 :          1 :         found_async_initable = TRUE;
     619                 :            :     }
     620                 :            : 
     621                 :          1 :   g_assert_true (found_initable);
     622                 :          1 :   g_assert_true (found_async_initable);
     623                 :          1 : }
     624                 :            : 
     625                 :            : static void
     626                 :          1 : test_repository_signal_info_with_array_length_arg (RepositoryFixture *fx,
     627                 :            :                                                    const void *unused)
     628                 :            : {
     629                 :          1 :   GIObjectInfo *gsettings_info = NULL;
     630                 :          1 :   GISignalInfo *sig_info = NULL;
     631                 :          1 :   GIArgInfo *arg_info = NULL;
     632                 :          1 :   GITypeInfo *type_info = NULL;
     633                 :            :   unsigned length_ix;
     634                 :            : 
     635                 :          1 :   g_test_summary ("Test finding the associated array length argument of an array parameter of a signal");
     636                 :            : 
     637                 :          1 :   gsettings_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "Gio", "Settings"));
     638                 :          1 :   g_assert_nonnull (gsettings_info);
     639                 :            : 
     640                 :          1 :   sig_info = gi_object_info_find_signal (gsettings_info, "change-event");
     641                 :          1 :   g_assert_nonnull (sig_info);
     642                 :            : 
     643                 :          1 :   g_assert_cmpuint (gi_callable_info_get_n_args (GI_CALLABLE_INFO (sig_info)), ==, 2);
     644                 :            : 
     645                 :            :   /* verify array argument */
     646                 :          1 :   arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (sig_info), 0);
     647                 :          1 :   g_assert_nonnull (arg_info);
     648                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (arg_info)), ==, "keys");
     649                 :            : 
     650                 :          1 :   type_info = gi_arg_info_get_type_info (arg_info);
     651                 :          1 :   g_assert_nonnull (type_info);
     652                 :          1 :   g_assert_cmpint (gi_type_info_get_tag (type_info), ==, GI_TYPE_TAG_ARRAY);
     653                 :          1 :   g_assert_cmpint (gi_type_info_get_array_type (type_info), ==, GI_ARRAY_TYPE_C);
     654                 :          1 :   g_assert_false (gi_type_info_is_zero_terminated (type_info));
     655                 :          1 :   gboolean ok = gi_type_info_get_array_length_index (type_info, &length_ix);
     656                 :          1 :   g_assert_true (ok);
     657                 :          1 :   g_assert_cmpuint (length_ix, ==, 1);
     658                 :            : 
     659                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     660                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     661                 :            : 
     662                 :            :   /* verify array length argument */
     663                 :          1 :   arg_info = gi_callable_info_get_arg (GI_CALLABLE_INFO (sig_info), 1);
     664                 :          1 :   g_assert_nonnull (arg_info);
     665                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (arg_info)), ==, "n_keys");
     666                 :            : 
     667                 :          1 :   g_clear_pointer (&arg_info, gi_base_info_unref);
     668                 :          1 :   g_clear_pointer (&type_info, gi_base_info_unref);
     669                 :          1 :   g_clear_pointer (&sig_info, gi_base_info_unref);
     670                 :          1 :   g_clear_pointer (&gsettings_info, gi_base_info_unref);
     671                 :          1 : }
     672                 :            : 
     673                 :            : static void
     674                 :          1 : test_repository_type_info_name (RepositoryFixture *fx,
     675                 :            :                                 const void *unused)
     676                 :            : {
     677                 :          1 :   GIInterfaceInfo *interface_info = NULL;
     678                 :            :   GIVFuncInfo *vfunc;
     679                 :            :   GITypeInfo *typeinfo;
     680                 :            : 
     681                 :          1 :   g_test_summary ("Test that gi_base_info_get_name() returns null for GITypeInfo");
     682                 :          1 :   g_test_bug ("https://gitlab.gnome.org/GNOME/gobject-introspection/issues/96");
     683                 :            : 
     684                 :          1 :   interface_info = GI_INTERFACE_INFO (gi_repository_find_by_name (fx->repository, "Gio", "File"));
     685                 :          1 :   g_assert_nonnull (interface_info);
     686                 :          1 :   vfunc = gi_interface_info_find_vfunc (interface_info, "read_async");
     687                 :          1 :   g_assert_nonnull (vfunc);
     688                 :            : 
     689                 :          1 :   typeinfo = gi_callable_info_get_return_type (GI_CALLABLE_INFO (vfunc));
     690                 :          1 :   g_assert_nonnull (typeinfo);
     691                 :            : 
     692                 :          1 :   g_assert_null (gi_base_info_get_name (GI_BASE_INFO (typeinfo)));
     693                 :            : 
     694                 :          1 :   g_clear_pointer (&interface_info, gi_base_info_unref);
     695                 :          1 :   g_clear_pointer (&vfunc, gi_base_info_unref);
     696                 :          1 :   g_clear_pointer (&typeinfo, gi_base_info_unref);
     697                 :          1 : }
     698                 :            : 
     699                 :            : static void
     700                 :          1 : test_repository_vfunc_info_with_no_invoker (RepositoryFixture *fx,
     701                 :            :                                             const void *unused)
     702                 :            : {
     703                 :          1 :   GIObjectInfo *object_info = NULL;
     704                 :          1 :   GIVFuncInfo *vfunc_info = NULL;
     705                 :          1 :   GIFunctionInfo *invoker_info = NULL;
     706                 :            : 
     707                 :          1 :   g_test_summary ("Test vfunc with no known invoker on object, such as GObject.dispose");
     708                 :            : 
     709                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "GObject", "Object"));
     710                 :          1 :   g_assert_nonnull (object_info);
     711                 :            : 
     712                 :          1 :   vfunc_info = gi_object_info_find_vfunc (object_info, "dispose");
     713                 :          1 :   g_assert_nonnull (vfunc_info);
     714                 :            : 
     715                 :          1 :   invoker_info = gi_vfunc_info_get_invoker (vfunc_info);
     716                 :          1 :   g_assert_null (invoker_info);
     717                 :            : 
     718                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     719                 :          1 :   g_clear_pointer (&vfunc_info, gi_base_info_unref);
     720                 :          1 : }
     721                 :            : 
     722                 :            : static void
     723                 :          1 : test_repository_vfunc_info_with_invoker_on_interface (RepositoryFixture *fx,
     724                 :            :                                                       const void *unused)
     725                 :            : {
     726                 :          1 :   GIInterfaceInfo *interface_info = NULL;
     727                 :          1 :   GIVFuncInfo *vfunc_info = NULL;
     728                 :          1 :   GIFunctionInfo *invoker_info = NULL;
     729                 :            : 
     730                 :          1 :   g_test_summary ("Test vfunc with invoker on interface, such as GFile.read_async");
     731                 :            : 
     732                 :          1 :   interface_info = GI_INTERFACE_INFO (gi_repository_find_by_name (fx->repository, "Gio", "File"));
     733                 :          1 :   g_assert_nonnull (interface_info);
     734                 :            : 
     735                 :          1 :   vfunc_info = gi_interface_info_find_vfunc (interface_info, "read_async");
     736                 :          1 :   g_assert_nonnull (vfunc_info);
     737                 :            : 
     738                 :          1 :   invoker_info = gi_vfunc_info_get_invoker (vfunc_info);
     739                 :          1 :   g_assert_nonnull (invoker_info);
     740                 :            : 
     741                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (invoker_info)), ==, "read_async");
     742                 :            : 
     743                 :          1 :   g_clear_pointer (&interface_info, gi_base_info_unref);
     744                 :          1 :   g_clear_pointer (&vfunc_info, gi_base_info_unref);
     745                 :          1 :   g_clear_pointer (&invoker_info, gi_base_info_unref);
     746                 :          1 : }
     747                 :            : 
     748                 :            : static void
     749                 :          1 : test_repository_vfunc_info_with_invoker_on_object (RepositoryFixture *fx,
     750                 :            :                                                    const void *unused)
     751                 :            : {
     752                 :          1 :   GIObjectInfo *object_info = NULL;
     753                 :          1 :   GIVFuncInfo *vfunc_info = NULL;
     754                 :          1 :   GIFunctionInfo *invoker_info = NULL;
     755                 :            : 
     756                 :          1 :   g_test_summary ("Test vfunc with invoker on object, such as GAppLaunchContext.get_display");
     757                 :            : 
     758                 :          1 :   object_info = GI_OBJECT_INFO (gi_repository_find_by_name (fx->repository, "Gio", "AppLaunchContext"));
     759                 :          1 :   g_assert_nonnull (object_info);
     760                 :            : 
     761                 :          1 :   vfunc_info = gi_object_info_find_vfunc (object_info, "get_display");
     762                 :          1 :   g_assert_nonnull (vfunc_info);
     763                 :            : 
     764                 :          1 :   invoker_info = gi_vfunc_info_get_invoker (vfunc_info);
     765                 :          1 :   g_assert_nonnull (invoker_info);
     766                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (invoker_info)), ==, "get_display");
     767                 :            : 
     768                 :            :   /* And let's be sure we can find the method directly */
     769                 :          1 :   g_clear_pointer (&invoker_info, gi_base_info_unref);
     770                 :            : 
     771                 :          1 :   invoker_info = gi_object_info_find_method (object_info, "get_display");
     772                 :          1 :   g_assert_nonnull (invoker_info);
     773                 :          1 :   g_assert_cmpstr (gi_base_info_get_name (GI_BASE_INFO (invoker_info)), ==, "get_display");
     774                 :            : 
     775                 :          1 :   g_clear_pointer (&object_info, gi_base_info_unref);
     776                 :          1 :   g_clear_pointer (&vfunc_info, gi_base_info_unref);
     777                 :          1 :   g_clear_pointer (&invoker_info, gi_base_info_unref);
     778                 :          1 : }
     779                 :            : 
     780                 :            : int
     781                 :          1 : main (int   argc,
     782                 :            :       char *argv[])
     783                 :            : {
     784                 :          1 :   repository_init (&argc, &argv);
     785                 :            : 
     786                 :          1 :   ADD_REPOSITORY_TEST ("/repository/basic", test_repository_basic, &typelib_load_spec_glib);
     787                 :          1 :   ADD_REPOSITORY_TEST ("/repository/info", test_repository_info, &typelib_load_spec_gobject);
     788                 :          1 :   ADD_REPOSITORY_TEST ("/repository/dependencies", test_repository_dependencies, &typelib_load_spec_gobject);
     789                 :          1 :   ADD_REPOSITORY_TEST ("/repository/base-info/clear", test_repository_base_info_clear, &typelib_load_spec_gobject);
     790                 :          1 :   ADD_REPOSITORY_TEST ("/repository/arg-info", test_repository_arg_info, &typelib_load_spec_gobject);
     791                 :          1 :   ADD_REPOSITORY_TEST ("/repository/callable-info", test_repository_callable_info, &typelib_load_spec_gobject);
     792                 :          1 :   ADD_REPOSITORY_TEST ("/repository/callback-info", test_repository_callback_info, &typelib_load_spec_gobject);
     793                 :          1 :   ADD_REPOSITORY_TEST ("/repository/char-types", test_repository_char_types, &typelib_load_spec_gobject);
     794                 :          1 :   ADD_REPOSITORY_TEST ("/repository/constructor-return-type", test_repository_constructor_return_type, &typelib_load_spec_gobject);
     795                 :          1 :   ADD_REPOSITORY_TEST ("/repository/enum-info-c-identifier", test_repository_enum_info_c_identifier, &typelib_load_spec_glib);
     796                 :          1 :   ADD_REPOSITORY_TEST ("/repository/enum-info-static-methods", test_repository_enum_info_static_methods, &typelib_load_spec_glib);
     797                 :          1 :   ADD_REPOSITORY_TEST ("/repository/error-quark", test_repository_error_quark, &typelib_load_spec_gio);
     798                 :          1 :   ADD_REPOSITORY_TEST ("/repository/flags-info-c-identifier", test_repository_flags_info_c_identifier, &typelib_load_spec_gobject);
     799                 :          1 :   ADD_REPOSITORY_TEST ("/repository/fundamental-ref-func", test_repository_fundamental_ref_func, &typelib_load_spec_gobject);
     800                 :          1 :   ADD_REPOSITORY_TEST ("/repository/instance-method-ownership-transfer", test_repository_instance_method_ownership_transfer, &typelib_load_spec_gio);
     801                 :          1 :   ADD_REPOSITORY_TEST ("/repository/object-gtype-interfaces", test_repository_object_gtype_interfaces, &typelib_load_spec_gio);
     802                 :          1 :   ADD_REPOSITORY_TEST ("/repository/signal-info-with-array-length-arg", test_repository_signal_info_with_array_length_arg, &typelib_load_spec_gio);
     803                 :          1 :   ADD_REPOSITORY_TEST ("/repository/type-info-name", test_repository_type_info_name, &typelib_load_spec_gio);
     804                 :          1 :   ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-no-invoker", test_repository_vfunc_info_with_no_invoker, &typelib_load_spec_gobject);
     805                 :          1 :   ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-invoker-on-interface", test_repository_vfunc_info_with_invoker_on_interface, &typelib_load_spec_gio);
     806                 :          1 :   ADD_REPOSITORY_TEST ("/repository/vfunc-info-with-invoker-on-object", test_repository_vfunc_info_with_invoker_on_object, &typelib_load_spec_gio);
     807                 :            : 
     808                 :          1 :   return g_test_run ();
     809                 :            : }

Generated by: LCOV version 1.14