GCC Code Coverage Report


Directory: ./
File: tests/interactive-panels/main.c
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 16 0.0%
Functions: 0 2 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 /* main.c
2 *
3 * Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: GPL-3.0-or-later
19 */
20
21 #include "config.h"
22
23 #include <stdlib.h>
24 #include <glib/gi18n.h>
25 #include <gtk/gtk.h>
26
27 #include "shell/cc-application.h"
28 #include "shell/cc-panel-loader.h"
29 #include "shell/resources.h"
30 #include "test-panels-resources.h"
31
32 #include "gtp-dynamic-panel.h"
33 #include "gtp-static-init.h"
34
35 /* Test panels */
36 static CcPanelLoaderVtable test_panels[] = {
37 { "dynamic-panel", gtp_dynamic_panel_get_type, NULL },
38 { "static-init", gtp_static_init_get_type, gtp_static_init_func },
39 };
40
41 static void
42 override_xdg_data_dirs (void)
43 {
44 g_autoptr(GString) extended_xdg_data_dirs = NULL;
45 const gchar *xdg_data_dirs;
46
47 extended_xdg_data_dirs = g_string_new (".");
48 xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
49
50 if (xdg_data_dirs)
51 g_string_append_printf (extended_xdg_data_dirs, ":%s", xdg_data_dirs);
52
53 g_setenv ("XDG_DATA_DIRS", extended_xdg_data_dirs->str, TRUE);
54 }
55
56 gint
57 main (gint argc,
58 gchar *argv[])
59 {
60 g_autoptr(GtkApplication) application = NULL;
61
62 /* Manually register GResources */
63 g_resources_register (gnome_control_center_get_resource ());
64 g_resources_register (test_panels_get_resource ());
65
66 /* Override the panels vtable with the test panels */
67 cc_panel_loader_override_vtable (test_panels, G_N_ELEMENTS (test_panels));
68
69 /* Override XDG_DATA_DIRS */
70 override_xdg_data_dirs ();
71
72 application = cc_application_new ();
73
74 return g_application_run (G_APPLICATION (application), argc, argv);
75 }
76