LCOV - code coverage report
Current view: top level - glib/gobject/tests - testmodule.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 19 19 100.0 %
Date: 2024-04-30 05:17:35 Functions: 5 5 100.0 %
Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* GObject - GLib Type, Object, Parameter and Signal Library
       2                 :            :  * testmodule.c: Dummy dynamic type module
       3                 :            :  * Copyright (C) 2003 Red Hat, Inc.
       4                 :            :  *
       5                 :            :  * SPDX-License-Identifier: LGPL-2.1-or-later
       6                 :            :  *
       7                 :            :  * This library is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU Lesser General Public
       9                 :            :  * License as published by the Free Software Foundation; either
      10                 :            :  * version 2.1 of the License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This library is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      15                 :            :  * Lesser General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU Lesser General Public
      18                 :            :  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
      19                 :            :  */
      20                 :            : 
      21                 :            : #include "testmodule.h"
      22                 :            : #include "testcommon.h"
      23                 :            : 
      24                 :            : static gboolean test_module_load   (GTypeModule *module);
      25                 :            : static void     test_module_unload (GTypeModule *module);
      26                 :            : 
      27                 :            : static void
      28                 :          2 : test_module_class_init (TestModuleClass *class)
      29                 :            : {
      30                 :          2 :   GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class);
      31                 :            : 
      32                 :          2 :   module_class->load = test_module_load;
      33                 :          2 :   module_class->unload = test_module_unload;
      34                 :          2 : }
      35                 :            : 
      36         [ +  + ]:          6 : DEFINE_TYPE (TestModule, test_module,
      37                 :            :              test_module_class_init, NULL, NULL,
      38                 :            :              G_TYPE_TYPE_MODULE)
      39                 :            : 
      40                 :            : static gboolean
      41                 :          4 : test_module_load (GTypeModule *module)
      42                 :            : {
      43                 :          4 :   TestModule *test_module = TEST_MODULE (module);
      44                 :            : 
      45                 :          4 :   test_module->register_func (module);
      46                 :            :   
      47                 :          4 :   return TRUE;
      48                 :            : }
      49                 :            : 
      50                 :            : static void
      51                 :          2 : test_module_unload (GTypeModule *module)
      52                 :            : {
      53                 :          2 : }
      54                 :            : 
      55                 :            : GTypeModule *
      56                 :          2 : test_module_new (TestModuleRegisterFunc register_func)
      57                 :            : {
      58                 :          2 :   TestModule *test_module = g_object_new (TEST_TYPE_MODULE, NULL);
      59                 :          2 :   GTypeModule *module = G_TYPE_MODULE (test_module);
      60                 :            :   
      61                 :          2 :   test_module->register_func = register_func;
      62                 :            : 
      63                 :            :   /* Register the types initially */
      64                 :          2 :   g_type_module_use (module);
      65                 :          2 :   g_type_module_unuse (module);
      66                 :            : 
      67                 :          2 :   return G_TYPE_MODULE (module);
      68                 :            : }

Generated by: LCOV version 1.14