1 /* Gtk+ testing utilities
2 * Copyright (C) 2007 Tim Janik
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 #include "gtktestutils.h"
21 #include <gdk/gdkkeysyms.h>
31 /* --- test utilities --- */
34 * @argc: Address of the <parameter>argc</parameter> parameter of the
35 * main() function. Changed if any arguments were handled.
36 * @argv: Address of the <parameter>argv</parameter> parameter of main().
37 * Any parameters understood by g_test_init() or gtk_init() are
38 * stripped before return.
40 * This function is used to initialize a Gtk+ test program.
41 * It will in turn call g_test_init() and gtk_init() to properly
42 * initialize the testing framework and graphical toolkit.
43 * It'll also set the program's locale to "C" and prevent loading of
44 * rc files and Gtk+ modules. This is done to make tets program
45 * environments as deterministic as possible.
46 * Like gtk_init() and g_test_init(), any known arguments will be
47 * processed and stripped from @argc and @argv.
50 gtk_test_init (int *argcp,
55 * - call g_test_init();
57 * - prevent RC files from loading;
58 * - prevent Gtk modules from loading;
59 * - supply mock object for GtkSettings
61 * - this function could install a mock object around GtkSettings
63 // FIXME: g_test_init (argcp, argvp, NULL);
64 g_setenv ("GTK_MODULES", "", TRUE);
65 g_setenv ("GTK2_RC_FILES", "/dev/null", TRUE);
66 gtk_disable_setlocale();
67 setlocale (LC_ALL, "C");
68 gtk_init (argcp, argvp);
72 test_find_widget_input_windows (GtkWidget *widget,
75 GList *node, *children;
76 GSList *matches = NULL;
78 gdk_window_get_user_data (widget->window, &udata);
79 if (udata == widget && (!input_only || (GDK_IS_WINDOW (widget->window) && GDK_WINDOW_OBJECT (widget->window)->input_only)))
80 matches = g_slist_prepend (matches, widget->window);
81 children = gdk_window_get_children (gtk_widget_get_parent_window (widget));
82 for (node = children; node; node = node->next)
84 gdk_window_get_user_data (node->data, &udata);
85 if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && GDK_WINDOW_OBJECT (node->data)->input_only)))
86 matches = g_slist_prepend (matches, node->data);
88 return g_slist_reverse (matches);
92 * gtk_test_simulate_key
93 * @window: Gdk window to simulate a key event for.
94 * @x: x coordinate within @window for the key event.
95 * @y: y coordinate within @window for the key event.
96 * @keyval: A Gdk keyboard value.
97 * @modifiers: Keyboard modifiers the event is setup with.
98 * @press_or_release: %TRUE to generate key press events, %FALSE to generate key release events.
100 * This function is intended to be used in Gtk+ test programs.
101 * If (@x,@y) are > (-1,-1), it will warp the mouse pointer to
102 * the given (@x,@y) corrdinates within @window and simulate a
103 * key press or release event.
104 * When the mouse pointer is warped to the target location, use
105 * of this function outside of test programs that run in their
106 * own virtual windowing system (e.g. Xvfb) is not recommended.
107 * If (@x,@y) are passed as (-1,-1), the mouse pointer will not
108 * be warped and @window origin will be used as mouse pointer
109 * location for the event.
110 * Also, gtk_test_simulate_key() is a fairly low level function,
111 * for most testing purposes, gtk_test_widget_send_key() is the
112 * right function to call which will generate a key press event
113 * followed by its accompanying key release event.
115 * Returns: wether all actions neccessary for a key event simulation were carried out successfully.
118 gtk_test_simulate_key (GdkWindow *window,
122 GdkModifierType modifiers,
123 gboolean press_or_release)
125 GdkScreen *screen = gdk_colormap_get_screen (gdk_drawable_get_colormap (window));
126 GdkKeymapKey *keys = NULL;
136 gdk_drawable_get_size (window, &x, &y);
140 xev.type = press_or_release ? KeyPress : KeyRelease;
141 xev.display = GDK_DRAWABLE_XDISPLAY (window);
142 xev.window = GDK_WINDOW_XID (window);
143 xev.root = RootWindow (xev.display, GDK_SCREEN_XNUMBER (screen));
150 xev.state = modifiers;
152 success = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_for_display (gdk_drawable_get_display (window)), keyval, &keys, &n_keys);
153 success &= n_keys > 0;
157 for (i = 0; i < n_keys; i++)
158 if (keys[i].group == 0 && keys[i].level == 0)
160 xev.keycode = keys[i].keycode;
163 if (i >= n_keys) /* no match for group==0 and level==0 */
164 xev.keycode = keys[0].keycode;
169 gdk_error_trap_push ();
170 xev.same_screen = XTranslateCoordinates (xev.display, xev.window, xev.root,
171 xev.x, xev.y, &xev.x_root, &xev.y_root,
174 xev.subwindow = xev.window;
175 success &= xev.same_screen;
176 if (x >= 0 && y >= 0)
177 success &= 0 != XWarpPointer (xev.display, None, xev.window, 0, 0, 0, 0, xev.x, xev.y);
178 success &= 0 != XSendEvent (xev.display, xev.window, True, press_or_release ? KeyPressMask : KeyReleaseMask, (XEvent*) &xev);
179 XSync (xev.display, False);
180 success &= 0 == gdk_error_trap_pop();
185 * gtk_test_widget_send_key
186 * @widget: Widget to generate a key press and release on.
187 * @keyval: A Gdk keyboard value.
188 * @modifiers: Keyboard modifiers the event is setup with.
190 * This function will generate keyboard press and release events in
191 * the middle of the first GdkWindow found that belongs to @widget.
192 * For %GTK_NO_WINDOW widgets like GtkButton, this will often be an
193 * input-only event window. For other widgets, this is usually widget->window.
194 * Certain caveats should be considered when using this function, in
195 * particular because the mouse pointer is warped to the key press
196 * location, see gtk_test_simulate_key() for details.
198 * Returns: wether all actions neccessary for the key event simulation were carried out successfully.
201 gtk_test_widget_send_key (GtkWidget *widget,
203 GdkModifierType modifiers)
205 gboolean k1res, k2res;
206 GSList *iwindows = test_find_widget_input_windows (widget, FALSE);
208 iwindows = test_find_widget_input_windows (widget, TRUE);
211 k1res = gtk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, TRUE);
212 k2res = gtk_test_simulate_key (iwindows->data, -1, -1, keyval, modifiers, FALSE);
213 g_slist_free (iwindows);
214 return k1res && k2res;
218 * gtk_test_simulate_button
219 * @window: Gdk window to simulate a button event for.
220 * @x: x coordinate within @window for the button event.
221 * @y: y coordinate within @window for the button event.
222 * @button: Number of the pointer button for the event, usually 1, 2 or 3.
223 * @modifiers: Keyboard modifiers the event is setup with.
224 * @press_or_release: %TRUE to generate button press events, %FALSE to generate button release events.
226 * This function is intended to be used in Gtk+ test programs.
227 * It will warp the mouse pointer to the given (@x,@y) corrdinates
228 * within @window and simulate a button press or release event.
229 * Because the mouse pointer needs to be warped to the target
230 * location, use of this function outside of test programs that
231 * run in their own virtual windowing system (e.g. Xvfb) is not
233 * Also, gtk_test_simulate_button() is a fairly low level function,
234 * for most testing purposes, gtk_test_widget_click() is the right
235 * function to call which will generate a button press event followed
236 * by its accompanying button release event.
238 * Returns: wether all actions neccessary for a button event simulation were carried out successfully.
241 gtk_test_simulate_button (GdkWindow *window,
244 guint button, /*1..3*/
245 GdkModifierType modifiers,
246 gboolean press_or_release)
248 GdkScreen *screen = gdk_colormap_get_screen (gdk_drawable_get_colormap (window));
256 gdk_drawable_get_size (window, &x, &y);
260 xev.type = press_or_release ? ButtonPress : ButtonRelease;
261 xev.display = GDK_DRAWABLE_XDISPLAY (window);
262 xev.window = GDK_WINDOW_XID (window);
263 xev.root = RootWindow (xev.display, GDK_SCREEN_XNUMBER (screen));
270 xev.state = modifiers;
272 gdk_error_trap_push ();
273 xev.same_screen = XTranslateCoordinates (xev.display, xev.window, xev.root,
274 xev.x, xev.y, &xev.x_root, &xev.y_root,
277 xev.subwindow = xev.window;
278 gboolean success = xev.same_screen;
279 success &= 0 != XWarpPointer (xev.display, None, xev.window, 0, 0, 0, 0, xev.x, xev.y);
280 success &= 0 != XSendEvent (xev.display, xev.window, True, press_or_release ? ButtonPressMask : ButtonReleaseMask, (XEvent*) &xev);
281 XSync (xev.display, False);
282 success &= 0 == gdk_error_trap_pop();
287 * gtk_test_widget_click
288 * @widget: Widget to generate a button click on.
289 * @button: Number of the pointer button for the event, usually 1, 2 or 3.
290 * @modifiers: Keyboard modifiers the event is setup with.
292 * This function will generate a @button click (button press and button
293 * release event) in the middle of the first GdkWindow found that belongs
295 * For %GTK_NO_WINDOW widgets like GtkButton, this will often be an
296 * input-only event window. For other widgets, this is usually widget->window.
297 * Certain caveats should be considered when using this function, in
298 * particular because the mouse pointer is warped to the button click
299 * location, see gtk_test_simulate_button() for details.
301 * Returns: wether all actions neccessary for the button click simulation were carried out successfully.
304 gtk_test_widget_click (GtkWidget *widget,
306 GdkModifierType modifiers)
308 gboolean b1res, b2res;
309 GSList *iwindows = test_find_widget_input_windows (widget, FALSE);
311 iwindows = test_find_widget_input_windows (widget, TRUE);
314 b1res = gtk_test_simulate_button (iwindows->data, -1, -1, button, modifiers, TRUE);
315 b2res = gtk_test_simulate_button (iwindows->data, -1, -1, button, modifiers, FALSE);
316 g_slist_free (iwindows);
317 return b1res && b2res;
321 * gtk_test_spin_button_click
322 * @spinner: valid GtkSpinButton widget.
323 * @button: Number of the pointer button for the event, usually 1, 2 or 3.
324 * @upwards: %TRUE for upwards arrow click, %FALSE for downwards arrow click.
326 * This function will generate a @button click in the upwards or downwards
327 * spin button arrow areas, usually leading to an increase or decrease of
328 * spin button's value.
330 * Returns: wether all actions neccessary for the button click simulation were carried out successfully.
333 gtk_test_spin_button_click (GtkSpinButton *spinner,
337 gboolean b1res = FALSE, b2res = FALSE;
340 gint width, height, pos;
341 gdk_drawable_get_size (spinner->panel, &width, &height);
342 pos = upwards ? 0 : height - 1;
343 b1res = gtk_test_simulate_button (spinner->panel, width - 1, pos, button, 0, TRUE);
344 b2res = gtk_test_simulate_button (spinner->panel, width - 1, pos, button, 0, FALSE);
346 return b1res && b2res;
350 * gtk_test_find_label
351 * @widget: Valid label or container widget.
352 * @label_pattern: Shell-glob pattern to match a label string.
354 * This function will search @widget and all its descendants for a GtkLabel
355 * widget with a text string matching @label_pattern.
356 * The @label_pattern may contain asterisks '*' and question marks '?' as
357 * placeholders, g_pattern_match() is used for the matching.
358 * Note that locales other than "C" tend to alter (translate" label strings,
359 * so this function is genrally only useful in test programs with
360 * predetermined locales, see gtk_test_init() for more details.
362 * Returns: a GtkLabel widget if any is found.
365 gtk_test_find_label (GtkWidget *widget,
366 const gchar *label_pattern)
368 if (GTK_IS_LABEL (widget))
370 const gchar *text = gtk_label_get_text (GTK_LABEL (widget));
371 if (g_pattern_match_simple (label_pattern, text))
374 if (GTK_IS_CONTAINER (widget))
376 GList *node, *list = gtk_container_get_children (GTK_CONTAINER (widget));
377 for (node = list; node; node = node->next)
379 GtkWidget *label = gtk_test_find_label (node->data, label_pattern);
389 test_list_descendants (GtkWidget *widget,
392 GList *results = NULL;
393 if (GTK_IS_CONTAINER (widget))
395 GList *node, *list = gtk_container_get_children (GTK_CONTAINER (widget));
396 for (node = list; node; node = node->next)
398 if (!widget_type || g_type_is_a (G_OBJECT_TYPE (node->data), widget_type))
399 results = g_list_prepend (results, node->data);
401 results = g_list_concat (results, test_list_descendants (node->data, widget_type));
409 widget_geo_dist (GtkWidget *a,
413 int ax0, ay0, ax1, ay1, bx0, by0, bx1, by1, xdist = 0, ydist = 0;
414 if (!gtk_widget_translate_coordinates (a, base, 0, 0, &ax0, &ay0) ||
415 !gtk_widget_translate_coordinates (a, base, a->allocation.width, a->allocation.height, &ax1, &ay1))
417 if (!gtk_widget_translate_coordinates (b, base, 0, 0, &bx0, &by0) ||
418 !gtk_widget_translate_coordinates (b, base, b->allocation.width, b->allocation.height, &bx1, &by1))
428 return xdist + ydist;
432 widget_geo_cmp (gconstpointer a,
436 gpointer *data = user_data;
437 GtkWidget *wa = (void*) a, *wb = (void*) b, *toplevel = data[0], *base_widget = data[1];
438 int adist = widget_geo_dist (wa, base_widget, toplevel);
439 int bdist = widget_geo_dist (wb, base_widget, toplevel);
440 return adist > bdist ? +1 : adist == bdist ? 0 : -1;
444 * gtk_test_find_sibling
445 * @base_widget: Valid widget, part of a widget hierarchy
446 * @widget_type: Type of a aearched for sibling widget
448 * This function will search siblings of @base_widget and siblings of its
449 * ancestors for all widgets matching @widget_type.
450 * Of the matching widgets, the one that is geometrically closest to
451 * @base_widget will be returned.
452 * The general purpose of this function is to find the most likely "action"
453 * widget, relative to another labeling widget. Such as finding a
454 * button or text entry widget, given it's corresponding label widget.
456 * Returns: a widget of type @widget_type if any is found.
459 gtk_test_find_sibling (GtkWidget *base_widget,
462 GList *siblings = NULL;
463 GtkWidget *tmpwidget = base_widget;
465 /* find all sibling candidates */
468 tmpwidget = tmpwidget->parent;
469 siblings = g_list_concat (siblings, test_list_descendants (tmpwidget, widget_type));
471 /* sort them by distance to base_widget */
472 data[0] = gtk_widget_get_toplevel (base_widget);
473 data[1] = base_widget;
474 siblings = g_list_sort_with_data (siblings, widget_geo_cmp, data);
475 /* pick nearest != base_widget */
476 siblings = g_list_remove (siblings, base_widget);
477 tmpwidget = siblings ? siblings->data : NULL;
478 g_list_free (siblings);
483 * gtk_test_find_widget
484 * @widget: Container widget, usually a GtkWindow.
485 * @label_pattern: Shell-glob pattern to match a label string.
486 * @widget_type: Type of a aearched for label sibling widget.
488 * This function will search the descendants of @widget for a widget
489 * of type @widget_type that has a label matching @label_pattern next
490 * to it. This is most useful for automated GUI testing, e.g. to find
491 * the "OK" button in a dialog and synthesize clicks on it.
492 * However see gtk_test_find_label(), gtk_test_find_sibling() and
493 * gtk_test_widget_click() for possible caveats involving the search of
494 * such widgets and synthesizing widget events.
496 * Returns: a valid widget if any is found or %NULL.
499 gtk_test_find_widget (GtkWidget *widget,
500 const gchar *label_pattern,
503 GtkWidget *label = gtk_test_find_label (widget, label_pattern);
505 label = gtk_test_find_label (gtk_widget_get_toplevel (widget), label_pattern);
507 return gtk_test_find_sibling (label, widget_type);
512 * gtk_test_slider_set_perc
513 * @widget: valid widget pointer.
514 * @percentage: value between 0 and 100.
516 * This function will adjust theslider position of all GtkRange
517 * based widgets, such as scrollbars or scales, it'll also adjust
518 * spin buttons. The adjustment value of tehse widgets is set to
519 * a value between the lower and upper limits, according to the
520 * @percentage argument.
523 gtk_test_slider_set_perc (GtkWidget *widget,
526 GtkAdjustment *adjustment = NULL;
527 if (GTK_IS_RANGE (widget))
528 adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
529 else if (GTK_IS_SPIN_BUTTON (widget))
530 adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
532 gtk_adjustment_set_value (adjustment, adjustment->lower + (adjustment->upper - adjustment->lower - adjustment->page_size) * percentage * 0.01);
536 * gtk_test_slider_get_value
537 * @widget: valid widget pointer.
539 * Retrive the literal adjustment value for GtkRange based
540 * widgets and spin buttons. Note that the value returned by
541 * this function is anything between the lower and upper bounds
542 * of the adjustment belonging to @widget, and is not a percentage
543 * as passed in to gtk_test_slider_set_perc().
545 * Returns: adjustment->value for an adjustment belonging to @widget.
548 gtk_test_slider_get_value (GtkWidget *widget)
550 GtkAdjustment *adjustment = NULL;
551 if (GTK_IS_RANGE (widget))
552 adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
553 else if (GTK_IS_SPIN_BUTTON (widget))
554 adjustment = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget));
555 return adjustment ? adjustment->value : 0;
560 * @widget: valid widget pointer.
561 * @string: a 0-terminated C string
563 * Set the text string of @widget to @string if it is a GtkLabel,
564 * GtkEditable (entry and text widgets) or GtkTextView.
567 gtk_test_text_set (GtkWidget *widget,
570 if (GTK_IS_LABEL (widget))
571 gtk_label_set_text (GTK_LABEL (widget), string);
572 else if (GTK_IS_EDITABLE (widget))
575 gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1);
576 gtk_editable_insert_text (GTK_EDITABLE (widget), string, -1, &pos);
578 else if (GTK_IS_TEXT_VIEW (widget))
580 GtkTextBuffer *tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
581 gtk_text_buffer_set_text (tbuffer, string, -1);
587 * @widget: valid widget pointer.
589 * Retrive the text string of @widget if it is a GtkLabel,
590 * GtkEditable (entry and text widgets) or GtkTextView.
592 * Returns: new 0-terminated C string, needs to be releaed with g_free().
595 gtk_test_text_get (GtkWidget *widget)
597 if (GTK_IS_LABEL (widget))
598 return g_strdup (gtk_label_get_text (GTK_LABEL (widget)));
599 else if (GTK_IS_EDITABLE (widget))
601 return g_strdup (gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1));
603 else if (GTK_IS_TEXT_VIEW (widget))
605 GtkTextBuffer *tbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
606 GtkTextIter start, end;
607 gtk_text_buffer_get_start_iter (tbuffer, &start);
608 gtk_text_buffer_get_end_iter (tbuffer, &end);
609 return gtk_text_buffer_get_text (tbuffer, &start, &end, FALSE);
615 * gtk_test_create_widget
616 * @widget_type: valid widget type.
617 * @first_property_name: Name of first property to set or %NULL
619 * This function wraps g_object_new() for widget types.
620 * It'll automatically show all created non window widgets, also
621 * g_object_ref_sink() them (to keep them alive across a running test)
622 * and set them up for destruction during test teardown phase.
624 * Returns: a newly created widget.
627 gtk_test_create_widget (GType widget_type,
628 const gchar *first_property_name,
633 g_return_val_if_fail (g_type_is_a (widget_type, GTK_TYPE_WIDGET), NULL);
634 va_start (var_args, first_property_name);
635 widget = (GtkWidget*) g_object_new_valist (widget_type, first_property_name, var_args);
639 if (!GTK_IS_WINDOW (widget))
640 gtk_widget_show (widget);
641 g_object_ref_sink (widget);
642 #ifdef __G_TESTFRAMEWORK_H__ /* FIXME */
643 g_test_queue_unref (widget);
644 g_test_queue_destroy ((GDestroyNotify) gtk_widget_destroy, widget);
653 if (gtk_main_level())
658 test_increment_intp (int *intp)
661 return 1; /* TRUE in case we're connected to event signals */
665 * gtk_test_display_button_window
666 * @window_title: Title of the window to be displayed.
667 * @dialog_text: Text inside the window to be displayed.
668 * @...: %NULL terminated list of (const char *label, int *nump) pairs.
670 * Create a window with window title @window_title, text contents @dialog_text,
671 * and a number of buttons, according to the paired argument list given
672 * as @... parameters.
673 * Each button is created with a @label and a ::clicked signal handler that
674 * incremrents the integer stored in @nump.
675 * The window will be automatically shown with gtk_widget_show_now() after
676 * creation, so when this function returns it has already been mapped,
677 * resized and positioned on screen.
678 * The window will quit any running gtk_main()-loop when destroyed, and it
679 * will automatically be destroyed upon test function teardown.
681 * Returns: a widget pointer to the newly created GtkWindow.
684 gtk_test_display_button_window (const gchar *window_title,
685 const gchar *dialog_text,
686 ...) /* NULL terminated list of (label, &int) pairs */
689 GtkWidget *window = gtk_test_create_widget (GTK_TYPE_WINDOW, "title", window_title, NULL);
690 GtkWidget *vbox = gtk_test_create_widget (GTK_TYPE_VBOX, "parent", window, NULL);
692 gtk_test_create_widget (GTK_TYPE_LABEL, "label", dialog_text, "parent", vbox, NULL);
693 g_signal_connect (window, "destroy", G_CALLBACK (try_main_quit), NULL);
694 va_start (var_args, dialog_text);
695 arg1 = va_arg (var_args, const char*);
698 int *arg2 = va_arg (var_args, int*);
699 GtkWidget *button = gtk_test_create_widget (GTK_TYPE_BUTTON, "label", arg1, "parent", vbox, NULL);
700 g_signal_connect_swapped (button, "clicked", G_CALLBACK (test_increment_intp), arg2);
701 arg1 = va_arg (var_args, const char*);
704 gtk_widget_show_all (vbox);
705 gtk_widget_show_now (window);
706 while (gtk_events_pending ())
707 gtk_main_iteration ();
712 * gtk_test_create_simple_window
713 * @window_title: Title of the window to be displayed.
714 * @dialog_text: Text inside the window to be displayed.
716 * Create a simple window with window title @window_title and
717 * text contents @dialog_text.
718 * The window will quit any running gtk_main()-loop when destroyed, and it
719 * will automatically be destroyed upon test function teardown.
721 * Returns: a widget pointer to the newly created GtkWindow.
724 gtk_test_create_simple_window (const gchar *window_title,
725 const gchar *dialog_text)
727 GtkWidget *window = gtk_test_create_widget (GTK_TYPE_WINDOW, "title", window_title, NULL);
728 GtkWidget *vbox = gtk_test_create_widget (GTK_TYPE_VBOX, "parent", window, NULL);
729 gtk_test_create_widget (GTK_TYPE_LABEL, "label", dialog_text, "parent", vbox, NULL);
730 g_signal_connect (window, "destroy", G_CALLBACK (try_main_quit), NULL);
731 gtk_widget_show_all (vbox);
736 * gtk_test_xserver_render_sync
737 * @window: a mapped GdkWindow
739 * This function retrives a pixel from @window to force the windowing
740 * system to carry out any pending rendering commands.
741 * This function is intended to be used to syncronize with rendering
742 * pipelines, to benchmark windowing system rendering operations.
745 gtk_test_xserver_render_sync (GdkWindow *window)
747 static GdkImage *p1image = NULL;
748 /* syncronize to X drawing queue, see:
749 * http://mail.gnome.org/archives/gtk-devel-list/2006-October/msg00103.html
751 p1image = gdk_drawable_copy_to_image (window, p1image, 0, 0, 0, 0, 1, 1);
755 * gtk_test_register_all_types
757 * Force registration of all core Gtk+ and Gdk object types.
758 * This allowes to refer to any of those object types via
759 * g_type_from_name() after calling this function.
762 gtk_test_register_all_types (void)
765 #include "gtktypefuncs.c"
768 #define __GTK_TEST_UTILS_C__
769 #include "gtkaliasdef.c"