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