File: | testsuite/ctk/builder.c |
Warning: | line 2043, column 3 Value stored to 'label' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* buildertest.c |
2 | * Copyright (C) 2006-2007 Async Open Source |
3 | * Authors: Johan Dahlin |
4 | * Henrique Romano |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 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 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public |
17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
18 | */ |
19 | |
20 | #include <string.h> |
21 | #include <libintl.h> |
22 | #include <locale.h> |
23 | #include <math.h> |
24 | |
25 | #include <ctk/ctk.h> |
26 | #include <cdk/cdkkeysyms.h> |
27 | |
28 | /* exported for CtkBuilder */ |
29 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_normal (CtkWindow *window, GParamSpec *spec); |
30 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_after (CtkWindow *window, GParamSpec *spec); |
31 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_object (CtkButton *button, GParamSpec *spec); |
32 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_object_after (CtkButton *button, GParamSpec *spec); |
33 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_first (CtkButton *button, GParamSpec *spec); |
34 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_second (CtkButton *button, GParamSpec *spec); |
35 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_extra (CtkButton *button, GParamSpec *spec); |
36 | G_MODULE_EXPORT__attribute__((visibility("default"))) void signal_extra2 (CtkButton *button, GParamSpec *spec); |
37 | |
38 | /* Copied from ctkiconfactory.c; keep in sync! */ |
39 | struct _CtkIconSet |
40 | { |
41 | guint ref_count; |
42 | GSList *sources; |
43 | GSList *cache; |
44 | guint cache_size; |
45 | guint cache_serial; |
46 | }; |
47 | |
48 | |
49 | static CtkBuilder * |
50 | builder_new_from_string (const gchar *buffer, |
51 | gsize length, |
52 | const gchar *domain) |
53 | { |
54 | CtkBuilder *builder; |
55 | GError *error = NULL((void*)0); |
56 | |
57 | builder = ctk_builder_new (); |
58 | if (domain) |
59 | ctk_builder_set_translation_domain (builder, domain); |
60 | ctk_builder_add_from_string (builder, buffer, length, &error); |
61 | if (error) |
62 | { |
63 | g_print ("ERROR: %s", error->message); |
64 | g_error_free (error); |
65 | } |
66 | |
67 | return builder; |
68 | } |
69 | |
70 | static void |
71 | test_parser (void) |
72 | { |
73 | CtkBuilder *builder; |
74 | GError *error; |
75 | |
76 | builder = ctk_builder_new (); |
77 | |
78 | error = NULL((void*)0); |
79 | ctk_builder_add_from_string (builder, "<xxx/>", -1, &error); |
80 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_UNHANDLED_TAG)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_UNHANDLED_TAG) g_assertion_message_error (((gchar*) 0), "builder.c", 80, ((const char*) (__func__)), "error" , error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_UNHANDLED_TAG ); } while (0); |
81 | g_error_free (error); |
82 | |
83 | error = NULL((void*)0); |
84 | ctk_builder_add_from_string (builder, "<interface invalid=\"X\"/>", -1, &error); |
85 | g_assert_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE)do { if (!error || (error)->domain != g_markup_error_quark () || (error)->code != G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) g_assertion_message_error (((gchar*) 0), "builder.c", 85, ((const char*) (__func__)), "error" , error, g_markup_error_quark (), G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE ); } while (0); |
86 | g_error_free (error); |
87 | |
88 | error = NULL((void*)0); |
89 | ctk_builder_add_from_string (builder, "<interface><child/></interface>", -1, &error); |
90 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_TAG)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_TAG) g_assertion_message_error (((gchar*) 0), "builder.c", 90, ((const char*) (__func__)), "error" , error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_TAG ); } while (0); |
91 | g_error_free (error); |
92 | |
93 | error = NULL((void*)0); |
94 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkVBox\" id=\"a\"><object class=\"CtkHBox\" id=\"b\"/></object></interface>", -1, &error); |
95 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_TAG)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_TAG) g_assertion_message_error (((gchar*) 0), "builder.c", 95, ((const char*) (__func__)), "error" , error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_TAG ); } while (0); |
96 | g_error_free (error); |
97 | |
98 | error = NULL((void*)0); |
99 | ctk_builder_add_from_string (builder, "<interface><object class=\"Unknown\" id=\"a\"></object></interface>", -1, &error); |
100 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 100, ((const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
101 | g_error_free (error); |
102 | |
103 | error = NULL((void*)0); |
104 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkWidget\" id=\"a\" constructor=\"none\"></object></interface>", -1, &error); |
105 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 105, ((const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
106 | g_error_free (error); |
107 | |
108 | error = NULL((void*)0); |
109 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkButton\" id=\"a\"><child internal-child=\"foobar\"><object class=\"CtkButton\" id=\"int\"/></child></object></interface>", -1, &error); |
110 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 110, ((const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
111 | g_error_free (error); |
112 | |
113 | error = NULL((void*)0); |
114 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkButton\" id=\"a\"></object><object class=\"CtkButton\" id=\"a\"/></object></interface>", -1, &error); |
115 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_DUPLICATE_ID)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_DUPLICATE_ID) g_assertion_message_error (((gchar*) 0), "builder.c", 115, ((const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_DUPLICATE_ID ); } while (0); |
116 | g_error_free (error); |
117 | |
118 | error = NULL((void*)0); |
119 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkButton\" id=\"a\"><property name=\"deafbeef\"></property></object></interface>", -1, &error); |
120 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_PROPERTY)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_PROPERTY ) g_assertion_message_error (((gchar*) 0), "builder.c", 120, ( (const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_PROPERTY); } while (0); |
121 | g_error_free (error); |
122 | |
123 | error = NULL((void*)0); |
124 | ctk_builder_add_from_string (builder, "<interface><object class=\"CtkButton\" id=\"a\"><signal name=\"deafbeef\" handler=\"ctk_true\"/></object></interface>", -1, &error); |
125 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_SIGNAL)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_SIGNAL) g_assertion_message_error (((gchar*) 0), "builder.c", 125, ( (const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_SIGNAL); } while (0); |
126 | g_error_free (error); |
127 | |
128 | g_object_unref (builder); |
129 | } |
130 | |
131 | static int normal = 0; |
132 | static int after = 0; |
133 | static int object = 0; |
134 | static int object_after = 0; |
135 | |
136 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
137 | signal_normal (CtkWindow *window, |
138 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
139 | { |
140 | g_assert (CTK_IS_WINDOW (window))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 140, (( const char*) (__func__)), "CTK_IS_WINDOW (window)"); } while ( 0); |
141 | g_assert (normal == 0)do { if (normal == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 141, ((const char*) (__func__)), "normal == 0" ); } while (0); |
142 | g_assert (after == 0)do { if (after == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 142, ((const char*) (__func__)), "after == 0" ); } while (0); |
143 | |
144 | normal++; |
145 | } |
146 | |
147 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
148 | signal_after (CtkWindow *window, |
149 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
150 | { |
151 | g_assert (CTK_IS_WINDOW (window))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 151, (( const char*) (__func__)), "CTK_IS_WINDOW (window)"); } while ( 0); |
152 | g_assert (normal == 1)do { if (normal == 1) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 152, ((const char*) (__func__)), "normal == 1" ); } while (0); |
153 | g_assert (after == 0)do { if (after == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 153, ((const char*) (__func__)), "after == 0" ); } while (0); |
154 | |
155 | after++; |
156 | } |
157 | |
158 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
159 | signal_object (CtkButton *button, |
160 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
161 | { |
162 | g_assert (CTK_IS_BUTTON (button))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((button)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 162, (( const char*) (__func__)), "CTK_IS_BUTTON (button)"); } while ( 0); |
163 | g_assert (object == 0)do { if (object == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 163, ((const char*) (__func__)), "object == 0" ); } while (0); |
164 | g_assert (object_after == 0)do { if (object_after == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 164, ((const char*) (__func__)), "object_after == 0" ); } while (0); |
165 | |
166 | object++; |
167 | } |
168 | |
169 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
170 | signal_object_after (CtkButton *button, |
171 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
172 | { |
173 | g_assert (CTK_IS_BUTTON (button))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((button)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 173, (( const char*) (__func__)), "CTK_IS_BUTTON (button)"); } while ( 0); |
174 | g_assert (object == 1)do { if (object == 1) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 174, ((const char*) (__func__)), "object == 1" ); } while (0); |
175 | g_assert (object_after == 0)do { if (object_after == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 175, ((const char*) (__func__)), "object_after == 0" ); } while (0); |
176 | |
177 | object_after++; |
178 | } |
179 | |
180 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
181 | signal_first (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
182 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
183 | { |
184 | g_assert (normal == 0)do { if (normal == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 184, ((const char*) (__func__)), "normal == 0" ); } while (0); |
185 | normal = 10; |
186 | } |
187 | |
188 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
189 | signal_second (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
190 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
191 | { |
192 | g_assert (normal == 10)do { if (normal == 10) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 192, ((const char*) (__func__)), "normal == 10" ); } while (0); |
193 | normal = 20; |
194 | } |
195 | |
196 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
197 | signal_extra (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
198 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
199 | { |
200 | g_assert (normal == 20)do { if (normal == 20) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 200, ((const char*) (__func__)), "normal == 20" ); } while (0); |
201 | normal = 30; |
202 | } |
203 | |
204 | G_MODULE_EXPORT__attribute__((visibility("default"))) void /* exported for CtkBuilder */ |
205 | signal_extra2 (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
206 | GParamSpec *spec G_GNUC_UNUSED__attribute__ ((__unused__))) |
207 | { |
208 | g_assert (normal == 30)do { if (normal == 30) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 208, ((const char*) (__func__)), "normal == 30" ); } while (0); |
209 | normal = 40; |
210 | } |
211 | |
212 | static void |
213 | test_connect_signals (void) |
214 | { |
215 | CtkBuilder *builder; |
216 | GObject *window; |
217 | const gchar buffer[] = |
218 | "<interface>" |
219 | " <object class=\"CtkButton\" id=\"button\"/>" |
220 | " <object class=\"CtkWindow\" id=\"window1\">" |
221 | " <signal name=\"notify::title\" handler=\"signal_normal\"/>" |
222 | " <signal name=\"notify::title\" handler=\"signal_after\" after=\"yes\"/>" |
223 | " <signal name=\"notify::title\" handler=\"signal_object\"" |
224 | " object=\"button\"/>" |
225 | " <signal name=\"notify::title\" handler=\"signal_object_after\"" |
226 | " object=\"button\" after=\"yes\"/>" |
227 | " </object>" |
228 | "</interface>"; |
229 | const gchar buffer_order[] = |
230 | "<interface>" |
231 | " <object class=\"CtkWindow\" id=\"window1\">" |
232 | " <signal name=\"notify::title\" handler=\"signal_first\"/>" |
233 | " <signal name=\"notify::title\" handler=\"signal_second\"/>" |
234 | " </object>" |
235 | "</interface>"; |
236 | const gchar buffer_extra[] = |
237 | "<interface>" |
238 | " <object class=\"CtkWindow\" id=\"window2\">" |
239 | " <signal name=\"notify::title\" handler=\"signal_extra\"/>" |
240 | " </object>" |
241 | "</interface>"; |
242 | const gchar buffer_extra2[] = |
243 | "<interface>" |
244 | " <object class=\"CtkWindow\" id=\"window3\">" |
245 | " <signal name=\"notify::title\" handler=\"signal_extra2\"/>" |
246 | " </object>" |
247 | "</interface>"; |
248 | const gchar buffer_after_child[] = |
249 | "<interface>" |
250 | " <object class=\"CtkWindow\" id=\"window1\">" |
251 | " <child>" |
252 | " <object class=\"CtkButton\" id=\"button1\"/>" |
253 | " </child>" |
254 | " <signal name=\"notify::title\" handler=\"signal_normal\"/>" |
255 | " </object>" |
256 | "</interface>"; |
257 | |
258 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
259 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
260 | |
261 | window = ctk_builder_get_object (builder, "window1"); |
262 | ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), "test"); |
263 | |
264 | g_assert_cmpint (normal, ==, 1)do { gint64 __n1 = (normal), __n2 = (1); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0), "builder.c", 264, ( (const char*) (__func__)), "normal" " " "==" " " "1", (guint64 )__n1, "==", (guint64)__n2, 'i'); } while (0); |
265 | g_assert_cmpint (after, ==, 1)do { gint64 __n1 = (after), __n2 = (1); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0), "builder.c", 265, ( (const char*) (__func__)), "after" " " "==" " " "1", (guint64 )__n1, "==", (guint64)__n2, 'i'); } while (0); |
266 | g_assert_cmpint (object, ==, 1)do { gint64 __n1 = (object), __n2 = (1); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0), "builder.c", 266, ( (const char*) (__func__)), "object" " " "==" " " "1", (guint64 )__n1, "==", (guint64)__n2, 'i'); } while (0); |
267 | g_assert_cmpint (object_after, ==, 1)do { gint64 __n1 = (object_after), __n2 = (1); if (__n1 == __n2 ) ; else g_assertion_message_cmpint (((gchar*) 0), "builder.c" , 267, ((const char*) (__func__)), "object_after" " " "==" " " "1", (guint64)__n1, "==", (guint64)__n2, 'i'); } while (0); |
268 | |
269 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
270 | g_object_unref (builder); |
271 | |
272 | builder = builder_new_from_string (buffer_order, -1, NULL((void*)0)); |
273 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
274 | window = ctk_builder_get_object (builder, "window1"); |
275 | normal = 0; |
276 | ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), "test"); |
277 | g_assert (normal == 20)do { if (normal == 20) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 277, ((const char*) (__func__)), "normal == 20" ); } while (0); |
278 | |
279 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
280 | |
281 | ctk_builder_add_from_string (builder, buffer_extra, |
282 | strlen (buffer_extra), NULL((void*)0)); |
283 | ctk_builder_add_from_string (builder, buffer_extra2, |
284 | strlen (buffer_extra2), NULL((void*)0)); |
285 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
286 | window = ctk_builder_get_object (builder, "window2"); |
287 | ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), "test"); |
288 | g_assert (normal == 30)do { if (normal == 30) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 288, ((const char*) (__func__)), "normal == 30" ); } while (0); |
289 | |
290 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
291 | window = ctk_builder_get_object (builder, "window3"); |
292 | ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), "test"); |
293 | g_assert (normal == 40)do { if (normal == 40) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 293, ((const char*) (__func__)), "normal == 40" ); } while (0); |
294 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
295 | |
296 | g_object_unref (builder); |
297 | |
298 | /* new test, reset globals */ |
299 | after = 0; |
300 | normal = 0; |
301 | |
302 | builder = builder_new_from_string (buffer_after_child, -1, NULL((void*)0)); |
303 | window = ctk_builder_get_object (builder, "window1"); |
304 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
305 | ctk_window_set_title (CTK_WINDOW (window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_window_get_type ())))))), "test"); |
306 | |
307 | g_assert (normal == 1)do { if (normal == 1) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 307, ((const char*) (__func__)), "normal == 1" ); } while (0); |
308 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
309 | g_object_unref (builder); |
310 | } |
311 | |
312 | static void |
313 | test_uimanager_simple (void) |
314 | { |
315 | CtkBuilder *builder; |
316 | GObject *window, *uimgr, *menubar; |
317 | GObject *menu, *label; |
318 | GList *children; |
319 | const gchar buffer[] = |
320 | "<interface>" |
321 | " <object class=\"CtkUIManager\" id=\"uimgr1\"/>" |
322 | "</interface>"; |
323 | |
324 | const gchar buffer2[] = |
325 | "<interface>" |
326 | " <object class=\"CtkUIManager\" id=\"uimgr1\">" |
327 | " <child>" |
328 | " <object class=\"CtkActionGroup\" id=\"ag1\">" |
329 | " <child>" |
330 | " <object class=\"CtkAction\" id=\"file\">" |
331 | " <property name=\"label\">_File</property>" |
332 | " </object>" |
333 | " <accelerator key=\"n\" modifiers=\"CDK_CONTROL_MASK\"/>" |
334 | " </child>" |
335 | " </object>" |
336 | " </child>" |
337 | " <ui>" |
338 | " <menubar name=\"menubar1\">" |
339 | " <menu action=\"file\">" |
340 | " </menu>" |
341 | " </menubar>" |
342 | " </ui>" |
343 | " </object>" |
344 | " <object class=\"CtkWindow\" id=\"window1\">" |
345 | " <child>" |
346 | " <object class=\"CtkMenuBar\" id=\"menubar1\" constructor=\"uimgr1\"/>" |
347 | " </child>" |
348 | " </object>" |
349 | "</interface>"; |
350 | |
351 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
352 | |
353 | uimgr = ctk_builder_get_object (builder, "uimgr1"); |
354 | g_assert (CTK_IS_UI_MANAGER (uimgr))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((uimgr)); GType __t = ((ctk_ui_manager_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 354, (( const char*) (__func__)), "CTK_IS_UI_MANAGER (uimgr)"); } while (0); |
355 | g_object_unref (builder); |
356 | |
357 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
358 | |
359 | menubar = ctk_builder_get_object (builder, "menubar1"); |
360 | g_assert (CTK_IS_MENU_BAR (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menubar)); GType __t = ((ctk_menu_bar_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 360, (( const char*) (__func__)), "CTK_IS_MENU_BAR (menubar)"); } while (0); |
361 | |
362 | children = ctk_container_get_children (CTK_CONTAINER (menubar)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menubar)), ((ctk_container_get_type ()))))))); |
363 | menu = children->data; |
364 | g_assert (CTK_IS_MENU_ITEM (menu))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menu)); GType __t = ((ctk_menu_item_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 364, (( const char*) (__func__)), "CTK_IS_MENU_ITEM (menu)"); } while (0); |
365 | g_assert (strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), "file") == 0)do { if (strcmp (ctk_widget_get_name (((((CtkWidget*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_widget_get_type ()))))))), "file") == 0) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 365, ((const char*) (__func__)), "strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), \"file\") == 0" ); } while (0); |
366 | g_list_free (children); |
367 | |
368 | label = G_OBJECT (ctk_bin_get_child (CTK_BIN (menu)))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_bin_get_child (((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_bin_get_type ()))))))))), ( ((GType) ((20) << (2)))))))); |
369 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 369, (( const char*) (__func__)), "CTK_IS_LABEL (label)"); } while (0 ); |
370 | g_assert (strcmp (ctk_label_get_text (CTK_LABEL (label)), "File") == 0)do { if (strcmp (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "File") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 370, ((const char*) (__func__)), "strcmp (ctk_label_get_text (CTK_LABEL (label)), \"File\") == 0" ); } while (0); |
371 | |
372 | window = ctk_builder_get_object (builder, "window1"); |
373 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
374 | g_object_unref (builder); |
375 | } |
376 | |
377 | static void |
378 | test_domain (void) |
379 | { |
380 | CtkBuilder *builder; |
381 | const gchar buffer1[] = "<interface/>"; |
382 | const gchar buffer2[] = "<interface domain=\"domain\"/>"; |
383 | const gchar *domain; |
384 | |
385 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
386 | domain = ctk_builder_get_translation_domain (builder); |
387 | g_assert (domain == NULL)do { if (domain == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 387, ((const char*) (__func__)), "domain == NULL"); } while (0); |
388 | g_object_unref (builder); |
389 | |
390 | builder = builder_new_from_string (buffer1, -1, "domain-1"); |
391 | domain = ctk_builder_get_translation_domain (builder); |
392 | g_assert (domain)do { if (domain) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 392, ((const char*) (__func__)), "domain"); } while (0); |
393 | g_assert (strcmp (domain, "domain-1") == 0)do { if (strcmp (domain, "domain-1") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 393, ((const char*) (__func__)), "strcmp (domain, \"domain-1\") == 0"); } while (0); |
394 | g_object_unref (builder); |
395 | |
396 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
397 | domain = ctk_builder_get_translation_domain (builder); |
398 | g_assert (domain == NULL)do { if (domain == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 398, ((const char*) (__func__)), "domain == NULL"); } while (0); |
399 | g_object_unref (builder); |
400 | } |
401 | |
402 | #if 0 |
403 | static void |
404 | test_translation (void) |
405 | { |
406 | CtkBuilder *builder; |
407 | const gchar buffer[] = |
408 | "<interface>" |
409 | " <object class=\"CtkWindow\" id=\"window1\">" |
410 | " <child>" |
411 | " <object class=\"CtkLabel\" id=\"label\">" |
412 | " <property name=\"label\" translatable=\"yes\">File</property>" |
413 | " </object>" |
414 | " </child>" |
415 | " </object>" |
416 | "</interface>"; |
417 | CtkLabel *window, *label; |
418 | |
419 | setlocale (LC_ALL6, "sv_SE"); |
420 | textdomain ("builder"); |
421 | bindtextdomain ("builder", "tests"); |
422 | |
423 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
424 | label = CTK_LABEL (ctk_builder_get_object (builder, "label"))((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (builder, "label"))), ((ctk_label_get_type ())))))); |
425 | g_assert (strcmp (ctk_label_get_text (label), "Arkiv") == 0)do { if (strcmp (ctk_label_get_text (label), "Arkiv") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 425 , ((const char*) (__func__)), "strcmp (ctk_label_get_text (label), \"Arkiv\") == 0" ); } while (0); |
426 | |
427 | window = ctk_builder_get_object (builder, "window1"); |
428 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
429 | g_object_unref (builder); |
430 | } |
431 | #endif |
432 | |
433 | static void |
434 | test_sizegroup (void) |
435 | { |
436 | CtkBuilder * builder; |
437 | const gchar buffer1[] = |
438 | "<interface domain=\"test\">" |
439 | " <object class=\"CtkSizeGroup\" id=\"sizegroup1\">" |
440 | " <property name=\"mode\">CTK_SIZE_GROUP_HORIZONTAL</property>" |
441 | " <widgets>" |
442 | " <widget name=\"radio1\"/>" |
443 | " <widget name=\"radio2\"/>" |
444 | " </widgets>" |
445 | " </object>" |
446 | " <object class=\"CtkWindow\" id=\"window1\">" |
447 | " <child>" |
448 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
449 | " <child>" |
450 | " <object class=\"CtkRadioButton\" id=\"radio1\"/>" |
451 | " </child>" |
452 | " <child>" |
453 | " <object class=\"CtkRadioButton\" id=\"radio2\"/>" |
454 | " </child>" |
455 | " </object>" |
456 | " </child>" |
457 | " </object>" |
458 | "</interface>"; |
459 | const gchar buffer2[] = |
460 | "<interface domain=\"test\">" |
461 | " <object class=\"CtkSizeGroup\" id=\"sizegroup1\">" |
462 | " <property name=\"mode\">CTK_SIZE_GROUP_HORIZONTAL</property>" |
463 | " <widgets>" |
464 | " </widgets>" |
465 | " </object>" |
466 | "</interface>"; |
467 | const gchar buffer3[] = |
468 | "<interface domain=\"test\">" |
469 | " <object class=\"CtkSizeGroup\" id=\"sizegroup1\">" |
470 | " <property name=\"mode\">CTK_SIZE_GROUP_HORIZONTAL</property>" |
471 | " <widgets>" |
472 | " <widget name=\"radio1\"/>" |
473 | " <widget name=\"radio2\"/>" |
474 | " </widgets>" |
475 | " </object>" |
476 | " <object class=\"CtkSizeGroup\" id=\"sizegroup2\">" |
477 | " <property name=\"mode\">CTK_SIZE_GROUP_HORIZONTAL</property>" |
478 | " <widgets>" |
479 | " <widget name=\"radio1\"/>" |
480 | " <widget name=\"radio2\"/>" |
481 | " </widgets>" |
482 | " </object>" |
483 | " <object class=\"CtkWindow\" id=\"window1\">" |
484 | " <child>" |
485 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
486 | " <child>" |
487 | " <object class=\"CtkRadioButton\" id=\"radio1\"/>" |
488 | " </child>" |
489 | " <child>" |
490 | " <object class=\"CtkRadioButton\" id=\"radio2\"/>" |
491 | " </child>" |
492 | " </object>" |
493 | " </child>" |
494 | " </object>" |
495 | "</interface>"; |
496 | GObject *sizegroup; |
497 | GSList *widgets; |
498 | |
499 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
500 | sizegroup = ctk_builder_get_object (builder, "sizegroup1"); |
501 | widgets = ctk_size_group_get_widgets (CTK_SIZE_GROUP (sizegroup)((((CtkSizeGroup*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sizegroup)), ((ctk_size_group_get_type ()))))))); |
502 | g_assert (g_slist_length (widgets) == 2)do { if (g_slist_length (widgets) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 502, ((const char*) (__func__)), "g_slist_length (widgets) == 2"); } while (0); |
503 | g_slist_free (widgets); |
504 | g_object_unref (builder); |
505 | |
506 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
507 | sizegroup = ctk_builder_get_object (builder, "sizegroup1"); |
508 | widgets = ctk_size_group_get_widgets (CTK_SIZE_GROUP (sizegroup)((((CtkSizeGroup*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sizegroup)), ((ctk_size_group_get_type ()))))))); |
509 | g_assert (g_slist_length (widgets) == 0)do { if (g_slist_length (widgets) == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 509, ((const char*) (__func__)), "g_slist_length (widgets) == 0"); } while (0); |
510 | g_slist_free (widgets); |
511 | g_object_unref (builder); |
512 | |
513 | builder = builder_new_from_string (buffer3, -1, NULL((void*)0)); |
514 | sizegroup = ctk_builder_get_object (builder, "sizegroup1"); |
515 | widgets = ctk_size_group_get_widgets (CTK_SIZE_GROUP (sizegroup)((((CtkSizeGroup*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sizegroup)), ((ctk_size_group_get_type ()))))))); |
516 | g_assert (g_slist_length (widgets) == 2)do { if (g_slist_length (widgets) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 516, ((const char*) (__func__)), "g_slist_length (widgets) == 2"); } while (0); |
517 | g_slist_free (widgets); |
518 | sizegroup = ctk_builder_get_object (builder, "sizegroup2"); |
519 | widgets = ctk_size_group_get_widgets (CTK_SIZE_GROUP (sizegroup)((((CtkSizeGroup*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sizegroup)), ((ctk_size_group_get_type ()))))))); |
520 | g_assert (g_slist_length (widgets) == 2)do { if (g_slist_length (widgets) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 520, ((const char*) (__func__)), "g_slist_length (widgets) == 2"); } while (0); |
521 | g_slist_free (widgets); |
522 | |
523 | #if 0 |
524 | { |
525 | GObject *window; |
526 | window = ctk_builder_get_object (builder, "window1"); |
527 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
528 | } |
529 | #endif |
530 | g_object_unref (builder); |
531 | } |
532 | |
533 | static void |
534 | test_list_store (void) |
535 | { |
536 | const gchar buffer1[] = |
537 | "<interface>" |
538 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
539 | " <columns>" |
540 | " <column type=\"gchararray\"/>" |
541 | " <column type=\"guint\"/>" |
542 | " </columns>" |
543 | " </object>" |
544 | "</interface>"; |
545 | const char buffer2[] = |
546 | "<interface>" |
547 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
548 | " <columns>" |
549 | " <column type=\"gchararray\"/>" |
550 | " <column type=\"gchararray\"/>" |
551 | " <column type=\"gint\"/>" |
552 | " </columns>" |
553 | " <data>" |
554 | " <row>" |
555 | " <col id=\"0\" translatable=\"yes\">John</col>" |
556 | " <col id=\"1\" context=\"foo\">Doe</col>" |
557 | " <col id=\"2\" comments=\"foobar\">25</col>" |
558 | " </row>" |
559 | " <row>" |
560 | " <col id=\"0\">Johan</col>" |
561 | " <col id=\"1\">Dole</col>" |
562 | " <col id=\"2\">50</col>" |
563 | " </row>" |
564 | " </data>" |
565 | " </object>" |
566 | "</interface>"; |
567 | const char buffer3[] = |
568 | "<interface>" |
569 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
570 | " <columns>" |
571 | " <column type=\"gchararray\"/>" |
572 | " <column type=\"gchararray\"/>" |
573 | " <column type=\"gint\"/>" |
574 | " </columns>" |
575 | " <data>" |
576 | " <row>" |
577 | " <col id=\"1\" context=\"foo\">Doe</col>" |
578 | " <col id=\"0\" translatable=\"yes\">John</col>" |
579 | " <col id=\"2\" comments=\"foobar\">25</col>" |
580 | " </row>" |
581 | " <row>" |
582 | " <col id=\"2\">50</col>" |
583 | " <col id=\"1\">Dole</col>" |
584 | " <col id=\"0\">Johan</col>" |
585 | " </row>" |
586 | " <row>" |
587 | " <col id=\"2\">19</col>" |
588 | " </row>" |
589 | " </data>" |
590 | " </object>" |
591 | "</interface>"; |
592 | CtkBuilder *builder; |
593 | GObject *store; |
594 | CtkTreeIter iter; |
595 | gchar *surname, *lastname; |
596 | int age; |
597 | |
598 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
599 | store = ctk_builder_get_object (builder, "liststore1"); |
600 | g_assert (ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 2)do { if (ctk_tree_model_get_n_columns (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ()))))))) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 600, ((const char*) (__func__)), "ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 2" ); } while (0); |
601 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 0) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 601, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING" ); } while (0); |
602 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_UINT)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 1) == ((GType) ((7) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 602, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_UINT" ); } while (0); |
603 | g_object_unref (builder); |
604 | |
605 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
606 | store = ctk_builder_get_object (builder, "liststore1"); |
607 | g_assert (ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 3)do { if (ctk_tree_model_get_n_columns (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ()))))))) == 3) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 607, ((const char*) (__func__)), "ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 3" ); } while (0); |
608 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 0) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 608, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING" ); } while (0); |
609 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 1) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 609, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_STRING" ); } while (0); |
610 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 2) == G_TYPE_INT)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 2) == ((GType) ((6) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 610, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 2) == G_TYPE_INT" ); } while (0); |
611 | |
612 | g_assert (ctk_tree_model_get_iter_first (CTK_TREE_MODEL (store), &iter) == TRUE)do { if (ctk_tree_model_get_iter_first (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ())))))), &iter) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 612, (( const char*) (__func__)), "ctk_tree_model_get_iter_first (CTK_TREE_MODEL (store), &iter) == TRUE" ); } while (0); |
613 | ctk_tree_model_get (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter, |
614 | 0, &surname, |
615 | 1, &lastname, |
616 | 2, &age, |
617 | -1); |
618 | g_assert (surname != NULL)do { if (surname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 618, ((const char*) (__func__)), "surname != NULL"); } while (0); |
619 | g_assert (strcmp (surname, "John") == 0)do { if (strcmp (surname, "John") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 619, ((const char*) (__func__)), "strcmp (surname, \"John\") == 0"); } while (0); |
620 | g_free (surname); |
621 | g_assert (lastname != NULL)do { if (lastname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 621, ((const char*) (__func__)), "lastname != NULL"); } while (0); |
622 | g_assert (strcmp (lastname, "Doe") == 0)do { if (strcmp (lastname, "Doe") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 622, ((const char*) (__func__)), "strcmp (lastname, \"Doe\") == 0"); } while (0); |
623 | g_free (lastname); |
624 | g_assert (age == 25)do { if (age == 25) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 624, ((const char*) (__func__)), "age == 25" ); } while (0); |
625 | g_assert (ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE)do { if (ctk_tree_model_iter_next (((((CtkTreeModel*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((store)), ((ctk_tree_model_get_type ())))))), &iter) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 625, ((const char*) (__func__)), "ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE" ); } while (0); |
626 | |
627 | ctk_tree_model_get (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter, |
628 | 0, &surname, |
629 | 1, &lastname, |
630 | 2, &age, |
631 | -1); |
632 | g_assert (surname != NULL)do { if (surname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 632, ((const char*) (__func__)), "surname != NULL"); } while (0); |
633 | g_assert (strcmp (surname, "Johan") == 0)do { if (strcmp (surname, "Johan") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 633, ((const char*) (__func__)), "strcmp (surname, \"Johan\") == 0"); } while (0); |
634 | g_free (surname); |
635 | g_assert (lastname != NULL)do { if (lastname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 635, ((const char*) (__func__)), "lastname != NULL"); } while (0); |
636 | g_assert (strcmp (lastname, "Dole") == 0)do { if (strcmp (lastname, "Dole") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 636, ((const char*) (__func__)), "strcmp (lastname, \"Dole\") == 0"); } while (0); |
637 | g_free (lastname); |
638 | g_assert (age == 50)do { if (age == 50) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 638, ((const char*) (__func__)), "age == 50" ); } while (0); |
639 | g_assert (ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == FALSE)do { if (ctk_tree_model_iter_next (((((CtkTreeModel*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((store)), ((ctk_tree_model_get_type ())))))), &iter) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 639, ((const char*) (__func__)), "ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == FALSE" ); } while (0); |
640 | |
641 | g_object_unref (builder); |
642 | |
643 | builder = builder_new_from_string (buffer3, -1, NULL((void*)0)); |
644 | store = ctk_builder_get_object (builder, "liststore1"); |
645 | g_assert (ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 3)do { if (ctk_tree_model_get_n_columns (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ()))))))) == 3) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 645, ((const char*) (__func__)), "ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 3" ); } while (0); |
646 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 0) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 646, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING" ); } while (0); |
647 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 1) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 647, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_STRING" ); } while (0); |
648 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 2) == G_TYPE_INT)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 2) == ((GType) ((6) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 648, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 2) == G_TYPE_INT" ); } while (0); |
649 | |
650 | g_assert (ctk_tree_model_get_iter_first (CTK_TREE_MODEL (store), &iter) == TRUE)do { if (ctk_tree_model_get_iter_first (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ())))))), &iter) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 650, (( const char*) (__func__)), "ctk_tree_model_get_iter_first (CTK_TREE_MODEL (store), &iter) == TRUE" ); } while (0); |
651 | ctk_tree_model_get (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter, |
652 | 0, &surname, |
653 | 1, &lastname, |
654 | 2, &age, |
655 | -1); |
656 | g_assert (surname != NULL)do { if (surname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 656, ((const char*) (__func__)), "surname != NULL"); } while (0); |
657 | g_assert (strcmp (surname, "John") == 0)do { if (strcmp (surname, "John") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 657, ((const char*) (__func__)), "strcmp (surname, \"John\") == 0"); } while (0); |
658 | g_free (surname); |
659 | g_assert (lastname != NULL)do { if (lastname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 659, ((const char*) (__func__)), "lastname != NULL"); } while (0); |
660 | g_assert (strcmp (lastname, "Doe") == 0)do { if (strcmp (lastname, "Doe") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 660, ((const char*) (__func__)), "strcmp (lastname, \"Doe\") == 0"); } while (0); |
661 | g_free (lastname); |
662 | g_assert (age == 25)do { if (age == 25) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 662, ((const char*) (__func__)), "age == 25" ); } while (0); |
663 | g_assert (ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE)do { if (ctk_tree_model_iter_next (((((CtkTreeModel*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((store)), ((ctk_tree_model_get_type ())))))), &iter) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 663, ((const char*) (__func__)), "ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE" ); } while (0); |
664 | |
665 | ctk_tree_model_get (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter, |
666 | 0, &surname, |
667 | 1, &lastname, |
668 | 2, &age, |
669 | -1); |
670 | g_assert (surname != NULL)do { if (surname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 670, ((const char*) (__func__)), "surname != NULL"); } while (0); |
671 | g_assert (strcmp (surname, "Johan") == 0)do { if (strcmp (surname, "Johan") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 671, ((const char*) (__func__)), "strcmp (surname, \"Johan\") == 0"); } while (0); |
672 | g_free (surname); |
673 | g_assert (lastname != NULL)do { if (lastname != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 673, ((const char*) (__func__)), "lastname != NULL"); } while (0); |
674 | g_assert (strcmp (lastname, "Dole") == 0)do { if (strcmp (lastname, "Dole") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 674, ((const char*) (__func__)), "strcmp (lastname, \"Dole\") == 0"); } while (0); |
675 | g_free (lastname); |
676 | g_assert (age == 50)do { if (age == 50) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 676, ((const char*) (__func__)), "age == 50" ); } while (0); |
677 | g_assert (ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE)do { if (ctk_tree_model_iter_next (((((CtkTreeModel*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((store)), ((ctk_tree_model_get_type ())))))), &iter) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 677, ((const char*) (__func__)), "ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == TRUE" ); } while (0); |
678 | |
679 | ctk_tree_model_get (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((store)), ((ctk_tree_model_get_type ())))))), &iter, |
680 | 0, &surname, |
681 | 1, &lastname, |
682 | 2, &age, |
683 | -1); |
684 | g_assert (surname == NULL)do { if (surname == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 684, ((const char*) (__func__)), "surname == NULL"); } while (0); |
685 | g_assert (lastname == NULL)do { if (lastname == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 685, ((const char*) (__func__)), "lastname == NULL"); } while (0); |
686 | g_assert (age == 19)do { if (age == 19) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 686, ((const char*) (__func__)), "age == 19" ); } while (0); |
687 | g_assert (ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == FALSE)do { if (ctk_tree_model_iter_next (((((CtkTreeModel*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((store)), ((ctk_tree_model_get_type ())))))), &iter) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 687, ((const char*) (__func__)), "ctk_tree_model_iter_next (CTK_TREE_MODEL (store), &iter) == FALSE" ); } while (0); |
688 | |
689 | g_object_unref (builder); |
690 | } |
691 | |
692 | static void |
693 | test_tree_store (void) |
694 | { |
695 | const gchar buffer[] = |
696 | "<interface domain=\"test\">" |
697 | " <object class=\"CtkTreeStore\" id=\"treestore1\">" |
698 | " <columns>" |
699 | " <column type=\"gchararray\"/>" |
700 | " <column type=\"guint\"/>" |
701 | " </columns>" |
702 | " </object>" |
703 | "</interface>"; |
704 | CtkBuilder *builder; |
705 | GObject *store; |
706 | |
707 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
708 | store = ctk_builder_get_object (builder, "treestore1"); |
709 | g_assert (ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 2)do { if (ctk_tree_model_get_n_columns (((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((store)), ( (ctk_tree_model_get_type ()))))))) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 709, ((const char*) (__func__)), "ctk_tree_model_get_n_columns (CTK_TREE_MODEL (store)) == 2" ); } while (0); |
710 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 0) == ((GType) ((16) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 710, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 0) == G_TYPE_STRING" ); } while (0); |
711 | g_assert (ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_UINT)do { if (ctk_tree_model_get_column_type (((((CtkTreeModel*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((store) ), ((ctk_tree_model_get_type ())))))), 1) == ((GType) ((7) << (2)))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 711, ((const char*) (__func__)), "ctk_tree_model_get_column_type (CTK_TREE_MODEL (store), 1) == G_TYPE_UINT" ); } while (0); |
712 | |
713 | g_object_unref (builder); |
714 | } |
715 | |
716 | static void |
717 | test_types (void) |
718 | { |
719 | const gchar buffer[] = |
720 | "<interface>" |
721 | " <object class=\"CtkAction\" id=\"action\"/>" |
722 | " <object class=\"CtkActionGroup\" id=\"actiongroup\"/>" |
723 | " <object class=\"CtkAlignment\" id=\"alignment\"/>" |
724 | " <object class=\"CtkArrow\" id=\"arrow\"/>" |
725 | " <object class=\"CtkButton\" id=\"button\"/>" |
726 | " <object class=\"CtkCheckButton\" id=\"checkbutton\"/>" |
727 | " <object class=\"CtkDialog\" id=\"dialog\"/>" |
728 | " <object class=\"CtkDrawingArea\" id=\"drawingarea\"/>" |
729 | " <object class=\"CtkEventBox\" id=\"eventbox\"/>" |
730 | " <object class=\"CtkEntry\" id=\"entry\"/>" |
731 | " <object class=\"CtkFontButton\" id=\"fontbutton\"/>" |
732 | " <object class=\"CtkHButtonBox\" id=\"hbuttonbox\"/>" |
733 | " <object class=\"CtkHBox\" id=\"hbox\"/>" |
734 | " <object class=\"CtkHPaned\" id=\"hpaned\"/>" |
735 | " <object class=\"CtkHScale\" id=\"hscale\"/>" |
736 | " <object class=\"CtkHScrollbar\" id=\"hscrollbar\"/>" |
737 | " <object class=\"CtkHSeparator\" id=\"hseparator\"/>" |
738 | " <object class=\"CtkImage\" id=\"image\"/>" |
739 | " <object class=\"CtkLabel\" id=\"label\"/>" |
740 | " <object class=\"CtkListStore\" id=\"liststore\"/>" |
741 | " <object class=\"CtkMenuBar\" id=\"menubar\"/>" |
742 | " <object class=\"CtkNotebook\" id=\"notebook\"/>" |
743 | " <object class=\"CtkProgressBar\" id=\"progressbar\"/>" |
744 | " <object class=\"CtkRadioButton\" id=\"radiobutton\"/>" |
745 | " <object class=\"CtkSizeGroup\" id=\"sizegroup\"/>" |
746 | " <object class=\"CtkScrolledWindow\" id=\"scrolledwindow\"/>" |
747 | " <object class=\"CtkSpinButton\" id=\"spinbutton\"/>" |
748 | " <object class=\"CtkStatusbar\" id=\"statusbar\"/>" |
749 | " <object class=\"CtkTextView\" id=\"textview\"/>" |
750 | " <object class=\"CtkToggleAction\" id=\"toggleaction\"/>" |
751 | " <object class=\"CtkToggleButton\" id=\"togglebutton\"/>" |
752 | " <object class=\"CtkToolbar\" id=\"toolbar\"/>" |
753 | " <object class=\"CtkTreeStore\" id=\"treestore\"/>" |
754 | " <object class=\"CtkTreeView\" id=\"treeview\"/>" |
755 | " <object class=\"CtkTable\" id=\"table\"/>" |
756 | " <object class=\"CtkVBox\" id=\"vbox\"/>" |
757 | " <object class=\"CtkVButtonBox\" id=\"vbuttonbox\"/>" |
758 | " <object class=\"CtkVScrollbar\" id=\"vscrollbar\"/>" |
759 | " <object class=\"CtkVSeparator\" id=\"vseparator\"/>" |
760 | " <object class=\"CtkViewport\" id=\"viewport\"/>" |
761 | " <object class=\"CtkVPaned\" id=\"vpaned\"/>" |
762 | " <object class=\"CtkVScale\" id=\"vscale\"/>" |
763 | " <object class=\"CtkWindow\" id=\"window\"/>" |
764 | " <object class=\"CtkUIManager\" id=\"uimanager\"/>" |
765 | "</interface>"; |
766 | const gchar buffer2[] = |
767 | "<interface>" |
768 | " <object type-func=\"ctk_window_get_type\" id=\"window\"/>" |
769 | "</interface>"; |
770 | const gchar buffer3[] = |
771 | "<interface>" |
772 | " <object class=\"XXXInvalidType\" type-func=\"ctk_window_get_type\" id=\"window\"/>" |
773 | "</interface>"; |
774 | const gchar buffer4[] = |
775 | "<interface>" |
776 | " <object type-func=\"xxx_invalid_get_type_function\" id=\"window\"/>" |
777 | "</interface>"; |
778 | CtkBuilder *builder; |
779 | GObject *window; |
780 | GError *error; |
781 | |
782 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
783 | ctk_widget_destroy (CTK_WIDGET (ctk_builder_get_object (builder, "dialog"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (builder, "dialog"))), ((ctk_widget_get_type ()))))))); |
784 | ctk_widget_destroy (CTK_WIDGET (ctk_builder_get_object (builder, "window"))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (builder, "window"))), ((ctk_widget_get_type ()))))))); |
785 | g_object_unref (builder); |
786 | |
787 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
788 | window = ctk_builder_get_object (builder, "window"); |
789 | g_assert (CTK_IS_WINDOW (window))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 789, (( const char*) (__func__)), "CTK_IS_WINDOW (window)"); } while ( 0); |
790 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
791 | g_object_unref (builder); |
792 | |
793 | builder = builder_new_from_string (buffer3, -1, NULL((void*)0)); |
794 | window = ctk_builder_get_object (builder, "window"); |
795 | g_assert (CTK_IS_WINDOW (window))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 795, (( const char*) (__func__)), "CTK_IS_WINDOW (window)"); } while ( 0); |
796 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
797 | g_object_unref (builder); |
798 | |
799 | error = NULL((void*)0); |
800 | builder = ctk_builder_new (); |
801 | ctk_builder_add_from_string (builder, buffer4, -1, &error); |
802 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_TYPE_FUNCTION)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_TYPE_FUNCTION ) g_assertion_message_error (((gchar*) 0), "builder.c", 802, ( (const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_TYPE_FUNCTION); } while (0); |
803 | g_error_free (error); |
804 | g_object_unref (builder); |
805 | } |
806 | |
807 | static void |
808 | test_spin_button (void) |
809 | { |
810 | CtkBuilder *builder; |
811 | const gchar buffer[] = |
812 | "<interface>" |
813 | "<object class=\"CtkAdjustment\" id=\"adjustment1\">" |
814 | "<property name=\"lower\">0</property>" |
815 | "<property name=\"upper\">10</property>" |
816 | "<property name=\"step-increment\">2</property>" |
817 | "<property name=\"page-increment\">3</property>" |
818 | "<property name=\"page-size\">0</property>" |
819 | "<property name=\"value\">1</property>" |
820 | "</object>" |
821 | "<object class=\"CtkSpinButton\" id=\"spinbutton1\">" |
822 | "<property name=\"visible\">True</property>" |
823 | "<property name=\"adjustment\">adjustment1</property>" |
824 | "</object>" |
825 | "</interface>"; |
826 | GObject *obj; |
827 | CtkAdjustment *adjustment; |
828 | gdouble value; |
829 | |
830 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
831 | obj = ctk_builder_get_object (builder, "spinbutton1"); |
832 | g_assert (CTK_IS_SPIN_BUTTON (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_spin_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 832, (( const char*) (__func__)), "CTK_IS_SPIN_BUTTON (obj)"); } while (0); |
833 | adjustment = ctk_spin_button_get_adjustment (CTK_SPIN_BUTTON (obj)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_spin_button_get_type ()))))))); |
834 | g_assert (CTK_IS_ADJUSTMENT (adjustment))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((adjustment)); GType __t = ((ctk_adjustment_get_type ())) ; gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0) ); else __r = g_type_check_instance_is_a (__inst, __t); __r; } ))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 834, ((const char*) (__func__)), "CTK_IS_ADJUSTMENT (adjustment)" ); } while (0); |
835 | g_object_get (adjustment, "value", &value, NULL((void*)0)); |
836 | g_assert (value == 1)do { if (value == 1) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 836, ((const char*) (__func__)), "value == 1" ); } while (0); |
837 | g_object_get (adjustment, "lower", &value, NULL((void*)0)); |
838 | g_assert (value == 0)do { if (value == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 838, ((const char*) (__func__)), "value == 0" ); } while (0); |
839 | g_object_get (adjustment, "upper", &value, NULL((void*)0)); |
840 | g_assert (value == 10)do { if (value == 10) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 840, ((const char*) (__func__)), "value == 10" ); } while (0); |
841 | g_object_get (adjustment, "step-increment", &value, NULL((void*)0)); |
842 | g_assert (value == 2)do { if (value == 2) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 842, ((const char*) (__func__)), "value == 2" ); } while (0); |
843 | g_object_get (adjustment, "page-increment", &value, NULL((void*)0)); |
844 | g_assert (value == 3)do { if (value == 3) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 844, ((const char*) (__func__)), "value == 3" ); } while (0); |
845 | g_object_get (adjustment, "page-size", &value, NULL((void*)0)); |
846 | g_assert (value == 0)do { if (value == 0) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 846, ((const char*) (__func__)), "value == 0" ); } while (0); |
847 | |
848 | g_object_unref (builder); |
849 | } |
850 | |
851 | static void |
852 | test_notebook (void) |
853 | { |
854 | CtkBuilder *builder; |
855 | const gchar buffer[] = |
856 | "<interface>" |
857 | " <object class=\"CtkNotebook\" id=\"notebook1\">" |
858 | " <child>" |
859 | " <object class=\"CtkLabel\" id=\"label1\">" |
860 | " <property name=\"label\">label1</property>" |
861 | " </object>" |
862 | " </child>" |
863 | " <child type=\"tab\">" |
864 | " <object class=\"CtkLabel\" id=\"tablabel1\">" |
865 | " <property name=\"label\">tab_label1</property>" |
866 | " </object>" |
867 | " </child>" |
868 | " <child>" |
869 | " <object class=\"CtkLabel\" id=\"label2\">" |
870 | " <property name=\"label\">label2</property>" |
871 | " </object>" |
872 | " </child>" |
873 | " <child type=\"tab\">" |
874 | " <object class=\"CtkLabel\" id=\"tablabel2\">" |
875 | " <property name=\"label\">tab_label2</property>" |
876 | " </object>" |
877 | " </child>" |
878 | " </object>" |
879 | "</interface>"; |
880 | GObject *notebook; |
881 | CtkWidget *label; |
882 | |
883 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
884 | notebook = ctk_builder_get_object (builder, "notebook1"); |
885 | g_assert (notebook != NULL)do { if (notebook != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 885, ((const char*) (__func__)), "notebook != NULL"); } while (0); |
886 | g_assert (ctk_notebook_get_n_pages (CTK_NOTEBOOK (notebook)) == 2)do { if (ctk_notebook_get_n_pages (((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((notebook)), ( (ctk_notebook_get_type ()))))))) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 886, ((const char*) (__func__)), "ctk_notebook_get_n_pages (CTK_NOTEBOOK (notebook)) == 2"); } while (0); |
887 | |
888 | label = ctk_notebook_get_nth_page (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((notebook)), ((ctk_notebook_get_type ())))))), 0); |
889 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 889, (( const char*) (__func__)), "CTK_IS_LABEL (label)"); } while (0 ); |
890 | g_assert (strcmp (ctk_label_get_label (CTK_LABEL (label)), "label1") == 0)do { if (strcmp (ctk_label_get_label (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "label1") == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 890, ((const char*) (__func__)), "strcmp (ctk_label_get_label (CTK_LABEL (label)), \"label1\") == 0" ); } while (0); |
891 | label = ctk_notebook_get_tab_label (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((notebook)), ((ctk_notebook_get_type ())))))), label); |
892 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 892, (( const char*) (__func__)), "CTK_IS_LABEL (label)"); } while (0 ); |
893 | g_assert (strcmp (ctk_label_get_label (CTK_LABEL (label)), "tab_label1") == 0)do { if (strcmp (ctk_label_get_label (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "tab_label1") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 893, ((const char*) (__func__)), "strcmp (ctk_label_get_label (CTK_LABEL (label)), \"tab_label1\") == 0" ); } while (0); |
894 | |
895 | label = ctk_notebook_get_nth_page (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((notebook)), ((ctk_notebook_get_type ())))))), 1); |
896 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 896, (( const char*) (__func__)), "CTK_IS_LABEL (label)"); } while (0 ); |
897 | g_assert (strcmp (ctk_label_get_label (CTK_LABEL (label)), "label2") == 0)do { if (strcmp (ctk_label_get_label (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "label2") == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 897, ((const char*) (__func__)), "strcmp (ctk_label_get_label (CTK_LABEL (label)), \"label2\") == 0" ); } while (0); |
898 | label = ctk_notebook_get_tab_label (CTK_NOTEBOOK (notebook)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((notebook)), ((ctk_notebook_get_type ())))))), label); |
899 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 899, (( const char*) (__func__)), "CTK_IS_LABEL (label)"); } while (0 ); |
900 | g_assert (strcmp (ctk_label_get_label (CTK_LABEL (label)), "tab_label2") == 0)do { if (strcmp (ctk_label_get_label (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "tab_label2") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 900, ((const char*) (__func__)), "strcmp (ctk_label_get_label (CTK_LABEL (label)), \"tab_label2\") == 0" ); } while (0); |
901 | |
902 | g_object_unref (builder); |
903 | } |
904 | |
905 | static void |
906 | test_construct_only_property (void) |
907 | { |
908 | CtkBuilder *builder; |
909 | const gchar buffer[] = |
910 | "<interface>" |
911 | " <object class=\"CtkWindow\" id=\"window1\">" |
912 | " <property name=\"type\">CTK_WINDOW_POPUP</property>" |
913 | " </object>" |
914 | "</interface>"; |
915 | const gchar buffer2[] = |
916 | "<interface>" |
917 | " <object class=\"CtkTextTagTable\" id=\"tagtable1\"/>" |
918 | " <object class=\"CtkTextBuffer\" id=\"textbuffer1\">" |
919 | " <property name=\"tag-table\">tagtable1</property>" |
920 | " </object>" |
921 | "</interface>"; |
922 | GObject *widget, *tagtable, *textbuffer; |
923 | CtkWindowType type; |
924 | |
925 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
926 | widget = ctk_builder_get_object (builder, "window1"); |
927 | g_object_get (widget, "type", &type, NULL((void*)0)); |
928 | g_assert (type == CTK_WINDOW_POPUP)do { if (type == CTK_WINDOW_POPUP) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 928, ((const char*) (__func__)), "type == CTK_WINDOW_POPUP"); } while (0); |
929 | |
930 | ctk_widget_destroy (CTK_WIDGET (widget)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((widget)), ((ctk_widget_get_type ()))))))); |
931 | g_object_unref (builder); |
932 | |
933 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
934 | textbuffer = ctk_builder_get_object (builder, "textbuffer1"); |
935 | g_assert (textbuffer != NULL)do { if (textbuffer != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 935, ((const char*) (__func__)), "textbuffer != NULL"); } while (0); |
936 | g_object_get (textbuffer, "tag-table", &tagtable, NULL((void*)0)); |
937 | g_assert (tagtable == ctk_builder_get_object (builder, "tagtable1"))do { if (tagtable == ctk_builder_get_object (builder, "tagtable1" )) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 937, ((const char*) (__func__)), "tagtable == ctk_builder_get_object (builder, \"tagtable1\")" ); } while (0); |
938 | g_object_unref (tagtable); |
939 | g_object_unref (builder); |
940 | } |
941 | |
942 | static void |
943 | test_object_properties (void) |
944 | { |
945 | CtkBuilder *builder; |
946 | const gchar buffer[] = |
947 | "<interface>" |
948 | " <object class=\"CtkWindow\" id=\"window1\">" |
949 | " <child>" |
950 | " <object class=\"CtkVBox\" id=\"vbox\">" |
951 | " <property name=\"border-width\">10</property>" |
952 | " <child>" |
953 | " <object class=\"CtkLabel\" id=\"label1\">" |
954 | " <property name=\"mnemonic-widget\">spinbutton1</property>" |
955 | " </object>" |
956 | " </child>" |
957 | " <child>" |
958 | " <object class=\"CtkSpinButton\" id=\"spinbutton1\"/>" |
959 | " </child>" |
960 | " </object>" |
961 | " </child>" |
962 | " </object>" |
963 | "</interface>"; |
964 | const gchar buffer2[] = |
965 | "<interface>" |
966 | " <object class=\"CtkWindow\" id=\"window2\"/>" |
967 | "</interface>"; |
968 | GObject *label, *spinbutton, *window; |
969 | |
970 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
971 | label = ctk_builder_get_object (builder, "label1"); |
972 | g_assert (label != NULL)do { if (label != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 972, ((const char*) (__func__)), "label != NULL"); } while (0); |
973 | spinbutton = ctk_builder_get_object (builder, "spinbutton1"); |
974 | g_assert (spinbutton != NULL)do { if (spinbutton != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 974, ((const char*) (__func__)), "spinbutton != NULL"); } while (0); |
975 | g_assert (spinbutton == (GObject*)ctk_label_get_mnemonic_widget (CTK_LABEL (label)))do { if (spinbutton == (GObject*)ctk_label_get_mnemonic_widget (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_label_get_type ())))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 975, ((const char*) (__func__)), "spinbutton == (GObject*)ctk_label_get_mnemonic_widget (CTK_LABEL (label))" ); } while (0); |
976 | |
977 | ctk_builder_add_from_string (builder, buffer2, -1, NULL((void*)0)); |
978 | window = ctk_builder_get_object (builder, "window2"); |
979 | g_assert (window != NULL)do { if (window != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 979, ((const char*) (__func__)), "window != NULL"); } while (0); |
980 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
981 | |
982 | g_object_unref (builder); |
983 | } |
984 | |
985 | static void |
986 | test_children (void) |
987 | { |
988 | CtkBuilder * builder; |
989 | CtkWidget *content_area, *dialog_action_area; |
990 | GList *children; |
991 | const gchar buffer1[] = |
992 | "<interface>" |
993 | " <object class=\"CtkWindow\" id=\"window1\">" |
994 | " <child>" |
995 | " <object class=\"CtkButton\" id=\"button1\">" |
996 | " <property name=\"label\">Hello</property>" |
997 | " </object>" |
998 | " </child>" |
999 | " </object>" |
1000 | "</interface>"; |
1001 | const gchar buffer2[] = |
1002 | "<interface>" |
1003 | " <object class=\"CtkDialog\" id=\"dialog1\">" |
1004 | " <property name=\"use_header_bar\">1</property>" |
1005 | " <child internal-child=\"vbox\">" |
1006 | " <object class=\"CtkVBox\" id=\"dialog1-vbox\">" |
1007 | " <property name=\"border-width\">10</property>" |
1008 | " <child internal-child=\"action_area\">" |
1009 | " <object class=\"CtkHButtonBox\" id=\"dialog1-action_area\">" |
1010 | " <property name=\"border-width\">20</property>" |
1011 | " </object>" |
1012 | " </child>" |
1013 | " </object>" |
1014 | " </child>" |
1015 | " </object>" |
1016 | "</interface>"; |
1017 | |
1018 | GObject *window, *button; |
1019 | GObject *dialog, *vbox, *action_area; |
1020 | |
1021 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1022 | window = ctk_builder_get_object (builder, "window1"); |
1023 | g_assert (window != NULL)do { if (window != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1023, ((const char*) (__func__)) , "window != NULL"); } while (0); |
1024 | g_assert (CTK_IS_WINDOW (window))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1024, ( (const char*) (__func__)), "CTK_IS_WINDOW (window)"); } while (0); |
1025 | |
1026 | button = ctk_builder_get_object (builder, "button1"); |
1027 | g_assert (button != NULL)do { if (button != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1027, ((const char*) (__func__)) , "button != NULL"); } while (0); |
1028 | g_assert (CTK_IS_BUTTON (button))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((button)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1028, ( (const char*) (__func__)), "CTK_IS_BUTTON (button)"); } while (0); |
1029 | g_assert (ctk_widget_get_parent (CTK_WIDGET(button)) != NULL)do { if (ctk_widget_get_parent (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), ((ctk_widget_get_type ())))))) ) != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 1029, ((const char*) (__func__)), "ctk_widget_get_parent (CTK_WIDGET(button)) != NULL" ); } while (0); |
1030 | g_assert (strcmp (ctk_buildable_get_name (CTK_BUILDABLE (ctk_widget_get_parent (CTK_WIDGET (button)))), "window1") == 0)do { if (strcmp (ctk_buildable_get_name (((((CtkBuildable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_widget_get_parent (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((button)), ((ctk_widget_get_type ()))))))))), ((ctk_buildable_get_type ()))))))), "window1") == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 1030, ((const char*) (__func__)), "strcmp (ctk_buildable_get_name (CTK_BUILDABLE (ctk_widget_get_parent (CTK_WIDGET (button)))), \"window1\") == 0" ); } while (0); |
1031 | |
1032 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1033 | g_object_unref (builder); |
1034 | |
1035 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1036 | dialog = ctk_builder_get_object (builder, "dialog1"); |
1037 | g_assert (dialog != NULL)do { if (dialog != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1037, ((const char*) (__func__)) , "dialog != NULL"); } while (0); |
1038 | g_assert (CTK_IS_DIALOG (dialog))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((dialog)); GType __t = ((ctk_dialog_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1038, ( (const char*) (__func__)), "CTK_IS_DIALOG (dialog)"); } while (0); |
1039 | children = ctk_container_get_children (CTK_CONTAINER (dialog)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_container_get_type ()))))))); |
1040 | g_assert_cmpint (g_list_length (children), ==, 2)do { gint64 __n1 = (g_list_length (children)), __n2 = (2); if (__n1 == __n2) ; else g_assertion_message_cmpint (((gchar*) 0 ), "builder.c", 1040, ((const char*) (__func__)), "g_list_length (children)" " " "==" " " "2", (guint64)__n1, "==", (guint64)__n2, 'i'); } while (0); |
1041 | g_list_free (children); |
1042 | |
1043 | vbox = ctk_builder_get_object (builder, "dialog1-vbox"); |
1044 | content_area = ctk_dialog_get_content_area (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
1045 | g_assert (vbox != NULL)do { if (vbox != ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 1045, ((const char*) (__func__)), "vbox != NULL" ); } while (0); |
1046 | g_assert (CTK_IS_BOX (vbox))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((vbox)); GType __t = ((ctk_box_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1046, ( (const char*) (__func__)), "CTK_IS_BOX (vbox)"); } while (0); |
1047 | g_assert (ctk_orientable_get_orientation (CTK_ORIENTABLE (vbox)) == CTK_ORIENTATION_VERTICAL)do { if (ctk_orientable_get_orientation (((((CtkOrientable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((vbox)) , ((ctk_orientable_get_type ()))))))) == CTK_ORIENTATION_VERTICAL ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1047, ((const char*) (__func__)), "ctk_orientable_get_orientation (CTK_ORIENTABLE (vbox)) == CTK_ORIENTATION_VERTICAL" ); } while (0); |
1048 | g_assert (strcmp (ctk_buildable_get_name (CTK_BUILDABLE (ctk_widget_get_parent (CTK_WIDGET (vbox)))), "dialog1") == 0)do { if (strcmp (ctk_buildable_get_name (((((CtkBuildable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_widget_get_parent (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_widget_get_type ()))))))))), ((ctk_buildable_get_type ()))))))), "dialog1") == 0) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 1048, ((const char*) (__func__)), "strcmp (ctk_buildable_get_name (CTK_BUILDABLE (ctk_widget_get_parent (CTK_WIDGET (vbox)))), \"dialog1\") == 0" ); } while (0); |
1049 | g_assert (ctk_container_get_border_width (CTK_CONTAINER (vbox)) == 10)do { if (ctk_container_get_border_width (((((CtkContainer*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((vbox)) , ((ctk_container_get_type ()))))))) == 10) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1049, ((const char*) (__func__)) , "ctk_container_get_border_width (CTK_CONTAINER (vbox)) == 10" ); } while (0); |
1050 | g_assert (strcmp (ctk_buildable_get_name (CTK_BUILDABLE (content_area)), "dialog1-vbox") == 0)do { if (strcmp (ctk_buildable_get_name (((((CtkBuildable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((content_area )), ((ctk_buildable_get_type ()))))))), "dialog1-vbox") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1050 , ((const char*) (__func__)), "strcmp (ctk_buildable_get_name (CTK_BUILDABLE (content_area)), \"dialog1-vbox\") == 0" ); } while (0); |
1051 | |
1052 | action_area = ctk_builder_get_object (builder, "dialog1-action_area"); |
1053 | dialog_action_area = ctk_dialog_get_action_area (CTK_DIALOG (dialog)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_dialog_get_type ()))))))); |
1054 | |
1055 | g_assert (action_area != NULL)do { if (action_area != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1055, ((const char*) (__func__)) , "action_area != NULL"); } while (0); |
1056 | g_assert (CTK_IS_BUTTON_BOX (action_area))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((action_area)); GType __t = ((ctk_button_box_get_type ()) ); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1056, ((const char*) (__func__)), "CTK_IS_BUTTON_BOX (action_area)" ); } while (0); |
1057 | g_assert (ctk_orientable_get_orientation (CTK_ORIENTABLE (action_area)) == CTK_ORIENTATION_HORIZONTAL)do { if (ctk_orientable_get_orientation (((((CtkOrientable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((action_area )), ((ctk_orientable_get_type ()))))))) == CTK_ORIENTATION_HORIZONTAL ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1057, ((const char*) (__func__)), "ctk_orientable_get_orientation (CTK_ORIENTABLE (action_area)) == CTK_ORIENTATION_HORIZONTAL" ); } while (0); |
1058 | g_assert (ctk_widget_get_parent (CTK_WIDGET (action_area)) != NULL)do { if (ctk_widget_get_parent (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((action_area)), ((ctk_widget_get_type ()) )))))) != ((void*)0)) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 1058, ((const char*) (__func__)), "ctk_widget_get_parent (CTK_WIDGET (action_area)) != NULL" ); } while (0); |
1059 | g_assert (ctk_container_get_border_width (CTK_CONTAINER (action_area)) == 20)do { if (ctk_container_get_border_width (((((CtkContainer*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((action_area )), ((ctk_container_get_type ()))))))) == 20) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1059, ((const char*) (__func__)) , "ctk_container_get_border_width (CTK_CONTAINER (action_area)) == 20" ); } while (0); |
1060 | g_assert (dialog_action_area != NULL)do { if (dialog_action_area != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1060, ((const char*) (__func__)) , "dialog_action_area != NULL"); } while (0); |
1061 | g_assert (ctk_buildable_get_name (CTK_BUILDABLE (action_area)) != NULL)do { if (ctk_buildable_get_name (((((CtkBuildable*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((action_area)), ((ctk_buildable_get_type ( )))))))) != ((void*)0)) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 1061, ((const char*) (__func__)), "ctk_buildable_get_name (CTK_BUILDABLE (action_area)) != NULL" ); } while (0); |
1062 | g_assert (strcmp (ctk_buildable_get_name (CTK_BUILDABLE (dialog_action_area)), "dialog1-action_area") == 0)do { if (strcmp (ctk_buildable_get_name (((((CtkBuildable*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog_action_area )), ((ctk_buildable_get_type ()))))))), "dialog1-action_area" ) == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1062, ((const char*) (__func__)), "strcmp (ctk_buildable_get_name (CTK_BUILDABLE (dialog_action_area)), \"dialog1-action_area\") == 0" ); } while (0); |
1063 | ctk_widget_destroy (CTK_WIDGET (dialog)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog)), ((ctk_widget_get_type ()))))))); |
1064 | g_object_unref (builder); |
1065 | } |
1066 | |
1067 | static void |
1068 | test_child_properties (void) |
1069 | { |
1070 | CtkBuilder * builder; |
1071 | const gchar buffer1[] = |
1072 | "<interface>" |
1073 | " <object class=\"CtkBox\" id=\"vbox1\">" |
1074 | " <child>" |
1075 | " <object class=\"CtkLabel\" id=\"label1\"/>" |
1076 | " <packing>" |
1077 | " <property name=\"pack-type\">start</property>" |
1078 | " </packing>" |
1079 | " </child>" |
1080 | " <child>" |
1081 | " <object class=\"CtkLabel\" id=\"label2\"/>" |
1082 | " <packing>" |
1083 | " <property name=\"pack-type\">end</property>" |
1084 | " </packing>" |
1085 | " </child>" |
1086 | " </object>" |
1087 | "</interface>"; |
1088 | |
1089 | GObject *label, *vbox; |
1090 | CtkPackType pack_type; |
1091 | |
1092 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1093 | vbox = ctk_builder_get_object (builder, "vbox1"); |
1094 | g_assert (CTK_IS_BOX (vbox))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((vbox)); GType __t = ((ctk_box_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1094, ( (const char*) (__func__)), "CTK_IS_BOX (vbox)"); } while (0); |
1095 | |
1096 | label = ctk_builder_get_object (builder, "label1"); |
1097 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1097, ( (const char*) (__func__)), "CTK_IS_LABEL (label)"); } while ( 0); |
1098 | ctk_container_child_get (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_container_get_type ())))))), |
1099 | CTK_WIDGET (label)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_widget_get_type ())))))), |
1100 | "pack-type", |
1101 | &pack_type, |
1102 | NULL((void*)0)); |
1103 | g_assert (pack_type == CTK_PACK_START)do { if (pack_type == CTK_PACK_START) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1103, ((const char*) (__func__)) , "pack_type == CTK_PACK_START"); } while (0); |
1104 | |
1105 | label = ctk_builder_get_object (builder, "label2"); |
1106 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1106, ( (const char*) (__func__)), "CTK_IS_LABEL (label)"); } while ( 0); |
1107 | ctk_container_child_get (CTK_CONTAINER (vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((vbox)), ((ctk_container_get_type ())))))), |
1108 | CTK_WIDGET (label)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_widget_get_type ())))))), |
1109 | "pack-type", |
1110 | &pack_type, |
1111 | NULL((void*)0)); |
1112 | g_assert (pack_type == CTK_PACK_END)do { if (pack_type == CTK_PACK_END) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1112, ((const char*) (__func__)) , "pack_type == CTK_PACK_END"); } while (0); |
1113 | |
1114 | g_object_unref (builder); |
1115 | } |
1116 | |
1117 | static void |
1118 | test_treeview_column (void) |
1119 | { |
1120 | CtkBuilder *builder; |
1121 | const gchar buffer[] = |
1122 | "<interface>" |
1123 | "<object class=\"CtkListStore\" id=\"liststore1\">" |
1124 | " <columns>" |
1125 | " <column type=\"gchararray\"/>" |
1126 | " <column type=\"guint\"/>" |
1127 | " </columns>" |
1128 | " <data>" |
1129 | " <row>" |
1130 | " <col id=\"0\">John</col>" |
1131 | " <col id=\"1\">25</col>" |
1132 | " </row>" |
1133 | " </data>" |
1134 | "</object>" |
1135 | "<object class=\"CtkWindow\" id=\"window1\">" |
1136 | " <child>" |
1137 | " <object class=\"CtkTreeView\" id=\"treeview1\">" |
1138 | " <property name=\"visible\">True</property>" |
1139 | " <property name=\"model\">liststore1</property>" |
1140 | " <child>" |
1141 | " <object class=\"CtkTreeViewColumn\" id=\"column1\">" |
1142 | " <property name=\"title\">Test</property>" |
1143 | " <child>" |
1144 | " <object class=\"CtkCellRendererText\" id=\"renderer1\"/>" |
1145 | " <attributes>" |
1146 | " <attribute name=\"text\">1</attribute>" |
1147 | " </attributes>" |
1148 | " </child>" |
1149 | " </object>" |
1150 | " </child>" |
1151 | " <child>" |
1152 | " <object class=\"CtkTreeViewColumn\" id=\"column2\">" |
1153 | " <property name=\"title\">Number</property>" |
1154 | " <child>" |
1155 | " <object class=\"CtkCellRendererText\" id=\"renderer2\"/>" |
1156 | " <attributes>" |
1157 | " <attribute name=\"text\">0</attribute>" |
1158 | " </attributes>" |
1159 | " </child>" |
1160 | " </object>" |
1161 | " </child>" |
1162 | " </object>" |
1163 | " </child>" |
1164 | "</object>" |
1165 | "</interface>"; |
1166 | GObject *window, *treeview; |
1167 | CtkTreeViewColumn *column; |
1168 | GList *renderers; |
1169 | GObject *renderer; |
1170 | |
1171 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1172 | treeview = ctk_builder_get_object (builder, "treeview1"); |
1173 | g_assert (treeview)do { if (treeview) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1173, ((const char*) (__func__)), "treeview" ); } while (0); |
1174 | g_assert (CTK_IS_TREE_VIEW (treeview))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((treeview)); GType __t = ((ctk_tree_view_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1174, ( (const char*) (__func__)), "CTK_IS_TREE_VIEW (treeview)"); } while (0); |
1175 | column = ctk_tree_view_get_column (CTK_TREE_VIEW (treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((treeview)), ((ctk_tree_view_get_type ())))))), 0); |
1176 | g_assert (CTK_IS_TREE_VIEW_COLUMN (column))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((column)); GType __t = ((ctk_tree_view_column_get_type () )); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1176, ((const char*) (__func__)), "CTK_IS_TREE_VIEW_COLUMN (column)" ); } while (0); |
1177 | g_assert (strcmp (ctk_tree_view_column_get_title (column), "Test") == 0)do { if (strcmp (ctk_tree_view_column_get_title (column), "Test" ) == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1177, ((const char*) (__func__)), "strcmp (ctk_tree_view_column_get_title (column), \"Test\") == 0" ); } while (0); |
1178 | |
1179 | renderers = ctk_cell_layout_get_cells (CTK_CELL_LAYOUT (column)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((column)), ((ctk_cell_layout_get_type ()))))))); |
1180 | g_assert (g_list_length (renderers) == 1)do { if (g_list_length (renderers) == 1) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1180, ((const char*) (__func__)) , "g_list_length (renderers) == 1"); } while (0); |
1181 | renderer = g_list_nth_data (renderers, 0); |
1182 | g_assert (renderer)do { if (renderer) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1182, ((const char*) (__func__)), "renderer" ); } while (0); |
1183 | g_assert (CTK_IS_CELL_RENDERER_TEXT (renderer))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((renderer)); GType __t = ((ctk_cell_renderer_text_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1183, ((const char*) (__func__)), "CTK_IS_CELL_RENDERER_TEXT (renderer)" ); } while (0); |
1184 | g_list_free (renderers); |
1185 | |
1186 | window = ctk_builder_get_object (builder, "window1"); |
1187 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1188 | |
1189 | g_object_unref (builder); |
1190 | } |
1191 | |
1192 | static void |
1193 | test_icon_view (void) |
1194 | { |
1195 | CtkBuilder *builder; |
1196 | const gchar buffer[] = |
1197 | "<interface>" |
1198 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
1199 | " <columns>" |
1200 | " <column type=\"gchararray\"/>" |
1201 | " <column type=\"GdkPixbuf\"/>" |
1202 | " </columns>" |
1203 | " <data>" |
1204 | " <row>" |
1205 | " <col id=\"0\">test</col>" |
1206 | " </row>" |
1207 | " </data>" |
1208 | " </object>" |
1209 | " <object class=\"CtkWindow\" id=\"window1\">" |
1210 | " <child>" |
1211 | " <object class=\"CtkIconView\" id=\"iconview1\">" |
1212 | " <property name=\"model\">liststore1</property>" |
1213 | " <property name=\"text-column\">0</property>" |
1214 | " <property name=\"pixbuf-column\">1</property>" |
1215 | " <property name=\"visible\">True</property>" |
1216 | " <child>" |
1217 | " <object class=\"CtkCellRendererText\" id=\"renderer1\"/>" |
1218 | " <attributes>" |
1219 | " <attribute name=\"text\">0</attribute>" |
1220 | " </attributes>" |
1221 | " </child>" |
1222 | " </object>" |
1223 | " </child>" |
1224 | " </object>" |
1225 | "</interface>"; |
1226 | GObject *window, *iconview; |
1227 | |
1228 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1229 | iconview = ctk_builder_get_object (builder, "iconview1"); |
1230 | g_assert (iconview)do { if (iconview) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1230, ((const char*) (__func__)), "iconview" ); } while (0); |
1231 | g_assert (CTK_IS_ICON_VIEW (iconview))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((iconview)); GType __t = ((ctk_icon_view_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1231, ( (const char*) (__func__)), "CTK_IS_ICON_VIEW (iconview)"); } while (0); |
1232 | |
1233 | window = ctk_builder_get_object (builder, "window1"); |
1234 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1235 | g_object_unref (builder); |
1236 | } |
1237 | |
1238 | static void |
1239 | test_combo_box (void) |
1240 | { |
1241 | CtkBuilder *builder; |
1242 | const gchar buffer[] = |
1243 | "<interface>" |
1244 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
1245 | " <columns>" |
1246 | " <column type=\"guint\"/>" |
1247 | " <column type=\"gchararray\"/>" |
1248 | " </columns>" |
1249 | " <data>" |
1250 | " <row>" |
1251 | " <col id=\"0\">1</col>" |
1252 | " <col id=\"1\">Foo</col>" |
1253 | " </row>" |
1254 | " <row>" |
1255 | " <col id=\"0\">2</col>" |
1256 | " <col id=\"1\">Bar</col>" |
1257 | " </row>" |
1258 | " </data>" |
1259 | " </object>" |
1260 | " <object class=\"CtkWindow\" id=\"window1\">" |
1261 | " <child>" |
1262 | " <object class=\"CtkComboBox\" id=\"combobox1\">" |
1263 | " <property name=\"model\">liststore1</property>" |
1264 | " <property name=\"visible\">True</property>" |
1265 | " <child>" |
1266 | " <object class=\"CtkCellRendererText\" id=\"renderer1\"/>" |
1267 | " <attributes>" |
1268 | " <attribute name=\"text\">0</attribute>" |
1269 | " </attributes>" |
1270 | " </child>" |
1271 | " <child>" |
1272 | " <object class=\"CtkCellRendererText\" id=\"renderer2\"/>" |
1273 | " <attributes>" |
1274 | " <attribute name=\"text\">1</attribute>" |
1275 | " </attributes>" |
1276 | " </child>" |
1277 | " </object>" |
1278 | " </child>" |
1279 | " </object>" |
1280 | "</interface>"; |
1281 | GObject *window, *combobox; |
1282 | |
1283 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1284 | combobox = ctk_builder_get_object (builder, "combobox1"); |
1285 | g_assert (combobox)do { if (combobox) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1285, ((const char*) (__func__)), "combobox" ); } while (0); |
1286 | |
1287 | window = ctk_builder_get_object (builder, "window1"); |
1288 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1289 | |
1290 | g_object_unref (builder); |
1291 | } |
1292 | |
1293 | #if 0 |
1294 | static void |
1295 | test_combo_box_entry (void) |
1296 | { |
1297 | CtkBuilder *builder; |
1298 | const gchar buffer[] = |
1299 | "<interface>" |
1300 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
1301 | " <columns>" |
1302 | " <column type=\"guint\"/>" |
1303 | " <column type=\"gchararray\"/>" |
1304 | " </columns>" |
1305 | " <data>" |
1306 | " <row>" |
1307 | " <col id=\"0\">1</col>" |
1308 | " <col id=\"1\">Foo</col>" |
1309 | " </row>" |
1310 | " <row>" |
1311 | " <col id=\"0\">2</col>" |
1312 | " <col id=\"1\">Bar</col>" |
1313 | " </row>" |
1314 | " </data>" |
1315 | " </object>" |
1316 | " <object class=\"CtkWindow\" id=\"window1\">" |
1317 | " <child>" |
1318 | " <object class=\"CtkComboBox\" id=\"comboboxentry1\">" |
1319 | " <property name=\"model\">liststore1</property>" |
1320 | " <property name=\"has-entry\">True</property>" |
1321 | " <property name=\"visible\">True</property>" |
1322 | " <child>" |
1323 | " <object class=\"CtkCellRendererText\" id=\"renderer1\"/>" |
1324 | " <attributes>" |
1325 | " <attribute name=\"text\">0</attribute>" |
1326 | " </attributes>" |
1327 | " </child>" |
1328 | " <child>" |
1329 | " <object class=\"CtkCellRendererText\" id=\"renderer2\"/>" |
1330 | " <attributes>" |
1331 | " <attribute name=\"text\">1</attribute>" |
1332 | " </attributes>" |
1333 | " </child>" |
1334 | " </object>" |
1335 | " </child>" |
1336 | " </object>" |
1337 | "</interface>"; |
1338 | GObject *window, *combobox, *renderer; |
1339 | gchar *text; |
1340 | |
1341 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1342 | combobox = ctk_builder_get_object (builder, "comboboxentry1"); |
1343 | g_assert (combobox)do { if (combobox) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1343, ((const char*) (__func__)), "combobox" ); } while (0); |
1344 | |
1345 | renderer = ctk_builder_get_object (builder, "renderer2"); |
1346 | g_assert (renderer)do { if (renderer) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1346, ((const char*) (__func__)), "renderer" ); } while (0); |
1347 | g_object_get (renderer, "text", &text, NULL((void*)0)); |
1348 | g_assert (text)do { if (text) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1348, ((const char*) (__func__)), "text"); } while (0); |
1349 | g_assert (strcmp (text, "Bar") == 0)do { if (strcmp (text, "Bar") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1349, ((const char*) (__func__)) , "strcmp (text, \"Bar\") == 0"); } while (0); |
1350 | g_free (text); |
1351 | |
1352 | renderer = ctk_builder_get_object (builder, "renderer1"); |
1353 | g_assert (renderer)do { if (renderer) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1353, ((const char*) (__func__)), "renderer" ); } while (0); |
1354 | g_object_get (renderer, "text", &text, NULL((void*)0)); |
1355 | g_assert (text)do { if (text) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1355, ((const char*) (__func__)), "text"); } while (0); |
1356 | g_assert (strcmp (text, "2") == 0)do { if (strcmp (text, "2") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1356, ((const char*) (__func__)) , "strcmp (text, \"2\") == 0"); } while (0); |
1357 | g_free (text); |
1358 | |
1359 | window = ctk_builder_get_object (builder, "window1"); |
1360 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1361 | |
1362 | g_object_unref (builder); |
1363 | } |
1364 | #endif |
1365 | |
1366 | static void |
1367 | test_cell_view (void) |
1368 | { |
1369 | CtkBuilder *builder; |
1370 | const gchar *buffer = |
1371 | "<interface>" |
1372 | " <object class=\"CtkListStore\" id=\"liststore1\">" |
1373 | " <columns>" |
1374 | " <column type=\"gchararray\"/>" |
1375 | " </columns>" |
1376 | " <data>" |
1377 | " <row>" |
1378 | " <col id=\"0\">test</col>" |
1379 | " </row>" |
1380 | " </data>" |
1381 | " </object>" |
1382 | " <object class=\"CtkWindow\" id=\"window1\">" |
1383 | " <child>" |
1384 | " <object class=\"CtkCellView\" id=\"cellview1\">" |
1385 | " <property name=\"visible\">True</property>" |
1386 | " <property name=\"model\">liststore1</property>" |
1387 | " <accelerator key=\"f\" modifiers=\"CDK_CONTROL_MASK\" signal=\"grab_focus\"/>" |
1388 | " <child>" |
1389 | " <object class=\"CtkCellRendererText\" id=\"renderer1\"/>" |
1390 | " <attributes>" |
1391 | " <attribute name=\"text\">0</attribute>" |
1392 | " </attributes>" |
1393 | " </child>" |
1394 | " </object>" |
1395 | " </child>" |
1396 | " </object>" |
1397 | "</interface>"; |
1398 | GObject *cellview; |
1399 | GObject *model, *window; |
1400 | CtkTreePath *path; |
1401 | GList *renderers; |
1402 | |
1403 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1404 | cellview = ctk_builder_get_object (builder, "cellview1"); |
1405 | g_assert (builder)do { if (builder) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 1405, ((const char*) (__func__)), "builder"); } while (0); |
1406 | g_assert (cellview)do { if (cellview) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1406, ((const char*) (__func__)), "cellview" ); } while (0); |
1407 | g_assert (CTK_IS_CELL_VIEW (cellview))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((cellview)); GType __t = ((ctk_cell_view_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1407, ( (const char*) (__func__)), "CTK_IS_CELL_VIEW (cellview)"); } while (0); |
1408 | g_object_get (cellview, "model", &model, NULL((void*)0)); |
1409 | g_assert (model)do { if (model) ; else g_assertion_message_expr (((gchar*) 0) , "builder.c", 1409, ((const char*) (__func__)), "model"); } while (0); |
1410 | g_assert (CTK_IS_TREE_MODEL (model))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((model)); GType __t = ((ctk_tree_model_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1410, ( (const char*) (__func__)), "CTK_IS_TREE_MODEL (model)"); } while (0); |
1411 | g_object_unref (model); |
1412 | path = ctk_tree_path_new_first (); |
1413 | ctk_cell_view_set_displayed_row (CTK_CELL_VIEW (cellview)((((CtkCellView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((cellview)), ((ctk_cell_view_get_type ())))))), path); |
1414 | |
1415 | renderers = ctk_cell_layout_get_cells (CTK_CELL_LAYOUT (cellview)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((cellview)), ((ctk_cell_layout_get_type ()))))))); |
1416 | g_assert (renderers)do { if (renderers) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1416, ((const char*) (__func__)), "renderers" ); } while (0); |
1417 | g_assert (g_list_length (renderers) == 1)do { if (g_list_length (renderers) == 1) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1417, ((const char*) (__func__)) , "g_list_length (renderers) == 1"); } while (0); |
1418 | |
1419 | window = ctk_builder_get_object (builder, "window1"); |
1420 | g_assert (window)do { if (window) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 1420, ((const char*) (__func__)), "window"); } while (0); |
1421 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1422 | |
1423 | g_object_unref (builder); |
1424 | } |
1425 | |
1426 | static void |
1427 | test_dialog (void) |
1428 | { |
1429 | CtkBuilder * builder; |
1430 | const gchar buffer1[] = |
1431 | "<interface>" |
1432 | " <object class=\"CtkDialog\" id=\"dialog1\">" |
1433 | " <child internal-child=\"vbox\">" |
1434 | " <object class=\"CtkVBox\" id=\"dialog1-vbox\">" |
1435 | " <child internal-child=\"action_area\">" |
1436 | " <object class=\"CtkHButtonBox\" id=\"dialog1-action_area\">" |
1437 | " <child>" |
1438 | " <object class=\"CtkButton\" id=\"button_cancel\"/>" |
1439 | " </child>" |
1440 | " <child>" |
1441 | " <object class=\"CtkButton\" id=\"button_ok\"/>" |
1442 | " </child>" |
1443 | " </object>" |
1444 | " </child>" |
1445 | " </object>" |
1446 | " </child>" |
1447 | " <action-widgets>" |
1448 | " <action-widget response=\"3\">button_ok</action-widget>" |
1449 | " <action-widget response=\"-5\">button_cancel</action-widget>" |
1450 | " </action-widgets>" |
1451 | " </object>" |
1452 | "</interface>"; |
1453 | |
1454 | GObject *dialog1; |
1455 | GObject *button_ok; |
1456 | GObject *button_cancel; |
1457 | |
1458 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1459 | dialog1 = ctk_builder_get_object (builder, "dialog1"); |
1460 | button_ok = ctk_builder_get_object (builder, "button_ok"); |
1461 | g_assert (ctk_dialog_get_response_for_widget (CTK_DIALOG (dialog1), CTK_WIDGET (button_ok)) == 3)do { if (ctk_dialog_get_response_for_widget (((((CtkDialog*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog1 )), ((ctk_dialog_get_type ())))))), ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button_ok)), ((ctk_widget_get_type ()))) )))) == 3) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1461, ((const char*) (__func__)), "ctk_dialog_get_response_for_widget (CTK_DIALOG (dialog1), CTK_WIDGET (button_ok)) == 3" ); } while (0); |
1462 | button_cancel = ctk_builder_get_object (builder, "button_cancel"); |
1463 | g_assert (ctk_dialog_get_response_for_widget (CTK_DIALOG (dialog1), CTK_WIDGET (button_cancel)) == -5)do { if (ctk_dialog_get_response_for_widget (((((CtkDialog*) ( void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog1 )), ((ctk_dialog_get_type ())))))), ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button_cancel)), ((ctk_widget_get_type ( )))))))) == -5) ; else g_assertion_message_expr (((gchar*) 0) , "builder.c", 1463, ((const char*) (__func__)), "ctk_dialog_get_response_for_widget (CTK_DIALOG (dialog1), CTK_WIDGET (button_cancel)) == -5" ); } while (0); |
1464 | |
1465 | ctk_widget_destroy (CTK_WIDGET (dialog1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog1)), ((ctk_widget_get_type ()))))))); |
1466 | g_object_unref (builder); |
1467 | } |
1468 | |
1469 | static void |
1470 | test_message_dialog (void) |
1471 | { |
1472 | CtkBuilder * builder; |
1473 | const gchar buffer1[] = |
1474 | "<interface>" |
1475 | " <object class=\"CtkMessageDialog\" id=\"dialog1\">" |
1476 | " <child internal-child=\"message_area\">" |
1477 | " <object class=\"CtkVBox\" id=\"dialog-message-area\">" |
1478 | " <child>" |
1479 | " <object class=\"CtkExpander\" id=\"expander\"/>" |
1480 | " </child>" |
1481 | " </object>" |
1482 | " </child>" |
1483 | " </object>" |
1484 | "</interface>"; |
1485 | |
1486 | GObject *dialog1; |
1487 | GObject *expander; |
1488 | |
1489 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1490 | dialog1 = ctk_builder_get_object (builder, "dialog1"); |
1491 | expander = ctk_builder_get_object (builder, "expander"); |
1492 | g_assert (CTK_IS_EXPANDER (expander))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((expander)); GType __t = ((ctk_expander_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1492, ( (const char*) (__func__)), "CTK_IS_EXPANDER (expander)"); } while (0); |
1493 | g_assert (ctk_widget_get_parent (CTK_WIDGET (expander)) == ctk_message_dialog_get_message_area (CTK_MESSAGE_DIALOG (dialog1)))do { if (ctk_widget_get_parent (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((expander)), ((ctk_widget_get_type ())))) ))) == ctk_message_dialog_get_message_area (((((CtkMessageDialog *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog1 )), ((ctk_message_dialog_get_type ())))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1493, ((const char*) (__func__)) , "ctk_widget_get_parent (CTK_WIDGET (expander)) == ctk_message_dialog_get_message_area (CTK_MESSAGE_DIALOG (dialog1))" ); } while (0); |
1494 | |
1495 | ctk_widget_destroy (CTK_WIDGET (dialog1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog1)), ((ctk_widget_get_type ()))))))); |
1496 | g_object_unref (builder); |
1497 | } |
1498 | |
1499 | static void |
1500 | test_accelerators (void) |
1501 | { |
1502 | CtkBuilder *builder; |
1503 | const gchar *buffer = |
1504 | "<interface>" |
1505 | " <object class=\"CtkWindow\" id=\"window1\">" |
1506 | " <child>" |
1507 | " <object class=\"CtkButton\" id=\"button1\">" |
1508 | " <accelerator key=\"q\" modifiers=\"CDK_CONTROL_MASK\" signal=\"clicked\"/>" |
1509 | " </object>" |
1510 | " </child>" |
1511 | " </object>" |
1512 | "</interface>"; |
1513 | const gchar *buffer2 = |
1514 | "<interface>" |
1515 | " <object class=\"CtkWindow\" id=\"window1\">" |
1516 | " <child>" |
1517 | " <object class=\"CtkTreeView\" id=\"treeview1\">" |
1518 | " <signal name=\"cursor-changed\" handler=\"ctk_main_quit\"/>" |
1519 | " <accelerator key=\"f\" modifiers=\"CDK_CONTROL_MASK\" signal=\"grab_focus\"/>" |
1520 | " </object>" |
1521 | " </child>" |
1522 | " </object>" |
1523 | "</interface>"; |
1524 | GObject *window1; |
1525 | GSList *accel_groups; |
1526 | GObject *accel_group; |
1527 | |
1528 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1529 | window1 = ctk_builder_get_object (builder, "window1"); |
1530 | g_assert (window1)do { if (window1) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 1530, ((const char*) (__func__)), "window1"); } while (0); |
1531 | g_assert (CTK_IS_WINDOW (window1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window1)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1531, ( (const char*) (__func__)), "CTK_IS_WINDOW (window1)"); } while (0); |
1532 | |
1533 | accel_groups = ctk_accel_groups_from_object (window1); |
1534 | g_assert (g_slist_length (accel_groups) == 1)do { if (g_slist_length (accel_groups) == 1) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1534, ((const char*) (__func__)) , "g_slist_length (accel_groups) == 1"); } while (0); |
1535 | accel_group = g_slist_nth_data (accel_groups, 0); |
1536 | g_assert (accel_group)do { if (accel_group) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 1536, ((const char*) (__func__)), "accel_group" ); } while (0); |
1537 | |
1538 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1539 | g_object_unref (builder); |
1540 | |
1541 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1542 | window1 = ctk_builder_get_object (builder, "window1"); |
1543 | g_assert (window1)do { if (window1) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 1543, ((const char*) (__func__)), "window1"); } while (0); |
1544 | g_assert (CTK_IS_WINDOW (window1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((window1)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1544, ( (const char*) (__func__)), "CTK_IS_WINDOW (window1)"); } while (0); |
1545 | |
1546 | accel_groups = ctk_accel_groups_from_object (window1); |
1547 | g_assert (g_slist_length (accel_groups) == 1)do { if (g_slist_length (accel_groups) == 1) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1547, ((const char*) (__func__)) , "g_slist_length (accel_groups) == 1"); } while (0); |
1548 | accel_group = g_slist_nth_data (accel_groups, 0); |
1549 | g_assert (accel_group)do { if (accel_group) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 1549, ((const char*) (__func__)), "accel_group" ); } while (0); |
1550 | |
1551 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1552 | g_object_unref (builder); |
1553 | } |
1554 | |
1555 | static void |
1556 | test_widget (void) |
1557 | { |
1558 | const gchar *buffer = |
1559 | "<interface>" |
1560 | " <object class=\"CtkWindow\" id=\"window1\">" |
1561 | " <child>" |
1562 | " <object class=\"CtkButton\" id=\"button1\">" |
1563 | " <property name=\"can-focus\">True</property>" |
1564 | " <property name=\"has-focus\">True</property>" |
1565 | " </object>" |
1566 | " </child>" |
1567 | " </object>" |
1568 | "</interface>"; |
1569 | const gchar *buffer2 = |
1570 | "<interface>" |
1571 | " <object class=\"CtkWindow\" id=\"window1\">" |
1572 | " <child>" |
1573 | " <object class=\"CtkButton\" id=\"button1\">" |
1574 | " <property name=\"can-default\">True</property>" |
1575 | " <property name=\"has-default\">True</property>" |
1576 | " </object>" |
1577 | " </child>" |
1578 | " </object>" |
1579 | "</interface>"; |
1580 | const gchar *buffer3 = |
1581 | "<interface>" |
1582 | " <object class=\"CtkWindow\" id=\"window1\">" |
1583 | " <child>" |
1584 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
1585 | " <child>" |
1586 | " <object class=\"CtkLabel\" id=\"label1\">" |
1587 | " <child internal-child=\"accessible\">" |
1588 | " <object class=\"AtkObject\" id=\"a11y-label1\">" |
1589 | " <property name=\"AtkObject::accessible-name\">A Label</property>" |
1590 | " </object>" |
1591 | " </child>" |
1592 | " <accessibility>" |
1593 | " <relation target=\"button1\" type=\"label-for\"/>" |
1594 | " </accessibility>" |
1595 | " </object>" |
1596 | " </child>" |
1597 | " <child>" |
1598 | " <object class=\"CtkButton\" id=\"button1\">" |
1599 | " <accessibility>" |
1600 | " <action action_name=\"click\" description=\"Sliff\"/>" |
1601 | " <action action_name=\"clack\" translatable=\"yes\">Sniff</action>" |
1602 | " </accessibility>" |
1603 | " </object>" |
1604 | " </child>" |
1605 | " </object>" |
1606 | " </child>" |
1607 | " </object>" |
1608 | "</interface>"; |
1609 | CtkBuilder *builder; |
1610 | GObject *window1, *button1, *label1; |
1611 | AtkObject *accessible; |
1612 | AtkRelationSet *relation_set; |
1613 | AtkRelation *relation; |
1614 | char *name; |
1615 | |
1616 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
1617 | button1 = ctk_builder_get_object (builder, "button1"); |
1618 | |
1619 | #if 0 |
1620 | g_assert (ctk_widget_has_focus (CTK_WIDGET (button1)))do { if (ctk_widget_has_focus (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button1)), ((ctk_widget_get_type ()))))) ))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1620, ((const char*) (__func__)), "ctk_widget_has_focus (CTK_WIDGET (button1))" ); } while (0); |
1621 | #endif |
1622 | window1 = ctk_builder_get_object (builder, "window1"); |
1623 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1624 | |
1625 | g_object_unref (builder); |
1626 | |
1627 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1628 | button1 = ctk_builder_get_object (builder, "button1"); |
1629 | |
1630 | g_assert (ctk_widget_get_receives_default (CTK_WIDGET (button1)))do { if (ctk_widget_get_receives_default (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button1)), ((ctk_widget_get_type ())))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1630, ((const char*) (__func__)) , "ctk_widget_get_receives_default (CTK_WIDGET (button1))"); } while (0); |
1631 | |
1632 | g_object_unref (builder); |
1633 | |
1634 | builder = builder_new_from_string (buffer3, -1, NULL((void*)0)); |
1635 | |
1636 | window1 = ctk_builder_get_object (builder, "window1"); |
1637 | label1 = ctk_builder_get_object (builder, "label1"); |
1638 | |
1639 | accessible = ctk_widget_get_accessible (CTK_WIDGET (label1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label1)), ((ctk_widget_get_type ()))))))); |
1640 | relation_set = atk_object_ref_relation_set (accessible); |
1641 | g_return_if_fail (atk_relation_set_get_n_relations (relation_set) == 1)do { if ((atk_relation_set_get_n_relations (relation_set) == 1 )) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "atk_relation_set_get_n_relations (relation_set) == 1" ); return; } } while (0); |
1642 | relation = atk_relation_set_get_relation (relation_set, 0); |
1643 | g_return_if_fail (relation != NULL)do { if ((relation != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "relation != NULL" ); return; } } while (0); |
1644 | g_return_if_fail (ATK_IS_RELATION (relation))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((relation)); GType __t = ((atk_relation_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char* ) (__func__)), "ATK_IS_RELATION (relation)"); return; } } while (0); |
1645 | g_return_if_fail (atk_relation_get_relation_type (relation) != ATK_RELATION_LABELLED_BY)do { if ((atk_relation_get_relation_type (relation) != ATK_RELATION_LABELLED_BY )) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "atk_relation_get_relation_type (relation) != ATK_RELATION_LABELLED_BY" ); return; } } while (0); |
1646 | g_object_unref (relation_set); |
1647 | |
1648 | g_object_get (G_OBJECT (accessible)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((accessible)), (((GType) ((20) << (2)))))))), "accessible-name", &name, NULL((void*)0)); |
1649 | g_return_if_fail (strcmp (name, "A Label") == 0)do { if ((strcmp (name, "A Label") == 0)) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "strcmp (name, \"A Label\") == 0" ); return; } } while (0); |
1650 | g_free (name); |
1651 | |
1652 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1653 | g_object_unref (builder); |
1654 | } |
1655 | |
1656 | static void |
1657 | test_window (void) |
1658 | { |
1659 | const gchar *buffer1 = |
1660 | "<interface>" |
1661 | " <object class=\"CtkWindow\" id=\"window1\">" |
1662 | " <property name=\"title\"></property>" |
1663 | " </object>" |
1664 | "</interface>"; |
1665 | const gchar *buffer2 = |
1666 | "<interface>" |
1667 | " <object class=\"CtkWindow\" id=\"window1\">" |
1668 | " </object>" |
1669 | "</interface>"; |
1670 | CtkBuilder *builder; |
1671 | GObject *window1; |
1672 | gchar *title; |
1673 | |
1674 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1675 | window1 = ctk_builder_get_object (builder, "window1"); |
1676 | g_object_get (window1, "title", &title, NULL((void*)0)); |
1677 | g_assert (strcmp (title, "") == 0)do { if (strcmp (title, "") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1677, ((const char*) (__func__)) , "strcmp (title, \"\") == 0"); } while (0); |
1678 | g_free (title); |
1679 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1680 | g_object_unref (builder); |
1681 | |
1682 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1683 | window1 = ctk_builder_get_object (builder, "window1"); |
1684 | ctk_widget_destroy (CTK_WIDGET (window1)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window1)), ((ctk_widget_get_type ()))))))); |
1685 | g_object_unref (builder); |
1686 | } |
1687 | |
1688 | static void |
1689 | test_value_from_string (void) |
1690 | { |
1691 | GValue value = G_VALUE_INIT{ 0, { { 0 } } }; |
1692 | GError *error = NULL((void*)0); |
1693 | CtkBuilder *builder; |
1694 | |
1695 | builder = ctk_builder_new (); |
1696 | |
1697 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_STRING, "test", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((16) << (2))), "test", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1697, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_STRING, \"test\", &value, &error)" ); } while (0); |
1698 | g_assert (G_VALUE_HOLDS_STRING (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((16) << (2))) ); gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1698, ((const char*) (__func__)), "G_VALUE_HOLDS_STRING (&value)" ); } while (0); |
1699 | g_assert (strcmp (g_value_get_string (&value), "test") == 0)do { if (strcmp (g_value_get_string (&value), "test") == 0 ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1699, ((const char*) (__func__)), "strcmp (g_value_get_string (&value), \"test\") == 0" ); } while (0); |
1700 | g_value_unset (&value); |
1701 | |
1702 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "true", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "true", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1702, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"true\", &value, &error)" ); } while (0); |
1703 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1703, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1704 | g_assert (g_value_get_boolean (&value) == TRUE)do { if (g_value_get_boolean (&value) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1704, ((const char*) (__func__)) , "g_value_get_boolean (&value) == TRUE"); } while (0); |
1705 | g_value_unset (&value); |
1706 | |
1707 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "false", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "false", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1707, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"false\", &value, &error)" ); } while (0); |
1708 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1708, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1709 | g_assert (g_value_get_boolean (&value) == FALSE)do { if (g_value_get_boolean (&value) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1709, ((const char*) (__func__)) , "g_value_get_boolean (&value) == FALSE"); } while (0); |
1710 | g_value_unset (&value); |
1711 | |
1712 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "yes", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "yes", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1712, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"yes\", &value, &error)" ); } while (0); |
1713 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1713, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1714 | g_assert (g_value_get_boolean (&value) == TRUE)do { if (g_value_get_boolean (&value) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1714, ((const char*) (__func__)) , "g_value_get_boolean (&value) == TRUE"); } while (0); |
1715 | g_value_unset (&value); |
1716 | |
1717 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "no", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "no", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1717, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"no\", &value, &error)" ); } while (0); |
1718 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1718, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1719 | g_assert (g_value_get_boolean (&value) == FALSE)do { if (g_value_get_boolean (&value) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1719, ((const char*) (__func__)) , "g_value_get_boolean (&value) == FALSE"); } while (0); |
1720 | g_value_unset (&value); |
1721 | |
1722 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "0", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "0", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1722, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"0\", &value, &error)" ); } while (0); |
1723 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1723, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1724 | g_assert (g_value_get_boolean (&value) == FALSE)do { if (g_value_get_boolean (&value) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1724, ((const char*) (__func__)) , "g_value_get_boolean (&value) == FALSE"); } while (0); |
1725 | g_value_unset (&value); |
1726 | |
1727 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "1", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "1", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1727, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"1\", &value, &error)" ); } while (0); |
1728 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1728, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1729 | g_assert (g_value_get_boolean (&value) == TRUE)do { if (g_value_get_boolean (&value) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1729, ((const char*) (__func__)) , "g_value_get_boolean (&value) == TRUE"); } while (0); |
1730 | g_value_unset (&value); |
1731 | |
1732 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "tRuE", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "tRuE", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1732, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"tRuE\", &value, &error)" ); } while (0); |
1733 | g_assert (G_VALUE_HOLDS_BOOLEAN (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((5) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1733, ((const char*) (__func__)), "G_VALUE_HOLDS_BOOLEAN (&value)" ); } while (0); |
1734 | g_assert (g_value_get_boolean (&value) == TRUE)do { if (g_value_get_boolean (&value) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1734, ((const char*) (__func__)) , "g_value_get_boolean (&value) == TRUE"); } while (0); |
1735 | g_value_unset (&value); |
1736 | |
1737 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "blaurgh", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "blaurgh", &value, &error) == ( 0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1737, ((const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"blaurgh\", &value, &error) == FALSE" ); } while (0); |
1738 | g_value_unset (&value); |
1739 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1739, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1740 | g_error_free (error); |
1741 | error = NULL((void*)0); |
1742 | |
1743 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "yess", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "yess", &value, &error) == (0) ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1743, ((const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"yess\", &value, &error) == FALSE" ); } while (0); |
1744 | g_value_unset (&value); |
1745 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1745, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1746 | g_error_free (error); |
1747 | error = NULL((void*)0); |
1748 | |
1749 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "trueee", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "trueee", &value, &error) == ( 0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1749, ((const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"trueee\", &value, &error) == FALSE" ); } while (0); |
1750 | g_value_unset (&value); |
1751 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1751, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1752 | g_error_free (error); |
1753 | error = NULL((void*)0); |
1754 | |
1755 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, "", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((5) << (2))), "", &value, &error) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1755, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, \"\", &value, &error) == FALSE" ); } while (0); |
1756 | g_value_unset (&value); |
1757 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1757, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1758 | g_error_free (error); |
1759 | error = NULL((void*)0); |
1760 | |
1761 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_INT, "12345", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((6) << (2))), "12345", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1761, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_INT, \"12345\", &value, &error)" ); } while (0); |
1762 | g_assert (G_VALUE_HOLDS_INT (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((6) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1762, ((const char*) (__func__)), "G_VALUE_HOLDS_INT (&value)" ); } while (0); |
1763 | g_assert (g_value_get_int (&value) == 12345)do { if (g_value_get_int (&value) == 12345) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1763, ((const char*) (__func__)) , "g_value_get_int (&value) == 12345"); } while (0); |
1764 | g_value_unset (&value); |
1765 | |
1766 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_LONG, "9912345", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((8) << (2))), "9912345", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1766, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_LONG, \"9912345\", &value, &error)" ); } while (0); |
1767 | g_assert (G_VALUE_HOLDS_LONG (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((8) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1767, ((const char*) (__func__)), "G_VALUE_HOLDS_LONG (&value)" ); } while (0); |
1768 | g_assert (g_value_get_long (&value) == 9912345)do { if (g_value_get_long (&value) == 9912345) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1768, ((const char*) (__func__)) , "g_value_get_long (&value) == 9912345"); } while (0); |
1769 | g_value_unset (&value); |
1770 | |
1771 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_UINT, "2345", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((7) << (2))), "2345", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1771, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_UINT, \"2345\", &value, &error)" ); } while (0); |
1772 | g_assert (G_VALUE_HOLDS_UINT (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((7) << (2)))) ; gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1772, ((const char*) (__func__)), "G_VALUE_HOLDS_UINT (&value)" ); } while (0); |
1773 | g_assert (g_value_get_uint (&value) == 2345)do { if (g_value_get_uint (&value) == 2345) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1773, ((const char*) (__func__)) , "g_value_get_uint (&value) == 2345"); } while (0); |
1774 | g_value_unset (&value); |
1775 | |
1776 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_INT64, "-2345", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((10) << (2))), "-2345", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1776, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_INT64, \"-2345\", &value, &error)" ); } while (0); |
1777 | g_assert (G_VALUE_HOLDS_INT64 (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((10) << (2))) ); gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1777, ((const char*) (__func__)), "G_VALUE_HOLDS_INT64 (&value)" ); } while (0); |
1778 | g_assert (g_value_get_int64 (&value) == -2345)do { if (g_value_get_int64 (&value) == -2345) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1778, ((const char*) (__func__)) , "g_value_get_int64 (&value) == -2345"); } while (0); |
1779 | g_value_unset (&value); |
1780 | |
1781 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_UINT64, "2345", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((11) << (2))), "2345", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1781, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_UINT64, \"2345\", &value, &error)" ); } while (0); |
1782 | g_assert (G_VALUE_HOLDS_UINT64 (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((11) << (2))) ); gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1782, ((const char*) (__func__)), "G_VALUE_HOLDS_UINT64 (&value)" ); } while (0); |
1783 | g_assert (g_value_get_uint64 (&value) == 2345)do { if (g_value_get_uint64 (&value) == 2345) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1783, ((const char*) (__func__)) , "g_value_get_uint64 (&value) == 2345"); } while (0); |
1784 | g_value_unset (&value); |
1785 | |
1786 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_FLOAT, "1.454", &value, &error))do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((14) << (2))), "1.454", &value, &error)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1786, ( (const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_FLOAT, \"1.454\", &value, &error)" ); } while (0); |
1787 | g_assert (G_VALUE_HOLDS_FLOAT (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((14) << (2))) ); gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1787, ((const char*) (__func__)), "G_VALUE_HOLDS_FLOAT (&value)" ); } while (0); |
1788 | g_assert (fabs (g_value_get_float (&value) - 1.454) < 0.00001)do { if (fabs (g_value_get_float (&value) - 1.454) < 0.00001 ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1788, ((const char*) (__func__)), "fabs (g_value_get_float (&value) - 1.454) < 0.00001" ); } while (0); |
1789 | g_value_unset (&value); |
1790 | |
1791 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_FLOAT, "abc", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((14) << (2))), "abc", &value, &error) == (0) ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1791, ((const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_FLOAT, \"abc\", &value, &error) == FALSE" ); } while (0); |
1792 | g_value_unset (&value); |
1793 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1793, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1794 | g_error_free (error); |
1795 | error = NULL((void*)0); |
1796 | |
1797 | g_assert (ctk_builder_value_from_string_type (builder, G_TYPE_INT, "/-+,abc", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, ((GType ) ((6) << (2))), "/-+,abc", &value, &error) == ( 0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 1797, ((const char*) (__func__)), "ctk_builder_value_from_string_type (builder, G_TYPE_INT, \"/-+,abc\", &value, &error) == FALSE" ); } while (0); |
1798 | g_value_unset (&value); |
1799 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1799, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1800 | g_error_free (error); |
1801 | error = NULL((void*)0); |
1802 | |
1803 | g_assert (ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, "toplevel", &value, &error) == TRUE)do { if (ctk_builder_value_from_string_type (builder, (ctk_window_type_get_type ()), "toplevel", &value, &error) == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1803, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, \"toplevel\", &value, &error) == TRUE" ); } while (0); |
1804 | g_assert (G_VALUE_HOLDS_ENUM (&value))do { if ((((__extension__ ({ const GValue *__val = (const GValue *) ((&value)); GType __t = (((GType) ((12) << (2))) ); gboolean __r; if (!__val) __r = (0); else if (__val->g_type == __t) __r = (!(0)); else __r = g_type_check_value_holds (__val , __t); __r; }))))) ; else g_assertion_message_expr (((gchar* ) 0), "builder.c", 1804, ((const char*) (__func__)), "G_VALUE_HOLDS_ENUM (&value)" ); } while (0); |
1805 | g_assert (g_value_get_enum (&value) == CTK_WINDOW_TOPLEVEL)do { if (g_value_get_enum (&value) == CTK_WINDOW_TOPLEVEL ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1805, ((const char*) (__func__)), "g_value_get_enum (&value) == CTK_WINDOW_TOPLEVEL" ); } while (0); |
1806 | g_value_unset (&value); |
1807 | |
1808 | g_assert (ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, "sliff", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, (ctk_window_type_get_type ()), "sliff", &value, &error) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1808, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, \"sliff\", &value, &error) == FALSE" ); } while (0); |
1809 | g_value_unset (&value); |
1810 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1810, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1811 | g_error_free (error); |
1812 | error = NULL((void*)0); |
1813 | |
1814 | g_assert (ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, "foobar", &value, &error) == FALSE)do { if (ctk_builder_value_from_string_type (builder, (ctk_window_type_get_type ()), "foobar", &value, &error) == (0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1814, ((const char*) (__func__)) , "ctk_builder_value_from_string_type (builder, CTK_TYPE_WINDOW_TYPE, \"foobar\", &value, &error) == FALSE" ); } while (0); |
1815 | g_value_unset (&value); |
1816 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_INVALID_VALUE)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_INVALID_VALUE) g_assertion_message_error (((gchar*) 0), "builder.c", 1816, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_INVALID_VALUE ); } while (0); |
1817 | g_error_free (error); |
1818 | error = NULL((void*)0); |
1819 | |
1820 | g_object_unref (builder); |
1821 | } |
1822 | |
1823 | static gboolean model_freed = FALSE(0); |
1824 | |
1825 | static void |
1826 | model_weakref (gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)), |
1827 | GObject *model G_GNUC_UNUSED__attribute__ ((__unused__))) |
1828 | { |
1829 | model_freed = TRUE(!(0)); |
1830 | } |
1831 | |
1832 | static void |
1833 | test_reference_counting (void) |
1834 | { |
1835 | CtkBuilder *builder; |
1836 | const gchar buffer1[] = |
1837 | "<interface>" |
1838 | " <object class=\"CtkListStore\" id=\"liststore1\"/>" |
1839 | " <object class=\"CtkListStore\" id=\"liststore2\"/>" |
1840 | " <object class=\"CtkWindow\" id=\"window1\">" |
1841 | " <child>" |
1842 | " <object class=\"CtkTreeView\" id=\"treeview1\">" |
1843 | " <property name=\"model\">liststore1</property>" |
1844 | " </object>" |
1845 | " </child>" |
1846 | " </object>" |
1847 | "</interface>"; |
1848 | const gchar buffer2[] = |
1849 | "<interface>" |
1850 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
1851 | " <child>" |
1852 | " <object class=\"CtkLabel\" id=\"label1\"/>" |
1853 | " <packing>" |
1854 | " <property name=\"pack-type\">start</property>" |
1855 | " </packing>" |
1856 | " </child>" |
1857 | " </object>" |
1858 | "</interface>"; |
1859 | GObject *window, *treeview, *model; |
1860 | |
1861 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1862 | window = ctk_builder_get_object (builder, "window1"); |
1863 | treeview = ctk_builder_get_object (builder, "treeview1"); |
1864 | model = ctk_builder_get_object (builder, "liststore1"); |
1865 | g_object_unref (builder); |
1866 | |
1867 | g_object_weak_ref (model, (GWeakNotify)model_weakref, NULL((void*)0)); |
1868 | |
1869 | g_assert (model_freed == FALSE)do { if (model_freed == (0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 1869, ((const char*) (__func__)), "model_freed == FALSE" ); } while (0); |
1870 | ctk_tree_view_set_model (CTK_TREE_VIEW (treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((treeview)), ((ctk_tree_view_get_type ())))))), NULL((void*)0)); |
1871 | g_assert (model_freed == TRUE)do { if (model_freed == (!(0))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1871, ((const char*) (__func__)) , "model_freed == TRUE"); } while (0); |
1872 | |
1873 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
1874 | |
1875 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1876 | g_object_unref (builder); |
1877 | } |
1878 | |
1879 | static void |
1880 | test_icon_factory (void) |
1881 | { |
1882 | CtkBuilder *builder; |
1883 | const gchar buffer1[] = |
1884 | "<interface>" |
1885 | " <object class=\"CtkIconFactory\" id=\"iconfactory1\">" |
1886 | " <sources>" |
1887 | " <source stock-id=\"apple-red\" filename=\"apple-red.png\"/>" |
1888 | " </sources>" |
1889 | " </object>" |
1890 | "</interface>"; |
1891 | const gchar buffer2[] = |
1892 | "<interface>" |
1893 | " <object class=\"CtkIconFactory\" id=\"iconfactory1\">" |
1894 | " <sources>" |
1895 | " <source stock-id=\"sliff\" direction=\"rtl\" state=\"active\"" |
1896 | " size=\"menu\" filename=\"sloff.png\"/>" |
1897 | " <source stock-id=\"sliff\" direction=\"ltr\" state=\"selected\"" |
1898 | " size=\"dnd\" filename=\"slurf.png\"/>" |
1899 | " </sources>" |
1900 | " </object>" |
1901 | "</interface>"; |
1902 | GObject *factory; |
1903 | CtkIconSet *icon_set; |
1904 | CtkIconSource *icon_source; |
1905 | CtkWidget *image; |
1906 | |
1907 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
1908 | factory = ctk_builder_get_object (builder, "iconfactory1"); |
1909 | g_assert (factory != NULL)do { if (factory != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1909, ((const char*) (__func__)) , "factory != NULL"); } while (0); |
1910 | |
1911 | icon_set = ctk_icon_factory_lookup (CTK_ICON_FACTORY (factory)((((CtkIconFactory*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((factory)), ((ctk_icon_factory_get_type ())))))), "apple-red"); |
1912 | g_assert (icon_set != NULL)do { if (icon_set != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1912, ((const char*) (__func__)) , "icon_set != NULL"); } while (0); |
1913 | ctk_icon_factory_add_default (CTK_ICON_FACTORY (factory)((((CtkIconFactory*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((factory)), ((ctk_icon_factory_get_type ()))))))); |
1914 | G_GNUC_BEGIN_IGNORE_DEPRECATIONSclang diagnostic push
clang diagnostic ignored "-Wdeprecated-declarations" ; |
1915 | image = ctk_image_new_from_stock ("apple-red", CTK_ICON_SIZE_BUTTON); |
1916 | G_GNUC_END_IGNORE_DEPRECATIONSclang diagnostic pop ; |
1917 | g_assert (image != NULL)do { if (image != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1917, ((const char*) (__func__)) , "image != NULL"); } while (0); |
1918 | g_object_ref_sink (image)((__typeof__ (image)) (g_object_ref_sink) (image)); |
1919 | g_object_unref (image); |
1920 | |
1921 | g_object_unref (builder); |
1922 | |
1923 | builder = builder_new_from_string (buffer2, -1, NULL((void*)0)); |
1924 | factory = ctk_builder_get_object (builder, "iconfactory1"); |
1925 | g_assert (factory != NULL)do { if (factory != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1925, ((const char*) (__func__)) , "factory != NULL"); } while (0); |
1926 | |
1927 | icon_set = ctk_icon_factory_lookup (CTK_ICON_FACTORY (factory)((((CtkIconFactory*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((factory)), ((ctk_icon_factory_get_type ())))))), "sliff"); |
1928 | g_assert (icon_set != NULL)do { if (icon_set != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1928, ((const char*) (__func__)) , "icon_set != NULL"); } while (0); |
1929 | g_assert (g_slist_length (icon_set->sources) == 2)do { if (g_slist_length (icon_set->sources) == 2) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1929, ((const char*) (__func__)) , "g_slist_length (icon_set->sources) == 2"); } while (0); |
1930 | |
1931 | icon_source = icon_set->sources->data; |
1932 | g_assert (ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_RTL)do { if (ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_RTL ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1932, ((const char*) (__func__)), "ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_RTL" ); } while (0); |
1933 | g_assert (ctk_icon_source_get_state (icon_source) == CTK_STATE_ACTIVE)do { if (ctk_icon_source_get_state (icon_source) == CTK_STATE_ACTIVE ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1933, ((const char*) (__func__)), "ctk_icon_source_get_state (icon_source) == CTK_STATE_ACTIVE" ); } while (0); |
1934 | g_assert (ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_MENU)do { if (ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_MENU ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1934, ((const char*) (__func__)), "ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_MENU" ); } while (0); |
1935 | g_assert (g_str_has_suffix (ctk_icon_source_get_filename (icon_source), "sloff.png"))do { if ((__builtin_constant_p ("sloff.png")? __extension__ ( { const char * const __str = (ctk_icon_source_get_filename (icon_source )); const char * const __suffix = ("sloff.png"); gboolean __result = (0); if (__str == ((void*)0) || __suffix == ((void*)0)) __result = (g_str_has_suffix) (__str, __suffix); else { const size_t __str_len = strlen (((__str) + !(__str))); const size_t __suffix_len = strlen (((__suffix) + !(__suffix))); if (__str_len >= __suffix_len ) __result = memcmp (__str + __str_len - __suffix_len, ((__suffix ) + !(__suffix)), __suffix_len) == 0; } __result; }) : (g_str_has_suffix ) (ctk_icon_source_get_filename (icon_source), "sloff.png") ) ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1935, ((const char*) (__func__)), "g_str_has_suffix (ctk_icon_source_get_filename (icon_source), \"sloff.png\")" ); } while (0); |
1936 | |
1937 | icon_source = icon_set->sources->next->data; |
1938 | g_assert (ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_LTR)do { if (ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_LTR ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1938, ((const char*) (__func__)), "ctk_icon_source_get_direction (icon_source) == CTK_TEXT_DIR_LTR" ); } while (0); |
1939 | g_assert (ctk_icon_source_get_state (icon_source) == CTK_STATE_SELECTED)do { if (ctk_icon_source_get_state (icon_source) == CTK_STATE_SELECTED ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1939, ((const char*) (__func__)), "ctk_icon_source_get_state (icon_source) == CTK_STATE_SELECTED" ); } while (0); |
1940 | g_assert (ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_DND)do { if (ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_DND ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1940, ((const char*) (__func__)), "ctk_icon_source_get_size (icon_source) == CTK_ICON_SIZE_DND" ); } while (0); |
1941 | g_assert (g_str_has_suffix (ctk_icon_source_get_filename (icon_source), "slurf.png"))do { if ((__builtin_constant_p ("slurf.png")? __extension__ ( { const char * const __str = (ctk_icon_source_get_filename (icon_source )); const char * const __suffix = ("slurf.png"); gboolean __result = (0); if (__str == ((void*)0) || __suffix == ((void*)0)) __result = (g_str_has_suffix) (__str, __suffix); else { const size_t __str_len = strlen (((__str) + !(__str))); const size_t __suffix_len = strlen (((__suffix) + !(__suffix))); if (__str_len >= __suffix_len ) __result = memcmp (__str + __str_len - __suffix_len, ((__suffix ) + !(__suffix)), __suffix_len) == 0; } __result; }) : (g_str_has_suffix ) (ctk_icon_source_get_filename (icon_source), "slurf.png") ) ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 1941, ((const char*) (__func__)), "g_str_has_suffix (ctk_icon_source_get_filename (icon_source), \"slurf.png\")" ); } while (0); |
1942 | |
1943 | g_object_unref (builder); |
1944 | } |
1945 | |
1946 | typedef struct { |
1947 | gboolean weight; |
1948 | gboolean foreground; |
1949 | gboolean underline; |
1950 | gboolean size; |
1951 | gboolean font_desc; |
1952 | gboolean language; |
1953 | } FoundAttrs; |
1954 | |
1955 | static gboolean |
1956 | filter_pango_attrs (PangoAttribute *attr, |
1957 | gpointer data) |
1958 | { |
1959 | FoundAttrs *found = (FoundAttrs *)data; |
1960 | |
1961 | if (attr->klass->type == PANGO_ATTR_WEIGHT) |
1962 | found->weight = TRUE(!(0)); |
1963 | else if (attr->klass->type == PANGO_ATTR_FOREGROUND) |
1964 | found->foreground = TRUE(!(0)); |
1965 | else if (attr->klass->type == PANGO_ATTR_UNDERLINE) |
1966 | found->underline = TRUE(!(0)); |
1967 | /* Make sure optional start/end properties are working */ |
1968 | else if (attr->klass->type == PANGO_ATTR_SIZE && |
1969 | attr->start_index == 5 && |
1970 | attr->end_index == 10) |
1971 | found->size = TRUE(!(0)); |
1972 | else if (attr->klass->type == PANGO_ATTR_FONT_DESC) |
1973 | found->font_desc = TRUE(!(0)); |
1974 | else if (attr->klass->type == PANGO_ATTR_LANGUAGE) |
1975 | found->language = TRUE(!(0)); |
1976 | |
1977 | return TRUE(!(0)); |
1978 | } |
1979 | |
1980 | static void |
1981 | test_pango_attributes (void) |
1982 | { |
1983 | CtkBuilder *builder; |
1984 | FoundAttrs found = { 0, }; |
1985 | const gchar buffer[] = |
1986 | "<interface>" |
1987 | " <object class=\"CtkLabel\" id=\"label1\">" |
1988 | " <attributes>" |
1989 | " <attribute name=\"weight\" value=\"PANGO_WEIGHT_BOLD\"/>" |
1990 | " <attribute name=\"foreground\" value=\"DarkSlateGray\"/>" |
1991 | " <attribute name=\"underline\" value=\"True\"/>" |
1992 | " <attribute name=\"size\" value=\"4\" start=\"5\" end=\"10\"/>" |
1993 | " <attribute name=\"font-desc\" value=\"Sans Italic 22\"/>" |
1994 | " <attribute name=\"language\" value=\"pt_BR\"/>" |
1995 | " </attributes>" |
1996 | " </object>" |
1997 | "</interface>"; |
1998 | const gchar err_buffer1[] = |
1999 | "<interface>" |
2000 | " <object class=\"CtkLabel\" id=\"label1\">" |
2001 | " <attributes>" |
2002 | " <attribute name=\"weight\"/>" |
2003 | " </attributes>" |
2004 | " </object>" |
2005 | "</interface>"; |
2006 | const gchar err_buffer2[] = |
2007 | "<interface>" |
2008 | " <object class=\"CtkLabel\" id=\"label1\">" |
2009 | " <attributes>" |
2010 | " <attribute name=\"weight\" value=\"PANGO_WEIGHT_BOLD\" unrecognized=\"True\"/>" |
2011 | " </attributes>" |
2012 | " </object>" |
2013 | "</interface>"; |
2014 | |
2015 | GObject *label; |
2016 | GError *error = NULL((void*)0); |
2017 | PangoAttrList *attrs, *filtered; |
2018 | |
2019 | /* Test attributes are set */ |
2020 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2021 | label = ctk_builder_get_object (builder, "label1"); |
2022 | g_assert (label != NULL)do { if (label != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2022, ((const char*) (__func__)) , "label != NULL"); } while (0); |
2023 | |
2024 | attrs = ctk_label_get_attributes (CTK_LABEL (label)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((label)), ((ctk_label_get_type ()))))))); |
2025 | g_assert (attrs != NULL)do { if (attrs != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2025, ((const char*) (__func__)) , "attrs != NULL"); } while (0); |
2026 | |
2027 | filtered = pango_attr_list_filter (attrs, filter_pango_attrs, &found); |
2028 | g_assert (filtered)do { if (filtered) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2028, ((const char*) (__func__)), "filtered" ); } while (0); |
2029 | pango_attr_list_unref (filtered); |
2030 | |
2031 | g_assert (found.weight)do { if (found.weight) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 2031, ((const char*) (__func__)), "found.weight" ); } while (0); |
2032 | g_assert (found.foreground)do { if (found.foreground) ; else g_assertion_message_expr (( (gchar*) 0), "builder.c", 2032, ((const char*) (__func__)), "found.foreground" ); } while (0); |
2033 | g_assert (found.underline)do { if (found.underline) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2033, ((const char*) (__func__)), "found.underline" ); } while (0); |
2034 | g_assert (found.size)do { if (found.size) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 2034, ((const char*) (__func__)), "found.size" ); } while (0); |
2035 | g_assert (found.language)do { if (found.language) ; else g_assertion_message_expr (((gchar *) 0), "builder.c", 2035, ((const char*) (__func__)), "found.language" ); } while (0); |
2036 | g_assert (found.font_desc)do { if (found.font_desc) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2036, ((const char*) (__func__)), "found.font_desc" ); } while (0); |
2037 | |
2038 | g_object_unref (builder); |
2039 | |
2040 | /* Test errors are set */ |
2041 | builder = ctk_builder_new (); |
2042 | ctk_builder_add_from_string (builder, err_buffer1, -1, &error); |
2043 | label = ctk_builder_get_object (builder, "label1"); |
Value stored to 'label' is never read | |
2044 | g_assert_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_MISSING_ATTRIBUTE)do { if (!error || (error)->domain != g_markup_error_quark () || (error)->code != G_MARKUP_ERROR_MISSING_ATTRIBUTE) g_assertion_message_error (((gchar*) 0), "builder.c", 2044, ((const char*) (__func__)) , "error", error, g_markup_error_quark (), G_MARKUP_ERROR_MISSING_ATTRIBUTE ); } while (0); |
2045 | g_object_unref (builder); |
2046 | g_error_free (error); |
2047 | error = NULL((void*)0); |
2048 | |
2049 | builder = ctk_builder_new (); |
2050 | ctk_builder_add_from_string (builder, err_buffer2, -1, &error); |
2051 | label = ctk_builder_get_object (builder, "label1"); |
2052 | |
2053 | g_assert_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE)do { if (!error || (error)->domain != g_markup_error_quark () || (error)->code != G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE) g_assertion_message_error (((gchar*) 0), "builder.c", 2053, ((const char*) (__func__)) , "error", error, g_markup_error_quark (), G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE ); } while (0); |
2054 | g_object_unref (builder); |
2055 | g_error_free (error); |
2056 | } |
2057 | |
2058 | static void |
2059 | test_requires (void) |
2060 | { |
2061 | CtkBuilder *builder; |
2062 | GError *error = NULL((void*)0); |
2063 | gchar *buffer; |
2064 | const gchar buffer_fmt[] = |
2065 | "<interface>" |
2066 | " <requires lib=\"ctk+\" version=\"%d.%d\"/>" |
2067 | "</interface>"; |
2068 | |
2069 | buffer = g_strdup_printf (buffer_fmt, CTK_MAJOR_VERSION(3), CTK_MINOR_VERSION(25) + 1); |
2070 | builder = ctk_builder_new (); |
2071 | ctk_builder_add_from_string (builder, buffer, -1, &error); |
2072 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_VERSION_MISMATCH)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_VERSION_MISMATCH ) g_assertion_message_error (((gchar*) 0), "builder.c", 2072, ((const char*) (__func__)), "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_VERSION_MISMATCH); } while (0); |
2073 | g_object_unref (builder); |
2074 | g_error_free (error); |
2075 | g_free (buffer); |
2076 | } |
2077 | |
2078 | static void |
2079 | test_add_objects (void) |
2080 | { |
2081 | CtkBuilder *builder; |
2082 | GError *error; |
2083 | gint ret; |
2084 | GObject *obj; |
2085 | CtkUIManager *manager; |
2086 | CtkWidget *menubar; |
2087 | GObject *menu, *label; |
2088 | GList *children; |
2089 | gchar *objects[2] = {"mainbox", NULL((void*)0)}; |
2090 | gchar *objects2[3] = {"mainbox", "window2", NULL((void*)0)}; |
2091 | gchar *objects3[3] = {"uimgr1", "menubar1"}; |
2092 | gchar *objects4[2] = {"uimgr1", NULL((void*)0)}; |
2093 | const gchar buffer[] = |
2094 | "<interface>" |
2095 | " <object class=\"CtkWindow\" id=\"window\">" |
2096 | " <child>" |
2097 | " <object class=\"CtkVBox\" id=\"mainbox\">" |
2098 | " <property name=\"visible\">True</property>" |
2099 | " <child>" |
2100 | " <object class=\"CtkLabel\" id=\"label1\">" |
2101 | " <property name=\"visible\">True</property>" |
2102 | " <property name=\"label\" translatable=\"no\">first label</property>" |
2103 | " </object>" |
2104 | " </child>" |
2105 | " <child>" |
2106 | " <object class=\"CtkLabel\" id=\"label2\">" |
2107 | " <property name=\"visible\">True</property>" |
2108 | " <property name=\"label\" translatable=\"no\">second label</property>" |
2109 | " </object>" |
2110 | " <packing>" |
2111 | " <property name=\"position\">1</property>" |
2112 | " </packing>" |
2113 | " </child>" |
2114 | " </object>" |
2115 | " </child>" |
2116 | " </object>" |
2117 | " <object class=\"CtkWindow\" id=\"window2\">" |
2118 | " <child>" |
2119 | " <object class=\"CtkLabel\" id=\"label3\">" |
2120 | " <property name=\"label\" translatable=\"no\">second label</property>" |
2121 | " </object>" |
2122 | " </child>" |
2123 | " </object>" |
2124 | "<interface/>"; |
2125 | const gchar buffer2[] = |
2126 | "<interface>" |
2127 | " <object class=\"CtkUIManager\" id=\"uimgr1\">" |
2128 | " <child>" |
2129 | " <object class=\"CtkActionGroup\" id=\"ag1\">" |
2130 | " <child>" |
2131 | " <object class=\"CtkAction\" id=\"file\">" |
2132 | " <property name=\"label\">_File</property>" |
2133 | " </object>" |
2134 | " <accelerator key=\"n\" modifiers=\"CDK_CONTROL_MASK\"/>" |
2135 | " </child>" |
2136 | " </object>" |
2137 | " </child>" |
2138 | " <ui>" |
2139 | " <menubar name=\"menubar1\">" |
2140 | " <menu action=\"file\">" |
2141 | " </menu>" |
2142 | " </menubar>" |
2143 | " </ui>" |
2144 | " </object>" |
2145 | " <object class=\"CtkWindow\" id=\"window1\">" |
2146 | " <child>" |
2147 | " <object class=\"CtkMenuBar\" id=\"menubar1\" constructor=\"uimgr1\"/>" |
2148 | " </child>" |
2149 | " </object>" |
2150 | "</interface>"; |
2151 | |
2152 | error = NULL((void*)0); |
2153 | builder = ctk_builder_new (); |
2154 | ret = ctk_builder_add_objects_from_string (builder, buffer, -1, objects, &error); |
2155 | g_assert (ret)do { if (ret) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2155, ((const char*) (__func__)), "ret"); } while (0); |
2156 | g_assert (error == NULL)do { if (error == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2156, ((const char*) (__func__)) , "error == NULL"); } while (0); |
2157 | obj = ctk_builder_get_object (builder, "window"); |
2158 | g_assert (obj == NULL)do { if (obj == ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 2158, ((const char*) (__func__)), "obj == NULL" ); } while (0); |
2159 | obj = ctk_builder_get_object (builder, "window2"); |
2160 | g_assert (obj == NULL)do { if (obj == ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 2160, ((const char*) (__func__)), "obj == NULL" ); } while (0); |
2161 | obj = ctk_builder_get_object (builder, "mainbox"); |
2162 | g_assert (CTK_IS_WIDGET (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_widget_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2162, ( (const char*) (__func__)), "CTK_IS_WIDGET (obj)"); } while (0 ); |
2163 | g_object_unref (builder); |
2164 | |
2165 | error = NULL((void*)0); |
2166 | builder = ctk_builder_new (); |
2167 | ret = ctk_builder_add_objects_from_string (builder, buffer, -1, objects2, &error); |
2168 | g_assert (ret)do { if (ret) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2168, ((const char*) (__func__)), "ret"); } while (0); |
2169 | g_assert (error == NULL)do { if (error == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2169, ((const char*) (__func__)) , "error == NULL"); } while (0); |
2170 | obj = ctk_builder_get_object (builder, "window"); |
2171 | g_assert (obj == NULL)do { if (obj == ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 2171, ((const char*) (__func__)), "obj == NULL" ); } while (0); |
2172 | obj = ctk_builder_get_object (builder, "window2"); |
2173 | g_assert (CTK_IS_WINDOW (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_window_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2173, ( (const char*) (__func__)), "CTK_IS_WINDOW (obj)"); } while (0 ); |
2174 | ctk_widget_destroy (CTK_WIDGET (obj)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_widget_get_type ()))))))); |
2175 | obj = ctk_builder_get_object (builder, "mainbox"); |
2176 | g_assert (CTK_IS_WIDGET (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_widget_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2176, ( (const char*) (__func__)), "CTK_IS_WIDGET (obj)"); } while (0 ); |
2177 | g_object_unref (builder); |
2178 | |
2179 | /* test cherry picking a ui manager and menubar that depends on it */ |
2180 | error = NULL((void*)0); |
2181 | builder = ctk_builder_new (); |
2182 | ret = ctk_builder_add_objects_from_string (builder, buffer2, -1, objects3, &error); |
2183 | g_assert (ret)do { if (ret) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2183, ((const char*) (__func__)), "ret"); } while (0); |
2184 | obj = ctk_builder_get_object (builder, "uimgr1"); |
2185 | g_assert (CTK_IS_UI_MANAGER (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_ui_manager_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2185, ( (const char*) (__func__)), "CTK_IS_UI_MANAGER (obj)"); } while (0); |
2186 | obj = ctk_builder_get_object (builder, "file"); |
2187 | g_assert (CTK_IS_ACTION (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_action_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2187, ( (const char*) (__func__)), "CTK_IS_ACTION (obj)"); } while (0 ); |
2188 | obj = ctk_builder_get_object (builder, "menubar1"); |
2189 | g_assert (CTK_IS_MENU_BAR (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_menu_bar_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2189, ( (const char*) (__func__)), "CTK_IS_MENU_BAR (obj)"); } while ( 0); |
2190 | menubar = CTK_WIDGET (obj)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_widget_get_type ())))))); |
2191 | |
2192 | children = ctk_container_get_children (CTK_CONTAINER (menubar)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menubar)), ((ctk_container_get_type ()))))))); |
2193 | menu = children->data; |
2194 | g_assert (menu != NULL)do { if (menu != ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 2194, ((const char*) (__func__)), "menu != NULL" ); } while (0); |
2195 | g_assert (CTK_IS_MENU_ITEM (menu))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menu)); GType __t = ((ctk_menu_item_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2195, ( (const char*) (__func__)), "CTK_IS_MENU_ITEM (menu)"); } while (0); |
2196 | g_assert (strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), "file") == 0)do { if (strcmp (ctk_widget_get_name (((((CtkWidget*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_widget_get_type ()))))))), "file") == 0) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2196, ((const char*) (__func__)), "strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), \"file\") == 0" ); } while (0); |
2197 | g_list_free (children); |
2198 | |
2199 | label = G_OBJECT (ctk_bin_get_child (CTK_BIN (menu)))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_bin_get_child (((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_bin_get_type ()))))))))), ( ((GType) ((20) << (2)))))))); |
2200 | g_assert (label != NULL)do { if (label != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2200, ((const char*) (__func__)) , "label != NULL"); } while (0); |
2201 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2201, ( (const char*) (__func__)), "CTK_IS_LABEL (label)"); } while ( 0); |
2202 | g_assert (strcmp (ctk_label_get_text (CTK_LABEL (label)), "File") == 0)do { if (strcmp (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "File") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2202, ((const char*) (__func__)), "strcmp (ctk_label_get_text (CTK_LABEL (label)), \"File\") == 0" ); } while (0); |
2203 | |
2204 | g_object_unref (builder); |
2205 | |
2206 | /* test cherry picking just the ui manager */ |
2207 | error = NULL((void*)0); |
2208 | builder = ctk_builder_new (); |
2209 | ret = ctk_builder_add_objects_from_string (builder, buffer2, -1, objects4, &error); |
2210 | g_assert (ret)do { if (ret) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2210, ((const char*) (__func__)), "ret"); } while (0); |
2211 | obj = ctk_builder_get_object (builder, "uimgr1"); |
2212 | g_assert (CTK_IS_UI_MANAGER (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_ui_manager_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2212, ( (const char*) (__func__)), "CTK_IS_UI_MANAGER (obj)"); } while (0); |
2213 | manager = CTK_UI_MANAGER (obj)((((CtkUIManager*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_ui_manager_get_type ())))))); |
2214 | obj = ctk_builder_get_object (builder, "file"); |
2215 | g_assert (CTK_IS_ACTION (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_action_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2215, ( (const char*) (__func__)), "CTK_IS_ACTION (obj)"); } while (0 ); |
2216 | menubar = ctk_ui_manager_get_widget (manager, "/menubar1"); |
2217 | g_assert (CTK_IS_MENU_BAR (menubar))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menubar)); GType __t = ((ctk_menu_bar_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2217, ( (const char*) (__func__)), "CTK_IS_MENU_BAR (menubar)"); } while (0); |
2218 | |
2219 | children = ctk_container_get_children (CTK_CONTAINER (menubar)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menubar)), ((ctk_container_get_type ()))))))); |
2220 | menu = children->data; |
2221 | g_assert (menu != NULL)do { if (menu != ((void*)0)) ; else g_assertion_message_expr ( ((gchar*) 0), "builder.c", 2221, ((const char*) (__func__)), "menu != NULL" ); } while (0); |
2222 | g_assert (CTK_IS_MENU_ITEM (menu))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menu)); GType __t = ((ctk_menu_item_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2222, ( (const char*) (__func__)), "CTK_IS_MENU_ITEM (menu)"); } while (0); |
2223 | g_assert (strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), "file") == 0)do { if (strcmp (ctk_widget_get_name (((((CtkWidget*) (void * ) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_widget_get_type ()))))))), "file") == 0) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2223, ((const char*) (__func__)), "strcmp (ctk_widget_get_name (CTK_WIDGET (menu)), \"file\") == 0" ); } while (0); |
2224 | g_list_free (children); |
2225 | |
2226 | label = G_OBJECT (ctk_bin_get_child (CTK_BIN (menu)))((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_bin_get_child (((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((menu)), ((ctk_bin_get_type ()))))))))), ( ((GType) ((20) << (2)))))))); |
2227 | g_assert (label != NULL)do { if (label != ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2227, ((const char*) (__func__)) , "label != NULL"); } while (0); |
2228 | g_assert (CTK_IS_LABEL (label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2228, ( (const char*) (__func__)), "CTK_IS_LABEL (label)"); } while ( 0); |
2229 | g_assert (strcmp (ctk_label_get_text (CTK_LABEL (label)), "File") == 0)do { if (strcmp (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((label)), ((ctk_label_get_type ()))))))), "File") == 0) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2229, ((const char*) (__func__)), "strcmp (ctk_label_get_text (CTK_LABEL (label)), \"File\") == 0" ); } while (0); |
2230 | |
2231 | g_object_unref (builder); |
2232 | } |
2233 | |
2234 | static CtkWidget * |
2235 | get_parent_menubar (CtkWidget *menuitem) |
2236 | { |
2237 | CtkMenuShell *menu_shell; |
2238 | CtkWidget *attach = NULL((void*)0); |
2239 | |
2240 | menu_shell = CTK_MENU_SHELL (ctk_widget_get_parent (menuitem))((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_widget_get_parent (menuitem))), ((ctk_menu_shell_get_type ())))))); |
2241 | |
2242 | g_assert (CTK_IS_MENU_SHELL (menu_shell))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((menu_shell)); GType __t = ((ctk_menu_shell_get_type ())) ; gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0) ); else __r = g_type_check_instance_is_a (__inst, __t); __r; } ))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2242, ((const char*) (__func__)), "CTK_IS_MENU_SHELL (menu_shell)" ); } while (0); |
2243 | |
2244 | while (menu_shell && !CTK_IS_MENU_BAR (menu_shell)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (menu_shell)); GType __t = ((ctk_menu_bar_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) |
2245 | { |
2246 | if (CTK_IS_MENU (menu_shell)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (menu_shell)); GType __t = ((ctk_menu_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) && |
2247 | (attach = ctk_menu_get_attach_widget (CTK_MENU (menu_shell)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu_shell)), ((ctk_menu_get_type ())))))))) != NULL((void*)0)) |
2248 | menu_shell = CTK_MENU_SHELL (ctk_widget_get_parent (attach))((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_widget_get_parent (attach))), ((ctk_menu_shell_get_type ())))))); |
2249 | else |
2250 | menu_shell = NULL((void*)0); |
2251 | } |
2252 | |
2253 | return menu_shell ? CTK_WIDGET (menu_shell)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((menu_shell)), ((ctk_widget_get_type ())))))) : NULL((void*)0); |
2254 | } |
2255 | |
2256 | static void |
2257 | test_menus (void) |
2258 | { |
2259 | const gchar *buffer = |
2260 | "<interface>" |
2261 | " <object class=\"CtkWindow\" id=\"window1\">" |
2262 | " <accel-groups>" |
2263 | " <group name=\"accelgroup1\"/>" |
2264 | " </accel-groups>" |
2265 | " <child>" |
2266 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
2267 | " <property name=\"visible\">True</property>" |
2268 | " <property name=\"orientation\">vertical</property>" |
2269 | " <child>" |
2270 | " <object class=\"CtkMenuBar\" id=\"menubar1\">" |
2271 | " <property name=\"visible\">True</property>" |
2272 | " <child>" |
2273 | " <object class=\"CtkMenuItem\" id=\"menuitem1\">" |
2274 | " <property name=\"visible\">True</property>" |
2275 | " <property name=\"label\" translatable=\"yes\">_File</property>" |
2276 | " <property name=\"use_underline\">True</property>" |
2277 | " <child type=\"submenu\">" |
2278 | " <object class=\"CtkMenu\" id=\"menu1\">" |
2279 | " <property name=\"visible\">True</property>" |
2280 | " <child>" |
2281 | " <object class=\"CtkImageMenuItem\" id=\"imagemenuitem1\">" |
2282 | " <property name=\"label\">ctk-new</property>" |
2283 | " <property name=\"visible\">True</property>" |
2284 | " <property name=\"use_stock\">True</property>" |
2285 | " <property name=\"accel_group\">accelgroup1</property>" |
2286 | " </object>" |
2287 | " </child>" |
2288 | " </object>" |
2289 | " </child>" |
2290 | " </object>" |
2291 | " </child>" |
2292 | " </object>" |
2293 | " </child>" |
2294 | " </object>" |
2295 | " </child>" |
2296 | " </object>" |
2297 | "<object class=\"CtkAccelGroup\" id=\"accelgroup1\"/>" |
2298 | "</interface>"; |
2299 | |
2300 | const gchar *buffer1 = |
2301 | "<interface>" |
2302 | " <object class=\"CtkWindow\" id=\"window1\">" |
2303 | " <accel-groups>" |
2304 | " <group name=\"accelgroup1\"/>" |
2305 | " </accel-groups>" |
2306 | " <child>" |
2307 | " <object class=\"CtkVBox\" id=\"vbox1\">" |
2308 | " <property name=\"visible\">True</property>" |
2309 | " <property name=\"orientation\">vertical</property>" |
2310 | " <child>" |
2311 | " <object class=\"CtkMenuBar\" id=\"menubar1\">" |
2312 | " <property name=\"visible\">True</property>" |
2313 | " <child>" |
2314 | " <object class=\"CtkImageMenuItem\" id=\"imagemenuitem1\">" |
2315 | " <property name=\"visible\">True</property>" |
2316 | " <child>" |
2317 | " <object class=\"CtkLabel\" id=\"custom1\">" |
2318 | " <property name=\"visible\">True</property>" |
2319 | " <property name=\"label\">a label</property>" |
2320 | " </object>" |
2321 | " </child>" |
2322 | " </object>" |
2323 | " </child>" |
2324 | " </object>" |
2325 | " </child>" |
2326 | " </object>" |
2327 | " </child>" |
2328 | " </object>" |
2329 | "<object class=\"CtkAccelGroup\" id=\"accelgroup1\"/>" |
2330 | "</interface>"; |
2331 | CtkBuilder *builder; |
2332 | CtkWidget *child; |
2333 | CtkWidget *window, *item; |
2334 | CtkAccelGroup *accel_group; |
2335 | CtkWidget *item_accel_label, *sample_accel_label, *sample_menu_item, *custom; |
2336 | |
2337 | /* Check that the item has the correct accel label string set |
2338 | */ |
2339 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2340 | window = (CtkWidget *)ctk_builder_get_object (builder, "window1"); |
2341 | item = (CtkWidget *)ctk_builder_get_object (builder, "imagemenuitem1"); |
2342 | accel_group = (CtkAccelGroup *)ctk_builder_get_object (builder, "accelgroup1"); |
2343 | |
2344 | ctk_widget_show_all (window); |
2345 | |
2346 | sample_menu_item = ctk_image_menu_item_new_from_stock (CTK_STOCK_NEW((CtkStock)"ctk-new"), accel_group); |
2347 | |
2348 | child = ctk_bin_get_child (CTK_BIN (sample_menu_item)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sample_menu_item)), ((ctk_bin_get_type ()))))))); |
2349 | g_assert (child)do { if (child) ; else g_assertion_message_expr (((gchar*) 0) , "builder.c", 2349, ((const char*) (__func__)), "child"); } while (0); |
2350 | g_assert (CTK_IS_ACCEL_LABEL (child))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((child)); GType __t = ((ctk_accel_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2350, ( (const char*) (__func__)), "CTK_IS_ACCEL_LABEL (child)"); } while (0); |
2351 | sample_accel_label = child; |
2352 | ctk_widget_show (sample_accel_label); |
2353 | |
2354 | child = ctk_bin_get_child (CTK_BIN (item)((((CtkBin*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((item)), ((ctk_bin_get_type ()))))))); |
2355 | g_assert (child)do { if (child) ; else g_assertion_message_expr (((gchar*) 0) , "builder.c", 2355, ((const char*) (__func__)), "child"); } while (0); |
2356 | g_assert (CTK_IS_ACCEL_LABEL (child))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((child)); GType __t = ((ctk_accel_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2356, ( (const char*) (__func__)), "CTK_IS_ACCEL_LABEL (child)"); } while (0); |
2357 | item_accel_label = child; |
2358 | |
2359 | ctk_accel_label_refetch (CTK_ACCEL_LABEL (sample_accel_label)((((CtkAccelLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((sample_accel_label)), ((ctk_accel_label_get_type ()))))) )); |
2360 | ctk_accel_label_refetch (CTK_ACCEL_LABEL (item_accel_label)((((CtkAccelLabel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((item_accel_label)), ((ctk_accel_label_get_type ()))))))); |
2361 | |
2362 | g_assert (ctk_label_get_text (CTK_LABEL (sample_accel_label)) != NULL)do { if (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((sample_accel_label)), ((ctk_label_get_type ()))))))) != ((void*)0)) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2362, ((const char*) (__func__)), "ctk_label_get_text (CTK_LABEL (sample_accel_label)) != NULL" ); } while (0); |
2363 | g_assert (ctk_label_get_text (CTK_LABEL (item_accel_label)) != NULL)do { if (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((item_accel_label)), ((ctk_label_get_type ()))))))) != ((void*)0)) ; else g_assertion_message_expr ((( gchar*) 0), "builder.c", 2363, ((const char*) (__func__)), "ctk_label_get_text (CTK_LABEL (item_accel_label)) != NULL" ); } while (0); |
2364 | g_assert (strcmp (ctk_label_get_text (CTK_LABEL (item_accel_label)),do { if (strcmp (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((item_accel_label)), ((ctk_label_get_type ()))))))), ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((sample_accel_label)), ((ctk_label_get_type ())))))))) == 0) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 2365, ((const char*) (__func__)), "strcmp (ctk_label_get_text (CTK_LABEL (item_accel_label)), ctk_label_get_text (CTK_LABEL (sample_accel_label))) == 0" ); } while (0) |
2365 | ctk_label_get_text (CTK_LABEL (sample_accel_label))) == 0)do { if (strcmp (ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((item_accel_label)), ((ctk_label_get_type ()))))))), ctk_label_get_text (((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((sample_accel_label)), ((ctk_label_get_type ())))))))) == 0) ; else g_assertion_message_expr (((gchar*) 0 ), "builder.c", 2365, ((const char*) (__func__)), "strcmp (ctk_label_get_text (CTK_LABEL (item_accel_label)), ctk_label_get_text (CTK_LABEL (sample_accel_label))) == 0" ); } while (0); |
2366 | |
2367 | /* Check the menu hierarchy worked here */ |
2368 | g_assert (get_parent_menubar (item))do { if (get_parent_menubar (item)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2368, ((const char*) (__func__)) , "get_parent_menubar (item)"); } while (0); |
2369 | |
2370 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
2371 | ctk_widget_destroy (sample_menu_item); |
2372 | g_object_unref (builder); |
2373 | |
2374 | |
2375 | /* Check that we can add alien children to menu items via normal |
2376 | * CtkContainer apis. |
2377 | */ |
2378 | builder = builder_new_from_string (buffer1, -1, NULL((void*)0)); |
2379 | window = (CtkWidget *)ctk_builder_get_object (builder, "window1"); |
2380 | item = (CtkWidget *)ctk_builder_get_object (builder, "imagemenuitem1"); |
2381 | custom = (CtkWidget *)ctk_builder_get_object (builder, "custom1"); |
2382 | |
2383 | g_assert (ctk_widget_get_parent (custom) == item)do { if (ctk_widget_get_parent (custom) == item) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2383, ((const char*) (__func__)) , "ctk_widget_get_parent (custom) == item"); } while (0); |
2384 | |
2385 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
2386 | g_object_unref (builder); |
2387 | } |
2388 | |
2389 | static void |
2390 | test_file (const gchar *filename) |
2391 | { |
2392 | CtkBuilder *builder; |
2393 | GError *error = NULL((void*)0); |
2394 | GSList *l, *objects; |
2395 | |
2396 | builder = ctk_builder_new (); |
2397 | |
2398 | if (!ctk_builder_add_from_file (builder, filename, &error)) |
2399 | { |
2400 | g_error ("%s", error->message); |
2401 | g_error_free (error); |
2402 | return; |
2403 | } |
2404 | |
2405 | objects = ctk_builder_get_objects (builder); |
2406 | for (l = objects; l; l = l->next) |
2407 | { |
2408 | GObject *obj = (GObject*)l->data; |
2409 | |
2410 | if (CTK_IS_DIALOG (obj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (obj)); GType __t = ((ctk_dialog_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) |
2411 | { |
2412 | g_print ("Running dialog %s.\n", |
2413 | ctk_widget_get_name (CTK_WIDGET (obj)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_widget_get_type ())))))))); |
2414 | ctk_dialog_run (CTK_DIALOG (obj)((((CtkDialog*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_dialog_get_type ()))))))); |
2415 | } |
2416 | else if (CTK_IS_WINDOW (obj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (obj)); GType __t = ((ctk_window_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) |
2417 | { |
2418 | g_signal_connect (obj, "destroy", G_CALLBACK (ctk_main_quit), NULL)g_signal_connect_data ((obj), ("destroy"), (((GCallback) (ctk_main_quit ))), (((void*)0)), ((void*)0), (GConnectFlags) 0); |
2419 | g_print ("Showing %s.\n", |
2420 | ctk_widget_get_name (CTK_WIDGET (obj)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_widget_get_type ())))))))); |
2421 | ctk_widget_show_all (CTK_WIDGET (obj)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_widget_get_type ()))))))); |
2422 | } |
2423 | } |
2424 | |
2425 | ctk_main (); |
2426 | |
2427 | g_object_unref (builder); |
2428 | } |
2429 | |
2430 | static void |
2431 | test_message_area (void) |
2432 | { |
2433 | CtkBuilder *builder; |
2434 | GObject *obj, *obj1; |
2435 | const gchar buffer[] = |
2436 | "<interface>" |
2437 | " <object class=\"CtkInfoBar\" id=\"infobar1\">" |
2438 | " <child internal-child=\"content_area\">" |
2439 | " <object class=\"CtkHBox\" id=\"contentarea1\">" |
2440 | " <child>" |
2441 | " <object class=\"CtkLabel\" id=\"content\">" |
2442 | " <property name=\"label\" translatable=\"yes\">Message</property>" |
2443 | " </object>" |
2444 | " <packing>" |
2445 | " <property name='expand'>False</property>" |
2446 | " </packing>" |
2447 | " </child>" |
2448 | " </object>" |
2449 | " </child>" |
2450 | " <child internal-child=\"action_area\">" |
2451 | " <object class=\"CtkVButtonBox\" id=\"actionarea1\">" |
2452 | " <child>" |
2453 | " <object class=\"CtkButton\" id=\"button_ok\">" |
2454 | " <property name=\"label\">ctk-ok</property>" |
2455 | " <property name=\"use-stock\">yes</property>" |
2456 | " </object>" |
2457 | " </child>" |
2458 | " </object>" |
2459 | " </child>" |
2460 | " <action-widgets>" |
2461 | " <action-widget response=\"1\">button_ok</action-widget>" |
2462 | " </action-widgets>" |
2463 | " </object>" |
2464 | "</interface>"; |
2465 | |
2466 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2467 | obj = ctk_builder_get_object (builder, "infobar1"); |
2468 | g_assert (CTK_IS_INFO_BAR (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_info_bar_get_type())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2468, ( (const char*) (__func__)), "CTK_IS_INFO_BAR (obj)"); } while ( 0); |
2469 | obj1 = ctk_builder_get_object (builder, "content"); |
2470 | g_assert (CTK_IS_LABEL (obj1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj1)); GType __t = ((ctk_label_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2470, ( (const char*) (__func__)), "CTK_IS_LABEL (obj1)"); } while (0 ); |
2471 | |
2472 | obj1 = ctk_builder_get_object (builder, "button_ok"); |
2473 | g_assert (CTK_IS_BUTTON (obj1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj1)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2473, ( (const char*) (__func__)), "CTK_IS_BUTTON (obj1)"); } while ( 0); |
2474 | |
2475 | g_object_unref (builder); |
2476 | } |
2477 | |
2478 | static void |
2479 | test_gmenu (void) |
2480 | { |
2481 | CtkBuilder *builder; |
2482 | GObject *obj, *obj1; |
2483 | const gchar buffer[] = |
2484 | "<interface>" |
2485 | " <object class=\"CtkWindow\" id=\"window\">" |
2486 | " </object>" |
2487 | " <menu id='edit-menu'>" |
2488 | " <section>" |
2489 | " <item>" |
2490 | " <attribute name='label'>Undo</attribute>" |
2491 | " <attribute name='action'>undo</attribute>" |
2492 | " </item>" |
2493 | " <item>" |
2494 | " <attribute name='label'>Redo</attribute>" |
2495 | " <attribute name='action'>redo</attribute>" |
2496 | " </item>" |
2497 | " </section>" |
2498 | " <section></section>" |
2499 | " <section>" |
2500 | " <attribute name='label'>Copy & Paste</attribute>" |
2501 | " <item>" |
2502 | " <attribute name='label'>Cut</attribute>" |
2503 | " <attribute name='action'>cut</attribute>" |
2504 | " </item>" |
2505 | " <item>" |
2506 | " <attribute name='label'>Copy</attribute>" |
2507 | " <attribute name='action'>copy</attribute>" |
2508 | " </item>" |
2509 | " <item>" |
2510 | " <attribute name='label'>Paste</attribute>" |
2511 | " <attribute name='action'>paste</attribute>" |
2512 | " </item>" |
2513 | " </section>" |
2514 | " <item><link name='section' id='blargh'>" |
2515 | " <item>" |
2516 | " <attribute name='label'>Bold</attribute>" |
2517 | " <attribute name='action'>bold</attribute>" |
2518 | " </item>" |
2519 | " <submenu>" |
2520 | " <attribute name='label'>Language</attribute>" |
2521 | " <item>" |
2522 | " <attribute name='label'>Latin</attribute>" |
2523 | " <attribute name='action'>lang</attribute>" |
2524 | " <attribute name='target'>'latin'</attribute>" |
2525 | " </item>" |
2526 | " <item>" |
2527 | " <attribute name='label'>Greek</attribute>" |
2528 | " <attribute name='action'>lang</attribute>" |
2529 | " <attribute name='target'>'greek'</attribute>" |
2530 | " </item>" |
2531 | " <item>" |
2532 | " <attribute name='label'>Urdu</attribute>" |
2533 | " <attribute name='action'>lang</attribute>" |
2534 | " <attribute name='target'>'urdu'</attribute>" |
2535 | " </item>" |
2536 | " </submenu>" |
2537 | " </link></item>" |
2538 | " </menu>" |
2539 | "</interface>"; |
2540 | |
2541 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2542 | obj = ctk_builder_get_object (builder, "window"); |
2543 | g_assert (CTK_IS_WINDOW (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_window_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2543, ( (const char*) (__func__)), "CTK_IS_WINDOW (obj)"); } while (0 ); |
2544 | obj1 = ctk_builder_get_object (builder, "edit-menu"); |
2545 | g_assert (G_IS_MENU_MODEL (obj1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj1)); GType __t = ((g_menu_model_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2545, ( (const char*) (__func__)), "G_IS_MENU_MODEL (obj1)"); } while (0); |
2546 | obj1 = ctk_builder_get_object (builder, "blargh"); |
2547 | g_assert (G_IS_MENU_MODEL (obj1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj1)); GType __t = ((g_menu_model_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2547, ( (const char*) (__func__)), "G_IS_MENU_MODEL (obj1)"); } while (0); |
2548 | g_object_unref (builder); |
2549 | } |
2550 | |
2551 | static void |
2552 | test_level_bar (void) |
2553 | { |
2554 | CtkBuilder *builder; |
2555 | GError *error = NULL((void*)0); |
2556 | GObject *obj, *obj1; |
2557 | const gchar buffer1[] = |
2558 | "<interface>" |
2559 | " <object class=\"CtkWindow\" id=\"window\">" |
2560 | " <child>" |
2561 | " <object class=\"CtkLevelBar\" id=\"levelbar\">" |
2562 | " <property name=\"value\">4.70</property>" |
2563 | " <property name=\"min-value\">2</property>" |
2564 | " <property name=\"max-value\">5</property>" |
2565 | " <offsets>" |
2566 | " <offset name=\"low\" value=\"2.25\"/>" |
2567 | " <offset name=\"custom\" value=\"3\"/>" |
2568 | " <offset name=\"high\" value=\"3\"/>" |
2569 | " </offsets>" |
2570 | " </object>" |
2571 | " </child>" |
2572 | " </object>" |
2573 | "</interface>"; |
2574 | const gchar buffer2[] = |
2575 | "<interface>" |
2576 | " <object class=\"CtkLevelBar\" id=\"levelbar\">" |
2577 | " <offsets>" |
2578 | " <offset name=\"low\" bogus_attr=\"foo\"/>" |
2579 | " </offsets>" |
2580 | " </object>" |
2581 | "</interface>"; |
2582 | const gchar buffer3[] = |
2583 | "<interface>" |
2584 | " <object class=\"CtkLevelBar\" id=\"levelbar\">" |
2585 | " <offsets>" |
2586 | " <offset name=\"low\" value=\"1\"/>" |
2587 | " </offsets>" |
2588 | " <bogus_tag>" |
2589 | " </bogus_tag>" |
2590 | " </object>" |
2591 | "</interface>"; |
2592 | |
2593 | builder = ctk_builder_new (); |
2594 | ctk_builder_add_from_string (builder, buffer1, -1, &error); |
2595 | g_assert (error == NULL)do { if (error == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2595, ((const char*) (__func__)) , "error == NULL"); } while (0); |
2596 | |
2597 | obj = ctk_builder_get_object (builder, "window"); |
2598 | g_assert (CTK_IS_WINDOW (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_window_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2598, ( (const char*) (__func__)), "CTK_IS_WINDOW (obj)"); } while (0 ); |
2599 | obj1 = ctk_builder_get_object (builder, "levelbar"); |
2600 | g_assert (CTK_IS_LEVEL_BAR (obj1))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj1)); GType __t = ((ctk_level_bar_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2600, ( (const char*) (__func__)), "CTK_IS_LEVEL_BAR (obj1)"); } while (0); |
2601 | g_object_unref (builder); |
2602 | |
2603 | error = NULL((void*)0); |
2604 | builder = ctk_builder_new (); |
2605 | ctk_builder_add_from_string (builder, buffer2, -1, &error); |
2606 | g_assert_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_MISSING_ATTRIBUTE)do { if (!error || (error)->domain != g_markup_error_quark () || (error)->code != G_MARKUP_ERROR_MISSING_ATTRIBUTE) g_assertion_message_error (((gchar*) 0), "builder.c", 2606, ((const char*) (__func__)) , "error", error, g_markup_error_quark (), G_MARKUP_ERROR_MISSING_ATTRIBUTE ); } while (0); |
2607 | g_error_free (error); |
2608 | g_object_unref (builder); |
2609 | |
2610 | error = NULL((void*)0); |
2611 | builder = ctk_builder_new (); |
2612 | ctk_builder_add_from_string (builder, buffer3, -1, &error); |
2613 | g_assert_error (error, CTK_BUILDER_ERROR, CTK_BUILDER_ERROR_UNHANDLED_TAG)do { if (!error || (error)->domain != (ctk_builder_error_quark ()) || (error)->code != CTK_BUILDER_ERROR_UNHANDLED_TAG) g_assertion_message_error (((gchar*) 0), "builder.c", 2613, ((const char*) (__func__)) , "error", error, (ctk_builder_error_quark ()), CTK_BUILDER_ERROR_UNHANDLED_TAG ); } while (0); |
2614 | g_error_free (error); |
2615 | g_object_unref (builder); |
2616 | } |
2617 | |
2618 | static GObject *external_object = NULL((void*)0), *external_object_swapped = NULL((void*)0); |
2619 | |
2620 | G_MODULE_EXPORT__attribute__((visibility("default"))) void |
2621 | on_button_clicked (CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__)), |
2622 | GObject *data) |
2623 | { |
2624 | external_object = data; |
2625 | } |
2626 | |
2627 | G_MODULE_EXPORT__attribute__((visibility("default"))) void |
2628 | on_button_clicked_swapped (GObject *data, |
2629 | CtkButton *button G_GNUC_UNUSED__attribute__ ((__unused__))) |
2630 | { |
2631 | external_object_swapped = data; |
2632 | } |
2633 | |
2634 | static void |
2635 | test_expose_object (void) |
2636 | { |
2637 | CtkBuilder *builder; |
2638 | GError *error = NULL((void*)0); |
2639 | CtkWidget *image; |
2640 | GObject *obj; |
2641 | const gchar buffer[] = |
2642 | "<interface>" |
2643 | " <object class=\"CtkButton\" id=\"button\">" |
2644 | " <property name=\"image\">external_image</property>" |
2645 | " <signal name=\"clicked\" handler=\"on_button_clicked\" object=\"builder\" swapped=\"no\"/>" |
2646 | " <signal name=\"clicked\" handler=\"on_button_clicked_swapped\" object=\"builder\"/>" |
2647 | " </object>" |
2648 | "</interface>"; |
2649 | |
2650 | image = ctk_image_new (); |
2651 | builder = ctk_builder_new (); |
2652 | ctk_builder_expose_object (builder, "external_image", G_OBJECT (image)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((image)), (((GType) ((20) << (2))))))))); |
2653 | ctk_builder_expose_object (builder, "builder", G_OBJECT (builder)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((builder)), (((GType) ((20) << (2))))))))); |
2654 | ctk_builder_add_from_string (builder, buffer, -1, &error); |
2655 | g_assert (error == NULL)do { if (error == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2655, ((const char*) (__func__)) , "error == NULL"); } while (0); |
2656 | |
2657 | obj = ctk_builder_get_object (builder, "button"); |
2658 | g_assert (CTK_IS_BUTTON (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_button_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2658, ( (const char*) (__func__)), "CTK_IS_BUTTON (obj)"); } while (0 ); |
2659 | |
2660 | g_assert (ctk_button_get_image (CTK_BUTTON (obj)) == image)do { if (ctk_button_get_image (((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((obj)), ((ctk_button_get_type ()))))))) == image) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2660, ((const char*) (__func__)), "ctk_button_get_image (CTK_BUTTON (obj)) == image" ); } while (0); |
2661 | |
2662 | /* Connect signals and fake clicked event */ |
2663 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
2664 | ctk_button_clicked (CTK_BUTTON (obj)((((CtkButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_button_get_type ()))))))); |
2665 | |
2666 | g_assert (external_object == G_OBJECT (builder))do { if (external_object == ((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((builder)), (((GType) ((20) << (2)) ))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2666, ((const char*) (__func__)), "external_object == G_OBJECT (builder)" ); } while (0); |
2667 | g_assert (external_object_swapped == G_OBJECT (builder))do { if (external_object_swapped == ((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((builder)), (((GType) ((20) << (2)) ))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2667, ((const char*) (__func__)), "external_object_swapped == G_OBJECT (builder)" ); } while (0); |
2668 | |
2669 | g_object_unref (builder); |
2670 | g_object_unref (image); |
2671 | } |
2672 | |
2673 | static void |
2674 | test_no_ids (void) |
2675 | { |
2676 | CtkBuilder *builder; |
2677 | GError *error = NULL((void*)0); |
2678 | GObject *obj; |
2679 | const gchar buffer[] = |
2680 | "<interface>" |
2681 | " <object class=\"CtkInfoBar\">" |
2682 | " <child internal-child=\"content_area\">" |
2683 | " <object class=\"CtkHBox\">" |
2684 | " <child>" |
2685 | " <object class=\"CtkLabel\">" |
2686 | " <property name=\"label\" translatable=\"yes\">Message</property>" |
2687 | " </object>" |
2688 | " <packing>" |
2689 | " <property name='expand'>False</property>" |
2690 | " </packing>" |
2691 | " </child>" |
2692 | " </object>" |
2693 | " </child>" |
2694 | " <child internal-child=\"action_area\">" |
2695 | " <object class=\"CtkVButtonBox\">" |
2696 | " <child>" |
2697 | " <object class=\"CtkButton\" id=\"button_ok\">" |
2698 | " <property name=\"label\">ctk-ok</property>" |
2699 | " <property name=\"use-stock\">yes</property>" |
2700 | " </object>" |
2701 | " </child>" |
2702 | " </object>" |
2703 | " </child>" |
2704 | " <action-widgets>" |
2705 | " <action-widget response=\"1\">button_ok</action-widget>" |
2706 | " </action-widgets>" |
2707 | " </object>" |
2708 | "</interface>"; |
2709 | |
2710 | builder = ctk_builder_new (); |
2711 | ctk_builder_add_from_string (builder, buffer, -1, &error); |
2712 | g_assert (error == NULL)do { if (error == ((void*)0)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2712, ((const char*) (__func__)) , "error == NULL"); } while (0); |
2713 | |
2714 | obj = ctk_builder_get_object (builder, "button_ok"); |
2715 | g_assert (CTK_IS_BUTTON (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_button_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2715, ( (const char*) (__func__)), "CTK_IS_BUTTON (obj)"); } while (0 ); |
2716 | |
2717 | g_object_unref (builder); |
2718 | } |
2719 | |
2720 | static void |
2721 | test_property_bindings (void) |
2722 | { |
2723 | const gchar *buffer = |
2724 | "<interface>" |
2725 | " <object class=\"CtkWindow\" id=\"window\">" |
2726 | " <child>" |
2727 | " <object class=\"CtkVBox\" id=\"vbox\">" |
2728 | " <property name=\"visible\">True</property>" |
2729 | " <property name=\"orientation\">vertical</property>" |
2730 | " <child>" |
2731 | " <object class=\"CtkCheckButton\" id=\"checkbutton\">" |
2732 | " <property name=\"active\">false</property>" |
2733 | " </object>" |
2734 | " </child>" |
2735 | " <child>" |
2736 | " <object class=\"CtkButton\" id=\"button\">" |
2737 | " <property name=\"sensitive\" bind-source=\"checkbutton\" bind-property=\"active\" bind-flags=\"sync-create\">false</property>" |
2738 | " </object>" |
2739 | " </child>" |
2740 | " <child>" |
2741 | " <object class=\"CtkButton\" id=\"button2\">" |
2742 | " <property name=\"sensitive\" bind-source=\"checkbutton\" bind-property=\"active\" />" |
2743 | " </object>" |
2744 | " </child>" |
2745 | " </object>" |
2746 | " </child>" |
2747 | " </object>" |
2748 | "</interface>"; |
2749 | |
2750 | CtkBuilder *builder; |
2751 | GObject *checkbutton, *button, *button2, *window; |
2752 | |
2753 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2754 | |
2755 | checkbutton = ctk_builder_get_object (builder, "checkbutton"); |
2756 | g_assert (CTK_IS_CHECK_BUTTON (checkbutton))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((checkbutton)); GType __t = ((ctk_check_button_get_type ( ))); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2756, ((const char*) (__func__)), "CTK_IS_CHECK_BUTTON (checkbutton)" ); } while (0); |
2757 | g_assert (!ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton)))do { if (!ctk_toggle_button_get_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((checkbutton )), ((ctk_toggle_button_get_type ())))))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2757, ((const char*) (__func__)) , "!ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (checkbutton))" ); } while (0); |
2758 | |
2759 | button = ctk_builder_get_object (builder, "button"); |
2760 | g_assert (CTK_IS_BUTTON (button))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((button)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2760, ( (const char*) (__func__)), "CTK_IS_BUTTON (button)"); } while (0); |
2761 | g_assert (!ctk_widget_get_sensitive (CTK_WIDGET (button)))do { if (!ctk_widget_get_sensitive (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), ((ctk_widget_get_type ())))))) )) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2761, ((const char*) (__func__)), "!ctk_widget_get_sensitive (CTK_WIDGET (button))" ); } while (0); |
2762 | |
2763 | button2 = ctk_builder_get_object (builder, "button2"); |
2764 | g_assert (CTK_IS_BUTTON (button2))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((button2)); GType __t = ((ctk_button_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2764, ( (const char*) (__func__)), "CTK_IS_BUTTON (button2)"); } while (0); |
2765 | g_assert (ctk_widget_get_sensitive (CTK_WIDGET (button2)))do { if (ctk_widget_get_sensitive (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button2)), ((ctk_widget_get_type ()))))) ))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2765, ((const char*) (__func__)), "ctk_widget_get_sensitive (CTK_WIDGET (button2))" ); } while (0); |
2766 | |
2767 | ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (checkbutton)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((checkbutton)), ((ctk_toggle_button_get_type ())))))), TRUE(!(0))); |
2768 | g_assert (ctk_widget_get_sensitive (CTK_WIDGET (button)))do { if (ctk_widget_get_sensitive (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button)), ((ctk_widget_get_type ())))))) )) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2768, ((const char*) (__func__)), "ctk_widget_get_sensitive (CTK_WIDGET (button))" ); } while (0); |
2769 | g_assert (ctk_widget_get_sensitive (CTK_WIDGET (button2)))do { if (ctk_widget_get_sensitive (((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((button2)), ((ctk_widget_get_type ()))))) ))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2769, ((const char*) (__func__)), "ctk_widget_get_sensitive (CTK_WIDGET (button2))" ); } while (0); |
2770 | |
2771 | window = ctk_builder_get_object (builder, "window"); |
2772 | ctk_widget_destroy (CTK_WIDGET (window)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((window)), ((ctk_widget_get_type ()))))))); |
2773 | g_object_unref (builder); |
2774 | } |
2775 | |
2776 | #define MY_CTK_GRID_TEMPLATE"<interface>\n <template class=\"MyCtkGrid\" parent=\"CtkGrid\">\n <property name=\"visible\">True</property>\n <child>\n <object class=\"CtkLabel\" id=\"label\">\n <property name=\"visible\">True</property>\n </object>\n </child>\n </template>\n</interface>\n" "\ |
2777 | <interface>\n\ |
2778 | <template class=\"MyCtkGrid\" parent=\"CtkGrid\">\n\ |
2779 | <property name=\"visible\">True</property>\n\ |
2780 | <child>\n\ |
2781 | <object class=\"CtkLabel\" id=\"label\">\n\ |
2782 | <property name=\"visible\">True</property>\n\ |
2783 | </object>\n\ |
2784 | </child>\n\ |
2785 | </template>\n\ |
2786 | </interface>\n" |
2787 | |
2788 | #define MY_TYPE_CTK_GRID(my_ctk_grid_get_type ()) (my_ctk_grid_get_type ()) |
2789 | #define MY_IS_CTK_GRID(obj)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (obj)); GType __t = ((my_ctk_grid_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MY_TYPE_CTK_GRID)((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ( (obj)); GType __t = ((my_ctk_grid_get_type ())); gboolean __r ; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))) |
2790 | |
2791 | typedef struct |
2792 | { |
2793 | CtkGridClass parent_class; |
2794 | } MyCtkGridClass; |
2795 | |
2796 | typedef struct |
2797 | { |
2798 | CtkLabel *label; |
2799 | } MyCtkGridPrivate; |
2800 | |
2801 | typedef struct |
2802 | { |
2803 | CtkGrid parent_instance; |
2804 | CtkLabel *label; |
2805 | MyCtkGridPrivate *priv; |
2806 | } MyCtkGrid; |
2807 | |
2808 | G_DEFINE_TYPE_WITH_PRIVATE (MyCtkGrid, my_ctk_grid, CTK_TYPE_GRID)static void my_ctk_grid_init (MyCtkGrid *self); static void my_ctk_grid_class_init (MyCtkGridClass *klass); static GType my_ctk_grid_get_type_once (void); static gpointer my_ctk_grid_parent_class = ((void*)0 ); static gint MyCtkGrid_private_offset; static void my_ctk_grid_class_intern_init (gpointer klass) { my_ctk_grid_parent_class = g_type_class_peek_parent (klass); if (MyCtkGrid_private_offset != 0) g_type_class_adjust_private_offset (klass, &MyCtkGrid_private_offset); my_ctk_grid_class_init ((MyCtkGridClass*) klass); } __attribute__ ((__unused__)) static inline gpointer my_ctk_grid_get_instance_private (MyCtkGrid * self) { return (((gpointer) ((guint8*) (self) + (glong) (MyCtkGrid_private_offset )))); } GType my_ctk_grid_get_type (void) { static GType static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); (void ) (0 ? (gpointer) * (&static_g_define_type_id) : ((void*) 0)); (!(__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id ) == sizeof (gpointer), "Expression evaluates to false"); __typeof__ (*(&static_g_define_type_id)) gapg_temp_newval; __typeof__ ((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id ); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5) ; gapg_temp_newval; })) && g_once_init_enter_pointer ( &static_g_define_type_id)); })) ) { GType g_define_type_id = my_ctk_grid_get_type_once (); (__extension__ ({ _Static_assert (sizeof *(&static_g_define_type_id) == sizeof (gpointer) , "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id ) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer ((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id )); })) ; } return static_g_define_type_id; } __attribute__ ( (__noinline__)) static GType my_ctk_grid_get_type_once (void) { GType g_define_type_id = g_type_register_static_simple ((ctk_grid_get_type ()), g_intern_static_string ("MyCtkGrid"), sizeof (MyCtkGridClass ), (GClassInitFunc)(void (*)(void)) my_ctk_grid_class_intern_init , sizeof (MyCtkGrid), (GInstanceInitFunc)(void (*)(void)) my_ctk_grid_init , (GTypeFlags) 0); { {{ MyCtkGrid_private_offset = g_type_add_instance_private (g_define_type_id, sizeof (MyCtkGridPrivate)); };} } return g_define_type_id ; }; |
2809 | |
2810 | static void |
2811 | my_ctk_grid_init (MyCtkGrid *grid) |
2812 | { |
2813 | grid->priv = my_ctk_grid_get_instance_private (grid); |
2814 | ctk_widget_init_template (CTK_WIDGET (grid)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((grid)), ((ctk_widget_get_type ()))))))); |
2815 | } |
2816 | |
2817 | static void |
2818 | my_ctk_grid_class_init (MyCtkGridClass *klass) |
2819 | { |
2820 | GBytes *template = g_bytes_new_static (MY_CTK_GRID_TEMPLATE"<interface>\n <template class=\"MyCtkGrid\" parent=\"CtkGrid\">\n <property name=\"visible\">True</property>\n <child>\n <object class=\"CtkLabel\" id=\"label\">\n <property name=\"visible\">True</property>\n </object>\n </child>\n </template>\n</interface>\n", strlen (MY_CTK_GRID_TEMPLATE"<interface>\n <template class=\"MyCtkGrid\" parent=\"CtkGrid\">\n <property name=\"visible\">True</property>\n <child>\n <object class=\"CtkLabel\" id=\"label\">\n <property name=\"visible\">True</property>\n </object>\n </child>\n </template>\n</interface>\n")); |
2821 | CtkWidgetClass *widget_class = CTK_WIDGET_CLASS (klass)((((CtkWidgetClass*) (void *) g_type_check_class_cast ((GTypeClass *) ((klass)), ((ctk_widget_get_type ())))))); |
2822 | |
2823 | ctk_widget_class_set_template (widget_class, template); |
2824 | ctk_widget_class_bind_template_child (widget_class, MyCtkGrid, label)ctk_widget_class_bind_template_child_full (widget_class, "label" , (0), ((glong) __builtin_offsetof(MyCtkGrid, label))); |
2825 | ctk_widget_class_bind_template_child_private (widget_class, MyCtkGrid, label)ctk_widget_class_bind_template_child_full (widget_class, "label" , (0), (MyCtkGrid_private_offset + (((glong) __builtin_offsetof (MyCtkGridPrivate, label))))); |
2826 | } |
2827 | |
2828 | static void |
2829 | test_template () |
2830 | { |
2831 | MyCtkGrid *my_ctk_grid; |
2832 | |
2833 | /* make sure the type we are trying to register does not exist */ |
2834 | g_assert (!g_type_from_name ("MyCtkGrid"))do { if (!g_type_from_name ("MyCtkGrid")) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2834, ((const char*) (__func__)) , "!g_type_from_name (\"MyCtkGrid\")"); } while (0); |
2835 | |
2836 | /* create the template object */ |
2837 | my_ctk_grid = g_object_new (MY_TYPE_CTK_GRID(my_ctk_grid_get_type ()), NULL((void*)0)); |
2838 | |
2839 | /* Check everything is fine */ |
2840 | g_assert (g_type_from_name ("MyCtkGrid"))do { if (g_type_from_name ("MyCtkGrid")) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2840, ((const char*) (__func__)) , "g_type_from_name (\"MyCtkGrid\")"); } while (0); |
2841 | g_assert (MY_IS_CTK_GRID (my_ctk_grid))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((my_ctk_grid)); GType __t = ((my_ctk_grid_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2841, ( (const char*) (__func__)), "MY_IS_CTK_GRID (my_ctk_grid)"); } while (0); |
2842 | g_assert (my_ctk_grid->label == my_ctk_grid->priv->label)do { if (my_ctk_grid->label == my_ctk_grid->priv->label ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2842, ((const char*) (__func__)), "my_ctk_grid->label == my_ctk_grid->priv->label" ); } while (0); |
2843 | g_assert (CTK_IS_LABEL (my_ctk_grid->label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((my_ctk_grid->label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2843, ((const char*) (__func__)), "CTK_IS_LABEL (my_ctk_grid->label)" ); } while (0); |
2844 | g_assert (CTK_IS_LABEL (my_ctk_grid->priv->label))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((my_ctk_grid->priv->label)); GType __t = ((ctk_label_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst-> g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c" , 2844, ((const char*) (__func__)), "CTK_IS_LABEL (my_ctk_grid->priv->label)" ); } while (0); |
2845 | } |
2846 | |
2847 | G_MODULE_EXPORT__attribute__((visibility("default"))) void |
2848 | on_cellrenderertoggle1_toggled (CtkCellRendererToggle *cell G_GNUC_UNUSED__attribute__ ((__unused__))) |
2849 | { |
2850 | } |
2851 | |
2852 | static void |
2853 | test_anaconda_signal (void) |
2854 | { |
2855 | CtkBuilder *builder; |
2856 | const gchar buffer[] = |
2857 | "<?xml version='1.0' encoding='UTF-8'?>" |
2858 | "<!-- Generated with glade 3.18.3 -->" |
2859 | "<interface>" |
2860 | " <requires lib='ctk+' version='3.12'/>" |
2861 | " <object class='CtkListStore' id='liststore1'>" |
2862 | " <columns>" |
2863 | " <!-- column-name use -->" |
2864 | " <column type='gboolean'/>" |
2865 | " </columns>" |
2866 | " </object>" |
2867 | " <object class='CtkWindow' id='window1'>" |
2868 | " <property name='can_focus'>False</property>" |
2869 | " <child>" |
2870 | " <object class='CtkTreeView' id='treeview1'>" |
2871 | " <property name='visible'>True</property>" |
2872 | " <property name='can_focus'>True</property>" |
2873 | " <property name='model'>liststore1</property>" |
2874 | " <child internal-child='selection'>" |
2875 | " <object class='CtkTreeSelection' id='treeview-selection1'/>" |
2876 | " </child>" |
2877 | " <child>" |
2878 | " <object class='CtkTreeViewColumn' id='treeviewcolumn1'>" |
2879 | " <property name='title' translatable='yes'>column</property>" |
2880 | " <child>" |
2881 | " <object class='CtkCellRendererToggle' id='cellrenderertoggle1'>" |
2882 | " <signal name='toggled' handler='on_cellrenderertoggle1_toggled' swapped='no'/>" |
2883 | " </object>" |
2884 | " <attributes>" |
2885 | " <attribute name='active'>0</attribute>" |
2886 | " </attributes>" |
2887 | " </child>" |
2888 | " </object>" |
2889 | " </child>" |
2890 | " </object>" |
2891 | " </child>" |
2892 | " </object>" |
2893 | "</interface>"; |
2894 | |
2895 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2896 | ctk_builder_connect_signals (builder, NULL((void*)0)); |
2897 | |
2898 | g_object_unref (builder); |
2899 | } |
2900 | |
2901 | static void |
2902 | test_file_filter (void) |
2903 | { |
2904 | CtkBuilder *builder; |
2905 | GObject *obj; |
2906 | CtkFileFilter *filter; |
2907 | CtkFileFilterInfo info; |
2908 | |
2909 | const gchar buffer[] = |
2910 | "<interface>" |
2911 | " <object class='CtkFileFilter' id='filter1'>" |
2912 | " <mime-types>" |
2913 | " <mime-type>text/plain</mime-type>" |
2914 | " <mime-type>image/*</mime-type>" |
2915 | " </mime-types>" |
2916 | " <patterns>" |
2917 | " <pattern>*.txt</pattern>" |
2918 | " <pattern>*.png</pattern>" |
2919 | " </patterns>" |
2920 | " </object>" |
2921 | "</interface>"; |
2922 | |
2923 | builder = builder_new_from_string (buffer, -1, NULL((void*)0)); |
2924 | obj = ctk_builder_get_object (builder, "filter1"); |
2925 | g_assert (CTK_IS_FILE_FILTER (obj))do { if ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance *) ((obj)); GType __t = ((ctk_file_filter_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2925, ( (const char*) (__func__)), "CTK_IS_FILE_FILTER (obj)"); } while (0); |
2926 | filter = CTK_FILE_FILTER (obj)((((CtkFileFilter*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((obj)), ((ctk_file_filter_get_type ())))))); |
2927 | g_assert_cmpstr (ctk_file_filter_get_name (filter), ==, "filter1")do { const char *__s1 = (ctk_file_filter_get_name (filter)), * __s2 = ("filter1"); if (g_strcmp0 (__s1, __s2) == 0) ; else g_assertion_message_cmpstr (((gchar*) 0), "builder.c", 2927, ((const char*) (__func__)) , "ctk_file_filter_get_name (filter)" " " "==" " " "\"filter1\"" , __s1, "==", __s2); } while (0); |
2928 | g_assert (ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_MIME_TYPE)do { if (ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_MIME_TYPE ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2928, ((const char*) (__func__)), "ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_MIME_TYPE" ); } while (0); |
2929 | g_assert (ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_DISPLAY_NAME)do { if (ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_DISPLAY_NAME ) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2929, ((const char*) (__func__)), "ctk_file_filter_get_needed (filter) & CTK_FILE_FILTER_DISPLAY_NAME" ); } while (0); |
2930 | |
2931 | info.filename = "test1.txt"; |
2932 | info.display_name = "test1.txt"; |
2933 | info.contains = CTK_FILE_FILTER_FILENAME | CTK_FILE_FILTER_DISPLAY_NAME; |
2934 | g_assert (ctk_file_filter_filter (filter, &info))do { if (ctk_file_filter_filter (filter, &info)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2934, ((const char*) (__func__)) , "ctk_file_filter_filter (filter, &info)"); } while (0); |
2935 | |
2936 | info.mime_type = "application/x-pdf"; |
2937 | info.contains = CTK_FILE_FILTER_MIME_TYPE; |
2938 | g_assert (!ctk_file_filter_filter (filter, &info))do { if (!ctk_file_filter_filter (filter, &info)) ; else g_assertion_message_expr (((gchar*) 0), "builder.c", 2938, ((const char*) (__func__)) , "!ctk_file_filter_filter (filter, &info)"); } while (0); |
2939 | |
2940 | g_object_unref (builder); |
2941 | } |
2942 | |
2943 | int |
2944 | main (int argc, char **argv) |
2945 | { |
2946 | /* initialize test program */ |
2947 | ctk_test_init (&argc, &argv); |
2948 | |
2949 | if (argc > 1) |
2950 | { |
2951 | test_file (argv[1]); |
2952 | return 0; |
2953 | } |
2954 | |
2955 | g_test_add_func ("/Builder/Parser", test_parser); |
2956 | g_test_add_func ("/Builder/Types", test_types); |
2957 | g_test_add_func ("/Builder/Construct-Only Properties", test_construct_only_property); |
2958 | g_test_add_func ("/Builder/Children", test_children); |
2959 | g_test_add_func ("/Builder/Child Properties", test_child_properties); |
2960 | g_test_add_func ("/Builder/Object Properties", test_object_properties); |
2961 | g_test_add_func ("/Builder/Notebook", test_notebook); |
2962 | g_test_add_func ("/Builder/Domain", test_domain); |
2963 | g_test_add_func ("/Builder/Signal Autoconnect", test_connect_signals); |
2964 | g_test_add_func ("/Builder/UIManager Simple", test_uimanager_simple); |
2965 | g_test_add_func ("/Builder/Spin Button", test_spin_button); |
2966 | g_test_add_func ("/Builder/SizeGroup", test_sizegroup); |
2967 | g_test_add_func ("/Builder/ListStore", test_list_store); |
2968 | g_test_add_func ("/Builder/TreeStore", test_tree_store); |
2969 | g_test_add_func ("/Builder/TreeView Column", test_treeview_column); |
2970 | g_test_add_func ("/Builder/IconView", test_icon_view); |
2971 | g_test_add_func ("/Builder/ComboBox", test_combo_box); |
2972 | #if 0 |
2973 | g_test_add_func ("/Builder/ComboBox Entry", test_combo_box_entry); |
2974 | #endif |
2975 | g_test_add_func ("/Builder/CellView", test_cell_view); |
2976 | g_test_add_func ("/Builder/Dialog", test_dialog); |
2977 | g_test_add_func ("/Builder/Accelerators", test_accelerators); |
2978 | g_test_add_func ("/Builder/Widget", test_widget); |
2979 | g_test_add_func ("/Builder/Value From String", test_value_from_string); |
2980 | g_test_add_func ("/Builder/Reference Counting", test_reference_counting); |
2981 | g_test_add_func ("/Builder/Window", test_window); |
2982 | g_test_add_func ("/Builder/IconFactory", test_icon_factory); |
2983 | g_test_add_func ("/Builder/PangoAttributes", test_pango_attributes); |
2984 | g_test_add_func ("/Builder/Requires", test_requires); |
2985 | g_test_add_func ("/Builder/AddObjects", test_add_objects); |
2986 | g_test_add_func ("/Builder/Menus", test_menus); |
2987 | g_test_add_func ("/Builder/MessageArea", test_message_area); |
2988 | g_test_add_func ("/Builder/MessageDialog", test_message_dialog); |
2989 | g_test_add_func ("/Builder/GMenu", test_gmenu); |
2990 | g_test_add_func ("/Builder/LevelBar", test_level_bar); |
2991 | g_test_add_func ("/Builder/Expose Object", test_expose_object); |
2992 | g_test_add_func ("/Builder/Template", test_template); |
2993 | g_test_add_func ("/Builder/No IDs", test_no_ids); |
2994 | g_test_add_func ("/Builder/Property Bindings", test_property_bindings); |
2995 | g_test_add_func ("/Builder/anaconda-signal", test_anaconda_signal); |
2996 | g_test_add_func ("/Builder/FileFilter", test_file_filter); |
2997 | |
2998 | return g_test_run(); |
2999 | } |
3000 |