]> Pileus Git - ~andy/gtk/blob - gtk/gtktestutils.c
Include "config.h" instead of <config.h> Command used: find -name
[~andy/gtk] / gtk / gtktestutils.c
1 /* Gtk+ testing utilities
2  * Copyright (C) 2007 Imendio AB
3  * Authors: Tim Janik
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 /* need to get the prototypes of all get_type functions */
22 #define GTK_ENABLE_BROKEN
23 #undef GTK_DISABLE_DEPRECATED
24
25 #include "config.h"
26
27 #include <gtk/gtk.h>
28 #include "gtkalias.h"
29
30 #include <locale.h>
31 #include <string.h>
32 #include <math.h>
33
34
35 /* --- test utilities --- */
36 /**
37  * gtk_test_init:
38  * @argcp: Address of the <parameter>argc</parameter> parameter of the
39  *        main() function. Changed if any arguments were handled.
40  * @argvp: Address of the <parameter>argv</parameter> parameter of main().
41  *        Any parameters understood by g_test_init() or gtk_init() are
42  *        stripped before return.
43  *
44  * This function is used to initialize a Gtk+ test program.
45  * It will in turn call g_test_init() and gtk_init() to properly
46  * initialize the testing framework and graphical toolkit.
47  * It'll also set the program's locale to "C" and prevent loading of
48  * rc files and Gtk+ modules. This is done to make tets program
49  * environments as deterministic as possible.
50  * Like gtk_init() and g_test_init(), any known arguments will be
51  * processed and stripped from @argc and @argv.
52  **/
53 void
54 gtk_test_init (int    *argcp,
55                char ***argvp,
56                ...)
57 {
58   g_test_init (argcp, argvp, NULL);
59   /* - enter C locale
60    * - call g_test_init();
61    * - call gtk_init();
62    * - prevent RC files from loading;
63    * - prevent Gtk modules from loading;
64    * - supply mock object for GtkSettings
65    * FUTURE TODO:
66    * - this function could install a mock object around GtkSettings
67    */
68   g_setenv ("GTK_MODULES", "", TRUE);
69   g_setenv ("GTK2_RC_FILES", "/dev/null", TRUE);
70   gtk_disable_setlocale();
71   setlocale (LC_ALL, "C");
72   g_test_bug_base ("http://bugzilla.gnome.org/show_bug.cgi?id=%s");
73   gtk_init (argcp, argvp);
74 }
75
76 static GSList*
77 test_find_widget_input_windows (GtkWidget *widget,
78                                 gboolean   input_only)
79 {
80   GList *node, *children;
81   GSList *matches = NULL;
82   gpointer udata;
83   gdk_window_get_user_data (widget->window, &udata);
84   if (udata == widget && (!input_only || (GDK_IS_WINDOW (widget->window) && GDK_WINDOW_OBJECT (widget->window)->input_only)))
85     matches = g_slist_prepend (matches, widget->window);
86   children = gdk_window_get_children (gtk_widget_get_parent_window (widget));
87   for (node = children; node; node = node->next)
88     {
89       gdk_window_get_user_data (node->data, &udata);
90       if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && GDK_WINDOW_OBJECT (node->data)->input_only)))
91         matches = g_slist_prepend (matches, node->data);
92     }
93   return g_slist_reverse (matches);
94 }
95
96 /**
97  * gtk_test_widget_send_key
98  * @widget: Widget to generate a key press and release on.
99  * @keyval: A Gdk keyboard value.
100  * @modifiers: Keyboard modifiers the event is setup with.
101  *
102  * This function will generate keyboard press and release events in
103  * the middle of the first GdkWindow found that belongs to @widget.
104  * For %GTK_NO_WINDOW widgets like GtkButton, this will often be an
105  * input-only event window. For other widgets, this is usually widget->window.
106  * Certain caveats should be considered when using this function, in
107  * particular because the mouse pointer is warped to the key press
108  * location, see gdk_test_simulate_key() for details.
109  *
110  * Returns: wether all actions neccessary for the key event simulation were carried out successfully.
111  **/
112 gboolean
113 gtk_test_widget_send_key (GtkWidget      *widget,
114                           guint           keyval,
115                           GdkModifierType modifiers)
116 {
117   gboolean k1res, k2res;
118   GSList *iwindows = test_find_widget_input_windows (widget, FALSE);
119   if (!iwindows)
120     iwindows = test_find_widget_input_windows (widget, TRUE);
121   if (!iwindows)
122     return FALSE;
123   k1res = gdk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, GDK_KEY_PRESS);
124   k2res = gdk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, GDK_KEY_RELEASE);
125   g_slist_free (iwindows);
126   return k1res && k2res;
127 }
128
129 /**
130  * gtk_test_widget_click
131  * @widget: Widget to generate a button click on.
132  * @button: Number of the pointer button for the event, usually 1, 2 or 3.
133  * @modifiers: Keyboard modifiers the event is setup with.
134  *
135  * This function will generate a @button click (button press and button
136  * release event) in the middle of the first GdkWindow found that belongs
137  * to @widget.
138  * For %GTK_NO_WINDOW widgets like GtkButton, this will often be an
139  * input-only event window. For other widgets, this is usually widget->window.
140  * Certain caveats should be considered when using this function, in
141  * particular because the mouse pointer is warped to the button click
142  * location, see gdk_test_simulate_button() for details.
143  *
144  * Returns: wether all actions neccessary for the button click simulation were carried out successfully.
145  **/
146 gboolean
147 gtk_test_widget_click (GtkWidget      *widget,
148                        guint           button,
149                        GdkModifierType modifiers)
150 {
151   gboolean b1res, b2res;
152   GSList *iwindows = test_find_widget_input_windows (widget, FALSE);
153   if (!iwindows)
154     iwindows = test_find_widget_input_windows (widget, TRUE);
155   if (!iwindows)
156     return FALSE;
157   b1res = gdk_test_simulate_button (iwindows->data, -1, -1, button, modifiers, GDK_BUTTON_PRESS);
158   b2res = gdk_test_simulate_button (iwindows->data, -1, -1, button, modifiers, GDK_BUTTON_RELEASE);
159   g_slist_free (iwindows);
160   return b1res && b2res;
161 }
162
163 /**
164  * gtk_test_spin_button_click
165  * @spinner: valid GtkSpinButton widget.
166  * @button:  Number of the pointer button for the event, usually 1, 2 or 3.
167  * @upwards: %TRUE for upwards arrow click, %FALSE for downwards arrow click.
168  *
169  * This function will generate a @button click in the upwards or downwards
170  * spin button arrow areas, usually leading to an increase or decrease of
171  * spin button's value.
172  *
173  * Returns: wether all actions neccessary for the button click simulation were carried out successfully.
174  **/
175 gboolean
176 gtk_test_spin_button_click (GtkSpinButton  *spinner,
177                             guint           button,
178                             gboolean        upwards)
179 {
180   gboolean b1res = FALSE, b2res = FALSE;
181   if (spinner->panel)
182     {
183       gint width, height, pos;
184       gdk_drawable_get_size (spinner->panel, &width, &height);
185       pos = upwards ? 0 : height - 1;
186       b1res = gdk_test_simulate_button (spinner->panel, width - 1, pos, button, 0, GDK_BUTTON_PRESS);
187       b2res = gdk_test_simulate_button (spinner->panel, width - 1, pos, button, 0, GDK_BUTTON_RELEASE);
188     }
189   return b1res && b2res;
190 }
191
192 /**
193  * gtk_test_find_label
194  * @widget:        Valid label or container widget.
195  * @label_pattern: Shell-glob pattern to match a label string.
196  *
197  * This function will search @widget and all its descendants for a GtkLabel
198  * widget with a text string matching @label_pattern.
199  * The @label_pattern may contain asterisks '*' and question marks '?' as
200  * placeholders, g_pattern_match() is used for the matching.
201  * Note that locales other than "C" tend to alter (translate" label strings,
202  * so this function is genrally only useful in test programs with
203  * predetermined locales, see gtk_test_init() for more details.
204  *
205  * Returns: a GtkLabel widget if any is found.
206  **/
207 GtkWidget*
208 gtk_test_find_label (GtkWidget    *widget,
209                      const gchar  *label_pattern)
210 {
211   if (GTK_IS_LABEL (widget))
212     {
213       const gchar *text = gtk_label_get_text (GTK_LABEL (widget));
214       if (g_pattern_match_simple (label_pattern, text))
215         return widget;
216     }
217   if (GTK_IS_CONTAINER (widget))
218     {
219       GList *node, *list = gtk_container_get_children (GTK_CONTAINER (widget));
220       for (node = list; node; node = node->next)
221         {
222           GtkWidget *label = gtk_test_find_label (node->data, label_pattern);
223           if (label)
224             return label;
225         }
226       g_list_free (list);
227     }
228   return NULL;
229 }
230
231 static GList*
232 test_list_descendants (GtkWidget *widget,
233                        GType      widget_type)
234 {
235   GList *results = NULL;
236   if (GTK_IS_CONTAINER (widget))
237     {
238       GList *node, *list = gtk_container_get_children (GTK_CONTAINER (widget));
239       for (node = list; node; node = node->next)
240         {
241           if (!widget_type || g_type_is_a (G_OBJECT_TYPE (node->data), widget_type))
242             results = g_list_prepend (results, node->data);
243           else
244             results = g_list_concat (results, test_list_descendants (node->data, widget_type));
245         }
246       g_list_free (list);
247     }
248   return results;
249 }
250
251 static int
252 widget_geo_dist (GtkWidget *a,
253                  GtkWidget *b,
254                  GtkWidget *base)
255 {
256   int ax0, ay0, ax1, ay1, bx0, by0, bx1, by1, xdist = 0, ydist = 0;
257   if (!gtk_widget_translate_coordinates (a, base, 0, 0, &ax0, &ay0) ||
258       !gtk_widget_translate_coordinates (a, base, a->allocation.width, a->allocation.height, &ax1, &ay1))
259     return -G_MAXINT;
260   if (!gtk_widget_translate_coordinates (b, base, 0, 0, &bx0, &by0) ||
261       !gtk_widget_translate_coordinates (b, base, b->allocation.width, b->allocation.height, &bx1, &by1))
262     return +G_MAXINT;
263   if (bx0 >= ax1)
264     xdist = bx0 - ax1;
265   else if (ax0 >= bx1)
266     xdist = ax0 - bx1;
267   if (by0 >= ay1)
268     ydist = by0 - ay1;
269   else if (ay0 >= by1)
270     ydist = ay0 - by1;
271   return xdist + ydist;
272 }
273
274 static int
275 widget_geo_cmp (gconstpointer a,
276                 gconstpointer b,
277                 gpointer      user_data)
278 {
279   gpointer *data = user_data;
280   GtkWidget *wa = (void*) a, *wb = (void*) b, *toplevel = data[0], *base_widget = data[1];
281   int adist = widget_geo_dist (wa, base_widget, toplevel);
282   int bdist = widget_geo_dist (wb, base_widget, toplevel);
283   return adist > bdist ? +1 : adist == bdist ? 0 : -1;
284 }
285
286 /**
287  * gtk_test_find_sibling
288  * @base_widget:        Valid widget, part of a widget hierarchy
289  * @widget_type:        Type of a aearched for sibling widget
290  *
291  * This function will search siblings of @base_widget and siblings of its
292  * ancestors for all widgets matching @widget_type.
293  * Of the matching widgets, the one that is geometrically closest to
294  * @base_widget will be returned.
295  * The general purpose of this function is to find the most likely "action"
296  * widget, relative to another labeling widget. Such as finding a
297  * button or text entry widget, given it's corresponding label widget.
298  *
299  * Returns: a widget of type @widget_type if any is found.
300  **/
301 GtkWidget*
302 gtk_test_find_sibling (GtkWidget *base_widget,
303                        GType      widget_type)
304 {
305   GList *siblings = NULL;
306   GtkWidget *tmpwidget = base_widget;
307   gpointer data[2];
308   /* find all sibling candidates */
309   while (tmpwidget)
310     {
311       tmpwidget = tmpwidget->parent;
312       siblings = g_list_concat (siblings, test_list_descendants (tmpwidget, widget_type));
313     }
314   /* sort them by distance to base_widget */
315   data[0] = gtk_widget_get_toplevel (base_widget);
316   data[1] = base_widget;
317   siblings = g_list_sort_with_data (siblings, widget_geo_cmp, data);
318   /* pick nearest != base_widget */
319   siblings = g_list_remove (siblings, base_widget);
320   tmpwidget = siblings ? siblings->data : NULL;
321   g_list_free (siblings);
322   return tmpwidget;
323 }
324
325 /**
326  * gtk_test_find_widget
327  * @widget:        Container widget, usually a GtkWindow.
328  * @label_pattern: Shell-glob pattern to match a label string.
329  * @widget_type:   Type of a aearched for label sibling widget.
330  *
331  * This function will search the descendants of @widget for a widget
332  * of type @widget_type that has a label matching @label_pattern next
333  * to it. This is most useful for automated GUI testing, e.g. to find
334  * the "OK" button in a dialog and synthesize clicks on it.
335  * However see gtk_test_find_label(), gtk_test_find_sibling() and
336  * gtk_test_widget_click() for possible caveats involving the search of
337  * such widgets and synthesizing widget events.
338  *
339  * Returns: a valid widget if any is found or %NULL.
340  **/
341 GtkWidget*
342 gtk_test_find_widget (GtkWidget    *widget,
343                       const gchar  *label_pattern,
344                       GType         widget_type)
345 {
346   GtkWidget *label = gtk_test_find_label (widget, label_pattern);
347   if (!label)
348     label = gtk_test_find_label (gtk_widget_get_toplevel (widget), label_pattern);
349   if (label)
350     return gtk_test_find_sibling (label, widget_type);
351   return NULL;
352 }
353
354 /**
355  * gtk_test_slider_set_perc
356  * @widget:     valid widget pointer.
357  * @percentage: value between 0 and 100.
358  *
359  * This function will adjust theslider position of all GtkRange
360  * based widgets, such as scrollbars or scales, it'll also adjust
361  * spin buttons. The adjustment value of tehse widgets is set to
362  * a value between the lower and upper limits, according to the
363  * @percentage argument.
364  **/
365 void
366 gtk_test_slider_set_perc (GtkWidget      *widget,
367                           double          percentage)
368 {
369   GtkAdjustment *adjustment = NULL;
370   if (GTK_IS_RANGE (widget))
371     adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
372   else if (GTK_IS_SPIN_BUTTON (widget))
373     adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
374   if (adjustment)
375     gtk_adjustment_set_value (adjustment, adjustment->lower + (adjustment->upper - adjustment->lower - adjustment->page_size) * percentage * 0.01);
376 }
377
378 /**
379  * gtk_test_slider_get_value
380  * @widget:     valid widget pointer.
381  *
382  * Retrive the literal adjustment value for GtkRange based
383  * widgets and spin buttons. Note that the value returned by
384  * this function is anything between the lower and upper bounds
385  * of the adjustment belonging to @widget, and is not a percentage
386  * as passed in to gtk_test_slider_set_perc().
387  *
388  * Returns: adjustment->value for an adjustment belonging to @widget.
389  **/
390 double
391 gtk_test_slider_get_value (GtkWidget *widget)
392 {
393   GtkAdjustment *adjustment = NULL;
394   if (GTK_IS_RANGE (widget))
395     adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
396   else if (GTK_IS_SPIN_BUTTON (widget))
397     adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
398   return adjustment ? adjustment->value : 0;
399 }
400
401 /**
402  * gtk_test_text_set
403  * @widget:     valid widget pointer.
404  * @string:     a 0-terminated C string
405  *
406  * Set the text string of @widget to @string if it is a GtkLabel,
407  * GtkEditable (entry and text widgets) or GtkTextView.
408  **/
409 void
410 gtk_test_text_set (GtkWidget   *widget,
411                    const gchar *string)
412 {
413   if (GTK_IS_LABEL (widget))
414     gtk_label_set_text (GTK_LABEL (widget), string);
415   else if (GTK_IS_EDITABLE (widget))
416     {
417       int pos = 0;
418       gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1);
419       gtk_editable_insert_text (GTK_EDITABLE (widget), string, -1, &pos);
420     }
421   else if (GTK_IS_TEXT_VIEW (widget))
422     {
423       GtkTextBuffer *tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
424       gtk_text_buffer_set_text (tbuffer, string, -1);
425     }
426 }
427
428 /**
429  * gtk_test_text_get
430  * @widget:     valid widget pointer.
431  *
432  * Retrive the text string of @widget if it is a GtkLabel,
433  * GtkEditable (entry and text widgets) or GtkTextView.
434  *
435  * Returns: new 0-terminated C string, needs to be releaed with g_free().
436  **/
437 gchar*
438 gtk_test_text_get (GtkWidget *widget)
439 {
440   if (GTK_IS_LABEL (widget))
441     return g_strdup (gtk_label_get_text (GTK_LABEL (widget)));
442   else if (GTK_IS_EDITABLE (widget))
443     {
444       return g_strdup (gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1));
445     }
446   else if (GTK_IS_TEXT_VIEW (widget))
447     {
448       GtkTextBuffer *tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
449       GtkTextIter start, end;
450       gtk_text_buffer_get_start_iter (tbuffer, &start);
451       gtk_text_buffer_get_end_iter (tbuffer, &end);
452       return gtk_text_buffer_get_text (tbuffer, &start, &end, FALSE);
453     }
454   return NULL;
455 }
456
457 /**
458  * gtk_test_create_widget
459  * @widget_type:        valid widget type.
460  * @first_property_name: Name of first property to set or %NULL
461  *
462  * This function wraps g_object_new() for widget types.
463  * It'll automatically show all created non window widgets, also
464  * g_object_ref_sink() them (to keep them alive across a running test)
465  * and set them up for destruction during the next test teardown phase.
466  *
467  * Returns: a newly created widget.
468  */
469 GtkWidget*
470 gtk_test_create_widget (GType        widget_type,
471                         const gchar *first_property_name,
472                         ...)
473 {
474   GtkWidget *widget;
475   va_list var_args;
476   g_return_val_if_fail (g_type_is_a (widget_type, GTK_TYPE_WIDGET), NULL);
477   va_start (var_args, first_property_name);
478   widget = (GtkWidget*) g_object_new_valist (widget_type, first_property_name, var_args);
479   va_end (var_args);
480   if (widget)
481     {
482       if (!GTK_IS_WINDOW (widget))
483         gtk_widget_show (widget);
484       g_object_ref_sink (widget);
485       g_test_queue_unref (widget);
486       g_test_queue_destroy ((GDestroyNotify) gtk_widget_destroy, widget);
487     }
488   return widget;
489 }
490
491 static void
492 try_main_quit (void)
493 {
494   if (gtk_main_level())
495     gtk_main_quit();
496 }
497
498 static int
499 test_increment_intp (int *intp)
500 {
501   *intp += 1;
502   return 1; /* TRUE in case we're connected to event signals */
503 }
504
505 /**
506  * gtk_test_display_button_window
507  * @window_title:       Title of the window to be displayed.
508  * @dialog_text:        Text inside the window to be displayed.
509  * @...:                %NULL terminated list of (const char *label, int *nump) pairs.
510  *
511  * Create a window with window title @window_title, text contents @dialog_text,
512  * and a number of buttons, according to the paired argument list given
513  * as @... parameters.
514  * Each button is created with a @label and a ::clicked signal handler that
515  * incremrents the integer stored in @nump.
516  * The window will be automatically shown with gtk_widget_show_now() after
517  * creation, so when this function returns it has already been mapped,
518  * resized and positioned on screen.
519  * The window will quit any running gtk_main()-loop when destroyed, and it
520  * will automatically be destroyed upon test function teardown.
521  *
522  * Returns: a widget pointer to the newly created GtkWindow.
523  **/
524 GtkWidget*
525 gtk_test_display_button_window (const gchar *window_title,
526                                 const gchar *dialog_text,
527                                 ...) /* NULL terminated list of (label, &int) pairs */
528 {
529   va_list var_args;
530   GtkWidget *window = gtk_test_create_widget (GTK_TYPE_WINDOW, "title", window_title, NULL);
531   GtkWidget *vbox = gtk_test_create_widget (GTK_TYPE_VBOX, "parent", window, NULL);
532   const char *arg1;
533   gtk_test_create_widget (GTK_TYPE_LABEL, "label", dialog_text, "parent", vbox, NULL);
534   g_signal_connect (window, "destroy", G_CALLBACK (try_main_quit), NULL);
535   va_start (var_args, dialog_text);
536   arg1 = va_arg (var_args, const char*);
537   while (arg1)
538     {
539       int *arg2 = va_arg (var_args, int*);
540       GtkWidget *button = gtk_test_create_widget (GTK_TYPE_BUTTON, "label", arg1, "parent", vbox, NULL);
541       g_signal_connect_swapped (button, "clicked", G_CALLBACK (test_increment_intp), arg2);
542       arg1 = va_arg (var_args, const char*);
543     }
544   va_end (var_args);
545   gtk_widget_show_all (vbox);
546   gtk_widget_show_now (window);
547   while (gtk_events_pending ())
548     gtk_main_iteration ();
549   return window;
550 }
551
552 /**
553  * gtk_test_create_simple_window
554  * @window_title:       Title of the window to be displayed.
555  * @dialog_text:        Text inside the window to be displayed.
556  *
557  * Create a simple window with window title @window_title and
558  * text contents @dialog_text.
559  * The window will quit any running gtk_main()-loop when destroyed, and it
560  * will automatically be destroyed upon test function teardown.
561  *
562  * Returns: a widget pointer to the newly created GtkWindow.
563  **/
564 GtkWidget*
565 gtk_test_create_simple_window (const gchar *window_title,
566                                const gchar *dialog_text)
567 {
568   GtkWidget *window = gtk_test_create_widget (GTK_TYPE_WINDOW, "title", window_title, NULL);
569   GtkWidget *vbox = gtk_test_create_widget (GTK_TYPE_VBOX, "parent", window, NULL);
570   gtk_test_create_widget (GTK_TYPE_LABEL, "label", dialog_text, "parent", vbox, NULL);
571   g_signal_connect (window, "destroy", G_CALLBACK (try_main_quit), NULL);
572   gtk_widget_show_all (vbox);
573   return window;
574 }
575
576 static GType *all_registered_types = NULL;
577 static guint  n_all_registered_types = 0;
578
579 /**
580  * gtk_test_list_all_types
581  * @n_types: location to store number of types
582  * @returns: 0-terminated array of type ids
583  *
584  * Return the type ids that have been registered after
585  * calling gtk_test_register_all_types().
586  **/
587 const GType*
588 gtk_test_list_all_types (guint *n_types)
589 {
590   if (n_types)
591     *n_types = n_all_registered_types;
592   return all_registered_types;
593 }
594
595 /**
596  * gtk_test_register_all_types
597  *
598  * Force registration of all core Gtk+ and Gdk object types.
599  * This allowes to refer to any of those object types via
600  * g_type_from_name() after calling this function.
601  **/
602 void
603 gtk_test_register_all_types (void)
604 {
605   if (!all_registered_types)
606     {
607       const guint max_gtk_types = 999;
608       GType *tp;
609       all_registered_types = g_new0 (GType, max_gtk_types);
610       tp = all_registered_types;
611 #include "gtktypefuncs.c"
612       n_all_registered_types = tp - all_registered_types;
613       g_assert (n_all_registered_types + 1 < max_gtk_types);
614       *tp = 0;
615     }
616 }
617
618 #define __GTK_TEST_UTILS_C__
619 #include "gtkaliasdef.c"