GCC Code Coverage Report


Directory: ./
File: panels/wacom/test-wacom.c
Date: 2024-05-04 07:58:27
Exec Total Coverage
Lines: 0 70 0.0%
Functions: 0 13 0.0%
Branches: 0 6 0.0%

Line Branch Exec Source
1
2 #include "config.h"
3
4 #include <glib/gi18n.h>
5 #include <shell/cc-panel.h>
6
7 #include "cc-wacom-panel.h"
8 #include "cc-wacom-page.h"
9
10 #define FIXED_WIDTH 675
11
12 CcShell *
13 cc_panel_get_shell (CcPanel *self)
14 {
15 return NULL;
16 }
17
18 GtkWidget *
19 cc_shell_get_toplevel (CcShell *shell)
20 {
21 return NULL;
22 }
23
24 GType
25 cc_panel_get_type ()
26 {
27 return 1234;
28 }
29
30 void
31 cc_wacom_panel_switch_to_panel (CcWacomPanel *self, const char *panel)
32 {
33 g_message ("Should launch %s preferences here", panel);
34 }
35
36 GDBusProxy *
37 cc_wacom_panel_get_gsd_wacom_bus_proxy (CcWacomPanel *self)
38 {
39 g_message ("Should get the g-s-d wacom dbus proxy here");
40
41 return NULL;
42 }
43
44 GDBusProxy *
45 cc_wacom_panel_get_input_mapping_bus_proxy (CcWacomPanel *self)
46 {
47 g_message ("Should get the mutter input mapping dbus proxy here");
48
49 return NULL;
50 }
51
52 static void
53 add_page (GList *devices,
54 GtkWidget *notebook)
55 {
56 GtkWidget *widget;
57 CcWacomDevice *stylus = NULL;
58 GList *l;
59
60 if (devices == NULL)
61 return;
62
63 for (l = devices; l ; l = l->next) {
64 stylus = l->data;
65 }
66 g_list_free (devices);
67
68 widget = cc_wacom_page_new (NULL, stylus);
69 gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, NULL);
70 }
71
72 static GList *
73 create_fake_cintiq (void)
74 {
75 CcWacomDevice *device;
76 GList *devices;
77
78 device = cc_wacom_device_new_fake ("Wacom Cintiq 21UX2");
79 devices = g_list_prepend (NULL, device);
80
81 return devices;
82 }
83
84 static GList *
85 create_fake_bt (void)
86 {
87 CcWacomDevice *device;
88 GList *devices;
89
90 device = cc_wacom_device_new_fake ("Wacom Graphire Wireless");
91 devices = g_list_prepend (NULL, device);
92
93 return devices;
94 }
95
96 static GList *
97 create_fake_x201 (void)
98 {
99 CcWacomDevice *device;
100 GList *devices;
101
102 device = cc_wacom_device_new_fake ("Wacom Serial Tablet WACf004");
103 devices = g_list_prepend (NULL, device);
104
105 return devices;
106 }
107
108 static GList *
109 create_fake_intuos4 (void)
110 {
111 CcWacomDevice *device;
112 GList *devices;
113
114 device = cc_wacom_device_new_fake ("Wacom Intuos4 6x9");
115 devices = g_list_prepend (NULL, device);
116
117 return devices;
118 }
119
120 static GList *
121 create_fake_h610pro (void)
122 {
123 CcWacomDevice *device;
124 GList *devices;
125
126 device = cc_wacom_device_new_fake ("Huion H610 Pro");
127 devices = g_list_prepend (NULL, device);
128
129 return devices;
130 }
131
132 int main (int argc, char **argv)
133 {
134 GtkWidget *window, *notebook;
135 GList *devices;
136
137 bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
138 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
139 textdomain (GETTEXT_PACKAGE);
140
141 gtk_init ();
142
143 window = gtk_window_new ();
144 gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
145 gtk_window_set_default_size (GTK_WINDOW (window), FIXED_WIDTH, -1);
146 notebook = gtk_notebook_new ();
147 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
148 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
149 gtk_widget_set_vexpand (notebook, TRUE);
150 gtk_window_set_child (GTK_WINDOW (window), notebook);
151
152 devices = create_fake_intuos4 ();
153 add_page (devices, notebook);
154
155 devices = create_fake_cintiq ();
156 add_page (devices, notebook);
157
158 devices = create_fake_bt ();
159 add_page (devices, notebook);
160
161 devices = create_fake_x201 ();
162 add_page (devices, notebook);
163
164 devices = create_fake_h610pro ();
165 add_page (devices, notebook);
166
167
168 while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
169 g_main_context_iteration (NULL, TRUE);
170
171 return 0;
172 }
173